[vlc-devel] commit: AC3 3F1R downmix to stereo (simple downmixer) (James Turner )

git version control git at videolan.org
Mon Sep 14 17:09:31 CEST 2009


vlc | branch: master | James Turner <zakalawe at mac.com> | Mon Sep 14 18:09:13 2009 +0300| [cef84e5f1627eff9534e5498dcb927f8eb416f0f] | committer: Rémi Denis-Courmont 

AC3 3F1R downmix to stereo (simple downmixer)

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cef84e5f1627eff9534e5498dcb927f8eb416f0f
---

 modules/audio_filter/channel_mixer/simple.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/modules/audio_filter/channel_mixer/simple.c b/modules/audio_filter/channel_mixer/simple.c
index 407700a..a1e3ea9 100644
--- a/modules/audio_filter/channel_mixer/simple.c
+++ b/modules/audio_filter/channel_mixer/simple.c
@@ -65,6 +65,7 @@ vlc_module_end ()
 #define AOUT_CHANS_3_0          ( AOUT_CHANS_STEREO_FRONT | AOUT_CHAN_CENTER )
 #define AOUT_CHANS_4_0          ( AOUT_CHANS_STEREO_FRONT | AOUT_CHANS_STEREO_REAR )
 #define AOUT_CHANS_4_0_MIDDLE   ( AOUT_CHANS_STEREO_FRONT | AOUT_CHANS_STEREO_MIDDLE )
+#define AOUT_CHANS_4_CENTER_REAR (AOUT_CHANS_STEREO_FRONT | AOUT_CHAN_CENTER | AOUT_CHAN_REARCENTER)
 #define AOUT_CHANS_5_0          ( AOUT_CHANS_4_0 | AOUT_CHAN_CENTER )
 #define AOUT_CHANS_5_0_MIDDLE   ( AOUT_CHANS_4_0_MIDDLE | AOUT_CHAN_CENTER )
 #define AOUT_CHANS_6_0          ( AOUT_CHANS_STEREO_FRONT | AOUT_CHANS_STEREO_REAR | AOUT_CHANS_STEREO_MIDDLE )
@@ -108,6 +109,9 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
                                (i_input_physical & AOUT_CHANS_5_0_MIDDLE) == AOUT_CHANS_5_0_MIDDLE );
     const bool b_input_3_0 = !b_input_7_0 && !b_input_5_0 &&
                              (i_input_physical & ~AOUT_CHAN_LFE) == AOUT_CHANS_3_0;
+
+    const bool b_input_4_center_rear = (i_input_physical & ~AOUT_CHAN_LFE) == AOUT_CHANS_4_CENTER_REAR;
+
     int i_input_nb = aout_FormatNbChannels( &p_filter->input );
     int i_output_nb = aout_FormatNbChannels( &p_filter->output );
     float *p_dest = (float *)p_out_buf->p_buffer;
@@ -155,6 +159,15 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
 
             if( p_filter->input.i_physical_channels & AOUT_CHAN_LFE ) p_src++;
         }
+        else if (b_input_4_center_rear)
+        for( i = p_in_buf->i_nb_samples; i--; )
+        {
+          *p_dest = p_src[2] + p_src[3] + 0.5 * p_src[0];
+          p_dest++;
+          *p_dest = p_src[2] + p_src[3] + 0.5 * p_src[1];
+          p_dest++;
+          p_src += 4;
+        }
     }
     else if( p_filter->output.i_physical_channels == AOUT_CHAN_CENTER )
     {
@@ -345,6 +358,7 @@ static bool IsSupported( const audio_format_t *p_input, const audio_format_t *p_
         (p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_5_0 &&
         (p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_5_0_MIDDLE &&
         (p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_3_0 &&
+        (p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_4_CENTER_REAR &&
          p_input->i_physical_channels != AOUT_CHANS_2_0 )
     {
         return false;




More information about the vlc-devel mailing list