static av_cold int decode_init(AVCodecContext *avctx) { AnmContext *s = avctx->priv_data; int i; avctx->pix_fmt = PIX_FMT_PAL8; s->frame.reference = 1; bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size); if (bytestream2_get_bytes_left(&s->gb) < 16 * 8 + 4 * 256) return -1; bytestream2_skipu(&s->gb, 16 * 8); for (i = 0; i < 256; i++) s->palette[i] = bytestream2_get_le32u(&s->gb); return 0; }
static av_cold int decode_init(AVCodecContext *avctx) { AnmContext *s = avctx->priv_data; int i; avctx->pix_fmt = AV_PIX_FMT_PAL8; s->frame = av_frame_alloc(); if (!s->frame) return AVERROR(ENOMEM); bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size); if (bytestream2_get_bytes_left(&s->gb) < 16 * 8 + 4 * 256) return AVERROR_INVALIDDATA; bytestream2_skipu(&s->gb, 16 * 8); for (i = 0; i < 256; i++) s->palette[i] = bytestream2_get_le32u(&s->gb); return 0; }
static unsigned tget_long(GetByteContext *gb, int le) { unsigned v = le ? bytestream2_get_le32u(gb) : bytestream2_get_be32u(gb); return v; }