@@ -16,13 +16,13 @@ namespace Kernels{
1616
1717
1818template <typename PixelTester>
19- class ToBlackWhite_Rgb32_ARM64_NEON {
19+ class FilterImage_Rgb32_ARM64_NEON {
2020public:
2121 static const size_t VECTOR_SIZE = 4 ;
2222 using Mask = size_t ;
2323
2424public:
25- ToBlackWhite_Rgb32_ARM64_NEON (
25+ FilterImage_Rgb32_ARM64_NEON (
2626 const PixelTester& tester,
2727 uint32_t replacement_color, bool replace_color_within_range
2828 )
@@ -45,7 +45,8 @@ class ToBlackWhite_Rgb32_ARM64_NEON{
4545 // The resulting pixels are saved in out[4]
4646 PA_FORCE_INLINE void process_full (uint32_t out[4 ], const uint32_t in[4 ], const uint32x4_t * cmp_mask_u32 = nullptr ){
4747 uint32x4_t pixel = vld1q_u32 (in);
48- uint32x4_t cmp_u32 = process_word (pixel);
48+ // If a pixel is within [mins, maxs], its uint32_t in `cmp_u32` is all 1 bits, otherwise, all 0 bits
49+ uint32x4_t cmp_u32 = m_tester.test_word (pixel);
4950 if (cmp_mask_u32) {
5051 cmp_u32 = vandq_u32 (cmp_u32, *cmp_mask_u32);
5152 }
@@ -111,9 +112,10 @@ class ToBlackWhite_Rgb32_ARM64_NEON{
111112 // If a per-pixel mask, cmp_mask_u32 is not nullptr, it only counts the pixels covered by the mask.
112113 // It also changes pixels into black or white depending on whether they are in range.
113114 // The resulting pixels are saved in out[4]
114- PA_FORCE_INLINE void process_full (uint32_t * out, const uint32_t * in){
115+ PA_FORCE_INLINE void process_full (uint32_t * out, const uint32_t * in, const uint32x4_t * cmp_mask_u32 = nullptr ){
115116 uint32x4_t pixel = vld1q_u32 (in);
116- uint32x4_t cmp_u32 = process_word (pixel);
117+ // If a pixel is within [mins, maxs], its uint32_t in `cmp_u32` is all 1 bits, otherwise, all 0 bits
118+ uint32x4_t cmp_u32 = m_tester.test_word (pixel);
117119 if (cmp_mask_u32) {
118120 cmp_u32 = vandq_u32 (cmp_u32, *cmp_mask_u32);
119121 }
0 commit comments