Merge "Adding get_scan_{4x4, 8x8, 16x16} functions." into experimental
This commit is contained in:
commit
d0d1094a05
@ -12,7 +12,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "vp9/common/vp9_entropy.h"
|
#include "vp9/common/vp9_entropy.h"
|
||||||
#include "string.h"
|
|
||||||
#include "vp9/common/vp9_blockd.h"
|
#include "vp9/common/vp9_blockd.h"
|
||||||
#include "vp9/common/vp9_onyxc_int.h"
|
#include "vp9/common/vp9_onyxc_int.h"
|
||||||
#include "vp9/common/vp9_entropymode.h"
|
#include "vp9/common/vp9_entropymode.h"
|
||||||
|
@ -223,6 +223,39 @@ void vp9_adapt_zpc_probs(struct VP9Common *cm);
|
|||||||
|
|
||||||
#endif // CONFIG_CODE_ZEROGROUP
|
#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"
|
#include "vp9/common/vp9_coefupdateprobs.h"
|
||||||
|
|
||||||
#endif // VP9_COMMON_VP9_ENTROPY_H_
|
#endif // VP9_COMMON_VP9_ENTROPY_H_
|
||||||
|
@ -165,17 +165,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
|
|||||||
case TX_4X4: {
|
case TX_4X4: {
|
||||||
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
|
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
|
||||||
get_tx_type_4x4(xd, block_idx) : DCT_DCT;
|
get_tx_type_4x4(xd, block_idx) : DCT_DCT;
|
||||||
switch (tx_type) {
|
scan = get_scan_4x4(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;
|
|
||||||
}
|
|
||||||
above_ec = A0[aidx] != 0;
|
above_ec = A0[aidx] != 0;
|
||||||
left_ec = L0[lidx] != 0;
|
left_ec = L0[lidx] != 0;
|
||||||
coef_probs = fc->coef_probs_4x4;
|
coef_probs = fc->coef_probs_4x4;
|
||||||
@ -194,17 +184,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
|
|||||||
const int y = block_idx - x;
|
const int y = block_idx - x;
|
||||||
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
|
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
|
||||||
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
|
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
|
||||||
switch (tx_type) {
|
scan = get_scan_8x8(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;
|
|
||||||
}
|
|
||||||
coef_probs = fc->coef_probs_8x8;
|
coef_probs = fc->coef_probs_8x8;
|
||||||
coef_counts = fc->coef_counts_8x8;
|
coef_counts = fc->coef_counts_8x8;
|
||||||
above_ec = (A0[aidx] + A0[aidx + 1]) != 0;
|
above_ec = (A0[aidx] + A0[aidx + 1]) != 0;
|
||||||
@ -223,17 +203,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
|
|||||||
const int y = block_idx - x;
|
const int y = block_idx - x;
|
||||||
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
|
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
|
||||||
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
|
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
|
||||||
switch (tx_type) {
|
scan = get_scan_16x16(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;
|
|
||||||
}
|
|
||||||
coef_probs = fc->coef_probs_16x16;
|
coef_probs = fc->coef_probs_16x16;
|
||||||
coef_counts = fc->coef_counts_16x16;
|
coef_counts = fc->coef_counts_16x16;
|
||||||
if (type == PLANE_TYPE_UV) {
|
if (type == PLANE_TYPE_UV) {
|
||||||
|
@ -335,13 +335,7 @@ static void optimize_b(VP9_COMMON *const cm,
|
|||||||
case TX_4X4: {
|
case TX_4X4: {
|
||||||
const TX_TYPE tx_type = get_tx_type_4x4(xd, ib);
|
const TX_TYPE tx_type = get_tx_type_4x4(xd, ib);
|
||||||
default_eob = 16;
|
default_eob = 16;
|
||||||
if (tx_type == DCT_ADST) {
|
scan = get_scan_4x4(tx_type);
|
||||||
scan = vp9_col_scan_4x4;
|
|
||||||
} else if (tx_type == ADST_DCT) {
|
|
||||||
scan = vp9_row_scan_4x4;
|
|
||||||
} else {
|
|
||||||
scan = vp9_default_zig_zag1d_4x4;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TX_8X8: {
|
case TX_8X8: {
|
||||||
@ -349,13 +343,7 @@ static void optimize_b(VP9_COMMON *const cm,
|
|||||||
const int sz = 3 + mb_width_log2(sb_type);
|
const int sz = 3 + mb_width_log2(sb_type);
|
||||||
const int x = ib & ((1 << sz) - 1), y = ib - x;
|
const int x = ib & ((1 << sz) - 1), y = ib - x;
|
||||||
const TX_TYPE tx_type = get_tx_type_8x8(xd, y + (x >> 1));
|
const TX_TYPE tx_type = get_tx_type_8x8(xd, y + (x >> 1));
|
||||||
if (tx_type == DCT_ADST) {
|
scan = get_scan_8x8(tx_type);
|
||||||
scan = vp9_col_scan_8x8;
|
|
||||||
} else if (tx_type == ADST_DCT) {
|
|
||||||
scan = vp9_row_scan_8x8;
|
|
||||||
} else {
|
|
||||||
scan = vp9_default_zig_zag1d_8x8;
|
|
||||||
}
|
|
||||||
default_eob = 64;
|
default_eob = 64;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -364,13 +352,7 @@ static void optimize_b(VP9_COMMON *const cm,
|
|||||||
const int sz = 4 + mb_width_log2(sb_type);
|
const int sz = 4 + mb_width_log2(sb_type);
|
||||||
const int x = ib & ((1 << sz) - 1), y = ib - x;
|
const int x = ib & ((1 << sz) - 1), y = ib - x;
|
||||||
const TX_TYPE tx_type = get_tx_type_16x16(xd, y + (x >> 2));
|
const TX_TYPE tx_type = get_tx_type_16x16(xd, y + (x >> 2));
|
||||||
if (tx_type == DCT_ADST) {
|
scan = get_scan_16x16(tx_type);
|
||||||
scan = vp9_col_scan_16x16;
|
|
||||||
} else if (tx_type == ADST_DCT) {
|
|
||||||
scan = vp9_row_scan_16x16;
|
|
||||||
} else {
|
|
||||||
scan = vp9_default_zig_zag1d_16x16;
|
|
||||||
}
|
|
||||||
default_eob = 256;
|
default_eob = 256;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -44,19 +44,7 @@ void vp9_ht_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) {
|
|||||||
uint8_t *quant_shift_ptr = b->quant_shift;
|
uint8_t *quant_shift_ptr = b->quant_shift;
|
||||||
int16_t *dequant_ptr = d->dequant;
|
int16_t *dequant_ptr = d->dequant;
|
||||||
int zbin_oq_value = b->zbin_extra;
|
int zbin_oq_value = b->zbin_extra;
|
||||||
const int *pt_scan;
|
const int *pt_scan = get_scan_4x4(tx_type);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
vpx_memset(qcoeff_ptr, 0, 32);
|
vpx_memset(qcoeff_ptr, 0, 32);
|
||||||
vpx_memset(dqcoeff_ptr, 0, 32);
|
vpx_memset(dqcoeff_ptr, 0, 32);
|
||||||
@ -165,19 +153,7 @@ void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
|
|||||||
pb_idx.block, 16);
|
pb_idx.block, 16);
|
||||||
BLOCK *const b = &mb->block[c_idx];
|
BLOCK *const b = &mb->block[c_idx];
|
||||||
BLOCKD *const d = &xd->block[c_idx];
|
BLOCKD *const d = &xd->block[c_idx];
|
||||||
const int *pt_scan;
|
const int *pt_scan = get_scan_8x8(tx_type);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_idx == 0) assert(pb_idx.plane == 0);
|
if (c_idx == 0) assert(pb_idx.plane == 0);
|
||||||
if (c_idx == 16) assert(pb_idx.plane == 1);
|
if (c_idx == 16) assert(pb_idx.plane == 1);
|
||||||
@ -313,19 +289,7 @@ void vp9_regular_quantize_b_16x16(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
|
|||||||
const int c_idx = plane_idx(pb_idx.plane);
|
const int c_idx = plane_idx(pb_idx.plane);
|
||||||
BLOCK *const b = &mb->block[c_idx];
|
BLOCK *const b = &mb->block[c_idx];
|
||||||
BLOCKD *const d = &xd->block[c_idx];
|
BLOCKD *const d = &xd->block[c_idx];
|
||||||
const int *pt_scan;
|
const int *pt_scan = get_scan_16x16(tx_type);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_idx == 0) assert(pb_idx.plane == 0);
|
if (c_idx == 0) assert(pb_idx.plane == 0);
|
||||||
if (c_idx == 16) assert(pb_idx.plane == 1);
|
if (c_idx == 16) assert(pb_idx.plane == 1);
|
||||||
|
@ -352,13 +352,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
|
|||||||
l_ec = *l;
|
l_ec = *l;
|
||||||
coef_probs = cm->fc.coef_probs_4x4;
|
coef_probs = cm->fc.coef_probs_4x4;
|
||||||
seg_eob = 16;
|
seg_eob = 16;
|
||||||
if (tx_type == ADST_DCT) {
|
scan = get_scan_4x4(tx_type);
|
||||||
scan = vp9_row_scan_4x4;
|
|
||||||
} else if (tx_type == DCT_ADST) {
|
|
||||||
scan = vp9_col_scan_4x4;
|
|
||||||
} else {
|
|
||||||
scan = vp9_default_zig_zag1d_4x4;
|
|
||||||
}
|
|
||||||
#if CONFIG_CODE_ZEROGROUP
|
#if CONFIG_CODE_ZEROGROUP
|
||||||
zpc_probs = &cm->fc.zpc_probs_4x4;
|
zpc_probs = &cm->fc.zpc_probs_4x4;
|
||||||
#endif
|
#endif
|
||||||
@ -372,13 +366,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
|
|||||||
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
|
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
|
||||||
a_ec = (a[0] + a[1]) != 0;
|
a_ec = (a[0] + a[1]) != 0;
|
||||||
l_ec = (l[0] + l[1]) != 0;
|
l_ec = (l[0] + l[1]) != 0;
|
||||||
if (tx_type == ADST_DCT) {
|
scan = get_scan_8x8(tx_type);
|
||||||
scan = vp9_row_scan_8x8;
|
|
||||||
} else if (tx_type == DCT_ADST) {
|
|
||||||
scan = vp9_col_scan_8x8;
|
|
||||||
} else {
|
|
||||||
scan = vp9_default_zig_zag1d_8x8;
|
|
||||||
}
|
|
||||||
coef_probs = cm->fc.coef_probs_8x8;
|
coef_probs = cm->fc.coef_probs_8x8;
|
||||||
seg_eob = 64;
|
seg_eob = 64;
|
||||||
#if CONFIG_CODE_ZEROGROUP
|
#if CONFIG_CODE_ZEROGROUP
|
||||||
@ -392,13 +380,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
|
|||||||
const int x = ib & ((1 << sz) - 1), y = ib - x;
|
const int x = ib & ((1 << sz) - 1), y = ib - x;
|
||||||
TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
|
TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
|
||||||
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
|
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
|
||||||
if (tx_type == ADST_DCT) {
|
scan = get_scan_16x16(tx_type);
|
||||||
scan = vp9_row_scan_16x16;
|
|
||||||
} else if (tx_type == DCT_ADST) {
|
|
||||||
scan = vp9_col_scan_16x16;
|
|
||||||
} else {
|
|
||||||
scan = vp9_default_zig_zag1d_16x16;
|
|
||||||
}
|
|
||||||
coef_probs = cm->fc.coef_probs_16x16;
|
coef_probs = cm->fc.coef_probs_16x16;
|
||||||
seg_eob = 256;
|
seg_eob = 256;
|
||||||
if (type == PLANE_TYPE_UV) {
|
if (type == PLANE_TYPE_UV) {
|
||||||
|
@ -204,14 +204,7 @@ static void tokenize_b(VP9_COMP *cpi,
|
|||||||
a_ec = *a;
|
a_ec = *a;
|
||||||
l_ec = *l;
|
l_ec = *l;
|
||||||
seg_eob = 16;
|
seg_eob = 16;
|
||||||
scan = vp9_default_zig_zag1d_4x4;
|
scan = get_scan_4x4(tx_type);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
counts = cpi->coef_counts_4x4;
|
counts = cpi->coef_counts_4x4;
|
||||||
coef_probs = cpi->common.fc.coef_probs_4x4;
|
coef_probs = cpi->common.fc.coef_probs_4x4;
|
||||||
#if CONFIG_CODE_ZEROGROUP
|
#if CONFIG_CODE_ZEROGROUP
|
||||||
@ -228,14 +221,7 @@ static void tokenize_b(VP9_COMP *cpi,
|
|||||||
a_ec = (a[0] + a[1]) != 0;
|
a_ec = (a[0] + a[1]) != 0;
|
||||||
l_ec = (l[0] + l[1]) != 0;
|
l_ec = (l[0] + l[1]) != 0;
|
||||||
seg_eob = 64;
|
seg_eob = 64;
|
||||||
scan = vp9_default_zig_zag1d_8x8;
|
scan = get_scan_8x8(tx_type);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
counts = cpi->coef_counts_8x8;
|
counts = cpi->coef_counts_8x8;
|
||||||
coef_probs = cpi->common.fc.coef_probs_8x8;
|
coef_probs = cpi->common.fc.coef_probs_8x8;
|
||||||
#if CONFIG_CODE_ZEROGROUP
|
#if CONFIG_CODE_ZEROGROUP
|
||||||
@ -257,14 +243,7 @@ static void tokenize_b(VP9_COMP *cpi,
|
|||||||
l_ec = (l[0] + l[1] + l1[0] + l1[1]) != 0;
|
l_ec = (l[0] + l[1] + l1[0] + l1[1]) != 0;
|
||||||
}
|
}
|
||||||
seg_eob = 256;
|
seg_eob = 256;
|
||||||
scan = vp9_default_zig_zag1d_16x16;
|
scan = get_scan_16x16(tx_type);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
counts = cpi->coef_counts_16x16;
|
counts = cpi->coef_counts_16x16;
|
||||||
coef_probs = cpi->common.fc.coef_probs_16x16;
|
coef_probs = cpi->common.fc.coef_probs_16x16;
|
||||||
#if CONFIG_CODE_ZEROGROUP
|
#if CONFIG_CODE_ZEROGROUP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user