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 #include "vpx_mem/vpx_mem.h"
14 
vp8_dequant_idct_add_y_block_c(short * q,short * dq,unsigned char * dst,int stride,char * eobs)15 void vp8_dequant_idct_add_y_block_c(short *q, short *dq, unsigned char *dst,
16                                     int stride, char *eobs) {
17   int i, j;
18 
19   for (i = 0; i < 4; ++i) {
20     for (j = 0; j < 4; ++j) {
21       if (*eobs++ > 1) {
22         vp8_dequant_idct_add_c(q, dq, dst, stride);
23       } else {
24         vp8_dc_only_idct_add_c(q[0] * dq[0], dst, stride, dst, stride);
25         memset(q, 0, 2 * sizeof(q[0]));
26       }
27 
28       q += 16;
29       dst += 4;
30     }
31 
32     dst += 4 * stride - 16;
33   }
34 }
35 
vp8_dequant_idct_add_uv_block_c(short * q,short * dq,unsigned char * dst_u,unsigned char * dst_v,int stride,char * eobs)36 void vp8_dequant_idct_add_uv_block_c(short *q, short *dq, unsigned char *dst_u,
37                                      unsigned char *dst_v, int stride,
38                                      char *eobs) {
39   int i, j;
40 
41   for (i = 0; i < 2; ++i) {
42     for (j = 0; j < 2; ++j) {
43       if (*eobs++ > 1) {
44         vp8_dequant_idct_add_c(q, dq, dst_u, stride);
45       } else {
46         vp8_dc_only_idct_add_c(q[0] * dq[0], dst_u, stride, dst_u, stride);
47         memset(q, 0, 2 * sizeof(q[0]));
48       }
49 
50       q += 16;
51       dst_u += 4;
52     }
53 
54     dst_u += 4 * stride - 8;
55   }
56 
57   for (i = 0; i < 2; ++i) {
58     for (j = 0; j < 2; ++j) {
59       if (*eobs++ > 1) {
60         vp8_dequant_idct_add_c(q, dq, dst_v, stride);
61       } else {
62         vp8_dc_only_idct_add_c(q[0] * dq[0], dst_v, stride, dst_v, stride);
63         memset(q, 0, 2 * sizeof(q[0]));
64       }
65 
66       q += 16;
67       dst_v += 4;
68     }
69 
70     dst_v += 4 * stride - 8;
71   }
72 }
73