[FFmpeg-cvslog] avfilter/af_hdcd: Fix undefined shifts
Andreas Rheinhardt
git at videolan.org
Thu Apr 1 17:12:06 EEST 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Fri Mar 26 06:22:24 2021 +0100| [9eadd616b7ec31f9a6b691ff3faa2c6c3716335f] | committer: Andreas Rheinhardt
avfilter/af_hdcd: Fix undefined shifts
Affected the filter-hdcd-* FATE tests.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9eadd616b7ec31f9a6b691ff3faa2c6c3716335f
---
libavfilter/af_hdcd.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index 251d03229a..978f63599b 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -1053,7 +1053,7 @@ static int hdcd_integrate(HDCDContext *ctx, hdcd_state *states, int channels, in
for (j = result - 1; j >= 0; j--) {
for (i = 0; i < channels; i++)
- bits[i] |= (*(samples++) & 1) << j;
+ bits[i] |= (*(samples++) & 1U) << j;
samples += stride - channels;
}
@@ -1210,7 +1210,7 @@ static int hdcd_analyze(int32_t *samples, int count, int stride, int gain, int t
int32_t *samples_end = samples + stride * count;
for (i = 0; i < count; i++) {
- samples[i * stride] <<= 15;
+ samples[i * stride] *= 1 << 15;
if (mode == HDCD_ANA_PE) {
int pel = (samples[i * stride] >> 16) & 1;
int32_t sample = samples[i * stride];
@@ -1284,13 +1284,13 @@ static int hdcd_envelope(int32_t *samples, int count, int stride, int vbits, int
av_assert0(asample <= max_asample);
sample = sample >= 0 ? peaktab[asample] : -peaktab[asample];
} else
- sample <<= shft;
+ sample *= (1 << shft);
samples[i * stride] = sample;
}
} else {
for (i = 0; i < count; i++)
- samples[i * stride] <<= shft;
+ samples[i * stride] *= (1 << shft);
}
if (gain <= target_gain) {
More information about the ffmpeg-cvslog
mailing list