diff mbox series

[FFmpeg-devel,07/12] avradio/rds: warnings cleanup

Message ID 20230711211910.1257355-7-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,01/12] avradio/sdrdemux: Fix use of uninitialized memory | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Michael Niedermayer July 11, 2023, 9:19 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavradio/rds.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavradio/rds.c b/libavradio/rds.c
index 1392bb0874..99e5360b72 100644
--- a/libavradio/rds.c
+++ b/libavradio/rds.c
@@ -171,8 +171,10 @@  int ff_sdr_decode_rds(SDRContext *sdr, Station *station, AVComplexFloat *signal)
     station->rds_ring_pos += sdr->fm_block_size_p2;
 
     while (station->rds_ring_pos > IDX(2) + IDX(4*104-1)) {
-        int best_phase;
+        int best_phase, step;
         float best_amplitude = -1;
+        float last_bpsk = 0;
+        int best_errors = INT_MAX;
         for (phase = 0; phase < 2*IDX(2); phase++) {
             double a = 0;
             for (i = 0; i<2*104; i++) {
@@ -185,7 +187,6 @@  int ff_sdr_decode_rds(SDRContext *sdr, Station *station, AVComplexFloat *signal)
         }
 
         phase = best_phase;
-        float last_bpsk = 0;
         for (i = 0; i<2*104; i++) {
             float bpsk = ring[IDX(2*i+1)][phase] - ring[IDX(2*i)][phase];
             if (i)
@@ -193,7 +194,6 @@  int ff_sdr_decode_rds(SDRContext *sdr, Station *station, AVComplexFloat *signal)
             last_bpsk = bpsk;
         }
 
-        int best_errors = INT_MAX;
         for (phase = 0; phase < 104; phase++) {
             int error = 0;
             for (int block = 0; block < 4; block++) {
@@ -217,7 +217,7 @@  int ff_sdr_decode_rds(SDRContext *sdr, Station *station, AVComplexFloat *signal)
                 decode_rds_group(sdr, station, group);
             }
         }
-        int step = IDX(2*(best_phase + 103));
+        step = IDX(2*(best_phase + 103));
 
         av_assert0(station->rds_ring_pos >= step);
         memmove(ring, ring + step, (station->rds_ring_pos + sdr->fm_block_size_p2 - step) * sizeof(*station->rds_ring));