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
2858 return 0;2858 return 0;
2859}2859}
2860 2860
2861static av_always_inline2861static av_cold void vp78_decode_init(AVCodecContext *avctx)
2862int vp78_decode_init(AVCodecContext *avctx, int is_vp7)
2863{2862{
2864 VP8Context *s = avctx->priv_data;2863 VP8Context *s = avctx->priv_data;
2865 2864
@@ -2870,37 +2869,25 @@ int vp78_decode_init(AVCodecContext *avctx, int is_vp7) · 4 unmodified lines
2870 ff_videodsp_init(&s->vdsp, 8);2869 ff_videodsp_init(&s->vdsp, 8);
2871 2870
2872 ff_vp78dsp_init(&s->vp8dsp);2871 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 }
2884 2872
2885 /* does not change for VP8 */2873 /* does not change for VP8 */
2886 memcpy(s->prob[0].scan, ff_zigzag_scan, sizeof(s->prob[0].scan));2874 memcpy(s->prob[0].scan, ff_zigzag_scan, sizeof(s->prob[0].scan));
2887
2888 return 0;
2889}2875}
2890 2876
2891#if CONFIG_VP7_DECODER2877#if CONFIG_VP8_DECODER
2892static int vp7_decode_init(AVCodecContext *avctx)
2893{
2894 return vp78_decode_init(avctx, IS_VP7);
2895}
2896#endif /* CONFIG_VP7_DECODER */
2897
2898av_cold int ff_vp8_decode_init(AVCodecContext *avctx)2878av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
2899{2879{
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;
2901}2889}
2902 2890
2903#if CONFIG_VP8_DECODER
2904#if HAVE_THREADS2891#if HAVE_THREADS
2905static void vp8_replace_frame(VP8Frame *dst, const VP8Frame *src)2892static void vp8_replace_frame(VP8Frame *dst, const VP8Frame *src)
2906{2893{
@@ -2944,6 +2931,19 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, · 37 unmodified lines
2944#endif /* CONFIG_VP8_DECODER */2931#endif /* CONFIG_VP8_DECODER */
2945 2932
2946#if CONFIG_VP7_DECODER2933#if CONFIG_VP7_DECODER
2934av_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
2947const FFCodec ff_vp7_decoder = {2947const FFCodec ff_vp7_decoder = {
2948 .p.name = "vp7",2948 .p.name = "vp7",
2949 CODEC_LONG_NAME("On2 VP7"),2949 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