@@ -3370,7 +3370,7 @@ static int ropus_compute_qn(int N, int b, int offset, int pulse_cap,
33703370}
33713371
33723372static void ropus_compute_theta (ropus_band_ctx * ctx , ropus_split_ctx * sctx ,
3373- float * X , float * Y , int N , int * b , int B , int B0 , int LM ,
3373+ float * X , float * Y , int N , int * b , int B , int rp_B0 , int LM ,
33743374 int stereo , int * fill )
33753375{
33763376 int qn , itheta = 0 , delta , imid , iside , qalloc ;
@@ -3405,7 +3405,7 @@ static void ropus_compute_theta(ropus_band_ctx *ctx, ropus_split_ctx *sctx,
34053405 x <= x0 ? p0 * (x + 1 ) : (x - x0 ) + (x0 + 1 ) * p0 , ft );
34063406 itheta = x ;
34073407 }
3408- else if (B0 > 1 || stereo )
3408+ else if (rp_B0 > 1 || stereo )
34093409 itheta = (int )ropus_ec_dec_uint (ec , qn + 1 );
34103410 else
34113411 {
@@ -3503,7 +3503,7 @@ static unsigned ropus_quant_partition(ropus_band_ctx *ctx, float *X,
35033503 const uint8_t * cache ;
35043504 int q , curr_bits ;
35053505 int imid = 0 , iside = 0 ;
3506- int B0 = B ;
3506+ int rp_B0 = B ;
35073507 float mid = 0 , side = 0 ;
35083508 unsigned cm = 0 ;
35093509 float * Y = NULL ;
@@ -3525,7 +3525,7 @@ static unsigned ropus_quant_partition(ropus_band_ctx *ctx, float *X,
35253525 if (B == 1 )
35263526 fill = (fill & 1 ) | (fill << 1 );
35273527 B = (B + 1 ) >> 1 ;
3528- ropus_compute_theta (ctx , & sctx , X , Y , N , & b , B , B0 , LM , 0 , & fill );
3528+ ropus_compute_theta (ctx , & sctx , X , Y , N , & b , B , rp_B0 , LM , 0 , & fill );
35293529 imid = sctx .imid ;
35303530 iside = sctx .iside ;
35313531 delta = sctx .delta ;
@@ -3534,7 +3534,7 @@ static unsigned ropus_quant_partition(ropus_band_ctx *ctx, float *X,
35343534 (void )qalloc ;
35353535 mid = (1.f / 32768 ) * imid ;
35363536 side = (1.f / 32768 ) * iside ;
3537- if (B0 > 1 && (itheta & 0x3fff ))
3537+ if (rp_B0 > 1 && (itheta & 0x3fff ))
35383538 {
35393539 if (itheta > 8192 )
35403540 delta -= delta >> (4 - LM );
@@ -3556,12 +3556,12 @@ static unsigned ropus_quant_partition(ropus_band_ctx *ctx, float *X,
35563556 if (rebalance > 3 << ROPUS_BITRES && itheta != 0 )
35573557 sbits += rebalance - (3 << ROPUS_BITRES );
35583558 cm |= ropus_quant_partition (ctx , Y , N , sbits , B , next_lowband2 ,
3559- LM , gain * side , fill >> B ) << (B0 >> 1 );
3559+ LM , gain * side , fill >> B ) << (rp_B0 >> 1 );
35603560 }
35613561 else
35623562 {
35633563 cm = ropus_quant_partition (ctx , Y , N , sbits , B , next_lowband2 ,
3564- LM , gain * side , fill >> B ) << (B0 >> 1 );
3564+ LM , gain * side , fill >> B ) << (rp_B0 >> 1 );
35653565 rebalance = sbits - (rebalance - ctx -> remaining_bits );
35663566 if (rebalance > 3 << ROPUS_BITRES && itheta != 16384 )
35673567 mbits += rebalance - (3 << ROPUS_BITRES );
@@ -3630,21 +3630,21 @@ static unsigned ropus_quant_band(ropus_band_ctx *ctx, float *X,
36303630 int N0 = N ;
36313631 int N_B = N ;
36323632 int N_B0 ;
3633- int B0 = B ;
3633+ int rp_B0 = B ;
36343634 int time_divide = 0 ;
36353635 int recombine = 0 ;
36363636 int longBlocks ;
36373637 unsigned cm = 0 ;
36383638 int k , tf_change ;
36393639 tf_change = ctx -> tf_change ;
3640- longBlocks = B0 == 1 ;
3640+ longBlocks = rp_B0 == 1 ;
36413641 N_B = (int )((uint32_t )N_B / B );
36423642 if (N == 1 )
36433643 return ropus_quant_band_n1 (ctx , X , NULL , lowband_out );
36443644 if (tf_change > 0 )
36453645 recombine = tf_change ;
36463646 if (lowband_scratch && lowband
3647- && (recombine || ((N_B & 1 ) == 0 && tf_change < 0 ) || B0 > 1 ))
3647+ && (recombine || ((N_B & 1 ) == 0 && tf_change < 0 ) || rp_B0 > 1 ))
36483648 {
36493649 memcpy (lowband_scratch , lowband , N * sizeof (* lowband ));
36503650 lowband = lowband_scratch ;
@@ -3670,20 +3670,20 @@ static unsigned ropus_quant_band(ropus_band_ctx *ctx, float *X,
36703670 time_divide ++ ;
36713671 tf_change ++ ;
36723672 }
3673- B0 = B ;
3673+ rp_B0 = B ;
36743674 N_B0 = N_B ;
3675- if (B0 > 1 && lowband )
3675+ if (rp_B0 > 1 && lowband )
36763676 ropus_deinterleave_hadamard (lowband , N_B >> recombine ,
3677- B0 << recombine , longBlocks );
3677+ rp_B0 << recombine , longBlocks );
36783678
36793679 cm = ropus_quant_partition (ctx , X , N , b , B , lowband , LM , gain , fill );
36803680
36813681 /* resynthesis (always on for the decoder) */
3682- if (B0 > 1 )
3682+ if (rp_B0 > 1 )
36833683 ropus_interleave_hadamard (X , N_B >> recombine ,
3684- B0 << recombine , longBlocks );
3684+ rp_B0 << recombine , longBlocks );
36853685 N_B = N_B0 ;
3686- B = B0 ;
3686+ B = rp_B0 ;
36873687 for (k = 0 ; k < time_divide ; k ++ )
36883688 {
36893689 B >>= 1 ;
@@ -4154,9 +4154,12 @@ static INLINE __m128 ropus_mm_cmul(__m128 a, __m128 b)
41544154/* Load complexes t[0*step] and t[1*step] into one vector. */
41554155static INLINE __m128 ropus_mm_ld2c (const ropus_cpx * t , size_t step )
41564156{
4157- __m128d lo = _mm_load_sd ((const double * )t );
4158- __m128d hi = _mm_load_sd ((const double * )(t + step ));
4159- return _mm_castpd_ps (_mm_unpacklo_pd (lo , hi ));
4157+ /* 64-bit lane loads through __m128i, whose gcc/clang definition
4158+ * carries may_alias; loading through a plain double* would violate
4159+ * strict aliasing (the storage is float). */
4160+ __m128i lo = _mm_loadl_epi64 ((const __m128i * )t );
4161+ __m128i hi = _mm_loadl_epi64 ((const __m128i * )(t + step ));
4162+ return _mm_castsi128_ps (_mm_unpacklo_epi64 (lo , hi ));
41604163}
41614164
41624165/* (r, i) -> (i, r) per complex lane. */
@@ -5900,7 +5903,7 @@ static unsigned ropus_quant_partition_q(ropus_band_ctx *ctx, ropus_norm *X,
59005903 const uint8_t * cache ;
59015904 int q , curr_bits ;
59025905 int imid = 0 , iside = 0 ;
5903- int B0 = B ;
5906+ int rp_B0 = B ;
59045907 int16_t mid = 0 , side = 0 ;
59055908 unsigned cm = 0 ;
59065909 ropus_norm * Y = NULL ;
@@ -5922,7 +5925,7 @@ static unsigned ropus_quant_partition_q(ropus_band_ctx *ctx, ropus_norm *X,
59225925 if (B == 1 )
59235926 fill = (fill & 1 ) | (fill << 1 );
59245927 B = (B + 1 ) >> 1 ;
5925- ropus_compute_theta (ctx , & sctx , NULL , NULL , N , & b , B , B0 , LM ,
5928+ ropus_compute_theta (ctx , & sctx , NULL , NULL , N , & b , B , rp_B0 , LM ,
59265929 0 , & fill );
59275930 imid = sctx .imid ;
59285931 iside = sctx .iside ;
@@ -5931,7 +5934,7 @@ static unsigned ropus_quant_partition_q(ropus_band_ctx *ctx, ropus_norm *X,
59315934 qalloc = sctx .qalloc ;
59325935 mid = (int16_t )imid ;
59335936 side = (int16_t )iside ;
5934- if (B0 > 1 && (itheta & 0x3fff ))
5937+ if (rp_B0 > 1 && (itheta & 0x3fff ))
59355938 {
59365939 if (itheta > 8192 )
59375940 delta -= delta >> (4 - LM );
@@ -5954,13 +5957,13 @@ static unsigned ropus_quant_partition_q(ropus_band_ctx *ctx, ropus_norm *X,
59545957 sbits += rebalance - (3 << ROPUS_BITRES );
59555958 cm |= ropus_quant_partition_q (ctx , Y , N , sbits , B , next_lowband2 ,
59565959 LM , (int16_t )ROPUS_MULT16_16_P15 (gain , side ), fill >> B )
5957- << (B0 >> 1 );
5960+ << (rp_B0 >> 1 );
59585961 }
59595962 else
59605963 {
59615964 cm = ropus_quant_partition_q (ctx , Y , N , sbits , B , next_lowband2 ,
59625965 LM , (int16_t )ROPUS_MULT16_16_P15 (gain , side ), fill >> B )
5963- << (B0 >> 1 );
5966+ << (rp_B0 >> 1 );
59645967 rebalance = sbits - (rebalance - ctx -> remaining_bits );
59655968 if (rebalance > 3 << ROPUS_BITRES && itheta != 16384 )
59665969 mbits += rebalance - (3 << ROPUS_BITRES );
@@ -6030,21 +6033,21 @@ static unsigned ropus_quant_band_q(ropus_band_ctx *ctx, ropus_norm *X,
60306033 int N0 = N ;
60316034 int N_B = N ;
60326035 int N_B0 ;
6033- int B0 = B ;
6036+ int rp_B0 = B ;
60346037 int time_divide = 0 ;
60356038 int recombine = 0 ;
60366039 int longBlocks ;
60376040 unsigned cm = 0 ;
60386041 int k , tf_change ;
60396042 tf_change = ctx -> tf_change ;
6040- longBlocks = B0 == 1 ;
6043+ longBlocks = rp_B0 == 1 ;
60416044 N_B = (int )((uint32_t )N_B / B );
60426045 if (N == 1 )
60436046 return ropus_quant_band_n1_q (ctx , X , NULL , lowband_out );
60446047 if (tf_change > 0 )
60456048 recombine = tf_change ;
60466049 if (lowband_scratch && lowband
6047- && (recombine || ((N_B & 1 ) == 0 && tf_change < 0 ) || B0 > 1 ))
6050+ && (recombine || ((N_B & 1 ) == 0 && tf_change < 0 ) || rp_B0 > 1 ))
60486051 {
60496052 memcpy (lowband_scratch , lowband , N * sizeof (* lowband ));
60506053 lowband = lowband_scratch ;
@@ -6070,19 +6073,19 @@ static unsigned ropus_quant_band_q(ropus_band_ctx *ctx, ropus_norm *X,
60706073 time_divide ++ ;
60716074 tf_change ++ ;
60726075 }
6073- B0 = B ;
6076+ rp_B0 = B ;
60746077 N_B0 = N_B ;
6075- if (B0 > 1 && lowband )
6078+ if (rp_B0 > 1 && lowband )
60766079 ropus_deinterleave_hadamard_q (lowband , N_B >> recombine ,
6077- B0 << recombine , longBlocks );
6080+ rp_B0 << recombine , longBlocks );
60786081
60796082 cm = ropus_quant_partition_q (ctx , X , N , b , B , lowband , LM , gain , fill );
60806083
6081- if (B0 > 1 )
6084+ if (rp_B0 > 1 )
60826085 ropus_interleave_hadamard_q (X , N_B >> recombine ,
6083- B0 << recombine , longBlocks );
6086+ rp_B0 << recombine , longBlocks );
60846087 N_B = N_B0 ;
6085- B = B0 ;
6088+ B = rp_B0 ;
60866089 for (k = 0 ; k < time_divide ; k ++ )
60876090 {
60886091 B >>= 1 ;
0 commit comments