1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avfilter/af_hdcd: Fix undefined shifts

Affected the filter-hdcd-* FATE tests.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2021-03-26 06:22:24 +01:00 committed by Andreas Rheinhardt
parent 659a925939
commit 9eadd616b7

View File

@ -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) {