Do not (re-)set libx264 parameter b_tff if interlaced encoding was not requested.
authorCarl Eugen Hoyos <cehoyos@ag.or.at>
Sat, 16 Mar 2013 19:13:44 +0000 (20:13 +0100)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Mon, 18 Mar 2013 01:11:30 +0000 (02:11 +0100)
Reconfiguring can break x264 lossless encoding.

Fixes ticket #2165.
(cherry picked from commit 75c7e4583f4fd727d236a12763a265502fe00988)

libavcodec/libx264.c

index a394213..7e8fa65 100644 (file)
@@ -175,7 +175,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
             frame->pict_type == AV_PICTURE_TYPE_P ? X264_TYPE_P :
             frame->pict_type == AV_PICTURE_TYPE_B ? X264_TYPE_B :
                                             X264_TYPE_AUTO;
-        if (x4->params.b_tff != frame->top_field_first) {
+        if (x4->params.b_interlaced && x4->params.b_tff != frame->top_field_first) {
             x4->params.b_tff = frame->top_field_first;
             x264_encoder_reconfig(x4->enc, &x4->params);
         }