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 ACBD140C7A for ; Sun, 6 Feb 2022 08:59:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BCD4A68A8A5; Sun, 6 Feb 2022 10:59:43 +0200 (EET) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E056868AE41 for ; Sun, 6 Feb 2022 10:59:36 +0200 (EET) Received: by mail-lj1-f169.google.com with SMTP id t14so15221230ljh.8 for ; Sun, 06 Feb 2022 00:59:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=jdyQojUjkZ/QDh8EJ/UEbBdnVQRYDhLFzTZyV58jqyU=; b=DuNbecsGSNstb6P/4Ne6irCHjt+WI7CtMycFKiY7SYlPoEyeF71nZPLlxel92Slpo+ cz/PtlYyom6RZt75Izlo7WhH7rsncptfkeemlLmSiAAYIj4SGNF1OsejrqHFFP2lYwZH i/GN2YB1QK1kDP9Hgu4f625fHKt5l/7fIuj1fC8YzfMTtNyAuvJgfzJucXZMQ7JtcNci dX7k92rpoViImHc9fhjcNlc4VJqKzi7LpvCv3rq1fiRBLchdY6PTJQneuHM1Ib4YZ534 UMfn8s8Q18p73R7Q/sRnkx7b1MGdK05JlkMfG56mPw5kZZ8kTzqp4vUql/ajpr3AnOe4 wPWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=jdyQojUjkZ/QDh8EJ/UEbBdnVQRYDhLFzTZyV58jqyU=; b=VQWkvo25GeJozZX5QqF4I6xeOYb848cNuAyTuFxH+fmBnVodAVAKBznGvA5ove1npo IuqQpHiqYP9mqmQqC4p1FMNdhqthfVUsayC0FXDx7cZabgApM75/V+PVN9VtctzL4Asn 5+OV4u52r6XHm8PoqMrDVBBbXjPfVCPff0jmTPQxuHDayzHUyRDkKXvQE2mq/QD/QzLA ybN9oS47/iLqXsI8065Qi9niunftbtInrRBbuVrOPlm1C1n5SubP0aGf/SpYfTHIiaXJ jm2HHIyUTveqXnzKW2T4iGIe8iVghKN4D4csJyLBFBC5P+xk2x3t4PQrW+LPFI2fmqIn SplA== X-Gm-Message-State: AOAM53345+gHMZvcyiH1vobVfoglh0QD7rF4MX2QweBzX9MprKMhDAgD IFJMszRQGArkA4+NXE6DQnLkXQUlhq6cRFKFD5QKff1O X-Google-Smtp-Source: ABdhPJza+96+1E93jTEPwu3JTBoVqiO6o+kO5BINDXtBGPgz98paNj4nTU59Z2QmC8guag3tLZjoLnd46rxYYJ7Dt0k= X-Received: by 2002:a2e:2284:: with SMTP id i126mr5176785lji.309.1644137975940; Sun, 06 Feb 2022 00:59:35 -0800 (PST) MIME-Version: 1.0 References: <167e94b0-79a3-1d31-27a2-e218c2b61e3a@gmail.com> <20220206054127.36820-1-tom.ty89@gmail.com> In-Reply-To: From: Tom Yan Date: Sun, 6 Feb 2022 16:59:24 +0800 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [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 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: This is really just a matter of choice. If you don't care about spec-conformance in this particular case, top_field_first *could* be 1 and/or picture_structure *could* be not 3 even when progressive_sequence is 1, so which one do you choose to believe? The truth is, it doesn't even matter. If you insist on making it more clumsy and silly, I can resend. On Sun, 6 Feb 2022 at 13:46, Andreas Rheinhardt wrote: > > Tom Yan: > > 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). > > > > Just because something is mandated does not mean that it is so; > spec-incompliant files exist. > > > 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; > > } > > _______________________________________________ > 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". _______________________________________________ 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".