spectrogram: convert int16 to unsigned for correct range
authorMaxime Even <maximeeven@proton.me>
Mon, 8 Jul 2024 15:41:39 +0000 (17:41 +0200)
committerSebastian Ramacher <sramacher@debian.org>
Tue, 21 Jan 2025 18:02:47 +0000 (19:02 +0100)
p_dest is used to set the height of the column, and it is used
as a variable defined from zero to 2^16 - 1. It is therefore
considered in the rest of the program as an unsigned int 16.
Moreover, the value that we put inside are a sum of two squared
real value, so they are necessarily positive.

(cherry picked from commit 94a8d152eadd53073305c95d221eca7623b4ed6c)

Gbp-Pq: Name 0016-spectrogram-convert-int16-to-unsigned-for-correct-ra.patch

modules/visualization/glspectrum.c
modules/visualization/visual/effects.c

index bf0ffd6354495a04a5da59c49e4004e3c92e1109..96ee3fe8d4f4b706de11e27982e0ac3a768bd485 100644 (file)
@@ -381,7 +381,7 @@ static void *Thread( void *p_data )
         float p_output[FFT_BUFFER_SIZE];           /* Raw FFT Result  */
         int16_t p_buffer1[FFT_BUFFER_SIZE];        /* Buffer on which we perform
                                                       the FFT (first channel) */
-        int16_t p_dest[FFT_BUFFER_SIZE];           /* Adapted FFT result */
+        uint16_t p_dest[FFT_BUFFER_SIZE];          /* Adapted FFT result */
         float *p_buffl = (float*)block->p_buffer;  /* Original buffer */
 
         int16_t  *p_buffs;                         /* int16_t converted buffer */
index 9b7b07aa420026fe105636362e975eddff5a102f..d5a720982b65ba964fbd99213c29e17aef2d622f 100644 (file)
@@ -109,7 +109,7 @@ static int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
 
     int i , j , y , k;
     int i_line;
-    int16_t p_dest[FFT_BUFFER_SIZE];      /* Adapted FFT result */
+    uint16_t p_dest[FFT_BUFFER_SIZE];     /* Adapted FFT result */
     int16_t p_buffer1[FFT_BUFFER_SIZE];   /* Buffer on which we perform
                                              the FFT (first channel) */
 
@@ -450,7 +450,7 @@ static int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
 
     int i , j , k;
     int i_line = 0;
-    int16_t p_dest[FFT_BUFFER_SIZE];      /* Adapted FFT result */
+    uint16_t p_dest[FFT_BUFFER_SIZE];     /* Adapted FFT result */
     int16_t p_buffer1[FFT_BUFFER_SIZE];   /* Buffer on which we perform
                                              the FFT (first channel) */
     float *p_buffl =                     /* Original buffer */