diff mbox series

[FFmpeg-devel,v2,08/16] avcodec/vvcdec: misc, rename x_ctb, y_ctb, ctu_x, ctu_y to rx, ry to avoid misleading

Message ID TYSPR06MB643389EE51460765CAEAD7E6AA342@TYSPR06MB6433.apcprd06.prod.outlook.com
State New
Headers show
Series avcodec/vvcdec: support subpicture | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Nuo Mi March 27, 2024, 1:01 p.m. UTC
---
 libavcodec/vvc/vvc_ctu.c    |  8 ++--
 libavcodec/vvc/vvc_filter.c | 96 ++++++++++++++++++-------------------
 libavcodec/vvc/vvc_ps.c     | 38 +++++++--------
 3 files changed, 71 insertions(+), 71 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c
index 05c3e04b83..8ba12c8d9f 100644
--- a/libavcodec/vvc/vvc_ctu.c
+++ b/libavcodec/vvc/vvc_ctu.c
@@ -87,10 +87,10 @@  static int get_qp_y_pred(const VVCLocalContext *lc)
     const int min_cb_width  = fc->ps.pps->min_cb_width;
     const int x_cb          = cu->x0 >> sps->min_cb_log2_size_y;
     const int y_cb          = cu->y0 >> sps->min_cb_log2_size_y;
-    const int x_ctb         = cu->x0 >> ctb_log2_size;
-    const int y_ctb         = cu->y0 >> ctb_log2_size;
-    const int in_same_ctb_a = ((xQg - 1) >> ctb_log2_size) == x_ctb && (yQg >> ctb_log2_size) == y_ctb;
-    const int in_same_ctb_b = (xQg >> ctb_log2_size) == x_ctb && ((yQg - 1) >> ctb_log2_size) == y_ctb;
+    const int rx            = cu->x0 >> ctb_log2_size;
+    const int ry            = cu->y0 >> ctb_log2_size;
+    const int in_same_ctb_a = ((xQg - 1) >> ctb_log2_size) == rx && (yQg >> ctb_log2_size) == ry;
+    const int in_same_ctb_b = (xQg >> ctb_log2_size) == rx && ((yQg - 1) >> ctb_log2_size) == ry;
     int qPy_pred, qPy_a, qPy_b;
 
     if (lc->na.cand_up) {
diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c
index dded447bfa..10bd57e078 100644
--- a/libavcodec/vvc/vvc_filter.c
+++ b/libavcodec/vvc/vvc_filter.c
@@ -99,7 +99,7 @@  static void copy_vert(uint8_t *dst, const uint8_t *src, const int pixel_shift, c
 
 static void copy_ctb_to_hv(VVCFrameContext *fc, const uint8_t *src,
     const ptrdiff_t src_stride, const int x, const int y, const int width, const int height,
-    const int c_idx, const int x_ctb, const int y_ctb, const int top)
+    const int c_idx, const int rx, const int ry, const int top)
 {
     const int ps = fc->ps.sps->pixel_shift;
     const int w  = fc->ps.pps->width >> fc->ps.sps->hshift[c_idx];
@@ -107,16 +107,16 @@  static void copy_ctb_to_hv(VVCFrameContext *fc, const uint8_t *src,
 
     if (top) {
         /* top */
-        memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << ps),
+        memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * ry) * w + x) << ps),
             src, width << ps);
     } else {
         /* bottom */
-        memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) * w + x) << ps),
+        memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * ry + 1) * w + x) << ps),
             src + src_stride * (height - 1), width << ps);
 
         /* copy vertical edges */
-        copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) * h + y) << ps), src, ps, height, 1 << ps, src_stride);
-        copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 1) * h + y) << ps), src + ((width - 1) << ps), ps, height, 1 << ps, src_stride);
+        copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * rx) * h + y) << ps), src, ps, height, 1 << ps, src_stride);
+        copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * rx + 1) * h + y) << ps), src + ((width - 1) << ps), ps, height, 1 << ps, src_stride);
     }
 }
 
@@ -158,9 +158,9 @@  void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y)
     static const uint8_t sao_tab[16] = { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8 };
     int c_idx;
     int edges[4];  // 0 left 1 top 2 right 3 bottom
