Skip to content

Commit 66bd2c2

Browse files
committed
utils: test_convert: Fix GStreamer pipeline colorimetry and byte ordering
Set explicit JPEG colorimetry (1:4:0:0) on input and output caps to ensure the correct BT601 full-range matrix is used for YUV conversions, matching the convert binary behaviour. Use videoconvert to output BGR for RGB test cases, accounting for pispconvert's R/B channel swap on RGB output.
1 parent c585ab0 commit 66bd2c2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

utils/test_convert.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ def run_gstreamer(self, input_file, output_file, input_format, output_format):
101101
# Convert to GStreamer format names
102102
gst_in_format = self._pisp_to_gst_format(in_fmt['format'])
103103
gst_out_format = self._pisp_to_gst_format(out_fmt['format'])
104+
# pispconvert swaps R/B for RGB, use BGR file output to match convert reference
105+
gst_file_format = 'BGR' if gst_out_format == 'RGB' else gst_out_format
104106

105107
# Build GStreamer pipeline
106108
pipeline = [
@@ -111,8 +113,11 @@ def run_gstreamer(self, input_file, output_file, input_format, output_format):
111113
f'height={in_fmt["height"]}',
112114
f'format={gst_in_format.lower()}',
113115
'framerate=30/1', '!',
116+
'video/x-raw,colorimetry=1:4:0:0', '!',
114117
'pispconvert', '!',
115-
f'video/x-raw,format={gst_out_format},width={out_fmt["width"]},height={out_fmt["height"]}', '!',
118+
f'video/x-raw,format={gst_out_format},width={out_fmt["width"]},height={out_fmt["height"]},colorimetry=1:4:0:0', '!',
119+
'videoconvert', '!',
120+
f'video/x-raw,format={gst_file_format},width={out_fmt["width"]},height={out_fmt["height"]}', '!',
116121
'filesink', f'location={output_file}'
117122
]
118123

0 commit comments

Comments
 (0)