Commit f6c6ffab authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '1052-discrepancy-in-the-complexity-of-the-copy-function' into 'main'

Resolve "Discrepancy in the complexity of the Copy() function"

Closes #1052

See merge request !810
parents 69312e13 abf8a1f4
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -84,4 +84,5 @@
#define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO            /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */
#define FIX_ISSUE_1062_AND_1068_TON_ENE_EST_FX
#define FIX_1054_IF_ELSE_CMPLX                          /* VA: Fix 1054 incorrect counting of complexity when ELSE-IF sequence is encoutered in two functions */
#define FIX_1052_COPY_CMPLX_DISCREPANCY       /* VA: modify IF-ELSE statements used in Copy*() functions to avoid dependency on x[] and y[] in RAM */
#endif
+46 −0
Original line number Diff line number Diff line
@@ -469,6 +469,7 @@ Word32 sum2_fx_mod( /* o : sum of all squared vector element
 * Copy:
 *
 * Copy vector x[] to y[]
 *
 *-------------------------------------------------------------------*/
void Copy(
    const Word16 x[], /* i  : input vector  */
@@ -485,15 +486,27 @@ void Copy(
            y[i] = x[i];
            move16();
        }

#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY
        /* Location of x and y may differ depending on platform/memory allocation. Since IF and ELSE has different complexity count, the early return is used instead of ELSE to ensure the same complexity number regardless of x and y memory addresses. */
        return;
#endif
    }

#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY
    ELSE
    {
#endif
        FOR( i = L - 1; i >= 0; i-- )
        {
            y[i] = x[i];
            move16();
        }

        return;
#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY
    }
#endif
}
/*-------------------------------------------------------------------*
 * Copy64:
@@ -514,15 +527,27 @@ void Copy64(
            y[i] = x[i];
            move64();
        }

#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY
        /* Location of x and y may differ depending on platform/memory allocation. Since IF and ELSE has different complexity count, the early return is used instead of ELSE to ensure the same complexity number regardless of x and y memory addresses. */
        return;
#endif
    }

#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY
    ELSE
    {
#endif
        FOR( i = L - 1; i >= 0; i-- )
        {
            y[i] = x[i];
            move64();
        }

        return;
#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY
    }
#endif
}

void set64_fx(
@@ -558,9 +583,17 @@ void Copy_pword(
            move16();
            move16();
        }

#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY
        /* Location of x and y may differ depending on platform/memory allocation. Since IF and ELSE has different complexity count, the early return is used instead of ELSE to ensure the same complexity number regardless of x and y memory addresses. */
        return;
#endif
    }

#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY
    ELSE
    {
#endif
        FOR( i = L - 1; i >= 0; i-- )
        {
            y[i].v.im = x[i].v.im;
@@ -568,7 +601,11 @@ void Copy_pword(
            move16();
            move16();
        }

        return;
#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY
    }
#endif
}
/*-------------------------------------------------------------------*
 * Copy32:
@@ -589,15 +626,24 @@ void Copy32(
            y[i] = x[i];
            move32();
        }

#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY
        return;
#endif
    }

#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY
    ELSE
    {
#endif
        FOR( i = L - 1; i >= 0; i-- )
        {
            y[i] = x[i];
            move32();
        }
#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY
    }
#endif
}

void set8_fx(