Commit dba425ad authored by Paul B Mahol's avatar Paul B Mahol Committed by Ronald S. Bultje

mimic: convert to bytestream2 API

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarRonald S. Bultje <rsbultje@gmail.com>
parent 05d089a8
...@@ -306,6 +306,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, ...@@ -306,6 +306,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;
MimicContext *ctx = avctx->priv_data; MimicContext *ctx = avctx->priv_data;
GetByteContext gb;
int is_pframe; int is_pframe;
int width, height; int width, height;
int quality, num_coeffs; int quality, num_coeffs;
...@@ -316,14 +317,15 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, ...@@ -316,14 +317,15 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
return -1; return -1;
} }
buf += 2; /* some constant (always 256) */ bytestream2_init(&gb, buf, MIMIC_HEADER_SIZE);
quality = bytestream_get_le16(&buf); bytestream2_skip(&gb, 2); /* some constant (always 256) */
width = bytestream_get_le16(&buf); quality = bytestream2_get_le16u(&gb);
height = bytestream_get_le16(&buf); width = bytestream2_get_le16u(&gb);
buf += 4; /* some constant */ height = bytestream2_get_le16u(&gb);
is_pframe = bytestream_get_le32(&buf); bytestream2_skip(&gb, 4); /* some constant */
num_coeffs = bytestream_get_byte(&buf); is_pframe = bytestream2_get_le32u(&gb);
buf += 3; /* some constant */ num_coeffs = bytestream2_get_byteu(&gb);
bytestream2_skip(&gb, 3); /* some constant */
if(!ctx->avctx) { if(!ctx->avctx) {
int i; int i;
...@@ -373,7 +375,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, ...@@ -373,7 +375,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ctx->dsp.bswap_buf(ctx->swap_buf, ctx->dsp.bswap_buf(ctx->swap_buf,
(const uint32_t*) buf, (const uint32_t*) (buf + MIMIC_HEADER_SIZE),
swap_buf_size>>2); swap_buf_size>>2);
init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3); init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment