ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Thu Mar  6 18:00:28 2025 +0100| [4040dc0782f2bc9307a3a93d93c4af37db512b19] | 
committer: Andreas Rheinhardt

avcodec/vp8: Move codec-specific init code out of common init

While just at it, also move the init functions inside
the #if CONFIG_VP?_DECODER (to avoid linking failures).
While just at it, also declare these init functions
as av_cold and uninline the remaining common init function.

Reviewed-by: Peter Ross <pr...@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

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

 libavcodec/vp8.c | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 6337fa173b..be8dbde91e 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -2858,8 +2858,7 @@ av_cold int ff_vp8_decode_free(AVCodecContext *avctx)
     return 0;
 }
 
-static av_always_inline
-int vp78_decode_init(AVCodecContext *avctx, int is_vp7)
+static av_cold void vp78_decode_init(AVCodecContext *avctx)
 {
     VP8Context *s = avctx->priv_data;
 
@@ -2870,37 +2869,25 @@ int vp78_decode_init(AVCodecContext *avctx, int is_vp7)
     ff_videodsp_init(&s->vdsp, 8);
 
     ff_vp78dsp_init(&s->vp8dsp);
-    if (CONFIG_VP7_DECODER && is_vp7) {
-        ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP7, 8, 1);
-        ff_vp7dsp_init(&s->vp8dsp);
-        s->decode_mb_row_no_filter = vp7_decode_mb_row_no_filter;
-        s->filter_mb_row           = vp7_filter_mb_row;
-    } else if (CONFIG_VP8_DECODER && !is_vp7) {
-        ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1);
-        ff_vp8dsp_init(&s->vp8dsp);
-        s->decode_mb_row_no_filter = vp8_decode_mb_row_no_filter;
-        s->filter_mb_row           = vp8_filter_mb_row;
-    }
 
     /* does not change for VP8 */
     memcpy(s->prob[0].scan, ff_zigzag_scan, sizeof(s->prob[0].scan));
-
-    return 0;
 }
 
-#if CONFIG_VP7_DECODER
-static int vp7_decode_init(AVCodecContext *avctx)
-{
-    return vp78_decode_init(avctx, IS_VP7);
-}
-#endif /* CONFIG_VP7_DECODER */
-
+#if CONFIG_VP8_DECODER
 av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
 {
-    return vp78_decode_init(avctx, IS_VP8);
+    VP8Context *s = avctx->priv_data;
+
+    vp78_decode_init(avctx);
+    ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1);
+    ff_vp8dsp_init(&s->vp8dsp);
+    s->decode_mb_row_no_filter = vp8_decode_mb_row_no_filter;
+    s->filter_mb_row           = vp8_filter_mb_row;
+
+    return 0;
 }
 
-#if CONFIG_VP8_DECODER
 #if HAVE_THREADS
 static void vp8_replace_frame(VP8Frame *dst, const VP8Frame *src)
 {
@@ -2944,6 +2931,19 @@ static int 
vp8_decode_update_thread_context(AVCodecContext *dst,
 #endif /* CONFIG_VP8_DECODER */
 
 #if CONFIG_VP7_DECODER
+av_cold static int vp7_decode_init(AVCodecContext *avctx)
+{
+    VP8Context *s = avctx->priv_data;
+
+    vp78_decode_init(avctx);
+    ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP7, 8, 1);
+    ff_vp7dsp_init(&s->vp8dsp);
+    s->decode_mb_row_no_filter = vp7_decode_mb_row_no_filter;
+    s->filter_mb_row           = vp7_filter_mb_row;
+
+    return 0;
+}
+
 const FFCodec ff_vp7_decoder = {
     .p.name                = "vp7",
     CODEC_LONG_NAME("On2 VP7"),

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to