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