<P>Hi,there.</P>
<P>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;</P>
<P>;-----------------------------------------------------------------------------<BR>; void hpel_filter_h( uint8_t *dst, uint8_t *src, int width );<BR>;-----------------------------------------------------------------------------<BR>cglobal hpel_filter_h_mmxext, 3,3<BR>add r0, r2<BR>add r1, r2<BR>neg r2<BR>%define src r1+r2<BR>pxor m0, m0<BR>.loop:<BR>movd m1, [src-2]<BR>movd m2, [src-1]<BR>movd m3, [src ]<BR>movd m6, [src+1]<BR>movd m4, [src+2]<BR>movd m5, [src+3]<BR>punpcklbw m1, m0<BR>punpcklbw m2, m0<BR>punpcklbw m3, m0<BR>punpcklbw m6, m0<BR>punpcklbw m4, m0<BR>punpcklbw m5, m0<BR>paddw m3, m6 ; c0<BR>paddw m2, m4 ; b0<BR>paddw m1, m5 ; a0<BR>movd m7, [src+7]<BR>movd m6, [src+6]<BR>punpcklbw m7, m0<BR>punpcklbw m6, m0<BR>paddw m4, m7 ; c1<BR>paddw m5, m6 ; b1<BR>movd m7, [src+5]<BR>movd m6, [src+4]<BR>punpcklbw m7, m0<BR>punpcklbw m6, m0<BR>paddw m6, m7 ; a1<BR>movq m7, [pw_1];<BR>FILT_H2 m1, m2, m3, m4, m5, m6<BR><FONT color=#3300cc>FILT_PACK m1, m4, 1, m7;Here it is!<BR></FONT>movntq [r0+r2], m1<BR>add r2, 8<BR>jl .loop<BR>REP_RET</P>
<P> </P>
<P></P>
<P>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.</P>
<P> </P>
<P><FONT color=#0033cc>%macro FILT_PACK 4-6 b<BR>paddw %1, %4<BR>paddw %2, %4<BR>%if %0 == 6<BR>psubusw %1, %6<BR>psubusw %2, %6<BR>psrlw %1, %3<BR>psrlw %2, %3<BR>%else<BR>psraw %1, %3<BR>psraw %2, %3<BR>%endif<BR>%ifnidn w, %5<BR>packuswb %1, %2<BR>%endif<BR>%endmacro</FONT></P>
<P></P>
<P>So my question : Why do the 8 points add the m7? What does contain in m7?</P>
<P></P>
<P>Thanks anyone who reply this mail in advance~~~</P>
<P></P>
<P>Best,</P>
<P>Peter<BR></P>