aom: restoration.c: make av1_foreach_rest_unit_in_plane() static

From f46501b1e410d45ac6b894a1641a6331bcfbaacc Mon Sep 17 00:00:00 2001
From: James Zern <[EMAIL REDACTED]>
Date: Tue, 13 Aug 2024 17:07:56 -0700
Subject: [PATCH] restoration.c: make av1_foreach_rest_unit_in_plane() static

This function is unused outside of this file.

Bug: aomedia:3416
Change-Id: I3fa550d15049ceb4c53a80c05446977f1d988155
---
 av1/common/restoration.c | 83 ++++++++++++++++++++--------------------
 av1/common/restoration.h |  6 ---
 2 files changed, 42 insertions(+), 47 deletions(-)

diff --git a/av1/common/restoration.c b/av1/common/restoration.c
index 4e0dee54c2..8aaddef4d5 100644
--- a/av1/common/restoration.c
+++ b/av1/common/restoration.c
@@ -1140,6 +1140,46 @@ void av1_loop_restoration_copy_planes(AV1LrStruct *loop_rest_ctxt,
   }
 }
 
+// Call on_rest_unit for each loop restoration unit in the plane.
+static void foreach_rest_unit_in_plane(const struct AV1Common *cm, int plane,
+                                       rest_unit_visitor_t on_rest_unit,
+                                       void *priv, int32_t *tmpbuf,
+                                       RestorationLineBuffers *rlbs) {
+  const RestorationInfo *rsi = &cm->rst_info[plane];
+  const int hnum_rest_units = rsi->horz_units;
+  const int vnum_rest_units = rsi->vert_units;
+  const int unit_size = rsi->restoration_unit_size;
+
+  const int is_uv = plane > 0;
+  const int ss_y = is_uv && cm->seq_params->subsampling_y;
+  const int ext_size = unit_size * 3 / 2;
+  int plane_w, plane_h;
+  av1_get_upsampled_plane_size(cm, is_uv, &plane_w, &plane_h);
+
+  int y0 = 0, i = 0;
+  while (y0 < plane_h) {
+    int remaining_h = plane_h - y0;
+    int h = (remaining_h < ext_size) ? remaining_h : unit_size;
+
+    RestorationTileLimits limits;
+    limits.v_start = y0;
+    limits.v_end = y0 + h;
+    assert(limits.v_end <= plane_h);
+    // Offset upwards to align with the restoration processing stripe
+    const int voffset = RESTORATION_UNIT_OFFSET >> ss_y;
+    limits.v_start = AOMMAX(0, limits.v_start - voffset);
+    if (limits.v_end < plane_h) limits.v_end -= voffset;
+
+    av1_foreach_rest_unit_in_row(&limits, plane_w, on_rest_unit, i, unit_size,
+                                 hnum_rest_units, vnum_rest_units, plane, priv,
+                                 tmpbuf, rlbs, av1_lr_sync_read_dummy,
+                                 av1_lr_sync_write_dummy, NULL, cm->error);
+
+    y0 += h;
+    ++i;
+  }
+}
+
 static void foreach_rest_unit_in_planes(AV1LrStruct *lr_ctxt, AV1_COMMON *cm,
                                         int num_planes) {
   FilterFrameCtxt *ctxt = lr_ctxt->ctxt;
@@ -1149,8 +1189,8 @@ static void foreach_rest_unit_in_planes(AV1LrStruct *lr_ctxt, AV1_COMMON *cm,
       continue;
     }
 
-    av1_foreach_rest_unit_in_plane(cm, plane, lr_ctxt->on_rest_unit,
-                                   &ctxt[plane], cm->rst_tmpbuf, cm->rlbs);
+    foreach_rest_unit_in_plane(cm, plane, lr_ctxt->on_rest_unit, &ctxt[plane],
+                               cm->rst_tmpbuf, cm->rlbs);
   }
 }
 
@@ -1234,45 +1274,6 @@ void av1_lr_sync_write_dummy(void *const lr_sync, int r, int c,
   (void)plane;
 }
 
-void av1_foreach_rest_unit_in_plane(const struct AV1Common *cm, int plane,
-                                    rest_unit_visitor_t on_rest_unit,
-                                    void *priv, int32_t *tmpbuf,
-                                    RestorationLineBuffers *rlbs) {
-  const RestorationInfo *rsi = &cm->rst_info[plane];
-  const int hnum_rest_units = rsi->horz_units;
-  const int vnum_rest_units = rsi->vert_units;
-  const int unit_size = rsi->restoration_unit_size;
-
-  const int is_uv = plane > 0;
-  const int ss_y = is_uv && cm->seq_params->subsampling_y;
-  const int ext_size = unit_size * 3 / 2;
-  int plane_w, plane_h;
-  av1_get_upsampled_plane_size(cm, is_uv, &plane_w, &plane_h);
-
-  int y0 = 0, i = 0;
-  while (y0 < plane_h) {
-    int remaining_h = plane_h - y0;
-    int h = (remaining_h < ext_size) ? remaining_h : unit_size;
-
-    RestorationTileLimits limits;
-    limits.v_start = y0;
-    limits.v_end = y0 + h;
-    assert(limits.v_end <= plane_h);
-    // Offset upwards to align with the restoration processing stripe
-    const int voffset = RESTORATION_UNIT_OFFSET >> ss_y;
-    limits.v_start = AOMMAX(0, limits.v_start - voffset);
-    if (limits.v_end < plane_h) limits.v_end -= voffset;
-
-    av1_foreach_rest_unit_in_row(&limits, plane_w, on_rest_unit, i, unit_size,
-                                 hnum_rest_units, vnum_rest_units, plane, priv,
-                                 tmpbuf, rlbs, av1_lr_sync_read_dummy,
-                                 av1_lr_sync_write_dummy, NULL, cm->error);
-
-    y0 += h;
-    ++i;
-  }
-}
-
 int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
                                        int mi_row, int mi_col, BLOCK_SIZE bsize,
                                        int *rcol0, int *rcol1, int *rrow0,
diff --git a/av1/common/restoration.h b/av1/common/restoration.h
index a73190e1dc..0b5d62bf6b 100644
--- a/av1/common/restoration.h
+++ b/av1/common/restoration.h
@@ -419,12 +419,6 @@ typedef void (*sync_read_fn_t)(void *const lr_sync, int r, int c, int plane);
 typedef void (*sync_write_fn_t)(void *const lr_sync, int r, int c,
                                 const int sb_cols, int plane);
 
-// Call on_rest_unit for each loop restoration unit in the plane.
-void av1_foreach_rest_unit_in_plane(const struct AV1Common *cm, int plane,
-                                    rest_unit_visitor_t on_rest_unit,
-                                    void *priv, int32_t *tmpbuf,
-                                    RestorationLineBuffers *rlbs);
-
 // Return 1 iff the block at mi_row, mi_col with size bsize is a
 // top-level superblock containing the top-left corner of at least one
 // loop restoration unit.