Merge "Moving pass from VP9_COMP to VP9EncoderConfig."
This commit is contained in:
Коммит
6e5149b68d
|
@ -902,7 +902,7 @@ static int get_refresh_mask(VP9_COMP *cpi) {
|
||||||
(cpi->refresh_golden_frame << cpi->alt_fb_idx);
|
(cpi->refresh_golden_frame << cpi->alt_fb_idx);
|
||||||
} else {
|
} else {
|
||||||
int arf_idx = cpi->alt_fb_idx;
|
int arf_idx = cpi->alt_fb_idx;
|
||||||
if ((cpi->pass == 2) && cpi->multi_arf_allowed) {
|
if ((cpi->oxcf.pass == 2) && cpi->multi_arf_allowed) {
|
||||||
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
||||||
arf_idx = gf_group->arf_update_idx[gf_group->index];
|
arf_idx = gf_group->arf_update_idx[gf_group->index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2476,7 +2476,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
|
||||||
} else {
|
} else {
|
||||||
GF_GROUP * gf_grp = &cpi->twopass.gf_group;
|
GF_GROUP * gf_grp = &cpi->twopass.gf_group;
|
||||||
int last_was_mid_sequence_overlay = 0;
|
int last_was_mid_sequence_overlay = 0;
|
||||||
if ((cpi->pass == 2) && (gf_grp->index)) {
|
if ((cpi->oxcf.pass == 2) && (gf_grp->index)) {
|
||||||
if (gf_grp->update_type[gf_grp->index - 1] == OVERLAY_UPDATE)
|
if (gf_grp->update_type[gf_grp->index - 1] == OVERLAY_UPDATE)
|
||||||
last_was_mid_sequence_overlay = 1;
|
last_was_mid_sequence_overlay = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -553,23 +553,6 @@ static void init_config(struct VP9_COMP *cpi, VP9EncoderConfig *oxcf) {
|
||||||
set_tile_limits(cpi);
|
set_tile_limits(cpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_pass(MODE mode) {
|
|
||||||
switch (mode) {
|
|
||||||
case REALTIME:
|
|
||||||
case ONE_PASS_GOOD:
|
|
||||||
case ONE_PASS_BEST:
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case TWO_PASS_FIRST:
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
case TWO_PASS_SECOND_GOOD:
|
|
||||||
case TWO_PASS_SECOND_BEST:
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
||||||
VP9_COMMON *const cm = &cpi->common;
|
VP9_COMMON *const cm = &cpi->common;
|
||||||
RATE_CONTROL *const rc = &cpi->rc;
|
RATE_CONTROL *const rc = &cpi->rc;
|
||||||
|
@ -584,7 +567,6 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
||||||
assert(cm->bit_depth > BITS_8);
|
assert(cm->bit_depth > BITS_8);
|
||||||
|
|
||||||
cpi->oxcf = *oxcf;
|
cpi->oxcf = *oxcf;
|
||||||
cpi->pass = get_pass(cpi->oxcf.mode);
|
|
||||||
|
|
||||||
rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;
|
rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;
|
||||||
|
|
||||||
|
@ -654,7 +636,7 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
||||||
|
|
||||||
if ((cpi->svc.number_temporal_layers > 1 &&
|
if ((cpi->svc.number_temporal_layers > 1 &&
|
||||||
cpi->oxcf.rc_mode == VPX_CBR) ||
|
cpi->oxcf.rc_mode == VPX_CBR) ||
|
||||||
(cpi->svc.number_spatial_layers > 1 && cpi->pass == 2)) {
|
(cpi->svc.number_spatial_layers > 1 && cpi->oxcf.pass == 2)) {
|
||||||
vp9_update_layer_context_change_config(cpi,
|
vp9_update_layer_context_change_config(cpi,
|
||||||
(int)cpi->oxcf.target_bandwidth);
|
(int)cpi->oxcf.target_bandwidth);
|
||||||
}
|
}
|
||||||
|
@ -748,7 +730,7 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf) {
|
||||||
cpi->use_svc = 0;
|
cpi->use_svc = 0;
|
||||||
|
|
||||||
init_config(cpi, oxcf);
|
init_config(cpi, oxcf);
|
||||||
vp9_rc_init(&cpi->oxcf, cpi->pass, &cpi->rc);
|
vp9_rc_init(&cpi->oxcf, oxcf->pass, &cpi->rc);
|
||||||
|
|
||||||
cm->current_video_frame = 0;
|
cm->current_video_frame = 0;
|
||||||
|
|
||||||
|
@ -800,7 +782,7 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf) {
|
||||||
// pending further tuning and testing. The code is left in place here
|
// pending further tuning and testing. The code is left in place here
|
||||||
// as a place holder in regard to the required paths.
|
// as a place holder in regard to the required paths.
|
||||||
cpi->multi_arf_last_grp_enabled = 0;
|
cpi->multi_arf_last_grp_enabled = 0;
|
||||||
if (cpi->pass == 2) {
|
if (oxcf->pass == 2) {
|
||||||
if (cpi->use_svc) {
|
if (cpi->use_svc) {
|
||||||
cpi->multi_arf_allowed = 0;
|
cpi->multi_arf_allowed = 0;
|
||||||
cpi->multi_arf_enabled = 0;
|
cpi->multi_arf_enabled = 0;
|
||||||
|
@ -888,9 +870,9 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf) {
|
||||||
|
|
||||||
cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
|
cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
|
||||||
|
|
||||||
if (cpi->pass == 1) {
|
if (oxcf->pass == 1) {
|
||||||
vp9_init_first_pass(cpi);
|
vp9_init_first_pass(cpi);
|
||||||
} else if (cpi->pass == 2) {
|
} else if (oxcf->pass == 2) {
|
||||||
const size_t packet_sz = sizeof(FIRSTPASS_STATS);
|
const size_t packet_sz = sizeof(FIRSTPASS_STATS);
|
||||||
const int packets = (int)(oxcf->two_pass_stats_in.sz / packet_sz);
|
const int packets = (int)(oxcf->two_pass_stats_in.sz / packet_sz);
|
||||||
|
|
||||||
|
@ -1066,7 +1048,7 @@ void vp9_remove_compressor(VP9_COMP *cpi) {
|
||||||
vp9_clear_system_state();
|
vp9_clear_system_state();
|
||||||
|
|
||||||
// printf("\n8x8-4x4:%d-%d\n", cpi->t8x8_count, cpi->t4x4_count);
|
// printf("\n8x8-4x4:%d-%d\n", cpi->t8x8_count, cpi->t4x4_count);
|
||||||
if (cpi->pass != 1) {
|
if (cpi->oxcf.pass != 1) {
|
||||||
FILE *f = fopen("opsnr.stt", "a");
|
FILE *f = fopen("opsnr.stt", "a");
|
||||||
double time_encoded = (cpi->last_end_time_stamp_seen
|
double time_encoded = (cpi->last_end_time_stamp_seen
|
||||||
- cpi->first_time_stamp_ever) / 10000000.000;
|
- cpi->first_time_stamp_ever) / 10000000.000;
|
||||||
|
@ -1580,7 +1562,7 @@ void vp9_update_reference_frames(VP9_COMP *cpi) {
|
||||||
} else { /* For non key/golden frames */
|
} else { /* For non key/golden frames */
|
||||||
if (cpi->refresh_alt_ref_frame) {
|
if (cpi->refresh_alt_ref_frame) {
|
||||||
int arf_idx = cpi->alt_fb_idx;
|
int arf_idx = cpi->alt_fb_idx;
|
||||||
if ((cpi->pass == 2) && cpi->multi_arf_allowed) {
|
if ((cpi->oxcf.pass == 2) && cpi->multi_arf_allowed) {
|
||||||
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
||||||
arf_idx = gf_group->arf_update_idx[gf_group->index];
|
arf_idx = gf_group->arf_update_idx[gf_group->index];
|
||||||
}
|
}
|
||||||
|
@ -2061,7 +2043,7 @@ static void set_arf_sign_bias(VP9_COMP *cpi) {
|
||||||
VP9_COMMON *const cm = &cpi->common;
|
VP9_COMMON *const cm = &cpi->common;
|
||||||
int arf_sign_bias;
|
int arf_sign_bias;
|
||||||
|
|
||||||
if ((cpi->pass == 2) && cpi->multi_arf_allowed) {
|
if ((cpi->oxcf.pass == 2) && cpi->multi_arf_allowed) {
|
||||||
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
||||||
arf_sign_bias = cpi->rc.source_alt_ref_active &&
|
arf_sign_bias = cpi->rc.source_alt_ref_active &&
|
||||||
(!cpi->refresh_alt_ref_frame ||
|
(!cpi->refresh_alt_ref_frame ||
|
||||||
|
@ -2163,19 +2145,19 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
|
||||||
// static regions if indicated.
|
// static regions if indicated.
|
||||||
// Only allowed in second pass of two pass (as requires lagged coding)
|
// Only allowed in second pass of two pass (as requires lagged coding)
|
||||||
// and if the relevant speed feature flag is set.
|
// and if the relevant speed feature flag is set.
|
||||||
if (cpi->pass == 2 && cpi->sf.static_segmentation)
|
if (cpi->oxcf.pass == 2 && cpi->sf.static_segmentation)
|
||||||
configure_static_seg_features(cpi);
|
configure_static_seg_features(cpi);
|
||||||
|
|
||||||
// Check if the current frame is skippable for the partition search in the
|
// Check if the current frame is skippable for the partition search in the
|
||||||
// second pass according to the first pass stats
|
// second pass according to the first pass stats
|
||||||
if (cpi->pass == 2 &&
|
if (cpi->oxcf.pass == 2 &&
|
||||||
(!cpi->use_svc || is_spatial_svc(cpi))) {
|
(!cpi->use_svc || is_spatial_svc(cpi))) {
|
||||||
configure_skippable_frame(cpi);
|
configure_skippable_frame(cpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For 1 pass CBR, check if we are dropping this frame.
|
// For 1 pass CBR, check if we are dropping this frame.
|
||||||
// Never drop on key frame.
|
// Never drop on key frame.
|
||||||
if (cpi->pass == 0 &&
|
if (cpi->oxcf.pass == 0 &&
|
||||||
cpi->oxcf.rc_mode == VPX_CBR &&
|
cpi->oxcf.rc_mode == VPX_CBR &&
|
||||||
cm->frame_type != KEY_FRAME) {
|
cm->frame_type != KEY_FRAME) {
|
||||||
if (vp9_rc_drop_frame(cpi)) {
|
if (vp9_rc_drop_frame(cpi)) {
|
||||||
|
@ -2507,7 +2489,7 @@ static int get_arf_src_index(VP9_COMP *cpi) {
|
||||||
RATE_CONTROL *const rc = &cpi->rc;
|
RATE_CONTROL *const rc = &cpi->rc;
|
||||||
int arf_src_index = 0;
|
int arf_src_index = 0;
|
||||||
if (is_altref_enabled(cpi)) {
|
if (is_altref_enabled(cpi)) {
|
||||||
if (cpi->pass == 2) {
|
if (cpi->oxcf.pass == 2) {
|
||||||
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
||||||
if (gf_group->update_type[gf_group->index] == ARF_UPDATE) {
|
if (gf_group->update_type[gf_group->index] == ARF_UPDATE) {
|
||||||
arf_src_index = gf_group->arf_src_offset[gf_group->index];
|
arf_src_index = gf_group->arf_src_offset[gf_group->index];
|
||||||
|
@ -2522,7 +2504,7 @@ static int get_arf_src_index(VP9_COMP *cpi) {
|
||||||
static void check_src_altref(VP9_COMP *cpi) {
|
static void check_src_altref(VP9_COMP *cpi) {
|
||||||
RATE_CONTROL *const rc = &cpi->rc;
|
RATE_CONTROL *const rc = &cpi->rc;
|
||||||
|
|
||||||
if (cpi->pass == 2) {
|
if (cpi->oxcf.pass == 2) {
|
||||||
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
||||||
rc->is_src_frame_alt_ref =
|
rc->is_src_frame_alt_ref =
|
||||||
(gf_group->update_type[gf_group->index] == OVERLAY_UPDATE);
|
(gf_group->update_type[gf_group->index] == OVERLAY_UPDATE);
|
||||||
|
@ -2555,7 +2537,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
||||||
if (!cpi)
|
if (!cpi)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (is_spatial_svc(cpi) && cpi->pass == 2) {
|
if (is_spatial_svc(cpi) && cpi->oxcf.pass == 2) {
|
||||||
#if CONFIG_SPATIAL_SVC
|
#if CONFIG_SPATIAL_SVC
|
||||||
vp9_svc_lookahead_peek(cpi, cpi->lookahead, 0, 1);
|
vp9_svc_lookahead_peek(cpi, cpi->lookahead, 0, 1);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2669,7 +2651,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
*size = 0;
|
*size = 0;
|
||||||
if (flush && cpi->pass == 1 && !cpi->twopass.first_pass_done) {
|
if (flush && cpi->oxcf.pass == 1 && !cpi->twopass.first_pass_done) {
|
||||||
vp9_end_first_pass(cpi); /* get last stats packet */
|
vp9_end_first_pass(cpi); /* get last stats packet */
|
||||||
cpi->twopass.first_pass_done = 1;
|
cpi->twopass.first_pass_done = 1;
|
||||||
}
|
}
|
||||||
|
@ -2707,7 +2689,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
||||||
if (!cpi->use_svc && cpi->multi_arf_allowed) {
|
if (!cpi->use_svc && cpi->multi_arf_allowed) {
|
||||||
if (cm->frame_type == KEY_FRAME) {
|
if (cm->frame_type == KEY_FRAME) {
|
||||||
init_buffer_indices(cpi);
|
init_buffer_indices(cpi);
|
||||||
} else if (cpi->pass == 2) {
|
} else if (cpi->oxcf.pass == 2) {
|
||||||
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
||||||
cpi->alt_fb_idx = gf_group->arf_ref_idx[gf_group->index];
|
cpi->alt_fb_idx = gf_group->arf_ref_idx[gf_group->index];
|
||||||
}
|
}
|
||||||
|
@ -2715,7 +2697,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
||||||
|
|
||||||
cpi->frame_flags = *frame_flags;
|
cpi->frame_flags = *frame_flags;
|
||||||
|
|
||||||
if (cpi->pass == 2 &&
|
if (cpi->oxcf.pass == 2 &&
|
||||||
cm->current_video_frame == 0 &&
|
cm->current_video_frame == 0 &&
|
||||||
cpi->oxcf.allow_spatial_resampling &&
|
cpi->oxcf.allow_spatial_resampling &&
|
||||||
cpi->oxcf.rc_mode == VPX_VBR) {
|
cpi->oxcf.rc_mode == VPX_VBR) {
|
||||||
|
@ -2753,13 +2735,13 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
||||||
vp9_vaq_init();
|
vp9_vaq_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpi->pass == 1 &&
|
if (cpi->oxcf.pass == 1 &&
|
||||||
(!cpi->use_svc || is_spatial_svc(cpi))) {
|
(!cpi->use_svc || is_spatial_svc(cpi))) {
|
||||||
const int lossless = is_lossless_requested(&cpi->oxcf);
|
const int lossless = is_lossless_requested(&cpi->oxcf);
|
||||||
cpi->mb.fwd_txm4x4 = lossless ? vp9_fwht4x4 : vp9_fdct4x4;
|
cpi->mb.fwd_txm4x4 = lossless ? vp9_fwht4x4 : vp9_fdct4x4;
|
||||||
cpi->mb.itxm_add = lossless ? vp9_iwht4x4_add : vp9_idct4x4_add;
|
cpi->mb.itxm_add = lossless ? vp9_iwht4x4_add : vp9_idct4x4_add;
|
||||||
vp9_first_pass(cpi);
|
vp9_first_pass(cpi);
|
||||||
} else if (cpi->pass == 2 &&
|
} else if (cpi->oxcf.pass == 2 &&
|
||||||
(!cpi->use_svc || is_spatial_svc(cpi))) {
|
(!cpi->use_svc || is_spatial_svc(cpi))) {
|
||||||
Pass2Encode(cpi, size, dest, frame_flags);
|
Pass2Encode(cpi, size, dest, frame_flags);
|
||||||
} else if (cpi->use_svc) {
|
} else if (cpi->use_svc) {
|
||||||
|
@ -2784,19 +2766,19 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
||||||
// Save layer specific state.
|
// Save layer specific state.
|
||||||
if ((cpi->svc.number_temporal_layers > 1 &&
|
if ((cpi->svc.number_temporal_layers > 1 &&
|
||||||
cpi->oxcf.rc_mode == VPX_CBR) ||
|
cpi->oxcf.rc_mode == VPX_CBR) ||
|
||||||
(cpi->svc.number_spatial_layers > 1 && cpi->pass == 2)) {
|
(cpi->svc.number_spatial_layers > 1 && cpi->oxcf.pass == 2)) {
|
||||||
vp9_save_layer_context(cpi);
|
vp9_save_layer_context(cpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
vpx_usec_timer_mark(&cmptimer);
|
vpx_usec_timer_mark(&cmptimer);
|
||||||
cpi->time_compress_data += vpx_usec_timer_elapsed(&cmptimer);
|
cpi->time_compress_data += vpx_usec_timer_elapsed(&cmptimer);
|
||||||
|
|
||||||
if (cpi->b_calculate_psnr && cpi->pass != 1 && cm->show_frame)
|
if (cpi->b_calculate_psnr && cpi->oxcf.pass != 1 && cm->show_frame)
|
||||||
generate_psnr_packet(cpi);
|
generate_psnr_packet(cpi);
|
||||||
|
|
||||||
#if CONFIG_INTERNAL_STATS
|
#if CONFIG_INTERNAL_STATS
|
||||||
|
|
||||||
if (cpi->pass != 1) {
|
if (cpi->oxcf.pass != 1) {
|
||||||
cpi->bytes += (int)(*size);
|
cpi->bytes += (int)(*size);
|
||||||
|
|
||||||
if (cm->show_frame) {
|
if (cm->show_frame) {
|
||||||
|
|
|
@ -143,6 +143,7 @@ typedef struct VP9EncoderConfig {
|
||||||
unsigned int rc_max_intra_bitrate_pct;
|
unsigned int rc_max_intra_bitrate_pct;
|
||||||
|
|
||||||
MODE mode;
|
MODE mode;
|
||||||
|
int pass;
|
||||||
|
|
||||||
// Key Framing Operations
|
// Key Framing Operations
|
||||||
int auto_key; // autodetect cut scenes and set the keyframes
|
int auto_key; // autodetect cut scenes and set the keyframes
|
||||||
|
@ -313,9 +314,6 @@ typedef struct VP9_COMP {
|
||||||
MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS];
|
MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS];
|
||||||
int mbgraph_n_frames; // number of frames filled in the above
|
int mbgraph_n_frames; // number of frames filled in the above
|
||||||
int static_mb_pct; // % forced skip mbs by segmentation
|
int static_mb_pct; // % forced skip mbs by segmentation
|
||||||
|
|
||||||
int pass;
|
|
||||||
|
|
||||||
int ref_frame_flags;
|
int ref_frame_flags;
|
||||||
|
|
||||||
SPEED_FEATURES sf;
|
SPEED_FEATURES sf;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "vp9/encoder/vp9_quantize.h"
|
#include "vp9/encoder/vp9_quantize.h"
|
||||||
|
|
||||||
static int get_max_filter_level(const VP9_COMP *cpi) {
|
static int get_max_filter_level(const VP9_COMP *cpi) {
|
||||||
if (cpi->pass == 2) {
|
if (cpi->oxcf.pass == 2) {
|
||||||
return cpi->twopass.section_intra_rating > 8 ? MAX_LOOP_FILTER * 3 / 4
|
return cpi->twopass.section_intra_rating > 8 ? MAX_LOOP_FILTER * 3 / 4
|
||||||
: MAX_LOOP_FILTER;
|
: MAX_LOOP_FILTER;
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,7 +82,7 @@ static int search_filter_level(const YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi,
|
||||||
// Bias against raising loop filter in favor of lowering it.
|
// Bias against raising loop filter in favor of lowering it.
|
||||||
int bias = (best_err >> (15 - (filt_mid / 8))) * filter_step;
|
int bias = (best_err >> (15 - (filt_mid / 8))) * filter_step;
|
||||||
|
|
||||||
if ((cpi->pass == 2) && (cpi->twopass.section_intra_rating < 20))
|
if ((cpi->oxcf.pass == 2) && (cpi->twopass.section_intra_rating < 20))
|
||||||
bias = (bias * cpi->twopass.section_intra_rating) / 20;
|
bias = (bias * cpi->twopass.section_intra_rating) / 20;
|
||||||
|
|
||||||
// yx, bias less for large block size
|
// yx, bias less for large block size
|
||||||
|
|
|
@ -277,7 +277,7 @@ static double get_rate_correction_factor(const VP9_COMP *cpi) {
|
||||||
|
|
||||||
if (cpi->common.frame_type == KEY_FRAME) {
|
if (cpi->common.frame_type == KEY_FRAME) {
|
||||||
return rc->rate_correction_factors[KF_STD];
|
return rc->rate_correction_factors[KF_STD];
|
||||||
} else if (cpi->pass == 2) {
|
} else if (cpi->oxcf.pass == 2) {
|
||||||
RATE_FACTOR_LEVEL rf_lvl =
|
RATE_FACTOR_LEVEL rf_lvl =
|
||||||
cpi->twopass.gf_group.rf_level[cpi->twopass.gf_group.index];
|
cpi->twopass.gf_group.rf_level[cpi->twopass.gf_group.index];
|
||||||
return rc->rate_correction_factors[rf_lvl];
|
return rc->rate_correction_factors[rf_lvl];
|
||||||
|
@ -296,7 +296,7 @@ static void set_rate_correction_factor(VP9_COMP *cpi, double factor) {
|
||||||
|
|
||||||
if (cpi->common.frame_type == KEY_FRAME) {
|
if (cpi->common.frame_type == KEY_FRAME) {
|
||||||
rc->rate_correction_factors[KF_STD] = factor;
|
rc->rate_correction_factors[KF_STD] = factor;
|
||||||
} else if (cpi->pass == 2) {
|
} else if (cpi->oxcf.pass == 2) {
|
||||||
RATE_FACTOR_LEVEL rf_lvl =
|
RATE_FACTOR_LEVEL rf_lvl =
|
||||||
cpi->twopass.gf_group.rf_level[cpi->twopass.gf_group.index];
|
cpi->twopass.gf_group.rf_level[cpi->twopass.gf_group.index];
|
||||||
rc->rate_correction_factors[rf_lvl] = factor;
|
rc->rate_correction_factors[rf_lvl] = factor;
|
||||||
|
@ -923,7 +923,7 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi,
|
||||||
int vp9_rc_pick_q_and_bounds(const VP9_COMP *cpi,
|
int vp9_rc_pick_q_and_bounds(const VP9_COMP *cpi,
|
||||||
int *bottom_index, int *top_index) {
|
int *bottom_index, int *top_index) {
|
||||||
int q;
|
int q;
|
||||||
if (cpi->pass == 0) {
|
if (cpi->oxcf.pass == 0) {
|
||||||
if (cpi->oxcf.rc_mode == VPX_CBR)
|
if (cpi->oxcf.rc_mode == VPX_CBR)
|
||||||
q = rc_pick_q_and_bounds_one_pass_cbr(cpi, bottom_index, top_index);
|
q = rc_pick_q_and_bounds_one_pass_cbr(cpi, bottom_index, top_index);
|
||||||
else
|
else
|
||||||
|
@ -991,7 +991,7 @@ static void update_golden_frame_stats(VP9_COMP *cpi) {
|
||||||
// this frame refreshes means next frames don't unless specified by user
|
// this frame refreshes means next frames don't unless specified by user
|
||||||
rc->frames_since_golden = 0;
|
rc->frames_since_golden = 0;
|
||||||
|
|
||||||
if (cpi->pass == 2) {
|
if (cpi->oxcf.pass == 2) {
|
||||||
if (!rc->source_alt_ref_pending &&
|
if (!rc->source_alt_ref_pending &&
|
||||||
cpi->twopass.gf_group.rf_level[0] == GF_ARF_STD)
|
cpi->twopass.gf_group.rf_level[0] == GF_ARF_STD)
|
||||||
rc->source_alt_ref_active = 0;
|
rc->source_alt_ref_active = 0;
|
||||||
|
@ -1242,7 +1242,7 @@ void vp9_rc_get_svc_params(VP9_COMP *cpi) {
|
||||||
(~VP9_LAST_FLAG & ~VP9_GOLD_FLAG & ~VP9_ALT_FLAG);
|
(~VP9_LAST_FLAG & ~VP9_GOLD_FLAG & ~VP9_ALT_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpi->pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) {
|
if (cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) {
|
||||||
target = calc_iframe_target_size_one_pass_cbr(cpi);
|
target = calc_iframe_target_size_one_pass_cbr(cpi);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1260,7 +1260,7 @@ void vp9_rc_get_svc_params(VP9_COMP *cpi) {
|
||||||
cpi->ref_frame_flags &= (~VP9_ALT_FLAG);
|
cpi->ref_frame_flags &= (~VP9_ALT_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpi->pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) {
|
if (cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) {
|
||||||
target = calc_pframe_target_size_one_pass_cbr(cpi);
|
target = calc_pframe_target_size_one_pass_cbr(cpi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) {
|
||||||
const int q = vp9_dc_quant(qindex, 0);
|
const int q = vp9_dc_quant(qindex, 0);
|
||||||
int rdmult = 88 * q * q / 24;
|
int rdmult = 88 * q * q / 24;
|
||||||
|
|
||||||
if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME)) {
|
if (cpi->oxcf.pass == 2 && (cpi->common.frame_type != KEY_FRAME)) {
|
||||||
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
||||||
const FRAME_UPDATE_TYPE frame_type = gf_group->update_type[gf_group->index];
|
const FRAME_UPDATE_TYPE frame_type = gf_group->update_type[gf_group->index];
|
||||||
const int boost_index = MIN(15, (cpi->rc.gfu_boost / 100));
|
const int boost_index = MIN(15, (cpi->rc.gfu_boost / 100));
|
||||||
|
|
|
@ -405,11 +405,11 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
|
||||||
|
|
||||||
// Slow quant, dct and trellis not worthwhile for first pass
|
// Slow quant, dct and trellis not worthwhile for first pass
|
||||||
// so make sure they are always turned off.
|
// so make sure they are always turned off.
|
||||||
if (cpi->pass == 1)
|
if (oxcf->pass == 1)
|
||||||
sf->optimize_coefficients = 0;
|
sf->optimize_coefficients = 0;
|
||||||
|
|
||||||
// No recode for 1 pass.
|
// No recode for 1 pass.
|
||||||
if (cpi->pass == 0) {
|
if (oxcf->pass == 0) {
|
||||||
sf->recode_loop = DISALLOW_RECODE;
|
sf->recode_loop = DISALLOW_RECODE;
|
||||||
sf->optimize_coefficients = 0;
|
sf->optimize_coefficients = 0;
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
|
||||||
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree;
|
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpi->mb.optimize = sf->optimize_coefficients == 1 && cpi->pass != 1;
|
cpi->mb.optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1;
|
||||||
|
|
||||||
if (sf->disable_split_mask == DISABLE_ALL_SPLIT)
|
if (sf->disable_split_mask == DISABLE_ALL_SPLIT)
|
||||||
sf->adaptive_pred_interp_filter = 0;
|
sf->adaptive_pred_interp_filter = 0;
|
||||||
|
|
|
@ -405,7 +405,7 @@ static void adjust_arnr_filter(VP9_COMP *cpi,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjustments for second level arf in multi arf case.
|
// Adjustments for second level arf in multi arf case.
|
||||||
if (cpi->pass == 2 && cpi->multi_arf_allowed) {
|
if (cpi->oxcf.pass == 2 && cpi->multi_arf_allowed) {
|
||||||
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
|
||||||
if (gf_group->rf_level[gf_group->index] != GF_ARF_STD) {
|
if (gf_group->rf_level[gf_group->index] != GF_ARF_STD) {
|
||||||
cpi->active_arnr_strength >>= 1;
|
cpi->active_arnr_strength >>= 1;
|
||||||
|
|
|
@ -337,12 +337,15 @@ static vpx_codec_err_t set_encoder_config(
|
||||||
switch (cfg->g_pass) {
|
switch (cfg->g_pass) {
|
||||||
case VPX_RC_ONE_PASS:
|
case VPX_RC_ONE_PASS:
|
||||||
oxcf->mode = ONE_PASS_GOOD;
|
oxcf->mode = ONE_PASS_GOOD;
|
||||||
|
oxcf->pass = 0;
|
||||||
break;
|
break;
|
||||||
case VPX_RC_FIRST_PASS:
|
case VPX_RC_FIRST_PASS:
|
||||||
oxcf->mode = TWO_PASS_FIRST;
|
oxcf->mode = TWO_PASS_FIRST;
|
||||||
|
oxcf->pass = 1;
|
||||||
break;
|
break;
|
||||||
case VPX_RC_LAST_PASS:
|
case VPX_RC_LAST_PASS:
|
||||||
oxcf->mode = TWO_PASS_SECOND_BEST;
|
oxcf->mode = TWO_PASS_SECOND_BEST;
|
||||||
|
oxcf->pass = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче