From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id A1BD54CE09 for ; Wed, 14 May 2025 13:41:38 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F399E68C5E3; Wed, 14 May 2025 16:40:57 +0300 (EEST) Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 39DBE68C557 for ; Wed, 14 May 2025 16:40:49 +0300 (EEST) Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-7376dd56f8fso8713589b3a.2 for ; Wed, 14 May 2025 06:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747230047; x=1747834847; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g3SlWjKqtGHDmHqFKayHSln9KcF/5Z2ASpqDosIz6o4=; b=Iu8oMEpjgwcznaGJIbJL44l84L3jfEF49+PNB435Oj42iBxjMTrGP9KUBlQrVhxq3O 23gv6XDu7ixLz+womkOGl98GWE+FGPI2E98J2AooSfliWV/AImSPAwyurrzvntTxyykV PreDeoiduu5XdxrZv/ro6dCNQlZNChyr0phKeUNQnvyq0Pf8vjW9n9ZnJyz4zJZNXj6h Le4MdlRoA/hk41XerwrL/p2NjtULc57M5qGmiuW7/MIrUiC2ZvpaTpXRTQbDYgGzo+yc gqiHMvL7CuI4kkTpKFvx4J6tFWmVLMXttvu70KLlJVYE76gBMZL7TVT88CVUX8OXG7nB Alsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747230047; x=1747834847; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g3SlWjKqtGHDmHqFKayHSln9KcF/5Z2ASpqDosIz6o4=; b=SCIDRx0kJhNW8PuOxPWPQ58v7DdGSeFnQWfqieNe6oTBc/GKSDP8hTyJdiDcUIF1CB 7/hHnrlr0nU1H3J5VmUpFcbKT9BqBLW+1wj2odeTtGP4AE0XiQFhae7GUkIjC4ZOyh22 vJWaKjtgC3h2Hs3nEM8VvoH2flEmLr7MJlz5VqbnfElGq6YYcFKtFXHD16fDCVPuoMUd x6H7jV48WEca8IK0IK6krC8qjtENb+jJwcnpH99vWYohk2NVvrbVXiqOlY2MUSzwkwV/ iCo+GcMYWlnJNmcCwXHMpJ2vOT4S98WEvBnoLiO/bZySOgwW/9pao6gfQEsm3ynHf48n Wv0g== X-Gm-Message-State: AOJu0Yxb7qiNGoLnyhfFb2dKVeT2QGZ4Ni3QH53LVHh2YAFqiMz2bPST M/rCKHIH+x/MNxqvmhNsx8KAfz7YulMJ5VVYgSdqDkAaGcqh4lH8YMErUfGR X-Gm-Gg: ASbGncsMLI8ARk8sFqC1fdV5Oztkw11EB1wrbydTwsc78d9mDZzDSGxSQ8E0u4o7JoR /0YCR0pyxKEZsYwWUhbZ5ZbyqHU8YTIil19987IfbhoG1aEIhsYKxegvTZ/xZnwZP9gvV+E7HqZ 76J0vCnXd522eV29AV4wz2xM8O3IyxZPxQoiDTjJffbpuYa/39b8FO3BHOCDrKVSLJ483zqwjGZ 4wjJI4DzEqFnBGVQxR/8+euyLsquDCvZD0/GwYMwQ62vAO+L0+Rz7TBV4UAQrElk8PRnNPnkNmd W9cDXePKeYm+BvIjZSoeEWnkZMeuOpyMlkVhIU6n9eyTOUxdOtcTEPEmIp3BGl16xKFunNzq X-Google-Smtp-Source: AGHT+IFL4zORK2jX1QDqAB/Kn4QknMLPoQSjlktKlzQNs/99oQgrmh6XhxT2GW2Rd/t2a/BraCLokg== X-Received: by 2002:a05:6a20:3d86:b0:1f8:d245:616d with SMTP id adf61e73a8af0-215ff115eacmr5058646637.21.1747230047307; Wed, 14 May 2025 06:40:47 -0700 (PDT) Received: from localhost.localdomain ([124.79.129.75]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a8f7edsm9310669b3a.167.2025.05.14.06.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 May 2025 06:40:46 -0700 (PDT) From: toqsxw@gmail.com X-Google-Original-From: toqsxw@outlook.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 May 2025 21:40:12 +0800 Message-ID: <20250514134031.1584-5-toqsxw@outlook.com> X-Mailer: git-send-email 2.44.0.windows.1 In-Reply-To: <20250514134031.1584-1-toqsxw@outlook.com> References: <20250514134031.1584-1-toqsxw@outlook.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1 05/23] avcodec/vvc/ctu: refact out ff_vvc_channel_range 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: Wu Jianhua Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Wu Jianhua Signed-off-by: Wu Jianhua --- libavcodec/vvc/ctu.c | 16 ++++++++++++---- libavcodec/vvc/ctu.h | 1 + libavcodec/vvc/intra.c | 8 ++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c index 080b740cc6..c621b6d5d6 100644 --- a/libavcodec/vvc/ctu.c +++ b/libavcodec/vvc/ctu.c @@ -501,13 +501,12 @@ static int skipped_transform_tree(VVCLocalContext *lc, int x0, int y0,int tu_wid SKIPPED_TRANSFORM_TREE(x0, y0 + trafo_height); } else { TransformUnit *tu = add_tu(fc, lc->cu, x0, y0, tu_width, tu_height); - const int has_chroma = sps->r->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA; - const int c_start = cu->tree_type == DUAL_TREE_CHROMA ? CB : LUMA; - const int c_end = has_chroma ? VVC_MAX_SAMPLE_ARRAYS : CB; + int start, end; if (!tu) return AVERROR_INVALIDDATA; - for (int i = c_start; i < c_end; i++) { + ff_vvc_channel_range(&start, &end, cu->tree_type, sps->r->sps_chroma_format_idc); + for (int i = start; i < end; i++) { TransformBlock *tb = add_tb(tu, lc, x0, y0, tu_width >> sps->hshift[i], tu_height >> sps->vshift[i], i); if (i != CR) set_tb_size(fc, tb); @@ -2580,3 +2579,12 @@ void ff_vvc_ep_init_stat_coeff(EntryPoint *ep, persistent_rice_adaptation_enabled_flag ? 2 * (av_log2(bit_depth - 10)) : 0; } } + +void ff_vvc_channel_range(int *start, int *end, const VVCTreeType tree_type, const uint8_t chroma_format_idc) +{ + const bool has_chroma = chroma_format_idc && tree_type != DUAL_TREE_LUMA; + const bool has_luma = tree_type != DUAL_TREE_CHROMA; + + *start = has_luma ? LUMA : CB; + *end = has_chroma ? VVC_MAX_SAMPLE_ARRAYS : CB; +} diff --git a/libavcodec/vvc/ctu.h b/libavcodec/vvc/ctu.h index c5533c1ad0..dab6f453f1 100644 --- a/libavcodec/vvc/ctu.h +++ b/libavcodec/vvc/ctu.h @@ -489,5 +489,6 @@ void ff_vvc_decode_neighbour(VVCLocalContext *lc, int x_ctb, int y_ctb, int rx, void ff_vvc_ctu_free_cus(CodingUnit **cus); int ff_vvc_get_qPy(const VVCFrameContext *fc, int xc, int yc); void ff_vvc_ep_init_stat_coeff(EntryPoint *ep, int bit_depth, int persistent_rice_adaptation_enabled_flag); +void ff_vvc_channel_range(int *start, int *end, VVCTreeType tree_type, uint8_t chroma_format_idc); #endif // AVCODEC_VVC_CTU_H diff --git a/libavcodec/vvc/intra.c b/libavcodec/vvc/intra.c index 41ed89c946..2e6cb8f09e 100644 --- a/libavcodec/vvc/intra.c +++ b/libavcodec/vvc/intra.c @@ -639,11 +639,11 @@ static void ibc_fill_vir_buf(const VVCLocalContext *lc, const CodingUnit *cu) { const VVCFrameContext *fc = lc->fc; const VVCSPS *sps = fc->ps.sps; - const int has_chroma = sps->r->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA; - const int start = cu->tree_type == DUAL_TREE_CHROMA; - const int end = has_chroma ? CR : LUMA; + int start, end; - for (int c_idx = start; c_idx <= end; c_idx++) { + ff_vvc_channel_range(&start, &end, cu->tree_type, sps->r->sps_chroma_format_idc); + + for (int c_idx = start; c_idx < end; c_idx++) { const int hs = sps->hshift[c_idx]; const int vs = sps->vshift[c_idx]; const int ps = sps->pixel_shift; -- 2.44.0.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".