summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_onyx_if.c
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2014-04-21 10:44:08 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2014-04-21 10:44:08 -0700
commit79303c993ae09390b6e636943f2f44c545f41928 (patch)
treec1de92366dd5251c28fa1a28bcc75cf6dd9cf787 /vp9/encoder/vp9_onyx_if.c
parentece689650adc86ddbeb5a189d0433a51a01ce816 (diff)
parent95f14d7f27b1e234f4a7eb45f8d419f7b2cbd9be (diff)
downloadlibvpx-79303c993ae09390b6e636943f2f44c545f41928.tar
libvpx-79303c993ae09390b6e636943f2f44c545f41928.tar.gz
libvpx-79303c993ae09390b6e636943f2f44c545f41928.tar.bz2
libvpx-79303c993ae09390b6e636943f2f44c545f41928.zip
Merge "Adding setup_frame() function."
Diffstat (limited to 'vp9/encoder/vp9_onyx_if.c')
-rw-r--r--vp9/encoder/vp9_onyx_if.c51
1 files changed, 21 insertions, 30 deletions
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 23a68729b..08a469ceb 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -131,6 +131,24 @@ static void setup_inter_frame(VP9_COMMON *cm) {
cm->fc = cm->frame_contexts[cm->frame_context_idx];
}
+static void setup_frame(VP9_COMP *cpi) {
+ VP9_COMMON *const cm = &cpi->common;
+ // Set up entropy context depending on frame type. The decoder mandates
+ // the use of the default context, index 0, for keyframes and inter
+ // frames where the error_resilient_mode or intra_only flag is set. For
+ // other inter-frames the encoder currently uses only two contexts;
+ // context 1 for ALTREF frames and context 0 for the others.
+ if (cm->frame_type == KEY_FRAME) {
+ setup_key_frame(cpi);
+ } else {
+ if (!cm->intra_only && !cm->error_resilient_mode && !cpi->use_svc)
+ cm->frame_context_idx = cpi->refresh_alt_ref_frame;
+ setup_inter_frame(cm);
+ }
+}
+
+
+
void vp9_initialize_enc() {
static int init_done = 0;
@@ -1798,20 +1816,7 @@ static void encode_without_recode_loop(VP9_COMP *cpi,
VP9_COMMON *const cm = &cpi->common;
vp9_clear_system_state();
vp9_set_quantizer(cm, q);
-
- // Set up entropy context depending on frame type. The decoder mandates
- // the use of the default context, index 0, for keyframes and inter
- // frames where the error_resilient_mode or intra_only flag is set. For
- // other inter-frames the encoder currently uses only two contexts;
- // context 1 for ALTREF frames and context 0 for the others.
- if (cm->frame_type == KEY_FRAME) {
- setup_key_frame(cpi);
- } else {
- if (!cm->intra_only && !cm->error_resilient_mode && !cpi->use_svc)
- cm->frame_context_idx = cpi->refresh_alt_ref_frame;
-
- setup_inter_frame(cm);
- }
+ setup_frame(cpi);
// Variance adaptive and in frame q adjustment experiments are mutually
// exclusive.
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
@@ -1856,21 +1861,8 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
vp9_set_quantizer(cm, q);
- if (loop_count == 0) {
- // Set up entropy context depending on frame type. The decoder mandates
- // the use of the default context, index 0, for keyframes and inter
- // frames where the error_resilient_mode or intra_only flag is set. For
- // other inter-frames the encoder currently uses only two contexts;
- // context 1 for ALTREF frames and context 0 for the others.
- if (cm->frame_type == KEY_FRAME) {
- setup_key_frame(cpi);
- } else {
- if (!cm->intra_only && !cm->error_resilient_mode && !cpi->use_svc)
- cpi->common.frame_context_idx = cpi->refresh_alt_ref_frame;
-
- setup_inter_frame(cm);
- }
- }
+ if (loop_count == 0)
+ setup_frame(cpi);
// Variance adaptive and in frame q adjustment experiments are mutually
// exclusive.
@@ -2161,7 +2153,6 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
// Set various flags etc to special state if it is a key frame.
if (frame_is_intra_only(cm)) {
- setup_key_frame(cpi);
// Reset the loop filter deltas and segmentation map.
vp9_reset_segment_features(&cm->seg);