From 99b9a3f422b7f4a8f8373eb01ecb3d237f07c679 Mon Sep 17 00:00:00 2001 From: Maxime Even Date: Mon, 8 Jul 2024 17:41:39 +0200 Subject: [PATCH] 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 --- 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 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 */ -- 2.30.2