Commit 524254f8 authored by Scott Caudle's avatar Scott Caudle

updates spectrometer visualization. some optimization tweaks and additional features.

parent 46d8d47a
......@@ -396,11 +396,6 @@ int spectrometer_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
}
p_buffs = p_s16_buff;
//i_nb_bands = config_GetInt ( p_aout, "visual-nbbands" );
//i_separ = config_GetInt( p_aout, "visual-separ" );
//i_amp = config_GetInt ( p_aout, "visual-amp" );
//i_peak = config_GetInt ( p_aout, "visual-peaks" );
/* previous 4 vars changed.. using them as `spect' variables */
i_original = config_GetInt ( p_aout, "spect-show-original" );
i_nb_bands = config_GetInt ( p_aout, "spect-nbbands" );
i_separ = config_GetInt ( p_aout, "spect-separ" );
......@@ -420,12 +415,10 @@ int spectrometer_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
}
else
{
if( i_nb_bands > 80 )
i_nb_bands = 80;
xscale = xscale2;
}
i_nb_bands *= i_sections;
/* whoops, dont malloc the following memory for all the duplicated bands..
-only the original 20 or 80 will be fine */
if( !p_effect->p_data )
{
......@@ -446,13 +439,13 @@ int spectrometer_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
peaks =(int *)p_effect->p_data;
}
height = (int *)malloc( i_nb_bands * sizeof(int) );
if( !height)
{
msg_Err(p_aout,"Out of memory");
return -1;
}
/* Convert the buffer to int16_t */
/* Pasted from float32tos16.c */
for (i = p_buffer->i_nb_samples * p_effect->i_nb_chans; i--; )
......@@ -482,6 +475,8 @@ int spectrometer_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
for(i= 0; i< FFT_BUFFER_SIZE ; i++ )
p_dest[i] = ( (int) sqrt( p_output [ i + 1 ] ) ) >> 8;
i_nb_bands *= i_sections;
for ( i = 0 ; i< i_nb_bands/i_sections ;i++)
{
/* We search the maximum on one scale */
......@@ -660,24 +655,20 @@ int spectrometer_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
y /= 2;
*(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
- p_picture->p[1].i_pitch
) = 0;/* U(R,G,B); */
if( 0x04 * (i_line + k ) - 0x0f > 0 )
{
if ( 0x04 * (i_line + k ) -0x0f < 0xff)
*(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
- p_picture->p[2].i_pitch
) = ( 0x04 * ( i_line + k ) ) -(color1-1);/* -V(R,G,B); */
else
*(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
- p_picture->p[2].i_pitch
) = 255;/* V(R,G,B); */
}
else
{
*(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
- p_picture->p[2].i_pitch
) = color1;/* V(R,G,B); */
}
}
......@@ -705,24 +696,20 @@ int spectrometer_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
y /= 2;
*(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
- p_picture->p[1].i_pitch
) = 0;/* U(R,G,B); */
if( 0x04 * i_line - 0x0f > 0 )
{
if( 0x04 * i_line -0x0f < 0xff)
*(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
- p_picture->p[2].i_pitch
) = ( 0x04 * i_line) -(color1-1);/* -V(R,G,B); */
else
*(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
- p_picture->p[2].i_pitch
) = 255;/* V(R,G,B); */
}
else
{
*(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
- p_picture->p[2].i_pitch
) = color1;/* V(R,G,B); */
}
}
......@@ -755,24 +742,20 @@ int spectrometer_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
y /= 2;
*(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
- p_picture->p[1].i_pitch
) = 0;
if( 0x04 * i_line - 0x0f > 0 )
{
if ( 0x04 * i_line -0x0f < 0xff)
*(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
- p_picture->p[2].i_pitch
) = ( 0x04 * i_line) -(color1-1);
else
*(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
- p_picture->p[2].i_pitch
) = 255;
}
else
{
*(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
- p_picture->p[2].i_pitch
) = color1;
}
}
......
......@@ -51,6 +51,8 @@
#define NBBANDS_TEXT N_( "Number of bands" )
#define NBBANDS_LONGTEXT N_( \
"Number of bands used by spectrum analyzer, should be 20 or 80." )
#define SPNBBANDS_LONGTEXT N_( \
"Number of bands used by the spectrOmeter, from 20 to 80." )
#define SEPAR_TEXT N_( "Band separator" )
#define SEPAR_LONGTEXT N_( \
......@@ -125,27 +127,27 @@ vlc_module_begin();
add_bool("visual-peaks", VLC_TRUE, NULL,
PEAKS_TEXT, PEAKS_LONGTEXT, VLC_TRUE );
set_section( N_("Spectrometer") , NULL );
add_bool("spect-show-original", VLC_TRUE, NULL,
add_bool("spect-show-original", VLC_FALSE, NULL,
ORIG_TEXT, ORIG_LONGTEXT, VLC_TRUE );
add_bool("spect-show-base", VLC_TRUE, NULL,
BASE_TEXT, BASE_LONGTEXT, VLC_TRUE );
add_integer("spect-radius", 22, NULL,
add_integer("spect-radius", 42, NULL,
RADIUS_TEXT, RADIUS_LONGTEXT, VLC_TRUE );
add_integer("spect-sections", 2, NULL,
add_integer("spect-sections", 3, NULL,
SECT_TEXT, SECT_LONGTEXT, VLC_TRUE );
add_integer("spect-color", 16, NULL,
add_integer("spect-color", 80, NULL,
COLOR1_TEXT, COLOR1_LONGTEXT, VLC_TRUE );
add_bool("spect-show-bands", VLC_TRUE, NULL,
BANDS_TEXT, BANDS_LONGTEXT, VLC_TRUE );
add_integer("spect-nbbands", 80, NULL,
NBBANDS_TEXT, NBBANDS_LONGTEXT, VLC_TRUE );
add_integer("spect-nbbands", 32, NULL,
NBBANDS_TEXT, SPNBBANDS_LONGTEXT, VLC_TRUE );
add_integer("spect-separ", 1, NULL,
SEPAR_TEXT, SEPAR_LONGTEXT, VLC_TRUE );
add_integer("spect-amp", 3, NULL,
add_integer("spect-amp", 8, NULL,
AMP_TEXT, AMP_LONGTEXT, VLC_TRUE );
add_bool("spect-show-peaks", VLC_TRUE, NULL,
PEAKS_TEXT, PEAKS_LONGTEXT, VLC_TRUE );
add_integer("spect-peak-width", 1, NULL,
add_integer("spect-peak-width", 61, NULL,
PEAK_WIDTH_TEXT, PEAK_WIDTH_LONGTEXT, VLC_TRUE );
add_integer("spect-peak-height", 1, NULL,
PEAK_HEIGHT_TEXT, PEAK_HEIGHT_LONGTEXT, VLC_TRUE );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment