File: 0016-spectrogram-convert-int16-to-unsigned-for-correct-ra.patch

package info (click to toggle)
vlc 3.0.21-10
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 212,728 kB
  • sloc: ansic: 441,379; cpp: 110,628; objc: 36,394; sh: 6,947; makefile: 6,592; javascript: 4,902; xml: 1,611; asm: 1,355; yacc: 640; python: 555; lex: 88; perl: 77; sed: 16
file content (51 lines) | stat: -rw-r--r-- 2,586 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From: Maxime Even <maximeeven@proton.me>
Date: Mon, 8 Jul 2024 17:41:39 +0200
Subject: spectrogram: convert int16 to unsigned for correct range

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)
---
 modules/visualization/glspectrum.c     | 2 +-
 modules/visualization/visual/effects.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/visualization/glspectrum.c b/modules/visualization/glspectrum.c
index bf0ffd6..96ee3fe 100644
--- a/modules/visualization/glspectrum.c
+++ b/modules/visualization/glspectrum.c
@@ -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 */
diff --git a/modules/visualization/visual/effects.c b/modules/visualization/visual/effects.c
index 9b7b07a..d5a7209 100644
--- a/modules/visualization/visual/effects.c
+++ b/modules/visualization/visual/effects.c
@@ -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 */