Commit c5b59dc4 authored by Laurent Aimar's avatar Laurent Aimar

Always use swab.

parent e8689aea
......@@ -90,10 +90,6 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
*/
static const uint8_t p_sync_le[6] = { 0x72, 0xF8, 0x1F, 0x4E, 0x01, 0x00 };
static const uint8_t p_sync_be[6] = { 0xF8, 0x72, 0x4E, 0x1F, 0x00, 0x01 };
#ifndef HAVE_SWAB
uint8_t * p_tmp;
uint16_t i;
#endif
uint16_t i_frame_size = p_in_buf->i_nb_bytes / 2;
uint8_t * p_in = p_in_buf->p_buffer;
uint8_t * p_out = p_out_buf->p_buffer;
......@@ -113,17 +109,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out[5] = p_in[5] & 0x7; /* bsmod */
p_out[6] = (i_frame_size << 4) & 0xff;
p_out[7] = (i_frame_size >> 4) & 0xff;
#ifdef HAVE_SWAB
swab( p_in, &p_out[8], i_frame_size * 2 );
#else
p_tmp = &p_out[8];
for( i = i_frame_size; i-- ; )
{
p_tmp[0] = p_in[1];
p_tmp[1] = p_in[0];
p_tmp += 2; p_in += 2;
}
#endif
}
vlc_memset( p_out + 8 + i_frame_size * 2, 0,
AOUT_SPDIF_SIZE - i_frame_size * 2 - 8 );
......
......@@ -191,20 +191,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
/* We are dealing with a big endian bitstream and a little endian output
* or a little endian bitstream and a big endian output.
* Byteswap the stream */
#ifdef HAVE_SWAB
swab( p_in, p_out + 8, i_length );
#else
uint16_t i;
uint8_t * p_tmp, tmp;
p_tmp = p_out + 8;
for( i = i_length / 2 ; i-- ; )
{
tmp = p_in[0]; /* in-place filter */
p_tmp[0] = p_in[1];
p_tmp[1] = tmp;
p_tmp += 2; p_in += 2;
}
#endif
/* If i_length is odd, we have to adjust swapping a bit.. */
if( i_length & 1 )
{
......
......@@ -551,28 +551,14 @@ static void Do_S16ToFL32_SW( aout_instance_t * p_aout, aout_filter_t * p_filter,
int16_t * p_in;
float * p_out = (float *)p_out_buf->p_buffer + i - 1;
#ifdef HAVE_SWAB
int16_t p_swabbed[i];
swab( p_in_buf->p_buffer, p_swabbed, i * sizeof(int16_t) );
p_in = p_swabbed + i - 1;
#else
uint8_t p_tmp[2];
p_in = (int16_t *)p_in_buf->p_buffer + i - 1;
#endif
while( i-- )
{
#ifndef HAVE_SWAB
p_tmp[0] = ((uint8_t *)p_in)[1];
p_tmp[1] = ((uint8_t *)p_in)[0];
*p_out = (float)( *(int16_t *)p_tmp ) / 32768.0;
#else
*p_out = (float)*p_in / 32768.0;
#endif
p_in--; p_out--;
}
*p_out-- = (float)*p_in-- / 32768.0;
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 4 / 2;
......
......@@ -221,18 +221,7 @@ static int Demux( demux_t *p_demux )
if( p_sys->codec.b_use_word && !p_sys->b_big_endian && p_block_in->i_buffer > 0 )
{
/* Convert to big endian */
#ifdef HAVE_SWAB
swab( p_block_in->p_buffer, p_block_in->p_buffer, p_block_in->i_buffer );
#else
uint8_t *p_tmp = p_block_in->p_buffer;
for( int i = p_block_in->i_buffer / 2 ; i-- ; )
{
uint8_t tmp = p_tmp[0];
p_tmp[0] = p_tmp[1];
p_tmp[1] = tmp;
p_tmp += 2;
}
#endif
}
p_block_in->i_pts = p_block_in->i_dts = p_sys->b_start || p_sys->b_initial_sync_failed ? 1 : 0;
......
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