Commit 6ef013be authored by Sumeyra Demir Kanik's avatar Sumeyra Demir Kanik
Browse files

Changes in ISM Encoder related to NULL metadata, tcx_only and radius difference

parent a3c74343
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -75,7 +75,9 @@ typedef struct
    int16_t ism_md_fec_cnt_enc;  /* counter of continuous frames where MD are not transmitted */
    int16_t ism_md_inc_diff_cnt; /* counter of continuous frames where MD are transmitted in inactive segments when MD significantly changes */
#endif

#ifdef FIX_435_ISM_MERGE_BUG
    float last_true_radius;      /* last true Q radius value */
#endif
} ISM_METADATA_FRAME, *ISM_METADATA_HANDLE;


+2 −0
Original line number Diff line number Diff line
@@ -172,6 +172,8 @@

#define EUALER2QUAT_FIX                                 /*Dlb :fix for issue 430 issue in euler2quat, sign of quat y is inverted*/
#define HR_METADATA                                     /* Nok: encode directional MASA metadata with more bits at 384k and 512k */

#define FIX_435_ISM_MERGE_BUG                           /* Eri: Merge bug fix for ISM NULL metadata and tcx_only cases */
/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+24 −3
Original line number Diff line number Diff line
@@ -61,7 +61,9 @@
#define ISM_MD_INC_DIFF_CNT_MAX 6
#define ISM_MD_FEC_CNT_MAX      25
#endif

#ifdef FIX_435_ISM_MERGE_BUG
#define ISM_MD_RAD_FEC_DIFF     1
#endif
#define INTER_OBJECT_PARAM_CHECK ( ( ISM_FEC_MAX / 2 ) - 2 ) /* note: constant must be less than (ISM_FEC_MAX / number of coded parameters)  */


@@ -221,14 +223,24 @@ ivas_error ivas_ism_metadata_enc(
        }
        else if ( ism_mode == ISM_MODE_DISC )
        {
#ifdef FIX_435_ISM_MERGE_BUG
            if ( hIsmMeta[ch]->ism_metadata_flag == 1 )
            {
                /* In case of low level noise for low bitrate inactive frames, do not sent metadata */
                hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10 || hSCE[ch]->hCoreCoder[0]->tcxonly;
#else
            hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10;

#endif
#ifdef FIX_387_ISM_MD_FEC
            /* in inactive frames, send MD 1) in ISM_MD_INC_DIFF_CNT_MAX consecutive frames when MD significantly change, 2) at least every ISM_MD_FEC_DIFF frames */
            if ( hIsmMeta[ch]->ism_metadata_flag == 0 )
            {
                if ( ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_true_azimuth ) > ISM_MD_FEC_DIFF ) ||
                     ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_true_elevation ) > ISM_MD_FEC_DIFF ) )
                     ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_true_elevation ) > ISM_MD_FEC_DIFF ) 
#ifdef FIX_435_ISM_MERGE_BUG
                    || ( fabsf( hIsmMeta[ch]->radius - hIsmMeta[ch]->last_true_radius ) > ISM_MD_RAD_FEC_DIFF )
#endif
                    )
                {
                    hIsmMeta[ch]->ism_metadata_flag = 1;
                    hIsmMeta[ch]->ism_md_inc_diff_cnt = 0;
@@ -252,6 +264,9 @@ ivas_error ivas_ism_metadata_enc(
                    hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX;
                }
            }
#endif
#ifdef FIX_435_ISM_MERGE_BUG
            }
#endif
        }
    }
@@ -369,6 +384,9 @@ ivas_error ivas_ism_metadata_enc(
                /* Updates */
                hIsmMeta[ch]->last_true_azimuth = hIsmMeta[ch]->azimuth;
                hIsmMeta[ch]->last_true_elevation = hIsmMeta[ch]->elevation;
#endif
#ifdef FIX_435_ISM_MERGE_BUG
                hIsmMeta[ch]->last_true_radius = hIsmMeta[ch]->radius;
#endif
            }
        }
@@ -610,6 +628,9 @@ ivas_error ivas_ism_metadata_enc_create(
        st_ivas->hIsmMetaData[ch]->last_true_elevation = 0.0f;
        st_ivas->hIsmMetaData[ch]->ism_md_fec_cnt_enc = 0;
        st_ivas->hIsmMetaData[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX;
#endif
#ifdef FIX_435_ISM_MERGE_BUG
        st_ivas->hIsmMetaData[ch]->last_true_radius = 1.0f;
#endif
    }