Hi,

On Thu, Jan 12, 2012 at 12:28 PM, Paul B Mahol <[email protected]> wrote:
> ---
>  libswscale/rgb2rgb.c          |   19 +++++++++++++++++++
>  libswscale/rgb2rgb.h          |    1 +
>  libswscale/swscale_unscaled.c |    1 +
>  3 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
> index 9fbb6cf..70317aa 100644
> --- a/libswscale/rgb2rgb.c
> +++ b/libswscale/rgb2rgb.c
> @@ -183,6 +183,25 @@ void rgb16tobgr32(const uint8_t *src, uint8_t
> *dst, int src_size)
>     }
>  }
>
> +void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size)
> +{
> +    const uint16_t *end;
> +    uint16_t *d = (uint16_t *)dst;
> +    const uint16_t *s = (const uint16_t *)src;
> +    uint16_t rgb, r, g, b;
> +    end = s + src_size / 2;
> +    while (s < end) {
> +        rgb = *s++;
> +        r = rgb & 0xF00;
> +        g = rgb & 0x0F0;
> +        b = rgb & 0x00F;
> +        r = (r << 3) | ((r & 0x800) >> 1);
> +        g = (g << 2) | ((g & 0x080) >> 2);
> +        b = (b << 1) | ((b & 0x008) >> 3);

The b & 0x8 here is silly, my fault. I'll remove that before I commit.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to