Skip to content

Instantly share code, notes, and snippets.

@Const-me
Created November 22, 2019 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Const-me/7a74e74264628aea0b4fe2e8ef004448 to your computer and use it in GitHub Desktop.
Save Const-me/7a74e74264628aea0b4fe2e8ef004448 to your computer and use it in GitHub Desktop.
{
VecInteger r, g, b;
loadRgb( src, r, g, b );
00007FF735AD11C0 vmovdqu xmm6,xmmword ptr [rcx-10h]
00007FF735AD11C5 vmovdqu xmm7,xmmword ptr [rcx-20h]
loadRgb( src + 2, r, g, b );
00007FF735AD11CA vmovdqu xmm9,xmmword ptr [rcx]
00007FF735AD11CE vmovdqu xmm8,xmmword ptr [rcx+10h]
{
VecInteger r, g, b;
loadRgb( src, r, g, b );
00007FF735AD11D3 vpand xmm3,xmm10,xmm6
00007FF735AD11D7 vpand xmm1,xmm11,xmm6
00007FF735AD11DB vpand xmm0,xmm11,xmm7
00007FF735AD11DF vpackusdw xmm1,xmm0,xmm1
00007FF735AD11E4 vpslldq xmm2,xmm1,1
const auto low = brightness( r, g, b );
00007FF735AD11E9 vpmulhuw xmm4,xmm2,xmm12
00007FF735AD11EE vpand xmm0,xmm10,xmm7
00007FF735AD11F2 vpackusdw xmm1,xmm0,xmm3
const auto low = brightness( r, g, b );
00007FF735AD11F7 vpmulhuw xmm2,xmm1,xmm13
00007FF735AD11FC vpaddusw xmm5,xmm4,xmm2
{
VecInteger r, g, b;
loadRgb( src, r, g, b );
00007FF735AD1200 vpsrldq xmm0,xmm6,1
00007FF735AD1205 vpand xmm3,xmm0,xmm10
00007FF735AD120A vpsrldq xmm1,xmm7,1
00007FF735AD120F vpand xmm2,xmm1,xmm10
00007FF735AD1214 vpackusdw xmm0,xmm2,xmm3
const auto low = brightness( r, g, b );
00007FF735AD1219 vpmulhuw xmm3,xmm0,xmm14
00007FF735AD121E vpaddusw xmm1,xmm5,xmm3
00007FF735AD1222 vpsrlw xmm6,xmm1,8
loadRgb( src + 2, r, g, b );
00007FF735AD1227 vpand xmm2,xmm11,xmm8
00007FF735AD122C vpand xmm0,xmm11,xmm9
00007FF735AD1231 vpackusdw xmm1,xmm0,xmm2
00007FF735AD1236 vpslldq xmm2,xmm1,1
const auto hi = brightness( r, g, b );
00007FF735AD123B vpmulhuw xmm4,xmm2,xmm12
loadRgb( src + 2, r, g, b );
00007FF735AD1240 vpand xmm0,xmm10,xmm9
00007FF735AD1245 vpand xmm3,xmm10,xmm8
00007FF735AD124A vpackusdw xmm1,xmm0,xmm3
const auto hi = brightness( r, g, b );
00007FF735AD124F vpmulhuw xmm2,xmm1,xmm13
00007FF735AD1254 vpaddusw xmm5,xmm4,xmm2
loadRgb( src + 2, r, g, b );
00007FF735AD1258 vpsrldq xmm1,xmm9,1
00007FF735AD125E vpand xmm2,xmm1,xmm10
00007FF735AD1263 vpsrldq xmm0,xmm8,1
00007FF735AD1269 vpand xmm3,xmm0,xmm10
00007FF735AD126E vpackusdw xmm0,xmm2,xmm3
const auto hi = brightness( r, g, b );
00007FF735AD1273 vpmulhuw xmm3,xmm0,xmm14
00007FF735AD1278 vpaddusw xmm1,xmm5,xmm3
00007FF735AD127C vpsrlw xmm2,xmm1,8
src += 4;
00007FF735AD1281 lea rcx,[rcx+40h]
const auto bytes = packus_epi16( low, hi );
00007FF735AD1285 vpackuswb xmm0,xmm6,xmm2
VecInteger* dest = (VecInteger*)destinationBytes;
while( src < srcEnd )
00007FF735AD1289 lea rax,[rcx-20h]
storeu_all( dest, bytes );
00007FF735AD128D vmovdqu xmmword ptr [rdx],xmm0
dest++;
00007FF735AD1291 lea rdx,[rdx+10h]
00007FF735AD1295 cmp rax,r8
00007FF735AD1298 jb Sse::convertToGrayscale+80h (07FF735AD11C0h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment