diff mbox

[FFmpeg-devel,1/5] avformat/ffmdec: Remove some st->codec uses which set encoder parameters

Message ID 20161202235258.26223-1-michael@niedermayer.cc
State Accepted
Headers show

Commit Message

Michael Niedermayer Dec. 2, 2016, 11:52 p.m. UTC
Modern ffserver should not need these

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/ffmdec.c | 148 +++++++++++++++++++++++++--------------------------
 1 file changed, 74 insertions(+), 74 deletions(-)

Comments

Andreas Cadhalpun Dec. 3, 2016, 12:14 a.m. UTC | #1
On 03.12.2016 00:52, Michael Niedermayer wrote:
> Modern ffserver should not need these
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/ffmdec.c | 148 +++++++++++++++++++++++++--------------------------
>  1 file changed, 74 insertions(+), 74 deletions(-)
> 
> diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
> index 960e793220..9192bff507 100644
> --- a/libavformat/ffmdec.c
> +++ b/libavformat/ffmdec.c
> @@ -405,51 +405,51 @@ static int ffm2_read_header(AVFormatContext *s)
>              ret = av_image_check_size(codec->width, codec->height, 0, s);
>              if (ret < 0)
>                  goto fail;
> -            codec->gop_size = avio_rb16(pb);
> +            avio_rb16(pb);

Please add a comment like /* gop_size */ here and similar ones below.
Otherwise it'll be rather mysterious what's the point of all these avio_rb* calls.

Best regards,
Andreas
Michael Niedermayer Dec. 3, 2016, 12:23 p.m. UTC | #2
On Sat, Dec 03, 2016 at 01:14:19AM +0100, Andreas Cadhalpun wrote:
> On 03.12.2016 00:52, Michael Niedermayer wrote:
> > Modern ffserver should not need these
> > 
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/ffmdec.c | 148 +++++++++++++++++++++++++--------------------------
> >  1 file changed, 74 insertions(+), 74 deletions(-)
> > 
> > diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
> > index 960e793220..9192bff507 100644
> > --- a/libavformat/ffmdec.c
> > +++ b/libavformat/ffmdec.c
> > @@ -405,51 +405,51 @@ static int ffm2_read_header(AVFormatContext *s)
> >              ret = av_image_check_size(codec->width, codec->height, 0, s);
> >              if (ret < 0)
> >                  goto fail;
> > -            codec->gop_size = avio_rb16(pb);
> > +            avio_rb16(pb);
> 
> Please add a comment like /* gop_size */ here and similar ones below.
> Otherwise it'll be rather mysterious what's the point of all these avio_rb* calls.

done locally


[...]
Andreas Cadhalpun Dec. 3, 2016, 1:03 p.m. UTC | #3
On 03.12.2016 13:23, Michael Niedermayer wrote:
> On Sat, Dec 03, 2016 at 01:14:19AM +0100, Andreas Cadhalpun wrote:
>> On 03.12.2016 00:52, Michael Niedermayer wrote:
>>> Modern ffserver should not need these
>>>
>>> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
>>> ---
>>>  libavformat/ffmdec.c | 148 +++++++++++++++++++++++++--------------------------
>>>  1 file changed, 74 insertions(+), 74 deletions(-)
>>>
>>> diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
>>> index 960e793220..9192bff507 100644
>>> --- a/libavformat/ffmdec.c
>>> +++ b/libavformat/ffmdec.c
>>> @@ -405,51 +405,51 @@ static int ffm2_read_header(AVFormatContext *s)
>>>              ret = av_image_check_size(codec->width, codec->height, 0, s);
>>>              if (ret < 0)
>>>                  goto fail;
>>> -            codec->gop_size = avio_rb16(pb);
>>> +            avio_rb16(pb);
>>
>> Please add a comment like /* gop_size */ here and similar ones below.
>> Otherwise it'll be rather mysterious what's the point of all these avio_rb* calls.
> 
> done locally

Thanks, patch is OK then.

