Merge "Fix to avoid abrupt relaxation of max qindex in recode path"
This commit is contained in:
@@ -3507,8 +3507,14 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size,
|
|||||||
// Frame is too large
|
// Frame is too large
|
||||||
if (rc->projected_frame_size > rc->this_frame_target) {
|
if (rc->projected_frame_size > rc->this_frame_target) {
|
||||||
// Special case if the projected size is > the max allowed.
|
// Special case if the projected size is > the max allowed.
|
||||||
if (rc->projected_frame_size >= rc->max_frame_bandwidth)
|
if (rc->projected_frame_size >= rc->max_frame_bandwidth) {
|
||||||
q_high = rc->worst_quality;
|
double q_val_high;
|
||||||
|
q_val_high = vp9_convert_qindex_to_q(q_high, cm->bit_depth);
|
||||||
|
q_val_high = q_val_high * ((double)rc->projected_frame_size /
|
||||||
|
rc->max_frame_bandwidth);
|
||||||
|
q_high = vp9_convert_q_to_qindex(q_val_high, cm->bit_depth);
|
||||||
|
q_high = clamp(q_high, rc->best_quality, rc->worst_quality);
|
||||||
|
}
|
||||||
|
|
||||||
// Raise Qlow as to at least the current value
|
// Raise Qlow as to at least the current value
|
||||||
qstep =
|
qstep =
|
||||||
|
|||||||
@@ -166,6 +166,19 @@ double vp9_convert_qindex_to_q(int qindex, vpx_bit_depth_t bit_depth) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vp9_convert_q_to_qindex(double q_val, vpx_bit_depth_t bit_depth) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < QINDEX_RANGE; ++i)
|
||||||
|
if (vp9_convert_qindex_to_q(i, bit_depth) >= q_val)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i == QINDEX_RANGE)
|
||||||
|
i--;
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
int vp9_rc_bits_per_mb(FRAME_TYPE frame_type, int qindex,
|
int vp9_rc_bits_per_mb(FRAME_TYPE frame_type, int qindex,
|
||||||
double correction_factor, vpx_bit_depth_t bit_depth) {
|
double correction_factor, vpx_bit_depth_t bit_depth) {
|
||||||
const double q = vp9_convert_qindex_to_q(qindex, bit_depth);
|
const double q = vp9_convert_qindex_to_q(qindex, bit_depth);
|
||||||
|
|||||||
@@ -179,6 +179,8 @@ int vp9_estimate_bits_at_q(FRAME_TYPE frame_kind, int q, int mbs,
|
|||||||
|
|
||||||
double vp9_convert_qindex_to_q(int qindex, vpx_bit_depth_t bit_depth);
|
double vp9_convert_qindex_to_q(int qindex, vpx_bit_depth_t bit_depth);
|
||||||
|
|
||||||
|
int vp9_convert_q_to_qindex(double q_val, vpx_bit_depth_t bit_depth);
|
||||||
|
|
||||||
void vp9_rc_init_minq_luts(void);
|
void vp9_rc_init_minq_luts(void);
|
||||||
|
|
||||||
int vp9_rc_get_default_min_gf_interval(int width, int height, double framerate);
|
int vp9_rc_get_default_min_gf_interval(int width, int height, double framerate);
|
||||||
|
|||||||
Reference in New Issue
Block a user