mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
volume: remove ref functions
This commit is contained in:
parent
f24c24c14b
commit
591baacba5
2 changed files with 0 additions and 446 deletions
|
|
@ -35,71 +35,6 @@
|
||||||
#include "sample-util.h"
|
#include "sample-util.h"
|
||||||
#include "endianmacros.h"
|
#include "endianmacros.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
pa_volume_u8_mmx (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int32_t t, hi, lo;
|
|
||||||
|
|
||||||
hi = volumes[channel] >> 16;
|
|
||||||
lo = volumes[channel] & 0xFFFF;
|
|
||||||
|
|
||||||
t = (int32_t) *samples - 0x80;
|
|
||||||
t = ((t * lo) >> 16) + (t * hi);
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80, 0x7F);
|
|
||||||
*samples++ = (uint8_t) (t + 0x80);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_alaw_mmx (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int32_t t, hi, lo;
|
|
||||||
|
|
||||||
hi = volumes[channel] >> 16;
|
|
||||||
lo = volumes[channel] & 0xFFFF;
|
|
||||||
|
|
||||||
t = (int32_t) st_alaw2linear16(*samples);
|
|
||||||
t = ((t * lo) >> 16) + (t * hi);
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x8000, 0x7FFF);
|
|
||||||
*samples++ = (uint8_t) st_13linear2alaw((int16_t) t >> 3);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_ulaw_mmx (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int32_t t, hi, lo;
|
|
||||||
|
|
||||||
hi = volumes[channel] >> 16;
|
|
||||||
lo = volumes[channel] & 0xFFFF;
|
|
||||||
|
|
||||||
t = (int32_t) st_ulaw2linear16(*samples);
|
|
||||||
t = ((t * lo) >> 16) + (t * hi);
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x8000, 0x7FFF);
|
|
||||||
*samples++ = (uint8_t) st_14linear2ulaw((int16_t) t >> 2);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* in s: 2 int16_t samples
|
/* in s: 2 int16_t samples
|
||||||
* in v: 2 int32_t volumes, fixed point 16:16
|
* in v: 2 int32_t volumes, fixed point 16:16
|
||||||
* out s: contains scaled and clamped int16_t samples.
|
* out s: contains scaled and clamped int16_t samples.
|
||||||
|
|
@ -304,164 +239,6 @@ pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
pa_volume_float32ne_mmx (float *samples, float *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (float);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
*samples++ *= volumes[channel];
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_float32re_mmx (float *samples, float *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (float);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
float t;
|
|
||||||
|
|
||||||
t = PA_FLOAT32_SWAP(*samples);
|
|
||||||
t *= volumes[channel];
|
|
||||||
*samples++ = PA_FLOAT32_SWAP(t);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s32ne_mmx (int32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (int32_t);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t)(*samples);
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
*samples++ = (int32_t) t;
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s32re_mmx (int32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (int32_t);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t) PA_INT32_SWAP(*samples);
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
*samples++ = PA_INT32_SWAP((int32_t) t);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s24ne_mmx (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
uint8_t *e;
|
|
||||||
|
|
||||||
e = samples + length;
|
|
||||||
|
|
||||||
for (channel = 0; samples < e; samples += 3) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t)((int32_t) (PA_READ24NE(samples) << 8));
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
PA_WRITE24NE(samples, ((uint32_t) (int32_t) t) >> 8);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s24re_mmx (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
uint8_t *e;
|
|
||||||
|
|
||||||
e = samples + length;
|
|
||||||
|
|
||||||
for (channel = 0; samples < e; samples += 3) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t)((int32_t) (PA_READ24RE(samples) << 8));
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
PA_WRITE24RE(samples, ((uint32_t) (int32_t) t) >> 8);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s24_32ne_mmx (uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (uint32_t);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t) ((int32_t) (*samples << 8));
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
*samples++ = ((uint32_t) ((int32_t) t)) >> 8;
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s24_32re_mmx (uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (uint32_t);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t) ((int32_t) (PA_UINT32_SWAP(*samples) << 8));
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
*samples++ = PA_UINT32_SWAP(((uint32_t) ((int32_t) t)) >> 8);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef RUN_TEST
|
#undef RUN_TEST
|
||||||
|
|
||||||
#ifdef RUN_TEST
|
#ifdef RUN_TEST
|
||||||
|
|
|
||||||
|
|
@ -35,71 +35,6 @@
|
||||||
#include "sample-util.h"
|
#include "sample-util.h"
|
||||||
#include "endianmacros.h"
|
#include "endianmacros.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
pa_volume_u8_sse (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int32_t t, hi, lo;
|
|
||||||
|
|
||||||
hi = volumes[channel] >> 16;
|
|
||||||
lo = volumes[channel] & 0xFFFF;
|
|
||||||
|
|
||||||
t = (int32_t) *samples - 0x80;
|
|
||||||
t = ((t * lo) >> 16) + (t * hi);
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80, 0x7F);
|
|
||||||
*samples++ = (uint8_t) (t + 0x80);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_alaw_sse (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int32_t t, hi, lo;
|
|
||||||
|
|
||||||
hi = volumes[channel] >> 16;
|
|
||||||
lo = volumes[channel] & 0xFFFF;
|
|
||||||
|
|
||||||
t = (int32_t) st_alaw2linear16(*samples);
|
|
||||||
t = ((t * lo) >> 16) + (t * hi);
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x8000, 0x7FFF);
|
|
||||||
*samples++ = (uint8_t) st_13linear2alaw((int16_t) t >> 3);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_ulaw_sse (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int32_t t, hi, lo;
|
|
||||||
|
|
||||||
hi = volumes[channel] >> 16;
|
|
||||||
lo = volumes[channel] & 0xFFFF;
|
|
||||||
|
|
||||||
t = (int32_t) st_ulaw2linear16(*samples);
|
|
||||||
t = ((t * lo) >> 16) + (t * hi);
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x8000, 0x7FFF);
|
|
||||||
*samples++ = (uint8_t) st_14linear2ulaw((int16_t) t >> 2);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define VOLUME_32x16(s,v) /* .. | vh | vl | */ \
|
#define VOLUME_32x16(s,v) /* .. | vh | vl | */ \
|
||||||
" pxor %%xmm4, %%xmm4 \n\t" /* .. | 0 | 0 | */ \
|
" pxor %%xmm4, %%xmm4 \n\t" /* .. | 0 | 0 | */ \
|
||||||
" punpcklwd %%xmm4, "#s" \n\t" /* .. | 0 | p0 | */ \
|
" punpcklwd %%xmm4, "#s" \n\t" /* .. | 0 | p0 | */ \
|
||||||
|
|
@ -303,164 +238,6 @@ pa_volume_s16re_sse (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
pa_volume_float32ne_sse (float *samples, float *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (float);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
*samples++ *= volumes[channel];
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_float32re_sse (float *samples, float *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (float);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
float t;
|
|
||||||
|
|
||||||
t = PA_FLOAT32_SWAP(*samples);
|
|
||||||
t *= volumes[channel];
|
|
||||||
*samples++ = PA_FLOAT32_SWAP(t);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s32ne_sse (int32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (int32_t);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t)(*samples);
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
*samples++ = (int32_t) t;
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s32re_sse (int32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (int32_t);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t) PA_INT32_SWAP(*samples);
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
*samples++ = PA_INT32_SWAP((int32_t) t);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s24ne_sse (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
uint8_t *e;
|
|
||||||
|
|
||||||
e = samples + length;
|
|
||||||
|
|
||||||
for (channel = 0; samples < e; samples += 3) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t)((int32_t) (PA_READ24NE(samples) << 8));
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
PA_WRITE24NE(samples, ((uint32_t) (int32_t) t) >> 8);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s24re_sse (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
uint8_t *e;
|
|
||||||
|
|
||||||
e = samples + length;
|
|
||||||
|
|
||||||
for (channel = 0; samples < e; samples += 3) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t)((int32_t) (PA_READ24RE(samples) << 8));
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
PA_WRITE24RE(samples, ((uint32_t) (int32_t) t) >> 8);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s24_32ne_sse (uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (uint32_t);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t) ((int32_t) (*samples << 8));
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
*samples++ = ((uint32_t) ((int32_t) t)) >> 8;
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pa_volume_s24_32re_sse (uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
|
||||||
{
|
|
||||||
unsigned channel;
|
|
||||||
|
|
||||||
length /= sizeof (uint32_t);
|
|
||||||
|
|
||||||
for (channel = 0; length; length--) {
|
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
t = (int64_t) ((int32_t) (PA_UINT32_SWAP(*samples) << 8));
|
|
||||||
t = (t * volumes[channel]) >> 16;
|
|
||||||
t = PA_CLAMP_UNLIKELY(t, -0x80000000LL, 0x7FFFFFFFLL);
|
|
||||||
*samples++ = PA_UINT32_SWAP(((uint32_t) ((int32_t) t)) >> 8);
|
|
||||||
|
|
||||||
if (PA_UNLIKELY(++channel >= channels))
|
|
||||||
channel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef RUN_TEST
|
#undef RUN_TEST
|
||||||
|
|
||||||
#ifdef RUN_TEST
|
#ifdef RUN_TEST
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue