67 |
cglobal interpolate8x8_halfpel_v_3dn |
cglobal interpolate8x8_halfpel_v_3dn |
68 |
cglobal interpolate8x8_halfpel_hv_3dn |
cglobal interpolate8x8_halfpel_hv_3dn |
69 |
|
|
70 |
|
cglobal interpolate8x4_halfpel_h_3dn |
71 |
|
cglobal interpolate8x4_halfpel_v_3dn |
72 |
|
cglobal interpolate8x4_halfpel_hv_3dn |
73 |
|
|
74 |
;----------------------------------------------------------------------------- |
;----------------------------------------------------------------------------- |
75 |
; |
; |
76 |
; void interpolate8x8_halfpel_h_3dn(uint8_t * const dst, |
; void interpolate8x8_halfpel_h_3dn(uint8_t * const dst, |
360 |
ret |
ret |
361 |
.endfunc |
.endfunc |
362 |
|
|
363 |
|
;----------------------------------------------------------------------------- |
364 |
|
; |
365 |
|
; void interpolate8x4_halfpel_h_3dn(uint8_t * const dst, |
366 |
|
; const uint8_t * const src, |
367 |
|
; const uint32_t stride, |
368 |
|
; const uint32_t rounding); |
369 |
|
; |
370 |
|
;----------------------------------------------------------------------------- |
371 |
|
|
372 |
|
ALIGN 16 |
373 |
|
interpolate8x4_halfpel_h_3dn: |
374 |
|
|
375 |
|
mov eax, [esp+16] ; rounding |
376 |
|
mov ecx, [esp+ 4] ; Dst |
377 |
|
test eax, eax |
378 |
|
mov eax, [esp+ 8] ; Src |
379 |
|
mov edx, [esp+12] ; stride |
380 |
|
|
381 |
|
jnz near .rounding1 |
382 |
|
|
383 |
|
COPY_H_3DN_RND0 |
384 |
|
lea ecx, [ecx+2*edx] |
385 |
|
COPY_H_3DN_RND0 |
386 |
|
ret |
387 |
|
|
388 |
|
.rounding1 |
389 |
|
; we use: (i+j)/2 = ( i+j+1 )/2 - (i^j)&1 |
390 |
|
movq mm7, [mmx_one] |
391 |
|
COPY_H_3DN_RND1 |
392 |
|
lea ecx, [ecx+2*edx] |
393 |
|
COPY_H_3DN_RND1 |
394 |
|
ret |
395 |
|
.endfunc |
396 |
|
|
397 |
|
|
398 |
|
;----------------------------------------------------------------------------- |
399 |
|
; |
400 |
|
; void interpolate8x4_halfpel_v_3dn(uint8_t * const dst, |
401 |
|
; const uint8_t * const src, |
402 |
|
; const uint32_t stride, |
403 |
|
; const uint32_t rounding); |
404 |
|
; |
405 |
|
;----------------------------------------------------------------------------- |
406 |
|
|
407 |
|
ALIGN 16 |
408 |
|
interpolate8x4_halfpel_v_3dn: |
409 |
|
|
410 |
|
mov eax, [esp+16] ; rounding |
411 |
|
mov ecx, [esp+ 4] ; Dst |
412 |
|
test eax,eax |
413 |
|
mov eax, [esp+ 8] ; Src |
414 |
|
mov edx, [esp+12] ; stride |
415 |
|
|
416 |
|
; we process 2 line at a time |
417 |
|
|
418 |
|
jnz near .rounding1 |
419 |
|
|
420 |
|
COPY_V_3DN_RND0 |
421 |
|
lea ecx, [ecx+2*edx] |
422 |
|
COPY_V_3DN_RND0 |
423 |
|
ret |
424 |
|
|
425 |
|
.rounding1 |
426 |
|
; we use: (i+j)/2 = ( i+j+1 )/2 - (i^j)&1 |
427 |
|
movq mm7, [mmx_one] |
428 |
|
movq mm2, [eax] ; loop invariant |
429 |
|
add eax, edx |
430 |
|
|
431 |
|
COPY_V_3DN_RND1 |
432 |
|
lea ecx, [ecx+2*edx] |
433 |
|
COPY_V_3DN_RND1 |
434 |
|
ret |
435 |
|
.endfunc |
436 |
|
|
437 |
|
|
438 |
|
;----------------------------------------------------------------------------- |
439 |
|
; |
440 |
|
; void interpolate8x4_halfpel_hv_3dn(uint8_t * const dst, |
441 |
|
; const uint8_t * const src, |
442 |
|
; const uint32_t stride, |
443 |
|
; const uint32_t rounding); |
444 |
|
; |
445 |
|
; |
446 |
|
;----------------------------------------------------------------------------- |
447 |
|
|
448 |
|
; The trick is to correct the result of 'pavgusb' with some combination of the |
449 |
|
; lsb's of the 4 input values i,j,k,l, and their intermediate 'pavgusb' (s and t). |
450 |
|
; The boolean relations are: |
451 |
|
; (i+j+k+l+3)/4 = (s+t+1)/2 - (ij&kl)&st |
452 |
|
; (i+j+k+l+2)/4 = (s+t+1)/2 - (ij|kl)&st |
453 |
|
; (i+j+k+l+1)/4 = (s+t+1)/2 - (ij&kl)|st |
454 |
|
; (i+j+k+l+0)/4 = (s+t+1)/2 - (ij|kl)|st |
455 |
|
; with s=(i+j+1)/2, t=(k+l+1)/2, ij = i^j, kl = k^l, st = s^t. |
456 |
|
|
457 |
|
ALIGN 16 |
458 |
|
interpolate8x4_halfpel_hv_3dn |
459 |
|
mov eax, [esp+16] ; rounding |
460 |
|
mov ecx, [esp+ 4] ; Dst |
461 |
|
test eax, eax |
462 |
|
mov eax, [esp+ 8] ; Src |
463 |
|
mov edx, [esp+12] ; stride |
464 |
|
|
465 |
|
movq mm7, [mmx_one] |
466 |
|
|
467 |
|
; loop invariants: mm2=(i+j+1)/2 and mm3= i^j |
468 |
|
movq mm2, [eax] |
469 |
|
movq mm3, [eax+1] |
470 |
|
movq mm6, mm2 |
471 |
|
pavgusb mm2, mm3 |
472 |
|
pxor mm3, mm6 ; mm2/mm3 ready |
473 |
|
|
474 |
|
jnz near .rounding1 |
475 |
|
|
476 |
|
COPY_HV_3DN_RND0 |
477 |
|
add ecx, edx |
478 |
|
COPY_HV_3DN_RND0 |
479 |
|
ret |
480 |
|
|
481 |
|
.rounding1 |
482 |
|
COPY_HV_3DN_RND1 |
483 |
|
add ecx, edx |
484 |
|
COPY_HV_3DN_RND1 |
485 |
|
ret |
486 |
|
.endfunc |
487 |
|
|