Declare the 'params' arg as const.
Declare the 'params' argument of av1_add_film_grain() as const. Because
of const propagation, the prototypes of many other functions need to be
changed.
Change-Id: Iac40fe91387c63ee8ad8f684bb01613e345aef0d
diff --git a/aom_dsp/grain_synthesis.c b/aom_dsp/grain_synthesis.c
index 93f07e5..2e716f8 100644
--- a/aom_dsp/grain_synthesis.c
+++ b/aom_dsp/grain_synthesis.c
@@ -238,7 +238,7 @@
static uint16_t random_register = 0; // random number generator register
-static void init_arrays(aom_film_grain_t *params, int luma_stride,
+static void init_arrays(const aom_film_grain_t *params, int luma_stride,
int chroma_stride, int ***pred_pos_luma_p,
int ***pred_pos_chroma_p, int **luma_grain_block,
int **cb_grain_block, int **cr_grain_block,
@@ -332,7 +332,7 @@
(int *)aom_malloc(sizeof(**cr_grain_block) * chroma_grain_samples);
}
-static void dealloc_arrays(aom_film_grain_t *params, int ***pred_pos_luma,
+static void dealloc_arrays(const aom_film_grain_t *params, int ***pred_pos_luma,
int ***pred_pos_chroma, int **luma_grain_block,
int **cb_grain_block, int **cr_grain_block,
int **y_line_buf, int **cb_line_buf,
@@ -397,7 +397,7 @@
}
static void generate_luma_grain_block(
- aom_film_grain_t *params, int **pred_pos_luma, int *luma_grain_block,
+ const aom_film_grain_t *params, int **pred_pos_luma, int *luma_grain_block,
int luma_block_size_y, int luma_block_size_x, int luma_grain_stride,
int left_pad, int top_pad, int right_pad, int bottom_pad) {
if (params->num_y_points == 0) return;
@@ -432,7 +432,7 @@
}
static void generate_chroma_grain_blocks(
- aom_film_grain_t *params,
+ const aom_film_grain_t *params,
// int** pred_pos_luma,
int **pred_pos_chroma, int *luma_grain_block, int *cb_grain_block,
int *cr_grain_block, int luma_grain_stride, int chroma_block_size_y,
@@ -525,7 +525,7 @@
}
}
-static void init_scaling_function(int scaling_points[][2], int num_points,
+static void init_scaling_function(const int scaling_points[][2], int num_points,
int scaling_lut[]) {
if (num_points == 0) return;
@@ -562,7 +562,7 @@
(bit_depth - 8));
}
-static void add_noise_to_block(aom_film_grain_t *params, uint8_t *luma,
+static void add_noise_to_block(const aom_film_grain_t *params, uint8_t *luma,
uint8_t *cb, uint8_t *cr, int luma_stride,
int chroma_stride, int *luma_grain,
int *cb_grain, int *cr_grain,
@@ -678,7 +678,7 @@
}
static void add_noise_to_block_hbd(
- aom_film_grain_t *params, uint16_t *luma, uint16_t *cb, uint16_t *cr,
+ const aom_film_grain_t *params, uint16_t *luma, uint16_t *cb, uint16_t *cr,
int luma_stride, int chroma_stride, int *luma_grain, int *cb_grain,
int *cr_grain, int luma_grain_stride, int chroma_grain_stride,
int half_luma_height, int half_luma_width, int bit_depth,
@@ -906,7 +906,7 @@
}
}
-void av1_add_film_grain(aom_film_grain_t *params, const aom_image_t *src,
+void av1_add_film_grain(const aom_film_grain_t *params, const aom_image_t *src,
aom_image_t *dst) {
uint8_t *luma, *cb, *cr;
int height, width, luma_stride, chroma_stride;
@@ -1013,7 +1013,7 @@
return;
}
-void av1_add_film_grain_run(aom_film_grain_t *params, uint8_t *luma,
+void av1_add_film_grain_run(const aom_film_grain_t *params, uint8_t *luma,
uint8_t *cb, uint8_t *cr, int height, int width,
int luma_stride, int chroma_stride,
int use_high_bit_depth, int chroma_subsamp_y,
diff --git a/aom_dsp/grain_synthesis.h b/aom_dsp/grain_synthesis.h
index 120812c..65feb60 100644
--- a/aom_dsp/grain_synthesis.h
+++ b/aom_dsp/grain_synthesis.h
@@ -94,7 +94,7 @@
* \param[in] luma_stride luma plane stride
* \param[in] chroma_stride chroma plane stride
*/
-void av1_add_film_grain_run(aom_film_grain_t *grain_params, uint8_t *luma,
+void av1_add_film_grain_run(const aom_film_grain_t *grain_params, uint8_t *luma,
uint8_t *cb, uint8_t *cr, int height, int width,
int luma_stride, int chroma_stride,
int use_high_bit_depth, int chroma_subsamp_y,
@@ -108,8 +108,8 @@
* \param[in] src Source image
* \param[out] dst Resulting image with grain
*/
-void av1_add_film_grain(aom_film_grain_t *grain_params, const aom_image_t *src,
- aom_image_t *dst);
+void av1_add_film_grain(const aom_film_grain_t *grain_params,
+ const aom_image_t *src, aom_image_t *dst);
#ifdef __cplusplus
} // extern "C"