Mercurial > mplayer.hg
annotate libvo/yuv2rgb_mmx.c @ 1240:e1f1419568d2
codec pack DONE
author | arpi |
---|---|
date | Wed, 27 Jun 2001 21:38:08 +0000 |
parents | 961f53221ffc |
children | 7ce37211e454 |
rev | line source |
---|---|
1 | 1 |
2 /* | |
3 * yuv2rgb_mmx.c, Software YUV to RGB coverter with Intel MMX "technology" | |
4 * | |
5 * Copyright (C) 2000, Silicon Integrated System Corp. | |
6 * All Rights Reserved. | |
7 * | |
8 * Author: Olie Lho <ollie@sis.com.tw> | |
9 * | |
10 * This file is part of mpeg2dec, a free MPEG-2 video decoder | |
11 * | |
12 * mpeg2dec is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2, or (at your option) | |
15 * any later version. | |
16 * | |
17 * mpeg2dec is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with GNU Make; see the file COPYING. If not, write to | |
24 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
25 * | |
26 */ | |
27 | |
28 #include <stdio.h> | |
29 #include <stdlib.h> | |
30 | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
31 #include "../config.h" |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
32 |
1 | 33 #include "mmx.h" |
34 //#include "libmpeg2/mpeg2.h" | |
35 //#include "libmpeg2/mpeg2_internal.h" | |
36 #include <inttypes.h> | |
37 | |
38 #include "yuv2rgb.h" | |
39 | |
40 /* hope these constant values are cache line aligned */ | |
41 uint64_t mmx_80w = 0x0080008000800080; | |
42 uint64_t mmx_10w = 0x1010101010101010; | |
43 uint64_t mmx_00ffw = 0x00ff00ff00ff00ff; | |
44 uint64_t mmx_Y_coeff = 0x253f253f253f253f; | |
45 | |
46 /* hope these constant values are cache line aligned */ | |
47 uint64_t mmx_U_green = 0xf37df37df37df37d; | |
48 uint64_t mmx_U_blue = 0x4093409340934093; | |
49 uint64_t mmx_V_red = 0x3312331233123312; | |
50 uint64_t mmx_V_green = 0xe5fce5fce5fce5fc; | |
51 | |
52 /* hope these constant values are cache line aligned */ | |
53 uint64_t mmx_redmask = 0xf8f8f8f8f8f8f8f8; | |
54 uint64_t mmx_grnmask = 0xfcfcfcfcfcfcfcfc; | |
55 uint64_t mmx_grnshift = 0x03; | |
56 uint64_t mmx_blueshift = 0x03; | |
57 | |
688
1a016347010a
movntq causes SIGILL on k6-3. Lets it be for K7, P3 cpus only
nickols_k
parents:
1
diff
changeset
|
58 #ifdef HAVE_MMX2 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
59 /* use this for K7 and p3 only */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
60 #define MOVNTQ "movntq" |
1 | 61 #else |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
62 /* for MMX-only processors */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
63 #define MOVNTQ "movq" |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
64 #endif |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
65 |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
66 #if !defined( HAVE_MMX2) && defined( HAVE_3DNOW) |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
67 /* for K6 2/2+/3 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
68 #define EMMS "femms;" |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
69 #else |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
70 #define EMMS "emms;" |
1 | 71 #endif |
72 | |
73 static void yuv420_rgb16_mmx (uint8_t * image, uint8_t * py, | |
74 uint8_t * pu, uint8_t * pv, | |
75 int h_size, int v_size, | |
76 int rgb_stride, int y_stride, int uv_stride) | |
77 { | |
78 int even = 1; | |
79 int x = 0, y = 0; | |
80 | |
81 /* load data for first scan line */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
82 __asm__ __volatile__ ( |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
83 "movd (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
84 "movd (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ |
1 | 85 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
86 "pxor %%mm4, %%mm4;" /* zero mm4 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
87 "movq (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
1 | 88 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
89 //"movl $0, (%3);" /* cache preload for image */ |
1 | 90 : : "r" (py), "r" (pu), "r" (pv), "r" (image)); |
91 | |
92 do { | |
93 do { | |
94 /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8 | |
95 pixels in each iteration */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
96 __asm__ __volatile__ (".align 8;" |
1 | 97 /* Do the multiply part of the conversion for even and odd pixels, |
98 register usage: | |
99 mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, | |
100 mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, | |
101 mm6 -> Y even, mm7 -> Y odd */ | |
102 /* convert the chroma part */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
103 "punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
104 "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ |
1 | 105 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
106 "psubsw mmx_80w, %%mm0;" /* Cb -= 128 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
107 "psubsw mmx_80w, %%mm1;" /* Cr -= 128 */ |
1 | 108 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
109 "psllw $3, %%mm0;" /* Promote precision */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
110 "psllw $3, %%mm1;" /* Promote precision */ |
1 | 111 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
112 "movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
113 "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ |
1 | 114 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
115 "pmulhw mmx_U_green, %%mm2;" /* Mul Cb with green coeff -> Cb green */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
116 "pmulhw mmx_V_green, %%mm3;" /* Mul Cr with green coeff -> Cr green */ |
1 | 117 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
118 "pmulhw mmx_U_blue, %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
119 "pmulhw mmx_V_red, %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */ |
1 | 120 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
121 "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */ |
1 | 122 |
123 /* convert the luma part */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
124 "psubusb mmx_10w, %%mm6;" /* Y -= 16 */ |
1 | 125 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
126 "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
127 "pand mmx_00ffw, %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */ |
1 | 128 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
129 "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */ |
1 | 130 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
131 "psllw $3, %%mm6;" /* Promote precision */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
132 "psllw $3, %%mm7;" /* Promote precision */ |
1 | 133 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
134 "pmulhw mmx_Y_coeff, %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
135 "pmulhw mmx_Y_coeff, %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */ |
1 | 136 |
137 /* Do the addition part of the conversion for even and odd pixels, | |
138 register usage: | |
139 mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, | |
140 mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, | |
141 mm6 -> Y even, mm7 -> Y odd */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
142 "movq %%mm0, %%mm3;" /* Copy Cblue */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
143 "movq %%mm1, %%mm4;" /* Copy Cred */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
144 "movq %%mm2, %%mm5;" /* Copy Cgreen */ |
1 | 145 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
146 "paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
147 "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */ |
1 | 148 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
149 "paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
150 "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */ |
1 | 151 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
152 "paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
153 "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */ |
1 | 154 |
155 /* Limit RGB even to 0..255 */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
156 "packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0 B6 B4 B2 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
157 "packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0 R6 R4 R2 R0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
158 "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */ |
1 | 159 |
160 /* Limit RGB odd to 0..255 */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
161 "packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1 B7 B5 B3 B1 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
162 "packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1 R7 R5 R3 R1 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
163 "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */ |
1 | 164 |
165 /* Interleave RGB even and odd */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
166 "punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
167 "punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
168 "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */ |
1 | 169 |
170 /* mask unneeded bits off */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
171 "pand mmx_redmask, %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
172 "pand mmx_grnmask, %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
173 "pand mmx_redmask, %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */ |
1 | 174 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
175 "psrlw mmx_blueshift,%%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
176 "pxor %%mm4, %%mm4;" /* zero mm4 */ |
1 | 177 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
178 "movq %%mm0, %%mm5;" /* Copy B7-B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
179 "movq %%mm2, %%mm7;" /* Copy G7-G0 */ |
1 | 180 |
181 /* convert rgb24 plane to rgb16 pack for pixel 0-3 */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
182 "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
183 "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */ |
1 | 184 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
185 "psllw mmx_blueshift,%%mm2;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
186 "por %%mm2, %%mm0;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */ |
1 | 187 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
188 "movq 8 (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
189 MOVNTQ " %%mm0, (%3);" /* store pixel 0-3 */ |
1 | 190 |
191 /* convert rgb24 plane to rgb16 pack for pixel 0-3 */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
192 "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
193 "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */ |
1 | 194 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
195 "psllw mmx_blueshift,%%mm7;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
196 "movd 4 (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ |
1 | 197 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
198 "por %%mm7, %%mm5;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
199 "movd 4 (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ |
1 | 200 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
201 MOVNTQ " %%mm5, 8 (%3);" /* store pixel 4-7 */ |
1 | 202 : : "r" (py), "r" (pu), "r" (pv), "r" (image)); |
203 | |
204 py += 8; | |
205 pu += 4; | |
206 pv += 4; | |
207 image += 16; | |
208 x += 8; | |
209 } while (x < h_size); | |
210 | |
211 if (even) { | |
212 pu -= h_size/2; | |
213 pv -= h_size/2; | |
214 } else { | |
215 pu += (uv_stride - h_size/2); | |
216 pv += (uv_stride - h_size/2); | |
217 } | |
218 | |
219 py += (y_stride - h_size); | |
220 image += (rgb_stride - 2*h_size); | |
221 | |
222 /* load data for start of next scan line */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
223 __asm__ __volatile__ ( |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
224 "movd (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 00 u3 u2 u1 u0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
225 "movd (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 00 v2 v1 v0 */ |
1 | 226 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
227 //"movl $0, (%3);" /* cache preload for image */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
228 "movq (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
1 | 229 |
230 : : "r" (py), "r" (pu), "r" (pv), "r" (image)); | |
231 | |
232 x = 0; | |
233 y += 1; | |
234 even = (!even); | |
235 } while (y < v_size) ; | |
236 | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
237 __asm__ __volatile__ (EMMS); |
1 | 238 } |
239 | |
240 static void yuv420_argb32_mmx (uint8_t * image, uint8_t * py, | |
241 uint8_t * pu, uint8_t * pv, | |
242 int h_size, int v_size, | |
243 int rgb_stride, int y_stride, int uv_stride) | |
244 { | |
245 int even = 1; | |
246 int x = 0, y = 0; | |
247 | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
248 __asm__ __volatile__ ( |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
249 ".align 8;" |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
250 "movd (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
251 //"movl $0, (%3);" /* cache preload for image */ |
1 | 252 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
253 "movd (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
254 "pxor %%mm4, %%mm4;" /* zero mm4 */ |
1 | 255 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
256 "movq (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
1 | 257 : : "r" (py), "r" (pu), "r" (pv), "r" (image)); |
258 | |
259 do { | |
260 do { | |
261 /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8 | |
262 pixels in each iteration */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
263 __asm__ __volatile__ ( |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
264 ".align 8;" |
1 | 265 /* Do the multiply part of the conversion for even and odd pixels, |
266 register usage: | |
267 mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, | |
268 mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, | |
269 mm6 -> Y even, mm7 -> Y odd */ | |
270 | |
271 /* convert the chroma part */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
272 "punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
273 "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ |
1 | 274 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
275 "psubsw mmx_80w, %%mm0;" /* Cb -= 128 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
276 "psubsw mmx_80w, %%mm1;" /* Cr -= 128 */ |
1 | 277 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
278 "psllw $3, %%mm0;" /* Promote precision */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
279 "psllw $3, %%mm1;" /* Promote precision */ |
1 | 280 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
281 "movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
282 "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ |
1 | 283 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
284 "pmulhw mmx_U_green, %%mm2;" /* Mul Cb with green coeff -> Cb green */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
285 "pmulhw mmx_V_green, %%mm3;" /* Mul Cr with green coeff -> Cr green */ |
1 | 286 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
287 "pmulhw mmx_U_blue, %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
288 "pmulhw mmx_V_red, %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */ |
1 | 289 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
290 "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */ |
1 | 291 |
292 /* convert the luma part */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
293 "psubusb mmx_10w, %%mm6;" /* Y -= 16 */ |
1 | 294 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
295 "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
296 "pand mmx_00ffw, %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */ |
1 | 297 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
298 "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */ |
1 | 299 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
300 "psllw $3, %%mm6;" /* Promote precision */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
301 "psllw $3, %%mm7;" /* Promote precision */ |
1 | 302 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
303 "pmulhw mmx_Y_coeff, %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
304 "pmulhw mmx_Y_coeff, %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */ |
1 | 305 |
306 /* Do the addition part of the conversion for even and odd pixels, | |
307 register usage: | |
308 mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, | |
309 mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, | |
310 mm6 -> Y even, mm7 -> Y odd */ | |
311 | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
312 "movq %%mm0, %%mm3;" /* Copy Cblue */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
313 "movq %%mm1, %%mm4;" /* Copy Cred */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
314 "movq %%mm2, %%mm5;" /* Copy Cgreen */ |
1 | 315 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
316 "paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
317 "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */ |
1 | 318 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
319 "paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
320 "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */ |
1 | 321 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
322 "paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
323 "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */ |
1 | 324 |
325 /* Limit RGB even to 0..255 */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
326 "packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0 B6 B4 B2 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
327 "packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0 R6 R4 R2 R0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
328 "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */ |
1 | 329 |
330 /* Limit RGB odd to 0..255 */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
331 "packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1 B7 B5 B3 B1 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
332 "packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1 R7 R5 R3 R1 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
333 "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */ |
1 | 334 |
335 /* Interleave RGB even and odd */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
336 "punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
337 "punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
338 "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */ |
1 | 339 |
340 /* convert RGB plane to RGB packed format, | |
341 mm0 -> B, mm1 -> R, mm2 -> G, mm3 -> 0, | |
342 mm4 -> GB, mm5 -> AR pixel 4-7, | |
343 mm6 -> GB, mm7 -> AR pixel 0-3 */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
344 "pxor %%mm3, %%mm3;" /* zero mm3 */ |
1 | 345 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
346 "movq %%mm0, %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
347 "movq %%mm1, %%mm7;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ |
1 | 348 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
349 "movq %%mm0, %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
350 "movq %%mm1, %%mm5;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ |
1 | 351 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
352 "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
353 "punpcklbw %%mm3, %%mm7;" /* 00 R3 00 R2 00 R1 00 R0 */ |
1 | 354 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
355 "punpcklwd %%mm7, %%mm6;" /* 00 R1 B1 G1 00 R0 B0 G0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
356 MOVNTQ " %%mm6, (%3);" /* Store ARGB1 ARGB0 */ |
1 | 357 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
358 "movq %%mm0, %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
359 "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */ |
1 | 360 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
361 "punpckhwd %%mm7, %%mm6;" /* 00 R3 G3 B3 00 R2 B3 G2 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
362 MOVNTQ " %%mm6, 8 (%3);" /* Store ARGB3 ARGB2 */ |
1 | 363 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
364 "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
365 "punpckhbw %%mm3, %%mm5;" /* 00 R7 00 R6 00 R5 00 R4 */ |
1 | 366 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
367 "punpcklwd %%mm5, %%mm4;" /* 00 R5 B5 G5 00 R4 B4 G4 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
368 MOVNTQ " %%mm4, 16 (%3);" /* Store ARGB5 ARGB4 */ |
1 | 369 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
370 "movq %%mm0, %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
371 "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */ |
1 | 372 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
373 "punpckhwd %%mm5, %%mm4;" /* 00 R7 G7 B7 00 R6 B6 G6 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
374 MOVNTQ " %%mm4, 24 (%3);" /* Store ARGB7 ARGB6 */ |
1 | 375 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
376 "movd 4 (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
377 "movd 4 (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ |
1 | 378 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
379 "pxor %%mm4, %%mm4;" /* zero mm4 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
380 "movq 8 (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
1 | 381 |
382 : : "r" (py), "r" (pu), "r" (pv), "r" (image)); | |
383 | |
384 py += 8; | |
385 pu += 4; | |
386 pv += 4; | |
387 image += 32; | |
388 x += 8; | |
389 } while (x < h_size); | |
390 | |
391 if (even) { | |
392 pu -= h_size/2; | |
393 pv -= h_size/2; | |
394 } else { | |
395 pu += (uv_stride - h_size/2); | |
396 pv += (uv_stride - h_size/2); | |
397 } | |
398 | |
399 py += (y_stride - h_size); | |
400 image += (rgb_stride - 4*h_size); | |
401 | |
402 /* load data for start of next scan line */ | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
403 __asm__ __volatile__ |
1 | 404 ( |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
405 ".align 8;" |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
406 "movd (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
407 "movd (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ |
1 | 408 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
409 //"movl $0, (%3);" /* cache preload for image */ |
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
410 "movq (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
1 | 411 : : "r" (py), "r" (pu), "r" (pv), "r" (image) |
412 ); | |
413 | |
414 | |
415 x = 0; | |
416 y += 1; | |
417 even = (!even); | |
418 } while ( y < v_size) ; | |
419 | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
420 __asm__ __volatile__ (EMMS); |
1 | 421 } |
422 | |
423 yuv2rgb_fun yuv2rgb_init_mmx (int bpp, int mode) | |
424 { | |
425 // if (bpp == 15 || bpp == 16) { | |
426 if (bpp == 16 && mode == MODE_RGB) return yuv420_rgb16_mmx; | |
427 if (bpp == 32 && mode == MODE_RGB) return yuv420_argb32_mmx; | |
428 return NULL; // Fallback to C. | |
429 } | |
430 |