Corrupted accumulation in reduce_metadata_further_fx
Basic info
- Float reference:
- Encoder (float): 2a32cceaf0d7ce3482cb05e5c12951e95a8a552a
- Decoder (float):
- Fixed point:
- Encoder (fixed): a8ff39cd
- Decoder (fixed):
Bug description
A temp variable is not reset properly in reduce_metadata_further_fx which causes wrong accumulation and corruption. See below:
Float
for ( band = 0; band < numCodingBands; band++ )
{
xSum = 0.0f;
ySum = 0.0f;
zSum = 0.0f;
bandSumEnergy = 0.0f;
for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ )
{
bandSumEnergy += energy[sf][band];
}
spreadCoh[0] = (uint8_t) roundf( spreadCohSum / ( bandSumEnergy + EPSILON ) * 255.0f );
}
BASOP
W_tmp = 0; <== BUG as reset does not happen properly
move64();
FOR( band = 0; band < numCodingBands; band++ )
{
xSum = 0; ySum = 0; zSum = 0;
bandSumEnergy = 0;
move32(); move32(); move32(); move32();
FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ )
{
...
W_tmp = W_add( W_tmp, energy[sf][band] );
}
tmp2 = W_norm( W_tmp );
tmp2 = s_min( 32, tmp2 );
bandSumEnergy = W_extract_h( W_shl( W_tmp, tmp2 ) );
...
W_xSum_sq = W_mult0_32_32( xSum, xSum );
W_ySum_sq = W_mult0_32_32( ySum, ySum );
W_tmp = W_add( W_xSum_sq, W_ySum_sq );
...
tmp = BASOP_Util_Divide3232_Scale( spreadCohSum, bandSumEnergy, &exp );
}
Edited by Tapani Pihlajakuja