[x264-devel] X264 6 tap filter MMX Question

peter bo3861926 at sina.com
Sat Apr 16 05:36:49 CEST 2011


Hi,there.
Recently I'm interested in the 6 tap filter MMX code in mc-a2.asm of X264.But I'm confused by such code (THE BLUE LINE)as below;
;-----------------------------------------------------------------------------
; void hpel_filter_h( uint8_t *dst, uint8_t *src, int width );
;-----------------------------------------------------------------------------
cglobal hpel_filter_h_mmxext, 3,3
add r0, r2
add r1, r2
neg r2
%define src r1+r2
pxor m0, m0
.loop:
movd m1, [src-2]
movd m2, [src-1]
movd m3, [src ]
movd m6, [src+1]
movd m4, [src+2]
movd m5, [src+3]
punpcklbw m1, m0
punpcklbw m2, m0
punpcklbw m3, m0
punpcklbw m6, m0
punpcklbw m4, m0
punpcklbw m5, m0
paddw m3, m6 ; c0
paddw m2, m4 ; b0
paddw m1, m5 ; a0
movd m7, [src+7]
movd m6, [src+6]
punpcklbw m7, m0
punpcklbw m6, m0
paddw m4, m7 ; c1
paddw m5, m6 ; b1
movd m7, [src+5]
movd m6, [src+4]
punpcklbw m7, m0
punpcklbw m6, m0
paddw m6, m7 ; a1
movq m7, [pw_1];
FILT_H2 m1, m2, m3, m4, m5, m6
FILT_PACK m1, m4, 1, m7;Here it is!
movntq [r0+r2], m1
add r2, 8
jl .loop
REP_RET
 

FILT_PACK m1,m4,1,m7,This macro computes m1= m1+m7;m4=m4+m7; Before this step,m1 and m4 conatin 4 outcomes like this (A+F)/16-(B+E)*5/16+(C+D)*5/4,it almost complete the 6 tap filter.
 
%macro FILT_PACK 4-6 b
paddw %1, %4
paddw %2, %4
%if %0 == 6
psubusw %1, %6
psubusw %2, %6
psrlw %1, %3
psrlw %2, %3
%else
psraw %1, %3
psraw %2, %3
%endif
%ifnidn w, %5
packuswb %1, %2
%endif
%endmacro

So my question : Why do the 8 points add the m7? What does contain in m7?

Thanks anyone who reply this mail in advance~~~

Best,
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20110416/3012f9f4/attachment.html>


More information about the x264-devel mailing list