video: Fix scaling in 4x horizontal co-sited chroma

4x downscaling of chroma with co-sited chroma has never worked
it seems.

Fixes incorrect videotestsrc output and videoconvert conversions
to Y41B, YUV9, YVU9 and IYU9 with co-sited chroma.

e.g.
gst-launch-1.0 videotestsrc ! video/x-raw,format=Y41B,width=1280,height=720 ! \
  videoconvert ! autovideosink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2791>
This commit is contained in:
Jan Schmidt 2022-07-23 02:49:20 +10:00 committed by Tim-Philipp Müller
parent aaae84d44b
commit 66abd61be9

View file

@ -260,9 +260,9 @@ struct _GstVideoChromaResample
#define FILT_5_3(a,b) (5*(a) + 3*(b) + 4) >> 3
#define FILT_3_5(a,b) (3*(a) + 5*(b) + 4) >> 3
#define FILT_10_3_2_1(a,b,c,d) (10*(a) + 3*(b) + 2*(c) + (d) + 8) >> 16
#define FILT_1_2_3_10(a,b,c,d) ((a) + 2*(b) + 3*(c) + 10*(d) + 8) >> 16
#define FILT_1_2_3_4_3_2_1(a,b,c,d,e,f,g) ((a) + 2*((b)+(f)) + 3*((c)+(e)) + 4*(d) + (g) + 8) >> 16
#define FILT_10_3_2_1(a,b,c,d) (10*(a) + 3*(b) + 2*(c) + (d) + 8) >> 4
#define FILT_1_2_3_10(a,b,c,d) ((a) + 2*(b) + 3*(c) + 10*(d) + 8) >> 4
#define FILT_1_2_3_4_3_2_1(a,b,c,d,e,f,g) ((a) + 2*((b)+(f)) + 3*((c)+(e)) + 4*(d) + (g) + 8) >> 4
/* 2x horizontal upsampling without cositing
*