[FFmpeg-devel] [PATCH 1/2] swscale: unscaled rgba64->bgr48

Michael Niedermayer michaelni at gmx.at
Wed Jul 18 14:43:12 CEST 2012


On Wed, Jul 18, 2012 at 01:54:22AM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libswscale/rgb2rgb.c          |   18 ++++++++++++++++++
>  libswscale/rgb2rgb.h          |    2 ++
>  libswscale/swscale_unscaled.c |   16 ++++++++++++++++
>  3 files changed, 36 insertions(+), 0 deletions(-)
> 
> diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
> index 63b9988..a1eab0a 100644
> --- a/libswscale/rgb2rgb.c
> +++ b/libswscale/rgb2rgb.c
> @@ -351,3 +351,21 @@ void rgb48tobgr48_ ## swap(const uint8_t *src,                          \
>  
>  DEFINE_RGB48TOBGR48(0)
>  DEFINE_RGB48TOBGR48(1)
> +
> +#define DEFINE_RGB64TOBGR48(swap)                                       \
> +void rgb64tobgr48_ ## swap(const uint8_t *src,                          \
> +                            uint8_t *dst, int src_size)                 \
> +{                                                                       \
> +    uint16_t *d = (uint16_t *)dst;                                      \
> +    uint16_t *s = (uint16_t *)src;                                      \
> +    int i, num_pixels = src_size >> 2;                                  \
> +                                                                        \
> +    for (i = 0; i < num_pixels; i++) {                                  \
> +        d[3 * i    ] = swap ? av_bswap16(s[4 * i + 2]) : s[4 * i + 2];  \
> +        d[3 * i + 1] = swap ? av_bswap16(s[4 * i + 1]) : s[4 * i + 1];  \
> +        d[3 * i + 2] = swap ? av_bswap16(s[4 * i    ]) : s[4 * i    ];  \
> +    }                                                                   \
> +}
> +
> +DEFINE_RGB64TOBGR48(0)
> +DEFINE_RGB64TOBGR48(1)
> diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
> index 92c964f..4ce2f85 100644
> --- a/libswscale/rgb2rgb.h
> +++ b/libswscale/rgb2rgb.h
> @@ -52,6 +52,8 @@ extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size);
>  
>  extern void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size);
>  
> +void rgb64tobgr48_0(const uint8_t *src, uint8_t *dst, int src_size);
> +void rgb64tobgr48_1(const uint8_t *src, uint8_t *dst, int src_size);

rgb64tobgr48 and rgb64tobgr48_bswap seem clearer here too otherwise
LGTM

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120718/f2397c6f/attachment.asc>


More information about the ffmpeg-devel mailing list