Commit c1d9a94d authored by vasilache's avatar vasilache
Browse files

add assert

parent 89c30a06
Loading
Loading
Loading
Loading
Loading
+38 −16
Original line number Diff line number Diff line
@@ -4663,18 +4663,23 @@ static Word16 encode_coherence_indexesDCT0_fx(
    move16();
    i = 0;
    move16();
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
    /* verify that idx and idx1 can be represented on 63 bits as it has been designed through split outside this function */
    assert( idx < ( 1 << 62 ) );
    assert( idx1 < ( 1 << 62 ) );
#endif
    FOR( i = 0; i < no_idx16 - 1; i++ )
    {
        k = sub( k, 16 );
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
        hMetaData->ind_list[indice_coherence + i].value = u_extract_l( (UWord32) W_extract_l( W_shr( idx, k ) ) ); /*   ( ( idx >> k ) & 65535 );  16 bits */
        hMetaData->ind_list[indice_coherence + i].value = u_extract_l( (UWord32) W_extract_l( W_shr( (Word64) idx, k ) ) ); /*   ( ( idx >> k ) & 65535 );  16 bits */
#else
        hMetaData->ind_list[indice_coherence + i].value = ( ( idx >> k ) & 65535 ); /* 16 bits */
        move16();
#endif
    }
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
    hMetaData->ind_list[indice_coherence + i].value = u_extract_l( (UWord32) L_and( W_extract_l( idx ), L_sub( L_shl( 1, k ), 1 ) ) ); /* ( idx & ( ( 1 << k ) - 1 ) ); */
    hMetaData->ind_list[indice_coherence + i].value = u_extract_l( (UWord32) L_and( W_extract_l( (Word64) idx ), L_sub( L_shl( 1, k ), 1 ) ) ); /* ( idx & ( ( 1 << k ) - 1 ) ); */
#else
    hMetaData->ind_list[indice_coherence + i].value = ( idx & ( ( 1 << k ) - 1 ) );
    move16();
@@ -4701,14 +4706,14 @@ static Word16 encode_coherence_indexesDCT0_fx(
        {
            k = sub( k, 16 );
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
            hMetaData->ind_list[indice_coherence + j].value = u_extract_l( (UWord32) W_extract_l( W_shr( idx1, k ) ) ); /*   ( ( idx1 >> k ) & 65535 );   16 bits */
            hMetaData->ind_list[indice_coherence + j].value = u_extract_l( (UWord32) W_extract_l( W_shr( (Word64) idx1, k ) ) ); /*   ( ( idx1 >> k ) & 65535 );   16 bits */
#else
            hMetaData->ind_list[indice_coherence + j].value = ( ( idx1 >> k ) & 65535 ); /* 16 bits */
            move16();
#endif
        }
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
        hMetaData->ind_list[indice_coherence + j].value = u_extract_l( (UWord32) L_and( W_extract_l( idx1 ), L_sub( L_shl( 1, k ), 1 ) ) ); /* ( idx1 & ( ( 1 << k ) - 1 ) ); */
        hMetaData->ind_list[indice_coherence + j].value = u_extract_l( (UWord32) L_and( W_extract_l( (Word64) idx1 ), L_sub( L_shl( 1, k ), 1 ) ) ); /* ( idx1 & ( ( 1 << k ) - 1 ) ); */
#else
        hMetaData->ind_list[indice_coherence + j].value = ( idx1 & ( ( 1 << k ) - 1 ) );
        move16();
@@ -4982,6 +4987,11 @@ static Word16 encode_spread_coherence_1sf_fx(
            no_idx16 = shr_r( add( nbits_fr, ONE_IN_Q3 ), 4 );
        }

#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
        /* verify that idx and idx1 can be represented on 63 bits as it has been designed through split outside this function */
        assert( idx < ( 1 << 62 ) );
        assert( idx1 < ( 1 << 62 ) );
#endif
        /* write combined index */
        k = nbits_fr;
        move16();
@@ -4989,13 +4999,13 @@ static Word16 encode_spread_coherence_1sf_fx(
        {
            k = sub( k, 16 );
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
            push_next_indice( hMasaMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( idx, k ) ) ), 16 ); /*  ( ( idx >> k ) & 65535 );   16 bits */
            push_next_indice( hMasaMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( (Word64) idx, k ) ) ), 16 ); /*  ( ( idx >> k ) & 65535 );   16 bits */
#else
            push_next_indice( hMasaMetaData, ( ( idx >> k ) & 65535 ), 16 ); /* 16 bits */
