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
14
15void vp8_dequant_idct_add_y_block_v6(short *q, short *dq,
16                                     unsigned char *dst,
17                                     int stride, char *eobs)
18{
19    int i;
20
21    for (i = 0; i < 4; i++)
22    {
23        if (eobs[0] > 1)
24            vp8_dequant_idct_add_v6 (q, dq, dst, stride);
25        else if (eobs[0] == 1)
26        {
27            vp8_dc_only_idct_add_v6 (q[0]*dq[0], dst, stride, dst, stride);
28            ((int *)q)[0] = 0;
29        }
30
31        if (eobs[1] > 1)
32            vp8_dequant_idct_add_v6 (q+16, dq, dst+4, stride);
33        else if (eobs[1] == 1)
34        {
35            vp8_dc_only_idct_add_v6 (q[16]*dq[0], dst+4, stride, dst+4, stride);
36            ((int *)(q+16))[0] = 0;
37        }
38
39        if (eobs[2] > 1)
40            vp8_dequant_idct_add_v6 (q+32, dq, dst+8, stride);
41        else if (eobs[2] == 1)
42        {
43            vp8_dc_only_idct_add_v6 (q[32]*dq[0], dst+8, stride, dst+8, stride);
44            ((int *)(q+32))[0] = 0;
45        }
46
47        if (eobs[3] > 1)
48            vp8_dequant_idct_add_v6 (q+48, dq, dst+12, stride);
49        else if (eobs[3] == 1)
50        {
51            vp8_dc_only_idct_add_v6 (q[48]*dq[0], dst+12, stride,dst+12,stride);
52            ((int *)(q+48))[0] = 0;
53        }
54
55        q    += 64;
56        dst  += 4*stride;
57        eobs += 4;
58    }
59}
60
61void vp8_dequant_idct_add_uv_block_v6(short *q, short *dq,
62                                      unsigned char *dstu,
63                                      unsigned char *dstv,
64                                      int stride, char *eobs)
65{
66    int i;
67
68    for (i = 0; i < 2; i++)
69    {
70        if (eobs[0] > 1)
71            vp8_dequant_idct_add_v6 (q, dq, dstu, stride);
72        else if (eobs[0] == 1)
73        {
74            vp8_dc_only_idct_add_v6 (q[0]*dq[0], dstu, stride, dstu, stride);
75            ((int *)q)[0] = 0;
76        }
77
78        if (eobs[1] > 1)
79            vp8_dequant_idct_add_v6 (q+16, dq, dstu+4, stride);
80        else if (eobs[1] == 1)
81        {
82            vp8_dc_only_idct_add_v6 (q[16]*dq[0], dstu+4, stride,
83                                                  dstu+4, stride);
84            ((int *)(q+16))[0] = 0;
85        }
86
87        q    += 32;
88        dstu += 4*stride;
89        eobs += 2;
90    }
91
92    for (i = 0; i < 2; i++)
93    {
94        if (eobs[0] > 1)
95            vp8_dequant_idct_add_v6 (q, dq, dstv, stride);
96        else if (eobs[0] == 1)
97        {
98            vp8_dc_only_idct_add_v6 (q[0]*dq[0], dstv, stride, dstv, stride);
99            ((int *)q)[0] = 0;
100        }
101
102        if (eobs[1] > 1)
103            vp8_dequant_idct_add_v6 (q+16, dq, dstv+4, stride);
104        else if (eobs[1] == 1)
105        {
106            vp8_dc_only_idct_add_v6 (q[16]*dq[0], dstv+4, stride,
107                                                  dstv+4, stride);
108            ((int *)(q+16))[0] = 0;
109        }
110
111        q    += 32;
112        dstv += 4*stride;
113        eobs += 2;
114    }
115}
116