* [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths
@ 2022-01-04 5:20 J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 2/6] Revert "arm: hevc_qpel: Fix the assembly to work with non-multiple of 8 widths" J. Dekker
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: J. Dekker @ 2022-01-04 5:20 UTC (permalink / raw)
To: ffmpeg-devel
The assembly is written assuming that the width is a multiple of 8.
However the real issue is the functions were errorneously assigned to
the 2, 4, 6 & 12 widths. This behaviour never broke the decoder as
samples which trigger the functions for these widths have not been found
in the wild. This relies on the mappings in ff_hevc_pel_weight[].
Signed-off-by: J. Dekker <jdek@itanimul.li>
---
libavcodec/arm/hevcdsp_init_neon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
This set has already been reviewed by Martin, sending to list for
transparency.
diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c
index 201a088dac..112edb5edd 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -270,7 +270,8 @@ av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, const int bit_depth)
put_hevc_qpel_uw_neon[3][1] = ff_hevc_put_qpel_uw_h1v3_neon_8;
put_hevc_qpel_uw_neon[3][2] = ff_hevc_put_qpel_uw_h2v3_neon_8;
put_hevc_qpel_uw_neon[3][3] = ff_hevc_put_qpel_uw_h3v3_neon_8;
- for (x = 0; x < 10; x++) {
+ for (x = 3; x < 10; x++) {
+ if (x == 4) continue;
c->put_hevc_qpel[x][1][0] = ff_hevc_put_qpel_neon_wrapper;
c->put_hevc_qpel[x][0][1] = ff_hevc_put_qpel_neon_wrapper;
c->put_hevc_qpel[x][1][1] = ff_hevc_put_qpel_neon_wrapper;
--
2.32.0 (Apple Git-132)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH v3 2/6] Revert "arm: hevc_qpel: Fix the assembly to work with non-multiple of 8 widths"
2022-01-04 5:20 [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths J. Dekker
@ 2022-01-04 5:20 ` J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 3/6] lavc/aarch64: add hevc sao edge 16x16 J. Dekker
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: J. Dekker @ 2022-01-04 5:20 UTC (permalink / raw)
To: ffmpeg-devel
This reverts commit 2589060b92eeeb944c6e2b50e38412c0c5fabcf4 which was
originally to fix the FATE test. The real cause of the test breakage was
fixed in 8dc8f04036eb27c8ad419839d4ed3bc67c44fe7a.
Signed-off-by: J. Dekker <jdek@itanimul.li>
---
libavcodec/arm/hevcdsp_qpel_neon.S | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/libavcodec/arm/hevcdsp_qpel_neon.S b/libavcodec/arm/hevcdsp_qpel_neon.S
index f71bec05ed..caa6efa766 100644
--- a/libavcodec/arm/hevcdsp_qpel_neon.S
+++ b/libavcodec/arm/hevcdsp_qpel_neon.S
@@ -237,7 +237,7 @@
vld1.8 {d23}, [r2], r3
bne 8b
subs r5, #8
- ble 99f
+ beq 99f
mov r4, r12
add r6, #16
mov r0, r6
@@ -280,7 +280,7 @@
vld1.8 {d23}, [r2], r3
bne 8b
subs r5, #8
- ble 99f
+ beq 99f
mov r4, r12
add r6, #8
mov r0, r6
@@ -310,7 +310,7 @@
vld1.8 {d23}, [r2], r3
bne 8b
subs r5, #8
- ble 99f
+ beq 99f
mov r4, r12
add r6, #8
mov r0, r6
@@ -377,7 +377,7 @@ endfunc
vst1.16 {q7}, [r0], r1
bne 8b
subs r5, #8
- ble 99f
+ beq 99f
mov r4, r12
add r6, #16
mov r0, r6
@@ -417,7 +417,7 @@ endfunc
vst1.8 d0, [r0], r1
bne 8b
subs r5, #8
- ble 99f
+ beq 99f
mov r4, r12
add r6, #8
mov r0, r6
@@ -446,7 +446,7 @@ endfunc
vst1.8 d0, [r0], r1
bne 8b
subs r5, #8
- ble 99f
+ beq 99f
mov r4, r12
add r6, #8
add r10, #16
@@ -533,7 +533,7 @@ endfunc
\filterh q7
bne 8b
subs r5, #8
- ble 99f
+ beq 99f
mov r4, r12
add r6, #16
mov r0, r6
@@ -594,7 +594,7 @@ endfunc
\filterh q7
bne 8b
subs r5, #8
- ble 99f
+ beq 99f
mov r4, r12
add r6, #8
mov r0, r6
@@ -641,7 +641,7 @@ endfunc
\filterh q7
bne 8b
subs r5, #8
- ble 99f
+ beq 99f
mov r4, r12
add r6, #8
mov r0, r6
--
2.32.0 (Apple Git-132)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH v3 3/6] lavc/aarch64: add hevc sao edge 16x16
2022-01-04 5:20 [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 2/6] Revert "arm: hevc_qpel: Fix the assembly to work with non-multiple of 8 widths" J. Dekker
@ 2022-01-04 5:20 ` J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 4/6] lavc/aarch64: add hevc sao edge 8x8 J. Dekker
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: J. Dekker @ 2022-01-04 5:20 UTC (permalink / raw)
To: ffmpeg-devel
bench on AWS Graviton:
hevc_sao_edge_16x16_8_c: 1857.0
hevc_sao_edge_16x16_8_neon: 211.0
hevc_sao_edge_32x32_8_c: 7802.2
hevc_sao_edge_32x32_8_neon: 808.2
hevc_sao_edge_48x48_8_c: 16764.2
hevc_sao_edge_48x48_8_neon: 1796.5
hevc_sao_edge_64x64_8_c: 32647.5
hevc_sao_edge_64x64_8_neon: 3118.5
Signed-off-by: J. Dekker <jdek@itanimul.li>
---
libavcodec/aarch64/hevcdsp_init_aarch64.c | 8 ++-
libavcodec/aarch64/hevcdsp_sao_neon.S | 65 +++++++++++++++++++++++
2 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index c785e46f79..747ff0412d 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -57,8 +57,8 @@ void ff_hevc_sao_band_filter_8x8_8_neon(uint8_t *_dst, uint8_t *_src,
ptrdiff_t stride_dst, ptrdiff_t stride_src,
int16_t *sao_offset_val, int sao_left_class,
int width, int height);
-
-
+void ff_hevc_sao_edge_filter_16x16_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst,
+ int16_t *sao_offset_val, int eo, int width, int height);
av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
{
@@ -76,6 +76,10 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon;
c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon;
c->sao_band_filter[0] = ff_hevc_sao_band_filter_8x8_8_neon;
+ c->sao_edge_filter[1] =
+ c->sao_edge_filter[2] =
+ c->sao_edge_filter[3] =
+ c->sao_edge_filter[4] = ff_hevc_sao_edge_filter_16x16_8_neon;
}
if (bit_depth == 10) {
c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon;
diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S b/libavcodec/aarch64/hevcdsp_sao_neon.S
index f9fed8345b..4b895959d8 100644
--- a/libavcodec/aarch64/hevcdsp_sao_neon.S
+++ b/libavcodec/aarch64/hevcdsp_sao_neon.S
@@ -85,3 +85,68 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
bne 1b
ret
endfunc
+
+// ASSUMES STRIDE_SRC = 192
+.Lsao_edge_pos:
+.word 1 // horizontal
+.word 192 // vertical
+.word 192 + 1 // 45 degree
+.word 192 - 1 // 135 degree
+
+// ff_hevc_sao_edge_filter_16x16_8_neon(char *dst, char *src, ptrdiff stride_dst,
+// int16 *sao_offset_val, int eo, int width, int height)
+function ff_hevc_sao_edge_filter_16x16_8_neon, export=1
+ adr x7, .Lsao_edge_pos
+ ld1 {v3.8h}, [x3] // load sao_offset_val
+ sxtw x5, w5
+ ldr w4, [x7, w4, uxtw #2] // stride_src
+ mov v3.h[7], v3.h[0] // reorder to [1,2,0,3,4]
+ mov v3.h[0], v3.h[1]
+ mov v3.h[1], v3.h[2]
+ mov v3.h[2], v3.h[7]
+ // split 16bit values into two tables
+ uzp2 v1.16b, v3.16b, v3.16b // sao_offset_val -> upper
+ uzp1 v0.16b, v3.16b, v3.16b // sao_offset_val -> lower
+ movi v2.16b, #2
+ mov x15, #192
+ // strides between end of line and next src/dst
+ sub x15, x15, x5 // stride_src - width
+ sub x16, x2, x5 // stride_dst - width
+ mov x11, x1 // copy base src
+1: // new line
+ mov x14, x5 // copy width
+ sub x12, x11, x4 // src_a (prev) = src - sao_edge_pos
+ add x13, x11, x4 // src_b (next) = src + sao_edge_pos
+2: // process 16 bytes
+ ld1 {v3.16b}, [x11], #16 // load src
+ ld1 {v4.16b}, [x12], #16 // load src_a (prev)
+ ld1 {v5.16b}, [x13], #16 // load src_b (next)
+ cmhi v16.16b, v4.16b, v3.16b // (prev > cur)
+ cmhi v17.16b, v3.16b, v4.16b // (cur > prev)
+ cmhi v18.16b, v5.16b, v3.16b // (next > cur)
+ cmhi v19.16b, v3.16b, v5.16b // (cur > next)
+ sub v20.16b, v16.16b, v17.16b // diff0 = CMP(cur, prev) = (cur > prev) - (cur < prev)
+ sub v21.16b, v18.16b, v19.16b // diff1 = CMP(cur, next) = (cur > next) - (cur < next)
+ add v20.16b, v20.16b, v21.16b // diff = diff0 + diff1
+ add v20.16b, v20.16b, v2.16b // offset_val = diff + 2
+ tbl v16.16b, {v0.16b}, v20.16b
+ tbl v17.16b, {v1.16b}, v20.16b
+ uxtl v20.8h, v3.8b // src[0:7]
+ uxtl2 v21.8h, v3.16b // src[7:15]
+ zip1 v18.16b, v16.16b, v17.16b // sao_offset_val lower ->
+ zip2 v19.16b, v16.16b, v17.16b // sao_offset_val upper ->
+ sqadd v20.8h, v18.8h, v20.8h // + sao_offset_val
+ sqadd v21.8h, v19.8h, v21.8h
+ sqxtun v3.8b, v20.8h
+ sqxtun2 v3.16b, v21.8h
+ st1 {v3.16b}, [x0], #16
+ subs x14, x14, #16 // filtered 16 bytes
+ b.ne 2b // do we have width to filter?
+ // no width to filter, setup next line
+ add x11, x11, x15 // stride src to next line
+ add x0, x0, x16 // stride dst to next line
+ subs w6, w6, #1 // filtered line
+ b.ne 1b // do we have lines to process?
+ // no lines to filter
+ ret
+endfunc
--
2.32.0 (Apple Git-132)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH v3 4/6] lavc/aarch64: add hevc sao edge 8x8
2022-01-04 5:20 [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 2/6] Revert "arm: hevc_qpel: Fix the assembly to work with non-multiple of 8 widths" J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 3/6] lavc/aarch64: add hevc sao edge 16x16 J. Dekker
@ 2022-01-04 5:20 ` J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 5/6] lavc/aarch64: clean-up sao band 8x8 function formatting J. Dekker
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: J. Dekker @ 2022-01-04 5:20 UTC (permalink / raw)
To: ffmpeg-devel
bench on AWS Graviton:
hevc_sao_edge_8x8_8_c: 516.0
hevc_sao_edge_8x8_8_neon: 81.0
Signed-off-by: J. Dekker <jdek@itanimul.li>
---
libavcodec/aarch64/hevcdsp_init_aarch64.c | 3 ++
libavcodec/aarch64/hevcdsp_sao_neon.S | 51 +++++++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index 747ff0412d..b93cec9e44 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -59,6 +59,8 @@ void ff_hevc_sao_band_filter_8x8_8_neon(uint8_t *_dst, uint8_t *_src,
int width, int height);
void ff_hevc_sao_edge_filter_16x16_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst,
int16_t *sao_offset_val, int eo, int width, int height);
+void ff_hevc_sao_edge_filter_8x8_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst,
+ int16_t *sao_offset_val, int eo, int width, int height);
av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
{
@@ -76,6 +78,7 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon;
c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon;
c->sao_band_filter[0] = ff_hevc_sao_band_filter_8x8_8_neon;
+ c->sao_edge_filter[0] = ff_hevc_sao_edge_filter_8x8_8_neon;
c->sao_edge_filter[1] =
c->sao_edge_filter[2] =
c->sao_edge_filter[3] =
diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S b/libavcodec/aarch64/hevcdsp_sao_neon.S
index 4b895959d8..167b9676d8 100644
--- a/libavcodec/aarch64/hevcdsp_sao_neon.S
+++ b/libavcodec/aarch64/hevcdsp_sao_neon.S
@@ -150,3 +150,54 @@ function ff_hevc_sao_edge_filter_16x16_8_neon, export=1
// no lines to filter
ret
endfunc
+
+// ff_hevc_sao_edge_filter_8x8_8_neon(char *dst, char *src, ptrdiff stride_dst,
+// int16 *sao_offset_val, int eo, int width, int height)
+function ff_hevc_sao_edge_filter_8x8_8_neon, export=1
+ adr x7, .Lsao_edge_pos
+ ldr w4, [x7, w4, uxtw #2]
+ ld1 {v3.8h}, [x3]
+ mov v3.h[7], v3.h[0]
+ mov v3.h[0], v3.h[1]
+ mov v3.h[1], v3.h[2]
+ mov v3.h[2], v3.h[7]
+ uzp2 v1.16b, v3.16b, v3.16b
+ uzp1 v0.16b, v3.16b, v3.16b
+ movi v2.16b, #2
+ add x16, x0, x2
+ lsl x2, x2, #1
+ mov x15, #192
+ mov x8, x1
+ sub x9, x1, x4
+ add x10, x1, x4
+ mov x17, #4
+1: ld1 {v3.d}[0], [ x8], x15
+ ld1 {v4.d}[0], [ x9], x15
+ ld1 {v5.d}[0], [x10], x15
+ ld1 {v3.d}[1], [ x8], x15
+ ld1 {v4.d}[1], [ x9], x15
+ ld1 {v5.d}[1], [x10], x15
+ cmhi v16.16b, v4.16b, v3.16b
+ cmhi v17.16b, v3.16b, v4.16b
+ cmhi v18.16b, v5.16b, v3.16b
+ cmhi v19.16b, v3.16b, v5.16b
+ sub v20.16b, v16.16b, v17.16b
+ sub v21.16b, v18.16b, v19.16b
+ add v20.16b, v20.16b, v21.16b
+ add v20.16b, v20.16b, v2.16b
+ tbl v16.16b, {v0.16b}, v20.16b
+ tbl v17.16b, {v1.16b}, v20.16b
+ uxtl v20.8h, v3.8b
+ uxtl2 v21.8h, v3.16b
+ zip1 v18.16b, v16.16b, v17.16b
+ zip2 v19.16b, v16.16b, v17.16b
+ sqadd v20.8h, v18.8h, v20.8h
+ sqadd v21.8h, v19.8h, v21.8h
+ sqxtun v6.8b, v20.8h
+ sqxtun v7.8b, v21.8h
+ st1 {v6.8b}, [ x0], x2
+ st1 {v7.8b}, [x16], x2
+ subs x17, x17, #1
+ b.ne 1b
+ ret
+endfunc
--
2.32.0 (Apple Git-132)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH v3 5/6] lavc/aarch64: clean-up sao band 8x8 function formatting
2022-01-04 5:20 [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths J. Dekker
` (2 preceding siblings ...)
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 4/6] lavc/aarch64: add hevc sao edge 8x8 J. Dekker
@ 2022-01-04 5:20 ` J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 6/6] lavc/aarch64: add hevc sao band 8x8 tiling J. Dekker
2022-01-05 6:46 ` [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths Andreas Rheinhardt
5 siblings, 0 replies; 10+ messages in thread
From: J. Dekker @ 2022-01-04 5:20 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: J. Dekker <jdek@itanimul.li>
---
libavcodec/aarch64/hevcdsp_sao_neon.S | 65 +++++++++++----------------
1 file changed, 25 insertions(+), 40 deletions(-)
diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S b/libavcodec/aarch64/hevcdsp_sao_neon.S
index 167b9676d8..73b0b3b056 100644
--- a/libavcodec/aarch64/hevcdsp_sao_neon.S
+++ b/libavcodec/aarch64/hevcdsp_sao_neon.S
@@ -30,24 +30,21 @@
// int width, int height)
function ff_hevc_sao_band_filter_8x8_8_neon, export=1
sub sp, sp, #64
- stp xzr, xzr, [sp]
- stp xzr, xzr, [sp, #16]
- stp xzr, xzr, [sp, #32]
- stp xzr, xzr, [sp, #48]
+ stp xzr, xzr, [sp]
+ stp xzr, xzr, [sp, #16]
+ stp xzr, xzr, [sp, #32]
+ stp xzr, xzr, [sp, #48]
mov w8, #4
-0:
- ldrsh x9, [x4, x8, lsl #1] // x9 = sao_offset_val[k+1]
+0: ldrsh x9, [x4, x8, lsl #1] // sao_offset_val[k+1]
subs w8, w8, #1
- add w10, w8, w5 // x10 = k + sao_left_class
- and w10, w10, #0x1F
+ add w10, w8, w5 // k + sao_left_class
+ and w10, w10, #0x1F
strh w9, [sp, x10, lsl #1]
bne 0b
- ld1 {v16.16b-v19.16b}, [sp], #64
- movi v20.8h, #1
-1: // beginning of line
- mov w8, w6
-2:
- // Simple layout for accessing 16bit values
+ ld1 {v16.16b-v19.16b}, [sp], #64
+ movi v20.8h, #1
+1: mov w8, w6 // beginning of line
+2: // Simple layout for accessing 16bit values
// with 8bit LUT.
//
// 00 01 02 03 04 05 06 07
@@ -55,33 +52,21 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
// |xDE#xAD|xCA#xFE|xBE#xEF|xFE#xED|....
// +----------------------------------->
// i-0 i-1 i-2 i-3
- // dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
- ld1 {v2.8b}, [x1]
- // load src[x]
- uxtl v0.8h, v2.8b
- // >> shift
- ushr v2.8h, v0.8h, #3 // BIT_DEPTH - 3
- // x2 (access lower short)
- shl v1.8h, v2.8h, #1 // low (x2, accessing short)
- // +1 access upper short
- add v3.8h, v1.8h, v20.8h
- // shift insert index to upper byte
- sli v1.8h, v3.8h, #8
- // table
- tbx v2.16b, {v16.16b-v19.16b}, v1.16b
- // src[x] + table
- add v1.8h, v0.8h, v2.8h
- // clip + narrow
- sqxtun v4.8b, v1.8h
- // store
- st1 {v4.8b}, [x0]
- // done 8 pixels
- subs w8, w8, #8
+ ld1 {v2.8b}, [x1] // dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
+ uxtl v0.8h, v2.8b // load src[x]
+ ushr v2.8h, v0.8h, #3 // >> BIT_DEPTH - 3
+ shl v1.8h, v2.8h, #1 // low (x2, accessing short)
+ add v3.8h, v1.8h, v20.8h // +1 access upper short
+ sli v1.8h, v3.8h, #8 // shift insert index to upper byte
+ tbx v2.16b, {v16.16b-v19.16b}, v1.16b // table
+ add v1.8h, v0.8h, v2.8h // src[x] + table
+ sqxtun v4.8b, v1.8h // clip + narrow
+ st1 {v4.8b}, [x0] // store
+ subs w8, w8, #8 // done 8 pixels
bne 2b
- // finished line
- subs w7, w7, #1
- add x0, x0, x2 // dst += stride_dst
- add x1, x1, x3 // src += stride_src
+ subs w7, w7, #1 // finished line, prep. new
+ add x0, x0, x2 // dst += stride_dst
+ add x1, x1, x3 // src += stride_src
bne 1b
ret
endfunc
--
2.32.0 (Apple Git-132)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH v3 6/6] lavc/aarch64: add hevc sao band 8x8 tiling
2022-01-04 5:20 [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths J. Dekker
` (3 preceding siblings ...)
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 5/6] lavc/aarch64: clean-up sao band 8x8 function formatting J. Dekker
@ 2022-01-04 5:20 ` J. Dekker
2022-01-04 9:41 ` Martin Storsjö
2022-01-05 6:46 ` [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths Andreas Rheinhardt
5 siblings, 1 reply; 10+ messages in thread
From: J. Dekker @ 2022-01-04 5:20 UTC (permalink / raw)
To: ffmpeg-devel
--bench on AWS Graviton:
hevc_sao_band_8x8_8_c: 317.5
hevc_sao_band_8x8_8_neon: 97.5
hevc_sao_band_16x16_8_c: 1115.0
hevc_sao_band_16x16_8_neon: 322.7
hevc_sao_band_32x32_8_c: 4599.2
hevc_sao_band_32x32_8_neon: 1246.2
hevc_sao_band_48x48_8_c: 10021.7
hevc_sao_band_48x48_8_neon: 2740.5
hevc_sao_band_64x64_8_c: 17635.0
hevc_sao_band_64x64_8_neon: 4875.7
Signed-off-by: J. Dekker <jdek@itanimul.li>
---
libavcodec/aarch64/hevcdsp_init_aarch64.c | 6 +++++-
libavcodec/aarch64/hevcdsp_sao_neon.S | 11 +++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index b93cec9e44..2002530266 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -77,7 +77,11 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon;
c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon;
c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon;
- c->sao_band_filter[0] = ff_hevc_sao_band_filter_8x8_8_neon;
+ c->sao_band_filter[0] =
+ c->sao_band_filter[1] =
+ c->sao_band_filter[2] =
+ c->sao_band_filter[3] =
+ c->sao_band_filter[4] = ff_hevc_sao_band_filter_8x8_8_neon;
c->sao_edge_filter[0] = ff_hevc_sao_edge_filter_8x8_8_neon;
c->sao_edge_filter[1] =
c->sao_edge_filter[2] =
diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S b/libavcodec/aarch64/hevcdsp_sao_neon.S
index 73b0b3b056..d524323fe8 100644
--- a/libavcodec/aarch64/hevcdsp_sao_neon.S
+++ b/libavcodec/aarch64/hevcdsp_sao_neon.S
@@ -3,7 +3,7 @@
*
* AArch64 NEON optimised SAO functions for HEVC decoding
*
- * Copyright (c) 2020 Josh Dekker <josh@itanimul.li>
+ * Copyright (c) 2020-2021 J. Dekker <jdek@itanimul.li>
*
* This file is part of FFmpeg.
*
@@ -35,6 +35,7 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
stp xzr, xzr, [sp, #32]
stp xzr, xzr, [sp, #48]
mov w8, #4
+ sxtw x6, w6
0: ldrsh x9, [x4, x8, lsl #1] // sao_offset_val[k+1]
subs w8, w8, #1
add w10, w8, w5 // k + sao_left_class
@@ -43,7 +44,9 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
bne 0b
ld1 {v16.16b-v19.16b}, [sp], #64
movi v20.8h, #1
-1: mov w8, w6 // beginning of line
+ sub x2, x2, x6 // stride_dst - width
+ sub x3, x3, x6 // stride_src - width
+1: mov x8, x6 // beginning of line
2: // Simple layout for accessing 16bit values
// with 8bit LUT.
//
@@ -52,7 +55,7 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
// |xDE#xAD|xCA#xFE|xBE#xEF|xFE#xED|....
// +----------------------------------->
// i-0 i-1 i-2 i-3
- ld1 {v2.8b}, [x1] // dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
+ ld1 {v2.8b}, [x1], #8 // dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
uxtl v0.8h, v2.8b // load src[x]
ushr v2.8h, v0.8h, #3 // >> BIT_DEPTH - 3
shl v1.8h, v2.8h, #1 // low (x2, accessing short)
@@ -61,7 +64,7 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
tbx v2.16b, {v16.16b-v19.16b}, v1.16b // table
add v1.8h, v0.8h, v2.8h // src[x] + table
sqxtun v4.8b, v1.8h // clip + narrow
- st1 {v4.8b}, [x0] // store
+ st1 {v4.8b}, [x0], #8 // store
subs w8, w8, #8 // done 8 pixels
bne 2b
subs w7, w7, #1 // finished line, prep. new
--
2.32.0 (Apple Git-132)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH v3 6/6] lavc/aarch64: add hevc sao band 8x8 tiling
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 6/6] lavc/aarch64: add hevc sao band 8x8 tiling J. Dekker
@ 2022-01-04 9:41 ` Martin Storsjö
2022-01-04 13:34 ` J. Dekker
0 siblings, 1 reply; 10+ messages in thread
From: Martin Storsjö @ 2022-01-04 9:41 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Tue, 4 Jan 2022, J. Dekker wrote:
> --bench on AWS Graviton:
>
> hevc_sao_band_8x8_8_c: 317.5
> hevc_sao_band_8x8_8_neon: 97.5
> hevc_sao_band_16x16_8_c: 1115.0
> hevc_sao_band_16x16_8_neon: 322.7
> hevc_sao_band_32x32_8_c: 4599.2
> hevc_sao_band_32x32_8_neon: 1246.2
> hevc_sao_band_48x48_8_c: 10021.7
> hevc_sao_band_48x48_8_neon: 2740.5
> hevc_sao_band_64x64_8_c: 17635.0
> hevc_sao_band_64x64_8_neon: 4875.7
>
> Signed-off-by: J. Dekker <jdek@itanimul.li>
> ---
> libavcodec/aarch64/hevcdsp_init_aarch64.c | 6 +++++-
> libavcodec/aarch64/hevcdsp_sao_neon.S | 11 +++++++----
> 2 files changed, 12 insertions(+), 5 deletions(-)
LGTM, please push.
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH v3 6/6] lavc/aarch64: add hevc sao band 8x8 tiling
2022-01-04 9:41 ` Martin Storsjö
@ 2022-01-04 13:34 ` J. Dekker
0 siblings, 0 replies; 10+ messages in thread
From: J. Dekker @ 2022-01-04 13:34 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On 4 Jan 2022, at 10:41, Martin Storsjö wrote:
> On Tue, 4 Jan 2022, J. Dekker wrote:
>
> [...]
>
> LGTM, please push.
>
> // Martin
>
Thanks, pushed.
--
J. Dekker
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths
2022-01-04 5:20 [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths J. Dekker
` (4 preceding siblings ...)
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 6/6] lavc/aarch64: add hevc sao band 8x8 tiling J. Dekker
@ 2022-01-05 6:46 ` Andreas Rheinhardt
2022-01-05 8:30 ` Martin Storsjö
5 siblings, 1 reply; 10+ messages in thread
From: Andreas Rheinhardt @ 2022-01-05 6:46 UTC (permalink / raw)
To: ffmpeg-devel
J. Dekker:
> The assembly is written assuming that the width is a multiple of 8.
>
> However the real issue is the functions were errorneously assigned to
> the 2, 4, 6 & 12 widths. This behaviour never broke the decoder as
> samples which trigger the functions for these widths have not been found
> in the wild. This relies on the mappings in ff_hevc_pel_weight[].
>
> Signed-off-by: J. Dekker <jdek@itanimul.li>
> ---
> libavcodec/arm/hevcdsp_init_neon.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> This set has already been reviewed by Martin, sending to list for
> transparency.
>
> diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c
> index 201a088dac..112edb5edd 100644
> --- a/libavcodec/arm/hevcdsp_init_neon.c
> +++ b/libavcodec/arm/hevcdsp_init_neon.c
> @@ -270,7 +270,8 @@ av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, const int bit_depth)
> put_hevc_qpel_uw_neon[3][1] = ff_hevc_put_qpel_uw_h1v3_neon_8;
> put_hevc_qpel_uw_neon[3][2] = ff_hevc_put_qpel_uw_h2v3_neon_8;
> put_hevc_qpel_uw_neon[3][3] = ff_hevc_put_qpel_uw_h3v3_neon_8;
> - for (x = 0; x < 10; x++) {
> + for (x = 3; x < 10; x++) {
> + if (x == 4) continue;
> c->put_hevc_qpel[x][1][0] = ff_hevc_put_qpel_neon_wrapper;
> c->put_hevc_qpel[x][0][1] = ff_hevc_put_qpel_neon_wrapper;
> c->put_hevc_qpel[x][1][1] = ff_hevc_put_qpel_neon_wrapper;
>
This patchset led to regressions; see e.g.
http://fate.ffmpeg.org/report.cgi?time=20220104162724&slot=aarch64-linux-qemu-ubuntu-gcc-4.8
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths
2022-01-05 6:46 ` [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths Andreas Rheinhardt
@ 2022-01-05 8:30 ` Martin Storsjö
0 siblings, 0 replies; 10+ messages in thread
From: Martin Storsjö @ 2022-01-05 8:30 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, 5 Jan 2022, Andreas Rheinhardt wrote:
> J. Dekker:
>> The assembly is written assuming that the width is a multiple of 8.
>>
>> However the real issue is the functions were errorneously assigned to
>> the 2, 4, 6 & 12 widths. This behaviour never broke the decoder as
>> samples which trigger the functions for these widths have not been found
>> in the wild. This relies on the mappings in ff_hevc_pel_weight[].
>>
>> Signed-off-by: J. Dekker <jdek@itanimul.li>
>> ---
>> libavcodec/arm/hevcdsp_init_neon.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> This set has already been reviewed by Martin, sending to list for
>> transparency.
>>
>> diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c
>> index 201a088dac..112edb5edd 100644
>> --- a/libavcodec/arm/hevcdsp_init_neon.c
>> +++ b/libavcodec/arm/hevcdsp_init_neon.c
>> @@ -270,7 +270,8 @@ av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, const int bit_depth)
>> put_hevc_qpel_uw_neon[3][1] = ff_hevc_put_qpel_uw_h1v3_neon_8;
>> put_hevc_qpel_uw_neon[3][2] = ff_hevc_put_qpel_uw_h2v3_neon_8;
>> put_hevc_qpel_uw_neon[3][3] = ff_hevc_put_qpel_uw_h3v3_neon_8;
>> - for (x = 0; x < 10; x++) {
>> + for (x = 3; x < 10; x++) {
>> + if (x == 4) continue;
>> c->put_hevc_qpel[x][1][0] = ff_hevc_put_qpel_neon_wrapper;
>> c->put_hevc_qpel[x][0][1] = ff_hevc_put_qpel_neon_wrapper;
>> c->put_hevc_qpel[x][1][1] = ff_hevc_put_qpel_neon_wrapper;
>>
>
> This patchset led to regressions; see e.g.
> http://fate.ffmpeg.org/report.cgi?time=20220104162724&slot=aarch64-linux-qemu-ubuntu-gcc-4.8
Indeed. I had only ran fate-checkasm while reviewing it, assuming that it
had been fully tested with fate-hevc by the patch author.
Instead of reverting the full 6 patch set, it's enough to revert a couple
patches out of it though (there's some cosmetic cleanup that we can keep
in for now). But I'm afraid we should disable the preexisting
ff_hevc_sao_band_filter_8x8_8_neon function too. It's currently only run
for the [0] case, which I think corresponds to width <= 8. But if that
case also must handle widths that aren't an even multiple of 8, we'd have
a lingering bug that isn't exercised by fate-hevc.
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-01-05 8:30 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 5:20 [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 2/6] Revert "arm: hevc_qpel: Fix the assembly to work with non-multiple of 8 widths" J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 3/6] lavc/aarch64: add hevc sao edge 16x16 J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 4/6] lavc/aarch64: add hevc sao edge 8x8 J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 5/6] lavc/aarch64: clean-up sao band 8x8 function formatting J. Dekker
2022-01-04 5:20 ` [FFmpeg-devel] [PATCH v3 6/6] lavc/aarch64: add hevc sao band 8x8 tiling J. Dekker
2022-01-04 9:41 ` Martin Storsjö
2022-01-04 13:34 ` J. Dekker
2022-01-05 6:46 ` [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths Andreas Rheinhardt
2022-01-05 8:30 ` Martin Storsjö
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git