Commit 04df81b6 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into sba-ext-fix

parents 561caa3e e32d715c
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@

/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define SPLIT_REND_WITH_HEAD_ROT                        /* Dlb,FhG: Split Rendering contributions 21 and 35 */
#define SPLIT_REND_POSE_CORRECTION_UNUSED_BITS

#define FIX_NUM_SUBFRAME_UPDATE

+6 −0
Original line number Diff line number Diff line
@@ -75,7 +75,12 @@ typedef enum
#define MAX_SPLIT_REND_MD_BANDS      20
#define MAX_SPLIT_MD_SUBFRAMES       1
#define COMPLEX_MD_BAND_THRESH       MAX_SPLIT_REND_MD_BANDS
#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
#define COMPLEX_MD_BAND_THRESH_LOW   4
#define COMPLEX_MD_BAND_THRESH_HIGH   10
#else
#define COMPLEX_MD_BAND_THRESH_LOW   5
#endif
#define SPLIT_REND_RO_MD_BAND_THRESH 4

#define ISAR_SPLIT_REND_NUM_QUANT_STRATS     4
@@ -108,6 +113,7 @@ typedef enum
#define ISAR_SPLIT_REND_DOF_BITS       2
#define ISAR_SPLIT_REND_HQ_MODE_BITS   1
#define ISAR_SPLIT_REND_ROT_AXIS_BITS  3
#define ISAR_SPLIT_REND_RO_FLAG_BITS   1

