Fix SIGBUS in av1_estimate_noise_from_single_plane_neon
Use the dedicated helper for unaligned loads and re-enable the function
for 32-bit Arm.
Bug: aomedia:349450845
Change-Id: If23b136629007a7f4a2065d713d8c5348a389d35
diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl
index 5515430..284f0ef 100644
--- a/av1/common/av1_rtcd_defs.pl
+++ b/av1/common/av1_rtcd_defs.pl
@@ -386,12 +386,7 @@
specialize qw/av1_apply_temporal_filter sse2 avx2 neon neon_dotprod/;
add_proto qw/double av1_estimate_noise_from_single_plane/, "const uint8_t *src, int height, int width, int stride, int edge_thresh";
- # TODO(aomedia:349450845): enable NEON for armv7 after SIGBUS is fixed.
- if (aom_config("AOM_ARCH_ARM") eq "yes" && aom_config("AOM_ARCH_AARCH64") eq "") {
- specialize qw/av1_estimate_noise_from_single_plane avx2/;
- } else {
- specialize qw/av1_estimate_noise_from_single_plane avx2 neon/;
- }
+ specialize qw/av1_estimate_noise_from_single_plane avx2 neon/;
if (aom_config("CONFIG_AV1_HIGHBITDEPTH") eq "yes") {
add_proto qw/void av1_highbd_apply_temporal_filter/, "const struct yv12_buffer_config *frame_to_filter, const struct macroblockd *mbd, const BLOCK_SIZE block_size, const int mb_row, const int mb_col, const int num_planes, const double *noise_levels, const MV *subblock_mvs, const int *subblock_mses, const int q_factor, const int filter_strength, int tf_wgt_calc_lvl, const uint8_t *pred, uint32_t *accum, uint16_t *count";
specialize qw/av1_highbd_apply_temporal_filter sse2 avx2 neon/;
diff --git a/av1/encoder/arm/temporal_filter_neon.c b/av1/encoder/arm/temporal_filter_neon.c
index dffa368..08746b5 100644
--- a/av1/encoder/arm/temporal_filter_neon.c
+++ b/av1/encoder/arm/temporal_filter_neon.c
@@ -283,8 +283,6 @@
}
}
-// TODO(aomedia:349450845): enable for armv7 after SIGBUS is fixed.
-#if AOM_ARCH_AARCH64
double av1_estimate_noise_from_single_plane_neon(const uint8_t *src, int height,
int width, int stride,
int edge_thresh) {
@@ -458,15 +456,15 @@
if (w <= (width - 1) - 4) {
uint16x8_t mask = vcombine_u16(vdup_n_u16(65535), vdup_n_u16(0));
uint8x8_t mat[3][3];
- mat[0][0] = load_u8_4x1(src_ptr - stride - 1);
- mat[0][1] = load_u8_4x1(src_ptr - stride);
- mat[0][2] = load_u8_4x1(src_ptr - stride + 1);
- mat[1][0] = load_u8_4x1(src_ptr - 1);
- mat[1][1] = load_u8_4x1(src_ptr);
- mat[1][2] = load_u8_4x1(src_ptr + 1);
- mat[2][0] = load_u8_4x1(src_ptr + stride - 1);
- mat[2][1] = load_u8_4x1(src_ptr + stride);
- mat[2][2] = load_u8_4x1(src_ptr + stride + 1);
+ mat[0][0] = load_unaligned_u8_4x1(src_ptr - stride - 1);
+ mat[0][1] = load_unaligned_u8_4x1(src_ptr - stride);
+ mat[0][2] = load_unaligned_u8_4x1(src_ptr - stride + 1);
+ mat[1][0] = load_unaligned_u8_4x1(src_ptr - 1);
+ mat[1][1] = load_unaligned_u8_4x1(src_ptr);
+ mat[1][2] = load_unaligned_u8_4x1(src_ptr + 1);
+ mat[2][0] = load_unaligned_u8_4x1(src_ptr + stride - 1);
+ mat[2][1] = load_unaligned_u8_4x1(src_ptr + stride);
+ mat[2][2] = load_unaligned_u8_4x1(src_ptr + stride + 1);
// Compute Sobel gradients.
uint16x8_t gxa = vaddl_u8(mat[0][0], mat[2][0]);
@@ -548,4 +546,3 @@
? -1.0
: (double)final_acc / (6 * final_count) * SQRT_PI_BY_2;
}
-#endif // AOM_ARCH_AARCH64
diff --git a/test/temporal_filter_test.cc b/test/temporal_filter_test.cc
index be11e2c..52e2366 100644
--- a/test/temporal_filter_test.cc
+++ b/test/temporal_filter_test.cc
@@ -413,15 +413,12 @@
#endif // HAVE_AVX2
#if HAVE_NEON
-// TODO(aomedia:349450845): enable for armv7 after SIGBUS is fixed.
-#if AOM_ARCH_AARCH64
INSTANTIATE_TEST_SUITE_P(
NEON, EstimateNoiseTest,
::testing::Combine(
::testing::Values(av1_estimate_noise_from_single_plane_c),
::testing::Values(av1_estimate_noise_from_single_plane_neon),
::testing::ValuesIn(kWidths), ::testing::ValuesIn(kHeights)));
-#endif // AOM_ARCH_AARCH64
#endif // HAVE_NEON
#if CONFIG_AV1_HIGHBITDEPTH