Unified · Split
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: bits.c,v 1.35 2004/01/16 20:20:32 menno Exp $ | 25 | ** $Id: bits.c,v 1.39 2004/09/04 14:56:27 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #include "common.h" | 28 | #include "common.h" |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: bits.h,v 1.34 2004/01/16 20:20:32 menno Exp $ | 25 | ** $Id: bits.h,v 1.35 2004/01/28 19:17:25 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #ifndef __BITS_H__ | 28 | #ifndef __BITS_H__ |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: common.h,v 1.47 2004/01/20 18:42:51 menno Exp $ | 25 | ** $Id: common.h,v 1.49 2004/01/29 11:31:11 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #ifndef __COMMON_H__ | 28 | #ifndef __COMMON_H__ |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: decoder.c,v 1.92 2004/01/16 20:20:32 menno Exp $ | 25 | ** $Id: decoder.c,v 1.93 2004/01/28 19:17:25 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #include "common.h" | 28 | #include "common.h" |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: error.c,v 1.20 2004/01/16 20:20:32 menno Exp $ | 25 | ** $Id: error.c,v 1.21 2004/01/28 19:17:25 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #include "common.h" | 28 | #include "common.h" |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: error.h,v 1.15 2004/01/16 20:20:32 menno Exp $ | 25 | ** $Id: error.h,v 1.16 2004/01/28 19:17:25 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #ifndef __ERROR_H__ | 28 | #ifndef __ERROR_H__ |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: fixed.h,v 1.17 2004/01/05 14:05:11 menno Exp $ | 25 | ** $Id: fixed.h,v 1.18 2004/01/28 19:17:25 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #ifndef __FIXED_H__ | 28 | #ifndef __FIXED_H__ |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: huffman.c,v 1.16 2004/01/20 18:42:51 menno Exp $ | 25 | ** $Id: huffman.c,v 1.17 2004/01/28 19:17:25 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #include "common.h" | 28 | #include "common.h" |
| @@ -62,7 +62,7 @@ int8_t huffman_scale_factor(bitfile *ld) · 33 unmodified lines | |||
| 62 | index = hcb_sf[index][bit]; | 62 | index = hcb_sf[index][bit]; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | return index + 121; | 65 | return index + 61; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | 68 | ||
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: output.c,v 1.33 2003/12/23 18:41:42 menno Exp $ | 25 | ** $Id: output.c,v 1.35 2004/02/26 09:29:27 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #include "common.h" | 28 | #include "common.h" |
| @@ -36,7 +36,7 @@ · 7 unmodified lines | |||
| 36 | 36 | ||
| 37 | #define FLOAT_SCALE (1.0f/(1<<15)) | 37 | #define FLOAT_SCALE (1.0f/(1<<15)) |
| 38 | 38 | ||
| 39 | #define DM_MUL REAL_CONST(0.4142135623730950488) // 1/(1+sqrt(2)) | 39 | #define DM_MUL REAL_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2)) |
| 40 | #define RSQRT2 REAL_CONST(0.7071067811865475244) // 1/sqrt(2) | 40 | #define RSQRT2 REAL_CONST(0.7071067811865475244) // 1/sqrt(2) |
| 41 | 41 | ||
| 42 | 42 | ||
| @@ -370,6 +370,29 @@ void *output_to_PCM(faacDecHandle hDecoder, · 327 unmodified lines | |||
| 370 | 370 | ||
| 371 | #else | 371 | #else |
| 372 | 372 | ||
| 373 | #define DM_MUL FRAC_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2)) | ||
| 374 | #define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2) | ||
| 375 | |||
| 376 | static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample, | ||
| 377 | uint8_t down_matrix, uint8_t *internal_channel) | ||
| 378 | { | ||
| 379 | if (!down_matrix) | ||
| 380 | return input[internal_channel[channel]][sample]; | ||
| 381 | |||
| 382 | if (channel == 0) | ||
| 383 | { | ||
| 384 | real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2); | ||
| 385 | real_t L_S = MUL_F(input[internal_channel[3]][sample], RSQRT2); | ||
| 386 | real_t cum = input[internal_channel[1]][sample] + C + L_S; | ||
| 387 | return MUL_F(cum, DM_MUL); | ||
| 388 | } else { | ||
| 389 | real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2); | ||
| 390 | real_t R_S = MUL_F(input[internal_channel[4]][sample], RSQRT2); | ||
| 391 | real_t cum = input[internal_channel[2]][sample] + C + R_S; | ||
| 392 | return MUL_F(cum, DM_MUL); | ||
| 393 | } | ||
| 394 | } | ||
| 395 | |||
| 373 | void* output_to_PCM(faacDecHandle hDecoder, | 396 | void* output_to_PCM(faacDecHandle hDecoder, |
| 374 | real_t **input, void *sample_buffer, uint8_t channels, | 397 | real_t **input, void *sample_buffer, uint8_t channels, |
| 375 | uint16_t frame_len, uint8_t format) | 398 | uint16_t frame_len, uint8_t format) |
| @@ -387,7 +410,8 @@ void* output_to_PCM(faacDecHandle hDecoder, · 11 unmodified lines | |||
| 387 | case FAAD_FMT_16BIT: | 410 | case FAAD_FMT_16BIT: |
| 388 | for(i = 0; i < frame_len; i++) | 411 | for(i = 0; i < frame_len; i++) |
| 389 | { | 412 | { |
| 390 | int32_t tmp = input[ch][i]; | 413 | //int32_t tmp = input[ch][i]; |
| 414 | int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); | ||
| 391 | if (tmp >= 0) | 415 | if (tmp >= 0) |
| 392 | { | 416 | { |
| 393 | tmp += (1 << (REAL_BITS-1)); | 417 | tmp += (1 << (REAL_BITS-1)); |
| @@ -409,7 +433,8 @@ void* output_to_PCM(faacDecHandle hDecoder, · 15 unmodified lines | |||
| 409 | case FAAD_FMT_24BIT: | 433 | case FAAD_FMT_24BIT: |
| 410 | for(i = 0; i < frame_len; i++) | 434 | for(i = 0; i < frame_len; i++) |
| 411 | { | 435 | { |
| 412 | int32_t tmp = input[ch][i]; | 436 | //int32_t tmp = input[ch][i]; |
| 437 | int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); | ||
| 413 | if (tmp >= 0) | 438 | if (tmp >= 0) |
| 414 | { | 439 | { |
| 415 | tmp += (1 << (REAL_BITS-9)); | 440 | tmp += (1 << (REAL_BITS-9)); |
| @@ -432,7 +457,8 @@ void* output_to_PCM(faacDecHandle hDecoder, · 16 unmodified lines | |||
| 432 | case FAAD_FMT_32BIT: | 457 | case FAAD_FMT_32BIT: |
| 433 | for(i = 0; i < frame_len; i++) | 458 | for(i = 0; i < frame_len; i++) |
| 434 | { | 459 | { |
| 435 | int32_t tmp = input[ch][i]; | 460 | //int32_t tmp = input[ch][i]; |
| 461 | int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); | ||
| 436 | if (tmp >= 0) | 462 | if (tmp >= 0) |
| 437 | { | 463 | { |
| 438 | tmp += (1 << (16-REAL_BITS-1)); | 464 | tmp += (1 << (16-REAL_BITS-1)); |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: specrec.c,v 1.41 2004/01/16 20:20:32 menno Exp $ | 25 | ** $Id: specrec.c,v 1.42 2004/01/28 19:17:26 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | /* | 28 | /* |
| @@ -688,16 +688,203 @@ void apply_scalefactors_sse(faacDecHandle hDecoder, ic_stream *ics, · 659 unmodified lines | |||
| 688 | } | 688 | } |
| 689 | #endif | 689 | #endif |
| 690 | 690 | ||
| 691 | static uint8_t allocate_single_channel(faacDecHandle hDecoder, uint8_t channel) | ||
| 692 | { | ||
| 693 | uint8_t mul = 1; | ||
| 694 | |||
| 695 | #ifdef MAIN_DEC | ||
| 696 | /* MAIN object type prediction */ | ||
| 697 | if (hDecoder->object_type == MAIN) | ||
| 698 | { | ||
| 699 | /* allocate the state only when needed */ | ||
| 700 | if (hDecoder->pred_stat[channel] == NULL) | ||
| 701 | { | ||
| 702 | hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); | ||
| 703 | reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); | ||
| 704 | } | ||
| 705 | } | ||
| 706 | #endif | ||
| 707 | |||
| 708 | #ifdef LTP_DEC | ||
| 709 | if (is_ltp_ot(hDecoder->object_type)) | ||
| 710 | { | ||
| 711 | /* allocate the state only when needed */ | ||
| 712 | if (hDecoder->lt_pred_stat[channel] == NULL) | ||
| 713 | { | ||
| 714 | hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 715 | memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 716 | } | ||
| 717 | } | ||
| 718 | #endif | ||
| 719 | |||
| 720 | if (hDecoder->time_out[channel] == NULL) | ||
| 721 | { | ||
| 722 | mul = 1; | ||
| 723 | #ifdef SBR_DEC | ||
| 724 | hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; | ||
| 725 | if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) | ||
| 726 | { | ||
| 727 | /* SBR requires 2 times as much output data */ | ||
| 728 | mul = 2; | ||
| 729 | hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; | ||
| 730 | } | ||
| 731 | #endif | ||
| 732 | hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 733 | memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 734 | } | ||
| 735 | |||
| 736 | if (hDecoder->fb_intermed[channel] == NULL) | ||
| 737 | { | ||
| 738 | hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); | ||
| 739 | memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); | ||
| 740 | } | ||
| 741 | |||
| 742 | #ifdef SSR_DEC | ||
| 743 | if (hDecoder->object_type == SSR) | ||
| 744 | { | ||
| 745 | if (hDecoder->ssr_overlap[channel] == NULL) | ||
| 746 | { | ||
| 747 | hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 748 | memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); | ||
| 749 | } | ||
| 750 | if (hDecoder->prev_fmd[channel] == NULL) | ||
| 751 | { | ||
| 752 | uint16_t k; | ||
| 753 | hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 754 | for (k = 0; k < 2*hDecoder->frameLength; k++) | ||
| 755 | hDecoder->prev_fmd[channel][k] = REAL_CONST(-1); | ||
| 756 | } | ||
| 757 | } | ||
| 758 | #endif | ||
| 759 | |||
| 760 | return 0; | ||
| 761 | } | ||
| 762 | |||
| 763 | static uint8_t allocate_channel_pair(faacDecHandle hDecoder, | ||
| 764 | uint8_t channel, uint8_t paired_channel) | ||
| 765 | { | ||
| 766 | uint8_t mul = 1; | ||
| 767 | |||
| 768 | #ifdef MAIN_DEC | ||
| 769 | /* MAIN object type prediction */ | ||
| 770 | if (hDecoder->object_type == MAIN) | ||
| 771 | { | ||
| 772 | /* allocate the state only when needed */ | ||
| 773 | if (hDecoder->pred_stat[channel] == NULL) | ||
| 774 | { | ||
| 775 | hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); | ||
| 776 | reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); | ||
| 777 | } | ||
| 778 | if (hDecoder->pred_stat[paired_channel] == NULL) | ||
| 779 | { | ||
| 780 | hDecoder->pred_stat[paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); | ||
| 781 | reset_all_predictors(hDecoder->pred_stat[paired_channel], hDecoder->frameLength); | ||
| 782 | } | ||
| 783 | } | ||
| 784 | #endif | ||
| 785 | |||
| 786 | #ifdef LTP_DEC | ||
| 787 | if (is_ltp_ot(hDecoder->object_type)) | ||
| 788 | { | ||
| 789 | /* allocate the state only when needed */ | ||
| 790 | if (hDecoder->lt_pred_stat[channel] == NULL) | ||
| 791 | { | ||
| 792 | hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 793 | memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 794 | } | ||
| 795 | if (hDecoder->lt_pred_stat[paired_channel] == NULL) | ||
| 796 | { | ||
| 797 | hDecoder->lt_pred_stat[paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 798 | memset(hDecoder->lt_pred_stat[paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 799 | } | ||
| 800 | } | ||
| 801 | #endif | ||
| 802 | |||
| 803 | if (hDecoder->time_out[channel] == NULL) | ||
| 804 | { | ||
| 805 | mul = 1; | ||
| 806 | #ifdef SBR_DEC | ||
| 807 | hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; | ||
| 808 | if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) | ||
| 809 | { | ||
| 810 | /* SBR requires 2 times as much output data */ | ||
| 811 | mul = 2; | ||
| 812 | hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; | ||
| 813 | } | ||
| 814 | #endif | ||
| 815 | hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 816 | memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 817 | } | ||
| 818 | if (hDecoder->time_out[paired_channel] == NULL) | ||
| 819 | { | ||
| 820 | hDecoder->time_out[paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 821 | memset(hDecoder->time_out[paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 822 | } | ||
| 823 | |||
| 824 | if (hDecoder->fb_intermed[channel] == NULL) | ||
| 825 | { | ||
| 826 | hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); | ||
| 827 | memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); | ||
| 828 | } | ||
| 829 | if (hDecoder->fb_intermed[paired_channel] == NULL) | ||
| 830 | { | ||
| 831 | hDecoder->fb_intermed[paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); | ||
| 832 | memset(hDecoder->fb_intermed[paired_channel], 0, hDecoder->frameLength*sizeof(real_t)); | ||
| 833 | } | ||
| 834 | |||
| 835 | #ifdef SSR_DEC | ||
| 836 | if (hDecoder->object_type == SSR) | ||
| 837 | { | ||
| 838 | if (hDecoder->ssr_overlap[cpe->channel] == NULL) | ||
| 839 | { | ||
| 840 | hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 841 | memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); | ||
| 842 | } | ||
| 843 | if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL) | ||
| 844 | { | ||
| 845 | hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 846 | memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); | ||
| 847 | } | ||
| 848 | if (hDecoder->prev_fmd[cpe->channel] == NULL) | ||
| 849 | { | ||
| 850 | uint16_t k; | ||
| 851 | hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 852 | for (k = 0; k < 2*hDecoder->frameLength; k++) | ||
| 853 | hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1); | ||
| 854 | } | ||
| 855 | if (hDecoder->prev_fmd[cpe->paired_channel] == NULL) | ||
| 856 | { | ||
| 857 | uint16_t k; | ||
| 858 | hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 859 | for (k = 0; k < 2*hDecoder->frameLength; k++) | ||
| 860 | hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1); | ||
| 861 | } | ||
| 862 | } | ||
| 863 | #endif | ||
| 864 | |||
| 865 | return 0; | ||
| 866 | } | ||
| 867 | |||
| 691 | uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, | 868 | uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, |
| 692 | element *sce, int16_t *spec_data) | 869 | element *sce, int16_t *spec_data) |
| 693 | { | 870 | { |
| 694 | uint8_t retval, mul; | 871 | uint8_t retval; |
| 695 | ALIGN real_t spec_coef[1024]; | 872 | ALIGN real_t spec_coef[1024]; |
| 696 | 873 | ||
| 697 | #ifdef PROFILE | 874 | #ifdef PROFILE |
| 698 | int64_t count = faad_get_ts(); | 875 | int64_t count = faad_get_ts(); |
| 699 | #endif | 876 | #endif |
| 700 | 877 | ||
| 878 | if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) | ||
| 879 | { | ||
| 880 | retval = allocate_single_channel(hDecoder, sce->channel); | ||
| 881 | if (retval > 0) | ||
| 882 | return retval; | ||
| 883 | |||
| 884 | hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; | ||
| 885 | } | ||
| 886 | |||
| 887 | |||
| 701 | /* inverse quantization */ | 888 | /* inverse quantization */ |
| 702 | retval = inverse_quantization(spec_coef, spec_data, hDecoder->frameLength); | 889 | retval = inverse_quantization(spec_coef, spec_data, hDecoder->frameLength); |
| 703 | if (retval > 0) | 890 | if (retval > 0) |
| @@ -727,13 +914,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, · 23 unmodified lines | |||
| 727 | /* MAIN object type prediction */ | 914 | /* MAIN object type prediction */ |
| 728 | if (hDecoder->object_type == MAIN) | 915 | if (hDecoder->object_type == MAIN) |
| 729 | { | 916 | { |
| 730 | /* allocate the state only when needed */ | ||
| 731 | if (hDecoder->pred_stat[sce->channel] == NULL) | ||
| 732 | { | ||
| 733 | hDecoder->pred_stat[sce->channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); | ||
| 734 | reset_all_predictors(hDecoder->pred_stat[sce->channel], hDecoder->frameLength); | ||
| 735 | } | ||
| 736 | |||
| 737 | /* intra channel prediction */ | 917 | /* intra channel prediction */ |
| 738 | ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength, | 918 | ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength, |
| 739 | hDecoder->sf_index); | 919 | hDecoder->sf_index); |
| @@ -761,13 +941,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, · 21 unmodified lines | |||
| 761 | } | 941 | } |
| 762 | #endif | 942 | #endif |
| 763 | 943 | ||
| 764 | /* allocate the state only when needed */ | ||
| 765 | if (hDecoder->lt_pred_stat[sce->channel] == NULL) | ||
| 766 | { | ||
| 767 | hDecoder->lt_pred_stat[sce->channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 768 | memset(hDecoder->lt_pred_stat[sce->channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 769 | } | ||
| 770 | |||
| 771 | /* long term prediction */ | 944 | /* long term prediction */ |
| 772 | lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb, | 945 | lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb, |
| 773 | ics->window_shape, hDecoder->window_shape_prev[sce->channel], | 946 | ics->window_shape, hDecoder->window_shape_prev[sce->channel], |
| @@ -787,28 +960,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, · 13 unmodified lines | |||
| 787 | } | 960 | } |
| 788 | 961 | ||
| 789 | 962 | ||
| 790 | if (hDecoder->time_out[sce->channel] == NULL) | ||
| 791 | { | ||
| 792 | mul = 1; | ||
| 793 | #ifdef SBR_DEC | ||
| 794 | hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; | ||
| 795 | if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) | ||
| 796 | { | ||
| 797 | /* SBR requires 2 times as much output data */ | ||
| 798 | mul = 2; | ||
| 799 | hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; | ||
| 800 | } | ||
| 801 | #endif | ||
| 802 | hDecoder->time_out[sce->channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 803 | memset(hDecoder->time_out[sce->channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 804 | } | ||
| 805 | |||
| 806 | if (hDecoder->fb_intermed[sce->channel] == NULL) | ||
| 807 | { | ||
| 808 | hDecoder->fb_intermed[sce->channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); | ||
| 809 | memset(hDecoder->fb_intermed[sce->channel], 0, hDecoder->frameLength*sizeof(real_t)); | ||
| 810 | } | ||
| 811 | |||
| 812 | /* filter bank */ | 963 | /* filter bank */ |
| 813 | #ifdef SSR_DEC | 964 | #ifdef SSR_DEC |
| 814 | if (hDecoder->object_type != SSR) | 965 | if (hDecoder->object_type != SSR) |
| @@ -826,19 +977,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, · 11 unmodified lines | |||
| 826 | #endif | 977 | #endif |
| 827 | #ifdef SSR_DEC | 978 | #ifdef SSR_DEC |
| 828 | } else { | 979 | } else { |
| 829 | if (hDecoder->ssr_overlap[sce->channel] == NULL) | ||
| 830 | { | ||
| 831 | hDecoder->ssr_overlap[sce->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 832 | memset(hDecoder->ssr_overlap[sce->channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); | ||
| 833 | } | ||
| 834 | if (hDecoder->prev_fmd[sce->channel] == NULL) | ||
| 835 | { | ||
| 836 | uint16_t k; | ||
| 837 | hDecoder->prev_fmd[sce->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 838 | for (k = 0; k < 2*hDecoder->frameLength; k++) | ||
| 839 | hDecoder->prev_fmd[sce->channel][k] = REAL_CONST(-1); | ||
| 840 | } | ||
| 841 | |||
| 842 | ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape, | 980 | ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape, |
| 843 | hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], | 981 | hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], |
| 844 | hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel], | 982 | hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel], |
| @@ -892,13 +1030,21 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, · 47 unmodified lines | |||
| 892 | uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, | 1030 | uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, |
| 893 | element *cpe, int16_t *spec_data1, int16_t *spec_data2) | 1031 | element *cpe, int16_t *spec_data1, int16_t *spec_data2) |
| 894 | { | 1032 | { |
| 895 | uint8_t retval, mul; | 1033 | uint8_t retval; |
| 896 | ALIGN real_t spec_coef1[1024]; | 1034 | ALIGN real_t spec_coef1[1024]; |
| 897 | ALIGN real_t spec_coef2[1024]; | 1035 | ALIGN real_t spec_coef2[1024]; |
| 898 | 1036 | ||
| 899 | #ifdef PROFILE | 1037 | #ifdef PROFILE |
| 900 | int64_t count = faad_get_ts(); | 1038 | int64_t count = faad_get_ts(); |
| 901 | #endif | 1039 | #endif |
| 1040 | if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) | ||
| 1041 | { | ||
| 1042 | retval = allocate_channel_pair(hDecoder, cpe->channel, cpe->paired_channel); | ||
| 1043 | if (retval > 0) | ||
| 1044 | return retval; | ||
| 1045 | |||
| 1046 | hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; | ||
| 1047 | } | ||
| 902 | 1048 | ||
| 903 | /* inverse quantization */ | 1049 | /* inverse quantization */ |
| 904 | retval = inverse_quantization(spec_coef1, spec_data1, hDecoder->frameLength); | 1050 | retval = inverse_quantization(spec_coef1, spec_data1, hDecoder->frameLength); |
| @@ -949,18 +1095,6 @@ uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_str · 44 unmodified lines | |||
| 949 | /* MAIN object type prediction */ | 1095 | /* MAIN object type prediction */ |
| 950 | if (hDecoder->object_type == MAIN) | 1096 | if (hDecoder->object_type == MAIN) |
| 951 | { | 1097 | { |
| 952 | /* allocate the state only when needed */ | ||
| 953 | if (hDecoder->pred_stat[cpe->channel] == NULL) | ||
| 954 | { | ||
| 955 | hDecoder->pred_stat[cpe->channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); | ||
| 956 | reset_all_predictors(hDecoder->pred_stat[cpe->channel], hDecoder->frameLength); | ||
| 957 | } | ||
| 958 | if (hDecoder->pred_stat[cpe->paired_channel] == NULL) | ||
| 959 | { | ||
| 960 | hDecoder->pred_stat[cpe->paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); | ||
| 961 | reset_all_predictors(hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength); | ||
| 962 | } | ||
| 963 | |||
| 964 | /* intra channel prediction */ | 1098 | /* intra channel prediction */ |
| 965 | ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength, | 1099 | ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength, |
| 966 | hDecoder->sf_index); | 1100 | hDecoder->sf_index); |
| @@ -999,18 +1133,6 @@ uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_str · 32 unmodified lines | |||
| 999 | } | 1133 | } |
| 1000 | #endif | 1134 | #endif |
| 1001 | 1135 | ||
| 1002 | /* allocate the state only when needed */ | ||
| 1003 | if (hDecoder->lt_pred_stat[cpe->channel] == NULL) | ||
| 1004 | { | ||
| 1005 | hDecoder->lt_pred_stat[cpe->channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 1006 | memset(hDecoder->lt_pred_stat[cpe->channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 1007 | } | ||
| 1008 | if (hDecoder->lt_pred_stat[cpe->paired_channel] == NULL) | ||
| 1009 | { | ||
| 1010 | hDecoder->lt_pred_stat[cpe->paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 1011 | memset(hDecoder->lt_pred_stat[cpe->paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); | ||
| 1012 | } | ||
| 1013 | |||
| 1014 | /* long term prediction */ | 1136 | /* long term prediction */ |
| 1015 | lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb, | 1137 | lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb, |
| 1016 | ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], | 1138 | ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], |
| @@ -1036,38 +1158,6 @@ uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_str · 19 unmodified lines | |||
| 1036 | drc_decode(hDecoder->drc, spec_coef2); | 1158 | drc_decode(hDecoder->drc, spec_coef2); |
| 1037 | } | 1159 | } |
| 1038 | 1160 | ||
| 1039 | if (hDecoder->time_out[cpe->channel] == NULL) | ||
| 1040 | { | ||
| 1041 | mul = 1; | ||
| 1042 | #ifdef SBR_DEC | ||
| 1043 | hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; | ||
| 1044 | if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) | ||
| 1045 | { | ||
| 1046 | /* SBR requires 2 times as much output data */ | ||
| 1047 | mul = 2; | ||
| 1048 | hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; | ||
| 1049 | } | ||
| 1050 | #endif | ||
| 1051 | hDecoder->time_out[cpe->channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 1052 | memset(hDecoder->time_out[cpe->channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 1053 | } | ||
| 1054 | if (hDecoder->time_out[cpe->paired_channel] == NULL) | ||
| 1055 | { | ||
| 1056 | hDecoder->time_out[cpe->paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 1057 | memset(hDecoder->time_out[cpe->paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); | ||
| 1058 | } | ||
| 1059 | |||
| 1060 | if (hDecoder->fb_intermed[cpe->channel] == NULL) | ||
| 1061 | { | ||
| 1062 | hDecoder->fb_intermed[cpe->channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); | ||
| 1063 | memset(hDecoder->fb_intermed[cpe->channel], 0, hDecoder->frameLength*sizeof(real_t)); | ||
| 1064 | } | ||
| 1065 | if (hDecoder->fb_intermed[cpe->paired_channel] == NULL) | ||
| 1066 | { | ||
| 1067 | hDecoder->fb_intermed[cpe->paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); | ||
| 1068 | memset(hDecoder->fb_intermed[cpe->paired_channel], 0, hDecoder->frameLength*sizeof(real_t)); | ||
| 1069 | } | ||
| 1070 | |||
| 1071 | /* filter bank */ | 1161 | /* filter bank */ |
| 1072 | #ifdef SSR_DEC | 1162 | #ifdef SSR_DEC |
| 1073 | if (hDecoder->object_type != SSR) | 1163 | if (hDecoder->object_type != SSR) |
| @@ -1092,31 +1182,6 @@ uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_str · 18 unmodified lines | |||
| 1092 | #endif | 1182 | #endif |
| 1093 | #ifdef SSR_DEC | 1183 | #ifdef SSR_DEC |
| 1094 | } else { | 1184 | } else { |
| 1095 | if (hDecoder->ssr_overlap[cpe->channel] == NULL) | ||
| 1096 | { | ||
| 1097 | hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 1098 | memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); | ||
| 1099 | } | ||
| 1100 | if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL) | ||
| 1101 | { | ||
| 1102 | hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 1103 | memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); | ||
| 1104 | } | ||
| 1105 | if (hDecoder->prev_fmd[cpe->channel] == NULL) | ||
| 1106 | { | ||
| 1107 | uint16_t k; | ||
| 1108 | hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 1109 | for (k = 0; k < 2*hDecoder->frameLength; k++) | ||
| 1110 | hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1); | ||
| 1111 | } | ||
| 1112 | if (hDecoder->prev_fmd[cpe->paired_channel] == NULL) | ||
| 1113 | { | ||
| 1114 | uint16_t k; | ||
| 1115 | hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | ||
| 1116 | for (k = 0; k < 2*hDecoder->frameLength; k++) | ||
| 1117 | hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1); | ||
| 1118 | } | ||
| 1119 | |||
| 1120 | ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape, | 1185 | ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape, |
| 1121 | hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], | 1186 | hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], |
| 1122 | hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel], | 1187 | hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel], |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: structs.h,v 1.29 2004/01/16 20:20:32 menno Exp $ | 25 | ** $Id: structs.h,v 1.30 2004/01/28 19:17:26 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #ifndef __STRUCTS_H__ | 28 | #ifndef __STRUCTS_H__ |
| @@ -386,6 +386,7 @@ typedef struct · 357 unmodified lines | |||
| 386 | 386 | ||
| 387 | void *sample_buffer; | 387 | void *sample_buffer; |
| 388 | uint8_t alloced_channels; | 388 | uint8_t alloced_channels; |
| 389 | uint8_t element_alloced[MAX_SYNTAX_ELEMENTS]; | ||
| 389 | 390 | ||
| 390 | uint8_t window_shape_prev[MAX_CHANNELS]; | 391 | uint8_t window_shape_prev[MAX_CHANNELS]; |
| 391 | #ifdef LTP_DEC | 392 | #ifdef LTP_DEC |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: syntax.c,v 1.68 2004/01/16 20:20:32 menno Exp $ | 25 | ** $Id: syntax.c,v 1.69 2004/01/28 19:17:26 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | /* | 28 | /* |
| @@ -328,11 +328,6 @@ void decode_sce_lfe(faacDecHandle hDecoder, · 299 unmodified lines | |||
| 328 | return; | 328 | return; |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | if (hDecoder->pce_set) | ||
| 332 | hDecoder->internal_channel[hDecoder->pce.sce_channel[tag]] = channels; | ||
| 333 | else | ||
| 334 | hDecoder->internal_channel[channels] = channels; | ||
| 335 | |||
| 336 | if (id_syn_ele == ID_SCE) | 331 | if (id_syn_ele == ID_SCE) |
| 337 | hDecoder->channel_element[channels] = hDecoder->fr_ch_ele; | 332 | hDecoder->channel_element[channels] = hDecoder->fr_ch_ele; |
| 338 | else /* LFE */ | 333 | else /* LFE */ |
| @@ -341,6 +336,11 @@ void decode_sce_lfe(faacDecHandle hDecoder, · 2 unmodified lines | |||
| 341 | 336 | ||
| 342 | hInfo->error = single_lfe_channel_element(hDecoder, ld, channels, &tag); | 337 | hInfo->error = single_lfe_channel_element(hDecoder, ld, channels, &tag); |
| 343 | 338 | ||
| 339 | if (hDecoder->pce_set) | ||
| 340 | hDecoder->internal_channel[hDecoder->pce.sce_channel[tag]] = channels; | ||
| 341 | else | ||
| 342 | hDecoder->internal_channel[channels] = channels; | ||
| 343 | |||
| 344 | hDecoder->fr_channels++; | 344 | hDecoder->fr_channels++; |
| 345 | hDecoder->fr_ch_ele++; | 345 | hDecoder->fr_ch_ele++; |
| 346 | } | 346 | } |
| @@ -362,6 +362,12 @@ void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, · 15 unmodified lines | |||
| 362 | return; | 362 | return; |
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | hDecoder->channel_element[channels] = hDecoder->fr_ch_ele; | ||
| 366 | hDecoder->channel_element[channels+1] = hDecoder->fr_ch_ele; | ||
| 367 | hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; | ||
| 368 | |||
| 369 | hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag); | ||
| 370 | |||
| 365 | if (hDecoder->pce_set) | 371 | if (hDecoder->pce_set) |
| 366 | { | 372 | { |
| 367 | hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels; | 373 | hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels; |
| @@ -371,12 +377,6 @@ void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, · 3 unmodified lines | |||
| 371 | hDecoder->internal_channel[channels+1] = channels+1; | 377 | hDecoder->internal_channel[channels+1] = channels+1; |
| 372 | } | 378 | } |
| 373 | 379 | ||
| 374 | hDecoder->channel_element[channels] = hDecoder->fr_ch_ele; | ||
| 375 | hDecoder->channel_element[channels+1] = hDecoder->fr_ch_ele; | ||
| 376 | hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; | ||
| 377 | |||
| 378 | hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag); | ||
| 379 | |||
| 380 | hDecoder->fr_channels += 2; | 380 | hDecoder->fr_channels += 2; |
| 381 | hDecoder->fr_ch_ele++; | 381 | hDecoder->fr_ch_ele++; |
| 382 | } | 382 | } |
| @@ -385,7 +385,6 @@ void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, · 2 unmodified lines | |||
| 385 | bitfile *ld, program_config *pce, drc_info *drc) | 385 | bitfile *ld, program_config *pce, drc_info *drc) |
| 386 | { | 386 | { |
| 387 | uint8_t id_syn_ele; | 387 | uint8_t id_syn_ele; |
| 388 | uint8_t ch_ele = 0; | ||
| 389 | 388 | ||
| 390 | hDecoder->fr_channels = 0; | 389 | hDecoder->fr_channels = 0; |
| 391 | hDecoder->fr_ch_ele = 0; | 390 | hDecoder->fr_ch_ele = 0; |
| @@ -404,21 +403,18 @@ void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, · 12 unmodified lines | |||
| 404 | case ID_SCE: | 403 | case ID_SCE: |
| 405 | if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; | 404 | if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; |
| 406 | decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); | 405 | decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); |
| 407 | ch_ele++; | ||
| 408 | if (hInfo->error > 0) | 406 | if (hInfo->error > 0) |
| 409 | return; | 407 | return; |
| 410 | break; | 408 | break; |
| 411 | case ID_CPE: | 409 | case ID_CPE: |
| 412 | if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; | 410 | if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; |
| 413 | decode_cpe(hDecoder, hInfo, ld, id_syn_ele); | 411 | decode_cpe(hDecoder, hInfo, ld, id_syn_ele); |
| 414 | ch_ele++; | ||
| 415 | if (hInfo->error > 0) | 412 | if (hInfo->error > 0) |
| 416 | return; | 413 | return; |
| 417 | break; | 414 | break; |
| 418 | case ID_LFE: | 415 | case ID_LFE: |
| 419 | hDecoder->has_lfe++; | 416 | hDecoder->has_lfe++; |
| 420 | decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); | 417 | decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); |
| 421 | ch_ele++; | ||
| 422 | if (hInfo->error > 0) | 418 | if (hInfo->error > 0) |
| 423 | return; | 419 | return; |
| 424 | break; | 420 | break; |
| @@ -448,7 +444,6 @@ void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, · 23 unmodified lines | |||
| 448 | /* SBR data will be read directly in the SCE/LFE/CPE element */ | 444 | /* SBR data will be read directly in the SCE/LFE/CPE element */ |
| 449 | if ((hInfo->error = fill_element(hDecoder, ld, drc | 445 | if ((hInfo->error = fill_element(hDecoder, ld, drc |
| 450 | #ifdef SBR_DEC | 446 | #ifdef SBR_DEC |
| 451 | //, (ch_ele == 0) ? INVALID_SBR_ELEMENT : (ch_ele-1) | ||
| 452 | , INVALID_SBR_ELEMENT | 447 | , INVALID_SBR_ELEMENT |
| 453 | #endif | 448 | #endif |
| 454 | )) > 0) | 449 | )) > 0) |
| @@ -463,67 +458,48 @@ void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, · 8 unmodified lines | |||
| 463 | { | 458 | { |
| 464 | case 1: | 459 | case 1: |
| 465 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); | 460 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); |
| 466 | ch_ele++; | ||
| 467 | if (hInfo->error > 0) | 461 | if (hInfo->error > 0) |
| 468 | return; | 462 | return; |
| 469 | break; | 463 | break; |
| 470 | case 2: | 464 | case 2: |
| 471 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); | 465 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); |
| 472 | ch_ele++; | ||
| 473 | if (hInfo->error > 0) | 466 | if (hInfo->error > 0) |
| 474 | return; | 467 | return; |
| 475 | break; | 468 | break; |
| 476 | case 3: | 469 | case 3: |
| 477 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); | 470 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); |
| 478 | ch_ele++; | ||
| 479 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); | 471 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); |
| 480 | ch_ele++; | ||
| 481 | if (hInfo->error > 0) | 472 | if (hInfo->error > 0) |
| 482 | return; | 473 | return; |
| 483 | break; | 474 | break; |
| 484 | case 4: | 475 | case 4: |
| 485 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); | 476 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); |
| 486 | ch_ele++; | ||
| 487 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); | 477 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); |
| 488 | ch_ele++; | ||
| 489 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); | 478 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); |
| 490 | ch_ele++; | ||
| 491 | if (hInfo->error > 0) | 479 | if (hInfo->error > 0) |
| 492 | return; | 480 | return; |
| 493 | break; | 481 | break; |
| 494 | case 5: | 482 | case 5: |
| 495 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); | 483 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); |
| 496 | ch_ele++; | ||
| 497 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); | 484 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); |
| 498 | ch_ele++; | ||
| 499 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); | 485 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); |
| 500 | ch_ele++; | ||
| 501 | if (hInfo->error > 0) | 486 | if (hInfo->error > 0) |
| 502 | return; | 487 | return; |
| 503 | break; | 488 | break; |
| 504 | case 6: | 489 | case 6: |
| 505 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); | 490 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); |
| 506 | ch_ele++; | ||
| 507 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); | 491 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); |
| 508 | ch_ele++; | ||
| 509 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); | 492 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); |
| 510 | ch_ele++; | ||
| 511 | decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); | 493 | decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); |
| 512 | ch_ele++; | ||
| 513 | if (hInfo->error > 0) | 494 | if (hInfo->error > 0) |
| 514 | return; | 495 | return; |
| 515 | break; | 496 | break; |
| 516 | case 7: | 497 | case 7: /* 8 channels */ |
| 517 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); | 498 | decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); |
| 518 | ch_ele++; | ||
| 519 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); | 499 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); |
| 520 | ch_ele++; | ||
| 521 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); | 500 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); |
| 522 | ch_ele++; | ||
| 523 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); | 501 | decode_cpe(hDecoder, hInfo, ld, ID_CPE); |
| 524 | ch_ele++; | ||
| 525 | decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); | 502 | decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); |
| 526 | ch_ele++; | ||
| 527 | if (hInfo->error > 0) | 503 | if (hInfo->error > 0) |
| 528 | return; | 504 | return; |
| 529 | break; | 505 | break; |
| @@ -1624,9 +1600,7 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) · 1094 unmodified lines | |||
| 1624 | 1600 | ||
| 1625 | /* decode intensity position */ | 1601 | /* decode intensity position */ |
| 1626 | t = huffman_scale_factor(ld); | 1602 | t = huffman_scale_factor(ld); |
| 1627 | if (t < 0) | 1603 | is_position += t; |
| 1628 | return 9; | ||
| 1629 | is_position += (t - 60); | ||
| 1630 | ics->scale_factors[g][sfb] = is_position; | 1604 | ics->scale_factors[g][sfb] = is_position; |
| 1631 | 1605 | ||
| 1632 | break; | 1606 | break; |
| @@ -1640,9 +1614,6 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) · 7 unmodified lines | |||
| 1640 | DEBUGVAR(1,73,"scale_factor_data(): first noise")) - 256; | 1614 | DEBUGVAR(1,73,"scale_factor_data(): first noise")) - 256; |
| 1641 | } else { | 1615 | } else { |
| 1642 | t = huffman_scale_factor(ld); | 1616 | t = huffman_scale_factor(ld); |
| 1643 | if (t < 0) | ||
| 1644 | return 9; | ||
| 1645 | t -= 60; | ||
| 1646 | } | 1617 | } |
| 1647 | noise_energy += t; | 1618 | noise_energy += t; |
| 1648 | ics->scale_factors[g][sfb] = noise_energy; | 1619 | ics->scale_factors[g][sfb] = noise_energy; |
| @@ -1656,9 +1627,7 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) · 7 unmodified lines | |||
| 1656 | 1627 | ||
| 1657 | /* decode scale factor */ | 1628 | /* decode scale factor */ |
| 1658 | t = huffman_scale_factor(ld); | 1629 | t = huffman_scale_factor(ld); |
| 1659 | if (t < 0) | 1630 | scale_factor += t; |
| 1660 | return 9; | ||
| 1661 | scale_factor += (t - 60); | ||
| 1662 | if (scale_factor < 0 || scale_factor > 255) | 1631 | if (scale_factor < 0 || scale_factor > 255) |
| 1663 | return 4; | 1632 | return 4; |
| 1664 | ics->scale_factors[g][sfb] = scale_factor; | 1633 | ics->scale_factors[g][sfb] = scale_factor; |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | ** Commercial non-GPL licensing of this software is possible. | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
| 24 | ** | 24 | ** |
| 25 | ** $Id: syntax.h,v 1.46 2004/01/16 20:20:32 menno Exp $ | 25 | ** $Id: syntax.h,v 1.47 2004/01/28 19:17:26 menno Exp $ |
| 26 | **/ | 26 | **/ |
| 27 | 27 | ||
| 28 | #ifndef __SYNTAX_H__ | 28 | #ifndef __SYNTAX_H__ |