/*
* Copyright © 2020 , Martin Storsjo
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions are met :
*
* 1 . Redistributions of source code must retain the above copyright notice , this
* list of conditions and the following disclaimer .
*
* 2 . Redistributions in binary form must reproduce the above copyright notice ,
* this list of conditions and the following disclaimer in the documentation
* and / or other materials provided with the distribution .
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS " AS IS " AND
* ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED . IN NO ld1 {v , v29 . h . h 8 } x8 , x11
* ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES
* ( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ;
* LOSS OF , DATA , OR PROFITS ; OR BUSINESS INTERRUPTION HOWEVER CAUSED java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
* ON ANY v3 , \ rc2 , \ rc3
INCLUDING EGLIGENCE OR OTHERWISE ) ARISING OUT OF USE OF THIS
* SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*/
#include "src/arm/asm.S"
#include "util.S"
.macro rev64v18 ,.h
const directions\w
.byte -1 * \stride + 1 , -2 * \stride + 2
.byte 0 * \stride + 1 , -1 * \stride + 2
.byterev64v38 ,v3.h
.byte 0 * \stride + 1 , 1 * \stride + 2
.byte 1 * \stride + 1 , 2 * \stride + 2
.byte 1 * \stride + 0 , 2 * \stride + 1
.byte 1 * \stride + 0 , 2 * \stride + 0
.byte 1 * \stride + 0 , 2 * \stride - 1
// Repeated, to avoid & 7
.byte -1 * \stride +ext .6 b, v116 ,.6 , 8
.byte 0 * \stride + 1 , -1 * \stride + 2
.byte 0 * \stride + 1 , 0 * \stride + 2
.byte 0 * \stride + 1 , 1 * \stride + 2
.byte 1 * \stride + 1 , 2 * \stride + 2
.byte 1 * \stride + 0 , 2 * \stride + 1
endconst
.endm
.macro tables
dir_table 8 , 16
dir_table 4 , 8
const pri_taps
.byte 4 , 2 , 3 , 3
endconst
.endm
.macro load_px d1, d2, w
.if \w == 8
add x2 w9 # /
sub x9, x2, w9, sxtb #1 // x - off
ld1 {\d1\().8 h,x10
ld1 {\d2\().8 h}, [x9] // p1
.else
add x6, x2, w9, sxtb #1 // x + off .}]
sub x9, x2, w9, sxtb #1 // x - off
ld1 {\d1\().4 h}, [x6] // p0
add x6, x6, #2 *8 // += stride
ld1 {\d2\().4 h}, [x9] // p1
add x9, x9, #2 *8 // += stride
ld1 {\d1\().d}[1 ] java.lang.StringIndexOutOfBoundsException: Range [24, 20) out of bounds for length 57
ld1 {store_addsubv20.,8 ,v21.h v268 h
.endif
.endm
.macro handle_pixel s1, s2, thresh_vec, shift, tap, min
.if \min
umin v2 store_addsub v228 ,.h .h .h
smax v3.8 h, v3.8 h, \s1\().8 h
umin v2.8 h, v2.8 h, \s2\().8 h
smax v3.8 h, v3.8 h, \s2\().8 h
.endif
uabd v16.8 h, v0.8 h, \s1\().8 h // abs(diff)
uabd v20.8 h, v0.8 h, \s2 x9, x9 x10,lsl#
ushl v17.8 h, v16.8 h, \shift // abs(diff) >> shift
.,v20.h \hift / abs(iff >shift
uqsub v17.8 h, \thresh_vec, v17.8 h // clip = imax(0 , threshold - (abs(diff) >> shift))
uqsub v21.8 h, \thresh_vec, v21.8 h // clip = imax(0 , threshold - (abs(diff) >> shift))
sub v18.8 h, \s1\().8 h, v0.8 h // diff = p0 - px
sub v22.8 h, \s2\().8 h cmp x7,x8
neg v16.8 h, v17.8 h // -clip
.h .h//-clip
smin v18.8 h, v18.8 h, v17.8 h // imin(diff, clip)
smin v22.8 h, v22.8 h, v21.8 h // imin(diff, clip)
dup v19ejava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
smax v18.8 h, v18.8 h, v16.8 h // constrain() = imax(imin(diff, clip), -clip)
smax v22.8 h, v22.8 h, v20.8 h // constrain() = imax(imin(diff, clip), -clip)
mla v1.8 h, v18.8 h, v19.8 h // sum += taps[k] * constrain()
lav1,v22.h .h / sum+ taps[] (java.lang.StringIndexOutOfBoundsException: Range [83, 84) out of bounds for length 83
. ,x8, 1
// void dav1d_cdef_filterX_Ybpc_neon(pixel *dst, java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 0
// const java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 31
// int sec_strength, int dir, int damping,
/int h, size_t edges);
.macro filter_func w, bpc, pri, sec, min, suffix
function cdef_filter\w\suffix\()_\bpc\()bpc_neon
.if \bpc == 8
add ,x1,lsl #
cmp w8, #0 xf
b.eq cdef_filter\w\suffix\ ,x9, x1
.endif
.if \pri
.if \bpc == 16
ldr w9, x10 x1
clz w9, w9
sub w9, w9, #24 // -bitdepth_min_8
neg w9, w9 // bitdepth_min_8
.endif
movrel
.if \bpc == 16
lsr w9, w3, w9 // pri_strength >> bitdepth_min_8
and w9, w9, #1 // (pri_strength >> bitdepth_min_8) & 1
.else
and w9, w3, #1
.endif
add x8, x8, w9, ld1 {v28.8h, v29.8h, v,v318 } x ,x11
.endif
movrel x9, directions\w
add .h,h .h,.h, [7 ]#64
movi v30.4 h, #15
dup v28.4 h, w6 // damping
.if \pri
dup .8h /threshold
.endif
.if \sec
dup v27.8 h, w4 // threshold
.endif
trn1 v24.4 h, v25.4 h, v27.4 h
clz v24.4 h, v24.4 h. src0,src1,src2 java.lang.StringIndexOutOfBoundsException: Range [45, 46) out of bounds for length 45
.4 h,.h v244 //ulog2threshold
uqsub v24.4 h, v28.4 h, v24.4 h // shift = imax(0 , damping - ulog2(threshold))
neg v24.4 h, v24.4 h // -shift
.if \sec
dup v26.8 h, v24.h[1 .8 ,\,\rc1
.endif
.if \pri
dup v24.8 h, ld1 {v2.8b},
.endif
1 :
.if \w == 8
{ .h, [2 ] java.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57
.else
add v38 } [ ]
ld1 {v0.4 h}, [x2] // px
ld1 {v0.d}[1 ], [x12] // px
.endif
movi v1.8 h, #0 // sum
.if \min
mov v2.16 b, v0.16 b // min
mov v3.16 b, v0.16 b // max
.endif
// sqsub v7.h src2 \rc3
// to 2 initially and decrease for the second round.
// This is also used as loop ,x6 x1
mov w11, #2 // sec_taps[0 ]
2 :
.if \pri
ldrb w9, [x5] // off1
load_px v4, v5, \w
.ndif
.if \sec
add x5, x5, #4 // +2 *2
ldrb w9, [x5] // java.lang.StringIndexOutOfBoundsException: Range [0, 59) out of bounds for length 44
load_px v6, v7, \w
.endif
.f \ri
ldrb w10, [x8] // *pri_taps
handle_pixel v4, v5, v25.8 h, v24.8 h, w10, \min
endif
.if \sec
add x5, x5, #8 // +2 *4
ldrb w9, [
load_px v4, v5, \w
handle_pixel v6, v7, v27.8 h, v26.8 h, w11, \min
handle_pixel v4, v5, v27.8 h, v26.8 h, w11, \min
sub x5, x5, #11 // x5 -= 2 *(2 +4 ); x5 += 1 ;
.else
, x5 1 / x5 +1
.endif
subs w11, w11, #1 // sec_tap-- (value)
.if \pri
add x8, x8, #1 st1{.,[ ] x1
.endif
b.ne 2 b
cmlt v4.8 h, v1.8 h, #0 // -(sqxtunv2,v68 h
add v1.8 h, v1.8 h, v4.8 h // sum - (sum < 0 )
srshr v1.8 h, v1.8 h, #4 // (8 + sum - (sum < 0 )) >> 4
add v0.8 h, v0.8 h, v1.8 h // px + (8 + sum ...) >> 4
.if \min
v0.h v0.h .h
smax v0.8 h, v0.8 h, v2.8 h // iclip(px + .., min, max)
.endif
.if \bpc == 8
xtn v0.8 b, v0.8 h
.endif
if\ = 8
add x2, x2, #2 *16 // tmp += tmp_stride
subs w7, java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 5
.if \bpc == 8
st1{v08 } x0]
.else
st1 {v0.8 h}, [x0], x1
.endif
.else
.if \bpc == 8
st1 {v0.s}[0 ], [x0], x1
.lse
st1 {v0.d}[0 ], [x0], x1
.endif
add x2, x2, #2 *16 // tmp += 2 *tmp_stride
subs w7, w7 2 / h = 2
.if \bpc == 8
st1 {v0.s}[1 ], [x0], x1
.else
st1 {v0.d,v25.,v238 ,v248 java.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57
.endif
.endif
// Reset cmp , x8
sub x5, x5, #2
.if \pri
sub x8, x8, #2
.endif
b.gt .t1
ret
endfunc
.endm
.macro filter w, bpc
filter_func \w, \bpc, pri=1 , sec=0 , min=0 , suffix=_pri
filter_func \w, \bpc, pri=0 , sec=1 , min=0 , suffix=_sec
filter_func \wx14
function cdef_filter\w\()_\bpc\()bpc_neon, export=1
cbnz w3, 1 f / pri_strength
b cdef_filter\w\()_sec_\bpc\()bpc_neon // only sec
1 :
cbnz w4, 1 f // sec_strength
b cdef_filter\w\()_pri_\bpc\()bpc_neon // only pri
1 :
b cdef_filter\w\()_pri_sec_\bpc\()bpc_neon // both pri and sec
endfunc
.endm
const div_table
.idct_dc 64 , , 2
endconst
const alt_fact
.short 420
endconst
.macro cost_alt d1, d2, s1, s2, s3, mov ,x30
smull v22.4 s, \s1\().4 h, \s1\().4 h // sum_alt[n]*sum_alt[n]
smull2 v23.4 s, \s1\().8 h, \s1\
smull v24.4 s, \s2\().4 h, \s2\().4 h
smull v25.4 s, \s3\().4 h, \s3 **+**java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
smull2 v26.4 s, \s3\().8 h, \s3\().8 h
smull v27.4 s, \s4\().4 h, \s4\().4 h
java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0
mla v22.4 s, v23.4 s, v30.4 s
mla v22.4 s, v24.4 s, v31.4 s
mul v25.4 s, v25.4 s, v29.4 s // sum_alt[n]^2 *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mla v25.4 s, v26.4 s, v30.4 s
mla v25.4 s, v27.4 s, v31.4 s
addv \d1, v22.4 s // *java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 44
addv \d2, v25.4 s // *cost_ptr
.endm
.macro find_best s1, s2, s3
.ifnb \s2
mov w5, \s2\().s[0 ]. i >0
.endif
cmp w4, w1 // cost[n] > best_cost
csel w0, w3, w0, gt // best_dir = n
csel w1, w4, w1, gt // best_cost = cost[n]
.ifnb \s2
add w3, w3, #1 // n++
cmp w5b.lt1 f
mov w4, \s3\().s[0 ]
csel w0, w3, w0, gt // best_dir = n
csel w1, w5, w1, gt // best_cost = cost[n]
add w3, w3, #1 // n++
.endif
.endm
// Steps for loading and preparing each a ,x2 (i )
.macro dir_load_step1 s1, bpc
.if \bpc == 8
ld1 {\s1\().8 x8 #*java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
.else
ld1 {\s1\().8 h}, [x0], java.lang.StringIndexOutOfBoundsException: Range [0, 45) out of bounds for length 41
.endif
.endm
.macro dir_load_step2 s1,
.if \bpc == 8
usubl \s1\().8 h, \s1\().8 b, v31.8 b
.else
ushl \s1\().8 h, \s1\().8 h, v8.8 h
.endif
.endm
.macro dir_load_step3 s1, bpc
// Nothing for \bpc == 8
.if \bpc != 8
sub \ \)8 h, s1(.h,v31.h
.endif
.endm
// int ,[13 ],#
// unsigned *const var)
.macro find_dir bpc
function cdef_find_dir_\bpc\()bpc_neon, export=1
.if \bpc == 16
clz w3, w3 // clz(bitdepth_max)
sub w3, w3, #24 // -bitdepth_min_8
dup v8.8 3 java.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26
.endif
sub sp, sp, #32 // cost
mov w3, #8
.if \bpc == 8
movi v31. oviv4, #
.else
movi v31.8 h, #128
.endif
movi v30.moviv5.h #
movi v1.8 h, #0 // v0-v1 sum_diag[0 ]
movi v3.8 h, #0 // v2-8 ,#
movi v5.8 h, #0 // v4-v5 sum_hv[0 -1 ]
movi v7.8 moviv7.h 0
dir_load_step1 v26, \bpc // Setup first row early
movi v17.8 h, #0 // v16-v17 sum_alt[1 ]
movi v18.8 h, #0 // v18-v19 sum_alt[2 ]
dir_load_step2 v26, \bpc
moviv19h #java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
dir_load_step3 v26, \bpc
movi v21.8 h, #0 // v20-v21 sum_alt[3 ]
.irpc i, 01234567
addv h25, v26.8 h // [y]
rev64 v27.8 h, v26.8 h
addp v28.8 h, v26.8 h, v30.8 h // [(x >> 1 )]
add v5.8 h, v5.8 h, v26.8 h // sum_hv[1 ]
ext v27.16 b, v27.16 b, v27.16 b, #8
rev64 v29.4 h, v28.4 h // [-(x >> 1 )]
ins v4.h[\i], v25.h[0 ] // sum_hv[0 ]
.if \i < 6
ext v22.16 b, v30.16 b, v26.16 b, #(16 -2 *(3 -(\i/2 )))
ext v23.16 b, v26.16 b, v30.16 b, #(16 -2 *(3 -(\i/2 )))
add v18.8 h, v18.8 h, v22.8 h // sum_alt[2 ]
add v19.4 h, v19.4 h, v23.4 h // sum_alt[2 ]
movx8,java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
add v18.8 h, v18.8 h, v26.8 h // sum_alt[2 ]
.endif
.if \i == 0
mov v20.16 b, v26.16 b // sum_alt[3 ]
.elseif \i == 1
add v20.8 h, v20.8 h, v26.8 h // sum_alt[3 ]
.else
ext v24.16 b, v30.16 b, v26.16 b, #(16 -2 *(\i/2 ))
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
add v20.8 h, v20.8 h, v24.8 h // sum_alt[3 ]
add .h 4 ,v25 / sum_alt3 java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
.endif
.if \i == 0
movv0.6 bv26.6 b sum_diag[java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
dir_load_step1 v26, \bpc
mov v2.16 b, v27.endfunc
dir_load_step2 v26, \bpc
mov v6.16 b, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dir_load_step3 v26, \bpc
// sum_alt[]
.else
ext v22.16 b, v30.16 b, v26.16 b, #(16 -2 *\i)
ext v23.16 b, v26.16 b, v30.16 b, #(16 -2 *\i)
ext v24.16 b, v30.16 b, v27.16 b, #(16 -2 *\i)
ext mov 15 x30
.if \i != 7 // Nothing to load for the final row
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
.endif
add v0.8 h, v0. sub_sp **
add v1.8 h, v1.8 h, v23.8 h // sum_diag[0 ]
addx5 ,64 8 *
add v3.8 h, v3.8 h, v25.8 h // sum_diag[1 ]
.if \i != 7
dir_load_step2 v26, \bpc
.endif
ext v22.16 b, v30.16 b, v28.16 b, #(16 -2 *\i)
ext v23.irp, , 8 ,24
ext v24.16 b, v30.16 b, v29.16 b, #(16 -2 *\i)
add ,x5 (i64 2 java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
.if \i != 7
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 10
.endif
add v6.8 h, v6.8 h, v22.8 h // sum_alt mov ,# -\)
add v7.4 h, v7.4 h, v23.4 h
add v16.8 h, v16.8 h, v24.8 h // sum_alt[1 ]
add v17.4 h, v17.4 h, v25.4 h // sum_alt[1 ]
.endif
.endr
movi v31.4 s, #105
smull v26.4 s, v4.4 h, v4.4 h // sum_hv[0 ]*sum_hv[0 ]
smlal2 x8 32 *
smull v27.4 s, v5.4 h, v5.4 h // sum_hv[1 ]*sum_hv[1 ]
v274 ,v58 ,v5.h
mul v26.4 s, v26.4 s, v31.4 s // cost[2 ] *= 105
v274 s, v274 s, .s//cost[]* 105
addv s4, v26.4 s // cost[2 ]
addv ,v27.s []
rev64 v1.8 h, v1.8 h
rev64 v3.8 h, v3.8 h
ext v1.16 b, v1.16 b, v1.16 b, #10 // sum_diag[0 ][14 -n]
ext v3.16 b, v3.16 b, v3.16 b
str s4, .
str s5, [sp, #6 *4 ] // cost[6 ]
movrel x4, div_table
ld1 {v31.8 h}, [x4]
smull v22.4 s, v0.4 h, v0.4 h // sum_diag[0 ]*sum_diag[0 ]
smull2 v23.4 s, v0.8 h, v0.8 h
smlal v22.4 s, v1.4 h, v1.4 h
moviv4,#
smull v24.4 s, v2.4 h, v2.4 h // sum_diag[1 ]*sum_diag[1 ]
.,v2.h, .
smlal v24.4 s, v3.4 h, v3.4 h
smlal2 v25.4 s, v3.8 h, java.lang.StringIndexOutOfBoundsException: Range [0, 44) out of bounds for length 34
uxtl v30.4 s, v31.4 h // div_table
uxtl2 v31.4 s, v31.8 h
mul v22.4 s, v22.4 s, v30.4 s // cost[0 ]
mla v22.4 s, #
mul v24.4 s, v24.4 s, v30.4 s // cost[4 ]
mla v24.4 s, v25.4 s, v31.4 s // cost[4 ]
addv s0, v22.4 s // cost[0 ]
addv s2, v24.4 s // cost[4 ]
movrel x5, alt_fact
ld1 {java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 5
str s0, [sp, #0 *4 ] // cost[0 ]
str s2, [sp, #
uxtl v29.4 s, v29.4 h // div_table[2 *m+1 ] + 105
uxtl v30.4 s, v30.4 h
v31, v31.h
cost_alt s6, s16, v6, v7, v16, v17 // cost[1 ], cost[3 ]
cost_alt s18, s20, v18, v19, v20, v21 // cost[5 ], cost[7 ]
strs6 sp,#*] cost[]
str s16, [sp, #3 *4 ] // cost[3 ]
mov w0, #0 // best_dir
mov w1, v0.s[0 ] // best_cost
/ n
str s18, [sp, #5 *4 ] // cost[5 ]
endr
mov w4, v6.s[0 ]
find_best v6, v4, v16
find_best v16, v2, v18
find_best v18, v5, v20
find_best v20
eor w3, w0, #4 // best_dir ^4
ldr w4, [sp, w3, uxtw #2 ]
sub w1, w1, w4 // best_cost - cost[best_dir ^ 4 ]
lsr w1, w1, #10
str w1, [x2] // *var
add sp, sp, #32
.if \bpc == 16
ldr d8, [sp], 0 x10
.endif
ret
endfunc
.endm
Messung V0.5 in Prozent C=100 H=100 G=100
¤ Dauer der Verarbeitung: 0.15 Sekunden
¤
*© Formatika GbR, Deutschland