[FFmpeg-cvslog] af_hdcd: hdcd_analyze_gen() using int instead of float
Burt P
git at videolan.org
Wed Sep 7 18:59:58 EEST 2016
ffmpeg | branch: master | Burt P <pburt0 at gmail.com> | Sat Sep 3 04:39:07 2016 -0500| [38445d58f1a1cdc69bb11309e07aa99360bf466b] | committer: Burt P
af_hdcd: hdcd_analyze_gen() using int instead of float
Signed-off-by: Burt P <pburt0 at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38445d58f1a1cdc69bb11309e07aa99360bf466b
---
libavfilter/af_hdcd.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index a8a3d59..96d5a0f 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
More information about the ffmpeg-cvslog
mailing list