Commit 180b1804 authored by Yunqing Wang's avatar Yunqing Wang Committed by Gerrit Code Review
Browse files

Merge "vp10 cleanup: remove svc code"

parents 4dcbf0a8 c147c4d6
......@@ -291,7 +291,7 @@ void vp10_cyclic_refresh_postencode(VP10_COMP *const cpi) {
}
}
// Set golden frame update interval, for non-svc 1 pass CBR mode.
// Set golden frame update interval, for 1 pass CBR mode.
void vp10_cyclic_refresh_set_golden_update(VP10_COMP *const cpi) {
RATE_CONTROL *const rc = &cpi->rc;
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
......@@ -484,10 +484,7 @@ void vp10_cyclic_refresh_setup(VP10_COMP *const cpi) {
if (cm->current_video_frame == 0)
cr->low_content_avg = 0.0;
// Don't apply refresh on key frame or enhancement layer frames.
if (!apply_cyclic_refresh ||
(cm->frame_type == KEY_FRAME) ||
(cpi->svc.temporal_layer_id > 0) ||
(cpi->svc.spatial_layer_id > 0)) {
if (!apply_cyclic_refresh || cm->frame_type == KEY_FRAME) {
// Set segmentation map to 0 and disable.
unsigned char *const seg_map = cpi->segmentation_map;
memset(seg_map, 0, cm->mi_rows * cm->mi_cols);
......
......@@ -61,7 +61,7 @@ void vp10_cyclic_refresh_update__map(struct VP10_COMP *const cpi);
// Update the actual number of blocks that were applied the segment delta q.
void vp10_cyclic_refresh_postencode(struct VP10_COMP *const cpi);
// Set golden frame update interval, for non-svc 1 pass CBR mode.
// Set golden frame update interval, for 1 pass CBR mode.
void vp10_cyclic_refresh_set_golden_update(struct VP10_COMP *const cpi);
// Check if we should not update golden reference, based on past refresh stats.
......
......@@ -996,18 +996,7 @@ static void write_frame_size_with_refs(VP10_COMP *cpi,
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi, ref_frame);
// Set "found" to 0 for temporal svc and for spatial svc key frame
if (cpi->use_svc &&
((cpi->svc.number_temporal_layers > 1 &&
cpi->oxcf.rc_mode == VPX_CBR) ||
(cpi->svc.number_spatial_layers > 1 &&
cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame) ||
(is_two_pass_svc(cpi) &&
cpi->svc.encode_empty_frame_state == ENCODING &&
cpi->svc.layer_context[0].frames_from_key_frame <
cpi->svc.number_temporal_layers + 1))) {
found = 0;
} else if (cfg != NULL) {
if (cfg != NULL) {
found = cm->width == cfg->y_crop_width &&
cm->height == cfg->y_crop_height;
}
......@@ -1093,14 +1082,6 @@ static void write_uncompressed_header(VP10_COMP *cpi,
write_bitdepth_colorspace_sampling(cm, wb);
write_frame_size(cm, wb);
} else {
// In spatial svc if it's not error_resilient_mode then we need to code all
// visible frames as invisible. But we need to keep the show_frame flag so
// that the publisher could know whether it is supposed to be visible.
// So we will code the show_frame flag as it is. Then code the intra_only
// bit here. This will make the bitstream incompatible. In the player we
// will change to show_frame flag to 0, then add an one byte frame with
// show_existing_frame flag which tells the decoder which frame we want to
// show.
if (!cm->show_frame)
vpx_wb_write_bit(wb, cm->intra_only);
......
......@@ -22,12 +22,7 @@ void vp10_pack_bitstream(VP10_COMP *cpi, uint8_t *dest, size_t *size);
static INLINE int vp10_preserve_existing_gf(VP10_COMP *cpi) {
return !cpi->multi_arf_allowed && cpi->refresh_golden_frame &&
cpi->rc.is_src_frame_alt_ref &&
(!cpi->use_svc || // Add spatial svc base layer case here
(is_two_pass_svc(cpi) &&
cpi->svc.spatial_layer_id == 0 &&
cpi->svc.layer_context[0].gold_ref_idx >=0 &&
cpi->oxcf.ss_enable_auto_arf[0]));
cpi->rc.is_src_frame_alt_ref;
}
#ifdef __cplusplus
......
......@@ -695,11 +695,7 @@ static int choose_partitioning(VP10_COMP *cpi,
s = x->plane[0].src.buf;
sp = x->plane[0].src.stride;
if (!is_key_frame && !(is_one_pass_cbr_svc(cpi) &&
cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame)) {
// In the case of spatial/temporal scalable coding, the assumption here is
// that the temporal reference frame will always be of type LAST_FRAME.
// TODO(marpan): If that assumption is broken, we need to revisit this code.
if (!is_key_frame) {
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
unsigned int uv_sad;
const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
......@@ -710,12 +706,7 @@ static int choose_partitioning(VP10_COMP *cpi,
+ (mi_col + 4 < cm->mi_cols) * 2 + (mi_row + 4 < cm->mi_rows);
assert(yv12 != NULL);
if (!(is_one_pass_cbr_svc(cpi) && cpi->svc.spatial_layer_id)) {
// For now, GOLDEN will not be used for non-zero spatial layers, since
// it may not be a temporal reference.
yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
}
yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
if (yv12_g && yv12_g != yv12) {
vp10_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col,
......@@ -851,9 +842,7 @@ static int choose_partitioning(VP10_COMP *cpi,
}
}
}
// TODO(marpan): There is an issue with variance based on 4x4 average in
// svc mode, don't allow it for now.
if (is_key_frame || (low_res && !cpi->use_svc &&
if (is_key_frame || (low_res &&
vt.split[i].split[j].part_variances.none.variance >
(thresholds[1] << 1))) {
force_split[split_index] = 0;
......
This diff is collapsed.
......@@ -33,7 +33,6 @@
#include "vp10/encoder/ratectrl.h"
#include "vp10/encoder/rd.h"
#include "vp10/encoder/speed_features.h"
#include "vp10/encoder/svc_layercontext.h"
#include "vp10/encoder/tokenize.h"
#if CONFIG_VP9_TEMPORAL_DENOISING
......@@ -116,7 +115,7 @@ typedef enum {
} AQ_MODE;
typedef enum {
RESIZE_NONE = 0, // No frame resizing allowed (except for SVC).
RESIZE_NONE = 0, // No frame resizing allowed.
RESIZE_FIXED = 1, // All frames are coded at the specified dimension.
RESIZE_DYNAMIC = 2 // Coded size of each frame is determined by the codec.
} RESIZE_TYPE;
......@@ -189,16 +188,6 @@ typedef struct VP10EncoderConfig {
// END DATARATE CONTROL OPTIONS
// ----------------------------------------------------------------
// Spatial and temporal scalability.
int ss_number_layers; // Number of spatial layers.
int ts_number_layers; // Number of temporal layers.
// Bitrate allocation for spatial layers.
int layer_target_bitrate[VPX_MAX_LAYERS];
int ss_target_bitrate[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_rate_decimator[VPX_TS_MAX_LAYERS];
int enable_auto_arf;
int encode_breakout; // early breakout : for video conf recommend 800
......@@ -239,7 +228,6 @@ typedef struct VP10EncoderConfig {
int use_highbitdepth;
#endif
vpx_color_space_t color_space;
VP9E_TEMPORAL_LAYERING_MODE temporal_layering_mode;
} VP10EncoderConfig;
static INLINE int is_lossless_requested(const VP10EncoderConfig *cfg) {
......@@ -451,10 +439,6 @@ typedef struct VP10_COMP {
// number of MBs in the current frame when the frame is
// scaled.
int use_svc;
SVC svc;
// Store frame variance info in SOURCE_VAR_BASED_PARTITION search type.
diff *source_diff_var;
// The threshold used in SOURCE_VAR_BASED_PARTITION search type.
......@@ -546,8 +530,6 @@ int vp10_set_internal_size(VP10_COMP *cpi,
int vp10_set_size_literal(VP10_COMP *cpi, unsigned int width,
unsigned int height);
void vp10_set_svc(VP10_COMP *cpi, int use_svc);
int vp10_get_quantizer(struct VP10_COMP *cpi);
static INLINE int frame_is_kf_gf_arf(const VP10_COMP *cpi) {
......@@ -624,19 +606,9 @@ YV12_BUFFER_CONFIG *vp10_scale_if_required(VP10_COMMON *cm,
void vp10_apply_encoding_flags(VP10_COMP *cpi, vpx_enc_frame_flags_t flags);
static INLINE int is_two_pass_svc(const struct VP10_COMP *const cpi) {
return cpi->use_svc && cpi->oxcf.pass != 0;
}
static INLINE int is_one_pass_cbr_svc(const struct VP10_COMP *const cpi) {
return (cpi->use_svc && cpi->oxcf.pass == 0);
}
static INLINE int is_altref_enabled(const VP10_COMP *const cpi) {
return cpi->oxcf.mode != REALTIME && cpi->oxcf.lag_in_frames > 0 &&
(cpi->oxcf.enable_auto_arf &&
(!is_two_pass_svc(cpi) ||
cpi->oxcf.ss_enable_auto_arf[cpi->svc.spatial_layer_id]));
cpi->oxcf.enable_auto_arf;
}
static INLINE void set_ref_ptrs(VP10_COMMON *cm, MACROBLOCKD *xd,
......
......@@ -76,13 +76,6 @@ void vp10_encode_tiles_mt(VP10_COMP *cpi) {
if (cpi->num_workers == 0) {
int allocated_workers = num_workers;
// While using SVC, we need to allocate threads according to the highest
// resolution.
if (cpi->use_svc) {
int max_tile_cols = get_max_tile_cols(cpi);
allocated_workers = VPXMIN(cpi->oxcf.max_threads, max_tile_cols);
}
CHECK_MEM_ERROR(cm, cpi->workers,
vpx_malloc(allocated_workers * sizeof(*cpi->workers)));
......
......@@ -55,7 +55,6 @@
#define MIN_DECAY_FACTOR 0.01
#define MIN_KF_BOOST 300
#define NEW_MV_MODE_PENALTY 32
#define SVC_FACTOR_PT_LOW 0.45
#define DARK_THRESH 64
#define DEFAULT_GRP_WEIGHT 1.0
#define RC_FACTOR_MIN 0.75
......@@ -177,14 +176,12 @@ static void zero_stats(FIRSTPASS_STATS *section) {
section->new_mv_count = 0.0;
section->count = 0.0;
section->duration = 1.0;
section->spatial_layer_id = 0;
}
static void accumulate_stats(FIRSTPASS_STATS *section,
const FIRSTPASS_STATS *frame) {
section->frame += frame->frame;
section->weight += frame->weight;
section->spatial_layer_id = frame->spatial_layer_id;
section->intra_error += frame->intra_error;
section->coded_error += frame->coded_error;
section->sr_coded_error += frame->sr_coded_error;
......@@ -292,15 +289,7 @@ void vp10_init_first_pass(VP10_COMP *cpi) {
}
void vp10_end_first_pass(VP10_COMP *cpi) {
if (is_two_pass_svc(cpi)) {
int i;
for (i = 0; i < cpi->svc.number_spatial_layers; ++i) {
output_stats(&cpi->svc.layer_context[i].twopass.total_stats,
cpi->output_pkt_list);
}
} else {
output_stats(&cpi->twopass.total_stats, cpi->output_pkt_list);
}
output_stats(&cpi->twopass.total_stats, cpi->output_pkt_list);
}
static vpx_variance_fn_t get_block_variance_fn(BLOCK_SIZE bsize) {
......@@ -530,16 +519,13 @@ void vp10_first_pass(VP10_COMP *cpi, const struct lookahead_entry *source) {
YV12_BUFFER_CONFIG *gld_yv12 = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
YV12_BUFFER_CONFIG *const new_yv12 = get_frame_new_buffer(cm);
const YV12_BUFFER_CONFIG *first_ref_buf = lst_yv12;
LAYER_CONTEXT *const lc = is_two_pass_svc(cpi) ?
&cpi->svc.layer_context[cpi->svc.spatial_layer_id] : NULL;
double intra_factor;
double brightness_factor;
BufferPool *const pool = cm->buffer_pool;
// First pass code requires valid last and new frame buffers.
assert(new_yv12 != NULL);
assert((lc != NULL) || frame_is_intra_only(cm) || (lst_yv12 != NULL));
assert(frame_is_intra_only(cm) || (lst_yv12 != NULL));
#if CONFIG_FP_MB_STATS
if (cpi->use_fp_mb_stats) {
......@@ -556,51 +542,6 @@ void vp10_first_pass(VP10_COMP *cpi, const struct lookahead_entry *source) {
set_first_pass_params(cpi);
vp10_set_quantizer(cm, find_fp_qindex(cm->bit_depth));
if (lc != NULL) {
twopass = &lc->twopass;
cpi->lst_fb_idx = cpi->svc.spatial_layer_id;
cpi->ref_frame_flags = VP9_LAST_FLAG;
if (cpi->svc.number_spatial_layers + cpi->svc.spatial_layer_id <
REF_FRAMES) {
cpi->gld_fb_idx =
cpi->svc.number_spatial_layers + cpi->svc.spatial_layer_id;
cpi->ref_frame_flags |= VP9_GOLD_FLAG;
cpi->refresh_golden_frame = (lc->current_video_frame_in_layer == 0);
} else {
cpi->refresh_golden_frame = 0;
}
if (lc->current_video_frame_in_layer == 0)
cpi->ref_frame_flags = 0;
vp10_scale_references(cpi);
// Use either last frame or alt frame for motion search.
if (cpi->ref_frame_flags & VP9_LAST_FLAG) {
first_ref_buf = vp10_get_scaled_ref_frame(cpi, LAST_FRAME);
if (first_ref_buf == NULL)
first_ref_buf = get_ref_frame_buffer(cpi, LAST_FRAME);
}
if (cpi->ref_frame_flags & VP9_GOLD_FLAG) {
gld_yv12 = vp10_get_scaled_ref_frame(cpi, GOLDEN_FRAME);
if (gld_yv12 == NULL) {
gld_yv12 = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
}
} else {
gld_yv12 = NULL;
}
set_ref_ptrs(cm, xd,
(cpi->ref_frame_flags & VP9_LAST_FLAG) ? LAST_FRAME: NONE,
(cpi->ref_frame_flags & VP9_GOLD_FLAG) ? GOLDEN_FRAME : NONE);
cpi->Source = vp10_scale_if_required(cm, cpi->un_scaled_source,
&cpi->scaled_source);
}
vp10_setup_block_planes(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
vp10_setup_src_planes(x, cpi->Source, 0, 0);
......@@ -754,8 +695,7 @@ void vp10_first_pass(VP10_COMP *cpi, const struct lookahead_entry *source) {
x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16) + BORDER_MV_PIXELS_B16;
// Other than for the first frame do a motion search.
if ((lc == NULL && cm->current_video_frame > 0) ||
(lc != NULL && lc->current_video_frame_in_layer > 0)) {
if (cm->current_video_frame > 0) {
int tmp_err, motion_error, raw_motion_error;
// Assume 0,0 motion with no mv overhead.
MV mv = {0, 0} , tmp_mv = {0, 0};
......@@ -796,7 +736,7 @@ void vp10_first_pass(VP10_COMP *cpi, const struct lookahead_entry *source) {
#endif // CONFIG_VP9_HIGHBITDEPTH
// TODO(pengchong): Replace the hard-coded threshold
if (raw_motion_error > 25 || lc != NULL) {
if (raw_motion_error > 25) {
// Test last reference frame using the previous best mv as the
// starting point (best reference) for the search.
first_pass_motion_search(cpi, x, &best_ref_mv, &mv, &motion_error);
......@@ -814,9 +754,7 @@ void vp10_first_pass(VP10_COMP *cpi, const struct lookahead_entry *source) {
}
// Search in an older reference frame.
if (((lc == NULL && cm->current_video_frame > 1) ||
(lc != NULL && lc->current_video_frame_in_layer > 1))
&& gld_yv12 != NULL) {
if ((cm->current_video_frame > 1) && gld_yv12 != NULL) {
// Assume 0,0 motion with no mv overhead.
int gf_motion_error;
......@@ -1045,7 +983,6 @@ void vp10_first_pass(VP10_COMP *cpi, const struct lookahead_entry *source) {
fps.weight = intra_factor * brightness_factor;
fps.frame = cm->current_video_frame;
fps.spatial_layer_id = cpi->svc.spatial_layer_id;
fps.coded_error = (double)(coded_error >> 8) + min_err;
fps.sr_coded_error = (double)(sr_coded_error >> 8) + min_err;
fps.intra_error = (double)(intra_error >> 8) + min_err;
......@@ -1116,18 +1053,13 @@ void vp10_first_pass(VP10_COMP *cpi, const struct lookahead_entry *source) {
vpx_extend_frame_borders(new_yv12);
if (lc != NULL) {
vp10_update_reference_frames(cpi);
} else {
// The frame we just compressed now becomes the last frame.
ref_cnt_fb(pool->frame_bufs, &cm->ref_frame_map[cpi->lst_fb_idx],
cm->new_fb_idx);
}
// The frame we just compressed now becomes the last frame.
ref_cnt_fb(pool->frame_bufs, &cm->ref_frame_map[cpi->lst_fb_idx],
cm->new_fb_idx);
// Special case for the first frame. Copy into the GF buffer as a second
// reference.
if (cm->current_video_frame == 0 && cpi->gld_fb_idx != INVALID_IDX &&
lc == NULL) {
if (cm->current_video_frame == 0 && cpi->gld_fb_idx != INVALID_IDX) {
ref_cnt_fb(pool->frame_bufs, &cm->ref_frame_map[cpi->gld_fb_idx],
cm->ref_frame_map[cpi->lst_fb_idx]);
}
......@@ -1149,8 +1081,6 @@ void vp10_first_pass(VP10_COMP *cpi, const struct lookahead_entry *source) {
}
++cm->current_video_frame;
if (cpi->use_svc)
vp10_inc_frame_in_layer(cpi);
}
static double calc_correction_factor(double err_per_mb,
......@@ -1200,11 +1130,6 @@ static int get_twopass_worst_quality(const VP10_COMP *cpi,
BPER_MB_NORMBITS) / active_mbs;
int q;
int is_svc_upper_layer = 0;
if (is_two_pass_svc(cpi) && cpi->svc.spatial_layer_id > 0)
is_svc_upper_layer = 1;
// Try and pick a max Q that will be high enough to encode the
// content at the given rate.
......@@ -1212,7 +1137,6 @@ static int get_twopass_worst_quality(const VP10_COMP *cpi,
const double factor =
calc_correction_factor(av_err_per_mb,
ERR_DIVISOR - ediv_size_correction,
is_svc_upper_layer ? SVC_FACTOR_PT_LOW :
FACTOR_PT_LOW, FACTOR_PT_HIGH, q,
cpi->common.bit_depth);
const int bits_per_mb =
......@@ -1264,12 +1188,8 @@ void vp10_calculate_coded_size(VP10_COMP *cpi,
}
void vp10_init_second_pass(VP10_COMP *cpi) {
SVC *const svc = &cpi->svc;
const VP10EncoderConfig *const oxcf = &cpi->oxcf;
const int is_two_pass_svc = (svc->number_spatial_layers > 1) ||
(svc->number_temporal_layers > 1);
TWO_PASS *const twopass = is_two_pass_svc ?
&svc->layer_context[svc->spatial_layer_id].twopass : &cpi->twopass;
TWO_PASS *const twopass = &cpi->twopass;
double frame_rate;
FIRSTPASS_STATS *stats;
......@@ -1290,17 +1210,9 @@ void vp10_init_second_pass(VP10_COMP *cpi) {
// encoded in the second pass is a guess. However, the sum duration is not.
// It is calculated based on the actual durations of all frames from the
// first pass.
if (is_two_pass_svc) {
vp10_update_spatial_layer_framerate(cpi, frame_rate);
twopass->bits_left = (int64_t)(stats->duration *
svc->layer_context[svc->spatial_layer_id].target_bandwidth /
10000000.0);
} else {
vp10_new_framerate(cpi, frame_rate);
twopass->bits_left = (int64_t)(stats->duration * oxcf->target_bandwidth /
10000000.0);
}
vp10_new_framerate(cpi, frame_rate);
twopass->bits_left = (int64_t)(stats->duration * oxcf->target_bandwidth /
10000000.0);
// This variable monitors how far behind the second ref update is lagging.
twopass->sr_update_lag = 1;
......@@ -1701,15 +1613,8 @@ static void allocate_gf_group_bits(VP10_COMP *cpi, int64_t gf_group_bits,
int mid_frame_idx;
unsigned char arf_buffer_indices[MAX_ACTIVE_ARFS];
int alt_frame_index = frame_index;
int has_temporal_layers = is_two_pass_svc(cpi) &&
cpi->svc.number_temporal_layers > 1;
// Only encode alt reference frame in temporal base layer.
if (has_temporal_layers)
alt_frame_index = cpi->svc.number_temporal_layers;
key_frame = cpi->common.frame_type == KEY_FRAME ||
vp10_is_upper_layer_key_frame(cpi);
key_frame = cpi->common.frame_type == KEY_FRAME;
get_arf_buffer_indices(arf_buffer_indices);
......@@ -1746,20 +1651,14 @@ static void allocate_gf_group_bits(VP10_COMP *cpi, int64_t gf_group_bits,
gf_group->rf_level[alt_frame_index] = GF_ARF_STD;
gf_group->bit_allocation[alt_frame_index] = gf_arf_bits;
if (has_temporal_layers)
gf_group->arf_src_offset[alt_frame_index] =
(unsigned char)(rc->baseline_gf_interval -
cpi->svc.number_temporal_layers);
else
gf_group->arf_src_offset[alt_frame_index] =
(unsigned char)(rc->baseline_gf_interval - 1);
gf_group->arf_src_offset[alt_frame_index] =
(unsigned char)(rc->baseline_gf_interval - 1);
gf_group->arf_update_idx[alt_frame_index] = arf_buffer_indices[0];
gf_group->arf_ref_idx[alt_frame_index] =
arf_buffer_indices[cpi->multi_arf_last_grp_enabled &&
rc->source_alt_ref_active];
if (!has_temporal_layers)
++frame_index;
++frame_index;
if (cpi->multi_arf_enabled) {
// Set aside a slot for a level 1 arf.
......@@ -1782,10 +1681,6 @@ static void allocate_gf_group_bits(VP10_COMP *cpi, int64_t gf_group_bits,
if (EOF == input_stats(twopass, &frame_stats))
break;
if (has_temporal_layers && frame_index == alt_frame_index) {
++frame_index;
}
modified_err = calculate_modified_err(cpi, twopass, oxcf, &frame_stats);
if (group_error > 0)
......@@ -2047,26 +1942,6 @@ static void define_gf_group(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// Set the interval until the next gf.
rc->baseline_gf_interval = i - (is_key_frame || rc->source_alt_ref_pending);
// Only encode alt reference frame in temporal base layer. So
// baseline_gf_interval should be multiple of a temporal layer group
// (typically the frame distance between two base layer frames)
if (is_two_pass_svc(cpi) && cpi->svc.number_temporal_layers > 1) {
int count = (1 << (cpi->svc.number_temporal_layers - 1)) - 1;
int new_gf_interval = (rc->baseline_gf_interval + count) & (~count);
int j;
for (j = 0; j < new_gf_interval - rc->baseline_gf_interval; ++j) {
if (EOF == input_stats(twopass, this_frame))
break;
gf_group_err += calculate_modified_err(cpi, twopass, oxcf, this_frame);
#if GROUP_ADAPTIVE_MAXQ
gf_group_raw_error += this_frame->coded_error;
#endif
gf_group_skip_pct += this_frame->intra_skip_pct;
gf_group_inactive_zone_rows += this_frame->inactive_zone_rows;
}
rc->baseline_gf_interval = new_gf_interval;
}
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
// Reset the file position.
......@@ -2386,18 +2261,6 @@ static void find_next_key_frame(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
rc->next_key_frame_forced = 0;
}
if (is_two_pass_svc(cpi) && cpi->svc.number_temporal_layers > 1) {
int count = (1 << (cpi->svc.number_temporal_layers - 1)) - 1;
int new_frame_to_key = (rc->frames_to_key + count) & (~count);
int j;
for (j = 0; j < new_frame_to_key - rc->frames_to_key; ++j) {
if (EOF == input_stats(twopass, this_frame))
break;
kf_group_err += calculate_modified_err(cpi, twopass, oxcf, this_frame);
}
rc->frames_to_key = new_frame_to_key;
}
// Special case for the last key frame of the file.
if (twopass->stats_in >= twopass->stats_in_end) {
// Accumulate kf group error.
......@@ -2547,16 +2410,6 @@ static void configure_buffer_updates(VP10_COMP *cpi) {
assert(0);
break;
}
if (is_two_pass_svc(cpi)) {
if (cpi->svc.temporal_layer_id > 0) {
cpi->refresh_last_frame = 0;
cpi->refresh_golden_frame = 0;
}
if (cpi->svc.layer_context[cpi->svc.spatial_layer_id].gold_ref_idx < 0)
cpi->refresh_golden_frame = 0;
if (cpi->alt_ref_source == NULL)
cpi->refresh_alt_ref_frame = 0;
}
}
static int is_skippable_frame(const VP10_COMP *cpi) {
......@@ -2564,9 +2417,7 @@ static int is_skippable_frame(const VP10_COMP *cpi) {
// first pass, and so do its previous and forward frames, then this frame
// can be skipped for partition check, and the partition size is assigned
// according to the variance
const SVC *const svc = &cpi->svc;
const TWO_PASS *const twopass = is_two_pass_svc(cpi) ?
&svc->layer_context[svc->spatial_layer_id].twopass : &cpi->twopass;
const TWO_PASS *const twopass = &cpi->twopass;
return (!frame_is_intra_only(&cpi->common) &&
twopass->stats_in - 2 > twopass->stats_in_start &&
......@@ -2587,16 +2438,9 @@ void vp10_rc_get_second_pass_params(VP10_COMP *cpi) {
FIRSTPASS_STATS this_frame;
int target_rate;
LAYER_CONTEXT *const lc = is_two_pass_svc(cpi) ?
&cpi->svc.layer_context[cpi->svc.spatial_layer_id] : 0;
if (lc != NULL) {
frames_left = (int)(twopass->total_stats.count -
lc->current_video_frame_in_layer);
} else {
frames_left = (int)(twopass->total_stats.count -
cm->current_video_frame);
}
frames_left = (int)(twopass->total_stats.count -
cm->current_video_frame);
if (!twopass->stats_in)
return;
......@@ -2612,21 +2456,9 @@ void vp10_rc_get_second_pass_params(VP10_COMP *cpi) {
cm->frame_type = INTER_FRAME;
if (lc != NULL) {
if (cpi->svc.spatial_layer_id == 0) {
lc->is_key_frame = 0;
} else {
lc->is_key_frame = cpi->svc.layer_context[0].is_key_frame;
if (lc->is_key_frame)
cpi->ref_frame_flags &= (~VP9_LAST_FLAG);
}
}
// Do the firstpass stats indicate that this frame is skippable for the
// partition search?
if (cpi->sf.allow_partition_search_skip &&
cpi->oxcf.pass == 2 && (!cpi->use_svc || is_two_pass_svc(cpi))) {
if (cpi->sf.allow_partition_search_skip && cpi->oxcf.pass == 2) {
cpi->partition_search_skippable_frame = is_skippable_frame(cpi);
}