[FFmpeg-devel] [RFC] Specifying KEYINT (-g) has no effect in libx264

Baptiste Coudurier baptiste.coudurier at gmail.com
Fri May 27 02:54:03 CEST 2011


Hi Etienne,

On 05/26/2011 05:15 PM, Etienne Buira wrote:
> Hi Baptiste and Stefano. Thank you both for reviewing.
> 
> [...]
>  
>  static void X264_log(void *p, int level, const char *fmt, va_list args)
> @@ -170,6 +219,39 @@ static av_cold int X264_close(AVCodecContext *avctx)
>      av_free(x4->level);
>      av_free(x4->stats);
>      av_free(x4->weightp);
> +    av_free(x4->keyint_max);
> +    av_free(x4->bframes);
> +    av_free(x4->cabac);
> +    av_free(x4->badapt);
> +    av_free(x4->bbias);
> +    av_free(x4->keyintmin);
> +    av_free(x4->scenecut);
> +    av_free(x4->deblockalpha);
> +    av_free(x4->deblockbeta);
> +    av_free(x4->qpmin);
> +    av_free(x4->qpmax);
> +    av_free(x4->qpstep);
> +    av_free(x4->qcomp);
> +    av_free(x4->qblur);
> +    av_free(x4->cplxblur);
> +    av_free(x4->ref);
> +    av_free(x4->partitions);
> +    av_free(x4->directpred);
> +    av_free(x4->me_method);
> +    av_free(x4->aqmode);
> +    av_free(x4->aqstrength);
> +    av_free(x4->rc_lookahead);
> +    av_free(x4->psy_rd);
> +    av_free(x4->psy_trellis);
> +    av_free(x4->me_range);
> +    av_free(x4->subq);
> +    av_free(x4->chroma_me);
> +    av_free(x4->trellis);
> +    av_free(x4->nr);
> +    av_free(x4->ip_factor);
> +    av_free(x4->pb_factor);
> +    av_free(x4->chromaoffset);
> +    av_free(x4->slices);

I believe it is possible to parse the options array and if AVOption type
is OPT_STRING, free the offset, that should work.

> [...]
>
> -
> -    x4->params.b_intra_refresh      = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH;

Where did this go ? Leave it as-is. We don't need to remap flags if the
default in x264 is not set for now.

> [...]
>
>      x4->params.rc.i_bitrate         = avctx->bit_rate       / 1000;
>      x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;
>      x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate    / 1000;
> -    x4->params.rc.b_stat_write      = avctx->flags & CODEC_FLAG_PASS1;
> -    if (avctx->flags & CODEC_FLAG_PASS2) {
> -        x4->params.rc.b_stat_read = 1;
> -    } else {
> -        if (avctx->crf) {
> -            x4->params.rc.i_rc_method   = X264_RC_CRF;
> -            x4->params.rc.f_rf_constant = avctx->crf;
> -            x4->params.rc.f_rf_constant_max = avctx->crf_max;
> -        } else if (avctx->cqp > -1) {
> -            x4->params.rc.i_rc_method   = X264_RC_CQP;
> -            x4->params.rc.i_qp_constant = avctx->cqp;
> -        }
> -    }

Same, where did this go ? It seems it went under #if 0 ?
Please make sure it works :)

>      OPT_STR("stats", x4->stats);
>  
> @@ -370,24 +498,12 @@ static av_cold int X264_init(AVCodecContext *avctx)
>      x4->params.i_fps_num = x4->params.i_timebase_den = avctx->time_base.den;
>      x4->params.i_fps_den = x4->params.i_timebase_num = avctx->time_base.num;
>  
> -    x4->params.analyse.b_psnr = avctx->flags & CODEC_FLAG_PSNR;
> -    x4->params.analyse.b_ssim = avctx->flags2 & CODEC_FLAG2_SSIM;
> -
> -    x4->params.b_aud          = avctx->flags2 & CODEC_FLAG2_AUD;
> -
>      x4->params.i_threads      = avctx->thread_count;
>  
> -    x4->params.b_interlaced   = avctx->flags & CODEC_FLAG_INTERLACED_DCT;
> -

Leave these as-is for now.

> [...]
>
>      x4->params.vui.b_fullrange = avctx->pix_fmt == PIX_FMT_YUVJ420P;
>  
> -    if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
> -        x4->params.b_repeat_headers = 0;

Lease this "as-is" for now.

[...]

-- 
Baptiste COUDURIER
Key fingerprint          8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                           http://www.ffmpeg.org


More information about the ffmpeg-devel mailing list