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 405F540C29 for ; Sat, 5 Feb 2022 13:12:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9391568B37E; Sat, 5 Feb 2022 15:12:41 +0200 (EET) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 20D3468B37C for ; Sat, 5 Feb 2022 15:12:35 +0200 (EET) Received: by mail-lj1-f180.google.com with SMTP id u7so10984110lji.2 for ; Sat, 05 Feb 2022 05:12:35 -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 :cc; bh=d/PZHJKly18HX844M0F9XePLKp9seer7Lyyti4rYHe0=; b=IkAI/q7ZKJSByZZ2p4Unaz63NSCRLaBFjDPcny/VLKFEP2yJ63wr9017jEmH0tY9qI sZivxAiIdxuOvuhOEyqS33VNiDtxIA3P8xElKF2jpr3fRJzaQOvzcMrrVesCooJQUCWf kcm2CgIvPrK9iEBlv2hNXjT6OFpRXuaeVHDhkug2EfJzLCOmkP9xMVvkmp3GwTr8N7b1 WQ3d76miaqiY8891smMl6PVfLjkBOLaHgePL/8Q8GLp85M8V6mPb+M+zt5v+9EENriXj w7MIe6M0fG3b0e+gW/Byp1UBVmS+ts/rqhjovszXhgdMm3P1sxWjH1+/1914TBJVSUcT 7w1w== 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:cc; bh=d/PZHJKly18HX844M0F9XePLKp9seer7Lyyti4rYHe0=; b=q6ZwtQXKr9++nBYy9Kwi0ox0Z7HvPhZWj0qE1UxYsVYzLvbmfkN/e4WBX34L1QSga9 W3xBCytZInCrXC2scwZ6sVIw6fAvtA6nbM3DCAbcvkOt+ZFzbtdrK1X1b1XBPXZUQue5 +0rsG20r9kweGOZmIeMBx34FXeVbKeL7qi/02nA+CqybqTQbR8v8R+2LDxVjVca/UcvT 2UdKQCazLGl6gF/8Trd34iMJA5knbn8l/v82bp16POaFDPEcXIT3e2h/36v8Xh1hW1B0 1Apn+0ggkBn+boNiNLu5rrmXIC8qKGBW7DmRNkdC+wH/RPqoBVOsn1HOzJbYShzjrfS7 idiw== X-Gm-Message-State: AOAM5318fx2OAFkY+JPzeLnshx/jNy83h/i19uZ/J1EdA8y6ok/TH0Wk gpHFX42x53o6WxMzHEHs/fTrMEVH11+q4ZEC25SNdm6fpYM= X-Google-Smtp-Source: ABdhPJxEPKmxGTPP1CkOaKZ+xpTlxYWTxWxQ02kJ4nZViVbNzFNljN2IEsgeyh0X07Q4lSTgsunVdE1o+lD6Ha6KBZw= X-Received: by 2002:a2e:a307:: with SMTP id l7mr2535833lje.363.1644066754170; Sat, 05 Feb 2022 05:12:34 -0800 (PST) MIME-Version: 1.0 References: <20220205125127.20744-1-tom.ty89@gmail.com> In-Reply-To: <20220205125127.20744-1-tom.ty89@gmail.com> From: Tom Yan Date: Sat, 5 Feb 2022 21:12:22 +0800 Message-ID: To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH] 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 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: It can probably be simplified to this: ... if (progressive_frame) s->field_order = AV_FIELD_PROGRESSIVE; /* top_field_first is mandated to be 0 when picture_structure is not 3 (i.e. not a frame picture) */ else if (top_field_first || picture_structure == 1) s->field_order = AV_FIELD_TT; else s->field_order = AV_FIELD_BB; ... since progressive_sequence == 1 is illegal anyway if not all the pictures/frames in the sequence are marked with progressive_frame == 1. If we consider commit 88e2dc7 proper, i.e. we should set s->field_order to AV_FIELD_PROGRESSIVE when (processive_sequence == 0 and progressive_frame == 1), there's not really a point to check processive_sequence at all. On Sat, 5 Feb 2022 at 20:51, Tom Yan wrote: > > 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 | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c > index c5dc867d24..2ddcdb0f37 100644 > --- a/libavcodec/mpegvideo_parser.c > +++ b/libavcodec/mpegvideo_parser.c > @@ -108,7 +108,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, > uint32_t start_code; > int frame_rate_index, ext_type, bytes_left; > int frame_rate_ext_n, frame_rate_ext_d; > - int top_field_first, repeat_first_field, progressive_frame; > + int picture_structure, top_field_first, repeat_first_field, progressive_frame; > int horiz_size_ext, vert_size_ext, bit_rate_ext; > int did_set_size=0; > int set_dim_ret = 0; > @@ -181,6 +181,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, > break; > case 0x8: /* picture coding extension */ > if (bytes_left >= 5) { > + 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); > @@ -199,7 +200,9 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, > } > > if (!pc->progressive_sequence && !progressive_frame) { > - if (top_field_first) > + /* top_field_first is mandated to be 0 when > + picture_structure is not 3 (i.e. not a frame picture) */ > + if (top_field_first || picture_structure == 1) > s->field_order = AV_FIELD_TT; > else > s->field_order = AV_FIELD_BB; > -- > 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".