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 C543D4BA0B for ; Thu, 1 May 2025 14:44:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3A17868B6F8; Thu, 1 May 2025 17:43:54 +0300 (EEST) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 28CB868B643 for ; Thu, 1 May 2025 17:43:48 +0300 (EEST) Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-af579e46b5dso717993a12.3 for ; Thu, 01 May 2025 07:43:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746110626; x=1746715426; 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=DRh7+7T6KUpSLudANSRCv1ko35DyTvy3Cb+ZCaH91tWIDW2Fg03TDqV/eD5JYNEEV/ 46rT3C+hVLMIVkFjGg27R5f1j4SD3XFlhHBN+Mo4ysxIpjFmynxhTU1Vfc2ZYhIXnCq9 pSWaBbwTVKyS06i7PeZZivh7BDy3MRveGc47tvPFrGpakkr81+FQy7Ga2C0G9TgCcVyV RVeFOxfDUbKzeAhAT0gfUBllhzUnEIi/4H3Yd/DmrGsIxkX2wz3KRuYllid2YW4X9UP5 u7Zn9DrQwJYd6erljmcI7Auy+sxXMI2xt51payAUekLLOHmi4Ras4CQdu+R+l1n+oPhw IjxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746110626; x=1746715426; 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=fY2lhOxlK3JFcrXzzcZ8fQUq8g+TiWnzYfKfjt3ccOwXTn5hv5VO0wy4JnkTx4EQ6W vvWayROuTkWGj+H0hP0ORAWZsSDqGKusvWrnVc14d4uxaE3MMDdhYFxFhCd9RZs5J1WA pEgZlJYh6SyS25VLQUuZmLtjyDWDajgo0gBtarGdNGyUDjXdWJ7ONW3xe+zjF+FeGfn5 5mqgpjIvDoqg+NKsyMlsda3QKW6ghT+Wi/kesTRxlOnTu4jOC1VRd+fluFcCPQb5cHdy /F76Pfuk2K6/nFF5rdvKq82lPvhA9/S6vie6YFEkncnWxaEWFVXu7524SNyVR271HKZp YYUA== X-Gm-Message-State: AOJu0YyaHvVxdvivtxNVBuJRjK2cLvltDEImKsWoSOwMA0a0y4ftH4Ms H9xwgu1Ty4x0FyosON6AWFV8mMUSU9iILechGSGhBVbS9SRzmCkrXCezrA== X-Gm-Gg: ASbGncsD/AvTatHVVkeyz6J2Wd6fDgbHIAIZLqUyTQo6elc27LAB52Z1imuS8r77vtj AJoKjhioXTXMnrVBmZZ1xLMETsd4d/SzG6vJz1jrM/Kk/xIqWz52dHzlUJN9pOutGvcbQYGyE+A VNliAnurrN5rGxrhXJnsmM7ohSqNPwYfYLIoJj8298B+SXsMQ3X52bgZEFQfRoTv/5I37NHiuxR H8K1FTrfoOoU14Ft3vcoUDr/g+d7R5sy9HzG05oZai0k7uY0OeLUVbj7FmG0zwdFGnzQBriwGO6 ELMVnTSr0bE+M/XeO8K/N8u5GuHrhYQnCkyNkygGqEveiGV8vHUbHAbpNutUTA== X-Google-Smtp-Source: AGHT+IHf8uoyWA/3UieF0KiF8zTCAjgOnRGnLEkCgYUJN0QWCA1lmRaU9GKg7aHqu9EM4Mfe40svLg== X-Received: by 2002:a05:6a21:50b:b0:1f5:6e00:14db with SMTP id adf61e73a8af0-20bd6a55426mr4501177637.14.1746110626151; Thu, 01 May 2025 07:43:46 -0700 (PDT) Received: from localhost.localdomain ([124.79.129.75]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b1f9d4b68e8sm807271a12.27.2025.05.01.07.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 May 2025 07:43:45 -0700 (PDT) From: toqsxw@gmail.com X-Google-Original-From: toqsxw@outlook.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 May 2025 22:43:03 +0800 Message-ID: <20250501144324.958-5-toqsxw@outlook.com> X-Mailer: git-send-email 2.44.0.windows.1 In-Reply-To: <20250501144324.958-1-toqsxw@outlook.com> References: <20250501144324.958-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".