Best regards,
Andreas
Moritz Barsnick Dec. 4, 2016, 11:28 p.m. UTC | #4
On Sat, Dec 03, 2016 at 13:23:26 +0100, Michael Niedermayer wrote:
> > Please add a comment like /* gop_size */ here and similar ones below.
> > Otherwise it'll be rather mysterious what's the point of all these avio_rb* calls.
> 
> done locally

Are the remaining avio_rb*() calls good for anything except documenting
the now unused fields? I know the code is just called once for the
headers, but replacing N avio_rb*() calls with a single avio_skip()
would be way more efficient, right?

Moritz
Michael Niedermayer Dec. 5, 2016, 12:27 a.m. UTC | #5
On Mon, Dec 05, 2016 at 12:28:49AM +0100, Moritz Barsnick wrote:
> On Sat, Dec 03, 2016 at 13:23:26 +0100, Michael Niedermayer wrote:
> > > Please add a comment like /* gop_size */ here and similar ones below.
> > > Otherwise it'll be rather mysterious what's the point of all these avio_rb* calls.
> > 
> > done locally
> 
> Are the remaining avio_rb*() calls good for anything except documenting
> the now unused fields? I know the code is just called once for the

Their only use is probably documenting


[...]
diff mbox

Patch

diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 960e793220..9192bff507 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -405,51 +405,51 @@  static int ffm2_read_header(AVFormatContext *s)
             ret = av_image_check_size(codec->width, codec->height, 0, s);
             if (ret < 0)
                 goto fail;
-            codec->gop_size = avio_rb16(pb);
+            avio_rb16(pb);
             codec->pix_fmt = avio_rb32(pb);
             if (!av_pix_fmt_desc_get(codec->pix_fmt)) {
                 av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt);
                 codec->pix_fmt = AV_PIX_FMT_NONE;
                 goto fail;
             }
-            codec->qmin = avio_r8(pb);
-            codec->qmax = avio_r8(pb);
-            codec->max_qdiff = avio_r8(pb);
-            codec->qcompress = avio_rb16(pb) / 10000.0;
-            codec->qblur = avio_rb16(pb) / 10000.0;
-            codec->bit_rate_tolerance = avio_rb32(pb);
+            avio_r8(pb);
+            avio_r8(pb);
+            avio_r8(pb);
+            avio_rb16(pb);
+            avio_rb16(pb);
+            avio_rb32(pb);
             avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf));
-            codec->rc_eq = av_strdup(rc_eq_buf);
-            codec->rc_max_rate = avio_rb32(pb);
-            codec->rc_min_rate = avio_rb32(pb);
-            codec->rc_buffer_size = avio_rb32(pb);
-            codec->i_quant_factor = av_int2double(avio_rb64(pb));
-            codec->b_quant_factor = av_int2double(avio_rb64(pb));
-            codec->i_quant_offset = av_int2double(avio_rb64(pb));
-            codec->b_quant_offset = av_int2double(avio_rb64(pb));
-            codec->dct_algo = avio_rb32(pb);
-            codec->strict_std_compliance = avio_rb32(pb);
-            codec->max_b_frames = avio_rb32(pb);
-            codec->mpeg_quant = avio_rb32(pb);
-            codec->intra_dc_precision = avio_rb32(pb);
-            codec->me_method = avio_rb32(pb);
-            codec->mb_decision = avio_rb32(pb);
-            codec->nsse_weight = avio_rb32(pb);
-            codec->frame_skip_cmp = avio_rb32(pb);
-            codec->rc_buffer_aggressivity = av_int2double(avio_rb64(pb));
+
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb64(pb);
+            avio_rb64(pb);
+            avio_rb64(pb);
+            avio_rb64(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb64(pb);
             codec->codec_tag = avio_rb32(pb);
-            codec->thread_count = avio_r8(pb);
-            codec->coder_type = avio_rb32(pb);
-            codec->me_cmp = avio_rb32(pb);
-            codec->me_subpel_quality = avio_rb32(pb);
-            codec->me_range = avio_rb32(pb);
-            codec->keyint_min = avio_rb32(pb);
-            codec->scenechange_threshold = avio_rb32(pb);
-            codec->b_frame_strategy = avio_rb32(pb);
-            codec->qcompress = av_int2double(avio_rb64(pb));
-            codec->qblur = av_int2double(avio_rb64(pb));
-            codec->max_qdiff = avio_rb32(pb);
-            codec->refs = avio_rb32(pb);
+            avio_r8(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb64(pb);
+            avio_rb64(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
             break;
         case MKBETAG('S', 'T', 'A', 'U'):
             if (f_stau++) {
@@ -614,51 +614,51 @@  static int ffm_read_header(AVFormatContext *s)
             codec->height = avio_rb16(pb);
             if (av_image_check_size(codec->width, codec->height, 0, s) < 0)
                 goto fail;
-            codec->gop_size = avio_rb16(pb);
+            avio_rb16(pb);
             codec->pix_fmt = avio_rb32(pb);
             if (!av_pix_fmt_desc_get(codec->pix_fmt)) {
                 av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt);
                 codec->pix_fmt = AV_PIX_FMT_NONE;
                 goto fail;
             }
-            codec->qmin = avio_r8(pb);
-            codec->qmax = avio_r8(pb);
-            codec->max_qdiff = avio_r8(pb);
-            codec->qcompress = avio_rb16(pb) / 10000.0;
-            codec->qblur = avio_rb16(pb) / 10000.0;
-            codec->bit_rate_tolerance = avio_rb32(pb);
+            avio_r8(pb);
+            avio_r8(pb);
+            avio_r8(pb);
+            avio_rb16(pb);
+            avio_rb16(pb);
+            avio_rb32(pb);
             avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf));
-            codec->rc_eq = av_strdup(rc_eq_buf);
-            codec->rc_max_rate = avio_rb32(pb);
-            codec->rc_min_rate = avio_rb32(pb);
-            codec->rc_buffer_size = avio_rb32(pb);
-            codec->i_quant_factor = av_int2double(avio_rb64(pb));
-            codec->b_quant_factor = av_int2double(avio_rb64(pb));
-            codec->i_quant_offset = av_int2double(avio_rb64(pb));
-            codec->b_quant_offset = av_int2double(avio_rb64(pb));
-            codec->dct_algo = avio_rb32(pb);
-            codec->strict_std_compliance = avio_rb32(pb);
-            codec->max_b_frames = avio_rb32(pb);
-            codec->mpeg_quant = avio_rb32(pb);
-            codec->intra_dc_precision = avio_rb32(pb);
-            codec->me_method = avio_rb32(pb);
-            codec->mb_decision = avio_rb32(pb);
-            codec->nsse_weight = avio_rb32(pb);
-            codec->frame_skip_cmp = avio_rb32(pb);
-            codec->rc_buffer_aggressivity = av_int2double(avio_rb64(pb));
+
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb64(pb);
+            avio_rb64(pb);
+            avio_rb64(pb);
+            avio_rb64(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb64(pb);
             codec->codec_tag = avio_rb32(pb);
-            codec->thread_count = avio_r8(pb);
-            codec->coder_type = avio_rb32(pb);
-            codec->me_cmp = avio_rb32(pb);
-            codec->me_subpel_quality = avio_rb32(pb);
-            codec->me_range = avio_rb32(pb);
-            codec->keyint_min = avio_rb32(pb);
-            codec->scenechange_threshold = avio_rb32(pb);
-            codec->b_frame_strategy = avio_rb32(pb);
-            codec->qcompress = av_int2double(avio_rb64(pb));
-            codec->qblur = av_int2double(avio_rb64(pb));
-            codec->max_qdiff = avio_rb32(pb);
-            codec->refs = avio_rb32(pb);
+            avio_r8(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
+            avio_rb64(pb);
+            avio_rb64(pb);
+            avio_rb32(pb);
+            avio_rb32(pb);
             break;
         case AVMEDIA_TYPE_AUDIO:
             codec->sample_rate = avio_rb32(pb);