diff --git a/apps/encoder.c b/apps/encoder.c index a1b7f0d10118e6e9388a5313036ac7c37a8ceeb0..b06b5de0deaa24584551e1902907b92124e18085 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -353,6 +353,15 @@ int main( goto cleanup; } +#ifdef SUPPORT_FORCE_TCX10_TCX20 +#ifdef DEBUGGING + if ( arg.forcedMode == IVAS_ENC_FORCE_TCX10 && totalBitrate < 48000 ) + { + fprintf( stderr, "Warning: Enforcing the TCX10 mode is only supported for bitrates higher or equal than 48 kbps!\n\n" ); + } +#endif +#endif + /*------------------------------------------------------------------------------------------* * Configure and initialize (allocate memory for static variables) the encoder *------------------------------------------------------------------------------------------*/ @@ -998,7 +1007,24 @@ static bool parseCmdlIVAS_enc( } else { +#ifdef SUPPORT_FORCE_TCX10_TCX20 + if ( arg->forcedMode == IVAS_ENC_FORCE_TCX10 ) + { + strcpy( stmp, "TCX10" ); + } + else if ( arg->forcedMode == IVAS_ENC_FORCE_TCX20 ) + { + strcpy( stmp, "TCX20" ); + } + else + { + strncpy( stmp, argv[i + 1], sizeof( stmp ) ); + } + + fprintf( stdout, "Forcing codec to: %s\n", stmp ); +#else fprintf( stdout, "Forcing codec to: %s\n", argv[i + 1] ); +#endif } i += 2; @@ -1919,10 +1945,24 @@ static IVAS_ENC_FORCED_MODE parseForcedMode( { return IVAS_ENC_FORCE_GSC; } - if ( ( strcmp( forcedModeChar, "TCX" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX'" ) == 0 ) ) + if ( ( strcmp( forcedModeChar, "TCX" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX'" ) == 0 ) +#ifdef SUPPORT_FORCE_TCX10_TCX20 + || ( strcmp( forcedModeChar, "TCX20" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX20'" ) == 0 ) +#endif + ) { +#ifdef SUPPORT_FORCE_TCX10_TCX20 + return IVAS_ENC_FORCE_TCX20; +#else return IVAS_ENC_FORCE_TCX; +#endif } +#ifdef SUPPORT_FORCE_TCX10_TCX20 + if ( ( strcmp( forcedModeChar, "TCX10" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX10'" ) == 0 ) ) + { + return IVAS_ENC_FORCE_TCX10; + } +#endif if ( ( strcmp( forcedModeChar, "HQ" ) == 0 ) || ( strcmp( forcedModeChar, "'HQ'" ) == 0 ) ) { return IVAS_ENC_FORCE_HQ; diff --git a/lib_com/cnst.h b/lib_com/cnst.h index fe16db670a45815e431324c572e699d454512c4a..6e24b0d1b53df0b2815179f4d46178363157852d 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -190,8 +190,14 @@ #define FORCE_MUSIC 101 /* debugging - force music on the command line */ #define FORCE_ACELP 102 /* debugging - force ACELP core on the command line */ #define FORCE_GSC 103 /* debugging - force GSC core on the command line */ +#ifdef SUPPORT_FORCE_TCX10_TCX20 +#define FORCE_TCX10 104 /* debugging - force TCX10 core on the command line */ +#define FORCE_TCX20 105 /* debugging - force TCX20 core on the command line */ +#define FORCE_HQ 106 /* debugging - force HQ core on the command line */ +#else #define FORCE_TCX 104 /* debugging - force TCX core on the command line */ #define FORCE_HQ 105 /* debugging - force HQ core on the command line */ +#endif #define FORCE_TD_RENDERER 201 #define FORCE_CLDFB_RENDERER 202 #endif diff --git a/lib_com/options.h b/lib_com/options.h index 5b6855dbd2c027a8a9346c09cd695d6c5ef466cc..4bbd4655ce9315ea8e1f80bc643ad58e736c8dd6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -51,6 +51,7 @@ #define DEBUG_MODE_INFO_TWEAK /* Enable command line switch to specify subdirectory for debug info output inside "./res/" */ #define DEBUG_FORCE_MDCT_STEREO_MODE /* Force stereo mode decision for MDCT stereo: -stereo 3 1 forces L/R coding and -stereo 3 2 forces full M/S coding */ /*#define DBG_WAV_WRITER*/ /* Enable dbgwrite_wav() function for generating ".wav" files */ +#define SUPPORT_FORCE_TCX10_TCX20 /* VA: Enable -force tcx10|tcx20 command-line option */ #endif #define SUPPORT_JBM_TRACEFILE /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */ diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index e09166f8a2f6ec504872d09f44fce67d336c3608..80aa5fc06c1f09f7d527eb1a0d76073da11ae806 100644 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -989,7 +989,6 @@ static void init_modes_ivas_fx( move16(); } - /* TCX mode (TCX20 TCX10_10 or NO_TCX) */ if ( st->hTcxEnc != NULL ) { diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 0ecafc6c3fdb42a50ac19a840dff857d14def364..27da713240e155b7c669d1173e8d51f64eab6653 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -244,10 +244,17 @@ void ivas_decision_matrix_enc_fx( { st->core = ACELP_CORE; } +#ifdef SUPPORT_FORCE_TCX10_TCX20 + else if ( st->force == FORCE_TCX20 || st->force == FORCE_TCX10 ) /* Initalizations should always happen with TCX20*/ + { + st->core = TCX_20_CORE; + } +#else else if ( st->force == FORCE_TCX ) { st->core = TCX_20_CORE; } +#endif else if ( st->force == FORCE_HQ && st->element_mode != IVAS_CPE_MDCT && element_brate >= IVAS_24k4 ) { st->core = HQ_CORE; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 281e131f7390017a89e5b9cdf8fbac510946f70b..c78fbe10799918dfa6ad4568f8106e6a95e4d51a 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -2690,9 +2690,18 @@ static ivas_error forcedModeApiToInternal( case IVAS_ENC_FORCE_GSC: *forcedModeInternal = FORCE_GSC; break; +#ifdef SUPPORT_FORCE_TCX10_TCX20 + case IVAS_ENC_FORCE_TCX10: + *forcedModeInternal = FORCE_TCX10; + break; + case IVAS_ENC_FORCE_TCX20: + *forcedModeInternal = FORCE_TCX20; + break; +#else case IVAS_ENC_FORCE_TCX: *forcedModeInternal = FORCE_TCX; break; +#endif case IVAS_ENC_FORCE_HQ: *forcedModeInternal = FORCE_HQ; break; diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index 1fd4e0ad06cc523f1125b52761a5fa8ac4ca3894..c23f56df9fe0f33b70c5f0aea620a17003a618e9 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -127,7 +127,12 @@ typedef enum _IVAS_ENC_FORCED_MODE IVAS_ENC_FORCE_MUSIC, IVAS_ENC_FORCE_ACELP, IVAS_ENC_FORCE_GSC, +#ifdef SUPPORT_FORCE_TCX10_TCX20 + IVAS_ENC_FORCE_TCX10, + IVAS_ENC_FORCE_TCX20, +#else IVAS_ENC_FORCE_TCX, +#endif IVAS_ENC_FORCE_HQ, IVAS_ENC_FORCE_UNFORCED, IVAS_ENC_FORCE_UNDEFINED = 0xffff diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index bb977b432ecc2b0a6bc72f5775a7f9227452a986..3a59bead4acc9d1b60ddfc3fabf10c2d9910cf43 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -715,6 +715,20 @@ void SetTCXModeInfo_ivas_fx( move16(); } } + +#ifdef SUPPORT_FORCE_TCX10_TCX20 +#ifdef DEBUGGING + if ( st->force == FORCE_TCX10 ) + { + hTcxEnc->tcxMode = TCX_10; + } + else if ( st->force == FORCE_TCX20 ) + { + hTcxEnc->tcxMode = TCX_20; + } +#endif +#endif + /* set the left window overlap */ test(); test();