#include <stdio.h>
#include "vp9/common/vp9_entropy.h"
-#include "string.h"
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/common/vp9_entropymode.h"
#endif // CONFIG_CODE_ZEROGROUP
+static INLINE const int* get_scan_4x4(TX_TYPE tx_type) {
+ switch (tx_type) {
+ case ADST_DCT:
+ return vp9_row_scan_4x4;
+ case DCT_ADST:
+ return vp9_col_scan_4x4;
+ default:
+ return vp9_default_zig_zag1d_4x4;
+ }
+}
+
+static INLINE const int* get_scan_8x8(TX_TYPE tx_type) {
+ switch (tx_type) {
+ case ADST_DCT:
+ return vp9_row_scan_8x8;
+ case DCT_ADST:
+ return vp9_col_scan_8x8;
+ default:
+ return vp9_default_zig_zag1d_8x8;
+ }
+}
+
+static INLINE const int* get_scan_16x16(TX_TYPE tx_type) {
+ switch (tx_type) {
+ case ADST_DCT:
+ return vp9_row_scan_16x16;
+ case DCT_ADST:
+ return vp9_col_scan_16x16;
+ default:
+ return vp9_default_zig_zag1d_16x16;
+ }
+}
+
#include "vp9/common/vp9_coefupdateprobs.h"
#endif // VP9_COMMON_VP9_ENTROPY_H_
case TX_4X4: {
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_4x4(xd, block_idx) : DCT_DCT;
- switch (tx_type) {
- default:
- scan = vp9_default_zig_zag1d_4x4;
- break;
- case ADST_DCT:
- scan = vp9_row_scan_4x4;
- break;
- case DCT_ADST:
- scan = vp9_col_scan_4x4;
- break;
- }
+ scan = get_scan_4x4(tx_type);
above_ec = A0[aidx] != 0;
left_ec = L0[lidx] != 0;
coef_probs = fc->coef_probs_4x4;
const int y = block_idx - x;
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
- switch (tx_type) {
- default:
- scan = vp9_default_zig_zag1d_8x8;
- break;
- case ADST_DCT:
- scan = vp9_row_scan_8x8;
- break;
- case DCT_ADST:
- scan = vp9_col_scan_8x8;
- break;
- }
+ scan = get_scan_8x8(tx_type);
coef_probs = fc->coef_probs_8x8;
coef_counts = fc->coef_counts_8x8;
above_ec = (A0[aidx] + A0[aidx + 1]) != 0;
const int y = block_idx - x;
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
- switch (tx_type) {
- default:
- scan = vp9_default_zig_zag1d_16x16;
- break;
- case ADST_DCT:
- scan = vp9_row_scan_16x16;
- break;
- case DCT_ADST:
- scan = vp9_col_scan_16x16;
- break;
- }
+ scan = get_scan_16x16(tx_type);
coef_probs = fc->coef_probs_16x16;
coef_counts = fc->coef_counts_16x16;
if (type == PLANE_TYPE_UV) {
case TX_4X4: {
const TX_TYPE tx_type = get_tx_type_4x4(xd, ib);
default_eob = 16;
- if (tx_type == DCT_ADST) {
- scan = vp9_col_scan_4x4;
- } else if (tx_type == ADST_DCT) {
- scan = vp9_row_scan_4x4;
- } else {
- scan = vp9_default_zig_zag1d_4x4;
- }
+ scan = get_scan_4x4(tx_type);
break;
}
case TX_8X8: {
const int sz = 3 + mb_width_log2(sb_type);
const int x = ib & ((1 << sz) - 1), y = ib - x;
const TX_TYPE tx_type = get_tx_type_8x8(xd, y + (x >> 1));
- if (tx_type == DCT_ADST) {
- scan = vp9_col_scan_8x8;
- } else if (tx_type == ADST_DCT) {
- scan = vp9_row_scan_8x8;
- } else {
- scan = vp9_default_zig_zag1d_8x8;
- }
+ scan = get_scan_8x8(tx_type);
default_eob = 64;
break;
}
const int sz = 4 + mb_width_log2(sb_type);
const int x = ib & ((1 << sz) - 1), y = ib - x;
const TX_TYPE tx_type = get_tx_type_16x16(xd, y + (x >> 2));
- if (tx_type == DCT_ADST) {
- scan = vp9_col_scan_16x16;
- } else if (tx_type == ADST_DCT) {
- scan = vp9_row_scan_16x16;
- } else {
- scan = vp9_default_zig_zag1d_16x16;
- }
+ scan = get_scan_16x16(tx_type);
default_eob = 256;
break;
}
uint8_t *quant_shift_ptr = b->quant_shift;
int16_t *dequant_ptr = d->dequant;
int zbin_oq_value = b->zbin_extra;
- const int *pt_scan;
-
- switch (tx_type) {
- case ADST_DCT:
- pt_scan = vp9_row_scan_4x4;
- break;
- case DCT_ADST:
- pt_scan = vp9_col_scan_4x4;
- break;
- default:
- pt_scan = vp9_default_zig_zag1d_4x4;
- break;
- }
+ const int *pt_scan = get_scan_4x4(tx_type);
vpx_memset(qcoeff_ptr, 0, 32);
vpx_memset(dqcoeff_ptr, 0, 32);
pb_idx.block, 16);
BLOCK *const b = &mb->block[c_idx];
BLOCKD *const d = &xd->block[c_idx];
- const int *pt_scan;
-
- switch (tx_type) {
- case ADST_DCT:
- pt_scan = vp9_row_scan_8x8;
- break;
- case DCT_ADST:
- pt_scan = vp9_col_scan_8x8;
- break;
- default:
- pt_scan = vp9_default_zig_zag1d_8x8;
- break;
- }
+ const int *pt_scan = get_scan_8x8(tx_type);
if (c_idx == 0) assert(pb_idx.plane == 0);
if (c_idx == 16) assert(pb_idx.plane == 1);
const int c_idx = plane_idx(pb_idx.plane);
BLOCK *const b = &mb->block[c_idx];
BLOCKD *const d = &xd->block[c_idx];
- const int *pt_scan;
-
- switch (tx_type) {
- case ADST_DCT:
- pt_scan = vp9_row_scan_16x16;
- break;
- case DCT_ADST:
- pt_scan = vp9_col_scan_16x16;
- break;
- default:
- pt_scan = vp9_default_zig_zag1d_16x16;
- break;
- }
+ const int *pt_scan = get_scan_16x16(tx_type);
if (c_idx == 0) assert(pb_idx.plane == 0);
if (c_idx == 16) assert(pb_idx.plane == 1);
l_ec = *l;
coef_probs = cm->fc.coef_probs_4x4;
seg_eob = 16;
- if (tx_type == ADST_DCT) {
- scan = vp9_row_scan_4x4;
- } else if (tx_type == DCT_ADST) {
- scan = vp9_col_scan_4x4;
- } else {
- scan = vp9_default_zig_zag1d_4x4;
- }
+ scan = get_scan_4x4(tx_type);
#if CONFIG_CODE_ZEROGROUP
zpc_probs = &cm->fc.zpc_probs_4x4;
#endif
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
a_ec = (a[0] + a[1]) != 0;
l_ec = (l[0] + l[1]) != 0;
- if (tx_type == ADST_DCT) {
- scan = vp9_row_scan_8x8;
- } else if (tx_type == DCT_ADST) {
- scan = vp9_col_scan_8x8;
- } else {
- scan = vp9_default_zig_zag1d_8x8;
- }
+ scan = get_scan_8x8(tx_type);
coef_probs = cm->fc.coef_probs_8x8;
seg_eob = 64;
#if CONFIG_CODE_ZEROGROUP
const int x = ib & ((1 << sz) - 1), y = ib - x;
TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
- if (tx_type == ADST_DCT) {
- scan = vp9_row_scan_16x16;
- } else if (tx_type == DCT_ADST) {
- scan = vp9_col_scan_16x16;
- } else {
- scan = vp9_default_zig_zag1d_16x16;
- }
+ scan = get_scan_16x16(tx_type);
coef_probs = cm->fc.coef_probs_16x16;
seg_eob = 256;
if (type == PLANE_TYPE_UV) {
a_ec = *a;
l_ec = *l;
seg_eob = 16;
- scan = vp9_default_zig_zag1d_4x4;
- if (tx_type != DCT_DCT) {
- if (tx_type == ADST_DCT) {
- scan = vp9_row_scan_4x4;
- } else if (tx_type == DCT_ADST) {
- scan = vp9_col_scan_4x4;
- }
- }
+ scan = get_scan_4x4(tx_type);
counts = cpi->coef_counts_4x4;
coef_probs = cpi->common.fc.coef_probs_4x4;
#if CONFIG_CODE_ZEROGROUP
a_ec = (a[0] + a[1]) != 0;
l_ec = (l[0] + l[1]) != 0;
seg_eob = 64;
- scan = vp9_default_zig_zag1d_8x8;
- if (tx_type != DCT_DCT) {
- if (tx_type == ADST_DCT) {
- scan = vp9_row_scan_8x8;
- } else if (tx_type == DCT_ADST) {
- scan = vp9_col_scan_8x8;
- }
- }
+ scan = get_scan_8x8(tx_type);
counts = cpi->coef_counts_8x8;
coef_probs = cpi->common.fc.coef_probs_8x8;
#if CONFIG_CODE_ZEROGROUP
l_ec = (l[0] + l[1] + l1[0] + l1[1]) != 0;
}
seg_eob = 256;
- scan = vp9_default_zig_zag1d_16x16;
- if (tx_type != DCT_DCT) {
- if (tx_type == ADST_DCT) {
- scan = vp9_row_scan_16x16;
- } else if (tx_type == DCT_ADST) {
- scan = vp9_col_scan_16x16;
- }
- }
+ scan = get_scan_16x16(tx_type);
counts = cpi->coef_counts_16x16;
coef_probs = cpi->common.fc.coef_probs_16x16;
#if CONFIG_CODE_ZEROGROUP