80 |
cglobal interpolate8x8_halfpel_v_3dne |
cglobal interpolate8x8_halfpel_v_3dne |
81 |
cglobal interpolate8x8_halfpel_hv_3dne |
cglobal interpolate8x8_halfpel_hv_3dne |
82 |
|
|
83 |
|
cglobal interpolate8x4_halfpel_h_3dne |
84 |
|
cglobal interpolate8x4_halfpel_v_3dne |
85 |
|
cglobal interpolate8x4_halfpel_hv_3dne |
86 |
|
|
87 |
;----------------------------------------------------------------------------- |
;----------------------------------------------------------------------------- |
88 |
; |
; |
89 |
; void interpolate8x8_halfpel_h_3dne(uint8_t * const dst, |
; void interpolate8x8_halfpel_h_3dne(uint8_t * const dst, |
97 |
%if (%1) |
%if (%1) |
98 |
movq mm0, [eax] |
movq mm0, [eax] |
99 |
%else |
%else |
100 |
movq mm0, [dword eax] |
movq mm0, [eax+0] |
101 |
|
; --- |
102 |
|
; nasm >0.99.x rejects the original statement: |
103 |
|
; movq mm0, [dword eax] |
104 |
|
; as it is ambiguous. for this statement nasm <0.99.x would |
105 |
|
; generate "movq mm0,[eax+0]" |
106 |
|
; --- |
107 |
%endif |
%endif |
108 |
pavgb mm0, [eax+1] |
pavgb mm0, [eax+1] |
109 |
movq mm1, [eax+edx] |
movq mm1, [eax+edx] |
422 |
ret |
ret |
423 |
.endfunc |
.endfunc |
424 |
|
|
425 |
|
;----------------------------------------------------------------------------- |
426 |
|
; |
427 |
|
; void interpolate8x4_halfpel_h_3dne(uint8_t * const dst, |
428 |
|
; const uint8_t * const src, |
429 |
|
; const uint32_t stride, |
430 |
|
; const uint32_t rounding); |
431 |
|
; |
432 |
|
;----------------------------------------------------------------------------- |
433 |
|
|
434 |
|
ALIGN 16 |
435 |
|
interpolate8x4_halfpel_h_3dne: |
436 |
|
|
437 |
|
mov eax, [esp+ 8] ; Src |
438 |
|
mov edx, [esp+12] ; stride |
439 |
|
dec dword [esp+16]; rounding |
440 |
|
|
441 |
|
jz .rounding1 |
442 |
|
mov ecx, [esp+ 4] ; Dst |
443 |
|
|
444 |
|
COPY_H_SSE_RND0 0 |
445 |
|
lea ecx,[ecx+2*edx] |
446 |
|
COPY_H_SSE_RND0 1 |
447 |
|
ret |
448 |
|
|
449 |
|
.rounding1 |
450 |
|
; we use: (i+j)/2 = ( i+j+1 )/2 - (i^j)&1 |
451 |
|
mov ecx, [esp+ 4] ; Dst |
452 |
|
movq mm7, [mmx_one] |
453 |
|
COPY_H_SSE_RND1 |
454 |
|
lea ecx, [ecx+2*edx] |
455 |
|
COPY_H_SSE_RND1 |
456 |
|
ret |
457 |
|
.endfunc |
458 |
|
|
459 |
|
;----------------------------------------------------------------------------- |
460 |
|
; |
461 |
|
; void interpolate8x4_halfpel_v_3dne(uint8_t * const dst, |
462 |
|
; const uint8_t * const src, |
463 |
|
; const uint32_t stride, |
464 |
|
; const uint32_t rounding); |
465 |
|
; |
466 |
|
;----------------------------------------------------------------------------- |
467 |
|
|
468 |
|
ALIGN 16 |
469 |
|
interpolate8x4_halfpel_v_3dne: |
470 |
|
|
471 |
|
mov eax, [esp+ 8] ; Src |
472 |
|
mov edx, [esp+12] ; stride |
473 |
|
dec dword [esp+16]; rounding |
474 |
|
|
475 |
|
; we process 2 line at a time |
476 |
|
|
477 |
|
jz .rounding1 |
478 |
|
pxor mm2,mm2 |
479 |
|
movq mm0, [eax] |
480 |
|
movq mm1, [eax+edx] |
481 |
|
por mm2, [eax+2*edx] ; Something like preload (pipelining) |
482 |
|
mov ecx, [esp+ 4] ; Dst |
483 |
|
lea eax, [eax+2*edx] |
484 |
|
pxor mm4, mm4 |
485 |
|
pavgb mm0, mm1 |
486 |
|
pavgb mm1, mm2 |
487 |
|
movq [byte ecx], mm0 |
488 |
|
movq [ecx+edx], mm1 |
489 |
|
|
490 |
|
pxor mm6, mm6 |
491 |
|
add eax, edx |
492 |
|
lea ecx, [ecx+2*edx] |
493 |
|
movq mm3, [byte eax] |
494 |
|
por mm4, [eax+edx] |
495 |
|
lea eax, [eax+2*edx] |
496 |
|
pavgb mm2, mm3 |
497 |
|
pavgb mm3, mm4 |
498 |
|
movq [ecx], mm2 |
499 |
|
movq [ecx+edx], mm3 |
500 |
|
|
501 |
|
ret |
502 |
|
|
503 |
|
ALIGN 8 |
504 |
|
.rounding1 |
505 |
|
pcmpeqb mm0, mm0 |
506 |
|
psubusb mm0, [eax] ; eax==line0 |
507 |
|
add eax, edx ; eax==line1 |
508 |
|
mov ecx, [esp+ 4] ; Dst |
509 |
|
|
510 |
|
push esi |
511 |
|
|
512 |
|
pcmpeqb mm1, mm1 |
513 |
|
pcmpeqb mm2, mm2 |
514 |
|
mov esi, mm_minusone |
515 |
|
psubusb mm1, [byte eax] ; line1 |
516 |
|
psubusb mm2, [eax+edx] ; line2 |
517 |
|
lea eax, [eax+2*edx] ; eax==line3 |
518 |
|
movq mm6, [esi] |
519 |
|
movq mm7, [esi] |
520 |
|
pavgb mm0, mm1 |
521 |
|
pavgb mm1, mm2 |
522 |
|
psubusb mm6, mm0 |
523 |
|
psubusb mm7, mm1 |
524 |
|
movq [ecx], mm6 ; store line0 |
525 |
|
movq [ecx+edx], mm7 ; store line1 |
526 |
|
|
527 |
|
lea ecx, [ecx+2*edx] |
528 |
|
pcmpeqb mm3, mm3 |
529 |
|
pcmpeqb mm4, mm4 |
530 |
|
psubusb mm3, [eax] ; line3 |
531 |
|
psubusb mm4, [eax+edx] ; line4 |
532 |
|
lea eax, [eax+2*edx] ; eax==line 5 |
533 |
|
pavgb mm2, mm3 |
534 |
|
pavgb mm3, mm4 |
535 |
|
movq mm0, [esi] |
536 |
|
movq mm1, [esi] |
537 |
|
psubusb mm0, mm2 |
538 |
|
psubusb mm1, mm3 |
539 |
|
movq [ecx], mm0 |
540 |
|
movq [ecx+edx], mm1 |
541 |
|
|
542 |
|
pop esi |
543 |
|
|
544 |
|
ret |
545 |
|
|
546 |
|
.endfunc |
547 |
|
|
548 |
|
;----------------------------------------------------------------------------- |
549 |
|
; |
550 |
|
; void interpolate8x4_halfpel_hv_3dne(uint8_t * const dst, |
551 |
|
; const uint8_t * const src, |
552 |
|
; const uint32_t stride, |
553 |
|
; const uint32_t rounding); |
554 |
|
; |
555 |
|
; |
556 |
|
;----------------------------------------------------------------------------- |
557 |
|
|
558 |
|
ALIGN 16 |
559 |
|
interpolate8x4_halfpel_hv_3dne: |
560 |
|
mov eax, [esp+ 8] ; Src |
561 |
|
mov edx, [esp+12] ; stride |
562 |
|
dec dword [esp+16] ; rounding |
563 |
|
|
564 |
|
; loop invariants: mm2=(i+j+1)/2 and mm3= i^j |
565 |
|
movq mm2, [eax] |
566 |
|
movq mm3, [eax+1] |
567 |
|
movq mm6, mm2 |
568 |
|
pavgb mm2, mm3 |
569 |
|
pxor mm3, mm6 ; mm2/mm3 ready |
570 |
|
mov ecx, [esp+ 4] ; Dst |
571 |
|
movq mm7, [mmx_one] |
572 |
|
|
573 |
|
jz near .rounding1 |
574 |
|
lea ebp,[byte ebp] |
575 |
|
COPY_HV_SSE_RND0 |
576 |
|
lea ecx,[ecx+2*edx] |
577 |
|
COPY_HV_SSE_RND0 |
578 |
|
ret |
579 |
|
|
580 |
|
ALIGN 16 |
581 |
|
.rounding1 |
582 |
|
COPY_HV_SSE_RND1 |
583 |
|
lea ecx,[ecx+2*edx] |
584 |
|
COPY_HV_SSE_RND1 |
585 |
|
ret |
586 |
|
.endfunc |
587 |
|
|