comparison libx264.c @ 10659:1f835b8a41c0 libavcodec

Boolify options passed to x264.
author darkshikari
date Tue, 08 Dec 2009 20:35:01 +0000
parents 8a7d79132993
children 80161fd66fd1
comparison
equal deleted inserted replaced
10658:8a7d79132993 10659:1f835b8a41c0
157 157
158 x4->params.i_keyint_max = avctx->gop_size; 158 x4->params.i_keyint_max = avctx->gop_size;
159 x4->params.rc.i_bitrate = avctx->bit_rate / 1000; 159 x4->params.rc.i_bitrate = avctx->bit_rate / 1000;
160 x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000; 160 x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;
161 x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000; 161 x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000;
162 x4->params.rc.b_stat_write = avctx->flags & CODEC_FLAG_PASS1; 162 x4->params.rc.b_stat_write = !!(avctx->flags & CODEC_FLAG_PASS1);
163 if (avctx->flags & CODEC_FLAG_PASS2) { 163 if (avctx->flags & CODEC_FLAG_PASS2) {
164 x4->params.rc.b_stat_read = 1; 164 x4->params.rc.b_stat_read = 1;
165 } else { 165 } else {
166 if (avctx->crf) { 166 if (avctx->crf) {
167 x4->params.rc.i_rc_method = X264_RC_CRF; 167 x4->params.rc.i_rc_method = X264_RC_CRF;
188 if (x4->params.i_keyint_min > x4->params.i_keyint_max) 188 if (x4->params.i_keyint_min > x4->params.i_keyint_max)
189 x4->params.i_keyint_min = x4->params.i_keyint_max; 189 x4->params.i_keyint_min = x4->params.i_keyint_max;
190 190
191 x4->params.i_scenecut_threshold = avctx->scenechange_threshold; 191 x4->params.i_scenecut_threshold = avctx->scenechange_threshold;
192 192
193 x4->params.b_deblocking_filter = avctx->flags & CODEC_FLAG_LOOP_FILTER; 193 x4->params.b_deblocking_filter = !!(avctx->flags & CODEC_FLAG_LOOP_FILTER);
194 x4->params.i_deblocking_filter_alphac0 = avctx->deblockalpha; 194 x4->params.i_deblocking_filter_alphac0 = avctx->deblockalpha;
195 x4->params.i_deblocking_filter_beta = avctx->deblockbeta; 195 x4->params.i_deblocking_filter_beta = avctx->deblockbeta;
196 196
197 x4->params.rc.i_qp_min = avctx->qmin; 197 x4->params.rc.i_qp_min = avctx->qmin;
198 x4->params.rc.i_qp_max = avctx->qmax; 198 x4->params.rc.i_qp_max = avctx->qmax;
225 x4->params.analyse.inter |= X264_ANALYSE_BSUB16x16; 225 x4->params.analyse.inter |= X264_ANALYSE_BSUB16x16;
226 } 226 }
227 227
228 x4->params.analyse.i_direct_mv_pred = avctx->directpred; 228 x4->params.analyse.i_direct_mv_pred = avctx->directpred;
229 229
230 x4->params.analyse.b_weighted_bipred = avctx->flags2 & CODEC_FLAG2_WPRED; 230 x4->params.analyse.b_weighted_bipred = !!(avctx->flags2 & CODEC_FLAG2_WPRED);
231 x4->params.analyse.i_weighted_pred = avctx->weighted_p_pred; 231 x4->params.analyse.i_weighted_pred = avctx->weighted_p_pred;
232 232
233 if (avctx->me_method == ME_EPZS) 233 if (avctx->me_method == ME_EPZS)
234 x4->params.analyse.i_me_method = X264_ME_DIA; 234 x4->params.analyse.i_me_method = X264_ME_DIA;
235 else if (avctx->me_method == ME_HEX) 235 else if (avctx->me_method == ME_HEX)
243 else x4->params.analyse.i_me_method = X264_ME_HEX; 243 else x4->params.analyse.i_me_method = X264_ME_HEX;
244 244
245 x4->params.analyse.i_me_range = avctx->me_range; 245 x4->params.analyse.i_me_range = avctx->me_range;
246 x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality; 246 x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality;
247 247
248 x4->params.analyse.b_mixed_references = avctx->flags2 & CODEC_FLAG2_MIXED_REFS; 248 x4->params.analyse.b_mixed_references = !!(avctx->flags2 & CODEC_FLAG2_MIXED_REFS);
249 x4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA; 249 x4->params.analyse.b_chroma_me = !!(avctx->me_cmp & FF_CMP_CHROMA);
250 x4->params.analyse.b_transform_8x8 = avctx->flags2 & CODEC_FLAG2_8X8DCT; 250 x4->params.analyse.b_transform_8x8 = !!(avctx->flags2 & CODEC_FLAG2_8X8DCT);
251 x4->params.analyse.b_fast_pskip = avctx->flags2 & CODEC_FLAG2_FASTPSKIP; 251 x4->params.analyse.b_fast_pskip = !!(avctx->flags2 & CODEC_FLAG2_FASTPSKIP);
252 252
253 x4->params.analyse.i_trellis = avctx->trellis; 253 x4->params.analyse.i_trellis = avctx->trellis;
254 x4->params.analyse.i_noise_reduction = avctx->noise_reduction; 254 x4->params.analyse.i_noise_reduction = avctx->noise_reduction;
255 255
256 if (avctx->level > 0) 256 if (avctx->level > 0)
269 x4->params.rc.b_mb_tree = !!(avctx->flags2 & CODEC_FLAG2_MBTREE); 269 x4->params.rc.b_mb_tree = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
270 x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor); 270 x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);
271 x4->params.rc.f_pb_factor = avctx->b_quant_factor; 271 x4->params.rc.f_pb_factor = avctx->b_quant_factor;
272 x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset; 272 x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
273 273
274 x4->params.analyse.b_psnr = avctx->flags & CODEC_FLAG_PSNR; 274 x4->params.analyse.b_psnr = !!(avctx->flags & CODEC_FLAG_PSNR);
275 x4->params.i_log_level = X264_LOG_DEBUG; 275 x4->params.i_log_level = X264_LOG_DEBUG;
276 276
277 x4->params.b_aud = avctx->flags2 & CODEC_FLAG2_AUD; 277 x4->params.b_aud = !!(avctx->flags2 & CODEC_FLAG2_AUD);
278 278
279 x4->params.i_threads = avctx->thread_count; 279 x4->params.i_threads = avctx->thread_count;
280 280
281 x4->params.b_interlaced = avctx->flags & CODEC_FLAG_INTERLACED_DCT; 281 x4->params.b_interlaced = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
282 282
283 if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) 283 if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
284 x4->params.b_repeat_headers = 0; 284 x4->params.b_repeat_headers = 0;
285 285
286 x4->enc = x264_encoder_open(&x4->params); 286 x4->enc = x264_encoder_open(&x4->params);