jpegdec / omxh264enc : color offset on images with height not a multiple of 16
Software/hardware information:
- Module: jpegdec (gst-plugins-good) and omxh264enc (gst-omx)
- Gstreamer version: 1.18.2
- OS: Linux raspberrypi 5.4.79-v7l+ #1373 SMP Mon Nov 23 13:27:40 GMT 2020 armv7l GNU/Linux
- Platform: Raspberry Pi 4b
Steps to reproduce:
gst-launch-1.0 v4l2src ! image/jpeg, width=1920, height=1080, framerate=30/1 ! jpegdec ! omxh264enc control-rate=variable target-bitrate=1000000 ! h264parse ! matroskamux ! filesink location=bad_colors.mkv
Description:
We observe an offset for the color fields of an image compared to its intensity field when:
- the image height is not divisible by 16, which for our camera is 1920x1080 (full HD) or 640x360 (1/3 full HD)
- the MJPEG decoder module is jpegdec
- the H264 encoder module is omxh264enc
And here is the erroneous color fields we observe:
Note that all colors are shifted but are otherwise correct.
Using other image sizes, another MJPEG decoder (v4l2jpegdec) or another h264 encoder (avenc_h264_omx) does not produce the offset colors. Thus the following two commands work fine:
gst-launch-1.0 v4l2src ! image/jpeg, width=1920, height=1080, framerate=30/1 ! jpegdec ! avenc_h264_omx ! h264parse ! matroskamux ! filesink location=good1.mkv
gst-launch-1.0 v4l2src ! image/jpeg, width=1920, height=1080, framerate=30/1 ! v4l2jpegdec ! omxh264enc control-rate=variable target-bitrate=1000000 ! h264parse ! matroskamux ! filesink location=good2.mkv
It's not clear for me whether the problem is in jpegdec or in omxh264dec but their combination seems problematic.