diff options
Diffstat (limited to 'chromium/third_party/libvpx/source/libvpx/vpx_dsp/add_noise.c')
-rw-r--r-- | chromium/third_party/libvpx/source/libvpx/vpx_dsp/add_noise.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/chromium/third_party/libvpx/source/libvpx/vpx_dsp/add_noise.c b/chromium/third_party/libvpx/source/libvpx/vpx_dsp/add_noise.c index cda6ae8814a..6839e979284 100644 --- a/chromium/third_party/libvpx/source/libvpx/vpx_dsp/add_noise.c +++ b/chromium/third_party/libvpx/source/libvpx/vpx_dsp/add_noise.c @@ -52,6 +52,7 @@ int vpx_setup_noise(double sigma, int8_t *noise, int size) { const int a_i = (int)(0.5 + 256 * gaussian(sigma, 0, i)); if (a_i) { for (j = 0; j < a_i; ++j) { + if (next + j >= 256) goto set_noise; char_dist[next + j] = (int8_t)i; } next = next + j; @@ -63,6 +64,7 @@ int vpx_setup_noise(double sigma, int8_t *noise, int size) { char_dist[next] = 0; } +set_noise: for (i = 0; i < size; ++i) { noise[i] = char_dist[rand() & 0xff]; // NOLINT } |