vpx_free(oci->pp_limits_buffer);
oci->pp_limits_buffer = NULL;
+
+ vpx_free(oci->postproc_state.generated_noise);
+ oci->postproc_state.generated_noise = NULL;
#endif
vpx_free(oci->above_context);
oci->postproc_state.last_frame_valid = 1;
return 0;
}
+ if (flags & VP8D_ADDNOISE)
+ {
+ if (!oci->postproc_state.generated_noise)
+ {
+ oci->postproc_state.generated_noise = vpx_calloc(
+ oci->Width + 256, sizeof(*oci->postproc_state.generated_noise));
+ if (!oci->postproc_state.generated_noise)
+ return 1;
+ }
+ }
/* Allocate post_proc_buffer_int if needed */
if ((flags & VP8D_MFQE) && !oci->post_proc_buffer_int_used)
struct postproc_state *ppstate = &oci->postproc_state;
vp8_clear_system_state();
sigma = noise_level + .5 + .6 * q / 63.0;
- oci->postproc_state.clamp = vpx_setup_noise(sigma,
- ppstate->noise,
- sizeof(ppstate->noise));
+ ppstate->clamp = vpx_setup_noise(sigma, ppstate->generated_noise,
+ oci->Width + 256);
ppstate->last_q = q;
ppstate->last_noise = noise_level;
}
vpx_plane_add_noise
(oci->post_proc_buffer.y_buffer,
- oci->postproc_state.noise,
+ oci->postproc_state.generated_noise,
oci->postproc_state.clamp,
oci->postproc_state.clamp,
oci->post_proc_buffer.y_width, oci->post_proc_buffer.y_height,
{
int last_q;
int last_noise;
- int8_t noise[3072];
int last_base_qindex;
int last_frame_valid;
int clamp;
+ int8_t *generated_noise;
};
#include "onyxc_int.h"
#include "ppflags.h"
vpx_free_frame_buffer(&cm->post_proc_buffer);
vpx_free_frame_buffer(&cm->post_proc_buffer_int);
vpx_free(cm->postproc_state.limits);
- cm->postproc_state.limits = 0;
+ cm->postproc_state.limits = NULL;
+ vpx_free(cm->postproc_state.generated_noise);
+ cm->postproc_state.generated_noise = NULL;
#else
(void)cm;
#endif
}
}
+ if (flags & VP9D_ADDNOISE) {
+ if (!cm->postproc_state.generated_noise) {
+ cm->postproc_state.generated_noise = vpx_calloc(
+ cm->width + 256, sizeof(*cm->postproc_state.generated_noise));
+ if (!cm->postproc_state.generated_noise)
+ return 1;
+ }
+ }
if ((flags & VP9D_MFQE) && cm->current_video_frame >= 2 &&
ppstate->last_frame_valid && cm->bit_depth == 8 &&
double sigma;
vpx_clear_system_state();
sigma = noise_level + .5 + .6 * q / 63.0;
- ppstate->clamp = vpx_setup_noise(sigma, ppstate->noise,
- sizeof(ppstate->noise));
+ ppstate->clamp = vpx_setup_noise(sigma, ppstate->generated_noise,
+ cm->width + 256);
ppstate->last_q = q;
ppstate->last_noise = noise_level;
}
- vpx_plane_add_noise(ppbuf->y_buffer, ppstate->noise, ppstate->clamp,
- ppstate->clamp, ppbuf->y_width, ppbuf->y_height,
- ppbuf->y_stride);
+ vpx_plane_add_noise(ppbuf->y_buffer, ppstate->generated_noise,
+ ppstate->clamp, ppstate->clamp, ppbuf->y_width,
+ ppbuf->y_height, ppbuf->y_stride);
}
*dest = *ppbuf;
struct postproc_state {
int last_q;
int last_noise;
- int8_t noise[3072];
int last_base_qindex;
int last_frame_valid;
MODE_INFO *prev_mip;
MODE_INFO *prev_mi;
int clamp;
uint8_t *limits;
+ int8_t *generated_noise;
};
struct VP9Common;