Commit a2ff4e8c authored by multrus's avatar multrus
Browse files

Merge branch '20260501_cleanup' into 'main'

20260501 cleanup

See merge request !3006
parents edfb9521 ee0e3096
Loading
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -1766,9 +1766,7 @@ static ivas_error initOnFirstGoodFrame(
        uint16_t rtpDecSeed = RANDOM_INITSEED_DEC;
        uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) << 16 );
        uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpDecSeed );
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
        uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */
#endif

        if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK )
        {
@@ -1805,11 +1803,7 @@ static ivas_error initOnFirstGoodFrame(


            /* Split Rendering RTPDump Output file */
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
            if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError: Can't open SR output bitstream file for RTP output %s \n\n", arg.outputWavFilename );
                return error;
+0 −6
Original line number Diff line number Diff line
@@ -230,9 +230,7 @@ int main(
    uint16_t rtpEncSeed = RANDOM_INITSEED_ENC;
    uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) << 16 );
    uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpEncSeed );
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
    uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */
#endif

    /*------------------------------------------------------------------------------------------*
     * Parse command-line arguments
@@ -647,11 +645,7 @@ int main(

    if ( arg.rtpdumpOutput )
    {
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
        if ( ( error = IVAS_RTP_WRITER_Init( &ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_RTP_WRITER_Init( &ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "\nError: Can't open output bitstream file for RTP output %s \n\n", arg.outputBitstreamFilename );
            goto cleanup;
+0 −2
Original line number Diff line number Diff line
@@ -72,10 +72,8 @@
#define IVAS_TIME_SCALE_MIN 50  /* min. time-scaling [%] */
#define IVAS_TIME_SCALE_MAX 150 /* max. time-scaling [%] */

#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
/* RTP constants */
#define DEFAULT_IVAS_PAYLOAD_TYPE ( 96 )
#endif

/*----------------------------------------------------------------------------------*
 * Common API enum for output audio configurations
+0 −308
Original line number Diff line number Diff line
@@ -87,9 +87,6 @@
 *-----------------------------------------------------------------*/

