comparison postproc/rgb2rgb.c @ 2697:1eaf3f89e49f

palette to bgr24
author michael
date Sun, 04 Nov 2001 19:50:29 +0000
parents 2924350d92ed
children 22652c028692
comparison
equal deleted inserted replaced
2696:d0f26c572633 2697:1eaf3f89e49f
179 int i; 179 int i;
180 for(i=0; i<src_size; i++) 180 for(i=0; i<src_size; i++)
181 ((uint32_t *)dst)[i] = ((uint32_t *)palette)[ src[i] ]; 181 ((uint32_t *)dst)[i] = ((uint32_t *)palette)[ src[i] ];
182 } 182 }
183 183
184 /**
185 * Pallete is assumed to contain bgr32
186 */
187 void palette8torgb24(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
188 {
189 int i;
190 /*
191 writes 1 byte o much and might cause alignment issues on some architectures?
192 for(i=0; i<src_size; i++)
193 ((uint32_t *)(&dst[i*3])) = ((uint32_t *)palette)[ src[i] ];
194 */
195 for(i=0; i<src_size; i++)
196 {
197 //FIXME slow?
198 dst[0]= palette[ src[i]*4+0 ];
199 dst[1]= palette[ src[i]*4+1 ];
200 dst[2]= palette[ src[i]*4+2 ];
201 dst+= 3;
202 }
203 }
204
184 void rgb32to16(uint8_t *src, uint8_t *dst, int src_size) 205 void rgb32to16(uint8_t *src, uint8_t *dst, int src_size)
185 { 206 {
186 int i; 207 int i;
187 for(i=0; i<src_size; i+=4) 208 for(i=0; i<src_size; i+=4)
188 { 209 {