[vlc-commits] visual: reduce symbols count
Rémi Denis-Courmont
git at videolan.org
Fri Apr 19 22:08:27 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 19 22:53:02 2013 +0300| [032bbe05780ff3684274317ddc6240297af396d0] | committer: Rémi Denis-Courmont
visual: reduce symbols count
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=032bbe05780ff3684274317ddc6240297af396d0
---
modules/visualization/visual/effects.c | 30 ++++++++++++++++++++----------
modules/visualization/visual/visual.c | 25 +++++--------------------
modules/visualization/visual/visual.h | 21 ++++++++-------------
3 files changed, 33 insertions(+), 43 deletions(-)
diff --git a/modules/visualization/visual/effects.c b/modules/visualization/visual/effects.c
index 1103375..9f76914 100644
--- a/modules/visualization/visual/effects.c
+++ b/modules/visualization/visual/effects.c
@@ -48,8 +48,8 @@
/*****************************************************************************
* dummy_Run
*****************************************************************************/
-int dummy_Run( visual_effect_t * p_effect, vlc_object_t *p_aout,
- const block_t * p_buffer , picture_t * p_picture)
+static int dummy_Run( visual_effect_t * p_effect, vlc_object_t *p_aout,
+ const block_t * p_buffer , picture_t * p_picture)
{
VLC_UNUSED(p_effect); VLC_UNUSED(p_aout); VLC_UNUSED(p_buffer);
VLC_UNUSED(p_picture);
@@ -59,8 +59,8 @@ int dummy_Run( visual_effect_t * p_effect, vlc_object_t *p_aout,
/*****************************************************************************
* spectrum_Run: spectrum analyser
*****************************************************************************/
-int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
- const block_t * p_buffer , picture_t * p_picture)
+static int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
+ const block_t * p_buffer , picture_t * p_picture)
{
spectrum_data *p_data = p_effect->p_data;
float p_output[FFT_BUFFER_SIZE]; /* Raw FFT Result */
@@ -336,8 +336,8 @@ int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
/*****************************************************************************
* spectrometer_Run: derivative spectrum analysis
*****************************************************************************/
-int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
- const block_t * p_buffer , picture_t * p_picture)
+static int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
+ const block_t * p_buffer , picture_t * p_picture)
{
#define Y(R,G,B) ((uint8_t)( (R * .299) + (G * .587) + (B * .114) ))
#define U(R,G,B) ((uint8_t)( (R * -.169) + (G * -.332) + (B * .500) + 128 ))
@@ -793,8 +793,8 @@ int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
/*****************************************************************************
* scope_Run: scope effect
*****************************************************************************/
-int scope_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
- const block_t * p_buffer , picture_t * p_picture)
+static int scope_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
+ const block_t * p_buffer , picture_t * p_picture)
{
VLC_UNUSED(p_aout);
@@ -850,8 +850,8 @@ int scope_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
/*****************************************************************************
* vuMeter_Run: vu meter effect
*****************************************************************************/
-int vuMeter_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
- const block_t * p_buffer , picture_t * p_picture)
+static int vuMeter_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
+ const block_t * p_buffer , picture_t * p_picture)
{
VLC_UNUSED(p_aout);
float i_value_l = 0;
@@ -985,3 +985,13 @@ int vuMeter_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
return 0;
}
+
+/* Table of effects */
+const struct visual_cb_t effectv[] = {
+ { "scope", scope_Run },
+ { "vuMeter", vuMeter_Run },
+ { "spectrum", spectrum_Run },
+ { "spectrometer", spectrometer_Run },
+ { "dummy", dummy_Run },
+};
+const unsigned effectc = sizeof (effectv) / sizeof (effectv[0]);
diff --git a/modules/visualization/visual/visual.c b/modules/visualization/visual/visual.c
index 7b053e0..5ae54f1 100644
--- a/modules/visualization/visual/visual.c
+++ b/modules/visualization/visual/visual.c
@@ -156,20 +156,6 @@ vlc_module_end ()
* Local prototypes
*****************************************************************************/
static block_t *DoWork( filter_t *, block_t * );
-static const struct
-{
- const char *psz_name;
- int (*pf_run)( visual_effect_t *, vlc_object_t *,
- const block_t *, picture_t *);
-} pf_effect_run[]=
-{
- { "scope", scope_Run },
- { "vuMeter", vuMeter_Run },
- { "spectrum", spectrum_Run },
- { "spectrometer", spectrometer_Run },
- { "dummy", dummy_Run},
- { NULL, dummy_Run}
-};
struct filter_sys_t
{
@@ -227,14 +213,13 @@ static int Open( vlc_object_t *p_this )
p_effect->pf_run = NULL;
p_effect->psz_name = NULL;
- for( int i = 0; pf_effect_run[i].psz_name != NULL; i++ )
+ for( unsigned i = 0; i < effectc; i++ )
{
- if( !strncasecmp( psz_parser,
- pf_effect_run[i].psz_name,
- strlen( pf_effect_run[i].psz_name ) ) )
+ if( !strncasecmp( psz_parser, effectv[i].name,
+ strlen( effectv[i].name ) ) )
{
- p_effect->pf_run = pf_effect_run[i].pf_run;
- p_effect->psz_name = pf_effect_run[i].psz_name;
+ p_effect->pf_run = effectv[i].run_cb;
+ p_effect->psz_name = effectv[i].name;
break;
}
}
diff --git a/modules/visualization/visual/visual.h b/modules/visualization/visual/visual.h
index fa4424e..1d61138 100644
--- a/modules/visualization/visual/visual.h
+++ b/modules/visualization/visual/visual.h
@@ -54,16 +54,11 @@ typedef struct
int16_t *p_prev_s16_buff;
} spectrometer_data;
-/* Prototypes */
-int scope_Run
- (visual_effect_t * , vlc_object_t *, const block_t *, picture_t *);
-int vuMeter_Run
- (visual_effect_t * , vlc_object_t *, const block_t *, picture_t *);
-int dummy_Run
- (visual_effect_t * , vlc_object_t *, const block_t *, picture_t *);
-int random_Run
- (visual_effect_t * , vlc_object_t *, const block_t *, picture_t *);
-int spectrum_Run
- (visual_effect_t * , vlc_object_t *, const block_t *, picture_t *);
-int spectrometer_Run
- (visual_effect_t * , vlc_object_t *, const block_t *, picture_t *);
+typedef int (*visual_run_t)(visual_effect_t *, vlc_object_t *,
+ const block_t *, picture_t *);
+extern const struct visual_cb_t
+{
+ char name[16];
+ visual_run_t run_cb;
+} effectv[];
+extern const unsigned effectc;
More information about the vlc-commits
mailing list