Mercurial > mplayer.hg
comparison libmpcodecs/ve_x264.c @ 13965:b825bd2efe14
sync to x264 r61 (improved 2pass ratecontrol)
rename option 'fullinter' to '4x4mv'
author | lorenm |
---|---|
date | Thu, 18 Nov 2004 07:16:02 +0000 |
parents | 8c93573e0cdf |
children | b055a075999a |
comparison
equal
deleted
inserted
replaced
13964:1df275df47d5 | 13965:b825bd2efe14 |
---|---|
46 #include "img_format.h" | 46 #include "img_format.h" |
47 #include "mp_image.h" | 47 #include "mp_image.h" |
48 #include "vf.h" | 48 #include "vf.h" |
49 | 49 |
50 #include <x264.h> | 50 #include <x264.h> |
51 | |
52 #if X264_BUILD < 0x000c | |
53 #error We do not support old versions of x264. Get the latest from SVN. | |
54 #endif | |
51 | 55 |
52 typedef struct _h264_module_t { | 56 typedef struct _h264_module_t { |
53 muxer_stream_t *mux; | 57 muxer_stream_t *mux; |
54 x264_param_t param; | 58 x264_param_t param; |
55 x264_t * x264; | 59 x264_t * x264; |
68 static int deblock = 1; | 72 static int deblock = 1; |
69 static int deblockalpha = 0; | 73 static int deblockalpha = 0; |
70 static int deblockbeta = 0; | 74 static int deblockbeta = 0; |
71 static int cabac = 1; | 75 static int cabac = 1; |
72 static int cabacidc = -1; | 76 static int cabacidc = -1; |
73 static int fullinter = 0; | 77 static int p4x4mv = 0; |
74 static float ip_factor = 2.0; | 78 static float ip_factor = 1.4; |
75 static float pb_factor = 2.0; | 79 static float pb_factor = 1.4; |
76 static int rc_buffer_size = -1; | 80 static int rc_buffer_size = -1; |
77 static int rc_init_buffer = -1; | 81 static int rc_init_buffer = -1; |
78 static int rc_sens = 4; | 82 static int rc_sens = 4; |
79 static int qp_min = 10; | 83 static int qp_min = 10; |
80 static int qp_max = 51; | 84 static int qp_max = 51; |
81 static int qp_step = 1; | 85 static int qp_step = 1; |
82 static int pass = 0; | 86 static int pass = 0; |
83 static float qcomp = 0.6; | 87 static float qcomp = 0.6; |
84 static float qblur = 0.5; | 88 static float qblur = 0.5; |
85 static char *rc_eq = "(tex^qComp)*(avgTex^(1-qComp))"; | 89 static float complexity_blur = 20; |
90 static char *rc_eq = "tex*blurTex^(qComp-1)"; | |
86 static int subq = 1; | 91 static int subq = 1; |
87 static int psnr = 0; | 92 static int psnr = 0; |
88 static int log_level = 2; | 93 static int log_level = 2; |
89 | 94 |
90 m_option_t x264encopts_conf[] = { | 95 m_option_t x264encopts_conf[] = { |
100 {"deblockalpha", &deblockalpha, CONF_TYPE_INT, CONF_RANGE, -6, 6, NULL}, | 105 {"deblockalpha", &deblockalpha, CONF_TYPE_INT, CONF_RANGE, -6, 6, NULL}, |
101 {"deblockbeta", &deblockbeta, CONF_TYPE_INT, CONF_RANGE, -6, 6, NULL}, | 106 {"deblockbeta", &deblockbeta, CONF_TYPE_INT, CONF_RANGE, -6, 6, NULL}, |
102 {"cabac", &cabac, CONF_TYPE_FLAG, 0, 0, 1, NULL}, | 107 {"cabac", &cabac, CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
103 {"nocabac", &cabac, CONF_TYPE_FLAG, 0, 1, 0, NULL}, | 108 {"nocabac", &cabac, CONF_TYPE_FLAG, 0, 1, 0, NULL}, |
104 {"cabacidc", &cabacidc, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL}, | 109 {"cabacidc", &cabacidc, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL}, |
105 {"fullinter", &fullinter, CONF_TYPE_FLAG, 0, 0, 1, NULL}, | 110 {"4x4mv", &p4x4mv, CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
106 {"nofullinter", &fullinter, CONF_TYPE_FLAG, 0, 1, 0, NULL}, | 111 {"no4x4mv", &p4x4mv, CONF_TYPE_FLAG, 0, 1, 0, NULL}, |
107 {"ip_factor", &ip_factor, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL}, | 112 {"ip_factor", &ip_factor, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL}, |
108 {"pb_factor", &pb_factor, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL}, | 113 {"pb_factor", &pb_factor, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL}, |
109 {"rc_buffer_size", &rc_buffer_size, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL}, | 114 {"rc_buffer_size", &rc_buffer_size, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL}, |
110 {"rc_init_buffer", &rc_init_buffer, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL}, | 115 {"rc_init_buffer", &rc_init_buffer, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL}, |
111 {"rc_sens", &rc_sens, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL}, | 116 {"rc_sens", &rc_sens, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL}, |
114 {"qp_step", &qp_step, CONF_TYPE_INT, CONF_RANGE, 0, 50, NULL}, | 119 {"qp_step", &qp_step, CONF_TYPE_INT, CONF_RANGE, 0, 50, NULL}, |
115 {"pass", &pass, CONF_TYPE_INT, CONF_RANGE, 1, 3, NULL}, | 120 {"pass", &pass, CONF_TYPE_INT, CONF_RANGE, 1, 3, NULL}, |
116 {"rc_eq", &rc_eq, CONF_TYPE_STRING, 0, 0, 0, NULL}, | 121 {"rc_eq", &rc_eq, CONF_TYPE_STRING, 0, 0, 0, NULL}, |
117 {"qcomp", &qcomp, CONF_TYPE_FLOAT, CONF_RANGE, 0, 1, NULL}, | 122 {"qcomp", &qcomp, CONF_TYPE_FLOAT, CONF_RANGE, 0, 1, NULL}, |
118 {"qblur", &qblur, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL}, | 123 {"qblur", &qblur, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL}, |
124 {"cplx_blur", &complexity_blur, CONF_TYPE_FLOAT, CONF_RANGE, 0, 999, NULL}, | |
119 {"subq", &subq, CONF_TYPE_INT, CONF_RANGE, 0, 5, NULL}, | 125 {"subq", &subq, CONF_TYPE_INT, CONF_RANGE, 0, 5, NULL}, |
120 {"psnr", &psnr, CONF_TYPE_FLAG, 0, 0, 1, NULL}, | 126 {"psnr", &psnr, CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
121 {"nopsnr", &psnr, CONF_TYPE_FLAG, 0, 1, 0, NULL}, | 127 {"nopsnr", &psnr, CONF_TYPE_FLAG, 0, 1, 0, NULL}, |
122 {"log", &log_level, CONF_TYPE_INT, CONF_RANGE, -1, 3, NULL}, | 128 {"log", &log_level, CONF_TYPE_INT, CONF_RANGE, -1, 3, NULL}, |
123 {NULL, NULL, 0, 0, 0, 0, NULL} | 129 {NULL, NULL, 0, 0, 0, 0, NULL} |
151 mod->param.rc.i_qp_max = qp_max; | 157 mod->param.rc.i_qp_max = qp_max; |
152 mod->param.rc.i_qp_step = qp_step; | 158 mod->param.rc.i_qp_step = qp_step; |
153 mod->param.rc.psz_rc_eq = rc_eq; | 159 mod->param.rc.psz_rc_eq = rc_eq; |
154 mod->param.rc.f_qcompress = qcomp; | 160 mod->param.rc.f_qcompress = qcomp; |
155 mod->param.rc.f_qblur = qblur; | 161 mod->param.rc.f_qblur = qblur; |
162 mod->param.rc.f_complexity_blur = complexity_blur; | |
156 mod->param.analyse.i_subpel_refine = subq; | 163 mod->param.analyse.i_subpel_refine = subq; |
157 mod->param.rc.psz_stat_out = passtmpfile; | 164 mod->param.rc.psz_stat_out = passtmpfile; |
158 mod->param.rc.psz_stat_in = passtmpfile; | 165 mod->param.rc.psz_stat_in = passtmpfile; |
159 if((pass & 2) && bitrate <= 0) | 166 if((pass & 2) && bitrate <= 0) |
160 { | 167 { |
189 mod->param.rc.i_bitrate = bitrate; | 196 mod->param.rc.i_bitrate = bitrate; |
190 mod->param.rc.i_rc_buffer_size = rc_buffer_size; | 197 mod->param.rc.i_rc_buffer_size = rc_buffer_size; |
191 mod->param.rc.i_rc_init_buffer = rc_init_buffer; | 198 mod->param.rc.i_rc_init_buffer = rc_init_buffer; |
192 mod->param.rc.i_rc_sens = rc_sens; | 199 mod->param.rc.i_rc_sens = rc_sens; |
193 } | 200 } |
194 if(fullinter) | 201 if(p4x4mv) |
195 mod->param.analyse.inter = X264_ANALYSE_I4x4 | X264_ANALYSE_PSUB16x16 | X264_ANALYSE_PSUB8x8; | 202 mod->param.analyse.inter = X264_ANALYSE_I4x4 | X264_ANALYSE_PSUB16x16 | X264_ANALYSE_PSUB8x8; |
196 mod->param.rc.f_ip_factor = ip_factor; | 203 mod->param.rc.f_ip_factor = ip_factor; |
197 mod->param.rc.f_pb_factor = pb_factor; | 204 mod->param.rc.f_pb_factor = pb_factor; |
198 | 205 |
199 mod->param.i_width = width; | 206 mod->param.i_width = width; |