comparison mpegvideo_enc.c @ 7034:130784da5595 libavcodec

uniformize trellis quant option
author bcoudurier
date Mon, 09 Jun 2008 00:43:07 +0000
parents e1302edb0f69
children e943e1409077
comparison
equal deleted inserted replaced
7033:f90b89217cc9 7034:130784da5595
330 s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER); 330 s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER);
331 s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN); 331 s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN);
332 s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC); 332 s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC);
333 s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT); 333 s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT);
334 334
335 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
336 if (s->flags & CODEC_FLAG_TRELLIS_QUANT)
337 avctx->trellis = 1;
338 #endif
339
335 if(avctx->rc_max_rate && !avctx->rc_buffer_size){ 340 if(avctx->rc_max_rate && !avctx->rc_buffer_size){
336 av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n"); 341 av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n");
337 return -1; 342 return -1;
338 } 343 }
339 344
412 if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ //FIXME mpeg2 uses that too 417 if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ //FIXME mpeg2 uses that too
413 av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supported by codec\n"); 418 av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supported by codec\n");
414 return -1; 419 return -1;
415 } 420 }
416 421
417 if((s->flags & CODEC_FLAG_CBP_RD) && !(s->flags & CODEC_FLAG_TRELLIS_QUANT)){ 422 if((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis){
418 av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n"); 423 av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n");
419 return -1; 424 return -1;
420 } 425 }
421 426
422 if((s->flags & CODEC_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD){ 427 if((s->flags & CODEC_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD){
678 if(!s->dct_quantize) 683 if(!s->dct_quantize)
679 s->dct_quantize = dct_quantize_c; 684 s->dct_quantize = dct_quantize_c;
680 if(!s->denoise_dct) 685 if(!s->denoise_dct)
681 s->denoise_dct = denoise_dct_c; 686 s->denoise_dct = denoise_dct_c;
682 s->fast_dct_quantize = s->dct_quantize; 687 s->fast_dct_quantize = s->dct_quantize;
683 if(s->flags & CODEC_FLAG_TRELLIS_QUANT) 688 if(avctx->trellis)
684 s->dct_quantize = dct_quantize_trellis_c; 689 s->dct_quantize = dct_quantize_trellis_c;
685 690
686 if((ENABLE_H263P_ENCODER || ENABLE_RV20_ENCODER) && s->modified_quant) 691 if((ENABLE_H263P_ENCODER || ENABLE_RV20_ENCODER) && s->modified_quant)
687 s->chroma_qscale_table= ff_h263_chroma_qscale_table; 692 s->chroma_qscale_table= ff_h263_chroma_qscale_table;
688 s->progressive_frame= 693 s->progressive_frame=