mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-02-04 14:30:55 +08:00
lavc/audiodsp: drop opposite sign optimisation
This was added along side the original SSE(one) DSP function in
0a68cd876e without rationale. This was
presumably faster on x87, which is no longer relevant since we pretty
much assume SSE2 or later on x86.
Meanwhile this function is ~2.5x slower than the normal floating point
one on SiFive-U74.
This commit is contained in:
@@ -22,44 +22,9 @@
|
||||
#include "libavutil/common.h"
|
||||
#include "audiodsp.h"
|
||||
|
||||
static inline float clipf_c_one(float a, uint32_t mini,
|
||||
uint32_t maxi, uint32_t maxisign)
|
||||
{
|
||||
uint32_t ai = av_float2int(a);
|
||||
|
||||
if (ai > mini)
|
||||
return av_int2float(mini);
|
||||
else if ((ai ^ (1U << 31)) > maxisign)
|
||||
return av_int2float(maxi);
|
||||
else
|
||||
return a;
|
||||
}
|
||||
|
||||
static void vector_clipf_c_opposite_sign(float *dst, const float *src,
|
||||
float min, float max, int len)
|
||||
{
|
||||
uint32_t mini = av_float2int(min);
|
||||
uint32_t maxi = av_float2int(max);
|
||||
uint32_t maxisign = maxi ^ (1U << 31);
|
||||
|
||||
for (int i = 0; i < len; i += 8) {
|
||||
float tmp[8];
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
tmp[j]= clipf_c_one(src[i + j], mini, maxi, maxisign);
|
||||
for (int j = 0; j < 8; j++)
|
||||
dst[i + j] = tmp[j];
|
||||
}
|
||||
}
|
||||
|
||||
static void vector_clipf_c(float *dst, const float *src, int len,
|
||||
float min, float max)
|
||||
{
|
||||
if (min < 0 && max > 0) {
|
||||
vector_clipf_c_opposite_sign(dst, src, min, max, len);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i += 8) {
|
||||
float tmp[8];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user