History

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.

Andreas Rheinhardt committed 1 year ago

Commit 4040dc01 parent b6602a11 file · +24 −24Browse files

Unified · Split

libavcodec/vp8.c+24−24
@@ -2858,8 +2858,7 @@ av_cold int ff_vp8_decode_free(AVCodecContext *avctx) · 2857 unmodified lines
28582858 return 0;
28592859 }
28602860
2861−static av_always_inline
2862−int vp78_decode_init(AVCodecContext *avctx, int is_vp7)
2861+static av_cold void vp78_decode_init(AVCodecContext *avctx)
28632862 {
28642863 VP8Context *s = avctx->priv_data;
28652864
@@ -2870,37 +2869,25 @@ int vp78_decode_init(AVCodecContext *avctx, int is_vp7) · 4 unmodified lines
28702869 ff_videodsp_init(&s->vdsp, 8);
28712870
28722871 ff_vp78dsp_init(&s->vp8dsp);
2873− if (CONFIG_VP7_DECODER && is_vp7) {
2874− ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP7, 8, 1);
2875− ff_vp7dsp_init(&s->vp8dsp);
2876− s->decode_mb_row_no_filter = vp7_decode_mb_row_no_filter;
2877− s->filter_mb_row = vp7_filter_mb_row;
2878− } else if (CONFIG_VP8_DECODER && !is_vp7) {
2879− ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1);
2880− ff_vp8dsp_init(&s->vp8dsp);
2881− s->decode_mb_row_no_filter = vp8_decode_mb_row_no_filter;
2882− s->filter_mb_row = vp8_filter_mb_row;
2883− }
28842872
28852873 /* does not change for VP8 */
28862874 memcpy(s->prob[0].scan, ff_zigzag_scan, sizeof(s->prob[0].scan));
2887−
2888− return 0;
28892875 }
28902876
2891−#if CONFIG_VP7_DECODER
2892−static int vp7_decode_init(AVCodecContext *avctx)
2893−{
2894− return vp78_decode_init(avctx, IS_VP7);
2895−}
2896−#endif /* CONFIG_VP7_DECODER */
2897−
2877+#if CONFIG_VP8_DECODER
28982878 av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
28992879 {
2900− return vp78_decode_init(avctx, IS_VP8);
2880+ VP8Context *s = avctx->priv_data;
2881+
2882+ vp78_decode_init(avctx);
2883+ ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1);
2884+ ff_vp8dsp_init(&s->vp8dsp);
2885+ s->decode_mb_row_no_filter = vp8_decode_mb_row_no_filter;
2886+ s->filter_mb_row = vp8_filter_mb_row;
2887+
2888+ return 0;
29012889 }
29022890
2903−#if CONFIG_VP8_DECODER
29042891 #if HAVE_THREADS
29052892 static void vp8_replace_frame(VP8Frame *dst, const VP8Frame *src)
29062893 {
@@ -2944,6 +2931,19 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, · 37 unmodified lines
29442931 #endif /* CONFIG_VP8_DECODER */
29452932
29462933 #if CONFIG_VP7_DECODER
2934+av_cold static int vp7_decode_init(AVCodecContext *avctx)
2935+{
2936+ VP8Context *s = avctx->priv_data;
2937+
2938+ vp78_decode_init(avctx);
2939+ ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP7, 8, 1);
2940+ ff_vp7dsp_init(&s->vp8dsp);
2941+ s->decode_mb_row_no_filter = vp7_decode_mb_row_no_filter;
2942+ s->filter_mb_row = vp7_filter_mb_row;
2943+
2944+ return 0;
2945+}
2946+
29472947 const FFCodec ff_vp7_decoder = {
29482948 .p.name = "vp7",
29492949 CODEC_LONG_NAME("On2 VP7"),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t