From 0942dc57dd00c17af38b058fdbb260b015cd3048 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 29 Oct 2024 09:49:50 +0100 Subject: [PATCH] mpegts: Fix bit-depth storage for jpeg-xs As per ISO/IEC 21122-3 2019: > Sample_Bitdepth code shall specify directly the bitdepth of the components minus 1 Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3945 Part-of: --- subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c | 2 +- subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c b/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c index 9943da9118..253cc7ec55 100644 --- a/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c +++ b/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c @@ -1865,7 +1865,7 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, /* interlace-mode, sampling, depth */ gst_caps_set_simple (caps, "width", G_TYPE_INT, jpegxs.horizontal_size, "height", G_TYPE_INT, jpegxs.vertical_size, "depth", G_TYPE_INT, - (jpegxs.schar >> 4) & 0xf, NULL); + ((jpegxs.schar >> 4) & 0xf) + 1, NULL); switch (jpegxs.schar & 0xf) { case 0: gst_caps_set_simple (caps, "sampling", G_TYPE_STRING, "YCbCr-4:2:2", diff --git a/subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c b/subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c index 829fb9e6ef..87ce645158 100644 --- a/subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c +++ b/subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c @@ -525,7 +525,7 @@ gst_base_ts_mux_jpegxs_descriptor (GstBaseTsMux * mux, } { - guint16 schar = (depth & 0xf) << 4; + guint16 schar = ((depth - 1) & 0xf) << 4; /* FIXME : Support all other variants */ if (!g_strcmp0 (sampling, "YCbCr-4:2:2")) { schar |= 0;