noise_model.c: add a few missing malloc casts
I noticed these when testing the MSVC optimizer bug described in issue
aomedia:3365, since I needed lambda expressions to start isolating the
affected loop.
Change-Id: I0ee5c06db5894f9c20e6f728f9036e5155662fa5
(cherry picked from commit cd252e725342b30e40f3a0a7ddea6a800f5a7cf1)
diff --git a/aom_dsp/noise_model.c b/aom_dsp/noise_model.c
index ed45087..8521232 100644
--- a/aom_dsp/noise_model.c
+++ b/aom_dsp/noise_model.c
@@ -387,7 +387,7 @@
max_output_points = solver->num_bins;
}
- double *residual = aom_malloc(solver->num_bins * sizeof(*residual));
+ double *residual = (double *)aom_malloc(solver->num_bins * sizeof(*residual));
if (!residual) {
aom_noise_strength_lut_free(lut);
return 0;
@@ -1532,11 +1532,11 @@
ctx->bit_depth = bit_depth;
ctx->noise_psd[0] =
- aom_malloc(sizeof(*ctx->noise_psd[0]) * block_size * block_size);
+ (float *)aom_malloc(sizeof(*ctx->noise_psd[0]) * block_size * block_size);
ctx->noise_psd[1] =
- aom_malloc(sizeof(*ctx->noise_psd[1]) * block_size * block_size);
+ (float *)aom_malloc(sizeof(*ctx->noise_psd[1]) * block_size * block_size);
ctx->noise_psd[2] =
- aom_malloc(sizeof(*ctx->noise_psd[2]) * block_size * block_size);
+ (float *)aom_malloc(sizeof(*ctx->noise_psd[2]) * block_size * block_size);
if (!ctx->noise_psd[0] || !ctx->noise_psd[1] || !ctx->noise_psd[2]) {
fprintf(stderr, "Unable to allocate noise PSD buffers\n");
aom_denoise_and_model_free(ctx);
@@ -1576,16 +1576,20 @@
aom_free(ctx->flat_blocks);
ctx->flat_blocks = NULL;
- ctx->denoised[0] = aom_malloc((sd->y_stride * sd->y_height) << use_highbd);
- ctx->denoised[1] = aom_malloc((sd->uv_stride * sd->uv_height) << use_highbd);
- ctx->denoised[2] = aom_malloc((sd->uv_stride * sd->uv_height) << use_highbd);
+ ctx->denoised[0] =
+ (uint8_t *)aom_malloc((sd->y_stride * sd->y_height) << use_highbd);
+ ctx->denoised[1] =
+ (uint8_t *)aom_malloc((sd->uv_stride * sd->uv_height) << use_highbd);
+ ctx->denoised[2] =
+ (uint8_t *)aom_malloc((sd->uv_stride * sd->uv_height) << use_highbd);
if (!ctx->denoised[0] || !ctx->denoised[1] || !ctx->denoised[2]) {
fprintf(stderr, "Unable to allocate denoise buffers\n");
return 0;
}
ctx->num_blocks_w = (sd->y_width + ctx->block_size - 1) / ctx->block_size;
ctx->num_blocks_h = (sd->y_height + ctx->block_size - 1) / ctx->block_size;
- ctx->flat_blocks = aom_malloc(ctx->num_blocks_w * ctx->num_blocks_h);
+ ctx->flat_blocks =
+ (uint8_t *)aom_malloc(ctx->num_blocks_w * ctx->num_blocks_h);
if (!ctx->flat_blocks) {
fprintf(stderr, "Unable to allocate flat_blocks buffer\n");
return 0;