| @@ -22,7 +22,7 @@ · 21 unmodified lines |
| 22 | 22 | ** Commercial non-GPL licensing of this software is possible. |
| 23 | 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 | 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 | 868 | uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, |
| 692 | 869 | element *sce, int16_t *spec_data) |
| 693 | 870 | { |
| 694 | | − uint8_t retval, mul; |
| 871 | + uint8_t retval; |
| 695 | 872 | ALIGN real_t spec_coef[1024]; |
| 696 | 873 | |
| 697 | 874 | #ifdef PROFILE |
| 698 | 875 | int64_t count = faad_get_ts(); |
| 699 | 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 | 888 | /* inverse quantization */ |
| 702 | 889 | retval = inverse_quantization(spec_coef, spec_data, hDecoder->frameLength); |
| 703 | 890 | if (retval > 0) |
| @@ -727,13 +914,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, · 23 unmodified lines |
| 727 | 914 | /* MAIN object type prediction */ |
| 728 | 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 | 917 | /* intra channel prediction */ |
| 738 | 918 | ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength, |
| 739 | 919 | hDecoder->sf_index); |
| @@ -761,13 +941,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, · 21 unmodified lines |
| 761 | 941 | } |
| 762 | 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 | 944 | /* long term prediction */ |
| 772 | 945 | lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb, |
| 773 | 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 | 963 | /* filter bank */ |
| 813 | 964 | #ifdef SSR_DEC |
| 814 | 965 | if (hDecoder->object_type != SSR) |
| @@ -826,19 +977,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, · 11 unmodified lines |
| 826 | 977 | #endif |
| 827 | 978 | #ifdef SSR_DEC |
| 828 | 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 | 980 | ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape, |
| 843 | 981 | hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], |
| 844 | 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 | 1030 | uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, |
| 893 | 1031 | element *cpe, int16_t *spec_data1, int16_t *spec_data2) |
| 894 | 1032 | { |
| 895 | | − uint8_t retval, mul; |
| 1033 | + uint8_t retval; |
| 896 | 1034 | ALIGN real_t spec_coef1[1024]; |
| 897 | 1035 | ALIGN real_t spec_coef2[1024]; |
| 898 | 1036 | |
| 899 | 1037 | #ifdef PROFILE |
| 900 | 1038 | int64_t count = faad_get_ts(); |
| 901 | 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 | 1049 | /* inverse quantization */ |
| 904 | 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 | 1095 | /* MAIN object type prediction */ |
| 950 | 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 | 1098 | /* intra channel prediction */ |
| 965 | 1099 | ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength, |
| 966 | 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 | 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 | 1136 | /* long term prediction */ |
| 1015 | 1137 | lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb, |
| 1016 | 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 | 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 | 1161 | /* filter bank */ |
| 1072 | 1162 | #ifdef SSR_DEC |
| 1073 | 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 | 1182 | #endif |
| 1093 | 1183 | #ifdef SSR_DEC |
| 1094 | 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 | 1185 | ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape, |
| 1121 | 1186 | hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], |
| 1122 | 1187 | hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel], |