Commit 54dcd228 authored by Alexandra Hájková's avatar Alexandra Hájková Committed by Diego Biurrun

als: Convert to the new bitstream reader

parent fb59f87c
This diff is collapsed.
......@@ -26,6 +26,8 @@
*/
#include "libavutil/attributes.h"
#include "bitstream.h"
#include "bgmc.h"
#define FREQ_BITS 14 // bits used by frequency counters
......@@ -485,24 +487,26 @@ av_cold void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
/** Initialize decoding and reads the first value */
void ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
void ff_bgmc_decode_init(BitstreamContext *bc, unsigned int *h,
unsigned int *l, unsigned int *v)
{
*h = TOP_VALUE;
*l = 0;
*v = get_bits_long(gb, VALUE_BITS);
*v = bitstream_read(bc, VALUE_BITS);
}
/** Finish decoding */
void ff_bgmc_decode_end(GetBitContext *gb)
void ff_bgmc_decode_end(BitstreamContext *bc)
{
skip_bits_long(gb, -(VALUE_BITS - 2));
unsigned pos = bitstream_tell(bc) - VALUE_BITS + 2;
bitstream_seek(bc, pos);
}
/** Read and decode a block Gilbert-Moore coded symbol */
void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
void ff_bgmc_decode(BitstreamContext *bc, unsigned int num, int32_t *dst,
int delta, unsigned int sx,
unsigned int *h, unsigned int *l, unsigned int *v,
uint8_t *cf_lut, int *cf_lut_status)
......@@ -547,7 +551,7 @@ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
low *= 2;
high = 2 * high + 1;
value = 2 * value + get_bits1(gb);
value = 2 * value + bitstream_read_bit(bc);
}
*dst++ = symbol;
......
......@@ -31,7 +31,7 @@
#include "avcodec.h"
#include "get_bits.h"
#include "bitstream.h"
int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status);
......@@ -40,17 +40,17 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status);
void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status);
void ff_bgmc_decode_init(GetBitContext *gb,
unsigned int *h, unsigned int *l, unsigned int *v);
void ff_bgmc_decode_init(BitstreamContext *bc,
unsigned int *h, unsigned int *l, unsigned int *v);
void ff_bgmc_decode_end(GetBitContext *gb);
void ff_bgmc_decode_end(BitstreamContext *bc);
void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
int delta, unsigned int sx,
unsigned int *h, unsigned int *l, unsigned int *v,
uint8_t *cf_lut, int *cf_lut_status);
void ff_bgmc_decode(BitstreamContext *bc, unsigned int num, int32_t *dst,
int delta, unsigned int sx,
unsigned int *h, unsigned int *l, unsigned int *v,
uint8_t *cf_lut, int *cf_lut_status);
#endif /* AVCODEC_BGMC_H */
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