+
+static void Interleave24( int8_t *p_out, const int32_t * const *pp_in,
+ const int pi_index[],
+ int i_nb_channels, int i_samples )
+{
+ int i, j;
+ for ( j = 0; j < i_samples; j++ )
+ {
+ for ( i = 0; i < i_nb_channels; i++ )
+ {
+ const int i_index = pi_index[i];
+#ifdef WORDS_BIGENDIAN
+ p_out[3*(j * i_nb_channels + i)+0] = (pp_in[i_index][j] >> 16) & 0xff;
+ p_out[3*(j * i_nb_channels + i)+1] = (pp_in[i_index][j] >> 8 ) & 0xff;
+ p_out[3*(j * i_nb_channels + i)+2] = (pp_in[i_index][j] >> 0 ) & 0xff;
+#else
+ p_out[3*(j * i_nb_channels + i)+2] = (pp_in[i_index][j] >> 16) & 0xff;
+ p_out[3*(j * i_nb_channels + i)+1] = (pp_in[i_index][j] >> 8 ) & 0xff;
+ p_out[3*(j * i_nb_channels + i)+0] = (pp_in[i_index][j] >> 0 ) & 0xff;
+#endif
+ }
+ }
+}
+