*/
#include "libavutil/attributes.h"
+
+#include "bitstream.h"
#include "bgmc.h"
#define FREQ_BITS 14 // bits used by frequency counters
/** 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)
low *= 2;
high = 2 * high + 1;
- value = 2 * value + get_bits1(gb);
+ value = 2 * value + bitstream_read_bit(bc);
}
*dst++ = symbol;