avfilter/af_hdcd: Fix undefined shifts

Affected the filter-hdcd-* FATE tests.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
pull/362/head
Andreas Rheinhardt 4 years ago committed by Andreas Rheinhardt
parent 659a925939
commit 9eadd616b7
  1. 8
      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 (j = result - 1; j >= 0; j--) {
for (i = 0; i < channels; i++) for (i = 0; i < channels; i++)
bits[i] |= (*(samples++) & 1) << j; bits[i] |= (*(samples++) & 1U) << j;
samples += stride - channels; 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; int32_t *samples_end = samples + stride * count;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
samples[i * stride] <<= 15; samples[i * stride] *= 1 << 15;
if (mode == HDCD_ANA_PE) { if (mode == HDCD_ANA_PE) {
int pel = (samples[i * stride] >> 16) & 1; int pel = (samples[i * stride] >> 16) & 1;
int32_t sample = samples[i * stride]; 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); av_assert0(asample <= max_asample);
sample = sample >= 0 ? peaktab[asample] : -peaktab[asample]; sample = sample >= 0 ? peaktab[asample] : -peaktab[asample];
} else } else
sample <<= shft; sample *= (1 << shft);
samples[i * stride] = sample; samples[i * stride] = sample;
} }
} else { } else {
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
samples[i * stride] <<= shft; samples[i * stride] *= (1 << shft);
} }
if (gain <= target_gain) { if (gain <= target_gain) {

Loading…
Cancel
Save