From 63ebec88df3fe4a2d784d976f4d705ae0dd8e7b9 Mon Sep 17 00:00:00 2001 From: Lukas Hejtmanek Date: Thu, 11 Feb 2010 17:50:00 +0100 Subject: [PATCH] introduce vc_copylineDVS10toV210 --- ultragrid/src/video_codec.c | 21 +++++++++++++++++++++ ultragrid/src/video_codec.h | 1 + 2 files changed, 22 insertions(+) diff --git a/ultragrid/src/video_codec.c b/ultragrid/src/video_codec.c index a23e6d4e1..52e642aa1 100644 --- a/ultragrid/src/video_codec.c +++ b/ultragrid/src/video_codec.c @@ -288,6 +288,27 @@ vc_copylineRGBA(unsigned char *dst, unsigned char *src, int len, int rshift, } } +void vc_copylineDVS10toV210(unsigned char *dst, unsigned char *src, int dst_len) +{ + unsigned int *d, *s1; + register unsigned int a,b; + d = dst; + s1 = src; + + while(dst_len > 0) { + a = b = *s1++; + b = ((b >> 24) * 0x00010101) & 0x00300c03; + a <<= 2; + b |= a & (0xff<<2); + a <<= 2; + b |= a & (0xff00<<4); + a <<= 2; + b |= a & (0xff0000<<6); + *d++ = b; + dst_len -= 4; + } +} + /* convert 10bits Cb Y Cr A Y Cb Y A to 8bits Cb Y Cr Y Cb Y */ #if !(HAVE_MACOSX || HAVE_32B_LINUX) diff --git a/ultragrid/src/video_codec.h b/ultragrid/src/video_codec.h index df1185cff..0e5430275 100644 --- a/ultragrid/src/video_codec.h +++ b/ultragrid/src/video_codec.h @@ -109,5 +109,6 @@ void vc_copylineDVS10(unsigned char *dst, unsigned char *src, int src_len); void vc_copylinev210(unsigned char *dst, unsigned char *src, int dst_len); void vc_copyliner10k(unsigned char *dst, unsigned char *src, int len, int rshift, int gshift, int bshift); void vc_copylineRGBA(unsigned char *dst, unsigned char *src, int len, int rshift, int gshift, int bshift); +void vc_copylineDVS10toV210(unsigned char *dst, unsigned char *src, int dst_len); #endif