annotate vc1dsp.c @ 3679:2702eec8c8b9 libavcodec

Try to handle all chunks, previous scheme was not correct.
author kostya
date Tue, 05 Sep 2006 07:31:53 +0000
parents 9d942506b1f2
children c8c591fe26f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3526
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
1 /*
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
2 * VC-1 and WMV3 decoder - DSP functions
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
3 * Copyright (c) 2006 Konstantin Shishkov
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
4 *
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
9 *
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
13 * Lesser General Public License for more details.
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
14 *
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
18 *
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
19 */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
20
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
21 /**
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
22 * @file vc1dsp.c
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
23 * VC-1 and WMV3 decoder
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
24 *
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
25 */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
26
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
27 #include "dsputil.h"
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
28
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
29
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
30 /** Apply overlap transform to vertical edge
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
31 */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
32 static void vc1_v_overlap_c(uint8_t* src, int stride, int rnd)
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
33 {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
34 int i;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
35 int a, b, c, d;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
36 for(i = 0; i < 8; i++) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
37 a = src[-2*stride];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
38 b = src[-stride];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
39 c = src[0];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
40 d = src[stride];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
41
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
42 src[-2*stride] = clip_uint8((7*a + d + 4 - rnd) >> 3);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
43 src[-stride] = clip_uint8((-a + 7*b + c + d + 3 + rnd) >> 3);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
44 src[0] = clip_uint8((a + b + 7*c - d + 4 - rnd) >> 3);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
45 src[stride] = clip_uint8((a + 7*d + 3 + rnd) >> 3);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
46 src++;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
47 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
48 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
49
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
50 /** Apply overlap transform to horizontal edge
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
51 */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
52 static void vc1_h_overlap_c(uint8_t* src, int stride, int rnd)
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
53 {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
54 int i;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
55 int a, b, c, d;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
56 for(i = 0; i < 8; i++) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
57 a = src[-2];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
58 b = src[-1];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
59 c = src[0];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
60 d = src[1];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
61
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
62 src[-2] = clip_uint8((7*a + d + 4 - rnd) >> 3);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
63 src[-1] = clip_uint8((-a + 7*b + c + d + 3 + rnd) >> 3);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
64 src[0] = clip_uint8((a + b + 7*c - d + 4 - rnd) >> 3);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
65 src[1] = clip_uint8((a + 7*d + 3 + rnd) >> 3);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
66 src += stride;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
67 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
68 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
69
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
70
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
71 /** Do inverse transform on 8x8 block
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
72 */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
73 static void vc1_inv_trans_8x8_c(DCTELEM block[64])
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
74 {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
75 int i;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
76 register int t1,t2,t3,t4,t5,t6,t7,t8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
77 DCTELEM *src, *dst;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
78
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
79 src = block;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
80 dst = block;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
81 for(i = 0; i < 8; i++){
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
82 t1 = 12 * (src[0] + src[4]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
83 t2 = 12 * (src[0] - src[4]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
84 t3 = 16 * src[2] + 6 * src[6];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
85 t4 = 6 * src[2] - 16 * src[6];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
86
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
87 t5 = t1 + t3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
88 t6 = t2 + t4;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
89 t7 = t2 - t4;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
90 t8 = t1 - t3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
91
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
92 t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
93 t2 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
94 t3 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
95 t4 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
96
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
97 dst[0] = (t5 + t1 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
98 dst[1] = (t6 + t2 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
99 dst[2] = (t7 + t3 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
100 dst[3] = (t8 + t4 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
101 dst[4] = (t8 - t4 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
102 dst[5] = (t7 - t3 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
103 dst[6] = (t6 - t2 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
104 dst[7] = (t5 - t1 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
105
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
106 src += 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
107 dst += 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
108 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
109
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
110 src = block;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
111 dst = block;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
112 for(i = 0; i < 8; i++){
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
113 t1 = 12 * (src[ 0] + src[32]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
114 t2 = 12 * (src[ 0] - src[32]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
115 t3 = 16 * src[16] + 6 * src[48];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
116 t4 = 6 * src[16] - 16 * src[48];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
117
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
118 t5 = t1 + t3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
119 t6 = t2 + t4;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
120 t7 = t2 - t4;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
121 t8 = t1 - t3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
122
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
123 t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
124 t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
125 t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
126 t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
127
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
128 dst[ 0] = (t5 + t1 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
129 dst[ 8] = (t6 + t2 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
130 dst[16] = (t7 + t3 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
131 dst[24] = (t8 + t4 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
132 dst[32] = (t8 - t4 + 64 + 1) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
133 dst[40] = (t7 - t3 + 64 + 1) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
134 dst[48] = (t6 - t2 + 64 + 1) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
135 dst[56] = (t5 - t1 + 64 + 1) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
136
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
137 src++;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
138 dst++;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
139 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
140 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
141
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
142 /** Do inverse transform on 8x4 part of block
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
143 */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
144 static void vc1_inv_trans_8x4_c(DCTELEM block[64], int n)
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
145 {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
146 int i;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
147 register int t1,t2,t3,t4,t5,t6,t7,t8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
148 DCTELEM *src, *dst;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
149 int off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
150
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
151 off = n * 32;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
152 src = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
153 dst = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
154 for(i = 0; i < 4; i++){
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
155 t1 = 12 * (src[0] + src[4]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
156 t2 = 12 * (src[0] - src[4]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
157 t3 = 16 * src[2] + 6 * src[6];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
158 t4 = 6 * src[2] - 16 * src[6];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
159
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
160 t5 = t1 + t3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
161 t6 = t2 + t4;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
162 t7 = t2 - t4;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
163 t8 = t1 - t3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
164
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
165 t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
166 t2 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
167 t3 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
168 t4 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
169
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
170 dst[0] = (t5 + t1 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
171 dst[1] = (t6 + t2 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
172 dst[2] = (t7 + t3 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
173 dst[3] = (t8 + t4 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
174 dst[4] = (t8 - t4 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
175 dst[5] = (t7 - t3 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
176 dst[6] = (t6 - t2 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
177 dst[7] = (t5 - t1 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
178
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
179 src += 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
180 dst += 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
181 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
182
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
183 src = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
184 dst = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
185 for(i = 0; i < 8; i++){
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
186 t1 = 17 * (src[ 0] + src[16]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
187 t2 = 17 * (src[ 0] - src[16]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
188 t3 = 22 * src[ 8];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
189 t4 = 22 * src[24];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
190 t5 = 10 * src[ 8];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
191 t6 = 10 * src[24];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
192
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
193 dst[ 0] = (t1 + t3 + t6 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
194 dst[ 8] = (t2 - t4 + t5 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
195 dst[16] = (t2 + t4 - t5 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
196 dst[24] = (t1 - t3 - t6 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
197
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
198 src ++;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
199 dst ++;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
200 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
201 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
202
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
203 /** Do inverse transform on 4x8 parts of block
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
204 */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
205 static void vc1_inv_trans_4x8_c(DCTELEM block[64], int n)
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
206 {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
207 int i;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
208 register int t1,t2,t3,t4,t5,t6,t7,t8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
209 DCTELEM *src, *dst;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
210 int off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
211
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
212 off = n * 4;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
213 src = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
214 dst = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
215 for(i = 0; i < 8; i++){
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
216 t1 = 17 * (src[0] + src[2]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
217 t2 = 17 * (src[0] - src[2]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
218 t3 = 22 * src[1];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
219 t4 = 22 * src[3];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
220 t5 = 10 * src[1];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
221 t6 = 10 * src[3];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
222
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
223 dst[0] = (t1 + t3 + t6 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
224 dst[1] = (t2 - t4 + t5 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
225 dst[2] = (t2 + t4 - t5 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
226 dst[3] = (t1 - t3 - t6 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
227
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
228 src += 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
229 dst += 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
230 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
231
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
232 src = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
233 dst = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
234 for(i = 0; i < 4; i++){
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
235 t1 = 12 * (src[ 0] + src[32]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
236 t2 = 12 * (src[ 0] - src[32]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
237 t3 = 16 * src[16] + 6 * src[48];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
238 t4 = 6 * src[16] - 16 * src[48];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
239
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
240 t5 = t1 + t3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
241 t6 = t2 + t4;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
242 t7 = t2 - t4;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
243 t8 = t1 - t3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
244
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
245 t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
246 t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
247 t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
248 t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
249
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
250 dst[ 0] = (t5 + t1 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
251 dst[ 8] = (t6 + t2 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
252 dst[16] = (t7 + t3 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
253 dst[24] = (t8 + t4 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
254 dst[32] = (t8 - t4 + 64 + 1) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
255 dst[40] = (t7 - t3 + 64 + 1) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
256 dst[48] = (t6 - t2 + 64 + 1) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
257 dst[56] = (t5 - t1 + 64 + 1) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
258
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
259 src++;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
260 dst++;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
261 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
262 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
263
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
264 /** Do inverse transform on 4x4 part of block
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
265 */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
266 static void vc1_inv_trans_4x4_c(DCTELEM block[64], int n)
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
267 {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
268 int i;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
269 register int t1,t2,t3,t4,t5,t6;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
270 DCTELEM *src, *dst;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
271 int off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
272
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
273 off = (n&1) * 4 + (n&2) * 16;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
274 src = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
275 dst = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
276 for(i = 0; i < 4; i++){
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
277 t1 = 17 * (src[0] + src[2]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
278 t2 = 17 * (src[0] - src[2]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
279 t3 = 22 * src[1];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
280 t4 = 22 * src[3];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
281 t5 = 10 * src[1];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
282 t6 = 10 * src[3];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
283
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
284 dst[0] = (t1 + t3 + t6 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
285 dst[1] = (t2 - t4 + t5 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
286 dst[2] = (t2 + t4 - t5 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
287 dst[3] = (t1 - t3 - t6 + 4) >> 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
288
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
289 src += 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
290 dst += 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
291 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
292
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
293 src = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
294 dst = block + off;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
295 for(i = 0; i < 4; i++){
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
296 t1 = 17 * (src[ 0] + src[16]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
297 t2 = 17 * (src[ 0] - src[16]);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
298 t3 = 22 * src[ 8];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
299 t4 = 22 * src[24];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
300 t5 = 10 * src[ 8];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
301 t6 = 10 * src[24];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
302
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
303 dst[ 0] = (t1 + t3 + t6 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
304 dst[ 8] = (t2 - t4 + t5 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
305 dst[16] = (t2 + t4 - t5 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
306 dst[24] = (t1 - t3 - t6 + 64) >> 7;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
307
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
308 src ++;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
309 dst ++;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
310 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
311 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
312
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
313 /* motion compensation functions */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
314
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
315 /** Filter used to interpolate fractional pel values
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
316 */
3529
b8656dfe6b1a Fix overflows in bicubic interpolation.
kostya
parents: 3526
diff changeset
317 static always_inline int vc1_mspel_filter(const uint8_t *src, int stride, int mode, int r)
3526
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
318 {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
319 switch(mode){
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
320 case 0: //no shift
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
321 return src[0];
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
322 case 1: // 1/4 shift
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
323 return (-4*src[-stride] + 53*src[0] + 18*src[stride] - 3*src[stride*2] + 32 - r) >> 6;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
324 case 2: // 1/2 shift
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
325 return (-src[-stride] + 9*src[0] + 9*src[stride] - src[stride*2] + 8 - r) >> 4;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
326 case 3: // 3/4 shift
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
327 return (-3*src[-stride] + 18*src[0] + 53*src[stride] - 4*src[stride*2] + 32 - r) >> 6;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
328 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
329 return 0; //should not occur
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
330 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
331
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
332 /** Function used to do motion compensation with bicubic interpolation
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
333 */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
334 static void vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int mode, int rnd)
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
335 {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
336 int i, j;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
337 uint8_t tmp[8*11], *tptr;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
338 int m, r;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
339
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
340 m = (mode & 3);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
341 r = rnd;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
342 src -= stride;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
343 tptr = tmp;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
344 for(j = 0; j < 11; j++) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
345 for(i = 0; i < 8; i++)
3529
b8656dfe6b1a Fix overflows in bicubic interpolation.
kostya
parents: 3526
diff changeset
346 tptr[i] = clip_uint8(vc1_mspel_filter(src + i, 1, m, r));
3526
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
347 src += stride;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
348 tptr += 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
349 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
350 r = 1 - rnd;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
351 m = (mode >> 2) & 3;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
352
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
353 tptr = tmp + 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
354 for(j = 0; j < 8; j++) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
355 for(i = 0; i < 8; i++)
3529
b8656dfe6b1a Fix overflows in bicubic interpolation.
kostya
parents: 3526
diff changeset
356 dst[i] = clip_uint8(vc1_mspel_filter(tptr + i, 8, m, r));
3526
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
357 dst += stride;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
358 tptr += 8;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
359 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
360 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
361
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
362 /* pixel functions - really are entry points to vc1_mspel_mc */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
363
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
364 /* this one is defined in dsputil.c */
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
365 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
366
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
367 static void ff_put_vc1_mspel_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
368 vc1_mspel_mc(dst, src, stride, 0x1, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
369 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
370
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
371 static void ff_put_vc1_mspel_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
372 vc1_mspel_mc(dst, src, stride, 0x2, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
373 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
374
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
375 static void ff_put_vc1_mspel_mc30_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
376 vc1_mspel_mc(dst, src, stride, 0x3, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
377 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
378
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
379 static void ff_put_vc1_mspel_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
380 vc1_mspel_mc(dst, src, stride, 0x4, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
381 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
382
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
383 static void ff_put_vc1_mspel_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
384 vc1_mspel_mc(dst, src, stride, 0x5, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
385 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
386
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
387 static void ff_put_vc1_mspel_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
388 vc1_mspel_mc(dst, src, stride, 0x6, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
389 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
390
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
391 static void ff_put_vc1_mspel_mc31_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
392 vc1_mspel_mc(dst, src, stride, 0x7, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
393 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
394
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
395 static void ff_put_vc1_mspel_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
396 vc1_mspel_mc(dst, src, stride, 0x8, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
397 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
398
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
399 static void ff_put_vc1_mspel_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
400 vc1_mspel_mc(dst, src, stride, 0x9, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
401 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
402
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
403 static void ff_put_vc1_mspel_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
404 vc1_mspel_mc(dst, src, stride, 0xA, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
405 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
406
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
407 static void ff_put_vc1_mspel_mc32_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
408 vc1_mspel_mc(dst, src, stride, 0xB, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
409 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
410
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
411 static void ff_put_vc1_mspel_mc03_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
412 vc1_mspel_mc(dst, src, stride, 0xC, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
413 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
414
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
415 static void ff_put_vc1_mspel_mc13_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
416 vc1_mspel_mc(dst, src, stride, 0xD, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
417 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
418
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
419 static void ff_put_vc1_mspel_mc23_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
420 vc1_mspel_mc(dst, src, stride, 0xE, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
421 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
422
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
423 static void ff_put_vc1_mspel_mc33_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
424 vc1_mspel_mc(dst, src, stride, 0xF, rnd);
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
425 }
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
426
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
427 void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
428 dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
429 dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
430 dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
431 dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
432 dsp->vc1_h_overlap = vc1_h_overlap_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
433 dsp->vc1_v_overlap = vc1_v_overlap_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
434
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
435 dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
436 dsp->put_vc1_mspel_pixels_tab[ 1] = ff_put_vc1_mspel_mc10_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
437 dsp->put_vc1_mspel_pixels_tab[ 2] = ff_put_vc1_mspel_mc20_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
438 dsp->put_vc1_mspel_pixels_tab[ 3] = ff_put_vc1_mspel_mc30_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
439 dsp->put_vc1_mspel_pixels_tab[ 4] = ff_put_vc1_mspel_mc01_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
440 dsp->put_vc1_mspel_pixels_tab[ 5] = ff_put_vc1_mspel_mc11_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
441 dsp->put_vc1_mspel_pixels_tab[ 6] = ff_put_vc1_mspel_mc21_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
442 dsp->put_vc1_mspel_pixels_tab[ 7] = ff_put_vc1_mspel_mc31_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
443 dsp->put_vc1_mspel_pixels_tab[ 8] = ff_put_vc1_mspel_mc02_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
444 dsp->put_vc1_mspel_pixels_tab[ 9] = ff_put_vc1_mspel_mc12_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
445 dsp->put_vc1_mspel_pixels_tab[10] = ff_put_vc1_mspel_mc22_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
446 dsp->put_vc1_mspel_pixels_tab[11] = ff_put_vc1_mspel_mc32_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
447 dsp->put_vc1_mspel_pixels_tab[12] = ff_put_vc1_mspel_mc03_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
448 dsp->put_vc1_mspel_pixels_tab[13] = ff_put_vc1_mspel_mc13_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
449 dsp->put_vc1_mspel_pixels_tab[14] = ff_put_vc1_mspel_mc23_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
450 dsp->put_vc1_mspel_pixels_tab[15] = ff_put_vc1_mspel_mc33_c;
7dc8e4a12105 New functions in DSPContext for VC-1 decoding
kostya
parents:
diff changeset
451 }