summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbrjake <[email protected]>2008-04-26 21:04:27 +0000
committerjbrjake <[email protected]>2008-04-26 21:04:27 +0000
commit82085af4ca15f94743d2185e9ce514b8fb934a7b (patch)
tree6a1ecf3a6b8cec7e7eaa980a433472dd534b5617
parentccb94aa9e6baac0c0896dd55a23987fbf53180b4 (diff)
Opens up another way to give x264 a constant QP or RF, by passing a direct value instead of a percentage that encx264.c has to convert.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1447 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/encx264.c25
-rw-r--r--test/test.c2
2 files changed, 25 insertions, 2 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c
index e529d45a5..ea10e97a6 100644
--- a/libhb/encx264.c
+++ b/libhb/encx264.c
@@ -207,7 +207,7 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
}
- if( job->vquality >= 0.0 && job->vquality <= 1.0 )
+ if( job->vquality > 0.0 && job->vquality < 1.0 )
{
switch( job->crf )
{
@@ -228,6 +228,29 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
break;
}
}
+ else if( job->vquality == 0 || job->vquality >= 1.0 )
+ {
+ /* Use the vquality as a raw RF or QP
+ instead of treating it like a percentage. */
+ switch( job->crf )
+ {
+ case 1:
+ /*Constant RF*/
+ param.rc.i_rc_method = X264_RC_CRF;
+ param.rc.f_rf_constant = job->vquality;
+ hb_log( "encx264: Encoding at constant RF %f",
+ param.rc.f_rf_constant );
+ break;
+
+ case 0:
+ /*Constant QP*/
+ param.rc.i_rc_method = X264_RC_CQP;
+ param.rc.i_qp_constant = job->vquality;
+ hb_log( "encx264: encoding at constant QP %d",
+ param.rc.i_qp_constant );
+ break;
+ }
+ }
else
{
/* Rate control */
diff --git a/test/test.c b/test/test.c
index bfcd87539..f2996b449 100644
--- a/test/test.c
+++ b/test/test.c
@@ -854,7 +854,7 @@ static int HandleEvents( hb_handle_t * h )
hb_fix_aspect( job, HB_KEEP_WIDTH );
}
- if( vquality >= 0.0 && vquality <= 1.0 )
+ if( vquality >= 0.0 && ( ( vquality <= 1.0 ) || ( vcodec == HB_VCODEC_X264 ) ) )
{
job->vquality = vquality;
job->vbitrate = 0;