1616#define DEFALUT_LOOKAHEAD_SAMPLES_FACTOR 4
1717/* デフォルトの可変ブロック分割数 */
1818#define DEFALUT_NUM_VARIABLE_BLOCK_DIVISIONS 1
19+ /* デフォルトのSVRによるフィルタ同定の学習繰り返し回数 */
20+ #define DEFALUT_NUM_SVR_FILTER_LEARNING_ITERATIONS 0
1921/* パラメータプリセットの最大インデックス */
2022#define SRLA_MAX_PARAMETER_PRESETS_INDEX 6
2123#if SRLA_MAX_PARAMETER_PRESETS_INDEX != (SRLA_NUM_PARAMETER_PRESETS - 1 )
@@ -49,6 +51,8 @@ static struct CommandLineParserSpecification command_line_spec[] = {
4951 COMMAND_LINE_PARSER_TRUE , NULL , COMMAND_LINE_PARSER_FALSE },
5052 { 'P' , "long-term-prediction" , "Specify long term (pitch) prediction order (must be odd number, default:0 (disabled))" ,
5153 COMMAND_LINE_PARSER_TRUE , NULL , COMMAND_LINE_PARSER_FALSE },
54+ { 0 , "svr-filter-learning-iteration" , "Specify the number of itration in filter computation using SVR (default:" TOSTRING (DEFALUT_NUM_SVR_FILTER_LEARNING_ITERATIONS ) ")" ,
55+ COMMAND_LINE_PARSER_TRUE , NULL , COMMAND_LINE_PARSER_FALSE },
5256 { 0 , "no-checksum-check" , "Whether to NOT check checksum at decoding (default:no)" ,
5357 COMMAND_LINE_PARSER_FALSE , NULL , COMMAND_LINE_PARSER_FALSE },
5458 { 'h' , "help" , "Show command help message" ,
@@ -69,7 +73,8 @@ static void encode_block_callback(
6973
7074/* エンコード 成功時は0、失敗時は0以外を返す */
7175static int do_encode (const char * in_filename , const char * out_filename ,
72- uint32_t encode_preset_no , uint32_t max_num_block_samples , uint32_t variable_block_num_divisions , uint32_t lookahead_samples_factor , uint32_t ltp_order )
76+ uint32_t encode_preset_no , uint32_t max_num_block_samples , uint32_t variable_block_num_divisions ,
77+ uint32_t lookahead_samples_factor , uint32_t ltp_order , uint32_t num_svr_filter_learning_iteration )
7378{
7479 FILE * out_fp ;
7580 struct WAVFile * in_wav ;
@@ -108,6 +113,7 @@ static int do_encode(const char *in_filename, const char *out_filename,
108113 parameter .min_num_samples_per_block = max_num_block_samples >> variable_block_num_divisions ;
109114 parameter .max_num_samples_per_block = max_num_block_samples ;
110115 parameter .num_lookahead_samples = lookahead_samples_factor * max_num_block_samples ;
116+ parameter .num_svr_filter_learning_iteration = num_svr_filter_learning_iteration ;
111117 parameter .ltp_order = ltp_order ;
112118 /* プリセットの反映 */
113119 parameter .preset = (uint8_t )encode_preset_no ;
@@ -307,6 +313,7 @@ int main(int argc, char** argv)
307313 uint32_t variable_block_num_divisions = DEFALUT_NUM_VARIABLE_BLOCK_DIVISIONS ;
308314 uint32_t lookahead_samples_factor = DEFALUT_LOOKAHEAD_SAMPLES_FACTOR ;
309315 uint32_t ltp_order = 0 ;
316+ uint32_t num_svr_filter_learning_iteration = DEFALUT_NUM_SVR_FILTER_LEARNING_ITERATIONS ;
310317 /* エンコードプリセット番号取得 */
311318 if (CommandLineParser_GetOptionAcquired (command_line_spec , "mode" ) == COMMAND_LINE_PARSER_TRUE ) {
312319 char * e ;
@@ -381,9 +388,19 @@ int main(int argc, char** argv)
381388 return 1 ;
382389 }
383390 }
391+ if (CommandLineParser_GetOptionAcquired (command_line_spec , "svr-filter-learning-iteration" ) == COMMAND_LINE_PARSER_TRUE ) {
392+ char * e ;
393+ const char * lstr = CommandLineParser_GetArgumentString (command_line_spec , "svr-filter-learning-iteration" );
394+ num_svr_filter_learning_iteration = (uint32_t )strtol (lstr , & e , 10 );
395+ if (* e != '\0' ) {
396+ fprintf (stderr , "%s: invalid number of lookahead samples. (irregular character found in %s at %s)\n" , argv [0 ], lstr , e );
397+ return 1 ;
398+ }
399+ }
384400 /* 一括エンコード実行 */
385401 if (do_encode (input_file , output_file ,
386- encode_preset_no , max_num_block_samples , variable_block_num_divisions , lookahead_samples_factor , ltp_order ) != 0 ) {
402+ encode_preset_no , max_num_block_samples , variable_block_num_divisions ,
403+ lookahead_samples_factor , ltp_order , num_svr_filter_learning_iteration ) != 0 ) {
387404 fprintf (stderr , "%s: failed to encode %s. \n" , argv [0 ], input_file );
388405 return 1 ;
389406 }
0 commit comments