Commit 7723c19a authored by sagnowski's avatar sagnowski
Browse files

Clean up writing of pose correction bits

parent 398094df
Loading
Loading
Loading
Loading
+3 −39
Original line number Diff line number Diff line
@@ -1844,29 +1844,6 @@ ivas_error splitRendLc3plusEncodeAndWrite(
    return IVAS_ERR_OK;
}

#ifdef LC3PLUS_RTP_PAYLOAD_FORMAT
static void write_pose_correction_section( SPLIT_REND_WRAPPER *hSplitBin,
                                           const IVAS_QUATERNION headPosition,
                                           const int32_t SplitRendBitRate,
                                           ISAR_SPLIT_REND_BITS_HANDLE pBits,
                                           float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
                                           float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
                                           const int16_t low_res_pre_rend_rot,
                                           const int16_t pcm_out_flag,
                                           const int16_t ro_md_flag )
{
    int32_t available_md_bits;
    available_md_bits = isar_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out_flag ) * L_FRAME48k / 48000;

    /* Write pose correction metadata */
    if ( hSplitBin->multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
    {
        isar_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPosition, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, available_md_bits, low_res_pre_rend_rot, ro_md_flag );
    }
}
#endif


/*-------------------------------------------------------------------------
 * Function isar_renderMultiTDBinToSplitBinaural()
 *
@@ -1890,7 +1867,7 @@ ivas_error isar_renderMultiTDBinToSplitBinaural(
{
    ivas_error error;
#ifdef LC3PLUS_RTP_PAYLOAD_FORMAT
    int32_t bit_len, available_bits;
    int32_t bit_len, available_bits, target_md_bits;
#else
    int32_t bit_len, available_bits, target_md_bits, actual_md_bits;
#endif
@@ -1969,29 +1946,16 @@ ivas_error isar_renderMultiTDBinToSplitBinaural(
        }
    }

#ifdef LC3PLUS_RTP_PAYLOAD_FORMAT
    if ( hSplitBin->multiBinPoseData.poseCorrectionMode != ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE )
    {
        write_pose_correction_section( hSplitBin,
                                       headPosition,
                                       SplitRendBitRate,
                                       pBits,
                                       Cldfb_In_BinReal,
                                       Cldfb_In_BinImag,
                                       low_res_pre_rend_rot,
                                       pcm_out_flag,
                                       ro_md_flag );
    }
#else
    if ( hSplitBin->multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
    {
        target_md_bits = isar_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out_flag ) * L_FRAME48k / 48000;

#ifndef LC3PLUS_RTP_PAYLOAD_FORMAT
        actual_md_bits = pBits->bits_written;
#endif

        isar_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPosition, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, target_md_bits, low_res_pre_rend_rot, ro_md_flag );
    }
#endif

    if ( pcm_out_flag == 0 )
    {