comparison src/video/SDL_yuv_mmx.c @ 949:e0d96eb0af19

I don't know how this got missed, but...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 24 Aug 2004 07:40:14 +0000
parents 8520712f8ef0
children 29d7db09776e
comparison
equal deleted inserted replaced
948:ac488ad4ef1d 949:e0d96eb0af19
230 "jl 1b\n" 230 "jl 1b\n"
231 "emms\n" 231 "emms\n"
232 "popl %%ebx\n" 232 "popl %%ebx\n"
233 : 233 :
234 : "m" (cr), "r"(cb),"r"(lum), 234 : "m" (cr), "r"(cb),"r"(lum),
235 "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod), 235 "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
236 [_MMX_0080w] "m" (*MMX_0080w), 236 [_MMX_0080w] "m" (*MMX_0080w),
237 [_MMX_00FFw] "m" (*MMX_00FFw), 237 [_MMX_00FFw] "m" (*MMX_00FFw),
238 [_MMX_FF00w] "m" (*MMX_FF00w), 238 [_MMX_FF00w] "m" (*MMX_FF00w),
239 [_MMX_VgrnRGB] "m" (*MMX_VgrnRGB), 239 [_MMX_VgrnRGB] "m" (*MMX_VgrnRGB),
240 [_MMX_VredRGB] "m" (*MMX_VredRGB), 240 [_MMX_VredRGB] "m" (*MMX_VredRGB),
241 [_MMX_UgrnRGB] "m" (*MMX_UgrnRGB), 241 [_MMX_UgrnRGB] "m" (*MMX_UgrnRGB),
242 [_MMX_UbluRGB] "m" (*MMX_UbluRGB) 242 [_MMX_UbluRGB] "m" (*MMX_UbluRGB)
243 ); 243 );
244 } 244 }
245 245
246 void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix, 246 void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
247 unsigned char *lum, unsigned char *cr, 247 unsigned char *lum, unsigned char *cr,
267 "movd (%1), %%mm0\n" // 4 Cb 0 0 0 0 u3 u2 u1 u0 267 "movd (%1), %%mm0\n" // 4 Cb 0 0 0 0 u3 u2 u1 u0
268 "pxor %%mm7, %%mm7\n" 268 "pxor %%mm7, %%mm7\n"
269 "movd (%%ebx), %%mm1\n" // 4 Cr 0 0 0 0 v3 v2 v1 v0 269 "movd (%%ebx), %%mm1\n" // 4 Cr 0 0 0 0 v3 v2 v1 v0
270 "punpcklbw %%mm7, %%mm0\n" // 4 W cb 0 u3 0 u2 0 u1 0 u0 270 "punpcklbw %%mm7, %%mm0\n" // 4 W cb 0 u3 0 u2 0 u1 0 u0
271 "punpcklbw %%mm7, %%mm1\n" // 4 W cr 0 v3 0 v2 0 v1 0 v0 271 "punpcklbw %%mm7, %%mm1\n" // 4 W cr 0 v3 0 v2 0 v1 0 v0
272 "psubw _MMX_0080w, %%mm0\n" 272 "psubw %[_MMX_0080w], %%mm0\n"
273 "psubw _MMX_0080w, %%mm1\n" 273 "psubw %[_MMX_0080w], %%mm1\n"
274 "movq %%mm0, %%mm2\n" // Cb 0 u3 0 u2 0 u1 0 u0 274 "movq %%mm0, %%mm2\n" // Cb 0 u3 0 u2 0 u1 0 u0
275 "movq %%mm1, %%mm3\n" // Cr 275 "movq %%mm1, %%mm3\n" // Cr
276 "pmullw _MMX_Ugrn565, %%mm2\n" // Cb2green 0 R3 0 R2 0 R1 0 R0 276 "pmullw %[_MMX_Ugrn565], %%mm2\n" // Cb2green 0 R3 0 R2 0 R1 0 R0
277 "movq (%2), %%mm6\n" // L1 l7 L6 L5 L4 L3 L2 L1 L0 277 "movq (%2), %%mm6\n" // L1 l7 L6 L5 L4 L3 L2 L1 L0
278 "pmullw _MMX_Ublu5x5, %%mm0\n" // Cb2blue 278 "pmullw %[_MMX_Ublu5x5], %%mm0\n" // Cb2blue
279 "pand _MMX_00FFw, %%mm6\n" // L1 00 L6 00 L4 00 L2 00 L0 279 "pand %[_MMX_00FFw], %%mm6\n" // L1 00 L6 00 L4 00 L2 00 L0
280 "pmullw _MMX_Vgrn565, %%mm3\n" // Cr2green 280 "pmullw %[_MMX_Vgrn565], %%mm3\n" // Cr2green
281 "movq (%2), %%mm7\n" // L2 281 "movq (%2), %%mm7\n" // L2
282 "pmullw _MMX_Vred5x5, %%mm1\n" // Cr2red 282 "pmullw %[_MMX_Vred5x5], %%mm1\n" // Cr2red
283 "psrlw $8, %%mm7\n" // L2 00 L7 00 L5 00 L3 00 L1 283 "psrlw $8, %%mm7\n" // L2 00 L7 00 L5 00 L3 00 L1
284 "pmullw _MMX_Ycoeff, %%mm6\n" // lum1 284 "pmullw %[_MMX_Ycoeff], %%mm6\n" // lum1
285 "paddw %%mm3, %%mm2\n" // Cb2green + Cr2green == green 285 "paddw %%mm3, %%mm2\n" // Cb2green + Cr2green == green
286 "pmullw _MMX_Ycoeff, %%mm7\n" // lum2 286 "pmullw %[_MMX_Ycoeff], %%mm7\n" // lum2
287 287
288 "movq %%mm6, %%mm4\n" // lum1 288 "movq %%mm6, %%mm4\n" // lum1
289 "paddw %%mm0, %%mm6\n" // lum1 +blue 00 B6 00 B4 00 B2 00 B0 289 "paddw %%mm0, %%mm6\n" // lum1 +blue 00 B6 00 B4 00 B2 00 B0
290 "movq %%mm4, %%mm5\n" // lum1 290 "movq %%mm4, %%mm5\n" // lum1
291 "paddw %%mm1, %%mm4\n" // lum1 +red 00 R6 00 R4 00 R2 00 R0 291 "paddw %%mm1, %%mm4\n" // lum1 +red 00 R6 00 R4 00 R2 00 R0
299 "packuswb %%mm5, %%mm5\n" // G1 G1 299 "packuswb %%mm5, %%mm5\n" // G1 G1
300 "packuswb %%mm6, %%mm6\n" // B1 B1 300 "packuswb %%mm6, %%mm6\n" // B1 B1
301 "punpcklbw %%mm4, %%mm4\n" 301 "punpcklbw %%mm4, %%mm4\n"
302 "punpcklbw %%mm5, %%mm5\n" 302 "punpcklbw %%mm5, %%mm5\n"
303 303
304 "pand _MMX_red565, %%mm4\n" 304 "pand %[_MMX_red565], %%mm4\n"
305 "psllw $3, %%mm5\n" // GREEN 1 305 "psllw $3, %%mm5\n" // GREEN 1
306 "punpcklbw %%mm6, %%mm6\n" 306 "punpcklbw %%mm6, %%mm6\n"
307 "pand _MMX_grn565, %%mm5\n" 307 "pand %[_MMX_grn565], %%mm5\n"
308 "pand _MMX_red565, %%mm6\n" 308 "pand %[_MMX_red565], %%mm6\n"
309 "por %%mm5, %%mm4\n" // 309 "por %%mm5, %%mm4\n" //
310 "psrlw $11, %%mm6\n" // BLUE 1 310 "psrlw $11, %%mm6\n" // BLUE 1
311 "movq %%mm3, %%mm5\n" // lum2 311 "movq %%mm3, %%mm5\n" // lum2
312 "paddw %%mm1, %%mm3\n" // lum2 +red 00 R7 00 R5 00 R3 00 R1 312 "paddw %%mm1, %%mm3\n" // lum2 +red 00 R7 00 R5 00 R3 00 R1
313 "paddw %%mm2, %%mm5\n" // lum2 +green 00 G7 00 G5 00 G3 00 G1 313 "paddw %%mm2, %%mm5\n" // lum2 +green 00 G7 00 G5 00 G3 00 G1
317 "movq (%2, %4), %%mm6\n" // L3 load lum2 317 "movq (%2, %4), %%mm6\n" // L3 load lum2
318 "psraw $6, %%mm7\n" 318 "psraw $6, %%mm7\n"
319 "packuswb %%mm3, %%mm3\n" 319 "packuswb %%mm3, %%mm3\n"
320 "packuswb %%mm5, %%mm5\n" 320 "packuswb %%mm5, %%mm5\n"
321 "packuswb %%mm7, %%mm7\n" 321 "packuswb %%mm7, %%mm7\n"
322 "pand _MMX_00FFw, %%mm6\n" // L3 322 "pand %[_MMX_00FFw], %%mm6\n" // L3
323 "punpcklbw %%mm3, %%mm3\n" 323 "punpcklbw %%mm3, %%mm3\n"
324 "punpcklbw %%mm5, %%mm5\n" 324 "punpcklbw %%mm5, %%mm5\n"
325 "pmullw _MMX_Ycoeff, %%mm6\n" // lum3 325 "pmullw %[_MMX_Ycoeff], %%mm6\n" // lum3
326 "punpcklbw %%mm7, %%mm7\n" 326 "punpcklbw %%mm7, %%mm7\n"
327 "psllw $3, %%mm5\n" // GREEN 2 327 "psllw $3, %%mm5\n" // GREEN 2
328 "pand _MMX_red565, %%mm7\n" 328 "pand %[_MMX_red565], %%mm7\n"
329 "pand _MMX_red565, %%mm3\n" 329 "pand %[_MMX_red565], %%mm3\n"
330 "psrlw $11, %%mm7\n" // BLUE 2 330 "psrlw $11, %%mm7\n" // BLUE 2
331 "pand _MMX_grn565, %%mm5\n" 331 "pand %[_MMX_grn565], %%mm5\n"
332 "por %%mm7, %%mm3\n" 332 "por %%mm7, %%mm3\n"
333 "movq (%2,%4), %%mm7\n" // L4 load lum2 333 "movq (%2,%4), %%mm7\n" // L4 load lum2
334 "por %%mm5, %%mm3\n" // 334 "por %%mm5, %%mm3\n" //
335 "psrlw $8, %%mm7\n" // L4 335 "psrlw $8, %%mm7\n" // L4
336 "movq %%mm4, %%mm5\n" 336 "movq %%mm4, %%mm5\n"
337 "punpcklwd %%mm3, %%mm4\n" 337 "punpcklwd %%mm3, %%mm4\n"
338 "pmullw _MMX_Ycoeff, %%mm7\n" // lum4 338 "pmullw %[_MMX_Ycoeff], %%mm7\n" // lum4
339 "punpckhwd %%mm3, %%mm5\n" 339 "punpckhwd %%mm3, %%mm5\n"
340 340
341 "movq %%mm4, (%3)\n" // write row1 341 "movq %%mm4, (%3)\n" // write row1
342 "movq %%mm5, 8(%3)\n" // write row1 342 "movq %%mm5, 8(%3)\n" // write row1
343 343
360 "packuswb %%mm6, %%mm6\n" 360 "packuswb %%mm6, %%mm6\n"
361 "punpcklbw %%mm4, %%mm4\n" 361 "punpcklbw %%mm4, %%mm4\n"
362 "punpcklbw %%mm5, %%mm5\n" 362 "punpcklbw %%mm5, %%mm5\n"
363 "punpcklbw %%mm6, %%mm6\n" 363 "punpcklbw %%mm6, %%mm6\n"
364 "psllw $3, %%mm5\n" // GREEN 3 364 "psllw $3, %%mm5\n" // GREEN 3
365 "pand _MMX_red565, %%mm4\n" 365 "pand %[_MMX_red565], %%mm4\n"
366 "psraw $6, %%mm3\n" // psr 6 366 "psraw $6, %%mm3\n" // psr 6
367 "psraw $6, %%mm0\n" 367 "psraw $6, %%mm0\n"
368 "pand _MMX_red565, %%mm6\n" // BLUE 368 "pand %[_MMX_red565], %%mm6\n" // BLUE
369 "pand _MMX_grn565, %%mm5\n" 369 "pand %[_MMX_grn565], %%mm5\n"
370 "psrlw $11, %%mm6\n" // BLUE 3 370 "psrlw $11, %%mm6\n" // BLUE 3
371 "por %%mm5, %%mm4\n" 371 "por %%mm5, %%mm4\n"
372 "psraw $6, %%mm7\n" 372 "psraw $6, %%mm7\n"
373 "por %%mm6, %%mm4\n" 373 "por %%mm6, %%mm4\n"
374 "packuswb %%mm3, %%mm3\n" 374 "packuswb %%mm3, %%mm3\n"
375 "packuswb %%mm0, %%mm0\n" 375 "packuswb %%mm0, %%mm0\n"
376 "packuswb %%mm7, %%mm7\n" 376 "packuswb %%mm7, %%mm7\n"
377 "punpcklbw %%mm3, %%mm3\n" 377 "punpcklbw %%mm3, %%mm3\n"
378 "punpcklbw %%mm0, %%mm0\n" 378 "punpcklbw %%mm0, %%mm0\n"
379 "punpcklbw %%mm7, %%mm7\n" 379 "punpcklbw %%mm7, %%mm7\n"
380 "pand _MMX_red565, %%mm3\n" 380 "pand %[_MMX_red565], %%mm3\n"
381 "pand _MMX_red565, %%mm7\n" // BLUE 381 "pand %[_MMX_red565], %%mm7\n" // BLUE
382 "psllw $3, %%mm0\n" // GREEN 4 382 "psllw $3, %%mm0\n" // GREEN 4
383 "psrlw $11, %%mm7\n" 383 "psrlw $11, %%mm7\n"
384 "pand _MMX_grn565, %%mm0\n" 384 "pand %[_MMX_grn565], %%mm0\n"
385 "por %%mm7, %%mm3\n" 385 "por %%mm7, %%mm3\n"
386 "por %%mm0, %%mm3\n" 386 "por %%mm0, %%mm3\n"
387 387
388 "movq %%mm4, %%mm5\n" 388 "movq %%mm4, %%mm5\n"
389 389
412 "emms\n" 412 "emms\n"
413 "popl %%ebx\n" 413 "popl %%ebx\n"
414 : 414 :
415 :"m" (cr), "r"(cb),"r"(lum), 415 :"m" (cr), "r"(cb),"r"(lum),
416 "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod), 416 "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
417 [_MMX_0080w] "m" (*MMX_0080w), 417 [_MMX_0080w] "m" (*MMX_0080w),
418 [_MMX_Ugrn565] "m" (*MMX_Ugrn565), 418 [_MMX_Ugrn565] "m" (*MMX_Ugrn565),
419 [_MMX_Ublu5x5] "m" (*MMX_Ublu5x5), 419 [_MMX_Ublu5x5] "m" (*MMX_Ublu5x5),
420 [_MMX_00FFw] "m" (*MMX_00FFw), 420 [_MMX_00FFw] "m" (*MMX_00FFw),
421 [_MMX_Vgrn565] "m" (*MMX_Vgrn565), 421 [_MMX_Vgrn565] "m" (*MMX_Vgrn565),
422 [_MMX_Vred5x5] "m" (*MMX_Vred5x5), 422 [_MMX_Vred5x5] "m" (*MMX_Vred5x5),
423 [_MMX_Ycoeff] "m" (*MMX_Ycoeff), 423 [_MMX_Ycoeff] "m" (*MMX_Ycoeff),
424 [_MMX_red565] "m" (*MMX_red565), 424 [_MMX_red565] "m" (*MMX_red565),
425 [_MMX_grn565] "m" (*MMX_grn565) 425 [_MMX_grn565] "m" (*MMX_grn565)
426 ); 426 );
427 } 427 }
428 428
429 #endif /* GCC i386 inline assembly */ 429 #endif /* GCC i386 inline assembly */