[FFmpeg-devel] [PATCH 37/39] lavc/hevcdec: use a ContainerFifo to hold frames scheduled for output

Anton Khirnov anton at khirnov.net
Mon Aug 12 15:28:50 EEST 2024


Quoting Andreas Rheinhardt (2024-08-10 01:52:36)
> Anton Khirnov:
> > @@ -3442,12 +3448,15 @@ static int hevc_receive_frame(AVCodecContext *avctx, AVFrame *frame)
> >      if (ret < 0)
> >          return ret;
> >  
> > -    if (s->output_frame->buf[0]) {
> > -        av_frame_move_ref(frame, s->output_frame);
> > +do_output:
> > +    if (ff_container_fifo_read(s->output_fifo, frame) >= 0) {
> 
> This looks like it adds a (several) av_frame_move_ref() for the common
> case in which we only have one output frame. Can't this be avoided?

Does it? Current code has av_frame_ref() into HEVCContext.output_frame,
which is then av_frame_move_ref()'d into the actual output frame.
New code does the same, except with a few more wrappers.

> > diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h
> > index da4d83e661..f2705b8de2 100644
> > --- a/libavcodec/hevc/hevcdec.h
> > +++ b/libavcodec/hevc/hevcdec.h
> > @@ -31,6 +31,7 @@
> >  #include "libavcodec/avcodec.h"
> >  #include "libavcodec/bswapdsp.h"
> >  #include "libavcodec/cabac.h"
> > +#include "libavcodec/container_fifo.h"
> 
> Unnecessary. Just use struct ContainerFifo* below.

Sure, changed locally.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list