vp9_stop_encode(&bw);
- BOOL_DECODER br;
- vp9_start_decode(&br, bw_buffer, buffer_size);
+ vp9_reader br;
+ vp9_reader_init(&br, bw_buffer, buffer_size);
bit_rnd.Reset(random_seed);
for (int i = 0; i < bits_to_test; ++i) {
if (bit_method == 2) {
#include "vp9/decoder/vp9_dboolhuff.h"
-int vp9_start_decode(BOOL_DECODER *br, const uint8_t *buffer, size_t size) {
- br->buffer_end = buffer + size;
- br->buffer = buffer;
- br->value = 0;
- br->count = -8;
- br->range = 255;
+int vp9_reader_init(vp9_reader *r, const uint8_t *buffer, size_t size) {
+ r->buffer_end = buffer + size;
+ r->buffer = buffer;
+ r->value = 0;
+ r->count = -8;
+ r->range = 255;
if (size && !buffer)
return 1;
- vp9_reader_fill(br);
+ vp9_reader_fill(r);
return 0;
}
-void vp9_reader_fill(BOOL_DECODER *br) {
- const uint8_t *const buffer_end = br->buffer_end;
- const uint8_t *buffer = br->buffer;
- VP9_BD_VALUE value = br->value;
- int count = br->count;
+void vp9_reader_fill(vp9_reader *r) {
+ const uint8_t *const buffer_end = r->buffer_end;
+ const uint8_t *buffer = r->buffer;
+ VP9_BD_VALUE value = r->value;
+ int count = r->count;
int shift = VP9_BD_VALUE_SIZE - 8 - (count + 8);
int loop_end = 0;
const int bits_left = (int)((buffer_end - buffer)*CHAR_BIT);
}
}
- br->buffer = buffer;
- br->value = value;
- br->count = count;
+ r->buffer = buffer;
+ r->value = value;
+ r->count = count;
+}
+
+const uint8_t *vp9_reader_find_end(vp9_reader *r) {
+ // Find the end of the coded buffer
+ while (r->count > CHAR_BIT && r->count < VP9_BD_VALUE_SIZE) {
+ r->count -= CHAR_BIT;
+ r->buffer--;
+ }
+ return r->buffer;
}
VP9_BD_VALUE value;
int count;
unsigned int range;
-} BOOL_DECODER;
+} vp9_reader;
DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]);
-int vp9_start_decode(BOOL_DECODER *br, const uint8_t *buffer, size_t size);
+int vp9_reader_init(vp9_reader *r, const uint8_t *buffer, size_t size);
-void vp9_reader_fill(BOOL_DECODER *br);
+void vp9_reader_fill(vp9_reader *r);
-static INLINE const uint8_t *vp9_reader_find_end(BOOL_DECODER *br) {
- // Find the end of the coded buffer
- while (br->count > CHAR_BIT && br->count < VP9_BD_VALUE_SIZE) {
- br->count -= CHAR_BIT;
- br->buffer--;
- }
- return br->buffer;
-}
+const uint8_t *vp9_reader_find_end(vp9_reader *r);
-static int vp9_read(BOOL_DECODER *br, int probability) {
+static int vp9_read(vp9_reader *br, int probability) {
unsigned int bit = 0;
VP9_BD_VALUE value;
VP9_BD_VALUE bigsplit;
return bit;
}
-static int vp9_read_bit(BOOL_DECODER *r) {
+static int vp9_read_bit(vp9_reader *r) {
return vp9_read(r, 128); // vp9_prob_half
}
-static int vp9_read_literal(BOOL_DECODER *br, int bits) {
+static int vp9_read_literal(vp9_reader *br, int bits) {
int z = 0, bit;
- for (bit = bits - 1; bit >= 0; bit--) {
+ for (bit = bits - 1; bit >= 0; bit--)
z |= vp9_read_bit(br) << bit;
- }
return z;
}
-static int bool_error(BOOL_DECODER *br) {
+static int vp9_reader_has_error(vp9_reader *r) {
// Check if we have reached the end of the buffer.
//
// Variable 'count' stores the number of bits in the 'value' buffer, minus
//
// 1 if we have tried to decode bits after the end of stream was encountered.
// 0 No error.
- return br->count > VP9_BD_VALUE_SIZE && br->count < VP9_LOTS_OF_BITS;
+ return r->count > VP9_BD_VALUE_SIZE && r->count < VP9_LOTS_OF_BITS;
}
#endif // VP9_DECODER_VP9_DBOOLHUFF_H_
if (xd->segmentation_enabled)
mb_init_dequantizer(pbi, xd);
- if (!bool_error(r)) {
+ if (!vp9_reader_has_error(r)) {
#if CONFIG_NEWBINTRAMODES
if (mode != I4X4_PRED)
#endif
mode != I4X4_PRED &&
mode != SPLITMV &&
mode != I8X8_PRED &&
- !bool_error(r)) {
+ !vp9_reader_has_error(r)) {
xd->mode_info_context->mbmi.mb_skip_coeff = 1;
} else {
#if 0 // def DEC_DEBUG
else
decode_mb(pbi, xd, mb_row, mb_col, r);
- xd->corrupted |= bool_error(r);
+ xd->corrupted |= vp9_reader_has_error(r);
}
static void decode_modes_sb(VP9D_COMP *pbi, int mb_row, int mb_col,
"Truncated packet or corrupt partition "
"%d length", 1);
- if (vp9_start_decode(r, data, partition_size))
+ if (vp9_reader_init(r, data, partition_size))
vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate bool decoder %d", 1);
}
pc->width, pc->height,
VP9BORDERINPIXELS);
- if (vp9_start_decode(&header_bc, data, first_partition_size))
+ if (vp9_reader_init(&header_bc, data, first_partition_size))
vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate bool decoder 0");
// Collect information about decoder corruption.
// 1. Check first boolean decoder for errors.
// 2. Check the macroblock information
- pc->yv12_fb[pc->new_fb_idx].corrupted = bool_error(&header_bc) |
+ pc->yv12_fb[pc->new_fb_idx].corrupted = vp9_reader_has_error(&header_bc) |
corrupt_tokens;
if (!pbi->decoded_key_frame) {
#include "vp9/common/vp9_treecoder.h"
#include "vp9/decoder/vp9_dboolhuff.h"
-typedef BOOL_DECODER vp9_reader;
-
#define vp9_read_prob(r) ((vp9_prob)vp9_read_literal(r, 8))
#define vp9_read_and_apply_sign(r, value) (vp9_read_bit(r) ? -(value) : (value))