<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><DIV>At 2014-02-15 13:23:56,"Satoshi Nakagawa" <nakagawa424@oki.com> wrote:<BR>># HG changeset patch<BR>># User Satoshi Nakagawa <nakagawa424@oki.com><BR>># Date 1392440540 -32400<BR>># Sat Feb 15 14:02:20 2014 +0900<BR>># Node ID dcdb5c276c7827fa540348018ddd72618b558feb<BR>># Parent d77a549b8061f038b2d263c4508e256b4a335208<BR>>primitives: add count_nonzero<BR>><BR>>+;-----------------------------------------------------------------------------<BR>>+; int count_nonzero(const int32_t *quantCoeff, int numCoeff);<BR>>+;-----------------------------------------------------------------------------<BR>>+INIT_XMM sse2<BR>>+cglobal count_nonzero, 2,3,4<BR>>+ pxor m0, m0<BR>>+ pxor m1, m1<BR>>+ mov r2d, r1d<BR>>+ shr r1d, 3<BR>>+<BR>>+.loop<BR>>+ movdqu m2, [r0] ; TODO: movdqa<BR>>+ movdqu m3, [r0 + 16] ; TODO: movdqa<BR>for x264 code style, we need write as movu here</DIV>
<DIV> </DIV>
<DIV>>+ add r0, 32<BR>>+ packssdw m2, m3<BR>>+ pcmpeqw m2, m0<BR>>+ psrlw m2, 15<BR>>+ packsswb m2, m2<BR>>+ psadbw m2, m0<BR>>+ paddd m1, m2<BR>>+ dec r1d<BR>>+ jnz .loop<BR>>+<BR>>+ movd r1d, m1<BR>>+ sub r2d, r1d<BR>>+ mov eax, r2d<BR>>+<BR>>+ RET<BR></DIV></div>