From 9047491f8bcd87673eed55fb310647a03b0981e9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 19 Nov 2013 14:17:26 +0100 Subject: swscale: add nv12/nv21->yuv420 converter Signed-off-by: Anton Khirnov --- libswscale/rgb2rgb_template.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libswscale/rgb2rgb_template.c') diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index 3da2b0b2aa..65ea5dda8c 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -708,6 +708,24 @@ static void interleaveBytes_c(const uint8_t *src1, const uint8_t *src2, } } +static void deinterleaveBytes_c(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, + int width, int height, int srcStride, + int dst1Stride, int dst2Stride) +{ + int h; + + for (h = 0; h < height; h++) { + int w; + for (w = 0; w < width; w++) { + dst1[w] = src[2 * w + 0]; + dst2[w] = src[2 * w + 1]; + } + src += srcStride; + dst1 += dst1Stride; + dst2 += dst2Stride; + } +} + static inline void vu9_to_vu12_c(const uint8_t *src1, const uint8_t *src2, uint8_t *dst1, uint8_t *dst2, int width, int height, @@ -937,6 +955,7 @@ static av_cold void rgb2rgb_init_c(void) planar2x = planar2x_c; rgb24toyv12 = rgb24toyv12_c; interleaveBytes = interleaveBytes_c; + deinterleaveBytes = deinterleaveBytes_c; vu9_to_vu12 = vu9_to_vu12_c; yvu9_to_yuy2 = yvu9_to_yuy2_c; -- cgit v1.2.3