Commit 38445d58 authored by Burt P's avatar Burt P

af_hdcd: hdcd_analyze_gen() using int instead of float

Signed-off-by: 's avatarBurt P <pburt0@gmail.com>
parent eb008658
...@@ -1318,11 +1318,10 @@ static void hdcd_analyze_prepare(hdcd_state *state, int32_t *samples, int count, ...@@ -1318,11 +1318,10 @@ static void hdcd_analyze_prepare(hdcd_state *state, int32_t *samples, int count,
/** encode a value in the given sample by adjusting the amplitude */ /** encode a value in the given sample by adjusting the amplitude */
static int32_t hdcd_analyze_gen(int32_t sample, unsigned int v, unsigned int maxv) static int32_t hdcd_analyze_gen(int32_t sample, unsigned int v, unsigned int maxv)
{ {
float sflt = sample, vv = v; static const int r = 18, m = 1024;
vv /= maxv; int64_t s64 = sample;
if (vv > 1.0) vv = 1.0; v = m + (v * r * m / maxv);
sflt *= 1.0 + (vv * 18); return (int32_t)(s64 * v / m);
return (int32_t)sflt;
} }
/** behaves like hdcd_envelope(), but encodes processing information in /** behaves like hdcd_envelope(), but encodes processing information in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment