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
14void vp8_dequant_idct_add_y_block_mmi(int16_t *q, int16_t *dq, uint8_t *dst,
15                                      int stride, int8_t *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
35void vp8_dequant_idct_add_uv_block_mmi(int16_t *q, int16_t *dq, uint8_t *dstu,
36                                       uint8_t *dstv, int stride,
37                                       int8_t *eobs) {
38  int i, j;
39
40  for (i = 0; i < 2; i++) {
41    for (j = 0; j < 2; j++) {
42      if (*eobs++ > 1) {
43        vp8_dequant_idct_add_mmi(q, dq, dstu, stride);
44      } else {
45        vp8_dc_only_idct_add_mmi(q[0] * dq[0], dstu, stride, dstu, stride);
46        memset(q, 0, 2 * sizeof(q[0]));
47      }
48
49      q += 16;
50      dstu += 4;
51    }
52
53    dstu += 4 * stride - 8;
54  }
55
56  for (i = 0; i < 2; i++) {
57    for (j = 0; j < 2; j++) {
58      if (*eobs++ > 1) {
59        vp8_dequant_idct_add_mmi(q, dq, dstv, stride);
60      } else {
61        vp8_dc_only_idct_add_mmi(q[0] * dq[0], dstv, stride, dstv, stride);
62        memset(q, 0, 2 * sizeof(q[0]));
63      }
64
65      q += 16;
66      dstv += 4;
67    }
68
69    dstv += 4 * stride - 8;
70  }
71}
72