Commit ebba4b0e authored by TYAGIRIS's avatar TYAGIRIS
Browse files

keep dirac SID bits same when num TC is 2

parent 45d3dfa4
Loading
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -3207,6 +3207,9 @@ void ivas_qmetadata_enc_sid_encode(
    BSTR_ENC_HANDLE hMetaData,                                  /* i/o: metadata bitstream handle               */
    IVAS_QMETADATA *q_metadata,                                 /* i/o: metadata handle                         */
    const int16_t masa_sid_descriptor,                          /* i  : description of MASA SID coding structure*/
#ifdef NONBE_FIX_1052_SBA_EXT
    const int16_t nchan_transport, /* i  : number of transport channels                             */
#endif
	const int16_t ivas_format                                   /* i  : ivas format                             */
);

@@ -3515,6 +3518,13 @@ int16_t ivas_sba_get_nchan_metadata(
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                      */
);

#ifdef NONBE_FIX_1052_SBA_EXT
/*! r: number of bits in SPAR SID frame */
int16_t ivas_sba_spar_sid_bitlen(
    const int16_t nchan_transport /* i  : number of transport channels            */
);
#endif

void ivas_sba_get_spar_hoa_ch_ind(
    const int16_t num_md_chs,                                   /* i  : number of MD channels                   */
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                      */
@@ -3616,6 +3626,9 @@ ivas_error ivas_dirac_enc(
    const int16_t input_frame,                                  /* i  : input frame length                      */
    const int16_t dtx_vad,                                      /* i  : DTX vad flag                            */
    const IVAS_FORMAT ivas_format,                              /* i  : ivas format                             */
#ifdef NONBE_FIX_1052_SBA_EXT
    const int16_t nchan_transport,                              /* i  : number of transport channels                             */
#endif
	const int16_t hodirac_flag                                  /* i  : hodirac flag                            */
);

@@ -3671,6 +3684,9 @@ void ivas_dirac_dec_read_BS(
    int16_t *nb_bits,                                           /* o  : number of bits read                     */
    const int16_t last_bit_pos,                                 /* i  : last read bitstream position            */
    const int16_t hodirac_flag,                                 /* i  : flag to indicate HO-DirAC mode          */
	#ifdef NONBE_FIX_1052_SBA_EXT
    const int16_t nchan_transport,                              /* i  : number of transport channels                             */
#endif
    int16_t *dirac_to_spar_md_bands                             /* o  : DirAC->SPAR MD bands                    */
);

+23 −0
Original line number Diff line number Diff line
@@ -158,6 +158,29 @@ int16_t ivas_sba_get_nchan(
    return ( nb_channels );
}

#ifdef NONBE_FIX_1052_SBA_EXT
/*-------------------------------------------------------------------*
 * ivas_sba_spar_sid_bitlen()
 *
 * Get number of bits in SPAR SID frame
 *-------------------------------------------------------------------*/

/*! r: number of bits in SPAR SID frame */
int16_t ivas_sba_spar_sid_bitlen(
    const int16_t nchan_transport /* i  : number of transport channels            */
)
{
    int16_t num_bits;

    num_bits = SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND;
    if ( nchan_transport > 1 )
    {
        num_bits -= 2;
    }

    return num_bits;
}
#endif

/*-------------------------------------------------------------------*
 * ivas_sba_get_nchan_metadata()
+13 −1
Original line number Diff line number Diff line
@@ -1001,6 +1001,9 @@ void ivas_dirac_dec_read_BS(
    int16_t *nb_bits,                                     /* o  : number of bits read             */
    const int16_t last_bit_pos,                           /* i  : last read bitstream position    */
    const int16_t hodirac_flag,                           /* i  : flag to indicate HO-DirAC mode  */
#ifdef NONBE_FIX_1052_SBA_EXT
    const int16_t nchan_transport, /* i  : number of transport channels                             */
#endif
    int16_t *dirac_to_spar_md_bands /* o  : DirAC->SPAR MD bands            */
)
{
@@ -1034,7 +1037,12 @@ void ivas_dirac_dec_read_BS(
                }
            }

#ifdef NONBE_FIX_1052_SBA_EXT
            *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT );
#else
            *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT );
#endif

            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];
@@ -1106,7 +1114,11 @@ void ivas_dirac_dec_read_BS(
            }
        }

#ifdef NONBE_FIX_1052_SBA_EXT
        *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT );
#else
        *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT );
#endif
        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];
+5 −1
Original line number Diff line number Diff line
@@ -1203,6 +1203,9 @@ int16_t ivas_qmetadata_dec_sid_decode(
    float direction_vector[3];
    int16_t metadata_sid_bits; /* bits allocated to SID for metadata */
    int16_t bits_delta, bits_dir;
#ifdef NONBE_FIX_1052_SBA_EXT
    int16_t sba_spar_bitlen;
#endif
#ifdef DEBUG_MODE_QMETADATA
    static FILE *pF = NULL;
    static FILE *pF_azi = NULL;
@@ -1222,7 +1225,8 @@ int16_t ivas_qmetadata_dec_sid_decode(
    if ( ivas_format == SBA_FORMAT )
    {
#ifdef NONBE_FIX_1052_SBA_EXT
        metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/
        sba_spar_bitlen = ivas_sba_spar_sid_bitlen( nchan_transport );
        metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - sba_spar_bitlen - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/
#else
        metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/
#endif
+4 −0
Original line number Diff line number Diff line
@@ -354,7 +354,11 @@ ivas_error ivas_spar_dec(
    /* read DirAC bitstream */
    if ( st_ivas->hQMetaData != NULL )
    {
#ifdef NONBE_FIX_1052_SBA_EXT
        ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, last_bit_pos, ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->nchan_transport, st_ivas->hSpar->dirac_to_spar_md_bands );
#else
        ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, last_bit_pos, ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands );
#endif
    }

    if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
Loading