From: Michael Niedermayer <michae...@gmx.at> We have to make some symetric changes elsewhere as this increases the precission with which samples are stored.
Signed-off-by: Michael Niedermayer <michae...@gmx.at> Signed-off-by: Derek Buitenhuis <derek.buitenh...@gmail.com> --- libswscale/input.c | 6 +++--- libswscale/swscale_internal.h | 10 +++++++++- tests/ref/lavfi/pixfmts_scale | 12 ++++++------ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/libswscale/input.c b/libswscale/input.c index 2e8d43f..64ab0b9 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -579,7 +579,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)); } } @@ -626,8 +626,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 f9f023f..474b8fb 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -670,7 +670,15 @@ static av_always_inline int isRGB(enum AVPixelFormat pix_fmt) #define isAnyRGB(x) \ (isRGBinInt(x) || \ - isBGRinInt(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_GBRP16LE || \ + (x)==AV_PIX_FMT_GBRP16BE || \ + (x)==AV_PIX_FMT_GBRP \ + ) static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt) { diff --git a/tests/ref/lavfi/pixfmts_scale b/tests/ref/lavfi/pixfmts_scale index fde07b0..f3ea0ab 100644 --- a/tests/ref/lavfi/pixfmts_scale +++ b/tests/ref/lavfi/pixfmts_scale @@ -13,12 +13,12 @@ bgr565le 3a514a298c6161a071ddf9963c06509d bgr8 7f007fa6c153a16e808a9c51605a4016 bgra a5e7040f9a80cccd65e5acf2ca09ace5 gbrp 205c50f8359cb4ba2827a7711dea2cc6 -gbrp10be 30b7f9d5ef5da474fb794743146236aa -gbrp10le 2e9949a01fe4c38774728e34795165cc -gbrp16be 4045de229757b7a285fea274b9599c0d -gbrp16le f71e77371c0c5781e46af85ea95f92a3 -gbrp9be 6bac01a7f64a381521b2149fc46f4178 -gbrp9le 4b6cba7acf7886c13db122e590ec6b1f +gbrp10be d5918718adc0dbd9fe0c2aa825cb182c +gbrp10le 559ef6feb5bcb453a10a247e257055b4 +gbrp16be cdea2e117cbde65c345435709665642e +gbrp16le 3eef0955d2c3d218fe77c7f5e6903ad3 +gbrp9be d4bef3b1b18095aa6fe684fb3188202b +gbrp9le 59330ed68dfd286f2795d2bffffdbefb gray d7786a7d9d99ac74230cc045cab5632c gray16be b554d6c1cc8da23967445be4dd3e4a86 gray16le 715a33aa1c19cb26b14f5cc000e7a3d1 -- 1.7.10.4 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel