1 /*
2 * Copyright (c) 2013 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 <assert.h>
12 #include <stdio.h>
13
14 #include "./vpx_config.h"
15 #include "./vp9_rtcd.h"
16 #include "vp9/common/vp9_common.h"
17 #include "vp9/common/vp9_blockd.h"
18 #include "vpx_dsp/mips/inv_txfm_dspr2.h"
19 #include "vpx_dsp/txfm_common.h"
20 #include "vpx_ports/mem.h"
21
22 #if HAVE_DSPR2
vp9_iht8x8_64_add_dspr2(const int16_t * input,uint8_t * dest,int dest_stride,int tx_type)23 void vp9_iht8x8_64_add_dspr2(const int16_t *input, uint8_t *dest,
24 int dest_stride, int tx_type) {
25 int i, j;
26 DECLARE_ALIGNED(32, int16_t, out[8 * 8]);
27 int16_t *outptr = out;
28 int16_t temp_in[8 * 8], temp_out[8];
29 uint32_t pos = 45;
30
31 /* bit positon for extract from acc */
32 __asm__ __volatile__ (
33 "wrdsp %[pos], 1 \n\t"
34 :
35 : [pos] "r" (pos)
36 );
37
38 switch (tx_type) {
39 case DCT_DCT: // DCT in both horizontal and vertical
40 idct8_rows_dspr2(input, outptr, 8);
41 idct8_columns_add_blk_dspr2(&out[0], dest, dest_stride);
42 break;
43 case ADST_DCT: // ADST in vertical, DCT in horizontal
44 idct8_rows_dspr2(input, outptr, 8);
45
46 for (i = 0; i < 8; ++i) {
47 iadst8_dspr2(&out[i * 8], temp_out);
48
49 for (j = 0; j < 8; ++j)
50 dest[j * dest_stride + i] =
51 clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5)
52 + dest[j * dest_stride + i]);
53 }
54 break;
55 case DCT_ADST: // DCT in vertical, ADST in horizontal
56 for (i = 0; i < 8; ++i) {
57 iadst8_dspr2(input, outptr);
58 input += 8;
59 outptr += 8;
60 }
61
62 for (i = 0; i < 8; ++i) {
63 for (j = 0; j < 8; ++j) {
64 temp_in[i * 8 + j] = out[j * 8 + i];
65 }
66 }
67 idct8_columns_add_blk_dspr2(&temp_in[0], dest, dest_stride);
68 break;
69 case ADST_ADST: // ADST in both directions
70 for (i = 0; i < 8; ++i) {
71 iadst8_dspr2(input, outptr);
72 input += 8;
73 outptr += 8;
74 }
75
76 for (i = 0; i < 8; ++i) {
77 for (j = 0; j < 8; ++j)
78 temp_in[j] = out[j * 8 + i];
79
80 iadst8_dspr2(temp_in, temp_out);
81
82 for (j = 0; j < 8; ++j)
83 dest[j * dest_stride + i] =
84 clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5)
85 + dest[j * dest_stride + i]);
86 }
87 break;
88 default:
89 printf("vp9_short_iht8x8_add_dspr2 : Invalid tx_type\n");
90 break;
91 }
92 }
93 #endif // #if HAVE_DSPR2
94