Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
214 Beiträge
 
#32

AW: Floyd-Steinberg Dithering

  Alt 8. Nov 2023, 08:12
@Stevie, nice !

I was going to more generic reusable one like this:
Code:
{$ALIGN 16}
procedure TestCMovShort;
const
  LOWER_LIMIT = 0;
  HIGHER_LIMIT = 255;
asm
        mov    esi, HIGHER_LIMIT         // High Limit
        mov    ecx, Count
        db     $48, $48

@1:    mov    edi, 0
        db     $48, $48, $48

@2:    mov    edx, dword[Data + edi * 4]
        mov    eax, LOWER_LIMIT
        //XOR    eax, eax    // eax is destination value filled with the lowest value
        cmp    edx, esi    // comapare v (edx) with high value
        cmovg  eax, esi    // if bigger then take the highest esi
        cmovbe eax, edx    // if below or equal we fill value v (edx)
        mov    Byte[CData + edi], al
        inc    edi
        cmp    edi, DATA_LEN
        jl     @2
        dec    ecx
        jne    @1
end;
But it is little slower than xor , and for sure slower then using cmovae and cmovge.
  Mit Zitat antworten Zitat