-    const int x_ctb      = x >> fc->ps.sps->ctb_log2_size_y;
-    const int y_ctb      = y >> fc->ps.sps->ctb_log2_size_y;
-    const SAOParams *sao = &CTB(fc->tab.sao, x_ctb, y_ctb);
+    const int rx         = x >> fc->ps.sps->ctb_log2_size_y;
+    const int ry         = y >> fc->ps.sps->ctb_log2_size_y;
+    const SAOParams *sao = &CTB(fc->tab.sao, rx, ry);
     // flags indicating unfilterable edges
     uint8_t vert_edge[]          = { 0, 0 };
     uint8_t horiz_edge[]         = { 0, 0 };
@@ -174,39 +174,39 @@  void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y)
     uint8_t up_tile_edge     = 0;
     uint8_t bottom_tile_edge = 0;
 
-    edges[LEFT]   = x_ctb == 0;
-    edges[TOP]    = y_ctb == 0;
-    edges[RIGHT]  = x_ctb == fc->ps.pps->ctb_width  - 1;
-    edges[BOTTOM] = y_ctb == fc->ps.pps->ctb_height - 1;
+    edges[LEFT]   = rx == 0;
+    edges[TOP]    = ry == 0;
+    edges[RIGHT]  = rx == fc->ps.pps->ctb_width  - 1;
+    edges[BOTTOM] = ry == fc->ps.pps->ctb_height - 1;
 
     if (restore) {
         if (!edges[LEFT]) {
-            left_tile_edge  = no_tile_filter && fc->ps.pps->ctb_to_col_bd[x_ctb] == x_ctb;
-            vert_edge[0]    = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb - 1, y_ctb)) || left_tile_edge;
+            left_tile_edge  = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] == rx;
+            vert_edge[0]    = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry)) || left_tile_edge;
         }
         if (!edges[RIGHT]) {
-            right_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_col_bd[x_ctb] != fc->ps.pps->ctb_to_col_bd[x_ctb + 1];
-            vert_edge[1]    = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb + 1, y_ctb)) || right_tile_edge;
+            right_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] != fc->ps.pps->ctb_to_col_bd[rx + 1];
+            vert_edge[1]    = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry)) || right_tile_edge;
         }
         if (!edges[TOP]) {
-            up_tile_edge     = no_tile_filter && fc->ps.pps->ctb_to_row_bd[y_ctb] == y_ctb;
-            horiz_edge[0]    = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb, y_ctb - 1)) || up_tile_edge;
+            up_tile_edge     = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] == ry;
+            horiz_edge[0]    = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry - 1)) || up_tile_edge;
         }
         if (!edges[BOTTOM]) {
-            bottom_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_row_bd[y_ctb] != fc->ps.pps->ctb_to_row_bd[y_ctb + 1];
-            horiz_edge[1]    = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb, y_ctb + 1)) || bottom_tile_edge;
+            bottom_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1];
+            horiz_edge[1]    = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1)) || bottom_tile_edge;
         }
         if (!edges[LEFT] && !edges[TOP]) {
-            diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb - 1, y_ctb - 1)) || left_tile_edge || up_tile_edge;
+            diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || left_tile_edge || up_tile_edge;
         }
         if (!edges[TOP] && !edges[RIGHT]) {
-            diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb + 1, y_ctb - 1)) || right_tile_edge || up_tile_edge;
+            diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || right_tile_edge || up_tile_edge;
         }
         if (!edges[RIGHT] && !edges[BOTTOM]) {
-            diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb + 1, y_ctb + 1)) || right_tile_edge || bottom_tile_edge;
+            diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry + 1)) || right_tile_edge || bottom_tile_edge;
         }
         if (!edges[LEFT] && !edges[BOTTOM]) {
-            diag_edge[3] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb - 1, y_ctb + 1)) || left_tile_edge || bottom_tile_edge;
+            diag_edge[3] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry + 1)) || left_tile_edge || bottom_tile_edge;
         }
     }
 
@@ -245,7 +245,7 @@  void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y)
                 int pos = 0;
 
                 dst1 = dst - dst_stride - (left << sh);
-                src1 = fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * y_ctb - 1) * w + x0 - left) << sh);
+                src1 = fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * ry - 1) * w + x0 - left) << sh);
                 if (left) {
                     copy_pixel(dst1, src1, sh);
                     pos += (1 << sh);
@@ -264,7 +264,7 @@  void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y)
                 int pos = 0;
 
                 dst1 = dst + height * dst_stride - (left << sh);
