annotate RTjpegN.c @ 4607:da09673aea00

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