OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 // exit(EXIT_FAILURE); | 549 // exit(EXIT_FAILURE); |
550 } | 550 } |
551 /* iSAC decoding */ | 551 /* iSAC decoding */ |
552 | 552 |
553 if (plc && (framecnt + 1) % 10 == 0) { | 553 if (plc && (framecnt + 1) % 10 == 0) { |
554 if (nbTest != 2) | 554 if (nbTest != 2) |
555 declen = WebRtcIsacfix_DecodePlc(ISACFIX_main_inst, decoded, 1); | 555 declen = WebRtcIsacfix_DecodePlc(ISACFIX_main_inst, decoded, 1); |
556 else | 556 else |
557 declen = WebRtcIsacfix_DecodePlcNb(ISACFIX_main_inst, decoded, 1); | 557 declen = WebRtcIsacfix_DecodePlcNb(ISACFIX_main_inst, decoded, 1); |
558 } else { | 558 } else { |
559 if (nbTest != 2) | 559 if (nbTest != 2) { |
560 declen = WebRtcIsacfix_Decode(ISACFIX_main_inst, streamdata, | 560 declen = WebRtcIsacfix_Decode(ISACFIX_main_inst, streamdata, |
561 stream_len, decoded, speechType); | 561 stream_len, decoded, speechType); |
562 else | 562 } else { |
563 declen = WebRtcIsacfix_DecodeNb(ISACFIX_main_inst, streamdata, | 563 declen = WebRtcIsacfix_DecodeNb(ISACFIX_main_inst, streamdata, |
564 stream_len, decoded, speechType); | 564 stream_len, decoded, speechType); |
| 565 } |
565 } | 566 } |
566 if (declen <= 0) { | 567 if (declen <= 0) { |
567 /* exit if returned with error */ | 568 /* exit if returned with error */ |
568 errtype = WebRtcIsacfix_GetErrorCode(ISACFIX_main_inst); | 569 errtype = WebRtcIsacfix_GetErrorCode(ISACFIX_main_inst); |
569 printf("\n\nError in decoder: %d.\n\n", errtype); | 570 printf("\n\nError in decoder: %d.\n\n", errtype); |
570 // exit(EXIT_FAILURE); | 571 // exit(EXIT_FAILURE); |
571 } | 572 } |
572 } | 573 } |
573 | 574 |
574 /* Write decoded speech frame to file */ | 575 /* Write decoded speech frame to file */ |
575 fwrite(decoded, sizeof(int16_t), declen, outp); | 576 fwrite(decoded, sizeof(int16_t), declen, outp); |
576 } | 577 } |
577 | 578 |
578 fprintf(stderr, " \rframe = %d", framecnt); | 579 fprintf(stderr, " \rframe = %d", framecnt); |
579 framecnt++; | 580 framecnt++; |
580 | 581 |
581 #ifdef _DEBUG | 582 #ifdef _DEBUG |
582 | 583 |
583 totalsmpls += declen; | 584 totalsmpls += declen; |
584 totalbits += 8 * stream_len; | 585 totalbits += 8 * stream_len; |
585 kbps = ((double)FS) / ((double)cur_framesmpls) * 8.0 * stream_len / 1000.0; | 586 kbps = (double)FS / (double)cur_framesmpls * 8.0 * stream_len / 1000.0; |
586 fy = fopen("bit_rate.dat", "a"); | 587 fy = fopen("bit_rate.dat", "a"); |
587 fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps); | 588 fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps); |
588 fclose(fy); | 589 fclose(fy); |
589 | 590 |
590 #endif /* _DEBUG */ | 591 #endif /* _DEBUG */ |
591 } | 592 } |
592 | 593 |
593 #ifdef _DEBUG | 594 #ifdef _DEBUG |
594 printf("\n\ntotal bits = %d bits", totalbits); | 595 printf("\n\ntotal bits = %d bits", totalbits); |
595 printf("\nmeasured average bitrate = %0.3f kbits/s", | 596 printf("\nmeasured average bitrate = %0.3f kbits/s", |
(...skipping 13 matching lines...) Expand all Loading... |
609 fclose(outp); | 610 fclose(outp); |
610 | 611 |
611 WebRtcIsac_Free(ISAC_main_inst); | 612 WebRtcIsac_Free(ISAC_main_inst); |
612 WebRtcIsacfix_Free(ISACFIX_main_inst); | 613 WebRtcIsacfix_Free(ISACFIX_main_inst); |
613 | 614 |
614 // fclose(histfile); | 615 // fclose(histfile); |
615 // fclose(ratefile); | 616 // fclose(ratefile); |
616 | 617 |
617 return 0; | 618 return 0; |
618 } | 619 } |
OLD | NEW |