From patchwork Wed Feb 16 08:51:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 34335 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:90eb:0:0:0:0 with SMTP id a11csp1036925nkf; Wed, 16 Feb 2022 00:53:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJ2AeKakv8KSsJXqobM1IcBhwTpRf8Vg0oO6LvU5pc5Gc1/lVXOmBD9qZZYLZ7eaU5V4rT X-Received: by 2002:a05:6402:42ca:b0:408:ed7:b011 with SMTP id i10-20020a05640242ca00b004080ed7b011mr1816260edc.6.1645001608650; Wed, 16 Feb 2022 00:53:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645001608; cv=none; d=google.com; s=arc-20160816; b=Gim1pGJadS8z8DlxsYWcst+4psDIquUG4WU93zL12v36HXMvgATzjRTLy1QbLGfpmp iCA0rvXxDSP95a5LqOybMkZ453FZTTKj3KV4iih6TJc8yf2MaNWIXoRdGuyAPzgEQMGd qfeg8sPIw2YTGgs8CHGAQxayE0Qrex8eB+Lfu0W+TFP2P//Al0x1fXFu1me7lpaao1fT Mg/hIIXcmF9mtWxHqdKCNwnPnaDtQMduxP+SM6S4JApOR43U81CyNOLjbWF0xuxptn/o 5ifNm/RRv7eV3sJd/rVTxAxBqdXIkWMitaXVvkxyDLoNSjdZiREAHlT6evJWoec15K9R 7LGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:mime-version:message-id:date :to:from:delivered-to; bh=l9k3QMS2BB9b09J+Ila+ehTOl4S+WBuRgP7DSTujvbo=; b=Oq4EboVWPKF7P+0BY5M+wJcH1HnNO7DxNyTDV9UbFs5ZTAbPy9lw7Pgb5CIQIEWk20 9Z83wjhwAKLhsS6ZjX6l8mhBDfRjAKgGO+zLpIp4kodcMlIy+ir4g3rEU32Gbw6iZm5a ze1K+6F0S5uSEo8nvW7T2d2FU7H1xg6N9NxUWTByTyjXv6Ra39iZ6+17fF0uVn5TB66K LJcF7XGjedbAr7v08kC4UHSWr7ofbdLsV+vBU6jZbdp3DtPjYhzdCfbflNxKCzRC4ev4 rfK3mjTTKKeDPovvK2yCjXwcGpFm1XfHV12RMJKGayyFlpe2kov5qSD0gUes120RyxsS KOgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hj1si30261980ejc.843.2022.02.16.00.53.28; Wed, 16 Feb 2022 00:53:28 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D77C568B2DC; Wed, 16 Feb 2022 10:53:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg587.qq.com (smtpbg126.qq.com [106.55.201.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 79DC468B2DC for ; Wed, 16 Feb 2022 10:53:09 +0200 (EET) X-QQ-mid: bizesmtp63t1645001508t3wra405 Received: from localhost (unknown [103.107.216.231]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 16 Feb 2022 16:51:48 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0000000 X-QQ-FEAT: q6FcPYdgG0gzbH9/mmqP9COBk1EmYp8yDM+Zy1JEz4e8ujW0uV0ZBSr+UPGU4 rS9MgUnUUliCZhrr5+qD23qKqRNAAMo97JMEqspw1Enjt6c2zrpCLTjLoCjNb9gbDFV7nfv W2XF3qtZCMnBWFdT/1fXvZ0pmusubYO/AbmYaOheg/sv8RZrVmZq69r9g3JsyW7JjApeUUI 09VNbCXmwPJFUF3TxOaDvCXLqybnfnL9rE8ExWuTUg4v0iR7ch99zzHtNQJfHC0/AtY/WEf sAhS60MDBDeLhpR3b5gQV/zuTDrGrtcF7OHXxg7ZF2TrTQZVtr0xZBWJA= X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Feb 2022 16:51:45 +0800 Message-Id: <20220216085146.26078-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgspam:qybgspam2 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/h264_slice: compute prev_frame_num_offset to correct value 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: Shitao Wang , Steven Liu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: NRAhRJRKfbRT From: Shitao Wang If H.264 stream decode under loss packet transport network, h264_slice will process prev_frame_num_offset in wrong way, it will dup picture, This is different to JM, so compute the prev_frame_num_offset when prev_frame_num >= (1 << sps->log2_max_frame_num), then it will same as JM. Signed-off-by: Shitao Wang Signed-off-by: Steven Liu --- libavcodec/h264_slice.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 110a41772a..6f21c48b2d 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1667,6 +1667,8 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, } h->poc.prev_frame_num++; + if (h->poc.prev_frame_num >= (1 << sps->log2_max_frame_num)) + h->poc.prev_frame_num_offset += 1 << sps->log2_max_frame_num; h->poc.prev_frame_num %= 1 << sps->log2_max_frame_num; h->cur_pic_ptr->frame_num = h->poc.prev_frame_num; h->cur_pic_ptr->invalid_gap = !sps->gaps_in_frame_num_allowed_flag;