Commit 79ebb199 authored by Loren Merritt's avatar Loren Merritt

expose option "chroma qp offset"


git-svn-id: svn://svn.videolan.org/x264/trunk@160 df754926-b1dd-0310-bc7b-ec298dee348c
parent 2fc52995
...@@ -107,6 +107,7 @@ void x264_param_default( x264_param_t *param ) ...@@ -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_direct_mv_pred = X264_DIRECT_PRED_TEMPORAL;
param->analyse.i_subpel_refine = 5; param->analyse.i_subpel_refine = 5;
param->analyse.i_mv_range = 512; param->analyse.i_mv_range = 512;
param->analyse.i_chroma_qp_offset = 0;
param->analyse.b_psnr = 1; param->analyse.b_psnr = 1;
} }
......
...@@ -395,6 +395,7 @@ x264_t *x264_encoder_open ( x264_param_t *param ) ...@@ -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 ); h->param.analyse.i_subpel_refine = x264_clip3( h->param.analyse.i_subpel_refine, 1, 5 );
if( h->param.analyse.inter & X264_ANALYSE_PSUB8x8 ) if( h->param.analyse.inter & X264_ANALYSE_PSUB8x8 )
h->param.analyse.inter |= X264_ANALYSE_PSUB16x16; 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 ) if( h->param.rc.f_qblur < 0 )
h->param.rc.f_qblur = 0; h->param.rc.f_qblur = 0;
......
...@@ -299,7 +299,7 @@ void x264_pps_init( x264_pps_t *pps, int i_id, x264_param_t *param, x264_sps_t * ...@@ -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_qp = 26;
pps->i_pic_init_qs = 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_deblocking_filter_control = 1;
pps->b_constrained_intra_pred = 0; pps->b_constrained_intra_pred = 0;
pps->b_redundant_pic_cnt = 0; pps->b_redundant_pic_cnt = 0;
......
...@@ -126,6 +126,7 @@ static void Help( x264_param_t *defaults ) ...@@ -126,6 +126,7 @@ static void Help( x264_param_t *defaults )
" --rcinitbuf <integer> Initial VBV buffer occupancy [%d]\n" " --rcinitbuf <integer> Initial VBV buffer occupancy [%d]\n"
" --ipratio <float> QP factor between I and P [%.2f]\n" " --ipratio <float> QP factor between I and P [%.2f]\n"
" --pbratio <float> QP factor between P and B [%.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" "\n"
" -p, --pass <1|2> Enable 2 pass ratecontrol\n" " -p, --pass <1|2> Enable 2 pass ratecontrol\n"
" --stats <string> Filename for 2 pass stats [\"%s\"]\n" " --stats <string> Filename for 2 pass stats [\"%s\"]\n"
...@@ -172,6 +173,7 @@ static void Help( x264_param_t *defaults ) ...@@ -172,6 +173,7 @@ static void Help( x264_param_t *defaults )
defaults->rc.i_rc_init_buffer, defaults->rc.i_rc_init_buffer,
defaults->rc.f_ip_factor, defaults->rc.f_ip_factor,
defaults->rc.f_pb_factor, defaults->rc.f_pb_factor,
defaults->analyse.i_chroma_qp_offset,
defaults->rc.psz_stat_out, defaults->rc.psz_stat_out,
defaults->rc.psz_rc_eq, defaults->rc.psz_rc_eq,
defaults->rc.f_qcompress, defaults->rc.f_qcompress,
...@@ -224,6 +226,7 @@ static int Parse( int argc, char **argv, ...@@ -224,6 +226,7 @@ static int Parse( int argc, char **argv,
#define OPT_NOBADAPT 277 #define OPT_NOBADAPT 277
#define OPT_BBIAS 278 #define OPT_BBIAS 278
#define OPT_BPYRAMID 279 #define OPT_BPYRAMID 279
#define OPT_CHROMA_QP 280
static struct option long_options[] = static struct option long_options[] =
{ {
...@@ -259,6 +262,7 @@ static int Parse( int argc, char **argv, ...@@ -259,6 +262,7 @@ static int Parse( int argc, char **argv,
{ "rcinitbuf",required_argument,NULL, OPT_RCIBUF }, { "rcinitbuf",required_argument,NULL, OPT_RCIBUF },
{ "ipratio", required_argument, NULL, OPT_IPRATIO }, { "ipratio", required_argument, NULL, OPT_IPRATIO },
{ "pbratio", required_argument, NULL, OPT_PBRATIO }, { "pbratio", required_argument, NULL, OPT_PBRATIO },
{ "chroma-qp-offset", required_argument, NULL, OPT_CHROMA_QP },
{ "pass", required_argument, NULL, 'p' }, { "pass", required_argument, NULL, 'p' },
{ "stats", required_argument, NULL, OPT_RCSTATS }, { "stats", required_argument, NULL, OPT_RCSTATS },
{ "rceq", required_argument, NULL, OPT_RCEQ }, { "rceq", required_argument, NULL, OPT_RCEQ },
...@@ -431,6 +435,9 @@ static int Parse( int argc, char **argv, ...@@ -431,6 +435,9 @@ static int Parse( int argc, char **argv,
case OPT_PBRATIO: case OPT_PBRATIO:
param->rc.f_pb_factor = atof(optarg); param->rc.f_pb_factor = atof(optarg);
break; break;
case OPT_CHROMA_QP:
param->analyse.i_chroma_qp_offset = atoi(optarg);
break;
case 'p': case 'p':
{ {
int i_pass = atoi(optarg); int i_pass = atoi(optarg);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <stdarg.h> #include <stdarg.h>
#define X264_BUILD 20 #define X264_BUILD 21
/* x264_t: /* x264_t:
* opaque handler for decoder and encoder */ * opaque handler for decoder and encoder */
...@@ -145,6 +145,8 @@ typedef struct ...@@ -145,6 +145,8 @@ typedef struct
int b_weighted_bipred; /* implicit weighting for B-frames */ 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) */ int b_psnr; /* Do we compute PSNR stats (save a few % of cpu) */
} analyse; } analyse;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment