From 20a3c8c24cc1b2476a62043a8505156f69001ddd Mon Sep 17 00:00:00 2001 From: lorenm Date: Mon, 14 Mar 2005 23:26:11 +0000 Subject: [PATCH] sync to x264 171: chroma_me, chroma_qp_offset git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14944 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 13 ++++++++++++- configure | 2 +- libmpcodecs/ve_x264.c | 15 ++++++++++----- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 2a7cbfff26..3317ee160f 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -7637,7 +7637,7 @@ This isn't recommended and wastes bitrate as scenecuts encoded as P-frames are just as big as I-frames, but don't reset the "keyint counter". . .TP -.B frameref=<1\-15> +.B frameref=<1\-16> Number of previous frames used as predictors in a P-frame (default: 1). This is effective in Anime, but seems to make little difference in live-action source material. @@ -7871,6 +7871,17 @@ In the above, "all candidates" doesn't exactly mean all enabled types: 4x4, 4x8, 8x4 are tried only if 8x8 is better than 16x16. . .TP +.B (no)chroma_me +Takes into account chroma information during subpixel motion search +(default: enabled). +Requires subq=5. +. +.TP +.B chroma_qp_offset=<-12\-12> +Use a different quantizer for chroma as compared to luma. +Useful values are in the range <-2\-2>. (default: 0) +. +.TP .B level_idc=<10\-51> Set the bitstream's Level as defined by Annex A of the H.264 standard (default: 40 - Level 4.0). diff --git a/configure b/configure index c20d710c12..a53c8d06fd 100755 --- a/configure +++ b/configure @@ -5919,7 +5919,7 @@ echocheck "x264" cat > $TMPC << EOF #include #include -#if X264_BUILD < 0x0014 +#if X264_BUILD < 22 #error We do not support old versions of x264. Get the latest from SVN. #endif int main(void) { x264_encoder_open((void*)0); return 0; } diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c index 24c436f1e5..c7e6bf5e65 100644 --- a/libmpcodecs/ve_x264.c +++ b/libmpcodecs/ve_x264.c @@ -78,6 +78,8 @@ static int p8x8mv = 1; static int b8x8mv = 1; static int direct_pred = X264_DIRECT_PRED_TEMPORAL; static int weight_b = 0; +static int chroma_me = 1; +static int chroma_qp_offset = 0; static float ip_factor = 1.4; static float pb_factor = 1.3; static int rc_buffer_size = -1; @@ -99,7 +101,7 @@ static int log_level = 2; m_option_t x264encopts_conf[] = { {"bitrate", &bitrate, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL}, {"qp_constant", &qp_constant, CONF_TYPE_INT, CONF_RANGE, 1, 51, NULL}, - {"frameref", &frame_ref, CONF_TYPE_INT, CONF_RANGE, 1, 15, NULL}, + {"frameref", &frame_ref, CONF_TYPE_INT, CONF_RANGE, 1, 16, NULL}, {"keyint", &keyint_max, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL}, {"keyint_min", &keyint_min, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL}, {"scenecut", &scenecut_threshold, CONF_TYPE_INT, CONF_RANGE, -1, 100, NULL}, @@ -125,6 +127,9 @@ m_option_t x264encopts_conf[] = { {"direct_pred", &direct_pred, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL}, {"weight_b", &weight_b, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"noweight_b", &weight_b, CONF_TYPE_FLAG, 0, 1, 0, NULL}, + {"chroma_me", &chroma_me, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + {"nochroma_me", &chroma_me, CONF_TYPE_FLAG, 0, 1, 0, NULL}, + {"chroma_qp_offset", &chroma_qp_offset, CONF_TYPE_INT, CONF_RANGE, -12, 12, NULL}, {"ip_factor", &ip_factor, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL}, {"pb_factor", &pb_factor, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL}, {"rc_buffer_size", &rc_buffer_size, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL}, @@ -232,6 +237,8 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width, mod->param.analyse.inter |= X264_ANALYSE_BSUB16x16; mod->param.analyse.i_direct_mv_pred = direct_pred; mod->param.analyse.b_weighted_bipred = weight_b; + mod->param.analyse.i_chroma_qp_offset = chroma_qp_offset; + mod->param.analyse.b_chroma_me = chroma_me; mod->param.i_width = width; mod->param.i_height = height; @@ -314,9 +321,8 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt) case IMGFMT_RGB: case IMGFMT_BGR: case IMGFMT_BGR32: - /* 2004/08/05: There seems to be some, but not complete, - support for these colorspaces in X264. Better to stay - on the safe side for now. */ + /* These colorspaces are supported, but they'll just have + * to be converted to I420 internally */ return 0; /* VFCAP_CSP_SUPPORTED */ } return 0; @@ -370,7 +376,6 @@ static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in) static void uninit(struct vf_instance_s *vf) { - // FIXME: flush delayed frames h264_module_t *mod=(h264_module_t*)vf->priv; x264_encoder_close(mod->x264); }