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