[FFmpeg-devel] [PATCH 06/12] avradio/avformat/sdrdemux: run clip check on the correct samples
Michael Niedermayer
michael at niedermayer.cc
Mon Jul 31 01:11:25 EEST 2023
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavformat/sdrdemux.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/libavformat/sdrdemux.c b/libavformat/sdrdemux.c
index 44a6489bd2..69349add7b 100644
--- a/libavformat/sdrdemux.c
+++ b/libavformat/sdrdemux.c
@@ -1153,10 +1153,9 @@ static int demodulate_fm(SDRContext *sdr, Station *station, AVStream *st, AVPack
sst->out_buf[2*i+0] =
sst->out_buf[2*i+1] = m;
}
-
- if (fabs(sst->out_buf[i]) > clip) {
- av_log(sdr->avfmt, AV_LOG_WARNING, "CLIP %f\n", sst->out_buf[i]);
- clip = fabs(sst->out_buf[i]) * 1.1;
+ if (fmax(fabs(sst->out_buf[2*i+0]), fabs(sst->out_buf[2*i+1])) > clip) {
+ av_log(sdr->avfmt, AV_LOG_WARNING, "CLIP %f %f\n", sst->out_buf[2*i+0], sst->out_buf[2*i+1]);
+ clip = fmax(fabs(sst->out_buf[2*i+0]), fabs(sst->out_buf[2*i+1])) * 1.1;
}
}
--
2.31.1
More information about the ffmpeg-devel
mailing list