From 6203153b25fda2c4b8d94fe71337d1145a36c132 Mon Sep 17 00:00:00 2001 From: Isabella Gottardi Date: Tue, 4 Jul 2017 11:21:28 +0100 Subject: COMPMID-424 Implemented reference implementation and validation tests (NEON and CL) for Warp Perspective Changed the behaviour in NEWarpKernel for border mode replicate and constant to stick with the VX specs. When the new coords are out of the valid region, the output will be computed using the values from the border. In the validation tests the validate will be called with tolerance_value 1 and tolerance_number 0.2%, due to some float arithmetic related mismatches. Change-Id: Id4f9d0ef87178f8f8fd38ee17fee0e6f4beb85cd Reviewed-on: http://mpd-gerrit.cambridge.arm.com/80283 Tested-by: Kaizen Reviewed-by: Moritz Pflanzer Reviewed-by: Steven Niu --- tests/validation/ReferenceCPP.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/validation/ReferenceCPP.cpp') diff --git a/tests/validation/ReferenceCPP.cpp b/tests/validation/ReferenceCPP.cpp index 69100ad9bb..069cc1d871 100644 --- a/tests/validation/ReferenceCPP.cpp +++ b/tests/validation/ReferenceCPP.cpp @@ -252,6 +252,16 @@ void ReferenceCPP::threshold(const RawTensor &src, RawTensor &dst, uint8_t thres tensor_operations::threshold(s, d, threshold, false_value, true_value, type, upper); } +// Warp perspective +void ReferenceCPP::warp_perspective(const RawTensor &src, RawTensor &dst, RawTensor &valid_mask, const float *matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value) +{ + ARM_COMPUTE_ERROR_ON(src.data_type() != DataType::U8 || dst.data_type() != DataType::U8); + const Tensor s(src.shape(), src.data_type(), src.fixed_point_position(), reinterpret_cast(src.data())); + Tensor d(dst.shape(), dst.data_type(), dst.fixed_point_position(), reinterpret_cast(dst.data())); + Tensor vmask(valid_mask.shape(), valid_mask.data_type(), valid_mask.fixed_point_position(), reinterpret_cast(valid_mask.data())); + tensor_operations::warp_perspective(s, d, vmask, matrix, policy, border_mode, constant_border_value); +} + // Batch Normalization Layer void ReferenceCPP::batch_normalization_layer(const RawTensor &src, RawTensor &dst, const RawTensor &mean, const RawTensor &var, const RawTensor &beta, const RawTensor &gamma, float epsilon, int fixed_point_position) -- cgit v1.2.1