Paul B Mahol <one...@gmail.com> writes: > --- > libswscale/rgb2rgb.c | 15 +++++++++++++++ > libswscale/rgb2rgb.h | 1 + > libswscale/swscale_unscaled.c | 1 + > 3 files changed, 17 insertions(+), 0 deletions(-) > > diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c > index 0f07e57..5458d26 100644 > --- a/libswscale/rgb2rgb.c > +++ b/libswscale/rgb2rgb.c > @@ -282,6 +282,21 @@ void rgb15tobgr15(const uint8_t *src, uint8_t > *dst, int src_size) > } > } > > +void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size) > +{ > + uint16_t *dest = (uint16_t*)dst; > + uint16_t *sour = (uint16_t*)src; > + int i; > + int num_pixels = src_size >> 1; > + > + for (i = 0; i < num_pixels; i++) { > + unsigned br; > + unsigned rgb = sour[i]; > + br = rgb & 0x0F0F; > + dest[i] = (br >> 8) | (rgb & 0x00F0) | (br << 8); > + }
Why the messing around with 0x0f0f? Why not something like this: dest[i] = (rgb << 8 | rgb & 0xf0 | rgb >> 8) & 0xfff; -- Måns Rullgård m...@mansr.com _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel