[FFmpeg-devel] [PATCH] avcodec/mpegvideo_enc: remove direct=1 support

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Mar 3 03:34:42 EET 2022


Michael Niedermayer:
> On Wed, Mar 02, 2022 at 08:11:18PM +0100, Paul B Mahol wrote:
>> On 3/2/22, Michael Niedermayer <michael at niedermayer.cc> wrote:
>>> On Wed, Mar 02, 2022 at 12:38:05PM +0100, Paul B Mahol wrote:
>>>> It seems it does not work properly.
>>>>
>>>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>>>> ---
>>>>  libavcodec/mpegvideo_enc.c | 23 +++--------------------
>>>>  1 file changed, 3 insertions(+), 20 deletions(-)
>>>
>>> if iam not mistaken, that requires the whole image to  be copied
>>> one extra time
>>> i think before doing that it should be understood
>>> where the problem is
>>> and why that is the better solution to fixing it and not doing
>>> that extra copy
>>>
>>> of course i may be missing something
>>>
>>
>> Yea, If you manage to trigger that path, I'm all ears.
> 
> thats a fair request
> 
> i tried
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -1065,6 +1065,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
>          pic->reference = 3;
>  
>          if (direct) {
> +            av_log(0,0, "direct mode\n");
>              if ((ret = av_frame_ref(pic->f, pic_arg)) < 0)
>                  return ret;
>          }
> 
> with
> ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -t 1 test.avi
> 
> and that gives me:
> direct mode
>     Last message repeated 23 times
> 
> so it seems the code is used
>     
> [...]
> 

Furthermore,
http://coverage.ffmpeg.org/index.mpegvideo_enc.c.68609919c7303277fae79be622d1b44d.html
shows that the direct branch is taken 649 times (out of 8563 instances).

- Andreas


More information about the ffmpeg-devel mailing list