annotate RTjpegN.c @ 3802:bf37d5cd3e6e

used by NuppelVideo decoder
author alex
date Thu, 27 Dec 2001 21:27:29 +0000
parents
children 07d5beff8793
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3802
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1 /*
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2 RTjpeg (C) Justin Schoeman 1998 (justin@suntiger.ee.up.ac.za)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
4 With modifications by:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
5 (c) 1998, 1999 by Joerg Walter <trouble@moes.pmnet.uni-oldenburg.de>
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
6 and
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
7 (c) 1999 by Wim Taymans <wim.taymans@tvd.be>
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
8
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
12 (at your option) any later version.
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
17 GNU General Public License for more details.
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
18
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
20 along with this program; if not, write to the Free Software
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
22
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
23 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
24
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
25 #include <stdio.h>
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
26 #include <stdlib.h>
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
27 #include <string.h>
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
28 #include "RTjpegN.h"
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
29
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
30 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
31 #include "mmx.h"
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
32 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
33
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
34 //#define SHOWBLOCK 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
35 #define BETTERCOMPRESSION 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
36
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
37 static const unsigned char RTjpeg_ZZ[64]={
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
38 0,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
39 8, 1,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
40 2, 9, 16,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
41 24, 17, 10, 3,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
42 4, 11, 18, 25, 32,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
43 40, 33, 26, 19, 12, 5,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
44 6, 13, 20, 27, 34, 41, 48,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
45 56, 49, 42, 35, 28, 21, 14, 7,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
46 15, 22, 29, 36, 43, 50, 57,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
47 58, 51, 44, 37, 30, 23,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
48 31, 38, 45, 52, 59,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
49 60, 53, 46, 39,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
50 47, 54, 61,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
51 62, 55,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
52 63 };
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
53
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
54 static const __u64 RTjpeg_aan_tab[64]={
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
55 4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL, 3374581504ULL, 2324432128ULL, 1184891264ULL,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
56 5957222912ULL, 8263040512ULL, 7783580160ULL, 7005009920ULL, 5957222912ULL, 4680582144ULL, 3224107520ULL, 1643641088ULL,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
57 5611718144ULL, 7783580160ULL, 7331904512ULL, 6598688768ULL, 5611718144ULL, 4408998912ULL, 3036936960ULL, 1548224000ULL,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
58 5050464768ULL, 7005009920ULL, 6598688768ULL, 5938608128ULL, 5050464768ULL, 3968072960ULL, 2733115392ULL, 1393296000ULL,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
59 4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL, 3374581504ULL, 2324432128ULL, 1184891264ULL,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
60 3374581504ULL, 4680582144ULL, 4408998912ULL, 3968072960ULL, 3374581504ULL, 2651326208ULL, 1826357504ULL, 931136000ULL,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
61 2324432128ULL, 3224107520ULL, 3036936960ULL, 2733115392ULL, 2324432128ULL, 1826357504ULL, 1258030336ULL, 641204288ULL,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
62 1184891264ULL, 1643641088ULL, 1548224000ULL, 1393296000ULL, 1184891264ULL, 931136000ULL, 641204288ULL, 326894240ULL,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
63 };
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
64
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
65 #ifndef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
66 static __s32 RTjpeg_ws[64+31];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
67 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
68 __u8 RTjpeg_alldata[2*64+4*64+4*64+4*64+4*64+32];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
69
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
70 __s16 *block; // rh
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
71 __s16 *RTjpeg_block;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
72 __s32 *RTjpeg_lqt;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
73 __s32 *RTjpeg_cqt;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
74 __u32 *RTjpeg_liqt;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
75 __u32 *RTjpeg_ciqt;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
76
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
77 unsigned char RTjpeg_lb8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
78 unsigned char RTjpeg_cb8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
79 int RTjpeg_width, RTjpeg_height;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
80 int RTjpeg_Ywidth, RTjpeg_Cwidth;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
81 int RTjpeg_Ysize, RTjpeg_Csize;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
82
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
83 __s16 *RTjpeg_old=NULL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
84
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
85 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
86 mmx_t RTjpeg_lmask;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
87 mmx_t RTjpeg_cmask;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
88 #else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
89 __u16 RTjpeg_lmask;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
90 __u16 RTjpeg_cmask;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
91 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
92 int RTjpeg_mtest=0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
93
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
94 static const unsigned char RTjpeg_lum_quant_tbl[64] = {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
95 16, 11, 10, 16, 24, 40, 51, 61,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
96 12, 12, 14, 19, 26, 58, 60, 55,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
97 14, 13, 16, 24, 40, 57, 69, 56,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
98 14, 17, 22, 29, 51, 87, 80, 62,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
99 18, 22, 37, 56, 68, 109, 103, 77,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
100 24, 35, 55, 64, 81, 104, 113, 92,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
101 49, 64, 78, 87, 103, 121, 120, 101,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
102 72, 92, 95, 98, 112, 100, 103, 99
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
103 };
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
104
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
105 static const unsigned char RTjpeg_chrom_quant_tbl[64] = {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
106 17, 18, 24, 47, 99, 99, 99, 99,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
107 18, 21, 26, 66, 99, 99, 99, 99,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
108 24, 26, 56, 99, 99, 99, 99, 99,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
109 47, 66, 99, 99, 99, 99, 99, 99,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
110 99, 99, 99, 99, 99, 99, 99, 99,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
111 99, 99, 99, 99, 99, 99, 99, 99,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
112 99, 99, 99, 99, 99, 99, 99, 99,
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
113 99, 99, 99, 99, 99, 99, 99, 99
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
114 };
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
115
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
116 #ifdef BETTERCOMPRESSION
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
117
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
118 /*--------------------------------------------------*/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
119 /* better encoding, but needs a lot more cpu time */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
120 /* seems to be more effective than old method +lzo */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
121 /* with this encoding lzo isn't efficient anymore */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
122 /* there is still more potential for better */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
123 /* encoding but that would need even more cputime */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
124 /* anyway your mileage may vary */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
125 /* */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
126 /* written by Martin BIELY and Roman HOCHLEITNER */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
127 /*--------------------------------------------------*/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
128
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
129 /* +++++++++++++++++++++++++++++++++++++++++++++++++++*/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
130 /* Block to Stream (encoding) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
131 /* */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
132
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
133 int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
134 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
135 register int ci, co=1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
136 register __s16 ZZvalue;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
137 register unsigned char bitten;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
138 register unsigned char bitoff;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
139
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
140 #ifdef SHOWBLOCK
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
141
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
142 int ii;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
143 for (ii=0; ii < 64; ii++) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
144 fprintf(stdout, "%d ", data[RTjpeg_ZZ[ii]]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
145 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
146 fprintf(stdout, "\n\n");
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
147
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
148 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
149
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
150 // *strm++ = 0x10;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
151 // *strm = 0x00;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
152 //
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
153 // return 2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
154
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
155 // first byte allways written
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
156 (__u8)strm[0]=
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
157 (__u8)(data[RTjpeg_ZZ[0]]>254) ? 254:((data[RTjpeg_ZZ[0]]<0)?0:data[RTjpeg_ZZ[0]]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
158
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
159
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
160 ci=63;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
161 while (data[RTjpeg_ZZ[ci]]==0 && ci>0) ci--;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
162
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
163 bitten = ((unsigned char)ci) << 2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
164
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
165 if (ci==0) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
166 (__u8)strm[1]= bitten;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
167 co = 2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
168 return (int)co;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
169 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
170
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
171 /* bitoff=0 because the high 6bit contain first non zero position */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
172 bitoff = 0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
173 co = 1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
174
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
175 for(; ci>0; ci--) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
176
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
177 ZZvalue = data[RTjpeg_ZZ[ci]];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
178
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
179 switch(ZZvalue) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
180 case 0:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
181 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
182 case 1:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
183 bitten |= (0x01<<bitoff);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
184 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
185 case -1:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
186 bitten |= (0x03<<bitoff);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
187 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
188 default:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
189 bitten |= (0x02<<bitoff);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
190 goto HERZWEH;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
191 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
192 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
193
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
194 if( bitoff == 0 ) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
195 (__u8)strm[co]= bitten;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
196 bitten = 0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
197 bitoff = 8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
198 co++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
199 } /* "fall through" */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
200 bitoff-=2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
201
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
202 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
203
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
204 /* ci must be 0 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
205 if(bitoff != 6) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
206
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
207 (__u8)strm[co]= bitten;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
208 co++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
209
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
210 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
211 goto BAUCHWEH;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
212
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
213 HERZWEH:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
214 /* ci cannot be 0 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
215 /* correct bitoff to nibble boundaries */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
216
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
217 switch(bitoff){
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
218 case 4:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
219 case 6:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
220 bitoff = 0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
221 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
222 case 2:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
223 case 0:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
224 (__u8)strm[co]= bitten;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
225 bitoff = 4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
226 co++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
227 bitten = 0; // clear half nibble values in bitten
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
228 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
229 default:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
230 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
231 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
232
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
233 for(; ci>0; ci--) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
234
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
235 ZZvalue = data[RTjpeg_ZZ[ci]];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
236
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
237 if( (ZZvalue > 7) || (ZZvalue < -7) ) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
238 bitten |= (0x08<<bitoff);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
239 goto HIRNWEH;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
240 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
241
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
242 bitten |= (ZZvalue&0xf)<<bitoff;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
243
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
244 if( bitoff == 0 ) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
245 (__u8)strm[co]= bitten;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
246 bitten = 0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
247 bitoff = 8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
248 co++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
249 } /* "fall thru" */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
250 bitoff-=4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
251 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
252
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
253 /* ci must be 0 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
254 if( bitoff == 0 ) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
255 (__u8)strm[co]= bitten;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
256 co++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
257 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
258 goto BAUCHWEH;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
259
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
260 HIRNWEH:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
261
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
262 (__u8)strm[co]= bitten;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
263 co++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
264
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
265
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
266 /* bitting is over now we bite */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
267 for(; ci>0; ci--) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
268
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
269 ZZvalue = data[RTjpeg_ZZ[ci]];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
270
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
271 if(ZZvalue>0)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
272 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
273 strm[co++]=(__s8)(ZZvalue>127)?127:ZZvalue;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
274 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
275 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
276 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
277 strm[co++]=(__s8)(ZZvalue<-128)?-128:ZZvalue;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
278 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
279
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
280 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
281
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
282
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
283 BAUCHWEH:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
284 /* we gotoo much now we are ill */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
285 #ifdef SHOWBLOCK
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
286 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
287 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
288 fprintf(stdout, "\nco = '%d'\n", co);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
289 for (i=0; i < co+2; i++) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
290 fprintf(stdout, "%d ", strm[i]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
291 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
292 fprintf(stdout, "\n\n");
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
293 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
294 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
295
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
296 return (int)co;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
297 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
298
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
299 /* +++++++++++++++++++++++++++++++++++++++++++++++++++*/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
300 /* Stream to Block (decoding) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
301 /* */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
302
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
303 int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
304 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
305 int ci;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
306 register int co;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
307 register int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
308 register unsigned char bitten;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
309 register unsigned char bitoff;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
310
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
311 /* first byte always read */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
312 i=RTjpeg_ZZ[0];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
313 data[i]=((__u8)strm[0])*qtbl[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
314
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
315 /* we start at the behind */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
316
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
317 bitten = ((unsigned char)strm[1]) >> 2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
318 co = 63;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
319 for(; co > bitten; co--) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
320
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
321 data[RTjpeg_ZZ[co]] = 0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
322
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
323 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
324
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
325 if (co==0) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
326 ci = 2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
327 goto AUTOBAHN;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
328 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
329
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
330 /* we have to read the last 2 bits of the second byte */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
331 ci=1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
332 bitoff = 0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
333
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
334 for(; co>0; co--) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
335
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
336 bitten = ((unsigned char)strm[ci]) >> bitoff;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
337 bitten &= 0x03;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
338
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
339 i=RTjpeg_ZZ[co];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
340
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
341 switch( bitten ) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
342 case 0x03:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
343 data[i]= -qtbl[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
344 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
345 case 0x02:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
346 goto FUSSWEG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
347 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
348 case 0x01:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
349 data[i]= qtbl[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
350 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
351 case 0x00:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
352 data[i]= 0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
353 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
354 default:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
355
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
356 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
357
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
358 if( bitoff == 0 ) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
359 bitoff = 8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
360 ci++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
361 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
362 bitoff -= 2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
363 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
364 /* co is 0 now */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
365 /* data is written properly */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
366
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
367 /* if bitoff!=6 then ci is the index, but should be the byte count, so we increment by 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
368 if (bitoff!=6) ci++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
369
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
370 goto AUTOBAHN;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
371
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
372
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
373 FUSSWEG:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
374 /* correct bitoff to nibble */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
375 switch(bitoff){
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
376 case 4:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
377 case 6:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
378 bitoff = 0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
379 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
380 case 2:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
381 case 0:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
382 /* we have to read from the next byte */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
383 ci++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
384 bitoff = 4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
385 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
386 default:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
387 break;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
388 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
389
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
390 for(; co>0; co--) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
391
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
392 bitten = ((unsigned char)strm[ci]) >> bitoff;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
393 bitten &= 0x0f;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
394
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
395 i=RTjpeg_ZZ[co];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
396
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
397 if( bitten == 0x08 ) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
398 goto STRASSE;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
399 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
400
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
401 /* the compiler cannot do sign extension for signed nibbles */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
402 if( bitten & 0x08 ) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
403 bitten |= 0xf0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
404 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
405 /* the unsigned char bitten now is a valid signed char */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
406
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
407 data[i]=((signed char)bitten)*qtbl[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
408
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
409 if( bitoff == 0 ) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
410 bitoff = 8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
411 ci++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
412 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
413 bitoff -= 4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
414 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
415 /* co is 0 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
416
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
417 /* if bitoff!=4 then ci is the index, but should be the byte count, so we increment by 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
418 if (bitoff!=4) ci++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
419
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
420 goto AUTOBAHN;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
421
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
422 STRASSE:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
423 ci++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
424
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
425 for(; co>0; co--) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
426 i=RTjpeg_ZZ[co];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
427 data[i]=strm[ci++]*qtbl[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
428 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
429
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
430 /* ci now is the count, because it points to next element => no incrementing */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
431
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
432 AUTOBAHN:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
433
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
434 #ifdef SHOWBLOCK
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
435 fprintf(stdout, "\nci = '%d'\n", ci);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
436 for (i=0; i < 64; i++) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
437 fprintf(stdout, "%d ", data[RTjpeg_ZZ[i]]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
438 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
439 fprintf(stdout, "\n\n");
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
440 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
441
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
442 return ci;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
443 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
444
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
445 #else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
446
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
447 int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
448 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
449 register int ci, co=1, tmp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
450 register __s16 ZZvalue;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
451
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
452 #ifdef SHOWBLOCK
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
453
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
454 int ii;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
455 for (ii=0; ii < 64; ii++) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
456 fprintf(stdout, "%d ", data[RTjpeg_ZZ[ii]]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
457 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
458 fprintf(stdout, "\n\n");
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
459
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
460 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
461
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
462 (__u8)strm[0]=(__u8)(data[RTjpeg_ZZ[0]]>254) ? 254:((data[RTjpeg_ZZ[0]]<0)?0:data[RTjpeg_ZZ[0]]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
463
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
464 for(ci=1; ci<=bt8; ci++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
465 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
466 ZZvalue = data[RTjpeg_ZZ[ci]];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
467
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
468 if(ZZvalue>0)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
469 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
470 strm[co++]=(__s8)(ZZvalue>127)?127:ZZvalue;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
471 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
472 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
473 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
474 strm[co++]=(__s8)(ZZvalue<-128)?-128:ZZvalue;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
475 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
476 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
477
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
478 for(; ci<64; ci++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
479 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
480 ZZvalue = data[RTjpeg_ZZ[ci]];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
481
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
482 if(ZZvalue>0)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
483 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
484 strm[co++]=(__s8)(ZZvalue>63)?63:ZZvalue;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
485 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
486 else if(ZZvalue<0)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
487 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
488 strm[co++]=(__s8)(ZZvalue<-64)?-64:ZZvalue;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
489 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
490 else /* compress zeros */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
491 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
492 tmp=ci;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
493 do
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
494 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
495 ci++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
496 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
497 while((ci<64)&&(data[RTjpeg_ZZ[ci]]==0));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
498
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
499 strm[co++]=(__s8)(63+(ci-tmp));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
500 ci--;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
501 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
502 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
503 return (int)co;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
504 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
505
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
506 int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
507 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
508 int ci=1, co=1, tmp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
509 register int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
510
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
511 i=RTjpeg_ZZ[0];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
512 data[i]=((__u8)strm[0])*qtbl[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
513
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
514 for(co=1; co<=bt8; co++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
515 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
516 i=RTjpeg_ZZ[co];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
517 data[i]=strm[ci++]*qtbl[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
518 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
519
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
520 for(; co<64; co++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
521 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
522 if(strm[ci]>63)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
523 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
524 tmp=co+strm[ci]-63;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
525 for(; co<tmp; co++)data[RTjpeg_ZZ[co]]=0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
526 co--;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
527 } else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
528 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
529 i=RTjpeg_ZZ[co];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
530 data[i]=strm[ci]*qtbl[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
531 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
532 ci++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
533 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
534 return (int)ci;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
535 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
536 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
537
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
538 #if defined(MMX)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
539 void RTjpeg_quant_init(void)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
540 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
541 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
542 __s16 *qtbl;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
543
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
544 qtbl=(__s16 *)RTjpeg_lqt;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
545 for(i=0; i<64; i++)qtbl[i]=(__s16)RTjpeg_lqt[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
546
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
547 qtbl=(__s16 *)RTjpeg_cqt;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
548 for(i=0; i<64; i++)qtbl[i]=(__s16)RTjpeg_cqt[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
549 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
550
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
551 static mmx_t RTjpeg_ones=(mmx_t)(long long)0x0001000100010001LL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
552 static mmx_t RTjpeg_half=(mmx_t)(long long)0x7fff7fff7fff7fffLL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
553
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
554 void RTjpeg_quant(__s16 *block, __s32 *qtbl)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
555 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
556 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
557 mmx_t *bl, *ql;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
558
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
559 ql=(mmx_t *)qtbl;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
560 bl=(mmx_t *)block;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
561
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
562 movq_m2r(RTjpeg_ones, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
563 movq_m2r(RTjpeg_half, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
564
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
565 for(i=16; i; i--)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
566 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
567 movq_m2r(*(ql++), mm0); /* quant vals (4) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
568 movq_m2r(*bl, mm2); /* block vals (4) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
569 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
570 movq_r2r(mm2, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
571
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
572 punpcklwd_r2r(mm6, mm0); /* 1 qb 1 qa */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
573 punpckhwd_r2r(mm6, mm1); /* 1 qd 1 qc */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
574
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
575 punpcklwd_r2r(mm7, mm2); /* 32767 bb 32767 ba */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
576 punpckhwd_r2r(mm7, mm3); /* 32767 bd 32767 bc */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
577
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
578 pmaddwd_r2r(mm2, mm0); /* 32767+bb*qb 32767+ba*qa */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
579 pmaddwd_r2r(mm3, mm1); /* 32767+bd*qd 32767+bc*qc */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
580
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
581 psrad_i2r(16, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
582 psrad_i2r(16, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
583
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
584 packssdw_r2r(mm1, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
585
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
586 movq_r2m(mm0, *(bl++));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
587
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
588 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
589 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
590 #else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
591 void RTjpeg_quant_init(void)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
592 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
593 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
594
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
595 void RTjpeg_quant(__s16 *block, __s32 *qtbl)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
596 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
597 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
598
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
599 for(i=0; i<64; i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
600 block[i]=(__s16)((block[i]*qtbl[i]+32767)>>16);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
601 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
602 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
603
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
604 /*
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
605 * Perform the forward DCT on one block of samples.
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
606 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
607 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
608 static mmx_t RTjpeg_C4 =(mmx_t)(long long)0x2D412D412D412D41LL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
609 static mmx_t RTjpeg_C6 =(mmx_t)(long long)0x187E187E187E187ELL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
610 static mmx_t RTjpeg_C2mC6=(mmx_t)(long long)0x22A322A322A322A3LL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
611 static mmx_t RTjpeg_C2pC6=(mmx_t)(long long)0x539F539F539F539FLL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
612 static mmx_t RTjpeg_zero =(mmx_t)(long long)0x0000000000000000LL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
613
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
614 #else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
615
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
616 #define FIX_0_382683433 ((__s32) 98) /* FIX(0.382683433) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
617 #define FIX_0_541196100 ((__s32) 139) /* FIX(0.541196100) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
618 #define FIX_0_707106781 ((__s32) 181) /* FIX(0.707106781) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
619 #define FIX_1_306562965 ((__s32) 334) /* FIX(1.306562965) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
620
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
621 #define DESCALE10(x) (__s16)( ((x)+128) >> 8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
622 #define DESCALE20(x) (__s16)(((x)+32768) >> 16)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
623 #define D_MULTIPLY(var,const) ((__s32) ((var) * (const)))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
624 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
625
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
626 void RTjpeg_dct_init(void)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
627 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
628 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
629
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
630 for(i=0; i<64; i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
631 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
632 RTjpeg_lqt[i]=(((__u64)RTjpeg_lqt[i]<<32)/RTjpeg_aan_tab[i]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
633 RTjpeg_cqt[i]=(((__u64)RTjpeg_cqt[i]<<32)/RTjpeg_aan_tab[i]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
634 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
635 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
636
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
637 void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
638 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
639 #ifndef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
640 __s32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
641 __s32 tmp10, tmp11, tmp12, tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
642 __s32 z1, z2, z3, z4, z5, z11, z13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
643 __u8 *idataptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
644 __s16 *odataptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
645 __s32 *wsptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
646 int ctr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
647
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
648 idataptr = idata;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
649 wsptr = RTjpeg_ws;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
650 for (ctr = 7; ctr >= 0; ctr--) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
651 tmp0 = idataptr[0] + idataptr[7];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
652 tmp7 = idataptr[0] - idataptr[7];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
653 tmp1 = idataptr[1] + idataptr[6];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
654 tmp6 = idataptr[1] - idataptr[6];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
655 tmp2 = idataptr[2] + idataptr[5];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
656 tmp5 = idataptr[2] - idataptr[5];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
657 tmp3 = idataptr[3] + idataptr[4];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
658 tmp4 = idataptr[3] - idataptr[4];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
659
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
660 tmp10 = (tmp0 + tmp3); /* phase 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
661 tmp13 = tmp0 - tmp3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
662 tmp11 = (tmp1 + tmp2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
663 tmp12 = tmp1 - tmp2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
664
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
665 wsptr[0] = (tmp10 + tmp11)<<8; /* phase 3 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
666 wsptr[4] = (tmp10 - tmp11)<<8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
667
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
668 z1 = D_MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
669 wsptr[2] = (tmp13<<8) + z1; /* phase 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
670 wsptr[6] = (tmp13<<8) - z1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
671
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
672 tmp10 = tmp4 + tmp5; /* phase 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
673 tmp11 = tmp5 + tmp6;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
674 tmp12 = tmp6 + tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
675
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
676 z5 = D_MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
677 z2 = D_MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
678 z4 = D_MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
679 z3 = D_MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
680
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
681 z11 = (tmp7<<8) + z3; /* phase 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
682 z13 = (tmp7<<8) - z3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
683
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
684 wsptr[5] = z13 + z2; /* phase 6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
685 wsptr[3] = z13 - z2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
686 wsptr[1] = z11 + z4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
687 wsptr[7] = z11 - z4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
688
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
689 idataptr += rskip<<3; /* advance pointer to next row */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
690 wsptr += 8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
691 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
692
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
693 wsptr = RTjpeg_ws;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
694 odataptr=odata;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
695 for (ctr = 7; ctr >= 0; ctr--) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
696 tmp0 = wsptr[0] + wsptr[56];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
697 tmp7 = wsptr[0] - wsptr[56];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
698 tmp1 = wsptr[8] + wsptr[48];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
699 tmp6 = wsptr[8] - wsptr[48];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
700 tmp2 = wsptr[16] + wsptr[40];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
701 tmp5 = wsptr[16] - wsptr[40];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
702 tmp3 = wsptr[24] + wsptr[32];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
703 tmp4 = wsptr[24] - wsptr[32];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
704
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
705 tmp10 = tmp0 + tmp3; /* phase 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
706 tmp13 = tmp0 - tmp3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
707 tmp11 = tmp1 + tmp2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
708 tmp12 = tmp1 - tmp2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
709
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
710 odataptr[0] = DESCALE10(tmp10 + tmp11); /* phase 3 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
711 odataptr[32] = DESCALE10(tmp10 - tmp11);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
712
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
713 z1 = D_MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
714 odataptr[16] = DESCALE20((tmp13<<8) + z1); /* phase 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
715 odataptr[48] = DESCALE20((tmp13<<8) - z1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
716
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
717 tmp10 = tmp4 + tmp5; /* phase 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
718 tmp11 = tmp5 + tmp6;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
719 tmp12 = tmp6 + tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
720
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
721 z5 = D_MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
722 z2 = D_MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
723 z4 = D_MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
724 z3 = D_MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
725
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
726 z11 = (tmp7<<8) + z3; /* phase 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
727 z13 = (tmp7<<8) - z3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
728
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
729 odataptr[40] = DESCALE20(z13 + z2); /* phase 6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
730 odataptr[24] = DESCALE20(z13 - z2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
731 odataptr[8] = DESCALE20(z11 + z4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
732 odataptr[56] = DESCALE20(z11 - z4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
733
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
734 odataptr++; /* advance pointer to next column */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
735 wsptr++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
736 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
737 #else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
738 volatile mmx_t tmp6, tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
739 register mmx_t *dataptr = (mmx_t *)odata;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
740 mmx_t *idata2 = (mmx_t *)idata;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
741
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
742 // first copy the input 8 bit to the destination 16 bits
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
743
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
744 movq_m2r(RTjpeg_zero, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
745
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
746
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
747 movq_m2r(*idata2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
748 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
749
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
750 punpcklbw_r2r(mm2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
751 movq_r2m(mm0, *(dataptr));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
752
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
753 punpckhbw_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
754 movq_r2m(mm1, *(dataptr+1));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
755
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
756 idata2 += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
757
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
758 movq_m2r(*idata2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
759 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
760
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
761 punpcklbw_r2r(mm2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
762 movq_r2m(mm0, *(dataptr+2));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
763
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
764 punpckhbw_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
765 movq_r2m(mm1, *(dataptr+3));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
766
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
767 idata2 += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
768
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
769 movq_m2r(*idata2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
770 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
771
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
772 punpcklbw_r2r(mm2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
773 movq_r2m(mm0, *(dataptr+4));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
774
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
775 punpckhbw_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
776 movq_r2m(mm1, *(dataptr+5));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
777
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
778 idata2 += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
779
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
780 movq_m2r(*idata2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
781 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
782
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
783 punpcklbw_r2r(mm2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
784 movq_r2m(mm0, *(dataptr+6));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
785
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
786 punpckhbw_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
787 movq_r2m(mm1, *(dataptr+7));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
788
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
789 idata2 += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
790
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
791 movq_m2r(*idata2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
792 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
793
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
794 punpcklbw_r2r(mm2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
795 movq_r2m(mm0, *(dataptr+8));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
796
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
797 punpckhbw_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
798 movq_r2m(mm1, *(dataptr+9));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
799
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
800 idata2 += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
801
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
802 movq_m2r(*idata2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
803 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
804
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
805 punpcklbw_r2r(mm2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
806 movq_r2m(mm0, *(dataptr+10));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
807
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
808 punpckhbw_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
809 movq_r2m(mm1, *(dataptr+11));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
810
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
811 idata2 += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
812
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
813 movq_m2r(*idata2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
814 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
815
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
816 punpcklbw_r2r(mm2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
817 movq_r2m(mm0, *(dataptr+12));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
818
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
819 punpckhbw_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
820 movq_r2m(mm1, *(dataptr+13));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
821
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
822 idata2 += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
823
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
824 movq_m2r(*idata2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
825 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
826
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
827 punpcklbw_r2r(mm2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
828 movq_r2m(mm0, *(dataptr+14));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
829
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
830 punpckhbw_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
831 movq_r2m(mm1, *(dataptr+15));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
832
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
833 /* Start Transpose to do calculations on rows */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
834
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
835 movq_m2r(*(dataptr+9), mm7); // m03:m02|m01:m00 - first line (line 4)and copy into m5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
836
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
837 movq_m2r(*(dataptr+13), mm6); // m23:m22|m21:m20 - third line (line 6)and copy into m2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
838 movq_r2r(mm7, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
839
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
840 punpcklwd_m2r(*(dataptr+11), mm7); // m11:m01|m10:m00 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
841 movq_r2r(mm6, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
842
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
843 punpcklwd_m2r(*(dataptr+15), mm6); // m31:m21|m30:m20 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
844 movq_r2r(mm7, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
845
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
846 movq_m2r(*(dataptr+11), mm3); // m13:m13|m11:m10 - second line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
847 punpckldq_r2r(mm6, mm7); // m30:m20|m10:m00 - interleave to produce result 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
848
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
849 movq_m2r(*(dataptr+15), mm0); // m13:m13|m11:m10 - fourth line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
850 punpckhdq_r2r(mm6, mm1); // m31:m21|m11:m01 - interleave to produce result 2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
851
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
852 movq_r2m(mm7,*(dataptr+9)); // write result 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
853 punpckhwd_r2r(mm3, mm5); // m13:m03|m12:m02 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
854
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
855 movq_r2m(mm1,*(dataptr+11)); // write result 2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
856 punpckhwd_r2r(mm0, mm2); // m33:m23|m32:m22 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
857
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
858 movq_r2r(mm5, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
859 punpckldq_r2r(mm2, mm5); // m32:m22|m12:m02 - interleave to produce result 3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
860
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
861 movq_m2r(*(dataptr+1), mm0); // m03:m02|m01:m00 - first line, 4x4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
862 punpckhdq_r2r(mm2, mm1); // m33:m23|m13:m03 - interleave to produce result 4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
863
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
864 movq_r2m(mm5,*(dataptr+13)); // write result 3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
865
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
866 // last 4x4 done
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
867
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
868 movq_r2m(mm1, *(dataptr+15)); // write result 4, last 4x4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
869
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
870 movq_m2r(*(dataptr+5), mm2); // m23:m22|m21:m20 - third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
871 movq_r2r(mm0, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
872
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
873 punpcklwd_m2r(*(dataptr+3), mm0); // m11:m01|m10:m00 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
874 movq_r2r(mm2, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
875
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
876 punpcklwd_m2r(*(dataptr+7), mm2); // m31:m21|m30:m20 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
877 movq_r2r(mm0, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
878
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
879 //
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
880 movq_m2r(*(dataptr+8), mm1); // n03:n02|n01:n00 - first line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
881 punpckldq_r2r(mm2, mm0); // m30:m20|m10:m00 - interleave to produce first result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
882
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
883 movq_m2r(*(dataptr+12), mm3); // n23:n22|n21:n20 - third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
884 punpckhdq_r2r(mm2, mm4); // m31:m21|m11:m01 - interleave to produce second result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
885
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
886 punpckhwd_m2r(*(dataptr+3), mm6); // m13:m03|m12:m02 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
887 movq_r2r(mm1, mm2); // copy first line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
888
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
889 punpckhwd_m2r(*(dataptr+7), mm7); // m33:m23|m32:m22 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
890 movq_r2r(mm6, mm5); // copy first intermediate result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
891
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
892 movq_r2m(mm0, *(dataptr+8)); // write result 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
893 punpckhdq_r2r(mm7, mm5); // m33:m23|m13:m03 - produce third result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
894
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
895 punpcklwd_m2r(*(dataptr+10), mm1); // n11:n01|n10:n00 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
896 movq_r2r(mm3, mm0); // copy third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
897
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
898 punpckhwd_m2r(*(dataptr+10), mm2); // n13:n03|n12:n02 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
899
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
900 movq_r2m(mm4, *(dataptr+10)); // write result 2 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
901 punpckldq_r2r(mm7, mm6); // m32:m22|m12:m02 - produce fourth result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
902
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
903 punpcklwd_m2r(*(dataptr+14), mm3); // n31:n21|n30:n20 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
904 movq_r2r(mm1, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
905
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
906 movq_r2m(mm6, *(dataptr+12)); // write result 3 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
907 punpckldq_r2r(mm3, mm1); // n30:n20|n10:n00 - produce first result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
908
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
909 punpckhwd_m2r(*(dataptr+14), mm0); // n33:n23|n32:n22 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
910 movq_r2r(mm2, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
911
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
912 movq_r2m(mm5, *(dataptr+14)); // write result 4 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
913 punpckhdq_r2r(mm3, mm4); // n31:n21|n11:n01- produce second result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
914
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
915 movq_r2m(mm1, *(dataptr+1)); // write result 5 out - (first result for other 4 x 4 block)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
916 punpckldq_r2r(mm0, mm2); // n32:n22|n12:n02- produce third result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
917
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
918 movq_r2m(mm4, *(dataptr+3)); // write result 6 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
919 punpckhdq_r2r(mm0, mm6); // n33:n23|n13:n03 - produce fourth result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
920
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
921 movq_r2m(mm2, *(dataptr+5)); // write result 7 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
922
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
923 movq_m2r(*dataptr, mm0); // m03:m02|m01:m00 - first line, first 4x4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
924
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
925 movq_r2m(mm6, *(dataptr+7)); // write result 8 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
926
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
927
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
928 // Do first 4x4 quadrant, which is used in the beginning of the DCT:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
929
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
930 movq_m2r(*(dataptr+4), mm7); // m23:m22|m21:m20 - third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
931 movq_r2r(mm0, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
932
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
933 punpcklwd_m2r(*(dataptr+2), mm0); // m11:m01|m10:m00 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
934 movq_r2r(mm7, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
935
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
936 punpcklwd_m2r(*(dataptr+6), mm7); // m31:m21|m30:m20 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
937 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
938
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
939 movq_m2r(*(dataptr+2), mm6); // m13:m12|m11:m10 - second line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
940 punpckldq_r2r(mm7, mm0); // m30:m20|m10:m00 - interleave to produce result 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
941
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
942 movq_m2r(*(dataptr+6), mm5); // m33:m32|m31:m30 - fourth line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
943 punpckhdq_r2r(mm7, mm1); // m31:m21|m11:m01 - interleave to produce result 2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
944
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
945 movq_r2r(mm0, mm7); // write result 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
946 punpckhwd_r2r(mm6, mm2); // m13:m03|m12:m02 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
947
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
948 psubw_m2r(*(dataptr+14), mm7); // tmp07=x0-x7 /* Stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
949 movq_r2r(mm1, mm6); // write result 2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
950
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
951 paddw_m2r(*(dataptr+14), mm0); // tmp00=x0+x7 /* Stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
952 punpckhwd_r2r(mm5, mm4); // m33:m23|m32:m22 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
953
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
954 paddw_m2r(*(dataptr+12), mm1); // tmp01=x1+x6 /* Stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
955 movq_r2r(mm2, mm3); // copy first intermediate result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
956
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
957 psubw_m2r(*(dataptr+12), mm6); // tmp06=x1-x6 /* Stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
958 punpckldq_r2r(mm4, mm2); // m32:m22|m12:m02 - interleave to produce result 3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
959
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
960 movq_r2m(mm7, tmp7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
961 movq_r2r(mm2, mm5); // write result 3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
962
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
963 movq_r2m(mm6, tmp6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
964 punpckhdq_r2r(mm4, mm3); // m33:m23|m13:m03 - interleave to produce result 4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
965
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
966 paddw_m2r(*(dataptr+10), mm2); // tmp02=x2+5 /* Stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
967 movq_r2r(mm3, mm4); // write result 4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
968
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
969 /************************************************************************************************
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
970 End of Transpose
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
971 ************************************************************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
972
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
973
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
974 paddw_m2r(*(dataptr+8), mm3); // tmp03=x3+x4 /* stage 1*/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
975 movq_r2r(mm0, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
976
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
977 psubw_m2r(*(dataptr+8), mm4); // tmp04=x3-x4 /* stage 1*/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
978 movq_r2r(mm1, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
979
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
980 paddw_r2r(mm3, mm0); // tmp10 = tmp00 + tmp03 /* even 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
981 psubw_r2r(mm3, mm7); // tmp13 = tmp00 - tmp03 /* even 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
982
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
983 psubw_r2r(mm2, mm6); // tmp12 = tmp01 - tmp02 /* even 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
984 paddw_r2r(mm2, mm1); // tmp11 = tmp01 + tmp02 /* even 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
985
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
986 psubw_m2r(*(dataptr+10), mm5); // tmp05=x2-x5 /* stage 1*/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
987 paddw_r2r(mm7, mm6); // tmp12 + tmp13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
988
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
989 /* stage 3 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
990
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
991 movq_m2r(tmp6, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
992 movq_r2r(mm0, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
993
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
994 psllw_i2r(2, mm6); // m8 * 2^2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
995 paddw_r2r(mm1, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
996
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
997 pmulhw_m2r(RTjpeg_C4, mm6); // z1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
998 psubw_r2r(mm1, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
999
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1000 movq_r2m(mm0, *dataptr);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1001 movq_r2r(mm7, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1002
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1003 /* Odd part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1004 movq_r2m(mm3, *(dataptr+8));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1005 paddw_r2r(mm5, mm4); // tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1006
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1007 movq_m2r(tmp7, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1008 paddw_r2r(mm6, mm0); // tmp32
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1009
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1010 paddw_r2r(mm2, mm5); // tmp11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1011 psubw_r2r(mm6, mm7); // tmp33
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1012
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1013 movq_r2m(mm0, *(dataptr+4));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1014 paddw_r2r(mm3, mm2); // tmp12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1015
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1016 /* stage 4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1017
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1018 movq_r2m(mm7, *(dataptr+12));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1019 movq_r2r(mm4, mm1); // copy of tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1020
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1021 psubw_r2r(mm2, mm1); // tmp10 - tmp12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1022 psllw_i2r(2, mm4); // m8 * 2^2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1023
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1024 movq_m2r(RTjpeg_C2mC6, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1025 psllw_i2r(2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1026
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1027 pmulhw_m2r(RTjpeg_C6, mm1); // z5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1028 psllw_i2r(2, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1029
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1030 pmulhw_r2r(mm0, mm4); // z5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1031
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1032 /* stage 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1033
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1034 pmulhw_m2r(RTjpeg_C2pC6, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1035 psllw_i2r(2, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1036
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1037 pmulhw_m2r(RTjpeg_C4, mm5); // z3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1038 movq_r2r(mm3, mm0); // copy tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1039
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1040 movq_m2r(*(dataptr+1), mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1041 paddw_r2r(mm1, mm4); // z2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1042
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1043 paddw_r2r(mm1, mm2); // z4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1044
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1045 paddw_r2r(mm5, mm0); // z11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1046 psubw_r2r(mm5, mm3); // z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1047
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1048 /* stage 6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1049
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1050 movq_r2r(mm3, mm5); // copy z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1051 psubw_r2r(mm4, mm3); // y3=z13 - z2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1052
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1053 paddw_r2r(mm4, mm5); // y5=z13 + z2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1054 movq_r2r(mm0, mm6); // copy z11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1055
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1056 movq_r2m(mm3, *(dataptr+6)); //save y3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1057 psubw_r2r(mm2, mm0); // y7=z11 - z4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1058
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1059 movq_r2m(mm5, *(dataptr+10)); //save y5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1060 paddw_r2r(mm2, mm6); // y1=z11 + z4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1061
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1062 movq_r2m(mm0, *(dataptr+14)); //save y7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1063
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1064 /************************************************
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1065 * End of 1st 4 rows
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1066 ************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1067
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1068 movq_m2r(*(dataptr+3), mm1); // load x1 /* stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1069 movq_r2r(mm7, mm0); // copy x0
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1070
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1071 movq_r2m(mm6, *(dataptr+2)); //save y1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1072
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1073 movq_m2r(*(dataptr+5), mm2); // load x2 /* stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1074 movq_r2r(mm1, mm6); // copy x1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1075
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1076 paddw_m2r(*(dataptr+15), mm0); // tmp00 = x0 + x7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1077
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1078 movq_m2r(*(dataptr+7), mm3); // load x3 /* stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1079 movq_r2r(mm2, mm5); // copy x2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1080
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1081 psubw_m2r(*(dataptr+15), mm7); // tmp07 = x0 - x7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1082 movq_r2r(mm3, mm4); // copy x3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1083
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1084 paddw_m2r(*(dataptr+13), mm1); // tmp01 = x1 + x6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1085
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1086 movq_r2m(mm7, tmp7); // save tmp07
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1087 movq_r2r(mm0, mm7); // copy tmp00
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1088
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1089 psubw_m2r(*(dataptr+13), mm6); // tmp06 = x1 - x6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1090
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1091 /* stage 2, Even Part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1092
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1093 paddw_m2r(*(dataptr+9), mm3); // tmp03 = x3 + x4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1094
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1095 movq_r2m(mm6, tmp6); // save tmp07
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1096 movq_r2r(mm1, mm6); // copy tmp01
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1097
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1098 paddw_m2r(*(dataptr+11), mm2); // tmp02 = x2 + x5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1099 paddw_r2r(mm3, mm0); // tmp10 = tmp00 + tmp03
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1100
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1101 psubw_r2r(mm3, mm7); // tmp13 = tmp00 - tmp03
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1102
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1103 psubw_m2r(*(dataptr+9), mm4); // tmp04 = x3 - x4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1104 psubw_r2r(mm2, mm6); // tmp12 = tmp01 - tmp02
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1105
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1106 paddw_r2r(mm2, mm1); // tmp11 = tmp01 + tmp02
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1107
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1108 psubw_m2r(*(dataptr+11), mm5); // tmp05 = x2 - x5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1109 paddw_r2r(mm7, mm6); // tmp12 + tmp13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1110
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1111 /* stage 3, Even and stage 4 & 5 even */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1112
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1113 movq_m2r(tmp6, mm2); // load tmp6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1114 movq_r2r(mm0, mm3); // copy tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1115
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1116 psllw_i2r(2, mm6); // shift z1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1117 paddw_r2r(mm1, mm0); // y0=tmp10 + tmp11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1118
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1119 pmulhw_m2r(RTjpeg_C4, mm6); // z1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1120 psubw_r2r(mm1, mm3); // y4=tmp10 - tmp11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1121
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1122 movq_r2m(mm0, *(dataptr+1)); //save y0
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1123 movq_r2r(mm7, mm0); // copy tmp13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1124
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1125 /* odd part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1126
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1127 movq_r2m(mm3, *(dataptr+9)); //save y4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1128 paddw_r2r(mm5, mm4); // tmp10 = tmp4 + tmp5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1129
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1130 movq_m2r(tmp7, mm3); // load tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1131 paddw_r2r(mm6, mm0); // tmp32 = tmp13 + z1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1132
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1133 paddw_r2r(mm2, mm5); // tmp11 = tmp5 + tmp6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1134 psubw_r2r(mm6, mm7); // tmp33 = tmp13 - z1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1135
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1136 movq_r2m(mm0, *(dataptr+5)); //save y2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1137 paddw_r2r(mm3, mm2); // tmp12 = tmp6 + tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1138
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1139 /* stage 4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1140
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1141 movq_r2m(mm7, *(dataptr+13)); //save y6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1142 movq_r2r(mm4, mm1); // copy tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1143
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1144 psubw_r2r(mm2, mm1); // tmp10 - tmp12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1145 psllw_i2r(2, mm4); // shift tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1146
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1147 movq_m2r(RTjpeg_C2mC6, mm0); // load C2mC6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1148 psllw_i2r(2, mm1); // shift (tmp10-tmp12)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1149
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1150 pmulhw_m2r(RTjpeg_C6, mm1); // z5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1151 psllw_i2r(2, mm5); // prepare for multiply
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1152
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1153 pmulhw_r2r(mm0, mm4); // multiply by converted real
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1154
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1155 /* stage 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1156
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1157 pmulhw_m2r(RTjpeg_C4, mm5); // z3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1158 psllw_i2r(2, mm2); // prepare for multiply
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1159
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1160 pmulhw_m2r(RTjpeg_C2pC6, mm2); // multiply
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1161 movq_r2r(mm3, mm0); // copy tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1162
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1163 movq_m2r(*(dataptr+9), mm7); // m03:m02|m01:m00 - first line (line 4)and copy into mm7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1164 paddw_r2r(mm1, mm4); // z2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1165
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1166 paddw_r2r(mm5, mm0); // z11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1167 psubw_r2r(mm5, mm3); // z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1168
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1169 /* stage 6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1170
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1171 movq_r2r(mm3, mm5); // copy z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1172 paddw_r2r(mm1, mm2); // z4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1173
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1174 movq_r2r(mm0, mm6); // copy z11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1175 psubw_r2r(mm4, mm5); // y3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1176
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1177 paddw_r2r(mm2, mm6); // y1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1178 paddw_r2r(mm4, mm3); // y5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1179
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1180 movq_r2m(mm5, *(dataptr+7)); //save y3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1181
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1182 movq_r2m(mm6, *(dataptr+3)); //save y1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1183 psubw_r2r(mm2, mm0); // y7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1184
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1185 /************************************************************************************************
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1186 Start of Transpose
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1187 ************************************************************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1188
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1189 movq_m2r(*(dataptr+13), mm6); // m23:m22|m21:m20 - third line (line 6)and copy into m2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1190 movq_r2r(mm7, mm5); // copy first line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1191
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1192 punpcklwd_r2r(mm3, mm7); // m11:m01|m10:m00 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1193 movq_r2r(mm6, mm2); // copy third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1194
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1195 punpcklwd_r2r(mm0, mm6); // m31:m21|m30:m20 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1196 movq_r2r(mm7, mm1); // copy first intermediate result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1197
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1198 punpckldq_r2r(mm6, mm7); // m30:m20|m10:m00 - interleave to produce result 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1199
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1200 punpckhdq_r2r(mm6, mm1); // m31:m21|m11:m01 - interleave to produce result 2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1201
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1202 movq_r2m(mm7, *(dataptr+9)); // write result 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1203 punpckhwd_r2r(mm3, mm5); // m13:m03|m12:m02 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1204
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1205 movq_r2m(mm1, *(dataptr+11)); // write result 2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1206 punpckhwd_r2r(mm0, mm2); // m33:m23|m32:m22 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1207
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1208 movq_r2r(mm5, mm1); // copy first intermediate result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1209 punpckldq_r2r(mm2, mm5); // m32:m22|m12:m02 - interleave to produce result 3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1210
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1211 movq_m2r(*(dataptr+1), mm0); // m03:m02|m01:m00 - first line, 4x4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1212 punpckhdq_r2r(mm2, mm1); // m33:m23|m13:m03 - interleave to produce result 4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1213
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1214 movq_r2m(mm5, *(dataptr+13)); // write result 3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1215
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1216 /****** last 4x4 done */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1217
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1218 movq_r2m(mm1, *(dataptr+15)); // write result 4, last 4x4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1219
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1220 movq_m2r(*(dataptr+5), mm2); // m23:m22|m21:m20 - third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1221 movq_r2r(mm0, mm6); // copy first line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1222
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1223 punpcklwd_m2r(*(dataptr+3), mm0); // m11:m01|m10:m00 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1224 movq_r2r(mm2, mm7); // copy third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1225
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1226 punpcklwd_m2r(*(dataptr+7), mm2); // m31:m21|m30:m20 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1227 movq_r2r(mm0, mm4); // copy first intermediate result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1228
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1229
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1230
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1231 movq_m2r(*(dataptr+8), mm1); // n03:n02|n01:n00 - first line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1232 punpckldq_r2r(mm2, mm0); // m30:m20|m10:m00 - interleave to produce first result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1233
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1234 movq_m2r(*(dataptr+12), mm3); // n23:n22|n21:n20 - third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1235 punpckhdq_r2r(mm2, mm4); // m31:m21|m11:m01 - interleave to produce second result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1236
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1237 punpckhwd_m2r(*(dataptr+3), mm6); // m13:m03|m12:m02 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1238 movq_r2r(mm1, mm2); // copy first line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1239
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1240 punpckhwd_m2r(*(dataptr+7), mm7); // m33:m23|m32:m22 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1241 movq_r2r(mm6, mm5); // copy first intermediate result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1242
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1243 movq_r2m(mm0, *(dataptr+8)); // write result 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1244 punpckhdq_r2r(mm7, mm5); // m33:m23|m13:m03 - produce third result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1245
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1246 punpcklwd_m2r(*(dataptr+10), mm1); // n11:n01|n10:n00 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1247 movq_r2r(mm3, mm0); // copy third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1248
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1249 punpckhwd_m2r(*(dataptr+10), mm2); // n13:n03|n12:n02 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1250
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1251 movq_r2m(mm4, *(dataptr+10)); // write result 2 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1252 punpckldq_r2r(mm7, mm6); // m32:m22|m12:m02 - produce fourth result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1253
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1254 punpcklwd_m2r(*(dataptr+14), mm3); // n33:n23|n32:n22 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1255 movq_r2r(mm1, mm4); // copy second intermediate result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1256
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1257 movq_r2m(mm6, *(dataptr+12)); // write result 3 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1258 punpckldq_r2r(mm3, mm1); //
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1259
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1260 punpckhwd_m2r(*(dataptr+14), mm0); // n33:n23|n32:n22 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1261 movq_r2r(mm2, mm6); // copy second intermediate result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1262
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1263 movq_r2m(mm5, *(dataptr+14)); // write result 4 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1264 punpckhdq_r2r(mm3, mm4); // n31:n21|n11:n01- produce second result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1265
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1266 movq_r2m(mm1, *(dataptr+1)); // write result 5 out - (first result for other 4 x 4 block)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1267 punpckldq_r2r(mm0, mm2); // n32:n22|n12:n02- produce third result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1268
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1269 movq_r2m(mm4, *(dataptr+3)); // write result 6 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1270 punpckhdq_r2r(mm0, mm6); // n33:n23|n13:n03 - produce fourth result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1271
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1272 movq_r2m(mm2, *(dataptr+5)); // write result 7 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1273
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1274 movq_m2r(*dataptr, mm0); // m03:m02|m01:m00 - first line, first 4x4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1275
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1276 movq_r2m(mm6, *(dataptr+7)); // write result 8 out
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1277
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1278 // Do first 4x4 quadrant, which is used in the beginning of the DCT:
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1279
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1280 movq_m2r(*(dataptr+4), mm7); // m23:m22|m21:m20 - third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1281 movq_r2r(mm0, mm2); // copy first line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1282
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1283 punpcklwd_m2r(*(dataptr+2), mm0); // m11:m01|m10:m00 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1284 movq_r2r(mm7, mm4); // copy third line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1285
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1286 punpcklwd_m2r(*(dataptr+6), mm7); // m31:m21|m30:m20 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1287 movq_r2r(mm0, mm1); // copy first intermediate result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1288
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1289 movq_m2r(*(dataptr+2), mm6); // m13:m12|m11:m10 - second line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1290 punpckldq_r2r(mm7, mm0); // m30:m20|m10:m00 - interleave to produce result 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1291
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1292 movq_m2r(*(dataptr+6), mm5); // m33:m32|m31:m30 - fourth line
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1293 punpckhdq_r2r(mm7, mm1); // m31:m21|m11:m01 - interleave to produce result 2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1294
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1295 movq_r2r(mm0, mm7); // write result 1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1296 punpckhwd_r2r(mm6, mm2); // m13:m03|m12:m02 - interleave first and second lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1297
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1298 psubw_m2r(*(dataptr+14), mm7); // tmp07=x0-x7 /* Stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1299 movq_r2r(mm1, mm6); // write result 2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1300
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1301 paddw_m2r(*(dataptr+14), mm0); // tmp00=x0+x7 /* Stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1302 punpckhwd_r2r(mm5, mm4); // m33:m23|m32:m22 - interleave third and fourth lines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1303
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1304 paddw_m2r(*(dataptr+12), mm1); // tmp01=x1+x6 /* Stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1305 movq_r2r(mm2, mm3); // copy first intermediate result
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1306
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1307 psubw_m2r(*(dataptr+12), mm6); // tmp06=x1-x6 /* Stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1308 punpckldq_r2r(mm4, mm2); // m32:m22|m12:m02 - interleave to produce result 3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1309
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1310 movq_r2m(mm7, tmp7); // save tmp07
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1311 movq_r2r(mm2, mm5); // write result 3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1312
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1313 movq_r2m(mm6, tmp6); // save tmp06
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1314
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1315 punpckhdq_r2r(mm4, mm3); // m33:m23|m13:m03 - interleave to produce result 4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1316
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1317 paddw_m2r(*(dataptr+10), mm2); // tmp02=x2+x5 /* stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1318 movq_r2r(mm3, mm4); // write result 4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1319
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1320 /************************************************************************************************
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1321 End of Transpose 2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1322 ************************************************************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1323
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1324 paddw_m2r(*(dataptr+8), mm3); // tmp03=x3+x4 /* stage 1*/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1325 movq_r2r(mm0, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1326
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1327 psubw_m2r(*(dataptr+8), mm4); // tmp04=x3-x4 /* stage 1*/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1328 movq_r2r(mm1, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1329
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1330 paddw_r2r(mm3, mm0); // tmp10 = tmp00 + tmp03 /* even 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1331 psubw_r2r(mm3, mm7); // tmp13 = tmp00 - tmp03 /* even 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1332
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1333 psubw_r2r(mm2, mm6); // tmp12 = tmp01 - tmp02 /* even 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1334 paddw_r2r(mm2, mm1); // tmp11 = tmp01 + tmp02 /* even 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1335
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1336 psubw_m2r(*(dataptr+10), mm5); // tmp05=x2-x5 /* stage 1*/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1337 paddw_r2r(mm7, mm6); // tmp12 + tmp13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1338
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1339 /* stage 3 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1340
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1341 movq_m2r(tmp6, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1342 movq_r2r(mm0, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1343
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1344 psllw_i2r(2, mm6); // m8 * 2^2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1345 paddw_r2r(mm1, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1346
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1347 pmulhw_m2r(RTjpeg_C4, mm6); // z1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1348 psubw_r2r(mm1, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1349
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1350 movq_r2m(mm0, *dataptr);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1351 movq_r2r(mm7, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1352
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1353 /* Odd part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1354 movq_r2m(mm3, *(dataptr+8));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1355 paddw_r2r(mm5, mm4); // tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1356
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1357 movq_m2r(tmp7, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1358 paddw_r2r(mm6, mm0); // tmp32
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1359
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1360 paddw_r2r(mm2, mm5); // tmp11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1361 psubw_r2r(mm6, mm7); // tmp33
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1362
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1363 movq_r2m(mm0, *(dataptr+4));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1364 paddw_r2r(mm3, mm2); // tmp12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1365
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1366 /* stage 4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1367 movq_r2m(mm7, *(dataptr+12));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1368 movq_r2r(mm4, mm1); // copy of tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1369
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1370 psubw_r2r(mm2, mm1); // tmp10 - tmp12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1371 psllw_i2r(2, mm4); // m8 * 2^2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1372
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1373 movq_m2r(RTjpeg_C2mC6, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1374 psllw_i2r(2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1375
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1376 pmulhw_m2r(RTjpeg_C6, mm1); // z5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1377 psllw_i2r(2, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1378
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1379 pmulhw_r2r(mm0, mm4); // z5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1380
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1381 /* stage 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1382
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1383 pmulhw_m2r(RTjpeg_C2pC6, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1384 psllw_i2r(2, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1385
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1386 pmulhw_m2r(RTjpeg_C4, mm5); // z3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1387 movq_r2r(mm3, mm0); // copy tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1388
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1389 movq_m2r(*(dataptr+1), mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1390 paddw_r2r(mm1, mm4); // z2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1391
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1392 paddw_r2r(mm1, mm2); // z4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1393
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1394 paddw_r2r(mm5, mm0); // z11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1395 psubw_r2r(mm5, mm3); // z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1396
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1397 /* stage 6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1398
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1399 movq_r2r(mm3, mm5); // copy z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1400 psubw_r2r(mm4, mm3); // y3=z13 - z2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1401
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1402 paddw_r2r(mm4, mm5); // y5=z13 + z2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1403 movq_r2r(mm0, mm6); // copy z11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1404
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1405 movq_r2m(mm3, *(dataptr+6)); //save y3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1406 psubw_r2r(mm2, mm0); // y7=z11 - z4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1407
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1408 movq_r2m(mm5, *(dataptr+10)); //save y5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1409 paddw_r2r(mm2, mm6); // y1=z11 + z4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1410
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1411 movq_r2m(mm0, *(dataptr+14)); //save y7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1412
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1413 /************************************************
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1414 * End of 1st 4 rows
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1415 ************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1416
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1417 movq_m2r(*(dataptr+3), mm1); // load x1 /* stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1418 movq_r2r(mm7, mm0); // copy x0
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1419
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1420 movq_r2m(mm6, *(dataptr+2)); //save y1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1421
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1422 movq_m2r(*(dataptr+5), mm2); // load x2 /* stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1423 movq_r2r(mm1, mm6); // copy x1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1424
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1425 paddw_m2r(*(dataptr+15), mm0); // tmp00 = x0 + x7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1426
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1427 movq_m2r(*(dataptr+7), mm3); // load x3 /* stage 1 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1428 movq_r2r(mm2, mm5); // copy x2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1429
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1430 psubw_m2r(*(dataptr+15), mm7); // tmp07 = x0 - x7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1431 movq_r2r(mm3, mm4); // copy x3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1432
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1433 paddw_m2r(*(dataptr+13), mm1); // tmp01 = x1 + x6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1434
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1435 movq_r2m(mm7, tmp7); // save tmp07
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1436 movq_r2r(mm0, mm7); // copy tmp00
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1437
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1438 psubw_m2r(*(dataptr+13), mm6); // tmp06 = x1 - x6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1439
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1440 /* stage 2, Even Part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1441
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1442 paddw_m2r(*(dataptr+9), mm3); // tmp03 = x3 + x4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1443
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1444 movq_r2m(mm6, tmp6); // save tmp07
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1445 movq_r2r(mm1, mm6); // copy tmp01
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1446
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1447 paddw_m2r(*(dataptr+11), mm2); // tmp02 = x2 + x5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1448 paddw_r2r(mm3, mm0); // tmp10 = tmp00 + tmp03
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1449
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1450 psubw_r2r(mm3, mm7); // tmp13 = tmp00 - tmp03
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1451
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1452 psubw_m2r(*(dataptr+9), mm4); // tmp04 = x3 - x4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1453 psubw_r2r(mm2, mm6); // tmp12 = tmp01 - tmp02
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1454
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1455 paddw_r2r(mm2, mm1); // tmp11 = tmp01 + tmp02
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1456
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1457 psubw_m2r(*(dataptr+11), mm5); // tmp05 = x2 - x5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1458 paddw_r2r(mm7, mm6); // tmp12 + tmp13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1459
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1460 /* stage 3, Even and stage 4 & 5 even */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1461
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1462 movq_m2r(tmp6, mm2); // load tmp6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1463 movq_r2r(mm0, mm3); // copy tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1464
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1465 psllw_i2r(2, mm6); // shift z1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1466 paddw_r2r(mm1, mm0); // y0=tmp10 + tmp11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1467
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1468 pmulhw_m2r(RTjpeg_C4, mm6); // z1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1469 psubw_r2r(mm1, mm3); // y4=tmp10 - tmp11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1470
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1471 movq_r2m(mm0, *(dataptr+1)); //save y0
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1472 movq_r2r(mm7, mm0); // copy tmp13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1473
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1474 /* odd part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1475
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1476 movq_r2m(mm3, *(dataptr+9)); //save y4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1477 paddw_r2r(mm5, mm4); // tmp10 = tmp4 + tmp5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1478
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1479 movq_m2r(tmp7, mm3); // load tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1480 paddw_r2r(mm6, mm0); // tmp32 = tmp13 + z1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1481
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1482 paddw_r2r(mm2, mm5); // tmp11 = tmp5 + tmp6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1483 psubw_r2r(mm6, mm7); // tmp33 = tmp13 - z1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1484
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1485 movq_r2m(mm0, *(dataptr+5)); //save y2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1486 paddw_r2r(mm3, mm2); // tmp12 = tmp6 + tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1487
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1488 /* stage 4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1489
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1490 movq_r2m(mm7, *(dataptr+13)); //save y6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1491 movq_r2r(mm4, mm1); // copy tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1492
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1493 psubw_r2r(mm2, mm1); // tmp10 - tmp12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1494 psllw_i2r(2, mm4); // shift tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1495
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1496 movq_m2r(RTjpeg_C2mC6, mm0); // load C2mC6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1497 psllw_i2r(2, mm1); // shift (tmp10-tmp12)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1498
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1499 pmulhw_m2r(RTjpeg_C6, mm1); // z5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1500 psllw_i2r(2, mm5); // prepare for multiply
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1501
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1502 pmulhw_r2r(mm0, mm4); // multiply by converted real
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1503
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1504 /* stage 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1505
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1506 pmulhw_m2r(RTjpeg_C4, mm5); // z3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1507 psllw_i2r(2, mm2); // prepare for multiply
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1508
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1509 pmulhw_m2r(RTjpeg_C2pC6, mm2); // multiply
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1510 movq_r2r(mm3, mm0); // copy tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1511
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1512 movq_m2r(*(dataptr+9), mm7); // m03:m02|m01:m00 - first line (line 4)and copy into mm7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1513 paddw_r2r(mm1, mm4); // z2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1514
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1515 paddw_r2r(mm5, mm0); // z11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1516 psubw_r2r(mm5, mm3); // z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1517
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1518 /* stage 6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1519
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1520 movq_r2r(mm3, mm5); // copy z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1521 paddw_r2r(mm1, mm2); // z4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1522
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1523 movq_r2r(mm0, mm6); // copy z11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1524 psubw_r2r(mm4, mm5); // y3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1525
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1526 paddw_r2r(mm2, mm6); // y1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1527 paddw_r2r(mm4, mm3); // y5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1528
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1529 movq_r2m(mm5, *(dataptr+7)); //save y3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1530 psubw_r2r(mm2, mm0); // yè=z11 - z4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1531
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1532 movq_r2m(mm3, *(dataptr+11)); //save y5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1533
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1534 movq_r2m(mm6, *(dataptr+3)); //save y1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1535
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1536 movq_r2m(mm0, *(dataptr+15)); //save y7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1537
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1538
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1539 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1540 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1541
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1542 #define FIX_1_082392200 ((__s32) 277) /* FIX(1.082392200) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1543 #define FIX_1_414213562 ((__s32) 362) /* FIX(1.414213562) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1544 #define FIX_1_847759065 ((__s32) 473) /* FIX(1.847759065) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1545 #define FIX_2_613125930 ((__s32) 669) /* FIX(2.613125930) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1546
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1547 #define DESCALE(x) (__s16)( ((x)+4) >> 3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1548
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1549 /* clip yuv to 16..235 (should be 16..240 for cr/cb but ... */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1550
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1551 #define RL(x) ((x)>235) ? 235 : (((x)<16) ? 16 : (x))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1552 #define MULTIPLY(var,const) (((__s32) ((var) * (const)) + 128)>>8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1553
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1554 void RTjpeg_idct_init(void)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1555 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1556 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1557
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1558 for(i=0; i<64; i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1559 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1560 RTjpeg_liqt[i]=((__u64)RTjpeg_liqt[i]*RTjpeg_aan_tab[i])>>32;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1561 RTjpeg_ciqt[i]=((__u64)RTjpeg_ciqt[i]*RTjpeg_aan_tab[i])>>32;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1562 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1563 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1564
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1565 void RTjpeg_idct(__u8 *odata, __s16 *data, int rskip)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1566 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1567 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1568
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1569 static mmx_t fix_141 = (mmx_t)(long long)0x5a825a825a825a82LL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1570 static mmx_t fix_184n261 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1571 static mmx_t fix_184 = (mmx_t)(long long)0x7641764176417641LL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1572 static mmx_t fix_n184 = (mmx_t)(long long)0x896f896f896f896fLL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1573 static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1574
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1575 mmx_t workspace[64];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1576 mmx_t *wsptr = workspace;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1577 register mmx_t *dataptr = (mmx_t *)odata;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1578 mmx_t *idata = (mmx_t *)data;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1579
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1580 rskip = rskip>>3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1581 /*
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1582 * Perform inverse DCT on one block of coefficients.
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1583 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1584
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1585 /* Odd part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1586
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1587 movq_m2r(*(idata+10), mm1); // load idata[DCTSIZE*5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1588
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1589 movq_m2r(*(idata+6), mm0); // load idata[DCTSIZE*3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1590
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1591 movq_m2r(*(idata+2), mm3); // load idata[DCTSIZE*1]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1592
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1593 movq_r2r(mm1, mm2); // copy tmp6 /* phase 6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1594
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1595 movq_m2r(*(idata+14), mm4); // load idata[DCTSIZE*7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1596
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1597 paddw_r2r(mm0, mm1); // z13 = tmp6 + tmp5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1598
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1599 psubw_r2r(mm0, mm2); // z10 = tmp6 - tmp5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1600
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1601 psllw_i2r(2, mm2); // shift z10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1602 movq_r2r(mm2, mm0); // copy z10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1603
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1604 pmulhw_m2r(fix_184n261, mm2); // MULTIPLY( z12, FIX_1_847759065); /* 2*c2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1605 movq_r2r(mm3, mm5); // copy tmp4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1606
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1607 pmulhw_m2r(fix_n184, mm0); // MULTIPLY(z10, -FIX_1_847759065); /* 2*c2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1608 paddw_r2r(mm4, mm3); // z11 = tmp4 + tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1609
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1610 movq_r2r(mm3, mm6); // copy z11 /* phase 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1611 psubw_r2r(mm4, mm5); // z12 = tmp4 - tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1612
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1613 psubw_r2r(mm1, mm6); // z11-z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1614 psllw_i2r(2, mm5); // shift z12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1615
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1616 movq_m2r(*(idata+12), mm4); // load idata[DCTSIZE*6], even part
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1617 movq_r2r(mm5, mm7); // copy z12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1618
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1619 pmulhw_m2r(fix_108n184, mm5); // MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1620 paddw_r2r(mm1, mm3); // tmp7 = z11 + z13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1621
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1622 //ok
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1623
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1624 /* Even part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1625 pmulhw_m2r(fix_184, mm7); // MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; /* -2*(c2+c6) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1626 psllw_i2r(2, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1627
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1628 movq_m2r(*(idata+4), mm1); // load idata[DCTSIZE*2]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1629
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1630 paddw_r2r(mm5, mm0); // tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1631
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1632 paddw_r2r(mm7, mm2); // tmp12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1633
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1634 pmulhw_m2r(fix_141, mm6); // tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1635 psubw_r2r(mm3, mm2); // tmp6 = tmp12 - tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1636
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1637 movq_r2r(mm1, mm5); // copy tmp1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1638 paddw_r2r(mm4, mm1); // tmp13= tmp1 + tmp3; /* phases 5-3 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1639
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1640 psubw_r2r(mm4, mm5); // tmp1-tmp3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1641 psubw_r2r(mm2, mm6); // tmp5 = tmp11 - tmp6;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1642
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1643 movq_r2m(mm1, *(wsptr)); // save tmp13 in workspace
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1644 psllw_i2r(2, mm5); // shift tmp1-tmp3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1645
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1646 movq_m2r(*(idata), mm7); // load idata[DCTSIZE*0]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1647
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1648 pmulhw_m2r(fix_141, mm5); // MULTIPLY(tmp1 - tmp3, FIX_1_414213562)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1649 paddw_r2r(mm6, mm0); // tmp4 = tmp10 + tmp5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1650
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1651 movq_m2r(*(idata+8), mm4); // load idata[DCTSIZE*4]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1652
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1653 psubw_r2r(mm1, mm5); // tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1654
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1655 movq_r2m(mm0, *(wsptr+4)); // save tmp4 in workspace
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1656 movq_r2r(mm7, mm1); // copy tmp0 /* phase 3 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1657
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1658 movq_r2m(mm5, *(wsptr+2)); // save tmp12 in workspace
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1659 psubw_r2r(mm4, mm1); // tmp11 = tmp0 - tmp2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1660
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1661 paddw_r2r(mm4, mm7); // tmp10 = tmp0 + tmp2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1662 movq_r2r(mm1, mm5); // copy tmp11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1663
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1664 paddw_m2r(*(wsptr+2), mm1); // tmp1 = tmp11 + tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1665 movq_r2r(mm7, mm4); // copy tmp10 /* phase 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1666
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1667 paddw_m2r(*(wsptr), mm7); // tmp0 = tmp10 + tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1668
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1669 psubw_m2r(*(wsptr), mm4); // tmp3 = tmp10 - tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1670 movq_r2r(mm7, mm0); // copy tmp0
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1671
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1672 psubw_m2r(*(wsptr+2), mm5); // tmp2 = tmp11 - tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1673 paddw_r2r(mm3, mm7); // wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1674
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1675 psubw_r2r(mm3, mm0); // wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1676
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1677 movq_r2m(mm7, *(wsptr)); // wsptr[DCTSIZE*0]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1678 movq_r2r(mm1, mm3); // copy tmp1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1679
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1680 movq_r2m(mm0, *(wsptr+14)); // wsptr[DCTSIZE*7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1681 paddw_r2r(mm2, mm1); // wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1682
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1683 psubw_r2r(mm2, mm3); // wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1684
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1685 movq_r2m(mm1, *(wsptr+2)); // wsptr[DCTSIZE*1]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1686 movq_r2r(mm4, mm1); // copy tmp3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1687
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1688 movq_r2m(mm3, *(wsptr+12)); // wsptr[DCTSIZE*6]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1689
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1690 paddw_m2r(*(wsptr+4), mm4); // wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1691
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1692 psubw_m2r(*(wsptr+4), mm1); // wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1693
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1694 movq_r2m(mm4, *(wsptr+8));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1695 movq_r2r(mm5, mm7); // copy tmp2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1696
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1697 paddw_r2r(mm6, mm5); // wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1698
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1699 movq_r2m(mm1, *(wsptr+6));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1700 psubw_r2r(mm6, mm7); // wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1701
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1702 movq_r2m(mm5, *(wsptr+4));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1703
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1704 movq_r2m(mm7, *(wsptr+10));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1705
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1706 //ok
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1707
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1708
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1709 /*****************************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1710
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1711 idata++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1712 wsptr++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1713
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1714 /*****************************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1715
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1716 movq_m2r(*(idata+10), mm1); // load idata[DCTSIZE*5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1717
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1718 movq_m2r(*(idata+6), mm0); // load idata[DCTSIZE*3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1719
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1720 movq_m2r(*(idata+2), mm3); // load idata[DCTSIZE*1]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1721 movq_r2r(mm1, mm2); // copy tmp6 /* phase 6 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1722
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1723 movq_m2r(*(idata+14), mm4); // load idata[DCTSIZE*7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1724 paddw_r2r(mm0, mm1); // z13 = tmp6 + tmp5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1725
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1726 psubw_r2r(mm0, mm2); // z10 = tmp6 - tmp5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1727
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1728 psllw_i2r(2, mm2); // shift z10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1729 movq_r2r(mm2, mm0); // copy z10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1730
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1731 pmulhw_m2r(fix_184n261, mm2); // MULTIPLY( z12, FIX_1_847759065); /* 2*c2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1732 movq_r2r(mm3, mm5); // copy tmp4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1733
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1734 pmulhw_m2r(fix_n184, mm0); // MULTIPLY(z10, -FIX_1_847759065); /* 2*c2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1735 paddw_r2r(mm4, mm3); // z11 = tmp4 + tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1736
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1737 movq_r2r(mm3, mm6); // copy z11 /* phase 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1738 psubw_r2r(mm4, mm5); // z12 = tmp4 - tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1739
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1740 psubw_r2r(mm1, mm6); // z11-z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1741 psllw_i2r(2, mm5); // shift z12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1742
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1743 movq_m2r(*(idata+12), mm4); // load idata[DCTSIZE*6], even part
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1744 movq_r2r(mm5, mm7); // copy z12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1745
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1746 pmulhw_m2r(fix_108n184, mm5); // MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1747 paddw_r2r(mm1, mm3); // tmp7 = z11 + z13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1748
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1749 //ok
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1750
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1751 /* Even part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1752 pmulhw_m2r(fix_184, mm7); // MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; /* -2*(c2+c6) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1753 psllw_i2r(2, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1754
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1755 movq_m2r(*(idata+4), mm1); // load idata[DCTSIZE*2]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1756
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1757 paddw_r2r(mm5, mm0); // tmp10
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1758
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1759 paddw_r2r(mm7, mm2); // tmp12
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1760
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1761 pmulhw_m2r(fix_141, mm6); // tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1762 psubw_r2r(mm3, mm2); // tmp6 = tmp12 - tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1763
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1764 movq_r2r(mm1, mm5); // copy tmp1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1765 paddw_r2r(mm4, mm1); // tmp13= tmp1 + tmp3; /* phases 5-3 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1766
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1767 psubw_r2r(mm4, mm5); // tmp1-tmp3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1768 psubw_r2r(mm2, mm6); // tmp5 = tmp11 - tmp6;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1769
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1770 movq_r2m(mm1, *(wsptr)); // save tmp13 in workspace
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1771 psllw_i2r(2, mm5); // shift tmp1-tmp3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1772
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1773 movq_m2r(*(idata), mm7); // load idata[DCTSIZE*0]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1774 paddw_r2r(mm6, mm0); // tmp4 = tmp10 + tmp5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1775
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1776 pmulhw_m2r(fix_141, mm5); // MULTIPLY(tmp1 - tmp3, FIX_1_414213562)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1777
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1778 movq_m2r(*(idata+8), mm4); // load idata[DCTSIZE*4]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1779
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1780 psubw_r2r(mm1, mm5); // tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1781
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1782 movq_r2m(mm0, *(wsptr+4)); // save tmp4 in workspace
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1783 movq_r2r(mm7, mm1); // copy tmp0 /* phase 3 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1784
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1785 movq_r2m(mm5, *(wsptr+2)); // save tmp12 in workspace
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1786 psubw_r2r(mm4, mm1); // tmp11 = tmp0 - tmp2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1787
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1788 paddw_r2r(mm4, mm7); // tmp10 = tmp0 + tmp2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1789 movq_r2r(mm1, mm5); // copy tmp11
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1790
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1791 paddw_m2r(*(wsptr+2), mm1); // tmp1 = tmp11 + tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1792 movq_r2r(mm7, mm4); // copy tmp10 /* phase 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1793
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1794 paddw_m2r(*(wsptr), mm7); // tmp0 = tmp10 + tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1795
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1796 psubw_m2r(*(wsptr), mm4); // tmp3 = tmp10 - tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1797 movq_r2r(mm7, mm0); // copy tmp0
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1798
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1799 psubw_m2r(*(wsptr+2), mm5); // tmp2 = tmp11 - tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1800 paddw_r2r(mm3, mm7); // wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1801
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1802 psubw_r2r(mm3, mm0); // wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1803
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1804 movq_r2m(mm7, *(wsptr)); // wsptr[DCTSIZE*0]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1805 movq_r2r(mm1, mm3); // copy tmp1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1806
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1807 movq_r2m(mm0, *(wsptr+14)); // wsptr[DCTSIZE*7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1808 paddw_r2r(mm2, mm1); // wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1809
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1810 psubw_r2r(mm2, mm3); // wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1811
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1812 movq_r2m(mm1, *(wsptr+2)); // wsptr[DCTSIZE*1]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1813 movq_r2r(mm4, mm1); // copy tmp3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1814
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1815 movq_r2m(mm3, *(wsptr+12)); // wsptr[DCTSIZE*6]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1816
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1817 paddw_m2r(*(wsptr+4), mm4); // wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1818
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1819 psubw_m2r(*(wsptr+4), mm1); // wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1820
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1821 movq_r2m(mm4, *(wsptr+8));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1822 movq_r2r(mm5, mm7); // copy tmp2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1823
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1824 paddw_r2r(mm6, mm5); // wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1825
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1826 movq_r2m(mm1, *(wsptr+6));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1827 psubw_r2r(mm6, mm7); // wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1828
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1829 movq_r2m(mm5, *(wsptr+4));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1830
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1831 movq_r2m(mm7, *(wsptr+10));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1832
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1833 /*****************************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1834
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1835 /* Pass 2: process rows from work array, store into output array. */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1836 /* Note that we must descale the results by a factor of 8 == 2**3, */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1837 /* and also undo the PASS1_BITS scaling. */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1838
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1839 /*****************************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1840 /* Even part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1841
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1842 wsptr--;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1843
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1844 // tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1845 // tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1846 // tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1847 // tmp14 = ((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1848 movq_m2r(*(wsptr), mm0); // wsptr[0,0],[0,1],[0,2],[0,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1849
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1850 movq_m2r(*(wsptr+1), mm1); // wsptr[0,4],[0,5],[0,6],[0,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1851 movq_r2r(mm0, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1852
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1853 movq_m2r(*(wsptr+2), mm3); // wsptr[1,0],[1,1],[1,2],[1,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1854 paddw_r2r(mm1, mm0); // wsptr[0,tmp10],[xxx],[0,tmp13],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1855
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1856 movq_m2r(*(wsptr+3), mm4); // wsptr[1,4],[1,5],[1,6],[1,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1857 psubw_r2r(mm1, mm2); // wsptr[0,tmp11],[xxx],[0,tmp14],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1858
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1859 movq_r2r(mm0, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1860 movq_r2r(mm3, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1861
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1862 paddw_r2r(mm4, mm3); // wsptr[1,tmp10],[xxx],[1,tmp13],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1863 movq_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1864
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1865 psubw_r2r(mm4, mm5); // wsptr[1,tmp11],[xxx],[1,tmp14],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1866 punpcklwd_r2r(mm3, mm0); // wsptr[0,tmp10],[1,tmp10],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1867
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1868 movq_m2r(*(wsptr+7), mm7); // wsptr[3,4],[3,5],[3,6],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1869 punpckhwd_r2r(mm3, mm6); // wsptr[0,tmp13],[1,tmp13],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1870
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1871 movq_m2r(*(wsptr+4), mm3); // wsptr[2,0],[2,1],[2,2],[2,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1872 punpckldq_r2r(mm6, mm0); // wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1873
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1874 punpcklwd_r2r(mm5, mm1); // wsptr[0,tmp11],[1,tmp11],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1875 movq_r2r(mm3, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1876
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1877 movq_m2r(*(wsptr+6), mm6); // wsptr[3,0],[3,1],[3,2],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1878 punpckhwd_r2r(mm5, mm2); // wsptr[0,tmp14],[1,tmp14],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1879
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1880 movq_m2r(*(wsptr+5), mm5); // wsptr[2,4],[2,5],[2,6],[2,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1881 punpckldq_r2r(mm2, mm1); // wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1882
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1883
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1884 paddw_r2r(mm5, mm3); // wsptr[2,tmp10],[xxx],[2,tmp13],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1885 movq_r2r(mm6, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1886
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1887 psubw_r2r(mm5, mm4); // wsptr[2,tmp11],[xxx],[2,tmp14],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1888 paddw_r2r(mm7, mm6); // wsptr[3,tmp10],[xxx],[3,tmp13],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1889
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1890 movq_r2r(mm3, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1891 punpcklwd_r2r(mm6, mm3); // wsptr[2,tmp10],[3,tmp10],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1892
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1893 psubw_r2r(mm7, mm2); // wsptr[3,tmp11],[xxx],[3,tmp14],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1894 punpckhwd_r2r(mm6, mm5); // wsptr[2,tmp13],[3,tmp13],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1895
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1896 movq_r2r(mm4, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1897 punpckldq_r2r(mm5, mm3); // wsptr[2,tmp10],[3,tmp10],[2,tmp13],[3,tmp13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1898
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1899 punpcklwd_r2r(mm2, mm4); // wsptr[2,tmp11],[3,tmp11],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1900
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1901 punpckhwd_r2r(mm2, mm7); // wsptr[2,tmp14],[3,tmp14],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1902
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1903 punpckldq_r2r(mm7, mm4); // wsptr[2,tmp11],[3,tmp11],[2,tmp14],[3,tmp14]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1904 movq_r2r(mm1, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1905
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1906 //ok
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1907
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1908 // mm0 = ;wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1909 // mm1 = ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1910
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1911
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1912 movq_r2r(mm0, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1913 punpckhdq_r2r(mm4, mm6); // wsptr[0,tmp14],[1,tmp14],[2,tmp14],[3,tmp14]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1914
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1915 punpckldq_r2r(mm4, mm1); // wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1916 psllw_i2r(2, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1917
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1918 pmulhw_m2r(fix_141, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1919 punpckldq_r2r(mm3, mm0); // wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1920
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1921 punpckhdq_r2r(mm3, mm2); // wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1922 movq_r2r(mm0, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1923
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1924 // tmp0 = tmp10 + tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1925 // tmp3 = tmp10 - tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1926 paddw_r2r(mm2, mm0); // [0,tmp0],[1,tmp0],[2,tmp0],[3,tmp0]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1927 psubw_r2r(mm2, mm7); // [0,tmp3],[1,tmp3],[2,tmp3],[3,tmp3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1928
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1929 // tmp12 = MULTIPLY(tmp14, FIX_1_414213562) - tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1930 psubw_r2r(mm2, mm6); // wsptr[0,tmp12],[1,tmp12],[2,tmp12],[3,tmp12]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1931 // tmp1 = tmp11 + tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1932 // tmp2 = tmp11 - tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1933 movq_r2r(mm1, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1934
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1935 //OK
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1936
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1937 /* Odd part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1938
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1939 // z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1940 // z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1941 // z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1942 // z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1943 movq_m2r(*(wsptr), mm3); // wsptr[0,0],[0,1],[0,2],[0,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1944 paddw_r2r(mm6, mm1); // [0,tmp1],[1,tmp1],[2,tmp1],[3,tmp1]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1945
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1946 movq_m2r(*(wsptr+1), mm4); // wsptr[0,4],[0,5],[0,6],[0,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1947 psubw_r2r(mm6, mm5); // [0,tmp2],[1,tmp2],[2,tmp2],[3,tmp2]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1948
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1949 movq_r2r(mm3, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1950 punpckldq_r2r(mm4, mm3); // wsptr[0,0],[0,1],[0,4],[0,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1951
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1952 punpckhdq_r2r(mm6, mm4); // wsptr[0,6],[0,7],[0,2],[0,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1953 movq_r2r(mm3, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1954
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1955 //Save tmp0 and tmp1 in wsptr
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1956 movq_r2m(mm0, *(wsptr)); // save tmp0
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1957 paddw_r2r(mm4, mm2); // wsptr[xxx],[0,z11],[xxx],[0,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1958
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1959
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1960 //Continue with z10 --- z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1961 movq_m2r(*(wsptr+2), mm6); // wsptr[1,0],[1,1],[1,2],[1,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1962 psubw_r2r(mm4, mm3); // wsptr[xxx],[0,z12],[xxx],[0,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1963
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1964 movq_m2r(*(wsptr+3), mm0); // wsptr[1,4],[1,5],[1,6],[1,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1965 movq_r2r(mm6, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1966
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1967 movq_r2m(mm1, *(wsptr+1)); // save tmp1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1968 punpckldq_r2r(mm0, mm6); // wsptr[1,0],[1,1],[1,4],[1,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1969
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1970 punpckhdq_r2r(mm4, mm0); // wsptr[1,6],[1,7],[1,2],[1,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1971 movq_r2r(mm6, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1972
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1973 //Save tmp2 and tmp3 in wsptr
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1974 paddw_r2r(mm0, mm6); // wsptr[xxx],[1,z11],[xxx],[1,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1975 movq_r2r(mm2, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1976
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1977 //Continue with z10 --- z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1978 movq_r2m(mm5, *(wsptr+2)); // save tmp2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1979 punpcklwd_r2r(mm6, mm2); // wsptr[xxx],[xxx],[0,z11],[1,z11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1980
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1981 psubw_r2r(mm0, mm1); // wsptr[xxx],[1,z12],[xxx],[1,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1982 punpckhwd_r2r(mm6, mm4); // wsptr[xxx],[xxx],[0,z13],[1,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1983
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1984 movq_r2r(mm3, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1985 punpcklwd_r2r(mm1, mm3); // wsptr[xxx],[xxx],[0,z12],[1,z12]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1986
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1987 movq_r2m(mm7, *(wsptr+3)); // save tmp3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1988 punpckhwd_r2r(mm1, mm0); // wsptr[xxx],[xxx],[0,z10],[1,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1989
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1990 movq_m2r(*(wsptr+4), mm6); // wsptr[2,0],[2,1],[2,2],[2,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1991 punpckhdq_r2r(mm2, mm0); // wsptr[0,z10],[1,z10],[0,z11],[1,z11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1992
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1993 movq_m2r(*(wsptr+5), mm7); // wsptr[2,4],[2,5],[2,6],[2,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1994 punpckhdq_r2r(mm4, mm3); // wsptr[0,z12],[1,z12],[0,z13],[1,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1995
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1996 movq_m2r(*(wsptr+6), mm1); // wsptr[3,0],[3,1],[3,2],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1997 movq_r2r(mm6, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1998
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
1999 punpckldq_r2r(mm7, mm6); // wsptr[2,0],[2,1],[2,4],[2,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2000 movq_r2r(mm1, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2001
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2002 punpckhdq_r2r(mm4, mm7); // wsptr[2,6],[2,7],[2,2],[2,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2003 movq_r2r(mm6, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2004
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2005 movq_m2r(*(wsptr+7), mm4); // wsptr[3,4],[3,5],[3,6],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2006 paddw_r2r(mm7, mm6); // wsptr[xxx],[2,z11],[xxx],[2,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2007
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2008 psubw_r2r(mm7, mm2); // wsptr[xxx],[2,z12],[xxx],[2,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2009 punpckldq_r2r(mm4, mm1); // wsptr[3,0],[3,1],[3,4],[3,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2010
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2011 punpckhdq_r2r(mm5, mm4); // wsptr[3,6],[3,7],[3,2],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2012 movq_r2r(mm1, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2013
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2014 paddw_r2r(mm4, mm1); // wsptr[xxx],[3,z11],[xxx],[3,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2015 psubw_r2r(mm4, mm7); // wsptr[xxx],[3,z12],[xxx],[3,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2016
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2017 movq_r2r(mm6, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2018 punpcklwd_r2r(mm1, mm6); // wsptr[xxx],[xxx],[2,z11],[3,z11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2019
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2020 punpckhwd_r2r(mm1, mm5); // wsptr[xxx],[xxx],[2,z13],[3,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2021 movq_r2r(mm2, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2022
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2023 punpcklwd_r2r(mm7, mm2); // wsptr[xxx],[xxx],[2,z12],[3,z12]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2024
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2025 punpckhwd_r2r(mm7, mm4); // wsptr[xxx],[xxx],[2,z10],[3,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2026
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2027 punpckhdq_r2r(mm6, mm4); /// wsptr[2,z10],[3,z10],[2,z11],[3,z11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2028
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2029 punpckhdq_r2r(mm5, mm2); // wsptr[2,z12],[3,z12],[2,z13],[3,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2030 movq_r2r(mm0, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2031
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2032 punpckldq_r2r(mm4, mm0); // wsptr[0,z10],[1,z10],[2,z10],[3,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2033
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2034 punpckhdq_r2r(mm4, mm5); // wsptr[0,z11],[1,z11],[2,z11],[3,z11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2035 movq_r2r(mm3, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2036
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2037 punpckhdq_r2r(mm2, mm4); // wsptr[0,z13],[1,z13],[2,z13],[3,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2038 movq_r2r(mm5, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2039
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2040 punpckldq_r2r(mm2, mm3); // wsptr[0,z12],[1,z12],[2,z12],[3,z12]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2041 // tmp7 = z11 + z13; /* phase 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2042 // tmp8 = z11 - z13; /* phase 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2043 psubw_r2r(mm4, mm1); // tmp8
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2044
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2045 paddw_r2r(mm4, mm5); // tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2046 // tmp21 = MULTIPLY(tmp8, FIX_1_414213562); /* 2*c4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2047 psllw_i2r(2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2048
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2049 psllw_i2r(2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2050
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2051 pmulhw_m2r(fix_141, mm1); // tmp21
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2052 // tmp20 = MULTIPLY(z12, (FIX_1_082392200- FIX_1_847759065)) /* 2*(c2-c6) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2053 // + MULTIPLY(z10, - FIX_1_847759065); /* 2*c2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2054 psllw_i2r(2, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2055 movq_r2r(mm0, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2056
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2057 pmulhw_m2r(fix_n184, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2058 movq_r2r(mm3, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2059
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2060 movq_m2r(*(wsptr), mm2); // tmp0,final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2061
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2062 pmulhw_m2r(fix_108n184, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2063 // tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) /* -2*(c2+c6) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2064 // + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2065 movq_r2r(mm2, mm4); // final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2066
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2067 pmulhw_m2r(fix_184n261, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2068 paddw_r2r(mm5, mm2); // tmp0+tmp7,final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2069
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2070 pmulhw_m2r(fix_184, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2071 psubw_r2r(mm5, mm4); // tmp0-tmp7,final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2072
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2073 // tmp6 = tmp22 - tmp7; /* phase 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2074 psraw_i2r(3, mm2); // outptr[0,0],[1,0],[2,0],[3,0],final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2075
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2076 paddw_r2r(mm6, mm7); // tmp20
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2077 psraw_i2r(3, mm4); // outptr[0,7],[1,7],[2,7],[3,7],final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2078
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2079 paddw_r2r(mm0, mm3); // tmp22
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2080
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2081 // tmp5 = tmp21 - tmp6;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2082 psubw_r2r(mm5, mm3); // tmp6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2083
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2084 // tmp4 = tmp20 + tmp5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2085 movq_m2r(*(wsptr+1), mm0); // tmp1,final2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2086 psubw_r2r(mm3, mm1); // tmp5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2087
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2088 movq_r2r(mm0, mm6); // final2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2089 paddw_r2r(mm3, mm0); // tmp1+tmp6,final2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2090
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2091 /* Final output stage: scale down by a factor of 8 and range-limit */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2092
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2093
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2094 // outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2095 // & RANGE_MASK];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2096 // outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2097 // & RANGE_MASK]; final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2098
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2099
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2100 // outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2101 // & RANGE_MASK];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2102 // outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2103 // & RANGE_MASK]; final2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2104 psubw_r2r(mm3, mm6); // tmp1-tmp6,final2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2105 psraw_i2r(3, mm0); // outptr[0,1],[1,1],[2,1],[3,1]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2106
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2107 psraw_i2r(3, mm6); // outptr[0,6],[1,6],[2,6],[3,6]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2108
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2109 packuswb_r2r(mm4, mm0); // out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2110
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2111 movq_m2r(*(wsptr+2), mm5); // tmp2,final3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2112 packuswb_r2r(mm6, mm2); // out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2113
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2114 // outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2115 // & RANGE_MASK];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2116 // outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2117 // & RANGE_MASK]; final3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2118 paddw_r2r(mm1, mm7); // tmp4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2119 movq_r2r(mm5, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2120
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2121 paddw_r2r(mm1, mm5); // tmp2+tmp5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2122 psubw_r2r(mm1, mm3); // tmp2-tmp5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2123
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2124 psraw_i2r(3, mm5); // outptr[0,2],[1,2],[2,2],[3,2]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2125
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2126 movq_m2r(*(wsptr+3), mm4); // tmp3,final4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2127 psraw_i2r(3, mm3); // outptr[0,5],[1,5],[2,5],[3,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2128
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2129
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2130
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2131 // outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2132 // & RANGE_MASK];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2133 // outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2134 // & RANGE_MASK]; final4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2135 movq_r2r(mm4, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2136 paddw_r2r(mm7, mm4); // tmp3+tmp4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2137
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2138 psubw_r2r(mm7, mm6); // tmp3-tmp4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2139 psraw_i2r(3, mm4); // outptr[0,4],[1,4],[2,4],[3,4]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2140
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2141 // mov ecx, [dataptr]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2142
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2143 psraw_i2r(3, mm6); // outptr[0,3],[1,3],[2,3],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2144
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2145 packuswb_r2r(mm4, mm5); // out[0,2],[1,2],[2,2],[3,2],[0,4],[1,4],[2,4],[3,4]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2146
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2147 packuswb_r2r(mm3, mm6); // out[0,3],[1,3],[2,3],[3,3],[0,5],[1,5],[2,5],[3,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2148 movq_r2r(mm2, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2149
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2150 movq_r2r(mm5, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2151 punpcklbw_r2r(mm0, mm2); // out[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2152
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2153 punpckhbw_r2r(mm0, mm4); // out[0,6],[0,7],[1,6],[1,7],[2,6],[2,7],[3,6],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2154 movq_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2155
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2156 punpcklbw_r2r(mm6, mm5); // out[0,2],[0,3],[1,2],[1,3],[2,2],[2,3],[3,2],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2157
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2158 // add dataptr, 4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2159
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2160 punpckhbw_r2r(mm6, mm7); // out[0,4],[0,5],[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2161
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2162 punpcklwd_r2r(mm5, mm2); // out[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2163
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2164 // add ecx, output_col
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2165
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2166 movq_r2r(mm7, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2167 punpckhwd_r2r(mm5, mm1); // out[2,0],[2,1],[2,2],[2,3],[3,0],[3,1],[3,2],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2168
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2169 movq_r2r(mm2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2170 punpcklwd_r2r(mm4, mm6); // out[0,4],[0,5],[0,6],[0,7],[1,4],[1,5],[1,6],[1,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2171
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2172 // mov idata, [dataptr]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2173
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2174 punpckldq_r2r(mm6, mm2); // out[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2175
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2176 // add dataptr, 4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2177
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2178 movq_r2r(mm1, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2179
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2180 // add idata, output_col
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2181
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2182 punpckhwd_r2r(mm4, mm7); // out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2183
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2184 movq_r2m(mm2, *(dataptr));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2185
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2186 punpckhdq_r2r(mm6, mm0); // out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2187
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2188 dataptr += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2189 movq_r2m(mm0, *(dataptr));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2190
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2191 punpckldq_r2r(mm7, mm1); // out[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2192 punpckhdq_r2r(mm7, mm3); // out[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2193
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2194 dataptr += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2195 movq_r2m(mm1, *(dataptr));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2196
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2197 dataptr += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2198 movq_r2m(mm3, *(dataptr));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2199
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2200 /*******************************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2201
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2202 wsptr += 8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2203
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2204 /*******************************************************************/
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2205
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2206 // tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2207 // tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2208 // tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2209 // tmp14 = ((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2210 movq_m2r(*(wsptr), mm0); // wsptr[0,0],[0,1],[0,2],[0,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2211
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2212 movq_m2r(*(wsptr+1), mm1); // wsptr[0,4],[0,5],[0,6],[0,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2213 movq_r2r(mm0, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2214
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2215 movq_m2r(*(wsptr+2), mm3); // wsptr[1,0],[1,1],[1,2],[1,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2216 paddw_r2r(mm1, mm0); // wsptr[0,tmp10],[xxx],[0,tmp13],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2217
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2218 movq_m2r(*(wsptr+3), mm4); // wsptr[1,4],[1,5],[1,6],[1,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2219 psubw_r2r(mm1, mm2); // wsptr[0,tmp11],[xxx],[0,tmp14],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2220
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2221 movq_r2r(mm0, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2222 movq_r2r(mm3, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2223
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2224 paddw_r2r(mm4, mm3); // wsptr[1,tmp10],[xxx],[1,tmp13],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2225 movq_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2226
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2227 psubw_r2r(mm4, mm5); // wsptr[1,tmp11],[xxx],[1,tmp14],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2228 punpcklwd_r2r(mm3, mm0); // wsptr[0,tmp10],[1,tmp10],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2229
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2230 movq_m2r(*(wsptr+7), mm7); // wsptr[3,4],[3,5],[3,6],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2231 punpckhwd_r2r(mm3, mm6); // wsptr[0,tmp13],[1,tmp13],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2232
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2233 movq_m2r(*(wsptr+4), mm3); // wsptr[2,0],[2,1],[2,2],[2,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2234 punpckldq_r2r(mm6, mm0); // wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2235
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2236 punpcklwd_r2r(mm5, mm1); // wsptr[0,tmp11],[1,tmp11],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2237 movq_r2r(mm3, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2238
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2239 movq_m2r(*(wsptr+6), mm6); // wsptr[3,0],[3,1],[3,2],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2240 punpckhwd_r2r(mm5, mm2); // wsptr[0,tmp14],[1,tmp14],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2241
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2242 movq_m2r(*(wsptr+5), mm5); // wsptr[2,4],[2,5],[2,6],[2,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2243 punpckldq_r2r(mm2, mm1); // wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2244
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2245 paddw_r2r(mm5, mm3); // wsptr[2,tmp10],[xxx],[2,tmp13],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2246 movq_r2r(mm6, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2247
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2248 psubw_r2r(mm5, mm4); // wsptr[2,tmp11],[xxx],[2,tmp14],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2249 paddw_r2r(mm7, mm6); // wsptr[3,tmp10],[xxx],[3,tmp13],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2250
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2251 movq_r2r(mm3, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2252 punpcklwd_r2r(mm6, mm3); // wsptr[2,tmp10],[3,tmp10],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2253
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2254 psubw_r2r(mm7, mm2); // wsptr[3,tmp11],[xxx],[3,tmp14],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2255 punpckhwd_r2r(mm6, mm5); // wsptr[2,tmp13],[3,tmp13],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2256
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2257 movq_r2r(mm4, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2258 punpckldq_r2r(mm5, mm3); // wsptr[2,tmp10],[3,tmp10],[2,tmp13],[3,tmp13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2259
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2260 punpcklwd_r2r(mm2, mm4); // wsptr[2,tmp11],[3,tmp11],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2261
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2262 punpckhwd_r2r(mm2, mm7); // wsptr[2,tmp14],[3,tmp14],[xxx],[xxx]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2263
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2264 punpckldq_r2r(mm7, mm4); // wsptr[2,tmp11],[3,tmp11],[2,tmp14],[3,tmp14]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2265 movq_r2r(mm1, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2266
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2267 //OK
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2268
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2269 // mm0 = ;wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2270 // mm1 = ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2271
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2272 movq_r2r(mm0, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2273 punpckhdq_r2r(mm4, mm6); // wsptr[0,tmp14],[1,tmp14],[2,tmp14],[3,tmp14]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2274
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2275 punpckldq_r2r(mm4, mm1); // wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2276 psllw_i2r(2, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2277
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2278 pmulhw_m2r(fix_141, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2279 punpckldq_r2r(mm3, mm0); // wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2280
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2281 punpckhdq_r2r(mm3, mm2); // wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2282 movq_r2r(mm0, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2283
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2284 // tmp0 = tmp10 + tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2285 // tmp3 = tmp10 - tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2286 paddw_r2r(mm2, mm0); // [0,tmp0],[1,tmp0],[2,tmp0],[3,tmp0]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2287 psubw_r2r(mm2, mm7); // [0,tmp3],[1,tmp3],[2,tmp3],[3,tmp3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2288
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2289 // tmp12 = MULTIPLY(tmp14, FIX_1_414213562) - tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2290 psubw_r2r(mm2, mm6); // wsptr[0,tmp12],[1,tmp12],[2,tmp12],[3,tmp12]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2291 // tmp1 = tmp11 + tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2292 // tmp2 = tmp11 - tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2293 movq_r2r(mm1, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2294
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2295 //OK
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2296
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2297
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2298 /* Odd part */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2299
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2300 // z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2301 // z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2302 // z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2303 // z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2304 movq_m2r(*(wsptr), mm3); // wsptr[0,0],[0,1],[0,2],[0,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2305 paddw_r2r(mm6, mm1); // [0,tmp1],[1,tmp1],[2,tmp1],[3,tmp1]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2306
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2307 movq_m2r(*(wsptr+1), mm4); // wsptr[0,4],[0,5],[0,6],[0,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2308 psubw_r2r(mm6, mm5); // [0,tmp2],[1,tmp2],[2,tmp2],[3,tmp2]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2309
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2310 movq_r2r(mm3, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2311 punpckldq_r2r(mm4, mm3); // wsptr[0,0],[0,1],[0,4],[0,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2312
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2313 punpckhdq_r2r(mm6, mm4); // wsptr[0,6],[0,7],[0,2],[0,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2314 movq_r2r(mm3, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2315
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2316 //Save tmp0 and tmp1 in wsptr
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2317 movq_r2m(mm0, *(wsptr)); // save tmp0
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2318 paddw_r2r(mm4, mm2); // wsptr[xxx],[0,z11],[xxx],[0,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2319
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2320
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2321 //Continue with z10 --- z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2322 movq_m2r(*(wsptr+2), mm6); // wsptr[1,0],[1,1],[1,2],[1,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2323 psubw_r2r(mm4, mm3); // wsptr[xxx],[0,z12],[xxx],[0,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2324
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2325 movq_m2r(*(wsptr+3), mm0); // wsptr[1,4],[1,5],[1,6],[1,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2326 movq_r2r(mm6, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2327
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2328 movq_r2m(mm1, *(wsptr+1)); // save tmp1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2329 punpckldq_r2r(mm0, mm6); // wsptr[1,0],[1,1],[1,4],[1,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2330
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2331 punpckhdq_r2r(mm4, mm0); // wsptr[1,6],[1,7],[1,2],[1,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2332 movq_r2r(mm6, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2333
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2334 //Save tmp2 and tmp3 in wsptr
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2335 paddw_r2r(mm0, mm6); // wsptr[xxx],[1,z11],[xxx],[1,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2336 movq_r2r(mm2, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2337
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2338 //Continue with z10 --- z13
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2339 movq_r2m(mm5, *(wsptr+2)); // save tmp2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2340 punpcklwd_r2r(mm6, mm2); // wsptr[xxx],[xxx],[0,z11],[1,z11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2341
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2342 psubw_r2r(mm0, mm1); // wsptr[xxx],[1,z12],[xxx],[1,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2343 punpckhwd_r2r(mm6, mm4); // wsptr[xxx],[xxx],[0,z13],[1,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2344
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2345 movq_r2r(mm3, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2346 punpcklwd_r2r(mm1, mm3); // wsptr[xxx],[xxx],[0,z12],[1,z12]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2347
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2348 movq_r2m(mm7, *(wsptr+3)); // save tmp3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2349 punpckhwd_r2r(mm1, mm0); // wsptr[xxx],[xxx],[0,z10],[1,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2350
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2351 movq_m2r(*(wsptr+4), mm6); // wsptr[2,0],[2,1],[2,2],[2,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2352 punpckhdq_r2r(mm2, mm0); // wsptr[0,z10],[1,z10],[0,z11],[1,z11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2353
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2354 movq_m2r(*(wsptr+5), mm7); // wsptr[2,4],[2,5],[2,6],[2,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2355 punpckhdq_r2r(mm4, mm3); // wsptr[0,z12],[1,z12],[0,z13],[1,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2356
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2357 movq_m2r(*(wsptr+6), mm1); // wsptr[3,0],[3,1],[3,2],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2358 movq_r2r(mm6, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2359
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2360 punpckldq_r2r(mm7, mm6); // wsptr[2,0],[2,1],[2,4],[2,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2361 movq_r2r(mm1, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2362
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2363 punpckhdq_r2r(mm4, mm7); // wsptr[2,6],[2,7],[2,2],[2,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2364 movq_r2r(mm6, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2365
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2366 movq_m2r(*(wsptr+7), mm4); // wsptr[3,4],[3,5],[3,6],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2367 paddw_r2r(mm7, mm6); // wsptr[xxx],[2,z11],[xxx],[2,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2368
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2369 psubw_r2r(mm7, mm2); // wsptr[xxx],[2,z12],[xxx],[2,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2370 punpckldq_r2r(mm4, mm1); // wsptr[3,0],[3,1],[3,4],[3,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2371
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2372 punpckhdq_r2r(mm5, mm4); // wsptr[3,6],[3,7],[3,2],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2373 movq_r2r(mm1, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2374
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2375 paddw_r2r(mm4, mm1); // wsptr[xxx],[3,z11],[xxx],[3,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2376 psubw_r2r(mm4, mm7); // wsptr[xxx],[3,z12],[xxx],[3,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2377
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2378 movq_r2r(mm6, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2379 punpcklwd_r2r(mm1, mm6); // wsptr[xxx],[xxx],[2,z11],[3,z11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2380
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2381 punpckhwd_r2r(mm1, mm5); // wsptr[xxx],[xxx],[2,z13],[3,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2382 movq_r2r(mm2, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2383
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2384 punpcklwd_r2r(mm7, mm2); // wsptr[xxx],[xxx],[2,z12],[3,z12]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2385
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2386 punpckhwd_r2r(mm7, mm4); // wsptr[xxx],[xxx],[2,z10],[3,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2387
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2388 punpckhdq_r2r(mm6, mm4); // wsptr[2,z10],[3,z10],[2,z11],[3,z11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2389
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2390 punpckhdq_r2r(mm5, mm2); // wsptr[2,z12],[3,z12],[2,z13],[3,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2391 movq_r2r(mm0, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2392
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2393 punpckldq_r2r(mm4, mm0); // wsptr[0,z10],[1,z10],[2,z10],[3,z10]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2394
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2395 punpckhdq_r2r(mm4, mm5); // wsptr[0,z11],[1,z11],[2,z11],[3,z11]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2396 movq_r2r(mm3, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2397
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2398 punpckhdq_r2r(mm2, mm4); // wsptr[0,z13],[1,z13],[2,z13],[3,z13]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2399 movq_r2r(mm5, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2400
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2401 punpckldq_r2r(mm2, mm3); // wsptr[0,z12],[1,z12],[2,z12],[3,z12]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2402 // tmp7 = z11 + z13; /* phase 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2403 // tmp8 = z11 - z13; /* phase 5 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2404 psubw_r2r(mm4, mm1); // tmp8
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2405
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2406 paddw_r2r(mm4, mm5); // tmp7
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2407 // tmp21 = MULTIPLY(tmp8, FIX_1_414213562); /* 2*c4 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2408 psllw_i2r(2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2409
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2410 psllw_i2r(2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2411
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2412 pmulhw_m2r(fix_141, mm1); // tmp21
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2413 // tmp20 = MULTIPLY(z12, (FIX_1_082392200- FIX_1_847759065)) /* 2*(c2-c6) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2414 // + MULTIPLY(z10, - FIX_1_847759065); /* 2*c2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2415 psllw_i2r(2, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2416 movq_r2r(mm0, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2417
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2418 pmulhw_m2r(fix_n184, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2419 movq_r2r(mm3, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2420
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2421 movq_m2r(*(wsptr), mm2); // tmp0,final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2422
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2423 pmulhw_m2r(fix_108n184, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2424 // tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) /* -2*(c2+c6) */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2425 // + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2426 movq_r2r(mm2, mm4); // final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2427
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2428 pmulhw_m2r(fix_184n261, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2429 paddw_r2r(mm5, mm2); // tmp0+tmp7,final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2430
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2431 pmulhw_m2r(fix_184, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2432 psubw_r2r(mm5, mm4); // tmp0-tmp7,final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2433
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2434 // tmp6 = tmp22 - tmp7; /* phase 2 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2435 psraw_i2r(3, mm2); // outptr[0,0],[1,0],[2,0],[3,0],final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2436
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2437 paddw_r2r(mm6, mm7); // tmp20
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2438 psraw_i2r(3, mm4); // outptr[0,7],[1,7],[2,7],[3,7],final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2439
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2440 paddw_r2r(mm0, mm3); // tmp22
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2441
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2442 // tmp5 = tmp21 - tmp6;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2443 psubw_r2r(mm5, mm3); // tmp6
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2444
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2445 // tmp4 = tmp20 + tmp5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2446 movq_m2r(*(wsptr+1), mm0); // tmp1,final2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2447 psubw_r2r(mm3, mm1); // tmp5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2448
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2449 movq_r2r(mm0, mm6); // final2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2450 paddw_r2r(mm3, mm0); // tmp1+tmp6,final2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2451
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2452 /* Final output stage: scale down by a factor of 8 and range-limit */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2453
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2454 // outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2455 // & RANGE_MASK];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2456 // outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2457 // & RANGE_MASK]; final1
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2458
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2459
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2460 // outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2461 // & RANGE_MASK];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2462 // outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2463 // & RANGE_MASK]; final2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2464 psubw_r2r(mm3, mm6); // tmp1-tmp6,final2
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2465 psraw_i2r(3, mm0); // outptr[0,1],[1,1],[2,1],[3,1]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2466
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2467 psraw_i2r(3, mm6); // outptr[0,6],[1,6],[2,6],[3,6]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2468
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2469 packuswb_r2r(mm4, mm0); // out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2470
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2471 movq_m2r(*(wsptr+2), mm5); // tmp2,final3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2472 packuswb_r2r(mm6, mm2); // out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2473
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2474 // outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2475 // & RANGE_MASK];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2476 // outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2477 // & RANGE_MASK]; final3
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2478 paddw_r2r(mm1, mm7); // tmp4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2479 movq_r2r(mm5, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2480
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2481 paddw_r2r(mm1, mm5); // tmp2+tmp5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2482 psubw_r2r(mm1, mm3); // tmp2-tmp5
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2483
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2484 psraw_i2r(3, mm5); // outptr[0,2],[1,2],[2,2],[3,2]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2485
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2486 movq_m2r(*(wsptr+3), mm4); // tmp3,final4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2487 psraw_i2r(3, mm3); // outptr[0,5],[1,5],[2,5],[3,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2488
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2489
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2490
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2491 // outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2492 // & RANGE_MASK];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2493 // outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2494 // & RANGE_MASK]; final4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2495 movq_r2r(mm4, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2496 paddw_r2r(mm7, mm4); // tmp3+tmp4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2497
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2498 psubw_r2r(mm7, mm6); // tmp3-tmp4
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2499 psraw_i2r(3, mm4); // outptr[0,4],[1,4],[2,4],[3,4]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2500
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2501 psraw_i2r(3, mm6); // outptr[0,3],[1,3],[2,3],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2502
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2503 /*
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2504 movq_r2m(mm4, *dummy);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2505 fprintf(stderr, "3-4 %016llx\n", dummy);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2506 movq_r2m(mm4, *dummy);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2507 fprintf(stderr, "3+4 %016llx\n", dummy);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2508 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2509
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2510
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2511 packuswb_r2r(mm4, mm5); // out[0,2],[1,2],[2,2],[3,2],[0,4],[1,4],[2,4],[3,4]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2512
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2513 packuswb_r2r(mm3, mm6); // out[0,3],[1,3],[2,3],[3,3],[0,5],[1,5],[2,5],[3,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2514 movq_r2r(mm2, mm4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2515
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2516 movq_r2r(mm5, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2517 punpcklbw_r2r(mm0, mm2); // out[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2518
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2519 punpckhbw_r2r(mm0, mm4); // out[0,6],[0,7],[1,6],[1,7],[2,6],[2,7],[3,6],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2520 movq_r2r(mm2, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2521
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2522 punpcklbw_r2r(mm6, mm5); // out[0,2],[0,3],[1,2],[1,3],[2,2],[2,3],[3,2],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2523
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2524 punpckhbw_r2r(mm6, mm7); // out[0,4],[0,5],[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2525
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2526 punpcklwd_r2r(mm5, mm2); // out[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2527
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2528 movq_r2r(mm7, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2529 punpckhwd_r2r(mm5, mm1); // out[2,0],[2,1],[2,2],[2,3],[3,0],[3,1],[3,2],[3,3]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2530
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2531 movq_r2r(mm2, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2532 punpcklwd_r2r(mm4, mm6); // out[0,4],[0,5],[0,6],[0,7],[1,4],[1,5],[1,6],[1,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2533
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2534 punpckldq_r2r(mm6, mm2); // out[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2535
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2536 movq_r2r(mm1, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2537
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2538 punpckhwd_r2r(mm4, mm7); // out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2539
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2540 dataptr += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2541 movq_r2m(mm2, *(dataptr));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2542
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2543 punpckhdq_r2r(mm6, mm0); // out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2544
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2545 dataptr += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2546 movq_r2m(mm0, *(dataptr));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2547
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2548 punpckldq_r2r(mm7, mm1); // out[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2549
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2550 punpckhdq_r2r(mm7, mm3); // out[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7]
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2551
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2552 dataptr += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2553 movq_r2m(mm1, *(dataptr));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2554
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2555 dataptr += rskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2556 movq_r2m(mm3, *(dataptr));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2557
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2558 #else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2559 __s32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2560 __s32 tmp10, tmp11, tmp12, tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2561 __s32 z5, z10, z11, z12, z13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2562 __s16 *inptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2563 __s32 *wsptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2564 __u8 *outptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2565 int ctr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2566 __s32 dcval;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2567 __s32 workspace[64];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2568
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2569 inptr = data;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2570 wsptr = workspace;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2571 for (ctr = 8; ctr > 0; ctr--) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2572
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2573 if ((inptr[8] | inptr[16] | inptr[24] |
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2574 inptr[32] | inptr[40] | inptr[48] | inptr[56]) == 0) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2575 dcval = inptr[0];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2576 wsptr[0] = dcval;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2577 wsptr[8] = dcval;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2578 wsptr[16] = dcval;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2579 wsptr[24] = dcval;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2580 wsptr[32] = dcval;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2581 wsptr[40] = dcval;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2582 wsptr[48] = dcval;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2583 wsptr[56] = dcval;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2584
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2585 inptr++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2586 wsptr++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2587 continue;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2588 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2589
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2590 tmp0 = inptr[0];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2591 tmp1 = inptr[16];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2592 tmp2 = inptr[32];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2593 tmp3 = inptr[48];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2594
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2595 tmp10 = tmp0 + tmp2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2596 tmp11 = tmp0 - tmp2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2597
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2598 tmp13 = tmp1 + tmp3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2599 tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2600
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2601 tmp0 = tmp10 + tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2602 tmp3 = tmp10 - tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2603 tmp1 = tmp11 + tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2604 tmp2 = tmp11 - tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2605
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2606 tmp4 = inptr[8];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2607 tmp5 = inptr[24];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2608 tmp6 = inptr[40];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2609 tmp7 = inptr[56];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2610
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2611 z13 = tmp6 + tmp5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2612 z10 = tmp6 - tmp5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2613 z11 = tmp4 + tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2614 z12 = tmp4 - tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2615
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2616 tmp7 = z11 + z13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2617 tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2618
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2619 z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2620 tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2621 tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2622
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2623 tmp6 = tmp12 - tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2624 tmp5 = tmp11 - tmp6;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2625 tmp4 = tmp10 + tmp5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2626
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2627 wsptr[0] = (__s32) (tmp0 + tmp7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2628 wsptr[56] = (__s32) (tmp0 - tmp7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2629 wsptr[8] = (__s32) (tmp1 + tmp6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2630 wsptr[48] = (__s32) (tmp1 - tmp6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2631 wsptr[16] = (__s32) (tmp2 + tmp5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2632 wsptr[40] = (__s32) (tmp2 - tmp5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2633 wsptr[32] = (__s32) (tmp3 + tmp4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2634 wsptr[24] = (__s32) (tmp3 - tmp4);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2635
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2636 inptr++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2637 wsptr++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2638 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2639
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2640 wsptr = workspace;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2641 for (ctr = 0; ctr < 8; ctr++) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2642 outptr = &(odata[ctr*rskip]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2643
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2644 tmp10 = wsptr[0] + wsptr[4];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2645 tmp11 = wsptr[0] - wsptr[4];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2646
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2647 tmp13 = wsptr[2] + wsptr[6];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2648 tmp12 = MULTIPLY(wsptr[2] - wsptr[6], FIX_1_414213562) - tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2649
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2650 tmp0 = tmp10 + tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2651 tmp3 = tmp10 - tmp13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2652 tmp1 = tmp11 + tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2653 tmp2 = tmp11 - tmp12;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2654
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2655 z13 = wsptr[5] + wsptr[3];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2656 z10 = wsptr[5] - wsptr[3];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2657 z11 = wsptr[1] + wsptr[7];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2658 z12 = wsptr[1] - wsptr[7];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2659
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2660 tmp7 = z11 + z13;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2661 tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2662
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2663 z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2664 tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2665 tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2666
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2667 tmp6 = tmp12 - tmp7;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2668 tmp5 = tmp11 - tmp6;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2669 tmp4 = tmp10 + tmp5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2670
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2671 outptr[0] = RL(DESCALE(tmp0 + tmp7));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2672 outptr[7] = RL(DESCALE(tmp0 - tmp7));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2673 outptr[1] = RL(DESCALE(tmp1 + tmp6));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2674 outptr[6] = RL(DESCALE(tmp1 - tmp6));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2675 outptr[2] = RL(DESCALE(tmp2 + tmp5));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2676 outptr[5] = RL(DESCALE(tmp2 - tmp5));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2677 outptr[4] = RL(DESCALE(tmp3 + tmp4));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2678 outptr[3] = RL(DESCALE(tmp3 - tmp4));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2679
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2680 wsptr += 8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2681 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2682 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2683 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2684 /*
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2685
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2686 Main Routines
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2687
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2688 This file contains most of the initialisation and control functions
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2689
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2690 (C) Justin Schoeman 1998
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2691
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2692 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2693
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2694 /*
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2695
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2696 Private function
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2697
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2698 Initialise all the cache-aliged data blocks
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2699
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2700 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2701
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2702 void RTjpeg_init_data(void)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2703 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2704 unsigned long dptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2705
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2706 dptr=(unsigned long)&(RTjpeg_alldata[0]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2707 dptr+=32;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2708 dptr=dptr>>5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2709 dptr=dptr<<5; /* cache align data */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2710
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2711 RTjpeg_block=(__s16 *)dptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2712 dptr+=sizeof(__s16)*64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2713 RTjpeg_lqt=(__s32 *)dptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2714 dptr+=sizeof(__s32)*64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2715 RTjpeg_cqt=(__s32 *)dptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2716 dptr+=sizeof(__s32)*64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2717 RTjpeg_liqt=(__u32 *)dptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2718 dptr+=sizeof(__u32)*64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2719 RTjpeg_ciqt=(__u32 *)dptr;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2720 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2721
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2722 /*
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2723
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2724 External Function
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2725
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2726 Re-set quality factor
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2727
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2728 Input: buf -> pointer to 128 ints for quant values store to pass back to
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2729 init_decompress.
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2730 Q -> quality factor (192=best, 32=worst)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2731 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2732
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2733 void RTjpeg_init_Q(__u8 Q)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2734 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2735 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2736 __u64 qual;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2737
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2738 qual=(__u64)Q<<(32-7); /* 32 bit FP, 255=2, 0=0 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2739
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2740 for(i=0; i<64; i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2741 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2742 RTjpeg_lqt[i]=(__s32)((qual/((__u64)RTjpeg_lum_quant_tbl[i]<<16))>>3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2743 if(RTjpeg_lqt[i]==0)RTjpeg_lqt[i]=1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2744 RTjpeg_cqt[i]=(__s32)((qual/((__u64)RTjpeg_chrom_quant_tbl[i]<<16))>>3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2745 if(RTjpeg_cqt[i]==0)RTjpeg_cqt[i]=1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2746 RTjpeg_liqt[i]=(1<<16)/(RTjpeg_lqt[i]<<3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2747 RTjpeg_ciqt[i]=(1<<16)/(RTjpeg_cqt[i]<<3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2748 RTjpeg_lqt[i]=((1<<16)/RTjpeg_liqt[i])>>3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2749 RTjpeg_cqt[i]=((1<<16)/RTjpeg_ciqt[i])>>3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2750 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2751
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2752 RTjpeg_lb8=0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2753 while(RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]]<=8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2754 RTjpeg_lb8--;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2755 RTjpeg_cb8=0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2756 while(RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]]<=8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2757 RTjpeg_cb8--;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2758
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2759 RTjpeg_dct_init();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2760 RTjpeg_idct_init();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2761 RTjpeg_quant_init();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2762 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2763
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2764 /*
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2765
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2766 External Function
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2767
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2768 Initialise compression.
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2769
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2770 Input: buf -> pointer to 128 ints for quant values store to pass back to
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2771 init_decompress.
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2772 width -> width of image
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2773 height -> height of image
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2774 Q -> quality factor (192=best, 32=worst)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2775
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2776 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2777
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2778 void RTjpeg_init_compress(__u32 *buf, int width, int height, __u8 Q)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2779 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2780 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2781 __u64 qual;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2782
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2783 RTjpeg_init_data();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2784
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2785 RTjpeg_width=width;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2786 RTjpeg_height=height;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2787 RTjpeg_Ywidth = RTjpeg_width>>3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2788 RTjpeg_Ysize=width * height;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2789 RTjpeg_Cwidth = RTjpeg_width>>4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2790 RTjpeg_Csize= (width>>1) * height;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2791
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2792 qual=(__u64)Q<<(32-7); /* 32 bit FP, 255=2, 0=0 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2793
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2794 for(i=0; i<64; i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2795 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2796 RTjpeg_lqt[i]=(__s32)((qual/((__u64)RTjpeg_lum_quant_tbl[i]<<16))>>3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2797 if(RTjpeg_lqt[i]==0)RTjpeg_lqt[i]=1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2798 RTjpeg_cqt[i]=(__s32)((qual/((__u64)RTjpeg_chrom_quant_tbl[i]<<16))>>3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2799 if(RTjpeg_cqt[i]==0)RTjpeg_cqt[i]=1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2800 RTjpeg_liqt[i]=(1<<16)/(RTjpeg_lqt[i]<<3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2801 RTjpeg_ciqt[i]=(1<<16)/(RTjpeg_cqt[i]<<3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2802 RTjpeg_lqt[i]=((1<<16)/RTjpeg_liqt[i])>>3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2803 RTjpeg_cqt[i]=((1<<16)/RTjpeg_ciqt[i])>>3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2804 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2805
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2806 RTjpeg_lb8=0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2807 while(RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]]<=8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2808 RTjpeg_lb8--;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2809 RTjpeg_cb8=0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2810 while(RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]]<=8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2811 RTjpeg_cb8--;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2812
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2813 RTjpeg_dct_init();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2814 RTjpeg_quant_init();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2815
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2816 for(i=0; i<64; i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2817 buf[i]=RTjpeg_liqt[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2818 for(i=0; i<64; i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2819 buf[64+i]=RTjpeg_ciqt[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2820 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2821
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2822 void RTjpeg_init_decompress(__u32 *buf, int width, int height)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2823 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2824 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2825
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2826 RTjpeg_init_data();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2827
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2828 RTjpeg_width=width;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2829 RTjpeg_height=height;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2830 RTjpeg_Ywidth = RTjpeg_width>>3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2831 RTjpeg_Ysize=width * height;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2832 RTjpeg_Cwidth = RTjpeg_width>>4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2833 RTjpeg_Csize= (width>>1) * height;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2834
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2835 for(i=0; i<64; i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2836 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2837 RTjpeg_liqt[i]=buf[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2838 RTjpeg_ciqt[i]=buf[i+64];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2839 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2840
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2841 RTjpeg_lb8=0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2842 while(RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]]<=8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2843 RTjpeg_lb8--;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2844 RTjpeg_cb8=0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2845 while(RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]]<=8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2846 RTjpeg_cb8--;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2847
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2848 RTjpeg_idct_init();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2849
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2850 // RTjpeg_color_init();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2851 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2852
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2853 int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2854 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2855 __s8 * sb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2856 register __s8 * bp1 = bp + (RTjpeg_width<<3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2857 register __s8 * bp2 = bp + RTjpeg_Ysize;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2858 register __s8 * bp3 = bp2 + (RTjpeg_Csize>>1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2859 register int i, j, k;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2860
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2861 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2862 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2863 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2864 sb=sp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2865 /* Y */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2866 for(i=RTjpeg_height>>1; i; i-=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2867 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2868 for(j=0, k=0; j<RTjpeg_width; j+=16, k+=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2869 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2870 RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2871 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2872 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2873
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2874 RTjpeg_dctY(bp+j+8, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2875 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2876 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2877
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2878 RTjpeg_dctY(bp1+j, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2879 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2880 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2881
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2882 RTjpeg_dctY(bp1+j+8, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2883 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2884 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2885
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2886 RTjpeg_dctY(bp2+k, RTjpeg_block, RTjpeg_Cwidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2887 RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2888 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2889
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2890 RTjpeg_dctY(bp3+k, RTjpeg_block, RTjpeg_Cwidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2891 RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2892 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2893
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2894 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2895 bp+=RTjpeg_width<<4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2896 bp1+=RTjpeg_width<<4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2897 bp2+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2898 bp3+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2899
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2900 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2901 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2902 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2903 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2904 return (sp-sb);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2905 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2906
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2907 int RTjpeg_compressYUV422(__s8 *sp, unsigned char *bp)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2908 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2909 __s8 * sb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2910 register __s8 * bp2 = bp + RTjpeg_Ysize;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2911 register __s8 * bp3 = bp2 + RTjpeg_Csize;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2912 register int i, j, k;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2913
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2914 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2915 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2916 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2917 sb=sp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2918 /* Y */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2919 for(i=RTjpeg_height; i; i-=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2920 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2921 for(j=0, k=0; j<RTjpeg_width; j+=16, k+=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2922 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2923 RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2924 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2925 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2926
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2927 RTjpeg_dctY(bp+j+8, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2928 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2929 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2930
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2931 RTjpeg_dctY(bp2+k, RTjpeg_block, RTjpeg_Cwidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2932 RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2933 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2934
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2935 RTjpeg_dctY(bp3+k, RTjpeg_block, RTjpeg_Cwidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2936 RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2937 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2938
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2939 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2940 bp+=RTjpeg_width<<3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2941 bp2+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2942 bp3+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2943
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2944 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2945 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2946 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2947 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2948 return (sp-sb);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2949 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2950
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2951 int RTjpeg_compress8(__s8 *sp, unsigned char *bp)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2952 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2953 __s8 * sb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2954 int i, j;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2955
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2956 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2957 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2958 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2959
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2960 sb=sp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2961 /* Y */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2962 for(i=0; i<RTjpeg_height; i+=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2963 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2964 for(j=0; j<RTjpeg_width; j+=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2965 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2966 RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_width);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2967 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2968 sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2969 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2970 bp+=RTjpeg_width;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2971 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2972
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2973 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2974 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2975 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2976 return (sp-sb);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2977 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2978
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2979 void RTjpeg_decompressYUV422(__s8 *sp, __u8 *bp)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2980 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2981 register __s8 * bp2 = bp + RTjpeg_Ysize;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2982 register __s8 * bp3 = bp2 + (RTjpeg_Csize);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2983 int i, j,k;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2984
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2985 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2986 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2987 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2988
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2989 /* Y */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2990 for(i=RTjpeg_height; i; i-=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2991 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2992 for(k=0, j=0; j<RTjpeg_width; j+=16, k+=8) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2993 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2994 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2995 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2996 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2997 RTjpeg_idct(bp+j, RTjpeg_block, RTjpeg_width);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2998 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
2999 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3000 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3001 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3002 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3003 RTjpeg_idct(bp+j+8, RTjpeg_block, RTjpeg_width);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3004 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3005 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3006 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3007 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3008 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3009 RTjpeg_idct(bp2+k, RTjpeg_block, RTjpeg_width>>1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3010 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3011 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3012 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3013 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3014 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3015 RTjpeg_idct(bp3+k, RTjpeg_block, RTjpeg_width>>1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3016 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3017 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3018 bp+=RTjpeg_width<<3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3019 bp2+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3020 bp3+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3021 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3022 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3023 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3024 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3025 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3026
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3027 void RTjpeg_decompressYUV420(__s8 *sp, __u8 *bp)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3028 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3029 register __s8 * bp1 = bp + (RTjpeg_width<<3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3030 register __s8 * bp2 = bp + RTjpeg_Ysize;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3031 register __s8 * bp3 = bp2 + (RTjpeg_Csize>>1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3032 int i, j,k;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3033
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3034 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3035 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3036 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3037
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3038 /* Y */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3039 for(i=RTjpeg_height>>1; i; i-=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3040 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3041 for(k=0, j=0; j<RTjpeg_width; j+=16, k+=8) {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3042 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3043 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3044 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3045 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3046 RTjpeg_idct(bp+j, RTjpeg_block, RTjpeg_width);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3047 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3048 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3049 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3050 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3051 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3052 RTjpeg_idct(bp+j+8, RTjpeg_block, RTjpeg_width);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3053 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3054 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3055 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3056 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3057 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3058 RTjpeg_idct(bp1+j, RTjpeg_block, RTjpeg_width);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3059 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3060 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3061 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3062 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3063 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3064 RTjpeg_idct(bp1+j+8, RTjpeg_block, RTjpeg_width);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3065 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3066 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3067 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3068 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3069 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3070 RTjpeg_idct(bp2+k, RTjpeg_block, RTjpeg_width>>1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3071 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3072 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3073 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3074 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3075 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3076 RTjpeg_idct(bp3+k, RTjpeg_block, RTjpeg_width>>1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3077 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3078 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3079 bp+=RTjpeg_width<<4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3080 bp1+=RTjpeg_width<<4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3081 bp2+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3082 bp3+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3083 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3084 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3085 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3086 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3087 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3088
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3089 void RTjpeg_decompress8(__s8 *sp, __u8 *bp)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3090 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3091 int i, j;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3092
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3093 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3094 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3095 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3096
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3097 /* Y */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3098 for(i=0; i<RTjpeg_height; i+=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3099 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3100 for(j=0; j<RTjpeg_width; j+=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3101 if(*sp==-1)sp++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3102 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3103 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3104 sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3105 RTjpeg_idct(bp+j, RTjpeg_block, RTjpeg_width);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3106 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3107 bp+=RTjpeg_width<<3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3108 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3109 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3110
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3111 /*
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3112 External Function
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3113
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3114 Initialise additional data structures for motion compensation
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3115
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3116 */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3117
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3118 void RTjpeg_init_mcompress(void)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3119 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3120 unsigned long tmp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3121
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3122 if(!RTjpeg_old)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3123 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3124 RTjpeg_old=malloc((4*RTjpeg_width*RTjpeg_height)+32);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3125 tmp=(unsigned long)RTjpeg_old;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3126 tmp+=32;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3127 tmp=tmp>>5;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3128 RTjpeg_old=(__s16 *)(tmp<<5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3129 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3130 if (!RTjpeg_old)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3131 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3132 fprintf(stderr, "RTjpeg: Could not allocate memory\n");
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3133 exit(-1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3134 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3135 bzero(RTjpeg_old, ((4*RTjpeg_width*RTjpeg_height)));
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3136 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3137
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3138 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3139
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3140 int RTjpeg_bcomp(__s16 *old, mmx_t *mask)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3141 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3142 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3143 mmx_t *mold=(mmx_t *)old;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3144 mmx_t *mblock=(mmx_t *)RTjpeg_block;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3145 volatile mmx_t result;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3146 static mmx_t neg=(mmx_t)(unsigned long long)0xffffffffffffffffULL;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3147
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3148 movq_m2r(*mask, mm7);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3149 movq_m2r(neg, mm6);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3150 pxor_r2r(mm5, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3151
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3152 for(i=0; i<8; i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3153 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3154 movq_m2r(*(mblock++), mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3155 movq_m2r(*(mblock++), mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3156 movq_m2r(*(mold++), mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3157 movq_m2r(*(mold++), mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3158 psubsw_r2r(mm1, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3159 psubsw_r2r(mm3, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3160 movq_r2r(mm0, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3161 movq_r2r(mm2, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3162 pcmpgtw_r2r(mm7, mm0);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3163 pcmpgtw_r2r(mm7, mm2);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3164 pxor_r2r(mm6, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3165 pxor_r2r(mm6, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3166 pcmpgtw_r2r(mm7, mm1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3167 pcmpgtw_r2r(mm7, mm3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3168 por_r2r(mm0, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3169 por_r2r(mm2, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3170 por_r2r(mm1, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3171 por_r2r(mm3, mm5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3172 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3173 movq_r2m(mm5, result);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3174
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3175 if(result.q)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3176 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3177 // if(!RTjpeg_mtest)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3178 // for(i=0; i<16; i++)((__u64 *)old)[i]=((__u64 *)RTjpeg_block)[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3179 return 0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3180 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3181 // printf(".");
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3182 return 1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3183 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3184
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3185 #else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3186 int RTjpeg_bcomp(__s16 *old, __u16 *mask)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3187 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3188 int i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3189
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3190 for(i=0; i<64; i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3191 if(abs(old[i]-RTjpeg_block[i])>*mask)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3192 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3193 if(!RTjpeg_mtest)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3194 for(i=0; i<16; i++)((__u64 *)old)[i]=((__u64 *)RTjpeg_block)[i];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3195 return 0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3196 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3197 return 1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3198 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3199 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3200
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3201 void RTjpeg_set_test(int i)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3202 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3203 RTjpeg_mtest=i;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3204 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3205
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3206 int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3207 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3208 __s8 * sb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3209 //rh __s16 *block;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3210 register __s8 * bp1 = bp + (RTjpeg_width<<3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3211 register __s8 * bp2 = bp + RTjpeg_Ysize;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3212 register __s8 * bp3 = bp2 + (RTjpeg_Csize>>1);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3213 register int i, j, k;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3214
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3215 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3216 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3217 RTjpeg_lmask=(mmx_t)(((__u64)lmask<<48)|((__u64)lmask<<32)|((__u64)lmask<<16)|lmask);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3218 RTjpeg_cmask=(mmx_t)(((__u64)cmask<<48)|((__u64)cmask<<32)|((__u64)cmask<<16)|cmask);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3219 #else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3220 RTjpeg_lmask=lmask;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3221 RTjpeg_cmask=cmask;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3222 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3223
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3224 sb=sp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3225 block=RTjpeg_old;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3226 /* Y */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3227 for(i=RTjpeg_height>>1; i; i-=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3228 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3229 for(j=0, k=0; j<RTjpeg_width; j+=16, k+=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3230 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3231 RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3232 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3233 if(RTjpeg_bcomp(block, &RTjpeg_lmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3234 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3235 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3236 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3237 else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3238 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3239
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3240 RTjpeg_dctY(bp+j+8, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3241 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3242 if(RTjpeg_bcomp(block, &RTjpeg_lmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3243 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3244 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3245 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3246 else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3247 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3248
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3249 RTjpeg_dctY(bp1+j, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3250 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3251 if(RTjpeg_bcomp(block, &RTjpeg_lmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3252 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3253 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3254 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3255 else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3256 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3257
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3258 RTjpeg_dctY(bp1+j+8, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3259 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3260 if(RTjpeg_bcomp(block, &RTjpeg_lmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3261 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3262 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3263 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3264 else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3265 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3266
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3267 RTjpeg_dctY(bp2+k, RTjpeg_block, RTjpeg_Cwidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3268 RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3269 if(RTjpeg_bcomp(block, &RTjpeg_cmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3270 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3271 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3272 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3273 else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3274 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3275
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3276 RTjpeg_dctY(bp3+k, RTjpeg_block, RTjpeg_Cwidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3277 RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3278 if(RTjpeg_bcomp(block, &RTjpeg_cmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3279 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3280 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3281 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3282 else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3283 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3284 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3285 bp+=RTjpeg_width<<4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3286 bp1+=RTjpeg_width<<4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3287 bp2+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3288 bp3+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3289
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3290 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3291 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3292 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3293 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3294 return (sp-sb);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3295 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3296
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3297
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3298 int RTjpeg_mcompressYUV422(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3299 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3300 __s8 * sb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3301 __s16 *block;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3302 register __s8 * bp2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3303 register __s8 * bp3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3304 register int i, j, k;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3305
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3306 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3307 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3308 RTjpeg_lmask=(mmx_t)(((__u64)lmask<<48)|((__u64)lmask<<32)|((__u64)lmask<<16)|lmask);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3309 RTjpeg_cmask=(mmx_t)(((__u64)cmask<<48)|((__u64)cmask<<32)|((__u64)cmask<<16)|cmask);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3310 #else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3311 RTjpeg_lmask=lmask;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3312 RTjpeg_cmask=cmask;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3313 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3314
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3315 bp = bp - RTjpeg_width*0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3316 bp2 = bp + RTjpeg_Ysize-RTjpeg_width*0;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3317 bp3 = bp2 + RTjpeg_Csize;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3318
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3319 sb=sp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3320 block=RTjpeg_old;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3321 /* Y */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3322 for(i=RTjpeg_height; i; i-=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3323 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3324 for(j=0, k=0; j<RTjpeg_width; j+=16, k+=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3325 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3326 RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3327 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3328 if(RTjpeg_bcomp(block, &RTjpeg_lmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3329 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3330 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3331 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3332 else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3333 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3334
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3335 RTjpeg_dctY(bp+j+8, RTjpeg_block, RTjpeg_Ywidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3336 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3337 if(RTjpeg_bcomp(block, &RTjpeg_lmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3338 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3339 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3340 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3341 else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3342 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3343
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3344 RTjpeg_dctY(bp2+k, RTjpeg_block, RTjpeg_Cwidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3345 RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3346 if(RTjpeg_bcomp(block, &RTjpeg_cmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3347 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3348 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3349 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3350 else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3351 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3352
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3353 RTjpeg_dctY(bp3+k, RTjpeg_block, RTjpeg_Cwidth);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3354 RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3355 if(RTjpeg_bcomp(block, &RTjpeg_cmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3356 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3357 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3358 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3359 else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3360 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3361
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3362 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3363 bp+=RTjpeg_width<<3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3364 bp2+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3365 bp3+=RTjpeg_width<<2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3366 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3367 printf ("%d\n", block - RTjpeg_old);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3368 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3369 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3370 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3371 return (sp-sb);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3372 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3373
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3374 int RTjpeg_mcompress8(__s8 *sp, unsigned char *bp, __u16 lmask)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3375 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3376 __s8 * sb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3377 __s16 *block;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3378 int i, j;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3379
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3380 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3381 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3382 RTjpeg_lmask=(mmx_t)(((__u64)lmask<<48)|((__u64)lmask<<32)|((__u64)lmask<<16)|lmask);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3383 #else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3384 RTjpeg_lmask=lmask;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3385 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3386
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3387
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3388 sb=sp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3389 block=RTjpeg_old;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3390 /* Y */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3391 for(i=0; i<RTjpeg_height; i+=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3392 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3393 for(j=0; j<RTjpeg_width; j+=8)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3394 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3395 RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_width);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3396 RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3397 if(RTjpeg_bcomp(block, &RTjpeg_lmask))
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3398 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3399 *((__u8 *)sp++)=255;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3400 // printf("* %d ", sp[-1]);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3401 } else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3402 block+=64;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3403 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3404 bp+=RTjpeg_width<<3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3405 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3406 #ifdef MMX
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3407 emms();
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3408 #endif
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3409 return (sp-sb);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3410 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3411
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3412 void RTjpeg_color_init(void)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3413 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3414 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3415
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3416 #define KcrR 76284
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3417 #define KcrG 53281
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3418 #define KcbG 25625
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3419 #define KcbB 132252
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3420 #define Ky 76284
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3421
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3422 void RTjpeg_yuv422rgb(__u8 *buf, __u8 *rgb, int stride)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3423 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3424 int tmp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3425 int i, j;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3426 __s32 y, crR, crG, cbG, cbB;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3427 __u8 *bufcr, *bufcb, *bufy, *bufoute;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3428 int yskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3429
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3430 yskip=RTjpeg_width;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3431
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3432 bufcb=&buf[RTjpeg_width*RTjpeg_height];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3433 bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/2];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3434 bufy=&buf[0];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3435 bufoute=rgb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3436
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3437 for(i=0; i<(RTjpeg_height); i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3438 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3439 for(j=0; j<RTjpeg_width; j+=2)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3440 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3441 crR=(*bufcr-128)*KcrR;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3442 crG=(*(bufcr++)-128)*KcrG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3443 cbG=(*bufcb-128)*KcbG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3444 cbB=(*(bufcb++)-128)*KcbB;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3445
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3446 y=(bufy[j]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3447
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3448 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3449 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3450 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3451 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3452 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3453 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3454
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3455 y=(bufy[j+1]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3456
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3457 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3458 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3459 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3460 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3461 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3462 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3463
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3464 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3465 bufy+=yskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3466 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3467 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3468
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3469
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3470 void RTjpeg_yuv420rgb(__u8 *buf, __u8 *rgb, int stride)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3471 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3472 int tmp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3473 int i, j;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3474 __s32 y, crR, crG, cbG, cbB;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3475 __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3476 int oskip, yskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3477
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3478 if(stride==0)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3479 oskip=RTjpeg_width*3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3480 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3481 oskip=2*stride-RTjpeg_width*3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3482
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3483 yskip=RTjpeg_width;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3484
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3485 bufcb=&buf[RTjpeg_width*RTjpeg_height];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3486 bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/4];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3487 bufy=&buf[0];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3488 bufoute=rgb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3489 bufouto=rgb+RTjpeg_width*3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3490
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3491 for(i=0; i<(RTjpeg_height>>1); i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3492 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3493 for(j=0; j<RTjpeg_width; j+=2)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3494 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3495 crR=(*bufcr-128)*KcrR;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3496 crG=(*(bufcr++)-128)*KcrG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3497 cbG=(*bufcb-128)*KcbG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3498 cbB=(*(bufcb++)-128)*KcbB;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3499
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3500 y=(bufy[j]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3501
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3502 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3503 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3504 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3505 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3506 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3507 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3508
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3509 y=(bufy[j+1]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3510
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3511 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3512 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3513 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3514 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3515 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3516 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3517
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3518 y=(bufy[j+yskip]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3519
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3520 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3521 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3522 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3523 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3524 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3525 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3526
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3527 y=(bufy[j+1+yskip]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3528
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3529 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3530 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3531 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3532 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3533 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3534 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3535
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3536 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3537 bufoute+=oskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3538 bufouto+=oskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3539 bufy+=yskip<<1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3540 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3541 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3542
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3543
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3544 void RTjpeg_yuvrgb32(__u8 *buf, __u8 *rgb, int stride)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3545 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3546 int tmp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3547 int i, j;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3548 __s32 y, crR, crG, cbG, cbB;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3549 __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3550 int oskip, yskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3551
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3552 if(stride==0)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3553 oskip=RTjpeg_width*4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3554 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3555 oskip = 2*stride-RTjpeg_width*4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3556 yskip=RTjpeg_width;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3557
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3558 bufcb=&buf[RTjpeg_width*RTjpeg_height];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3559 bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/2];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3560 bufy=&buf[0];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3561 bufoute=rgb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3562 bufouto=rgb+RTjpeg_width*4;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3563
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3564 for(i=0; i<(RTjpeg_height>>1); i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3565 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3566 for(j=0; j<RTjpeg_width; j+=2)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3567 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3568 crR=(*bufcr-128)*KcrR;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3569 crG=(*(bufcr++)-128)*KcrG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3570 cbG=(*bufcb-128)*KcbG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3571 cbB=(*(bufcb++)-128)*KcbB;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3572
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3573 y=(bufy[j]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3574
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3575 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3576 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3577 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3578 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3579 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3580 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3581 bufoute++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3582
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3583 y=(bufy[j+1]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3584
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3585 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3586 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3587 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3588 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3589 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3590 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3591 bufoute++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3592
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3593 y=(bufy[j+yskip]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3594
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3595 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3596 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3597 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3598 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3599 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3600 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3601 bufouto++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3602
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3603 y=(bufy[j+1+yskip]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3604
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3605 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3606 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3607 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3608 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3609 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3610 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3611 bufouto++;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3612
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3613 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3614 bufoute+=oskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3615 bufouto+=oskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3616 bufy+=yskip<<1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3617 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3618 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3619
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3620 void RTjpeg_yuvrgb24(__u8 *buf, __u8 *rgb, int stride)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3621 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3622 int tmp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3623 int i, j;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3624 __s32 y, crR, crG, cbG, cbB;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3625 __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3626 int oskip, yskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3627
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3628 if(stride==0)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3629 oskip=RTjpeg_width*3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3630 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3631 oskip=2*stride - RTjpeg_width*3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3632
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3633 yskip=RTjpeg_width;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3634
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3635 bufcb=&buf[RTjpeg_width*RTjpeg_height];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3636 bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/4];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3637 bufy=&buf[0];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3638 bufoute=rgb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3639 bufouto=rgb+RTjpeg_width*3;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3640
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3641 for(i=0; i<(RTjpeg_height>>1); i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3642 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3643 for(j=0; j<RTjpeg_width; j+=2)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3644 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3645 crR=(*bufcr-128)*KcrR;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3646 crG=(*(bufcr++)-128)*KcrG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3647 cbG=(*bufcb-128)*KcbG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3648 cbB=(*(bufcb++)-128)*KcbB;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3649
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3650 y=(bufy[j]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3651
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3652 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3653 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3654 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3655 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3656 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3657 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3658
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3659 y=(bufy[j+1]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3660
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3661 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3662 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3663 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3664 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3665 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3666 *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3667
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3668 y=(bufy[j+yskip]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3669
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3670 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3671 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3672 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3673 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3674 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3675 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3676
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3677 y=(bufy[j+1+yskip]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3678
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3679 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3680 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3681 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3682 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3683 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3684 *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3685
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3686 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3687 bufoute+=oskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3688 bufouto+=oskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3689 bufy+=yskip<<1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3690 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3691 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3692
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3693 void RTjpeg_yuvrgb16(__u8 *buf, __u8 *rgb, int stride)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3694 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3695 int tmp;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3696 int i, j;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3697 __s32 y, crR, crG, cbG, cbB;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3698 __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3699 int oskip, yskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3700 unsigned char r, g, b;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3701
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3702 if(stride==0)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3703 oskip=RTjpeg_width*2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3704 else
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3705 oskip=2*stride-RTjpeg_width*2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3706
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3707 yskip=RTjpeg_width;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3708
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3709 bufcb=&buf[RTjpeg_width*RTjpeg_height];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3710 bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/4];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3711 bufy=&buf[0];
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3712 bufoute=rgb;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3713 bufouto=rgb+RTjpeg_width*2;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3714
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3715 for(i=0; i<(RTjpeg_height>>1); i++)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3716 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3717 for(j=0; j<RTjpeg_width; j+=2)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3718 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3719 crR=(*bufcr-128)*KcrR;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3720 crG=(*(bufcr++)-128)*KcrG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3721 cbG=(*bufcb-128)*KcbG;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3722 cbB=(*(bufcb++)-128)*KcbB;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3723
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3724 y=(bufy[j]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3725
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3726 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3727 b=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3728 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3729 g=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3730 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3731 r=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3732 tmp=(int)((int)b >> 3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3733 tmp|=(int)(((int)g >> 2) << 5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3734 tmp|=(int)(((int)r >> 3) << 11);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3735 *(bufoute++)=tmp&0xff;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3736 *(bufoute++)=tmp>>8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3737
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3738
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3739 y=(bufy[j+1]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3740
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3741 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3742 b=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3743 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3744 g=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3745 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3746 r=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3747 tmp=(int)((int)b >> 3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3748 tmp|=(int)(((int)g >> 2) << 5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3749 tmp|=(int)(((int)r >> 3) << 11);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3750 *(bufoute++)=tmp&0xff;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3751 *(bufoute++)=tmp>>8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3752
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3753 y=(bufy[j+yskip]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3754
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3755 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3756 b=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3757 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3758 g=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3759 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3760 r=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3761 tmp=(int)((int)b >> 3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3762 tmp|=(int)(((int)g >> 2) << 5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3763 tmp|=(int)(((int)r >> 3) << 11);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3764 *(bufouto++)=tmp&0xff;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3765 *(bufouto++)=tmp>>8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3766
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3767 y=(bufy[j+1+yskip]-16)*Ky;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3768
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3769 tmp=(y+cbB)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3770 b=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3771 tmp=(y-crG-cbG)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3772 g=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3773 tmp=(y+crR)>>16;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3774 r=(tmp>255)?255:((tmp<0)?0:tmp);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3775 tmp=(int)((int)b >> 3);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3776 tmp|=(int)(((int)g >> 2) << 5);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3777 tmp|=(int)(((int)r >> 3) << 11);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3778 *(bufouto++)=tmp&0xff;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3779 *(bufouto++)=tmp>>8;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3780
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3781 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3782 bufoute+=oskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3783 bufouto+=oskip;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3784 bufy+=yskip<<1;
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3785 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3786 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3787
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3788 /* fix stride */
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3789
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3790 void RTjpeg_yuvrgb8(__u8 *buf, __u8 *rgb, int stride)
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3791 {
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3792 bcopy(buf, rgb, RTjpeg_width*RTjpeg_height);
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3793 }
bf37d5cd3e6e used by NuppelVideo decoder
alex
parents:
diff changeset
3794