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