-                src1 = fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 2) * w + x0 - left) << sh);
+                src1 = fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * ry + 2) * w + x0 - left) << sh);
                 if (left) {
                     copy_pixel(dst1, src1, sh);
                     pos += (1 << sh);
@@ -277,12 +277,12 @@  void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y)
             }
             if (!edges[LEFT]) {
                 copy_vert(dst - (1 << sh),
-                    fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * x_ctb - 1) * h + y0) << sh),
+                    fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * rx - 1) * h + y0) << sh),
                     sh, height, dst_stride, 1 << sh);
             }
             if (!edges[RIGHT]) {
                 copy_vert(dst + (width << sh),
-                    fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 2) * h + y0) << sh),
+                    fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * rx + 2) * h + y0) << sh),
                     sh, height, dst_stride, 1 << sh);
             }
 
@@ -994,7 +994,7 @@  static void alf_extend_horz(uint8_t *dst, const uint8_t *src,
 }
 
 static void alf_copy_ctb_to_hv(VVCFrameContext *fc, const uint8_t *src, const ptrdiff_t src_stride,
-    const int x, const int y, const int width, const int height, const int x_ctb, const int y_ctb, const int c_idx)
+    const int x, const int y, const int width, const int height, const int rx, const int ry, const int c_idx)
 {
     const int ps            = fc->ps.sps->pixel_shift;
     const int w             = fc->ps.pps->width >> fc->ps.sps->hshift[c_idx];
@@ -1005,12 +1005,12 @@  static void alf_copy_ctb_to_hv(VVCFrameContext *fc, const uint8_t *src, const pt
 
     /* copy horizontal edges */
     for (int i = 0; i < FF_ARRAY_ELEMS(offset_h); i++) {
-        alf_copy_border(fc->tab.alf_pixel_buffer_h[c_idx][i] + ((border_pixels * y_ctb * w + x)<< ps),
+        alf_copy_border(fc->tab.alf_pixel_buffer_h[c_idx][i] + ((border_pixels * ry * w + x)<< ps),
             src + offset_h[i] * src_stride, ps, width, border_pixels, w << ps, src_stride);
     }
     /* copy vertical edges */
     for (int i = 0; i < FF_ARRAY_ELEMS(offset_v); i++) {
-        alf_copy_border(fc->tab.alf_pixel_buffer_v[c_idx][i] + ((h * x_ctb + y) * (border_pixels << ps)),
+        alf_copy_border(fc->tab.alf_pixel_buffer_v[c_idx][i] + ((h * rx + y) * (border_pixels << ps)),
             src + (offset_v[i] << ps), ps, border_pixels, height, border_pixels << ps, src_stride);
     }
 }
@@ -1050,7 +1050,7 @@  static void alf_fill_border_v(uint8_t *dst, const ptrdiff_t dst_stride, const ui
 }
 
 static void alf_prepare_buffer(VVCFrameContext *fc, uint8_t *_dst, const uint8_t *_src, const int x, const int y,
-    const int x_ctb, const int y_ctb, const int width, const int height, const ptrdiff_t dst_stride, const ptrdiff_t src_stride,
+    const int rx, const int ry, const int width, const int height, const ptrdiff_t dst_stride, const ptrdiff_t src_stride,
     const int c_idx, const int *edges)
 {
     const int ps = fc->ps.sps->pixel_shift;
@@ -1062,23 +1062,23 @@  static void alf_prepare_buffer(VVCFrameContext *fc, uint8_t *_dst, const uint8_t
     copy_ctb(_dst, _src, width << ps, height, dst_stride, src_stride);
 
     //top
-    src = fc->tab.alf_pixel_buffer_h[c_idx][1] + (((border_pixels * w) << ps) * (y_ctb - 1) + (x << ps));
+    src = fc->tab.alf_pixel_buffer_h[c_idx][1] + (((border_pixels * w) << ps) * (ry - 1) + (x << ps));
     dst = _dst - border_pixels * dst_stride;
     alf_fill_border_h(dst, dst_stride, src, w  << ps, _dst, width, border_pixels, ps, edges[TOP]);
 
     //bottom
-    src = fc->tab.alf_pixel_buffer_h[c_idx][0] + (((border_pixels * w) << ps) * (y_ctb + 1) + (x << ps));
+    src = fc->tab.alf_pixel_buffer_h[c_idx][0] + (((border_pixels * w) << ps) * (ry + 1) + (x << ps));
     dst = _dst + height * dst_stride;
     alf_fill_border_h(dst, dst_stride, src, w  << ps, _dst + (height - 1) * dst_stride, width, border_pixels, ps, edges[BOTTOM]);
 
 
     //left
-    src = fc->tab.alf_pixel_buffer_v[c_idx][1] + (h * (x_ctb - 1) + y - border_pixels) * (border_pixels << ps);
+    src = fc->tab.alf_pixel_buffer_v[c_idx][1] + (h * (rx - 1) + y - border_pixels) * (border_pixels << ps);
     dst = _dst - (border_pixels << ps) - border_pixels * dst_stride;
     alf_fill_border_v(dst, dst_stride, src,  dst + (border_pixels << ps), border_pixels, height, ps, edges, edges[LEFT]);
 
     //right
-    src = fc->tab.alf_pixel_buffer_v[c_idx][0] + (h * (x_ctb + 1) + y - border_pixels) * (border_pixels << ps);
+    src = fc->tab.alf_pixel_buffer_v[c_idx][0] + (h * (rx + 1) + y - border_pixels) * (border_pixels << ps);
     dst = _dst + (width << ps) - border_pixels * dst_stride;
     alf_fill_border_v(dst, dst_stride, src,  dst - (1 << ps), border_pixels, height, ps, edges, edges[RIGHT]);
 }
@@ -1177,8 +1177,8 @@  static void alf_filter_cc(VVCLocalContext *lc, uint8_t *dst, const uint8_t *luma
 void ff_vvc_alf_copy_ctu_to_hv(VVCLocalContext* lc, const int x0, const int y0)
 {
     VVCFrameContext *fc  = lc->fc;
-    const int x_ctb      = x0 >> fc->ps.sps->ctb_log2_size_y;
-    const int y_ctb      = y0 >> fc->ps.sps->ctb_log2_size_y;
+    const int rx         = x0 >> fc->ps.sps->ctb_log2_size_y;
+    const int ry         = y0 >> fc->ps.sps->ctb_log2_size_y;
     const int ctb_size_y = fc->ps.sps->ctb_size_y;
     const int ps         = fc->ps.sps->pixel_shift;
     const int c_end      = fc->ps.sps->r->sps_chroma_format_idc ? VVC_MAX_SAMPLE_ARRAYS : 1;
@@ -1194,7 +1194,7 @@  void ff_vvc_alf_copy_ctu_to_hv(VVCLocalContext* lc, const int x0, const int y0)
         const int src_stride = fc->frame->linesize[c_idx];
         uint8_t* src = &fc->frame->data[c_idx][y * src_stride + (x << ps)];
 
-        alf_copy_ctb_to_hv(fc, src, src_stride, x, y, width, height, x_ctb, y_ctb, c_idx);
+        alf_copy_ctb_to_hv(fc, src, src_stride, x, y, width, height, rx, ry, c_idx);
     }
 }
 
@@ -1202,28 +1202,28 @@  void ff_vvc_alf_filter(VVCLocalContext *lc, const int x0, const int y0)
 {
     VVCFrameContext *fc     = lc->fc;
     const VVCPPS *pps       = fc->ps.pps;
-    const int x_ctb         = x0 >> fc->ps.sps->ctb_log2_size_y;
-    const int y_ctb         = y0 >> fc->ps.sps->ctb_log2_size_y;
+    const int rx            = x0 >> fc->ps.sps->ctb_log2_size_y;
+    const int ry            = y0 >> fc->ps.sps->ctb_log2_size_y;
     const int ctb_size_y    = fc->ps.sps->ctb_size_y;
     const int ps            = fc->ps.sps->pixel_shift;
     const int padded_stride = EDGE_EMU_BUFFER_STRIDE << ps;
     const int padded_offset = padded_stride * ALF_PADDING_SIZE + (ALF_PADDING_SIZE << ps);
     const int c_end         = fc->ps.sps->r->sps_chroma_format_idc ? VVC_MAX_SAMPLE_ARRAYS : 1;
-    ALFParams *alf          = &CTB(fc->tab.alf, x_ctb, y_ctb);
-    int edges[MAX_EDGES]    = { x_ctb == 0, y_ctb == 0, x_ctb == pps->ctb_width - 1, y_ctb == pps->ctb_height - 1 };
+    ALFParams *alf          = &CTB(fc->tab.alf, rx, ry);
+    int edges[MAX_EDGES]    = { rx == 0, ry == 0, rx == pps->ctb_width - 1, ry == pps->ctb_height - 1 };
 
     if (!pps->r->pps_loop_filter_across_tiles_enabled_flag) {
         edges[LEFT]   = edges[LEFT] || (lc->boundary_flags & BOUNDARY_LEFT_TILE);
         edges[TOP]    = edges[TOP] || (lc->boundary_flags & BOUNDARY_UPPER_TILE);
-        edges[RIGHT]  = edges[RIGHT] || pps->ctb_to_col_bd[x_ctb] != pps->ctb_to_col_bd[x_ctb + 1];
-        edges[BOTTOM] = edges[BOTTOM] || pps->ctb_to_row_bd[y_ctb] != pps->ctb_to_row_bd[y_ctb + 1];
+        edges[RIGHT]  = edges[RIGHT] || pps->ctb_to_col_bd[rx] != pps->ctb_to_col_bd[rx + 1];
+        edges[BOTTOM] = edges[BOTTOM] || pps->ctb_to_row_bd[ry] != pps->ctb_to_row_bd[ry + 1];
     }
 
     if (!pps->r->pps_loop_filter_across_slices_enabled_flag) {
         edges[LEFT]   = edges[LEFT] || (lc->boundary_flags & BOUNDARY_LEFT_SLICE);
         edges[TOP]    = edges[TOP] || (lc->boundary_flags & BOUNDARY_UPPER_SLICE);
-        edges[RIGHT]  = edges[RIGHT] || CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb + 1, y_ctb);
-        edges[BOTTOM] = edges[BOTTOM] || CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb, y_ctb + 1);
+        edges[RIGHT]  = edges[RIGHT] || CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry);
+        edges[BOTTOM] = edges[BOTTOM] || CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1);
     }
 
     for (int c_idx = 0; c_idx < c_end; c_idx++) {
@@ -1243,7 +1243,7 @@  void ff_vvc_alf_filter(VVCLocalContext *lc, const int x0, const int y0)
 
         if (alf->ctb_flag[c_idx] || (!c_idx && (alf->ctb_cc_idc[0] || alf->ctb_cc_idc[1]))) {
             padded = (c_idx ? lc->alf_buffer_chroma : lc->alf_buffer_luma) + padded_offset;
-            alf_prepare_buffer(fc, padded, src, x, y, x_ctb, y_ctb, width, height,
+            alf_prepare_buffer(fc, padded, src, x, y, rx, ry, width, height,
                 padded_stride, src_stride, c_idx, edges);
         }
         if (alf->ctb_flag[c_idx]) {
diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
index 556135fee2..d6fa04c169 100644
--- a/libavcodec/vvc/vvc_ps.c
+++ b/libavcodec/vvc/vvc_ps.c
@@ -322,24 +322,24 @@  static void tile_xy(int *tile_x, int *tile_y, const int tile_idx, const VVCPPS *
     *tile_y = tile_idx / pps->r->num_tile_columns;
 }
 
-static void ctu_xy(int *ctu_x, int *ctu_y, const int tile_x, const int tile_y, const VVCPPS *pps)
+static void ctu_xy(int *rx, int *ry, const int tile_x, const int tile_y, const VVCPPS *pps)
 {
-    *ctu_x = pps->col_bd[tile_x];
-    *ctu_y = pps->row_bd[tile_y];
+    *rx = pps->col_bd[tile_x];
+    *ry = pps->row_bd[tile_y];
 }
 
-static int ctu_rs(const int ctu_x, const int ctu_y, const VVCPPS *pps)
+static int ctu_rs(const int rx, const int ry, const VVCPPS *pps)
 {
-    return pps->ctb_width * ctu_y + ctu_x;
+    return pps->ctb_width * ry + rx;
 }
 
-static int pps_add_ctus(VVCPPS *pps, int *off, const int ctu_x, const int ctu_y,
+static int pps_add_ctus(VVCPPS *pps, int *off, const int rx, const int ry,
     const int w, const int h)
 {
     int start = *off;
     for (int y = 0; y < h; y++) {
         for (int x = 0; x < w; x++) {
-            pps->ctb_addr_in_slice[*off] = ctu_rs(ctu_x + x, ctu_y + y, pps);
+            pps->ctb_addr_in_slice[*off] = ctu_rs(rx + x, ry + y, pps);
             (*off)++;
         }
     }
@@ -426,16 +426,16 @@  static void pps_single_slice_per_subpic(VVCPPS *pps, const VVCSPS *sps, int *off
 static int pps_one_tile_slices(VVCPPS *pps, const int tile_idx, int i, int *off)
 {
     const H266RawPPS *r = pps->r;
-    int ctu_x, ctu_y, ctu_y_end, tile_x, tile_y;
+    int rx, ry, ctu_y_end, tile_x, tile_y;
 
     tile_xy(&tile_x, &tile_y, tile_idx, pps);
-    ctu_xy(&ctu_x, &ctu_y, tile_x, tile_y, pps);
-    ctu_y_end = ctu_y + r->row_height_val[tile_y];
-    while (ctu_y < ctu_y_end) {
+    ctu_xy(&rx, &ry, tile_x, tile_y, pps);
+    ctu_y_end = ry + r->row_height_val[tile_y];
+    while (ry < ctu_y_end) {
         pps->slice_start_offset[i] = *off;
-        pps->num_ctus_in_slice[i] = pps_add_ctus(pps, off, ctu_x, ctu_y,
+        pps->num_ctus_in_slice[i] = pps_add_ctus(pps, off, rx, ry,
             r->col_width_val[tile_x], r->slice_height_in_ctus[i]);
-        ctu_y += r->slice_height_in_ctus[i++];
+        ry += r->slice_height_in_ctus[i++];
     }
     i--;
     return i;
@@ -444,15 +444,15 @@  static int pps_one_tile_slices(VVCPPS *pps, const int tile_idx, int i, int *off)
 static void pps_multi_tiles_slice(VVCPPS *pps, const int tile_idx, const int i, int *off)
 {
     const H266RawPPS *r = pps->r;
-    int ctu_x, ctu_y,tile_x, tile_y;
+    int rx, ry, tile_x, tile_y;
 
     tile_xy(&tile_x, &tile_y, tile_idx, pps);
     pps->slice_start_offset[i] = *off;
     pps->num_ctus_in_slice[i] = 0;
     for (int ty = tile_y; ty <= tile_y + r->pps_slice_height_in_tiles_minus1[i]; ty++) {
         for (int tx = tile_x; tx <= tile_x + r->pps_slice_width_in_tiles_minus1[i]; tx++) {
-            ctu_xy(&ctu_x, &ctu_y, tx, ty, pps);
-            pps->num_ctus_in_slice[i] += pps_add_ctus(pps, off, ctu_x, ctu_y,
+            ctu_xy(&rx, &ry, tx, ty, pps);
+            pps->num_ctus_in_slice[i] += pps_add_ctus(pps, off, rx, ry,
                 r->col_width_val[tx], r->row_height_val[ty]);
         }
     }
@@ -482,12 +482,12 @@  static void pps_rect_slice(VVCPPS *pps, const VVCSPS *sps)
 static void pps_no_rect_slice(VVCPPS* pps)
 {
     const H266RawPPS* r = pps->r;
-    int ctu_x, ctu_y, off = 0;
+    int rx, ry, off = 0;
 
     for (int tile_y = 0; tile_y < r->num_tile_rows; tile_y++) {
         for (int tile_x = 0; tile_x < r->num_tile_columns; tile_x++) {
-            ctu_xy(&ctu_x, &ctu_y, tile_x, tile_y, pps);
-            pps_add_ctus(pps, &off, ctu_x, ctu_y, r->col_width_val[tile_x], r->row_height_val[tile_y]);
+            ctu_xy(&rx, &ry, tile_x, tile_y, pps);
+            pps_add_ctus(pps, &off, rx, ry, r->col_width_val[tile_x], r->row_height_val[tile_y]);
         }
     }
 }