Skip to content

Commit

Permalink
Update Encoder.c
Browse files Browse the repository at this point in the history
  • Loading branch information
kn007 committed Jun 1, 2016
1 parent 5179ca1 commit 1fae6f0
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions silk/test/Encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand All @@ -107,6 +109,7 @@ static void print_usage( char* argv[] ) {
printf( "\n-complexity <comp> : Set complexity, 0: low, 1: medium, 2: high; default: 2" );
printf( "\n-DTX <flag> : Enable DTX (0/1); default: 0" );
printf( "\n-quiet : Print only some basic values" );
printf( "\n-tencent : Compatible with QQ/Wechat" );
printf( "\n");
}

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 1fae6f0

Please sign in to comment.