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 "vp8_rtcd.h"
13
14void vp8_idct_dequant_0_2x_sse2(short *q, short *dq, unsigned char *dst,
15                                int dst_stride);
16void vp8_idct_dequant_full_2x_sse2(short *q, short *dq, unsigned char *dst,
17                                   int dst_stride);
18
19void vp8_dequant_idct_add_y_block_sse2(short *q, short *dq, unsigned char *dst,
20                                       int stride, char *eobs) {
21  int i;
22
23  for (i = 0; i < 4; ++i) {
24    if (((short *)(eobs))[0]) {
25      if (((short *)(eobs))[0] & 0xfefe) {
26        vp8_idct_dequant_full_2x_sse2(q, dq, dst, stride);
27      } else {
28        vp8_idct_dequant_0_2x_sse2(q, dq, dst, stride);
29      }
30    }
31    if (((short *)(eobs))[1]) {
32      if (((short *)(eobs))[1] & 0xfefe) {
33        vp8_idct_dequant_full_2x_sse2(q + 32, dq, dst + 8, stride);
34      } else {
35        vp8_idct_dequant_0_2x_sse2(q + 32, dq, dst + 8, stride);
36      }
37    }
38    q += 64;
39    dst += stride * 4;
40    eobs += 4;
41  }
42}
43
44void vp8_dequant_idct_add_uv_block_sse2(short *q, short *dq,
45                                        unsigned char *dstu,
46                                        unsigned char *dstv, int stride,
47                                        char *eobs) {
48  if (((short *)(eobs))[0]) {
49    if (((short *)(eobs))[0] & 0xfefe) {
50      vp8_idct_dequant_full_2x_sse2(q, dq, dstu, stride);
51    } else {
52      vp8_idct_dequant_0_2x_sse2(q, dq, dstu, stride);
53    }
54  }
55  q += 32;
56  dstu += stride * 4;
57
58  if (((short *)(eobs))[1]) {
59    if (((short *)(eobs))[1] & 0xfefe) {
60      vp8_idct_dequant_full_2x_sse2(q, dq, dstu, stride);
61    } else {
62      vp8_idct_dequant_0_2x_sse2(q, dq, dstu, stride);
63    }
64  }
65  q += 32;
66
67  if (((short *)(eobs))[2]) {
68    if (((short *)(eobs))[2] & 0xfefe) {
69      vp8_idct_dequant_full_2x_sse2(q, dq, dstv, stride);
70    } else {
71      vp8_idct_dequant_0_2x_sse2(q, dq, dstv, stride);
72    }
73  }
74  q += 32;
75  dstv += stride * 4;
76
77  if (((short *)(eobs))[3]) {
78    if (((short *)(eobs))[3] & 0xfefe) {
79      vp8_idct_dequant_full_2x_sse2(q, dq, dstv, stride);
80    } else {
81      vp8_idct_dequant_0_2x_sse2(q, dq, dstv, stride);
82    }
83  }
84}
85