aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_hdcd.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2016-09-03 04:39:07 -0500
committerBurt P <pburt0@gmail.com>2016-09-07 10:59:18 -0500
commit38445d58f1a1cdc69bb11309e07aa99360bf466b (patch)
tree96ef144351ca3d87dd5de7e2ff81d7e6279cd1e7 /libavfilter/af_hdcd.c
parenteb0086588f1823841108ab1dee08683ab67cf507 (diff)
downloadffmpeg-38445d58f1a1cdc69bb11309e07aa99360bf466b.tar.gz
af_hdcd: hdcd_analyze_gen() using int instead of float
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'libavfilter/af_hdcd.c')
-rw-r--r--libavfilter/af_hdcd.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index a8a3d59448..96d5a0faf1 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -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 */
static int32_t hdcd_analyze_gen(int32_t sample, unsigned int v, unsigned int maxv)
{
- float sflt = sample, vv = v;
- vv /= maxv;
- if (vv > 1.0) vv = 1.0;
- sflt *= 1.0 + (vv * 18);
- return (int32_t)sflt;
+ static const int r = 18, m = 1024;
+ int64_t s64 = sample;
+ v = m + (v * r * m / maxv);
+ return (int32_t)(s64 * v / m);
}
/** behaves like hdcd_envelope(), but encodes processing information in