Commit 94ea1aa6 authored by Jingning Han's avatar Jingning Han
Browse files

Clean up encode_superblock()

Replace repeated is_inter_block() check with a constant is_inter
variable.

Change-Id: I1215f72d5fcbf167cf5252333e7d9fbe5c9ff808
parent 7c2b7f25
...@@ -5254,6 +5254,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5254,6 +5254,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
const int mis = cm->mi_stride; const int mis = cm->mi_stride;
const int mi_width = num_8x8_blocks_wide_lookup[bsize]; const int mi_width = num_8x8_blocks_wide_lookup[bsize];
const int mi_height = num_8x8_blocks_high_lookup[bsize]; const int mi_height = num_8x8_blocks_high_lookup[bsize];
const int is_inter = is_inter_block(mbmi);
x->use_lp32x32fdct = cpi->sf.use_lp32x32fdct; x->use_lp32x32fdct = cpi->sf.use_lp32x32fdct;
...@@ -5262,7 +5263,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5262,7 +5263,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
x->pvq_coded = !dry_run ? 1 : 0; x->pvq_coded = !dry_run ? 1 : 0;
#endif #endif
if (!is_inter_block(mbmi)) { if (!is_inter) {
int plane; int plane;
mbmi->skip = 1; mbmi->skip = 1;
for (plane = 0; plane < MAX_MB_PLANE; ++plane) for (plane = 0; plane < MAX_MB_PLANE; ++plane)
...@@ -5365,7 +5366,6 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5365,7 +5366,6 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
} }
if (!dry_run) { if (!dry_run) {
const int is_inter = is_inter_block(mbmi);
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
TX_SIZE tx_size = TX_SIZE tx_size =
is_inter && !mbmi->skip ? mbmi->min_tx_size : mbmi->tx_size; is_inter && !mbmi->skip ? mbmi->min_tx_size : mbmi->tx_size;
...@@ -5373,7 +5373,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5373,7 +5373,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
TX_SIZE tx_size = mbmi->tx_size; TX_SIZE tx_size = mbmi->tx_size;
#endif #endif
if (cm->tx_mode == TX_MODE_SELECT && mbmi->sb_type >= BLOCK_8X8 && if (cm->tx_mode == TX_MODE_SELECT && mbmi->sb_type >= BLOCK_8X8 &&
!(is_inter_block(mbmi) && (mbmi->skip || seg_skip))) { !(is_inter && (mbmi->skip || seg_skip))) {
const int tx_size_ctx = get_tx_size_context(xd); const int tx_size_ctx = get_tx_size_context(xd);
const int tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize] const int tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize]
: intra_tx_size_cat_lookup[bsize]; : intra_tx_size_cat_lookup[bsize];
...@@ -5406,7 +5406,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5406,7 +5406,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
int i, j; int i, j;
TX_SIZE intra_tx_size; TX_SIZE intra_tx_size;
// The new intra coding scheme requires no change of transform size // The new intra coding scheme requires no change of transform size
if (is_inter_block(&mi->mbmi)) { if (is_inter) {
if (xd->lossless[mbmi->segment_id]) { if (xd->lossless[mbmi->segment_id]) {
intra_tx_size = TX_4X4; intra_tx_size = TX_4X4;
} else { } else {
...@@ -5435,12 +5435,12 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5435,12 +5435,12 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
++td->counts ++td->counts
->tx_size_totals[txsize_sqr_map[get_uv_tx_size(mbmi, &xd->plane[1])]]; ->tx_size_totals[txsize_sqr_map[get_uv_tx_size(mbmi, &xd->plane[1])]];
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
if (get_ext_tx_types(tx_size, bsize, is_inter_block(mbmi)) > 1 && if (get_ext_tx_types(tx_size, bsize, is_inter) > 1 && cm->base_qindex > 0 &&
cm->base_qindex > 0 && !mbmi->skip && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
int eset = get_ext_tx_set(tx_size, bsize, is_inter_block(mbmi)); int eset = get_ext_tx_set(tx_size, bsize, is_inter);
if (eset > 0) { if (eset > 0) {
if (is_inter_block(mbmi)) { if (is_inter) {
++td->counts->inter_ext_tx[eset][txsize_sqr_map[tx_size]] ++td->counts->inter_ext_tx[eset][txsize_sqr_map[tx_size]]
[mbmi->tx_type]; [mbmi->tx_type];
} else { } else {
...@@ -5451,7 +5451,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5451,7 +5451,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
#else #else
if (tx_size < TX_32X32 && cm->base_qindex > 0 && !mbmi->skip && if (tx_size < TX_32X32 && cm->base_qindex > 0 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
if (is_inter_block(mbmi)) { if (is_inter) {
++td->counts->inter_ext_tx[tx_size][mbmi->tx_type]; ++td->counts->inter_ext_tx[tx_size][mbmi->tx_type];
} else { } else {
++td->counts->intra_ext_tx[tx_size] ++td->counts->intra_ext_tx[tx_size]
...@@ -5463,8 +5463,8 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5463,8 +5463,8 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
} }
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
if (cm->tx_mode == TX_MODE_SELECT && mbmi->sb_type >= BLOCK_8X8 && if (cm->tx_mode == TX_MODE_SELECT && mbmi->sb_type >= BLOCK_8X8 && is_inter &&
is_inter_block(mbmi) && !(mbmi->skip || seg_skip)) { !(mbmi->skip || seg_skip)) {
#if CONFIG_EXT_TX && CONFIG_RECT_TX #if CONFIG_EXT_TX && CONFIG_RECT_TX
if (is_rect_tx(mbmi->tx_size)) { if (is_rect_tx(mbmi->tx_size)) {
set_txfm_ctxs(mbmi->tx_size, xd->n8_w, xd->n8_h, xd); set_txfm_ctxs(mbmi->tx_size, xd->n8_w, xd->n8_h, xd);
...@@ -5477,7 +5477,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5477,7 +5477,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
} else { } else {
TX_SIZE tx_size = mbmi->tx_size; TX_SIZE tx_size = mbmi->tx_size;
// The new intra coding scheme requires no change of transform size // The new intra coding scheme requires no change of transform size
if (is_inter_block(mbmi)) if (is_inter)
#if CONFIG_EXT_TX && CONFIG_RECT_TX #if CONFIG_EXT_TX && CONFIG_RECT_TX
{ {
tx_size = AOMMIN(tx_mode_to_biggest_tx_size[cm->tx_mode], tx_size = AOMMIN(tx_mode_to_biggest_tx_size[cm->tx_mode],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment