[FFmpeg-cvslog] avcodec/vp9: Join extradata buffer pools

Andreas Rheinhardt git at videolan.org
Wed Nov 1 22:02:54 EET 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Aug 16 15:49:41 2022 +0200| [eba73142adc776d7fe0639d3cff23d878da0174a] | committer: Andreas Rheinhardt

avcodec/vp9: Join extradata buffer pools

Up until now each thread had its own buffer pool for extradata
buffers when using frame-threading. Each thread can have at most
three references to extradata and in the long run, each thread's
bufferpool seems to fill up with three entries. But given
that at any given time there can be at most 2 + number of threads
entries used (the oldest thread can have two references to preceding
frames that are not currently decoded and each thread has its own
current frame, but there can be no references to any other frames),
this is wasteful. This commit therefore uses a single buffer pool
that is synced across threads.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eba73142adc776d7fe0639d3cff23d878da0174a
---

 libavcodec/vp9.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 26144c0a99..75e2e1d329 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1845,6 +1845,8 @@ static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo
                 return ret;
         }
     }
+    ff_refstruct_replace(&s->frame_extradata_pool, ssrc->frame_extradata_pool);
+    s->frame_extradata_pool_size = ssrc->frame_extradata_pool_size;
 
     s->s.h.invisible = ssrc->s.h.invisible;
     s->s.h.keyframe = ssrc->s.h.keyframe;



More information about the ffmpeg-cvslog mailing list