mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
audioconvert: use SPA_CLAMPF to clamp floats
It generates better assembler.
This commit is contained in:
parent
fd46ef16ed
commit
5a8af97a40
2 changed files with 7 additions and 1 deletions
|
|
@ -147,6 +147,12 @@ struct spa_fraction {
|
||||||
SPA_MIN(SPA_MAX(_v, _low), _high); \
|
SPA_MIN(SPA_MAX(_v, _low), _high); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#define SPA_CLAMPF(v,low,high) \
|
||||||
|
({ \
|
||||||
|
fminf(fmaxf(v, low), high); \
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
#define SPA_SWAP(a,b) \
|
#define SPA_SWAP(a,b) \
|
||||||
({ \
|
({ \
|
||||||
__typeof__(a) _t = (a); \
|
__typeof__(a) _t = (a); \
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
#define ITOF(type,v,scale,offs) \
|
#define ITOF(type,v,scale,offs) \
|
||||||
(((type)(v)) * (1.0f / (scale)) - (offs))
|
(((type)(v)) * (1.0f / (scale)) - (offs))
|
||||||
#define FTOI(type,v,scale,offs,noise,min,max) \
|
#define FTOI(type,v,scale,offs,noise,min,max) \
|
||||||
(type)f32_round(SPA_CLAMP((v) * (scale) + (offs) + (noise), min, max))
|
(type)f32_round(SPA_CLAMPF((v) * (scale) + (offs) + (noise), min, max))
|
||||||
|
|
||||||
#define FMT_OPS_MAX_ALIGN 32
|
#define FMT_OPS_MAX_ALIGN 32
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue