summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2014-03-10 12:07:26 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2014-03-10 12:07:26 -0700
commitcb13d0f3e4bc9a9b62c82873a406c7edbe188b9a (patch)
treed85d24dc8d50eae9ffb3415de176402cc57d3a53 /vp9/encoder
parentf8f8c6d44c436609a408cf9a8910ccf8b65ca319 (diff)
parentab1f9054389dc14736d73c43101a0f882c120a33 (diff)
downloadlibvpx-cb13d0f3e4bc9a9b62c82873a406c7edbe188b9a.tar
libvpx-cb13d0f3e4bc9a9b62c82873a406c7edbe188b9a.tar.gz
libvpx-cb13d0f3e4bc9a9b62c82873a406c7edbe188b9a.tar.bz2
libvpx-cb13d0f3e4bc9a9b62c82873a406c7edbe188b9a.zip
Merge "Cleaning up rd_pick_sb_modes() function."
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_encodeframe.c31
-rw-r--r--vp9/encoder/vp9_onyx_int.h6
2 files changed, 18 insertions, 19 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index 76ef2705c..11d4749ba 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -662,10 +662,11 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
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 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
}
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 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
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 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
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 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
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 4ee035b37..1540d6e26 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -484,8 +484,8 @@ typedef enum {
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 @@ typedef struct {
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