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; From patchwork Wed Feb 16 08:51:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 34334 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:90eb:0:0:0:0 with SMTP id a11csp1036864nkf; Wed, 16 Feb 2022 00:53:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcBneUuETZ7Q1CiVWaPRbBGo4kes4lr/OhIw8ycw750yCuXgonArq0/PN1UbjctcII/eu7 X-Received: by 2002:a05:6402:c10:b0:40f:33cd:a39 with SMTP id co16-20020a0564020c1000b0040f33cd0a39mr1824645edb.234.1645001599269; Wed, 16 Feb 2022 00:53:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645001599; cv=none; d=google.com; s=arc-20160816; b=pdt9gjrn85pCGG5gboEXZ2lPSf9IV5vJvSS1/TSyX/2YJi3rfiKv6gpivfcqxMEjRH a4piPtbzVyj/IDByiBX2hb+NqkX+ZtJwQNMvXVDA1Xnv2/LmFQgfMnW6jMBluxYZWas3 GBMgtT68URglTAvOfb+B3z+3NDxJZyR0sMe+QNu4TZYQH2ZIZDtmjR4M8ItE8K55qe/V ueY5AThJLPeYdTMazhPX/YmkprSubTCBjc7Em45HRRtBDHfWRgwxhI3QNB28EQu/zOiO gCsZkNoMY9iYkG2J8MKMBB2YUsHgpmJFvDblWI5wO3M4BWFVQgyLMMGfwfdIO2AvjVEg bydw== 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:references :in-reply-to:message-id:date:to:from:delivered-to; bh=LMDMnlYGLyq5pt359QYyHrGg+tARJ9+zHilP2OFAc20=; b=OL/Ftkj8tWl3fClPVVNWIHmSypRCmu2bPoyiiLi/OJezr/AhQpBLenMhlWWTkw7EMX A/XFaIVAfRHgedcf2WuT73rVL2rmtkcb1EN4MXPBvNAsUz3ptDjI0/9MGYPAfUtbF8eC OTOqj7JTzg0Pqc+Zj+nlS/A0vXvhZ+Ovhe8xaBXFKUir+M2LUbWfQ5clZm82naHZBg3L AC0hDdDzMNLcmMXawU89Okb0Q5f0iRfsqoORP9gINbVLMbcGL4HH8zPOBZqZEFBysbv2 2UoKNvfAvik8rN4we+aQOjk+S0MY/K93TJ/aAuye3d/uJ1Rjz3O8EXC9sk4xOn4F5/ph 6fAg== 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 qf42si7912575ejc.628.2022.02.16.00.53.18; Wed, 16 Feb 2022 00:53:19 -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 D8A6968B2F7; Wed, 16 Feb 2022 10:53:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg.qq.com (smtpbg127.qq.com [109.244.180.96]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8DFFD68B0E9 for ; Wed, 16 Feb 2022 10:53:08 +0200 (EET) X-QQ-mid: bizesmtp74t1645001511tguna4il Received: from localhost (unknown [103.107.216.231]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 16 Feb 2022 16:51:50 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0000000 X-QQ-FEAT: 58s9QYSgpDiJmpthqb6HLQ35O6zwK2JaR+ro/HcjFhQFYP14z7ahbDgN34yrp Y52ICxJuV4+xuuufMqB241HOdYEso+H8p46KcOqISFrKaJDH7GN5NeQBgH/7KxZP5yt5O/S 4ITJXy7+cdnR9YzvmQE0zOEuH5aBrp9iJYBAUxgmL9TOJWPfh7ifkj3Wr5RLnbAf7CN/lH7 V2XvLOW02OhkZOJeItl7YqTaA8PlI3LrpGxj/WiboV2o1BcWVMazE7MLxpcdoh0rQDukYN5 QA+Gji6UU3HKx7auXMI/1UvZYOMYraCTI2wcJkKB3LdD8ZmN5RFdtjDSFG5P3UvKSnSpYcp xGDCu8d X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Feb 2022 16:51:46 +0800 Message-Id: <20220216085146.26078-2-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20220216085146.26078-1-lq@chinaffmpeg.org> References: <20220216085146.26078-1-lq@chinaffmpeg.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgspam:qybgspam1 Subject: [FFmpeg-devel] [PATCH 2/2] fate/h264: add test case for h264-loss_packet_for_prev_frame_num_offset 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: Steven Liu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ivmcfBaK96d+ From: Steven Liu Signed-off-by: Steven Liu --- tests/fate/h264.mak | 2 ++ ...h264-loss_packet_for_prev_frame_num_offset | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak index e075b6f67f..142a4ea708 100644 --- a/tests/fate/h264.mak +++ b/tests/fate/h264.mak @@ -195,6 +195,7 @@ FATE_H264 := $(FATE_H264:%=fate-h264-conformance-%) \ fate-h264-lossless \ fate-h264-3386 \ fate-h264-missing-frame \ + fate-h264-loss_packet_for_prev_frame_num_offset \ fate-h264-ref-pic-mod-overflow \ fate-h264-timecode \ fate-h264-encparams @@ -442,6 +443,7 @@ fate-h264-twofields-packet: CMD = framecrc -i $(TARGET_SAM fate-h264-unescaped-extradata: CMD = framecrc -i $(TARGET_SAMPLES)/h264/unescaped_extradata.mp4 -an -frames 10 fate-h264-3386: CMD = framecrc -i $(TARGET_SAMPLES)/h264/bbc2.sample.h264 fate-h264-missing-frame: CMD = framecrc -i $(TARGET_SAMPLES)/h264/nondeterministic_cut.h264 +fate-h264-loss_packet_for_prev_frame_num_offset: CMD = framecrc -i $(TARGET_SAMPLES)/h264/loss_packet_for_prev_frame_num_offset.h264 fate-h264-timecode: CMD = framecrc -i $(TARGET_SAMPLES)/h264/crew_cif_timecode-2.h264 fate-h264-reinit-%: CMD = framecrc -i $(TARGET_SAMPLES)/h264/$(@:fate-h264-%=%).h264 -vf scale,format=yuv444p10le,scale=w=352:h=288 diff --git a/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset b/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset new file mode 100644 index 0000000000..df8a88f5d4 --- /dev/null +++ b/tests/ref/fate/h264-loss_packet_for_prev_frame_num_offset @@ -0,0 +1,23 @@ +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 1280x720 +#sar 0: 0/1 +0, 0, 0, 1, 1382400, 0xa21b9a12 +0, 1, 1, 1, 1382400, 0x9f266c66 +0, 2, 2, 1, 1382400, 0x08604d2c +0, 3, 3, 1, 1382400, 0x0f59c63a +0, 4, 4, 1, 1382400, 0xe9588c5d +0, 5, 5, 1, 1382400, 0x01c3559a +0, 6, 6, 1, 1382400, 0x40791f04 +0, 7, 7, 1, 1382400, 0x2047c562 +0, 8, 8, 1, 1382400, 0x24f7b450 +0, 9, 9, 1, 1382400, 0xfa3d00ed +0, 10, 10, 1, 1382400, 0x8c3384ed +0, 11, 11, 1, 1382400, 0xfa7c59e0 +0, 12, 12, 1, 1382400, 0x0d16c5d1 +0, 13, 13, 1, 1382400, 0x665bd32c +0, 14, 14, 1, 1382400, 0xe8771b9d +0, 15, 15, 1, 1382400, 0xd9824ab1 +0, 16, 16, 1, 1382400, 0xa7264481 +0, 17, 17, 1, 1382400, 0xdcaec99a