Loading lib_dec/ivas_dirac_dec.c +43 −4 Original line number Diff line number Diff line Loading @@ -1297,18 +1297,19 @@ void ivas_dirac_dec_read_BS( b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; #ifndef ALIGN_SID_SIZE if ( sba_mode == SBA_MODE_SPAR ) { #ifdef ALIGN_SID_SIZE if ( ivas_total_brate == IVAS_SID_5k2 ) #else if ( ivas_total_brate == IVAS_SID_5k ) #endif { b = 1; } } else #else if ( sba_mode != SBA_MODE_SPAR ) #endif { assert( ( b == 0 ) || ( hQMetaData->q_direction[0].cfg.start_band > 0 ) ); } Loading Loading @@ -1406,6 +1407,13 @@ void ivas_dirac_dec_read_BS( /* subtract mode signaling bits, since bitstream was moved after mode reading */ st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); #ifdef ALIGN_SID_SIZE /* 1 bit flag for SPAR/DirAC, already read in read format function */ b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; hQMetaData->sba_inactive_mode = 1; orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; #endif /* if we start with a SID frame, we need to init the azi/ele arrays.*/ if ( st->ini_frame == 0 ) Loading @@ -1420,8 +1428,39 @@ void ivas_dirac_dec_read_BS( } } #ifdef ALIGN_SID_SIZE *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT, sba_mode ); if ( sba_mode == SBA_MODE_SPAR ) { for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; } for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { for ( j = orig_dirac_bands - 2; j >= 0; j-- ) { hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; } } hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; } else { *nb_bits += SID_FORMAT_NBITS; } #else *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT, SBA_MODE_DIRAC ); *nb_bits += SID_FORMAT_NBITS; #endif st->next_bit_pos = next_bit_pos_orig; } Loading lib_dec/ivas_init_dec.c +27 −7 Original line number Diff line number Diff line Loading @@ -418,15 +418,34 @@ static ivas_error ivas_read_format( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); } #ifdef ALIGN_SID_SIZE if ( st_ivas->ivas_format == SBA_FORMAT ) { int16_t tc_mode_offset; tc_mode_offset = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); idx = st_ivas->bit_stream[tc_mode_offset]; // TBD: needs more work for HOA if ( st_ivas->sba_analysis_order == 0 ) { st_ivas->sba_analysis_order = 1; } if ( idx == 1 ) { st_ivas->sba_mode = SBA_MODE_SPAR; } else { st_ivas->sba_mode = SBA_MODE_DIRAC; } } #endif /* reset bitstream handle to avoid BER detection after reading the 2400 kbps for ch0 */ st_ivas->bit_stream += ( *num_bits_read ); ( *num_bits_read ) = 0; } #ifdef ALIGN_SID_SIZE else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) #else #ifndef ALIGN_SID_SIZE else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k ) #endif { int16_t tc_mode_offset; tc_mode_offset = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); Loading @@ -453,6 +472,7 @@ static ivas_error ivas_read_format( st_ivas->element_mode_init = IVAS_CPE_MDCT; } } #endif else { /* In SID/NO_DATA frames, use the previous frame IVAS format */ Loading lib_dec/ivas_qmetadata_dec.c +8 −5 Original line number Diff line number Diff line Loading @@ -871,11 +871,14 @@ int16_t ivas_qmetadata_dec_sid_decode( { if ( sba_mode == SBA_MODE_SPAR ) { metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ #if 0 /*This would break BE for SPAR modes, hence disabling it for now*/ metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ #endif } else { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - 1; /* -1 for spar/dirac indicator*/ } } else Loading lib_dec/ivas_spar_decoder.c +17 −0 Original line number Diff line number Diff line Loading @@ -241,6 +241,12 @@ ivas_error ivas_spar_dec( next_bit_pos_orig = st0->next_bit_pos; last_bit_pos = (int16_t) ( ( hDecoderConfig->ivas_total_brate / FRAMES_PER_SEC ) - 1 ); #ifdef ALIGN_SID_SIZE if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) { last_bit_pos -= SID_FORMAT_NBITS; } #endif nb_bits_read_orig = *nb_bits_read; last_bit_pos -= nb_bits_read_orig; Loading @@ -260,6 +266,17 @@ ivas_error ivas_spar_dec( st0->bit_stream = bit_stream_orig; st0->next_bit_pos = next_bit_pos_orig; #ifdef ALIGN_SID_SIZE if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) { int16_t zero_pad_bits; *nb_bits_read += SID_FORMAT_NBITS; zero_pad_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - *nb_bits_read; assert( zero_pad_bits <= 1 ); *nb_bits_read += zero_pad_bits; } #endif wmops_sub_end(); return error; Loading lib_enc/ivas_dirac_enc.c +4 −0 Original line number Diff line number Diff line Loading @@ -429,6 +429,10 @@ void ivas_dirac_enc( } else { #ifdef ALIGN_SID_SIZE /*indicate whether SPAR or DiRAC mode*/ push_next_indice( hMetaData, 0, 1 ); #endif /* encode SID parameters */ ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT, Loading Loading
lib_dec/ivas_dirac_dec.c +43 −4 Original line number Diff line number Diff line Loading @@ -1297,18 +1297,19 @@ void ivas_dirac_dec_read_BS( b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; #ifndef ALIGN_SID_SIZE if ( sba_mode == SBA_MODE_SPAR ) { #ifdef ALIGN_SID_SIZE if ( ivas_total_brate == IVAS_SID_5k2 ) #else if ( ivas_total_brate == IVAS_SID_5k ) #endif { b = 1; } } else #else if ( sba_mode != SBA_MODE_SPAR ) #endif { assert( ( b == 0 ) || ( hQMetaData->q_direction[0].cfg.start_band > 0 ) ); } Loading Loading @@ -1406,6 +1407,13 @@ void ivas_dirac_dec_read_BS( /* subtract mode signaling bits, since bitstream was moved after mode reading */ st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); #ifdef ALIGN_SID_SIZE /* 1 bit flag for SPAR/DirAC, already read in read format function */ b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; hQMetaData->sba_inactive_mode = 1; orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; #endif /* if we start with a SID frame, we need to init the azi/ele arrays.*/ if ( st->ini_frame == 0 ) Loading @@ -1420,8 +1428,39 @@ void ivas_dirac_dec_read_BS( } } #ifdef ALIGN_SID_SIZE *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT, sba_mode ); if ( sba_mode == SBA_MODE_SPAR ) { for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; } for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { for ( j = orig_dirac_bands - 2; j >= 0; j-- ) { hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; } } hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; } else { *nb_bits += SID_FORMAT_NBITS; } #else *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT, SBA_MODE_DIRAC ); *nb_bits += SID_FORMAT_NBITS; #endif st->next_bit_pos = next_bit_pos_orig; } Loading
lib_dec/ivas_init_dec.c +27 −7 Original line number Diff line number Diff line Loading @@ -418,15 +418,34 @@ static ivas_error ivas_read_format( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); } #ifdef ALIGN_SID_SIZE if ( st_ivas->ivas_format == SBA_FORMAT ) { int16_t tc_mode_offset; tc_mode_offset = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); idx = st_ivas->bit_stream[tc_mode_offset]; // TBD: needs more work for HOA if ( st_ivas->sba_analysis_order == 0 ) { st_ivas->sba_analysis_order = 1; } if ( idx == 1 ) { st_ivas->sba_mode = SBA_MODE_SPAR; } else { st_ivas->sba_mode = SBA_MODE_DIRAC; } } #endif /* reset bitstream handle to avoid BER detection after reading the 2400 kbps for ch0 */ st_ivas->bit_stream += ( *num_bits_read ); ( *num_bits_read ) = 0; } #ifdef ALIGN_SID_SIZE else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) #else #ifndef ALIGN_SID_SIZE else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k ) #endif { int16_t tc_mode_offset; tc_mode_offset = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); Loading @@ -453,6 +472,7 @@ static ivas_error ivas_read_format( st_ivas->element_mode_init = IVAS_CPE_MDCT; } } #endif else { /* In SID/NO_DATA frames, use the previous frame IVAS format */ Loading
lib_dec/ivas_qmetadata_dec.c +8 −5 Original line number Diff line number Diff line Loading @@ -871,11 +871,14 @@ int16_t ivas_qmetadata_dec_sid_decode( { if ( sba_mode == SBA_MODE_SPAR ) { metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ #if 0 /*This would break BE for SPAR modes, hence disabling it for now*/ metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ #endif } else { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - 1; /* -1 for spar/dirac indicator*/ } } else Loading
lib_dec/ivas_spar_decoder.c +17 −0 Original line number Diff line number Diff line Loading @@ -241,6 +241,12 @@ ivas_error ivas_spar_dec( next_bit_pos_orig = st0->next_bit_pos; last_bit_pos = (int16_t) ( ( hDecoderConfig->ivas_total_brate / FRAMES_PER_SEC ) - 1 ); #ifdef ALIGN_SID_SIZE if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) { last_bit_pos -= SID_FORMAT_NBITS; } #endif nb_bits_read_orig = *nb_bits_read; last_bit_pos -= nb_bits_read_orig; Loading @@ -260,6 +266,17 @@ ivas_error ivas_spar_dec( st0->bit_stream = bit_stream_orig; st0->next_bit_pos = next_bit_pos_orig; #ifdef ALIGN_SID_SIZE if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) { int16_t zero_pad_bits; *nb_bits_read += SID_FORMAT_NBITS; zero_pad_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - *nb_bits_read; assert( zero_pad_bits <= 1 ); *nb_bits_read += zero_pad_bits; } #endif wmops_sub_end(); return error; Loading
lib_enc/ivas_dirac_enc.c +4 −0 Original line number Diff line number Diff line Loading @@ -429,6 +429,10 @@ void ivas_dirac_enc( } else { #ifdef ALIGN_SID_SIZE /*indicate whether SPAR or DiRAC mode*/ push_next_indice( hMetaData, 0, 1 ); #endif /* encode SID parameters */ ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT, Loading