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

a52: decode to S32N in fixed point

parent b68794c7
...@@ -230,17 +230,19 @@ static int Open( vlc_object_t *p_this, filter_sys_t *p_sys, ...@@ -230,17 +230,19 @@ static int Open( vlc_object_t *p_this, filter_sys_t *p_sys,
/***************************************************************************** /*****************************************************************************
* Interleave: helper function to interleave channels * Interleave: helper function to interleave channels
*****************************************************************************/ *****************************************************************************/
static void Interleave( sample_t * p_out, const sample_t * p_in, static void Interleave( sample_t *restrict p_out, const sample_t *restrict p_in,
int i_nb_channels, uint8_t *pi_chan_table ) unsigned i_nb_channels, uint8_t *restrict pi_chan_table )
{ {
/* We do not only have to interleave, but also reorder the channels */ /* We do not only have to interleave, but also reorder the channels */
for( unsigned j = 0; j < i_nb_channels; j++ )
int i, j;
for ( j = 0; j < i_nb_channels; j++ )
{ {
for ( i = 0; i < 256; i++ ) for( unsigned i = 0; i < 256; i++ )
{ {
#ifdef LIBA52_FIXED
p_out[i * i_nb_channels + pi_chan_table[j]] = p_in[j * 256 + i] << 4;
#else
p_out[i * i_nb_channels + pi_chan_table[j]] = p_in[j * 256 + i]; p_out[i * i_nb_channels + pi_chan_table[j]] = p_in[j * 256 + i];
#endif
} }
} }
} }
...@@ -248,31 +250,37 @@ static void Interleave( sample_t * p_out, const sample_t * p_in, ...@@ -248,31 +250,37 @@ static void Interleave( sample_t * p_out, const sample_t * p_in,
/***************************************************************************** /*****************************************************************************
* Duplicate: helper function to duplicate a unique channel * Duplicate: helper function to duplicate a unique channel
*****************************************************************************/ *****************************************************************************/
static void Duplicate( sample_t * p_out, const sample_t * p_in ) static void Duplicate( sample_t *restrict p_out, const sample_t *restrict p_in )
{ {
int i; for( unsigned i = 256; i--; )
for ( i = 256; i--; )
{ {
*p_out++ = *p_in; #ifdef LIBA52_FIXED
*p_out++ = *p_in; sample_t s = *(p_in++) << 4;
p_in++; #else
sample_t s = *(p_in++);
#endif
*p_out++ = s;
*p_out++ = s;
} }
} }
/***************************************************************************** /*****************************************************************************
* Exchange: helper function to exchange left & right channels * Exchange: helper function to exchange left & right channels
*****************************************************************************/ *****************************************************************************/
static void Exchange( sample_t * p_out, const sample_t * p_in ) static void Exchange( sample_t *restrict p_out, const sample_t *restrict p_in )
{ {
int i; const sample_t *p_first = p_in + 256;
const sample_t * p_first = p_in + 256; const sample_t *p_second = p_in;
const sample_t * p_second = p_in;
for ( i = 0; i < 256; i++ ) for( unsigned i = 0; i < 256; i++ )
{ {
#ifdef LIBA52_FIXED
*p_out++ = *p_first++ << 4;
*p_out++ = *p_second++ << 4;
#else
*p_out++ = *p_first++; *p_out++ = *p_first++;
*p_out++ = *p_second++; *p_out++ = *p_second++;
#endif
} }
} }
...@@ -370,7 +378,7 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -370,7 +378,7 @@ static int OpenFilter( vlc_object_t *p_this )
if( p_filter->fmt_in.i_codec != VLC_CODEC_A52 ) if( p_filter->fmt_in.i_codec != VLC_CODEC_A52 )
return VLC_EGENERIC; return VLC_EGENERIC;
#ifdef LIBA52_FIXED #ifdef LIBA52_FIXED
if( p_filter->fmt_out.audio.i_format != VLC_CODEC_FI32 ) if( p_filter->fmt_out.audio.i_format != VLC_CODEC_S32N )
#else #else
if( p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 ) if( p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
#endif #endif
......
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