COMPMID-504: Move NonLinearFilter to new validation

Change-Id: Ie2e9c34dd541cf570b9aef29d94ac79e2360e0e9
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/87580
Reviewed-by: Moritz Pflanzer <moritz.pflanzer@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
diff --git a/tests/TypePrinter.h b/tests/TypePrinter.h
index f276f45..2f9909c 100644
--- a/tests/TypePrinter.h
+++ b/tests/TypePrinter.h
@@ -149,6 +149,13 @@
     return os;
 }
 
+inline std::string to_string(const NonLinearFilterFunction &function)
+{
+    std::stringstream str;
+    str << function;
+    return str.str();
+}
+
 /** Formatted output of the MatrixPattern type. */
 inline ::std::ostream &operator<<(::std::ostream &os, const MatrixPattern &pattern)
 {
@@ -173,6 +180,13 @@
     return os;
 }
 
+inline std::string to_string(const MatrixPattern &pattern)
+{
+    std::stringstream str;
+    str << pattern;
+    return str.str();
+}
+
 /** Formatted output of the InterpolationPolicy type. */
 inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
 {
diff --git a/tests/datasets/MatrixPatternDataset.h b/tests/datasets/MatrixPatternDataset.h
new file mode 100644
index 0000000..4c14149
--- /dev/null
+++ b/tests/datasets/MatrixPatternDataset.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef __ARM_COMPUTE_TEST_MATRIX_PATTERN_DATASET_H__
+#define __ARM_COMPUTE_TEST_MATRIX_PATTERN_DATASET_H__
+
+#include "arm_compute/core/Types.h"
+#include "tests/framework/datasets/ContainerDataset.h"
+
+#include <vector>
+
+namespace arm_compute
+{
+namespace test
+{
+namespace datasets
+{
+class MatrixPatterns final : public framework::dataset::ContainerDataset<std::vector<MatrixPattern>>
+{
+public:
+    MatrixPatterns()
+        : ContainerDataset("MatrixPattern",
+    {
+        MatrixPattern::BOX,
+                      MatrixPattern::CROSS,
+                      MatrixPattern::DISK
+    })
+    {
+    }
+};
+} // namespace datasets
+} // namespace test
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_TEST_MATRIX_PATTERN_DATASET_H__ */
diff --git a/tests/datasets/NonLinearFilterFunctionDataset.h b/tests/datasets/NonLinearFilterFunctionDataset.h
new file mode 100644
index 0000000..c2659f8
--- /dev/null
+++ b/tests/datasets/NonLinearFilterFunctionDataset.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef __ARM_COMPUTE_TEST_NON_LINEAR_FILTER_FUNCTION_DATASET_H__
+#define __ARM_COMPUTE_TEST_NON_LINEAR_FILTER_FUNCTION_DATASET_H__
+
+#include "arm_compute/core/Types.h"
+#include "tests/framework/datasets/ContainerDataset.h"
+
+#include <vector>
+
+namespace arm_compute
+{
+namespace test
+{
+namespace datasets
+{
+class NonLinearFilterFunctions final : public framework::dataset::ContainerDataset<std::vector<NonLinearFilterFunction>>
+{
+public:
+    NonLinearFilterFunctions()
+        : ContainerDataset("NonLinearFilterFunction",
+    {
+        NonLinearFilterFunction::MEDIAN,
+                                NonLinearFilterFunction::MIN,
+                                NonLinearFilterFunction::MAX
+    })
+    {
+    }
+};
+} // namespace datasets
+} // namespace test
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_TEST_NON_LINEAR_FILTER_FUNCTION_DATASET_H__ */
diff --git a/tests/validation/CL/NonLinearFilter.cpp b/tests/validation/CL/NonLinearFilter.cpp
new file mode 100644
index 0000000..ad26b8e
--- /dev/null
+++ b/tests/validation/CL/NonLinearFilter.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/runtime/CL/functions/CLNonLinearFilter.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/PaddingCalculator.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/MatrixPatternDataset.h"
+#include "tests/datasets/NonLinearFilterFunctionDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/NonLinearFilterFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+TEST_SUITE(CL)
+TEST_SUITE(NonLinearFilter)
+
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), datasets::NonLinearFilterFunctions()),
+                                                                                   framework::dataset::make("MaskSize", { 3U, 5U })),
+                                                                           datasets::MatrixPatterns()),
+                                                                   datasets::BorderModes()),
+               shape, function, mask_size, pattern, border_mode)
+{
+    std::mt19937                           generator(library->seed());
+    std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
+    const uint8_t                          constant_border_value = distribution_u8(generator);
+
+    // Create the mask
+    uint8_t mask[mask_size * mask_size];
+    fill_mask_from_pattern(mask, mask_size, mask_size, pattern);
+    const auto half_mask_size = static_cast<int>(mask_size / 2);
+
+    // Create tensors
+    CLTensor src = create_tensor<CLTensor>(shape, DataType::U8);
+    CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8);
+
+    ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+    ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+    // Create and configure function
+    CLNonLinearFilter filter;
+    filter.configure(&src, &dst, function, mask_size, pattern, mask, border_mode, constant_border_value);
+
+    // Validate valid region
+    const ValidRegion dst_valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(half_mask_size));
+    validate(dst.info()->valid_region(), dst_valid_region);
+
+    // Validate padding
+    PaddingCalculator calculator(shape.x(), ((MatrixPattern::OTHER == pattern) ? 1 : 8));
+    calculator.set_border_mode(border_mode);
+    calculator.set_border_size(half_mask_size);
+
+    const PaddingSize write_padding = calculator.required_padding(PaddingCalculator::Option::EXCLUDE_BORDER);
+
+    calculator.set_accessed_elements(16);
+    calculator.set_access_offset(-half_mask_size);
+
+    const PaddingSize read_padding = calculator.required_padding(PaddingCalculator::Option::INCLUDE_BORDER);
+
+    validate(src.info()->padding(), read_padding);
+    validate(dst.info()->padding(), write_padding);
+}
+
+template <typename T>
+using CLNonLinearFilterFixture = NonLinearFilterValidationFixture<CLTensor, CLAccessor, CLNonLinearFilter, T>;
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLNonLinearFilterFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallShapes(),
+                                                                                                                       datasets::NonLinearFilterFunctions()),
+                                                                                                                       framework::dataset::make("MaskSize", { 3U, 5U })),
+                                                                                                                       datasets::MatrixPatterns()),
+                                                                                                                       datasets::BorderModes()),
+                                                                                                               framework::dataset::make("DataType", DataType::U8)))
+{
+    // Validate output
+    validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), _border_size));
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLNonLinearFilterFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(),
+                                                                                                                     datasets::NonLinearFilterFunctions()),
+                                                                                                                     framework::dataset::make("MaskSize", { 3U, 5U })),
+                                                                                                                     datasets::MatrixPatterns()),
+                                                                                                                     datasets::BorderModes()),
+                                                                                                             framework::dataset::make("DataType", DataType::U8)))
+{
+    // Validate output
+    validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), _border_size));
+}
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CPP/NonLinearFilter.cpp b/tests/validation/CPP/NonLinearFilter.cpp
new file mode 100644
index 0000000..8669c9c
--- /dev/null
+++ b/tests/validation/CPP/NonLinearFilter.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal src the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included src all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. src NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER src AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * dst OF OR src CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "NonLinearFilter.h"
+#include "Utils.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+template <typename T>
+SimpleTensor<T> non_linear_filter(const SimpleTensor<T> &src, NonLinearFilterFunction function, unsigned int mask_size, MatrixPattern pattern, const uint8_t *mask, BorderMode border_mode,
+                                  uint8_t constant_border_value)
+{
+    SimpleTensor<T> dst(src.shape(), src.data_type());
+
+    ARM_COMPUTE_ERROR_ON(pattern == MatrixPattern::OTHER && mask == nullptr);
+    ARM_COMPUTE_UNUSED(pattern);
+
+    using intermediate_type = typename common_promoted_signed_type<T>::intermediate_type;
+
+    const int                      sq_mask_size   = mask_size * mask_size;
+    const int                      half_mask_size = mask_size / 2;
+    std::vector<intermediate_type> vals(sq_mask_size);
+    intermediate_type              current_value = 0;
+
+    const ValidRegion valid_region = shape_to_valid_region(src.shape(), border_mode == BorderMode::UNDEFINED, BorderSize(half_mask_size));
+
+    for(int element_idx = 0, count = 0, index = 0; element_idx < src.num_elements(); ++element_idx, count = 0, index = 0)
+    {
+        Coordinates id = index2coord(src.shape(), element_idx);
+        if(is_in_valid_region(valid_region, id))
+        {
+            int idx = id.x();
+            int idy = id.y();
+            for(int y = idy - half_mask_size; y <= idy + half_mask_size; ++y)
+            {
+                for(int x = idx - half_mask_size; x <= idx + half_mask_size; ++x, ++index)
+                {
+                    id.set(0, x);
+                    id.set(1, y);
+                    current_value = tensor_elem_at(src, id, border_mode, constant_border_value);
+
+                    if(mask[index] == 255)
+                    {
+                        vals[count] = static_cast<intermediate_type>(current_value);
+                        ++count;
+                    }
+                }
+            }
+            std::sort(vals.begin(), vals.begin() + count);
+
+            ARM_COMPUTE_ERROR_ON(count == 0);
+
+            switch(function)
+            {
+                case NonLinearFilterFunction::MIN:
+                    dst[element_idx] = saturate_cast<T>(vals[0]);
+                    break;
+                case NonLinearFilterFunction::MAX:
+                    dst[element_idx] = saturate_cast<T>(vals[count - 1]);
+                    break;
+                case NonLinearFilterFunction::MEDIAN:
+                    dst[element_idx] = saturate_cast<T>(vals[count / 2]);
+                    break;
+                default:
+                    ARM_COMPUTE_ERROR("Unsupported NonLinearFilter function.");
+            }
+        }
+    }
+
+    return dst;
+}
+
+template SimpleTensor<uint8_t> non_linear_filter(const SimpleTensor<uint8_t> &src, NonLinearFilterFunction function, unsigned int mask_size, MatrixPattern pattern, const uint8_t *mask,
+                                                 BorderMode border_mode, uint8_t constant_border_value);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CPP/NonLinearFilter.h b/tests/validation/CPP/NonLinearFilter.h
new file mode 100644
index 0000000..1df47c8
--- /dev/null
+++ b/tests/validation/CPP/NonLinearFilter.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef __ARM_COMPUTE_TEST_BITWISE_NOT_H__
+#define __ARM_COMPUTE_TEST_BITWISE_NOT_H__
+
+#include "tests/SimpleTensor.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+template <typename T>
+SimpleTensor<T> non_linear_filter(const SimpleTensor<T> &src, NonLinearFilterFunction function, unsigned int mask_size, MatrixPattern pattern, const uint8_t *mask, BorderMode border_mode,
+                                  uint8_t constant_border_value);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_TEST_BITWISE_NOT_H__ */
diff --git a/tests/validation/Helpers.h b/tests/validation/Helpers.h
index 3095916..5fdd57f 100644
--- a/tests/validation/Helpers.h
+++ b/tests/validation/Helpers.h
@@ -26,6 +26,7 @@
 
 #include "arm_compute/core/Types.h"
 #include "arm_compute/core/Utils.h"
