From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 079A440C84 for ; Sun, 6 Feb 2022 10:04:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1FDD168B143; Sun, 6 Feb 2022 12:04:29 +0200 (EET) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 31D3268B13C for ; Sun, 6 Feb 2022 12:04:23 +0200 (EET) Received: by mail-pg1-f169.google.com with SMTP id p125so9024983pga.2 for ; Sun, 06 Feb 2022 02:04:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=a5bEglL7uyn0JOo7WzgedOfbybT1dYXpOZ9leST7ilY=; b=eHnr5PpCrD5cAy0BCLlcpIZ2Tnh3NH+grGrrlvpshSG6nbhXBhg2V5nzFqO16IHYMq l/H0+MyB0nC8clumgi6Xf/DwoHqrFdErnDDqbO1eNhxlh8tUJwNheTaYZai+YJ6qREFk n0kSnFPdWRCdzzSQm4+bhF0/I7MhX/FwGYfOF+oQiTQxAi/AZwmvSA0uyloudxQgb829 AMIQ8GxuLnaTj1IdAUOZmWqHy3RBS9g8eD/ssirsm3bLX5dHUdQJxCoZIhivAboowgW6 ZZBa7WDorytHi96ckq5v67++JhmzyPGwNRhr2YTg512NfqIHU47/NuKrbmQrfCu1mfJD xUjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=a5bEglL7uyn0JOo7WzgedOfbybT1dYXpOZ9leST7ilY=; b=BR4lNjpxI1CEptZG/Tp4QMM3YISUpjYB5cn/hzWYXHS5F0vZzmgy9+rzg5nMTAoH61 3QjjIUyPEvunymiHkDUKQ5+9FUTZQg/x5q3Ql+xD680fzTCuWa48D2COhYk0p8jcuBvV WAeD93rXlgeuKSuWNHgnQCxzUzKOK3ksu1bLFYEjQJ0lDDnLUfGP98kkwbnnxp7XWhBM n6wXZRoewV+4KFVaGOoSKReIz3NU0rQsxhcPnw3AVbf9zb40prf28TjToi1D+hLhLako K65B3U6F17HC22Za5ceNHndrTBMsh+dN/+PneFAL4ZD4rWJRA6CnqniojavOJE4aenrB fPIQ== X-Gm-Message-State: AOAM531NidF8xz4Of1f6B/8ux3OxcWDwxciUI7vcMoqVyjEb5/er46n/ Cif8PTcBAOepP/7z7nLj6tioxU33EAE= X-Google-Smtp-Source: ABdhPJzhDdU5JajBPhJlS1v01RQqG7yl9qW9krEENlLMMZ23irUv3dgXSZks2hwfZb/l/e3dTcGDwA== X-Received: by 2002:aa7:87c4:: with SMTP id i4mr11128394pfo.38.1644141861112; Sun, 06 Feb 2022 02:04:21 -0800 (PST) Received: from archlinux.. ([161.81.112.246]) by smtp.gmail.com with ESMTPSA id kb18sm20855273pjb.30.2022.02.06.02.04.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 02:04:20 -0800 (PST) From: Tom Yan To: ffmpeg-devel@ffmpeg.org, jamrial@gmail.com, andreas.rheinhardt@outlook.com Date: Sun, 6 Feb 2022 18:04:08 +0800 Message-Id: <20220206100408.40824-1-tom.ty89@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3] mpegvideo_parser: check picture_structure for field order X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: aman@tmm1.net, Tom Yan Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: the top_field_first bit is only used to indicate the field order when the picture is a frame picture (which consists of two fields) but not when it is a field picture (which consists of one single top or bottom field). Signed-off-by: Tom Yan --- libavcodec/mpegvideo_parser.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index c5dc867d24..26f3aac9da 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -181,6 +181,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, break; case 0x8: /* picture coding extension */ if (bytes_left >= 5) { + s->picture_structure = buf[2] & 0x3; top_field_first = buf[3] & (1 << 7); repeat_first_field = buf[3] & (1 << 1); progressive_frame = buf[4] & (1 << 7); @@ -198,13 +199,15 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, } } - if (!pc->progressive_sequence && !progressive_frame) { - if (top_field_first) - s->field_order = AV_FIELD_TT; - else - s->field_order = AV_FIELD_BB; - } else + /* picture_structure > progressive bits > top_field_first */ + if (s->picture_structure == AV_PICTURE_STRUCTURE_TOP_FIELD) + s->field_order = AV_FIELD_TT; + else if (s->picture_structure == AV_PICTURE_STRUCTURE_BOTTOM_FIELD) + s->field_order = AV_FIELD_BB; + else if (pc->progressive_sequence || progressive_frame) s->field_order = AV_FIELD_PROGRESSIVE; + else + s->field_order = top_field_first ? AV_FIELD_TT : AV_FIELD_BB; } break; } -- 2.35.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".