Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/arm
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2021-05-13 09:33:21 +0300
committerJean-Baptiste Kempf <jb@videolan.org>2021-05-13 11:49:02 +0300
commit3aac025204602810c5bf33cbad6ac1bf157487cc (patch)
tree54bcb2f2c39f7e4d0377f51c5bdbc952ed89a214 /src/arm
parent1cf1b309bb2c40e25582f2ace6917d84e45f354b (diff)
arm64: filmgrain16: Guard against out of range pixels in the gather function
In 16 bpc, the pixels are 16 bit integers, but valid pixels only are up to 12 bits, and the scaling buffer only contains 4096 elements. The src pixels are, normally, supposed to be valid pixels, but when processing blocks of 32 pixels at a time, it can operate on uninitialized pixels past the right edge. Before: Cortex A53 A72 A73 Apple M1 fgy_32x32xn_16bpc_neon: 10372.5 8194.4 8612.1 24.2 After: fgy_32x32xn_16bpc_neon: 10837.9 8469.5 8885.1 24.6
Diffstat (limited to 'src/arm')
-rw-r--r--src/arm/64/film_grain16.S8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/arm/64/film_grain16.S b/src/arm/64/film_grain16.S
index be40388..a72164c 100644
--- a/src/arm/64/film_grain16.S
+++ b/src/arm/64/film_grain16.S
@@ -188,6 +188,7 @@ function fgy_loop_neon
.macro fgy ox, oy
L(loop_\ox\oy):
1:
+ mov w16, #0xfff
ld1 {v0.8h, v1.8h, v2.8h, v3.8h}, [x1], x2 // src
.if \ox
ld1 {v20.4h}, [x4], x9 // grain_lut old
@@ -198,8 +199,15 @@ L(loop_\ox\oy):
.if \ox && \oy
ld1 {v14.4h}, [x8], x9 // grain_lut top old
.endif
+ dup v4.8h, w16
ld1 {v16.8h, v17.8h, v18.8h, v19.8h}, [x5], x9 // grain_lut
+ // Make sure that uninitialized pixels out of range past the right
+ // edge are in range; their actual values shouldn't matter.
+ and v0.16b, v0.16b, v4.16b
+ and v1.16b, v1.16b, v4.16b
+ and v2.16b, v2.16b, v4.16b
+ and v3.16b, v3.16b, v4.16b
bl gather_neon
.if \ox