mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-04-26 13:18:08 +00:00
exr: Convert to the new bitstream reader
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
2906d8dcb3
commit
8df1ac6b78
@ -39,8 +39,8 @@
|
|||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
|
#include "bitstream.h"
|
||||||
#include "bytestream.h"
|
#include "bytestream.h"
|
||||||
#include "get_bits.h"
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "mathops.h"
|
#include "mathops.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
@ -379,16 +379,16 @@ static void huf_canonical_code_table(uint64_t *hcode)
|
|||||||
static int huf_unpack_enc_table(GetByteContext *gb,
|
static int huf_unpack_enc_table(GetByteContext *gb,
|
||||||
int32_t im, int32_t iM, uint64_t *hcode)
|
int32_t im, int32_t iM, uint64_t *hcode)
|
||||||
{
|
{
|
||||||
GetBitContext gbit;
|
BitstreamContext bc;
|
||||||
int ret = init_get_bits8(&gbit, gb->buffer, bytestream2_get_bytes_left(gb));
|
int ret = bitstream_init8(&bc, gb->buffer, bytestream2_get_bytes_left(gb));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (; im <= iM; im++) {
|
for (; im <= iM; im++) {
|
||||||
uint64_t l = hcode[im] = get_bits(&gbit, 6);
|
uint64_t l = hcode[im] = bitstream_read(&bc, 6);
|
||||||
|
|
||||||
if (l == LONG_ZEROCODE_RUN) {
|
if (l == LONG_ZEROCODE_RUN) {
|
||||||
int zerun = get_bits(&gbit, 8) + SHORTEST_LONG_RUN;
|
int zerun = bitstream_read(&bc, 8) + SHORTEST_LONG_RUN;
|
||||||
|
|
||||||
if (im + zerun > iM + 1)
|
if (im + zerun > iM + 1)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -410,7 +410,7 @@ static int huf_unpack_enc_table(GetByteContext *gb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bytestream2_skip(gb, (get_bits_count(&gbit) + 7) / 8);
|
bytestream2_skip(gb, (bitstream_tell(&bc) + 7) / 8);
|
||||||
huf_canonical_code_table(hcode);
|
huf_canonical_code_table(hcode);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user