+#include "tests/Globals.h"
 #include "tests/validation/half.h"
 
 #include <random>
@@ -129,6 +130,55 @@
     return bounds;
 }
 
+/** Fill mask with the corresponding given pattern.
+ *
+ * @param[in,out] mask    Mask to be filled according to pattern
+ * @param[in]     cols    Columns (width) of mask
+ * @param[in]     rows    Rows (height) of mask
+ * @param[in]     pattern Pattern to fill the mask according to
+ */
+inline void fill_mask_from_pattern(uint8_t *mask, int cols, int rows, MatrixPattern pattern)
+{
+    unsigned int                v = 0;
+    std::mt19937                gen(library->seed());
+    std::bernoulli_distribution dist(0.5);
+
+    for(int r = 0; r < rows; ++r)
+    {
+        for(int c = 0; c < cols; ++c, ++v)
+        {
+            uint8_t val = 0;
+
+            switch(pattern)
+            {
+                case MatrixPattern::BOX:
+                    val = 255;
+                    break;
+                case MatrixPattern::CROSS:
+                    val = ((r == (rows / 2)) || (c == (cols / 2))) ? 255 : 0;
+                    break;
+                case MatrixPattern::DISK:
+                    val = (((r - rows / 2.0f + 0.5f) * (r - rows / 2.0f + 0.5f)) / ((rows / 2.0f) * (rows / 2.0f)) + ((c - cols / 2.0f + 0.5f) * (c - cols / 2.0f + 0.5f)) / ((cols / 2.0f) *
+                            (cols / 2.0f))) <= 1.0f ? 255 : 0;
+                    break;
+                case MatrixPattern::OTHER:
+                    val = (dist(gen) ? 0 : 255);
+                    break;
+                default:
+                    return;
+            }
+
+            mask[v] = val;
+        }
+    }
+
+    if(pattern == MatrixPattern::OTHER)
+    {
+        std::uniform_int_distribution<uint8_t> distribution_u8(0, ((cols * rows) - 1));
+        mask[distribution_u8(gen)] = 255;
+    }
+}
+
 /** Calculate output tensor shape give a vector of input tensor to concatenate
  *
  * @param[in] input_shapes Shapes of the tensors to concatenate across depth.
diff --git a/tests/validation/NEON/NonLinearFilter.cpp b/tests/validation/NEON/NonLinearFilter.cpp
new file mode 100644
index 0000000..541e870
--- /dev/null
+++ b/tests/validation/NEON/NonLinearFilter.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/runtime/NEON/functions/NENonLinearFilter.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/PaddingCalculator.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/MatrixPatternDataset.h"
+#include "tests/datasets/NonLinearFilterFunctionDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/NonLinearFilterFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+TEST_SUITE(NEON)
+TEST_SUITE(NonLinearFilter)
+
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), datasets::NonLinearFilterFunctions()),
+                                                                                   framework::dataset::make("MaskSize", { 3U, 5U })),
+                                                                           datasets::MatrixPatterns()),
+                                                                   datasets::BorderModes()),
+               shape, function, mask_size, pattern, border_mode)
+{
+    std::mt19937                           generator(library->seed());
+    std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
+    const uint8_t                          constant_border_value = distribution_u8(generator);
+
+    // Create the mask
+    uint8_t mask[mask_size * mask_size];
+    fill_mask_from_pattern(mask, mask_size, mask_size, pattern);
+    const auto half_mask_size = static_cast<int>(mask_size / 2);
+
+    // Create tensors
+    Tensor src = create_tensor<Tensor>(shape, DataType::U8);
+    Tensor dst = create_tensor<Tensor>(shape, DataType::U8);
+
+    ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+    ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+    // Create and configure function
+    NENonLinearFilter filter;
+    filter.configure(&src, &dst, function, mask_size, pattern, mask, border_mode, constant_border_value);
+
+    // Validate valid region
+    const ValidRegion dst_valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(half_mask_size));
+    validate(dst.info()->valid_region(), dst_valid_region);
+
+    // Validate padding
+    PaddingCalculator calculator(shape.x(), ((MatrixPattern::OTHER == pattern) ? 1 : 8));
+    calculator.set_border_mode(border_mode);
+    calculator.set_border_size(half_mask_size);
+
+    const PaddingSize write_padding = calculator.required_padding(PaddingCalculator::Option::EXCLUDE_BORDER);
+
+    calculator.set_accessed_elements(16);
+    calculator.set_access_offset(-half_mask_size);
+
+    const PaddingSize read_padding = calculator.required_padding(PaddingCalculator::Option::INCLUDE_BORDER);
+
+    validate(src.info()->padding(), read_padding);
+    validate(dst.info()->padding(), write_padding);
+}
+
+template <typename T>
+using NENonLinearFilterFixture = NonLinearFilterValidationFixture<Tensor, Accessor, NENonLinearFilter, T>;
+
+FIXTURE_DATA_TEST_CASE(RunSmall, NENonLinearFilterFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallShapes(),
+                                                                                                                       datasets::NonLinearFilterFunctions()),
+                                                                                                                       framework::dataset::make("MaskSize", { 3U, 5U })),
+                                                                                                                       datasets::MatrixPatterns()),
+                                                                                                                       datasets::BorderModes()),
+                                                                                                               framework::dataset::make("DataType", DataType::U8)))
+{
+    // Validate output
+    validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), _border_size));
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NENonLinearFilterFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(),
+                                                                                                                     datasets::NonLinearFilterFunctions()),
+                                                                                                                     framework::dataset::make("MaskSize", { 3U, 5U })),
+                                                                                                                     datasets::MatrixPatterns()),
+                                                                                                                     datasets::BorderModes()),
+                                                                                                             framework::dataset::make("DataType", DataType::U8)))
+{
+    // Validate output
+    validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), _border_size));
+}
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/fixtures/NonLinearFilterFixture.h b/tests/validation/fixtures/NonLinearFilterFixture.h
new file mode 100644
index 0000000..2f22873
--- /dev/null
+++ b/tests/validation/fixtures/NonLinearFilterFixture.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_NONLINEAR_FILTER_FIXTURE
+#define ARM_COMPUTE_TEST_NONLINEAR_FILTER_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/Globals.h"
+#include "tests/IAccessor.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Fixture.h"
+#include "tests/validation/CPP/NonLinearFilter.h"
+#include "tests/validation/Helpers.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class NonLinearFilterValidationFixture : public framework::Fixture
+{
+public:
+    template <typename...>
+    void setup(TensorShape shape, NonLinearFilterFunction function, unsigned int mask_size, MatrixPattern pattern, BorderMode border_mode, DataType data_type)
+    {
+        std::mt19937                           generator(library->seed());
+        std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
+        const uint8_t                          constant_border_value = distribution_u8(generator);
+
+        // Create the mask
+        std::vector<uint8_t> mask(mask_size * mask_size);
+        fill_mask_from_pattern(mask.data(), mask_size, mask_size, pattern);
+
+        _border_size = BorderSize(static_cast<int>(mask_size / 2));
+        _target      = compute_target(shape, data_type, function, mask_size, pattern, mask.data(), border_mode, constant_border_value);
+        _reference   = compute_reference(shape, data_type, function, mask_size, pattern, mask.data(), border_mode, constant_border_value);
+    }
+
+protected:
+    template <typename U>
+    void fill(U &&tensor)
+    {
+        library->fill_tensor_uniform(tensor, 0);
+    }
+
+    TensorType compute_target(const TensorShape &shape, DataType data_type, NonLinearFilterFunction function, unsigned int mask_size, MatrixPattern pattern, const uint8_t *mask, BorderMode border_mode,
+                              uint8_t constant_border_value)
+    {
+        // Create tensors
+        TensorType src = create_tensor<TensorType>(shape, data_type);
+        TensorType dst = create_tensor<TensorType>(shape, data_type);
+
+        // Create and configure function
+        FunctionType non_linear_filter;
+        non_linear_filter.configure(&src, &dst, function, mask_size, pattern, mask, border_mode, constant_border_value);
+
+        ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+        ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+        // Allocate tensors
+        src.allocator()->allocate();
+        dst.allocator()->allocate();
+        ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
+        ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+        // Fill tensors
+        fill(AccessorType(src));
+
+        // Compute function
+        non_linear_filter.run();
+
+        return dst;
+    }
+
+    SimpleTensor<T> compute_reference(const TensorShape &shape, DataType data_type, NonLinearFilterFunction function, unsigned int mask_size, MatrixPattern pattern, const uint8_t *mask,
+                                      BorderMode border_mode, uint8_t constant_border_value)
+    {
+        // Create reference
+        SimpleTensor<T> src{ shape, data_type };
+
+        // Fill reference
+        fill(src);
+
+        return reference::non_linear_filter<T>(src, function, mask_size, pattern, mask, border_mode, constant_border_value);
+    }
+
+    BorderMode      _border_mode{};
+    BorderSize      _border_size{};
+    TensorType      _target{};
+    SimpleTensor<T> _reference{};
+};
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_NONLINEAR_FILTER_FIXTURE */
diff --git a/tests/validation_old/CL/NonLinearFilter.cpp b/tests/validation_old/CL/NonLinearFilter.cpp
deleted file mode 100644
index 0132f7d..0000000
--- a/tests/validation_old/CL/NonLinearFilter.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "CL/CLAccessor.h"
-#include "PaddingCalculator.h"
-#include "TypePrinter.h"
-#include "Utils.h"
-#include "tests/AssetsLibrary.h"
-#include "tests/Globals.h"
-#include "tests/validation_old/Datasets.h"
-#include "tests/validation_old/Helpers.h"
-#include "tests/validation_old/Reference.h"
-#include "tests/validation_old/Validation.h"
-#include "tests/validation_old/ValidationUserConfiguration.h"
-
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/functions/CLNonLinearFilter.h"
-#include "arm_compute/runtime/Tensor.h"
-#include "arm_compute/runtime/TensorAllocator.h"
-
-#include "tests/validation_old/boost_wrapper.h"
-
-#include <random>
-#include <string>
-
-using namespace arm_compute;
-using namespace arm_compute::test;
-using namespace arm_compute::test::validation;
-
-namespace
-{
-/** Compute NonLinearFilter function.
- *
-     * @param[in] input                 Shape of the input and output tensors.
-     * @param[in] function              Non linear function to perform
-     * @param[in] mask_size             Mask size. Supported sizes: 3, 5
-     * @param[in] pattern               Mask pattern
-     * @param[in] mask                  The given mask. Will be used only if pattern is specified to PATTERN_OTHER
-     * @param[in] border_mode           Strategy to use for borders.
-     * @param[in] constant_border_value (Optional) Constant value to use for borders if border_mode is set to CONSTANT.
- *
- * @return Computed output CL tensor.
- */
-CLTensor compute_non_linear_filter(const TensorShape &shape, NonLinearFilterFunction function, unsigned int mask_size,
-                                   MatrixPattern pattern, const uint8_t *mask, BorderMode border_mode,
-                                   uint8_t constant_border_value)
-{
-    // Create tensors
-    CLTensor src = create_tensor<CLTensor>(shape, DataType::U8);
-    CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8);
-
-    // Create and configure function
-    CLNonLinearFilter filter;
-    filter.configure(&src, &dst, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Allocate tensors
-    src.allocator()->allocate();
-    dst.allocator()->allocate();
-
-    BOOST_TEST(!src.info()->is_resizable());
-    BOOST_TEST(!dst.info()->is_resizable());
-
-    // Fill tensors
-    library->fill_tensor_uniform(CLAccessor(src), 0);
-
-    // Compute function
-    filter.run();
-
-    return dst;
-}
-} // namespace
-
-#ifndef DOXYGEN_SKIP_THIS
-BOOST_AUTO_TEST_SUITE(CL)
-BOOST_AUTO_TEST_SUITE(NonLinearFilter)
-
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes())
-                     * NonLinearFilterFunctions() * boost::unit_test::data::make({ 3U, 5U })
-                     * boost::unit_test::data::make({ MatrixPattern::BOX, MatrixPattern::CROSS, MatrixPattern::DISK }) * BorderModes(),
-                     shape, function, mask_size, pattern, border_mode)
-{
-    std::mt19937                           generator(user_config.seed.get());
-    std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
-    const uint8_t                          constant_border_value = distribution_u8(generator);
-
-    // Create the mask
-    uint8_t mask[mask_size * mask_size];
-    fill_mask_from_pattern(mask, mask_size, mask_size, pattern);
-    const auto half_mask_size = static_cast<int>(mask_size / 2);
-
-    // Create tensors
-    CLTensor src = create_tensor<CLTensor>(shape, DataType::U8);
-    CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8);
-
-    BOOST_TEST(src.info()->is_resizable());
-    BOOST_TEST(dst.info()->is_resizable());
-
-    // Create and configure function
-    CLNonLinearFilter filter;
-    filter.configure(&src, &dst, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Validate valid region
-    const ValidRegion src_valid_region = shape_to_valid_region(shape);
-    const ValidRegion dst_valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(half_mask_size));
-
-    validate(src.info()->valid_region(), src_valid_region);
-    validate(dst.info()->valid_region(), dst_valid_region);
-
-    // Validate padding
-    PaddingCalculator calculator(shape.x(), ((MatrixPattern::OTHER == pattern) ? 1 : 8));
-    calculator.set_border_mode(border_mode);
-    calculator.set_border_size(half_mask_size);
-
-    const PaddingSize write_padding = calculator.required_padding(PaddingCalculator::Option::EXCLUDE_BORDER);
-
-    calculator.set_accessed_elements(16);
-    calculator.set_access_offset(-half_mask_size);
-
-    const PaddingSize read_padding = calculator.required_padding(PaddingCalculator::Option::INCLUDE_BORDER);
-
-    validate(src.info()->padding(), read_padding);
-    validate(dst.info()->padding(), write_padding);
-}
-
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes()
-                     * NonLinearFilterFunctions() * boost::unit_test::data::make({ 3U, 5U })
-                     * boost::unit_test::data::make({ MatrixPattern::BOX, MatrixPattern::CROSS, MatrixPattern::DISK }) * BorderModes(),
-                     shape, function, mask_size, pattern, border_mode)
-{
-    std::mt19937                           generator(user_config.seed.get());
-    std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
-    const uint8_t                          constant_border_value = distribution_u8(generator);
-
-    // Create the mask
-    uint8_t mask[mask_size * mask_size];
-    fill_mask_from_pattern(mask, mask_size, mask_size, pattern);
-
-    // Compute function
-    CLTensor dst = compute_non_linear_filter(shape, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Compute reference
-    RawTensor ref_dst = Reference::compute_reference_non_linear_filter(shape, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Calculate valid region
-    const ValidRegion valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(static_cast<int>(mask_size / 2)));
-
-    // Validate output
-    validate(CLAccessor(dst), ref_dst, valid_region);
-}
-
-BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(RunLarge, LargeShapes()
-                     * NonLinearFilterFunctions() * boost::unit_test::data::make({ 3U, 5U })
-                     * boost::unit_test::data::make({ MatrixPattern::BOX, MatrixPattern::CROSS, MatrixPattern::DISK }) * BorderModes(),
-                     shape, function, mask_size, pattern, border_mode)
-{
-    std::mt19937                           generator(user_config.seed.get());
-    std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
-    const uint8_t                          constant_border_value = distribution_u8(generator);
-
-    // Create the mask
-    uint8_t mask[mask_size * mask_size];
-    fill_mask_from_pattern(mask, mask_size, mask_size, pattern);
-
-    // Compute function
-    CLTensor dst = compute_non_linear_filter(shape, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Compute reference
-    RawTensor ref_dst = Reference::compute_reference_non_linear_filter(shape, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Calculate valid region
-    const ValidRegion valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(static_cast<int>(mask_size / 2)));
-
-    // Validate output
-    validate(CLAccessor(dst), ref_dst, valid_region);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE_END()
-#endif /* DOXYGEN_SKIP_THIS */
diff --git a/tests/validation_old/NEON/NonLinearFilter.cpp b/tests/validation_old/NEON/NonLinearFilter.cpp
deleted file mode 100644
index acc90a4..0000000
--- a/tests/validation_old/NEON/NonLinearFilter.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "NEON/Accessor.h"
-#include "PaddingCalculator.h"
-#include "TypePrinter.h"
-#include "Utils.h"
-#include "tests/AssetsLibrary.h"
-#include "tests/Globals.h"
-#include "tests/validation_old/Datasets.h"
-#include "tests/validation_old/Helpers.h"
-#include "tests/validation_old/Reference.h"
-#include "tests/validation_old/Validation.h"
-#include "tests/validation_old/ValidationUserConfiguration.h"
-
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/NEON/functions/NENonLinearFilter.h"
-#include "arm_compute/runtime/Tensor.h"
-#include "arm_compute/runtime/TensorAllocator.h"
-
-#include "tests/validation_old/boost_wrapper.h"
-
-#include <random>
-#include <string>
-
-using namespace arm_compute;
-using namespace arm_compute::test;
-using namespace arm_compute::test::validation;
-
-namespace
-{
-/** Compute NonLinearFilter function.
- *
-     * @param[in] input                 Shape of the input and output tensors.
-     * @param[in] function              Non linear function to perform
-     * @param[in] mask_size             Mask size. Supported sizes: 3, 5
-     * @param[in] pattern               Mask pattern
-     * @param[in] mask                  The given mask. Will be used only if pattern is specified to PATTERN_OTHER
-     * @param[in] border_mode           Strategy to use for borders.
-     * @param[in] constant_border_value (Optional) Constant value to use for borders if border_mode is set to CONSTANT.
- *
- * @return Computed output tensor.
- */
-Tensor compute_non_linear_filter(const TensorShape &shape, NonLinearFilterFunction function, unsigned int mask_size,
-                                 MatrixPattern pattern, const uint8_t *mask, BorderMode border_mode,
-                                 uint8_t constant_border_value)
-{
-    // Create tensors
-    Tensor src = create_tensor<Tensor>(shape, DataType::U8);
-    Tensor dst = create_tensor<Tensor>(shape, DataType::U8);
-
-    // Create and configure function
-    NENonLinearFilter filter;
-    filter.configure(&src, &dst, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Allocate tensors
-    src.allocator()->allocate();
-    dst.allocator()->allocate();
-
-    BOOST_TEST(!src.info()->is_resizable());
-    BOOST_TEST(!dst.info()->is_resizable());
-
-    // Fill tensors
-    library->fill_tensor_uniform(Accessor(src), 0);
-
-    // Compute function
-    filter.run();
-
-    return dst;
-}
-} // namespace
-
-#ifndef DOXYGEN_SKIP_THIS
-BOOST_AUTO_TEST_SUITE(NEON)
-BOOST_AUTO_TEST_SUITE(NonLinearFilter)
-
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes())
-                     * NonLinearFilterFunctions() * boost::unit_test::data::make({ 3U, 5U })
-                     * MatrixPatterns() * BorderModes(),
-                     shape, function, mask_size, pattern, border_mode)
-{
-    std::mt19937                           generator(user_config.seed.get());
-    std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
-    const uint8_t                          constant_border_value = distribution_u8(generator);
-
-    // Create the mask
-    uint8_t mask[mask_size * mask_size];
-    fill_mask_from_pattern(mask, mask_size, mask_size, pattern);
-    const auto half_mask_size = static_cast<int>(mask_size / 2);
-
-    // Create tensors
-    Tensor src = create_tensor<Tensor>(shape, DataType::U8);
-    Tensor dst = create_tensor<Tensor>(shape, DataType::U8);
-
-    BOOST_TEST(src.info()->is_resizable());
-    BOOST_TEST(dst.info()->is_resizable());
-
-    // Create and configure function
-    NENonLinearFilter filter;
-    filter.configure(&src, &dst, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Validate valid region
-    const ValidRegion src_valid_region = shape_to_valid_region(shape);
-    const ValidRegion dst_valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(half_mask_size));
-
-    validate(src.info()->valid_region(), src_valid_region);
-    validate(dst.info()->valid_region(), dst_valid_region);
-
-    // Validate padding
-    PaddingCalculator calculator(shape.x(), ((MatrixPattern::OTHER == pattern) ? 1 : 8));
-    calculator.set_border_mode(border_mode);
-    calculator.set_border_size(half_mask_size);
-
-    const PaddingSize write_padding = calculator.required_padding(PaddingCalculator::Option::EXCLUDE_BORDER);
-
-    calculator.set_accessed_elements(16);
-    calculator.set_access_offset(-half_mask_size);
-
-    const PaddingSize read_padding = calculator.required_padding(PaddingCalculator::Option::INCLUDE_BORDER);
-
-    validate(src.info()->padding(), read_padding);
-    validate(dst.info()->padding(), write_padding);
-}
-
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes()
-                     * NonLinearFilterFunctions() * boost::unit_test::data::make({ 3U, 5U })
-                     * MatrixPatterns() * BorderModes(),
-                     shape, function, mask_size, pattern, border_mode)
-{
-    std::mt19937                           generator(user_config.seed.get());
-    std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
-    const uint8_t                          constant_border_value = distribution_u8(generator);
-
-    // Create the mask
-    uint8_t mask[mask_size * mask_size];
-    fill_mask_from_pattern(mask, mask_size, mask_size, pattern);
-
-    // Compute function
-    Tensor dst = compute_non_linear_filter(shape, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Compute reference
-    RawTensor ref_dst = Reference::compute_reference_non_linear_filter(shape, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Calculate valid region
-    const ValidRegion valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(static_cast<int>(mask_size / 2)));
-
-    // Validate output
-    validate(Accessor(dst), ref_dst, valid_region);
-}
-
-BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(RunLarge, LargeShapes()
-                     * NonLinearFilterFunctions() * boost::unit_test::data::make({ 3U, 5U })
-                     * MatrixPatterns() * BorderModes(),
-                     shape, function, mask_size, pattern, border_mode)
-{
-    std::mt19937                           generator(user_config.seed.get());
-    std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
-    const uint8_t                          constant_border_value = distribution_u8(generator);
-
-    // Create the mask
-    uint8_t mask[mask_size * mask_size];
-    fill_mask_from_pattern(mask, mask_size, mask_size, pattern);
-
-    // Compute function
-    Tensor dst = compute_non_linear_filter(shape, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Compute reference
-    RawTensor ref_dst = Reference::compute_reference_non_linear_filter(shape, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    // Calculate valid region
-    const ValidRegion valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(static_cast<int>(mask_size / 2)));
-
-    // Validate output
-    validate(Accessor(dst), ref_dst, valid_region);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE_END()
-#endif /* DOXYGEN_SKIP_THIS */
diff --git a/tests/validation_old/Reference.cpp b/tests/validation_old/Reference.cpp
index 3a45cbb..b8564db 100644
--- a/tests/validation_old/Reference.cpp
+++ b/tests/validation_old/Reference.cpp
@@ -217,22 +217,6 @@
     return ref_dst;
 }
 
-RawTensor Reference::compute_reference_non_linear_filter(const TensorShape &shape, NonLinearFilterFunction function, unsigned int mask_size,
-                                                         MatrixPattern pattern, const uint8_t *mask, BorderMode border_mode, uint8_t constant_border_value)
-{
-    // Create reference
-    RawTensor ref_src(shape, DataType::U8);
-    RawTensor ref_dst(shape, DataType::U8);
-
-    // Fill reference
-    library->fill_tensor_uniform(ref_src, 0);
-
-    // Compute reference
-    ReferenceCPP::non_linear_filter(ref_src, ref_dst, function, mask_size, pattern, mask, border_mode, constant_border_value);
-
-    return ref_dst;
-}
-
 RawTensor Reference::compute_reference_pixel_wise_multiplication(const TensorShape &shape, DataType dt_in0, DataType dt_in1, DataType dt_out, float scale, ConvertPolicy convert_policy,
                                                                  RoundingPolicy rounding_policy)
 {
diff --git a/tests/validation_old/Reference.h b/tests/validation_old/Reference.h
index f8e726c..b3f35ce 100644
--- a/tests/validation_old/Reference.h
+++ b/tests/validation_old/Reference.h
@@ -148,20 +148,6 @@
      * @return Computed raw tensor.
      */
     static RawTensor compute_reference_gaussian5x5(const TensorShape &shape, BorderMode border_mode, uint8_t constant_border_value);
-    /** Compute reference non linear filter function
-     *
-     * @param[in] shape                 Shape of the input and output tensors.Data type supported: U8
-     * @param[in] function              Non linear function to perform
-     * @param[in] mask_size             Mask size. Supported sizes: 3, 5
-     * @param[in] pattern               Matrix pattern
-     * @param[in] mask                  The given mask. Will be used only if pattern is specified to PATTERN_OTHER
-     * @param[in] border_mode           Strategy to use for borders.
-     * @param[in] constant_border_value (Optional) Constant value to use for borders if border_mode is set to CONSTANT.
-     *
-     * @return Computed raw tensor.
-    */
-    static RawTensor compute_reference_non_linear_filter(const TensorShape &shape, NonLinearFilterFunction function, unsigned int mask_size,
-                                                         MatrixPattern pattern, const uint8_t *mask, BorderMode border_mode, uint8_t constant_border_value = 0);
     /** Compute reference pixel-wise multiplication
      *
      * @param[in] shape           Shape of the input and output tensors.
diff --git a/tests/validation_old/dataset/MatrixPatternDataset.h b/tests/validation_old/dataset/MatrixPatternDataset.h
index 7d7d365..5100ae0 100644
--- a/tests/validation_old/dataset/MatrixPatternDataset.h
+++ b/tests/validation_old/dataset/MatrixPatternDataset.h
@@ -21,8 +21,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#ifndef __ARM_COMPUTE_TEST_MATRIX_PATTERN_DATASET_H__
-#define __ARM_COMPUTE_TEST_MATRIX_PATTERN_DATASET_H__
+#ifndef __ARM_COMPUTE_DATASETS_TEST_MATRIX_PATTERN_DATASET_H__
+#define __ARM_COMPUTE_DATASETS_TEST_MATRIX_PATTERN_DATASET_H__
 
 #include "arm_compute/core/Types.h"
 
@@ -79,4 +79,4 @@
 };
 } // namespace test
 } // namespace arm_compute
-#endif /* __ARM_COMPUTE_TEST_MATRIX_PATTERN_DATASET_H__ */
+#endif /* __ARM_COMPUTE_DATASETS_TEST_MATRIX_PATTERN_DATASET_H__ */
diff --git a/tests/validation_old/dataset/NonLinearFilterFunctionDataset.h b/tests/validation_old/dataset/NonLinearFilterFunctionDataset.h
index c961c84..5beeb14 100644
--- a/tests/validation_old/dataset/NonLinearFilterFunctionDataset.h
+++ b/tests/validation_old/dataset/NonLinearFilterFunctionDataset.h
@@ -21,8 +21,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#ifndef __ARM_COMPUTE_TEST_NON_LINEAR_FILTER_FUNCTION_DATASET_H__
-#define __ARM_COMPUTE_TEST_NON_LINEAR_FILTER_FUNCTION_DATASET_H__
+#ifndef __ARM_COMPUTE_DATASETS_TEST_NON_LINEAR_FILTER_FUNCTION_DATASET_H__
+#define __ARM_COMPUTE_DATASETS_TEST_NON_LINEAR_FILTER_FUNCTION_DATASET_H__
 
 #include "arm_compute/core/Types.h"
 
@@ -79,4 +79,4 @@
 };
 } // namespace test
 } // namespace arm_compute
-#endif /* __ARM_COMPUTE_TEST_NON_LINEAR_FILTER_FUNCTION_DATASET_H__ */
+#endif /* __ARM_COMPUTE_DATASETS_TEST_NON_LINEAR_FILTER_FUNCTION_DATASET_H__ */