[x264-devel] commit: Various high-bit-depth ratecontrol fixes (Anton Mitrofanov )
git at videolan.org
git at videolan.org
Fri Nov 19 23:50:09 CET 2010
x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Nov 17 02:46:30 2010 +0300| [2824c3a064d88f8b1a4af726249c0b51a449c0b2] | committer: Jason Garrett-Glaser
Various high-bit-depth ratecontrol fixes
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=2824c3a064d88f8b1a4af726249c0b51a449c0b2
---
common/common.c | 4 ++--
encoder/ratecontrol.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/common.c b/common/common.c
index bdab98d..4e3f934 100644
--- a/common/common.c
+++ b/common/common.c
@@ -468,8 +468,8 @@ int x264_param_apply_profile( x264_param_t *param, const char *profile )
x264_log( NULL, X264_LOG_ERROR, "invalid profile: %s\n", profile );
return -1;
}
- if( (param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant == 0) ||
- (param->rc.i_rc_method == X264_RC_CRF && param->rc.f_rf_constant == 0) )
+ if( (param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant <= 0) ||
+ (param->rc.i_rc_method == X264_RC_CRF && (int)(param->rc.f_rf_constant + QP_BD_OFFSET) <= 0) )
{
x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support lossless\n", profile );
return -1;
diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 34879b7..d1fa48e 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -1095,7 +1095,7 @@ void x264_ratecontrol_summary( x264_t *h )
double mbtree_offset = h->param.rc.b_mb_tree ? (1.0-h->param.rc.f_qcompress)*13.5 : 0;
x264_log( h, X264_LOG_INFO, "final ratefactor: %.2f\n",
qscale2qp( pow( base_cplx, 1 - rc->qcompress )
- * rc->cplxr_sum / rc->wanted_bits_window ) - mbtree_offset );
+ * rc->cplxr_sum / rc->wanted_bits_window ) - mbtree_offset - QP_BD_OFFSET );
}
}
@@ -1449,7 +1449,7 @@ int x264_ratecontrol_slice_type( x264_t *h, int frame_num )
/* We could try to initialize everything required for ABR and
* adaptive B-frames, but that would be complicated.
* So just calculate the average QP used so far. */
- h->param.rc.i_qp_constant = (h->stat.i_frame_count[SLICE_TYPE_P] == 0) ? 24
+ h->param.rc.i_qp_constant = (h->stat.i_frame_count[SLICE_TYPE_P] == 0) ? 24 + QP_BD_OFFSET
: 1 + h->stat.f_frame_qp[SLICE_TYPE_P] / h->stat.i_frame_count[SLICE_TYPE_P];
rc->qp_constant[SLICE_TYPE_P] = x264_clip3( h->param.rc.i_qp_constant, 0, QP_MAX );
rc->qp_constant[SLICE_TYPE_I] = x264_clip3( (int)( qscale2qp( qp2qscale( h->param.rc.i_qp_constant ) / fabs( h->param.rc.f_ip_factor )) + 0.5 ), 0, QP_MAX );
More information about the x264-devel
mailing list