#endif
        }
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
        push_next_indice( hMasaMetaData, u_extract_l( (UWord32) L_and( W_extract_l( idx ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx & ( ( 1 << k ) - 1 ) ); */
        push_next_indice( hMasaMetaData, u_extract_l( (UWord32) L_and( W_extract_l( (Word64) idx ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx & ( ( 1 << k ) - 1 ) ); */
#else
        push_next_indice( hMasaMetaData, ( idx & ( ( 1 << k ) - 1 ) ), k );
#endif
@@ -5021,13 +5031,13 @@ static Word16 encode_spread_coherence_1sf_fx(
            {
                k = sub( k, 16 );
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
                push_next_indice( hMasaMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( idx1, k ) ) ), 16 ); /*  ( ( idx1 >> k ) & 65535 );   16 bits */
                push_next_indice( hMasaMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( (Word64) idx1, k ) ) ), 16 ); /*  ( ( idx1 >> k ) & 65535 );   16 bits */
#else
                push_next_indice( hMasaMetaData, ( ( idx1 >> k ) & 65535 ), 16 ); /* 16 bits */
#endif
            }
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
            push_next_indice( hMasaMetaData, u_extract_l( (UWord32) L_and( W_extract_l( idx1 ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx1 & ( ( 1 << k ) - 1 ) ); */
            push_next_indice( hMasaMetaData, u_extract_l( (UWord32) L_and( W_extract_l( (Word64) idx1 ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx1 & ( ( 1 << k ) - 1 ) ); */
#else
            push_next_indice( hMasaMetaData, ( idx1 & ( ( 1 << k ) - 1 ) ), k );
#endif
@@ -5223,6 +5233,12 @@ static Word16 encode_surround_coherence_fx(
                no_idx16 = shr_r( add( nbits_fr, ONE_IN_Q3 ), 4 );
            }

#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
            /* verify that idx and idx1 can be represented on 63 bits as it has been designed through split outside this function */
            assert( idx < ( 1 << 62 ) );
            assert( idx1 < ( 1 << 62 ) );
#endif

            /* write combined index */
            k = nbits_fr;
            move16();
@@ -5230,13 +5246,13 @@ static Word16 encode_surround_coherence_fx(
            {
                k = sub( k, 16 );
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
                push_next_indice( hMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( idx, k ) ) ), 16 ); /*  ( ( idx >> k ) & 65535 );   16 bits */
                push_next_indice( hMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( (Word64) idx, k ) ) ), 16 ); /*  ( ( idx >> k ) & 65535 );   16 bits */
#else
                push_next_indice( hMetaData, ( ( idx >> k ) & 65535 ), 16 ); /* 16 bits */
#endif
            }
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
            push_next_indice( hMetaData, u_extract_l( (UWord32) L_and( W_extract_l( idx ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx & ( ( 1 << k ) - 1 ) ); */
            push_next_indice( hMetaData, u_extract_l( (UWord32) L_and( W_extract_l( (Word64) idx ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx & ( ( 1 << k ) - 1 ) ); */
#else
            push_next_indice( hMetaData, ( idx & ( ( 1 << k ) - 1 ) ), k );
#endif
@@ -5262,13 +5278,13 @@ static Word16 encode_surround_coherence_fx(
                {
                    k = sub( k, 16 );
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
                    push_next_indice( hMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( idx1, k ) ) ), 16 ); /*  ( ( idx1 >> k ) & 65535 );   16 bits */
                    push_next_indice( hMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( (Word64) idx1, k ) ) ), 16 ); /*  ( ( idx1 >> k ) & 65535 );   16 bits */
#else
                    push_next_indice( hMetaData, ( ( idx1 >> k ) & 65535 ), 16 ); /* 16 bits */
#endif
                }
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
                push_next_indice( hMetaData, u_extract_l( (UWord32) L_and( W_extract_l( idx1 ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx1 & ( ( 1 << k ) - 1 ) ); */
                push_next_indice( hMetaData, u_extract_l( (UWord32) L_and( W_extract_l( (Word64) idx1 ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx1 & ( ( 1 << k ) - 1 ) ); */
#else
                push_next_indice( hMetaData, ( idx1 & ( ( 1 << k ) - 1 ) ), k );
#endif
@@ -5466,6 +5482,12 @@ static Word16 encode_surround_coherence_hr_fx(
                        no_idx16 = add( shr( nbits_fr, 4 ), 1 );
                    }

#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
                    /* verify that idx and idx1 can be represented on 63 bits as it has been designed through split outside this function */
                    assert( idx < ( 1 << 62 ) );
                    assert( idx1 < ( 1 << 62 ) );
#endif

                    /* write combined index */
                    k = nbits_fr;
                    move16();
@@ -5473,13 +5495,13 @@ static Word16 encode_surround_coherence_hr_fx(
                    {
                        k = sub( k, 16 );
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
                        push_next_indice( hMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( idx, k ) ) ), 16 ); /*  ( ( idx >> k ) & 65535 );   16 bits */
                        push_next_indice( hMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( (Word64) idx, k ) ) ), 16 ); /*  ( ( idx >> k ) & 65535 );   16 bits */
#else
                        push_next_indice( hMetaData, ( ( idx >> k ) & 65535 ), 16 ); /* 16 bits */
#endif
                    }
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
                    push_next_indice( hMetaData, u_extract_l( (UWord32) L_and( W_extract_l( idx ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx & ( ( 1 << k ) - 1 ) ); */
                    push_next_indice( hMetaData, u_extract_l( (UWord32) L_and( W_extract_l( (Word64) idx ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx & ( ( 1 << k ) - 1 ) ); */
#else
                    push_next_indice( hMetaData, ( idx & ( ( 1 << k ) - 1 ) ), k );
#endif
@@ -5503,13 +5525,13 @@ static Word16 encode_surround_coherence_hr_fx(
                        {
                            k = sub( k, 16 );
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
                            push_next_indice( hMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( idx1, k ) ) ), 16 ); /*  ( ( idx1 >> k ) & 65535 );   16 bits */
                            push_next_indice( hMetaData, u_extract_l( (UWord32) W_extract_l( W_shr( (Word64) idx1, k ) ) ), 16 ); /*  ( ( idx1 >> k ) & 65535 );   16 bits */
#else
                            push_next_indice( hMetaData, ( ( idx1 >> k ) & 65535 ), 16 ); /* 16 bits */
#endif
                        }
#ifdef FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC
                        push_next_indice( hMetaData, u_extract_l( (UWord32) L_and( W_extract_l( idx1 ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx1 & ( ( 1 << k ) - 1 ) ); */
                        push_next_indice( hMetaData, u_extract_l( (UWord32) L_and( W_extract_l( (Word64) idx1 ), L_sub( L_shl( 1, k ), 1 ) ) ), k ); /* ( idx1 & ( ( 1 << k ) - 1 ) ); */
#else
                        push_next_indice( hMetaData, ( idx1 & ( ( 1 << k ) - 1 ) ), k );
#endif