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 E4B0B40C73 for ; Sun, 6 Feb 2022 05:41:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C276968B064; Sun, 6 Feb 2022 07:41:50 +0200 (EET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5132D68AE64 for ; Sun, 6 Feb 2022 07:41:45 +0200 (EET) Received: by mail-pl1-f180.google.com with SMTP id t9so6493905plg.13 for ; Sat, 05 Feb 2022 21:41:45 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=pvvfpZ/g11SvpfS+wFqJssoG6kZvkjn7V9Mz7FxlKdY=; b=iirk+JOm+4CopcmKRgDqJtWjNXrElES2YfjMn86TqmCOsp1oxtQH45HilPUIc5Ymh/ kEJchbXjQdHGSlAuWZHZxigOOADFPgNbXhrwes0CRNoYtjmREs4xOjzOnk1AgA9CVkor TG9DqXmuNSNfwTyUV2FjzgMDn9cCZeopp+Jp0QXXhpVZZMVRplTwWT9Ulgw8PNkGNcey E4+HWh8Fl8o447mR7UJUsuX4XehPwqLkFMvHahxV9yCi480wRrcsSM2DQ0bNLBTbd/ut YEHTogSu2fDvu7vEWqmjf5/kNymaNfQ+aJWAraN414bF16leBf/xyPDwFkWWcapRFjGR 2GyQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=pvvfpZ/g11SvpfS+wFqJssoG6kZvkjn7V9Mz7FxlKdY=; b=Hjr0RubSgBGa0+BP4SGsmzz9fvu+LiZxBGsJhf8vtcit1pPhEXOKJbTjR1W/i89dc7 e/igglri/Kn+64k0xcD+yEDW0VQXWU0o1QY7f7jnhu5ABI8knQ7E7gEdBFK9ArqSqM6Y BWSk5YhYnZ1eAdEZ0hPDiX7jjgGH3ZJ6a3qc+LXvOBG8RG7Ki+MlvD7svZMBu0sPowc0 r4atMIh8Cfyls/l5vAKAG56jtv9vpW+MN3xltJGl/Pq78LQwOdkHgSvbYQnFSHlV41un w/6PimJi5UVu3e/FRK6ysymDrbsmTs87yTd+t/LccEkd5NK0Ato019fMgHOPNelAz2yX iKYg== X-Gm-Message-State: AOAM530YFJITSkdL7yt8kusK6PBaK+8Fge9wrCWa+rc4whl12mNSldDP g+0YhuMCcDgP47WpqA1D8xzmtCgVAAo= X-Google-Smtp-Source: ABdhPJwdu3zAYySDNiRGIcSpUmdEGJzGTKGQy61cWH9UJ4jsrOPnJGHvV3JXoXa+T1d9u3d5NUMuuA== X-Received: by 2002:a17:90b:3512:: with SMTP id ls18mr11711345pjb.224.1644126102987; Sat, 05 Feb 2022 21:41:42 -0800 (PST) Received: from archlinux.. ([161.81.112.246]) by smtp.gmail.com with ESMTPSA id a186sm5191551pgc.70.2022.02.05.21.41.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Feb 2022 21:41:42 -0800 (PST) From: Tom Yan To: ffmpeg-devel@ffmpeg.org, jamrial@gmail.com Date: Sun, 6 Feb 2022 13:41:27 +0800 Message-Id: <20220206054127.36820-1-tom.ty89@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <167e94b0-79a3-1d31-27a2-e218c2b61e3a@gmail.com> References: <167e94b0-79a3-1d31-27a2-e218c2b61e3a@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] 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). also removing the unnecessary progressive_sequence check (the bit is mandated to be 0 if progressive_frame is 0 on any picture in the sequence). 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..004ff602f6 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 + if (progressive_frame) s->field_order = AV_FIELD_PROGRESSIVE; + else if (top_field_first || + /* top_field_first is mandated to be 0 when + the picture is not a frame picture) */ + s->picture_structure == AV_PICTURE_STRUCTURE_TOP_FIELD) + s->field_order = AV_FIELD_TT; + else + s->field_order = 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".