Commit 8a061d42 authored by clang-format's avatar clang-format Committed by James Zern

vp10/decoder,vp10/*.[hc]: apply clang-format

Change-Id: Ie4d7ecb2f692c1c43eff1242e1f00e7fbae00e57
parent 9c6a7cab
This diff is collapsed.
......@@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef VP10_DECODER_DECODEFRAME_H_
#define VP10_DECODER_DECODEFRAME_H_
......@@ -20,13 +19,12 @@ struct VP10Decoder;
struct vpx_read_bit_buffer;
int vp10_read_sync_code(struct vpx_read_bit_buffer *const rb);
void vp10_read_frame_size(struct vpx_read_bit_buffer *rb,
int *width, int *height);
void vp10_read_frame_size(struct vpx_read_bit_buffer *rb, int *width,
int *height);
BITSTREAM_PROFILE vp10_read_profile(struct vpx_read_bit_buffer *rb);
void vp10_decode_frame(struct VP10Decoder *pbi,
const uint8_t *data, const uint8_t *data_end,
const uint8_t **p_data_end);
void vp10_decode_frame(struct VP10Decoder *pbi, const uint8_t *data,
const uint8_t *data_end, const uint8_t **p_data_end);
#ifdef __cplusplus
} // extern "C"
......
This diff is collapsed.
......@@ -24,8 +24,8 @@ void vp10_read_mode_info(VP10Decoder *const pbi, MACROBLOCKD *xd,
int supertx_enabled,
#endif
int mi_row, int mi_col, vp10_reader *r,
int x_mis, int y_mis);
int mi_row, int mi_col, vp10_reader *r, int x_mis,
int y_mis);
#ifdef __cplusplus
} // extern "C"
......
......@@ -58,12 +58,10 @@ static void vp10_dec_setup_mi(VP10_COMMON *cm) {
static int vp10_dec_alloc_mi(VP10_COMMON *cm, int mi_size) {
cm->mip = vpx_calloc(mi_size, sizeof(*cm->mip));
if (!cm->mip)
return 1;
if (!cm->mip) return 1;
cm->mi_alloc_size = mi_size;
cm->mi_grid_base = (MODE_INFO **)vpx_calloc(mi_size, sizeof(MODE_INFO*));
if (!cm->mi_grid_base)
return 1;
cm->mi_grid_base = (MODE_INFO **)vpx_calloc(mi_size, sizeof(MODE_INFO *));
if (!cm->mi_grid_base) return 1;
return 0;
}
......@@ -78,8 +76,7 @@ VP10Decoder *vp10_decoder_create(BufferPool *const pool) {
VP10Decoder *volatile const pbi = vpx_memalign(32, sizeof(*pbi));
VP10_COMMON *volatile const cm = pbi ? &pbi->common : NULL;
if (!cm)
return NULL;
if (!cm) return NULL;
vp10_zero(*pbi);
......@@ -91,11 +88,10 @@ VP10Decoder *vp10_decoder_create(BufferPool *const pool) {
cm->error.setjmp = 1;
CHECK_MEM_ERROR(cm, cm->fc,
(FRAME_CONTEXT *)vpx_calloc(1, sizeof(*cm->fc)));
CHECK_MEM_ERROR(cm, cm->frame_contexts,
(FRAME_CONTEXT *)vpx_calloc(FRAME_CONTEXTS,
sizeof(*cm->frame_contexts)));
CHECK_MEM_ERROR(cm, cm->fc, (FRAME_CONTEXT *)vpx_calloc(1, sizeof(*cm->fc)));
CHECK_MEM_ERROR(
cm, cm->frame_contexts,
(FRAME_CONTEXT *)vpx_calloc(FRAME_CONTEXTS, sizeof(*cm->frame_contexts)));
pbi->need_resync = 1;
once(initialize_dec);
......@@ -130,8 +126,7 @@ VP10Decoder *vp10_decoder_create(BufferPool *const pool) {
void vp10_decoder_remove(VP10Decoder *pbi) {
int i;
if (!pbi)
return;
if (!pbi) return;
vpx_get_worker_interface()->end(&pbi->lf_worker);
vpx_free(pbi->lf_worker.data1);
......@@ -153,13 +148,13 @@ void vp10_decoder_remove(VP10Decoder *pbi) {
static int equal_dimensions(const YV12_BUFFER_CONFIG *a,
const YV12_BUFFER_CONFIG *b) {
return a->y_height == b->y_height && a->y_width == b->y_width &&
a->uv_height == b->uv_height && a->uv_width == b->uv_width;
return a->y_height == b->y_height && a->y_width == b->y_width &&
a->uv_height == b->uv_height && a->uv_width == b->uv_width;
}
vpx_codec_err_t vp10_copy_reference_dec(VP10Decoder *pbi,
VPX_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd) {
VPX_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd) {
VP10_COMMON *cm = &pbi->common;
/* TODO(jkoleszar): The decoder doesn't have any real knowledge of what the
......@@ -180,17 +175,15 @@ vpx_codec_err_t vp10_copy_reference_dec(VP10Decoder *pbi,
else
vpx_yv12_copy_frame(cfg, sd);
} else {
vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
"Invalid reference frame");
vpx_internal_error(&cm->error, VPX_CODEC_ERROR, "Invalid reference frame");
}
return cm->error.error_code;
}
vpx_codec_err_t vp10_set_reference_dec(VP10_COMMON *cm,
VPX_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd) {
VPX_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd) {
int idx;
YV12_BUFFER_CONFIG *ref_buf = NULL;
......@@ -235,8 +228,7 @@ vpx_codec_err_t vp10_set_reference_dec(VP10_COMMON *cm,
idx = cm->ref_frame_map[2];
#endif // CONFIG_EXT_REFS
} else {
vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
"Invalid reference frame");
vpx_internal_error(&cm->error, VPX_CODEC_ERROR, "Invalid reference frame");
return cm->error.error_code;
}
......@@ -275,8 +267,7 @@ static void swap_frame_buffers(VP10Decoder *pbi) {
// Release the reference frame holding in the reference map for the decoding
// of the next frame.
if (mask & 1)
decrease_ref_count(old_idx, frame_bufs, pool);
if (mask & 1) decrease_ref_count(old_idx, frame_bufs, pool);
cm->ref_frame_map[ref_index] = cm->next_ref_frame_map[ref_index];
++ref_index;
}
......@@ -307,8 +298,8 @@ static void swap_frame_buffers(VP10Decoder *pbi) {
}
}
int vp10_receive_compressed_data(VP10Decoder *pbi,
size_t size, const uint8_t **psource) {
int vp10_receive_compressed_data(VP10Decoder *pbi, size_t size,
const uint8_t **psource) {
VP10_COMMON *volatile const cm = &pbi->common;
BufferPool *volatile const pool = cm->buffer_pool;
RefCntBuffer *volatile const frame_bufs = cm->buffer_pool->frame_bufs;
......@@ -338,15 +329,14 @@ int vp10_receive_compressed_data(VP10Decoder *pbi,
// Check if the previous frame was a frame without any references to it.
// Release frame buffer if not decoding in frame parallel mode.
if (!cm->frame_parallel_decode && cm->new_fb_idx >= 0
&& frame_bufs[cm->new_fb_idx].ref_count == 0)
if (!cm->frame_parallel_decode && cm->new_fb_idx >= 0 &&
frame_bufs[cm->new_fb_idx].ref_count == 0)
pool->release_fb_cb(pool->cb_priv,
&frame_bufs[cm->new_fb_idx].raw_frame_buffer);
// Find a free frame buffer. Return error if can not find any.
cm->new_fb_idx = get_free_fb(cm);
if (cm->new_fb_idx == INVALID_IDX)
return VPX_CODEC_MEM_ERROR;
if (cm->new_fb_idx == INVALID_IDX) return VPX_CODEC_MEM_ERROR;
// Assign a MV array to the frame buffer.
cm->cur_frame = &pool->frame_bufs[cm->new_fb_idx];
......@@ -388,10 +378,9 @@ int vp10_receive_compressed_data(VP10Decoder *pbi,
// Current thread releases the holding of reference frame.
decrease_ref_count(old_idx, frame_bufs, pool);
// Release the reference frame holding in the reference map for the
// decoding of the next frame.
if (mask & 1)
decrease_ref_count(old_idx, frame_bufs, pool);
// Release the reference frame holding in the reference map for the
// decoding of the next frame.
if (mask & 1) decrease_ref_count(old_idx, frame_bufs, pool);
++ref_index;
}
......@@ -468,14 +457,12 @@ int vp10_receive_compressed_data(VP10Decoder *pbi,
int vp10_get_raw_frame(VP10Decoder *pbi, YV12_BUFFER_CONFIG *sd) {
VP10_COMMON *const cm = &pbi->common;
int ret = -1;
if (pbi->ready_for_new_data == 1)
return ret;
if (pbi->ready_for_new_data == 1) return ret;
pbi->ready_for_new_data = 1;
/* no raw frame to show!!! */
if (!cm->show_frame)
return ret;
if (!cm->show_frame) return ret;
pbi->ready_for_new_data = 1;
*sd = *cm->frame_to_show;
......@@ -484,22 +471,19 @@ int vp10_get_raw_frame(VP10Decoder *pbi, YV12_BUFFER_CONFIG *sd) {
return ret;
}
int vp10_get_frame_to_show(VP10Decoder *pbi,
YV12_BUFFER_CONFIG *frame) {
int vp10_get_frame_to_show(VP10Decoder *pbi, YV12_BUFFER_CONFIG *frame) {
VP10_COMMON *const cm = &pbi->common;
if (!cm->show_frame || !cm->frame_to_show)
return -1;
if (!cm->show_frame || !cm->frame_to_show) return -1;
*frame = *cm->frame_to_show;
return 0;
}
vpx_codec_err_t vp10_parse_superframe_index(const uint8_t *data,
size_t data_sz,
uint32_t sizes[8], int *count,
vpx_decrypt_cb decrypt_cb,
void *decrypt_state) {
vpx_codec_err_t vp10_parse_superframe_index(const uint8_t *data, size_t data_sz,
uint32_t sizes[8], int *count,
vpx_decrypt_cb decrypt_cb,
void *decrypt_state) {
// A chunk ending with a byte matching 0xc0 is an invalid chunk unless
// it is a super frame index. If the last byte of real video compression
// data is 0xc0 the encoder must add a 0 byte. If we have the marker but
......@@ -520,18 +504,16 @@ vpx_codec_err_t vp10_parse_superframe_index(const uint8_t *data,
// This chunk is marked as having a superframe index but doesn't have
// enough data for it, thus it's an invalid superframe index.
if (data_sz < index_sz)
return VPX_CODEC_CORRUPT_FRAME;
if (data_sz < index_sz) return VPX_CODEC_CORRUPT_FRAME;
{
const uint8_t marker2 = read_marker(decrypt_cb, decrypt_state,
data + data_sz - index_sz);
const uint8_t marker2 =
read_marker(decrypt_cb, decrypt_state, data + data_sz - index_sz);
// This chunk is marked as having a superframe index but doesn't have
// the matching marker byte at the front of the index therefore it's an
// invalid chunk.
if (marker != marker2)
return VPX_CODEC_CORRUPT_FRAME;
if (marker != marker2) return VPX_CODEC_CORRUPT_FRAME;
}
{
......@@ -550,8 +532,7 @@ vpx_codec_err_t vp10_parse_superframe_index(const uint8_t *data,
for (i = 0; i < frames - 1; ++i) {
uint32_t this_sz = 0;
for (j = 0; j < mag; ++j)
this_sz |= (*x++) << (j * 8);
for (j = 0; j < mag; ++j) this_sz |= (*x++) << (j * 8);
this_sz += 1;
sizes[i] = this_sz;
frame_sz_sum += this_sz;
......
......@@ -52,7 +52,7 @@ typedef struct TileBufferDec {
size_t size;
const uint8_t *raw_data_end; // The end of the raw tile buffer in the
// bit stream.
int col; // only used with multi-threaded decoding
int col; // only used with multi-threaded decoding
} TileBufferDec;
typedef struct VP10Decoder {
......@@ -66,9 +66,9 @@ typedef struct VP10Decoder {
// TODO(hkuang): Combine this with cur_buf in macroblockd as they are
// the same.
RefCntBuffer *cur_buf; // Current decoding frame buffer.
RefCntBuffer *cur_buf; // Current decoding frame buffer.
VPxWorker *frame_worker_owner; // frame_worker that owns this pbi.
VPxWorker *frame_worker_owner; // frame_worker that owns this pbi.
VPxWorker lf_worker;
VPxWorker *tile_workers;
TileWorkerData *tile_worker_data;
......@@ -87,7 +87,7 @@ typedef struct VP10Decoder {
int max_threads;
int inv_tile_order;
int need_resync; // wait for key/intra-only frame.
int need_resync; // wait for key/intra-only frame.
int hold_ref_buf; // hold the reference buffer.
int tile_size_bytes;
......@@ -97,24 +97,23 @@ typedef struct VP10Decoder {
#endif // CONFIG_EXT_TILE
} VP10Decoder;
int vp10_receive_compressed_data(struct VP10Decoder *pbi,
size_t size, const uint8_t **dest);
int vp10_receive_compressed_data(struct VP10Decoder *pbi, size_t size,
const uint8_t **dest);
int vp10_get_raw_frame(struct VP10Decoder *pbi, YV12_BUFFER_CONFIG *sd);
int vp10_get_frame_to_show(struct VP10Decoder *pbi, YV12_BUFFER_CONFIG *frame);
vpx_codec_err_t vp10_copy_reference_dec(struct VP10Decoder *pbi,
VPX_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd);
VPX_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd);
vpx_codec_err_t vp10_set_reference_dec(VP10_COMMON *cm,
VPX_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd);
VPX_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd);
static INLINE uint8_t read_marker(vpx_decrypt_cb decrypt_cb,
void *decrypt_state,
const uint8_t *data) {
void *decrypt_state, const uint8_t *data) {
if (decrypt_cb) {
uint8_t marker;
decrypt_cb(decrypt_state, data, &marker, 1);
......@@ -125,11 +124,10 @@ static INLINE uint8_t read_marker(vpx_decrypt_cb decrypt_cb,
// This function is exposed for use in tests, as well as the inlined function
// "read_marker".
vpx_codec_err_t vp10_parse_superframe_index(const uint8_t *data,
size_t data_sz,
uint32_t sizes[8], int *count,
vpx_decrypt_cb decrypt_cb,
void *decrypt_state);
vpx_codec_err_t vp10_parse_superframe_index(const uint8_t *data, size_t data_sz,
uint32_t sizes[8], int *count,
vpx_decrypt_cb decrypt_cb,
void *decrypt_state);
struct VP10Decoder *vp10_decoder_create(BufferPool *const pool);
......@@ -158,8 +156,7 @@ static INLINE int dec_is_ref_frame_buf(VP10Decoder *const pbi,
for (i = 0; i < INTER_REFS_PER_FRAME; ++i) {
RefBuffer *const ref_frame = &cm->frame_refs[i];
if (ref_frame->idx == INVALID_IDX) continue;
if (frame_buf == &cm->buffer_pool->frame_bufs[ref_frame->idx])
break;
if (frame_buf == &cm->buffer_pool->frame_bufs[ref_frame->idx]) break;
}
return (i < INTER_REFS_PER_FRAME);
}
......
......@@ -19,34 +19,31 @@
#include "vp10/decoder/detokenize.h"
#define EOB_CONTEXT_NODE 0
#define ZERO_CONTEXT_NODE 1
#define ONE_CONTEXT_NODE 2
#define LOW_VAL_CONTEXT_NODE 0
#define TWO_CONTEXT_NODE 1
#define THREE_CONTEXT_NODE 2
#define HIGH_LOW_CONTEXT_NODE 3
#define CAT_ONE_CONTEXT_NODE 4
#define CAT_THREEFOUR_CONTEXT_NODE 5
#define CAT_THREE_CONTEXT_NODE 6
#define CAT_FIVE_CONTEXT_NODE 7
#define INCREMENT_COUNT(token) \
do { \
if (counts) \
++coef_counts[band][ctx][token]; \
#define EOB_CONTEXT_NODE 0
#define ZERO_CONTEXT_NODE 1
#define ONE_CONTEXT_NODE 2
#define LOW_VAL_CONTEXT_NODE 0
#define TWO_CONTEXT_NODE 1
#define THREE_CONTEXT_NODE 2
#define HIGH_LOW_CONTEXT_NODE 3
#define CAT_ONE_CONTEXT_NODE 4
#define CAT_THREEFOUR_CONTEXT_NODE 5
#define CAT_THREE_CONTEXT_NODE 6
#define CAT_FIVE_CONTEXT_NODE 7
#define INCREMENT_COUNT(token) \
do { \
if (counts) ++coef_counts[band][ctx][token]; \
} while (0)
#if !CONFIG_ANS
static INLINE int read_coeff(const vpx_prob *probs, int n, vp10_reader *r) {
int i, val = 0;
for (i = 0; i < n; ++i)
val = (val << 1) | vp10_read(r, probs[i]);
for (i = 0; i < n; ++i) val = (val << 1) | vp10_read(r, probs[i]);
return val;
}
static int decode_coefs(const MACROBLOCKD *xd,
PLANE_TYPE type,
static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
tran_low_t *dqcoeff, TX_SIZE tx_size, TX_TYPE tx_type,
const int16_t *dq,
#if CONFIG_NEW_QUANT
......@@ -60,11 +57,11 @@ static int decode_coefs(const MACROBLOCKD *xd,
const int ref = is_inter_block(&xd->mi[0]->mbmi);
int band, c = 0;
const int tx_size_ctx = txsize_sqr_map[tx_size];
const vpx_prob (*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
const vpx_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
fc->coef_probs[tx_size_ctx][type][ref];
const vpx_prob *prob;
unsigned int (*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
unsigned int (*eob_branch_count)[COEFF_CONTEXTS];
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
unsigned int(*eob_branch_count)[COEFF_CONTEXTS];
uint8_t token_cache[MAX_TX_SQUARE];
const uint8_t *band_translate = get_band_translate(tx_size);
int dq_shift;
......@@ -125,8 +122,7 @@ static int decode_coefs(const MACROBLOCKD *xd,
int val = -1;
band = *band_translate++;
prob = coef_probs[band][ctx];
if (counts)
++eob_branch_count[band][ctx];
if (counts) ++eob_branch_count[band][ctx];
if (!vp10_read(r, prob[EOB_CONTEXT_NODE])) {
INCREMENT_COUNT(EOB_MODEL_TOKEN);
break;
......@@ -141,8 +137,7 @@ static int decode_coefs(const MACROBLOCKD *xd,
dqv = dq[1];
token_cache[scan[c]] = 0;
++c;
if (c >= max_eob)
return c; // zero tokens at the end (no eob token)
if (c >= max_eob) return c; // zero tokens at the end (no eob token)
ctx = get_coef_context(nb, token_cache, c);
band = *band_translate++;
prob = coef_probs[band][ctx];
......@@ -158,13 +153,11 @@ static int decode_coefs(const MACROBLOCKD *xd,
} else {
INCREMENT_COUNT(TWO_TOKEN);
token = vp10_read_tree(r, vp10_coef_con_tree,
vp10_pareto8_full[prob[PIVOT_NODE] - 1]);
vp10_pareto8_full[prob[PIVOT_NODE] - 1]);
switch (token) {
case TWO_TOKEN:
case THREE_TOKEN:
case FOUR_TOKEN:
val = token;
break;
case FOUR_TOKEN: val = token; break;
case CATEGORY1_TOKEN:
val = CAT1_MIN_VAL + read_coeff(cat1_prob, 1, r);
break;
......@@ -194,9 +187,7 @@ static int decode_coefs(const MACROBLOCKD *xd,
case VPX_BITS_12:
val = CAT6_MIN_VAL + read_coeff(cat6p, 18 - skip_bits, r);
break;
default:
assert(0);
return -1;
default: assert(0); return -1;
}
#else
val = CAT6_MIN_VAL + read_coeff(cat6p, 14 - skip_bits, r);
......@@ -214,8 +205,7 @@ static int decode_coefs(const MACROBLOCKD *xd,
#if CONFIG_COEFFICIENT_RANGE_CHECKING
#if CONFIG_VP9_HIGHBITDEPTH
dqcoeff[scan[c]] = highbd_check_range((vp10_read_bit(r) ? -v : v),
xd->bd);
dqcoeff[scan[c]] = highbd_check_range((vp10_read_bit(r) ? -v : v), xd->bd);
#else
dqcoeff[scan[c]] = check_range(vp10_read_bit(r) ? -v : v);
#endif // CONFIG_VP9_HIGHBITDEPTH
......@@ -234,16 +224,13 @@ static int decode_coefs(const MACROBLOCKD *xd,
static INLINE int read_coeff(const vpx_prob *const probs, int n,
struct AnsDecoder *const ans) {
int i, val = 0;
for (i = 0; i < n; ++i)
val = (val << 1) | uabs_read(ans, probs[i]);
for (i = 0; i < n; ++i) val = (val << 1) | uabs_read(ans, probs[i]);
return val;
}
static int decode_coefs_ans(const MACROBLOCKD *const xd,
PLANE_TYPE type,
static int decode_coefs_ans(const MACROBLOCKD *const xd, PLANE_TYPE type,
tran_low_t *dqcoeff, TX_SIZE tx_size,
TX_TYPE tx_type,
const int16_t *dq,
TX_TYPE tx_type, const int16_t *dq,
#if CONFIG_NEW_QUANT
dequant_val_type_nuq *dq_val,
#endif // CONFIG_NEW_QUANT
......@@ -256,14 +243,14 @@ static int decode_coefs_ans(const MACROBLOCKD *const xd,
int band, c = 0;
int skip_eob = 0;
const int tx_size_ctx = txsize_sqr_map[tx_size];
const vpx_prob (*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
const vpx_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
fc->coef_probs[tx_size_ctx][type][ref];
const rans_dec_lut(*coef_cdfs)[COEFF_CONTEXTS] =
fc->coef_cdfs[tx_size_ctx][type][ref];
const vpx_prob *prob;
const rans_dec_lut *cdf;
unsigned int (*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
unsigned int (*eob_branch_count)[COEFF_CONTEXTS];
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
unsigned int(*eob_branch_count)[COEFF_CONTEXTS];
uint8_t token_cache[MAX_TX_SQUARE];
const uint8_t *band_translate = get_band_translate(tx_size);
int dq_shift;
......@@ -325,8 +312,7 @@ static int decode_coefs_ans(const MACROBLOCKD *const xd,
band = *band_translate++;
prob = coef_probs[band][ctx];
if (!skip_eob) {
if (counts)
++eob_branch_count[band][ctx];
if (counts) ++eob_branch_count[band][ctx];
if (!uabs_read(ans, prob[EOB_CONTEXT_NODE])) {
INCREMENT_COUNT(EOB_MODEL_TOKEN);
break;
......@@ -349,9 +335,7 @@ static int decode_coefs_ans(const MACROBLOCKD *const xd,
case ONE_TOKEN:
case TWO_TOKEN:
case THREE_TOKEN:
case FOUR_TOKEN:
val = token;
break;
case FOUR_TOKEN: val = token; break;
case CATEGORY1_TOKEN:
val = CAT1_MIN_VAL + read_coeff(cat1_prob, 1, ans);
break;
......@@ -381,9 +365,7 @@ static int decode_coefs_ans(const MACROBLOCKD *const xd,
case VPX_BITS_12:
val = CAT6_MIN_VAL + read_coeff(cat6p, 18 - skip_bits, ans);
break;
default:
assert(0);
return -1;
default: assert(0); return -1;
}
#else
val = CAT6_MIN_VAL + read_coeff(cat6p, 14 - skip_bits, ans);
......@@ -391,10 +373,10 @@ static int decode_coefs_ans(const MACROBLOCKD *const xd,
} break;
}
#if CONFIG_NEW_QUANT
v = vp10_dequant_abscoeff_nuq(val, dqv, dqv_val);
v = dq_shift ? ROUND_POWER_OF_TWO(v, dq_shift) : v;
v = vp10_dequant_abscoeff_nuq(val, dqv, dqv_val);
v = dq_shift ? ROUND_POWER_OF_TWO(v, dq_shift) : v;
#else
v = (val * dqv) >> dq_shift;
v = (val * dqv) >> dq_shift;
#endif // CONFIG_NEW_QUANT
#if CONFIG_COEFFICIENT_RANGE_CHECKING
......@@ -419,12 +401,12 @@ static int decode_coefs_ans(const MACROBLOCKD *const xd,
}
#endif // !CONFIG_ANS
// TODO(slavarnway): Decode version of vp10_set_context. Modify vp10_set_context
// TODO(slavarnway): Decode version of vp10_set_context. Modify
// vp10_set_context
// after testing is complete, then delete this version.
static
void dec_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
TX_SIZE tx_size, int has_eob,
int aoff, int loff) {
static void dec_set_contexts(const MACROBLOCKD *xd,
struct macroblockd_plane *pd, TX_SIZE tx_size,
int has_eob, int aoff, int loff) {
ENTROPY_CONTEXT *const a = pd->above_context + aoff;
ENTROPY_CONTEXT *const l = pd->left_context + loff;
const int tx_w_in_blocks = num_4x4_blocks_wide_txsize_lookup[tx_size];
......@@ -433,16 +415,14 @@ void dec_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
// above
if (has_eob && xd->mb_to_right_edge < 0) {
int i;
const int blocks_wide = pd->n4_w +
(xd->mb_to_right_edge >> (5 + pd->subsampling_x));
const int blocks_wide =
pd->n4_w + (xd->mb_to_right_edge >> (5 + pd->subsampling_x));
int above_contexts = tx_w_in_blocks;
if (above_contexts + aoff > blocks_wide)
above_contexts = blocks_wide - aoff;
for (i = 0; i < above_contexts; ++i)
a[i] = has_eob;
for (i = above_contexts; i < tx_w_in_blocks; ++i)
a[i] = 0;
for (i = 0; i < above_contexts; ++i) a[i] = has_eob;
for (i = above_contexts; i < tx_w_in_blocks; ++i) a[i] = 0;
} else {
memset(a, has_eob, sizeof(ENTROPY_CONTEXT) * tx_w_in_blocks);
}
......@@ -450,16 +430,13 @@ void dec_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
// left
if (has_eob && xd->mb_to_bottom_edge < 0) {
int i;
const int blocks_high = pd->n4_h +
(xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
const int blocks_high =
pd->n4_h + (xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
int left_contexts = tx_h_in_blocks;
if (left_contexts + loff > blocks_high)
left_contexts = blocks_high - loff;
if (left_contexts + loff > blocks_high) left_contexts = blocks_high - loff;
for (i = 0; i < left_contexts; ++i)
l[i] = has_eob;
for (i = left_contexts; i < tx_h_in_blocks; ++i)
l[i] = 0;
for (i = 0; i < left_contexts; ++i) l[i] = has_eob;