diff mbox series

[FFmpeg-devel,13/17] avformat/mxfenc: Remove redundant DNXHD frame size checks

Message ID AM7PR03MB66604E2F93EFFF94A2DB7D708F929@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit b9a26b9d55f77ebbff3596e46be54bb5fed469d3
Headers show
Series [FFmpeg-devel,01/17] avformat/mxfenc: Auto-insert h264_mp4toannexb BSF if needed | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 9, 2021, 6:01 p.m. UTC
The actual frame_size is no longer used since commit
3d38e45eb85c7a2420cb48a9cd45625c28644b2e; and the check for
"< 0" is equivalent to the CID being valid. But this is already
ensured by mxf_dnxhd_codec_uls containing this CID.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/mxfenc.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Tomas Härdin Nov. 9, 2021, 10:39 p.m. UTC | #1
tis 2021-11-09 klockan 19:01 +0100 skrev Andreas Rheinhardt:
> The actual frame_size is no longer used since commit
> 3d38e45eb85c7a2420cb48a9cd45625c28644b2e; and the check for
> "< 0" is equivalent to the CID being valid. But this is already
> ensured by mxf_dnxhd_codec_uls containing this CID.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/mxfenc.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> index 326ec6a7d6..83f9a778fe 100644
> --- a/libavformat/mxfenc.c
> +++ b/libavformat/mxfenc.c
> @@ -2066,7 +2066,7 @@ static int
> mxf_parse_dnxhd_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt
>  {
>      MXFContext *mxf = s->priv_data;
>      MXFStreamContext *sc = st->priv_data;
> -    int i, cid, frame_size = 0;
> +    int i, cid;
>  
>      if (mxf->header_written)
>          return 1;
> @@ -2094,12 +2094,6 @@ static int
> mxf_parse_dnxhd_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt
>      if (!sc->component_depth)
>          return 0;
>  
> -    if ((frame_size = avpriv_dnxhd_get_frame_size(cid)) ==
> DNXHD_VARIABLE) {
> -        frame_size = avpriv_dnxhd_get_hr_frame_size(cid, st-
> >codecpar->width, st->codecpar->height);
> -    }
> -    if (frame_size < 0)
> -        return 0;

Looks simple enough. Might want Baptiste to chime in given that he
authored 3d38e45.

/Tomas
Andreas Rheinhardt Nov. 18, 2021, 9:28 p.m. UTC | #2
Tomas Härdin:
> tis 2021-11-09 klockan 19:01 +0100 skrev Andreas Rheinhardt:
>> The actual frame_size is no longer used since commit
>> 3d38e45eb85c7a2420cb48a9cd45625c28644b2e; and the check for
>> "< 0" is equivalent to the CID being valid. But this is already
>> ensured by mxf_dnxhd_codec_uls containing this CID.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>>  libavformat/mxfenc.c | 8 +-------
>>  1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
>> index 326ec6a7d6..83f9a778fe 100644
>> --- a/libavformat/mxfenc.c
>> +++ b/libavformat/mxfenc.c
>> @@ -2066,7 +2066,7 @@ static int
>> mxf_parse_dnxhd_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt
>>  {
>>      MXFContext *mxf = s->priv_data;
>>      MXFStreamContext *sc = st->priv_data;
>> -    int i, cid, frame_size = 0;
>> +    int i, cid;
>>  
>>      if (mxf->header_written)
>>          return 1;
>> @@ -2094,12 +2094,6 @@ static int
>> mxf_parse_dnxhd_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt
>>      if (!sc->component_depth)
>>          return 0;
>>  
>> -    if ((frame_size = avpriv_dnxhd_get_frame_size(cid)) ==
>> DNXHD_VARIABLE) {
>> -        frame_size = avpriv_dnxhd_get_hr_frame_size(cid, st-
>>> codecpar->width, st->codecpar->height);
>> -    }
>> -    if (frame_size < 0)
>> -        return 0;
> 
> Looks simple enough. Might want Baptiste to chime in given that he
> authored 3d38e45.
> 

Will apply this tomorrow just in case Baptiste still wants to chime in.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 326ec6a7d6..83f9a778fe 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2066,7 +2066,7 @@  static int mxf_parse_dnxhd_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt
 {
     MXFContext *mxf = s->priv_data;
     MXFStreamContext *sc = st->priv_data;
-    int i, cid, frame_size = 0;
+    int i, cid;
 
     if (mxf->header_written)
         return 1;
@@ -2094,12 +2094,6 @@  static int mxf_parse_dnxhd_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt
     if (!sc->component_depth)
         return 0;
 
-    if ((frame_size = avpriv_dnxhd_get_frame_size(cid)) == DNXHD_VARIABLE) {
-        frame_size = avpriv_dnxhd_get_hr_frame_size(cid, st->codecpar->width, st->codecpar->height);
-    }
-    if (frame_size < 0)
-        return 0;
-
     if (cid >= 1270) { // RI raster
         av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den,
                   st->codecpar->width, st->codecpar->height,