From patchwork Wed Jun 26 12:43:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 50160 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:ccd2:0:b0:482:c625:d099 with SMTP id q18csp405888vqv; Wed, 26 Jun 2024 05:44:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWFswRifnQmlPIG5WdAduhjIqZ5Zrz3FNXxHUwY8kIWXHV4VoBlTuupkcyFhBMQv4NUYEm7QAftahPeOoZtPPV15N4Ye8GTR0fbig== X-Google-Smtp-Source: AGHT+IGpgY/bCHeCkresdJKFj2OUgZ/H0fltcfZgeXqn8SC4K6eM/tPkzYZzPSplxNfJ8ispDQGq X-Received: by 2002:a50:9b42:0:b0:57c:672b:ca34 with SMTP id 4fb4d7f45d1cf-57d4bdcabacmr7359239a12.28.1719405848113; Wed, 26 Jun 2024 05:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719405848; cv=none; d=google.com; s=arc-20160816; b=yjoKsikMNcCID/2dfu3htdqWLr0n241tHrdyNAarRmJeHZ75+Y55rhONvU+YSGeoQa o+DZdnSK/JKUnsuuZe5YrIO3WKm7q2Sdyf6tjXnZJdpqd6HOv743eoI8MMPm8aaPx/t1 9oeoyxF7kmvBYGNo6DIkyj+e1ArZ2alWWSGQfTfDovDPuXzQcGv0jWZBOQWlUFHURrUA g/yPMNLGWJUsE0F4RBsNQv/duqzVhdYaKyM6dpP7N2/34G9IOrXBuHaAkk46xjbDnwrw LiLY67INw5JC+LTPpRnxa1rNZ6WWbodjJlWnBCIIavn8JoaKSRVPoBqEb1ENG5h63tgs VRzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=PqB0ZtV7NpF0CMhUH0BL+3g0jr9VGBlf6FICDgFcQRI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=HevFdwzqNmfaPTr0mbhrlFD4hOtMVM0gpwb1DhS2YA124LFw30sUSlurWEPp4jAECc NRNcS/p3VKl8ounDX67I+kf7L52tvuwJEBUsKDmMYCMHdtnA9viWEItyybHFxUfJIeZj R9rSuN+Q7nZUqrZaLXXVlEAIeqxCuxlOHVTXHRtVb7/UiRGQW5zumFDWzwEALuoZcG8+ fBbMEMy5wcD/Oi601G+9ugW9GuY3doj+2hxgtjhWbD0rP8/7TG2fsWKf0hcC96Vzpfx7 tnEvitZ3Flja1T4wVhhMwCWBfcH7zE3Dh6RBVX6LPhwB4+8EtfNr89hgUAuVve3qU8GC 4z1A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b="QEdB/qaO"; 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 4fb4d7f45d1cf-57d30632bdesi5889684a12.79.2024.06.26.05.44.07; Wed, 26 Jun 2024 05:44:08 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b="QEdB/qaO"; 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 774E268D516; Wed, 26 Jun 2024 15:43:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 00EFD68D3E3 for ; Wed, 26 Jun 2024 15:43:44 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=QEdB/qaO; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 3A8EC4DE4 for ; Wed, 26 Jun 2024 14:43:42 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 9YZKw3XluO-n for ; Wed, 26 Jun 2024 14:43:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1719405821; bh=ba5DQlTj2RNsqNkP92cDxEL8C//I+25OZdgn1Ad1TO0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QEdB/qaOJgwlq5OtCBLFmE3fbPqFDP2vMZSFBBHReL7kpMHtna0FxwHoEmxUG7LVe Ux1/fOnYNdYIbeKXgZBqnJS0spyyK0qsjHBpSW/fi+C7lcslZGQC4ZIihFSJuO63DO 92SxTxLEBmR4nPltcOKF/MUNwGMKYPmg5LZBiXrvhCuAJ+p60PSSHsCEGd7s9V3nSD 7y6cn4GtAOPZJSWoSBjIPO8fwbmQrVLGKV0irJdF3Atq6js3yskyS5QkDup5LVASCd 50KdQEnCjZcLjwAgtKoP+OyHdIrL1iOKpy9DX1nDTTvTLbuZKhYg5npPerOiUZWfar ZeJgkxlRg1U0g== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id D44624DDB for ; Wed, 26 Jun 2024 14:43:40 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id C3E353A083A for ; Wed, 26 Jun 2024 14:43:39 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 26 Jun 2024 14:43:35 +0200 Message-ID: <20240626124337.14478-3-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240626124337.14478-1-anton@khirnov.net> References: <20240626124337.14478-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/5] lavc/hevcdec: do not pass a pixel format to set_sps() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: R6gd5+aWp/aw It is merely copied to AVCodecContext.pix_fmt, which serves no useful purpose. set_sps() is called from two places: * when a new SPS becomes active - then the pixel format is overridden immediately after the set_sps() call by the result from ff_get_format(); * when a new SPS is propagated across frame threads - then the AVCodecContext value is already set to the same value by the generic code. --- libavcodec/hevc/hevcdec.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 4a62170073..5136bb53d9 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -526,8 +526,7 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) return ff_get_format(s->avctx, pix_fmts); } -static int set_sps(HEVCContext *s, const HEVCSPS *sps, - enum AVPixelFormat pix_fmt) +static int set_sps(HEVCContext *s, const HEVCSPS *sps) { int ret, i; @@ -544,8 +543,6 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps, export_stream_params(s, sps); - s->avctx->pix_fmt = pix_fmt; - ff_hevc_pred_init(&s->hpc, sps->bit_depth); ff_hevc_dsp_init (&s->hevcdsp, sps->bit_depth); ff_videodsp_init (&s->vdsp, sps->bit_depth); @@ -2918,7 +2915,7 @@ static int hevc_frame_start(HEVCContext *s) ff_hevc_clear_refs(s); - ret = set_sps(s, sps, sps->pix_fmt); + ret = set_sps(s, sps); if (ret < 0) return ret; @@ -3592,7 +3589,7 @@ static int hevc_update_thread_context(AVCodecContext *dst, ff_refstruct_unref(&s->pps); if (s->ps.sps != s0->ps.sps) - if ((ret = set_sps(s, s0->ps.sps, src->pix_fmt)) < 0) + if ((ret = set_sps(s, s0->ps.sps)) < 0) return ret; s->seq_decode = s0->seq_decode;