Commit f521d69d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

linear resampler: fixed-point support (disabled)

parent ab151ef1
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_filter.h> #include <vlc_filter.h>
#include <vlc_block.h> #include <vlc_block.h>
#include <vlc_cpu.h>
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
...@@ -43,7 +44,13 @@ static int OpenFilter ( vlc_object_t * ); ...@@ -43,7 +44,13 @@ static int OpenFilter ( vlc_object_t * );
static void CloseFilter( vlc_object_t * ); static void CloseFilter( vlc_object_t * );
static block_t *Resample( filter_t *, block_t * ); static block_t *Resample( filter_t *, block_t * );
#if 1
typedef float sample_t; typedef float sample_t;
# define VLC_CODEC_NATIVE VLC_CODEC_FL32
#else
typedef int32_t sample_t;
# define VLC_CODEC_NATIVE VLC_CODEC_FI32
#endif
/***************************************************************************** /*****************************************************************************
* Local structures * Local structures
...@@ -130,7 +137,11 @@ static block_t *Resample( filter_t *p_filter, block_t *p_in_buf ) ...@@ -130,7 +137,11 @@ static block_t *Resample( filter_t *p_filter, block_t *p_in_buf )
for( unsigned i = 0; i < i_nb_channels ; i++ ) for( unsigned i = 0; i < i_nb_channels ; i++ )
{ {
p_out[i] = p_prev_sample[i]; p_out[i] = p_prev_sample[i];
#if CPU_CAPABILITY_FPU
p_out[i] += (p_in[i] - p_prev_sample[i]) p_out[i] += (p_in[i] - p_prev_sample[i])
#else
p_out[i] += (int64_t)(p_in[i] - p_prev_sample[i])
#endif
* p_sys->i_remainder / p_filter->fmt_out.audio.i_rate; * p_sys->i_remainder / p_filter->fmt_out.audio.i_rate;
} }
p_out += i_nb_channels; p_out += i_nb_channels;
...@@ -149,7 +160,11 @@ static block_t *Resample( filter_t *p_filter, block_t *p_in_buf ) ...@@ -149,7 +160,11 @@ static block_t *Resample( filter_t *p_filter, block_t *p_in_buf )
for( unsigned i = 0; i < i_nb_channels ; i++ ) for( unsigned i = 0; i < i_nb_channels ; i++ )
{ {
p_out[i] = p_in[i]; p_out[i] = p_in[i];
#if CPU_CAPABILITY_FPU
p_out[i] += (p_in[i + i_nb_channels] - p_in[i]) p_out[i] += (p_in[i + i_nb_channels] - p_in[i])
#else
p_out[i] += (int64_t)(p_in[i + i_nb_channels] - p_in[i])
#endif
* p_sys->i_remainder / p_filter->fmt_out.audio.i_rate; * p_sys->i_remainder / p_filter->fmt_out.audio.i_rate;
} }
p_out += i_nb_channels; p_out += i_nb_channels;
...@@ -194,7 +209,7 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -194,7 +209,7 @@ static int OpenFilter( vlc_object_t *p_this )
int i_out_rate = p_filter->fmt_out.audio.i_rate; int i_out_rate = p_filter->fmt_out.audio.i_rate;
if( p_filter->fmt_in.audio.i_rate == p_filter->fmt_out.audio.i_rate || if( p_filter->fmt_in.audio.i_rate == p_filter->fmt_out.audio.i_rate ||
p_filter->fmt_in.i_codec != VLC_CODEC_FL32 ) p_filter->fmt_in.i_codec != VLC_CODEC_NATIVE )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
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