Changeset a9bc769eafbfe07e8782859c69e325e5c7859585

Show
Ignore:
Timestamp:
22/11/02 00:06:08 (6 years ago)
Author:
Christophe Massiot <massiot@videolan.org>
git-committer:
Christophe Massiot <massiot@videolan.org> 1037919968 +0000
git-parent:

[e9e8b069d0538fd3551bae5f0c30fb7457939a7e]

git-author:
Christophe Massiot <massiot@videolan.org> 1037919968 +0000
Message:

Channel reordering according to the WG-4 specification, courtesy of
Heiko Panther.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/audio_filter/converter/a52tofloat32.c

    r4961a87 ra9bc769  
    55 ***************************************************************************** 
    66 * Copyright (C) 2001, 2002 VideoLAN 
    7  * $Id: a52tofloat32.c,v 1.7 2002/11/18 23:00:41 massiot Exp $ 
     7 * $Id: a52tofloat32.c,v 1.8 2002/11/21 23:06:08 massiot Exp $ 
    88 * 
    99 * Authors: Gildas Bazin <gbazin@netcourrier.com> 
     
    216216static void Interleave( float * p_out, const float * p_in, int i_nb_channels ) 
    217217{ 
     218    /* We do not only have to interleave, but also reorder the channels 
     219     * Channel reordering according to number of output channels of libA52 
     220     * The reordering needs to be different for different channel configurations 
     221     * (3F2R, 1F2R etc), so this is only temporary. 
     222     * The WG-4 order is appropriate for stereo, quadrophonia, and 5.1 surround. 
     223     * 
     224     * 6 channel mode 
     225     * channel  liba52 order    WG-4 order 
     226     * 0    LFE     // L 
     227     * 1    L       // R 
     228     * 2    C       // LS 
     229     * 3    R       // RS 
     230     * 4    LS      // C 
     231     * 5    RS      // LFE 
     232     * 
     233     * The liba52 moves channels to the front if there are unused spaces, so 
     234     * there is no gap between channels. The translation table says which 
     235     * channel of the new stream [use the new channel # as index] is taken 
     236     * from which original channel [use the number from the array to address 
     237     * the original channel]. 
     238     */ 
     239     
     240    static const int translation[7][6] = 
     241    {{ 0, 0, 0, 0, 0, 0 },  /* 0 channels (rarely used) */ 
     242    { 0, 0, 0, 0, 0, 0 },   /* 1 ch */ 
     243    { 0, 1, 0, 0, 0, 0 },   /* 2 */ 
     244    { 1, 2, 0, 0, 0, 0 },   /* 3 */ 
     245    { 1, 3, 2, 0, 0, 0 },   /* 4 */ 
     246    { 1, 3, 4, 2, 0, 0 },   /* 5 */ 
     247    { 1, 3, 4, 5, 2, 0 }};  /* 6 */ 
     248     
    218249    int i, j; 
    219  
    220250    for ( j = 0; j < i_nb_channels; j++ ) 
    221251    { 
    222252        for ( i = 0; i < 256; i++ ) 
    223253        { 
    224             p_out[i * i_nb_channels + j] = p_in[j * 256 + i]; 
     254            p_out[i * i_nb_channels + translation[i_nb_channels][j]] 
     255                    = p_in[j * 256 + i]; 
    225256        } 
    226257    }