Commit d2101c20 authored by vaclav's avatar vaclav
Browse files

Issue 387: fix MD discontinuity in ISM FEC; under FIX_387_ISM_MD_FEC

parent ad1223e5
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -75,6 +75,10 @@ typedef struct
    float last_true_elevation; /* MD smoothing in DTX- last true Q elevation value */
#endif

#ifdef FIX_387_ISM_MD_FEC
    int16_t ism_md_fec_cnt_enc; /* counter of continuous frames where MD are not transmitted */
#endif

} ISM_METADATA_FRAME, *ISM_METADATA_HANDLE;


+2 −1
Original line number Diff line number Diff line
@@ -150,8 +150,9 @@
#define NCHAN_ISM_PARAMETER                             /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */

#define FIX_382_MASA_META_FRAMING_ASYNC                 /* Nokia: Issue 382: detect potential MASA metadata framing offset */

#define SBA2MONO                                        /* FhG: Issue 365: Adapt processing of SBA mono output to be in line with stereo output (less delay, lower complexity) */
#define FIX_387_ISM_MD_FEC                              /* VA: Issue 387: fix MD discontinuity in ISM FEC */


/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+37 −0
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@
#define ISM_MAX_RADIUS_DIFF_IDX    ( ISM_RADIUS_NBITS - 1 /*zero*/ - 1 /*sign*/ )

#define ISM_FEC_MAX 10
#ifdef FIX_387_ISM_MD_FEC
#define ISM_MD_FEC_DIFF    10
#define ISM_MD_FEC_CNT_MAX 25
#endif

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

@@ -252,6 +256,15 @@ ivas_error ivas_ism_metadata_enc(
                hIsmMeta[ch]->ism_metadata_flag = 0;
            }
#endif

#ifdef FIX_387_ISM_MD_FEC
            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 ) ||
                 hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX )
            {
                hIsmMeta[ch]->ism_metadata_flag = 1;
            }
#endif
        }
    }

@@ -362,6 +375,12 @@ ivas_error ivas_ism_metadata_enc(
                {
                    nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start;
                }

#ifdef FIX_387_ISM_MD_FEC
                /* Updates */
                hIsmMeta[ch]->last_true_azimuth = hIsmMeta[ch]->azimuth;
                hIsmMeta[ch]->last_true_elevation = hIsmMeta[ch]->elevation;
#endif
            }
        }

@@ -498,6 +517,16 @@ ivas_error ivas_ism_metadata_enc(
    for ( ch = 0; ch < nchan_ism; ch++ )
    {
        hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag;
#ifdef FIX_387_ISM_MD_FEC
        if ( hIsmMeta[ch]->ism_metadata_flag == 0 )
        {
            hIsmMeta[ch]->ism_md_fec_cnt_enc++;
        }
        else
        {
            hIsmMeta[ch]->ism_md_fec_cnt_enc = 0;
        }
#endif
    }

    for ( ch = 0; ch < nchan_transport; ch++ )
@@ -581,6 +610,10 @@ ivas_error ivas_ism_metadata_enc_create(
        st_ivas->hIsmMetaData[ch]->last_azimuth = 0.0f;
        st_ivas->hIsmMetaData[ch]->last_elevation = 0.0f;
#endif

#ifdef FIX_387_ISM_MD_FEC
        st_ivas->hIsmMetaData[ch]->ism_md_fec_cnt_enc = 0;
#endif
    }

    if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK )
@@ -1064,6 +1097,10 @@ void ivas_ism_metadata_sid_enc(
                    hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth );
                    hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation );
                }

#ifdef FIX_387_ISM_MD_FEC
                hIsmMetaData->ism_md_fec_cnt_enc = 0;
#endif
            }
        }