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

Michael Niedermayer michael at niedermayer.cc
Wed Mar 2 23:47:27 EET 2022


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
    
[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220302/baf891d8/attachment.sig>


More information about the ffmpeg-devel mailing list