Arm: Speed up FLOAT2INT16 conversion with Neon

Using Neon for float to int conversion, and introducing platform-
specific function for converting an array of float values to int16.
Also adding appropriate unit test.

Signed-off-by: Jean-Marc Valin <jeanmarcv@google.com>
This commit is contained in:
Sandor Zsombor Vegh 2024-09-11 14:00:32 +02:00 committed by Jean-Marc Valin
parent edffe56b30
commit d4494e6ed7
No known key found for this signature in database
GPG key ID: 8D2952BBB52C646D
9 changed files with 277 additions and 4 deletions

View file

@ -1,6 +1,7 @@
/* Copyright (c) 2002-2008 Jean-Marc Valin
Copyright (c) 2007-2008 CSIRO
Copyright (c) 2007-2009 Xiph.Org Foundation
Copyright (c) 2024 Arm Limited
Written by Jean-Marc Valin */
/**
@file mathops.h
@ -35,6 +36,7 @@
#include "config.h"
#endif
#include "float_cast.h"
#include "mathops.h"
/*Compute floor(sqrt(_val)) with exact arithmetic.
@ -215,3 +217,16 @@ opus_val32 celt_rcp(opus_val32 x)
}
#endif
#ifndef DISABLE_FLOAT_API
void celt_float2int16_c(const float * OPUS_RESTRICT in, short * OPUS_RESTRICT out, int cnt)
{
int i;
for (i = 0; i < cnt; i++)
{
out[i] = FLOAT2INT16(in[i]);
}
}
#endif /* DISABLE_FLOAT_API */