Skip to content
Snippets Groups Projects
Commit 56d0aca2 authored by Maxime Even's avatar Maxime Even
Browse files

spectrogram: allows better visualization of low frequencies

In some cases, Y which represents the height of a column was equal to 1
and therefore when passed through the log, the output displayed was
zero, by adding this 0.1, this allows you to see a column when y = 1
without really changing the height of each column

(cherry picked from commit c347fed9)
parent 6b961756
No related branches found
No related tags found
No related merge requests found
......@@ -58,6 +58,8 @@ static void Close(vlc_object_t *);
#define HEIGHT_TEXT N_("Video height")
#define HEIGHT_LONGTEXT N_("The height of the visualization window, in pixels.")
#define LOG_OFFSET 0.1
vlc_module_begin()
set_shortname(N_("glSpectrum"))
set_description(N_("3D OpenGL spectrum visualization"))
......@@ -466,8 +468,9 @@ static void *Thread( void *p_data )
if (p_dest[j] > y)
y = p_dest[j];
}
/* Calculate the height of the bar */
float new_height = y != 0 ? logf(y) * 0.4f : 0;
/* Calculate the height of the bar
This log_offset makes it possible to display low values */
float new_height = y != 0 ? logf( y + LOG_OFFSET ) * 0.4f : 0;
height[i] = new_height > height[i]
? new_height : height[i];
}
......
......@@ -46,6 +46,8 @@
#define GRAD_ANGLE_MAX 0.5
#define GRAD_INCR 0.01
#define LOG_OFFSET 0.1
/*****************************************************************************
* dummy_Run
*****************************************************************************/
......@@ -231,10 +233,11 @@ static int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
if ( p_dest[j] > y )
y = p_dest[j];
}
/* Calculate the height of the bar */
/* Calculate the height of the bar
This log_offset makes it possible to display low values */
if( y != 0 )
{
height[i] = log( y ) * 30;
height[i] = log( y + LOG_OFFSET ) * 30;
if( height[i] > 380 )
height[i] = 380;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment