Commit 32c44f70 authored by vaclav's avatar vaclav
Browse files

extend FIX_387_ISM_MD_FEC to send MD in inactive frames in several consecutive frames

parent dbd3fd77
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ typedef struct

#ifdef FIX_387_ISM_MD_FEC
    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

} ISM_METADATA_FRAME, *ISM_METADATA_HANDLE;
+19 −6
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@
#define ISM_FEC_MAX 10
#ifdef FIX_387_ISM_MD_FEC
#define ISM_MD_FEC_DIFF         10
#define ISM_MD_INC_DIFF_CNT_MAX 6
#define ISM_MD_FEC_CNT_MAX      25
#endif

@@ -258,12 +259,21 @@ ivas_error ivas_ism_metadata_enc(
#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 kleast 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 ) )
                {
                    hIsmMeta[ch]->ism_metadata_flag = 1;
                    hIsmMeta[ch]->ism_md_inc_diff_cnt = 0;
                }
                else if ( hIsmMeta[ch]->ism_md_inc_diff_cnt < ISM_MD_INC_DIFF_CNT_MAX ||
                          hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX )
                {
                    hIsmMeta[ch]->ism_metadata_flag = 1;
                }
            }
#endif
        }
    }
@@ -526,6 +536,7 @@ ivas_error ivas_ism_metadata_enc(
        {
            hIsmMeta[ch]->ism_md_fec_cnt_enc = 0;
        }
        hIsmMeta[ch]->ism_md_inc_diff_cnt = min( hIsmMeta[ch]->ism_md_inc_diff_cnt++, ISM_MD_INC_DIFF_CNT_MAX );
#endif
    }

@@ -615,6 +626,7 @@ ivas_error ivas_ism_metadata_enc_create(
        st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0.0f;
        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
    }

@@ -1102,6 +1114,7 @@ void ivas_ism_metadata_sid_enc(

#ifdef FIX_387_ISM_MD_FEC
                hIsmMetaData->ism_md_fec_cnt_enc = 0;
                hIsmMeta[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX;
#endif
            }
        }