From 25f23680b211b6dd27c006cb9575e816e8f80bb5 Mon Sep 17 00:00:00 2001 From: John Richardson Date: Mon, 27 Nov 2017 14:35:09 +0000 Subject: COMPMID-589: Port HOGDescriptor to new validation Change-Id: I2021612e61de1b82aaeb49249d06929c7fceb15f Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/115216 Reviewed-by: Pablo Tello Tested-by: Jenkins --- src/core/CL/cl_kernels/hog.cl | 4 ++-- src/core/HOGInfo.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/CL/cl_kernels/hog.cl b/src/core/CL/cl_kernels/hog.cl index 5d3a607c44..3d37fbcaf2 100644 --- a/src/core/CL/cl_kernels/hog.cl +++ b/src/core/CL/cl_kernels/hog.cl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017, 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -124,7 +124,7 @@ __kernel void hog_orientation_binning(IMAGE_DECLARATION(mag), for(; xc < CELL_WIDTH; xc++) { const float mag_value = *((__global short *)mag_row_ptr + xc); - const float phase_value = *(mag_row_ptr + xc) * (float)PHASE_SCALE + 0.5f; + const float phase_value = *(phase_row_ptr + xc) * (float)PHASE_SCALE + 0.5f; const float w1 = phase_value - floor(phase_value); // The quantised phase is the histogram index [0, NUM_BINS - 1] diff --git a/src/core/HOGInfo.cpp b/src/core/HOGInfo.cpp index 1b6175e68f..73f4c42041 100644 --- a/src/core/HOGInfo.cpp +++ b/src/core/HOGInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016, 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -66,10 +66,20 @@ void HOGInfo::init(const Size2D &cell_size, const Size2D &block_size, const Size Size2D HOGInfo::num_cells_per_block() const { + ARM_COMPUTE_ERROR_ON(_cell_size.width == 0 || _cell_size.height == 0); + return Size2D(_block_size.width / _cell_size.width, _block_size.height / _cell_size.height); } +Size2D HOGInfo::num_cells_per_block_stride() const +{ + ARM_COMPUTE_ERROR_ON(_cell_size.width == 0 || _cell_size.height == 0); + + return Size2D(_block_stride.width / _cell_size.width, + _block_stride.height / _cell_size.height); +} + Size2D HOGInfo::num_blocks_per_image(const Size2D &image_size) const { return Size2D(((image_size.width - _block_size.width) / _block_stride.width) + 1, -- cgit v1.2.1