From: Loren Merritt Date: Thu, 10 Mar 2005 21:42:24 +0000 (+0000) Subject: expose option "chroma qp offset" X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=79ebb19964a115ab8de21fe1e90162ff9954b283;p=x264.git expose option "chroma qp offset" git-svn-id: svn://svn.videolan.org/x264/trunk@160 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/common/common.c b/common/common.c index 4d634be2..0e70204b 100644 --- a/common/common.c +++ b/common/common.c @@ -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; } diff --git a/encoder/encoder.c b/encoder/encoder.c index bfab88b7..a94127f9 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -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; diff --git a/encoder/set.c b/encoder/set.c index 3fdca53f..47432853 100644 --- a/encoder/set.c +++ b/encoder/set.c @@ -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 d031eac2..58bb8d39 100644 --- a/x264.c +++ b/x264.c @@ -126,6 +126,7 @@ static void Help( x264_param_t *defaults ) " --rcinitbuf Initial VBV buffer occupancy [%d]\n" " --ipratio QP factor between I and P [%.2f]\n" " --pbratio QP factor between P and B [%.2f]\n" + " --chroma-qp-offset QP difference between chroma and luma [%d]\n" "\n" " -p, --pass <1|2> Enable 2 pass ratecontrol\n" " --stats 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 b15b806b..dde5e845 100644 --- a/x264.h +++ b/x264.h @@ -26,7 +26,7 @@ #include -#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;