Commit a218d490 authored by vaclav's avatar vaclav Committed by emerit
Browse files

fix issue 1273: fix counter overflow in ISM metadata encoder; under NONBE_1273_ISM_METADATA_COUNTER

parent c0ad987b
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -557,9 +557,10 @@ ivas_error ivas_ism_metadata_enc(

                if ( hIsmMeta[ch]->ism_metadata_flag == 0 )
                {
                    hIsmMeta[ch]->ism_md_fec_cnt_enc++;
#ifdef NONBE_1273_ISM_METADATA_COUNTER
                    hIsmMeta[ch]->ism_md_fec_cnt_enc = min( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX );
                    hIsmMeta[ch]->ism_md_fec_cnt_enc = min( hIsmMeta[ch]->ism_md_fec_cnt_enc++, ISM_MD_FEC_CNT_MAX );
#else
                    hIsmMeta[ch]->ism_md_fec_cnt_enc++;
#endif
                }
                else
@@ -704,14 +705,10 @@ ivas_error ivas_ism_metadata_enc(

        if ( hIsmMeta[ch]->ism_metadata_flag == 0 )
        {
            hIsmMeta[ch]->ism_md_fec_cnt_enc++;
#ifdef NONBE_1273_ISM_METADATA_COUNTER
            hIsmMeta[ch]->ism_md_fec_cnt_enc = min( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX );
#endif
        }
        else
        {
            hIsmMeta[ch]->ism_md_fec_cnt_enc = 0;
            hIsmMeta[ch]->ism_md_fec_cnt_enc = min( hIsmMeta[ch]->ism_md_fec_cnt_enc++, ISM_MD_FEC_CNT_MAX );
#else
            hIsmMeta[ch]->ism_md_fec_cnt_enc++;
        }
        hIsmMeta[ch]->ism_md_inc_diff_cnt++;
        hIsmMeta[ch]->ism_md_inc_diff_cnt = min( hIsmMeta[ch]->ism_md_inc_diff_cnt, ISM_MD_INC_DIFF_CNT_MAX );