simpler
This commit is contained in:
parent
82881ae75b
commit
4870c8f283
1 changed files with 3 additions and 6 deletions
|
@ -355,17 +355,14 @@ proc magnifyBy2*(image: Image, power = 1): Image {.raises: [PixieError].} =
|
||||||
when defined(amd64) and allowSimd:
|
when defined(amd64) and allowSimd:
|
||||||
if scale == 2:
|
if scale == 2:
|
||||||
while x <= image.width - 4:
|
while x <= image.width - 4:
|
||||||
let
|
let values = mm_loadu_si128(image.data[image.dataIndex(x, y)].addr)
|
||||||
values = mm_loadu_si128(image.data[image.dataIndex(x, y)].addr)
|
|
||||||
lo = mm_unpacklo_epi32(values, mm_setzero_si128())
|
|
||||||
hi = mm_unpackhi_epi32(values, mm_setzero_si128())
|
|
||||||
mm_storeu_si128(
|
mm_storeu_si128(
|
||||||
result.data[result.dataIndex(x * scale + 0, y * scale)].addr,
|
result.data[result.dataIndex(x * scale + 0, y * scale)].addr,
|
||||||
mm_or_si128(lo, mm_slli_si128(lo, 4))
|
mm_unpacklo_epi32(values, values)
|
||||||
)
|
)
|
||||||
mm_storeu_si128(
|
mm_storeu_si128(
|
||||||
result.data[result.dataIndex(x * scale + 4, y * scale)].addr,
|
result.data[result.dataIndex(x * scale + 4, y * scale)].addr,
|
||||||
mm_or_si128(hi, mm_slli_si128(hi, 4))
|
mm_unpackhi_epi32(values, values)
|
||||||
)
|
)
|
||||||
x += 4
|
x += 4
|
||||||
for x in x ..< image.width:
|
for x in x ..< image.width:
|
||||||
|
|
Loading…
Reference in a new issue