[FFmpeg-cvslog] avformat/mxfdec: fix frame wrapping detection for J2K essence container

Pierre-Anthony Lemieux git at videolan.org
Thu Jul 29 23:43:51 EEST 2021


ffmpeg | branch: master | Pierre-Anthony Lemieux <pal at sandflow.com> | Sun Jul 18 11:07:43 2021 -0700| [74e43824421bac9fa0816dce8b069eeab6f4cd07] | committer: Marton Balint

avformat/mxfdec: fix frame wrapping detection for J2K essence container

For JPEG 2000 essence, the MXF input format module currently uses the value of
byte 14 of the essence container UL to determine whether the J2K essence is
clip- (byte 14 is 0x02) or frame-wrapped (byte 14 is 0x01). Otherwise it
assumes an unknown wrapping.

Additional wrappings are documented in SMPTE ST422:2019:

0x03: Interlaced Frame, 1 field/KLV
0x04: Interlaced Frame, 2 fields/KLV
0x05: Field-wrapped Picture Element
0x06: Frame-wrapped Picture Element

And these should also be handled as frame wrapped content.

Signed-off-by: Pierre-Anthony Lemieux <pal at sandflow.com>
Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74e43824421bac9fa0816dce8b069eeab6f4cd07
---

 libavformat/mxf.h    | 3 ++-
 libavformat/mxfdec.c | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index eb473d8a55..fe9c52732c 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -76,7 +76,8 @@ typedef enum {
     NormalWrap = 0,
     D10D11Wrap,
     RawAWrap,
-    RawVWrap
+    RawVWrap,
+    J2KWrap
 } MXFWrappingIndicatorType;
 
 typedef struct MXFLocalTagPair {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index f93cc30f0e..f491914bf1 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1411,7 +1411,7 @@ static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMe
 
 static const MXFCodecUL mxf_picture_essence_container_uls[] = {
     // video essence container uls
-    { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c,0x01,0x00 }, 14,   AV_CODEC_ID_JPEG2000, NULL, 14 },
+    { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c,0x01,0x00 }, 14,   AV_CODEC_ID_JPEG2000, NULL, 14, J2KWrap },
     { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x02,0x0d,0x01,0x03,0x01,0x02,0x10,0x60,0x01 }, 14,       AV_CODEC_ID_H264, NULL, 15 }, /* H.264 */
     { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x02,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 }, 14,      AV_CODEC_ID_DNXHD, NULL, 14 }, /* VC-3 */
     { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x02,0x0d,0x01,0x03,0x01,0x02,0x12,0x01,0x00 }, 14,        AV_CODEC_ID_VC1, NULL, 14 }, /* VC-1 */
@@ -1495,6 +1495,10 @@ static MXFWrappingScheme mxf_get_wrapping_kind(UID *essence_container_ul)
             if (val == 0x02)
                 val = 0x01;
             break;
+        case J2KWrap:
+            if (val != 0x02)
+                val = 0x01;
+            break;
     }
     if (val == 0x01)
         return FrameWrapped;



More information about the ffmpeg-cvslog mailing list