Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: toqsxw@gmail.com
To: ffmpeg-devel@ffmpeg.org
Cc: Wu Jianhua <toqsxw@outlook.com>
Subject: [FFmpeg-devel] [PATCH v1 05/23] avcodec/vvc/ctu: refact out ff_vvc_channel_range
Date: Thu,  1 May 2025 22:43:03 +0800
Message-ID: <20250501144324.958-5-toqsxw@outlook.com> (raw)
In-Reply-To: <20250501144324.958-1-toqsxw@outlook.com>

From: Wu Jianhua <toqsxw@outlook.com>

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
---
 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".

  parent reply	other threads:[~2025-05-01 14:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-01 14:42 [FFmpeg-devel] [PATCH v1 01/23] avcodec/vvc/cabac: add 9.3.3.5 k-th order Exp - Golomb binarization process toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 02/23] avcodec/vvc/cabac: add 9.3.3.7 Fixed-length " toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 03/23] avcodec/vvc/cabac: add palette support toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 04/23] avcodec/vvc: add VVC_MAX_NUM_PALETTE_PREDICTOR_SIZE toqsxw
2025-05-01 14:43 ` toqsxw [this message]
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 06/23] avcodec/vvc: refact out ep_init and ep_init_wpp toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 07/23] avcodec/vvc: refact, save pf and ciip_flag in ff_vvc_set_intra_mvf toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 08/23] avcodec/vvc/ctu: refact out intra_data toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 09/23] avcodec/vvc/intra: add ff_vvc_palette_derive_scale toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 10/23] avcodec/vvc/ctu: add palette support toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 11/23] avcodec/vvc/filter: skip deblocking filter for palette toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 12/23] avcodec/vvc/intra: add palette coding decoder toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 13/23] avcodec/vvc/cabac: add ff_vvc_cu_act_enabled_flag toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 14/23] avcodec/vvc/ctu: read act_enabled_flag for adaptive color transform toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 15/23] avcodec/vvc/ctu: fix derive_chroma_intra_pred_mode toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 16/23] avcodec/vvc/dsp: update the interface of pred_residual_joint for joint cbcr residual functionality toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 17/23] avcodec/vvc/dsp: add adaptive_color_transform toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 18/23] avcodec/vvc/intra: fix scaling process for transform coefficients toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 19/23] avcodec/vvc/intra: refact, predict jcbcr to tb->coeffs toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 20/23] avcodec/vvc/intra: make lmcs_scale_chroma inplace toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 21/23] avcodec/vvc/intra: refact out lmcs_scale_chroma and add_residual toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 22/23] avcodec/vvc: add adaptive color transform support toqsxw
2025-05-01 14:43 ` [FFmpeg-devel] [PATCH v1 23/23] Changelog: VVC supports all content of SCC toqsxw
2025-05-10 12:59   ` Nuo Mi
2025-05-14 13:40 [FFmpeg-devel] [PATCH v1 01/23] avcodec/vvc/cabac: add 9.3.3.5 k-th order Exp - Golomb binarization process toqsxw
2025-05-14 13:40 ` [FFmpeg-devel] [PATCH v1 05/23] avcodec/vvc/ctu: refact out ff_vvc_channel_range toqsxw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250501144324.958-5-toqsxw@outlook.com \
    --to=toqsxw@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=toqsxw@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git