Commit e2a0d0c2 authored by nick's avatar nick

Fixed rgb32(24)to16 stuff, rgb32(24)to15 is still broken


git-svn-id: file:///var/local/repositories/mplayer/trunk/postproc@2720 b3059339-0415-0410-9bf9-f77b7e298cf2
parent ff807c4b
...@@ -216,53 +216,57 @@ void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons ...@@ -216,53 +216,57 @@ void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons
void rgb32to16(const uint8_t *src, uint8_t *dst, unsigned src_size) void rgb32to16(const uint8_t *src, uint8_t *dst, unsigned src_size)
{ {
unsigned i,num_pixels=src_size/4; unsigned j,i,num_pixels=src_size/4;
for(i=0; i<num_pixels; i+=4) uint16_t *d = (uint16_t *)dst;
for(i=0,j=0; j<num_pixels; i+=4,j++)
{ {
const int b= src[i+0]; const int b= src[i+0];
const int g= src[i+1]; const int g= src[i+1];
const int r= src[i+2]; const int r= src[i+2];
((uint16_t *)dst)[i]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8); d[j]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
} }
} }
void rgb32to15(const uint8_t *src, uint8_t *dst, unsigned src_size) void rgb32to15(const uint8_t *src, uint8_t *dst, unsigned src_size)
{ {
unsigned i,num_pixels=src_size/4; unsigned j,i,num_pixels=src_size/4;
for(i=0; i<num_pixels; i+=4) uint16_t *d = (uint16_t *)dst;
for(i=0,j=0; j<num_pixels; i+=4,j++)
{ {
const int b= src[i+0]; const int b= src[i+0];
const int g= src[i+1]; const int g= src[i+1];
const int r= src[i+2]; const int r= src[i+2];
((uint16_t *)dst)[i]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7); d[j]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7);
} }
} }
void rgb24to16(const uint8_t *src, uint8_t *dst, unsigned src_size) void rgb24to16(const uint8_t *src, uint8_t *dst, unsigned src_size)
{ {
unsigned i,num_pixels=src_size/3; unsigned j,i,num_pixels=src_size/3;
for(i=0; i<num_pixels; i+=3) uint16_t *d = (uint16_t *)dst;
for(i=0,j=0; j<num_pixels; i+=3,j++)
{ {
const int b= src[i+0]; const int b= src[i+0];
const int g= src[i+1]; const int g= src[i+1];
const int r= src[i+2]; const int r= src[i+2];
((uint16_t *)dst)[i]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8); d[j]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
} }
} }
void rgb24to15(const uint8_t *src, uint8_t *dst, unsigned src_size) void rgb24to15(const uint8_t *src, uint8_t *dst, unsigned src_size)
{ {
unsigned i,num_pixels=src_size/3; unsigned j,i,num_pixels=src_size/3;
for(i=0; i<num_pixels; i+=3) uint16_t *d = (uint16_t *)dst;
for(i=0,j=0; j<num_pixels; i+=3,j++)
{ {
const int b= src[i+0]; const int b= src[i+0];
const int g= src[i+1]; const int g= src[i+1];
const int r= src[i+2]; const int r= src[i+2];
((uint16_t *)dst)[i]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7); d[j]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7);
} }
} }
......
...@@ -216,53 +216,57 @@ void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons ...@@ -216,53 +216,57 @@ void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons
void rgb32to16(const uint8_t *src, uint8_t *dst, unsigned src_size) void rgb32to16(const uint8_t *src, uint8_t *dst, unsigned src_size)
{ {
unsigned i,num_pixels=src_size/4; unsigned j,i,num_pixels=src_size/4;
for(i=0; i<num_pixels; i+=4) uint16_t *d = (uint16_t *)dst;
for(i=0,j=0; j<num_pixels; i+=4,j++)
{ {
const int b= src[i+0]; const int b= src[i+0];
const int g= src[i+1]; const int g= src[i+1];
const int r= src[i+2]; const int r= src[i+2];
((uint16_t *)dst)[i]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8); d[j]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
} }
} }
void rgb32to15(const uint8_t *src, uint8_t *dst, unsigned src_size) void rgb32to15(const uint8_t *src, uint8_t *dst, unsigned src_size)
{ {
unsigned i,num_pixels=src_size/4; unsigned j,i,num_pixels=src_size/4;
for(i=0; i<num_pixels; i+=4) uint16_t *d = (uint16_t *)dst;
for(i=0,j=0; j<num_pixels; i+=4,j++)
{ {
const int b= src[i+0]; const int b= src[i+0];
const int g= src[i+1]; const int g= src[i+1];
const int r= src[i+2]; const int r= src[i+2];
((uint16_t *)dst)[i]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7); d[j]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7);
} }
} }
void rgb24to16(const uint8_t *src, uint8_t *dst, unsigned src_size) void rgb24to16(const uint8_t *src, uint8_t *dst, unsigned src_size)
{ {
unsigned i,num_pixels=src_size/3; unsigned j,i,num_pixels=src_size/3;
for(i=0; i<num_pixels; i+=3) uint16_t *d = (uint16_t *)dst;
for(i=0,j=0; j<num_pixels; i+=3,j++)
{ {
const int b= src[i+0]; const int b= src[i+0];
const int g= src[i+1]; const int g= src[i+1];
const int r= src[i+2]; const int r= src[i+2];
((uint16_t *)dst)[i]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8); d[j]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
} }
} }
void rgb24to15(const uint8_t *src, uint8_t *dst, unsigned src_size) void rgb24to15(const uint8_t *src, uint8_t *dst, unsigned src_size)
{ {
unsigned i,num_pixels=src_size/3; unsigned j,i,num_pixels=src_size/3;
for(i=0; i<num_pixels; i+=3) uint16_t *d = (uint16_t *)dst;
for(i=0,j=0; j<num_pixels; i+=3,j++)
{ {
const int b= src[i+0]; const int b= src[i+0];
const int g= src[i+1]; const int g= src[i+1];
const int r= src[i+2]; const int r= src[i+2];
((uint16_t *)dst)[i]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7); d[j]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment