aboutsummaryrefslogtreecommitdiff
path: root/sound/fdk-aac/patches-free/020-remove-hcx-rvlc-error.patch
blob: bf1796a65ee3ac540c0d880d7cf3463e32ccc959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
From 022f1b86ef2f992c1c5623719e403b9b28e1becc Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Mon, 24 Jun 2019 16:26:20 +0200
Subject: Remove HCR, RVLC, error concealment

---
 Makefile.am                      |    7 -
 Makefile.vc                      |    7 -
 libAACdec/src/aac_ram.h          |    3 -
 libAACdec/src/aac_rom.cpp        |   96 --
 libAACdec/src/aac_rom.h          |    4 +-
 libAACdec/src/aacdec_hcr.cpp     | 1498 ---------------------------
 libAACdec/src/aacdec_hcr.h       |  128 ---
 libAACdec/src/aacdec_hcr_bit.cpp |  164 ---
 libAACdec/src/aacdec_hcr_bit.h   |  114 ---
 libAACdec/src/aacdec_hcr_types.h |  432 --------
 libAACdec/src/aacdec_hcrs.cpp    | 1551 ----------------------------
 libAACdec/src/aacdec_hcrs.h      |  176 ----
 libAACdec/src/aacdecoder.cpp     |   91 +-
 libAACdec/src/aacdecoder.h       |    3 -
 libAACdec/src/aacdecoder_lib.cpp |   73 +-
 libAACdec/src/block.cpp          |   59 +-
 libAACdec/src/channel.cpp        |   19 +-
 libAACdec/src/channelinfo.h      |   22 -
 libAACdec/src/conceal.cpp        | 2095 --------------------------------------
 libAACdec/src/conceal.h          |  152 ---
 libAACdec/src/conceal_types.h    |  203 ----
 libAACdec/src/rvlc.cpp           | 1217 ----------------------
 libAACdec/src/rvlc.h             |  153 ---
 libAACdec/src/rvlc_info.h        |  204 ----
 libAACdec/src/rvlcbit.cpp        |  148 ---
 libAACdec/src/rvlcbit.h          |  111 --
 libAACdec/src/rvlcconceal.cpp    |  787 --------------
 libAACdec/src/rvlcconceal.h      |  127 ---
 libAACdec/src/usacdec_lpd.cpp    |   20 +-
 29 files changed, 21 insertions(+), 9643 deletions(-)
 delete mode 100644 libAACdec/src/aacdec_hcr.cpp
 delete mode 100644 libAACdec/src/aacdec_hcr.h
 delete mode 100644 libAACdec/src/aacdec_hcr_bit.cpp
 delete mode 100644 libAACdec/src/aacdec_hcr_bit.h
 delete mode 100644 libAACdec/src/aacdec_hcr_types.h
 delete mode 100644 libAACdec/src/aacdec_hcrs.cpp
 delete mode 100644 libAACdec/src/aacdec_hcrs.h
 delete mode 100644 libAACdec/src/conceal.cpp
 delete mode 100644 libAACdec/src/conceal.h
 delete mode 100644 libAACdec/src/conceal_types.h
 delete mode 100644 libAACdec/src/rvlc.cpp
 delete mode 100644 libAACdec/src/rvlc.h
 delete mode 100644 libAACdec/src/rvlc_info.h
 delete mode 100644 libAACdec/src/rvlcbit.cpp
 delete mode 100644 libAACdec/src/rvlcbit.h
 delete mode 100644 libAACdec/src/rvlcconceal.cpp
 delete mode 100644 libAACdec/src/rvlcconceal.h

--- a/Makefile.am
+++ b/Makefile.am
@@ -50,9 +50,6 @@ AACDEC_SRC = \
     libAACdec/src/aac_ram.cpp \
     libAACdec/src/aac_rom.cpp \
     libAACdec/src/aacdec_drc.cpp \
-    libAACdec/src/aacdec_hcr.cpp \
-    libAACdec/src/aacdec_hcr_bit.cpp \
-    libAACdec/src/aacdec_hcrs.cpp \
     libAACdec/src/aacdec_pns.cpp \
     libAACdec/src/aacdec_tns.cpp \
     libAACdec/src/aacdecoder.cpp \
@@ -60,12 +57,8 @@ AACDEC_SRC = \
     libAACdec/src/block.cpp \
     libAACdec/src/channel.cpp \
     libAACdec/src/channelinfo.cpp \
-    libAACdec/src/conceal.cpp \
     libAACdec/src/ldfiltbank.cpp \
     libAACdec/src/pulsedata.cpp \
-    libAACdec/src/rvlc.cpp \
-    libAACdec/src/rvlcbit.cpp \
-    libAACdec/src/rvlcconceal.cpp \
     libAACdec/src/stereo.cpp \
     libAACdec/src/usacdec_ace_d4t64.cpp \
     libAACdec/src/usacdec_ace_ltp.cpp \
--- a/Makefile.vc
+++ b/Makefile.vc
@@ -34,9 +34,6 @@ AACDEC_SRC = \
     libAACdec/src/aac_ram.cpp \
     libAACdec/src/aac_rom.cpp \
     libAACdec/src/aacdec_drc.cpp \
-    libAACdec/src/aacdec_hcr.cpp \
-    libAACdec/src/aacdec_hcr_bit.cpp \
-    libAACdec/src/aacdec_hcrs.cpp \
     libAACdec/src/aacdec_pns.cpp \
     libAACdec/src/aacdec_tns.cpp \
     libAACdec/src/aacdecoder.cpp \
@@ -44,12 +41,8 @@ AACDEC_SRC = \
     libAACdec/src/block.cpp \
     libAACdec/src/channel.cpp \
     libAACdec/src/channelinfo.cpp \
-    libAACdec/src/conceal.cpp \
     libAACdec/src/ldfiltbank.cpp \
     libAACdec/src/pulsedata.cpp \
-    libAACdec/src/rvlc.cpp \
-    libAACdec/src/rvlcbit.cpp \
-    libAACdec/src/rvlcconceal.cpp \
     libAACdec/src/stereo.cpp \
     libAACdec/src/usacdec_ace_d4t64.cpp \
     libAACdec/src/usacdec_ace_ltp.cpp \
--- a/libAACdec/src/aac_ram.h
+++ b/libAACdec/src/aac_ram.h
@@ -111,9 +111,6 @@ amm-info@iis.fraunhofer.de
 
 #include "ac_arith_coder.h"
 
-#include "aacdec_hcr_types.h"
-#include "aacdec_hcr.h"
-
 /* End of formal fix.h */
 
 #define MAX_SYNCHS 10
--- a/libAACdec/src/aac_rom.cpp
+++ b/libAACdec/src/aac_rom.cpp
@@ -1583,102 +1583,6 @@ const SCHAR *aQuantTable[] = {
     aValTab24,                   /* 30            6        */
     aValTab24};                  /* 31            6        */
 
-/* arrays for HCR_TABLE_INFO structures */
-/* maximum length of codeword in each codebook */
-/* codebook:                     0,1, 2,3, 4, 5, 6, 7, 8, 9,
- * 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 */
-const UCHAR aMaxCwLen[MAX_CB] = {0,  11, 9,  20, 16, 13, 11, 14, 12, 17, 14,
-                                 49, 0,  0,  0,  0,  14, 17, 21, 21, 25, 25,
-                                 29, 29, 29, 29, 33, 33, 33, 37, 37, 41};
-
-/*                                                           11  13  15  17  19
- * 21  23  25  27  39  31 */
-/*                            CB:  0 1 2 3 4 5 6 7 8 9 10  12  14  16  18  20
- * 22  24  26  28  30       */
-const UCHAR aDimCb[MAX_CB] = {
-    2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; /* codebook dimension -
-                                                          zero cb got a
-                                                          dimension of 2 */
-
-/*                                                           11  13  15  17  19
- * 21  23  25  27  39  31 */
-/*                            CB:  0 1 2 3 4 5 6 7 8 9 10  12  14  16  18  20
- * 22  24  26  28  30       */
-const UCHAR aDimCbShift[MAX_CB] = {
-    1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; /* codebook dimension */
-
-/*               1 -> decode sign bits */
-/*               0 -> decode no sign bits                11  13  15  17  19  21
- * 23  25  27  39  31 */
-/*                        CB:  0 1 2 3 4 5 6 7 8 9 10  12  14  16  18  20  22
- * 24  26  28  30       */
-const UCHAR aSignCb[MAX_CB] = {0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
-                               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
-
-/* arrays for HCR_CB_PAIRS structures */
-const UCHAR aMinOfCbPair[MAX_CB_PAIRS] = {0,  1,  3,  5,  7,  9,  16, 17,
-                                          18, 19, 20, 21, 22, 23, 24, 25,
-                                          26, 27, 28, 29, 30, 31, 11};
-const UCHAR aMaxOfCbPair[MAX_CB_PAIRS] = {0,  2,  4,  6,  8,  10, 16, 17,
-                                          18, 19, 20, 21, 22, 23, 24, 25,
-                                          26, 27, 28, 29, 30, 31, 11};
-
-/* priorities of codebooks */
-const UCHAR aCbPriority[MAX_CB] = {0,  1,  1,  2,  2,  3,  3,  4,  4,  5,  5,
-                                   22, 0,  0,  0,  0,  6,  7,  8,  9,  10, 11,
-                                   12, 13, 14, 15, 16, 17, 18, 19, 20, 21};
-
-const SCHAR aCodebook2StartInt[] = {STOP_THIS_STATE,      /* cb  0 */
-                                    BODY_ONLY,            /* cb  1 */
-                                    BODY_ONLY,            /* cb  2 */
-                                    BODY_SIGN__BODY,      /* cb  3 */
-                                    BODY_SIGN__BODY,      /* cb  4 */
-                                    BODY_ONLY,            /* cb  5 */
-                                    BODY_ONLY,            /* cb  6 */
-                                    BODY_SIGN__BODY,      /* cb  7 */
-                                    BODY_SIGN__BODY,      /* cb  8 */
-                                    BODY_SIGN__BODY,      /* cb  9 */
-                                    BODY_SIGN__BODY,      /* cb 10 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 11 */
-                                    STOP_THIS_STATE,      /* cb 12 */
-                                    STOP_THIS_STATE,      /* cb 13 */
-                                    STOP_THIS_STATE,      /* cb 14 */
-                                    STOP_THIS_STATE,      /* cb 15 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 16 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 17 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 18 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 19 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 20 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 21 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 22 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 23 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 24 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 25 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 26 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 27 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 28 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 29 */
-                                    BODY_SIGN_ESC__BODY,  /* cb 30 */
-                                    BODY_SIGN_ESC__BODY}; /* cb 31 */
-
-const STATEFUNC aStateConstant2State[] = {
-    NULL,                                /*  0 = STOP_THIS_STATE           */
-    Hcr_State_BODY_ONLY,                 /*  1 = BODY_ONLY                 */
-    Hcr_State_BODY_SIGN__BODY,           /*  2 = BODY_SIGN__BODY           */
-    Hcr_State_BODY_SIGN__SIGN,           /*  3 = BODY_SIGN__SIGN           */
-    Hcr_State_BODY_SIGN_ESC__BODY,       /*  4 = BODY_SIGN_ESC__BODY       */
-    Hcr_State_BODY_SIGN_ESC__SIGN,       /*  5 = BODY_SIGN_ESC__SIGN       */
-    Hcr_State_BODY_SIGN_ESC__ESC_PREFIX, /*  6 = BODY_SIGN_ESC__ESC_PREFIX */
-    Hcr_State_BODY_SIGN_ESC__ESC_WORD};  /*  7 = BODY_SIGN_ESC__ESC_WORD   */
-
-/*                                     CB:  0 1 2 3 4 5 6 7 8  9 10      12
- * 14    16    18    20      22      24      26      28       30         */
-const USHORT aLargestAbsoluteValue[MAX_CB] = {
-    0,    1,   1,   2,   2,   4,   4,   7,   7,    12,  12,
-    8191, 0,   0,   0,   0,   15,  31,  47,  63,   95,  127,
-    159,  191, 223, 255, 319, 383, 511, 767, 1023, 2047}; /* lav */
 /*                                     CB:                           11     13
  * 15    17    19     21      23      25      27      39       31     */
 
--- a/libAACdec/src/aac_rom.h
+++ b/libAACdec/src/aac_rom.h
@@ -105,8 +105,6 @@ amm-info@iis.fraunhofer.de
 
 #include "common_fix.h"
 #include "FDK_audio.h"
-#include "aacdec_hcr_types.h"
-#include "aacdec_hcrs.h"
 
 #define PCM_DEC FIXP_DBL
 #define MAXVAL_PCM_DEC MAXVAL_DBL
@@ -165,7 +163,7 @@ typedef struct {
 extern const CodeBookDescription AACcodeBookDescriptionTable[13];
 extern const CodeBookDescription AACcodeBookDescriptionSCL;
 
-extern const STATEFUNC aStateConstant2State[];
+#define  MAX_CB                        32     /* last used CB is cb #31 when VCB11 is used */
 
 extern const SCHAR aCodebook2StartInt[];
 
--- a/libAACdec/src/aacdec_hcr.cpp
+++ /dev/null
@@ -1,1498 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Robert Weidner (DSP Solutions)
-
-   Description: HCR Decoder: HCR initialization, preprocess HCR sideinfo,
-                decode priority codewords (PCWs)
-
-*******************************************************************************/
-
-#include "aacdec_hcr.h"
-
-#include "aacdec_hcr_types.h"
-#include "aacdec_hcr_bit.h"
-#include "aacdec_hcrs.h"
-#include "aac_ram.h"
-#include "aac_rom.h"
-#include "channel.h"
-#include "block.h"
-
-#include "aacdecoder.h" /* for ID_CPE, ID_SCE ... */
-#include "FDK_bitstream.h"
-
-extern int mlFileChCurr;
-
-static void errDetectorInHcrSideinfoShrt(SCHAR cb, SHORT numLine,
-                                         UINT *errorWord);
-
-static void errDetectorInHcrLengths(SCHAR lengthOfLongestCodeword,
-                                    SHORT lengthOfReorderedSpectralData,
-                                    UINT *errorWord);
-
-static void HcrCalcNumCodeword(H_HCR_INFO pHcr);
-static void HcrSortCodebookAndNumCodewordInSection(H_HCR_INFO pHcr);
-static void HcrPrepareSegmentationGrid(H_HCR_INFO pHcr);
-static void HcrExtendedSectionInfo(H_HCR_INFO pHcr);
-
-static void DeriveNumberOfExtendedSortedSectionsInSets(
-    UINT numSegment, USHORT *pNumExtendedSortedCodewordInSection,
-    int numExtendedSortedCodewordInSectionIdx,
-    USHORT *pNumExtendedSortedSectionsInSets,
-    int numExtendedSortedSectionsInSetsIdx);
-
-static INT DecodeEscapeSequence(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
-                                INT quantSpecCoef, INT *pLeftStartOfSegment,
-                                SCHAR *pRemainingBitsInSegment,
-                                int *pNumDecodedBits);
-
-static int DecodePCW_Sign(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
-                          UINT codebookDim, const SCHAR *pQuantVal,
-                          FIXP_DBL *pQuantSpecCoef, int *quantSpecCoefIdx,
-                          INT *pLeftStartOfSegment,
-                          SCHAR *pRemainingBitsInSegment, int *pNumDecodedBits);
-
-static const SCHAR *DecodePCW_Body(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
-                                   const UINT *pCurrentTree,
-                                   const SCHAR *pQuantValBase,
-                                   INT *pLeftStartOfSegment,
-                                   SCHAR *pRemainingBitsInSegment,
-                                   int *pNumDecodedBits);
-
-static void DecodePCWs(HANDLE_FDK_BITSTREAM bs, H_HCR_INFO pHcr);
-
-static void HcrReorderQuantizedSpectralCoefficients(
-    H_HCR_INFO pHcr, CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    const SamplingRateInfo *pSamplingRateInfo);
-
-static UCHAR errDetectPcwSegmentation(SCHAR remainingBitsInSegment,
-                                      H_HCR_INFO pHcr, PCW_TYPE kind,
-                                      FIXP_DBL *qsc_base_of_cw,
-                                      UCHAR dimension);
-
-static void errDetectWithinSegmentationFinal(H_HCR_INFO pHcr);
-
-/*---------------------------------------------------------------------------------------------
-     description:   Check if codebook and numSect are within allowed range
-(short only)
---------------------------------------------------------------------------------------------
-*/
-static void errDetectorInHcrSideinfoShrt(SCHAR cb, SHORT numLine,
-                                         UINT *errorWord) {
-  if (cb < ZERO_HCB || cb >= MAX_CB_CHECK || cb == BOOKSCL) {
-    *errorWord |= CB_OUT_OF_RANGE_SHORT_BLOCK;
-  }
-  if (numLine < 0 || numLine > 1024) {
-    *errorWord |= LINE_IN_SECT_OUT_OF_RANGE_SHORT_BLOCK;
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   Check both HCR lengths
---------------------------------------------------------------------------------------------
-*/
-static void errDetectorInHcrLengths(SCHAR lengthOfLongestCodeword,
-                                    SHORT lengthOfReorderedSpectralData,
-                                    UINT *errorWord) {
-  if (lengthOfReorderedSpectralData < lengthOfLongestCodeword) {
-    *errorWord |= HCR_SI_LENGTHS_FAILURE;
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   Decode (and adapt if necessary) the two HCR sideinfo
-components: 'reordered_spectral_data_length' and 'longest_codeword_length'
---------------------------------------------------------------------------------------------
-*/
-
-void CHcr_Read(HANDLE_FDK_BITSTREAM bs,
-               CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-               const MP4_ELEMENT_ID globalHcrType) {
-  SHORT lengOfReorderedSpectralData;
-  SCHAR lengOfLongestCodeword;
-
-  pAacDecoderChannelInfo->pDynData->specificTo.aac.lenOfReorderedSpectralData =
-      0;
-  pAacDecoderChannelInfo->pDynData->specificTo.aac.lenOfLongestCodeword = 0;
-
-  /* ------- SI-Value No 1 ------- */
-  lengOfReorderedSpectralData = FDKreadBits(bs, 14) + ERROR_LORSD;
-  if (globalHcrType == ID_CPE) {
-    if ((lengOfReorderedSpectralData >= 0) &&
-        (lengOfReorderedSpectralData <= CPE_TOP_LENGTH)) {
-      pAacDecoderChannelInfo->pDynData->specificTo.aac
-          .lenOfReorderedSpectralData =
-          lengOfReorderedSpectralData; /* the decoded value is within range */
-    } else {
-      if (lengOfReorderedSpectralData > CPE_TOP_LENGTH) {
-        pAacDecoderChannelInfo->pDynData->specificTo.aac
-            .lenOfReorderedSpectralData =
-            CPE_TOP_LENGTH; /* use valid maximum */
-      }
-    }
-  } else if (globalHcrType == ID_SCE || globalHcrType == ID_LFE ||
-             globalHcrType == ID_CCE) {
-    if ((lengOfReorderedSpectralData >= 0) &&
-        (lengOfReorderedSpectralData <= SCE_TOP_LENGTH)) {
-      pAacDecoderChannelInfo->pDynData->specificTo.aac
-          .lenOfReorderedSpectralData =
-          lengOfReorderedSpectralData; /* the decoded value is within range */
-    } else {
-      if (lengOfReorderedSpectralData > SCE_TOP_LENGTH) {
-        pAacDecoderChannelInfo->pDynData->specificTo.aac
-            .lenOfReorderedSpectralData =
-            SCE_TOP_LENGTH; /* use valid maximum */
-      }
-    }
-  }
-
-  /* ------- SI-Value No 2 ------- */
-  lengOfLongestCodeword = FDKreadBits(bs, 6) + ERROR_LOLC;
-  if ((lengOfLongestCodeword >= 0) &&
-      (lengOfLongestCodeword <= LEN_OF_LONGEST_CW_TOP_LENGTH)) {
-    pAacDecoderChannelInfo->pDynData->specificTo.aac.lenOfLongestCodeword =
-        lengOfLongestCodeword; /* the decoded value is within range */
-  } else {
-    if (lengOfLongestCodeword > LEN_OF_LONGEST_CW_TOP_LENGTH) {
-      pAacDecoderChannelInfo->pDynData->specificTo.aac.lenOfLongestCodeword =
-          LEN_OF_LONGEST_CW_TOP_LENGTH; /* use valid maximum */
-    }
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   Set up HCR - must be called before every call to
-HcrDecoder(). For short block a sorting algorithm is applied to get the SI in
-the order that HCR could assemble the qsc's as if it is a long block.
------------------------------------------------------------------------------------------------
-        return:     error log
---------------------------------------------------------------------------------------------
-*/
-
-UINT HcrInit(H_HCR_INFO pHcr, CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-             const SamplingRateInfo *pSamplingRateInfo,
-             HANDLE_FDK_BITSTREAM bs) {
-  CIcsInfo *pIcsInfo = &pAacDecoderChannelInfo->icsInfo;
-  SHORT *pNumLinesInSec;
-  UCHAR *pCodeBk;
-  SHORT numSection;
-  SCHAR cb;
-  int numLine;
-  int i;
-
-  pHcr->decInOut.lengthOfReorderedSpectralData =
-      pAacDecoderChannelInfo->pDynData->specificTo.aac
-          .lenOfReorderedSpectralData;
-  pHcr->decInOut.lengthOfLongestCodeword =
-      pAacDecoderChannelInfo->pDynData->specificTo.aac.lenOfLongestCodeword;
-  pHcr->decInOut.pQuantizedSpectralCoefficientsBase =
-      pAacDecoderChannelInfo->pSpectralCoefficient;
-  pHcr->decInOut.quantizedSpectralCoefficientsIdx = 0;
-  pHcr->decInOut.pCodebook =
-      pAacDecoderChannelInfo->pDynData->specificTo.aac.aCodeBooks4Hcr;
-  pHcr->decInOut.pNumLineInSect =
-      pAacDecoderChannelInfo->pDynData->specificTo.aac.aNumLineInSec4Hcr;
-  pHcr->decInOut.numSection =
-      pAacDecoderChannelInfo->pDynData->specificTo.aac.numberSection;
-  pHcr->decInOut.errorLog = 0;
-  pHcr->nonPcwSideinfo.pResultBase =
-      SPEC_LONG(pAacDecoderChannelInfo->pSpectralCoefficient);
-
-  FDKsyncCache(bs);
-  pHcr->decInOut.bitstreamAnchor = (INT)FDKgetValidBits(bs);
-
-  if (!IsLongBlock(&pAacDecoderChannelInfo->icsInfo)) /* short block */
-  {
-    SHORT band;
-    SHORT maxBand;
-    SCHAR group;
-    SCHAR winGroupLen;
-    SCHAR window;
-    SCHAR numUnitInBand;
-    SCHAR cntUnitInBand;
-    SCHAR groupWin;
-    SCHAR cb_prev;
-
-    UCHAR *pCodeBook;
-    const SHORT *BandOffsets;
-    SCHAR numOfGroups;
-
-    pCodeBook = pAacDecoderChannelInfo->pDynData->aCodeBook; /* in */
-    pNumLinesInSec = pHcr->decInOut.pNumLineInSect;          /* out */
-    pCodeBk = pHcr->decInOut.pCodebook;                      /* out */
-    BandOffsets =
-        GetScaleFactorBandOffsets(pIcsInfo, pSamplingRateInfo); /* aux */
-    numOfGroups = GetWindowGroups(pIcsInfo);
-
-    numLine = 0;
-    numSection = 0;
-    cb = pCodeBook[0];
-    cb_prev = pCodeBook[0];
-
-    /* convert HCR-sideinfo into a unitwise manner: When the cb changes, a new
-     * section starts */
-
-    *pCodeBk++ = cb_prev;
-
-    maxBand = GetScaleFactorBandsTransmitted(&pAacDecoderChannelInfo->icsInfo);
-    for (band = 0; band < maxBand;
-         band++) { /* from low to high sfbs i.e. from low to high frequencies */
-      numUnitInBand =
-          ((BandOffsets[band + 1] - BandOffsets[band]) >>
-           FOUR_LOG_DIV_TWO_LOG); /* get the number of units in current sfb */
-      for (cntUnitInBand = numUnitInBand; cntUnitInBand != 0;
-           cntUnitInBand--) { /* for every unit in the band */
-        for (window = 0, group = 0; group < numOfGroups; group++) {
-          winGroupLen = (SCHAR)GetWindowGroupLength(
-              &pAacDecoderChannelInfo->icsInfo, group);
-          for (groupWin = winGroupLen; groupWin != 0; groupWin--, window++) {
-            cb = pCodeBook[group * 16 + band];
-            if (cb != cb_prev) {
-              errDetectorInHcrSideinfoShrt(cb, numLine,
-                                           &pHcr->decInOut.errorLog);
-              if (pHcr->decInOut.errorLog != 0) {
-                return (pHcr->decInOut.errorLog);
-              }
-              *pCodeBk++ = cb;
-              *pNumLinesInSec++ = numLine;
-              numSection++;
-
-              cb_prev = cb;
-              numLine = LINES_PER_UNIT;
-            } else {
-              numLine += LINES_PER_UNIT;
-            }
-          }
-        }
-      }
-    }
-
-    numSection++;
-
-    errDetectorInHcrSideinfoShrt(cb, numLine, &pHcr->decInOut.errorLog);
-    if (numSection <= 0 || numSection > 1024 / 2) {
-      pHcr->decInOut.errorLog |= NUM_SECT_OUT_OF_RANGE_SHORT_BLOCK;
-    }
-    errDetectorInHcrLengths(pHcr->decInOut.lengthOfLongestCodeword,
-                            pHcr->decInOut.lengthOfReorderedSpectralData,
-                            &pHcr->decInOut.errorLog);
-    if (pHcr->decInOut.errorLog != 0) {
-      return (pHcr->decInOut.errorLog);
-    }
-
-    *pCodeBk = cb;
-    *pNumLinesInSec = numLine;
-    pHcr->decInOut.numSection = numSection;
-
-  } else /* end short block prepare SI */
-  {      /* long block */
-    errDetectorInHcrLengths(pHcr->decInOut.lengthOfLongestCodeword,
-                            pHcr->decInOut.lengthOfReorderedSpectralData,
-                            &pHcr->decInOut.errorLog);
-    numSection = pHcr->decInOut.numSection;
-    pNumLinesInSec = pHcr->decInOut.pNumLineInSect;
-    pCodeBk = pHcr->decInOut.pCodebook;
-    if (numSection <= 0 || numSection > 64) {
-      pHcr->decInOut.errorLog |= NUM_SECT_OUT_OF_RANGE_LONG_BLOCK;
-      numSection = 0;
-    }
-
-    for (i = numSection; i != 0; i--) {
-      cb = *pCodeBk++;
-
-      if (cb < ZERO_HCB || cb >= MAX_CB_CHECK || cb == BOOKSCL) {
-        pHcr->decInOut.errorLog |= CB_OUT_OF_RANGE_LONG_BLOCK;
-      }
-
-      numLine = *pNumLinesInSec++;
-      /* FDK_ASSERT(numLine > 0); */
-
-      if ((numLine <= 0) || (numLine > 1024)) {
-        pHcr->decInOut.errorLog |= LINE_IN_SECT_OUT_OF_RANGE_LONG_BLOCK;
-      }
-    }
-    if (pHcr->decInOut.errorLog != 0) {
-      return (pHcr->decInOut.errorLog);
-    }
-  }
-
-  pCodeBk = pHcr->decInOut.pCodebook;
-  for (i = 0; i < numSection; i++) {
-    if ((*pCodeBk == NOISE_HCB) || (*pCodeBk == INTENSITY_HCB2) ||
-        (*pCodeBk == INTENSITY_HCB)) {
-      *pCodeBk = 0;
-    }
-    pCodeBk++;
-  }
-
-  /* HCR-sideinfo-input is complete and seems to be valid */
-
-  return (pHcr->decInOut.errorLog);
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function decodes the codewords of the spectral
-coefficients from the bitstream according to the HCR algorithm and stores the
-quantized spectral coefficients in correct order in the output buffer.
---------------------------------------------------------------------------------------------
-*/
-
-UINT HcrDecoder(H_HCR_INFO pHcr, CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                const SamplingRateInfo *pSamplingRateInfo,
-                HANDLE_FDK_BITSTREAM bs) {
-  int pTmp1, pTmp2, pTmp3, pTmp4;
-  int pTmp5;
-
-  INT bitCntOffst;
-  INT saveBitCnt = (INT)FDKgetValidBits(bs); /* save bitstream position */
-
-  HcrCalcNumCodeword(pHcr);
-
-  HcrSortCodebookAndNumCodewordInSection(pHcr);
-
-  HcrPrepareSegmentationGrid(pHcr);
-
-  HcrExtendedSectionInfo(pHcr);
-
-  if ((pHcr->decInOut.errorLog & HCR_FATAL_PCW_ERROR_MASK) != 0) {
-    return (pHcr->decInOut.errorLog); /* sideinfo is massively corrupt, return
-                                         from HCR without having decoded
-                                         anything */
-  }
-
-  DeriveNumberOfExtendedSortedSectionsInSets(
-      pHcr->segmentInfo.numSegment,
-      pHcr->sectionInfo.pNumExtendedSortedCodewordInSection,
-      pHcr->sectionInfo.numExtendedSortedCodewordInSectionIdx,
-      pHcr->sectionInfo.pNumExtendedSortedSectionsInSets,
-      pHcr->sectionInfo.numExtendedSortedSectionsInSetsIdx);
-
-  /* store */
-  pTmp1 = pHcr->sectionInfo.numExtendedSortedCodewordInSectionIdx;
-  pTmp2 = pHcr->sectionInfo.extendedSortedCodebookIdx;
-  pTmp3 = pHcr->sectionInfo.numExtendedSortedSectionsInSetsIdx;
-  pTmp4 = pHcr->decInOut.quantizedSpectralCoefficientsIdx;
-  pTmp5 = pHcr->sectionInfo.maxLenOfCbInExtSrtSecIdx;
-
-  /* ------- decode meaningful PCWs ------ */
-  DecodePCWs(bs, pHcr);
-
-  if ((pHcr->decInOut.errorLog & HCR_FATAL_PCW_ERROR_MASK) == 0) {
-    /* ------ decode the non-PCWs -------- */
-    DecodeNonPCWs(bs, pHcr);
-  }
-
-  errDetectWithinSegmentationFinal(pHcr);
-
-  /* restore */
-  pHcr->sectionInfo.numExtendedSortedCodewordInSectionIdx = pTmp1;
-  pHcr->sectionInfo.extendedSortedCodebookIdx = pTmp2;
-  pHcr->sectionInfo.numExtendedSortedSectionsInSetsIdx = pTmp3;
-  pHcr->decInOut.quantizedSpectralCoefficientsIdx = pTmp4;
-  pHcr->sectionInfo.maxLenOfCbInExtSrtSecIdx = pTmp5;
-
-  HcrReorderQuantizedSpectralCoefficients(pHcr, pAacDecoderChannelInfo,
-                                          pSamplingRateInfo);
-
-  /* restore bitstream position */
-  bitCntOffst = (INT)FDKgetValidBits(bs) - saveBitCnt;
-  if (bitCntOffst) {
-    FDKpushBiDirectional(bs, bitCntOffst);
-  }
-
-  return (pHcr->decInOut.errorLog);
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function reorders the quantized spectral coefficients
-sectionwise for long- and short-blocks and compares to the LAV (Largest Absolute
-Value of the current codebook) -- a counter is incremented if there is an error
-                    detected.
-                    Additional for short-blocks a unit-based-deinterleaving is
-applied. Moreover (for short blocks) the scaling is derived (compare plain
-huffman decoder).
---------------------------------------------------------------------------------------------
-*/
-
-static void HcrReorderQuantizedSpectralCoefficients(
-    H_HCR_INFO pHcr, CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    const SamplingRateInfo *pSamplingRateInfo) {
-  INT qsc;
-  UINT abs_qsc;
-  UINT i, j;
-  USHORT numSpectralValuesInSection;
-  FIXP_DBL *pTeVa;
-  USHORT lavErrorCnt = 0;
-
-  UINT numSection = pHcr->decInOut.numSection;
-  SPECTRAL_PTR pQuantizedSpectralCoefficientsBase =
-      pHcr->decInOut.pQuantizedSpectralCoefficientsBase;
-  FIXP_DBL *pQuantizedSpectralCoefficients =
-      SPEC_LONG(pHcr->decInOut.pQuantizedSpectralCoefficientsBase);
-  const UCHAR *pCbDimShift = aDimCbShift;
-  const USHORT *pLargestAbsVal = aLargestAbsoluteValue;
-  UCHAR *pSortedCodebook = pHcr->sectionInfo.pSortedCodebook;
-  USHORT *pNumSortedCodewordInSection =
-      pHcr->sectionInfo.pNumSortedCodewordInSection;
-  USHORT *pReorderOffset = pHcr->sectionInfo.pReorderOffset;
-  FIXP_DBL pTempValues[1024];
-  FIXP_DBL *pBak = pTempValues;
-
-  FDKmemclear(pTempValues, 1024 * sizeof(FIXP_DBL));
-
-  /* long and short: check if decoded huffman-values (quantized spectral
-   * coefficients) are within range */
-  for (i = numSection; i != 0; i--) {
-    numSpectralValuesInSection = *pNumSortedCodewordInSection++
-                                 << pCbDimShift[*pSortedCodebook];
-    pTeVa = &pTempValues[*pReorderOffset++];
-    for (j = numSpectralValuesInSection; j != 0; j--) {
-      qsc = *pQuantizedSpectralCoefficients++;
-      abs_qsc = fAbs(qsc);
-      if (abs_qsc <= pLargestAbsVal[*pSortedCodebook]) {
-        *pTeVa++ = (FIXP_DBL)qsc; /* the qsc value is within range */
-      } else {                    /* line is too high .. */
-        if (abs_qsc ==
-            Q_VALUE_INVALID) { /* .. because of previous marking --> dont set
-                                  LAV flag (would be confusing), just copy out
-                                  the already marked value */
-          *pTeVa++ = (FIXP_DBL)qsc;
-        } else { /* .. because a too high value was decoded for this cb --> set
-                    LAV flag */
-          *pTeVa++ = (FIXP_DBL)Q_VALUE_INVALID;
-          lavErrorCnt += 1;
-        }
-      }
-    }
-    pSortedCodebook++;
-  }
-
-  if (!IsLongBlock(&pAacDecoderChannelInfo->icsInfo)) {
-    FIXP_DBL *pOut;
-    FIXP_DBL locMax;
-    FIXP_DBL tmp;
-    SCHAR groupoffset;
-    SCHAR group;
-    SCHAR band;
-    SCHAR groupwin;
-    SCHAR window;
-    SCHAR numWinGroup;
-    SHORT interm;
-    SCHAR numSfbTransm;
-    SCHAR winGroupLen;
-    SHORT index;
-    INT msb;
-    INT lsb;
-
-    SHORT *pScaleFacHcr = pAacDecoderChannelInfo->pDynData->aScaleFactor;
-    SHORT *pSfbSclHcr = pAacDecoderChannelInfo->pDynData->aSfbScale;
-    const SHORT *BandOffsets = GetScaleFactorBandOffsets(
-        &pAacDecoderChannelInfo->icsInfo, pSamplingRateInfo);
-
-    pBak = pTempValues;
-    /* deinterleave unitwise for short blocks */
-    for (window = 0; window < (8); window++) {
-      pOut = SPEC(pQuantizedSpectralCoefficientsBase, window,
-                  pAacDecoderChannelInfo->granuleLength);
-      for (i = 0; i < (LINES_PER_UNIT_GROUP); i++) {
-        pTeVa = pBak + (window << FOUR_LOG_DIV_TWO_LOG) +
-                i * 32; /* distance of lines between unit groups has to be
-                           constant for every framelength (32)!  */
-        for (j = (LINES_PER_UNIT); j != 0; j--) {
-          *pOut++ = *pTeVa++;
-        }
-      }
-    }
-
-    /* short blocks only */
-    /* derive global scaling-value for every sfb and every window (as it is done
-     * in plain-huffman-decoder at short blocks) */
-    groupoffset = 0;
-
-    numWinGroup = GetWindowGroups(&pAacDecoderChannelInfo->icsInfo);
-    numSfbTransm =
-        GetScaleFactorBandsTransmitted(&pAacDecoderChannelInfo->icsInfo);
-
-    for (group = 0; group < numWinGroup; group++) {
-      winGroupLen =
-          GetWindowGroupLength(&pAacDecoderChannelInfo->icsInfo, group);
-      for (band = 0; band < numSfbTransm; band++) {
-        interm = group * 16 + band;
-        msb = pScaleFacHcr[interm] >> 2;
-        lsb = pScaleFacHcr[interm] & 3;
-        for (groupwin = 0; groupwin < winGroupLen; groupwin++) {
-          window = groupoffset + groupwin;
-          pBak = SPEC(pQuantizedSpectralCoefficientsBase, window,
-                      pAacDecoderChannelInfo->granuleLength);
-          locMax = FL2FXCONST_DBL(0.0f);
-          for (index = BandOffsets[band]; index < BandOffsets[band + 1];
-               index += LINES_PER_UNIT) {
-            pTeVa = &pBak[index];
-            for (i = LINES_PER_UNIT; i != 0; i--) {
-              tmp = (*pTeVa < FL2FXCONST_DBL(0.0f)) ? -*pTeVa++ : *pTeVa++;
-              locMax = fixMax(tmp, locMax);
-            }
-          }
-          if (fixp_abs(locMax) > (FIXP_DBL)MAX_QUANTIZED_VALUE) {
-            locMax = (FIXP_DBL)MAX_QUANTIZED_VALUE;
-          }
-          pSfbSclHcr[window * 16 + band] =
-              msb - GetScaleFromValue(
-                        locMax, lsb); /* save global scale maxima in this sfb */
-        }
-      }
-      groupoffset +=
-          GetWindowGroupLength(&pAacDecoderChannelInfo->icsInfo, group);
-    }
-  } else {
-    /* copy straight for long-blocks */
-    pQuantizedSpectralCoefficients =
-        SPEC_LONG(pQuantizedSpectralCoefficientsBase);
-    for (i = 1024; i != 0; i--) {
-      *pQuantizedSpectralCoefficients++ = *pBak++;
-    }
-  }
-
-  if (lavErrorCnt != 0) {
-    pHcr->decInOut.errorLog |= LAV_VIOLATION;
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function calculates the number of codewords
-                    for each section (numCodewordInSection) and the number of
-codewords for all sections (numCodeword). For zero and intensity codebooks a
-entry is also done in the variable numCodewordInSection. It is assumed that the
-codebook is a two tuples codebook. This is needed later for the calculation of
-the base addresses for the reordering of the quantize spectral coefficients at
-the end of the hcr tool. The variable numCodeword contain the number of
-codewords which are really in the bitstream. Zero or intensity codebooks does
-not increase the variable numCodewords.
------------------------------------------------------------------------------------------------
-        return:   -
---------------------------------------------------------------------------------------------
-*/
-
-static void HcrCalcNumCodeword(H_HCR_INFO pHcr) {
-  int hcrSection;
-  UINT numCodeword;
-
-  UINT numSection = pHcr->decInOut.numSection;
-  UCHAR *pCodebook = pHcr->decInOut.pCodebook;
-  SHORT *pNumLineInSection = pHcr->decInOut.pNumLineInSect;
-  const UCHAR *pCbDimShift = aDimCbShift;
-
-  USHORT *pNumCodewordInSection = pHcr->sectionInfo.pNumCodewordInSection;
-
-  numCodeword = 0;
-  for (hcrSection = numSection; hcrSection != 0; hcrSection--) {
-    *pNumCodewordInSection = *pNumLineInSection++ >> pCbDimShift[*pCodebook];
-    if (*pCodebook != 0) {
-      numCodeword += *pNumCodewordInSection;
-    }
-    pNumCodewordInSection++;
-    pCodebook++;
-  }
-  pHcr->sectionInfo.numCodeword = numCodeword;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function calculates the number
-                    of sorted codebooks and sorts the codebooks and the
-numCodewordInSection according to the priority.
---------------------------------------------------------------------------------------------
-*/
-
-static void HcrSortCodebookAndNumCodewordInSection(H_HCR_INFO pHcr) {
-  UINT i, j, k;
-  UCHAR temp;
-  UINT counter;
-  UINT startOffset;
-  UINT numZeroSection;
-  UCHAR *pDest;
-  UINT numSectionDec;
-
-  UINT numSection = pHcr->decInOut.numSection;
-  UCHAR *pCodebook = pHcr->decInOut.pCodebook;
-  UCHAR *pSortedCodebook = pHcr->sectionInfo.pSortedCodebook;
-  USHORT *pNumCodewordInSection = pHcr->sectionInfo.pNumCodewordInSection;
-  USHORT *pNumSortedCodewordInSection =
-      pHcr->sectionInfo.pNumSortedCodewordInSection;
-  UCHAR *pCodebookSwitch = pHcr->sectionInfo.pCodebookSwitch;
-  USHORT *pReorderOffset = pHcr->sectionInfo.pReorderOffset;
-  const UCHAR *pCbPriority = aCbPriority;
-  const UCHAR *pMinOfCbPair = aMinOfCbPair;
-  const UCHAR *pMaxOfCbPair = aMaxOfCbPair;
-  const UCHAR *pCbDimShift = aDimCbShift;
-
-  UINT searchStart = 0;
-
-  /* calculate *pNumSortedSection and store the priorities in array
-   * pSortedCdebook */
-  pDest = pSortedCodebook;
-  numZeroSection = 0;
-  for (i = numSection; i != 0; i--) {
-    if (pCbPriority[*pCodebook] == 0) {
-      numZeroSection += 1;
-    }
-    *pDest++ = pCbPriority[*pCodebook++];
-  }
-  pHcr->sectionInfo.numSortedSection =
-      numSection - numZeroSection; /* numSortedSection contains no zero or
-                                      intensity section */
-  pCodebook = pHcr->decInOut.pCodebook;
-
-  /* sort priorities of the codebooks in array pSortedCdebook[] */
-  numSectionDec = numSection - 1;
-  if (numSectionDec > 0) {
-    counter = numSectionDec;
-    for (j = numSectionDec; j != 0; j--) {
-      for (i = 0; i < counter; i++) {
-        /* swap priorities */
-        if (pSortedCodebook[i + 1] > pSortedCodebook[i]) {
-          temp = pSortedCodebook[i];
-          pSortedCodebook[i] = pSortedCodebook[i + 1];
-          pSortedCodebook[i + 1] = temp;
-        }
-      }
-      counter -= 1;
-    }
-  }
-
-  /* clear codebookSwitch array */
-  for (i = numSection; i != 0; i--) {
-    *pCodebookSwitch++ = 0;
-  }
-  pCodebookSwitch = pHcr->sectionInfo.pCodebookSwitch;
-
-  /* sort sectionCodebooks and numCodwordsInSection and calculate
-   * pReorderOffst[j] */
-  for (j = 0; j < numSection; j++) {
-    for (i = searchStart; i < numSection; i++) {
-      if (pCodebookSwitch[i] == 0 &&
-          (pMinOfCbPair[pSortedCodebook[j]] == pCodebook[i] ||
-           pMaxOfCbPair[pSortedCodebook[j]] == pCodebook[i])) {
-        pCodebookSwitch[i] = 1;
-        pSortedCodebook[j] = pCodebook[i]; /* sort codebook */
-        pNumSortedCodewordInSection[j] =
-            pNumCodewordInSection[i]; /* sort NumCodewordInSection */
-
-        startOffset = 0;
-        for (k = 0; k < i; k++) { /* make entry in pReorderOffst */
-          startOffset += pNumCodewordInSection[k] << pCbDimShift[pCodebook[k]];
-        }
-        pReorderOffset[j] =
-            startOffset; /* offset for reordering the codewords */
-
-        if (i == searchStart) {
-          k = i;
-          while (pCodebookSwitch[k++] == 1) searchStart++;
-        }
-        break;
-      }
-    }
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function calculates the segmentation, which includes
-numSegment, leftStartOfSegment, rightStartOfSegment and remainingBitsInSegment.
-                    The segmentation could be visualized a as kind of
-'overlay-grid' for the bitstream-block holding the HCR-encoded
-quantized-spectral-coefficients.
---------------------------------------------------------------------------------------------
-*/
-
-static void HcrPrepareSegmentationGrid(H_HCR_INFO pHcr) {
-  USHORT i, j;
-  USHORT numSegment = 0;
-  INT segmentStart = 0;
-  UCHAR segmentWidth;
-  UCHAR lastSegmentWidth;
-  UCHAR sortedCodebook;
-  UCHAR endFlag = 0;
-  INT intermediateResult;
-
-  SCHAR lengthOfLongestCodeword = pHcr->decInOut.lengthOfLongestCodeword;
-  SHORT lengthOfReorderedSpectralData =
-      pHcr->decInOut.lengthOfReorderedSpectralData;
-  UINT numSortedSection = pHcr->sectionInfo.numSortedSection;
-  UCHAR *pSortedCodebook = pHcr->sectionInfo.pSortedCodebook;
-  USHORT *pNumSortedCodewordInSection =
-      pHcr->sectionInfo.pNumSortedCodewordInSection;
-  INT *pLeftStartOfSegment = pHcr->segmentInfo.pLeftStartOfSegment;
-  INT *pRightStartOfSegment = pHcr->segmentInfo.pRightStartOfSegment;
-  SCHAR *pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  const UCHAR *pMaxCwLength = aMaxCwLen;
-
-  for (i = numSortedSection; i != 0; i--) {
-    sortedCodebook = *pSortedCodebook++;
-    segmentWidth =
-        fMin((INT)pMaxCwLength[sortedCodebook], (INT)lengthOfLongestCodeword);
-
-    for (j = *pNumSortedCodewordInSection; j != 0; j--) {
-      /* width allows a new segment */
-      intermediateResult = segmentStart;
-      if ((segmentStart + segmentWidth) <= lengthOfReorderedSpectralData) {
-        /* store segment start, segment length and increment the number of
-         * segments */
-        *pLeftStartOfSegment++ = intermediateResult;
-        *pRightStartOfSegment++ = intermediateResult + segmentWidth - 1;
-        *pRemainingBitsInSegment++ = segmentWidth;
-        segmentStart += segmentWidth;
-        numSegment += 1;
-      }
-      /* width does not allow a new segment */
-      else {
-        /* correct the last segment length */
-        pLeftStartOfSegment--;
-        pRightStartOfSegment--;
-        pRemainingBitsInSegment--;
-        segmentStart = *pLeftStartOfSegment;
-
-        lastSegmentWidth = lengthOfReorderedSpectralData - segmentStart;
-        *pRemainingBitsInSegment = lastSegmentWidth;
-        *pRightStartOfSegment = segmentStart + lastSegmentWidth - 1;
-        endFlag = 1;
-        break;
-      }
-    }
-    pNumSortedCodewordInSection++;
-    if (endFlag != 0) {
-      break;
-    }
-  }
-  pHcr->segmentInfo.numSegment = numSegment;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function adapts the sorted section boundaries to the
-boundaries of segmentation. If the section lengths does not fit completely into
-the current segment, the section is spitted into two so called 'extended
-                    sections'. The extended-section-info
-(pNumExtendedSortedCodewordInSectin and pExtendedSortedCodebook) is updated in
-this case.
-
---------------------------------------------------------------------------------------------
-*/
-
-static void HcrExtendedSectionInfo(H_HCR_INFO pHcr) {
-  UINT srtSecCnt = 0; /* counter for sorted sections */
-  UINT xSrtScCnt = 0; /* counter for extended sorted sections */
-  UINT remainNumCwInSortSec;
-  UINT inSegmentRemainNumCW;
-
-  UINT numSortedSection = pHcr->sectionInfo.numSortedSection;
-  UCHAR *pSortedCodebook = pHcr->sectionInfo.pSortedCodebook;
-  USHORT *pNumSortedCodewordInSection =
-      pHcr->sectionInfo.pNumSortedCodewordInSection;
-  UCHAR *pExtendedSortedCoBo = pHcr->sectionInfo.pExtendedSortedCodebook;
-  USHORT *pNumExtSortCwInSect =
-      pHcr->sectionInfo.pNumExtendedSortedCodewordInSection;
-  UINT numSegment = pHcr->segmentInfo.numSegment;
-  UCHAR *pMaxLenOfCbInExtSrtSec = pHcr->sectionInfo.pMaxLenOfCbInExtSrtSec;
-  SCHAR lengthOfLongestCodeword = pHcr->decInOut.lengthOfLongestCodeword;
-  const UCHAR *pMaxCwLength = aMaxCwLen;
-
-  remainNumCwInSortSec = pNumSortedCodewordInSection[srtSecCnt];
-  inSegmentRemainNumCW = numSegment;
-
-  while (srtSecCnt < numSortedSection) {
-    if (inSegmentRemainNumCW < remainNumCwInSortSec) {
-      pNumExtSortCwInSect[xSrtScCnt] = inSegmentRemainNumCW;
-      pExtendedSortedCoBo[xSrtScCnt] = pSortedCodebook[srtSecCnt];
-
-      remainNumCwInSortSec -= inSegmentRemainNumCW;
-      inSegmentRemainNumCW = numSegment;
-      /* data of a sorted section was not integrated in extended sorted section
-       */
-    } else if (inSegmentRemainNumCW == remainNumCwInSortSec) {
-      pNumExtSortCwInSect[xSrtScCnt] = inSegmentRemainNumCW;
-      pExtendedSortedCoBo[xSrtScCnt] = pSortedCodebook[srtSecCnt];
-
-      srtSecCnt++;
-      remainNumCwInSortSec = pNumSortedCodewordInSection[srtSecCnt];
-      inSegmentRemainNumCW = numSegment;
-      /* data of a sorted section was integrated in extended sorted section */
-    } else { /* inSegmentRemainNumCW > remainNumCwInSortSec */
-      pNumExtSortCwInSect[xSrtScCnt] = remainNumCwInSortSec;
-      pExtendedSortedCoBo[xSrtScCnt] = pSortedCodebook[srtSecCnt];
-
-      inSegmentRemainNumCW -= remainNumCwInSortSec;
-      srtSecCnt++;
-      remainNumCwInSortSec = pNumSortedCodewordInSection[srtSecCnt];
-      /* data of a sorted section was integrated in extended sorted section */
-    }
-    pMaxLenOfCbInExtSrtSec[xSrtScCnt] =
-        fMin((INT)pMaxCwLength[pExtendedSortedCoBo[xSrtScCnt]],
-             (INT)lengthOfLongestCodeword);
-
-    xSrtScCnt += 1;
-
-    if (xSrtScCnt >= (MAX_SFB_HCR + MAX_HCR_SETS)) {
-      pHcr->decInOut.errorLog |= EXTENDED_SORTED_COUNTER_OVERFLOW;
-      return;
-    }
-  }
-  pNumExtSortCwInSect[xSrtScCnt] = 0;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function calculates the number of extended sorted
-sections which belong to the sets. Each set from set 0 (one and only set for the
-PCWs) till to the last set gets a entry in the array to which
-                    'pNumExtendedSortedSectinsInSets' points to.
-
-                    Calculation: The entrys in
-pNumExtendedSortedCodewordInSectin are added untill the value numSegment is
-reached. Then the sum_variable is cleared and the calculation starts from the
-beginning. As much extended sorted Sections are summed up to reach the value
-numSegment, as much is the current entry in *pNumExtendedSortedCodewordInSectin.
---------------------------------------------------------------------------------------------
-*/
-static void DeriveNumberOfExtendedSortedSectionsInSets(
-    UINT numSegment, USHORT *pNumExtendedSortedCodewordInSection,
-    int numExtendedSortedCodewordInSectionIdx,
-    USHORT *pNumExtendedSortedSectionsInSets,
-    int numExtendedSortedSectionsInSetsIdx) {
-  USHORT counter = 0;
-  UINT cwSum = 0;
-  USHORT *pNumExSortCwInSec = pNumExtendedSortedCodewordInSection;
-  USHORT *pNumExSortSecInSets = pNumExtendedSortedSectionsInSets;
-
-  while (pNumExSortCwInSec[numExtendedSortedCodewordInSectionIdx] != 0) {
-    cwSum += pNumExSortCwInSec[numExtendedSortedCodewordInSectionIdx];
-    numExtendedSortedCodewordInSectionIdx++;
-    if (numExtendedSortedCodewordInSectionIdx >= (MAX_SFB_HCR + MAX_HCR_SETS)) {
-      return;
-    }
-    if (cwSum > numSegment) {
-      return;
-    }
-    counter++;
-    if (counter > 1024 / 4) {
-      return;
-    }
-    if (cwSum == numSegment) {
-      pNumExSortSecInSets[numExtendedSortedSectionsInSetsIdx] = counter;
-      numExtendedSortedSectionsInSetsIdx++;
-      if (numExtendedSortedSectionsInSetsIdx >= MAX_HCR_SETS) {
-        return;
-      }
-      counter = 0;
-      cwSum = 0;
-    }
-  }
-  pNumExSortSecInSets[numExtendedSortedSectionsInSetsIdx] =
-      counter; /* save last entry for the last - probably shorter - set */
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function decodes all priority codewords (PCWs) in a
-spectrum (within set 0). The calculation of the PCWs is managed in two loops.
-The loopcounter of the outer loop is set to the first value pointer
-                    pNumExtendedSortedSectionsInSets points to. This value
-represents the number of extended sorted sections within set 0. The loopcounter
-of the inner loop is set to the first value pointer
-                    pNumExtendedSortedCodewordInSectin points to. The value
-represents the number of extended sorted codewords in sections (the original
-sections have been splitted to go along with the borders of the sets). Each time
-the number of the extended sorted codewords in sections are de- coded, the
-pointer 'pNumExtendedSortedCodewordInSectin' is incremented by one.
---------------------------------------------------------------------------------------------
-*/
-static void DecodePCWs(HANDLE_FDK_BITSTREAM bs, H_HCR_INFO pHcr) {
-  UINT i;
-  USHORT extSortSec;
-  USHORT curExtSortCwInSec;
-  UCHAR codebook;
-  UCHAR dimension;
-  const UINT *pCurrentTree;
-  const SCHAR *pQuantValBase;
-  const SCHAR *pQuantVal;
-
-  USHORT *pNumExtendedSortedCodewordInSection =
-      pHcr->sectionInfo.pNumExtendedSortedCodewordInSection;
-  int numExtendedSortedCodewordInSectionIdx =
-      pHcr->sectionInfo.numExtendedSortedCodewordInSectionIdx;
-  UCHAR *pExtendedSortedCodebook = pHcr->sectionInfo.pExtendedSortedCodebook;
-  int extendedSortedCodebookIdx = pHcr->sectionInfo.extendedSortedCodebookIdx;
-  USHORT *pNumExtendedSortedSectionsInSets =
-      pHcr->sectionInfo.pNumExtendedSortedSectionsInSets;
-  int numExtendedSortedSectionsInSetsIdx =
-      pHcr->sectionInfo.numExtendedSortedSectionsInSetsIdx;
-  FIXP_DBL *pQuantizedSpectralCoefficients =
-      SPEC_LONG(pHcr->decInOut.pQuantizedSpectralCoefficientsBase);
-  int quantizedSpectralCoefficientsIdx =
-      pHcr->decInOut.quantizedSpectralCoefficientsIdx;
-  INT *pLeftStartOfSegment = pHcr->segmentInfo.pLeftStartOfSegment;
-  SCHAR *pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  UCHAR *pMaxLenOfCbInExtSrtSec = pHcr->sectionInfo.pMaxLenOfCbInExtSrtSec;
-  int maxLenOfCbInExtSrtSecIdx = pHcr->sectionInfo.maxLenOfCbInExtSrtSecIdx;
-  UCHAR maxAllowedCwLen;
-  int numDecodedBits;
-  const UCHAR *pCbDimension = aDimCb;
-  const UCHAR *pCbSign = aSignCb;
-
-  /* clear result array */
-  FDKmemclear(pQuantizedSpectralCoefficients + quantizedSpectralCoefficientsIdx,
-              1024 * sizeof(FIXP_DBL));
-
-  /* decode all PCWs in the extended sorted section(s) belonging to set 0 */
-  for (extSortSec =
-           pNumExtendedSortedSectionsInSets[numExtendedSortedSectionsInSetsIdx];
-       extSortSec != 0; extSortSec--) {
-    codebook =
-        pExtendedSortedCodebook[extendedSortedCodebookIdx]; /* get codebook for
-                                                               this extended
-                                                               sorted section
-                                                               and increment ptr
-                                                               to cb of next
-                                                               ext. sort sec */
-    extendedSortedCodebookIdx++;
-    if (extendedSortedCodebookIdx >= (MAX_SFB_HCR + MAX_HCR_SETS)) {
-      return;
-    }
-    dimension = pCbDimension[codebook]; /* get dimension of codebook of this
-                                           extended sort. sec. */
-    pCurrentTree =
-        aHuffTable[codebook]; /* convert codebook to pointer to QSCs */
-    pQuantValBase =
-        aQuantTable[codebook]; /* convert codebook to index to table of QSCs */
-    maxAllowedCwLen = pMaxLenOfCbInExtSrtSec[maxLenOfCbInExtSrtSecIdx];
-    maxLenOfCbInExtSrtSecIdx++;
-    if (maxLenOfCbInExtSrtSecIdx >= (MAX_SFB_HCR + MAX_HCR_SETS)) {
-      return;
-    }
-
-    /* switch for decoding with different codebooks: */
-    if (pCbSign[codebook] ==
-        0) { /* no sign bits follow after the codeword-body */
-      /* PCW_BodyONLY */
-      /*==============*/
-
-      for (curExtSortCwInSec = pNumExtendedSortedCodewordInSection
-               [numExtendedSortedCodewordInSectionIdx];
-           curExtSortCwInSec != 0; curExtSortCwInSec--) {
-        numDecodedBits = 0;
-
-        /* decode PCW_BODY */
-        pQuantVal = DecodePCW_Body(
-            bs, pHcr->decInOut.bitstreamAnchor, pCurrentTree, pQuantValBase,
-            pLeftStartOfSegment, pRemainingBitsInSegment, &numDecodedBits);
-
-        /* result is written out here because NO sign bits follow the body */
-        for (i = dimension; i != 0; i--) {
-          pQuantizedSpectralCoefficients[quantizedSpectralCoefficientsIdx] =
-              (FIXP_DBL)*pQuantVal++; /* write quant. spec. coef. into
-                                         spectrum; sign is already valid */
-          quantizedSpectralCoefficientsIdx++;
-          if (quantizedSpectralCoefficientsIdx >= 1024) {
-            return;
-          }
-        }
-
-        /* one more PCW should be decoded */
-
-        if (maxAllowedCwLen < (numDecodedBits + ERROR_PCW_BODY_ONLY_TOO_LONG)) {
-          pHcr->decInOut.errorLog |= TOO_MANY_PCW_BODY_BITS_DECODED;
-        }
-
-        if (1 == errDetectPcwSegmentation(
-                     *pRemainingBitsInSegment - ERROR_PCW_BODY, pHcr, PCW_BODY,
-                     pQuantizedSpectralCoefficients +
-                         quantizedSpectralCoefficientsIdx - dimension,
-                     dimension)) {
-          return;
-        }
-        pLeftStartOfSegment++; /* update pointer for decoding the next PCW */
-        pRemainingBitsInSegment++; /* update pointer for decoding the next PCW
-                                    */
-      }
-    } else if ((codebook < 11) && (pCbSign[codebook] ==
-                                   1)) { /* possibly there follow 1,2,3 or 4
-                                            sign bits after the codeword-body */
-      /* PCW_Body and PCW_Sign */
-      /*=======================*/
-
-      for (curExtSortCwInSec = pNumExtendedSortedCodewordInSection
-               [numExtendedSortedCodewordInSectionIdx];
-           curExtSortCwInSec != 0; curExtSortCwInSec--) {
-        int err;
-        numDecodedBits = 0;
-
-        pQuantVal = DecodePCW_Body(
-            bs, pHcr->decInOut.bitstreamAnchor, pCurrentTree, pQuantValBase,
-            pLeftStartOfSegment, pRemainingBitsInSegment, &numDecodedBits);
-
-        err = DecodePCW_Sign(
-            bs, pHcr->decInOut.bitstreamAnchor, dimension, pQuantVal,
-            pQuantizedSpectralCoefficients, &quantizedSpectralCoefficientsIdx,
-            pLeftStartOfSegment, pRemainingBitsInSegment, &numDecodedBits);
-        if (err != 0) {
-          return;
-        }
-        /* one more PCW should be decoded */
-
-        if (maxAllowedCwLen < (numDecodedBits + ERROR_PCW_BODY_SIGN_TOO_LONG)) {
-          pHcr->decInOut.errorLog |= TOO_MANY_PCW_BODY_SIGN_BITS_DECODED;
-        }
-
-        if (1 == errDetectPcwSegmentation(
-                     *pRemainingBitsInSegment - ERROR_PCW_BODY_SIGN, pHcr,
-                     PCW_BODY_SIGN,
-                     pQuantizedSpectralCoefficients +
-                         quantizedSpectralCoefficientsIdx - dimension,
-                     dimension)) {
-          return;
-        }
-        pLeftStartOfSegment++;
-        pRemainingBitsInSegment++;
-      }
-    } else if ((pCbSign[codebook] == 1) &&
-               (codebook >= 11)) { /* possibly there follow some sign bits and
-                                      maybe one or two escape sequences after
-                                      the cw-body */
-      /* PCW_Body, PCW_Sign and maybe PCW_Escape */
-      /*=========================================*/
-
-      for (curExtSortCwInSec = pNumExtendedSortedCodewordInSection
-               [numExtendedSortedCodewordInSectionIdx];
-           curExtSortCwInSec != 0; curExtSortCwInSec--) {
-        int err;
-        numDecodedBits = 0;
-
-        /* decode PCW_BODY */
-        pQuantVal = DecodePCW_Body(
-            bs, pHcr->decInOut.bitstreamAnchor, pCurrentTree, pQuantValBase,
-            pLeftStartOfSegment, pRemainingBitsInSegment, &numDecodedBits);
-
-        err = DecodePCW_Sign(
-            bs, pHcr->decInOut.bitstreamAnchor, dimension, pQuantVal,
-            pQuantizedSpectralCoefficients, &quantizedSpectralCoefficientsIdx,
-            pLeftStartOfSegment, pRemainingBitsInSegment, &numDecodedBits);
-        if (err != 0) {
-          return;
-        }
-
-        /* decode PCW_ESCAPE if present */
-        quantizedSpectralCoefficientsIdx -= DIMENSION_OF_ESCAPE_CODEBOOK;
-
-        if (fixp_abs(pQuantizedSpectralCoefficients
-                         [quantizedSpectralCoefficientsIdx]) ==
-            (FIXP_DBL)ESCAPE_VALUE) {
-          pQuantizedSpectralCoefficients[quantizedSpectralCoefficientsIdx] =
-              (FIXP_DBL)DecodeEscapeSequence(
-                  bs, pHcr->decInOut.bitstreamAnchor,
-                  pQuantizedSpectralCoefficients
-                      [quantizedSpectralCoefficientsIdx],
-                  pLeftStartOfSegment, pRemainingBitsInSegment,
-                  &numDecodedBits);
-        }
-        quantizedSpectralCoefficientsIdx++;
-        if (quantizedSpectralCoefficientsIdx >= 1024) {
-          return;
-        }
-
-        if (fixp_abs(pQuantizedSpectralCoefficients
-                         [quantizedSpectralCoefficientsIdx]) ==
-            (FIXP_DBL)ESCAPE_VALUE) {
-          pQuantizedSpectralCoefficients[quantizedSpectralCoefficientsIdx] =
-              (FIXP_DBL)DecodeEscapeSequence(
-                  bs, pHcr->decInOut.bitstreamAnchor,
-                  pQuantizedSpectralCoefficients
-                      [quantizedSpectralCoefficientsIdx],
-                  pLeftStartOfSegment, pRemainingBitsInSegment,
-                  &numDecodedBits);
-        }
-        quantizedSpectralCoefficientsIdx++;
-        if (quantizedSpectralCoefficientsIdx >= 1024) {
-          return;
-        }
-
-        /* one more PCW should be decoded */
-
-        if (maxAllowedCwLen <
-            (numDecodedBits + ERROR_PCW_BODY_SIGN_ESC_TOO_LONG)) {
-          pHcr->decInOut.errorLog |= TOO_MANY_PCW_BODY_SIGN_ESC_BITS_DECODED;
-        }
-
-        if (1 == errDetectPcwSegmentation(
-                     *pRemainingBitsInSegment - ERROR_PCW_BODY_SIGN_ESC, pHcr,
-                     PCW_BODY_SIGN_ESC,
-                     pQuantizedSpectralCoefficients +
-                         quantizedSpectralCoefficientsIdx -
-                         DIMENSION_OF_ESCAPE_CODEBOOK,
-                     DIMENSION_OF_ESCAPE_CODEBOOK)) {
-          return;
-        }
-        pLeftStartOfSegment++;
-        pRemainingBitsInSegment++;
-      }
-    }
-
-    /* all PCWs belonging to this extended section should be decoded */
-    numExtendedSortedCodewordInSectionIdx++;
-    if (numExtendedSortedCodewordInSectionIdx >= MAX_SFB_HCR + MAX_HCR_SETS) {
-      return;
-    }
-  }
-  /* all PCWs should be decoded */
-
-  numExtendedSortedSectionsInSetsIdx++;
-  if (numExtendedSortedSectionsInSetsIdx >= MAX_HCR_SETS) {
-    return;
-  }
-
-  /* Write back indexes into structure */
-  pHcr->sectionInfo.numExtendedSortedCodewordInSectionIdx =
-      numExtendedSortedCodewordInSectionIdx;
-  pHcr->sectionInfo.extendedSortedCodebookIdx = extendedSortedCodebookIdx;
-  pHcr->sectionInfo.numExtendedSortedSectionsInSetsIdx =
-      numExtendedSortedSectionsInSetsIdx;
-  pHcr->decInOut.quantizedSpectralCoefficientsIdx =
-      quantizedSpectralCoefficientsIdx;
-  pHcr->sectionInfo.maxLenOfCbInExtSrtSecIdx = maxLenOfCbInExtSrtSecIdx;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function checks immediately after every decoded PCW,
-whether out of the current segment too many bits have been read or not. If an
-error occurrs, probably the sideinfo or the HCR-bitstream block holding the
-huffman encoded quantized spectral coefficients is distorted. In this case the
-two or four quantized spectral coefficients belonging to the current codeword
-                    are marked (for being detected by concealment later).
---------------------------------------------------------------------------------------------
-*/
-static UCHAR errDetectPcwSegmentation(SCHAR remainingBitsInSegment,
-                                      H_HCR_INFO pHcr, PCW_TYPE kind,
-                                      FIXP_DBL *qsc_base_of_cw,
-                                      UCHAR dimension) {
-  SCHAR i;
-  if (remainingBitsInSegment < 0) {
-    /* log the error */
-    switch (kind) {
-      case PCW_BODY:
-        pHcr->decInOut.errorLog |= SEGMENT_OVERRIDE_ERR_PCW_BODY;
-        break;
-      case PCW_BODY_SIGN:
-        pHcr->decInOut.errorLog |= SEGMENT_OVERRIDE_ERR_PCW_BODY_SIGN;
-        break;
-      case PCW_BODY_SIGN_ESC:
-        pHcr->decInOut.errorLog |= SEGMENT_OVERRIDE_ERR_PCW_BODY_SIGN_ESC;
-        break;
-    }
-    /* mark the erred lines */
-    for (i = dimension; i != 0; i--) {
-      *qsc_base_of_cw++ = (FIXP_DBL)Q_VALUE_INVALID;
-    }
-    return 1;
-  }
-  return 0;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function checks if all segments are empty after
-decoding. There are _no lines markded_ as invalid because it could not be traced
-back where from the remaining bits are.
---------------------------------------------------------------------------------------------
-*/
-static void errDetectWithinSegmentationFinal(H_HCR_INFO pHcr) {
-  UCHAR segmentationErrorFlag = 0;
-  USHORT i;
-  SCHAR *pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  UINT numSegment = pHcr->segmentInfo.numSegment;
-
-  for (i = numSegment; i != 0; i--) {
-    if (*pRemainingBitsInSegment++ != 0) {
-      segmentationErrorFlag = 1;
-    }
-  }
-  if (segmentationErrorFlag == 1) {
-    pHcr->decInOut.errorLog |= BIT_IN_SEGMENTATION_ERROR;
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function walks one step within the decoding tree. Which
-branch is taken depends on the decoded carryBit input parameter.
---------------------------------------------------------------------------------------------
-*/
-void CarryBitToBranchValue(UCHAR carryBit, UINT treeNode, UINT *branchValue,
-                           UINT *branchNode) {
-  if (carryBit == 0) {
-    *branchNode =
-        (treeNode & MASK_LEFT) >> LEFT_OFFSET; /* MASK_LEFT:  00FFF000 */
-  } else {
-    *branchNode = treeNode & MASK_RIGHT; /* MASK_RIGHT: 00000FFF */
-  }
-
-  *branchValue = *branchNode & CLR_BIT_10; /* clear bit 10 (if set) */
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   Decodes the body of a priority codeword (PCW)
------------------------------------------------------------------------------------------------
-        return:   - return value is pointer to first of two or four quantized
-spectral coefficients
---------------------------------------------------------------------------------------------
-*/
-static const SCHAR *DecodePCW_Body(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
-                                   const UINT *pCurrentTree,
-                                   const SCHAR *pQuantValBase,
-                                   INT *pLeftStartOfSegment,
-                                   SCHAR *pRemainingBitsInSegment,
-                                   int *pNumDecodedBits) {
-  UCHAR carryBit;
-  UINT branchNode;
-  UINT treeNode;
-  UINT branchValue;
-  const SCHAR *pQuantVal;
-
-  /* decode PCW_BODY */
-  treeNode = *pCurrentTree; /* get first node of current tree belonging to
-                               current codebook */
-
-  /* decode whole PCW-codeword-body */
-  while (1) {
-    carryBit = HcrGetABitFromBitstream(bs, bsAnchor, pLeftStartOfSegment,
-                                       pLeftStartOfSegment, /* dummy */
-                                       FROM_LEFT_TO_RIGHT);
-    *pRemainingBitsInSegment -= 1;
-    *pNumDecodedBits += 1;
-
-    CarryBitToBranchValue(carryBit, treeNode, &branchValue, &branchNode);
-
-    if ((branchNode & TEST_BIT_10) ==
-        TEST_BIT_10) { /* test bit 10 ; if set --> codeword-body is complete */
-      break; /* end of branch in tree reached  i.e. a whole PCW-Body is decoded
-              */
-    } else {
-      treeNode = *(
-          pCurrentTree +
-          branchValue); /* update treeNode for further step in decoding tree */
-    }
-  }
-
-  pQuantVal =
-      pQuantValBase + branchValue; /* update pointer to valid first of 2 or 4
-                                      quantized values */
-
-  return pQuantVal;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function decodes one escape sequence. In case of a
-escape codebook and in case of the absolute value of the quantized spectral
-value == 16, a escapeSequence is decoded in two steps:
-                      1. escape prefix
-                      2. escape word
---------------------------------------------------------------------------------------------
-*/
-
-static INT DecodeEscapeSequence(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
-                                INT quantSpecCoef, INT *pLeftStartOfSegment,
-                                SCHAR *pRemainingBitsInSegment,
-                                int *pNumDecodedBits) {
-  UINT i;
-  INT sign;
-  UINT escapeOnesCounter = 0;
-  UINT carryBit;
-  INT escape_word = 0;
-
-  /* decode escape prefix */
-  while (1) {
-    carryBit = HcrGetABitFromBitstream(bs, bsAnchor, pLeftStartOfSegment,
-                                       pLeftStartOfSegment, /* dummy */
-                                       FROM_LEFT_TO_RIGHT);
-    *pRemainingBitsInSegment -= 1;
-    *pNumDecodedBits += 1;
-
-    if (carryBit != 0) {
-      escapeOnesCounter += 1;
-    } else {
-      escapeOnesCounter += 4;
-      break;
-    }
-  }
-
-  /* decode escape word */
-  for (i = escapeOnesCounter; i != 0; i--) {
-    carryBit = HcrGetABitFromBitstream(bs, bsAnchor, pLeftStartOfSegment,
-                                       pLeftStartOfSegment, /* dummy */
-                                       FROM_LEFT_TO_RIGHT);
-    *pRemainingBitsInSegment -= 1;
-    *pNumDecodedBits += 1;
-
-    escape_word <<= 1;
-    escape_word = escape_word | carryBit;
-  }
-
-  sign = (quantSpecCoef >= 0) ? 1 : -1;
-
-  quantSpecCoef = sign * (((INT)1 << escapeOnesCounter) + escape_word);
-
-  return quantSpecCoef;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   Decodes the Signbits of a priority codeword (PCW) and writes
-out the resulting quantized spectral values into unsorted sections
------------------------------------------------------------------------------------------------
-        output:   - two or four lines at position in corresponding section
-(which are not located at the desired position, i.e. they must be reordered in
-the last of eight function of HCR)
------------------------------------------------------------------------------------------------
-        return:   - updated pQuantSpecCoef pointer (to next empty storage for a
-line)
---------------------------------------------------------------------------------------------
-*/
-static int DecodePCW_Sign(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
-                          UINT codebookDim, const SCHAR *pQuantVal,
-                          FIXP_DBL *pQuantSpecCoef, int *quantSpecCoefIdx,
-                          INT *pLeftStartOfSegment,
-                          SCHAR *pRemainingBitsInSegment,
-                          int *pNumDecodedBits) {
-  UINT i;
-  UINT carryBit;
-  INT quantSpecCoef;
-
-  for (i = codebookDim; i != 0; i--) {
-    quantSpecCoef = *pQuantVal++;
-    if (quantSpecCoef != 0) {
-      carryBit = HcrGetABitFromBitstream(bs, bsAnchor, pLeftStartOfSegment,
-                                         pLeftStartOfSegment, /* dummy */
-                                         FROM_LEFT_TO_RIGHT);
-      *pRemainingBitsInSegment -= 1;
-      *pNumDecodedBits += 1;
-      if (*pRemainingBitsInSegment < 0 || *pNumDecodedBits >= (1024 >> 1)) {
-        return -1;
-      }
-
-      /* adapt sign of values according to the decoded sign bit */
-      if (carryBit != 0) {
-        pQuantSpecCoef[*quantSpecCoefIdx] = -(FIXP_DBL)quantSpecCoef;
-      } else {
-        pQuantSpecCoef[*quantSpecCoefIdx] = (FIXP_DBL)quantSpecCoef;
-      }
-    } else {
-      pQuantSpecCoef[*quantSpecCoefIdx] = FL2FXCONST_DBL(0.0f);
-    }
-    *quantSpecCoefIdx += 1;
-    if (*quantSpecCoefIdx >= 1024) {
-      return -1;
-    }
-  }
-  return 0;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   Mutes spectral lines which have been marked as erroneous
-(Q_VALUE_INVALID)
---------------------------------------------------------------------------------------------
-*/
-void HcrMuteErroneousLines(H_HCR_INFO hHcr) {
-  int c;
-  FIXP_DBL *RESTRICT pLong =
-      SPEC_LONG(hHcr->decInOut.pQuantizedSpectralCoefficientsBase);
-
-  /* if there is a line with value Q_VALUE_INVALID mute it */
-  for (c = 0; c < 1024; c++) {
-    if (pLong[c] == (FIXP_DBL)Q_VALUE_INVALID) {
-      pLong[c] = FL2FXCONST_DBL(0.0f); /* muting */
-    }
-  }
-}
--- a/libAACdec/src/aacdec_hcr.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Robert Weidner (DSP Solutions)
-
-   Description: HCR Decoder: Interface function declaration; common defines
-                and structures; defines for switching error-generator,
-                -detector, and -concealment
-
-*******************************************************************************/
-
-#ifndef AACDEC_HCR_H
-#define AACDEC_HCR_H
-
-#include "channelinfo.h"
-#include "FDK_bitstream.h"
-
-UINT HcrInit(H_HCR_INFO pHcr, CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-             const SamplingRateInfo *pSamplingRateInfo,
-             HANDLE_FDK_BITSTREAM bs);
-UINT HcrDecoder(H_HCR_INFO hHcr, CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                const SamplingRateInfo *pSamplingRateInfo,
-                HANDLE_FDK_BITSTREAM bs);
-void CarryBitToBranchValue(UCHAR carryBit, UINT treeNode, UINT *branchValue,
-                           UINT *branchNode);
-
-void CHcr_Read(HANDLE_FDK_BITSTREAM bs,
-               CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-               const MP4_ELEMENT_ID globalHcrType);
-void HcrMuteErroneousLines(H_HCR_INFO hHcr);
-
-void setHcrType(H_HCR_INFO hHcr, MP4_ELEMENT_ID type);
-INT getHcrType(H_HCR_INFO hHcr);
-
-#endif /* AACDEC_HCR_H */
--- a/libAACdec/src/aacdec_hcr_bit.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Robert Weidner (DSP Solutions)
-
-   Description: HCR Decoder: Bitstream reading
-
-*******************************************************************************/
-
-#include "aacdec_hcr_bit.h"
-
-/*---------------------------------------------------------------------------------------------
-        description:  This function toggles the read direction.
------------------------------------------------------------------------------------------------
-        input:        current read direction
------------------------------------------------------------------------------------------------
-        return:       new read direction
---------------------------------------------------------------------------------------------
-*/
-UCHAR ToggleReadDirection(UCHAR readDirection) {
-  if (readDirection == FROM_LEFT_TO_RIGHT) {
-    return FROM_RIGHT_TO_LEFT;
-  } else {
-    return FROM_LEFT_TO_RIGHT;
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function returns a bit from the bitstream according to
-read direction. It is called very often, therefore it makes sense to inline it
-(runtime).
------------------------------------------------------------------------------------------------
-        input:    - handle to FDK bitstream
-                  - reference value marking start of bitfield
-                  - pLeftStartOfSegment
-                  - pRightStartOfSegment
-                  - readDirection
------------------------------------------------------------------------------------------------
-        return:   - bit from bitstream
---------------------------------------------------------------------------------------------
-*/
-UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
-                             INT *pLeftStartOfSegment,
-                             INT *pRightStartOfSegment, UCHAR readDirection) {
-  UINT bit;
-  INT readBitOffset;
-
-  if (readDirection == FROM_LEFT_TO_RIGHT) {
-    readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pLeftStartOfSegment;
-    if (readBitOffset) {
-      FDKpushBiDirectional(bs, readBitOffset);
-    }
-
-    bit = FDKreadBits(bs, 1);
-
-    *pLeftStartOfSegment += 1;
-  } else {
-    readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pRightStartOfSegment;
-    if (readBitOffset) {
-      FDKpushBiDirectional(bs, readBitOffset);
-    }
-
-    /* to be replaced with a brother function of FDKreadBits() */
-    bit = FDKreadBits(bs, 1);
-    FDKpushBack(bs, 2);
-
-    *pRightStartOfSegment -= 1;
-  }
-
-  return (bit);
-}
--- a/libAACdec/src/aacdec_hcr_bit.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Robert Weidner (DSP Solutions)
-
-   Description: HCR Decoder: Bitstream reading prototypes
-
-*******************************************************************************/
-
-#ifndef AACDEC_HCR_BIT_H
-#define AACDEC_HCR_BIT_H
-
-#include "aacdec_hcr.h"
-
-UCHAR ToggleReadDirection(UCHAR readDirection);
-
-UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
-                             INT *pLeftStartOfSegment,
-                             INT *pRightStartOfSegment, UCHAR readDirection);
-
-#endif /* AACDEC_HCR_BIT_H */
--- a/libAACdec/src/aacdec_hcr_types.h
+++ /dev/null
@@ -1,432 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Robert Weidner (DSP Solutions)
-
-   Description: HCR Decoder: Common defines and structures; defines for
-                switching error-generator, -detector, and -concealment;
-
-*******************************************************************************/
-
-#ifndef AACDEC_HCR_TYPES_H
-#define AACDEC_HCR_TYPES_H
-
-#include "FDK_bitstream.h"
-#include "overlapadd.h"
-
-/* ------------------------------------------------ */
-/* ------------------------------------------------ */
-
-#define LINES_PER_UNIT 4
-
-/* ------------------------------------------------ */
-/* ------------------------------------------------ */
-/* ----------- basic HCR configuration ------------ */
-
-#define MAX_SFB_HCR                                                          \
-  (((1024 / 8) / LINES_PER_UNIT) * 8) /* (8 * 16) is not enough because sfbs \
-                                         are split in units for blocktype    \
-                                         short */
-#define NUMBER_OF_UNIT_GROUPS (LINES_PER_UNIT * 8)
-#define LINES_PER_UNIT_GROUP (1024 / NUMBER_OF_UNIT_GROUPS) /* 15 16 30 32 */
-
-/* ------------------------------------------------ */
-/* ------------------------------------------------ */
-/* ------------------------------------------------ */
-
-#define FROM_LEFT_TO_RIGHT 0
-#define FROM_RIGHT_TO_LEFT 1
-
-#define MAX_CB_PAIRS 23
-#define MAX_HCR_SETS 14
-
-#define ESCAPE_VALUE 16
-#define POSITION_OF_FLAG_A 21
-#define POSITION_OF_FLAG_B 20
-
-#define MAX_CB 32 /* last used CB is cb #31 when VCB11 is used */
-
-#define MAX_CB_CHECK                                                         \
-  32 /* support for VCB11 available -- is more general, could therefore used \
-        in both cases */
-
-#define NUMBER_OF_BIT_IN_WORD 32
-
-/* log */
-#define THIRTYTWO_LOG_DIV_TWO_LOG 5
-#define EIGHT_LOG_DIV_TWO_LOG 3
-#define FOUR_LOG_DIV_TWO_LOG 2
-
-/* borders */
-#define CPE_TOP_LENGTH 12288
-#define SCE_TOP_LENGTH 6144
-#define LEN_OF_LONGEST_CW_TOP_LENGTH 49
-
-/* qsc's of high level */
-#define Q_VALUE_INVALID \
-  8192 /* mark a invalid line with this value (to be concealed later on) */
-#define HCR_DIRAC 500 /* a line of high level */
-
-/* masks */
-#define MASK_LEFT 0xFFF000
-#define MASK_RIGHT 0xFFF
-#define CLR_BIT_10 0x3FF
-#define TEST_BIT_10 0x400
-
-#define LEFT_OFFSET 12
-
-/* when set HCR is replaced by a dummy-module which just fills the outputbuffer
- * with a dirac sequence */
-/* use this if HCR is suspected to write in other modules -- if error is stell
- * there, HCR is innocent */
-
-/* ------------------------------ */
-/* -    insert HCR errors       - */
-/* ------------------------------ */
-
-/* modify input lengths -- high protected */
-#define ERROR_LORSD 0 /* offset: error if different from zero */
-#define ERROR_LOLC 0  /* offset: error if different from zero */
-
-/* segments are earlier empty as expected when decoding PCWs */
-#define ERROR_PCW_BODY                                                   \
-  0 /* set a positive values to trigger the error (make segments earlyer \
-       appear to be empty) */
-#define ERROR_PCW_BODY_SIGN                                              \
-  0 /* set a positive values to trigger the error (make segments earlyer \
-       appear to be empty) */
-#define ERROR_PCW_BODY_SIGN_ESC                                          \
-  0 /* set a positive values to trigger the error (make segments earlyer \
-       appear to be empty) */
-
-/* pretend there are too many bits decoded (enlarge length of codeword) at PCWs
- * -- use a positive value */
-#define ERROR_PCW_BODY_ONLY_TOO_LONG \
-  0 /* set a positive values to trigger the error */
-#define ERROR_PCW_BODY_SIGN_TOO_LONG \
-  0 /* set a positive values to trigger the error */
-#define ERROR_PCW_BODY_SIGN_ESC_TOO_LONG \
-  0 /* set a positive values to trigger the error */
-
-/* modify HCR bitstream block */
-
-#define MODULO_DIVISOR_HCR 30
-
-/* ------------------------------ */
-/* -    detect HCR errors       - */
-/* ------------------------------ */
-/* check input data */
-
-/* during decoding */
-
-/* all the segments are checked -- therefore -- if this check passes, its a kind
-   of evidence that the decoded PCWs and non-PCWs are fine */
-
-/* if a codeword is decoded there exists a border for the number of bits, which
-   are allowed to read for this codeword. This border is the minimum of the
-   length of the longest codeword (for the currently used codebook) and the
-   separately transmitted 'lengthOfLongestCodeword' in this frame and channel.
-   The number of decoded bits is counted (for PCWs only -- there it makes really
-   sense in my opinion). If this number exceeds the border (derived as minimum
-   -- see above), a error is detected. */
-
-/* -----------------------------------------------------------------------------------------------------
-   This error check could be set to zero because due to a test within
-   RVLC-Escape-huffman-Decoder a too long codeword could not be detected -- it
-   seems that for RVLC-Escape-Codeword the coderoom is used to 100%. Therefore I
-   assume that the coderoom is used to 100% also for the codebooks 1..11 used at
-   HCR Therefore this test is deactivated pending further notice
-   -----------------------------------------------------------------------------------------------------
- */
-
-/* test if the number of remaining bits in a segment is _below_ zero. If there
-   are no errors the lowest allowed value for remainingBitsInSegment is zero.
-   This check also could be set to zero (save runtime) */
-
-/* other */
-/* when set to '1', avoid setting the LAV-Flag in errorLog due to a
-   previous-line-marking (at PCW decoder). A little more runtime is needed then
-   when writing values out into output-buffer. */
-
-/* ------------------------------ */
-/* -    conceal HCR errors      - */
-/* ------------------------------ */
-
-#define HCR_ERROR_CONCEALMENT \
-  1 /* if set to '1', HCR _mutes_ the erred quantized spectral coefficients */
-
-// ------------------------------------------------------------------------------------------------------------------
-//                                         errorLog: A word of 32 bits used for
-//                                         logging possible errors within HCR
-//                                                   in case of distorted
-//                                                   bitstreams. Table of all
-//                                                   known errors:
-// ------------------------------------------------------------------------------------------------------------------------
-// bit  fatal  location    meaning
-// ----+-----+-----------+--------------------------------------
-#define SEGMENT_OVERRIDE_ERR_PCW_BODY \
-  0x80000000  //  31   no    PCW-Dec     During PCW decoding it is checked after
-              //  every PCW if there are too many bits decoded (immediate
-              //  check).
-#define SEGMENT_OVERRIDE_ERR_PCW_BODY_SIGN \
-  0x40000000  //  30   no    PCW-Dec     During PCW decoding it is checked after
-              //  every PCW if there are too many bits decoded (immediate
-              //  check).
-#define SEGMENT_OVERRIDE_ERR_PCW_BODY_SIGN_ESC \
-  0x20000000  //  29   no    PCW-Dec     During PCW decoding it is checked after
-              //  every PCW if there are too many bits decoded (immediate
-              //  check).
-#define EXTENDED_SORTED_COUNTER_OVERFLOW \
-  0x10000000  //  28   yes   Init-Dec    Error during extending sideinfo
-              //  (neither a PCW nor a nonPCW was decoded so far)
-              // 0x08000000 //  27                     reserved
-              // 0x04000000 //  26                     reserved
-              // 0x02000000 //  25                     reserved
-              // 0x01000000 //  24                     reserved
-              // 0x00800000 //  23                     reserved
-              // 0x00400000 //  22                     reserved
-              // 0x00200000 //  21                     reserved
-              // 0x00100000 //  20                     reserved
-
-/* special errors */
-#define TOO_MANY_PCW_BODY_BITS_DECODED \
-  0x00080000  //  19   yes   PCW-Dec     During PCW-body-decoding too many bits
-              //  have been read from bitstream -- advice: skip non-PCW decoding
-#define TOO_MANY_PCW_BODY_SIGN_BITS_DECODED \
-  0x00040000  //  18   yes   PCW-Dec     During PCW-body-sign-decoding too many
-              //  bits have been read from bitstream -- advice: skip non-PCW
-              //  decoding
-#define TOO_MANY_PCW_BODY_SIGN_ESC_BITS_DECODED \
-  0x00020000  //  17   yes   PCW-Dec     During PCW-body-sign-esc-decoding too
-              //  many bits have been read from bitstream -- advice: skip
-              //  non-PCW decoding
-
-// 0x00010000 //  16                     reserved
-#define STATE_ERROR_BODY_ONLY \
-  0x00008000  //  15   no    NonPCW-Dec  State machine returned with error
-#define STATE_ERROR_BODY_SIGN__BODY \
-  0x00004000  //  14   no    NonPCW-Dec  State machine returned with error
-#define STATE_ERROR_BODY_SIGN__SIGN \
-  0x00002000  //  13   no    NonPCW-Dec  State machine returned with error
-#define STATE_ERROR_BODY_SIGN_ESC__BODY \
-  0x00001000  //  12   no    NonPCW-Dec  State machine returned with error
-#define STATE_ERROR_BODY_SIGN_ESC__SIGN \
-  0x00000800  //  11   no    NonPCW-Dec  State machine returned with error
-#define STATE_ERROR_BODY_SIGN_ESC__ESC_PREFIX \
-  0x00000400  //  10   no    NonPCW-Dec  State machine returned with error
-#define STATE_ERROR_BODY_SIGN_ESC__ESC_WORD \
-  0x00000200  //   9   no    NonPCW-Dec  State machine returned with error
-#define HCR_SI_LENGTHS_FAILURE \
-  0x00000100  //   8   yes   Init-Dec    LengthOfLongestCodeword must not be
-              //   less than lenghtOfReorderedSpectralData
-#define NUM_SECT_OUT_OF_RANGE_SHORT_BLOCK \
-  0x00000080  //   7   yes   Init-Dec    The number of sections is not within
-              //   the allowed range (short block)
-#define NUM_SECT_OUT_OF_RANGE_LONG_BLOCK \
-  0x00000040  //   6   yes   Init-Dec    The number of sections is not within
-              //   the allowed range (long block)
-#define LINE_IN_SECT_OUT_OF_RANGE_SHORT_BLOCK \
-  0x00000020  //   5   yes   Init-Dec    The number of lines per section is not
-              //   within the allowed range (short block)
-#define CB_OUT_OF_RANGE_SHORT_BLOCK \
-  0x00000010  //   4   yes   Init-Dec    The codebook is not within the allowed
-              //   range (short block)
-#define LINE_IN_SECT_OUT_OF_RANGE_LONG_BLOCK \
-  0x00000008  //   3   yes   Init-Dec    The number of lines per section is not
-              //   within the allowed range (long block)
-#define CB_OUT_OF_RANGE_LONG_BLOCK \
-  0x00000004  //   2   yes   Init-Dec    The codebook is not within the allowed
-              //   range (long block)
-#define LAV_VIOLATION \
-  0x00000002  //   1   no    Final       The absolute value of at least one
-              //   decoded line was too high for the according codebook.
-#define BIT_IN_SEGMENTATION_ERROR \
-  0x00000001  //   0   no    Final       After PCW and non-PWC-decoding at least
-              //   one segment is not zero (global check).
-
-/*----------*/
-#define HCR_FATAL_PCW_ERROR_MASK 0x100E01FC
-
-typedef enum { PCW_BODY, PCW_BODY_SIGN, PCW_BODY_SIGN_ESC } PCW_TYPE;
-
-/* interface Decoder <---> HCR */
-typedef struct {
-  UINT errorLog;
-  SPECTRAL_PTR pQuantizedSpectralCoefficientsBase;
-  int quantizedSpectralCoefficientsIdx;
-  SHORT lengthOfReorderedSpectralData;
-  SHORT numSection;
-  SHORT *pNumLineInSect;
-  INT bitstreamAnchor;
-  SCHAR lengthOfLongestCodeword;
-  UCHAR *pCodebook;
-} HCR_INPUT_OUTPUT;
-
-typedef struct {
-  const UCHAR *pMinOfCbPair;
-  const UCHAR *pMaxOfCbPair;
-} HCR_CB_PAIRS;
-
-typedef struct {
-  const USHORT *pLargestAbsVal;
-  const UCHAR *pMaxCwLength;
-  const UCHAR *pCbDimension;
-  const UCHAR *pCbDimShift;
-  const UCHAR *pCbSign;
-  const UCHAR *pCbPriority;
-} HCR_TABLE_INFO;
-
-typedef struct {
-  UINT numSegment;
-  UINT pSegmentBitfield[((1024 >> 1) / NUMBER_OF_BIT_IN_WORD + 1)];
-  UINT pCodewordBitfield[((1024 >> 1) / NUMBER_OF_BIT_IN_WORD + 1)];
-  UINT segmentOffset;
-  INT pLeftStartOfSegment[1024 >> 1];
-  INT pRightStartOfSegment[1024 >> 1];
-  SCHAR pRemainingBitsInSegment[1024 >> 1];
-  UCHAR readDirection;
-  UCHAR numWordForBitfield;
-  USHORT pNumBitValidInLastWord;
-} HCR_SEGMENT_INFO;
-
-typedef struct {
-  UINT numCodeword;
-  UINT numSortedSection;
-  USHORT pNumCodewordInSection[MAX_SFB_HCR];
-  USHORT pNumSortedCodewordInSection[MAX_SFB_HCR];
-  USHORT pNumExtendedSortedCodewordInSection[MAX_SFB_HCR + MAX_HCR_SETS];
-  int numExtendedSortedCodewordInSectionIdx;
-  USHORT pNumExtendedSortedSectionsInSets[MAX_HCR_SETS];
-  int numExtendedSortedSectionsInSetsIdx;
-  USHORT pReorderOffset[MAX_SFB_HCR];
-  UCHAR pSortedCodebook[MAX_SFB_HCR];
-
-  UCHAR pExtendedSortedCodebook[MAX_SFB_HCR + MAX_HCR_SETS];
-  int extendedSortedCodebookIdx;
-  UCHAR pMaxLenOfCbInExtSrtSec[MAX_SFB_HCR + MAX_HCR_SETS];
-  int maxLenOfCbInExtSrtSecIdx;
-  UCHAR pCodebookSwitch[MAX_SFB_HCR];
-} HCR_SECTION_INFO;
-
-typedef UINT (*STATEFUNC)(HANDLE_FDK_BITSTREAM, void *);
-
-typedef struct {
-  /* worst-case and 1024/4 non-PCWs exist in worst-case */
-  FIXP_DBL
-  *pResultBase; /* Base address for spectral data output target buffer */
-  UINT iNode[1024 >> 2]; /* Helper indices for code books */
-  USHORT
-  iResultPointer[1024 >> 2]; /* Helper indices for accessing pResultBase */
-  UINT pEscapeSequenceInfo[1024 >> 2];
-  UINT codewordOffset;
-  STATEFUNC pState;
-  UCHAR pCodebook[1024 >> 2];
-  UCHAR pCntSign[1024 >> 2];
-  /* this array holds the states coded as integer values within the range
-   * [0,1,..,7] */
-  SCHAR pSta[1024 >> 2];
-} HCR_NON_PCW_SIDEINFO;
-
-typedef struct {
-  HCR_INPUT_OUTPUT decInOut;
-  HCR_SEGMENT_INFO segmentInfo;
-  HCR_SECTION_INFO sectionInfo;
-  HCR_NON_PCW_SIDEINFO nonPcwSideinfo;
-} CErHcrInfo;
-
-typedef CErHcrInfo *H_HCR_INFO;
-
-#endif /* AACDEC_HCR_TYPES_H */
--- a/libAACdec/src/aacdec_hcrs.cpp
+++ /dev/null
@@ -1,1551 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Robert Weidner (DSP Solutions)
-
-   Description: HCR Decoder: Prepare decoding of non-PCWs, segmentation- and
-                bitfield-handling, HCR-Statemachine
-
-*******************************************************************************/
-
-#include "aacdec_hcrs.h"
-
-#include "aacdec_hcr.h"
-
-#include "aacdec_hcr_bit.h"
-#include "aac_rom.h"
-#include "aac_ram.h"
-
-static UINT InitSegmentBitfield(UINT *pNumSegment,
-                                SCHAR *pRemainingBitsInSegment,
-                                UINT *pSegmentBitfield,
-                                UCHAR *pNumWordForBitfield,
-                                USHORT *pNumBitValidInLastWord);
-
-static void InitNonPCWSideInformationForCurrentSet(H_HCR_INFO pHcr);
-
-static INT ModuloValue(INT input, INT bufferlength);
-
-static void ClearBitFromBitfield(STATEFUNC *ptrState, UINT offset,
-                                 UINT *pBitfield);
-
-/*---------------------------------------------------------------------------------------------
-     description: This function decodes all non-priority codewords (non-PCWs) by
-using a state-machine.
---------------------------------------------------------------------------------------------
-*/
-void DecodeNonPCWs(HANDLE_FDK_BITSTREAM bs, H_HCR_INFO pHcr) {
-  UINT numValidSegment;
-  INT segmentOffset;
-  INT codewordOffsetBase;
-  INT codewordOffset;
-  UINT trial;
-
-  UINT *pNumSegment;
-  SCHAR *pRemainingBitsInSegment;
-  UINT *pSegmentBitfield;
-  UCHAR *pNumWordForBitfield;
-  USHORT *pNumBitValidInLastWord;
-  UINT *pCodewordBitfield;
-  INT bitfieldWord;
-  INT bitInWord;
-  UINT tempWord;
-  UINT interMediateWord;
-  INT tempBit;
-  INT carry;
-
-  UINT numCodeword;
-  UCHAR numSet;
-  UCHAR currentSet;
-  UINT codewordInSet;
-  UINT remainingCodewordsInSet;
-  SCHAR *pSta;
-  UINT ret;
-
-  pNumSegment = &(pHcr->segmentInfo.numSegment);
-  pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  pSegmentBitfield = pHcr->segmentInfo.pSegmentBitfield;
-  pNumWordForBitfield = &(pHcr->segmentInfo.numWordForBitfield);
-  pNumBitValidInLastWord = &(pHcr->segmentInfo.pNumBitValidInLastWord);
-  pSta = pHcr->nonPcwSideinfo.pSta;
-
-  numValidSegment = InitSegmentBitfield(pNumSegment, pRemainingBitsInSegment,
-                                        pSegmentBitfield, pNumWordForBitfield,
-                                        pNumBitValidInLastWord);
-
-  if (numValidSegment != 0) {
-    numCodeword = pHcr->sectionInfo.numCodeword;
-    numSet = ((numCodeword - 1) / *pNumSegment) + 1;
-
-    pHcr->segmentInfo.readDirection = FROM_RIGHT_TO_LEFT;
-
-    /* Process sets subsequently */
-    for (currentSet = 1; currentSet < numSet; currentSet++) {
-      /* step 1 */
-      numCodeword -=
-          *pNumSegment; /* number of remaining non PCWs [for all sets] */
-      if (numCodeword < *pNumSegment) {
-        codewordInSet = numCodeword; /* for last set */
-      } else {
-        codewordInSet = *pNumSegment; /* for all sets except last set */
-      }
-
-      /* step 2 */
-      /* prepare array 'CodewordBitfield'; as much ones are written from left in
-       * all words, as much decodedCodewordInSetCounter nonPCWs exist in this
-       * set */
-      tempWord = 0xFFFFFFFF;
-      pCodewordBitfield = pHcr->segmentInfo.pCodewordBitfield;
-
-      for (bitfieldWord = *pNumWordForBitfield; bitfieldWord != 0;
-           bitfieldWord--) { /* loop over all used words */
-        if (codewordInSet > NUMBER_OF_BIT_IN_WORD) { /* more codewords than
-                                                        number of bits => fill
-                                                        ones */
-          /* fill a whole word with ones */
-          *pCodewordBitfield++ = tempWord;
-          codewordInSet -= NUMBER_OF_BIT_IN_WORD; /* subtract number of bits */
-        } else {
-          /* prepare last tempWord */
-          for (remainingCodewordsInSet = codewordInSet;
-               remainingCodewordsInSet < NUMBER_OF_BIT_IN_WORD;
-               remainingCodewordsInSet++) {
-            tempWord =
-                tempWord &
-                ~(1
-                  << (NUMBER_OF_BIT_IN_WORD - 1 -
-                      remainingCodewordsInSet)); /* set a zero at bit number
-                                                    (NUMBER_OF_BIT_IN_WORD-1-i)
-                                                    in tempWord */
-          }
-          *pCodewordBitfield++ = tempWord;
-          tempWord = 0x00000000;
-        }
-      }
-      pCodewordBitfield = pHcr->segmentInfo.pCodewordBitfield;
-
-      /* step 3 */
-      /* build non-PCW sideinfo for each non-PCW of the current set */
-      InitNonPCWSideInformationForCurrentSet(pHcr);
-
-      /* step 4 */
-      /* decode all non-PCWs belonging to this set */
-
-      /* loop over trials */
-      codewordOffsetBase = 0;
-      for (trial = *pNumSegment; trial > 0; trial--) {
-        /* loop over number of words in bitfields */
-        segmentOffset = 0; /* start at zero in every segment */
-        pHcr->segmentInfo.segmentOffset =
-            segmentOffset; /* store in structure for states */
-        codewordOffset = codewordOffsetBase;
-        pHcr->nonPcwSideinfo.codewordOffset =
-            codewordOffset; /* store in structure for states */
-
-        for (bitfieldWord = 0; bitfieldWord < *pNumWordForBitfield;
-             bitfieldWord++) {
-          /* derive tempWord with bitwise and */
-          tempWord =
-              pSegmentBitfield[bitfieldWord] & pCodewordBitfield[bitfieldWord];
-
-          /* if tempWord is not zero, decode something */
-          if (tempWord != 0) {
-            /* loop over all bits in tempWord; start state machine if & is true
-             */
-            for (bitInWord = NUMBER_OF_BIT_IN_WORD; bitInWord > 0;
-                 bitInWord--) {
-              interMediateWord = ((UINT)1 << (bitInWord - 1));
-              if ((tempWord & interMediateWord) == interMediateWord) {
-                /* get state and start state machine */
-                pHcr->nonPcwSideinfo.pState =
-                    aStateConstant2State[pSta[codewordOffset]];
-
-                while (pHcr->nonPcwSideinfo.pState) {
-                  ret = ((STATEFUNC)pHcr->nonPcwSideinfo.pState)(bs, pHcr);
-                  if (ret != 0) {
-                    return;
-                  }
-                }
-              }
-
-              /* update both offsets */
-              segmentOffset += 1; /* add NUMBER_OF_BIT_IN_WORD times one */
-              pHcr->segmentInfo.segmentOffset = segmentOffset;
-              codewordOffset += 1; /* add NUMBER_OF_BIT_IN_WORD times one */
-              codewordOffset =
-                  ModuloValue(codewordOffset,
-                              *pNumSegment); /* index of the current codeword
-                                                lies within modulo range */
-              pHcr->nonPcwSideinfo.codewordOffset = codewordOffset;
-            }
-          } else {
-            segmentOffset +=
-                NUMBER_OF_BIT_IN_WORD; /* add NUMBER_OF_BIT_IN_WORD at once */
-            pHcr->segmentInfo.segmentOffset = segmentOffset;
-            codewordOffset +=
-                NUMBER_OF_BIT_IN_WORD; /* add NUMBER_OF_BIT_IN_WORD at once */
-            codewordOffset = ModuloValue(
-                codewordOffset,
-                *pNumSegment); /* index of the current codeword lies within
-                                  modulo range */
-            pHcr->nonPcwSideinfo.codewordOffset = codewordOffset;
-          }
-        } /* end of bitfield word loop */
-
-        /* decrement codeword - pointer */
-        codewordOffsetBase -= 1;
-        codewordOffsetBase =
-            ModuloValue(codewordOffsetBase, *pNumSegment); /* index of the
-                                                              current codeword
-                                                              base lies within
-                                                              modulo range */
-
-        /* rotate numSegment bits in codewordBitfield */
-        /* rotation of *numSegment bits in bitfield of codewords
-         * (circle-rotation) */
-        /* get last valid bit */
-        tempBit = pCodewordBitfield[*pNumWordForBitfield - 1] &
-                  (1 << (NUMBER_OF_BIT_IN_WORD - *pNumBitValidInLastWord));
-        tempBit = tempBit >> (NUMBER_OF_BIT_IN_WORD - *pNumBitValidInLastWord);
-
-        /* write zero into place where tempBit was fetched from */
-        pCodewordBitfield[*pNumWordForBitfield - 1] =
-            pCodewordBitfield[*pNumWordForBitfield - 1] &
-            ~(1 << (NUMBER_OF_BIT_IN_WORD - *pNumBitValidInLastWord));
-
-        /* rotate last valid word */
-        pCodewordBitfield[*pNumWordForBitfield - 1] =
-            pCodewordBitfield[*pNumWordForBitfield - 1] >> 1;
-
-        /* transfare carry bit 0 from current word into bitposition 31 from next
-         * word and rotate current word */
-        for (bitfieldWord = *pNumWordForBitfield - 2; bitfieldWord > -1;
-             bitfieldWord--) {
-          /* get carry (=bit at position 0) from current word */
-          carry = pCodewordBitfield[bitfieldWord] & 1;
-
-          /* put the carry bit at position 31 into word right from current word
-           */
-          pCodewordBitfield[bitfieldWord + 1] =
-              pCodewordBitfield[bitfieldWord + 1] |
-              (carry << (NUMBER_OF_BIT_IN_WORD - 1));
-
-          /* shift current word */
-          pCodewordBitfield[bitfieldWord] =
-              pCodewordBitfield[bitfieldWord] >> 1;
-        }
-
-        /* put tempBit into free bit-position 31 from first word */
-        pCodewordBitfield[0] =
-            pCodewordBitfield[0] | (tempBit << (NUMBER_OF_BIT_IN_WORD - 1));
-
-      } /* end of trial loop */
-
-      /* toggle read direction */
-      pHcr->segmentInfo.readDirection =
-          ToggleReadDirection(pHcr->segmentInfo.readDirection);
-    }
-    /* end of set loop */
-
-    /* all non-PCWs of this spectrum are decoded */
-  }
-
-  /* all PCWs and all non PCWs are decoded. They are unbacksorted in output
-   * buffer. Here is the Interface with comparing QSCs to asm decoding */
-}
-
-/*---------------------------------------------------------------------------------------------
-     description:   This function prepares the bitfield used for the
-                    segments. The list is set up once to be used in all
-following sets. If a segment is decoded empty, the according bit from the
-Bitfield is removed.
------------------------------------------------------------------------------------------------
-        return:     numValidSegment = the number of valid segments
---------------------------------------------------------------------------------------------
-*/
-static UINT InitSegmentBitfield(UINT *pNumSegment,
-                                SCHAR *pRemainingBitsInSegment,
-                                UINT *pSegmentBitfield,
-                                UCHAR *pNumWordForBitfield,
-                                USHORT *pNumBitValidInLastWord) {
-  SHORT i;
-  USHORT r;
-  UCHAR bitfieldWord;
-  UINT tempWord;
-  USHORT numValidSegment;
-
-  *pNumWordForBitfield =
-      (*pNumSegment == 0)
-          ? 0
-          : ((*pNumSegment - 1) >> THIRTYTWO_LOG_DIV_TWO_LOG) + 1;
-
-  /* loop over all words, which are completely used or only partial */
-  /* bit in pSegmentBitfield is zero if segment is empty; bit in
-   * pSegmentBitfield is one if segment is not empty */
-  numValidSegment = 0;
-  *pNumBitValidInLastWord = *pNumSegment;
-
-  /* loop over words */
-  for (bitfieldWord = 0; bitfieldWord < *pNumWordForBitfield - 1;
-       bitfieldWord++) {
-    tempWord = 0xFFFFFFFF; /* set ones */
-    r = bitfieldWord << THIRTYTWO_LOG_DIV_TWO_LOG;
-    for (i = 0; i < NUMBER_OF_BIT_IN_WORD; i++) {
-      if (pRemainingBitsInSegment[r + i] == 0) {
-        tempWord = tempWord & ~(1 << (NUMBER_OF_BIT_IN_WORD - 1 -
-                                      i)); /* set a zero at bit number
-                                              (NUMBER_OF_BIT_IN_WORD-1-i) in
-                                              tempWord */
-      } else {
-        numValidSegment += 1; /* count segments which are not empty */
-      }
-    }
-    pSegmentBitfield[bitfieldWord] = tempWord;        /* store result */
-    *pNumBitValidInLastWord -= NUMBER_OF_BIT_IN_WORD; /* calculate number of
-                                                         zeros on LSB side in
-                                                         the last word */
-  }
-
-  /* calculate last word: prepare special tempWord */
-  tempWord = 0xFFFFFFFF;
-  for (i = 0; i < (NUMBER_OF_BIT_IN_WORD - *pNumBitValidInLastWord); i++) {
-    tempWord = tempWord & ~(1 << i); /* clear bit i in tempWord */
-  }
-
-  /* calculate last word */
-  r = bitfieldWord << THIRTYTWO_LOG_DIV_TWO_LOG;
-  for (i = 0; i < *pNumBitValidInLastWord; i++) {
-    if (pRemainingBitsInSegment[r + i] == 0) {
-      tempWord = tempWord & ~(1 << (NUMBER_OF_BIT_IN_WORD - 1 -
-                                    i)); /* set a zero at bit number
-                                            (NUMBER_OF_BIT_IN_WORD-1-i) in
-                                            tempWord */
-    } else {
-      numValidSegment += 1; /* count segments which are not empty */
-    }
-  }
-  pSegmentBitfield[bitfieldWord] = tempWord; /* store result */
-
-  return numValidSegment;
-}
-
-/*---------------------------------------------------------------------------------------------
-  description:  This function sets up sideinfo for the non-PCW decoder (for the
-current set).
----------------------------------------------------------------------------------------------*/
-static void InitNonPCWSideInformationForCurrentSet(H_HCR_INFO pHcr) {
-  USHORT i, k;
-  UCHAR codebookDim;
-  UINT startNode;
-
-  UCHAR *pCodebook = pHcr->nonPcwSideinfo.pCodebook;
-  UINT *iNode = pHcr->nonPcwSideinfo.iNode;
-  UCHAR *pCntSign = pHcr->nonPcwSideinfo.pCntSign;
-  USHORT *iResultPointer = pHcr->nonPcwSideinfo.iResultPointer;
-  UINT *pEscapeSequenceInfo = pHcr->nonPcwSideinfo.pEscapeSequenceInfo;
-  SCHAR *pSta = pHcr->nonPcwSideinfo.pSta;
-  USHORT *pNumExtendedSortedCodewordInSection =
-      pHcr->sectionInfo.pNumExtendedSortedCodewordInSection;
-  int numExtendedSortedCodewordInSectionIdx =
-      pHcr->sectionInfo.numExtendedSortedCodewordInSectionIdx;
-  UCHAR *pExtendedSortedCodebook = pHcr->sectionInfo.pExtendedSortedCodebook;
-  int extendedSortedCodebookIdx = pHcr->sectionInfo.extendedSortedCodebookIdx;
-  USHORT *pNumExtendedSortedSectionsInSets =
-      pHcr->sectionInfo.pNumExtendedSortedSectionsInSets;
-  int numExtendedSortedSectionsInSetsIdx =
-      pHcr->sectionInfo.numExtendedSortedSectionsInSetsIdx;
-  int quantizedSpectralCoefficientsIdx =
-      pHcr->decInOut.quantizedSpectralCoefficientsIdx;
-  const UCHAR *pCbDimension = aDimCb;
-  int iterationCounter = 0;
-
-  /* loop over number of extended sorted sections in the current set so all
-   * codewords sideinfo variables within this set can be prepared for decoding
-   */
-  for (i = pNumExtendedSortedSectionsInSets[numExtendedSortedSectionsInSetsIdx];
-       i != 0; i--) {
-    codebookDim =
-        pCbDimension[pExtendedSortedCodebook[extendedSortedCodebookIdx]];
-    startNode = *aHuffTable[pExtendedSortedCodebook[extendedSortedCodebookIdx]];
-
-    for (k = pNumExtendedSortedCodewordInSection
-             [numExtendedSortedCodewordInSectionIdx];
-         k != 0; k--) {
-      iterationCounter++;
-      if (iterationCounter > (1024 >> 2)) {
-        return;
-      }
-      *pSta++ = aCodebook2StartInt
-          [pExtendedSortedCodebook[extendedSortedCodebookIdx]];
-      *pCodebook++ = pExtendedSortedCodebook[extendedSortedCodebookIdx];
-      *iNode++ = startNode;
-      *pCntSign++ = 0;
-      *iResultPointer++ = quantizedSpectralCoefficientsIdx;
-      *pEscapeSequenceInfo++ = 0;
-      quantizedSpectralCoefficientsIdx +=
-          codebookDim; /* update pointer by codebookDim --> point to next
-                          starting value for writing out */
-      if (quantizedSpectralCoefficientsIdx >= 1024) {
-        return;
-      }
-    }
-    numExtendedSortedCodewordInSectionIdx++; /* inc ptr for next ext sort sec in
-                                                current set */
-    extendedSortedCodebookIdx++; /* inc ptr for next ext sort sec in current set
-                                  */
-    if (numExtendedSortedCodewordInSectionIdx >= (MAX_SFB_HCR + MAX_HCR_SETS) ||
-        extendedSortedCodebookIdx >= (MAX_SFB_HCR + MAX_HCR_SETS)) {
-      return;
-    }
-  }
-  numExtendedSortedSectionsInSetsIdx++; /* inc ptr for next set of non-PCWs */
-  if (numExtendedSortedCodewordInSectionIdx >= (MAX_SFB_HCR + MAX_HCR_SETS)) {
-    return;
-  }
-
-  /* Write back indexes */
-  pHcr->sectionInfo.numExtendedSortedCodewordInSectionIdx =
-      numExtendedSortedCodewordInSectionIdx;
-  pHcr->sectionInfo.extendedSortedCodebookIdx = extendedSortedCodebookIdx;
-  pHcr->sectionInfo.numExtendedSortedSectionsInSetsIdx =
-      numExtendedSortedSectionsInSetsIdx;
-  pHcr->sectionInfo.numExtendedSortedCodewordInSectionIdx =
-      numExtendedSortedCodewordInSectionIdx;
-  pHcr->decInOut.quantizedSpectralCoefficientsIdx =
-      quantizedSpectralCoefficientsIdx;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description: This function returns the input value if the value is in the
-                  range of bufferlength. If <input> is smaller, one bufferlength
-is added, if <input> is bigger one bufferlength is subtracted.
------------------------------------------------------------------------------------------------
-        return:   modulo result
---------------------------------------------------------------------------------------------
-*/
-static INT ModuloValue(INT input, INT bufferlength) {
-  if (input > (bufferlength - 1)) {
-    return (input - bufferlength);
-  }
-  if (input < 0) {
-    return (input + bufferlength);
-  }
-  return input;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description: This function clears a bit from current bitfield and
-                  switches off the statemachine.
-
-                  A bit is cleared in two cases:
-                  a) a codeword is decoded, then a bit is cleared in codeword
-bitfield b) a segment is decoded empty, then a bit is cleared in segment
-bitfield
---------------------------------------------------------------------------------------------
-*/
-static void ClearBitFromBitfield(STATEFUNC *ptrState, UINT offset,
-                                 UINT *pBitfield) {
-  UINT numBitfieldWord;
-  UINT numBitfieldBit;
-
-  /* get both values needed for clearing the bit */
-  numBitfieldWord = offset >> THIRTYTWO_LOG_DIV_TWO_LOG; /* int   = wordNr */
-  numBitfieldBit = offset - (numBitfieldWord
-                             << THIRTYTWO_LOG_DIV_TWO_LOG); /* fract = bitNr  */
-
-  /* clear a bit in bitfield */
-  pBitfield[numBitfieldWord] =
-      pBitfield[numBitfieldWord] &
-      ~(1 << (NUMBER_OF_BIT_IN_WORD - 1 - numBitfieldBit));
-
-  /* switch off state machine because codeword is decoded and/or because segment
-   * is empty */
-  *ptrState = NULL;
-}
-
-/* =========================================================================================
-                              the states of the statemachine
-   =========================================================================================
- */
-
-/*---------------------------------------------------------------------------------------------
-     description:  Decodes the body of a codeword. This State is used for
-codebooks 1,2,5 and 6. No sign bits are decoded, because the table of the
-quantized spectral values has got a valid sign at the quantized spectral lines.
------------------------------------------------------------------------------------------------
-        output:   Two or four quantizes spectral values written at position
-where pResultPointr points to
------------------------------------------------------------------------------------------------
-        return:   0
---------------------------------------------------------------------------------------------
-*/
-UINT Hcr_State_BODY_ONLY(HANDLE_FDK_BITSTREAM bs, void *ptr) {
-  H_HCR_INFO pHcr = (H_HCR_INFO)ptr;
-  UINT *pSegmentBitfield;
-  UINT *pCodewordBitfield;
-  UINT segmentOffset;
-  FIXP_DBL *pResultBase;
-  UINT *iNode;
-  USHORT *iResultPointer;
-  UINT codewordOffset;
-  UINT branchNode;
-  UINT branchValue;
-  UINT iQSC;
-  UINT treeNode;
-  UCHAR carryBit;
-  INT *pLeftStartOfSegment;
-  INT *pRightStartOfSegment;
-  SCHAR *pRemainingBitsInSegment;
-  UCHAR readDirection;
-  UCHAR *pCodebook;
-  UCHAR dimCntr;
-  const UINT *pCurrentTree;
-  const UCHAR *pCbDimension;
-  const SCHAR *pQuantVal;
-  const SCHAR *pQuantValBase;
-
-  pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  pLeftStartOfSegment = pHcr->segmentInfo.pLeftStartOfSegment;
-  pRightStartOfSegment = pHcr->segmentInfo.pRightStartOfSegment;
-  readDirection = pHcr->segmentInfo.readDirection;
-  pSegmentBitfield = pHcr->segmentInfo.pSegmentBitfield;
-  pCodewordBitfield = pHcr->segmentInfo.pCodewordBitfield;
-  segmentOffset = pHcr->segmentInfo.segmentOffset;
-
-  pCodebook = pHcr->nonPcwSideinfo.pCodebook;
-  iNode = pHcr->nonPcwSideinfo.iNode;
-  pResultBase = pHcr->nonPcwSideinfo.pResultBase;
-  iResultPointer = pHcr->nonPcwSideinfo.iResultPointer;
-  codewordOffset = pHcr->nonPcwSideinfo.codewordOffset;
-
-  pCbDimension = aDimCb;
-
-  treeNode = iNode[codewordOffset];
-  pCurrentTree = aHuffTable[pCodebook[codewordOffset]];
-
-  for (; pRemainingBitsInSegment[segmentOffset] > 0;
-       pRemainingBitsInSegment[segmentOffset] -= 1) {
-    carryBit = HcrGetABitFromBitstream(
-        bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset],
-        &pRightStartOfSegment[segmentOffset], readDirection);
-
-    CarryBitToBranchValue(carryBit, /* make a step in decoding tree */
-                          treeNode, &branchValue, &branchNode);
-
-    /* if end of branch reached write out lines and count bits needed for sign,
-     * otherwise store node in codeword sideinfo */
-    if ((branchNode & TEST_BIT_10) ==
-        TEST_BIT_10) { /* test bit 10 ; ==> body is complete */
-      pQuantValBase = aQuantTable[pCodebook[codewordOffset]]; /* get base
-                                                                 address of
-                                                                 quantized
-                                                                 values
-                                                                 belonging to
-                                                                 current
-                                                                 codebook */
-      pQuantVal = pQuantValBase + branchValue; /* set pointer to first valid
-                                                  line [of 2 or 4 quantized
-                                                  values] */
-
-      iQSC = iResultPointer[codewordOffset]; /* get position of first line for
-                                                writing out result */
-
-      for (dimCntr = pCbDimension[pCodebook[codewordOffset]]; dimCntr != 0;
-           dimCntr--) {
-        pResultBase[iQSC++] =
-            (FIXP_DBL)*pQuantVal++; /* write out 2 or 4 lines into
-                                       spectrum; no Sign bits
-                                       available in this state */
-      }
-
-      ClearBitFromBitfield(&(pHcr->nonPcwSideinfo.pState), segmentOffset,
-                           pCodewordBitfield); /* clear a bit in bitfield and
-                                                  switch off statemachine */
-      pRemainingBitsInSegment[segmentOffset] -= 1; /* last reinitialzation of
-                                                      for loop counter (see
-                                                      above) is done here */
-      break; /* end of branch in tree reached  i.e. a whole nonPCW-Body is
-                decoded */
-    } else { /* body is not decoded completely: */
-      treeNode = *(
-          pCurrentTree +
-          branchValue); /* update treeNode for further step in decoding tree */
-    }
-  }
-  iNode[codewordOffset] = treeNode; /* store updated treeNode because maybe
-                                       decoding of codeword body not finished
-                                       yet */
-
-  if (pRemainingBitsInSegment[segmentOffset] <= 0) {
-    ClearBitFromBitfield(&(pHcr->nonPcwSideinfo.pState), segmentOffset,
-                         pSegmentBitfield); /* clear a bit in bitfield and
-                                               switch off statemachine */
-
-    if (pRemainingBitsInSegment[segmentOffset] < 0) {
-      pHcr->decInOut.errorLog |= STATE_ERROR_BODY_ONLY;
-      return BODY_ONLY;
-    }
-  }
-
-  return STOP_THIS_STATE;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description: Decodes the codeword body, writes out result and counts the
-number of quantized spectral values, which are different form zero. For those
-values sign bits are needed.
-
-                  If sign bit counter cntSign is different from zero, switch to
-next state to decode sign Bits there. If sign bit counter cntSign is zero, no
-sign bits are needed and codeword is decoded.
------------------------------------------------------------------------------------------------
-        output:   Two or four written quantizes spectral values written at
-position where pResultPointr points to. The signs of those lines may be wrong.
-If the signs [on just one signle sign] is wrong, the next state will correct it.
------------------------------------------------------------------------------------------------
-        return:   0
---------------------------------------------------------------------------------------------
-*/
-UINT Hcr_State_BODY_SIGN__BODY(HANDLE_FDK_BITSTREAM bs, void *ptr) {
-  H_HCR_INFO pHcr = (H_HCR_INFO)ptr;
-  SCHAR *pRemainingBitsInSegment;
-  INT *pLeftStartOfSegment;
-  INT *pRightStartOfSegment;
-  UCHAR readDirection;
-  UINT *pSegmentBitfield;
-  UINT *pCodewordBitfield;
-  UINT segmentOffset;
-
-  UCHAR *pCodebook;
-  UINT *iNode;
-  UCHAR *pCntSign;
-  FIXP_DBL *pResultBase;
-  USHORT *iResultPointer;
-  UINT codewordOffset;
-
-  UINT iQSC;
-  UINT cntSign;
-  UCHAR dimCntr;
-  UCHAR carryBit;
-  SCHAR *pSta;
-  UINT treeNode;
-  UINT branchValue;
-  UINT branchNode;
-  const UCHAR *pCbDimension;
-  const UINT *pCurrentTree;
-  const SCHAR *pQuantValBase;
-  const SCHAR *pQuantVal;
-
-  pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  pLeftStartOfSegment = pHcr->segmentInfo.pLeftStartOfSegment;
-  pRightStartOfSegment = pHcr->segmentInfo.pRightStartOfSegment;
-  readDirection = pHcr->segmentInfo.readDirection;
-  pSegmentBitfield = pHcr->segmentInfo.pSegmentBitfield;
-  pCodewordBitfield = pHcr->segmentInfo.pCodewordBitfield;
-  segmentOffset = pHcr->segmentInfo.segmentOffset;
-
-  pCodebook = pHcr->nonPcwSideinfo.pCodebook;
-  iNode = pHcr->nonPcwSideinfo.iNode;
-  pCntSign = pHcr->nonPcwSideinfo.pCntSign;
-  pResultBase = pHcr->nonPcwSideinfo.pResultBase;
-  iResultPointer = pHcr->nonPcwSideinfo.iResultPointer;
-  codewordOffset = pHcr->nonPcwSideinfo.codewordOffset;
-  pSta = pHcr->nonPcwSideinfo.pSta;
-
-  pCbDimension = aDimCb;
-
-  treeNode = iNode[codewordOffset];
-  pCurrentTree = aHuffTable[pCodebook[codewordOffset]];
-
-  for (; pRemainingBitsInSegment[segmentOffset] > 0;
-       pRemainingBitsInSegment[segmentOffset] -= 1) {
-    carryBit = HcrGetABitFromBitstream(
-        bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset],
-        &pRightStartOfSegment[segmentOffset], readDirection);
-
-    CarryBitToBranchValue(carryBit, /* make a step in decoding tree */
-                          treeNode, &branchValue, &branchNode);
-
-    /* if end of branch reached write out lines and count bits needed for sign,
-     * otherwise store node in codeword sideinfo */
-    if ((branchNode & TEST_BIT_10) ==
-        TEST_BIT_10) { /* test bit 10 ; if set body complete */
-      /* body completely decoded; branchValue is valid, set pQuantVal to first
-       * (of two or four) quantized spectral coefficients */
-      pQuantValBase = aQuantTable[pCodebook[codewordOffset]]; /* get base
-                                                                 address of
-                                                                 quantized
-                                                                 values
-                                                                 belonging to
-                                                                 current
-                                                                 codebook */
-      pQuantVal = pQuantValBase + branchValue; /* set pointer to first valid
-                                                  line [of 2 or 4 quantized
-                                                  values] */
-
-      iQSC = iResultPointer[codewordOffset]; /* get position of first line for
-                                                writing result */
-
-      /* codeword decoding result is written out here: Write out 2 or 4
-       * quantized spectral values with probably */
-      /* wrong sign and count number of values which are different from zero for
-       * sign bit decoding [which happens in next state] */
-      cntSign = 0;
-      for (dimCntr = pCbDimension[pCodebook[codewordOffset]]; dimCntr != 0;
-           dimCntr--) {
-        pResultBase[iQSC++] =
-            (FIXP_DBL)*pQuantVal; /* write quant. spec. coef. into spectrum */
-        if (*pQuantVal++ != 0) {
-          cntSign += 1;
-        }
-      }
-
-      if (cntSign == 0) {
-        ClearBitFromBitfield(
-            &(pHcr->nonPcwSideinfo.pState), segmentOffset,
-            pCodewordBitfield); /* clear a bit in bitfield and switch off
-                                   statemachine */
-      } else {
-        pCntSign[codewordOffset] = cntSign;     /* write sign count result into
-                                                   codewordsideinfo of current
-                                                   codeword */
-        pSta[codewordOffset] = BODY_SIGN__SIGN; /* change state */
-        pHcr->nonPcwSideinfo.pState =
-            aStateConstant2State[pSta[codewordOffset]]; /* get state from
-                                                           separate array of
-                                                           cw-sideinfo */
-      }
-      pRemainingBitsInSegment[segmentOffset] -= 1; /* last reinitialzation of
-                                                      for loop counter (see
-                                                      above) is done here */
-      break; /* end of branch in tree reached  i.e. a whole nonPCW-Body is
-                decoded */
-    } else { /* body is not decoded completely: */
-      treeNode = *(
-          pCurrentTree +
-          branchValue); /* update treeNode for further step in decoding tree */
-    }
-  }
-  iNode[codewordOffset] = treeNode; /* store updated treeNode because maybe
-                                       decoding of codeword body not finished
-                                       yet */
-
-  if (pRemainingBitsInSegment[segmentOffset] <= 0) {
-    ClearBitFromBitfield(&(pHcr->nonPcwSideinfo.pState), segmentOffset,
-                         pSegmentBitfield); /* clear a bit in bitfield and
-                                               switch off statemachine */
-
-    if (pRemainingBitsInSegment[segmentOffset] < 0) {
-      pHcr->decInOut.errorLog |= STATE_ERROR_BODY_SIGN__BODY;
-      return BODY_SIGN__BODY;
-    }
-  }
-
-  return STOP_THIS_STATE;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description: This state decodes the sign bits belonging to a codeword. The
-state is called as often in different "trials" until pCntSgn[codewordOffset] is
-zero.
------------------------------------------------------------------------------------------------
-        output:   The two or four quantizes spectral values (written in previous
-state) have now the correct sign.
------------------------------------------------------------------------------------------------
-        return:   0
---------------------------------------------------------------------------------------------
-*/
-UINT Hcr_State_BODY_SIGN__SIGN(HANDLE_FDK_BITSTREAM bs, void *ptr) {
-  H_HCR_INFO pHcr = (H_HCR_INFO)ptr;
-  SCHAR *pRemainingBitsInSegment;
-  INT *pLeftStartOfSegment;
-  INT *pRightStartOfSegment;
-  UCHAR readDirection;
-  UINT *pSegmentBitfield;
-  UINT *pCodewordBitfield;
-  UINT segmentOffset;
-
-  UCHAR *pCntSign;
-  FIXP_DBL *pResultBase;
-  USHORT *iResultPointer;
-  UINT codewordOffset;
-
-  UCHAR carryBit;
-  UINT iQSC;
-  UCHAR cntSign;
-
-  pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  pLeftStartOfSegment = pHcr->segmentInfo.pLeftStartOfSegment;
-  pRightStartOfSegment = pHcr->segmentInfo.pRightStartOfSegment;
-  readDirection = pHcr->segmentInfo.readDirection;
-  pSegmentBitfield = pHcr->segmentInfo.pSegmentBitfield;
-  pCodewordBitfield = pHcr->segmentInfo.pCodewordBitfield;
-  segmentOffset = pHcr->segmentInfo.segmentOffset;
-
-  /*pCodebook               = */
-  pCntSign = pHcr->nonPcwSideinfo.pCntSign;
-  pResultBase = pHcr->nonPcwSideinfo.pResultBase;
-  iResultPointer = pHcr->nonPcwSideinfo.iResultPointer;
-  codewordOffset = pHcr->nonPcwSideinfo.codewordOffset;
-
-  iQSC = iResultPointer[codewordOffset];
-  cntSign = pCntSign[codewordOffset];
-
-  /* loop for sign bit decoding */
-  for (; pRemainingBitsInSegment[segmentOffset] > 0;
-       pRemainingBitsInSegment[segmentOffset] -= 1) {
-    carryBit = HcrGetABitFromBitstream(
-        bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset],
-        &pRightStartOfSegment[segmentOffset], readDirection);
-    cntSign -=
-        1; /* decrement sign counter because one sign bit has been read */
-
-    /* search for a line (which was decoded in previous state) which is not
-     * zero. [This value will get a sign] */
-    while (pResultBase[iQSC] == (FIXP_DBL)0) {
-      if (++iQSC >= 1024) { /* points to current value different from zero */
-        return BODY_SIGN__SIGN;
-      }
-    }
-
-    /* put sign together with line; if carryBit is zero, the sign is ok already;
-     * no write operation necessary in this case */
-    if (carryBit != 0) {
-      pResultBase[iQSC] = -pResultBase[iQSC]; /* carryBit = 1 --> minus */
-    }
-
-    iQSC++; /* update pointer to next (maybe valid) value */
-
-    if (cntSign == 0) { /* if (cntSign==0)  ==>  set state CODEWORD_DECODED */
-      ClearBitFromBitfield(&(pHcr->nonPcwSideinfo.pState), segmentOffset,
-                           pCodewordBitfield); /* clear a bit in bitfield and
-                                                  switch off statemachine */
-      pRemainingBitsInSegment[segmentOffset] -= 1; /* last reinitialzation of
-                                                      for loop counter (see
-                                                      above) is done here */
-      break; /* whole nonPCW-Body and according sign bits are decoded */
-    }
-  }
-  pCntSign[codewordOffset] = cntSign;
-  iResultPointer[codewordOffset] = iQSC; /* store updated pResultPointer */
-
-  if (pRemainingBitsInSegment[segmentOffset] <= 0) {
-    ClearBitFromBitfield(&(pHcr->nonPcwSideinfo.pState), segmentOffset,
-                         pSegmentBitfield); /* clear a bit in bitfield and
-                                               switch off statemachine */
-
-    if (pRemainingBitsInSegment[segmentOffset] < 0) {
-      pHcr->decInOut.errorLog |= STATE_ERROR_BODY_SIGN__SIGN;
-      return BODY_SIGN__SIGN;
-    }
-  }
-
-  return STOP_THIS_STATE;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description: Decodes the codeword body in case of codebook is 11. Writes
-out resulting two or four lines [with probably wrong sign] and counts the number
-of lines, which are different form zero. This information is needed in next
-                  state where sign bits will be decoded, if necessary.
-                  If sign bit counter cntSign is zero, no sign bits are needed
-and codeword is decoded completely.
------------------------------------------------------------------------------------------------
-        output:   Two lines (quantizes spectral coefficients) which are probably
-wrong. The sign may be wrong and if one or two values is/are 16, the following
-states will decode the escape sequence to correct the values which are wirtten
-here.
------------------------------------------------------------------------------------------------
-        return:   0
---------------------------------------------------------------------------------------------
-*/
-UINT Hcr_State_BODY_SIGN_ESC__BODY(HANDLE_FDK_BITSTREAM bs, void *ptr) {
-  H_HCR_INFO pHcr = (H_HCR_INFO)ptr;
-  SCHAR *pRemainingBitsInSegment;
-  INT *pLeftStartOfSegment;
-  INT *pRightStartOfSegment;
-  UCHAR readDirection;
-  UINT *pSegmentBitfield;
-  UINT *pCodewordBitfield;
-  UINT segmentOffset;
-
-  UINT *iNode;
-  UCHAR *pCntSign;
-  FIXP_DBL *pResultBase;
-  USHORT *iResultPointer;
-  UINT codewordOffset;
-
-  UCHAR carryBit;
-  UINT iQSC;
-  UINT cntSign;
-  UINT dimCntr;
-  UINT treeNode;
-  SCHAR *pSta;
-  UINT branchNode;
-  UINT branchValue;
-  const UINT *pCurrentTree;
-  const SCHAR *pQuantValBase;
-  const SCHAR *pQuantVal;
-
-  pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  pLeftStartOfSegment = pHcr->segmentInfo.pLeftStartOfSegment;
-  pRightStartOfSegment = pHcr->segmentInfo.pRightStartOfSegment;
-  readDirection = pHcr->segmentInfo.readDirection;
-  pSegmentBitfield = pHcr->segmentInfo.pSegmentBitfield;
-  pCodewordBitfield = pHcr->segmentInfo.pCodewordBitfield;
-  segmentOffset = pHcr->segmentInfo.segmentOffset;
-
-  iNode = pHcr->nonPcwSideinfo.iNode;
-  pCntSign = pHcr->nonPcwSideinfo.pCntSign;
-  pResultBase = pHcr->nonPcwSideinfo.pResultBase;
-  iResultPointer = pHcr->nonPcwSideinfo.iResultPointer;
-  codewordOffset = pHcr->nonPcwSideinfo.codewordOffset;
-  pSta = pHcr->nonPcwSideinfo.pSta;
-
-  treeNode = iNode[codewordOffset];
-  pCurrentTree = aHuffTable[ESCAPE_CODEBOOK];
-
-  for (; pRemainingBitsInSegment[segmentOffset] > 0;
-       pRemainingBitsInSegment[segmentOffset] -= 1) {
-    carryBit = HcrGetABitFromBitstream(
-        bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset],
-        &pRightStartOfSegment[segmentOffset], readDirection);
-
-    /* make a step in tree */
-    CarryBitToBranchValue(carryBit, treeNode, &branchValue, &branchNode);
-
-    /* if end of branch reached write out lines and count bits needed for sign,
-     * otherwise store node in codeword sideinfo */
-    if ((branchNode & TEST_BIT_10) ==
-        TEST_BIT_10) { /* test bit 10 ; if set body complete */
-
-      /* body completely decoded; branchValue is valid */
-      /* set pQuantVol to first (of two or four) quantized spectral coefficients
-       */
-      pQuantValBase = aQuantTable[ESCAPE_CODEBOOK]; /* get base address of
-                                                       quantized values
-                                                       belonging to current
-                                                       codebook */
-      pQuantVal = pQuantValBase + branchValue; /* set pointer to first valid
-                                                  line [of 2 or 4 quantized
-                                                  values] */
-
-      /* make backup from original resultPointer in node storage for state
-       * BODY_SIGN_ESC__SIGN */
-      iNode[codewordOffset] = iResultPointer[codewordOffset];
-
-      /* get position of first line for writing result */
-      iQSC = iResultPointer[codewordOffset];
-
-      /* codeword decoding result is written out here: Write out 2 or 4
-       * quantized spectral values with probably */
-      /* wrong sign and count number of values which are different from zero for
-       * sign bit decoding [which happens in next state] */
-      cntSign = 0;
-
-      for (dimCntr = DIMENSION_OF_ESCAPE_CODEBOOK; dimCntr != 0; dimCntr--) {
-        pResultBase[iQSC++] =
-            (FIXP_DBL)*pQuantVal; /* write quant. spec. coef. into spectrum */
-        if (*pQuantVal++ != 0) {
-          cntSign += 1;
-        }
-      }
-
-      if (cntSign == 0) {
-        ClearBitFromBitfield(
-            &(pHcr->nonPcwSideinfo.pState), segmentOffset,
-            pCodewordBitfield); /* clear a bit in bitfield and switch off
-                                   statemachine */
-        /* codeword decoded */
-      } else {
-        /* write sign count result into codewordsideinfo of current codeword */
-        pCntSign[codewordOffset] = cntSign;
-        pSta[codewordOffset] = BODY_SIGN_ESC__SIGN; /* change state */
-        pHcr->nonPcwSideinfo.pState =
-            aStateConstant2State[pSta[codewordOffset]]; /* get state from
-                                                           separate array of
-                                                           cw-sideinfo */
-      }
-      pRemainingBitsInSegment[segmentOffset] -= 1; /* the last reinitialzation
-                                                      of for loop counter (see
-                                                      above) is done here */
-      break; /* end of branch in tree reached  i.e. a whole nonPCW-Body is
-                decoded */
-    } else { /* body is not decoded completely: */
-      /* update treeNode for further step in decoding tree and store updated
-       * treeNode because maybe no more bits left in segment */
-      treeNode = *(pCurrentTree + branchValue);
-      iNode[codewordOffset] = treeNode;
-    }
-  }
-
-  if (pRemainingBitsInSegment[segmentOffset] <= 0) {
-    ClearBitFromBitfield(&(pHcr->nonPcwSideinfo.pState), segmentOffset,
-                         pSegmentBitfield); /* clear a bit in bitfield and
-                                               switch off statemachine */
-
-    if (pRemainingBitsInSegment[segmentOffset] < 0) {
-      pHcr->decInOut.errorLog |= STATE_ERROR_BODY_SIGN_ESC__BODY;
-      return BODY_SIGN_ESC__BODY;
-    }
-  }
-
-  return STOP_THIS_STATE;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description: This state decodes the sign bits, if a codeword of codebook 11
-needs some. A flag named 'flagB' in codeword sideinfo is set, if the second line
-of quantized spectral values is 16. The 'flagB' is used in case of decoding of a
-escape sequence is necessary as far as the second line is concerned.
-
-                  If only the first line needs an escape sequence, the flagB is
-cleared. If only the second line needs an escape sequence, the flagB is not
-used.
-
-                  For storing sideinfo in case of escape sequence decoding one
-single word can be used for both escape sequences because they are decoded not
-at the same time:
-
-
-                  bit 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5
-4  3  2  1  0
-                      ===== == == =========== ===========
-=================================== ^      ^  ^         ^            ^
-^ |      |  |         |            |                    | res. flagA  flagB
-escapePrefixUp  escapePrefixDown  escapeWord
-
------------------------------------------------------------------------------------------------
-        output:   Two lines with correct sign. If one or two values is/are 16,
-the lines are not valid, otherwise they are.
------------------------------------------------------------------------------------------------
-        return:   0
---------------------------------------------------------------------------------------------
-*/
-UINT Hcr_State_BODY_SIGN_ESC__SIGN(HANDLE_FDK_BITSTREAM bs, void *ptr) {
-  H_HCR_INFO pHcr = (H_HCR_INFO)ptr;
-  SCHAR *pRemainingBitsInSegment;
-  INT *pLeftStartOfSegment;
-  INT *pRightStartOfSegment;
-  UCHAR readDirection;
-  UINT *pSegmentBitfield;
-  UINT *pCodewordBitfield;
-  UINT segmentOffset;
-
-  UINT *iNode;
-  UCHAR *pCntSign;
-  FIXP_DBL *pResultBase;
-  USHORT *iResultPointer;
-  UINT *pEscapeSequenceInfo;
-  UINT codewordOffset;
-
-  UINT iQSC;
-  UCHAR cntSign;
-  UINT flagA;
-  UINT flagB;
-  UINT flags;
-  UCHAR carryBit;
-  SCHAR *pSta;
-
-  pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  pLeftStartOfSegment = pHcr->segmentInfo.pLeftStartOfSegment;
-  pRightStartOfSegment = pHcr->segmentInfo.pRightStartOfSegment;
-  readDirection = pHcr->segmentInfo.readDirection;
-  pSegmentBitfield = pHcr->segmentInfo.pSegmentBitfield;
-  pCodewordBitfield = pHcr->segmentInfo.pCodewordBitfield;
-  segmentOffset = pHcr->segmentInfo.segmentOffset;
-
-  iNode = pHcr->nonPcwSideinfo.iNode;
-  pCntSign = pHcr->nonPcwSideinfo.pCntSign;
-  pResultBase = pHcr->nonPcwSideinfo.pResultBase;
-  iResultPointer = pHcr->nonPcwSideinfo.iResultPointer;
-  pEscapeSequenceInfo = pHcr->nonPcwSideinfo.pEscapeSequenceInfo;
-  codewordOffset = pHcr->nonPcwSideinfo.codewordOffset;
-  pSta = pHcr->nonPcwSideinfo.pSta;
-
-  iQSC = iResultPointer[codewordOffset];
-  cntSign = pCntSign[codewordOffset];
-
-  /* loop for sign bit decoding */
-  for (; pRemainingBitsInSegment[segmentOffset] > 0;
-       pRemainingBitsInSegment[segmentOffset] -= 1) {
-    carryBit = HcrGetABitFromBitstream(
-        bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset],
-        &pRightStartOfSegment[segmentOffset], readDirection);
-
-    /* decrement sign counter because one sign bit has been read */
-    cntSign -= 1;
-    pCntSign[codewordOffset] = cntSign;
-
-    /* get a quantized spectral value (which was decoded in previous state)
-     * which is not zero. [This value will get a sign] */
-    while (pResultBase[iQSC] == (FIXP_DBL)0) {
-      if (++iQSC >= 1024) {
-        return BODY_SIGN_ESC__SIGN;
-      }
-    }
-    iResultPointer[codewordOffset] = iQSC;
-
-    /* put negative sign together with quantized spectral value; if carryBit is
-     * zero, the sign is ok already; no write operation necessary in this case
-     */
-    if (carryBit != 0) {
-      pResultBase[iQSC] = -pResultBase[iQSC]; /* carryBit = 1 --> minus */
-    }
-    iQSC++; /* update index to next (maybe valid) value */
-    iResultPointer[codewordOffset] = iQSC;
-
-    if (cntSign == 0) {
-      /* all sign bits are decoded now */
-      pRemainingBitsInSegment[segmentOffset] -= 1; /* last reinitialzation of
-                                                      for loop counter (see
-                                                      above) is done here */
-
-      /* check decoded values if codeword is decoded: Check if one or two escape
-       * sequences 16 follow */
-
-      /* step 0 */
-      /* restore pointer to first decoded quantized value [ = original
-       * pResultPointr] from index iNode prepared in State_BODY_SIGN_ESC__BODY
-       */
-      iQSC = iNode[codewordOffset];
-
-      /* step 1 */
-      /* test first value if escape sequence follows */
-      flagA = 0; /* for first possible escape sequence */
-      if (fixp_abs(pResultBase[iQSC++]) == (FIXP_DBL)ESCAPE_VALUE) {
-        flagA = 1;
-      }
-
-      /* step 2 */
-      /* test second value if escape sequence follows */
-      flagB = 0; /* for second possible escape sequence */
-      if (fixp_abs(pResultBase[iQSC]) == (FIXP_DBL)ESCAPE_VALUE) {
-        flagB = 1;
-      }
-
-      /* step 3 */
-      /* evaluate flag result and go on if necessary */
-      if (!flagA && !flagB) {
-        ClearBitFromBitfield(
-            &(pHcr->nonPcwSideinfo.pState), segmentOffset,
-            pCodewordBitfield); /* clear a bit in bitfield and switch off
-                                   statemachine */
-      } else {
-        /* at least one of two lines is 16 */
-        /* store both flags at correct positions in non PCW codeword sideinfo
-         * pEscapeSequenceInfo[codewordOffset] */
-        flags = flagA << POSITION_OF_FLAG_A;
-        flags |= (flagB << POSITION_OF_FLAG_B);
-        pEscapeSequenceInfo[codewordOffset] = flags;
-
-        /* set next state */
-        pSta[codewordOffset] = BODY_SIGN_ESC__ESC_PREFIX;
-        pHcr->nonPcwSideinfo.pState =
-            aStateConstant2State[pSta[codewordOffset]]; /* get state from
-                                                           separate array of
-                                                           cw-sideinfo */
-
-        /* set result pointer to the first line of the two decoded lines */
-        iResultPointer[codewordOffset] = iNode[codewordOffset];
-
-        if (!flagA && flagB) {
-          /* update pResultPointr ==> state Stat_BODY_SIGN_ESC__ESC_WORD writes
-           * to correct position. Second value is the one and only escape value
-           */
-          iQSC = iResultPointer[codewordOffset];
-          iQSC++;
-          iResultPointer[codewordOffset] = iQSC;
-        }
-
-      }      /* at least one of two lines is 16 */
-      break; /* nonPCW-Body at cb 11 and according sign bits are decoded */
-
-    } /* if ( cntSign == 0 ) */
-  }   /* loop over remaining Bits in segment */
-
-  if (pRemainingBitsInSegment[segmentOffset] <= 0) {
-    ClearBitFromBitfield(&(pHcr->nonPcwSideinfo.pState), segmentOffset,
-                         pSegmentBitfield); /* clear a bit in bitfield and
-                                               switch off statemachine */
-
-    if (pRemainingBitsInSegment[segmentOffset] < 0) {
-      pHcr->decInOut.errorLog |= STATE_ERROR_BODY_SIGN_ESC__SIGN;
-      return BODY_SIGN_ESC__SIGN;
-    }
-  }
-  return STOP_THIS_STATE;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description: Decode escape prefix of first or second escape sequence. The
-escape prefix consists of ones. The following zero is also decoded here.
------------------------------------------------------------------------------------------------
-        output:   If the single separator-zero which follows the
-escape-prefix-ones is not yet decoded: The value 'escapePrefixUp' in word
-pEscapeSequenceInfo[codewordOffset] is updated.
-
-                  If the single separator-zero which follows the
-escape-prefix-ones is decoded: Two updated values 'escapePrefixUp' and
-'escapePrefixDown' in word pEscapeSequenceInfo[codewordOffset]. This State is
-finished. Switch to next state.
------------------------------------------------------------------------------------------------
-        return:   0
---------------------------------------------------------------------------------------------
-*/
-UINT Hcr_State_BODY_SIGN_ESC__ESC_PREFIX(HANDLE_FDK_BITSTREAM bs, void *ptr) {
-  H_HCR_INFO pHcr = (H_HCR_INFO)ptr;
-  SCHAR *pRemainingBitsInSegment;
-  INT *pLeftStartOfSegment;
-  INT *pRightStartOfSegment;
-  UCHAR readDirection;
-  UINT *pSegmentBitfield;
-  UINT segmentOffset;
-  UINT *pEscapeSequenceInfo;
-  UINT codewordOffset;
-  UCHAR carryBit;
-  UINT escapePrefixUp;
-  SCHAR *pSta;
-
-  pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  pLeftStartOfSegment = pHcr->segmentInfo.pLeftStartOfSegment;
-  pRightStartOfSegment = pHcr->segmentInfo.pRightStartOfSegment;
-  readDirection = pHcr->segmentInfo.readDirection;
-  pSegmentBitfield = pHcr->segmentInfo.pSegmentBitfield;
-  segmentOffset = pHcr->segmentInfo.segmentOffset;
-  pEscapeSequenceInfo = pHcr->nonPcwSideinfo.pEscapeSequenceInfo;
-  codewordOffset = pHcr->nonPcwSideinfo.codewordOffset;
-  pSta = pHcr->nonPcwSideinfo.pSta;
-
-  escapePrefixUp =
-      (pEscapeSequenceInfo[codewordOffset] & MASK_ESCAPE_PREFIX_UP) >>
-      LSB_ESCAPE_PREFIX_UP;
-
-  /* decode escape prefix */
-  for (; pRemainingBitsInSegment[segmentOffset] > 0;
-       pRemainingBitsInSegment[segmentOffset] -= 1) {
-    carryBit = HcrGetABitFromBitstream(
-        bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset],
-        &pRightStartOfSegment[segmentOffset], readDirection);
-
-    /* count ones and store sum in escapePrefixUp */
-    if (carryBit == 1) {
-      escapePrefixUp += 1; /* update conter for ones */
-
-      /* store updated counter in sideinfo of current codeword */
-      pEscapeSequenceInfo[codewordOffset] &=
-          ~MASK_ESCAPE_PREFIX_UP;              /* delete old escapePrefixUp */
-      escapePrefixUp <<= LSB_ESCAPE_PREFIX_UP; /* shift to correct position */
-      pEscapeSequenceInfo[codewordOffset] |=
-          escapePrefixUp;                      /* insert new escapePrefixUp */
-      escapePrefixUp >>= LSB_ESCAPE_PREFIX_UP; /* shift back down */
-    } else {                                   /* separator [zero] reached */
-      pRemainingBitsInSegment[segmentOffset] -= 1; /* last reinitialzation of
-                                                      for loop counter (see
-                                                      above) is done here */
-      escapePrefixUp +=
-          4; /* if escape_separator '0' appears, add 4 and ==> break */
-
-      /* store escapePrefixUp in pEscapeSequenceInfo[codewordOffset] at bit
-       * position escapePrefixUp */
-      pEscapeSequenceInfo[codewordOffset] &=
-          ~MASK_ESCAPE_PREFIX_UP;              /* delete old escapePrefixUp */
-      escapePrefixUp <<= LSB_ESCAPE_PREFIX_UP; /* shift to correct position */
-      pEscapeSequenceInfo[codewordOffset] |=
-          escapePrefixUp;                      /* insert new escapePrefixUp */
-      escapePrefixUp >>= LSB_ESCAPE_PREFIX_UP; /* shift back down */
-
-      /* store escapePrefixUp in pEscapeSequenceInfo[codewordOffset] at bit
-       * position escapePrefixDown */
-      pEscapeSequenceInfo[codewordOffset] &=
-          ~MASK_ESCAPE_PREFIX_DOWN; /* delete old escapePrefixDown */
-      escapePrefixUp <<= LSB_ESCAPE_PREFIX_DOWN; /* shift to correct position */
-      pEscapeSequenceInfo[codewordOffset] |=
-          escapePrefixUp; /* insert new escapePrefixDown */
-
-      pSta[codewordOffset] = BODY_SIGN_ESC__ESC_WORD; /* set next state */
-      pHcr->nonPcwSideinfo.pState =
-          aStateConstant2State[pSta[codewordOffset]]; /* get state from separate
-                                                         array of cw-sideinfo */
-      break;
-    }
-  }
-
-  if (pRemainingBitsInSegment[segmentOffset] <= 0) {
-    ClearBitFromBitfield(&(pHcr->nonPcwSideinfo.pState), segmentOffset,
-                         pSegmentBitfield); /* clear a bit in bitfield and
-                                               switch off statemachine */
-
-    if (pRemainingBitsInSegment[segmentOffset] < 0) {
-      pHcr->decInOut.errorLog |= STATE_ERROR_BODY_SIGN_ESC__ESC_PREFIX;
-      return BODY_SIGN_ESC__ESC_PREFIX;
-    }
-  }
-
-  return STOP_THIS_STATE;
-}
-
-/*---------------------------------------------------------------------------------------------
-     description: Decode escapeWord of escape sequence. If the escape sequence
-is decoded completely, assemble quantized-spectral-escape-coefficient and
-replace the previous decoded 16 by the new value. Test flagB. If flagB is set,
-the second escape sequence must be decoded. If flagB is not set, the codeword is
-decoded and the state machine is switched off.
------------------------------------------------------------------------------------------------
-        output:   Two lines with valid sign. At least one of both lines has got
-the correct value.
------------------------------------------------------------------------------------------------
-        return:   0
---------------------------------------------------------------------------------------------
-*/
-UINT Hcr_State_BODY_SIGN_ESC__ESC_WORD(HANDLE_FDK_BITSTREAM bs, void *ptr) {
-  H_HCR_INFO pHcr = (H_HCR_INFO)ptr;
-  SCHAR *pRemainingBitsInSegment;
-  INT *pLeftStartOfSegment;
-  INT *pRightStartOfSegment;
-  UCHAR readDirection;
-  UINT *pSegmentBitfield;
-  UINT *pCodewordBitfield;
-  UINT segmentOffset;
-
-  FIXP_DBL *pResultBase;
-  USHORT *iResultPointer;
-  UINT *pEscapeSequenceInfo;
-  UINT codewordOffset;
-
-  UINT escapeWord;
-  UINT escapePrefixDown;
-  UINT escapePrefixUp;
-  UCHAR carryBit;
-  UINT iQSC;
-  INT sign;
-  UINT flagA;
-  UINT flagB;
-  SCHAR *pSta;
-
-  pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment;
-  pLeftStartOfSegment = pHcr->segmentInfo.pLeftStartOfSegment;
-  pRightStartOfSegment = pHcr->segmentInfo.pRightStartOfSegment;
-  readDirection = pHcr->segmentInfo.readDirection;
-  pSegmentBitfield = pHcr->segmentInfo.pSegmentBitfield;
-  pCodewordBitfield = pHcr->segmentInfo.pCodewordBitfield;
-  segmentOffset = pHcr->segmentInfo.segmentOffset;
-
-  pResultBase = pHcr->nonPcwSideinfo.pResultBase;
-  iResultPointer = pHcr->nonPcwSideinfo.iResultPointer;
-  pEscapeSequenceInfo = pHcr->nonPcwSideinfo.pEscapeSequenceInfo;
-  codewordOffset = pHcr->nonPcwSideinfo.codewordOffset;
-  pSta = pHcr->nonPcwSideinfo.pSta;
-
-  escapeWord = pEscapeSequenceInfo[codewordOffset] & MASK_ESCAPE_WORD;
-  escapePrefixDown =
-      (pEscapeSequenceInfo[codewordOffset] & MASK_ESCAPE_PREFIX_DOWN) >>
-      LSB_ESCAPE_PREFIX_DOWN;
-
-  /* decode escape word */
-  for (; pRemainingBitsInSegment[segmentOffset] > 0;
-       pRemainingBitsInSegment[segmentOffset] -= 1) {
-    carryBit = HcrGetABitFromBitstream(
-        bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset],
-        &pRightStartOfSegment[segmentOffset], readDirection);
-
-    /* build escape word */
-    escapeWord <<=
-        1; /* left shift previous decoded part of escapeWord by on bit */
-    escapeWord = escapeWord | carryBit; /* assemble escape word by bitwise or */
-
-    /* decrement counter for length of escape word because one more bit was
-     * decoded */
-    escapePrefixDown -= 1;
-
-    /* store updated escapePrefixDown */
-    pEscapeSequenceInfo[codewordOffset] &=
-        ~MASK_ESCAPE_PREFIX_DOWN; /* delete old escapePrefixDown */
-    escapePrefixDown <<= LSB_ESCAPE_PREFIX_DOWN; /* shift to correct position */
-    pEscapeSequenceInfo[codewordOffset] |=
-        escapePrefixDown; /* insert new escapePrefixDown */
-    escapePrefixDown >>= LSB_ESCAPE_PREFIX_DOWN; /* shift back */
-
-    /* store updated escapeWord */
-    pEscapeSequenceInfo[codewordOffset] &=
-        ~MASK_ESCAPE_WORD; /* delete old escapeWord */
-    pEscapeSequenceInfo[codewordOffset] |=
-        escapeWord; /* insert new escapeWord */
-
-    if (escapePrefixDown == 0) {
-      pRemainingBitsInSegment[segmentOffset] -= 1; /* last reinitialzation of
-                                                      for loop counter (see
-                                                      above) is done here */
-
-      /* escape sequence decoded. Assemble escape-line and replace original line
-       */
-
-      /* step 0 */
-      /* derive sign */
-      iQSC = iResultPointer[codewordOffset];
-      sign = (pResultBase[iQSC] >= (FIXP_DBL)0)
-                 ? 1
-                 : -1; /* get sign of escape value 16 */
-
-      /* step 1 */
-      /* get escapePrefixUp */
-      escapePrefixUp =
-          (pEscapeSequenceInfo[codewordOffset] & MASK_ESCAPE_PREFIX_UP) >>
-          LSB_ESCAPE_PREFIX_UP;
-
-      /* step 2 */
-      /* calculate escape value */
-      pResultBase[iQSC] =
-          (FIXP_DBL)(sign * (((INT)1 << escapePrefixUp) + (INT)escapeWord));
-
-      /* get both flags from sideinfo (flags are not shifted to the
-       * lsb-position) */
-      flagA = pEscapeSequenceInfo[codewordOffset] & MASK_FLAG_A;
-      flagB = pEscapeSequenceInfo[codewordOffset] & MASK_FLAG_B;
-
-      /* step 3 */
-      /* clear the whole escape sideinfo word */
-      pEscapeSequenceInfo[codewordOffset] = 0;
-
-      /* change state in dependence of flag flagB */
-      if (flagA != 0) {
-        /* first escape sequence decoded; previous decoded 16 has been replaced
-         * by valid line */
-
-        /* clear flagA in sideinfo word because this escape sequence has already
-         * beed decoded */
-        pEscapeSequenceInfo[codewordOffset] &= ~MASK_FLAG_A;
-
-        if (flagB == 0) {
-          ClearBitFromBitfield(&(pHcr->nonPcwSideinfo.pState), segmentOffset,
-                               pCodewordBitfield); /* clear a bit in bitfield
-                                                      and switch off
-                                                      statemachine */
-        } else {
-          /* updated pointer to next and last 16 */
-          iQSC++;
-          iResultPointer[codewordOffset] = iQSC;
-
-          /* change state */
-          pSta[codewordOffset] = BODY_SIGN_ESC__ESC_PREFIX;
-          pHcr->nonPcwSideinfo.pState =
-              aStateConstant2State[pSta[codewordOffset]]; /* get state from
-                                                             separate array of
-                                                             cw-sideinfo */
-        }
-      } else {
-        ClearBitFromBitfield(
-            &(pHcr->nonPcwSideinfo.pState), segmentOffset,
-            pCodewordBitfield); /* clear a bit in bitfield and switch off
-                                   statemachine */
-      }
-      break;
-    }
-  }
-
-  if (pRemainingBitsInSegment[segmentOffset] <= 0) {
-    ClearBitFromBitfield(&(pHcr->nonPcwSideinfo.pState), segmentOffset,
-                         pSegmentBitfield); /* clear a bit in bitfield and
-                                               switch off statemachine */
-
-    if (pRemainingBitsInSegment[segmentOffset] < 0) {
-      pHcr->decInOut.errorLog |= STATE_ERROR_BODY_SIGN_ESC__ESC_WORD;
-      return BODY_SIGN_ESC__ESC_WORD;
-    }
-  }
-
-  return STOP_THIS_STATE;
-}
--- a/libAACdec/src/aacdec_hcrs.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Robert Weidner (DSP Solutions)
-
-   Description: HCR Decoder: Defines of state-constants, masks and
-                state-prototypes
-
-*******************************************************************************/
-
-#ifndef AACDEC_HCRS_H
-#define AACDEC_HCRS_H
-
-#include "FDK_bitstream.h"
-#include "aacdec_hcr_types.h"
-/* The four different kinds of types of states are:                     */
-/* different states are defined as constants */ /* start   middle=self   next
-                                                   stop */
-#define STOP_THIS_STATE \
-  0 /*                                                                      */
-#define BODY_ONLY \
-  1 /*   X          X                X                                      */
-#define BODY_SIGN__BODY \
-  2 /*   X          X         X      X [stop if no sign]                    */
-#define BODY_SIGN__SIGN \
-  3 /*              X                X [stop if sign bits decoded]          */
-#define BODY_SIGN_ESC__BODY \
-  4 /*   X          X         X      X [stop if no sign]                    */
-#define BODY_SIGN_ESC__SIGN \
-  5 /*              X         X      X [stop if no escape sequence]         */
-#define BODY_SIGN_ESC__ESC_PREFIX \
-  6 /*              X         X                                             */
-#define BODY_SIGN_ESC__ESC_WORD \
-  7 /*              X         X      X [stop if abs(second qsc) != 16]      */
-
-/* examples: */
-
-/* BODY_ONLY                    means only the codeword body will be decoded; no
- * sign bits will follow and no escapesequence will follow */
-
-/* BODY_SIGN__BODY              means that the codeword consists of two parts;
- * body and sign part. The part '__BODY' after the two underscores shows */
-/*                              that the bits which are currently decoded belong
- * to the '__BODY' of the codeword and not to the sign part. */
-
-/* BODY_SIGN_ESC__ESC_PB        means that the codeword consists of three parts;
- * body, sign and (here: two) escape sequences;  */
-/*                              P = Prefix = ones */
-/*                              W = Escape Word */
-/*                              A = first possible (of two) Escape sequeces */
-/*                              B = second possible (of two) Escape sequeces */
-/*                              The part after the two underscores shows that
- * the current bits which are decoded belong to the '__ESC_PB' - part of the */
-/*                              codeword. That means the body and the sign bits
- * are decoded completely and the bits which are decoded now belong to */
-/*                              the escape sequence [P = prefix; B=second
- * possible escape sequence] */
-
-#define MSB_31_MASK 0x80000000 /* masks MSB (= Bit 31) in a 32 bit word */
-#define DIMENSION_OF_ESCAPE_CODEBOOK 2 /* for cb >= 11 is dimension 2 */
-#define ESCAPE_CODEBOOK 11
-
-#define MASK_ESCAPE_PREFIX_UP 0x000F0000
-#define LSB_ESCAPE_PREFIX_UP 16
-
-#define MASK_ESCAPE_PREFIX_DOWN 0x0000F000
-#define LSB_ESCAPE_PREFIX_DOWN 12
-
-#define MASK_ESCAPE_WORD 0x00000FFF
-#define MASK_FLAG_A 0x00200000
-#define MASK_FLAG_B 0x00100000
-
-extern void DecodeNonPCWs(HANDLE_FDK_BITSTREAM bs, H_HCR_INFO hHcr);
-
-UINT Hcr_State_BODY_ONLY(HANDLE_FDK_BITSTREAM, void*);
-UINT Hcr_State_BODY_SIGN__BODY(HANDLE_FDK_BITSTREAM, void*);
-UINT Hcr_State_BODY_SIGN__SIGN(HANDLE_FDK_BITSTREAM, void*);
-UINT Hcr_State_BODY_SIGN_ESC__BODY(HANDLE_FDK_BITSTREAM, void*);
-UINT Hcr_State_BODY_SIGN_ESC__SIGN(HANDLE_FDK_BITSTREAM, void*);
-UINT Hcr_State_BODY_SIGN_ESC__ESC_PREFIX(HANDLE_FDK_BITSTREAM, void*);
-UINT Hcr_State_BODY_SIGN_ESC__ESC_WORD(HANDLE_FDK_BITSTREAM, void*);
-
-#endif /* AACDEC_HCRS_H */
--- a/libAACdec/src/aacdecoder.cpp
+++ b/libAACdec/src/aacdecoder.cpp
@@ -163,17 +163,12 @@ amm-info@iis.fraunhofer.de
 
 #include "sac_dec_lib.h"
 
-#include "aacdec_hcr.h"
-#include "rvlc.h"
-
 #include "usacdec_lpd.h"
 
 #include "ac_arith_coder.h"
 
 #include "tpdec_lib.h"
 
-#include "conceal.h"
-
 #include "FDK_crc.h"
 #define PS_IS_EXPLICITLY_DISABLED(aot, flags) \
   (((aot) == AOT_DRM_AAC) && !(flags & AC_PS_PRESENT))
@@ -1191,10 +1186,6 @@ LINKSPEC_CPP HANDLE_AACDECODER CAacDecod
   /* initialize progam config */
   CProgramConfig_Init(&self->pce);
 
-  /* initialize error concealment common data */
-  CConcealment_InitCommonData(&self->concealCommonData);
-  self->concealMethodUser = ConcealMethodNone; /* undefined -> auto mode */
-
   self->hDrcInfo = GetDrcInfo();
   if (self->hDrcInfo == NULL) {
     goto bail;
@@ -1202,8 +1193,7 @@ LINKSPEC_CPP HANDLE_AACDECODER CAacDecod
   /* Init common DRC structure */
   aacDecoder_drcInit(self->hDrcInfo);
   /* Set default frame delay */
-  aacDecoder_drcSetParam(self->hDrcInfo, DRC_BS_DELAY,
-                         CConcealment_GetDelay(&self->concealCommonData));
+  aacDecoder_drcSetParam(self->hDrcInfo, DRC_BS_DELAY, 0);
 
   self->workBufferCore2 = GetWorkBufferCore2();
   if (self->workBufferCore2 == NULL) goto bail;
@@ -2085,15 +2075,6 @@ CAacDecoder_Init(HANDLE_AACDECODER self,
             if (self->pAacDecoderStaticChannelInfo[ch]->pCpeStaticData !=
                 NULL) {
               self->pAacDecoderStaticChannelInfo[ch]
-                  ->pCpeStaticData->jointStereoPersistentData
-                  .spectralCoeffs[ch2] =
-                  self->pAacDecoderStaticChannelInfo[ch]
-                      ->concealmentInfo.spectralCoefficient;
-              self->pAacDecoderStaticChannelInfo[ch]
-                  ->pCpeStaticData->jointStereoPersistentData.specScale[ch2] =
-                  self->pAacDecoderStaticChannelInfo[ch]
-                      ->concealmentInfo.specScale;
-              self->pAacDecoderStaticChannelInfo[ch]
                   ->pCpeStaticData->jointStereoPersistentData.scratchBuffer =
                   (FIXP_DBL *)self->pTimeData2;
             }
@@ -2193,12 +2174,6 @@ CAacDecoder_Init(HANDLE_AACDECODER self,
       /* Delete mixdown metadata from the past */
       pcmDmx_Reset(self->hPcmUtils, PCMDMX_RESET_BS_DATA);
 
-      /* Reset concealment only if ASC changed. Otherwise it will be done with
-         any config callback. E.g. every time the LATM SMC is present. */
-      CConcealment_InitChannelData(
-          &self->pAacDecoderStaticChannelInfo[ch]->concealmentInfo,
-          &self->concealCommonData, initRenderMode,
-          self->streamInfo.aacSamplesPerFrame);
       ch++;
       chIdx++;
     }
@@ -2336,12 +2311,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecod
       int ch;
       /* Clear history */
       for (ch = 0; ch < self->aacChannels; ch++) {
-        /* Reset concealment */
-        CConcealment_InitChannelData(
-            &self->pAacDecoderStaticChannelInfo[ch]->concealmentInfo,
-            &self->concealCommonData,
-            self->pAacDecoderChannelInfo[0]->renderMode,
-            self->streamInfo.aacSamplesPerFrame);
         /* Clear overlap-add buffers to avoid clicks. */
         FDKmemclear(self->pAacDecoderStaticChannelInfo[ch]->pOverlapBuffer,
                     OverlapBufferSize * sizeof(FIXP_DBL));
@@ -2403,15 +2372,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecod
           if (ch >= self->aacChannels) {
             return AAC_DEC_UNKNOWN;
           }
-
-          /* if last frame was broken and this frame is no independent frame,
-           * correct decoding is impossible we need to trigger concealment */
-          if ((CConcealment_GetLastFrameOk(
-                   &self->pAacDecoderStaticChannelInfo[ch]->concealmentInfo,
-                   1) == 0) &&
-              !(self->flags[streamIndex] & AC_INDEP)) {
-            self->frameOK = 0;
-          }
           ch++;
         }
       }
@@ -3081,13 +3041,8 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecod
          * following concealment method, mark the frame as erroneous */
         {
           CIcsInfo *pIcsInfo = &pAacDecoderChannelInfo->icsInfo;
-          CConcealmentInfo *hConcealmentInfo =
-              &pAacDecoderStaticChannelInfo->concealmentInfo;
           const int mute_release_active =
-              (self->frameOK && !(flags & AACDEC_CONCEAL)) &&
-              ((hConcealmentInfo->concealState >= ConcealState_Mute) &&
-               (hConcealmentInfo->cntValidFrames + 1 <=
-                hConcealmentInfo->pConcealParams->numMuteReleaseFrames));
+              (self->frameOK && !(flags & AACDEC_CONCEAL));
           const int icsIsInvalid = (GetScaleFactorBandsTransmitted(pIcsInfo) >
                                     GetScaleFactorBandsTotal(pIcsInfo));
           const int icsInfoUsedinFadeOut =
@@ -3098,29 +3053,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecod
           }
         }
 
-        /*
-          Conceal defective spectral data
-        */
-        {
-          CAacDecoderChannelInfo **ppAacDecoderChannelInfo =
-              &pAacDecoderChannelInfo;
-          CAacDecoderStaticChannelInfo **ppAacDecoderStaticChannelInfo =
-              &pAacDecoderStaticChannelInfo;
-          {
-            concealApplyReturnCode = CConcealment_Apply(
-                &(*ppAacDecoderStaticChannelInfo)->concealmentInfo,
-                *ppAacDecoderChannelInfo, *ppAacDecoderStaticChannelInfo,
-                &self->samplingRateInfo[streamIndex],
-                self->streamInfo.aacSamplesPerFrame,
-                pAacDecoderStaticChannelInfo->last_lpd_mode,
-                (self->frameOK && !(flags & AACDEC_CONCEAL)),
-                self->flags[streamIndex]);
-          }
-        }
-        if (concealApplyReturnCode == -1) {
-          frameOk_butConceal = 1;
-        }
-
         if (flags & (AACDEC_INTR)) {
           /* Reset DRC control data for this channel */
           aacDecoder_drcInitChannelData(&pAacDecoderStaticChannelInfo->drcData);
@@ -3191,20 +3123,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecod
               ErrorStatus = AAC_DEC_UNKNOWN;
               break;
           }
-        /* TimeDomainFading */
-        if (!CConceal_TDFading_Applied[c]) {
-          CConceal_TDFading_Applied[c] = CConcealment_TDFading(
-              self->streamInfo.aacSamplesPerFrame,
-              &self->pAacDecoderStaticChannelInfo[c], pTimeData + offset, 0);
-          if (c + 1 < (8) && c < aacChannels - 1) {
-            /* update next TDNoise Seed to avoid muting in case of Parametric
-             * Stereo */
-            self->pAacDecoderStaticChannelInfo[c + 1]
-                ->concealmentInfo.TDNoiseSeed =
-                self->pAacDecoderStaticChannelInfo[c]
-                    ->concealmentInfo.TDNoiseSeed;
-          }
-        }
       }
     }
 
@@ -3249,11 +3167,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecod
     }
   }
 
-  /* Add additional concealment delay */
-  self->streamInfo.outputDelay +=
-      CConcealment_GetDelay(&self->concealCommonData) *
-      self->streamInfo.aacSamplesPerFrame;
-
   /* Map DRC data to StreamInfo structure */
   aacDecoder_drcGetInfo(self->hDrcInfo, &self->streamInfo.drcPresMode,
                         &self->streamInfo.drcProgRefLev);
--- a/libAACdec/src/aacdecoder.h
+++ b/libAACdec/src/aacdecoder.h
@@ -236,9 +236,6 @@ struct AAC_DECODER_INSTANCE {
       1)]; /*!< Pointer to persistent data shared by both channels of a CPE.
 This structure is allocated once for each CPE. */
 
-  CConcealParams concealCommonData;
-  CConcealmentMethod concealMethodUser;
-
   CUsacCoreExtensions usacCoreExt; /*!< Data and handles to extend USAC FD/LPD
                                       core decoder (SBR, MPS, ...) */
   UINT numUsacElements[(1 * 1)];
--- a/libAACdec/src/aacdecoder_lib.cpp
+++ b/libAACdec/src/aacdecoder_lib.cpp
@@ -107,8 +107,6 @@ amm-info@iis.fraunhofer.de
 #include "tpdec_lib.h"
 #include "FDK_core.h" /* FDK_tools version info */
 
-#include "conceal.h"
-
 #include "aacdec_drc.h"
 
 #include "sac_dec_lib.h"
@@ -280,26 +278,6 @@ static INT aacDecoder_ConfigCallback(voi
     { err = aacDecoder_Config(self, pAscStruct, configMode, configChanged); }
   }
   if (err == AAC_DEC_OK) {
-    /*
-    revert concealment method if either
-       - Interpolation concealment might not be meaningful
-       - Interpolation concealment is not implemented
-    */
-    if ((self->flags[0] & (AC_LD | AC_ELD) &&
-         (self->concealMethodUser == ConcealMethodNone) &&
-         CConcealment_GetDelay(&self->concealCommonData) >
-             0) /* might not be meaningful but allow if user has set it
-                   expicitly */
-        || (self->flags[0] & (AC_USAC | AC_RSVD50 | AC_RSV603DA) &&
-            CConcealment_GetDelay(&self->concealCommonData) >
-                0) /* not implemented */
-    ) {
-      /* Revert to error concealment method Noise Substitution.
-         Because interpolation is not implemented for USAC or
-         the additional delay is unwanted for low delay codecs. */
-      setConcealMethod(self, 1);
-    }
-    aacDecoder_setMetadataExpiry(self, self->metadataExpiry);
     errTp = TRANSPORTDEC_OK;
   } else {
     if (err == AAC_DEC_NEED_TO_RESTART) {
@@ -529,17 +507,12 @@ static AAC_DECODER_ERROR setConcealMetho
     const HANDLE_AACDECODER self, /*!< Handle of the decoder instance */
     const INT method) {
   AAC_DECODER_ERROR errorStatus = AAC_DEC_OK;
-  CConcealParams *pConcealData = NULL;
   int method_revert = 0;
   HANDLE_AAC_DRC hDrcInfo = NULL;
   HANDLE_PCM_DOWNMIX hPcmDmx = NULL;
-  CConcealmentMethod backupMethod = ConcealMethodNone;
-  int backupDelay = 0;
-  int bsDelay = 0;
 
   /* check decoder handle */
   if (self != NULL) {
-    pConcealData = &self->concealCommonData;
     hDrcInfo = self->hDrcInfo;
     hPcmDmx = self->hPcmUtils;
     if (self->flags[0] & (AC_USAC | AC_RSVD50 | AC_RSV603DA) && method >= 2) {
@@ -555,33 +528,13 @@ static AAC_DECODER_ERROR setConcealMetho
     }
   }
 
-  /* Get current method/delay */
-  backupMethod = CConcealment_GetMethod(pConcealData);
-  backupDelay = CConcealment_GetDelay(pConcealData);
-
-  /* Be sure to set AAC and SBR concealment method simultaneously! */
-  errorStatus = CConcealment_SetParams(
-      pConcealData,
-      (method_revert == 0) ? (int)method : (int)1,  // concealMethod
-      AACDEC_CONCEAL_PARAM_NOT_SPECIFIED,           // concealFadeOutSlope
-      AACDEC_CONCEAL_PARAM_NOT_SPECIFIED,           // concealFadeInSlope
-      AACDEC_CONCEAL_PARAM_NOT_SPECIFIED,           // concealMuteRelease
-      AACDEC_CONCEAL_PARAM_NOT_SPECIFIED            // concealComfNoiseLevel
-  );
-  if ((errorStatus != AAC_DEC_OK) && (errorStatus != AAC_DEC_INVALID_HANDLE)) {
-    goto bail;
-  }
-
-  /* Get new delay */
-  bsDelay = CConcealment_GetDelay(pConcealData);
-
-  errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_BS_DELAY, bsDelay);
+  errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_BS_DELAY, 0);
   if ((errorStatus != AAC_DEC_OK) && (errorStatus != AAC_DEC_INVALID_HANDLE)) {
     goto bail;
   }
 
   if (errorStatus == AAC_DEC_OK) {
-    PCMDMX_ERROR err = pcmDmx_SetParam(hPcmDmx, DMX_BS_DATA_DELAY, bsDelay);
+    PCMDMX_ERROR err = pcmDmx_SetParam(hPcmDmx, DMX_BS_DATA_DELAY, 0);
     switch (err) {
       case PCMDMX_INVALID_HANDLE:
         errorStatus = AAC_DEC_INVALID_HANDLE;
@@ -596,15 +549,10 @@ static AAC_DECODER_ERROR setConcealMetho
 
 bail:
   if ((errorStatus != AAC_DEC_OK) && (errorStatus != AAC_DEC_INVALID_HANDLE)) {
-    /* Revert to the initial state */
-    CConcealment_SetParams(
-        pConcealData, (int)backupMethod, AACDEC_CONCEAL_PARAM_NOT_SPECIFIED,
-        AACDEC_CONCEAL_PARAM_NOT_SPECIFIED, AACDEC_CONCEAL_PARAM_NOT_SPECIFIED,
-        AACDEC_CONCEAL_PARAM_NOT_SPECIFIED);
     /* Revert DRC bitstream delay */
-    aacDecoder_drcSetParam(hDrcInfo, DRC_BS_DELAY, backupDelay);
+    aacDecoder_drcSetParam(hDrcInfo, DRC_BS_DELAY, 0);
     /* Revert PCM mixdown bitstream delay */
-    pcmDmx_SetParam(hPcmDmx, DMX_BS_DATA_DELAY, backupDelay);
+    pcmDmx_SetParam(hPcmDmx, DMX_BS_DATA_DELAY, 0);
   }
 
   return errorStatus;
@@ -834,9 +782,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecode
          packed into a helper function which keeps all modules and libs in a
          consistent state even in the case an error occures. */
       errorStatus = setConcealMethod(self, value);
-      if (errorStatus == AAC_DEC_OK) {
-        self->concealMethodUser = (CConcealmentMethod)value;
-      }
       break;
 
     default:
@@ -966,8 +911,7 @@ LINKSPEC_CPP HANDLE_AACDECODER aacDecode
   aacDec->limiterEnableCurr = 0;
 
   /* Assure that all modules have same delay */
-  if (setConcealMethod(aacDec,
-                       CConcealment_GetMethod(&aacDec->concealCommonData))) {
+  if (setConcealMethod(aacDec, 0)) {
     err = -1;
     goto bail;
   }
@@ -1359,9 +1303,7 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER
           break;
       }
 
-      if ((ErrorStatus != AAC_DEC_OK) || (flags & AACDEC_CONCEAL) ||
-          self->pAacDecoderStaticChannelInfo[0]->concealmentInfo.concealState >
-              ConcealState_FadeIn) {
+      if ((ErrorStatus != AAC_DEC_OK) || (flags & AACDEC_CONCEAL)) {
         self->frameOK = 0; /* if an error has occured do concealment in the SBR
                               decoder too */
       }
@@ -1457,9 +1399,6 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER
              domain signal before the QMF synthesis. Therefore the DRC gains
              need to be delayed by the QMF synthesis delay. */
           if (self->mpsEnableCurr) drcDelay = 257;
-          /* Take into account concealment delay */
-          drcDelay += CConcealment_GetDelay(&self->concealCommonData) *
-                      self->streamInfo.frameSize;
 
           for (ch = 0; ch < self->streamInfo.numChannels; ch++) {
             UCHAR mapValue = FDK_chMapDescr_getMapValue(
--- a/libAACdec/src/block.cpp
+++ b/libAACdec/src/block.cpp
@@ -114,9 +114,6 @@ amm-info@iis.fraunhofer.de
 
 #include "ac_arith_coder.h"
 
-#include "aacdec_hcr.h"
-#include "rvlc.h"
-
 #if defined(__arm__)
 #include "arm/block_arm.cpp"
 #endif
@@ -331,12 +328,7 @@ AAC_DECODER_ERROR CBlock_ReadSectionData
   int group;
   UCHAR sect_cb;
   UCHAR *pCodeBook = pAacDecoderChannelInfo->pDynData->aCodeBook;
-  /* HCR input (long) */
-  SHORT *pNumLinesInSec =
-      pAacDecoderChannelInfo->pDynData->specificTo.aac.aNumLineInSec4Hcr;
   int numLinesInSecIdx = 0;
-  UCHAR *pHcrCodeBook =
-      pAacDecoderChannelInfo->pDynData->specificTo.aac.aCodeBooks4Hcr;
   const SHORT *BandOffsets = GetScaleFactorBandOffsets(
       &pAacDecoderChannelInfo->icsInfo, pSamplingRateInfo);
   pAacDecoderChannelInfo->pDynData->specificTo.aac.numberSection = 0;
@@ -376,22 +368,8 @@ AAC_DECODER_ERROR CBlock_ReadSectionData
       top = band + sect_len;
 
       if (flags & AC_ER_HCR) {
-        /* HCR input (long) -- collecting sideinfo (for HCR-_long_ only) */
-        if (numLinesInSecIdx >= MAX_SFB_HCR) {
-          return AAC_DEC_PARSE_ERROR;
-        }
-        if (top > (int)GetNumberOfScaleFactorBands(
-                      &pAacDecoderChannelInfo->icsInfo, pSamplingRateInfo)) {
-          return AAC_DEC_PARSE_ERROR;
-        }
-        pNumLinesInSec[numLinesInSecIdx] = BandOffsets[top] - BandOffsets[band];
-        numLinesInSecIdx++;
-        if (sect_cb == BOOKSCL) {
-          return AAC_DEC_INVALID_CODE_BOOK;
-        } else {
-          *pHcrCodeBook++ = sect_cb;
-        }
-        pAacDecoderChannelInfo->pDynData->specificTo.aac.numberSection++;
+        /* HCR disabled */
+        return AAC_DEC_PARSE_ERROR;
       }
 
       /* Check spectral line limits */
@@ -718,41 +696,12 @@ AAC_DECODER_ERROR CBlock_ReadSpectralDat
     /* plain huffman decoding (short) finished */
   }
 
-  /* HCR - Huffman Codeword Reordering  short */
   else /* if ( flags & AC_ER_HCR ) */
 
   {
-    H_HCR_INFO hHcr = &pAacDecoderChannelInfo->pComData->overlay.aac.erHcrInfo;
-
-    int hcrStatus = 0;
-
-    /* advanced Huffman decoding starts here (HCR decoding :) */
-    if (pAacDecoderChannelInfo->pDynData->specificTo.aac
-            .lenOfReorderedSpectralData != 0) {
-      /* HCR initialization short */
-      hcrStatus = HcrInit(hHcr, pAacDecoderChannelInfo, pSamplingRateInfo, bs);
-
-      if (hcrStatus != 0) {
-        return AAC_DEC_DECODE_FRAME_ERROR;
-      }
-
-      /* HCR decoding short */
-      hcrStatus =
-          HcrDecoder(hHcr, pAacDecoderChannelInfo, pSamplingRateInfo, bs);
-
-      if (hcrStatus != 0) {
-#if HCR_ERROR_CONCEALMENT
-        HcrMuteErroneousLines(hHcr);
-#else
-        return AAC_DEC_DECODE_FRAME_ERROR;
-#endif /* HCR_ERROR_CONCEALMENT */
-      }
-
-      FDKpushFor(bs, pAacDecoderChannelInfo->pDynData->specificTo.aac
-                         .lenOfReorderedSpectralData);
-    }
+    /* HCR - Huffman Codeword Reordering disabled */
+    return AAC_DEC_DECODE_FRAME_ERROR;
   }
-  /* HCR - Huffman Codeword Reordering short finished */
 
   if (IsLongBlock(&pAacDecoderChannelInfo->icsInfo) &&
       !(flags & (AC_ELD | AC_SCALABLE))) {
--- a/libAACdec/src/channel.cpp
+++ b/libAACdec/src/channel.cpp
@@ -106,12 +106,6 @@ amm-info@iis.fraunhofer.de
 #include "aacdec_tns.h"
 #include "FDK_bitstream.h"
 
-#include "conceal.h"
-
-#include "rvlc.h"
-
-#include "aacdec_hcr.h"
-
 #include "usacdec_lpd.h"
 #include "usacdec_fac.h"
 
@@ -376,9 +370,6 @@ void CChannelElement_Decode(
           ->pCpeStaticData->jointStereoPersistentData.clearSpectralCoeffs = 0;
     }
   }
-
-  CRvlc_ElementCheck(pAacDecoderChannelInfo, pAacDecoderStaticChannelInfo,
-                     flags, el_channels);
 }
 
 void CChannel_CodebookTableInit(
@@ -596,8 +587,8 @@ AAC_DECODER_ERROR CChannelElement_Read(
 
       case scale_factor_data:
         if (flags & AC_ER_RVLC) {
-          /* read RVLC data from bitstream (error sens. cat. 1) */
-          CRvlc_Read(pAacDecoderChannelInfo[ch], hBs);
+          /* RVLC not supported */
+          error = AAC_DEC_DECODE_FRAME_ERROR;
         } else {
           error = CBlock_ReadScaleFactorData(pAacDecoderChannelInfo[ch], hBs,
                                              flags);
@@ -730,15 +721,13 @@ AAC_DECODER_ERROR CChannelElement_Read(
       } break;
       case esc2_rvlc:
         if (flags & AC_ER_RVLC) {
-          CRvlc_Decode(pAacDecoderChannelInfo[ch],
-                       pAacDecoderStaticChannelInfo[ch], hBs);
+          error = AAC_DEC_UNSUPPORTED_FORMAT;
         }
         break;
 
       case esc1_hcr:
         if (flags & AC_ER_HCR) {
-          CHcr_Read(hBs, pAacDecoderChannelInfo[ch],
-                    numberOfChannels == 2 ? ID_CPE : ID_SCE);
+	  error = AAC_DEC_UNSUPPORTED_FORMAT;
         }
         break;
 
--- a/libAACdec/src/channelinfo.h
+++ b/libAACdec/src/channelinfo.h
@@ -117,17 +117,12 @@ amm-info@iis.fraunhofer.de
 
 #include "aacdec_pns.h"
 
-#include "aacdec_hcr_types.h"
-#include "rvlc_info.h"
-
 #include "usacdec_acelp.h"
 #include "usacdec_const.h"
 #include "usacdec_rom.h"
 
 #include "ac_arith_coder.h"
 
-#include "conceal_types.h"
-
 #include "aacdec_drc_types.h"
 
 #define WB_SECTION_SIZE (1024 * 2)
@@ -257,7 +252,6 @@ typedef struct {
   ULONG nfRandomSeed; /* seed value for USAC noise filling random generator */
 
   CDrcChannelData drcData;
-  CConcealmentInfo concealmentInfo;
 
   CpePersistentData *pCpeStaticData;
 
@@ -280,11 +274,6 @@ typedef struct {
   shouldBeUnion {
     struct {
       CPulseData PulseData;
-      SHORT aNumLineInSec4Hcr[MAX_SFB_HCR]; /* needed once for all channels
-                                               except for Drm syntax */
-      UCHAR
-      aCodeBooks4Hcr[MAX_SFB_HCR]; /* needed once for all channels except for
-                                      Drm syntax. Same as "aCodeBook" ? */
       SHORT lenOfReorderedSpectralData;
       SCHAR lenOfLongestCodeword;
       SCHAR numberSection;
@@ -325,17 +314,6 @@ typedef struct {
 
   CJointStereoData jointStereoData; /* One for one element */
 
-  shouldBeUnion {
-    struct {
-      CErHcrInfo erHcrInfo;
-      CErRvlcInfo erRvlcInfo;
-      SHORT aRvlcScfEsc[RVLC_MAX_SFB]; /* needed once for all channels */
-      SHORT aRvlcScfFwd[RVLC_MAX_SFB]; /* needed once for all channels */
-      SHORT aRvlcScfBwd[RVLC_MAX_SFB]; /* needed once for all channels */
-    } aac;
-  }
-  overlay;
-
 } CAacDecoderCommonData;
 
 typedef struct {
--- a/libAACdec/src/conceal.cpp
+++ /dev/null
@@ -1,2095 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Josef Hoepfl
-
-   Description: independent channel concealment
-
-*******************************************************************************/
-
-/*!
-  \page concealment AAC core concealment
-
-  This AAC core implementation includes a concealment function, which can be
-  enabled using the several defines during compilation.
-
-  There are various tests inside the core, starting with simple CRC tests and
-  ending in a variety of plausibility checks. If such a check indicates an
-  invalid bitstream, then concealment is applied.
-
-  Concealment is also applied when the calling main program indicates a
-  distorted or missing data frame using the frameOK flag. This is used for error
-  detection on the transport layer. (See below)
-
-  There are three concealment-modes:
-
-  1) Muting: The spectral data is simply set to zero in case of an detected
-  error.
-
-  2) Noise substitution: In case of an detected error, concealment copies the
-  last frame and adds attenuates the spectral data. For this mode you have to
-  set the #CONCEAL_NOISE define. Noise substitution adds no additional delay.
-
-  3) Interpolation: The interpolation routine swaps the spectral data from the
-  previous and the current frame just before the final frequency to time
-  conversion. In case a single frame is corrupted, concealmant interpolates
-  between the last good and the first good frame to create the spectral data for
-  the missing frame. If multiple frames are corrupted, concealment implements
-  first a fade out based on slightly modified spectral values from the last good
-     frame. As soon as good frames are available, concealmant fades in the new
-  spectral data. For this mode you have to set the #CONCEAL_INTER define. Note
-  that in this case, you also need to set #SBR_BS_DELAY_ENABLE, which basically
-  adds approriate delay in the SBR decoder. Note that the
-  Interpolating-Concealment increases the delay of your decoder by one frame and
-  that it does require additional resources such as memory and computational
-  complexity.
-
-  <h2>How concealment can be used with errors on the transport layer</h2>
-
-  Many errors can or have to be detected on the transport layer. For example in
-  IP based systems packet loss can occur. The transport protocol used should
-  indicate such packet loss by inserting an empty frame with frameOK=0.
-*/
-
-#include "conceal.h"
-
-#include "aac_rom.h"
-#include "genericStds.h"
-
-/* PNS (of block) */
-#include "aacdec_pns.h"
-#include "block.h"
-
-#define CONCEAL_DFLT_COMF_NOISE_LEVEL (0x100000)
-
-#define CONCEAL_NOT_DEFINED ((UCHAR)-1)
-
-/* default settings */
-#define CONCEAL_DFLT_FADEOUT_FRAMES (6)
-#define CONCEAL_DFLT_FADEIN_FRAMES (5)
-#define CONCEAL_DFLT_MUTE_RELEASE_FRAMES (0)
-
-#define CONCEAL_DFLT_FADE_FACTOR (0.707106781186548f) /* 1/sqrt(2) */
-
-/* some often used constants: */
-#define FIXP_ZERO FL2FXCONST_DBL(0.0f)
-#define FIXP_ONE FL2FXCONST_DBL(1.0f)
-#define FIXP_FL_CORRECTION FL2FXCONST_DBL(0.53333333333333333f)
-
-/* For parameter conversion */
-#define CONCEAL_PARAMETER_BITS (8)
-#define CONCEAL_MAX_QUANT_FACTOR ((1 << CONCEAL_PARAMETER_BITS) - 1)
-/*#define CONCEAL_MIN_ATTENUATION_FACTOR_025  ( FL2FXCONST_DBL(0.971627951577106174) )*/ /* -0.25 dB */
-#define CONCEAL_MIN_ATTENUATION_FACTOR_025_LD \
-  FL2FXCONST_DBL(-0.041524101186092029596853445212299)
-/*#define CONCEAL_MIN_ATTENUATION_FACTOR_050  ( FL2FXCONST_DBL(0.944060876285923380) )*/ /* -0.50 dB */
-#define CONCEAL_MIN_ATTENUATION_FACTOR_050_LD \
-  FL2FXCONST_DBL(-0.083048202372184059253597008145293)
-
-typedef enum {
-  CConcealment_NoExpand,
-  CConcealment_Expand,
-  CConcealment_Compress
-} CConcealmentExpandType;
-
-static const FIXP_SGL facMod4Table[4] = {
-    FL2FXCONST_SGL(0.500000000f), /* FIXP_SGL(0x4000),  2^-(1-0,00) */
-    FL2FXCONST_SGL(0.594603558f), /* FIXP_SGL(0x4c1b),  2^-(1-0,25) */
-    FL2FXCONST_SGL(0.707106781f), /* FIXP_SGL(0x5a82),  2^-(1-0,50) */
-    FL2FXCONST_SGL(0.840896415f)  /* FIXP_SGL(0x6ba2)   2^-(1-0,75) */
-};
-
-static void CConcealment_CalcBandEnergy(
-    FIXP_DBL *spectrum, const SamplingRateInfo *pSamplingRateInfo,
-    const int blockType, CConcealmentExpandType ex, int *sfbEnergy);
-
-static void CConcealment_InterpolateBuffer(FIXP_DBL *spectrum,
-                                           SHORT *pSpecScalePrev,
-                                           SHORT *pSpecScaleAct,
-                                           SHORT *pSpecScaleOut, int *enPrv,
-                                           int *enAct, int sfbCnt,
-                                           const SHORT *pSfbOffset);
-
-static int CConcealment_ApplyInter(
-    CConcealmentInfo *pConcealmentInfo,
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    const SamplingRateInfo *pSamplingRateInfo, const int samplesPerFrame,
-    const int improveTonal, const int frameOk, const int mute_release_active);
-
-static int CConcealment_ApplyNoise(
-    CConcealmentInfo *pConcealmentInfo,
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo,
-    const SamplingRateInfo *pSamplingRateInfo, const int samplesPerFrame,
-    const UINT flags);
-
-static void CConcealment_UpdateState(
-    CConcealmentInfo *pConcealmentInfo, int frameOk,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo,
-    const int samplesPerFrame, CAacDecoderChannelInfo *pAacDecoderChannelInfo);
-
-static void CConcealment_ApplyRandomSign(int iRandomPhase, FIXP_DBL *spec,
-                                         int samplesPerFrame);
-
-/* TimeDomainFading */
-static void CConcealment_TDFadePcmAtt(int start, int len, FIXP_DBL fadeStart,
-                                      FIXP_DBL fadeStop, FIXP_PCM *pcmdata);
-static void CConcealment_TDFadeFillFadingStations(FIXP_DBL *fadingStations,
-                                                  int *fadingSteps,
-                                                  FIXP_DBL fadeStop,
-                                                  FIXP_DBL fadeStart,
-                                                  TDfadingType fadingType);
-static void CConcealment_TDFading_doLinearFadingSteps(int *fadingSteps);
-
-/* Streamline the state machine */
-static int CConcealment_ApplyFadeOut(
-    int mode, CConcealmentInfo *pConcealmentInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo,
-    const int samplesPerFrame, CAacDecoderChannelInfo *pAacDecoderChannelInfo);
-
-static int CConcealment_TDNoise_Random(ULONG *seed);
-static void CConcealment_TDNoise_Apply(CConcealmentInfo *const pConcealmentInfo,
-                                       const int len, FIXP_PCM *const pcmdata);
-
-static BLOCK_TYPE CConcealment_GetWinSeq(int prevWinSeq) {
-  BLOCK_TYPE newWinSeq = BLOCK_LONG;
-
-  /* Try to have only long blocks */
-  if (prevWinSeq == BLOCK_START || prevWinSeq == BLOCK_SHORT) {
-    newWinSeq = BLOCK_STOP;
-  }
-
-  return (newWinSeq);
-}
-
-/*!
-  \brief Init common concealment information data
-
-  \param pConcealCommonData Pointer to the concealment common data structure.
-*/
-void CConcealment_InitCommonData(CConcealParams *pConcealCommonData) {
-  if (pConcealCommonData != NULL) {
-    int i;
-
-    /* Set default error concealment technique */
-    pConcealCommonData->method = ConcealMethodInter;
-
-    pConcealCommonData->numFadeOutFrames = CONCEAL_DFLT_FADEOUT_FRAMES;
-    pConcealCommonData->numFadeInFrames = CONCEAL_DFLT_FADEIN_FRAMES;
-    pConcealCommonData->numMuteReleaseFrames = CONCEAL_DFLT_MUTE_RELEASE_FRAMES;
-
-    pConcealCommonData->comfortNoiseLevel =
-        (FIXP_DBL)CONCEAL_DFLT_COMF_NOISE_LEVEL;
-
-    /* Init fade factors (symetric) */
-    pConcealCommonData->fadeOutFactor[0] =
-        FL2FXCONST_SGL(CONCEAL_DFLT_FADE_FACTOR);
-    pConcealCommonData->fadeInFactor[0] = pConcealCommonData->fadeOutFactor[0];
-
-    for (i = 1; i < CONCEAL_MAX_NUM_FADE_FACTORS; i++) {
-      pConcealCommonData->fadeOutFactor[i] =
-          FX_DBL2FX_SGL(fMult(pConcealCommonData->fadeOutFactor[i - 1],
-                              FL2FXCONST_SGL(CONCEAL_DFLT_FADE_FACTOR)));
-      pConcealCommonData->fadeInFactor[i] =
-          pConcealCommonData->fadeOutFactor[i];
-    }
-  }
-}
-
-/*!
-  \brief Get current concealment method.
-
-  \param pConcealCommonData Pointer to common concealment data (for all
-  channels)
-*/
-CConcealmentMethod CConcealment_GetMethod(CConcealParams *pConcealCommonData) {
-  CConcealmentMethod method = ConcealMethodNone;
-
-  if (pConcealCommonData != NULL) {
-    method = pConcealCommonData->method;
-  }
-
-  return (method);
-}
-
-/*!
-  \brief Init concealment information for each channel
-
-  \param pConcealChannelInfo Pointer to the channel related concealment info
-  structure to be initialized. \param pConcealCommonData  Pointer to common
-  concealment data (for all channels) \param initRenderMode      Initial render
-  mode to be set for the current channel. \param samplesPerFrame     The number
-  of samples per frame.
-*/
-void CConcealment_InitChannelData(CConcealmentInfo *pConcealChannelInfo,
-                                  CConcealParams *pConcealCommonData,
-                                  AACDEC_RENDER_MODE initRenderMode,
-                                  int samplesPerFrame) {
-  int i;
-  pConcealChannelInfo->TDNoiseSeed = 0;
-  FDKmemclear(pConcealChannelInfo->TDNoiseStates,
-              sizeof(pConcealChannelInfo->TDNoiseStates));
-  pConcealChannelInfo->TDNoiseCoef[0] = FL2FXCONST_SGL(0.05f);
-  pConcealChannelInfo->TDNoiseCoef[1] = FL2FXCONST_SGL(0.5f);
-  pConcealChannelInfo->TDNoiseCoef[2] = FL2FXCONST_SGL(0.45f);
-
-  pConcealChannelInfo->pConcealParams = pConcealCommonData;
-
-  pConcealChannelInfo->lastRenderMode = initRenderMode;
-
-  pConcealChannelInfo->windowShape = CONCEAL_NOT_DEFINED;
-  pConcealChannelInfo->windowSequence = BLOCK_LONG; /* default type */
-  pConcealChannelInfo->lastWinGrpLen = 1;
-
-  pConcealChannelInfo->concealState = ConcealState_Ok;
-
-  FDKmemclear(pConcealChannelInfo->spectralCoefficient,
-              1024 * sizeof(FIXP_CNCL));
-
-  for (i = 0; i < 8; i++) {
-    pConcealChannelInfo->specScale[i] = 0;
-  }
-
-  pConcealChannelInfo->iRandomPhase = 0;
-
-  pConcealChannelInfo->prevFrameOk[0] = 1;
-  pConcealChannelInfo->prevFrameOk[1] = 1;
-
-  pConcealChannelInfo->cntFadeFrames = 0;
-  pConcealChannelInfo->cntValidFrames = 0;
-  pConcealChannelInfo->fade_old = (FIXP_DBL)MAXVAL_DBL;
-  pConcealChannelInfo->winGrpOffset[0] = 0;
-  pConcealChannelInfo->winGrpOffset[1] = 0;
-  pConcealChannelInfo->attGrpOffset[0] = 0;
-  pConcealChannelInfo->attGrpOffset[1] = 0;
-}
-
-/*!
-  \brief Set error concealment parameters
-
-  \param concealParams
-  \param method
-  \param fadeOutSlope
-  \param fadeInSlope
-  \param muteRelease
-  \param comfNoiseLevel
-*/
-AAC_DECODER_ERROR
-CConcealment_SetParams(CConcealParams *concealParams, int method,
-                       int fadeOutSlope, int fadeInSlope, int muteRelease,
-                       FIXP_DBL comfNoiseLevel) {
-  /* set concealment technique */
-  if (method != AACDEC_CONCEAL_PARAM_NOT_SPECIFIED) {
-    switch ((CConcealmentMethod)method) {
-      case ConcealMethodMute:
-      case ConcealMethodNoise:
-      case ConcealMethodInter:
-        /* Be sure to enable delay adjustment of SBR decoder! */
-        if (concealParams == NULL) {
-          return AAC_DEC_INVALID_HANDLE;
-        } else {
-          /* set param */
-          concealParams->method = (CConcealmentMethod)method;
-        }
-        break;
-
-      default:
-        return AAC_DEC_SET_PARAM_FAIL;
-    }
-  }
-
-  /* set number of frames for fade-out slope */
-  if (fadeOutSlope != AACDEC_CONCEAL_PARAM_NOT_SPECIFIED) {
-    if ((fadeOutSlope < CONCEAL_MAX_NUM_FADE_FACTORS) && (fadeOutSlope >= 0)) {
-      if (concealParams == NULL) {
-        return AAC_DEC_INVALID_HANDLE;
-      } else {
-        /* set param */
-        concealParams->numFadeOutFrames = fadeOutSlope;
-      }
-    } else {
-      return AAC_DEC_SET_PARAM_FAIL;
-    }
-  }
-
-  /* set number of frames for fade-in slope */
-  if (fadeInSlope != AACDEC_CONCEAL_PARAM_NOT_SPECIFIED) {
-    if ((fadeInSlope < CONCEAL_MAX_NUM_FADE_FACTORS) && (fadeInSlope >= 0)) {
-      if (concealParams == NULL) {
-        return AAC_DEC_INVALID_HANDLE;
-      } else {
-        /* set param */
-        concealParams->numFadeInFrames = fadeInSlope;
-      }
-    } else {
-      return AAC_DEC_SET_PARAM_FAIL;
-    }
-  }
-
-  /* set number of error-free frames after which the muting will be released */
-  if (muteRelease != AACDEC_CONCEAL_PARAM_NOT_SPECIFIED) {
-    if ((muteRelease < (CONCEAL_MAX_NUM_FADE_FACTORS << 1)) &&
-        (muteRelease >= 0)) {
-      if (concealParams == NULL) {
-        return AAC_DEC_INVALID_HANDLE;
-      } else {
-        /* set param */
-        concealParams->numMuteReleaseFrames = muteRelease;
-      }
-    } else {
-      return AAC_DEC_SET_PARAM_FAIL;
-    }
-  }
-
-  /* set confort noise level which will be inserted while in state 'muting' */
-  if (comfNoiseLevel != (FIXP_DBL)AACDEC_CONCEAL_PARAM_NOT_SPECIFIED) {
-    if ((comfNoiseLevel < (FIXP_DBL)0) ||
-        (comfNoiseLevel > (FIXP_DBL)MAXVAL_DBL)) {
-      return AAC_DEC_SET_PARAM_FAIL;
-    }
-    if (concealParams == NULL) {
-      return AAC_DEC_INVALID_HANDLE;
-    } else {
-      concealParams->comfortNoiseLevel = (FIXP_DBL)comfNoiseLevel;
-    }
-  }
-
-  return (AAC_DEC_OK);
-}
-
-/*!
-  \brief Set fade-out/in attenuation factor vectors
-
-  \param concealParams
-  \param fadeOutAttenuationVector
-  \param fadeInAttenuationVector
-
-  \return 0 if OK all other values indicate errors
-*/
-AAC_DECODER_ERROR
-CConcealment_SetAttenuation(CConcealParams *concealParams,
-                            const SHORT *fadeOutAttenuationVector,
-                            const SHORT *fadeInAttenuationVector) {
-  if ((fadeOutAttenuationVector == NULL) && (fadeInAttenuationVector == NULL)) {
-    return AAC_DEC_SET_PARAM_FAIL;
-  }
-
-  /* Fade-out factors */
-  if (fadeOutAttenuationVector != NULL) {
-    int i;
-
-    /* check quantized factors first */
-    for (i = 0; i < CONCEAL_MAX_NUM_FADE_FACTORS; i++) {
-      if ((fadeOutAttenuationVector[i] < 0) ||
-          (fadeOutAttenuationVector[i] > CONCEAL_MAX_QUANT_FACTOR)) {
-        return AAC_DEC_SET_PARAM_FAIL;
-      }
-    }
-    if (concealParams == NULL) {
-      return AAC_DEC_INVALID_HANDLE;
-    }
-
-    /* now dequantize factors */
-    for (i = 0; i < CONCEAL_MAX_NUM_FADE_FACTORS; i++) {
-      concealParams->fadeOutFactor[i] =
-          FX_DBL2FX_SGL(fLdPow(CONCEAL_MIN_ATTENUATION_FACTOR_025_LD, 0,
-                               (FIXP_DBL)((INT)(FL2FXCONST_DBL(1.0 / 2.0) >>
-                                                (CONCEAL_PARAMETER_BITS - 1)) *
-                                          (INT)fadeOutAttenuationVector[i]),
-                               CONCEAL_PARAMETER_BITS));
-    }
-  }
-
-  /* Fade-in factors */
-  if (fadeInAttenuationVector != NULL) {
-    int i;
-
-    /* check quantized factors first */
-    for (i = 0; i < CONCEAL_MAX_NUM_FADE_FACTORS; i++) {
-      if ((fadeInAttenuationVector[i] < 0) ||
-          (fadeInAttenuationVector[i] > CONCEAL_MAX_QUANT_FACTOR)) {
-        return AAC_DEC_SET_PARAM_FAIL;
-      }
-    }
-    if (concealParams == NULL) {
-      return AAC_DEC_INVALID_HANDLE;
-    }
-
-    /* now dequantize factors */
-    for (i = 0; i < CONCEAL_MAX_NUM_FADE_FACTORS; i++) {
-      concealParams->fadeInFactor[i] = FX_DBL2FX_SGL(
-          fLdPow(CONCEAL_MIN_ATTENUATION_FACTOR_025_LD, 0,
-                 (FIXP_DBL)((INT)(FIXP_ONE >> CONCEAL_PARAMETER_BITS) *
-                            (INT)fadeInAttenuationVector[i]),
-                 CONCEAL_PARAMETER_BITS));
-    }
-  }
-
-  return (AAC_DEC_OK);
-}
-
-/*!
-  \brief Get state of concealment module.
-
-  \param pConcealChannelInfo
-
-  \return Concealment state.
-*/
-CConcealmentState CConcealment_GetState(CConcealmentInfo *pConcealChannelInfo) {
-  CConcealmentState state = ConcealState_Ok;
-
-  if (pConcealChannelInfo != NULL) {
-    state = pConcealChannelInfo->concealState;
-  }
-
-  return (state);
-}
-
-/*!
-  \brief Store data for concealment techniques applied later
-
-  Interface function to store data for different concealment strategies
- */
-void CConcealment_Store(
-    CConcealmentInfo *hConcealmentInfo,
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo) {
-  UCHAR nbDiv = NB_DIV;
-
-  if (!(pAacDecoderChannelInfo->renderMode == AACDEC_RENDER_LPD &&
-        pAacDecoderChannelInfo->data.usac.mod[nbDiv - 1] == 0))
-
-  {
-    FIXP_DBL *pSpectralCoefficient =
-        SPEC_LONG(pAacDecoderChannelInfo->pSpectralCoefficient);
-    SHORT *pSpecScale = pAacDecoderChannelInfo->specScale;
-    CIcsInfo *pIcsInfo = &pAacDecoderChannelInfo->icsInfo;
-
-    SHORT tSpecScale[8];
-    UCHAR tWindowShape;
-    BLOCK_TYPE tWindowSequence;
-
-    /* store old window infos for swapping */
-    tWindowSequence = hConcealmentInfo->windowSequence;
-    tWindowShape = hConcealmentInfo->windowShape;
-
-    /* store old scale factors for swapping */
-    FDKmemcpy(tSpecScale, hConcealmentInfo->specScale, 8 * sizeof(SHORT));
-
-    /* store new window infos */
-    hConcealmentInfo->windowSequence = GetWindowSequence(pIcsInfo);
-    hConcealmentInfo->windowShape = GetWindowShape(pIcsInfo);
-    hConcealmentInfo->lastWinGrpLen =
-        *(GetWindowGroupLengthTable(pIcsInfo) + GetWindowGroups(pIcsInfo) - 1);
-
-    /* store new scale factors */
-    FDKmemcpy(hConcealmentInfo->specScale, pSpecScale, 8 * sizeof(SHORT));
-
-    if (hConcealmentInfo->pConcealParams->method < ConcealMethodInter) {
-    /* store new spectral bins */
-#if (CNCL_FRACT_BITS == DFRACT_BITS)
-      FDKmemcpy(hConcealmentInfo->spectralCoefficient, pSpectralCoefficient,
-                1024 * sizeof(FIXP_CNCL));
-#else
-      FIXP_CNCL *RESTRICT pCncl =
-          &hConcealmentInfo->spectralCoefficient[1024 - 1];
-      FIXP_DBL *RESTRICT pSpec = &pSpectralCoefficient[1024 - 1];
-      int i;
-      for (i = 1024; i != 0; i--) {
-        *pCncl-- = FX_DBL2FX_CNCL(*pSpec--);
-      }
-#endif
-    } else {
-    /* swap spectral data */
-#if (FIXP_CNCL == FIXP_DBL)
-      C_ALLOC_SCRATCH_START(pSpecTmp, FIXP_DBL, 1024);
-      FDKmemcpy(pSpecTmp, pSpectralCoefficient, 1024 * sizeof(FIXP_DBL));
-      FDKmemcpy(pSpectralCoefficient, hConcealmentInfo->spectralCoefficient,
-                1024 * sizeof(FIXP_DBL));
-      FDKmemcpy(hConcealmentInfo->spectralCoefficient, pSpecTmp,
-                1024 * sizeof(FIXP_DBL));
-      C_ALLOC_SCRATCH_END(pSpecTmp, FIXP_DBL, 1024);
-#else
-      FIXP_CNCL *RESTRICT pCncl =
-          &hConcealmentInfo->spectralCoefficient[1024 - 1];
-      FIXP_DBL *RESTRICT pSpec = &pSpectralCoefficient[1024 - 1];
-      FIXP_DBL tSpec;
-
-      for (int i = 1024; i != 0; i--) {
-        tSpec = *pSpec;
-        *pSpec-- = FX_CNCL2FX_DBL(*pCncl);
-        *pCncl-- = FX_DBL2FX_CNCL(tSpec);
-      }
-#endif
-
-      /* complete swapping of window infos */
-      pIcsInfo->WindowSequence = tWindowSequence;
-      pIcsInfo->WindowShape = tWindowShape;
-
-      /* complete swapping of scale factors */
-      FDKmemcpy(pSpecScale, tSpecScale, 8 * sizeof(SHORT));
-    }
-  }
-
-  if (pAacDecoderChannelInfo->renderMode == AACDEC_RENDER_LPD) {
-    /* Store LSF4 */
-    FDKmemcpy(hConcealmentInfo->lsf4, pAacDecoderStaticChannelInfo->lpc4_lsf,
-              sizeof(hConcealmentInfo->lsf4));
-    /* Store TCX gain */
-    hConcealmentInfo->last_tcx_gain =
-        pAacDecoderStaticChannelInfo->last_tcx_gain;
-    hConcealmentInfo->last_tcx_gain_e =
-        pAacDecoderStaticChannelInfo->last_tcx_gain_e;
-  }
-}
-
-/*!
-  \brief Apply concealment
-
-  Interface function to different concealment strategies
- */
-int CConcealment_Apply(
-    CConcealmentInfo *hConcealmentInfo,
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo,
-    const SamplingRateInfo *pSamplingRateInfo, const int samplesPerFrame,
-    const UCHAR lastLpdMode, const int frameOk, const UINT flags) {
-  int appliedProcessing = 0;
-  const int mute_release_active =
-      frameOk && (hConcealmentInfo->concealState >= ConcealState_Mute) &&
-      (hConcealmentInfo->cntValidFrames + 1 <=
-       hConcealmentInfo->pConcealParams->numMuteReleaseFrames);
-
-  if (hConcealmentInfo->windowShape == CONCEAL_NOT_DEFINED) {
-    /* Initialize window_shape with same value as in the current (parsed) frame.
-       Because section 4.6.11.3.2 (Windowing and block switching) of ISO/IEC
-       14496-3:2009 says: For the first raw_data_block() to be decoded the
-       window_shape of the left and right half of the window are identical. */
-    hConcealmentInfo->windowShape = pAacDecoderChannelInfo->icsInfo.WindowShape;
-  }
-
-  if (frameOk && !mute_release_active) {
-    /* Update render mode if frameOk except for ongoing mute release state. */
-    hConcealmentInfo->lastRenderMode =
-        (SCHAR)pAacDecoderChannelInfo->renderMode;
-
-    /* Rescue current data for concealment in future frames */
-    CConcealment_Store(hConcealmentInfo, pAacDecoderChannelInfo,
-                       pAacDecoderStaticChannelInfo);
-    /* Reset index to random sign vector to make sign calculation frame agnostic
-       (only depends on number of subsequently concealed spectral blocks) */
-    hConcealmentInfo->iRandomPhase = 0;
-  } else {
-    if (hConcealmentInfo->lastRenderMode == AACDEC_RENDER_INVALID) {
-      hConcealmentInfo->lastRenderMode = AACDEC_RENDER_IMDCT;
-    }
-    pAacDecoderChannelInfo->renderMode =
-        (AACDEC_RENDER_MODE)hConcealmentInfo->lastRenderMode;
-  }
-
-  /* hand current frame status to the state machine */
-  CConcealment_UpdateState(hConcealmentInfo, frameOk,
-                           pAacDecoderStaticChannelInfo, samplesPerFrame,
-                           pAacDecoderChannelInfo);
-
-  {
-    if (!frameOk && pAacDecoderChannelInfo->renderMode == AACDEC_RENDER_IMDCT) {
-      /* LPC extrapolation */
-      CLpc_Conceal(pAacDecoderChannelInfo->data.usac.lsp_coeff,
-                   pAacDecoderStaticChannelInfo->lpc4_lsf,
-                   pAacDecoderStaticChannelInfo->lsf_adaptive_mean,
-                   hConcealmentInfo->lastRenderMode == AACDEC_RENDER_IMDCT);
-      FDKmemcpy(hConcealmentInfo->lsf4, pAacDecoderStaticChannelInfo->lpc4_lsf,
-                sizeof(pAacDecoderStaticChannelInfo->lpc4_lsf));
-    }
-
-    /* Create data for signal rendering according to the selected concealment
-     * method and decoder operating mode. */
-
-    if ((!frameOk || mute_release_active) &&
-        (pAacDecoderChannelInfo->renderMode == AACDEC_RENDER_LPD)) {
-      /* Restore old LSF4 */
-      FDKmemcpy(pAacDecoderStaticChannelInfo->lpc4_lsf, hConcealmentInfo->lsf4,
-                sizeof(pAacDecoderStaticChannelInfo->lpc4_lsf));
-      /* Restore old TCX gain */
-      pAacDecoderStaticChannelInfo->last_tcx_gain =
-          hConcealmentInfo->last_tcx_gain;
-      pAacDecoderStaticChannelInfo->last_tcx_gain_e =
-          hConcealmentInfo->last_tcx_gain_e;
-    }
-
-    if (!(pAacDecoderChannelInfo->renderMode == AACDEC_RENDER_LPD &&
-          pAacDecoderStaticChannelInfo->last_lpd_mode == 0)) {
-      switch (hConcealmentInfo->pConcealParams->method) {
-        default:
-        case ConcealMethodMute:
-          if (!frameOk) {
-            /* Mute spectral data in case of errors */
-            FDKmemclear(pAacDecoderChannelInfo->pSpectralCoefficient,
-                        samplesPerFrame * sizeof(FIXP_DBL));
-            /* Set last window shape */
-            pAacDecoderChannelInfo->icsInfo.WindowShape =
-                hConcealmentInfo->windowShape;
-            appliedProcessing = 1;
-          }
-          break;
-
-        case ConcealMethodNoise:
-          /* Noise substitution error concealment technique */
-          appliedProcessing = CConcealment_ApplyNoise(
-              hConcealmentInfo, pAacDecoderChannelInfo,
-              pAacDecoderStaticChannelInfo, pSamplingRateInfo, samplesPerFrame,
-              flags);
-          break;
-
-        case ConcealMethodInter:
-          /* Energy interpolation concealment based on 3GPP */
-          appliedProcessing = CConcealment_ApplyInter(
-              hConcealmentInfo, pAacDecoderChannelInfo, pSamplingRateInfo,
-              samplesPerFrame, 0, /* don't use tonal improvement */
-              frameOk, mute_release_active);
-          break;
-      }
-    } else if (!frameOk || mute_release_active) {
-      /* simply restore the buffer */
-      FIXP_DBL *pSpectralCoefficient =
-          SPEC_LONG(pAacDecoderChannelInfo->pSpectralCoefficient);
-      SHORT *pSpecScale = pAacDecoderChannelInfo->specScale;
-      CIcsInfo *pIcsInfo = &pAacDecoderChannelInfo->icsInfo;
-#if (CNCL_FRACT_BITS != DFRACT_BITS)
-      FIXP_CNCL *RESTRICT pCncl =
-          &hConcealmentInfo->spectralCoefficient[1024 - 1];
-      FIXP_DBL *RESTRICT pSpec = &pSpectralCoefficient[1024 - 1];
-      int i;
-#endif
-
-      /* restore window infos (gri) do we need that? */
-      pIcsInfo->WindowSequence = hConcealmentInfo->windowSequence;
-      pIcsInfo->WindowShape = hConcealmentInfo->windowShape;
-
-      if (hConcealmentInfo->concealState != ConcealState_Mute) {
-        /* restore scale factors */
-        FDKmemcpy(pSpecScale, hConcealmentInfo->specScale, 8 * sizeof(SHORT));
-
-        /* restore spectral bins */
-#if (CNCL_FRACT_BITS == DFRACT_BITS)
-        FDKmemcpy(pSpectralCoefficient, hConcealmentInfo->spectralCoefficient,
-                  1024 * sizeof(FIXP_DBL));
-#else
-        for (i = 1024; i != 0; i--) {
-          *pSpec-- = FX_CNCL2FX_DBL(*pCncl--);
-        }
-#endif
-      } else {
-        /* clear scale factors */
-        FDKmemclear(pSpecScale, 8 * sizeof(SHORT));
-
-        /* clear buffer */
-        FDKmemclear(pSpectralCoefficient, 1024 * sizeof(FIXP_CNCL));
-      }
-    }
-  }
-  /* update history */
-  hConcealmentInfo->prevFrameOk[0] = hConcealmentInfo->prevFrameOk[1];
-  hConcealmentInfo->prevFrameOk[1] = frameOk;
-
-  return mute_release_active ? -1 : appliedProcessing;
-}
-
-/*!
-\brief Apply concealment noise substitution
-
-  In case of frame lost this function produces a noisy frame with respect to the
-  energies values of past frame.
- */
-static int CConcealment_ApplyNoise(
-    CConcealmentInfo *pConcealmentInfo,
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo,
-    const SamplingRateInfo *pSamplingRateInfo, const int samplesPerFrame,
-    const UINT flags) {
-  FIXP_DBL *pSpectralCoefficient =
-      SPEC_LONG(pAacDecoderChannelInfo->pSpectralCoefficient);
-  CIcsInfo *pIcsInfo = &pAacDecoderChannelInfo->icsInfo;
-
-  int appliedProcessing = 0;
-
-  FDK_ASSERT(pConcealmentInfo != NULL);
-  FDK_ASSERT((samplesPerFrame >= 120) && (samplesPerFrame <= 1024));
-
-  switch (pConcealmentInfo->concealState) {
-    case ConcealState_Ok:
-      /* Nothing to do here! */
-      break;
-
-    case ConcealState_Single:
-    case ConcealState_FadeOut:
-      appliedProcessing = CConcealment_ApplyFadeOut(
-          /*mode =*/1, pConcealmentInfo, pAacDecoderStaticChannelInfo,
-          samplesPerFrame, pAacDecoderChannelInfo);
-      break;
-
-    case ConcealState_Mute: {
-      /* set dummy window parameters */
-      pIcsInfo->Valid = 0; /* Trigger the generation of a consitent IcsInfo */
-      pIcsInfo->WindowShape =
-          pConcealmentInfo->windowShape; /* Prevent an invalid WindowShape
-                                            (required for F/T transform) */
-      pIcsInfo->WindowSequence =
-          CConcealment_GetWinSeq(pConcealmentInfo->windowSequence);
-      pConcealmentInfo->windowSequence =
-          pIcsInfo->WindowSequence; /* Store for next frame
-                                       (spectrum in concealment
-                                       buffer can't be used at
-                                       all) */
-
-      /* mute spectral data */
-      FDKmemclear(pSpectralCoefficient, samplesPerFrame * sizeof(FIXP_DBL));
-      FDKmemclear(pConcealmentInfo->spectralCoefficient,
-                  samplesPerFrame * sizeof(FIXP_DBL));
-
-      appliedProcessing = 1;
-    } break;
-
-    case ConcealState_FadeIn: {
-      /* TimeDomainFading:                                        */
-      /* Attenuation of signal is done in CConcealment_TDFading() */
-
-      appliedProcessing = 1;
-    } break;
-
-    default:
-      /* we shouldn't come here anyway */
-      FDK_ASSERT(0);
-      break;
-  }
-
-  return appliedProcessing;
-}
-
-/*!
-  \brief Apply concealment interpolation
-
-  The function swaps the data from the current and the previous frame. If an
-  error has occured, frame interpolation is performed to restore the missing
-  frame. In case of multiple faulty frames, fade-in and fade-out is applied.
-*/
-static int CConcealment_ApplyInter(
-    CConcealmentInfo *pConcealmentInfo,
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    const SamplingRateInfo *pSamplingRateInfo, const int samplesPerFrame,
-    const int improveTonal, const int frameOk, const int mute_release_active) {
-#if defined(FDK_ASSERT_ENABLE)
-  CConcealParams *pConcealCommonData = pConcealmentInfo->pConcealParams;
-#endif
-
-  FIXP_DBL *pSpectralCoefficient =
-      SPEC_LONG(pAacDecoderChannelInfo->pSpectralCoefficient);
-  CIcsInfo *pIcsInfo = &pAacDecoderChannelInfo->icsInfo;
-  SHORT *pSpecScale = pAacDecoderChannelInfo->specScale;
-
-  int sfbEnergyPrev[64];
-  int sfbEnergyAct[64];
-
-  int i, appliedProcessing = 0;
-
-  /* clear/init */
-  FDKmemclear(sfbEnergyPrev, 64 * sizeof(int));
-  FDKmemclear(sfbEnergyAct, 64 * sizeof(int));
-
-  if (!frameOk || mute_release_active) {
-    /* Restore last frame from concealment buffer */
-    pIcsInfo->WindowShape = pConcealmentInfo->windowShape;
-    pIcsInfo->WindowSequence = pConcealmentInfo->windowSequence;
-
-    /* Restore spectral data */
-    for (i = 0; i < samplesPerFrame; i++) {
-      pSpectralCoefficient[i] =
-          FX_CNCL2FX_DBL(pConcealmentInfo->spectralCoefficient[i]);
-    }
-
-    /* Restore scale factors */
-    FDKmemcpy(pSpecScale, pConcealmentInfo->specScale, 8 * sizeof(SHORT));
-  }
-
-  /* if previous frame was not ok */
-  if (!pConcealmentInfo->prevFrameOk[1] || mute_release_active) {
-    /* if current frame (f_n) is ok and the last but one frame (f_(n-2))
-       was ok, too, then interpolate both frames in order to generate
-       the current output frame (f_(n-1)). Otherwise, use the last stored
-       frame (f_(n-2) or f_(n-3) or ...). */
-    if (frameOk && pConcealmentInfo->prevFrameOk[0] && !mute_release_active) {
-      appliedProcessing = 1;
-
-      /* Interpolate both frames in order to generate the current output frame
-       * (f_(n-1)). */
-      if (pIcsInfo->WindowSequence == BLOCK_SHORT) {
-        /* f_(n-2) == BLOCK_SHORT */
-        /* short--??????--short, short--??????--long interpolation */
-        /* short--short---short, short---long---long interpolation */
-
-        int wnd;
-
-        if (pConcealmentInfo->windowSequence ==
-            BLOCK_SHORT) { /* f_n == BLOCK_SHORT */
-          /* short--short---short interpolation */
-
-          int scaleFactorBandsTotal =
-              pSamplingRateInfo->NumberOfScaleFactorBands_Short;
-          const SHORT *pSfbOffset = pSamplingRateInfo->ScaleFactorBands_Short;
-          pIcsInfo->WindowShape = (samplesPerFrame <= 512) ? 2 : 1;
-          pIcsInfo->WindowSequence = BLOCK_SHORT;
-
-          for (wnd = 0; wnd < 8; wnd++) {
-            CConcealment_CalcBandEnergy(
-                &pSpectralCoefficient[wnd *
-                                      (samplesPerFrame / 8)], /* spec_(n-2) */
-                pSamplingRateInfo, BLOCK_SHORT, CConcealment_NoExpand,
-                sfbEnergyPrev);
-
-            CConcealment_CalcBandEnergy(
-                &pConcealmentInfo->spectralCoefficient[wnd * (samplesPerFrame /
-                                                              8)], /* spec_n */
-                pSamplingRateInfo, BLOCK_SHORT, CConcealment_NoExpand,
-                sfbEnergyAct);
-
-            CConcealment_InterpolateBuffer(
-                &pSpectralCoefficient[wnd *
-                                      (samplesPerFrame / 8)], /* spec_(n-1) */
-                &pSpecScale[wnd], &pConcealmentInfo->specScale[wnd],
-                &pSpecScale[wnd], sfbEnergyPrev, sfbEnergyAct,
-                scaleFactorBandsTotal, pSfbOffset);
-          }
-        } else { /* f_n != BLOCK_SHORT */
-          /* short---long---long interpolation */
-
-          int scaleFactorBandsTotal =
-              pSamplingRateInfo->NumberOfScaleFactorBands_Long;
-          const SHORT *pSfbOffset = pSamplingRateInfo->ScaleFactorBands_Long;
-          SHORT specScaleOut;
-
-          CConcealment_CalcBandEnergy(
-              &pSpectralCoefficient[samplesPerFrame -
-                                    (samplesPerFrame /
-                                     8)], /* [wnd] spec_(n-2) */
-              pSamplingRateInfo, BLOCK_SHORT, CConcealment_Expand,
-              sfbEnergyAct);
-
-          CConcealment_CalcBandEnergy(
-              pConcealmentInfo->spectralCoefficient, /* spec_n */
-              pSamplingRateInfo, BLOCK_LONG, CConcealment_NoExpand,
-              sfbEnergyPrev);
-
-          pIcsInfo->WindowShape = 0;
-          pIcsInfo->WindowSequence = BLOCK_STOP;
-
-          for (i = 0; i < samplesPerFrame; i++) {
-            pSpectralCoefficient[i] =
-                pConcealmentInfo->spectralCoefficient[i]; /* spec_n */
-          }
-
-          for (i = 0; i < 8; i++) { /* search for max(specScale) */
-            if (pSpecScale[i] > pSpecScale[0]) {
-              pSpecScale[0] = pSpecScale[i];
-            }
-          }
-
-          CConcealment_InterpolateBuffer(
-              pSpectralCoefficient, /* spec_(n-1) */
-              &pConcealmentInfo->specScale[0], &pSpecScale[0], &specScaleOut,
-              sfbEnergyPrev, sfbEnergyAct, scaleFactorBandsTotal, pSfbOffset);
-
-          pSpecScale[0] = specScaleOut;
-        }
-      } else {
-        /* long--??????--short, long--??????--long interpolation */
-        /* long---long---short, long---long---long interpolation */
-
-        int scaleFactorBandsTotal =
-            pSamplingRateInfo->NumberOfScaleFactorBands_Long;
-        const SHORT *pSfbOffset = pSamplingRateInfo->ScaleFactorBands_Long;
-        SHORT specScaleAct = pConcealmentInfo->specScale[0];
-
-        CConcealment_CalcBandEnergy(pSpectralCoefficient, /* spec_(n-2) */
-                                    pSamplingRateInfo, BLOCK_LONG,
-                                    CConcealment_NoExpand, sfbEnergyPrev);
-
-        if (pConcealmentInfo->windowSequence ==
-            BLOCK_SHORT) { /* f_n == BLOCK_SHORT */
-          /* long---long---short interpolation */
-
-          pIcsInfo->WindowShape = (samplesPerFrame <= 512) ? 2 : 1;
-          pIcsInfo->WindowSequence = BLOCK_START;
-
-          for (i = 1; i < 8; i++) { /* search for max(specScale) */
-            if (pConcealmentInfo->specScale[i] > specScaleAct) {
-              specScaleAct = pConcealmentInfo->specScale[i];
-            }
-          }
-
-          /* Expand first short spectrum */
-          CConcealment_CalcBandEnergy(
-              pConcealmentInfo->spectralCoefficient,               /* spec_n */
-              pSamplingRateInfo, BLOCK_SHORT, CConcealment_Expand, /* !!! */
-              sfbEnergyAct);
-        } else {
-          /* long---long---long interpolation */
-
-          pIcsInfo->WindowShape = 0;
-          pIcsInfo->WindowSequence = BLOCK_LONG;
-
-          CConcealment_CalcBandEnergy(
-              pConcealmentInfo->spectralCoefficient, /* spec_n */
-              pSamplingRateInfo, BLOCK_LONG, CConcealment_NoExpand,
-              sfbEnergyAct);
-        }
-
-        CConcealment_InterpolateBuffer(
-            pSpectralCoefficient, /* spec_(n-1) */
-            &pSpecScale[0], &specScaleAct, &pSpecScale[0], sfbEnergyPrev,
-            sfbEnergyAct, scaleFactorBandsTotal, pSfbOffset);
-      }
-    }
-
-    /* Noise substitution of sign of the output spectral coefficients */
-    CConcealment_ApplyRandomSign(pConcealmentInfo->iRandomPhase,
-                                 pSpectralCoefficient, samplesPerFrame);
-    /* Increment random phase index to avoid repetition artifacts. */
-    pConcealmentInfo->iRandomPhase =
-        (pConcealmentInfo->iRandomPhase + 1) & (AAC_NF_NO_RANDOM_VAL - 1);
-  }
-
-  /* scale spectrum according to concealment state */
-  switch (pConcealmentInfo->concealState) {
-    case ConcealState_Single:
-      appliedProcessing = 1;
-      break;
-
-    case ConcealState_FadeOut: {
-      FDK_ASSERT(pConcealmentInfo->cntFadeFrames >= 0);
-      FDK_ASSERT(pConcealmentInfo->cntFadeFrames <
-                 CONCEAL_MAX_NUM_FADE_FACTORS);
-      FDK_ASSERT(pConcealmentInfo->cntFadeFrames <
-                 pConcealCommonData->numFadeOutFrames);
-
-      /* TimeDomainFading:                                        */
-      /* Attenuation of signal is done in CConcealment_TDFading() */
-
-      appliedProcessing = 1;
-    } break;
-
-    case ConcealState_FadeIn: {
-      FDK_ASSERT(pConcealmentInfo->cntFadeFrames >= 0);
-      FDK_ASSERT(pConcealmentInfo->cntFadeFrames <
-                 CONCEAL_MAX_NUM_FADE_FACTORS);
-      FDK_ASSERT(pConcealmentInfo->cntFadeFrames <
-                 pConcealCommonData->numFadeInFrames);
-
-      /* TimeDomainFading:                                        */
-      /* Attenuation of signal is done in CConcealment_TDFading() */
-
-      appliedProcessing = 1;
-    } break;
-
-    case ConcealState_Mute: {
-      /* set dummy window parameters */
-      pIcsInfo->Valid = 0; /* Trigger the generation of a consitent IcsInfo */
-      pIcsInfo->WindowShape =
-          pConcealmentInfo->windowShape; /* Prevent an invalid WindowShape
-                                            (required for F/T transform) */
-      pIcsInfo->WindowSequence =
-          CConcealment_GetWinSeq(pConcealmentInfo->windowSequence);
-      pConcealmentInfo->windowSequence =
-          pIcsInfo->WindowSequence; /* Store for next frame
-                                       (spectrum in concealment
-                                       buffer can't be used at
-                                       all) */
-
-      /* mute spectral data */
-      FDKmemclear(pSpectralCoefficient, samplesPerFrame * sizeof(FIXP_DBL));
-
-      appliedProcessing = 1;
-    } break;
-
-    default:
-      /* nothing to do here */
-      break;
-  }
-
-  return appliedProcessing;
-}
-
-/*!
-  \brief Calculate the spectral energy
-
-  The function calculates band-wise the spectral energy. This is used for
-  frame interpolation.
-*/
-static void CConcealment_CalcBandEnergy(
-    FIXP_DBL *spectrum, const SamplingRateInfo *pSamplingRateInfo,
-    const int blockType, CConcealmentExpandType expandType, int *sfbEnergy) {
-  const SHORT *pSfbOffset;
-  int line, sfb, scaleFactorBandsTotal = 0;
-
-  /* In the following calculations, enAccu is initialized with LSB-value in
-   * order to avoid zero energy-level */
-
-  line = 0;
-
-  switch (blockType) {
-    case BLOCK_LONG:
-    case BLOCK_START:
-    case BLOCK_STOP:
-
-      if (expandType == CConcealment_NoExpand) {
-        /* standard long calculation */
-        scaleFactorBandsTotal =
-            pSamplingRateInfo->NumberOfScaleFactorBands_Long;
-        pSfbOffset = pSamplingRateInfo->ScaleFactorBands_Long;
-
-        for (sfb = 0; sfb < scaleFactorBandsTotal; sfb++) {
-          FIXP_DBL enAccu = (FIXP_DBL)(LONG)1;
-          int sfbScale =
-              (sizeof(LONG) << 3) -
-              CntLeadingZeros(pSfbOffset[sfb + 1] - pSfbOffset[sfb]) - 1;
-          /* scaling depends on sfb width. */
-          for (; line < pSfbOffset[sfb + 1]; line++) {
-            enAccu += fPow2Div2(*(spectrum + line)) >> sfbScale;
-          }
-          *(sfbEnergy + sfb) = CntLeadingZeros(enAccu) - 1;
-        }
-      } else {
-        /* compress long to short */
-        scaleFactorBandsTotal =
-            pSamplingRateInfo->NumberOfScaleFactorBands_Short;
-        pSfbOffset = pSamplingRateInfo->ScaleFactorBands_Short;
-
-        for (sfb = 0; sfb < scaleFactorBandsTotal; sfb++) {
-          FIXP_DBL enAccu = (FIXP_DBL)(LONG)1;
-          int sfbScale =
-              (sizeof(LONG) << 3) -
-              CntLeadingZeros(pSfbOffset[sfb + 1] - pSfbOffset[sfb]) - 1;
-          /* scaling depends on sfb width. */
-          for (; line < pSfbOffset[sfb + 1] << 3; line++) {
-            enAccu +=
-                (enAccu + (fPow2Div2(*(spectrum + line)) >> sfbScale)) >> 3;
-          }
-          *(sfbEnergy + sfb) = CntLeadingZeros(enAccu) - 1;
-        }
-      }
-      break;
-
-    case BLOCK_SHORT:
-
-      if (expandType == CConcealment_NoExpand) {
-        /*   standard short calculation */
-        scaleFactorBandsTotal =
-            pSamplingRateInfo->NumberOfScaleFactorBands_Short;
-        pSfbOffset = pSamplingRateInfo->ScaleFactorBands_Short;
-
-        for (sfb = 0; sfb < scaleFactorBandsTotal; sfb++) {
-          FIXP_DBL enAccu = (FIXP_DBL)(LONG)1;
-          int sfbScale =
-              (sizeof(LONG) << 3) -
-              CntLeadingZeros(pSfbOffset[sfb + 1] - pSfbOffset[sfb]) - 1;
-          /* scaling depends on sfb width. */
-          for (; line < pSfbOffset[sfb + 1]; line++) {
-            enAccu += fPow2Div2(*(spectrum + line)) >> sfbScale;
-          }
-          *(sfbEnergy + sfb) = CntLeadingZeros(enAccu) - 1;
-        }
-      } else {
-        /*  expand short to long spectrum */
-        scaleFactorBandsTotal =
-            pSamplingRateInfo->NumberOfScaleFactorBands_Long;
-        pSfbOffset = pSamplingRateInfo->ScaleFactorBands_Long;
-
-        for (sfb = 0; sfb < scaleFactorBandsTotal; sfb++) {
-          FIXP_DBL enAccu = (FIXP_DBL)(LONG)1;
-          int sfbScale =
-              (sizeof(LONG) << 3) -
-              CntLeadingZeros(pSfbOffset[sfb + 1] - pSfbOffset[sfb]) - 1;
-          /* scaling depends on sfb width. */
-          for (; line < pSfbOffset[sfb + 1]; line++) {
-            enAccu += fPow2Div2(*(spectrum + (line >> 3))) >> sfbScale;
-          }
-          *(sfbEnergy + sfb) = CntLeadingZeros(enAccu) - 1;
-        }
-      }
-      break;
-  }
-}
-
-/*!
-  \brief Interpolate buffer
-
-  The function creates the interpolated spectral data according to the
-  energy of the last good frame and the current (good) frame.
-*/
-static void CConcealment_InterpolateBuffer(FIXP_DBL *spectrum,
-                                           SHORT *pSpecScalePrv,
-                                           SHORT *pSpecScaleAct,
-                                           SHORT *pSpecScaleOut, int *enPrv,
-                                           int *enAct, int sfbCnt,
-                                           const SHORT *pSfbOffset) {
-  int sfb, line = 0;
-  int fac_shift;
-  int fac_mod;
-  FIXP_DBL accu;
-
-  for (sfb = 0; sfb < sfbCnt; sfb++) {
-    fac_shift =
-        enPrv[sfb] - enAct[sfb] + ((*pSpecScaleAct - *pSpecScalePrv) << 1);
-    fac_mod = fac_shift & 3;
-    fac_shift = (fac_shift >> 2) + 1;
-    fac_shift += *pSpecScalePrv - fixMax(*pSpecScalePrv, *pSpecScaleAct);
-
-    for (; line < pSfbOffset[sfb + 1]; line++) {
-      accu = fMult(*(spectrum + line), facMod4Table[fac_mod]);
-      if (fac_shift < 0) {
-        accu >>= -fac_shift;
-      } else {
-        accu <<= fac_shift;
-      }
-      *(spectrum + line) = accu;
-    }
-  }
-  *pSpecScaleOut = fixMax(*pSpecScalePrv, *pSpecScaleAct);
-}
-
-/*!
-  \brief Find next fading frame in case of changing fading direction
-
-  \param pConcealCommonData Pointer to the concealment common data structure.
-  \param actFadeIndex Last index used for fading
-  \param direction Direction of change: 0 : change from FADE-OUT to FADE-IN,  1
-  : change from FADE-IN to FADE-OUT
-
-  This function determines the next fading index to be used for the fading
-  direction to be changed to.
-*/
-
-static INT findEquiFadeFrame(CConcealParams *pConcealCommonData,
-                             INT actFadeIndex, int direction) {
-  FIXP_SGL *pFactor;
-  FIXP_SGL referenceVal;
-  FIXP_SGL minDiff = (FIXP_SGL)MAXVAL_SGL;
-
-  INT nextFadeIndex = 0;
-
-  int i;
-
-  /* init depending on direction */
-  if (direction == 0) { /* FADE-OUT => FADE-IN */
-    if (actFadeIndex < 0) {
-      referenceVal = (FIXP_SGL)MAXVAL_SGL;
-    } else {
-      referenceVal = pConcealCommonData->fadeOutFactor[actFadeIndex] >> 1;
-    }
-    pFactor = pConcealCommonData->fadeInFactor;
-  } else { /* FADE-IN => FADE-OUT */
-    if (actFadeIndex < 0) {
-      referenceVal = (FIXP_SGL)MAXVAL_SGL;
-    } else {
-      referenceVal = pConcealCommonData->fadeInFactor[actFadeIndex] >> 1;
-    }
-    pFactor = pConcealCommonData->fadeOutFactor;
-  }
-
-  /* search for minimum difference */
-  for (i = 0; i < CONCEAL_MAX_NUM_FADE_FACTORS; i++) {
-    FIXP_SGL diff = fixp_abs((pFactor[i] >> 1) - referenceVal);
-    if (diff < minDiff) {
-      minDiff = diff;
-      nextFadeIndex = i;
-    }
-  }
-
-  /* check and adjust depending on direction */
-  if (direction == 0) { /* FADE-OUT => FADE-IN */
-    if (nextFadeIndex > pConcealCommonData->numFadeInFrames) {
-      nextFadeIndex = fMax(pConcealCommonData->numFadeInFrames - 1, 0);
-    }
-    if (((pFactor[nextFadeIndex] >> 1) <= referenceVal) &&
-        (nextFadeIndex > 0)) {
-      nextFadeIndex -= 1;
-    }
-  } else { /* FADE-IN => FADE-OUT */
-    if (((pFactor[nextFadeIndex] >> 1) >= referenceVal) &&
-        (nextFadeIndex < CONCEAL_MAX_NUM_FADE_FACTORS - 1)) {
-      nextFadeIndex += 1;
-    }
-  }
-
-  return (nextFadeIndex);
-}
-
-/*!
-  \brief Update the concealment state
-
-  The function updates the state of the concealment state-machine. The
-  states are: mute, fade-in, fade-out, interpolate and frame-ok.
-*/
-static void CConcealment_UpdateState(
-    CConcealmentInfo *pConcealmentInfo, int frameOk,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo,
-    const int samplesPerFrame, CAacDecoderChannelInfo *pAacDecoderChannelInfo) {
-  CConcealParams *pConcealCommonData = pConcealmentInfo->pConcealParams;
-
-  switch (pConcealCommonData->method) {
-    case ConcealMethodNoise: {
-      if (pConcealmentInfo->concealState != ConcealState_Ok) {
-        /* count the valid frames during concealment process */
-        if (frameOk) {
-          pConcealmentInfo->cntValidFrames += 1;
-        } else {
-          pConcealmentInfo->cntValidFrames = 0;
-        }
-      }
-
-      /* -- STATE MACHINE for Noise Substitution -- */
-      switch (pConcealmentInfo->concealState) {
-        case ConcealState_Ok:
-          if (!frameOk) {
-            pConcealmentInfo->cntFadeFrames = 0;
-            pConcealmentInfo->cntValidFrames = 0;
-            pConcealmentInfo->attGrpOffset[0] = 0;
-            pConcealmentInfo->attGrpOffset[1] = 0;
-            pConcealmentInfo->winGrpOffset[0] = 0;
-            pConcealmentInfo->winGrpOffset[1] = 0;
-            if (pConcealCommonData->numFadeOutFrames > 0) {
-              /* change to state SINGLE-FRAME-LOSS */
-              pConcealmentInfo->concealState = ConcealState_Single;
-              /* mode 0 just updates the Fading counter */
-              CConcealment_ApplyFadeOut(
-                  /*mode =*/0, pConcealmentInfo, pAacDecoderStaticChannelInfo,
-                  samplesPerFrame, pAacDecoderChannelInfo);
-
-            } else {
-              /* change to state MUTE */
-              pConcealmentInfo->concealState = ConcealState_Mute;
-            }
-          }
-          break;
-
-        case ConcealState_Single: /* Just a pre-stage before fade-out begins.
-                                     Stay here only one frame! */
-          if (frameOk) {
-            /* change to state OK */
-            pConcealmentInfo->concealState = ConcealState_Ok;
-          } else {
-            if (pConcealmentInfo->cntFadeFrames >=
-                pConcealCommonData->numFadeOutFrames) {
-              /* change to state MUTE */
-              pConcealmentInfo->concealState = ConcealState_Mute;
-            } else {
-              /* change to state FADE-OUT */
-              pConcealmentInfo->concealState = ConcealState_FadeOut;
-              /* mode 0 just updates the Fading counter */
-              CConcealment_ApplyFadeOut(
-                  /*mode =*/0, pConcealmentInfo, pAacDecoderStaticChannelInfo,
-                  samplesPerFrame, pAacDecoderChannelInfo);
-            }
-          }
-          break;
-
-        case ConcealState_FadeOut:
-          if (pConcealmentInfo->cntValidFrames >
-              pConcealCommonData->numMuteReleaseFrames) {
-            if (pConcealCommonData->numFadeInFrames > 0) {
-              /* change to state FADE-IN */
-              pConcealmentInfo->concealState = ConcealState_FadeIn;
-              pConcealmentInfo->cntFadeFrames = findEquiFadeFrame(
-                  pConcealCommonData, pConcealmentInfo->cntFadeFrames,
-                  0 /* FadeOut -> FadeIn */);
-            } else {
-              /* change to state OK */
-              pConcealmentInfo->concealState = ConcealState_Ok;
-            }
-          } else {
-            if (frameOk) {
-              /* we have good frame information but stay fully in concealment -
-               * reset winGrpOffset/attGrpOffset */
-              pConcealmentInfo->winGrpOffset[0] = 0;
-              pConcealmentInfo->winGrpOffset[1] = 0;
-              pConcealmentInfo->attGrpOffset[0] = 0;
-              pConcealmentInfo->attGrpOffset[1] = 0;
-            }
-            if (pConcealmentInfo->cntFadeFrames >=
-                pConcealCommonData->numFadeOutFrames) {
-              /* change to state MUTE */
-              pConcealmentInfo->concealState = ConcealState_Mute;
-            } else /* Stay in FADE-OUT */
-            {
-              /* mode 0 just updates the Fading counter */
-              CConcealment_ApplyFadeOut(
-                  /*mode =*/0, pConcealmentInfo, pAacDecoderStaticChannelInfo,
-                  samplesPerFrame, pAacDecoderChannelInfo);
-            }
-          }
-          break;
-
-        case ConcealState_Mute:
-          if (pConcealmentInfo->cntValidFrames >
-              pConcealCommonData->numMuteReleaseFrames) {
-            if (pConcealCommonData->numFadeInFrames > 0) {
-              /* change to state FADE-IN */
-              pConcealmentInfo->concealState = ConcealState_FadeIn;
-              pConcealmentInfo->cntFadeFrames =
-                  pConcealCommonData->numFadeInFrames - 1;
-            } else {
-              /* change to state OK */
-              pConcealmentInfo->concealState = ConcealState_Ok;
-            }
-          } else {
-            if (frameOk) {
-              /* we have good frame information but stay fully in concealment -
-               * reset winGrpOffset/attGrpOffset */
-              pConcealmentInfo->winGrpOffset[0] = 0;
-              pConcealmentInfo->winGrpOffset[1] = 0;
-              pConcealmentInfo->attGrpOffset[0] = 0;
-              pConcealmentInfo->attGrpOffset[1] = 0;
-            }
-          }
-          break;
-
-        case ConcealState_FadeIn:
-          pConcealmentInfo->cntFadeFrames -= 1;
-          if (frameOk) {
-            if (pConcealmentInfo->cntFadeFrames < 0) {
-              /* change to state OK */
-              pConcealmentInfo->concealState = ConcealState_Ok;
-            }
-          } else {
-            if (pConcealCommonData->numFadeOutFrames > 0) {
-              /* change to state FADE-OUT */
-              pConcealmentInfo->concealState = ConcealState_FadeOut;
-              pConcealmentInfo->cntFadeFrames = findEquiFadeFrame(
-                  pConcealCommonData, pConcealmentInfo->cntFadeFrames + 1,
-                  1 /* FadeIn -> FadeOut */);
-              pConcealmentInfo->winGrpOffset[0] = 0;
-              pConcealmentInfo->winGrpOffset[1] = 0;
-              pConcealmentInfo->attGrpOffset[0] = 0;
-              pConcealmentInfo->attGrpOffset[1] = 0;
-
-              pConcealmentInfo
-                  ->cntFadeFrames--; /* decrease because
-                                        CConcealment_ApplyFadeOut() will
-                                        increase, accordingly */
-              /* mode 0 just updates the Fading counter */
-              CConcealment_ApplyFadeOut(
-                  /*mode =*/0, pConcealmentInfo, pAacDecoderStaticChannelInfo,
-                  samplesPerFrame, pAacDecoderChannelInfo);
-            } else {
-              /* change to state MUTE */
-              pConcealmentInfo->concealState = ConcealState_Mute;
-            }
-          }
-          break;
-
-        default:
-          FDK_ASSERT(0);
-          break;
-      }
-    } break;
-
-    case ConcealMethodInter:
-    case ConcealMethodTonal: {
-      if (pConcealmentInfo->concealState != ConcealState_Ok) {
-        /* count the valid frames during concealment process */
-        if (pConcealmentInfo->prevFrameOk[1] ||
-            (pConcealmentInfo->prevFrameOk[0] &&
-             !pConcealmentInfo->prevFrameOk[1] && frameOk)) {
-          /* The frame is OK even if it can be estimated by the energy
-           * interpolation algorithm */
-          pConcealmentInfo->cntValidFrames += 1;
-        } else {
-          pConcealmentInfo->cntValidFrames = 0;
-        }
-      }
-
-      /* -- STATE MACHINE for energy interpolation -- */
-      switch (pConcealmentInfo->concealState) {
-        case ConcealState_Ok:
-          if (!(pConcealmentInfo->prevFrameOk[1] ||
-                (pConcealmentInfo->prevFrameOk[0] &&
-                 !pConcealmentInfo->prevFrameOk[1] && frameOk))) {
-            if (pConcealCommonData->numFadeOutFrames > 0) {
-              /* Fade out only if the energy interpolation algorithm can not be
-               * applied! */
-              pConcealmentInfo->concealState = ConcealState_FadeOut;
-            } else {
-              /* change to state MUTE */
-              pConcealmentInfo->concealState = ConcealState_Mute;
-            }
-            pConcealmentInfo->cntFadeFrames = 0;
-            pConcealmentInfo->cntValidFrames = 0;
-          }
-          break;
-
-        case ConcealState_Single:
-          pConcealmentInfo->concealState = ConcealState_Ok;
-          break;
-
-        case ConcealState_FadeOut:
-          pConcealmentInfo->cntFadeFrames += 1;
-
-          if (pConcealmentInfo->cntValidFrames >
-              pConcealCommonData->numMuteReleaseFrames) {
-            if (pConcealCommonData->numFadeInFrames > 0) {
-              /* change to state FADE-IN */
-              pConcealmentInfo->concealState = ConcealState_FadeIn;
-              pConcealmentInfo->cntFadeFrames = findEquiFadeFrame(
-                  pConcealCommonData, pConcealmentInfo->cntFadeFrames - 1,
-                  0 /* FadeOut -> FadeIn */);
-            } else {
-              /* change to state OK */
-              pConcealmentInfo->concealState = ConcealState_Ok;
-            }
-          } else {
-            if (pConcealmentInfo->cntFadeFrames >=
-                pConcealCommonData->numFadeOutFrames) {
-              /* change to state MUTE */
-              pConcealmentInfo->concealState = ConcealState_Mute;
-            }
-          }
-          break;
-
-        case ConcealState_Mute:
-          if (pConcealmentInfo->cntValidFrames >
-              pConcealCommonData->numMuteReleaseFrames) {
-            if (pConcealCommonData->numFadeInFrames > 0) {
-              /* change to state FADE-IN */
-              pConcealmentInfo->concealState = ConcealState_FadeIn;
-              pConcealmentInfo->cntFadeFrames =
-                  pConcealCommonData->numFadeInFrames - 1;
-            } else {
-              /* change to state OK */
-              pConcealmentInfo->concealState = ConcealState_Ok;
-            }
-          }
-          break;
-
-        case ConcealState_FadeIn:
-          pConcealmentInfo->cntFadeFrames -=
-              1; /* used to address the fade-in factors */
-
-          if (frameOk || pConcealmentInfo->prevFrameOk[1]) {
-            if (pConcealmentInfo->cntFadeFrames < 0) {
-              /* change to state OK */
-              pConcealmentInfo->concealState = ConcealState_Ok;
-            }
-          } else {
-            if (pConcealCommonData->numFadeOutFrames > 0) {
-              /* change to state FADE-OUT */
-              pConcealmentInfo->concealState = ConcealState_FadeOut;
-              pConcealmentInfo->cntFadeFrames = findEquiFadeFrame(
-                  pConcealCommonData, pConcealmentInfo->cntFadeFrames + 1,
-                  1 /* FadeIn -> FadeOut */);
-            } else {
-              /* change to state MUTE */
-              pConcealmentInfo->concealState = ConcealState_Mute;
-            }
-          }
-          break;
-      } /* End switch(pConcealmentInfo->concealState) */
-    } break;
-
-    default:
-      /* Don't need a state machine for other concealment methods. */
-      break;
-  }
-}
-
-/*!
-\brief Randomizes the sign of the spectral data
-
-  The function toggles the sign of the spectral data randomly. This is
-  useful to ensure the quality of the concealed frames.
- */
-static void CConcealment_ApplyRandomSign(int randomPhase, FIXP_DBL *spec,
-                                         int samplesPerFrame) {
-  int i;
-  USHORT packedSign = 0;
-
-  /* random table 512x16bit has been reduced to 512 packed sign bits = 32x16 bit
-   */
-
-  /* read current packed sign word */
-  packedSign = AacDec_randomSign[randomPhase >> 4];
-  packedSign >>= (randomPhase & 0xf);
-
-  for (i = 0; i < samplesPerFrame; i++) {
-    if ((randomPhase & 0xf) == 0) {
-      packedSign = AacDec_randomSign[randomPhase >> 4];
-    }
-
-    if (packedSign & 0x1) {
-      spec[i] = -spec[i];
-    }
-    packedSign >>= 1;
-
-    randomPhase = (randomPhase + 1) & (AAC_NF_NO_RANDOM_VAL - 1);
-  }
-}
-
-/*!
-  \brief Get fadeing factor for current concealment state.
-
-  The function returns the state (ok or not) of the previous frame.
-  If called before the function CConcealment_Apply() set the fBeforeApply
-  flag to get the correct value.
-
-  \return Frame OK flag of previous frame.
- */
-int CConcealment_GetLastFrameOk(CConcealmentInfo *hConcealmentInfo,
-                                const int fBeforeApply) {
-  int prevFrameOk = 1;
-
-  if (hConcealmentInfo != NULL) {
-    prevFrameOk = hConcealmentInfo->prevFrameOk[fBeforeApply & 0x1];
-  }
-
-  return prevFrameOk;
-}
-
-/*!
-  \brief Get the number of delay frames introduced by concealment technique.
-
-  \return Number of delay frames.
- */
-UINT CConcealment_GetDelay(CConcealParams *pConcealCommonData) {
-  UINT frameDelay = 0;
-
-  if (pConcealCommonData != NULL) {
-    switch (pConcealCommonData->method) {
-      case ConcealMethodTonal:
-      case ConcealMethodInter:
-        frameDelay = 1;
-        break;
-      default:
-        break;
-    }
-  }
-
-  return frameDelay;
-}
-
-static int CConcealment_ApplyFadeOut(
-    int mode, CConcealmentInfo *pConcealmentInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo,
-    const int samplesPerFrame, CAacDecoderChannelInfo *pAacDecoderChannelInfo) {
-  /* mode 1 = apply RandomSign and mute spectral coefficients if necessary,  *
-   * mode 0 = Update cntFadeFrames                                            */
-
-  /* restore frequency coefficients from buffer with a specific muting */
-  int srcWin, dstWin, numWindows = 1;
-  int windowLen = samplesPerFrame;
-  int srcGrpStart = 0;
-  int winIdxStride = 1;
-  int numWinGrpPerFac, attIdx, attIdxStride;
-  int i;
-  int appliedProcessing = 0;
-
-  CIcsInfo *pIcsInfo = &pAacDecoderChannelInfo->icsInfo;
-  FIXP_DBL *pSpectralCoefficient =
-      SPEC_LONG(pAacDecoderChannelInfo->pSpectralCoefficient);
-  SHORT *pSpecScale = pAacDecoderChannelInfo->specScale;
-
-  /* set old window parameters */
-  if (pConcealmentInfo->lastRenderMode == AACDEC_RENDER_LPD) {
-    switch (pAacDecoderStaticChannelInfo->last_lpd_mode) {
-      case 1:
-        numWindows = 4;
-        srcGrpStart = 3;
-        windowLen = samplesPerFrame >> 2;
-        break;
-      case 2:
-        numWindows = 2;
-        srcGrpStart = 1;
-        windowLen = samplesPerFrame >> 1;
-        winIdxStride = 2;
-        break;
-      case 3:
-        numWindows = 1;
-        srcGrpStart = 0;
-        windowLen = samplesPerFrame;
-        winIdxStride = 4;
-        break;
-    }
-    pConcealmentInfo->lastWinGrpLen = 1;
-  } else {
-    pIcsInfo->WindowShape = pConcealmentInfo->windowShape;
-    pIcsInfo->WindowSequence = pConcealmentInfo->windowSequence;
-
-    if (pConcealmentInfo->windowSequence == BLOCK_SHORT) {
-      /* short block handling */
-      numWindows = 8;
-      windowLen = samplesPerFrame >> 3;
-      srcGrpStart = numWindows - pConcealmentInfo->lastWinGrpLen;
-    }
-  }
-
-  attIdxStride =
-      fMax(1, (int)(numWindows / (pConcealmentInfo->lastWinGrpLen + 1)));
-
-  /* load last state */
-  attIdx = pConcealmentInfo->cntFadeFrames;
-  numWinGrpPerFac = pConcealmentInfo->attGrpOffset[mode];
-  srcWin = srcGrpStart + pConcealmentInfo->winGrpOffset[mode];
-
-  FDK_ASSERT((srcGrpStart * windowLen + windowLen) <= samplesPerFrame);
-  FDK_ASSERT((srcWin * windowLen + windowLen) <= 1024);
-
-  for (dstWin = 0; dstWin < numWindows; dstWin += 1) {
-    FIXP_CNCL *pCncl =
-        pConcealmentInfo->spectralCoefficient + (srcWin * windowLen);
-    FIXP_DBL *pOut = pSpectralCoefficient + (dstWin * windowLen);
-
-    if (mode == 1) {
-      /* mute if attIdx gets large enaugh */
-      if (attIdx > pConcealmentInfo->pConcealParams->numFadeOutFrames) {
-        FDKmemclear(pCncl, sizeof(FIXP_DBL) * windowLen);
-      }
-
-      /* restore frequency coefficients from buffer - attenuation is done later
-       */
-      for (i = 0; i < windowLen; i++) {
-        pOut[i] = pCncl[i];
-      }
-
-      /* apply random change of sign for spectral coefficients */
-      CConcealment_ApplyRandomSign(pConcealmentInfo->iRandomPhase, pOut,
-                                   windowLen);
-
-      /* Increment random phase index to avoid repetition artifacts. */
-      pConcealmentInfo->iRandomPhase =
-          (pConcealmentInfo->iRandomPhase + 1) & (AAC_NF_NO_RANDOM_VAL - 1);
-
-      /* set old scale factors */
-      pSpecScale[dstWin * winIdxStride] =
-          pConcealmentInfo->specScale[srcWin * winIdxStride];
-    }
-
-    srcWin += 1;
-
-    if (srcWin >= numWindows) {
-      /* end of sequence -> rewind to first window of group */
-      srcWin = srcGrpStart;
-      numWinGrpPerFac += 1;
-      if (numWinGrpPerFac >= attIdxStride) {
-        numWinGrpPerFac = 0;
-        attIdx += 1;
-      }
-    }
-  }
-
-  /* store current state */
-
-  pConcealmentInfo->winGrpOffset[mode] = srcWin - srcGrpStart;
-  FDK_ASSERT((pConcealmentInfo->winGrpOffset[mode] >= 0) &&
-             (pConcealmentInfo->winGrpOffset[mode] < 8));
-  pConcealmentInfo->attGrpOffset[mode] = numWinGrpPerFac;
-  FDK_ASSERT((pConcealmentInfo->attGrpOffset[mode] >= 0) &&
-             (pConcealmentInfo->attGrpOffset[mode] < attIdxStride));
-
-  if (mode == 0) {
-    pConcealmentInfo->cntFadeFrames = attIdx;
-  }
-
-  appliedProcessing = 1;
-
-  return appliedProcessing;
-}
-
-/*!
-  \brief Do Time domain fading (TDFading) in concealment case
-
-  In case of concealment, this function takes care of the fading, after time
-domain signal has been rendered by the respective signal rendering functions.
-  The fading out in case of ACELP decoding is not done by this function but by
-the ACELP decoder for the first concealed frame if CONCEAL_CORE_IGNORANT_FADE is
-not set.
-
-  TimeDomain fading never creates jumps in energy / discontinuities, it always
-does a continuous fading. To achieve this, fading is always done from a starting
-point to a target point, while the starting point is always determined to be the
-last target point. By varying the target point of a fading, the fading slope can
-be controlled.
-
-  This principle is applied to the fading within a frame and the fading from
-frame to frame.
-
-  One frame is divided into 8 subframes to obtain 8 parts of fading slopes
-within a frame, each maybe with its own gradient.
-
-  Workflow:
-  1.) Determine Fading behavior and end-of-frame target fading level, based on
-concealmentState (determined by CConcealment_UpdateState()) and the core mode.
-        - By _DEFAULT_,
-          The target fading level is determined by fadeOutFactor[cntFadeFrames]
-in case of fadeOut, or fadeInFactor[cntFadeFrames] in case of fadeIn.
-          --> fading type is FADE_TIMEDOMAIN in this case. Target fading level
-is determined by fading index cntFadeFrames.
-
-        - If concealmentState is signalling a _MUTED SIGNAL_,
-          TDFading decays to 0 within 1/8th of a frame if numFadeOutFrames == 0.
-          --> fading type is FADE_TIMEDOMAIN_TOSPECTRALMUTE in this case.
-
-        - If concealmentState is signalling the _END OF MUTING_,
-          TDFading fades to target fading level within 1/8th of a frame if
-numFadeInFrames == 0.
-          --> fading type is FADE_TIMEDOMAIN_FROMSPECTRALMUTE in this case.
-Target fading level is determined by fading index cntFadeFrames.
-
-#ifndef CONCEAL_CORE_IGNORANT_FADE
-        - In case of an _ACELP FADEOUT_,
-          TDFading leaves fading control to ACELP decoder for 1/2 frame.
-          --> fading type is FADE_ACELPDOMAIN in this case.
-#endif
-
-  2.) Render fading levels within current frame and do the final fading:
-      Map Fading slopes to fading levels and apply to time domain signal.
-
-
-*/
-
-INT CConcealment_TDFading(
-    int len, CAacDecoderStaticChannelInfo **ppAacDecoderStaticChannelInfo,
-    FIXP_PCM *pcmdata, FIXP_PCM *pcmdata_1) {
-  /*
-  Do the fading in Time domain based on concealment states and core mode
-  */
-  FIXP_DBL fadeStop, attMute = (FIXP_DBL)0;
-  int idx = 0, ii;
-  CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo =
-      *ppAacDecoderStaticChannelInfo;
-  CConcealmentInfo *pConcealmentInfo =
-      &pAacDecoderStaticChannelInfo->concealmentInfo;
-  CConcealParams *pConcealParams = pConcealmentInfo->pConcealParams;
-  const CConcealmentState concealState = pConcealmentInfo->concealState;
-  TDfadingType fadingType;
-  FIXP_DBL fadingStations[9] = {0};
-  int fadingSteps[8] = {0};
-  const FIXP_DBL fadeStart =
-      pConcealmentInfo
-          ->fade_old; /* start fading at last end-of-frame attenuation */
-  FIXP_SGL *fadeFactor = pConcealParams->fadeOutFactor;
-  const INT cntFadeFrames = pConcealmentInfo->cntFadeFrames;
-  int TDFadeOutStopBeforeMute = 1;
-  int TDFadeInStopBeforeFullLevel = 1;
-
-  /*
-  determine Fading behaviour (end-of-frame attenuation and fading type) (1.)
-  */
-
-  switch (concealState) {
-    case ConcealState_Single:
-    case ConcealState_Mute:
-    case ConcealState_FadeOut:
-      idx = (pConcealParams->method == ConcealMethodNoise) ? cntFadeFrames - 1
-                                                           : cntFadeFrames;
-      fadingType = FADE_TIMEDOMAIN;
-
-      if (concealState == ConcealState_Mute ||
-          (cntFadeFrames + TDFadeOutStopBeforeMute) >
-              pConcealmentInfo->pConcealParams->numFadeOutFrames) {
-        fadingType = FADE_TIMEDOMAIN_TOSPECTRALMUTE;
-      }
-
-      break;
-    case ConcealState_FadeIn:
-      idx = cntFadeFrames;
-      idx -= TDFadeInStopBeforeFullLevel;
-      FDK_FALLTHROUGH;
-    case ConcealState_Ok:
-      fadeFactor = pConcealParams->fadeInFactor;
-      idx = (concealState == ConcealState_Ok) ? -1 : idx;
-      fadingType = (pConcealmentInfo->concealState_old == ConcealState_Mute)
-                       ? FADE_TIMEDOMAIN_FROMSPECTRALMUTE
-                       : FADE_TIMEDOMAIN;
-      break;
-    default:
-      FDK_ASSERT(0);
-      fadingType = FADE_TIMEDOMAIN_TOSPECTRALMUTE;
-      break;
-  }
-
-  /* determine Target end-of-frame fading level and fading slope */
-  switch (fadingType) {
-    case FADE_TIMEDOMAIN_FROMSPECTRALMUTE:
-      fadeStop =
-          (idx < 0) ? (FIXP_DBL)MAXVAL_DBL : FX_SGL2FX_DBL(fadeFactor[idx]);
-      if (pConcealmentInfo->pConcealParams->numFadeInFrames == 0) {
-        /* do step as fast as possible */
-        fadingSteps[0] = 1;
-        break;
-      }
-      CConcealment_TDFading_doLinearFadingSteps(&fadingSteps[0]);
-      break;
-    case FADE_TIMEDOMAIN:
-      fadeStop =
-          (idx < 0) ? (FIXP_DBL)MAXVAL_DBL : FX_SGL2FX_DBL(fadeFactor[idx]);
-      CConcealment_TDFading_doLinearFadingSteps(&fadingSteps[0]);
-      break;
-    case FADE_TIMEDOMAIN_TOSPECTRALMUTE:
-      fadeStop = attMute;
-      if (pConcealmentInfo->pConcealParams->numFadeOutFrames == 0) {
-        /* do step as fast as possible */
-        fadingSteps[0] = 1;
-        break;
-      }
-      CConcealment_TDFading_doLinearFadingSteps(&fadingSteps[0]);
-      break;
-  }
-
-  /*
-  Render fading levels within current frame and do the final fading (2.)
-  */
-
-  len >>= 3;
-  CConcealment_TDFadeFillFadingStations(fadingStations, fadingSteps, fadeStop,
-                                        fadeStart, fadingType);
-
-  if ((fadingStations[8] != (FIXP_DBL)MAXVAL_DBL) ||
-      (fadingStations[7] != (FIXP_DBL)MAXVAL_DBL) ||
-      (fadingStations[6] != (FIXP_DBL)MAXVAL_DBL) ||
-      (fadingStations[5] != (FIXP_DBL)MAXVAL_DBL) ||
-      (fadingStations[4] != (FIXP_DBL)MAXVAL_DBL) ||
-      (fadingStations[3] != (FIXP_DBL)MAXVAL_DBL) ||
-      (fadingStations[2] != (FIXP_DBL)MAXVAL_DBL) ||
-      (fadingStations[1] != (FIXP_DBL)MAXVAL_DBL) ||
-      (fadingStations[0] !=
-       (FIXP_DBL)MAXVAL_DBL)) /* if there's something to fade */
-  {
-    int start = 0;
-    for (ii = 0; ii < 8; ii++) {
-      CConcealment_TDFadePcmAtt(start, len, fadingStations[ii],
-                                fadingStations[ii + 1], pcmdata);
-      start += len;
-    }
-  }
-  CConcealment_TDNoise_Apply(pConcealmentInfo, len, pcmdata);
-
-  /* Save end-of-frame attenuation and fading type */
-  pConcealmentInfo->lastFadingType = fadingType;
-  pConcealmentInfo->fade_old = fadeStop;
-  pConcealmentInfo->concealState_old = concealState;
-
-  return 1;
-}
-
-/* attenuate pcmdata in Time Domain Fading process */
-static void CConcealment_TDFadePcmAtt(int start, int len, FIXP_DBL fadeStart,
-                                      FIXP_DBL fadeStop, FIXP_PCM *pcmdata) {
-  int i;
-  FIXP_DBL dStep;
-  FIXP_DBL dGain;
-  FIXP_DBL dGain_apply;
-  int bitshift = (DFRACT_BITS - SAMPLE_BITS);
-
-  /* set start energy */
-  dGain = fadeStart;
-  /* determine energy steps from sample to sample */
-  dStep = (FIXP_DBL)((int)((fadeStart >> 1) - (fadeStop >> 1)) / len) << 1;
-
-  for (i = start; i < (start + len); i++) {
-    dGain -= dStep;
-    /* prevent gain from getting negative due to possible fixpoint inaccuracies
-     */
-    dGain_apply = fMax((FIXP_DBL)0, dGain);
-    /* finally, attenuate samples */
-    pcmdata[i] = (FIXP_PCM)((fMult(pcmdata[i], (dGain_apply))) >> bitshift);
-  }
-}
-
-/*
-\brief Fill FadingStations
-
-The fadingstations are the attenuation factors, being applied to its dedicated
-portions of pcm data. They are calculated using the fadingsteps. One fadingstep
-is the weighted contribution to the fading slope within its dedicated portion of
-pcm data.
-
-*Fadingsteps  :      0  0  0  1  0  1  2  0
-
-                  |<-  1 Frame pcm data ->|
-      fadeStart-->|__________             |
-                  ^  ^  ^  ^ \____        |
- Attenuation  :   |  |  |  |  ^  ^\__     |
-                  |  |  |  |  |  |  ^\    |
-                  |  |  |  |  |  |  | \___|<-- fadeStop
-                  |  |  |  |  |  |  |  ^  ^
-                  |  |  |  |  |  |  |  |  |
-Fadingstations:  [0][1][2][3][4][5][6][7][8]
-
-(Fadingstations "[0]" is "[8] from previous frame", therefore its not meaningful
-to be edited)
-
-*/
-static void CConcealment_TDFadeFillFadingStations(FIXP_DBL *fadingStations,
-                                                  int *fadingSteps,
-                                                  FIXP_DBL fadeStop,
-                                                  FIXP_DBL fadeStart,
-                                                  TDfadingType fadingType) {
-  int i;
-  INT fadingSteps_sum = 0;
-  INT fadeDiff;
-
-  fadingSteps_sum = fadingSteps[0] + fadingSteps[1] + fadingSteps[2] +
-                    fadingSteps[3] + fadingSteps[4] + fadingSteps[5] +
-                    fadingSteps[6] + fadingSteps[7];
-  fadeDiff = ((INT)(fadeStop - fadeStart) / fMax(fadingSteps_sum, (INT)1));
-  fadingStations[0] = fadeStart;
-  for (i = 1; i < 8; i++) {
-    fadingStations[i] =
-        fadingStations[i - 1] + (FIXP_DBL)(fadeDiff * fadingSteps[i - 1]);
-  }
-  fadingStations[8] = fadeStop;
-}
-
-static void CConcealment_TDFading_doLinearFadingSteps(int *fadingSteps) {
-  fadingSteps[0] = fadingSteps[1] = fadingSteps[2] = fadingSteps[3] =
-      fadingSteps[4] = fadingSteps[5] = fadingSteps[6] = fadingSteps[7] = 1;
-}
-
-/* end of TimeDomainFading functions */
-
-/* derived from int UsacRandomSign() */
-static int CConcealment_TDNoise_Random(ULONG *seed) {
-  *seed = (ULONG)(((UINT64)(*seed) * 69069) + 5);
-  return (int)(*seed);
-}
-
-static void CConcealment_TDNoise_Apply(CConcealmentInfo *const pConcealmentInfo,
-                                       const int len, FIXP_PCM *const pcmdata) {
-  FIXP_PCM *states = pConcealmentInfo->TDNoiseStates;
-  FIXP_PCM noiseVal;
-  FIXP_DBL noiseValLong;
-  FIXP_SGL *coef = pConcealmentInfo->TDNoiseCoef;
-  FIXP_DBL TDNoiseAtt;
-  ULONG seed = pConcealmentInfo->TDNoiseSeed =
-      (ULONG)CConcealment_TDNoise_Random(&pConcealmentInfo->TDNoiseSeed) + 1;
-
-  TDNoiseAtt = pConcealmentInfo->pConcealParams->comfortNoiseLevel;
-
-  int ii;
-
-  if ((pConcealmentInfo->concealState != ConcealState_Ok ||
-       pConcealmentInfo->concealState_old != ConcealState_Ok) &&
-      TDNoiseAtt != (FIXP_DBL)0) {
-    for (ii = 0; ii < (len << 3); ii++) {
-      /* create filtered noise */
-      states[2] = states[1];
-      states[1] = states[0];
-      states[0] = ((FIXP_PCM)CConcealment_TDNoise_Random(&seed));
-      noiseValLong = fMult(states[0], coef[0]) + fMult(states[1], coef[1]) +
-                     fMult(states[2], coef[2]);
-      noiseVal = FX_DBL2FX_PCM(fMult(noiseValLong, TDNoiseAtt));
-
-      /* add filtered noise - check for clipping, before */
-      if (noiseVal > (FIXP_PCM)0 &&
-          pcmdata[ii] > (FIXP_PCM)MAXVAL_FIXP_PCM - noiseVal) {
-        noiseVal = noiseVal * (FIXP_PCM)-1;
-      } else if (noiseVal < (FIXP_PCM)0 &&
-                 pcmdata[ii] < (FIXP_PCM)MINVAL_FIXP_PCM - noiseVal) {
-        noiseVal = noiseVal * (FIXP_PCM)-1;
-      }
-
-      pcmdata[ii] += noiseVal;
-    }
-  }
-}
--- a/libAACdec/src/conceal.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Josef Hoepfl
-
-   Description: independent channel concealment
-
-*******************************************************************************/
-
-#ifndef CONCEAL_H
-#define CONCEAL_H
-
-#include "channelinfo.h"
-
-#define AACDEC_CONCEAL_PARAM_NOT_SPECIFIED (0xFFFE)
-
-void CConcealment_InitCommonData(CConcealParams *pConcealCommonData);
-
-void CConcealment_InitChannelData(CConcealmentInfo *hConcealmentInfo,
-                                  CConcealParams *pConcealCommonData,
-                                  AACDEC_RENDER_MODE initRenderMode,
-                                  int samplesPerFrame);
-
-CConcealmentMethod CConcealment_GetMethod(CConcealParams *pConcealCommonData);
-
-UINT CConcealment_GetDelay(CConcealParams *pConcealCommonData);
-
-AAC_DECODER_ERROR
-CConcealment_SetParams(CConcealParams *concealParams, int method,
-                       int fadeOutSlope, int fadeInSlope, int muteRelease,
-                       FIXP_DBL comfNoiseLevel);
-
-CConcealmentState CConcealment_GetState(CConcealmentInfo *hConcealmentInfo);
-
-AAC_DECODER_ERROR
-CConcealment_SetAttenuation(CConcealParams *concealParams,
-                            const SHORT *fadeOutAttenuationVector,
-                            const SHORT *fadeInAttenuationVector);
-
-void CConcealment_Store(
-    CConcealmentInfo *hConcealmentInfo,
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo);
-
-int CConcealment_Apply(
-    CConcealmentInfo *hConcealmentInfo,
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo,
-    const SamplingRateInfo *pSamplingRateInfo, const int samplesPerFrame,
-    const UCHAR lastLpdMode, const int FrameOk, const UINT flags);
-
-int CConcealment_GetLastFrameOk(CConcealmentInfo *hConcealmentInfo,
-                                const int fBeforeApply);
-
-INT CConcealment_TDFading(
-    int len, CAacDecoderStaticChannelInfo **ppAacDecoderStaticChannelInfo,
-    FIXP_PCM *pcmdata, FIXP_PCM *pcmdata_1);
-
-#endif /* #ifndef CONCEAL_H */
--- a/libAACdec/src/conceal_types.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Christian Griebel
-
-   Description: Error concealment structs and types
-
-*******************************************************************************/
-
-#ifndef CONCEAL_TYPES_H
-#define CONCEAL_TYPES_H
-
-#include "machine_type.h"
-#include "common_fix.h"
-
-#include "rvlc_info.h"
-
-#include "usacdec_lpc.h"
-
-#define CONCEAL_MAX_NUM_FADE_FACTORS (32)
-
-#define FIXP_CNCL FIXP_DBL
-#define FL2FXCONST_CNCL FL2FXCONST_DBL
-#define FX_DBL2FX_CNCL
-#define FX_CNCL2FX_DBL
-#define CNCL_FRACT_BITS DFRACT_BITS
-
-/* Warning: Do not ever change these values. */
-typedef enum {
-  ConcealMethodNone = -1,
-  ConcealMethodMute = 0,
-  ConcealMethodNoise = 1,
-  ConcealMethodInter = 2,
-  ConcealMethodTonal = 3
-
-} CConcealmentMethod;
-
-typedef enum {
-  ConcealState_Ok,
-  ConcealState_Single,
-  ConcealState_FadeIn,
-  ConcealState_Mute,
-  ConcealState_FadeOut
-
-} CConcealmentState;
-
-typedef struct {
-  FIXP_SGL fadeOutFactor[CONCEAL_MAX_NUM_FADE_FACTORS];
-  FIXP_SGL fadeInFactor[CONCEAL_MAX_NUM_FADE_FACTORS];
-
-  CConcealmentMethod method;
-
-  int numFadeOutFrames;
-  int numFadeInFrames;
-  int numMuteReleaseFrames;
-  FIXP_DBL comfortNoiseLevel;
-
-} CConcealParams;
-
-typedef enum {
-  FADE_TIMEDOMAIN_TOSPECTRALMUTE = 1,
-  FADE_TIMEDOMAIN_FROMSPECTRALMUTE,
-  FADE_TIMEDOMAIN
-} TDfadingType;
-
-typedef struct {
-  CConcealParams *pConcealParams;
-
-  FIXP_CNCL spectralCoefficient[1024];
-  SHORT specScale[8];
-
-  INT iRandomPhase;
-  INT prevFrameOk[2];
-  INT cntValidFrames;
-  INT cntFadeFrames; /* State for signal fade-in/out */
-  /* States for signal fade-out of frames with more than one window/subframe -
-    [0] used by Update CntFadeFrames mode of CConcealment_ApplyFadeOut, [1] used
-    by FadeOut mode */
-  int winGrpOffset[2]; /* State for signal fade-out of frames with more than one
-                          window/subframe */
-  int attGrpOffset[2]; /* State for faster signal fade-out of frames with
-                          transient signal parts */
-
-  SCHAR lastRenderMode;
-
-  UCHAR windowShape;
-  BLOCK_TYPE windowSequence;
-  UCHAR lastWinGrpLen;
-
-  CConcealmentState concealState;
-  CConcealmentState concealState_old;
-  FIXP_DBL fade_old;           /* last fading factor */
-  TDfadingType lastFadingType; /* last fading type */
-
-  SHORT aRvlcPreviousScaleFactor[RVLC_MAX_SFB]; /* needed once per channel */
-  UCHAR aRvlcPreviousCodebook[RVLC_MAX_SFB];    /* needed once per channel */
-  SCHAR rvlcPreviousScaleFactorOK;
-  SCHAR rvlcPreviousBlockType;
-
-  FIXP_LPC lsf4[M_LP_FILTER_ORDER];
-  FIXP_DBL last_tcx_gain;
-  INT last_tcx_gain_e;
-  ULONG TDNoiseSeed;
-  FIXP_PCM TDNoiseStates[3];
-  FIXP_SGL TDNoiseCoef[3];
-  FIXP_SGL TDNoiseAtt;
-
-} CConcealmentInfo;
-
-#endif /* #ifndef CONCEAL_TYPES_H */
--- a/libAACdec/src/rvlc.cpp
+++ /dev/null
@@ -1,1217 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):
-
-   Description:
-
-*******************************************************************************/
-
-/*!
-  \file
-  \brief  RVLC Decoder
-  \author Robert Weidner
-*/
-
-#include "rvlc.h"
-
-#include "block.h"
-
-#include "aac_rom.h"
-#include "rvlcbit.h"
-#include "rvlcconceal.h"
-#include "aacdec_hcr.h"
-
-/*---------------------------------------------------------------------------------------------
-     function:     rvlcInit
-
-     description:  init RVLC by data from channelinfo, which was decoded
-previously and set up pointers
------------------------------------------------------------------------------------------------
-        input:     - pointer rvlc structure
-                   - pointer channel info structure
-                   - pointer bitstream structure
------------------------------------------------------------------------------------------------
-        return:    -
---------------------------------------------------------------------------------------------
-*/
-
-static void rvlcInit(CErRvlcInfo *pRvlc,
-                     CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                     HANDLE_FDK_BITSTREAM bs) {
-  /* RVLC common initialization part 2 of 2 */
-  SHORT *pScfEsc = pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfEsc;
-  SHORT *pScfFwd = pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd;
-  SHORT *pScfBwd = pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd;
-  SHORT *pScaleFactor = pAacDecoderChannelInfo->pDynData->aScaleFactor;
-  int bnds;
-
-  pAacDecoderChannelInfo->pDynData->specificTo.aac.rvlcIntensityUsed = 0;
-
-  pRvlc->numDecodedEscapeWordsEsc = 0;
-  pRvlc->numDecodedEscapeWordsFwd = 0;
-  pRvlc->numDecodedEscapeWordsBwd = 0;
-
-  pRvlc->intensity_used = 0;
-  pRvlc->errorLogRvlc = 0;
-
-  pRvlc->conceal_max = CONCEAL_MAX_INIT;
-  pRvlc->conceal_min = CONCEAL_MIN_INIT;
-
-  pRvlc->conceal_max_esc = CONCEAL_MAX_INIT;
-  pRvlc->conceal_min_esc = CONCEAL_MIN_INIT;
-
-  pRvlc->pHuffTreeRvlcEscape = aHuffTreeRvlcEscape;
-  pRvlc->pHuffTreeRvlCodewds = aHuffTreeRvlCodewds;
-
-  /* init scf arrays (for savety (in case of there are only zero codebooks)) */
-  for (bnds = 0; bnds < RVLC_MAX_SFB; bnds++) {
-    pScfFwd[bnds] = 0;
-    pScfBwd[bnds] = 0;
-    pScfEsc[bnds] = 0;
-    pScaleFactor[bnds] = 0;
-  }
-
-  /* set base bitstream ptr to the RVL-coded part (start of RVLC data (ESC 2))
-   */
-  FDKsyncCache(bs);
-  pRvlc->bsAnchor = (INT)FDKgetValidBits(bs);
-
-  pRvlc->bitstreamIndexRvlFwd =
-      0; /* first bit within RVL coded block as start address for  forward
-            decoding */
-  pRvlc->bitstreamIndexRvlBwd =
-      pRvlc->length_of_rvlc_sf - 1; /* last bit within RVL coded block as start
-                                       address for backward decoding */
-
-  /* skip RVLC-bitstream-part -- pointing now to escapes (if present) or to TNS
-   * data (if present) */
-  FDKpushFor(bs, pRvlc->length_of_rvlc_sf);
-
-  if (pRvlc->sf_escapes_present != 0) {
-    /* locate internal bitstream ptr at escapes (which is the second part) */
-    FDKsyncCache(bs);
-    pRvlc->bitstreamIndexEsc = pRvlc->bsAnchor - (INT)FDKgetValidBits(bs);
-
-    /* skip escapeRVLC-bitstream-part -- pointing to TNS data (if present)   to
-     * make decoder continue */
-    /* decoding of RVLC should work despite this second pushFor during
-     * initialization because        */
-    /* bitstream initialization is valid for both ESC2 data parts (RVL-coded
-     * values and ESC-coded values) */
-    FDKpushFor(bs, pRvlc->length_of_rvlc_escapes);
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     function:     rvlcCheckIntensityCb
-
-     description:  Check if a intensity codebook is used in the current channel.
------------------------------------------------------------------------------------------------
-        input:     - pointer rvlc structure
-                   - pointer channel info structure
------------------------------------------------------------------------------------------------
-        output:    - intensity_used: 0 no intensity codebook is used
-                                     1 intensity codebook is used
------------------------------------------------------------------------------------------------
-        return:    -
---------------------------------------------------------------------------------------------
-*/
-
-static void rvlcCheckIntensityCb(
-    CErRvlcInfo *pRvlc, CAacDecoderChannelInfo *pAacDecoderChannelInfo) {
-  int group, band, bnds;
-
-  pRvlc->intensity_used = 0;
-
-  for (group = 0; group < pRvlc->numWindowGroups; group++) {
-    for (band = 0; band < pRvlc->maxSfbTransmitted; band++) {
-      bnds = 16 * group + band;
-      if ((pAacDecoderChannelInfo->pDynData->aCodeBook[bnds] ==
-           INTENSITY_HCB) ||
-          (pAacDecoderChannelInfo->pDynData->aCodeBook[bnds] ==
-           INTENSITY_HCB2)) {
-        pRvlc->intensity_used = 1;
-        break;
-      }
-    }
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     function:     rvlcDecodeEscapeWord
-
-     description:  Decode a huffman coded RVLC Escape-word. This value is part
-of a DPCM coded scalefactor.
------------------------------------------------------------------------------------------------
-        input:     - pointer rvlc structure
------------------------------------------------------------------------------------------------
-        return:    - a single RVLC-Escape value which had to be applied to a
-DPCM value (which has a absolute value of 7)
---------------------------------------------------------------------------------------------
-*/
-
-static SCHAR rvlcDecodeEscapeWord(CErRvlcInfo *pRvlc, HANDLE_FDK_BITSTREAM bs) {
-  int i;
-  SCHAR value;
-  UCHAR carryBit;
-  UINT treeNode;
-  UINT branchValue;
-  UINT branchNode;
-
-  INT *pBitstreamIndexEsc;
-  const UINT *pEscTree;
-
-  pEscTree = pRvlc->pHuffTreeRvlcEscape;
-  pBitstreamIndexEsc = &(pRvlc->bitstreamIndexEsc);
-  treeNode = *pEscTree; /* init at starting node */
-
-  for (i = MAX_LEN_RVLC_ESCAPE_WORD - 1; i >= 0; i--) {
-    carryBit =
-        rvlcReadBitFromBitstream(bs, /* get next bit */
-                                 pRvlc->bsAnchor, pBitstreamIndexEsc, FWD);
-
-    CarryBitToBranchValue(carryBit, /* huffman decoding, do a single step in
-                                       huffman decoding tree */
-                          treeNode, &branchValue, &branchNode);
-
-    if ((branchNode & TEST_BIT_10) ==
-        TEST_BIT_10) { /* test bit 10 ; if set --> a RVLC-escape-word is
-                          completely decoded */
-      value = (SCHAR)branchNode & CLR_BIT_10;
-      pRvlc->length_of_rvlc_escapes -= (MAX_LEN_RVLC_ESCAPE_WORD - i);
-
-      if (pRvlc->length_of_rvlc_escapes < 0) {
-        pRvlc->errorLogRvlc |= RVLC_ERROR_ALL_ESCAPE_WORDS_INVALID;
-        value = -1;
-      }
-
-      return value;
-    } else {
-      treeNode = *(
-          pEscTree +
-          branchValue); /* update treeNode for further step in decoding tree */
-    }
-  }
-
-  pRvlc->errorLogRvlc |= RVLC_ERROR_ALL_ESCAPE_WORDS_INVALID;
-
-  return -1; /* should not be reached */
-}
-
-/*---------------------------------------------------------------------------------------------
-     function:     rvlcDecodeEscapes
-
-     description:  Decodes all huffman coded RVLC Escape Words.
-                   Here a difference to the pseudo-code-implementation from
-standard can be found. A while loop (and not two nested for loops) is used for
-two reasons:
-
-                   1. The plain huffman encoded escapes are decoded before the
-RVL-coded scalefactors. Therefore the escapes are present in the second step
-                      when decoding the RVL-coded-scalefactor values in forward
-and backward direction.
-
-                      When the RVL-coded scalefactors are decoded and there a
-escape is needed, then it is just taken out of the array in ascending order.
-
-                   2. It's faster.
------------------------------------------------------------------------------------------------
-        input:     - pointer rvlc structure
-                   - handle to FDK bitstream
------------------------------------------------------------------------------------------------
-        return:    - 0 ok     the decoded escapes seem to be valid
-                   - 1 error  there was a error detected during decoding escapes
-                              --> all escapes are invalid
---------------------------------------------------------------------------------------------
-*/
-
-static void rvlcDecodeEscapes(CErRvlcInfo *pRvlc, SHORT *pEsc,
-                              HANDLE_FDK_BITSTREAM bs) {
-  SCHAR escWord;
-  SCHAR escCnt = 0;
-  SHORT *pEscBitCntSum;
-
-  pEscBitCntSum = &(pRvlc->length_of_rvlc_escapes);
-
-  /* Decode all RVLC-Escape words with a plain Huffman-Decoder */
-  while (*pEscBitCntSum > 0) {
-    escWord = rvlcDecodeEscapeWord(pRvlc, bs);
-
-    if (escWord >= 0) {
-      pEsc[escCnt] = escWord;
-      escCnt++;
-    } else {
-      pRvlc->errorLogRvlc |= RVLC_ERROR_ALL_ESCAPE_WORDS_INVALID;
-      pRvlc->numDecodedEscapeWordsEsc = escCnt;
-
-      return;
-    }
-  } /* all RVLC escapes decoded */
-
-  pRvlc->numDecodedEscapeWordsEsc = escCnt;
-}
-
-/*---------------------------------------------------------------------------------------------
-     function:     decodeRVLCodeword
-
-     description:  Decodes a RVL-coded dpcm-word (-part).
------------------------------------------------------------------------------------------------
-        input:     - FDK bitstream handle
-                   - pointer rvlc structure
------------------------------------------------------------------------------------------------
-        return:    - a dpcm value which is within range [0,1,..,14] in case of
-no errors. The offset of 7 must be subtracted to get a valid dpcm scalefactor
-value. In case of errors a forbidden codeword is detected --> returning -1
---------------------------------------------------------------------------------------------
-*/
-
-SCHAR decodeRVLCodeword(HANDLE_FDK_BITSTREAM bs, CErRvlcInfo *pRvlc) {
-  int i;
-  SCHAR value;
-  UCHAR carryBit;
-  UINT branchValue;
-  UINT branchNode;
-
-  const UINT *pRvlCodeTree = pRvlc->pHuffTreeRvlCodewds;
-  UCHAR direction = pRvlc->direction;
-  INT *pBitstrIndxRvl = pRvlc->pBitstrIndxRvl_RVL;
-  UINT treeNode = *pRvlCodeTree;
-
-  for (i = MAX_LEN_RVLC_CODE_WORD - 1; i >= 0; i--) {
-    carryBit =
-        rvlcReadBitFromBitstream(bs, /* get next bit */
-                                 pRvlc->bsAnchor, pBitstrIndxRvl, direction);
-
-    CarryBitToBranchValue(carryBit, /* huffman decoding, do a single step in
-                                       huffman decoding tree */
-                          treeNode, &branchValue, &branchNode);
-
-    if ((branchNode & TEST_BIT_10) ==
-        TEST_BIT_10) { /* test bit 10 ; if set --> a
-                          RVLC-codeword is completely decoded
-                        */
-      value = (SCHAR)(branchNode & CLR_BIT_10);
-      *pRvlc->pRvlBitCnt_RVL -= (MAX_LEN_RVLC_CODE_WORD - i);
-
-      /* check available bits for decoding */
-      if (*pRvlc->pRvlBitCnt_RVL < 0) {
-        if (direction == FWD) {
-          pRvlc->errorLogRvlc |= RVLC_ERROR_RVL_SUM_BIT_COUNTER_BELOW_ZERO_FWD;
-        } else {
-          pRvlc->errorLogRvlc |= RVLC_ERROR_RVL_SUM_BIT_COUNTER_BELOW_ZERO_BWD;
-        }
-        value = -1; /* signalize an error in return value, because too many bits
-                       was decoded */
-      }
-
-      /* check max value of dpcm value */
-      if (value > MAX_ALLOWED_DPCM_INDEX) {
-        if (direction == FWD) {
-          pRvlc->errorLogRvlc |= RVLC_ERROR_FORBIDDEN_CW_DETECTED_FWD;
-        } else {
-          pRvlc->errorLogRvlc |= RVLC_ERROR_FORBIDDEN_CW_DETECTED_BWD;
-        }
-        value = -1; /* signalize an error in return value, because a forbidden
-                       cw was detected*/
-      }
-
-      return value; /* return a dpcm value with offset +7 or an error status */
-    } else {
-      treeNode = *(
-          pRvlCodeTree +
-          branchValue); /* update treeNode for further step in decoding tree */
-    }
-  }
-
-  return -1;
-}
-
-/*---------------------------------------------------------------------------------------------
-     function:     rvlcDecodeForward
-
-     description:  Decode RVL-coded codewords in forward direction.
------------------------------------------------------------------------------------------------
-        input:     - pointer rvlc structure
-                   - pointer channel info structure
-                   - handle to FDK bitstream
------------------------------------------------------------------------------------------------
-        return:    -
---------------------------------------------------------------------------------------------
-*/
-
-static void rvlcDecodeForward(CErRvlcInfo *pRvlc,
-                              CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                              HANDLE_FDK_BITSTREAM bs) {
-  int band = 0;
-  int group = 0;
-  int bnds = 0;
-
-  SHORT dpcm;
-
-  SHORT factor =
-      pAacDecoderChannelInfo->pDynData->RawDataInfo.GlobalGain - SF_OFFSET;
-  SHORT position = -SF_OFFSET;
-  SHORT noisenrg = pAacDecoderChannelInfo->pDynData->RawDataInfo.GlobalGain -
-                   SF_OFFSET - 90 - 256;
-
-  SHORT *pScfFwd = pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd;
-  SHORT *pScfEsc = pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfEsc;
-  UCHAR *pEscFwdCnt = &(pRvlc->numDecodedEscapeWordsFwd);
-
-  pRvlc->pRvlBitCnt_RVL = &(pRvlc->length_of_rvlc_sf_fwd);
-  pRvlc->pBitstrIndxRvl_RVL = &(pRvlc->bitstreamIndexRvlFwd);
-
-  *pEscFwdCnt = 0;
-  pRvlc->direction = FWD;
-  pRvlc->noise_used = 0;
-  pRvlc->sf_used = 0;
-  pRvlc->lastScf = 0;
-  pRvlc->lastNrg = 0;
-  pRvlc->lastIs = 0;
-
-  rvlcCheckIntensityCb(pRvlc, pAacDecoderChannelInfo);
-
-  /* main loop fwd long */
-  for (group = 0; group < pRvlc->numWindowGroups; group++) {
-    for (band = 0; band < pRvlc->maxSfbTransmitted; band++) {
-      bnds = 16 * group + band;
-
-      switch (pAacDecoderChannelInfo->pDynData->aCodeBook[bnds]) {
-        case ZERO_HCB:
-          pScfFwd[bnds] = 0;
-          break;
-
-        case INTENSITY_HCB2:
-        case INTENSITY_HCB:
-          /* store dpcm_is_position */
-          dpcm = decodeRVLCodeword(bs, pRvlc);
-          if (dpcm < 0) {
-            pRvlc->conceal_max = bnds;
-            return;
-          }
-          dpcm -= TABLE_OFFSET;
-          if ((dpcm == MIN_RVL) || (dpcm == MAX_RVL)) {
-            if (pRvlc->length_of_rvlc_escapes) {
-              pRvlc->conceal_max = bnds;
-              return;
-            } else {
-              if (dpcm == MIN_RVL) {
-                dpcm -= *pScfEsc++;
-              } else {
-                dpcm += *pScfEsc++;
-              }
-              (*pEscFwdCnt)++;
-              if (pRvlc->conceal_max_esc == CONCEAL_MAX_INIT) {
-                pRvlc->conceal_max_esc = bnds;
-              }
-            }
-          }
-          position += dpcm;
-          pScfFwd[bnds] = position;
-          pRvlc->lastIs = position;
-          break;
-
-        case NOISE_HCB:
-          if (pRvlc->noise_used == 0) {
-            pRvlc->noise_used = 1;
-            pRvlc->first_noise_band = bnds;
-            noisenrg += pRvlc->dpcm_noise_nrg;
-            pScfFwd[bnds] = 100 + noisenrg;
-            pRvlc->lastNrg = noisenrg;
-          } else {
-            dpcm = decodeRVLCodeword(bs, pRvlc);
-            if (dpcm < 0) {
-              pRvlc->conceal_max = bnds;
-              return;
-            }
-            dpcm -= TABLE_OFFSET;
-            if ((dpcm == MIN_RVL) || (dpcm == MAX_RVL)) {
-              if (pRvlc->length_of_rvlc_escapes) {
-                pRvlc->conceal_max = bnds;
-                return;
-              } else {
-                if (dpcm == MIN_RVL) {
-                  dpcm -= *pScfEsc++;
-                } else {
-                  dpcm += *pScfEsc++;
-                }
-                (*pEscFwdCnt)++;
-                if (pRvlc->conceal_max_esc == CONCEAL_MAX_INIT) {
-                  pRvlc->conceal_max_esc = bnds;
-                }
-              }
-            }
-            noisenrg += dpcm;
-            pScfFwd[bnds] = 100 + noisenrg;
-            pRvlc->lastNrg = noisenrg;
-          }
-          pAacDecoderChannelInfo->data.aac.PnsData.pnsUsed[bnds] = 1;
-          break;
-
-        default:
-          pRvlc->sf_used = 1;
-          dpcm = decodeRVLCodeword(bs, pRvlc);
-          if (dpcm < 0) {
-            pRvlc->conceal_max = bnds;
-            return;
-          }
-          dpcm -= TABLE_OFFSET;
-          if ((dpcm == MIN_RVL) || (dpcm == MAX_RVL)) {
-            if (pRvlc->length_of_rvlc_escapes) {
-              pRvlc->conceal_max = bnds;
-              return;
-            } else {
-              if (dpcm == MIN_RVL) {
-                dpcm -= *pScfEsc++;
-              } else {
-                dpcm += *pScfEsc++;
-              }
-              (*pEscFwdCnt)++;
-              if (pRvlc->conceal_max_esc == CONCEAL_MAX_INIT) {
-                pRvlc->conceal_max_esc = bnds;
-              }
-            }
-          }
-          factor += dpcm;
-          pScfFwd[bnds] = factor;
-          pRvlc->lastScf = factor;
-          break;
-      }
-    }
-  }
-
-  /* postfetch fwd long */
-  if (pRvlc->intensity_used) {
-    dpcm = decodeRVLCodeword(bs, pRvlc); /* dpcm_is_last_position */
-    if (dpcm < 0) {
-      pRvlc->conceal_max = bnds;
-      return;
-    }
-    dpcm -= TABLE_OFFSET;
-    if ((dpcm == MIN_RVL) || (dpcm == MAX_RVL)) {
-      if (pRvlc->length_of_rvlc_escapes) {
-        pRvlc->conceal_max = bnds;
-        return;
-      } else {
-        if (dpcm == MIN_RVL) {
-          dpcm -= *pScfEsc++;
-        } else {
-          dpcm += *pScfEsc++;
-        }
-        (*pEscFwdCnt)++;
-        if (pRvlc->conceal_max_esc == CONCEAL_MAX_INIT) {
-          pRvlc->conceal_max_esc = bnds;
-        }
-      }
-    }
-    pRvlc->dpcm_is_last_position = dpcm;
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     function:     rvlcDecodeBackward
-
-     description:  Decode RVL-coded codewords in backward direction.
------------------------------------------------------------------------------------------------
-        input:     - pointer rvlc structure
-                   - pointer channel info structure
-                   - handle FDK bitstream
------------------------------------------------------------------------------------------------
-        return:    -
---------------------------------------------------------------------------------------------
-*/
-
-static void rvlcDecodeBackward(CErRvlcInfo *pRvlc,
-                               CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                               HANDLE_FDK_BITSTREAM bs) {
-  SHORT band, group, dpcm, offset;
-  SHORT bnds = pRvlc->maxSfbTransmitted - 1;
-
-  SHORT factor = pRvlc->rev_global_gain - SF_OFFSET;
-  SHORT position = pRvlc->dpcm_is_last_position - SF_OFFSET;
-  SHORT noisenrg = pRvlc->rev_global_gain + pRvlc->dpcm_noise_last_position -
-                   SF_OFFSET - 90 - 256;
-
-  SHORT *pScfBwd = pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd;
-  SHORT *pScfEsc = pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfEsc;
-  UCHAR *pEscEscCnt = &(pRvlc->numDecodedEscapeWordsEsc);
-  UCHAR *pEscBwdCnt = &(pRvlc->numDecodedEscapeWordsBwd);
-
-  pRvlc->pRvlBitCnt_RVL = &(pRvlc->length_of_rvlc_sf_bwd);
-  pRvlc->pBitstrIndxRvl_RVL = &(pRvlc->bitstreamIndexRvlBwd);
-
-  *pEscBwdCnt = 0;
-  pRvlc->direction = BWD;
-  pScfEsc += *pEscEscCnt - 1; /* set pScfEsc to last entry */
-  pRvlc->firstScf = 0;
-  pRvlc->firstNrg = 0;
-  pRvlc->firstIs = 0;
-
-  /* prefetch long BWD */
-  if (pRvlc->intensity_used) {
-    dpcm = decodeRVLCodeword(bs, pRvlc); /* dpcm_is_last_position */
-    if (dpcm < 0) {
-      pRvlc->dpcm_is_last_position = 0;
-      pRvlc->conceal_min = bnds;
-      return;
-    }
-    dpcm -= TABLE_OFFSET;
-    if ((dpcm == MIN_RVL) || (dpcm == MAX_RVL)) {
-      if (pRvlc->length_of_rvlc_escapes) {
-        pRvlc->conceal_min = bnds;
-        return;
-      } else {
-        if (dpcm == MIN_RVL) {
-          dpcm -= *pScfEsc--;
-        } else {
-          dpcm += *pScfEsc--;
-        }
-        (*pEscBwdCnt)++;
-        if (pRvlc->conceal_min_esc == CONCEAL_MIN_INIT) {
-          pRvlc->conceal_min_esc = bnds;
-        }
-      }
-    }
-    pRvlc->dpcm_is_last_position = dpcm;
-  }
-
-  /* main loop long BWD */
-  for (group = pRvlc->numWindowGroups - 1; group >= 0; group--) {
-    for (band = pRvlc->maxSfbTransmitted - 1; band >= 0; band--) {
-      bnds = 16 * group + band;
-      if ((band == 0) && (pRvlc->numWindowGroups != 1))
-        offset = 16 - pRvlc->maxSfbTransmitted + 1;
-      else
-        offset = 1;
-
-      switch (pAacDecoderChannelInfo->pDynData->aCodeBook[bnds]) {
-        case ZERO_HCB:
-          pScfBwd[bnds] = 0;
-          break;
-
-        case INTENSITY_HCB2:
-        case INTENSITY_HCB:
-          /* store dpcm_is_position */
-          dpcm = decodeRVLCodeword(bs, pRvlc);
-          if (dpcm < 0) {
-            pScfBwd[bnds] = position;
-            pRvlc->conceal_min = fMax(0, bnds - offset);
-            return;
-          }
-          dpcm -= TABLE_OFFSET;
-          if ((dpcm == MIN_RVL) || (dpcm == MAX_RVL)) {
-            if (pRvlc->length_of_rvlc_escapes) {
-              pScfBwd[bnds] = position;
-              pRvlc->conceal_min = fMax(0, bnds - offset);
-              return;
-            } else {
-              if (dpcm == MIN_RVL) {
-                dpcm -= *pScfEsc--;
-              } else {
-                dpcm += *pScfEsc--;
-              }
-              (*pEscBwdCnt)++;
-              if (pRvlc->conceal_min_esc == CONCEAL_MIN_INIT) {
-                pRvlc->conceal_min_esc = fMax(0, bnds - offset);
-              }
-            }
-          }
-          pScfBwd[bnds] = position;
-          position -= dpcm;
-          pRvlc->firstIs = position;
-          break;
-
-        case NOISE_HCB:
-          if (bnds == pRvlc->first_noise_band) {
-            pScfBwd[bnds] =
-                pRvlc->dpcm_noise_nrg +
-                pAacDecoderChannelInfo->pDynData->RawDataInfo.GlobalGain -
-                SF_OFFSET - 90 - 256;
-            pRvlc->firstNrg = pScfBwd[bnds];
-          } else {
-            dpcm = decodeRVLCodeword(bs, pRvlc);
-            if (dpcm < 0) {
-              pScfBwd[bnds] = noisenrg;
-              pRvlc->conceal_min = fMax(0, bnds - offset);
-              return;
-            }
-            dpcm -= TABLE_OFFSET;
-            if ((dpcm == MIN_RVL) || (dpcm == MAX_RVL)) {
-              if (pRvlc->length_of_rvlc_escapes) {
-                pScfBwd[bnds] = noisenrg;
-                pRvlc->conceal_min = fMax(0, bnds - offset);
-                return;
-              } else {
-                if (dpcm == MIN_RVL) {
-                  dpcm -= *pScfEsc--;
-                } else {
-                  dpcm += *pScfEsc--;
-                }
-                (*pEscBwdCnt)++;
-                if (pRvlc->conceal_min_esc == CONCEAL_MIN_INIT) {
-                  pRvlc->conceal_min_esc = fMax(0, bnds - offset);
-                }
-              }
-            }
-            pScfBwd[bnds] = noisenrg;
-            noisenrg -= dpcm;
-            pRvlc->firstNrg = noisenrg;
-          }
-          break;
-
-        default:
-          dpcm = decodeRVLCodeword(bs, pRvlc);
-          if (dpcm < 0) {
-            pScfBwd[bnds] = factor;
-            pRvlc->conceal_min = fMax(0, bnds - offset);
-            return;
-          }
-          dpcm -= TABLE_OFFSET;
-          if ((dpcm == MIN_RVL) || (dpcm == MAX_RVL)) {
-            if (pRvlc->length_of_rvlc_escapes) {
-              pScfBwd[bnds] = factor;
-              pRvlc->conceal_min = fMax(0, bnds - offset);
-              return;
-            } else {
-              if (dpcm == MIN_RVL) {
-                dpcm -= *pScfEsc--;
-              } else {
-                dpcm += *pScfEsc--;
-              }
-              (*pEscBwdCnt)++;
-              if (pRvlc->conceal_min_esc == CONCEAL_MIN_INIT) {
-                pRvlc->conceal_min_esc = fMax(0, bnds - offset);
-              }
-            }
-          }
-          pScfBwd[bnds] = factor;
-          factor -= dpcm;
-          pRvlc->firstScf = factor;
-          break;
-      }
-    }
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     function:     rvlcFinalErrorDetection
-
-     description:  Call RVLC concealment if error was detected in decoding
-process
------------------------------------------------------------------------------------------------
-        input:     - pointer rvlc structure
-                   - pointer channel info structure
------------------------------------------------------------------------------------------------
-        return:    -
---------------------------------------------------------------------------------------------
-*/
-
-static void rvlcFinalErrorDetection(
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo) {
-  CErRvlcInfo *pRvlc =
-      &pAacDecoderChannelInfo->pComData->overlay.aac.erRvlcInfo;
-  UCHAR ErrorStatusComplete = 0;
-  UCHAR ErrorStatusLengthFwd = 0;
-  UCHAR ErrorStatusLengthBwd = 0;
-  UCHAR ErrorStatusLengthEscapes = 0;
-  UCHAR ErrorStatusFirstScf = 0;
-  UCHAR ErrorStatusLastScf = 0;
-  UCHAR ErrorStatusFirstNrg = 0;
-  UCHAR ErrorStatusLastNrg = 0;
-  UCHAR ErrorStatusFirstIs = 0;
-  UCHAR ErrorStatusLastIs = 0;
-  UCHAR ErrorStatusForbiddenCwFwd = 0;
-  UCHAR ErrorStatusForbiddenCwBwd = 0;
-  UCHAR ErrorStatusNumEscapesFwd = 0;
-  UCHAR ErrorStatusNumEscapesBwd = 0;
-  UCHAR ConcealStatus = 1;
-  UCHAR currentBlockType; /* short: 0, not short: 1*/
-
-  pAacDecoderChannelInfo->pDynData->specificTo.aac.rvlcCurrentScaleFactorOK = 1;
-
-  /* invalid escape words, bit counter unequal zero, forbidden codeword detected
-   */
-  if (pRvlc->errorLogRvlc & RVLC_ERROR_FORBIDDEN_CW_DETECTED_FWD)
-    ErrorStatusForbiddenCwFwd = 1;
-
-  if (pRvlc->errorLogRvlc & RVLC_ERROR_FORBIDDEN_CW_DETECTED_BWD)
-    ErrorStatusForbiddenCwBwd = 1;
-
-  /* bit counter forward unequal zero */
-  if (pRvlc->length_of_rvlc_sf_fwd) ErrorStatusLengthFwd = 1;
-
-  /* bit counter backward unequal zero */
-  if (pRvlc->length_of_rvlc_sf_bwd) ErrorStatusLengthBwd = 1;
-
-  /* bit counter escape sequences unequal zero */
-  if (pRvlc->sf_escapes_present)
-    if (pRvlc->length_of_rvlc_escapes) ErrorStatusLengthEscapes = 1;
-
-  if (pRvlc->sf_used) {
-    /* first decoded scf does not match to global gain in backward direction */
-    if (pRvlc->firstScf !=
-        (pAacDecoderChannelInfo->pDynData->RawDataInfo.GlobalGain - SF_OFFSET))
-      ErrorStatusFirstScf = 1;
-
-    /* last decoded scf does not match to rev global gain in forward direction
-     */
-    if (pRvlc->lastScf != (pRvlc->rev_global_gain - SF_OFFSET))
-      ErrorStatusLastScf = 1;
-  }
-
-  if (pRvlc->noise_used) {
-    /* first decoded nrg does not match to dpcm_noise_nrg in backward direction
-     */
-    if (pRvlc->firstNrg !=
-        (pAacDecoderChannelInfo->pDynData->RawDataInfo.GlobalGain +
-         pRvlc->dpcm_noise_nrg - SF_OFFSET - 90 - 256))
-      ErrorStatusFirstNrg = 1;
-
-    /* last decoded nrg does not match to dpcm_noise_last_position in forward
-     * direction */
-    if (pRvlc->lastNrg !=
-        (pRvlc->rev_global_gain + pRvlc->dpcm_noise_last_position - SF_OFFSET -
-         90 - 256))
-      ErrorStatusLastNrg = 1;
-  }
-
-  if (pRvlc->intensity_used) {
-    /* first decoded is position does not match in backward direction */
-    if (pRvlc->firstIs != (-SF_OFFSET)) ErrorStatusFirstIs = 1;
-
-    /* last decoded is position does not match in forward direction */
-    if (pRvlc->lastIs != (pRvlc->dpcm_is_last_position - SF_OFFSET))
-      ErrorStatusLastIs = 1;
-  }
-
-  /* decoded escapes and used escapes in forward direction do not fit */
-  if ((pRvlc->numDecodedEscapeWordsFwd != pRvlc->numDecodedEscapeWordsEsc) &&
-      (pRvlc->conceal_max == CONCEAL_MAX_INIT)) {
-    ErrorStatusNumEscapesFwd = 1;
-  }
-
-  /* decoded escapes and used escapes in backward direction do not fit */
-  if ((pRvlc->numDecodedEscapeWordsBwd != pRvlc->numDecodedEscapeWordsEsc) &&
-      (pRvlc->conceal_min == CONCEAL_MIN_INIT)) {
-    ErrorStatusNumEscapesBwd = 1;
-  }
-
-  if (ErrorStatusLengthEscapes ||
-      (((pRvlc->conceal_max == CONCEAL_MAX_INIT) &&
-        (pRvlc->numDecodedEscapeWordsFwd != pRvlc->numDecodedEscapeWordsEsc) &&
-        (ErrorStatusLastScf || ErrorStatusLastNrg || ErrorStatusLastIs))
-
-       &&
-
-       ((pRvlc->conceal_min == CONCEAL_MIN_INIT) &&
-        (pRvlc->numDecodedEscapeWordsBwd != pRvlc->numDecodedEscapeWordsEsc) &&
-        (ErrorStatusFirstScf || ErrorStatusFirstNrg || ErrorStatusFirstIs))) ||
-      ((pRvlc->conceal_max == CONCEAL_MAX_INIT) &&
-       ((pRvlc->rev_global_gain - SF_OFFSET - pRvlc->lastScf) < -15)) ||
-      ((pRvlc->conceal_min == CONCEAL_MIN_INIT) &&
-       ((pAacDecoderChannelInfo->pDynData->RawDataInfo.GlobalGain - SF_OFFSET -
-         pRvlc->firstScf) < -15))) {
-    if ((pRvlc->conceal_max == CONCEAL_MAX_INIT) ||
-        (pRvlc->conceal_min == CONCEAL_MIN_INIT)) {
-      pRvlc->conceal_max = 0;
-      pRvlc->conceal_min = fMax(
-          0, (pRvlc->numWindowGroups - 1) * 16 + pRvlc->maxSfbTransmitted - 1);
-    } else {
-      pRvlc->conceal_max = fMin(pRvlc->conceal_max, pRvlc->conceal_max_esc);
-      pRvlc->conceal_min = fMax(pRvlc->conceal_min, pRvlc->conceal_min_esc);
-    }
-  }
-
-  ErrorStatusComplete = ErrorStatusLastScf || ErrorStatusFirstScf ||
-                        ErrorStatusLastNrg || ErrorStatusFirstNrg ||
-                        ErrorStatusLastIs || ErrorStatusFirstIs ||
-                        ErrorStatusForbiddenCwFwd ||
-                        ErrorStatusForbiddenCwBwd || ErrorStatusLengthFwd ||
-                        ErrorStatusLengthBwd || ErrorStatusLengthEscapes ||
-                        ErrorStatusNumEscapesFwd || ErrorStatusNumEscapesBwd;
-
-  currentBlockType =
-      (GetWindowSequence(&pAacDecoderChannelInfo->icsInfo) == BLOCK_SHORT) ? 0
-                                                                           : 1;
-
-  if (!ErrorStatusComplete) {
-    int band;
-    int group;
-    int bnds;
-    int lastSfbIndex;
-
-    lastSfbIndex = (pRvlc->numWindowGroups > 1) ? 16 : 64;
-
-    for (group = 0; group < pRvlc->numWindowGroups; group++) {
-      for (band = 0; band < pRvlc->maxSfbTransmitted; band++) {
-        bnds = 16 * group + band;
-        pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-            pAacDecoderStaticChannelInfo->concealmentInfo
-                .aRvlcPreviousScaleFactor[bnds] =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-      }
-    }
-
-    for (group = 0; group < pRvlc->numWindowGroups; group++) {
-      for (band = 0; band < pRvlc->maxSfbTransmitted; band++) {
-        bnds = 16 * group + band;
-        pAacDecoderStaticChannelInfo->concealmentInfo
-            .aRvlcPreviousCodebook[bnds] =
-            pAacDecoderChannelInfo->pDynData->aCodeBook[bnds];
-      }
-      for (; band < lastSfbIndex; band++) {
-        bnds = 16 * group + band;
-        FDK_ASSERT(bnds >= 0 && bnds < RVLC_MAX_SFB);
-        pAacDecoderStaticChannelInfo->concealmentInfo
-            .aRvlcPreviousCodebook[bnds] = ZERO_HCB;
-      }
-    }
-  } else {
-    int band;
-    int group;
-
-    /* A single bit error was detected in decoding of dpcm values. It also could
-       be an error with more bits in decoding of escapes and dpcm values whereby
-       an illegal codeword followed not directly after the corrupted bits but
-       just after decoding some more (wrong) scalefactors. Use the smaller
-       scalefactor from forward decoding, backward decoding and previous frame.
-     */
-    if (((pRvlc->conceal_min != CONCEAL_MIN_INIT) ||
-         (pRvlc->conceal_max != CONCEAL_MAX_INIT)) &&
-        (pRvlc->conceal_min <= pRvlc->conceal_max) &&
-        (pAacDecoderStaticChannelInfo->concealmentInfo.rvlcPreviousBlockType ==
-         currentBlockType) &&
-        pAacDecoderStaticChannelInfo->concealmentInfo
-            .rvlcPreviousScaleFactorOK &&
-        pRvlc->sf_concealment && ConcealStatus) {
-      BidirectionalEstimation_UseScfOfPrevFrameAsReference(
-          pAacDecoderChannelInfo, pAacDecoderStaticChannelInfo);
-      ConcealStatus = 0;
-    }
-
-    /* A single bit error was detected in decoding of dpcm values. It also could
-       be an error with more bits in decoding of escapes and dpcm values whereby
-       an illegal codeword followed not directly after the corrupted bits but
-       just after decoding some more (wrong) scalefactors. Use the smaller
-       scalefactor from forward and backward decoding. */
-    if ((pRvlc->conceal_min <= pRvlc->conceal_max) &&
-        ((pRvlc->conceal_min != CONCEAL_MIN_INIT) ||
-         (pRvlc->conceal_max != CONCEAL_MAX_INIT)) &&
-        !(pAacDecoderStaticChannelInfo->concealmentInfo
-              .rvlcPreviousScaleFactorOK &&
-          pRvlc->sf_concealment &&
-          (pAacDecoderStaticChannelInfo->concealmentInfo
-               .rvlcPreviousBlockType == currentBlockType)) &&
-        ConcealStatus) {
-      BidirectionalEstimation_UseLowerScfOfCurrentFrame(pAacDecoderChannelInfo);
-      ConcealStatus = 0;
-    }
-
-    /* No errors were detected in decoding of escapes and dpcm values however
-       the first and last value of a group (is,nrg,sf) is incorrect */
-    if ((pRvlc->conceal_min <= pRvlc->conceal_max) &&
-        ((ErrorStatusLastScf && ErrorStatusFirstScf) ||
-         (ErrorStatusLastNrg && ErrorStatusFirstNrg) ||
-         (ErrorStatusLastIs && ErrorStatusFirstIs)) &&
-        !(ErrorStatusForbiddenCwFwd || ErrorStatusForbiddenCwBwd ||
-          ErrorStatusLengthEscapes) &&
-        ConcealStatus) {
-      StatisticalEstimation(pAacDecoderChannelInfo);
-      ConcealStatus = 0;
-    }
-
-    /* A error with more bits in decoding of escapes and dpcm values was
-       detected. Use the smaller scalefactor from forward decoding, backward
-       decoding and previous frame. */
-    if ((pRvlc->conceal_min <= pRvlc->conceal_max) &&
-        pAacDecoderStaticChannelInfo->concealmentInfo
-            .rvlcPreviousScaleFactorOK &&
-        pRvlc->sf_concealment &&
-        (pAacDecoderStaticChannelInfo->concealmentInfo.rvlcPreviousBlockType ==
-         currentBlockType) &&
-        ConcealStatus) {
-      PredictiveInterpolation(pAacDecoderChannelInfo,
-                              pAacDecoderStaticChannelInfo);
-      ConcealStatus = 0;
-    }
-
-    /* Call frame concealment, because no better strategy was found. Setting the
-       scalefactors to zero is done for debugging purposes */
-    if (ConcealStatus) {
-      for (group = 0; group < pRvlc->numWindowGroups; group++) {
-        for (band = 0; band < pRvlc->maxSfbTransmitted; band++) {
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[16 * group + band] = 0;
-        }
-      }
-      pAacDecoderChannelInfo->pDynData->specificTo.aac
-          .rvlcCurrentScaleFactorOK = 0;
-    }
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-     function:     CRvlc_Read
-
-     description:  Read RVLC ESC1 data (side info) from bitstream.
------------------------------------------------------------------------------------------------
-        input:     - pointer rvlc structure
-                   - pointer channel info structure
-                   - pointer bitstream structure
------------------------------------------------------------------------------------------------
-        return:    -
---------------------------------------------------------------------------------------------
-*/
-
-void CRvlc_Read(CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                HANDLE_FDK_BITSTREAM bs) {
-  CErRvlcInfo *pRvlc =
-      &pAacDecoderChannelInfo->pComData->overlay.aac.erRvlcInfo;
-
-  int group, band;
-
-  /* RVLC long specific initialization  Init part 1 of 2 */
-  pRvlc->numWindowGroups = GetWindowGroups(&pAacDecoderChannelInfo->icsInfo);
-  pRvlc->maxSfbTransmitted =
-      GetScaleFactorBandsTransmitted(&pAacDecoderChannelInfo->icsInfo);
-  pRvlc->noise_used = 0;               /* noise detection */
-  pRvlc->dpcm_noise_nrg = 0;           /* only for debugging */
-  pRvlc->dpcm_noise_last_position = 0; /* only for debugging */
-  pRvlc->length_of_rvlc_escapes =
-      -1; /* default value is used for error detection and concealment */
-
-  /* read only error sensitivity class 1 data (ESC 1 - data) */
-  pRvlc->sf_concealment = FDKreadBits(bs, 1);  /* #1 */
-  pRvlc->rev_global_gain = FDKreadBits(bs, 8); /* #2 */
-
-  if (GetWindowSequence(&pAacDecoderChannelInfo->icsInfo) == BLOCK_SHORT) {
-    pRvlc->length_of_rvlc_sf = FDKreadBits(bs, 11); /* #3 */
-  } else {
-    pRvlc->length_of_rvlc_sf = FDKreadBits(bs, 9); /* #3 */
-  }
-
-  /* check if noise codebook is used */
-  for (group = 0; group < pRvlc->numWindowGroups; group++) {
-    for (band = 0; band < pRvlc->maxSfbTransmitted; band++) {
-      if (pAacDecoderChannelInfo->pDynData->aCodeBook[16 * group + band] ==
-          NOISE_HCB) {
-        pRvlc->noise_used = 1;
-        break;
-      }
-    }
-  }
-
-  if (pRvlc->noise_used)
-    pRvlc->dpcm_noise_nrg = FDKreadBits(bs, 9); /* #4  PNS */
-
-  pRvlc->sf_escapes_present = FDKreadBits(bs, 1); /* #5      */
-
-  if (pRvlc->sf_escapes_present) {
-    pRvlc->length_of_rvlc_escapes = FDKreadBits(bs, 8); /* #6      */
-  }
-
-  if (pRvlc->noise_used) {
-    pRvlc->dpcm_noise_last_position = FDKreadBits(bs, 9); /* #7  PNS */
-    pRvlc->length_of_rvlc_sf -= 9;
-  }
-
-  pRvlc->length_of_rvlc_sf_fwd = pRvlc->length_of_rvlc_sf;
-  pRvlc->length_of_rvlc_sf_bwd = pRvlc->length_of_rvlc_sf;
-}
-
-/*---------------------------------------------------------------------------------------------
-     function:     CRvlc_Decode
-
-     description:  Decode rvlc data
-                   The function reads both the escape sequences and the
-scalefactors in forward and backward direction. If an error occured during
-decoding process which can not be concealed with the rvlc concealment frame
-concealment will be initiated. Then the element "rvlcCurrentScaleFactorOK" in
-the decoder channel info is set to 0 otherwise it is set to 1.
------------------------------------------------------------------------------------------------
-        input:     - pointer rvlc structure
-                   - pointer channel info structure
-                   - pointer to persistent channel info structure
-                   - pointer bitstream structure
------------------------------------------------------------------------------------------------
-        return:    ErrorStatus = AAC_DEC_OK
---------------------------------------------------------------------------------------------
-*/
-
-void CRvlc_Decode(CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                  CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo,
-                  HANDLE_FDK_BITSTREAM bs) {
-  CErRvlcInfo *pRvlc =
-      &pAacDecoderChannelInfo->pComData->overlay.aac.erRvlcInfo;
-  INT bitCntOffst;
-  INT saveBitCnt;
-
-  rvlcInit(pRvlc, pAacDecoderChannelInfo, bs);
-
-  /* save bitstream position */
-  saveBitCnt = (INT)FDKgetValidBits(bs);
-
-  if (pRvlc->sf_escapes_present)
-    rvlcDecodeEscapes(
-        pRvlc, pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfEsc, bs);
-
-  rvlcDecodeForward(pRvlc, pAacDecoderChannelInfo, bs);
-  rvlcDecodeBackward(pRvlc, pAacDecoderChannelInfo, bs);
-  rvlcFinalErrorDetection(pAacDecoderChannelInfo, pAacDecoderStaticChannelInfo);
-
-  pAacDecoderChannelInfo->pDynData->specificTo.aac.rvlcIntensityUsed =
-      pRvlc->intensity_used;
-  pAacDecoderChannelInfo->data.aac.PnsData.PnsActive = pRvlc->noise_used;
-
-  /* restore bitstream position */
-  bitCntOffst = (INT)FDKgetValidBits(bs) - saveBitCnt;
-  if (bitCntOffst) {
-    FDKpushBiDirectional(bs, bitCntOffst);
-  }
-}
-
-void CRvlc_ElementCheck(
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo[],
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo[],
-    const UINT flags, const INT elChannels) {
-  int ch;
-
-  /* Required for MPS residuals. */
-  if (pAacDecoderStaticChannelInfo == NULL) {
-    return;
-  }
-
-  /* RVLC specific sanity checks */
-  if ((flags & AC_ER_RVLC) && (elChannels == 2)) { /* to be reviewed */
-    if (((pAacDecoderChannelInfo[0]
-              ->pDynData->specificTo.aac.rvlcCurrentScaleFactorOK == 0) ||
-         (pAacDecoderChannelInfo[1]
-              ->pDynData->specificTo.aac.rvlcCurrentScaleFactorOK == 0)) &&
-        pAacDecoderChannelInfo[0]->pComData->jointStereoData.MsMaskPresent) {
-      pAacDecoderChannelInfo[0]
-          ->pDynData->specificTo.aac.rvlcCurrentScaleFactorOK = 0;
-      pAacDecoderChannelInfo[1]
-          ->pDynData->specificTo.aac.rvlcCurrentScaleFactorOK = 0;
-    }
-
-    if ((pAacDecoderChannelInfo[0]
-             ->pDynData->specificTo.aac.rvlcCurrentScaleFactorOK == 0) &&
-        (pAacDecoderChannelInfo[1]
-             ->pDynData->specificTo.aac.rvlcCurrentScaleFactorOK == 1) &&
-        (pAacDecoderChannelInfo[1]
-             ->pDynData->specificTo.aac.rvlcIntensityUsed == 1)) {
-      pAacDecoderChannelInfo[1]
-          ->pDynData->specificTo.aac.rvlcCurrentScaleFactorOK = 0;
-    }
-  }
-
-  for (ch = 0; ch < elChannels; ch++) {
-    pAacDecoderStaticChannelInfo[ch]->concealmentInfo.rvlcPreviousBlockType =
-        (GetWindowSequence(&pAacDecoderChannelInfo[ch]->icsInfo) == BLOCK_SHORT)
-            ? 0
-            : 1;
-    if (flags & AC_ER_RVLC) {
-      pAacDecoderStaticChannelInfo[ch]
-          ->concealmentInfo.rvlcPreviousScaleFactorOK =
-          pAacDecoderChannelInfo[ch]
-              ->pDynData->specificTo.aac.rvlcCurrentScaleFactorOK;
-    } else {
-      pAacDecoderStaticChannelInfo[ch]
-          ->concealmentInfo.rvlcPreviousScaleFactorOK = 0;
-    }
-  }
-}
--- a/libAACdec/src/rvlc.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):
-
-   Description:
-
-*******************************************************************************/
-
-/*!
-  \file
-  \brief  Defines structures and prototypes for RVLC
-  \author Robert Weidner
-*/
-
-#ifndef RVLC_H
-#define RVLC_H
-
-#include "aacdecoder.h"
-#include "channel.h"
-#include "rvlc_info.h"
-
-/* ------------------------------------------------------------------- */
-/*    errorLogRvlc: A word of 32 bits used for logging possible errors */
-/*                  within RVLC in case of distorted bitstreams.       */
-/* ------------------------------------------------------------------- */
-#define RVLC_ERROR_ALL_ESCAPE_WORDS_INVALID                                \
-  0x80000000 /*  ESC-Dec  During RVLC-Escape-decoding there have been more \
-                bits decoded as there are available */
-#define RVLC_ERROR_RVL_SUM_BIT_COUNTER_BELOW_ZERO_FWD                     \
-  0x40000000 /*  RVL-Dec  negative sum-bitcounter during RVL-fwd-decoding \
-                (long+shrt) */
-#define RVLC_ERROR_RVL_SUM_BIT_COUNTER_BELOW_ZERO_BWD                     \
-  0x20000000 /*  RVL-Dec  negative sum-bitcounter during RVL-fwd-decoding \
-                (long+shrt) */
-#define RVLC_ERROR_FORBIDDEN_CW_DETECTED_FWD \
-  0x08000000 /*  RVL-Dec  forbidden codeword detected fwd (long+shrt) */
-#define RVLC_ERROR_FORBIDDEN_CW_DETECTED_BWD \
-  0x04000000 /*  RVL-Dec  forbidden codeword detected bwd (long+shrt) */
-
-void CRvlc_Read(CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                HANDLE_FDK_BITSTREAM bs);
-
-void CRvlc_Decode(CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                  CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo,
-                  HANDLE_FDK_BITSTREAM bs);
-
-/**
- * \brief performe sanity checks to the channel data corresponding to one
- * channel element.
- * \param pAacDecoderChannelInfo
- * \param pAacDecoderStaticChannelInfo
- * \param elChannels amount of channels of the channel element.
- */
-void CRvlc_ElementCheck(
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo[],
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo[],
-    const UINT flags, const INT elChannels);
-
-#endif /* RVLC_H */
--- a/libAACdec/src/rvlc_info.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):
-
-   Description:
-
-*******************************************************************************/
-
-/*!
-  \file
-  \brief  Defines structures for RVLC
-  \author Robert Weidner
-*/
-#ifndef RVLC_INFO_H
-#define RVLC_INFO_H
-
-#define FWD 0 /* bitstream decoding direction forward (RVL coded part) */
-#define BWD 1 /* bitstream decoding direction backward (RVL coded part) */
-
-#define MAX_RVL 7  /* positive RVLC escape */
-#define MIN_RVL -7 /* negative RVLC escape */
-#define MAX_ALLOWED_DPCM_INDEX                                    \
-  14 /* the maximum allowed index of a decoded dpcm value (offset \
-        'TABLE_OFFSET' incl --> must be subtracted) */
-#define TABLE_OFFSET                                                           \
-  7 /* dpcm offset of valid output values of rvl table decoding, the rvl table \
-       ouly returns positive values, therefore the offset */
-#define MAX_LEN_RVLC_CODE_WORD 9 /* max length of a RVL codeword in bits */
-#define MAX_LEN_RVLC_ESCAPE_WORD \
-  20 /* max length of huffman coded RVLC escape word in bits */
-
-#define DPCM_NOISE_NRG_BITS 9
-#define SF_OFFSET 100 /* offset for correcting scf value */
-
-#define CONCEAL_MAX_INIT 1311  /* arbitrary value */
-#define CONCEAL_MIN_INIT -1311 /* arbitrary value */
-
-#define RVLC_MAX_SFB ((8) * (16))
-
-/* sideinfo of RVLC */
-typedef struct {
-  /* ------- ESC 1 Data: --------- */ /* order of RVLC-bitstream components in
-                                         bitstream (RVLC-initialization), every
-                                         component appears only once in
-                                         bitstream */
-  INT sf_concealment;                 /* 1          */
-  INT rev_global_gain;                /* 2          */
-  SHORT length_of_rvlc_sf; /* 3          */ /* original value, gets modified
-                                               (subtract 9) in case of noise
-                                               (PNS); is kept for later use */
-  INT dpcm_noise_nrg;                       /* 4 optional */
-  INT sf_escapes_present;                   /* 5          */
-  SHORT length_of_rvlc_escapes;             /* 6 optional */
-  INT dpcm_noise_last_position;             /* 7 optional */
-
-  INT dpcm_is_last_position;
-
-  SHORT length_of_rvlc_sf_fwd; /* length_of_rvlc_sf used for forward decoding */
-  SHORT
-  length_of_rvlc_sf_bwd; /* length_of_rvlc_sf used for backward decoding */
-
-  /* for RVL-Codeword decoder to distinguish between fwd and bwd decoding */
-  SHORT *pRvlBitCnt_RVL;
-  INT *pBitstrIndxRvl_RVL;
-
-  UCHAR numWindowGroups;
-  UCHAR maxSfbTransmitted;
-  UCHAR first_noise_group;
-  UCHAR first_noise_band;
-  UCHAR direction;
-
-  /* bitstream indices */
-  INT bsAnchor;             /* hcr bit buffer reference index */
-  INT bitstreamIndexRvlFwd; /* base address of RVL-coded-scalefactor data (ESC
-                               2) for forward  decoding */
-  INT bitstreamIndexRvlBwd; /* base address of RVL-coded-scalefactor data (ESC
-                               2) for backward decoding */
-  INT bitstreamIndexEsc;    /* base address where RVLC-escapes start (ESC 2) */
-
-  /* decoding trees */
-  const UINT *pHuffTreeRvlCodewds;
-  const UINT *pHuffTreeRvlcEscape;
-
-  /* escape counters */
-  UCHAR numDecodedEscapeWordsFwd; /* when decoding RVL-codes forward  */
-  UCHAR numDecodedEscapeWordsBwd; /* when decoding RVL-codes backward */
-  UCHAR numDecodedEscapeWordsEsc; /* when decoding the escape-Words */
-
-  SCHAR noise_used;
-  SCHAR intensity_used;
-  SCHAR sf_used;
-
-  SHORT firstScf;
-  SHORT lastScf;
-  SHORT firstNrg;
-  SHORT lastNrg;
-  SHORT firstIs;
-  SHORT lastIs;
-
-  /* ------ RVLC error detection ------ */
-  UINT errorLogRvlc;     /* store RVLC errors  */
-  SHORT conceal_min;     /* is set at backward decoding  */
-  SHORT conceal_max;     /* is set at forward  decoding  */
-  SHORT conceal_min_esc; /* is set at backward decoding  */
-  SHORT conceal_max_esc; /* is set at forward  decoding  */
-} CErRvlcInfo;
-
-typedef CErRvlcInfo RVLC_INFO; /* temp */
-
-#endif /* RVLC_INFO_H */
--- a/libAACdec/src/rvlcbit.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):
-
-   Description:
-
-*******************************************************************************/
-
-/*!
-  \file
-  \brief  RVLC bitstream reading
-  \author Robert Weidner
-*/
-
-#include "rvlcbit.h"
-
-/*---------------------------------------------------------------------------------------------
-     function:     rvlcReadBitFromBitstream
-
-     description:  This function returns a bit from the bitstream according to
-read direction. It is called very often, therefore it makes sense to inline it
-(runtime).
------------------------------------------------------------------------------------------------
-        input:     - bitstream
-                   - pPosition
-                   - readDirection
------------------------------------------------------------------------------------------------
-        return:    - bit from bitstream
---------------------------------------------------------------------------------------------
-*/
-
-UCHAR rvlcReadBitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
-                               INT *pPosition, UCHAR readDirection) {
-  UINT bit;
-  INT readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pPosition;
-
-  if (readBitOffset) {
-    FDKpushBiDirectional(bs, readBitOffset);
-  }
-
-  if (readDirection == FWD) {
-    bit = FDKreadBits(bs, 1);
-
-    *pPosition += 1;
-  } else {
-    /* to be replaced with a brother function of FDKreadBits() */
-    bit = FDKreadBits(bs, 1);
-    FDKpushBack(bs, 2);
-
-    *pPosition -= 1;
-  }
-
-  return (bit);
-}
--- a/libAACdec/src/rvlcbit.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):   Robert Weidner (DSP Solutions)
-
-   Description: RVLC Decoder: Bitstream reading
-
-*******************************************************************************/
-
-#ifndef RVLCBIT_H
-#define RVLCBIT_H
-
-#include "rvlc.h"
-
-UCHAR rvlcReadBitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
-                               INT *pPosition, UCHAR readDirection);
-
-#endif /* RVLCBIT_H */
--- a/libAACdec/src/rvlcconceal.cpp
+++ /dev/null
@@ -1,787 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):
-
-   Description:
-
-*******************************************************************************/
-
-/*!
-  \file
-  \brief  rvlc concealment
-  \author Josef Hoepfl
-*/
-
-#include "rvlcconceal.h"
-
-#include "block.h"
-#include "rvlc.h"
-
-/*---------------------------------------------------------------------------------------------
-  function:      calcRefValFwd
-
-  description:   The function determines the scalefactor which is closed to the
-scalefactorband conceal_min. The same is done for intensity data and noise
-energies.
------------------------------------------------------------------------------------------------
-  output:        - reference value scf
-                 - reference value internsity data
-                 - reference value noise energy
------------------------------------------------------------------------------------------------
-  return:        -
---------------------------------------------------------------------------------------------
-*/
-
-static void calcRefValFwd(CErRvlcInfo *pRvlc,
-                          CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                          int *refIsFwd, int *refNrgFwd, int *refScfFwd) {
-  int band, bnds, group, startBand;
-  int idIs, idNrg, idScf;
-  int conceal_min, conceal_group_min;
-  int MaximumScaleFactorBands;
-
-  if (GetWindowSequence(&pAacDecoderChannelInfo->icsInfo) == BLOCK_SHORT)
-    MaximumScaleFactorBands = 16;
-  else
-    MaximumScaleFactorBands = 64;
-
-  conceal_min = pRvlc->conceal_min % MaximumScaleFactorBands;
-  conceal_group_min = pRvlc->conceal_min / MaximumScaleFactorBands;
-
-  /* calculate first reference value for approach in forward direction */
-  idIs = idNrg = idScf = 1;
-
-  /* set reference values */
-  *refIsFwd = -SF_OFFSET;
-  *refNrgFwd = pAacDecoderChannelInfo->pDynData->RawDataInfo.GlobalGain -
-               SF_OFFSET - 90 - 256;
-  *refScfFwd =
-      pAacDecoderChannelInfo->pDynData->RawDataInfo.GlobalGain - SF_OFFSET;
-
-  startBand = conceal_min - 1;
-  for (group = conceal_group_min; group >= 0; group--) {
-    for (band = startBand; band >= 0; band--) {
-      bnds = 16 * group + band;
-      switch (pAacDecoderChannelInfo->pDynData->aCodeBook[bnds]) {
-        case ZERO_HCB:
-          break;
-        case INTENSITY_HCB:
-        case INTENSITY_HCB2:
-          if (idIs) {
-            *refIsFwd =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-            idIs = 0; /* reference value has been set */
-          }
-          break;
-        case NOISE_HCB:
-          if (idNrg) {
-            *refNrgFwd =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-            idNrg = 0; /* reference value has been set */
-          }
-          break;
-        default:
-          if (idScf) {
-            *refScfFwd =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-            idScf = 0; /* reference value has been set */
-          }
-          break;
-      }
-    }
-    startBand = pRvlc->maxSfbTransmitted - 1;
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-  function:      calcRefValBwd
-
-  description:   The function determines the scalefactor which is closed to the
-scalefactorband conceal_max. The same is done for intensity data and noise
-energies.
------------------------------------------------------------------------------------------------
-  output:        - reference value scf
-                 - reference value internsity data
-                 - reference value noise energy
------------------------------------------------------------------------------------------------
-  return:        -
---------------------------------------------------------------------------------------------
-*/
-
-static void calcRefValBwd(CErRvlcInfo *pRvlc,
-                          CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-                          int *refIsBwd, int *refNrgBwd, int *refScfBwd) {
-  int band, bnds, group, startBand;
-  int idIs, idNrg, idScf;
-  int conceal_max, conceal_group_max;
-  int MaximumScaleFactorBands;
-
-  if (GetWindowSequence(&pAacDecoderChannelInfo->icsInfo) == BLOCK_SHORT)
-    MaximumScaleFactorBands = 16;
-  else
-    MaximumScaleFactorBands = 64;
-
-  conceal_max = pRvlc->conceal_max % MaximumScaleFactorBands;
-  conceal_group_max = pRvlc->conceal_max / MaximumScaleFactorBands;
-
-  /* calculate first reference value for approach in backward direction */
-  idIs = idNrg = idScf = 1;
-
-  /* set reference values */
-  *refIsBwd = pRvlc->dpcm_is_last_position - SF_OFFSET;
-  *refNrgBwd = pRvlc->rev_global_gain + pRvlc->dpcm_noise_last_position -
-               SF_OFFSET - 90 - 256 + pRvlc->dpcm_noise_nrg;
-  *refScfBwd = pRvlc->rev_global_gain - SF_OFFSET;
-
-  startBand = conceal_max + 1;
-
-  /* if needed, re-set reference values */
-  for (group = conceal_group_max; group < pRvlc->numWindowGroups; group++) {
-    for (band = startBand; band < pRvlc->maxSfbTransmitted; band++) {
-      bnds = 16 * group + band;
-      switch (pAacDecoderChannelInfo->pDynData->aCodeBook[bnds]) {
-        case ZERO_HCB:
-          break;
-        case INTENSITY_HCB:
-        case INTENSITY_HCB2:
-          if (idIs) {
-            *refIsBwd =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-            idIs = 0; /* reference value has been set */
-          }
-          break;
-        case NOISE_HCB:
-          if (idNrg) {
-            *refNrgBwd =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-            idNrg = 0; /* reference value has been set */
-          }
-          break;
-        default:
-          if (idScf) {
-            *refScfBwd =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-            idScf = 0; /* reference value has been set */
-          }
-          break;
-      }
-    }
-    startBand = 0;
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-  function:      BidirectionalEstimation_UseLowerScfOfCurrentFrame
-
-  description:   This approach by means of bidirectional estimation is generally
-performed when a single bit error has been detected, the bit error can be
-isolated between 'conceal_min' and 'conceal_max' and the 'sf_concealment' flag
-is not set. The sets of scalefactors decoded in forward and backward direction
-are compared with each other. The smaller scalefactor will be considered as the
-correct one respectively. The reconstruction of the scalefactors with this
-approach archieve good results in audio quality. The strategy must be applied to
-scalefactors, intensity data and noise energy seperately.
------------------------------------------------------------------------------------------------
-  output:        Concealed scalefactor, noise energy and intensity data between
-conceal_min and conceal_max
------------------------------------------------------------------------------------------------
-  return:        -
---------------------------------------------------------------------------------------------
-*/
-
-void BidirectionalEstimation_UseLowerScfOfCurrentFrame(
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo) {
-  CErRvlcInfo *pRvlc =
-      &pAacDecoderChannelInfo->pComData->overlay.aac.erRvlcInfo;
-  int band, bnds, startBand, endBand, group;
-  int conceal_min, conceal_max;
-  int conceal_group_min, conceal_group_max;
-  int MaximumScaleFactorBands;
-
-  if (GetWindowSequence(&pAacDecoderChannelInfo->icsInfo) == BLOCK_SHORT) {
-    MaximumScaleFactorBands = 16;
-  } else {
-    MaximumScaleFactorBands = 64;
-  }
-
-  /* If an error was detected just in forward or backward direction, set the
-     corresponding border for concealment to a appropriate scalefactor band. The
-     border is set to first or last sfb respectively, because the error will
-     possibly not follow directly after the corrupt bit but just after decoding
-     some more (wrong) scalefactors. */
-  if (pRvlc->conceal_min == CONCEAL_MIN_INIT) pRvlc->conceal_min = 0;
-
-  if (pRvlc->conceal_max == CONCEAL_MAX_INIT)
-    pRvlc->conceal_max =
-        (pRvlc->numWindowGroups - 1) * 16 + pRvlc->maxSfbTransmitted - 1;
-
-  conceal_min = pRvlc->conceal_min % MaximumScaleFactorBands;
-  conceal_group_min = pRvlc->conceal_min / MaximumScaleFactorBands;
-  conceal_max = pRvlc->conceal_max % MaximumScaleFactorBands;
-  conceal_group_max = pRvlc->conceal_max / MaximumScaleFactorBands;
-
-  if (pRvlc->conceal_min == pRvlc->conceal_max) {
-    int refIsFwd, refNrgFwd, refScfFwd;
-    int refIsBwd, refNrgBwd, refScfBwd;
-
-    bnds = pRvlc->conceal_min;
-    calcRefValFwd(pRvlc, pAacDecoderChannelInfo, &refIsFwd, &refNrgFwd,
-                  &refScfFwd);
-    calcRefValBwd(pRvlc, pAacDecoderChannelInfo, &refIsBwd, &refNrgBwd,
-                  &refScfBwd);
-
-    switch (pAacDecoderChannelInfo->pDynData->aCodeBook[bnds]) {
-      case ZERO_HCB:
-        break;
-      case INTENSITY_HCB:
-      case INTENSITY_HCB2:
-        if (refIsFwd < refIsBwd)
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = refIsFwd;
-        else
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = refIsBwd;
-        break;
-      case NOISE_HCB:
-        if (refNrgFwd < refNrgBwd)
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = refNrgFwd;
-        else
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = refNrgBwd;
-        break;
-      default:
-        if (refScfFwd < refScfBwd)
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = refScfFwd;
-        else
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = refScfBwd;
-        break;
-    }
-  } else {
-    pAacDecoderChannelInfo->pComData->overlay.aac
-        .aRvlcScfFwd[pRvlc->conceal_max] =
-        pAacDecoderChannelInfo->pComData->overlay.aac
-            .aRvlcScfBwd[pRvlc->conceal_max];
-    pAacDecoderChannelInfo->pComData->overlay.aac
-        .aRvlcScfBwd[pRvlc->conceal_min] =
-        pAacDecoderChannelInfo->pComData->overlay.aac
-            .aRvlcScfFwd[pRvlc->conceal_min];
-
-    /* consider the smaller of the forward and backward decoded value as the
-     * correct one */
-    startBand = conceal_min;
-    if (conceal_group_min == conceal_group_max)
-      endBand = conceal_max;
-    else
-      endBand = pRvlc->maxSfbTransmitted - 1;
-
-    for (group = conceal_group_min; group <= conceal_group_max; group++) {
-      for (band = startBand; band <= endBand; band++) {
-        bnds = 16 * group + band;
-        if (pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds] <
-            pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds])
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-              pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-        else
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-              pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-      }
-      startBand = 0;
-      if ((group + 1) == conceal_group_max) endBand = conceal_max;
-    }
-  }
-
-  /* now copy all data to the output buffer which needs not to be concealed */
-  if (conceal_group_min == 0)
-    endBand = conceal_min;
-  else
-    endBand = pRvlc->maxSfbTransmitted;
-  for (group = 0; group <= conceal_group_min; group++) {
-    for (band = 0; band < endBand; band++) {
-      bnds = 16 * group + band;
-      pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-          pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-    }
-    if ((group + 1) == conceal_group_min) endBand = conceal_min;
-  }
-
-  startBand = conceal_max + 1;
-  for (group = conceal_group_max; group < pRvlc->numWindowGroups; group++) {
-    for (band = startBand; band < pRvlc->maxSfbTransmitted; band++) {
-      bnds = 16 * group + band;
-      pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-          pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-    }
-    startBand = 0;
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-  function:      BidirectionalEstimation_UseScfOfPrevFrameAsReference
-
-  description:   This approach by means of bidirectional estimation is generally
-performed when a single bit error has been detected, the bit error can be
-isolated between 'conceal_min' and 'conceal_max', the 'sf_concealment' flag is
-set and the previous frame has the same block type as the current frame. The
-scalefactor decoded in forward and backward direction and the scalefactor of the
-previous frame are compared with each other. The smaller scalefactor will be
-considered as the correct one. At this the codebook of the previous and current
-frame must be of the same set (scf, nrg, is) in each scalefactorband. Otherwise
-the scalefactor of the previous frame is not considered in the minimum
-calculation. The reconstruction of the scalefactors with this approach archieve
-good results in audio quality. The strategy must be applied to scalefactors,
-intensity data and noise energy seperately.
------------------------------------------------------------------------------------------------
-  output:        Concealed scalefactor, noise energy and intensity data between
-conceal_min and conceal_max
------------------------------------------------------------------------------------------------
-  return:        -
---------------------------------------------------------------------------------------------
-*/
-
-void BidirectionalEstimation_UseScfOfPrevFrameAsReference(
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo) {
-  CErRvlcInfo *pRvlc =
-      &pAacDecoderChannelInfo->pComData->overlay.aac.erRvlcInfo;
-  int band, bnds, startBand, endBand, group;
-  int conceal_min, conceal_max;
-  int conceal_group_min, conceal_group_max;
-  int MaximumScaleFactorBands;
-  SHORT commonMin;
-
-  if (GetWindowSequence(&pAacDecoderChannelInfo->icsInfo) == BLOCK_SHORT) {
-    MaximumScaleFactorBands = 16;
-  } else {
-    MaximumScaleFactorBands = 64;
-  }
-
-  /* If an error was detected just in forward or backward direction, set the
-     corresponding border for concealment to a appropriate scalefactor band. The
-     border is set to first or last sfb respectively, because the error will
-     possibly not follow directly after the corrupt bit but just after decoding
-     some more (wrong) scalefactors. */
-  if (pRvlc->conceal_min == CONCEAL_MIN_INIT) pRvlc->conceal_min = 0;
-
-  if (pRvlc->conceal_max == CONCEAL_MAX_INIT)
-    pRvlc->conceal_max =
-        (pRvlc->numWindowGroups - 1) * 16 + pRvlc->maxSfbTransmitted - 1;
-
-  conceal_min = pRvlc->conceal_min % MaximumScaleFactorBands;
-  conceal_group_min = pRvlc->conceal_min / MaximumScaleFactorBands;
-  conceal_max = pRvlc->conceal_max % MaximumScaleFactorBands;
-  conceal_group_max = pRvlc->conceal_max / MaximumScaleFactorBands;
-
-  pAacDecoderChannelInfo->pComData->overlay.aac
-      .aRvlcScfFwd[pRvlc->conceal_max] =
-      pAacDecoderChannelInfo->pComData->overlay.aac
-          .aRvlcScfBwd[pRvlc->conceal_max];
-  pAacDecoderChannelInfo->pComData->overlay.aac
-      .aRvlcScfBwd[pRvlc->conceal_min] =
-      pAacDecoderChannelInfo->pComData->overlay.aac
-          .aRvlcScfFwd[pRvlc->conceal_min];
-
-  /* consider the smaller of the forward and backward decoded value as the
-   * correct one */
-  startBand = conceal_min;
-  if (conceal_group_min == conceal_group_max)
-    endBand = conceal_max;
-  else
-    endBand = pRvlc->maxSfbTransmitted - 1;
-
-  for (group = conceal_group_min; group <= conceal_group_max; group++) {
-    for (band = startBand; band <= endBand; band++) {
-      bnds = 16 * group + band;
-      switch (pAacDecoderChannelInfo->pDynData->aCodeBook[bnds]) {
-        case ZERO_HCB:
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = 0;
-          break;
-
-        case INTENSITY_HCB:
-        case INTENSITY_HCB2:
-          if ((pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] == INTENSITY_HCB) ||
-              (pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] == INTENSITY_HCB2)) {
-            commonMin = fMin(
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds],
-                pAacDecoderChannelInfo->pComData->overlay.aac
-                    .aRvlcScfBwd[bnds]);
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                fMin(commonMin, pAacDecoderStaticChannelInfo->concealmentInfo
-                                    .aRvlcPreviousScaleFactor[bnds]);
-          } else {
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = fMin(
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds],
-                pAacDecoderChannelInfo->pComData->overlay.aac
-                    .aRvlcScfBwd[bnds]);
-          }
-          break;
-
-        case NOISE_HCB:
-          if (pAacDecoderStaticChannelInfo->concealmentInfo
-                  .aRvlcPreviousCodebook[bnds] == NOISE_HCB) {
-            commonMin = fMin(
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds],
-                pAacDecoderChannelInfo->pComData->overlay.aac
-                    .aRvlcScfBwd[bnds]);
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                fMin(commonMin, pAacDecoderStaticChannelInfo->concealmentInfo
-                                    .aRvlcPreviousScaleFactor[bnds]);
-          } else {
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = fMin(
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds],
-                pAacDecoderChannelInfo->pComData->overlay.aac
-                    .aRvlcScfBwd[bnds]);
-          }
-          break;
-
-        default:
-          if ((pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] != ZERO_HCB) &&
-              (pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] != NOISE_HCB) &&
-              (pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] != INTENSITY_HCB) &&
-              (pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] != INTENSITY_HCB2)) {
-            commonMin = fMin(
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds],
-                pAacDecoderChannelInfo->pComData->overlay.aac
-                    .aRvlcScfBwd[bnds]);
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                fMin(commonMin, pAacDecoderStaticChannelInfo->concealmentInfo
-                                    .aRvlcPreviousScaleFactor[bnds]);
-          } else {
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = fMin(
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds],
-                pAacDecoderChannelInfo->pComData->overlay.aac
-                    .aRvlcScfBwd[bnds]);
-          }
-          break;
-      }
-    }
-    startBand = 0;
-    if ((group + 1) == conceal_group_max) endBand = conceal_max;
-  }
-
-  /* now copy all data to the output buffer which needs not to be concealed */
-  if (conceal_group_min == 0)
-    endBand = conceal_min;
-  else
-    endBand = pRvlc->maxSfbTransmitted;
-  for (group = 0; group <= conceal_group_min; group++) {
-    for (band = 0; band < endBand; band++) {
-      bnds = 16 * group + band;
-      pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-          pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-    }
-    if ((group + 1) == conceal_group_min) endBand = conceal_min;
-  }
-
-  startBand = conceal_max + 1;
-  for (group = conceal_group_max; group < pRvlc->numWindowGroups; group++) {
-    for (band = startBand; band < pRvlc->maxSfbTransmitted; band++) {
-      bnds = 16 * group + band;
-      pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-          pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-    }
-    startBand = 0;
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-  function:      StatisticalEstimation
-
-  description:   This approach by means of statistical estimation is generally
-performed when both the start value and the end value are different and no
-further errors have been detected. Considering the forward and backward decoded
-scalefactors, the set with the lower scalefactors in sum will be considered as
-the correct one. The scalefactors are differentially encoded. Normally it would
-reach to compare one pair of the forward and backward decoded scalefactors to
-specify the lower set. But having detected no further errors does not
-necessarily mean the absence of errors. Therefore all scalefactors decoded in
-forward and backward direction are summed up seperately. The set with the lower
-sum will be used. The strategy must be applied to scalefactors, intensity data
-and noise energy seperately.
------------------------------------------------------------------------------------------------
-  output:        Concealed scalefactor, noise energy and intensity data
------------------------------------------------------------------------------------------------
-  return:        -
---------------------------------------------------------------------------------------------
-*/
-
-void StatisticalEstimation(CAacDecoderChannelInfo *pAacDecoderChannelInfo) {
-  CErRvlcInfo *pRvlc =
-      &pAacDecoderChannelInfo->pComData->overlay.aac.erRvlcInfo;
-  int band, bnds, group;
-  int sumIsFwd, sumIsBwd;   /* sum of intensity data forward/backward */
-  int sumNrgFwd, sumNrgBwd; /* sum of noise energy data forward/backward */
-  int sumScfFwd, sumScfBwd; /* sum of scalefactor data forward/backward */
-  int useIsFwd, useNrgFwd, useScfFwd; /* the flags signals the elements which
-                                         are used for the final result */
-
-  sumIsFwd = sumIsBwd = sumNrgFwd = sumNrgBwd = sumScfFwd = sumScfBwd = 0;
-  useIsFwd = useNrgFwd = useScfFwd = 0;
-
-  /* calculate sum of each group (scf,nrg,is) of forward and backward direction
-   */
-  for (group = 0; group < pRvlc->numWindowGroups; group++) {
-    for (band = 0; band < pRvlc->maxSfbTransmitted; band++) {
-      bnds = 16 * group + band;
-      switch (pAacDecoderChannelInfo->pDynData->aCodeBook[bnds]) {
-        case ZERO_HCB:
-          break;
-
-        case INTENSITY_HCB:
-        case INTENSITY_HCB2:
-          sumIsFwd +=
-              pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-          sumIsBwd +=
-              pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-          break;
-
-        case NOISE_HCB:
-          sumNrgFwd +=
-              pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-          sumNrgBwd +=
-              pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-          break;
-
-        default:
-          sumScfFwd +=
-              pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-          sumScfBwd +=
-              pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-          break;
-      }
-    }
-  }
-
-  /* find for each group (scf,nrg,is) the correct direction */
-  if (sumIsFwd < sumIsBwd) useIsFwd = 1;
-
-  if (sumNrgFwd < sumNrgBwd) useNrgFwd = 1;
-
-  if (sumScfFwd < sumScfBwd) useScfFwd = 1;
-
-  /* conceal each group (scf,nrg,is) */
-  for (group = 0; group < pRvlc->numWindowGroups; group++) {
-    for (band = 0; band < pRvlc->maxSfbTransmitted; band++) {
-      bnds = 16 * group + band;
-      switch (pAacDecoderChannelInfo->pDynData->aCodeBook[bnds]) {
-        case ZERO_HCB:
-          break;
-
-        case INTENSITY_HCB:
-        case INTENSITY_HCB2:
-          if (useIsFwd)
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-          else
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-          break;
-
-        case NOISE_HCB:
-          if (useNrgFwd)
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-          else
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-          break;
-
-        default:
-          if (useScfFwd)
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds];
-          else
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfBwd[bnds];
-          break;
-      }
-    }
-  }
-}
-
-/*---------------------------------------------------------------------------------------------
-  description:   Approach by means of predictive interpolation
-                 This approach by means of predictive estimation is generally
-performed when the error cannot be isolated between 'conceal_min' and
-'conceal_max', the 'sf_concealment' flag is set and the previous frame has the
-same block type as the current frame. Check for each scalefactorband if the same
-type of data (scalefactor, internsity data, noise energies) is transmitted. If
-so use the scalefactor (intensity data, noise energy) in the current frame.
-Otherwise set the scalefactor (intensity data, noise energy) for this
-scalefactorband to zero.
------------------------------------------------------------------------------------------------
-  output:        Concealed scalefactor, noise energy and intensity data
------------------------------------------------------------------------------------------------
-  return:        -
---------------------------------------------------------------------------------------------
-*/
-
-void PredictiveInterpolation(
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo) {
-  CErRvlcInfo *pRvlc =
-      &pAacDecoderChannelInfo->pComData->overlay.aac.erRvlcInfo;
-  int band, bnds, group;
-  SHORT commonMin;
-
-  for (group = 0; group < pRvlc->numWindowGroups; group++) {
-    for (band = 0; band < pRvlc->maxSfbTransmitted; band++) {
-      bnds = 16 * group + band;
-      switch (pAacDecoderChannelInfo->pDynData->aCodeBook[bnds]) {
-        case ZERO_HCB:
-          pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = 0;
-          break;
-
-        case INTENSITY_HCB:
-        case INTENSITY_HCB2:
-          if ((pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] == INTENSITY_HCB) ||
-              (pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] == INTENSITY_HCB2)) {
-            commonMin = fMin(
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds],
-                pAacDecoderChannelInfo->pComData->overlay.aac
-                    .aRvlcScfBwd[bnds]);
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                fMin(commonMin, pAacDecoderStaticChannelInfo->concealmentInfo
-                                    .aRvlcPreviousScaleFactor[bnds]);
-          } else {
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = -110;
-          }
-          break;
-
-        case NOISE_HCB:
-          if (pAacDecoderStaticChannelInfo->concealmentInfo
-                  .aRvlcPreviousCodebook[bnds] == NOISE_HCB) {
-            commonMin = fMin(
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds],
-                pAacDecoderChannelInfo->pComData->overlay.aac
-                    .aRvlcScfBwd[bnds]);
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                fMin(commonMin, pAacDecoderStaticChannelInfo->concealmentInfo
-                                    .aRvlcPreviousScaleFactor[bnds]);
-          } else {
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = -110;
-          }
-          break;
-
-        default:
-          if ((pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] != ZERO_HCB) &&
-              (pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] != NOISE_HCB) &&
-              (pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] != INTENSITY_HCB) &&
-              (pAacDecoderStaticChannelInfo->concealmentInfo
-                   .aRvlcPreviousCodebook[bnds] != INTENSITY_HCB2)) {
-            commonMin = fMin(
-                pAacDecoderChannelInfo->pComData->overlay.aac.aRvlcScfFwd[bnds],
-                pAacDecoderChannelInfo->pComData->overlay.aac
-                    .aRvlcScfBwd[bnds]);
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] =
-                fMin(commonMin, pAacDecoderStaticChannelInfo->concealmentInfo
-                                    .aRvlcPreviousScaleFactor[bnds]);
-          } else {
-            pAacDecoderChannelInfo->pDynData->aScaleFactor[bnds] = 0;
-          }
-          break;
-      }
-    }
-  }
-}
--- a/libAACdec/src/rvlcconceal.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -----------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
-Forschung e.V. All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
-that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
-scheme for digital audio. This FDK AAC Codec software is intended to be used on
-a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
-general perceptual audio codecs. AAC-ELD is considered the best-performing
-full-bandwidth communications codec by independent studies and is widely
-deployed. AAC has been standardized by ISO and IEC as part of the MPEG
-specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including
-those of Fraunhofer) may be obtained through Via Licensing
-(www.vialicensing.com) or through the respective patent owners individually for
-the purpose of encoding or decoding bit streams in products that are compliant
-with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
-Android devices already license these patent claims through Via Licensing or
-directly from the patent owners, and therefore FDK AAC Codec software may
-already be covered under those patent licenses when it is used for those
-licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions
-with enhanced sound quality, are also available from Fraunhofer. Users are
-encouraged to check the Fraunhofer website for additional applications
-information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted without payment of copyright license fees provided that you
-satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of
-the FDK AAC Codec or your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation
-and/or other materials provided with redistributions of the FDK AAC Codec or
-your modifications thereto in binary form. You must make available free of
-charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived
-from this library without prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute
-the FDK AAC Codec software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating
-that you changed the software and the date of any change. For modified versions
-of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
-must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
-AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
-limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
-Fraunhofer provides no warranty of patent non-infringement with respect to this
-software.
-
-You may use this FDK AAC Codec software or modifications thereto only for
-purposes that are authorized by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
-holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-including but not limited to the implied warranties of merchantability and
-fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
-or consequential damages, including but not limited to procurement of substitute
-goods or services; loss of use, data, or profits, or business interruption,
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of
-this software, even if advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------ */
-
-/**************************** AAC decoder library ******************************
-
-   Author(s):
-
-   Description:
-
-*******************************************************************************/
-
-/*!
-  \file
-  \brief  rvlc concealment
-  \author Josef Hoepfl
-*/
-
-#ifndef RVLCCONCEAL_H
-#define RVLCCONCEAL_H
-
-#include "rvlc.h"
-
-void BidirectionalEstimation_UseLowerScfOfCurrentFrame(
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo);
-
-void BidirectionalEstimation_UseScfOfPrevFrameAsReference(
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo);
-
-void StatisticalEstimation(CAacDecoderChannelInfo *pAacDecoderChannelInfo);
-
-void PredictiveInterpolation(
-    CAacDecoderChannelInfo *pAacDecoderChannelInfo,
-    CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo);
-
-#endif /* RVLCCONCEAL_H */
--- a/libAACdec/src/usacdec_lpd.cpp
+++ b/libAACdec/src/usacdec_lpd.cpp
@@ -111,8 +111,6 @@ amm-info@iis.fraunhofer.de
 #include "usacdec_acelp.h"
 #include "overlapadd.h"
 
-#include "conceal.h"
-
 #include "block.h"
 
 #define SF_PITCH_TRACK 6
@@ -1210,8 +1208,7 @@ AAC_DECODER_ERROR CLpdChannelStream_Read
                             : &lg_table_ccfl[1][lg_table_offset];
   int last_lpc_lost = pAacDecoderStaticChannelInfo->last_lpc_lost;
 
-  int last_frame_ok = CConcealment_GetLastFrameOk(
-      &pAacDecoderStaticChannelInfo->concealmentInfo, 1);
+  int last_frame_ok = 1;
 
   INT i_offset;
   UINT samplingRate;
@@ -1392,13 +1389,7 @@ AAC_DECODER_ERROR CLpdChannelStream_Read
     }
   }
 
-  if (!CConcealment_GetLastFrameOk(
-          &pAacDecoderStaticChannelInfo->concealmentInfo, 1)) {
-    E_LPC_f_lsp_a_conversion(
-        pAacDecoderChannelInfo->data.usac.lsp_coeff[0],
-        pAacDecoderChannelInfo->data.usac.lp_coeff[0],
-        &pAacDecoderChannelInfo->data.usac.lp_coeff_exp[0]);
-  } else if (pAacDecoderStaticChannelInfo->last_lpd_mode != 0) {
+  if (pAacDecoderStaticChannelInfo->last_lpd_mode != 0) {
     if (pAacDecoderStaticChannelInfo->last_lpd_mode == 255) {
       /* We need it for TCX decoding or ACELP excitation update */
       E_LPC_f_lsp_a_conversion(
@@ -1426,9 +1417,7 @@ AAC_DECODER_ERROR CLpdChannelStream_Read
           FD_SHORT;
       pAacDecoderChannelInfo->data.usac.lpd_mode_last = 255;
 
-      if ((pAacDecoderStaticChannelInfo->last_core_mode != FD_SHORT) &&
-          CConcealment_GetLastFrameOk(
-              &pAacDecoderStaticChannelInfo->concealmentInfo, 1)) {
+      if ((pAacDecoderStaticChannelInfo->last_core_mode != FD_SHORT)) {
         /* USAC Conformance document:
            short_fac_flag   shall be encoded with a value of 1 if the
            window_sequence of the previous frame was 2 (EIGHT_SHORT_SEQUENCE).
@@ -1604,8 +1593,7 @@ AAC_DECODER_ERROR CLpd_RenderTimeSignal(
       return AAC_DEC_UNKNOWN;
   }
 
-  last_frame_lost = !CConcealment_GetLastFrameOk(
-      &pAacDecoderStaticChannelInfo->concealmentInfo, 0);
+  last_frame_lost = 0;
 
   /* Maintain LPD mode from previous frame */
   if ((pAacDecoderStaticChannelInfo->last_core_mode == FD_LONG) ||