2 * Copyright (c) 2015 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
13 #include "./vpx_config.h"
14 #include "./vpx_dsp_rtcd.h"
16 #include "vpx/vpx_integer.h"
17 #include "vpx_ports/mem.h"
19 void vpx_plane_add_noise_c(uint8_t *start, char *noise,
23 unsigned int width, unsigned int height, int pitch) {
26 // TODO(jbb): why does simd code use both but c doesn't, normalize and
29 for (i = 0; i < height; i++) {
30 uint8_t *pos = start + i * pitch;
31 char *ref = (char *)(noise + (rand() & 0xff)); // NOLINT
33 for (j = 0; j < width; j++) {
34 if (pos[j] < blackclamp[0])
35 pos[j] = blackclamp[0];
37 if (pos[j] > 255 - whiteclamp[0])
38 pos[j] = 255 - whiteclamp[0];