OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * |
| 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. |
| 9 */ |
| 10 |
| 11 #include <stdlib.h> |
| 12 #include "vpx_ports/mem.h" |
| 13 #include "./vp9_rtcd.h" |
| 14 unsigned int vp9_satd16x16_c(const unsigned char *src_ptr, |
| 15 int src_stride, |
| 16 const unsigned char *ref_ptr, |
| 17 int ref_stride, |
| 18 unsigned int *psatd) { |
| 19 int r, c, i; |
| 20 unsigned int satd = 0; |
| 21 DECLARE_ALIGNED(16, short, diff_in[256]); |
| 22 DECLARE_ALIGNED(16, short, diff_out[16]); |
| 23 short *in; |
| 24 |
| 25 for (r = 0; r < 16; r++) { |
| 26 for (c = 0; c < 16; c++) { |
| 27 diff_in[r * 16 + c] = src_ptr[c] - ref_ptr[c]; |
| 28 } |
| 29 src_ptr += src_stride; |
| 30 ref_ptr += ref_stride; |
| 31 } |
| 32 |
| 33 in = diff_in; |
| 34 for (r = 0; r < 16; r += 4) { |
| 35 for (c = 0; c < 16; c += 4) { |
| 36 vp9_short_walsh4x4_c(in + c, diff_out, 32); |
| 37 for (i = 0; i < 16; i++) |
| 38 satd += abs(diff_out[i]); |
| 39 } |
| 40 in += 64; |
| 41 } |
| 42 |
| 43 if (psatd) |
| 44 *psatd = satd; |
| 45 |
| 46 return satd; |
| 47 } |
OLD | NEW |