static void cdftForw( Word16 n, Word32 *a, const Word16 *ip, const Word16 *w );
#ifndef HARMONIZE_DoRTFTn
static void bitrv2_SR( Word16 n, const Word16 *ip, Word32 *a );
#endif
static void cftfsub( Word16 n, Word32 *a, const Word16 *w );
static void cft1st( Word16 n, Word32 *a, const Word16 *w );
static void cftmdl( Word16 n, Word16 l, Word32 *a, const Word16 *w );
@@ -1548,11 +1545,7 @@ static void fft5_4(
 * a low complexity 2-dimensional DFT of 80 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT80_fx(
#else
void DoRTFT80_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1579,11 +1572,7 @@ void DoRTFT80_fx(
 * a low complexity 2-dimensional DFT of 120 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT120_fx(
#else
void DoRTFT120_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1610,11 +1599,7 @@ void DoRTFT120_fx(
 * a low complexity 2-dimensional DFT of 160 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT160_fx(
#else
void DoRTFT160_fx(
#endif
    Word32 x[], /* i/o: real part of input and output data Qx      */
    Word32 y[]  /* i/o: imaginary part of input and output data Qx */
)
@@ -1641,11 +1626,7 @@ void DoRTFT160_fx(
 * a low complexity 2-dimensional DFT of 320 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT320_fx(
#else
void DoRTFT320_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1672,11 +1653,7 @@ void DoRTFT320_fx(
 * a low complexity 2-dimensional DFT of 480 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT480_fx(
#else
void DoRTFT480_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1703,11 +1680,7 @@ void DoRTFT480_fx(
 * a low complexity 2-dimensional DFT of 40 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT40_fx(
#else
void DoRTFT40_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1733,11 +1706,7 @@ void DoRTFT40_fx(
 * a low complexity 2-dimensional DFT of 20 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT20_fx(
#else
void DoRTFT20_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1764,11 +1733,7 @@ void DoRTFT20_fx(
 * FFT with 128 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT128_fx(
#else
void DoRTFT128_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1815,11 +1780,7 @@ static void cdftForw(
)
{
    /* bit reversal */
#ifdef HARMONIZE_DoRTFTn
    bitrv2_SR_fx( n, ip + 2, a );
#else
    bitrv2_SR( n, ip + 2, a );
#endif

    /* Do FFT */
    cftfsub( n, a, w );
@@ -1828,210 +1789,6 @@ static void cdftForw(
}


#ifndef HARMONIZE_DoRTFTn
/*-----------------------------------------------------------------*
 * bitrv2_SR()
 * Bit reversal
 *-----------------------------------------------------------------*/

static void bitrv2_SR(
    Word16 n,         /* i  : data length of real and imag Q0 */
    const Word16 *ip, /* i/o: work area for bit reversal Q0   */
    Word32 *a         /* i/o: input/output data Qx            */
)
{
    Word16 j, j1, k, k1, m, m2;
    Word16 l;
    Word32 xr, xi, yr, yi;

    IF( EQ_16( n, 64 ) )
    {
        m = 4;
        move16();
        l = -1;
        move16();
    }
    ELSE IF( EQ_16( n, 256 ) )
    {
        m = 8;
        move16();
        l = -1;
        move16();
    }
    ELSE IF( EQ_16( n, 16 ) )
    {
        m = 2;
        move16();
        l = -1;
        move16();
    }
    ELSE
    {
        l = n;
        move16();
        m = 1;
        move16();

        WHILE( ( m << 3 ) < l )
        {
            l = shr( l, 1 );
            m = shl( m, 1 );
        }
        l = sub( l, shl( m, 3 ) );
    }

    m2 = shl( m, 1 );

    IF( l == 0 )
    {
        FOR( k = 0; k < m; k++ )
        {
            FOR( j = 0; j < k; j++ )
            {
                j1 = add( shl( j, 1 ), ip[k] );
                k1 = add( shl( k, 1 ), ip[j] );
                xr = a[j1]; // Qx
                move32();
                xi = a[j1 + 1]; // Qx
                move32();
                yr = a[k1]; // Qx
                move32();
                yi = a[k1 + 1]; // Qx
                move32();
                a[j1] = yr; // Qx
                move32();
                a[j1 + 1] = yi; // Qx
                move32();
                a[k1] = xr; // Qx
                move32();
                a[k1 + 1] = xi; // Qx
                move32();
                j1 = add( j1, m2 );
                k1 = add( k1, 2 * m2 );
                xr = a[j1];
                move32();
                xi = a[j1 + 1];
                move32();
                yr = a[k1];
                move32();
                yi = a[k1 + 1];
                move32();
                a[j1] = yr;
                move32();
                a[j1 + 1] = yi;
                move32();
                a[k1] = xr;
                move32();
                a[k1 + 1] = xi;
                move32();
                j1 = add( j1, m2 );
                k1 = sub( k1, m2 );
                xr = a[j1];
                move32();
                xi = a[j1 + 1];
                move32();
                yr = a[k1];
                move32();
                yi = a[k1 + 1];
                move32();
                a[j1] = yr;
                move32();
                a[j1 + 1] = yi;
                move32();
                a[k1] = xr;
                move32();
                a[k1 + 1] = xi;
                move32();
                j1 = add( j1, m2 );
                k1 = add( k1, shl( m2, 1 ) );
                xr = a[j1];
                move32();
                xi = a[j1 + 1];
                move32();
                yr = a[k1];
                move32();
                yi = a[k1 + 1];
                move32();
                a[j1] = yr;
                move32();
                a[j1 + 1] = yi;
                move32();
                a[k1] = xr;
                move32();
                a[k1 + 1] = xi;
                move32();
            }

            j1 = add( shl( k, 1 ), add( m2, ip[k] ) );
            k1 = add( j1, m2 );
            xr = a[j1];
            move32();
            xi = a[j1 + 1];
            move32();
            yr = a[k1];
            move32();
            yi = a[k1 + 1];
            move32();
            a[j1] = yr;
            move32();
            a[j1 + 1] = yi;
            move32();
            a[k1] = xr;
            move32();
            a[k1 + 1] = xi;
            move32();
        }
    }
    ELSE
    {
        FOR( k = 1; k < m; k++ )
        {
            FOR( j = 0; j < k; j++ )
            {
                j1 = add( shl( j, 1 ), ip[k] );
                k1 = add( shl( k, 1 ), ip[j] );
                xr = a[j1];
                move32();
                xi = a[j1 + 1];
                move32();
                yr = a[k1];
                move32();
                yi = a[k1 + 1];
                move32();
                a[j1] = yr;
                move32();
                a[j1 + 1] = yi;
                move32();
                a[k1] = xr;
                move32();
                a[k1 + 1] = xi;
                move32();
                j1 = add( j1, m2 );
                k1 = add( k1, m2 );
                xr = a[j1];
                move32();
                xi = a[j1 + 1];
                move32();
                yr = a[k1];
                move32();
                yi = a[k1 + 1];
                move32();
                a[j1] = yr;
                move32();
                a[j1 + 1] = yi;
                move32();
                a[k1] = xr;
                move32();
                a[k1 + 1] = xi;
                move32();
            }
        }
    }

    return;
}
#endif

/*-----------------------------------------------------------------*
 * cftfsub()
 * Complex Discrete Fourier Transform
@@ -2474,63 +2231,6 @@ static void cftmdl(
    return;
}

#ifndef HARMONIZE_DoRTFTn
void DoRTFTn_fx_ivas(
    Word32 *x,     /* i/o: real part of input and output data Qx      */
    Word32 *y,     /* i/o: imaginary part of input and output data Qx */
    const Word16 n /* i  : size of the FFT up to 1024 Q0*/
)
{
    Word16 i;
    Word32 z[2048];

    FOR( i = 0; i < n; i++ )
    {
        z[2 * i] = x[i]; // Qx
        move32();
        z[( ( i << 1 ) + 1 )] = y[i]; // Qx
        move32();
    }

    SWITCH( n )
    {
        case ( 16 ):
            cdftForw( 2 * n, z, Ip_fft16, w_fft16_fx );
            BREAK;
        case ( 32 ):
            cdftForw( 2 * n, z, Ip_fft32, w_fft32_fx );
            BREAK;
        case ( 64 ):
            cdftForw( 2 * n, z, Ip_fft64, w_fft64_fx );
            BREAK;
        case ( 128 ):
            cdftForw( 2 * n, z, Ip_fft128, w_fft128_fx );
            BREAK;
        case ( 256 ):
            cdftForw( 2 * n, z, Ip_fft256, w_fft256_fx );
            BREAK;
        case ( 512 ):
            cdftForw( 2 * n, z, Ip_fft512, w_fft512_fx );
            BREAK;
        default:
            assert( 0 );
    }

    x[0] = z[0]; // Qx
    move32();
    y[0] = z[1]; // Qx
    move32();
    FOR( i = 1; i < n; i++ )
    {
        x[( n - i )] = z[2 * i];
        move32();
        y[( n - i )] = z[( ( i << 1 ) + 1 )];
        move32();
    }

    return;
}
#endif

static void rfft_post(
    const Word16 *sine_table, // Q15
@@ -3516,11 +3216,7 @@ void DoFFT_fx(
            DoRTFT320_fx( re2, im2 );
            BREAK;
        case 256:
#ifdef HARMONIZE_DoRTFTn
            DoRTFTn_fx( re2, im2, NULL, 256 );
#else
            DoRTFTn_fx_ivas( re2, im2, 256 );
#endif
            BREAK;
        case 240:
            DoRTFT240( re2, im2 );
@@ -3544,11 +3240,7 @@ void DoFFT_fx(
            DoRTFT80_fx( re2, im2 );
            BREAK;
        case 64:
#ifdef HARMONIZE_DoRTFTn
            DoRTFTn_fx( re2, im2, NULL, 64 );
#else
            DoRTFTn_fx_ivas( re2, im2, 64 );
#endif
            BREAK;
        case 40:
            DoRTFT40_fx( re2, im2 );
+0 −31
Original line number Diff line number Diff line
@@ -37,9 +37,6 @@ static void fft5_32_16fx( Word16 *zRe, Word16 *zIm, const Word16 *Idx );
static void cdftForw_16fx( Word16 n, Word16 *a, const Word16 *ip, const Word32 *w );

static void cdftForw_fx( Word16 n, Word32 *a, const Word16 *ip, const Word16 *w );
#ifndef HARMONIZE_DoRTFTn
static void bitrv2_SR_fx( Word16 n, const Word16 *ip, Word32 *a );
#endif
static void cftfsub_fx( Word16 n, Word32 *a, const Word16 *w );
static void cft1st_fx( Word16 n, Word32 *a, const Word16 *w );
static void cftmdl_fx( Word16 n, Word16 l, Word32 *a, const Word16 *w );
@@ -86,51 +83,27 @@ void DoRTFTn_fx(

    IF( EQ_16( n, 16 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft16, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft16, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 32 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft32, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft32, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 64 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft64, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft64, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 128 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft128, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft128, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 256 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft256, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft256, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 512 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft512, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft512, w_fft512_fx_evs );
#endif
    }
    ELSE
    {
@@ -197,11 +170,7 @@ static void cdftForw_fx(
 * Bit reversal
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
void bitrv2_SR_fx(
#else
static void bitrv2_SR_fx(
#endif
    Word16 n,         /* i    : data length of real and imag              */
    const Word16 *ip, /* i/o  : work area for bit reversal                */
    Word32 *a         /* i/o  : input/output data                     Q(q)*/
Loading