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 EF14440C36 for ; Sat, 5 Feb 2022 13:31:35 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 77E3668B394; Sat, 5 Feb 2022 15:31:33 +0200 (EET) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 95B4D68B31D for ; Sat, 5 Feb 2022 15:31:27 +0200 (EET) Received: by mail-ot1-f52.google.com with SMTP id g15-20020a9d6b0f000000b005a062b0dc12so7352351otp.4 for ; Sat, 05 Feb 2022 05:31:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=hs0vfv13tmTMUYadNNLYifyPGk9EYzBOxvXIsWoQzGo=; b=leDL3L2nUGnoB/p/BcQdPHwkeEHYLyaxkxs7nHwtnnoRlVmO58NgALlijjc8G5C0MN zi4VoWwthyWtSV1MSXbWyGx1TrrX1CGhpTksmuQ3/OzxwMpV4FbnkqAkQRdNHB6zVscN eyhqeetOrDuaPYqtv/5295F5lmUW/gkKnak4nXIXlHlsCPITX4DdWQyQgXDnEpA9Rna+ e6UZDr1v8t0nDuDOHq+Ba+vtaMz4n2mxFpRd39/kgEYv3BhOC5WgJZpcDwu8RypV+frY fuXazr02LHBXW1WGd8gWOs1tdzqygTA8IlOYQOpt7oRLTDQBPSIHankOn4Q33qhcKfjO J9CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=hs0vfv13tmTMUYadNNLYifyPGk9EYzBOxvXIsWoQzGo=; b=qd9TLfpzJka9EkQZKzzB6p0KEnMu4CrBdzcD3aX2maeNMDmYFOA5PavYcMlz61ATmN QqbaDzTuiJV/cw7dg9YVuhj/N9Dqj5hqE+PdpBHctLGFUo8bSclRMbgqRIPbLt4axlit WlDak8DZTj9U0xcM7kdi5VqiMYXKlvLhGpP6izkErI9Bj0Q8aCX67GC5HL0yxGlALSbN 0toUQdwyQLmLTkCmJtc5gD0zEdf/cLuMrTrhUbe+k0JvrtHglocktEsVyTJbO2c0qmqa 12snGc5Qm2g4gzE5d2GOTrn9Nuu/Lc6rw0yWRW49U26CAhyXjvuL91QNLF084WqIyK5+ /G4A== X-Gm-Message-State: AOAM5329wECWrePVNcDn3/pgl6LX8huyyNWtrlTZUJ1HJJbOWisFLOd6 wn8LhDuN5BNySU7ebDOc3XblKpQr0FQ= X-Google-Smtp-Source: ABdhPJwlVT+Um8g3mUocZ5hdawpywhN8pH0+sREXNPqxxTVsGjziXABhe6MU57nY5YLwaPCes/WlmA== X-Received: by 2002:a05:6830:25d2:: with SMTP id d18mr1209204otu.384.1644067885553; Sat, 05 Feb 2022 05:31:25 -0800 (PST) Received: from [192.168.1.55] ([191.83.210.20]) by smtp.gmail.com with ESMTPSA id g10sm1818941otn.65.2022.02.05.05.31.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 05 Feb 2022 05:31:24 -0800 (PST) Message-ID: <167e94b0-79a3-1d31-27a2-e218c2b61e3a@gmail.com> Date: Sat, 5 Feb 2022 10:31:22 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220205125127.20744-1-tom.ty89@gmail.com> From: James Almer In-Reply-To: <20220205125127.20744-1-tom.ty89@gmail.com> 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2/5/2022 9:51 AM, 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; You could maybe also set s->picture_structure with this. > 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; _______________________________________________ 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".