[vlc-commits] vorbisenc: remove useless p_sys->i_channels

Thomas Guillem git at videolan.org
Fri Jan 19 12:01:33 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan 18 16:01:21 2018 +0100| [2dee0937a70de4ac35d6abc16d0f1d7acfa5d979] | committer: Jean-Baptiste Kempf

vorbisenc: remove useless p_sys->i_channels

(cherry picked from commit 1d3888f5ec613ee856440b27403135aa57bc75d8)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/vorbis.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index 04a22879d3..15999a2332 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -747,7 +747,6 @@ struct encoder_sys_t
 
     int i_last_block_size;
     int i_samples_delay;
-    unsigned int i_channels;
 
     /*
     ** Channel reordering
@@ -877,7 +876,6 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->fmt_out.audio.i_physical_channels =
     p_enc->fmt_in.audio.i_physical_channels =
         pi_channels_maps[p_sys->vi.channels];
-    p_sys->i_channels = p_enc->fmt_in.audio.i_channels;
 
     p_sys->i_last_block_size = 0;
     p_sys->i_samples_delay = 0;
@@ -912,12 +910,13 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
     buffer = vorbis_analysis_buffer( &p_sys->vd, p_aout_buf->i_nb_samples );
 
     /* convert samples to float and uninterleave */
-    for( unsigned int i = 0; i < p_sys->i_channels; i++ )
+    const unsigned i_channels = p_enc->fmt_in.audio.i_channels;
+    for( unsigned int i = 0; i < i_channels; i++ )
     {
         for( unsigned int j = 0 ; j < p_aout_buf->i_nb_samples ; j++ )
         {
             buffer[i][j]= ((float *)p_aout_buf->p_buffer)
-                                    [j * p_sys->i_channels + p_sys->pi_chan_table[i]];
+                                    [j * i_channels + p_sys->pi_chan_table[i]];
         }
     }
 



More information about the vlc-commits mailing list