From patchwork Tue Nov 14 17:20:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 44659 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:92a5:b0:181:818d:5e7f with SMTP id q37csp2134311pzg; Tue, 14 Nov 2023 09:21:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4Zr0/nIGra/Uq6onqMNpbG2yHlHLD4l8oZy1HcwEd/1+l6rB06rFfYwUyuLvWgIVsQiOB X-Received: by 2002:a05:6512:3142:b0:505:7371:ec83 with SMTP id s2-20020a056512314200b005057371ec83mr6677861lfi.48.1699982472944; Tue, 14 Nov 2023 09:21:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699982472; cv=none; d=google.com; s=arc-20160816; b=bPyKLfGw+U9OmZUSGuU/PS+cOjMWGmUyO6Ql1Z4BokG7oZngTzCJPPeBd4buax/qpN mWTtMZO/ONMPSsdyXJgw1Jz+kS6aWPArdwCLUjv/Yl7+70yIECcRPl25Tm/elp3tDrAQ BxrUiuLgmzuupdogLu96G9VlkIAJzCH47KR6s6lvrov/Tw/PMuSCnK4mree95k94ytUQ exa++pUY7Evk3Ili6GCuw6+8JHU7fIh5r3UVelCxCXClV8mkhOgjyCXa/K+e5TrPpo9O AchCOghMsRu+z92Ne8N5VqJbh99hNrfJr0AY6cJK1QbS7Ano9CSlq7CvtECYPTLG/mzb 4p8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=zE200U35arZzRKPtGvaqNBCzTro+gVB5AiRamb8KWAg=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=hFmXBZRdopjcyRAhdffq86sQ/MwNgDN9XJOM/IXaCj1g/fM1SXz34Fr5KEnwTlnrbt FrHjFOy1sN7Ec6rYapgq4dDtudiVUVrdmQw5eZsOxQEPlLDtNnTukM6Y8ClLFOzI4MVh pcCGRPMnwBTHuWVvDzPvyqzAV6hNtR9mOx2tliOUVQCk4eMPuymqrOqC3yLSt5eQrdqj wtkMe99NdOoKMT7vuAKw+DkTMUdY5XL5aoYLJDGu5c9p5SDJgUG3LdHmoYuA3HmY1asR Bt0bBsFP5/c7zPn1jTZ4gtnQJngAfNA7xQZr0O15LOIrrA5+/zZ7QDR+PCDvoRJHS462 46Lw== 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 u26-20020a50951a000000b00543312678dcsi3997843eda.625.2023.11.14.09.21.12; Tue, 14 Nov 2023 09:21:12 -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 552E368CD30; Tue, 14 Nov 2023 19:21:01 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EA76368CBCB for ; Tue, 14 Nov 2023 19:20:53 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 310571BF203 for ; Tue, 14 Nov 2023 17:20:52 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 14 Nov 2023 18:20:47 +0100 Message-Id: <20231114172051.13872-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231114172051.13872-1-michael@niedermayer.cc> References: <20231114172051.13872-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/6] avcodec/h264: Use FRAME_RECOVERED_HEURISTIC instead of IDR/SEI 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: EojsiZWkxgpD This keeps IDR/SEI and heuristically detected recovery points cleaner seperated Signed-off-by: Michael Niedermayer --- libavcodec/h264_refs.c | 4 ++-- libavcodec/h264dec.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 25e521dafc0..92778e737a5 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -822,9 +822,9 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) || pps_ref_count[0] <= 1 + (h->picture_structure != PICT_FRAME) && pps_ref_count[1] <= 1) && pps_ref_count[0]<=2 + (h->picture_structure != PICT_FRAME) + (2*!h->has_recovery_point) && h->cur_pic_ptr->f->pict_type == AV_PICTURE_TYPE_I){ - h->cur_pic_ptr->recovered |= FRAME_RECOVERED_IDR; + h->cur_pic_ptr->recovered |= FRAME_RECOVERED_HEURISTIC; if(!h->avctx->has_b_frames) - h->frame_recovered |= FRAME_RECOVERED_SEI; + h->frame_recovered |= FRAME_RECOVERED_HEURISTIC; } out: diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index 5ce3a6be735..b0c54ad82fb 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -519,6 +519,10 @@ typedef struct H264Context { * so all the following frames in presentation order are correct. */ #define FRAME_RECOVERED_SEI (1 << 1) +/** + * Recovery point detected by heuristic + */ +#define FRAME_RECOVERED_HEURISTIC (1 << 2) int frame_recovered; ///< Initial frame has been completely recovered