]> granicus.if.org Git - handbrake/commitdiff
Added CRF x264 rate control method to HBTest.
authorjbrjake <jb.rubin@gmail.com>
Thu, 4 Jan 2007 19:48:54 +0000 (19:48 +0000)
committerjbrjake <jb.rubin@gmail.com>
Thu, 4 Jan 2007 19:48:54 +0000 (19:48 +0000)
Constant quantizer is maintained as the default so nothing changes:
HBTest -i input -o output -e x264 -q 0.60

Switch to constant rate factor by throwing a -Q on the end:
HBTest -i input -o output -e x264 -q 0.60 -Q

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk/libhb@89 b64f7644-9d1e-0410-96f1-a4d463321fa5

common.h
encx264.c

index 0bd8971e388127dc40ecc2310fe2097f19de0264..eba152f35d24462a159c85a29b81158a2519416e 100644 (file)
--- a/common.h
+++ b/common.h
@@ -124,7 +124,8 @@ struct hb_job_s
     int             pass;
     int             h264_13;
        int                             h264_level;
-
+       int                             crf;
+       
     /* Audio tracks:
          Indexes in hb_title_t's audios list, starting from 0.
          -1 indicates the end of the list */
index a72a9603ef79131322ad2e393c1af024026788bf..1bc24866c5144514441e438ae0b2b890b0945dd1 100644 (file)
--- a/encx264.c
+++ b/encx264.c
@@ -77,11 +77,23 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
        
     if( job->vquality >= 0.0 && job->vquality <= 1.0 )
     {
-        /* Constant QP */
-        param.rc.i_rc_method = X264_RC_CQP;
-        param.rc.i_qp_constant = 51 - job->vquality * 51;
-        hb_log( "encx264: encoding at constant QP %d",
+        switch(job->crf)
+               {
+                       case 1:
+                       /*Constant RF*/
+                       param.rc.i_rc_method = X264_RC_CRF;
+                       param.rc.f_rf_constant = 51 - job->vquality * 51;
+                       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 = 51 - job->vquality * 51;
+               hb_log( "encx264: encoding at constant QP %d",
                 param.rc.i_qp_constant );
+                       break;
+               }
     }
     else
     {