bugfix
This commit is contained in:
parent
2d39091c44
commit
0e1df4b0c8
2 changed files with 7 additions and 7 deletions
|
@ -110,7 +110,7 @@ proc toPremultipliedAlphaAvx2*(data: var seq[ColorRGBA | ColorRGBX]) {.simd.} =
|
||||||
oddMask = mm256_set1_epi16(0xff00)
|
oddMask = mm256_set1_epi16(0xff00)
|
||||||
vec128 = mm256_set1_epi16(128)
|
vec128 = mm256_set1_epi16(128)
|
||||||
hiMask = mm256_set1_epi16(255 shl 8)
|
hiMask = mm256_set1_epi16(255 shl 8)
|
||||||
iterations = data.len div 8
|
iterations = (data.len - i) div 8
|
||||||
for _ in 0 ..< iterations:
|
for _ in 0 ..< iterations:
|
||||||
let
|
let
|
||||||
values = mm256_load_si256(cast[pointer](p))
|
values = mm256_load_si256(cast[pointer](p))
|
||||||
|
@ -163,7 +163,7 @@ proc invertAvx2*(image: Image) {.simd.} =
|
||||||
|
|
||||||
let
|
let
|
||||||
vec255 = mm256_set1_epi8(255)
|
vec255 = mm256_set1_epi8(255)
|
||||||
iterations = image.data.len div 16
|
iterations = (image.data.len - i) div 16
|
||||||
for _ in 0 ..< iterations:
|
for _ in 0 ..< iterations:
|
||||||
let
|
let
|
||||||
a = mm256_load_si256(cast[pointer](p))
|
a = mm256_load_si256(cast[pointer](p))
|
||||||
|
@ -211,7 +211,7 @@ proc applyOpacityAvx2*(image: Image, opacity: float32) {.simd.} =
|
||||||
div255 = mm256_set1_epi16(0x8081)
|
div255 = mm256_set1_epi16(0x8081)
|
||||||
zeroVec = mm256_setzero_si256()
|
zeroVec = mm256_setzero_si256()
|
||||||
opacityVec = mm256_slli_epi16(mm256_set1_epi16(opacity), 8)
|
opacityVec = mm256_slli_epi16(mm256_set1_epi16(opacity), 8)
|
||||||
iterations = image.data.len div 8
|
iterations = (image.data.len - i) div 8
|
||||||
for _ in 0 ..< iterations:
|
for _ in 0 ..< iterations:
|
||||||
let
|
let
|
||||||
values = mm256_load_si256(cast[pointer](p))
|
values = mm256_load_si256(cast[pointer](p))
|
||||||
|
@ -257,7 +257,7 @@ proc ceilAvx2*(image: Image) {.simd.} =
|
||||||
let
|
let
|
||||||
vecZero = mm256_setzero_si256()
|
vecZero = mm256_setzero_si256()
|
||||||
vec255 = mm256_set1_epi8(255)
|
vec255 = mm256_set1_epi8(255)
|
||||||
iterations = image.data.len div 8
|
iterations = (image.data.len - i) div 8
|
||||||
for _ in 0 ..< iterations:
|
for _ in 0 ..< iterations:
|
||||||
var values = mm256_load_si256(cast[pointer](p))
|
var values = mm256_load_si256(cast[pointer](p))
|
||||||
values = mm256_cmpeq_epi8(values, vecZero)
|
values = mm256_cmpeq_epi8(values, vecZero)
|
||||||
|
|
|
@ -212,7 +212,7 @@ proc invertSse2*(image: Image) {.simd.} =
|
||||||
|
|
||||||
let
|
let
|
||||||
vec255 = mm_set1_epi8(255)
|
vec255 = mm_set1_epi8(255)
|
||||||
iterations = image.data.len div 16
|
iterations = (image.data.len - i) div 16
|
||||||
for _ in 0 ..< iterations:
|
for _ in 0 ..< iterations:
|
||||||
let
|
let
|
||||||
a = mm_load_si128(cast[pointer](p))
|
a = mm_load_si128(cast[pointer](p))
|
||||||
|
@ -264,7 +264,7 @@ proc applyOpacitySse2*(image: Image, opacity: float32) {.simd.} =
|
||||||
div255 = mm_set1_epi16(0x8081)
|
div255 = mm_set1_epi16(0x8081)
|
||||||
zeroVec = mm_setzero_si128()
|
zeroVec = mm_setzero_si128()
|
||||||
opacityVec = mm_slli_epi16(mm_set1_epi16(opacity), 8)
|
opacityVec = mm_slli_epi16(mm_set1_epi16(opacity), 8)
|
||||||
iterations = image.data.len div 4
|
iterations = (image.data.len - i) div 4
|
||||||
for _ in 0 ..< iterations:
|
for _ in 0 ..< iterations:
|
||||||
let values = mm_loadu_si128(cast[pointer](p))
|
let values = mm_loadu_si128(cast[pointer](p))
|
||||||
if mm_movemask_epi8(mm_cmpeq_epi16(values, zeroVec)) != 0xffff:
|
if mm_movemask_epi8(mm_cmpeq_epi16(values, zeroVec)) != 0xffff:
|
||||||
|
@ -308,7 +308,7 @@ proc ceilSse2*(image: Image) {.simd.} =
|
||||||
let
|
let
|
||||||
vecZero = mm_setzero_si128()
|
vecZero = mm_setzero_si128()
|
||||||
vec255 = mm_set1_epi8(255)
|
vec255 = mm_set1_epi8(255)
|
||||||
iterations = image.data.len div 8
|
iterations = (image.data.len - i) div 8
|
||||||
for _ in 0 ..< iterations:
|
for _ in 0 ..< iterations:
|
||||||
var
|
var
|
||||||
values0 = mm_loadu_si128(cast[pointer](p))
|
values0 = mm_loadu_si128(cast[pointer](p))
|
||||||
|
|
Loading…
Reference in a new issue