*/
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;
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 );
/* 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 )
{
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;
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;