MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / mp_decode_init

Function mp_decode_init

libavcodec/motionpixels.c:71–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71static av_cold int mp_decode_init(AVCodecContext *avctx)
72{
73 MotionPixelsContext *mp = avctx->priv_data;
74 int w4 = (avctx->width + 3) & ~3;
75 int h4 = (avctx->height + 3) & ~3;
76
77 if(avctx->extradata_size < 2){
78 av_log(avctx, AV_LOG_ERROR, "extradata too small\n");
79 return AVERROR_INVALIDDATA;
80 }
81
82 mp->avctx = avctx;
83 ff_bswapdsp_init(&mp->bdsp);
84 mp->changes_map = av_calloc(avctx->width, h4);
85 mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
86 mp->vpt = av_calloc(avctx->height, sizeof(*mp->vpt));
87 mp->hpt = av_calloc(h4 / 4, w4 / 4 * sizeof(*mp->hpt));
88 if (!mp->changes_map || !mp->vpt || !mp->hpt)
89 return AVERROR(ENOMEM);
90 avctx->pix_fmt = AV_PIX_FMT_RGB555;
91
92 mp->frame = av_frame_alloc();
93 if (!mp->frame)
94 return AVERROR(ENOMEM);
95
96#if !CONFIG_HARDCODED_TABLES
97 static AVOnce init_static_once = AV_ONCE_INIT;
98 ff_thread_once(&init_static_once, motionpixels_tableinit);
99#endif
100
101 return 0;
102}
103
104static void mp_read_changes_map(MotionPixelsContext *mp, GetBitContext *gb, int count, int bits_len, int read_color)
105{

Callers

nothing calls this directly

Calls 6

av_logFunction · 0.85
ff_bswapdsp_initFunction · 0.85
av_callocFunction · 0.85
av_log2Function · 0.85
av_frame_allocFunction · 0.85
ff_thread_onceFunction · 0.85

Tested by

no test coverage detected