Commit d584c497 authored by Stephane Ragot's avatar Stephane Ragot
Browse files

clean up of some todos + bypass option

parent 0ead5858
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -125,7 +125,9 @@ typedef struct
    const char *dbg_file_tag;
#endif
#endif
#ifndef PCA_ENH
    bool pca;
#endif
    bool ism_extended_metadata;

} EncArguments;
@@ -396,10 +398,16 @@ int main(
                           arg.dtxConfig,
                           arg.inputFormatConfig.sba.order,
                           arg.inputFormatConfig.sba.isPlanar,
#ifndef PCA_ENH
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
                           arg.agc,
#endif
                           arg.pca
#else
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
                           arg.agc
#endif
#endif
#ifdef DEBUG_SBA_AUDIO_DUMP
                           ,
                           &numTransportChannels
@@ -892,7 +900,9 @@ static void initArgStruct( EncArguments *arg )
    arg->dbg_file_tag = NULL;
#endif
#endif
#ifndef PCA_ENH
    arg->pca = false;
#endif

    return;
}
@@ -1463,6 +1473,7 @@ static bool parseCmdlIVAS_enc(
            arg->inputFormatConfig.stereoToMonoDownmix = true;
            i++;
        }
#ifndef PCA_ENH
        else if ( strcmp( argv_to_upper, "-BYPASS" ) == 0 ) // VE: should be renamed to "-pca"
        {
            i++;
@@ -1496,6 +1507,7 @@ static bool parseCmdlIVAS_enc(
                return false;
            }
        }
#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -1683,8 +1695,9 @@ static void usage_enc( void )
    fprintf( stdout, "-mime               : Mime output bitstream file format\n" );
    fprintf( stdout, "                      The encoder produces TS26.445 Annex.2.6 Mime Storage Format, (not RFC4867 Mime Format).\n" );
    fprintf( stdout, "                      default output bitstream file format is G.192\n" );

#ifndef PCA_ENH
    fprintf( stdout, "-bypass mode        : SBA PCA by-pass, mode = (1, 2), 1 = PCA off, 2 = signal adaptive, default is 1\n" );
#endif
#ifdef DEBUGGING
    fprintf( stdout, "-force T            : Force specific mode, T = (speech, music, ACELP, GSC, TCX, HQ),\n" );
    fprintf( stdout, "                      alternatively, T can be a text file where each line contains \"nb_frames T\"\n" );
+31 −16
Original line number Diff line number Diff line
@@ -653,13 +653,28 @@ static void norm_quat(
    int16_t i;

    norm_q = dotp( q, q, IVAS_PCA_INTERP );

    norm_q = inv_sqrt( norm_q ); // VE: TBV: possible division by 0

#ifdef PCA_ENH
    if (norm_q == 0) 
    {
        // PCA is disabled for sharp rotation changes, interpolated values cannot trigger a zero norm
        // however the detection of zero norm is done here for general code robustness
        set_zero( q, 4 );
        q[0] = 1.f;
	} else {
		norm_q = inv_sqrt( norm_q );
    for ( i = 0; i < IVAS_PCA_INTERP; i++ )
    {
        q[i] *= norm_q;
    }
    }
#else
    norm_q = inv_sqrt( norm_q );
    for ( i = 0; i < IVAS_PCA_INTERP; i++ )
    {
        q[i] *= norm_q;
    }
#endif


    return;
}
@@ -1119,7 +1134,7 @@ void pca_dec_s3(
#endif

#ifdef IVAS_PCA_VBR
	sp2cart(ph_q[0], ph_q[1], ph_q[2], q); FUNC(4); INDIRECT(4); ADD(2);
    sp2cart( ph_q[0], ph_q[1], ph_q[2], q );
#else
    j = index;
    index1 = -1;
+6 −3
Original line number Diff line number Diff line
@@ -306,6 +306,9 @@ void ivas_pca_enc(
    ivas_total_brate = hEncoderConfig->ivas_total_brate;

    /* if PCA is disabled, just pass-through */
#ifdef PCA_ENH
    push_next_indice( hMetaData, PCA_MODE_INACTIVE, 1 );
#else
    if ( hEncoderConfig->Opt_PCA_ON == 0 )
    {
        /* write by-pass indicator */
@@ -313,7 +316,7 @@ void ivas_pca_enc(

        return;
    }

#endif

    /* handle bitrate switching */
#ifdef PCA_ENH
+8 −0
Original line number Diff line number Diff line
@@ -151,6 +151,13 @@ ivas_error ivas_spar_enc_open(
    }
    /* PCA handle */
    hSpar->hPCA = NULL;
#ifdef PCA_ENH
    if ( ( hSpar->hPCA = (PCA_ENC_STATE *) malloc( sizeof( PCA_ENC_STATE ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR PCA encoder" );
    }
    ivas_pca_enc_init( hSpar->hPCA );
#else
    if ( hEncoderConfig->Opt_PCA_ON )
    {
        if ( ( hSpar->hPCA = (PCA_ENC_STATE *) malloc( sizeof( PCA_ENC_STATE ) ) ) == NULL )
@@ -159,6 +166,7 @@ ivas_error ivas_spar_enc_open(
        }
        ivas_pca_enc_init( hSpar->hPCA );
    }
#endif

    /* initialization */
    hSpar->hMdEnc->table_idx = -1;
+2 −0
Original line number Diff line number Diff line
@@ -1036,7 +1036,9 @@ typedef struct encoder_config_structure
    int16_t last_Opt_SC_VBR;                        /* flag indicating prev frame's SC-VBR mode */

    /* temp. development parameters */
#ifndef PCA_ENH
    int16_t Opt_PCA_ON;                             /* flag indicating PCA operation in SBA */
#endif
#ifdef LBR_SBA_BR_SWITCHING
    int16_t spar_reconfig_flag;
#endif
Loading