Loading lib_enc/ivas_qmetadata_enc_fx.c +79 −3 Original line number Diff line number Diff line Loading @@ -243,7 +243,33 @@ ivas_error ivas_qmetadata_enc_encode_fx( Word16 ind_order[MASA_MAXIMUM_CODING_SUBBANDS]; Word16 reduce_bits; ivas_error error; #ifdef DEBUG_MODE_QMETADATA int16_t ec_flag = 0; int16_t tmp; static FILE *pF = NULL; static FILE *pF_azi = NULL; static FILE *pF_ele = NULL; static FILE *pF_ratio = NULL; static FILE *pF_spcoh = NULL; static FILE *pF_spcoh_orig = NULL; static FILE *pF_surcoh = NULL; if ( pF == NULL ) pF = fopen( "./res/qmetadata_enc.txt", "w" ); if ( pF_azi == NULL ) pF_azi = fopen( "./res/qmetadata_azi_enc.txt", "w" ); if ( pF_ele == NULL ) pF_ele = fopen( "./res/qmetadata_ele_enc.txt", "w" ); if ( pF_ratio == NULL ) pF_ratio = fopen( "./res/qmetadata_ratio_enc.txt", "w" ); if ( pF_spcoh == NULL ) pF_spcoh = fopen( "./res/qmetadata_spcoh_enc.txt", "w" ); if ( pF_spcoh_orig == NULL ) pF_spcoh_orig = fopen( "./res/qmetadata_spcoh_orig.txt", "w" ); if ( pF_surcoh == NULL ) pF_surcoh = fopen( "./res/qmetadata_surcoh_enc.txt", "w" ); #endif error = IVAS_ERR_OK; move32(); Loading Loading @@ -519,9 +545,14 @@ ivas_error ivas_qmetadata_enc_encode_fx( bits_ec = ivas_qmetadata_raw_encode_dir_fx( hMetaData, q_direction, q_direction->cfg.nbands, q_direction->cfg.start_band ); } bits_dir[d] = add( bits_ec, 1 ); #ifdef DEBUG_MODE_QMETADATA tmp = bits_dir[d] - ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signaling[d] ) ); #endif move16(); extra_bits = sub( hQMetaData->metadata_max_bits, sub( hMetaData->nb_bits_tot, bit_pos_0 ) ); #ifdef DEBUG_MODE_QMETADATA ec_flag = 0; #endif /* Encode quantized directions with EC band-wise */ test(); test(); Loading Loading @@ -588,7 +619,9 @@ ivas_error ivas_qmetadata_enc_encode_fx( extra_bits = sub( hQMetaData->metadata_max_bits, sub( hMetaData->nb_bits_tot, bit_pos_0 ) ); } #ifdef DEBUG_MODE_QMETADATA ec_flag = 1; #endif /* Requantized directions */ test(); IF( LE_16( add( total_bits_1dir, bits_surround_coh ), hQMetaData->qmetadata_max_bit_req ) && GT_16( add( add( add( bits_dir[d], bits_diff[d] ), bits_coherence[d] ), bits_signaling[d] ), total_bits_1dir ) ) Loading Loading @@ -638,6 +671,9 @@ ivas_error ivas_qmetadata_enc_encode_fx( requantize_direction_EC_3_fx( &extra_bits, q_direction, nbands, hMetaData, elevation_orig, azimuth_orig, ind_order ); bits_dir[d] = sub( hMetaData->nb_bits_tot, bits_dir[d] ); move16(); #ifdef DEBUG_MODE_QMETADATA ec_flag = 2; #endif } /* finalize writing coherence */ Loading @@ -658,7 +694,47 @@ ivas_error ivas_qmetadata_enc_encode_fx( { total_bits_1dir = sub( hQMetaData->metadata_max_bits, sub( hMetaData->nb_bits_tot, bit_pos_0 ) ); } #ifdef DEBUG_MODE_QMETADATA int m, b; FOR( d = 0; d < hQMetaData->no_directions; d++ ) { fprintf( pF, "diff %d ", bits_diff_sum ); /* fprintf( pF_azi, "/dir/ec %d: ", d ); */ fprintf( pF_azi, "%d ", 200 * ( d + 1 ) ); fprintf( pF_ele, "/dir/ec %d: ", d ); fprintf( pF_spcoh, "/dir %d: ", d ); fprintf( pF_ratio, "/dir %d: ", d ); for ( b = hQMetaData->q_direction[d].cfg.start_band; b < hQMetaData->q_direction[d].cfg.nbands; b++ ) { for ( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) { fprintf( pF_azi, " %+5.0f ", (int16_t) ( 100.f * hQMetaData->q_direction[d].band_data[b].azimuth_fx[m] / ( (float) 4194304.0f ) ) / 100.f ); fprintf( pF_azi, " %+5.0f ", (int16_t) ( 100.f * azimuth_orig[b][m] / ( (float) 4194304.0f ) ) / 100.f ); fprintf( pF_ele, " %+5.2f ", (int16_t) ( 100.f * hQMetaData->q_direction[d].band_data[b].elevation_fx[m] / ( (float) 4194304.0f ) ) / 100.f ); fprintf( pF_ratio, " %1.3f ", hQMetaData->q_direction[d].band_data[b].energy_ratio_fx[m] / ( (float) 1073741824.0f ) ); if ( hQMetaData->q_direction[d].coherence_band_data != NULL ) { fprintf( pF_spcoh, " %d ", hQMetaData->q_direction[d].coherence_band_data[b].spread_coherence[m] ); } if ( d == 0 && hQMetaData->surcoh_band_data != NULL ) { fprintf( pF_surcoh, " %d ", hQMetaData->surcoh_band_data[b].surround_coherence[m] ); } } } /* if ( d > 0 || hQMetaData->no_directions == 1 ) */ fprintf( pF_azi, "\n" ); fprintf( pF_ele, "\n" ); fprintf( pF_ratio, "\n" ); fprintf( pF_spcoh, "\n" ); } #endif /* Save quantized DOAs */ FOR( i = start_band; i < nbands; i++ ) { Loading Loading
lib_enc/ivas_qmetadata_enc_fx.c +79 −3 Original line number Diff line number Diff line Loading @@ -243,7 +243,33 @@ ivas_error ivas_qmetadata_enc_encode_fx( Word16 ind_order[MASA_MAXIMUM_CODING_SUBBANDS]; Word16 reduce_bits; ivas_error error; #ifdef DEBUG_MODE_QMETADATA int16_t ec_flag = 0; int16_t tmp; static FILE *pF = NULL; static FILE *pF_azi = NULL; static FILE *pF_ele = NULL; static FILE *pF_ratio = NULL; static FILE *pF_spcoh = NULL; static FILE *pF_spcoh_orig = NULL; static FILE *pF_surcoh = NULL; if ( pF == NULL ) pF = fopen( "./res/qmetadata_enc.txt", "w" ); if ( pF_azi == NULL ) pF_azi = fopen( "./res/qmetadata_azi_enc.txt", "w" ); if ( pF_ele == NULL ) pF_ele = fopen( "./res/qmetadata_ele_enc.txt", "w" ); if ( pF_ratio == NULL ) pF_ratio = fopen( "./res/qmetadata_ratio_enc.txt", "w" ); if ( pF_spcoh == NULL ) pF_spcoh = fopen( "./res/qmetadata_spcoh_enc.txt", "w" ); if ( pF_spcoh_orig == NULL ) pF_spcoh_orig = fopen( "./res/qmetadata_spcoh_orig.txt", "w" ); if ( pF_surcoh == NULL ) pF_surcoh = fopen( "./res/qmetadata_surcoh_enc.txt", "w" ); #endif error = IVAS_ERR_OK; move32(); Loading Loading @@ -519,9 +545,14 @@ ivas_error ivas_qmetadata_enc_encode_fx( bits_ec = ivas_qmetadata_raw_encode_dir_fx( hMetaData, q_direction, q_direction->cfg.nbands, q_direction->cfg.start_band ); } bits_dir[d] = add( bits_ec, 1 ); #ifdef DEBUG_MODE_QMETADATA tmp = bits_dir[d] - ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signaling[d] ) ); #endif move16(); extra_bits = sub( hQMetaData->metadata_max_bits, sub( hMetaData->nb_bits_tot, bit_pos_0 ) ); #ifdef DEBUG_MODE_QMETADATA ec_flag = 0; #endif /* Encode quantized directions with EC band-wise */ test(); test(); Loading Loading @@ -588,7 +619,9 @@ ivas_error ivas_qmetadata_enc_encode_fx( extra_bits = sub( hQMetaData->metadata_max_bits, sub( hMetaData->nb_bits_tot, bit_pos_0 ) ); } #ifdef DEBUG_MODE_QMETADATA ec_flag = 1; #endif /* Requantized directions */ test(); IF( LE_16( add( total_bits_1dir, bits_surround_coh ), hQMetaData->qmetadata_max_bit_req ) && GT_16( add( add( add( bits_dir[d], bits_diff[d] ), bits_coherence[d] ), bits_signaling[d] ), total_bits_1dir ) ) Loading Loading @@ -638,6 +671,9 @@ ivas_error ivas_qmetadata_enc_encode_fx( requantize_direction_EC_3_fx( &extra_bits, q_direction, nbands, hMetaData, elevation_orig, azimuth_orig, ind_order ); bits_dir[d] = sub( hMetaData->nb_bits_tot, bits_dir[d] ); move16(); #ifdef DEBUG_MODE_QMETADATA ec_flag = 2; #endif } /* finalize writing coherence */ Loading @@ -658,7 +694,47 @@ ivas_error ivas_qmetadata_enc_encode_fx( { total_bits_1dir = sub( hQMetaData->metadata_max_bits, sub( hMetaData->nb_bits_tot, bit_pos_0 ) ); } #ifdef DEBUG_MODE_QMETADATA int m, b; FOR( d = 0; d < hQMetaData->no_directions; d++ ) { fprintf( pF, "diff %d ", bits_diff_sum ); /* fprintf( pF_azi, "/dir/ec %d: ", d ); */ fprintf( pF_azi, "%d ", 200 * ( d + 1 ) ); fprintf( pF_ele, "/dir/ec %d: ", d ); fprintf( pF_spcoh, "/dir %d: ", d ); fprintf( pF_ratio, "/dir %d: ", d ); for ( b = hQMetaData->q_direction[d].cfg.start_band; b < hQMetaData->q_direction[d].cfg.nbands; b++ ) { for ( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) { fprintf( pF_azi, " %+5.0f ", (int16_t) ( 100.f * hQMetaData->q_direction[d].band_data[b].azimuth_fx[m] / ( (float) 4194304.0f ) ) / 100.f ); fprintf( pF_azi, " %+5.0f ", (int16_t) ( 100.f * azimuth_orig[b][m] / ( (float) 4194304.0f ) ) / 100.f ); fprintf( pF_ele, " %+5.2f ", (int16_t) ( 100.f * hQMetaData->q_direction[d].band_data[b].elevation_fx[m] / ( (float) 4194304.0f ) ) / 100.f ); fprintf( pF_ratio, " %1.3f ", hQMetaData->q_direction[d].band_data[b].energy_ratio_fx[m] / ( (float) 1073741824.0f ) ); if ( hQMetaData->q_direction[d].coherence_band_data != NULL ) { fprintf( pF_spcoh, " %d ", hQMetaData->q_direction[d].coherence_band_data[b].spread_coherence[m] ); } if ( d == 0 && hQMetaData->surcoh_band_data != NULL ) { fprintf( pF_surcoh, " %d ", hQMetaData->surcoh_band_data[b].surround_coherence[m] ); } } } /* if ( d > 0 || hQMetaData->no_directions == 1 ) */ fprintf( pF_azi, "\n" ); fprintf( pF_ele, "\n" ); fprintf( pF_ratio, "\n" ); fprintf( pF_spcoh, "\n" ); } #endif /* Save quantized DOAs */ FOR( i = start_band; i < nbands; i++ ) { Loading