avcodec/libx264: Avoid reconfig on equivalent aspect ratios
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 18 Jun 2015 12:40:11 +0000 (14:40 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 18 Jun 2015 12:40:11 +0000 (14:40 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/libx264.c

index 220d43e..4f34d06 100644 (file)
@@ -170,8 +170,7 @@ static void reconfig_encoder(AVCodecContext *ctx, const AVFrame *frame)
         x4->params.b_tff = frame->top_field_first;
         x264_encoder_reconfig(x4->enc, &x4->params);
     }
-    if (x4->params.vui.i_sar_height != ctx->sample_aspect_ratio.den ||
-        x4->params.vui.i_sar_width  != ctx->sample_aspect_ratio.num) {
+    if (x4->params.vui.i_sar_height*ctx->sample_aspect_ratio.num != ctx->sample_aspect_ratio.den * x4->params.vui.i_sar_width) {
         x4->params.vui.i_sar_height = ctx->sample_aspect_ratio.den;
         x4->params.vui.i_sar_width  = ctx->sample_aspect_ratio.num;
         x264_encoder_reconfig(x4->enc, &x4->params);