From 1fae6f0a2486d3381ffd02f510cc3793d48d39ec Mon Sep 17 00:00:00 2001 From: Karl Chen Date: Wed, 1 Jun 2016 15:03:55 +0800 Subject: [PATCH] Update Encoder.c --- silk/test/Encoder.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/silk/test/Encoder.c b/silk/test/Encoder.c index 12b29c5..184fdc7 100644 --- a/silk/test/Encoder.c +++ b/silk/test/Encoder.c @@ -94,6 +94,8 @@ unsigned long GetHighResolutionTime() /* O: time in usec*/ #endif // _WIN32 static void print_usage( char* argv[] ) { + printf( "\nBuild By kn007 (kn007.net)"); + printf( "\nGithub: https://github.com/kn007/silk-v3-decoder\n"); printf( "\nusage: %s in.pcm out.bit [settings]\n", argv[ 0 ] ); printf( "\nin.pcm : Speech input to encoder" ); printf( "\nout.bit : Bitstream output from encoder" ); @@ -107,6 +109,7 @@ static void print_usage( char* argv[] ) { printf( "\n-complexity : Set complexity, 0: low, 1: medium, 2: high; default: 2" ); printf( "\n-DTX : Enable DTX (0/1); default: 0" ); printf( "\n-quiet : Print only some basic values" ); + printf( "\n-tencent : Compatible with QQ/Wechat" ); printf( "\n"); } @@ -140,7 +143,7 @@ int main( int argc, char* argv[] ) #else SKP_int32 complexity_mode = 2; #endif - SKP_int32 DTX_enabled = 0, INBandFEC_enabled = 0, quiet = 0; + SKP_int32 DTX_enabled = 0, INBandFEC_enabled = 0, quiet = 0, tencent = 0; SKP_SILK_SDK_EncControlStruct encControl; // Struct for input to encoder SKP_SILK_SDK_EncControlStruct encStatus; // Struct for status of encoder @@ -180,6 +183,9 @@ int main( int argc, char* argv[] ) } else if( SKP_STR_CASEINSENSITIVE_COMPARE( argv[ args ], "-DTX") == 0 ) { sscanf( argv[ args + 1 ], "%d", &DTX_enabled ); args += 2; + } else if( SKP_STR_CASEINSENSITIVE_COMPARE( argv[ args ], "-tencent" ) == 0 ) { + tencent = 1; + args ++; } else if( SKP_STR_CASEINSENSITIVE_COMPARE( argv[ args ], "-quiet" ) == 0 ) { quiet = 1; args++; @@ -226,9 +232,16 @@ int main( int argc, char* argv[] ) } /* Add Silk header to stream */ - { - static const char Silk_header[] = "#!SILK_V3"; - fwrite( Silk_header, sizeof( char ), strlen( Silk_header ), bitOutFile ); + if( !tencent ) { + { + static const char Silk_header[] = "#!SILK_V3"; + fwrite( Silk_header, sizeof( char ), strlen( Silk_header ), bitOutFile ); + } + } else { + { + static const char Silk_header[] = "#!SILK_V3"; + fwrite( Silk_header, sizeof( char ), strlen( Silk_header ), bitOutFile ); + } } /* Create Encoder */