variance_ssse3.c 3.9 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
/*
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

11
#include "vpx_config.h"
12
13
#include "vp9/encoder/variance.h"
#include "vp9/common/pragmas.h"
14
15
#include "vpx_ports/mem.h"

16
17
#define HALFNDX 8

18
extern unsigned int vp9_get16x16var_sse2
19
(
John Koleszar's avatar
John Koleszar committed
20
21
22
23
24
25
  const unsigned char *src_ptr,
  int source_stride,
  const unsigned char *ref_ptr,
  int recon_stride,
  unsigned int *SSE,
  int *Sum
26
);
27
extern void vp9_half_horiz_vert_variance16x_h_sse2
28
(
John Koleszar's avatar
John Koleszar committed
29
30
31
32
33
34
35
  const unsigned char *ref_ptr,
  int ref_pixels_per_line,
  const unsigned char *src_ptr,
  int src_pixels_per_line,
  unsigned int Height,
  int *sum,
  unsigned int *sumsquared
36
);
37
extern void vp9_half_horiz_variance16x_h_sse2
38
(
John Koleszar's avatar
John Koleszar committed
39
40
41
42
43
44
45
  const unsigned char *ref_ptr,
  int ref_pixels_per_line,
  const unsigned char *src_ptr,
  int src_pixels_per_line,
  unsigned int Height,
  int *sum,
  unsigned int *sumsquared
46
);
47
extern void vp9_half_vert_variance16x_h_sse2
48
(
John Koleszar's avatar
John Koleszar committed
49
50
51
52
53
54
55
  const unsigned char *ref_ptr,
  int ref_pixels_per_line,
  const unsigned char *src_ptr,
  int src_pixels_per_line,
  unsigned int Height,
  int *sum,
  unsigned int *sumsquared
56
);
57
extern void vp9_filter_block2d_bil_var_ssse3
58
(
John Koleszar's avatar
John Koleszar committed
59
60
61
62
63
64
65
66
67
  const unsigned char *ref_ptr,
  int ref_pixels_per_line,
  const unsigned char *src_ptr,
  int src_pixels_per_line,
  unsigned int Height,
  int  xoffset,
  int  yoffset,
  int *sum,
  unsigned int *sumsquared
68
69
);

70
unsigned int vp9_sub_pixel_variance16x16_ssse3
71
(
John Koleszar's avatar
John Koleszar committed
72
73
74
75
76
77
78
79
80
81
  const unsigned char  *src_ptr,
  int  src_pixels_per_line,
  int  xoffset,
  int  yoffset,
  const unsigned char *dst_ptr,
  int dst_pixels_per_line,
  unsigned int *sse
) {
  int xsum0;
  unsigned int xxsum0;
82

John Koleszar's avatar
John Koleszar committed
83
84
85
  // note we could avoid these if statements if the calling function
  // just called the appropriate functions inside.
  if (xoffset == HALFNDX && yoffset == 0) {
86
    vp9_half_horiz_variance16x_h_sse2(
John Koleszar's avatar
John Koleszar committed
87
88
89
90
      src_ptr, src_pixels_per_line,
      dst_ptr, dst_pixels_per_line, 16,
      &xsum0, &xxsum0);
  } else if (xoffset == 0 && yoffset == HALFNDX) {
91
    vp9_half_vert_variance16x_h_sse2(
John Koleszar's avatar
John Koleszar committed
92
93
94
95
      src_ptr, src_pixels_per_line,
      dst_ptr, dst_pixels_per_line, 16,
      &xsum0, &xxsum0);
  } else if (xoffset == HALFNDX && yoffset == HALFNDX) {
96
    vp9_half_horiz_vert_variance16x_h_sse2(
John Koleszar's avatar
John Koleszar committed
97
98
99
100
      src_ptr, src_pixels_per_line,
      dst_ptr, dst_pixels_per_line, 16,
      &xsum0, &xxsum0);
  } else {
101
    vp9_filter_block2d_bil_var_ssse3(
John Koleszar's avatar
John Koleszar committed
102
103
104
105
106
      src_ptr, src_pixels_per_line,
      dst_ptr, dst_pixels_per_line, 16,
      xoffset, yoffset,
      &xsum0, &xxsum0);
  }
107

John Koleszar's avatar
John Koleszar committed
108
  *sse = xxsum0;
109
  return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
110
}
111

112
unsigned int vp9_sub_pixel_variance16x8_ssse3
113
(
John Koleszar's avatar
John Koleszar committed
114
115
116
117
118
119
120
  const unsigned char  *src_ptr,
  int  src_pixels_per_line,
  int  xoffset,
  int  yoffset,
  const unsigned char *dst_ptr,
  int dst_pixels_per_line,
  unsigned int *sse
121

John Koleszar's avatar
John Koleszar committed
122
123
124
) {
  int xsum0;
  unsigned int xxsum0;
125

John Koleszar's avatar
John Koleszar committed
126
  if (xoffset == HALFNDX && yoffset == 0) {
127
    vp9_half_horiz_variance16x_h_sse2(
John Koleszar's avatar
John Koleszar committed
128
129
130
131
      src_ptr, src_pixels_per_line,
      dst_ptr, dst_pixels_per_line, 8,
      &xsum0, &xxsum0);
  } else if (xoffset == 0 && yoffset == HALFNDX) {
132
    vp9_half_vert_variance16x_h_sse2(
John Koleszar's avatar
John Koleszar committed
133
134
135
136
      src_ptr, src_pixels_per_line,
      dst_ptr, dst_pixels_per_line, 8,
      &xsum0, &xxsum0);
  } else if (xoffset == HALFNDX && yoffset == HALFNDX) {
137
    vp9_half_horiz_vert_variance16x_h_sse2(
John Koleszar's avatar
John Koleszar committed
138
139
140
141
      src_ptr, src_pixels_per_line,
      dst_ptr, dst_pixels_per_line, 8,
      &xsum0, &xxsum0);
  } else {
142
    vp9_filter_block2d_bil_var_ssse3(
John Koleszar's avatar
John Koleszar committed
143
144
145
146
147
      src_ptr, src_pixels_per_line,
      dst_ptr, dst_pixels_per_line, 8,
      xoffset, yoffset,
      &xsum0, &xxsum0);
  }
148

John Koleszar's avatar
John Koleszar committed
149
  *sse = xxsum0;
150
  return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 7));
151
}