| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <stdlib.h> | 11 #include <stdlib.h> |
| 12 | 12 |
| 13 #include "./vpx_config.h" | 13 #include "./vpx_config.h" |
| 14 #include "./vpx_dsp_rtcd.h" | 14 #include "./vpx_dsp_rtcd.h" |
| 15 | 15 |
| 16 #include "vpx/vpx_integer.h" | 16 #include "vpx/vpx_integer.h" |
| 17 | 17 #include "vpx_ports/mem.h" |
| 18 #if CONFIG_VP9_HIGHBITDEPTH | |
| 19 #include "vp9/common/vp9_common.h" | |
| 20 #endif // CONFIG_VP9_HIGHBITDEPTH | |
| 21 // Temporary ... | |
| 22 #define ROUND_POWER_OF_TWO(value, n) \ | |
| 23 (((value) + (1 << ((n) - 1))) >> (n)) | |
| 24 | 18 |
| 25 /* Sum the difference between every corresponding element of the buffers. */ | 19 /* Sum the difference between every corresponding element of the buffers. */ |
| 26 static INLINE unsigned int sad(const uint8_t *a, int a_stride, | 20 static INLINE unsigned int sad(const uint8_t *a, int a_stride, |
| 27 const uint8_t *b, int b_stride, | 21 const uint8_t *b, int b_stride, |
| 28 int width, int height) { | 22 int width, int height) { |
| 29 int y, x; | 23 int y, x; |
| 30 unsigned int sad = 0; | 24 unsigned int sad = 0; |
| 31 | 25 |
| 32 for (y = 0; y < height; y++) { | 26 for (y = 0; y < height; y++) { |
| 33 for (x = 0; x < width; x++) | 27 for (x = 0; x < width; x++) |
| 34 sad += abs(a[x] - b[x]); | 28 sad += abs(a[x] - b[x]); |
| 35 | 29 |
| 36 a += a_stride; | 30 a += a_stride; |
| 37 b += b_stride; | 31 b += b_stride; |
| 38 } | 32 } |
| 39 return sad; | 33 return sad; |
| 40 } | 34 } |
| 41 | 35 |
| 36 // TODO(johannkoenig): this moved to vpx_dsp, should be able to clean this up. |
| 42 /* Remove dependency on vp9 variance function by duplicating vp9_comp_avg_pred. | 37 /* Remove dependency on vp9 variance function by duplicating vp9_comp_avg_pred. |
| 43 * The function averages every corresponding element of the buffers and stores | 38 * The function averages every corresponding element of the buffers and stores |
| 44 * the value in a third buffer, comp_pred. | 39 * the value in a third buffer, comp_pred. |
| 45 * pred and comp_pred are assumed to have stride = width | 40 * pred and comp_pred are assumed to have stride = width |
| 46 * In the usage below comp_pred is a local array. | 41 * In the usage below comp_pred is a local array. |
| 47 */ | 42 */ |
| 48 static INLINE void avg_pred(uint8_t *comp_pred, const uint8_t *pred, int width, | 43 static INLINE void avg_pred(uint8_t *comp_pred, const uint8_t *pred, int width, |
| 49 int height, const uint8_t *ref, int ref_stride) { | 44 int height, const uint8_t *ref, int ref_stride) { |
| 50 int i, j; | 45 int i, j; |
| 51 | 46 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 highbd_sadMxNxK(4, 8, 8) | 309 highbd_sadMxNxK(4, 8, 8) |
| 315 highbd_sadMxNx4D(4, 8) | 310 highbd_sadMxNx4D(4, 8) |
| 316 | 311 |
| 317 // 4x4 | 312 // 4x4 |
| 318 highbd_sadMxN(4, 4) | 313 highbd_sadMxN(4, 4) |
| 319 highbd_sadMxNxK(4, 4, 3) | 314 highbd_sadMxNxK(4, 4, 3) |
| 320 highbd_sadMxNxK(4, 4, 8) | 315 highbd_sadMxNxK(4, 4, 8) |
| 321 highbd_sadMxNx4D(4, 4) | 316 highbd_sadMxNx4D(4, 4) |
| 322 | 317 |
| 323 #endif // CONFIG_VP9_HIGHBITDEPTH | 318 #endif // CONFIG_VP9_HIGHBITDEPTH |
| OLD | NEW |