/*----------------------------------------------------------------------------------*
 * Split rendering bitrate constants
+23 −2
Original line number Diff line number Diff line
@@ -200,8 +200,15 @@ void isar_split_rend_get_quant_params(
    int16_t bands_pitch[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
    int16_t pred_real_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
    int16_t pred_imag_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
    int16_t *num_quant_strats,
    int16_t *num_complex_bands );
#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
    const int16_t ro_flag,
#endif
    int16_t *num_quant_strats
#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
    ,
    int16_t *num_complex_bands
#endif
);

void isar_splitBinPostRendMdDec(
    ISAR_SPLIT_REND_BITS_HANDLE pBits,
@@ -269,6 +276,20 @@ void isar_renderSplitGetMultiBinPoseData(
    MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
    const ISAR_SPLIT_REND_ROT_AXIS rot_axis );

#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
int16_t isar_renderSplitGetRot_axisNumBits(
    const int16_t dof );

ISAR_SPLIT_REND_ROT_AXIS isar_renderSplitGetRot_axisFromCode(
    const int16_t dof,
    const int16_t code );

int16_t isar_renderSplitGetCodeFromRot_axis(
    const int16_t dof,
    const ISAR_SPLIT_REND_ROT_AXIS rot_axis,
    int16_t *num_bits );
#endif

void isar_init_split_post_rend_handles(
    ISAR_SPLIT_POST_REND_WRAPPER *hSplitRendWrapper );

+203 −1
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ static void isar_split_rend_unquant_md(
        float quantstep;

        quantstep = pred_quant_step;

#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
        for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
        {
            for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
@@ -251,8 +251,20 @@ static void isar_split_rend_unquant_md(
                hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + fix_pos_rot_mat[ch1][ch2];
            }
        }
#endif
        if ( real_only )
        {
#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
            for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
            {
                for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
                {
                    hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * quantstep;
                    hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + ( ( ch1 == ch2 ) ? 1.0f : 0.0f );
                }
            }
#endif

            for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
            {
                for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
@@ -263,6 +275,17 @@ static void isar_split_rend_unquant_md(
        }
        else
        {
#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
            for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
            {
                for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
                {
                    hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * quantstep;
                    hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + fix_pos_rot_mat[ch1][ch2];
                }
            }
#endif

            for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
            {
                for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
@@ -348,6 +371,7 @@ static void isar_splitBinPostRendMdBase2Dec(
        {
            if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW )
            {
#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
                for ( b = 0; b < pred_real_bands_yaw; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
@@ -372,6 +396,40 @@ static void isar_splitBinPostRendMdBase2Dec(
                        }
                    }
                }
#else
                for ( b = 0; b < pred_imag_bands_yaw; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
                        {
                            code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_code_len );
                            hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_idx;
                        }
                    }
                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
                        {
                            code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_code_len );
                            hMd->pred_mat_im_idx[ch1][ch2] = code + min_pred_idx;
                        }
                    }
                }

                for ( ; b < pred_real_bands_yaw; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_code_len );
                        hMd->pred_mat_re_idx[ch1][ch1] = code + min_pred_idx;
                    }
                    hMd->pred_mat_re_idx[0][1] = 0;
                    hMd->pred_mat_re_idx[1][0] = 0;
                }
#endif
                for ( b = 0; b < d_bands_yaw; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
@@ -392,6 +450,7 @@ static void isar_splitBinPostRendMdBase2Dec(
            }
            else
            {
#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
                for ( b = 0; b < pred_real_bands_roll; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
@@ -416,6 +475,40 @@ static void isar_splitBinPostRendMdBase2Dec(
                        }
                    }
                }
#else
                for ( b = 0; b < pred_imag_bands_roll; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
                        {
                            code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_roll_code_len );
                            hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_roll_idx;
                        }
                    }
                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
                        {
                            code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_roll_code_len );
                            hMd->pred_mat_im_idx[ch1][ch2] = code + min_pred_roll_idx;
                        }
                    }
                }

                for ( ; b < pred_real_bands_roll; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_roll_code_len );
                        hMd->pred_mat_re_idx[ch1][ch1] = code + min_pred_roll_idx;
                    }
                    hMd->pred_mat_re_idx[0][1] = 0;
                    hMd->pred_mat_re_idx[1][0] = 0;
                }
#endif
            }
        }
    }
@@ -473,6 +566,7 @@ static void isar_splitBinPostRendMdHuffDec(
        {
            if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW )
            {
#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
                for ( b = 0; b < pred_real_bands_yaw; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
@@ -497,6 +591,39 @@ static void isar_splitBinPostRendMdHuffDec(
                    }
                    isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_idx, max_pred_idx );
                }
#else
                for ( b = 0; b < pred_imag_bands_yaw; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
                        {
                            sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred[pred_cb_idx], pBits, pHuff_cfg->pred_idx_trav[pred_cb_idx] );
                        }
                    }
                    isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_idx, max_pred_idx );
                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
                        {
                            sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred[pred_cb_idx], pBits, pHuff_cfg->pred_idx_trav[pred_cb_idx] );
                        }
                    }
                    isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_idx, max_pred_idx );
                }
                for ( ; b < pred_real_bands_yaw; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        sym_adj_idx[ch1][ch1] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred[pred_cb_idx], pBits, pHuff_cfg->pred_idx_trav[pred_cb_idx] );
                    }
                    sym_adj_idx[1][0] = 0;
                    sym_adj_idx[0][1] = 0;
                    isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, -1, min_pred_idx, max_pred_idx );
                }
#endif
                for ( b = 0; b < d_bands_yaw; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
@@ -515,6 +642,7 @@ static void isar_splitBinPostRendMdHuffDec(
            }
            else
            {
#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
                for ( b = 0; b < pred_real_bands_roll; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
@@ -540,6 +668,42 @@ static void isar_splitBinPostRendMdHuffDec(
                    }
                    isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_roll_idx, max_pred_roll_idx );
                }
#else
                for ( b = 0; b < pred_imag_bands_roll; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];

                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
                        {
                            sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred_roll, pBits, pHuff_cfg->pred_roll_idx_trav );
                        }
                    }
                    isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_roll_idx, max_pred_roll_idx );
                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
                        {
                            sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred_roll, pBits, pHuff_cfg->pred_roll_idx_trav );
                        }
                    }
                    isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_roll_idx, max_pred_roll_idx );
                }

                for ( ; b < pred_real_bands_roll; b++ )
                {
                    hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];

                    for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
                    {
                        sym_adj_idx[ch1][ch1] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred_roll, pBits, pHuff_cfg->pred_roll_idx_trav );
                    }
                    sym_adj_idx[1][0] = 0;
                    sym_adj_idx[0][1] = 0;
                    isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, -1, min_pred_roll_idx, max_pred_roll_idx );
                }
#endif
            }
        }
    }
@@ -568,7 +732,11 @@ void isar_splitBinPostRendMdDec(
    int16_t pred_real_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_real_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
    int16_t pred_imag_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_imag_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
    int16_t d_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], bands_pitch[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
    int16_t num_quant_strats;
#else
    int16_t num_complex_bands, num_quant_strats;
#endif
    int32_t quant_strat_bits, is_huff_coding, quant_strat;
    int16_t pred_quant_pnts_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
    float pred_1byquantstep_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
@@ -579,12 +747,30 @@ void isar_splitBinPostRendMdDec(
    ISAR_BIN_HR_SPLIT_REND_MD_HANDLE hMd;
    ISAR_SPLIT_REND_CONFIG_DATA split_rend_config;
    ISAR_SPLIT_REND_ROT_AXIS rot_axis;
#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
    int16_t ro_md_flag, num_bits, axis_code;
#endif

    hBinHrSplitPostRend->low_Res = 1;

    split_rend_config.dof = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_DOF_BITS );
    split_rend_config.hq_mode = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HQ_MODE_BITS );

#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
    num_bits = isar_renderSplitGetRot_axisNumBits( split_rend_config.dof );
    if ( num_bits > 0 )
    {
        axis_code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, (int32_t) num_bits );
    }
    else
    {
        axis_code = 0;
    }
    rot_axis = isar_renderSplitGetRot_axisFromCode( split_rend_config.dof, axis_code );
    ro_md_flag = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_RO_FLAG_BITS );
#else
    rot_axis = (ISAR_SPLIT_REND_ROT_AXIS) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_ROT_AXIS_BITS );
#endif

    isar_renderSplitGetMultiBinPoseData( &split_rend_config, pMultiBinPoseData, rot_axis );

@@ -611,6 +797,21 @@ void isar_splitBinPostRendMdDec(
        hBinHrSplitPostRend->QuaternionsPre[sf_idx].z = (float) angle;
    }

#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
    isar_split_rend_get_quant_params(
        MAX_SPLIT_REND_MD_BANDS,
        pred_real_bands_yaw,
        pred_imag_bands_yaw,
        pred_quant_pnts_yaw,
        pred_quantstep_yaw,
        pred_1byquantstep_yaw,
        d_bands_yaw,
        bands_pitch,
        pred_real_bands_roll,
        pred_imag_bands_roll,
        ro_md_flag,
        &num_quant_strats );
#else
    isar_split_rend_get_quant_params(
        MAX_SPLIT_REND_MD_BANDS,
        pred_real_bands_yaw,
@@ -624,6 +825,7 @@ void isar_splitBinPostRendMdDec(
        pred_imag_bands_roll,
        &num_quant_strats,
        &num_complex_bands );
#endif

    quant_strat_bits = (int32_t) ceilf( log2f( num_quant_strats ) );
    is_huff_coding = ISAR_SPLIT_REND_BITStream_read_int32( pBits, 1 );
+257 −9

File changed.

Preview size limit exceeded, changes collapsed.

Loading