Merge "Cleaning up select_tx_mode() function."
diff --git a/test/sixtap_predict_test.cc b/test/sixtap_predict_test.cc
index 1b2f03f..0c600f4 100644
--- a/test/sixtap_predict_test.cc
+++ b/test/sixtap_predict_test.cc
@@ -198,7 +198,7 @@
const sixtap_predict_fn_t sixtap_8x8_neon = vp8_sixtap_predict8x8_neon;
const sixtap_predict_fn_t sixtap_8x4_neon = vp8_sixtap_predict8x4_neon;
INSTANTIATE_TEST_CASE_P(
- NEON, SixtapPredictTest, ::testing::Values(
+ DISABLED_NEON, SixtapPredictTest, ::testing::Values(
make_tuple(16, 16, sixtap_16x16_neon),
make_tuple(8, 8, sixtap_8x8_neon),
make_tuple(8, 4, sixtap_8x4_neon)));
diff --git a/vp9/common/vp9_entropymode.h b/vp9/common/vp9_entropymode.h
index f881952..c7b1911 100644
--- a/vp9/common/vp9_entropymode.h
+++ b/vp9/common/vp9_entropymode.h
@@ -97,6 +97,15 @@
void tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p,
unsigned int (*ct_8x8p)[2]);
+static INLINE const vp9_prob *get_y_mode_probs(const MODE_INFO *mi,
+ const MODE_INFO *above_mi,
+ const MODE_INFO *left_mi,
+ int block) {
+ const MB_PREDICTION_MODE above = vp9_above_block_mode(mi, above_mi, block);
+ const MB_PREDICTION_MODE left = vp9_left_block_mode(mi, left_mi, block);
+ return vp9_kf_y_mode_prob[above][left];
+}
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c
index 1cb741f..1e203b1 100644
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -33,9 +33,9 @@
#include "vp9/decoder/vp9_decodeframe.h"
#include "vp9/decoder/vp9_detokenize.h"
#include "vp9/decoder/vp9_decodemv.h"
+#include "vp9/decoder/vp9_decoder.h"
#include "vp9/decoder/vp9_dsubexp.h"
#include "vp9/decoder/vp9_dthread.h"
-#include "vp9/decoder/vp9_onyxd.h"
#include "vp9/decoder/vp9_read_bit_buffer.h"
#include "vp9/decoder/vp9_reader.h"
#include "vp9/decoder/vp9_thread.h"
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 9bc21d2..799a82a 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -174,9 +174,7 @@
mbmi->ref_frame[1] = NONE;
if (bsize >= BLOCK_8X8) {
- const MB_PREDICTION_MODE A = vp9_above_block_mode(mi, above_mi, 0);
- const MB_PREDICTION_MODE L = vp9_left_block_mode(mi, left_mi, 0);
- mbmi->mode = read_intra_mode(r, vp9_kf_y_mode_prob[A][L]);
+ mbmi->mode = read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, 0));
} else {
// Only 4x4, 4x8, 8x4 blocks
const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize]; // 1 or 2
@@ -185,16 +183,14 @@
for (idy = 0; idy < 2; idy += num_4x4_h) {
for (idx = 0; idx < 2; idx += num_4x4_w) {
- const int ib = idy * 2 + idx;
- const MB_PREDICTION_MODE A = vp9_above_block_mode(mi, above_mi, ib);
- const MB_PREDICTION_MODE L = vp9_left_block_mode(mi, left_mi, ib);
- const MB_PREDICTION_MODE b_mode = read_intra_mode(r,
- vp9_kf_y_mode_prob[A][L]);
- mi->bmi[ib].as_mode = b_mode;
+ const int block = idy * 2 + idx;
+ const MB_PREDICTION_MODE mode =
+ read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, block));
+ mi->bmi[block].as_mode = mode;
if (num_4x4_h == 2)
- mi->bmi[ib + 2].as_mode = b_mode;
+ mi->bmi[block + 2].as_mode = mode;
if (num_4x4_w == 2)
- mi->bmi[ib + 1].as_mode = b_mode;
+ mi->bmi[block + 1].as_mode = mode;
}
}
diff --git a/vp9/decoder/vp9_onyxd_if.c b/vp9/decoder/vp9_decoder.c
similarity index 99%
rename from vp9/decoder/vp9_onyxd_if.c
rename to vp9/decoder/vp9_decoder.c
index 7052888..77985c9 100644
--- a/vp9/decoder/vp9_onyxd_if.c
+++ b/vp9/decoder/vp9_decoder.c
@@ -12,22 +12,25 @@
#include <limits.h>
#include <stdio.h>
+#include "./vpx_scale_rtcd.h"
+
+#include "vpx_mem/vpx_mem.h"
+#include "vpx_ports/vpx_timer.h"
+#include "vpx_scale/vpx_scale.h"
+
+#include "vp9/common/vp9_alloccommon.h"
+#include "vp9/common/vp9_loopfilter.h"
#include "vp9/common/vp9_onyxc_int.h"
#if CONFIG_VP9_POSTPROC
#include "vp9/common/vp9_postproc.h"
#endif
-#include "vp9/decoder/vp9_onyxd.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp9/common/vp9_alloccommon.h"
-#include "vp9/common/vp9_loopfilter.h"
#include "vp9/common/vp9_quant_common.h"
-#include "vpx_scale/vpx_scale.h"
#include "vp9/common/vp9_systemdependent.h"
-#include "vpx_ports/vpx_timer.h"
+
#include "vp9/decoder/vp9_decodeframe.h"
+#include "vp9/decoder/vp9_decoder.h"
#include "vp9/decoder/vp9_detokenize.h"
#include "vp9/decoder/vp9_dthread.h"
-#include "./vpx_scale_rtcd.h"
#define WRITE_RECON_BUFFER 0
#if WRITE_RECON_BUFFER == 1
diff --git a/vp9/decoder/vp9_onyxd.h b/vp9/decoder/vp9_decoder.h
similarity index 94%
rename from vp9/decoder/vp9_onyxd.h
rename to vp9/decoder/vp9_decoder.h
index 5ea251b..e6edaf9 100644
--- a/vp9/decoder/vp9_onyxd.h
+++ b/vp9/decoder/vp9_decoder.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef VP9_DECODER_VP9_ONYXD_H_
-#define VP9_DECODER_VP9_ONYXD_H_
+#ifndef VP9_DECODER_VP9_DECODER_H_
+#define VP9_DECODER_VP9_DECODER_H_
#include "./vpx_config.h"
@@ -19,8 +19,8 @@
#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/common/vp9_ppflags.h"
+#include "vp9/decoder/vp9_decoder.h"
#include "vp9/decoder/vp9_dthread.h"
-#include "vp9/decoder/vp9_onyxd.h"
#include "vp9/decoder/vp9_thread.h"
#ifdef __cplusplus
@@ -112,4 +112,4 @@
} // extern "C"
#endif
-#endif // VP9_DECODER_VP9_ONYXD_H_
+#endif // VP9_DECODER_VP9_DECODER_H_
diff --git a/vp9/decoder/vp9_detokenize.h b/vp9/decoder/vp9_detokenize.h
index c5198a2..5278e97 100644
--- a/vp9/decoder/vp9_detokenize.h
+++ b/vp9/decoder/vp9_detokenize.h
@@ -12,7 +12,7 @@
#ifndef VP9_DECODER_VP9_DETOKENIZE_H_
#define VP9_DECODER_VP9_DETOKENIZE_H_
-#include "vp9/decoder/vp9_onyxd.h"
+#include "vp9/decoder/vp9_decoder.h"
#include "vp9/decoder/vp9_reader.h"
#ifdef __cplusplus
diff --git a/vp9/decoder/vp9_dthread.c b/vp9/decoder/vp9_dthread.c
index 7d2179d..4df8509 100644
--- a/vp9/decoder/vp9_dthread.c
+++ b/vp9/decoder/vp9_dthread.c
@@ -15,7 +15,7 @@
#include "vp9/common/vp9_reconinter.h"
#include "vp9/decoder/vp9_dthread.h"
-#include "vp9/decoder/vp9_onyxd.h"
+#include "vp9/decoder/vp9_decoder.h"
#if CONFIG_MULTITHREAD
static INLINE void mutex_lock(pthread_mutex_t *const mutex) {
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 585b690..1b4a6cc 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -331,44 +331,41 @@
}
static void write_mb_modes_kf(const VP9_COMP *cpi, MODE_INFO **mi_8x8,
- vp9_writer *bc) {
+ vp9_writer *w) {
const VP9_COMMON *const cm = &cpi->common;
const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
const struct segmentation *const seg = &cm->seg;
- MODE_INFO *m = mi_8x8[0];
- const int ym = m->mbmi.mode;
- const int segment_id = m->mbmi.segment_id;
- MODE_INFO *above_mi = mi_8x8[-xd->mode_info_stride];
- MODE_INFO *left_mi = xd->left_available ? mi_8x8[-1] : NULL;
+ const MODE_INFO *const mi = mi_8x8[0];
+ const MODE_INFO *const above_mi = mi_8x8[-xd->mode_info_stride];
+ const MODE_INFO *const left_mi = xd->left_available ? mi_8x8[-1] : NULL;
+ const MB_MODE_INFO *const mbmi = &mi->mbmi;
+ const BLOCK_SIZE bsize = mbmi->sb_type;
if (seg->update_map)
- write_segment_id(bc, seg, m->mbmi.segment_id);
+ write_segment_id(w, seg, mbmi->segment_id);
- write_skip(cpi, segment_id, m, bc);
+ write_skip(cpi, mbmi->segment_id, mi, w);
- if (m->mbmi.sb_type >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT)
- write_selected_tx_size(cpi, m->mbmi.tx_size, m->mbmi.sb_type, bc);
+ if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT)
+ write_selected_tx_size(cpi, mbmi->tx_size, bsize, w);
- if (m->mbmi.sb_type >= BLOCK_8X8) {
- const MB_PREDICTION_MODE A = vp9_above_block_mode(m, above_mi, 0);
- const MB_PREDICTION_MODE L = vp9_left_block_mode(m, left_mi, 0);
- write_intra_mode(bc, ym, vp9_kf_y_mode_prob[A][L]);
+ if (bsize >= BLOCK_8X8) {
+ write_intra_mode(w, mbmi->mode, get_y_mode_probs(mi, above_mi, left_mi, 0));
} else {
+ const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
+ const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
int idx, idy;
- const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[m->mbmi.sb_type];
- const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[m->mbmi.sb_type];
- for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
- for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
- int i = idy * 2 + idx;
- const MB_PREDICTION_MODE A = vp9_above_block_mode(m, above_mi, i);
- const MB_PREDICTION_MODE L = vp9_left_block_mode(m, left_mi, i);
- const int bm = m->bmi[i].as_mode;
- write_intra_mode(bc, bm, vp9_kf_y_mode_prob[A][L]);
+
+ for (idy = 0; idy < 2; idy += num_4x4_h) {
+ for (idx = 0; idx < 2; idx += num_4x4_w) {
+ const int block = idy * 2 + idx;
+ write_intra_mode(w, mi->bmi[block].as_mode,
+ get_y_mode_probs(mi, above_mi, left_mi, block));
}
}
}
- write_intra_mode(bc, m->mbmi.uv_mode, vp9_kf_uv_mode_prob[ym]);
+ write_intra_mode(w, mbmi->uv_mode, vp9_kf_uv_mode_prob[mbmi->mode]);
}
static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile,
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index 5a8fd82..1016209 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -662,10 +662,11 @@
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
+ MB_MODE_INFO *mbmi;
struct macroblock_plane *const p = x->plane;
struct macroblockd_plane *const pd = xd->plane;
- int i;
- int orig_rdmult = x->rdmult;
+ const AQ_MODE aq_mode = cpi->oxcf.aq_mode;
+ int i, orig_rdmult = x->rdmult;
double rdmult_ratio;
vp9_clear_system_state();
@@ -685,7 +686,8 @@
}
set_offsets(cpi, tile, mi_row, mi_col, bsize);
- xd->mi_8x8[0]->mbmi.sb_type = bsize;
+ mbmi = &xd->mi_8x8[0]->mbmi;
+ mbmi->sb_type = bsize;
for (i = 0; i < MAX_MB_PLANE; ++i) {
p[i].coeff = ctx->coeff_pbuf[i][0];
@@ -697,23 +699,22 @@
x->skip_recode = 0;
// Set to zero to make sure we do not use the previous encoded frame stats
- xd->mi_8x8[0]->mbmi.skip = 0;
+ mbmi->skip = 0;
x->source_variance = get_sby_perpixel_variance(cpi, x, bsize);
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
+ if (aq_mode == VARIANCE_AQ) {
const int energy = bsize <= BLOCK_16X16 ? x->mb_energy
: vp9_block_energy(cpi, x, bsize);
if (cm->frame_type == KEY_FRAME ||
cpi->refresh_alt_ref_frame ||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
- xd->mi_8x8[0]->mbmi.segment_id = vp9_vaq_segment_id(energy);
+ mbmi->segment_id = vp9_vaq_segment_id(energy);
} else {
const uint8_t *const map = cm->seg.update_map ? cpi->segmentation_map
: cm->last_frame_seg_map;
- xd->mi_8x8[0]->mbmi.segment_id =
- vp9_get_segment_id(cm, map, bsize, mi_row, mi_col);
+ mbmi->segment_id = vp9_get_segment_id(cm, map, bsize, mi_row, mi_col);
}
rdmult_ratio = vp9_vaq_rdmult_ratio(energy);
@@ -723,18 +724,17 @@
if (cpi->oxcf.tuning == VP8_TUNE_SSIM)
activity_masking(cpi, x);
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
+ if (aq_mode == VARIANCE_AQ) {
vp9_clear_system_state();
x->rdmult = (int)round(x->rdmult * rdmult_ratio);
- } else if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) {
+ } else if (aq_mode == COMPLEXITY_AQ) {
const int mi_offset = mi_row * cm->mi_cols + mi_col;
unsigned char complexity = cpi->complexity_map[mi_offset];
const int is_edge = (mi_row <= 1) || (mi_row >= (cm->mi_rows - 2)) ||
(mi_col <= 1) || (mi_col >= (cm->mi_cols - 2));
- if (!is_edge && (complexity > 128)) {
- x->rdmult = x->rdmult + ((x->rdmult * (complexity - 128)) / 256);
- }
+ if (!is_edge && (complexity > 128))
+ x->rdmult += ((x->rdmult * (complexity - 128)) / 256);
}
// Find best coding mode & reconstruct the MB so it is available
@@ -751,14 +751,13 @@
totaldist, bsize, ctx, best_rd);
}
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
+ if (aq_mode == VARIANCE_AQ) {
x->rdmult = orig_rdmult;
if (*totalrate != INT_MAX) {
vp9_clear_system_state();
*totalrate = (int)round(*totalrate * rdmult_ratio);
}
- }
- else if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) {
+ } else if (aq_mode == COMPLEXITY_AQ) {
x->rdmult = orig_rdmult;
}
}
diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h
index 4ee035b..1540d6e 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -484,8 +484,8 @@
NO_AQ = 0,
VARIANCE_AQ = 1,
COMPLEXITY_AQ = 2,
- AQ_MODES_COUNT // This should always be the last member of the enum
-} AQ_MODES;
+ AQ_MODE_COUNT // This should always be the last member of the enum
+} AQ_MODE;
typedef struct {
int version; // 4 versions of bitstream defined:
@@ -553,7 +553,7 @@
int best_allowed_q;
int cq_level;
int lossless;
- int aq_mode; // Adaptive Quantization mode
+ AQ_MODE aq_mode; // Adaptive Quantization mode
// two pass datarate control
int two_pass_vbrbias; // two pass datarate control tweaks
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index 8d89e74..895fa16 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -156,7 +156,7 @@
RANGE_CHECK_HI(cfg, rc_max_quantizer, 0);
RANGE_CHECK_HI(cfg, rc_min_quantizer, 0);
}
- RANGE_CHECK(vp8_cfg, aq_mode, 0, AQ_MODES_COUNT - 1);
+ RANGE_CHECK(vp8_cfg, aq_mode, 0, AQ_MODE_COUNT - 1);
RANGE_CHECK_HI(cfg, g_threads, 64);
RANGE_CHECK_HI(cfg, g_lag_in_frames, MAX_LAG_BUFFERS);
diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c
index a9e6a88..ae6ccff 100644
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -16,7 +16,7 @@
#include "vpx/internal/vpx_codec_internal.h"
#include "./vpx_version.h"
#include "vp9/common/vp9_frame_buffers.h"
-#include "vp9/decoder/vp9_onyxd.h"
+#include "vp9/decoder/vp9_decoder.h"
#include "vp9/decoder/vp9_read_bit_buffer.h"
#include "vp9/vp9_iface_common.h"
diff --git a/vp9/vp9dx.mk b/vp9/vp9dx.mk
index 40fb575..92ec6fd 100644
--- a/vp9/vp9dx.mk
+++ b/vp9/vp9dx.mk
@@ -29,10 +29,10 @@
VP9_DX_SRCS-yes += decoder/vp9_read_bit_buffer.h
VP9_DX_SRCS-yes += decoder/vp9_decodemv.h
VP9_DX_SRCS-yes += decoder/vp9_detokenize.h
-VP9_DX_SRCS-yes += decoder/vp9_onyxd.h
+VP9_DX_SRCS-yes += decoder/vp9_decoder.c
+VP9_DX_SRCS-yes += decoder/vp9_decoder.h
VP9_DX_SRCS-yes += decoder/vp9_thread.c
VP9_DX_SRCS-yes += decoder/vp9_thread.h
-VP9_DX_SRCS-yes += decoder/vp9_onyxd_if.c
VP9_DX_SRCS-yes += decoder/vp9_dsubexp.c
VP9_DX_SRCS-yes += decoder/vp9_dsubexp.h