| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 #include "vp9/common/vp9_common.h" | 10 #include "vp9/common/vp9_common.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 unsigned int vp9_avg_4x4_c(const uint8_t *s, int p) { | 22 unsigned int vp9_avg_4x4_c(const uint8_t *s, int p) { |
| 23 int i, j; | 23 int i, j; |
| 24 int sum = 0; | 24 int sum = 0; |
| 25 for (i = 0; i < 4; ++i, s+=p) | 25 for (i = 0; i < 4; ++i, s+=p) |
| 26 for (j = 0; j < 4; sum += s[j], ++j) {} | 26 for (j = 0; j < 4; sum += s[j], ++j) {} |
| 27 | 27 |
| 28 return (sum + 8) >> 4; | 28 return (sum + 8) >> 4; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // Integer projection onto row vectors. |
| 32 void vp9_int_pro_row_c(int16_t *hbuf, uint8_t const *ref, |
| 33 const int ref_stride, const int height) { |
| 34 int idx; |
| 35 for (idx = 0; idx < 16; ++idx) { |
| 36 int i; |
| 37 hbuf[idx] = 0; |
| 38 for (i = 0; i < height; ++i) |
| 39 hbuf[idx] += ref[i * ref_stride]; |
| 40 ++ref; |
| 41 } |
| 42 } |
| 43 |
| 44 int16_t vp9_int_pro_col_c(uint8_t const *ref, const int width) { |
| 45 int idx; |
| 46 int16_t sum = 0; |
| 47 for (idx = 0; idx < width; ++idx) |
| 48 sum += ref[idx]; |
| 49 return sum; |
| 50 } |
| 51 |
| 52 int vp9_vector_sad_c(int16_t const *ref, int16_t const *src, |
| 53 const int width) { |
| 54 int i; |
| 55 int this_sad = 0; |
| 56 for (i = 0; i < width; ++i) |
| 57 this_sad += abs(ref[i] - src[i]); |
| 58 return this_sad; |
| 59 } |
| 60 |
| 31 #if CONFIG_VP9_HIGHBITDEPTH | 61 #if CONFIG_VP9_HIGHBITDEPTH |
| 32 unsigned int vp9_highbd_avg_8x8_c(const uint8_t *s8, int p) { | 62 unsigned int vp9_highbd_avg_8x8_c(const uint8_t *s8, int p) { |
| 33 int i, j; | 63 int i, j; |
| 34 int sum = 0; | 64 int sum = 0; |
| 35 const uint16_t* s = CONVERT_TO_SHORTPTR(s8); | 65 const uint16_t* s = CONVERT_TO_SHORTPTR(s8); |
| 36 for (i = 0; i < 8; ++i, s+=p) | 66 for (i = 0; i < 8; ++i, s+=p) |
| 37 for (j = 0; j < 8; sum += s[j], ++j) {} | 67 for (j = 0; j < 8; sum += s[j], ++j) {} |
| 38 | 68 |
| 39 return (sum + 32) >> 6; | 69 return (sum + 32) >> 6; |
| 40 } | 70 } |
| 41 | 71 |
| 42 unsigned int vp9_highbd_avg_4x4_c(const uint8_t *s8, int p) { | 72 unsigned int vp9_highbd_avg_4x4_c(const uint8_t *s8, int p) { |
| 43 int i, j; | 73 int i, j; |
| 44 int sum = 0; | 74 int sum = 0; |
| 45 const uint16_t* s = CONVERT_TO_SHORTPTR(s8); | 75 const uint16_t* s = CONVERT_TO_SHORTPTR(s8); |
| 46 for (i = 0; i < 4; ++i, s+=p) | 76 for (i = 0; i < 4; ++i, s+=p) |
| 47 for (j = 0; j < 4; sum += s[j], ++j) {} | 77 for (j = 0; j < 4; sum += s[j], ++j) {} |
| 48 | 78 |
| 49 return (sum + 8) >> 4; | 79 return (sum + 8) >> 4; |
| 50 } | 80 } |
| 51 #endif // CONFIG_VP9_HIGHBITDEPTH | 81 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 52 | 82 |
| 53 | 83 |
| OLD | NEW |