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 "vpx_config.h" |
| 12 #include "vp9/encoder/vp9_variance.h" |
| 13 #include "vp9/common/vp9_pragmas.h" |
| 14 #include "vpx_ports/mem.h" |
| 15 |
| 16 #define HALFNDX 8 |
| 17 |
| 18 extern unsigned int vp9_get16x16var_sse2 |
| 19 ( |
| 20 const unsigned char *src_ptr, |
| 21 int source_stride, |
| 22 const unsigned char *ref_ptr, |
| 23 int recon_stride, |
| 24 unsigned int *SSE, |
| 25 int *Sum |
| 26 ); |
| 27 extern void vp9_half_horiz_vert_variance16x_h_sse2 |
| 28 ( |
| 29 const unsigned char *ref_ptr, |
| 30 int ref_pixels_per_line, |
| 31 const unsigned char *src_ptr, |
| 32 int src_pixels_per_line, |
| 33 unsigned int Height, |
| 34 int *sum, |
| 35 unsigned int *sumsquared |
| 36 ); |
| 37 extern void vp9_half_horiz_variance16x_h_sse2 |
| 38 ( |
| 39 const unsigned char *ref_ptr, |
| 40 int ref_pixels_per_line, |
| 41 const unsigned char *src_ptr, |
| 42 int src_pixels_per_line, |
| 43 unsigned int Height, |
| 44 int *sum, |
| 45 unsigned int *sumsquared |
| 46 ); |
| 47 extern void vp9_half_vert_variance16x_h_sse2 |
| 48 ( |
| 49 const unsigned char *ref_ptr, |
| 50 int ref_pixels_per_line, |
| 51 const unsigned char *src_ptr, |
| 52 int src_pixels_per_line, |
| 53 unsigned int Height, |
| 54 int *sum, |
| 55 unsigned int *sumsquared |
| 56 ); |
| 57 extern void vp9_filter_block2d_bil_var_ssse3 |
| 58 ( |
| 59 const unsigned char *ref_ptr, |
| 60 int ref_pixels_per_line, |
| 61 const unsigned char *src_ptr, |
| 62 int src_pixels_per_line, |
| 63 unsigned int Height, |
| 64 int xoffset, |
| 65 int yoffset, |
| 66 int *sum, |
| 67 unsigned int *sumsquared |
| 68 ); |
| 69 |
| 70 unsigned int vp9_sub_pixel_variance16x16_ssse3 |
| 71 ( |
| 72 const unsigned char *src_ptr, |
| 73 int src_pixels_per_line, |
| 74 int xoffset, |
| 75 int yoffset, |
| 76 const unsigned char *dst_ptr, |
| 77 int dst_pixels_per_line, |
| 78 unsigned int *sse |
| 79 ) { |
| 80 int xsum0; |
| 81 unsigned int xxsum0; |
| 82 |
| 83 // note we could avoid these if statements if the calling function |
| 84 // just called the appropriate functions inside. |
| 85 if (xoffset == HALFNDX && yoffset == 0) { |
| 86 vp9_half_horiz_variance16x_h_sse2( |
| 87 src_ptr, src_pixels_per_line, |
| 88 dst_ptr, dst_pixels_per_line, 16, |
| 89 &xsum0, &xxsum0); |
| 90 } else if (xoffset == 0 && yoffset == HALFNDX) { |
| 91 vp9_half_vert_variance16x_h_sse2( |
| 92 src_ptr, src_pixels_per_line, |
| 93 dst_ptr, dst_pixels_per_line, 16, |
| 94 &xsum0, &xxsum0); |
| 95 } else if (xoffset == HALFNDX && yoffset == HALFNDX) { |
| 96 vp9_half_horiz_vert_variance16x_h_sse2( |
| 97 src_ptr, src_pixels_per_line, |
| 98 dst_ptr, dst_pixels_per_line, 16, |
| 99 &xsum0, &xxsum0); |
| 100 } else { |
| 101 vp9_filter_block2d_bil_var_ssse3( |
| 102 src_ptr, src_pixels_per_line, |
| 103 dst_ptr, dst_pixels_per_line, 16, |
| 104 xoffset, yoffset, |
| 105 &xsum0, &xxsum0); |
| 106 } |
| 107 |
| 108 *sse = xxsum0; |
| 109 return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8)); |
| 110 } |
| 111 |
| 112 unsigned int vp9_sub_pixel_variance16x8_ssse3 |
| 113 ( |
| 114 const unsigned char *src_ptr, |
| 115 int src_pixels_per_line, |
| 116 int xoffset, |
| 117 int yoffset, |
| 118 const unsigned char *dst_ptr, |
| 119 int dst_pixels_per_line, |
| 120 unsigned int *sse |
| 121 |
| 122 ) { |
| 123 int xsum0; |
| 124 unsigned int xxsum0; |
| 125 |
| 126 if (xoffset == HALFNDX && yoffset == 0) { |
| 127 vp9_half_horiz_variance16x_h_sse2( |
| 128 src_ptr, src_pixels_per_line, |
| 129 dst_ptr, dst_pixels_per_line, 8, |
| 130 &xsum0, &xxsum0); |
| 131 } else if (xoffset == 0 && yoffset == HALFNDX) { |
| 132 vp9_half_vert_variance16x_h_sse2( |
| 133 src_ptr, src_pixels_per_line, |
| 134 dst_ptr, dst_pixels_per_line, 8, |
| 135 &xsum0, &xxsum0); |
| 136 } else if (xoffset == HALFNDX && yoffset == HALFNDX) { |
| 137 vp9_half_horiz_vert_variance16x_h_sse2( |
| 138 src_ptr, src_pixels_per_line, |
| 139 dst_ptr, dst_pixels_per_line, 8, |
| 140 &xsum0, &xxsum0); |
| 141 } else { |
| 142 vp9_filter_block2d_bil_var_ssse3( |
| 143 src_ptr, src_pixels_per_line, |
| 144 dst_ptr, dst_pixels_per_line, 8, |
| 145 xoffset, yoffset, |
| 146 &xsum0, &xxsum0); |
| 147 } |
| 148 |
| 149 *sse = xxsum0; |
| 150 return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 7)); |
| 151 } |
OLD | NEW |