aom: Declare some YV12_BUFFER_CONFIG * params as const

From 1be3f2ebf87ea1a314c5effe2c967303796ba7ae Mon Sep 17 00:00:00 2001
From: Wan-Teh Chang <[EMAIL REDACTED]>
Date: Mon, 5 Feb 2024 14:44:16 -0800
Subject: [PATCH] Declare some YV12_BUFFER_CONFIG * params as const

Declare the YV12_BUFFER_CONFIG * parameters of
denoise_and_model_realloc_if_necessary(), aom_denoise_and_model_run(),
apply_denoise_2d(), and av1_receive_raw_frame().

Also rename the YV12_BUFFER_CONFIG * parameter in the declaration of
aom_denoise_and_model_run() as `sd` to match the name of the parameter
in the definition of the function.

Change-Id: Ia4bd8eb99a31d749a0cadd3caeabcd6e3e9f7643
---
 aom_dsp/noise_model.c | 4 ++--
 aom_dsp/noise_model.h | 6 +++---
 av1/encoder/encoder.c | 4 ++--
 av1/encoder/encoder.h | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/aom_dsp/noise_model.c b/aom_dsp/noise_model.c
index 065ec9a106..4359d3af69 100644
--- a/aom_dsp/noise_model.c
+++ b/aom_dsp/noise_model.c
@@ -1555,7 +1555,7 @@ void aom_denoise_and_model_free(struct aom_denoise_and_model_t *ctx) {
 }
 
 static int denoise_and_model_realloc_if_necessary(
-    struct aom_denoise_and_model_t *ctx, YV12_BUFFER_CONFIG *sd) {
+    struct aom_denoise_and_model_t *ctx, const YV12_BUFFER_CONFIG *sd) {
   if (ctx->width == sd->y_width && ctx->height == sd->y_height &&
       ctx->y_stride == sd->y_stride && ctx->uv_stride == sd->uv_stride)
     return 1;
@@ -1624,7 +1624,7 @@ static int denoise_and_model_realloc_if_necessary(
 // TODO(aomedia:3151): Handle a monochrome image (sd->u_buffer and sd->v_buffer
 // are null pointers) correctly.
 int aom_denoise_and_model_run(struct aom_denoise_and_model_t *ctx,
-                              YV12_BUFFER_CONFIG *sd,
+                              const YV12_BUFFER_CONFIG *sd,
                               aom_film_grain_t *film_grain, int apply_denoise) {
   const int block_size = ctx->block_size;
   const int use_highbd = (sd->flags & YV12_FLAG_HIGHBITDEPTH) != 0;
diff --git a/aom_dsp/noise_model.h b/aom_dsp/noise_model.h
index 8228aeacfc..5b2d7efe29 100644
--- a/aom_dsp/noise_model.h
+++ b/aom_dsp/noise_model.h
@@ -297,14 +297,14 @@ struct aom_denoise_and_model_t;
  *                              aom_denoise_and_model_alloc that holds some
  *                              buffers for denoising and the current noise
  *                              estimate.
- * \param[in,out] buf           The raw input buffer to be denoised.
+ * \param[in,out] sd            The raw input buffer to be denoised.
  * \param[out]    grain         Output film grain parameters
  * \param[in]     apply_denoise Whether or not to apply the denoising to the
  *                              frame that will be encoded
  */
 int aom_denoise_and_model_run(struct aom_denoise_and_model_t *ctx,
-                              YV12_BUFFER_CONFIG *buf, aom_film_grain_t *grain,
-                              int apply_denoise);
+                              const YV12_BUFFER_CONFIG *sd,
+                              aom_film_grain_t *grain, int apply_denoise);
 
 /*!\brief Allocates a context that can be used for denoising and noise modeling.
  *
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 2aa8b799e2..6324818108 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -4041,7 +4041,7 @@ int av1_encode(AV1_COMP *const cpi, uint8_t *const dest,
 }
 
 #if CONFIG_DENOISE
-static int apply_denoise_2d(AV1_COMP *cpi, YV12_BUFFER_CONFIG *sd,
+static int apply_denoise_2d(AV1_COMP *cpi, const YV12_BUFFER_CONFIG *sd,
                             int block_size, float noise_level,
                             int64_t time_stamp, int64_t end_time) {
   AV1_COMMON *const cm = &cpi->common;
@@ -4076,7 +4076,7 @@ static int apply_denoise_2d(AV1_COMP *cpi, YV12_BUFFER_CONFIG *sd,
 #endif
 
 int av1_receive_raw_frame(AV1_COMP *cpi, aom_enc_frame_flags_t frame_flags,
-                          YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
+                          const YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
                           int64_t end_time) {
   AV1_COMMON *const cm = &cpi->common;
   const SequenceHeader *const seq_params = cm->seq_params;
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 7548bfc401..ff7dc0b7de 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -3808,7 +3808,7 @@ int av1_init_parallel_frame_context(const AV1_COMP_DATA *const first_cpi_data,
  * copy of the pointer.
  */
 int av1_receive_raw_frame(AV1_COMP *cpi, aom_enc_frame_flags_t frame_flags,
-                          YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
+                          const YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
                           int64_t end_time_stamp);
 
 /*!\brief Encode a frame