media/libvpx/vp8/common/x86/variance_ssse3.c

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /*
michael@0 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license
michael@0 5 * that can be found in the LICENSE file in the root of the source
michael@0 6 * tree. An additional intellectual property rights grant can be found
michael@0 7 * in the file PATENTS. All contributing project authors may
michael@0 8 * be found in the AUTHORS file in the root of the source tree.
michael@0 9 */
michael@0 10
michael@0 11 #include "vpx_config.h"
michael@0 12 #include "vp8/common/variance.h"
michael@0 13 #include "vp8/common/pragmas.h"
michael@0 14 #include "vpx_ports/mem.h"
michael@0 15
michael@0 16 extern unsigned int vp8_get16x16var_sse2
michael@0 17 (
michael@0 18 const unsigned char *src_ptr,
michael@0 19 int source_stride,
michael@0 20 const unsigned char *ref_ptr,
michael@0 21 int recon_stride,
michael@0 22 unsigned int *SSE,
michael@0 23 int *Sum
michael@0 24 );
michael@0 25 extern void vp8_half_horiz_vert_variance16x_h_sse2
michael@0 26 (
michael@0 27 const unsigned char *ref_ptr,
michael@0 28 int ref_pixels_per_line,
michael@0 29 const unsigned char *src_ptr,
michael@0 30 int src_pixels_per_line,
michael@0 31 unsigned int Height,
michael@0 32 int *sum,
michael@0 33 unsigned int *sumsquared
michael@0 34 );
michael@0 35 extern void vp8_half_horiz_variance16x_h_sse2
michael@0 36 (
michael@0 37 const unsigned char *ref_ptr,
michael@0 38 int ref_pixels_per_line,
michael@0 39 const unsigned char *src_ptr,
michael@0 40 int src_pixels_per_line,
michael@0 41 unsigned int Height,
michael@0 42 int *sum,
michael@0 43 unsigned int *sumsquared
michael@0 44 );
michael@0 45 extern void vp8_half_vert_variance16x_h_sse2
michael@0 46 (
michael@0 47 const unsigned char *ref_ptr,
michael@0 48 int ref_pixels_per_line,
michael@0 49 const unsigned char *src_ptr,
michael@0 50 int src_pixels_per_line,
michael@0 51 unsigned int Height,
michael@0 52 int *sum,
michael@0 53 unsigned int *sumsquared
michael@0 54 );
michael@0 55 extern void vp8_filter_block2d_bil_var_ssse3
michael@0 56 (
michael@0 57 const unsigned char *ref_ptr,
michael@0 58 int ref_pixels_per_line,
michael@0 59 const unsigned char *src_ptr,
michael@0 60 int src_pixels_per_line,
michael@0 61 unsigned int Height,
michael@0 62 int xoffset,
michael@0 63 int yoffset,
michael@0 64 int *sum,
michael@0 65 unsigned int *sumsquared
michael@0 66 );
michael@0 67
michael@0 68 unsigned int vp8_sub_pixel_variance16x16_ssse3
michael@0 69 (
michael@0 70 const unsigned char *src_ptr,
michael@0 71 int src_pixels_per_line,
michael@0 72 int xoffset,
michael@0 73 int yoffset,
michael@0 74 const unsigned char *dst_ptr,
michael@0 75 int dst_pixels_per_line,
michael@0 76 unsigned int *sse
michael@0 77 )
michael@0 78 {
michael@0 79 int xsum0;
michael@0 80 unsigned int xxsum0;
michael@0 81
michael@0 82 /* note we could avoid these if statements if the calling function
michael@0 83 * just called the appropriate functions inside.
michael@0 84 */
michael@0 85 if (xoffset == 4 && yoffset == 0)
michael@0 86 {
michael@0 87 vp8_half_horiz_variance16x_h_sse2(
michael@0 88 src_ptr, src_pixels_per_line,
michael@0 89 dst_ptr, dst_pixels_per_line, 16,
michael@0 90 &xsum0, &xxsum0);
michael@0 91 }
michael@0 92 else if (xoffset == 0 && yoffset == 4)
michael@0 93 {
michael@0 94 vp8_half_vert_variance16x_h_sse2(
michael@0 95 src_ptr, src_pixels_per_line,
michael@0 96 dst_ptr, dst_pixels_per_line, 16,
michael@0 97 &xsum0, &xxsum0);
michael@0 98 }
michael@0 99 else if (xoffset == 4 && yoffset == 4)
michael@0 100 {
michael@0 101 vp8_half_horiz_vert_variance16x_h_sse2(
michael@0 102 src_ptr, src_pixels_per_line,
michael@0 103 dst_ptr, dst_pixels_per_line, 16,
michael@0 104 &xsum0, &xxsum0);
michael@0 105 }
michael@0 106 else
michael@0 107 {
michael@0 108 vp8_filter_block2d_bil_var_ssse3(
michael@0 109 src_ptr, src_pixels_per_line,
michael@0 110 dst_ptr, dst_pixels_per_line, 16,
michael@0 111 xoffset, yoffset,
michael@0 112 &xsum0, &xxsum0);
michael@0 113 }
michael@0 114
michael@0 115 *sse = xxsum0;
michael@0 116 return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
michael@0 117 }
michael@0 118
michael@0 119 unsigned int vp8_sub_pixel_variance16x8_ssse3
michael@0 120 (
michael@0 121 const unsigned char *src_ptr,
michael@0 122 int src_pixels_per_line,
michael@0 123 int xoffset,
michael@0 124 int yoffset,
michael@0 125 const unsigned char *dst_ptr,
michael@0 126 int dst_pixels_per_line,
michael@0 127 unsigned int *sse
michael@0 128
michael@0 129 )
michael@0 130 {
michael@0 131 int xsum0;
michael@0 132 unsigned int xxsum0;
michael@0 133
michael@0 134 if (xoffset == 4 && yoffset == 0)
michael@0 135 {
michael@0 136 vp8_half_horiz_variance16x_h_sse2(
michael@0 137 src_ptr, src_pixels_per_line,
michael@0 138 dst_ptr, dst_pixels_per_line, 8,
michael@0 139 &xsum0, &xxsum0);
michael@0 140 }
michael@0 141 else if (xoffset == 0 && yoffset == 4)
michael@0 142 {
michael@0 143 vp8_half_vert_variance16x_h_sse2(
michael@0 144 src_ptr, src_pixels_per_line,
michael@0 145 dst_ptr, dst_pixels_per_line, 8,
michael@0 146 &xsum0, &xxsum0);
michael@0 147 }
michael@0 148 else if (xoffset == 4 && yoffset == 4)
michael@0 149 {
michael@0 150 vp8_half_horiz_vert_variance16x_h_sse2(
michael@0 151 src_ptr, src_pixels_per_line,
michael@0 152 dst_ptr, dst_pixels_per_line, 8,
michael@0 153 &xsum0, &xxsum0);
michael@0 154 }
michael@0 155 else
michael@0 156 {
michael@0 157 vp8_filter_block2d_bil_var_ssse3(
michael@0 158 src_ptr, src_pixels_per_line,
michael@0 159 dst_ptr, dst_pixels_per_line, 8,
michael@0 160 xoffset, yoffset,
michael@0 161 &xsum0, &xxsum0);
michael@0 162 }
michael@0 163
michael@0 164 *sse = xxsum0;
michael@0 165 return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 7));
michael@0 166 }

mercurial