vlc | branch: master | Francois Cartegnie <[email protected]> | Wed Mar 1 14:08:44 2017 +0100| [63e33235b0af1788ef53421c2ed56d020ee5972f] | committer: Francois Cartegnie
codec: flac: change reordering to 8bit indexes > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=63e33235b0af1788ef53421c2ed56d020ee5972f --- modules/codec/flac.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/modules/codec/flac.c b/modules/codec/flac.c index 5394d53..cc1cecd 100644 --- a/modules/codec/flac.c +++ b/modules/codec/flac.c @@ -71,7 +71,9 @@ struct decoder_sys_t bool b_stream_info; }; -static const int pi_channels_maps[9] = +#define FLAC_MAX_CHANNELS 8 + +static const int pi_channels_maps[FLAC_MAX_CHANNELS + 1] = { 0, AOUT_CHAN_CENTER, @@ -91,6 +93,20 @@ static const int pi_channels_maps[9] = | AOUT_CHAN_LFE }; +/* XXX it supposes our internal format is WG4 */ +static const uint8_t ppi_reorder[1+FLAC_MAX_CHANNELS][FLAC_MAX_CHANNELS] = +{ + { }, + { 0, }, + { 0, 1 }, + { 0, 1, 2 }, + { 0, 1, 2, 3 }, + { 0, 1, 3, 4, 2 }, + { 0, 1, 4, 5, 2, 3 }, + { 0, 1, 5, 6, 4, 2, 3 }, + { 0, 1, 6, 7, 4, 5, 2, 3 }, +}; + /***************************************************************************** * Local prototypes *****************************************************************************/ @@ -132,7 +148,7 @@ vlc_module_end () * Interleave: helper function to interleave channels *****************************************************************************/ static void Interleave( int32_t *p_out, const int32_t * const *pp_in, - const unsigned char *restrict pi_index, unsigned i_nb_channels, + const uint8_t *restrict pi_index, unsigned i_nb_channels, unsigned i_samples, unsigned bits ) { unsigned shift = 32 - bits; @@ -155,19 +171,6 @@ DecoderWriteCallback( const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *const buffer[], void *client_data ) { - /* XXX it supposes our internal format is WG4 */ - static const unsigned char ppi_reorder[1+8][8] = { - { }, - { 0, }, - { 0, 1 }, - { 0, 1, 2 }, - { 0, 1, 2, 3 }, - { 0, 1, 3, 4, 2 }, - { 0, 1, 4, 5, 2, 3 }, - { 0, 1, 5, 6, 4, 2, 3 }, - { 0, 1, 6, 7, 4, 5, 2, 3 }, - }; - VLC_UNUSED(decoder); decoder_t *p_dec = (decoder_t *)client_data; decoder_sys_t *p_sys = p_dec->p_sys; @@ -178,7 +181,7 @@ DecoderWriteCallback( const FLAC__StreamDecoder *decoder, if( date_Get( &p_sys->end_date ) <= VLC_TS_INVALID ) return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; - const unsigned char *pi_reorder = ppi_reorder[p_dec->fmt_out.audio.i_channels]; + const uint8_t *pi_reorder = ppi_reorder[p_dec->fmt_out.audio.i_channels]; if( decoder_UpdateAudioFormat( p_dec ) ) return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
