diff mbox series

[FFmpeg-devel,10/23] avcodec/vp9: Inline function with only one caller into it

Message ID VI1PR0301MB2159497636B23A643714882F8F589@VI1PR0301MB2159.eurprd03.prod.outlook.com
State Accepted
Commit 4818ea69d2dab5e96e7c2c078d804a260d5efcbd
Headers show
Series [FFmpeg-devel,01/23] avcodec/ljpegenc: Mark encoder as init-threadsafe
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 6, 2021, 5:11 a.m. UTC
The split into vp9_decode_init() and init_frames() is a remnant
of using init_thread_copy() for frame-threading; the latter has
been removed, so there is no reason for init_frames() not be part
of vp9_decode_init().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/vp9.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index fd0e0dc54f..783f446125 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1790,36 +1790,27 @@  static void vp9_decode_flush(AVCodecContext *avctx)
         ff_thread_release_buffer(avctx, &s->s.refs[i]);
 }
 
-static int init_frames(AVCodecContext *avctx)
+static av_cold int vp9_decode_init(AVCodecContext *avctx)
 {
     VP9Context *s = avctx->priv_data;
-    int i;
 
-    for (i = 0; i < 3; i++) {
+    s->last_bpp = 0;
+    s->s.h.filter.sharpness = -1;
+
+    for (int i = 0; i < 3; i++) {
         s->s.frames[i].tf.f = av_frame_alloc();
         if (!s->s.frames[i].tf.f)
             return AVERROR(ENOMEM);
     }
-    for (i = 0; i < 8; i++) {
-        s->s.refs[i].f = av_frame_alloc();
-        s->next_refs[i].f = av_frame_alloc();
+    for (int i = 0; i < 8; i++) {
+        s->s.refs[i].f      = av_frame_alloc();
+        s->next_refs[i].f   = av_frame_alloc();
         if (!s->s.refs[i].f || !s->next_refs[i].f)
             return AVERROR(ENOMEM);
     }
-
     return 0;
 }
 
-static av_cold int vp9_decode_init(AVCodecContext *avctx)
-{
-    VP9Context *s = avctx->priv_data;
-
-    s->last_bpp = 0;
-    s->s.h.filter.sharpness = -1;
-
-    return init_frames(avctx);
-}
-
 #if HAVE_THREADS
 static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 {