fix: handle YUVJ422P/YUV422P in zm_colours_from_pixformat

MJPEG decoder outputs AV_PIX_FMT_YUVJ422P which was not handled by
zm_colours_from_pixformat, causing "Unknown pixelformat 13 yuvj422p"
errors and leaving imagePixFormat stale — resulting in random image
corruption.

Add YUV422P and YUVJ422P cases to zm_colours_from_pixformat and
zm_bytes_per_pixel in zm_pixformat.h.

refs #4735

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Isaac Connor
2026-04-18 18:38:10 -04:00
parent 4c999c0fe8
commit 02e6be6b47

View File

@@ -61,6 +61,11 @@ inline bool zm_colours_from_pixformat(AVPixelFormat fmt,
colours = ZM_COLOUR_GRAY8;
subpixelorder = ZM_SUBPIX_ORDER_YUVJ420P;
return true;
case AV_PIX_FMT_YUV422P:
case AV_PIX_FMT_YUVJ422P:
colours = ZM_COLOUR_GRAY8; // Y-plane is 1 byte/pixel
subpixelorder = ZM_SUBPIX_ORDER_NONE;
return true;
case AV_PIX_FMT_RGB24:
colours = ZM_COLOUR_RGB24;
subpixelorder = ZM_SUBPIX_ORDER_RGB;
@@ -97,6 +102,8 @@ inline unsigned int zm_bytes_per_pixel(AVPixelFormat fmt) {
case AV_PIX_FMT_GRAY8:
case AV_PIX_FMT_YUV420P:
case AV_PIX_FMT_YUVJ420P:
case AV_PIX_FMT_YUV422P:
case AV_PIX_FMT_YUVJ422P:
return 1;
case AV_PIX_FMT_RGB24:
case AV_PIX_FMT_BGR24: