summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandra Hájková <alexandra@khirnov.net>2016-04-10 20:20:10 +0200
committerAlexandra Hájková <alexandra@khirnov.net>2016-05-22 16:47:58 +0200
commitd46f62524f46b1bef9063a97bf01199f88e937f3 (patch)
treeb907fa1e0e0bba43464c52ee245f464ca0126749
parent20a0b3cffb7f29f9cf76f90320d7d674253aa6a1 (diff)
mimic: convert to the new bitstream reader
-rw-r--r--libavcodec/mimic.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index 6f43723ef6..d247860c37 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -26,7 +26,7 @@
#include "avcodec.h"
#include "blockdsp.h"
#include "internal.h"
-#include "get_bits.h"
+#include "bitstream.h"
#include "bytestream.h"
#include "bswapdsp.h"
#include "hpeldsp.h"
@@ -51,7 +51,7 @@ typedef struct MimicContext {
DECLARE_ALIGNED(16, int16_t, dct_block)[64];
- GetBitContext gb;
+ BitstreamContext bc;
ScanTable scantable;
BlockDSPContext bdsp;
BswapDSPContext bbdsp;
@@ -232,14 +232,14 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
ctx->bdsp.clear_block(block);
- block[0] = get_bits(&ctx->gb, 8) << 3;
+ block[0] = bitstream_read(&ctx->bc, 8) << 3;
for (pos = 1; pos < num_coeffs; pos++) {
uint32_t vlc, num_bits;
int value;
int coeff;
- vlc = get_vlc2(&ctx->gb, ctx->vlc.table, ctx->vlc.bits, 3);
+ vlc = bitstream_read_vlc(&ctx->bc, ctx->vlc.table, ctx->vlc.bits, 3);
if (!vlc) /* end-of-block code */
return 0;
if (vlc == -1)
@@ -252,7 +252,7 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
if (pos >= 64)
return AVERROR_INVALIDDATA;
- value = get_bits(&ctx->gb, num_bits);
+ value = bitstream_read(&ctx->bc, num_bits);
/* Libav's IDCT behaves somewhat different from the original code, so
* a factor of 4 was added to the input */
@@ -286,13 +286,13 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
for (x = 0; x < ctx->num_hblocks[plane]; x++) {
/* Check for a change condition in the current block.
* - iframes always change.
- * - Luma plane changes on get_bits1 == 0
- * - Chroma planes change on get_bits1 == 1 */
- if (is_iframe || get_bits1(&ctx->gb) == is_chroma) {
+ * - Luma plane changes on bitstream_read_bit == 0
+ * - Chroma planes change on bitstream_read_bit == 1 */
+ if (is_iframe || bitstream_read_bit(&ctx->bc) == is_chroma) {
/* Luma planes may use a backreference from the 15 last
- * frames preceding the previous. (get_bits1 == 1)
+ * frames preceding the previous. (bitstream_read_bit == 1)
* Chroma planes don't use backreferences. */
- if (is_chroma || is_iframe || !get_bits1(&ctx->gb)) {
+ if (is_chroma || is_iframe || !bitstream_read_bit(&ctx->bc)) {
if ((ret = vlc_decode_block(ctx, num_coeffs,
qscale)) < 0) {
av_log(ctx->avctx, AV_LOG_ERROR, "Error decoding "
@@ -301,7 +301,7 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
}
ctx->idsp.idct_put(dst, stride, ctx->dct_block);
} else {
- unsigned int backref = get_bits(&ctx->gb, 4);
+ unsigned int backref = bitstream_read(&ctx->bc, 4);
int index = (ctx->cur_index + backref) & 15;
uint8_t *p = ctx->frames[index].f->data[0];
@@ -426,7 +426,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
ctx->bbdsp.bswap_buf(ctx->swap_buf,
(const uint32_t *) (buf + MIMIC_HEADER_SIZE),
swap_buf_size >> 2);
- init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3);
+ bitstream_init(&ctx->bc, ctx->swap_buf, swap_buf_size << 3);
res = decode(ctx, quality, num_coeffs, !is_pframe);
ff_thread_report_progress(&ctx->frames[ctx->cur_index], INT_MAX, 0);