diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2017-06-22 12:57:51 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | bbd9fb95daa08d6da67c567b40ca2cd032f7a2d3 (patch) | |
tree | c1401585f64396d6f22bb790442d8183f3a17a9e /arm_compute/core/FixedPoint.inl | |
parent | 2eac5bd444d16e4e81c427d5a99e1534b387e211 (diff) | |
download | ComputeLibrary-bbd9fb95daa08d6da67c567b40ca2cd032f7a2d3.tar.gz |
COMPMID-412: Port PoolingLayer to use fixed point 16.
Change-Id: I2005de4c7c14526996309826d33a0ec8e732d2d5
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/78720
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Steven Niu <steven.niu@arm.com>
Diffstat (limited to 'arm_compute/core/FixedPoint.inl')
-rw-r--r-- | arm_compute/core/FixedPoint.inl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arm_compute/core/FixedPoint.inl b/arm_compute/core/FixedPoint.inl index b921b32ed9..5ea0f6c825 100644 --- a/arm_compute/core/FixedPoint.inl +++ b/arm_compute/core/FixedPoint.inl @@ -21,6 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include "arm_compute/core/Error.h" + #include <cmath> #include <limits> @@ -59,6 +61,20 @@ inline qint16_t sqshl_qs16(qint16_t a, int shift) return saturate_convert<qint32_t, qint16_t>(tmp); } +inline qint8_t sshr_qs8(qint8_t a, int shift) +{ + ARM_COMPUTE_ERROR_ON_MSG(shift == 0, "Shift should not be zero"); + const qint8_t round_val = 1 << (shift - 1); + return sqadd_qs8(a, round_val) >> shift; +} + +inline qint16_t sshr_qs16(qint16_t a, int shift) +{ + ARM_COMPUTE_ERROR_ON_MSG(shift == 0, "Shift should not be zero"); + const qint16_t round_val = 1 << (shift - 1); + return sqadd_qs16(a, round_val) >> shift; +} + inline qint8_t sabs_qs8(qint8_t a) { return (a < 0) ? (a == std::numeric_limits<int8_t>::min()) ? std::numeric_limits<int8_t>::max() : -a : a; |