From: Maxime Even Date: Mon, 8 Jul 2024 15:41:39 +0000 (+0200) Subject: spectrogram: convert int16 to unsigned for correct range X-Git-Tag: archive/raspbian/3.0.21-7+rpi1^2~110 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=99b9a3f422b7f4a8f8373eb01ecb3d237f07c679;p=vlc.git 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) Gbp-Pq: Name 0016-spectrogram-convert-int16-to-unsigned-for-correct-ra.patch --- diff --git a/modules/visualization/glspectrum.c b/modules/visualization/glspectrum.c index bf0ffd63..96ee3fe8 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 9b7b07aa..d5a72098 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 */