diff mbox series

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

Message ID 20210718180742.2718-1-pal@sandflow.com
State Accepted
Commit 74e43824421bac9fa0816dce8b069eeab6f4cd07
Headers show
Series [FFmpeg-devel,V2] avformat/mxf: fixed frame wrapping detection for J2K essence container | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Pierre-Anthony Lemieux July 18, 2021, 6:07 p.m. UTC
From: Pierre-Anthony Lemieux <pal@sandflow.com>

Signed-off-by: Pierre-Anthony Lemieux <pal@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(-)

Comments

Marton Balint July 18, 2021, 8:02 p.m. UTC | #1
On Sun, 18 Jul 2021, pal@sandflow.com wrote:

> From: Pierre-Anthony Lemieux <pal@sandflow.com>
>
> Signed-off-by: Pierre-Anthony Lemieux <pal@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@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Pierre-Anthony Lemieux July 24, 2021, 8:36 p.m. UTC | #2
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@passwd.hu> wrote:
>
>
>
> On Sun, 18 Jul 2021, pal@sandflow.com wrote:
>
> > From: Pierre-Anthony Lemieux <pal@sandflow.com>
> >
> > Signed-off-by: Pierre-Anthony Lemieux <pal@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@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Marton Balint July 29, 2021, 8:44 p.m. UTC | #3
On Sat, 24 Jul 2021, Pierre-Anthony Lemieux wrote:

> 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).

Thanks, applied.

Regards,
Marton

>
> On Sun, Jul 18, 2021 at 1:03 PM Marton Balint <cus@passwd.hu> wrote:
>>
>>
>>
>> On Sun, 18 Jul 2021, pal@sandflow.com wrote:
>>
>>> From: Pierre-Anthony Lemieux <pal@sandflow.com>
>>>
>>> Signed-off-by: Pierre-Anthony Lemieux <pal@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@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

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;