Browse Source

libx264: Correctly manage constant rate factor params

By default they are set to -1.
tags/n2.3
Luca Barbato 11 years ago
parent
commit
0ef256d515
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      libavcodec/libx264.c

+ 3
- 2
libavcodec/libx264.c View File

@@ -179,7 +179,8 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
x264_encoder_reconfig(x4->enc, &x4->params); x264_encoder_reconfig(x4->enc, &x4->params);
} }


if (x4->params.rc.i_rc_method == X264_RC_CRF &&
if (x4->crf >= 0 &&
x4->params.rc.i_rc_method == X264_RC_CRF &&
x4->params.rc.f_rf_constant != x4->crf) { x4->params.rc.f_rf_constant != x4->crf) {
x4->params.rc.f_rf_constant = x4->crf; x4->params.rc.f_rf_constant = x4->crf;
x264_encoder_reconfig(x4->enc, &x4->params); x264_encoder_reconfig(x4->enc, &x4->params);
@@ -191,7 +192,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
x264_encoder_reconfig(x4->enc, &x4->params); x264_encoder_reconfig(x4->enc, &x4->params);
} }


if (x4->crf_max &&
if (x4->crf_max >= 0 &&
x4->params.rc.f_rf_constant_max != x4->crf_max) { x4->params.rc.f_rf_constant_max != x4->crf_max) {
x4->params.rc.f_rf_constant_max = x4->crf_max; x4->params.rc.f_rf_constant_max = x4->crf_max;
x264_encoder_reconfig(x4->enc, &x4->params); x264_encoder_reconfig(x4->enc, &x4->params);


Loading…
Cancel
Save