summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_onyx_if.c
diff options
context:
space:
mode:
authorAlexander Voronov <avoronov@graphics.cs.msu.ru>2013-10-03 20:07:24 +0400
committerAdrian Grange <agrange@google.com>2013-10-15 16:44:02 -0700
commitd6a59fb12c94cd31034e359b0ff639a9f6a27637 (patch)
treefc1f6d1044c69d0904436c8e99e902515b668b9f /vp9/encoder/vp9_onyx_if.c
parent355db167347bc9f6f29cbea440838fd0d3be019d (diff)
downloadlibvpx-d6a59fb12c94cd31034e359b0ff639a9f6a27637.tar
libvpx-d6a59fb12c94cd31034e359b0ff639a9f6a27637.tar.gz
libvpx-d6a59fb12c94cd31034e359b0ff639a9f6a27637.tar.bz2
libvpx-d6a59fb12c94cd31034e359b0ff639a9f6a27637.zip
Updated encoder to handle intra-only frames
Updated the encoder to handle frames that are coded intra-only. Intra-only frames must be non-showable, that is, the "show frame" flag must be set to 0 in the frame header. Tested by forcing the ARF frames to be coded intra- only. Note: The rate control code will need to be modified to account for intra-only frames better than they are currently handled. Change-Id: I6a9dd5337deddcecc599d3a44a7431909ed21079
Diffstat (limited to 'vp9/encoder/vp9_onyx_if.c')
-rw-r--r--vp9/encoder/vp9_onyx_if.c53
1 files changed, 24 insertions, 29 deletions
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 0afb35f54..45d323285 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -772,11 +772,9 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->recode_loop = (speed < 1);
if (speed == 1) {
- sf->use_square_partition_only = !(cpi->common.frame_type == KEY_FRAME ||
- cpi->common.intra_only);
+ sf->use_square_partition_only = !frame_is_intra_only(&cpi->common);
sf->less_rectangular_check = 1;
- sf->tx_size_search_method = (cpi->common.frame_type == KEY_FRAME ||
- cpi->common.intra_only)
+ sf->tx_size_search_method = frame_is_intra_only(&cpi->common)
? USE_FULL_RD : USE_LARGESTALL;
if (MIN(cpi->common.width, cpi->common.height) >= 720)
@@ -795,12 +793,10 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
}
if (speed == 2) {
- sf->use_square_partition_only = !(cpi->common.frame_type == KEY_FRAME ||
- cpi->common.intra_only);
+ sf->use_square_partition_only = !frame_is_intra_only(&cpi->common);
sf->less_rectangular_check = 1;
- sf->tx_size_search_method = ((cpi->common.frame_type == KEY_FRAME ||
- cpi->common.intra_only)
- ? USE_FULL_RD : USE_LARGESTALL);
+ sf->tx_size_search_method = frame_is_intra_only(&cpi->common)
+ ? USE_FULL_RD : USE_LARGESTALL;
if (MIN(cpi->common.width, cpi->common.height) >= 720)
sf->disable_split_mask = cpi->common.show_frame ?
@@ -911,8 +907,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
sf->use_one_partition_size_always = 1;
sf->always_this_block_size = BLOCK_16X16;
- sf->tx_size_search_method = (cpi->common.frame_type == KEY_FRAME ||
- cpi->common.intra_only) ?
+ sf->tx_size_search_method = frame_is_intra_only(&cpi->common) ?
USE_FULL_RD : USE_LARGESTALL;
sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
FLAG_SKIP_INTRA_BESTINTER |
@@ -2626,7 +2621,7 @@ static int pick_q_and_adjust_q_bounds(VP9_COMP *cpi,
int q = cpi->active_worst_quality;
VP9_COMMON *const cm = &cpi->common;
- if (cm->frame_type == KEY_FRAME) {
+ if (frame_is_intra_only(cm)) {
#if !CONFIG_MULTIPLE_ARF
// Handle the special case for key frames forced when we have75 reached
// the maximum key frame interval. Here force the Q to a range
@@ -2876,7 +2871,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
cpi->mv_step_param = vp9_init_search_range(cpi, max_mv_def);
// Initialize cpi->max_mv_magnitude and cpi->mv_step_param if appropriate.
if (sf->auto_mv_step_size) {
- if ((cpi->common.frame_type == KEY_FRAME) || cpi->common.intra_only) {
+ if (frame_is_intra_only(&cpi->common)) {
// Initialize max_mv_magnitude for use in the first INTER frame
// after a key/intra-only frame.
cpi->max_mv_magnitude = max_mv_def;
@@ -2892,8 +2887,8 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
}
// Set various flags etc to special state if it is a key frame.
- if (cm->frame_type == KEY_FRAME) {
- // Reset the loop filter deltas and segmentation map.
+ if (frame_is_intra_only(cm)) {
+ // Reset the loop filter deltas and segmentation map
setup_features(cm);
// If segmentation is enabled force a map update for key frames.
@@ -2912,6 +2907,9 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
cm->frame_parallel_decoding_mode = 1;
cm->reset_frame_context = 0;
cm->refresh_frame_context = 0;
+ } else if (cm->intra_only) {
+ // Only reset the current context.
+ cm->reset_frame_context = 2;
}
}
@@ -2961,7 +2959,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
loop_count = 0;
vp9_zero(cpi->rd_tx_select_threshes);
- if (cm->frame_type != KEY_FRAME) {
+ if (!frame_is_intra_only(cm)) {
cm->mcomp_filter_type = DEFAULT_INTERP_FILTER;
/* TODO: Decide this more intelligently */
xd->allow_high_precision_mv = q < HIGH_PRECISION_MV_QTHRESH;
@@ -3007,20 +3005,17 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
vp9_set_quantizer(cpi, q);
if (loop_count == 0) {
- // Set up entropy depending on frame type.
+ // 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) {
- /* Choose which entropy context to use. When using a forward reference
- * frame, it immediately follows the keyframe, and thus benefits from
- * using the same entropy context established by the keyframe.
- * Otherwise, use the default context 0.
- */
- cm->frame_context_idx = cpi->oxcf.play_alternate;
vp9_setup_key_frame(cpi);
} else {
- /* Choose which entropy context to use. Currently there are only two
- * contexts used, one for normal frames and one for alt ref frames.
- */
- cpi->common.frame_context_idx = cpi->refresh_alt_ref_frame;
+ if (!cm->intra_only && !cm->error_resilient_mode) {
+ cpi->common.frame_context_idx = cpi->refresh_alt_ref_frame;
+ }
vp9_setup_inter_frame(cpi);
}
}
@@ -3239,7 +3234,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
vp9_adapt_coef_probs(&cpi->common);
}
- if (cpi->common.frame_type != KEY_FRAME) {
+ if (!frame_is_intra_only(&cpi->common)) {
FRAME_COUNTS *counts = &cpi->common.counts;
vp9_copy(counts->y_mode, cpi->y_mode_count);
@@ -3618,7 +3613,6 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
}
cm->show_frame = 0;
- cm->intra_only = 0;
cpi->refresh_alt_ref_frame = 1;
cpi->refresh_golden_frame = 0;
cpi->refresh_last_frame = 0;
@@ -3640,6 +3634,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
#endif
if ((cpi->source = vp9_lookahead_pop(cpi->lookahead, flush))) {
cm->show_frame = 1;
+ cm->intra_only = 0;
#if CONFIG_MULTIPLE_ARF
// Is this frame the ARF overlay.