From patchwork Fri Feb 10 22:21:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vittorio Giovara X-Patchwork-Id: 2493 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp722727vsb; Fri, 10 Feb 2017 14:29:05 -0800 (PST) X-Received: by 10.223.152.2 with SMTP id v2mr9696609wrb.109.1486765745177; Fri, 10 Feb 2017 14:29:05 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e72si2890159wma.116.2017.02.10.14.29.04; Fri, 10 Feb 2017 14:29:05 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7A9ED689DC1; Sat, 11 Feb 2017 00:28:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk0-f182.google.com (mail-qk0-f182.google.com [209.85.220.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E3EEE689D75 for ; Sat, 11 Feb 2017 00:28:50 +0200 (EET) Received: by mail-qk0-f182.google.com with SMTP id s186so54630203qkb.1 for ; Fri, 10 Feb 2017 14:28:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=+RlobRtXZGQXz4HoxdoU4rnv0tMSGrdbrVHM6ry53Jo=; b=PDGgVE+87WpLsOLnIBkbm04aZckQHdIfYyNQt8kLeMKeQWBaBZM+dE+zz34Rjz81cd O5bhd/mBwKf4zkCLVcAYa8NbEXBM43e+4NFP2YY45G7hBFvlnSyQhlYn/gS7uzYTHaTH hBh6KRifaF6zJcy+15jeHgiTAMNAgp3LY4fLExc23DjIUaxlhio8Bneoy7qr69s86nsT G8yjw7qqJ48pU0EuLvjwCtpuEdAE2CL8+u4y/N55VXZ9KbwZkPxR70qrfkJAdoycv1Xl HPPd/lbG3ql1HnuLBCMB7/aj7VanqrJgMNJPSFl6hzGe6N30G16ciqXccv/IIGxHeI4e 3ySQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=+RlobRtXZGQXz4HoxdoU4rnv0tMSGrdbrVHM6ry53Jo=; b=dM6D/8Saf/pMOlGQnIZqlU3DSY/Pi/rdCH0I1L4z+OmNBoSRGut08Um3QJE8d5BpFr 1USrh9ilCzXzTxkUg3IWk0vu/Agi4lMiUuKwTwjWZCysP2Ygs3b5H7bMXxSV+29m/vhB 7S/71EmAiwRoR8TzsLecMI7TyMF+T3vRNYQ1tZE0HBVNUmzjvofQdNKc7idKAQ24gpJj eufImIm24KuIIcNsEDwpwpHc1UT+uyFseREeXUAr/gZK+gWyb05BpzfOYJErccXtc8Pe vj/+jQayAO6Bxt+AFQGcSl6RIJjHDRVwYGgAZBX1WeMUPFG/bT3Kh5gUZrOynrYh5YCc RG8w== X-Gm-Message-State: AMke39nps7YC1a/SPt2aR3dEpwljBOAYbywPlP5vCNPZhXCeLV2qoWn/IITZzTo/kxvbng== X-Received: by 10.55.88.66 with SMTP id m63mr11423657qkb.270.1486765261721; Fri, 10 Feb 2017 14:21:01 -0800 (PST) Received: from vimacbookpro.vimeows.com (nyv-exweb.iac.com. [216.112.252.10]) by smtp.gmail.com with ESMTPSA id 23sm2524834qtp.20.2017.02.10.14.21.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 10 Feb 2017 14:21:01 -0800 (PST) From: Vittorio Giovara To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Feb 2017 17:21:00 -0500 Message-Id: <20170210222100.15027-1-vittorio.giovara@gmail.com> X-Mailer: git-send-email 2.10.0 Subject: [FFmpeg-devel] [PATCH] h264: Correctly initialize interlaced_frame if tff is set X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" In particular cases, it is possible to initialize top_field_first but not interlaced_frame. Make sure to correctly tag a frame as interlaced when this happens. Signed-off-by: Vittorio Giovara --- Please CC. Vittorio libavcodec/h264_slice.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 91a3b25..eeb5202 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1174,20 +1174,23 @@ static int h264_export_frame_props(H264Context *h) if (cur->field_poc[0] != cur->field_poc[1]) { /* Derive top_field_first from field pocs. */ - cur->f->top_field_first = cur->field_poc[0] < cur->field_poc[1]; + cur->f->interlaced_frame = + cur->f->top_field_first = cur->field_poc[0] < cur->field_poc[1]; } else { if (sps->pic_struct_present_flag) { /* Use picture timing SEI information. Even if it is a * information of a past frame, better than nothing. */ if (h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM || - h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP) - cur->f->top_field_first = 1; - else + h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP) { + cur->f->interlaced_frame = + cur->f->top_field_first = 1; + } else cur->f->top_field_first = 0; } else if (cur->f->interlaced_frame) { /* Default to top field first when pic_struct_present_flag * is not set but interlaced frame detected */ - cur->f->top_field_first = 1; + cur->f->interlaced_frame = + cur->f->top_field_first = 1; } else { /* Most likely progressive */ cur->f->top_field_first = 0;