summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2014-10-21 07:02:24 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2014-10-21 07:02:24 -0700
commit4163da33c2689108d75ddaf9bf9f46612582b727 (patch)
tree8074d35ac36d5d5a1a1e356f231a6bb8f1bafda8 /vp9/encoder
parent889c53a507902008feb3a384fce4ff8514387336 (diff)
parent6f0ae3a2d1343a5610911a64f6fbf267a698a3f2 (diff)
downloadlibvpx-4163da33c2689108d75ddaf9bf9f46612582b727.tar
libvpx-4163da33c2689108d75ddaf9bf9f46612582b727.tar.gz
libvpx-4163da33c2689108d75ddaf9bf9f46612582b727.tar.bz2
libvpx-4163da33c2689108d75ddaf9bf9f46612582b727.zip
Merge "Extend --auto-alt-ref so it can enable multi-alt ref."
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_bitstream.h2
-rw-r--r--vp9/encoder/vp9_encoder.c31
-rw-r--r--vp9/encoder/vp9_encoder.h9
-rw-r--r--vp9/encoder/vp9_svc_layercontext.c6
4 files changed, 19 insertions, 29 deletions
diff --git a/vp9/encoder/vp9_bitstream.h b/vp9/encoder/vp9_bitstream.h
index b48826140..4f0e46ffd 100644
--- a/vp9/encoder/vp9_bitstream.h
+++ b/vp9/encoder/vp9_bitstream.h
@@ -29,7 +29,7 @@ static INLINE int vp9_preserve_existing_gf(VP9_COMP *cpi) {
(is_two_pass_svc(cpi) &&
cpi->svc.spatial_layer_id == 0 &&
cpi->svc.layer_context[0].gold_ref_idx >=0 &&
- cpi->oxcf.ss_play_alternate[0]));
+ cpi->oxcf.ss_enable_auto_arf[0]));
}
#ifdef __cplusplus
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 1758e3fdb..c5e872607 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -1436,25 +1436,6 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf) {
cpi->refresh_alt_ref_frame = 0;
- // Note that at the moment multi_arf will not work with svc.
- // For the current check in all the execution paths are defaulted to 0
- // pending further tuning and testing. The code is left in place here
- // as a place holder in regard to the required paths.
- cpi->multi_arf_last_grp_enabled = 0;
- if (oxcf->pass == 2) {
- if (cpi->use_svc) {
- cpi->multi_arf_allowed = 0;
- cpi->multi_arf_enabled = 0;
- } else {
- // Disable by default for now.
- cpi->multi_arf_allowed = 0;
- cpi->multi_arf_enabled = 0;
- }
- } else {
- cpi->multi_arf_allowed = 0;
- cpi->multi_arf_enabled = 0;
- }
-
cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS;
#if CONFIG_INTERNAL_STATS
cpi->b_calculate_ssimg = 0;
@@ -3431,6 +3412,16 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
vp9_set_high_precision_mv(cpi, ALTREF_HIGH_PRECISION_MV);
+ // Is multi-arf enabled.
+ // Note that at the moment multi_arf is only configured for 2 pass VBR and
+ // will not work properly with svc.
+ if ((oxcf->pass == 2) && !cpi->use_svc &&
+ (cpi->oxcf.enable_auto_arf > 1) && (cpi->oxcf.rc_mode == VPX_VBR))
+ cpi->multi_arf_allowed = 1;
+ else
+ cpi->multi_arf_allowed = 0;
+ cpi->multi_arf_last_grp_enabled = 0;
+
// Normal defaults
cm->reset_frame_context = 0;
cm->refresh_frame_context = 1;
@@ -3456,7 +3447,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
int i;
// Reference a hidden frame from a lower layer
for (i = cpi->svc.spatial_layer_id - 1; i >= 0; --i) {
- if (oxcf->ss_play_alternate[i]) {
+ if (oxcf->ss_enable_auto_arf[i]) {
cpi->gld_fb_idx = cpi->svc.layer_context[i].alt_ref_idx;
break;
}
diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h
index 2c56b81f3..1e6047464 100644
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -178,13 +178,12 @@ typedef struct VP9EncoderConfig {
int ts_number_layers; // Number of temporal layers.
// Bitrate allocation for spatial layers.
int ss_target_bitrate[VPX_SS_MAX_LAYERS];
- int ss_play_alternate[VPX_SS_MAX_LAYERS];
+ int ss_enable_auto_arf[VPX_SS_MAX_LAYERS];
// Bitrate allocation (CBR mode) and framerate factor, for temporal layers.
int ts_target_bitrate[VPX_TS_MAX_LAYERS];
int ts_rate_decimator[VPX_TS_MAX_LAYERS];
- // these parameters aren't to be used in final build don't use!!!
- int play_alternate;
+ int enable_auto_arf;
int encode_breakout; // early breakout : for video conf recommend 800
@@ -520,9 +519,9 @@ static INLINE int is_two_pass_svc(const struct VP9_COMP *const cpi) {
static INLINE int is_altref_enabled(const VP9_COMP *const cpi) {
return cpi->oxcf.mode != REALTIME && cpi->oxcf.lag_in_frames > 0 &&
- (cpi->oxcf.play_alternate &&
+ (cpi->oxcf.enable_auto_arf &&
(!is_two_pass_svc(cpi) ||
- cpi->oxcf.ss_play_alternate[cpi->svc.spatial_layer_id]));
+ cpi->oxcf.ss_enable_auto_arf[cpi->svc.spatial_layer_id]));
}
static INLINE void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd,
diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c
index 1573557d4..8d3ca0d13 100644
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -85,7 +85,7 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
oxcf->best_allowed_q) / 2;
lrc->avg_frame_qindex[INTER_FRAME] = (oxcf->worst_allowed_q +
oxcf->best_allowed_q) / 2;
- if (oxcf->ss_play_alternate[layer])
+ if (oxcf->ss_enable_auto_arf[layer])
lc->alt_ref_idx = alt_ref_idx++;
else
lc->alt_ref_idx = -1;
@@ -305,7 +305,7 @@ int vp9_svc_start_frame(VP9_COMP *const cpi) {
cpi->ref_frame_flags &= (~VP9_LAST_FLAG & ~VP9_ALT_FLAG);
}
} else {
- if (cpi->oxcf.ss_play_alternate[cpi->svc.spatial_layer_id]) {
+ if (cpi->oxcf.ss_enable_auto_arf[cpi->svc.spatial_layer_id]) {
cpi->alt_fb_idx = lc->alt_ref_idx;
if (!lc->has_alt_frame)
cpi->ref_frame_flags &= (~VP9_ALT_FLAG);
@@ -317,7 +317,7 @@ int vp9_svc_start_frame(VP9_COMP *const cpi) {
LAYER_CONTEXT *lc_lower =
&cpi->svc.layer_context[cpi->svc.spatial_layer_id - 1];
- if (cpi->oxcf.ss_play_alternate[cpi->svc.spatial_layer_id - 1] &&
+ if (cpi->oxcf.ss_enable_auto_arf[cpi->svc.spatial_layer_id - 1] &&
lc_lower->alt_ref_source != NULL)
cpi->alt_fb_idx = lc_lower->alt_ref_idx;
else if (cpi->svc.spatial_layer_id >= 2)