summaryrefslogtreecommitdiff
path: root/libavcodec/aarch64
diff options
context:
space:
mode:
authorJ. Dekker <jdek@itanimul.li>2022-04-26 09:29:54 +0200
committerJ. Dekker <jdek@itanimul.li>2022-05-25 08:04:35 +0200
commitd957ee34a6ec998ea00d6d07ac687c5d7a9792a2 (patch)
tree8f149887e7f34884e1346347119a521bcc455c1c /libavcodec/aarch64
parent8d788c567a1338e5b1e322f5ef8db55bc326d41a (diff)
lavc/aarch64: fix hevc sao band filter
The SAO band filter can be called with non-multiples of 8, we round up to the nearest multiple of 8 to account for this. Signed-off-by: J. Dekker <jdek@itanimul.li>
Diffstat (limited to 'libavcodec/aarch64')
-rw-r--r--libavcodec/aarch64/hevcdsp_init_aarch64.c10
-rw-r--r--libavcodec/aarch64/hevcdsp_sao_neon.S8
2 files changed, 11 insertions, 7 deletions
diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index 1e40be740c..c8963e6104 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -75,11 +75,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;
- // This function is disabled, as it doesn't handle widths that aren't
- // an even multiple of 8 correctly. fate-hevc doesn't exercise that
- // for the current size, but if enabled for bigger sizes, the cases
- // of non-multiple of 8 seem to arise.
-// 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;
}
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 d523bf584d..e07e0cea2d 100644
--- a/libavcodec/aarch64/hevcdsp_sao_neon.S
+++ b/libavcodec/aarch64/hevcdsp_sao_neon.S
@@ -41,7 +41,11 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
and w10, w10, #0x1F
strh w9, [sp, x10, lsl #1]
bne 0b
+ add w6, w6, #7
+ bic w6, w6, #7
ld1 {v16.16b-v19.16b}, [sp], #64
+ sub x2, x2, x6
+ sub x3, x3, x6
movi v20.8h, #1
1: mov w8, w6 // beginning of line
2: // Simple layout for accessing 16bit values
@@ -52,7 +56,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 +65,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