Issue in dft stereo at 32 kbps for residual spectral lines decoding
with 7b78b916 and this bitstream : [ltv_STEREO_32k.bit.32000.zip](/uploads/3a8916cb3ae06b6781cbb3d652545456/ltv_STEREO_32k.bit.32000.zip) and the command line : STEREO 32 bit syn As show un the figure below, a major problem can be seen in the synthesis. ![image](/uploads/6eb65cf300f35488d1705e52745998f3/image.png) After some debugging, it seems the problem come from that part of the code (in IVAS_Stereo_dft_dec_fx.c): ``` IF( I != ECSQ_GLOBAL_GAIN_INDEX_ALL_ZERO ) { ECSQ_init_instance_fx( &ecsq_inst, 0 /*dummy index*/, &range_uni_dec_state ); rc_uni_dec_init_fx( &range_uni_dec_state, bit_stream_side + *nb_bits, max_bits - *nb_bits ); hStereoDft->res_global_gain_fx = ECSQ_dequantize_gain_fx( I ); move32(); #ifdef DEBUGGING dbgwrite_txt( (const float *) ( &hStereoDft->res_global_gain_fx ), 1, "fixed_res_global_gain.txt", NULL ); #endif ecsq_inst.config_index = sub( shl( hStereoDft->res_cod_mode[k_offset], 1 ), 1 ); move16(); >>>>> ECSQ_decode( &ecsq_inst, hStereoDft->res_cod_line_max, dec ); >>>>> n_bits = rc_uni_dec_virtual_finish_fx( &range_uni_dec_state ); set_zero_fx( res_buf_fx, STEREO_DFT_N_8k ); FOR( Word16 c = 0; c < hStereoDft->res_cod_line_max; c++ ) { dec[c] = shl_sat( dec[c], 8 ); move16(); } ECSQ_dequantize_vector_fx( dec, hStereoDft->res_global_gain_fx, hStereoDft->res_cod_line_max, res_buf_fx ); #ifdef DEBUGGING dbgwrite_txt( (const float *) res_buf_fx, hStereoDft->res_cod_line_max, "fixed_res_buf.txt", NULL ); #endif } ``` ECSQ_decode( ..., ..., dec ); -> The last indice of dec is different between float and fix. n_bits = rc_uni_dec_virtual_finish_fx( ... ); -> here it is not the same function as float, but using the "float" doesn't solve the problem as the n_bits output is the same (and wrong compared to float) Given n_bits differs from float, it leads to a wrong bitstream decoding for the core decoder, which is likely the cause of the bad synthesis. This is happening at frame 2769. @multrus, @norvell, I'm not sure who knows more about ECSQ coding, please feel free to tag someone else
issue