diff --git a/src/flac/decode.h b/src/flac/decode.h index 85f8b684..35d123f8 100644 --- a/src/flac/decode.h +++ b/src/flac/decode.h @@ -19,8 +19,10 @@ #ifndef flac__decode_h #define flac__decode_h +#include "analyze.h" + /* outfile == 0 => test only */ -int decode_wav(const char *infile, const char *outfile, bool analysis_mode, bool analyze_residual, bool verbose, uint64 skip); -int decode_raw(const char *infile, const char *outfile, bool analysis_mode, bool analyze_residual, bool verbose, uint64 skip, bool is_big_endian, bool is_unsigned_samples); +int decode_wav(const char *infile, const char *outfile, bool analysis_mode, analysis_options aopts, bool verbose, uint64 skip); +int decode_raw(const char *infile, const char *outfile, bool analysis_mode, analysis_options aopts, bool verbose, uint64 skip, bool is_big_endian, bool is_unsigned_samples); #endif diff --git a/src/flac/main.c b/src/flac/main.c index d8bab8a0..56390203 100644 --- a/src/flac/main.c +++ b/src/flac/main.c @@ -23,6 +23,7 @@ #include #include #include "FLAC/all.h" +#include "analyze.h" #include "decode.h" #include "encode.h" @@ -33,7 +34,7 @@ int main(int argc, char *argv[]) int i; bool verify = false, verbose = true, lax = false, mode_decode = false, test_only = false, analyze = false; bool do_mid_side = true, loose_mid_side = false, do_exhaustive_model_search = false, do_qlp_coeff_prec_search = false; - bool analyze_residual = false; + analysis_options aopts; unsigned padding = 0; unsigned max_lpc_order = 8; unsigned qlp_coeff_precision = 0; @@ -42,6 +43,9 @@ int main(int argc, char *argv[]) int format_channels = -1, format_bps = -1, format_sample_rate = -1; int blocksize = -1, rice_optimization_level = -1; + aopts.do_residual_text = false; + aopts.do_residual_gnuplot = false; + if(argc <= 1) return usage(0); @@ -95,10 +99,6 @@ int main(int argc, char *argv[]) qlp_coeff_precision = atoi(argv[++i]); else if(0 == strcmp(argv[i], "-r")) rice_optimization_level = atoi(argv[++i]); - else if(0 == strcmp(argv[i], "-v")) - analyze_residual = true; - else if(0 == strcmp(argv[i], "-v-")) - analyze_residual = false; else if(0 == strcmp(argv[i], "-V")) verify = true; else if(0 == strcmp(argv[i], "-V-")) @@ -119,6 +119,10 @@ int main(int argc, char *argv[]) format_is_wave = false; else if(0 == strcmp(argv[i], "-fw")) format_is_wave = true; + else if(0 == strcmp(argv[i], "--a-rgp")) + aopts.do_residual_gnuplot = true; + else if(0 == strcmp(argv[i], "--a-rgp-")) + aopts.do_residual_gnuplot = false; else if(0 == strcmp(argv[i], "-0")) { do_exhaustive_model_search = false; do_mid_side = false; @@ -281,9 +285,9 @@ int main(int argc, char *argv[]) if(mode_decode) if(format_is_wave) - return decode_wav(argv[i], test_only? 0 : argv[i+1], analyze, analyze_residual, verbose, skip); + return decode_wav(argv[i], test_only? 0 : argv[i+1], analyze, aopts, verbose, skip); else - return decode_raw(argv[i], test_only? 0 : argv[i+1], analyze, analyze_residual, verbose, skip, format_is_big_endian, format_is_unsigned_samples); + return decode_raw(argv[i], test_only? 0 : argv[i+1], analyze, aopts, verbose, skip, format_is_big_endian, format_is_unsigned_samples); else if(format_is_wave) return encode_wav(argv[i], argv[i+1], verbose, skip, verify, lax, do_mid_side, loose_mid_side, do_exhaustive_model_search, do_qlp_coeff_prec_search, rice_optimization_level, max_lpc_order, (unsigned)blocksize, qlp_coeff_precision, padding); @@ -345,7 +349,8 @@ int usage(const char *message, ...) printf(" -s : silent (do not write runtime encode/decode statistics to stdout)\n"); printf(" --skip samples : can be used both for encoding and decoding\n"); printf("analyze options:\n"); - printf(" -v : verbose (include residual signal in output)\n"); + printf(" --a-rtext : include residual signal in text output\n"); + printf(" --a-rgp : generate gnuplot files of residual distribution of each subframe\n"); printf("encoding options:\n"); printf(" --lax : allow encoder to generate non-Subset files\n"); printf(" -P bytes : write a PADDING block of the given length (0 => no PADDING block, default is -P 0)\n");