PR #26143 opened by Baptiste Coudurier (bcoudurier)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26143
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26143.patch

Rsiz was parsed into an unused field and always written as 0. Xsiz and Ysiz 
were written from the stream dimensions instead of the codestream SIZ values 
(ST 422 8.2), which differ when X0siz/Y0siz are not 0.

No FATE ref changes (no test muxes JPEG 2000 into MXF); full FATE passes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)



From 2210b7405466c9e5091f61a6034f2a6be1111894 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <[email protected]>
Date: Fri, 13 Nov 2026 16:27:51 -0800
Subject: [PATCH] avformat/mxfenc: write the JPEG 2000 Rsiz, Xsiz and Ysiz from
 SIZ

Rsiz was parsed into an unused field and always written as 0.

Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavformat/mxfenc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 867a4abd4d2..592d9ecf0f4 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -85,7 +85,6 @@ typedef struct MXFIndexEntry {
 } MXFIndexEntry;
 
 typedef struct j2k_info_t {
-    uint16_t j2k_cap;        ///< j2k required decoder capabilities
     uint16_t j2k_rsiz;       ///< j2k required decoder capabilities (Rsiz)
     uint32_t j2k_xsiz;       ///< j2k width of the reference grid (Xsiz)
     uint32_t j2k_ysiz;       ///< j2k height of the reference grid (Ysiz)
@@ -1562,10 +1561,10 @@ static int mxf_write_jpeg2000_subdesc(AVFormatContext 
*s, AVStream *st)
     avio_wb16(pb, sc->j2k_info.j2k_rsiz);
     /* Width of the JPEG2000 reference grid (Xsiz) */
     mxf_write_local_tag(s, 4, 0x8402);
-    avio_wb32(pb, st->codecpar->width);
+    avio_wb32(pb, sc->j2k_info.j2k_xsiz);
     /* Height of the JPEG2000 reference grid (Ysiz) */
     mxf_write_local_tag(s, 4, 0x8403);
-    avio_wb32(pb, st->codecpar->height);
+    avio_wb32(pb, sc->j2k_info.j2k_ysiz);
     /* Horizontal offset from the reference grid origin to the left side of 
the image area (X0siz) */
     mxf_write_local_tag(s, 4, 0x8404);
     avio_wb32(pb, sc->j2k_info.j2k_x0siz);
@@ -2737,7 +2736,7 @@ static int mxf_parse_jpeg2000_frame(AVFormatContext *s, 
AVStream *st, AVPacket *
         return AVERROR_INVALIDDATA;
     }
     bytestream2_skip(&g, 2); // Skip Lsiz
-    sc->j2k_info.j2k_cap = bytestream2_get_be16u(&g);
+    sc->j2k_info.j2k_rsiz = bytestream2_get_be16u(&g);
     sc->j2k_info.j2k_xsiz = bytestream2_get_be32u(&g);
     sc->j2k_info.j2k_ysiz = bytestream2_get_be32u(&g);
     sc->j2k_info.j2k_x0siz = bytestream2_get_be32u(&g);
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to