audio: change naming scheme of FLOAT_CONV macros

This patch changes the naming scheme of the FLOAT_CONV_TO and
FLOAT_CONV_FROM macros to the scheme used in mixeng_template.h.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 20200308193321.20668-2-vr_qemu@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Volker Rümelin 2020-03-08 20:33:17 +01:00 committed by Gerd Hoffmann
parent 019b5ba7b3
commit dd381319a3

View file

@ -268,17 +268,17 @@ f_sample *mixeng_clip[2][2][2][3] = {
}; };
#ifdef FLOAT_MIXENG #ifdef FLOAT_MIXENG
#define FLOAT_CONV_TO(x) (x) #define CONV_NATURAL_FLOAT(x) (x)
#define FLOAT_CONV_FROM(x) (x) #define CLIP_NATURAL_FLOAT(x) (x)
#else #else
static const float float_scale = UINT_MAX; static const float float_scale = UINT_MAX;
#define FLOAT_CONV_TO(x) ((x) * float_scale) #define CONV_NATURAL_FLOAT(x) ((x) * float_scale)
#ifdef RECIPROCAL #ifdef RECIPROCAL
static const float float_scale_reciprocal = 1.f / UINT_MAX; static const float float_scale_reciprocal = 1.f / UINT_MAX;
#define FLOAT_CONV_FROM(x) ((x) * float_scale_reciprocal) #define CLIP_NATURAL_FLOAT(x) ((x) * float_scale_reciprocal)
#else #else
#define FLOAT_CONV_FROM(x) ((x) / float_scale) #define CLIP_NATURAL_FLOAT(x) ((x) / float_scale)
#endif #endif
#endif #endif
@ -288,7 +288,7 @@ static void conv_natural_float_to_mono(struct st_sample *dst, const void *src,
float *in = (float *)src; float *in = (float *)src;
while (samples--) { while (samples--) {
dst->r = dst->l = FLOAT_CONV_TO(*in++); dst->r = dst->l = CONV_NATURAL_FLOAT(*in++);
dst++; dst++;
} }
} }
@ -299,8 +299,8 @@ static void conv_natural_float_to_stereo(struct st_sample *dst, const void *src,
float *in = (float *)src; float *in = (float *)src;
while (samples--) { while (samples--) {
dst->l = FLOAT_CONV_TO(*in++); dst->l = CONV_NATURAL_FLOAT(*in++);
dst->r = FLOAT_CONV_TO(*in++); dst->r = CONV_NATURAL_FLOAT(*in++);
dst++; dst++;
} }
} }
@ -316,7 +316,7 @@ static void clip_natural_float_from_mono(void *dst, const struct st_sample *src,
float *out = (float *)dst; float *out = (float *)dst;
while (samples--) { while (samples--) {
*out++ = FLOAT_CONV_FROM(src->l) + FLOAT_CONV_FROM(src->r); *out++ = CLIP_NATURAL_FLOAT(src->l) + CLIP_NATURAL_FLOAT(src->r);
src++; src++;
} }
} }
@ -327,8 +327,8 @@ static void clip_natural_float_from_stereo(
float *out = (float *)dst; float *out = (float *)dst;
while (samples--) { while (samples--) {
*out++ = FLOAT_CONV_FROM(src->l); *out++ = CLIP_NATURAL_FLOAT(src->l);
*out++ = FLOAT_CONV_FROM(src->r); *out++ = CLIP_NATURAL_FLOAT(src->r);
src++; src++;
} }
} }