On Tue, Jan 10, 2012 at 06:58:11PM +0000, Måns Rullgård wrote:
> Paul B Mahol <one...@gmail.com> writes:
> > On 1/10/12, Maans Rullgaard <m...@mansr.com> wrote:
> >> Paul B Mahol <one...@gmail.com> writes:
> >>>
> >>> --- a/libswscale/rgb2rgb.c
> >>> +++ b/libswscale/rgb2rgb.c
> >>> @@ -282,6 +282,19 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst,
> >>>
> >>> +void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
> >>> +{
> >>> +    int i;
> >>> +    int num_pixels = src_size >> 1;
> >>> +
> >>> +    for (i = 0; i < num_pixels; i++) {
> >>> +        unsigned br;
> >>> +        unsigned rgb = ((const uint16_t *)src)[i];
> >>> +        br = rgb & 0x0F0F;
> >>> +        ((uint16_t *)dst)[i] = (br >> 8) | (rgb & 0x00F0) | (br << 8);
> >>> +    }
> >>> +}
> >>
> >> Why so complicated?
> >>
> >> I also don't like the look of those pointer casts.
> >
> > I don't follow.
> 
> Can someone explain in more convoluted terms what I mean?  Perhaps then
> there will be something to "follow" for those who like things complicated.

Nobody intentionally writes overcomplicated code, people just do what
they can.  If you see issues or a simpler implementation, just point
it out in a constructive way.  Everybody will be glad to hear your
suggestions.

Thank you, Diego
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to