aboutsummaryrefslogtreecommitdiffstats
path: root/postproc/rgb2rgb.c
diff options
context:
space:
mode:
authorNick Kurshev <nickols_k@mail.ru>2001-11-05 17:46:20 +0000
committerNick Kurshev <nickols_k@mail.ru>2001-11-05 17:46:20 +0000
commit90226a43e64e50d74932210e97fb9d4f27a01fdb (patch)
treee819a17f0dcb558d193761667ab22d00e38d667e /postproc/rgb2rgb.c
parent996e1a7cff7f02f822b992bb83ff87f5c87a74d4 (diff)
downloadffmpeg-90226a43e64e50d74932210e97fb9d4f27a01fdb.tar.gz
Fixed rgb32(24)to16 stuff, rgb32(24)to15 is still broken
Originally committed as revision 2720 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
Diffstat (limited to 'postproc/rgb2rgb.c')
-rw-r--r--postproc/rgb2rgb.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/postproc/rgb2rgb.c b/postproc/rgb2rgb.c
index 19fa7faca0..5779bf5e30 100644
--- a/postproc/rgb2rgb.c
+++ b/postproc/rgb2rgb.c
@@ -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)
{
- unsigned i,num_pixels=src_size/4;
- for(i=0; i<num_pixels; i+=4)
+ unsigned j,i,num_pixels=src_size/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 g= src[i+1];
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)
{
- unsigned i,num_pixels=src_size/4;
- for(i=0; i<num_pixels; i+=4)
+ unsigned j,i,num_pixels=src_size/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 g= src[i+1];
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)
{
- unsigned i,num_pixels=src_size/3;
- for(i=0; i<num_pixels; i+=3)
+ unsigned j,i,num_pixels=src_size/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 g= src[i+1];
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)
{
- unsigned i,num_pixels=src_size/3;
- for(i=0; i<num_pixels; i+=3)
+ unsigned j,i,num_pixels=src_size/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 g= src[i+1];
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);
}
}