From patchwork Fri Jun 7 13:01:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 49659 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp1011066vqo; Fri, 7 Jun 2024 06:07:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXeHpsX1bElnEO9HlzKbJKTEEWsVdw03EKsqRf6d9fu/uBNYzdBFyo18zdneNeEUBmq/mWH/JQnelUWIRpHrYqOUZN9/S1mtoiWxw== X-Google-Smtp-Source: AGHT+IF3MUkITh0OWCoZvehRlLzsPrfWCP7cJKX2n6dUG4FqXSOsjGvjP1FZ0m6vXT4AJXx/oHbM X-Received: by 2002:a50:9fc6:0:b0:57a:7490:a872 with SMTP id 4fb4d7f45d1cf-57c508b7a59mr1744616a12.10.1717765665131; Fri, 07 Jun 2024 06:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717765665; cv=none; d=google.com; s=arc-20160816; b=Tw2TJytg703NNkLVt1KeTiF70aMmPPaJ7N7cFSfZmaK6LcNQI5IrSIommKlkWVxu2K rpYMsTMb631lNpo7Bgiud8wFXg6ko3Xmn3OEmgnXbjjH2v9R6iqUqLxoTYmAQXTrztmV Vt2fxwEmVTCq/RP61ZZjf6s8EY7S1aCKLbEk0bF2fhZs29U5E5H8wlN3m9Z2HWHp3wtW n3WJ+tOLJsAkO4YXL31s1+bgRLiExSlChPwk3psXH87OvptlFy8DdpcYR/Z3BEMfzsD8 W+62zq2H2u4D3a8JI/X0CfprDbFAXaEVqa35SKz9nFWmbpQfnIn+mCqk3Xu/4fsydgMZ GrAw== 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=zVKtw5YWvLEBHtW43cgnXHRiqfujsrOSKnPETOVP2Hk=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=JyxjROws+3OMMl+0YFbpBFY6eECU9X2CUUYZTDU+ISvI+Kf/CUGzO4+lLftwLGDMZ0 5Ot7KdIHeJ3r5vmcVHA3pGDTUW82W7QQtzemitlUX77ClUeRFiZF/88pnSgGiDYWgp4w 648hcCS0nt4R5sRcNbepsnjeFR4Dt3YwFFwoIHR3f+TAzT4x7ggZcIH2PJd+cXbYsrt9 RlyN54yLL3IwYOUcvimmEMNT+LZlliZH33iIJM1eBrfHonJiGQsvrRE5En+bz0JWH5gl xwo+a64YPP7fYcgBycqyiTkW7dGAPd/pmzz/rO0P5AuDOQVBA/h2Da18FWUodnwllUlK sFMA==; 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=m7Q7rOMf; 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 a640c23a62f3a-a6c8070813asi177169566b.566.2024.06.07.06.07.44; Fri, 07 Jun 2024 06:07:45 -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=m7Q7rOMf; 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 39B9D68D82A; Fri, 7 Jun 2024 16:04:18 +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 B041368D77E for ; Fri, 7 Jun 2024 16:03:50 +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=m7Q7rOMf; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id D1B454D42 for ; Fri, 7 Jun 2024 15:03:49 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id eHLgfjtf33iF for ; Fri, 7 Jun 2024 15:03:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1717765422; bh=YhNaxof0j6H8GxcKEdkRbwMJwlKOfHRnF9Bw0aRRxgQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=m7Q7rOMfZ+zo4qK/7sl8a3lODBgtmyB+DM4IwELtUsjIq/7Uhp0BiCfkUMq90J82z oVE4GmqwiK9AiFiJpMBrhNcJPyf7cYpNKLhSBQP+xMp8V5Rk1AU0uC3ZnoekHTqb7j plNARSbpQb2QQfyn1Fs++F/a/3IBC4DDIDD1Z6hg01LOMHk4BfQnCPFGuwIJemMPLm DhwAD9t/gvvTf3fOnEMP2e0vqlshN2mDjR6Kq8E+IK2k8SMqSMNHfdq8HAkfsBNa60 jAEZfgHtym60L0mqAcKmDW8Ux2FE2wd62BXWZUUmp59hSK3RDhu6sOAfxrKwaulmPx ZPeTxMezRMEJw== 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 559494DFE for ; Fri, 7 Jun 2024 15:03:42 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 5A5863A174D for ; Fri, 07 Jun 2024 15:03:35 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Jun 2024 15:01:18 +0200 Message-ID: <20240607130135.9088-22-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240607130135.9088-1-anton@khirnov.net> References: <20240607130135.9088-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 22/39] lavc/hevc/cabac: do not infer WPP use based on HEVCContext.threads_number 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: p6Db2o/u0dj1 Pass this information explicitly instead. --- libavcodec/hevc/cabac.c | 7 ++++--- libavcodec/hevc/hevcdec.c | 4 ++-- libavcodec/hevc/hevcdec.h | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/hevc/cabac.c b/libavcodec/hevc/cabac.c index 8708efc248..39ca7c0135 100644 --- a/libavcodec/hevc/cabac.c +++ b/libavcodec/hevc/cabac.c @@ -452,7 +452,8 @@ static void cabac_init_state(HEVCLocalContext *lc, const HEVCContext *s) } int ff_hevc_cabac_init(HEVCLocalContext *lc, const HEVCPPS *pps, - int ctb_addr_ts, const uint8_t *data, size_t size) + int ctb_addr_ts, const uint8_t *data, size_t size, + int is_wpp) { const HEVCContext *const s = lc->parent; const HEVCSPS *const sps = pps->sps; @@ -479,7 +480,7 @@ int ff_hevc_cabac_init(HEVCLocalContext *lc, const HEVCPPS *pps, if (pps->tiles_enabled_flag && pps->tile_id[ctb_addr_ts] != pps->tile_id[ctb_addr_ts - 1]) { int ret; - if (s->threads_number == 1) + if (!is_wpp) ret = cabac_reinit(lc); else { ret = ff_init_cabac_decoder(&lc->cc, data, size); @@ -492,7 +493,7 @@ int ff_hevc_cabac_init(HEVCLocalContext *lc, const HEVCPPS *pps, if (ctb_addr_ts % sps->ctb_width == 0) { int ret; get_cabac_terminate(&lc->cc); - if (s->threads_number == 1) + if (!is_wpp) ret = cabac_reinit(lc); else { ret = ff_init_cabac_decoder(&lc->cc, data, size); diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index a57fa4e539..e3773a6147 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -2599,7 +2599,7 @@ static int hls_decode_entry(HEVCContext *s, GetBitContext *gb) y_ctb = (ctb_addr_rs / ((sps->width + ctb_size - 1) >> sps->log2_ctb_size)) << sps->log2_ctb_size; hls_decode_neighbour(lc, pps, sps, x_ctb, y_ctb, ctb_addr_ts); - ret = ff_hevc_cabac_init(lc, pps, ctb_addr_ts, slice_data, slice_size); + ret = ff_hevc_cabac_init(lc, pps, ctb_addr_ts, slice_data, slice_size, 0); if (ret < 0) { s->tab_slice_address[ctb_addr_rs] = -1; return ret; @@ -2669,7 +2669,7 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *hevc_lclist, return 0; } - ret = ff_hevc_cabac_init(lc, pps, ctb_addr_ts, data, data_size); + ret = ff_hevc_cabac_init(lc, pps, ctb_addr_ts, data, data_size, 1); if (ret < 0) goto error; hls_sao_param(lc, pps, sps, diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h index 04eacca76d..22367602aa 100644 --- a/libavcodec/hevc/hevcdec.h +++ b/libavcodec/hevc/hevcdec.h @@ -579,7 +579,8 @@ int ff_hevc_slice_rpl(HEVCContext *s); void ff_hevc_save_states(HEVCLocalContext *lc, const HEVCPPS *pps, int ctb_addr_ts); int ff_hevc_cabac_init(HEVCLocalContext *lc, const HEVCPPS *pps, - int ctb_addr_ts, const uint8_t *data, size_t size); + int ctb_addr_ts, const uint8_t *data, size_t size, + int is_wpp); int ff_hevc_sao_merge_flag_decode(HEVCLocalContext *lc); int ff_hevc_sao_type_idx_decode(HEVCLocalContext *lc); int ff_hevc_sao_band_position_decode(HEVCLocalContext *lc);