Commit 1f033be2 authored by vaclav's avatar vaclav
Browse files

formatting around recent ISAR switches (LC3PLUS_LEA_COMPAT_BITRATES_48_6,...

formatting around recent ISAR switches (LC3PLUS_LEA_COMPAT_BITRATES_48_6, SPLIT_REND_POSE_CORRECTION_UNUSED_BITS)
parent 8597e17b
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1249,7 +1249,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
                                                          Cldfb_RealBuffer_Binaural,
                                                          Cldfb_ImagBuffer_Binaural,
                                                          max_band, pOutput, 1, !td_input, pcm_out_flag, ro_md_flag ) ) != IVAS_ERR_OK )

    {
        return error;
    }
+1 −1
Original line number Diff line number Diff line
@@ -195,8 +195,8 @@ ivas_error ISAR_LC3PLUS_DEC_Open(
            ISAR_LC3PLUS_DEC_Close( handle );
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" );
        }
#endif

#endif
        ( *handle )->selective_decoding_states[iCh]->has_skipped_a_frame = 0;
        ( *handle )->selective_decoding_states[iCh]->shall_decode_cached_frame = 0;
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
+1 −0
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ ivas_error ISAR_LC3PLUS_ENC_Open(
        for ( uint32_t iEnc = 0; iEnc < ( *handle )->num_encs; ++iEnc )
        {
            int32_t ftd_index = iEnc + iMediaTime * ( *handle )->num_encs;

#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
            ( *handle )->frame_type_descriptors[ftd_index].frame_data_length = 0; /* will be set to the correct value in IVAS_LC3PLUS_ENC_SetBitrate */
#else
+5 −5
Original line number Diff line number Diff line
@@ -239,7 +239,6 @@ void isar_split_rend_get_quant_params(
#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
    const int16_t ro_flag,
    int16_t *num_quant_strats

#else
    int16_t *num_quant_strats,
    int16_t *num_complex_bands
@@ -358,10 +357,11 @@ int32_t isar_get_lc3plus_bitrate(
#endif
#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6
int32_t isar_get_lc3plus_bitrate(
    const int32_t SplitRendBitRate,
    const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode,
    const int32_t nChannels,
    const int32_t codecFrameDurationUs );
    const int32_t SplitRendBitRate,                             /* i  : ISAR bitrate                            */
    const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, /* i  : ISAR pose correction mode            */
    const int32_t nChannels,                                    /* i  : number of channels                      */
    const int32_t lc3plus_frame_duration_us                     /* i  : ISAR frame length in us                 */
);
#endif

ivas_error isar_split_rend_validate_config(
+23 −6
Original line number Diff line number Diff line
@@ -495,6 +495,7 @@ static void isar_split_rend_quant_md(
            {
                hMd->pred_mat_re[ch1][ch1] = hMd->pred_mat_re2[ch1];
            }

            hMd->pred_mat_re[1][0] = 0.0f;
            hMd->pred_mat_re[0][1] = 0.0f;

@@ -572,12 +573,15 @@ static void isar_split_rend_quant_md(
    return;
}


#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
static void get_lr_gains( float cov_in[][BINAURAL_CHANNELS],
static void get_lr_gains(
    float cov_in[][BINAURAL_CHANNELS],
    float cov_out[][BINAURAL_CHANNELS],
    float gains[BINAURAL_CHANNELS] )
{
    int16_t i;

    for ( i = 0; i < BINAURAL_CHANNELS; i++ )
    {
        gains[i] = cov_in[i][i];
@@ -591,10 +595,12 @@ static void get_lr_gains( float cov_in[][BINAURAL_CHANNELS],
            gains[i] = sqrtf( gains[i] );
        }
    }

    return;
}
#endif


static void ComputeCoeffs(
    float cov_ii_re[][BINAURAL_CHANNELS],
    float cov_ii_im[][BINAURAL_CHANNELS],
@@ -617,6 +623,7 @@ static void ComputeCoeffs(
    if ( pose_type == PITCH_ONLY )
    {
        float gd_tmp[BINAURAL_CHANNELS];

#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
        get_lr_gains( cov_ii_re, cov_oo_re, gd_tmp );
#else
@@ -634,6 +641,7 @@ static void ComputeCoeffs(
            }
        }
#endif

        hMd->gd = gd_tmp[0];
        hMd->gd2 = gd_tmp[1];
    }
@@ -642,8 +650,10 @@ static void ComputeCoeffs(
        if ( real_only )
        {
            float gd_tmp[BINAURAL_CHANNELS];

#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
            get_lr_gains( cov_ii_re, cov_oo_re, gd_tmp );

            for ( i = 0; i < BINAURAL_CHANNELS; i++ )
            {
                hMd->pred_mat_re[i][i] = gd_tmp[i];
@@ -667,6 +677,7 @@ static void ComputeCoeffs(
                set_zero( hMd->pred_mat_im[i], BINAURAL_CHANNELS );
            }
#endif

            hMd->pred_mat_re[1][0] = 0.0f;
            hMd->pred_mat_re[0][1] = 0.0f;
        }
@@ -675,6 +686,7 @@ static void ComputeCoeffs(
#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
            get_lr_gains( cov_ii_re, cov_oo_re, hMd->pred_mat_re2 );
#endif

            cov_norm_fact = GetNormFact( cov_ii_re, cov_ii_im, cov_io_re, cov_io_im, cov_oo_re );

            /* normalize the covariance */
@@ -903,7 +915,6 @@ static void isar_SplitRenderer_code_md_base2(
                    }
                }
#else

                for ( b = 0; b < pred_imag_bands_yaw; b++ )
                {
                    hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b];
@@ -936,6 +947,7 @@ static void isar_SplitRenderer_code_md_base2(
                    }
                }
#endif

                for ( b = 0; b < d_bands_yaw; b++ )
                {
                    hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b];
@@ -1270,9 +1282,10 @@ static void isar_SplitRenderer_quant_code(
    const ISAR_SPLIT_REND_BITS_HANDLE pBits,                    /* i/o: ISAR bits handle                */
    const int16_t low_res_pre_rend_rot,                         /* i  : low time resolution pre-renderer flag   */
#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
    const int16_t ro_md_flag,
    const int16_t ro_md_flag, /* i  : real only metadata for yaw flag */
#endif
    const int32_t target_md_bits )
    const int32_t target_md_bits /* i  : ISAR MD bitrate                 */
)
{
#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
    int16_t q, num_subframes, sf_idx, pos_idx, b, num_quant_strats;
@@ -1305,12 +1318,14 @@ static void isar_SplitRenderer_quant_code(

    ISAR_SPLIT_REND_BITStream_write_int32( pBits, pMultiBinPoseData->dof, ISAR_SPLIT_REND_DOF_BITS );
    ISAR_SPLIT_REND_BITStream_write_int32( pBits, pMultiBinPoseData->hq_mode, ISAR_SPLIT_REND_HQ_MODE_BITS );

#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
    rot_axis_code = isar_renderSplitGetCodeFromRot_axis( pMultiBinPoseData->dof, pMultiBinPoseData->rot_axis, &num_bits );
    if ( num_bits > 0 )
    {
        ISAR_SPLIT_REND_BITStream_write_int32( pBits, (int32_t) rot_axis_code, num_bits );
    }

    ISAR_SPLIT_REND_BITStream_write_int32( pBits, (int32_t) ro_md_flag, ISAR_SPLIT_REND_RO_FLAG_BITS );
#else
    ISAR_SPLIT_REND_BITStream_write_int32( pBits, (int32_t) pMultiBinPoseData->rot_axis, ISAR_SPLIT_REND_ROT_AXIS_BITS );
@@ -1346,6 +1361,7 @@ static void isar_SplitRenderer_quant_code(
                                      pred_quant_pnts_yaw, pred_quantstep_yaw, pred_1byquantstep_yaw,
                                      d_bands_yaw, bands_pitch, pred_real_bands_roll, pred_imag_bands_roll, &num_quant_strats, &num_complex_bands );
#endif

    quant_strat_bits = (int32_t) ceilf( log2f( num_quant_strats ) );

    overhead_bits = pBits->bits_written - overhead_bits + quant_strat_bits + 1; /* 1 for base2 vs huff */
@@ -2246,6 +2262,7 @@ ivas_error isar_renderMultiTDBinToSplitBinaural(
#else
            available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written;
#endif

            if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, available_bits, in ) ) != IVAS_ERR_OK )
#else
            if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, in ) ) != IVAS_ERR_OK )
Loading