From f12577f0b9a2748541f868886eef6fb6def4e872 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 11 Oct 2024 15:54:30 +0200 Subject: [PATCH] fix vc_copylineRG48toY216 incorrectly braced Actually not obvious until 2f450060 (2024-09-24) because the chroma x1.5 was used but clamped, which has somehow hidden that. --- src/pixfmt_conv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pixfmt_conv.c b/src/pixfmt_conv.c index b20f3aaf2..12403cb27 100644 --- a/src/pixfmt_conv.c +++ b/src/pixfmt_conv.c @@ -2365,6 +2365,7 @@ static void vc_copylineRG48toV210(unsigned char * __restrict dst, const unsigned #undef FETCH_BLOCK } + static void vc_copylineRG48toY216(unsigned char * __restrict dst, const unsigned char * __restrict src, int dst_len, int rshift, int gshift, int bshift) { enum { @@ -2392,14 +2393,14 @@ static void vc_copylineRG48toY216(unsigned char * __restrict dst, const unsigned r = *in++; g = *in++; b = *in++; - u = (u + (RGB_TO_CB(cfs, r, g, b) >> COMP_BASE) / + u = ((u + (RGB_TO_CB(cfs, r, g, b) >> COMP_BASE)) / 2) + (1 << 15); *d++ = CLAMP_LIMITED_CBCR(u, 16); y = (RGB_TO_Y(cfs, r, g, b) >> COMP_BASE) + (1 << 12); *d++ = CLAMP_LIMITED_Y(y, 16); - v = (v + (RGB_TO_CR(cfs, r, g, b) >> COMP_BASE) / + v = ((v + (RGB_TO_CR(cfs, r, g, b) >> COMP_BASE)) / 2) + (1 << 15); *d++ = CLAMP_LIMITED_CBCR(v, 16);