Add chartjson_result_file argument to isac_fix_test.
So we can report perf results using JSON and not parsing stdout. I reordered the way the arguments are parsed, so that options go at the end, and not at the middle, which is an awkward place to put them. Regular usage specifying [-I], bottleneck_value, infile and outfile shouldn't be affected. Bug: chromium:807737 Change-Id: Ida863846400326c33e443d723f384971b891b6e5 Reviewed-on: https://webrtc-review.googlesource.com/47161 Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Reviewed-by: Oleh Prypin <oprypin@webrtc.org> Commit-Queue: Edward Lemur <ehmaldonado@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21873}
This commit is contained in:
@ -106,6 +106,8 @@ TEST(IsacFixTest, Kenny) {
|
|||||||
FILE *inp, *outp, *f_bn, *outbits;
|
FILE *inp, *outp, *f_bn, *outbits;
|
||||||
int endfile;
|
int endfile;
|
||||||
|
|
||||||
|
char chartjson_result_file[100];
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
int errtype, h = 0, k, packetLossPercent = 0;
|
int errtype, h = 0, k, packetLossPercent = 0;
|
||||||
int16_t CodingMode;
|
int16_t CodingMode;
|
||||||
@ -162,7 +164,7 @@ TEST(IsacFixTest, Kenny) {
|
|||||||
packetLossPercent = 0;
|
packetLossPercent = 0;
|
||||||
|
|
||||||
/* Handling wrong input arguments in the command line */
|
/* Handling wrong input arguments in the command line */
|
||||||
if ((argc<3) || (argc>21)) {
|
if ((argc<3) || (argc>22)) {
|
||||||
printf("\n\nWrong number of arguments or flag values.\n\n");
|
printf("\n\nWrong number of arguments or flag values.\n\n");
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -170,7 +172,7 @@ TEST(IsacFixTest, Kenny) {
|
|||||||
printf("iSAC version %s \n\n", version_number);
|
printf("iSAC version %s \n\n", version_number);
|
||||||
|
|
||||||
printf("Usage:\n\n");
|
printf("Usage:\n\n");
|
||||||
printf("%s [-F num][-I] bottleneck_value infile outfile \n\n", argv[0]);
|
printf("%s [-I] bottleneck_value infile outfile [-F num]\n\n", argv[0]);
|
||||||
printf("with:\n");
|
printf("with:\n");
|
||||||
printf("[-I] :if -I option is specified, the coder will use\n");
|
printf("[-I] :if -I option is specified, the coder will use\n");
|
||||||
printf(" an instantaneous Bottleneck value. If not, it\n");
|
printf(" an instantaneous Bottleneck value. If not, it\n");
|
||||||
@ -178,6 +180,8 @@ TEST(IsacFixTest, Kenny) {
|
|||||||
printf("bottleneck_value :the value of the bottleneck provided either\n");
|
printf("bottleneck_value :the value of the bottleneck provided either\n");
|
||||||
printf(" as a fixed value (e.g. 25000) or\n");
|
printf(" as a fixed value (e.g. 25000) or\n");
|
||||||
printf(" read from a file (e.g. bottleneck.txt)\n\n");
|
printf(" read from a file (e.g. bottleneck.txt)\n\n");
|
||||||
|
printf("infile :Normal speech input file\n\n");
|
||||||
|
printf("outfile :Speech output file\n\n");
|
||||||
printf("[-INITRATE num] :Set a new value for initial rate. Note! Only used"
|
printf("[-INITRATE num] :Set a new value for initial rate. Note! Only used"
|
||||||
" in adaptive mode.\n\n");
|
" in adaptive mode.\n\n");
|
||||||
printf("[-FL num] :Set (initial) frame length in msec. Valid length"
|
printf("[-FL num] :Set (initial) frame length in msec. Valid length"
|
||||||
@ -226,8 +230,9 @@ TEST(IsacFixTest, Kenny) {
|
|||||||
printf("[-RTP_INIT num] :if -RTP_INIT option is specified num will be"
|
printf("[-RTP_INIT num] :if -RTP_INIT option is specified num will be"
|
||||||
" the initial\n");
|
" the initial\n");
|
||||||
printf(" value of the rtp sequence number.\n\n");
|
printf(" value of the rtp sequence number.\n\n");
|
||||||
printf("infile : Normal speech input file\n\n");
|
printf("[--chartjson_result_file file]\n");
|
||||||
printf("outfile : Speech output file\n\n");
|
printf(" :If this option is specified, perf values will be"
|
||||||
|
" written to this file in a JSON format.\n\n");
|
||||||
printf("Example usage :\n\n");
|
printf("Example usage :\n\n");
|
||||||
printf("%s -I bottleneck.txt speechIn.pcm speechOut.pcm\n\n", argv[0]);
|
printf("%s -I bottleneck.txt speechIn.pcm speechOut.pcm\n\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -242,7 +247,8 @@ TEST(IsacFixTest, Kenny) {
|
|||||||
CodingMode = 0;
|
CodingMode = 0;
|
||||||
testNum = 0;
|
testNum = 0;
|
||||||
testCE = 0;
|
testCE = 0;
|
||||||
for (i = 1; i + 2 < static_cast<size_t>(argc); i++) {
|
i = 1;
|
||||||
|
|
||||||
/* Instantaneous mode */
|
/* Instantaneous mode */
|
||||||
if (!strcmp ("-I", argv[i])) {
|
if (!strcmp ("-I", argv[i])) {
|
||||||
printf("\nInstantaneous BottleNeck\n");
|
printf("\nInstantaneous BottleNeck\n");
|
||||||
@ -250,6 +256,14 @@ TEST(IsacFixTest, Kenny) {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Bottleneck value is processed after the for */
|
||||||
|
i++;
|
||||||
|
|
||||||
|
/* Get Input and Output files */
|
||||||
|
sscanf(argv[i++], "%s", inname);
|
||||||
|
sscanf(argv[i++], "%s", outname);
|
||||||
|
|
||||||
|
for (; i + 1 < static_cast<size_t>(argc); i++) {
|
||||||
/* Set (initial) bottleneck value */
|
/* Set (initial) bottleneck value */
|
||||||
if (!strcmp ("-INITRATE", argv[i])) {
|
if (!strcmp ("-INITRATE", argv[i])) {
|
||||||
rateBPS = atoi(argv[i + 1]);
|
rateBPS = atoi(argv[i + 1]);
|
||||||
@ -375,6 +389,11 @@ TEST(IsacFixTest, Kenny) {
|
|||||||
if (!strcmp ("-RTP_INIT", argv[i])) {
|
if (!strcmp ("-RTP_INIT", argv[i])) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp ("--chartjson_result_file", argv[i])) {
|
||||||
|
strncpy(chartjson_result_file, argv[i+1], 50);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get Bottleneck value */
|
/* Get Bottleneck value */
|
||||||
@ -413,10 +432,6 @@ TEST(IsacFixTest, Kenny) {
|
|||||||
printf("\nAdaptive BottleNeck\n");
|
printf("\nAdaptive BottleNeck\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get Input and Output files */
|
|
||||||
sscanf(argv[argc-2], "%s", inname);
|
|
||||||
sscanf(argv[argc-1], "%s", outname);
|
|
||||||
|
|
||||||
/* Add '.bit' to output bitstream file */
|
/* Add '.bit' to output bitstream file */
|
||||||
while ((int)outname[h] != 0) {
|
while ((int)outname[h] != 0) {
|
||||||
outbitsname[h] = outname[h];
|
outbitsname[h] = outname[h];
|
||||||
@ -826,6 +841,10 @@ TEST(IsacFixTest, Kenny) {
|
|||||||
webrtc::test::PrintResult("isac", "", "time_per_10ms_frame",
|
webrtc::test::PrintResult("isac", "", "time_per_10ms_frame",
|
||||||
(runtime * 10000) / length_file, "us", false);
|
(runtime * 10000) / length_file, "us", false);
|
||||||
|
|
||||||
|
if (*chartjson_result_file) {
|
||||||
|
webrtc::test::WritePerfResults(chartjson_result_file);
|
||||||
|
}
|
||||||
|
|
||||||
fclose(inp);
|
fclose(inp);
|
||||||
fclose(outp);
|
fclose(outp);
|
||||||
fclose(outbits);
|
fclose(outbits);
|
||||||
|
Reference in New Issue
Block a user