]> granicus.if.org Git - libx264/commitdiff
expose option "chroma qp offset"
authorLoren Merritt <pengvado@videolan.org>
Thu, 10 Mar 2005 21:42:24 +0000 (21:42 +0000)
committerLoren Merritt <pengvado@videolan.org>
Thu, 10 Mar 2005 21:42:24 +0000 (21:42 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@160 df754926-b1dd-0310-bc7b-ec298dee348c

common/common.c
encoder/encoder.c
encoder/set.c
x264.c
x264.h

index 4d634be2429385dce0adc0024a12d1925a4840c3..0e70204bc8aab9cad5d76154e60c6ff33f504ffe 100644 (file)
@@ -107,6 +107,7 @@ void    x264_param_default( x264_param_t *param )
     param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_TEMPORAL;
     param->analyse.i_subpel_refine = 5;
     param->analyse.i_mv_range = 512;
+    param->analyse.i_chroma_qp_offset = 0;
     param->analyse.b_psnr = 1;
 }
 
index bfab88b70c04edc1680c4e1431239ef104c4dd28..a94127f90973489c73f69b2d5d65b55fceaf8916 100644 (file)
@@ -395,6 +395,7 @@ x264_t *x264_encoder_open   ( x264_param_t *param )
     h->param.analyse.i_subpel_refine = x264_clip3( h->param.analyse.i_subpel_refine, 1, 5 );
     if( h->param.analyse.inter & X264_ANALYSE_PSUB8x8 )
         h->param.analyse.inter |= X264_ANALYSE_PSUB16x16;
+    h->param.analyse.i_chroma_qp_offset = x264_clip3(h->param.analyse.i_chroma_qp_offset, -12, 12);
 
     if( h->param.rc.f_qblur < 0 )
         h->param.rc.f_qblur = 0;
index 3fdca53fe514a1d35c23f28e421390b60c10e5d8..4743285319ea9c07368812f5207c30ef13a0d431 100644 (file)
@@ -299,7 +299,7 @@ void x264_pps_init( x264_pps_t *pps, int i_id, x264_param_t *param, x264_sps_t *
     pps->i_pic_init_qp = 26;
     pps->i_pic_init_qs = 26;
 
-    pps->i_chroma_qp_index_offset = 0;
+    pps->i_chroma_qp_index_offset = param->analyse.i_chroma_qp_offset;
     pps->b_deblocking_filter_control = 1;
     pps->b_constrained_intra_pred = 0;
     pps->b_redundant_pic_cnt = 0;
diff --git a/x264.c b/x264.c
index d031eac26655f8429be0bb71cfd598c5c69357e2..58bb8d394f5d63822fb40af2fd74c247d22a6a10 100644 (file)
--- a/x264.c
+++ b/x264.c
@@ -126,6 +126,7 @@ static void Help( x264_param_t *defaults )
              "      --rcinitbuf <integer>   Initial VBV buffer occupancy [%d]\n"
              "      --ipratio <float>       QP factor between I and P [%.2f]\n"
              "      --pbratio <float>       QP factor between P and B [%.2f]\n"
+             "      --chroma-qp-offset <integer>  QP difference between chroma and luma [%d]\n"
              "\n"
              "  -p, --pass <1|2>            Enable 2 pass ratecontrol\n"
              "      --stats <string>        Filename for 2 pass stats [\"%s\"]\n"
@@ -172,6 +173,7 @@ static void Help( x264_param_t *defaults )
             defaults->rc.i_rc_init_buffer,
             defaults->rc.f_ip_factor,
             defaults->rc.f_pb_factor,
+            defaults->analyse.i_chroma_qp_offset,
             defaults->rc.psz_stat_out,
             defaults->rc.psz_rc_eq,
             defaults->rc.f_qcompress,
@@ -224,6 +226,7 @@ static int  Parse( int argc, char **argv,
 #define OPT_NOBADAPT 277
 #define OPT_BBIAS 278
 #define OPT_BPYRAMID 279
+#define OPT_CHROMA_QP 280
 
         static struct option long_options[] =
         {
@@ -259,6 +262,7 @@ static int  Parse( int argc, char **argv,
             { "rcinitbuf",required_argument,NULL, OPT_RCIBUF },
             { "ipratio", required_argument, NULL, OPT_IPRATIO },
             { "pbratio", required_argument, NULL, OPT_PBRATIO },
+            { "chroma-qp-offset", required_argument, NULL, OPT_CHROMA_QP },
             { "pass",    required_argument, NULL, 'p' },
             { "stats",   required_argument, NULL, OPT_RCSTATS },
             { "rceq",    required_argument, NULL, OPT_RCEQ },
@@ -431,6 +435,9 @@ static int  Parse( int argc, char **argv,
             case OPT_PBRATIO:
                 param->rc.f_pb_factor = atof(optarg);
                 break;
+            case OPT_CHROMA_QP:
+                param->analyse.i_chroma_qp_offset = atoi(optarg);
+                break;
             case 'p':
             {
                 int i_pass = atoi(optarg);
diff --git a/x264.h b/x264.h
index b15b806b5a3acabe4c7d351a1aa6dae635136dea..dde5e8459719fb2423811398d5e63fad9629ec27 100644 (file)
--- a/x264.h
+++ b/x264.h
@@ -26,7 +26,7 @@
 
 #include <stdarg.h>
 
-#define X264_BUILD 20
+#define X264_BUILD 21
 
 /* x264_t:
  *      opaque handler for decoder and encoder */
@@ -145,6 +145,8 @@ typedef struct
 
         int          b_weighted_bipred; /* implicit weighting for B-frames */
 
+        int          i_chroma_qp_offset;
+
         int          b_psnr;    /* Do we compute PSNR stats (save a few % of cpu) */
     } analyse;