Mercurial > mplayer.hg
annotate libvo/yuv2rgb_mmx.c @ 2430:125ece057b0e
afm synced to codec-cfg.h
author | alex |
---|---|
date | Tue, 23 Oct 2001 16:53:48 +0000 |
parents | 7ce37211e454 |
children | ae2026ac39d4 |
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; | |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
79 int x, y; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
80 |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
81 __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); |
1 | 82 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
83 for (y = v_size; --y >= 0; ) { |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
84 uint8_t *_image = image; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
85 uint8_t *_py = py; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
86 uint8_t *_pu = pu; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
87 uint8_t *_pv = pv; |
1 | 88 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
89 /* load data for start of next scan line */ |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
90 __asm__ __volatile__ ( |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
91 "movd (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
92 "movd (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
93 "movq (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
1 | 94 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
95 : : "r" (_py), "r" (_pu), "r" (_pv)); |
1 | 96 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
97 for (x = h_size >> 3; --x >= 0; ) { |
1 | 98 /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8 |
99 pixels in each iteration */ | |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
100 |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
101 __asm__ __volatile__ ( |
1 | 102 /* Do the multiply part of the conversion for even and odd pixels, |
103 register usage: | |
104 mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, | |
105 mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, | |
106 mm6 -> Y even, mm7 -> Y odd */ | |
107 /* 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
|
108 "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
|
109 "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ |
1 | 110 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
111 "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
|
112 "psubsw mmx_80w, %%mm1;" /* Cr -= 128 */ |
1 | 113 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
114 "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
|
115 "psllw $3, %%mm1;" /* Promote precision */ |
1 | 116 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
117 "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
|
118 "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ |
1 | 119 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
120 "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
|
121 "pmulhw mmx_V_green, %%mm3;" /* Mul Cr with green coeff -> Cr green */ |
1 | 122 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
123 "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
|
124 "pmulhw mmx_V_red, %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */ |
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 "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */ |
1 | 127 |
128 /* 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
|
129 "psubusb mmx_10w, %%mm6;" /* Y -= 16 */ |
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 "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
|
132 "pand mmx_00ffw, %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */ |
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 "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */ |
1 | 135 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
136 "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
|
137 "psllw $3, %%mm7;" /* Promote precision */ |
1 | 138 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
139 "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
|
140 "pmulhw mmx_Y_coeff, %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */ |
1 | 141 |
142 /* Do the addition part of the conversion for even and odd pixels, | |
143 register usage: | |
144 mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, | |
145 mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, | |
146 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
|
147 "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
|
148 "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
|
149 "movq %%mm2, %%mm5;" /* Copy Cgreen */ |
1 | 150 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
151 "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
|
152 "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */ |
1 | 153 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
154 "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
|
155 "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */ |
1 | 156 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
157 "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
|
158 "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */ |
1 | 159 |
160 /* 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
|
161 "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
|
162 "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
|
163 "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */ |
1 | 164 |
165 /* 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
|
166 "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
|
167 "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
|
168 "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */ |
1 | 169 |
170 /* 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
|
171 "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
|
172 "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
|
173 "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */ |
1 | 174 |
175 /* 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
|
176 "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
|
177 "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
|
178 "pand mmx_redmask, %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */ |
1 | 179 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
180 "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
|
181 "pxor %%mm4, %%mm4;" /* zero mm4 */ |
1 | 182 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
183 "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
|
184 "movq %%mm2, %%mm7;" /* Copy G7-G0 */ |
1 | 185 |
186 /* 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
|
187 "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
|
188 "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */ |
1 | 189 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
190 "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
|
191 "por %%mm2, %%mm0;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */ |
1 | 192 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
193 "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
|
194 MOVNTQ " %%mm0, (%3);" /* store pixel 0-3 */ |
1 | 195 |
196 /* 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
|
197 "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
|
198 "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */ |
1 | 199 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
200 "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
|
201 "movd 4 (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ |
1 | 202 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
203 "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
|
204 "movd 4 (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ |
1 | 205 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
206 MOVNTQ " %%mm5, 8 (%3);" /* store pixel 4-7 */ |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
207 : : "r" (_py), "r" (_pu), "r" (_pv), "r" (_image)); |
1 | 208 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
209 _py += 8; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
210 _pu += 4; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
211 _pv += 4; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
212 _image += 16; |
1 | 213 } |
214 | |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
215 if (!even) { |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
216 pu += uv_stride; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
217 pv += uv_stride; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
218 } |
1 | 219 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
220 py += y_stride; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
221 image += rgb_stride; |
1 | 222 |
223 even = (!even); | |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
224 } |
1 | 225 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
226 __asm__ __volatile__ (EMMS); |
1 | 227 } |
228 | |
229 static void yuv420_argb32_mmx (uint8_t * image, uint8_t * py, | |
230 uint8_t * pu, uint8_t * pv, | |
231 int h_size, int v_size, | |
232 int rgb_stride, int y_stride, int uv_stride) | |
233 { | |
234 int even = 1; | |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
235 int x, y; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
236 |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
237 __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); |
1 | 238 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
239 for (y = v_size; --y >= 0; ) { |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
240 uint8_t *_image = image; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
241 uint8_t *_py = py; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
242 uint8_t *_pu = pu; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
243 uint8_t *_pv = pv; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
244 |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
245 /* load data for start of next scan line */ |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
246 __asm__ __volatile__ |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
247 ( |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
248 "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
|
249 "movd (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
250 "movq (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
251 : : "r" (_py), "r" (_pu), "r" (_pv) |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
252 ); |
1 | 253 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
254 for (x = h_size >> 3; --x >= 0; ) { |
1 | 255 /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8 |
256 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
|
257 __asm__ __volatile__ ( |
1 | 258 /* Do the multiply part of the conversion for even and odd pixels, |
259 register usage: | |
260 mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, | |
261 mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, | |
262 mm6 -> Y even, mm7 -> Y odd */ | |
263 | |
264 /* 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
|
265 "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
|
266 "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ |
1 | 267 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
268 "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
|
269 "psubsw mmx_80w, %%mm1;" /* Cr -= 128 */ |
1 | 270 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
271 "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
|
272 "psllw $3, %%mm1;" /* Promote precision */ |
1 | 273 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
274 "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
|
275 "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ |
1 | 276 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
277 "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
|
278 "pmulhw mmx_V_green, %%mm3;" /* Mul Cr with green coeff -> Cr green */ |
1 | 279 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
280 "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
|
281 "pmulhw mmx_V_red, %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */ |
1 | 282 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
283 "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */ |
1 | 284 |
285 /* 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
|
286 "psubusb mmx_10w, %%mm6;" /* Y -= 16 */ |
1 | 287 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
288 "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
|
289 "pand mmx_00ffw, %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */ |
1 | 290 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
291 "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */ |
1 | 292 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
293 "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
|
294 "psllw $3, %%mm7;" /* Promote precision */ |
1 | 295 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
296 "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
|
297 "pmulhw mmx_Y_coeff, %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */ |
1 | 298 |
299 /* Do the addition part of the conversion for even and odd pixels, | |
300 register usage: | |
301 mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, | |
302 mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, | |
303 mm6 -> Y even, mm7 -> Y odd */ | |
304 | |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
305 "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
|
306 "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
|
307 "movq %%mm2, %%mm5;" /* Copy Cgreen */ |
1 | 308 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
309 "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
|
310 "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */ |
1 | 311 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
312 "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
|
313 "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */ |
1 | 314 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
315 "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
|
316 "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */ |
1 | 317 |
318 /* 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
|
319 "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
|
320 "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
|
321 "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */ |
1 | 322 |
323 /* 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
|
324 "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
|
325 "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
|
326 "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */ |
1 | 327 |
328 /* 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
|
329 "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
|
330 "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
|
331 "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */ |
1 | 332 |
333 /* convert RGB plane to RGB packed format, | |
334 mm0 -> B, mm1 -> R, mm2 -> G, mm3 -> 0, | |
335 mm4 -> GB, mm5 -> AR pixel 4-7, | |
336 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
|
337 "pxor %%mm3, %%mm3;" /* zero mm3 */ |
1 | 338 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
339 "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
|
340 "movq %%mm1, %%mm7;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ |
1 | 341 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
342 "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
|
343 "movq %%mm1, %%mm5;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ |
1 | 344 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
345 "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
|
346 "punpcklbw %%mm3, %%mm7;" /* 00 R3 00 R2 00 R1 00 R0 */ |
1 | 347 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
348 "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
|
349 MOVNTQ " %%mm6, (%3);" /* Store ARGB1 ARGB0 */ |
1 | 350 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
351 "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
|
352 "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */ |
1 | 353 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
354 "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
|
355 MOVNTQ " %%mm6, 8 (%3);" /* Store ARGB3 ARGB2 */ |
1 | 356 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
357 "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
|
358 "punpckhbw %%mm3, %%mm5;" /* 00 R7 00 R6 00 R5 00 R4 */ |
1 | 359 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
360 "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
|
361 MOVNTQ " %%mm4, 16 (%3);" /* Store ARGB5 ARGB4 */ |
1 | 362 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
363 "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
|
364 "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */ |
1 | 365 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
366 "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
|
367 MOVNTQ " %%mm4, 24 (%3);" /* Store ARGB7 ARGB6 */ |
1 | 368 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
369 "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
|
370 "movd 4 (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ |
1 | 371 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
372 "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
|
373 "movq 8 (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ |
1 | 374 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
375 : : "r" (_py), "r" (_pu), "r" (_pv), "r" (_image)); |
1 | 376 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
377 _py += 8; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
378 _pu += 4; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
379 _pv += 4; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
380 _image += 32; |
1 | 381 } |
382 | |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
383 if (!even) { |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
384 pu += uv_stride; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
385 pv += uv_stride; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
386 } |
1 | 387 |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
388 py += y_stride; |
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
389 image += rgb_stride; |
1 | 390 |
391 even = (!even); | |
1306
7ce37211e454
yuv2rgb_mmx crashes with ffdivx codec, when we play back avi files that have
jkeil
parents:
1101
diff
changeset
|
392 } |
1 | 393 |
1101
961f53221ffc
Code cleanup and fix missing config.h and use femms on K6 2/2+/3.
atmosfear
parents:
1098
diff
changeset
|
394 __asm__ __volatile__ (EMMS); |
1 | 395 } |
396 | |
397 yuv2rgb_fun yuv2rgb_init_mmx (int bpp, int mode) | |
398 { | |
399 // if (bpp == 15 || bpp == 16) { | |
400 if (bpp == 16 && mode == MODE_RGB) return yuv420_rgb16_mmx; | |
401 if (bpp == 32 && mode == MODE_RGB) return yuv420_argb32_mmx; | |
402 return NULL; // Fallback to C. | |
403 } | |
404 |