From 02001a372de6e07a51d1772accc7c7b27f2af7ae Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 26 Jan 2013 19:50:28 +0100 Subject: sws: add planar RGB formats to isAnyRGB We have to make some symetric changes elsewhere as this increases the precission with which samples are stored. Signed-off-by: Michael Niedermayer --- libswscale/input.c | 6 +++--- libswscale/swscale_internal.h | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'libswscale') diff --git a/libswscale/input.c b/libswscale/input.c index d3aeb22151..2def2de6c8 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -729,7 +729,7 @@ static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_sr int b = rdpx(src[1] + i); int r = rdpx(src[2] + i); - dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT + bpc - 9))) >> RGB2YUV_SHIFT); + dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + bpc - 14)); } } @@ -796,8 +796,8 @@ static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV, int b = rdpx(src[1] + i); int r = rdpx(src[2] + i); - dstU[i] = (RU * r + GU * g + BU * b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> RGB2YUV_SHIFT; - dstV[i] = (RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> RGB2YUV_SHIFT; + dstU[i] = (RU * r + GU * g + BU * b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + bpc - 14); + dstV[i] = (RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + bpc - 14); } } #undef rdpx diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 9f9cc4a790..5f10a6022e 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -716,6 +716,14 @@ static av_always_inline int isRGB(enum AVPixelFormat pix_fmt) ( \ isRGBinInt(x) || \ isBGRinInt(x) || \ + (x)==AV_PIX_FMT_GBRP9LE || \ + (x)==AV_PIX_FMT_GBRP9BE || \ + (x)==AV_PIX_FMT_GBRP10LE || \ + (x)==AV_PIX_FMT_GBRP10BE || \ + (x)==AV_PIX_FMT_GBRP12LE || \ + (x)==AV_PIX_FMT_GBRP12BE || \ + (x)==AV_PIX_FMT_GBRP14LE || \ + (x)==AV_PIX_FMT_GBRP14BE || \ (x)==AV_PIX_FMT_GBR24P \ ) -- cgit v1.2.3