| 69 | } |
| 70 | |
| 71 | static 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 | |
| 104 | static void mp_read_changes_map(MotionPixelsContext *mp, GetBitContext *gb, int count, int bits_len, int read_color) |
| 105 | { |
nothing calls this directly
no test coverage detected