[FFmpeg-devel] [PATCH V2] avformat/mxf: fixed frame wrapping detection for J2K essence container

Pierre-Anthony Lemieux pal at sandflow.com
Sat Jul 24 23:36:01 EEST 2021


Great. Let me know if you need anything else to process the patch,
which is necessary to process MXF files used by the Interoperable
Master Format (IMF, SMPTE ST 2067).

On Sun, Jul 18, 2021 at 1:03 PM Marton Balint <cus at passwd.hu> wrote:
>
>
>
> On Sun, 18 Jul 2021, pal at sandflow.com wrote:
>
> > From: Pierre-Anthony Lemieux <pal at sandflow.com>
> >
> > Signed-off-by: Pierre-Anthony Lemieux <pal at sandflow.com>
> > ---
> >
> > Notes:
> >    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). This approach does not work when
> >    byte 14 is larger than 0x02, e.g. when the essence container is MXFGCP1FrameWrappedPicture, in which case the
> >    essence is always frame-wrapped.
> >
> > libavformat/mxf.h    | 3 ++-
> > libavformat/mxfdec.c | 6 +++++-
> > 2 files changed, 7 insertions(+), 2 deletions(-)
>
> LGTM, thanks.
>
> Marton
>
> >
> > diff --git a/libavformat/mxf.h b/libavformat/mxf.h
> > index b1b1fedac7..b9fe7fe7ef 100644
> > --- a/libavformat/mxf.h
> > +++ b/libavformat/mxf.h
> > @@ -75,7 +75,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 f813408b3d..88ff8001ff 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;
> > --
> > 2.17.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list