annotate mace.c @ 7840:38dd4fd9f107 libavcodec

Remove ChannelData.lev var and use ChannelData.level instead
author vitor
date Tue, 09 Sep 2008 16:50:11 +0000
parents a16406b793a5
children 991f4bb253fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
1 /*
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
2 * MACE decoder
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
3 * Copyright (c) 2002 Laszlo Torok <torokl@alpha.dfmk.hu>
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3682
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3682
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3682
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3682
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3682
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
15 * Lesser General Public License for more details.
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
16 *
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3682
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2967
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
20 */
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
21
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
22 /**
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
23 * @file mace.c
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
24 * MACE decoder.
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
25 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2487
diff changeset
26
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
27 #include "avcodec.h"
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
28
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
29 /*
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
30 * Adapted to ffmpeg by Francois Revol <revol@free.fr>
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
31 * (removed 68k REG stuff, changed types, added some statics and consts,
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
32 * libavcodec api, context stuff, interlaced stereo out).
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
33 */
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
34
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 893
diff changeset
35 static const uint16_t MACEtab1[] = { 0xfff3, 0x0008, 0x004c, 0x00de, 0x00de, 0x004c, 0x0008, 0xfff3 };
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
36
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 893
diff changeset
37 static const uint16_t MACEtab3[] = { 0xffee, 0x008c, 0x008c, 0xffee };
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
38
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
39 static const int16_t MACEtab2[][4] = {
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
40 { 37, 116, 206, 330}, { 39, 121, 216, 346},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
41 { 41, 127, 225, 361}, { 42, 132, 235, 377},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
42 { 44, 137, 245, 392}, { 46, 144, 256, 410},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
43 { 48, 150, 267, 428}, { 51, 157, 280, 449},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
44 { 53, 165, 293, 470}, { 55, 172, 306, 490},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
45 { 58, 179, 319, 511}, { 60, 187, 333, 534},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
46 { 63, 195, 348, 557}, { 66, 205, 364, 583},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
47 { 69, 214, 380, 609}, { 72, 223, 396, 635},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
48 { 75, 233, 414, 663}, { 79, 244, 433, 694},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
49 { 82, 254, 453, 725}, { 86, 265, 472, 756},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
50 { 90, 278, 495, 792}, { 94, 290, 516, 826},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
51 { 98, 303, 538, 862}, { 102, 316, 562, 901},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
52 { 107, 331, 588, 942}, { 112, 345, 614, 983},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
53 { 117, 361, 641, 1027}, { 122, 377, 670, 1074},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
54 { 127, 394, 701, 1123}, { 133, 411, 732, 1172},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
55 { 139, 430, 764, 1224}, { 145, 449, 799, 1280},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
56 { 152, 469, 835, 1337}, { 159, 490, 872, 1397},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
57 { 166, 512, 911, 1459}, { 173, 535, 951, 1523},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
58 { 181, 558, 993, 1590}, { 189, 584, 1038, 1663},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
59 { 197, 610, 1085, 1738}, { 206, 637, 1133, 1815},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
60 { 215, 665, 1183, 1895}, { 225, 695, 1237, 1980},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
61 { 235, 726, 1291, 2068}, { 246, 759, 1349, 2161},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
62 { 257, 792, 1409, 2257}, { 268, 828, 1472, 2357},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
63 { 280, 865, 1538, 2463}, { 293, 903, 1606, 2572},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
64 { 306, 944, 1678, 2688}, { 319, 986, 1753, 2807},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
65 { 334, 1030, 1832, 2933}, { 349, 1076, 1914, 3065},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
66 { 364, 1124, 1999, 3202}, { 380, 1174, 2088, 3344},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
67 { 398, 1227, 2182, 3494}, { 415, 1281, 2278, 3649},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
68 { 434, 1339, 2380, 3811}, { 453, 1398, 2486, 3982},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
69 { 473, 1461, 2598, 4160}, { 495, 1526, 2714, 4346},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
70 { 517, 1594, 2835, 4540}, { 540, 1665, 2961, 4741},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
71 { 564, 1740, 3093, 4953}, { 589, 1818, 3232, 5175},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
72 { 615, 1898, 3375, 5405}, { 643, 1984, 3527, 5647},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
73 { 671, 2072, 3683, 5898}, { 701, 2164, 3848, 6161},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
74 { 733, 2261, 4020, 6438}, { 766, 2362, 4199, 6724},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
75 { 800, 2467, 4386, 7024}, { 836, 2578, 4583, 7339},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
76 { 873, 2692, 4786, 7664}, { 912, 2813, 5001, 8008},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
77 { 952, 2938, 5223, 8364}, { 995, 3070, 5457, 8739},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
78 { 1039, 3207, 5701, 9129}, { 1086, 3350, 5956, 9537},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
79 { 1134, 3499, 6220, 9960}, { 1185, 3655, 6497, 10404},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
80 { 1238, 3818, 6788, 10869}, { 1293, 3989, 7091, 11355},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
81 { 1351, 4166, 7407, 11861}, { 1411, 4352, 7738, 12390},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
82 { 1474, 4547, 8084, 12946}, { 1540, 4750, 8444, 13522},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
83 { 1609, 4962, 8821, 14126}, { 1680, 5183, 9215, 14756},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
84 { 1756, 5415, 9626, 15415}, { 1834, 5657, 10057, 16104},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
85 { 1916, 5909, 10505, 16822}, { 2001, 6173, 10975, 17574},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
86 { 2091, 6448, 11463, 18356}, { 2184, 6736, 11974, 19175},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
87 { 2282, 7037, 12510, 20032}, { 2383, 7351, 13068, 20926},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
88 { 2490, 7679, 13652, 21861}, { 2601, 8021, 14260, 22834},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
89 { 2717, 8380, 14897, 23854}, { 2838, 8753, 15561, 24918},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
90 { 2965, 9144, 16256, 26031}, { 3097, 9553, 16982, 27193},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
91 { 3236, 9979, 17740, 28407}, { 3380, 10424, 18532, 29675},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
92 { 3531, 10890, 19359, 31000}, { 3688, 11375, 20222, 32382},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
93 { 3853, 11883, 21125, 32767}, { 4025, 12414, 22069, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
94 { 4205, 12967, 23053, 32767}, { 4392, 13546, 24082, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
95 { 4589, 14151, 25157, 32767}, { 4793, 14783, 26280, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
96 { 5007, 15442, 27452, 32767}, { 5231, 16132, 28678, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
97 { 5464, 16851, 29957, 32767}, { 5708, 17603, 31294, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
98 { 5963, 18389, 32691, 32767}, { 6229, 19210, 32767, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
99 { 6507, 20067, 32767, 32767}, { 6797, 20963, 32767, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
100 { 7101, 21899, 32767, 32767}, { 7418, 22876, 32767, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
101 { 7749, 23897, 32767, 32767}, { 8095, 24964, 32767, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
102 { 8456, 26078, 32767, 32767}, { 8833, 27242, 32767, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
103 { 9228, 28457, 32767, 32767}, { 9639, 29727, 32767, 32767}
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
104 };
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
105
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
106 static const int16_t MACEtab4[][2] = {
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
107 { 64, 216}, { 67, 226}, { 70, 236}, { 74, 246},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
108 { 77, 257}, { 80, 268}, { 84, 280}, { 88, 294},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
109 { 92, 307}, { 96, 321}, { 100, 334}, { 104, 350},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
110 { 109, 365}, { 114, 382}, { 119, 399}, { 124, 416},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
111 { 130, 434}, { 136, 454}, { 142, 475}, { 148, 495},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
112 { 155, 519}, { 162, 541}, { 169, 564}, { 176, 590},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
113 { 185, 617}, { 193, 644}, { 201, 673}, { 210, 703},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
114 { 220, 735}, { 230, 767}, { 240, 801}, { 251, 838},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
115 { 262, 876}, { 274, 914}, { 286, 955}, { 299, 997},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
116 { 312, 1041}, { 326, 1089}, { 341, 1138}, { 356, 1188},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
117 { 372, 1241}, { 388, 1297}, { 406, 1354}, { 424, 1415},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
118 { 443, 1478}, { 462, 1544}, { 483, 1613}, { 505, 1684},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
119 { 527, 1760}, { 551, 1838}, { 576, 1921}, { 601, 2007},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
120 { 628, 2097}, { 656, 2190}, { 686, 2288}, { 716, 2389},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
121 { 748, 2496}, { 781, 2607}, { 816, 2724}, { 853, 2846},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
122 { 891, 2973}, { 930, 3104}, { 972, 3243}, { 1016, 3389},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
123 { 1061, 3539}, { 1108, 3698}, { 1158, 3862}, { 1209, 4035},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
124 { 1264, 4216}, { 1320, 4403}, { 1379, 4599}, { 1441, 4806},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
125 { 1505, 5019}, { 1572, 5244}, { 1642, 5477}, { 1715, 5722},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
126 { 1792, 5978}, { 1872, 6245}, { 1955, 6522}, { 2043, 6813},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
127 { 2134, 7118}, { 2229, 7436}, { 2329, 7767}, { 2432, 8114},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
128 { 2541, 8477}, { 2655, 8854}, { 2773, 9250}, { 2897, 9663},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
129 { 3026, 10094}, { 3162, 10546}, { 3303, 11016}, { 3450, 11508},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
130 { 3604, 12020}, { 3765, 12556}, { 3933, 13118}, { 4108, 13703},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
131 { 4292, 14315}, { 4483, 14953}, { 4683, 15621}, { 4892, 16318},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
132 { 5111, 17046}, { 5339, 17807}, { 5577, 18602}, { 5826, 19433},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
133 { 6086, 20300}, { 6358, 21205}, { 6642, 22152}, { 6938, 23141},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
134 { 7248, 24173}, { 7571, 25252}, { 7909, 26380}, { 8262, 27557},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
135 { 8631, 28786}, { 9016, 30072}, { 9419, 31413}, { 9839, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
136 { 10278, 32767}, { 10737, 32767}, { 11216, 32767}, { 11717, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
137 { 12240, 32767}, { 12786, 32767}, { 13356, 32767}, { 13953, 32767},
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
138 { 14576, 32767}, { 15226, 32767}, { 15906, 32767}, { 16615, 32767}
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
139 };
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
140
7808
0acafe424d54 Use the same 8 bit -> 16 bit conversion as QuickTime.
vitor
parents: 7807
diff changeset
141 #define QT_8S_2_16S(x) (((x) & 0xFF00) | (((x) >> 8) & 0xFF))
0acafe424d54 Use the same 8 bit -> 16 bit conversion as QuickTime.
vitor
parents: 7807
diff changeset
142
7807
8c32b5606f83 Do not share context variables between channels and do not zero them at
vitor
parents: 7806
diff changeset
143 typedef struct ChannelData {
7840
38dd4fd9f107 Remove ChannelData.lev var and use ChannelData.level instead
vitor
parents: 7819
diff changeset
144 int16_t index, factor, prev2, previous, level;
7807
8c32b5606f83 Do not share context variables between channels and do not zero them at
vitor
parents: 7806
diff changeset
145 } ChannelData;
8c32b5606f83 Do not share context variables between channels and do not zero them at
vitor
parents: 7806
diff changeset
146
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
147 typedef struct MACEContext {
7807
8c32b5606f83 Do not share context variables between channels and do not zero them at
vitor
parents: 7806
diff changeset
148 ChannelData chd[2];
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
149 } MACEContext;
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
150
7810
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
151 /**
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
152 * MACE version of av_clip_int16(). We have to do this to keep binary
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
153 * identical output to the binary decoder.
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
154 */
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
155 static inline int16_t mace_broken_clip_int16(int n)
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
156 {
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
157 if (n > 32767)
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
158 return 32767;
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
159 else if (n < -32768)
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
160 return -32767;
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
161 else
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
162 return n;
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
163 }
06d3f6968b90 Factorize broken clipping in its own function and document it.
vitor
parents: 7809
diff changeset
164
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
165 static void chomp3(ChannelData *chd, int16_t *output, uint8_t val,
7806
b90764c4f31a Remove output pointer from context
vitor
parents: 7798
diff changeset
166 const uint16_t tab1[],
7815
275e43fa3dcb Remove cast, now tables are signed.
vitor
parents: 7814
diff changeset
167 const int16_t *tab2, int tab2_stride,
7813
0bd07f3d3556 Remove unused table entries.
vitor
parents: 7812
diff changeset
168 uint32_t numChannels)
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
169 {
7816
e4b066e695b1 Cosmetics: s/short/int16_t/
vitor
parents: 7815
diff changeset
170 int16_t current;
7792
c372b8d5abfb Reindent mace.c, its indentation was completly inconsistent with the coding rules.
vitor
parents: 7451
diff changeset
171
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
172 if (val < tab2_stride)
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
173 current = tab2[((chd->index & 0x7f0) >> 4)*tab2_stride + val];
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
174 else
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
175 current = - 1 - tab2[((chd->index & 0x7f0) >> 4)*tab2_stride + 2*tab2_stride-val-1];
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
176
7840
38dd4fd9f107 Remove ChannelData.lev var and use ChannelData.level instead
vitor
parents: 7819
diff changeset
177 current = mace_broken_clip_int16(current + chd->level);
7792
c372b8d5abfb Reindent mace.c, its indentation was completly inconsistent with the coding rules.
vitor
parents: 7451
diff changeset
178
7840
38dd4fd9f107 Remove ChannelData.lev var and use ChannelData.level instead
vitor
parents: 7819
diff changeset
179 chd->level = current - (current >> 3);
7808
0acafe424d54 Use the same 8 bit -> 16 bit conversion as QuickTime.
vitor
parents: 7807
diff changeset
180 *output = QT_8S_2_16S(current);
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
181 if (( chd->index += tab1[val]-(chd->index >> 5) ) < 0)
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
182 chd->index = 0;
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
183 }
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
184
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
185 static void chomp6(ChannelData *chd, int16_t *output, uint8_t val,
7806
b90764c4f31a Remove output pointer from context
vitor
parents: 7798
diff changeset
186 const uint16_t tab1[],
7815
275e43fa3dcb Remove cast, now tables are signed.
vitor
parents: 7814
diff changeset
187 const int16_t *tab2, int tab2_stride,
7813
0bd07f3d3556 Remove unused table entries.
vitor
parents: 7812
diff changeset
188 uint32_t numChannels)
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
189 {
7816
e4b066e695b1 Cosmetics: s/short/int16_t/
vitor
parents: 7815
diff changeset
190 int16_t current;
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
191
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
192 if (val < tab2_stride)
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
193 current = tab2[((chd->index & 0x7f0) >> 4)*tab2_stride + val];
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
194 else
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
195 current = - 1 - tab2[((chd->index & 0x7f0) >> 4)*tab2_stride + 2*tab2_stride-val-1];
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
196
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
197 if ((chd->previous ^ current) >= 0) {
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
198 chd->factor = FFMIN(chd->factor + 506, 32767);
7792
c372b8d5abfb Reindent mace.c, its indentation was completly inconsistent with the coding rules.
vitor
parents: 7451
diff changeset
199 } else {
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
200 if (chd->factor - 314 < -32768)
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
201 chd->factor = -32767;
7792
c372b8d5abfb Reindent mace.c, its indentation was completly inconsistent with the coding rules.
vitor
parents: 7451
diff changeset
202 else
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
203 chd->factor -= 314;
7792
c372b8d5abfb Reindent mace.c, its indentation was completly inconsistent with the coding rules.
vitor
parents: 7451
diff changeset
204 }
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
205
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
206 current = mace_broken_clip_int16(current + chd->level);
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
207
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
208 chd->level = ((current*chd->factor) >> 15);
7792
c372b8d5abfb Reindent mace.c, its indentation was completly inconsistent with the coding rules.
vitor
parents: 7451
diff changeset
209 current >>= 1;
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
210
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
211 output[0] = QT_8S_2_16S(chd->previous + chd->prev2 -
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
212 ((chd->prev2-current) >> 2));
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
213 output[numChannels] = QT_8S_2_16S(chd->previous + current +
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
214 ((chd->prev2-current) >> 2));
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
215 chd->prev2 = chd->previous;
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
216 chd->previous = current;
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
217
7818
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
218 if ((chd->index += tab1[val] - (chd->index >> 5)) < 0)
09291b115695 Cosmetics: rename vars s/ctx/chd/
vitor
parents: 7817
diff changeset
219 chd->index = 0;
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
220 }
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
221
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6217
diff changeset
222 static av_cold int mace_decode_init(AVCodecContext * avctx)
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
223 {
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
224 if (avctx->channels > 2)
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
225 return -1;
7451
85ab7655ad4d Modify all codecs to report their supported input and output sample format(s).
pross
parents: 7040
diff changeset
226 avctx->sample_fmt = SAMPLE_FMT_S16;
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
227 return 0;
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
228 }
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
229
7795
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
230 static int mace3_decode_frame(AVCodecContext *avctx,
7809
74a7ac273231 Cosmetics: whitespace/linebreaks
vitor
parents: 7808
diff changeset
231 void *data, int *data_size,
74a7ac273231 Cosmetics: whitespace/linebreaks
vitor
parents: 7808
diff changeset
232 const uint8_t *buf, int buf_size)
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
233 {
7816
e4b066e695b1 Cosmetics: s/short/int16_t/
vitor
parents: 7815
diff changeset
234 int16_t *samples = data;
7796
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
235 MACEContext *ctx = avctx->priv_data;
7797
09b73aceebaf Simplify: use a for instead of unrolling by hand
vitor
parents: 7796
diff changeset
236 int i, j, k;
7796
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
237
7819
a16406b793a5 Check output buffer size before decoding.
vitor
parents: 7818
diff changeset
238 if (*data_size < 2 * 3 * buf_size) {
a16406b793a5 Check output buffer size before decoding.
vitor
parents: 7818
diff changeset
239 av_log(avctx, AV_LOG_ERROR, "Output buffer too small!\n");
a16406b793a5 Check output buffer size before decoding.
vitor
parents: 7818
diff changeset
240 return -1;
a16406b793a5 Check output buffer size before decoding.
vitor
parents: 7818
diff changeset
241 }
a16406b793a5 Check output buffer size before decoding.
vitor
parents: 7818
diff changeset
242
7796
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
243 for(i = 0; i < avctx->channels; i++) {
7806
b90764c4f31a Remove output pointer from context
vitor
parents: 7798
diff changeset
244 int16_t *output = samples + i;
7796
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
245
7798
e7ec66d55d9e Cosmetics: indent after last commit and remove useless braces
vitor
parents: 7797
diff changeset
246 for (j=0; j < buf_size / 2 / avctx->channels; j++)
7797
09b73aceebaf Simplify: use a for instead of unrolling by hand
vitor
parents: 7796
diff changeset
247 for (k=0; k < 2; k++) {
7798
e7ec66d55d9e Cosmetics: indent after last commit and remove useless braces
vitor
parents: 7797
diff changeset
248 uint8_t pkt = buf[i*2 + j*2*avctx->channels + k];
7809
74a7ac273231 Cosmetics: whitespace/linebreaks
vitor
parents: 7808
diff changeset
249 chomp3(&ctx->chd[i], output, pkt &7, MACEtab1, MACEtab2,
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
250 4, avctx->channels);
7806
b90764c4f31a Remove output pointer from context
vitor
parents: 7798
diff changeset
251 output += avctx->channels;
7809
74a7ac273231 Cosmetics: whitespace/linebreaks
vitor
parents: 7808
diff changeset
252 chomp3(&ctx->chd[i], output,(pkt >> 3) &3, MACEtab3, MACEtab4,
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
253 2, avctx->channels);
7806
b90764c4f31a Remove output pointer from context
vitor
parents: 7798
diff changeset
254 output += avctx->channels;
7809
74a7ac273231 Cosmetics: whitespace/linebreaks
vitor
parents: 7808
diff changeset
255 chomp3(&ctx->chd[i], output, pkt >> 5 , MACEtab1, MACEtab2,
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
256 4, avctx->channels);
7806
b90764c4f31a Remove output pointer from context
vitor
parents: 7798
diff changeset
257 output += avctx->channels;
7797
09b73aceebaf Simplify: use a for instead of unrolling by hand
vitor
parents: 7796
diff changeset
258 }
7796
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
259 }
7795
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
260
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
261 *data_size = 2 * 3 * buf_size;
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
262
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
263 return buf_size;
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
264 }
7794
315d2a6c6a1e Simplify mace_decode_frame()
vitor
parents: 7793
diff changeset
265
7795
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
266 static int mace6_decode_frame(AVCodecContext *avctx,
7809
74a7ac273231 Cosmetics: whitespace/linebreaks
vitor
parents: 7808
diff changeset
267 void *data, int *data_size,
74a7ac273231 Cosmetics: whitespace/linebreaks
vitor
parents: 7808
diff changeset
268 const uint8_t *buf, int buf_size)
7795
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
269 {
7816
e4b066e695b1 Cosmetics: s/short/int16_t/
vitor
parents: 7815
diff changeset
270 int16_t *samples = data;
7796
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
271 MACEContext *ctx = avctx->priv_data;
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
272 int i, j;
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
273
7819
a16406b793a5 Check output buffer size before decoding.
vitor
parents: 7818
diff changeset
274 if (*data_size < 2 * 6 * buf_size) {
a16406b793a5 Check output buffer size before decoding.
vitor
parents: 7818
diff changeset
275 av_log(avctx, AV_LOG_ERROR, "Output buffer too small!\n");
a16406b793a5 Check output buffer size before decoding.
vitor
parents: 7818
diff changeset
276 return -1;
a16406b793a5 Check output buffer size before decoding.
vitor
parents: 7818
diff changeset
277 }
a16406b793a5 Check output buffer size before decoding.
vitor
parents: 7818
diff changeset
278
7796
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
279 for(i = 0; i < avctx->channels; i++) {
7806
b90764c4f31a Remove output pointer from context
vitor
parents: 7798
diff changeset
280 int16_t *output = samples + i;
7796
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
281
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
282 for (j = 0; j < buf_size / avctx->channels; j++) {
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
283 uint8_t pkt = buf[i + j*avctx->channels];
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
284
7809
74a7ac273231 Cosmetics: whitespace/linebreaks
vitor
parents: 7808
diff changeset
285 chomp6(&ctx->chd[i], output, pkt >> 5 , MACEtab1, MACEtab2,
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
286 4, avctx->channels);
7806
b90764c4f31a Remove output pointer from context
vitor
parents: 7798
diff changeset
287 output += avctx->channels << 1;
7809
74a7ac273231 Cosmetics: whitespace/linebreaks
vitor
parents: 7808
diff changeset
288 chomp6(&ctx->chd[i], output,(pkt >> 3) & 3, MACEtab3, MACEtab4,
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
289 2, avctx->channels);
7806
b90764c4f31a Remove output pointer from context
vitor
parents: 7798
diff changeset
290 output += avctx->channels << 1;
7809
74a7ac273231 Cosmetics: whitespace/linebreaks
vitor
parents: 7808
diff changeset
291 chomp6(&ctx->chd[i], output, pkt & 7, MACEtab1, MACEtab2,
7817
0f3b77f8789d Exploit symmetry to reduce size of tables by half.
vitor
parents: 7816
diff changeset
292 4, avctx->channels);
7806
b90764c4f31a Remove output pointer from context
vitor
parents: 7798
diff changeset
293 output += avctx->channels << 1;
7796
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
294 }
a7caaa2b56e9 Functions mace{3,6}_decode_frame() are just wrappers to Exp1to{3,6}(). This commit
vitor
parents: 7795
diff changeset
295 }
7794
315d2a6c6a1e Simplify mace_decode_frame()
vitor
parents: 7793
diff changeset
296
7795
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
297 *data_size = 2 * 6 * buf_size;
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
298
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
299 return buf_size;
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
300 }
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
301
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
302 AVCodec mace3_decoder = {
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
303 "mace3",
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
304 CODEC_TYPE_AUDIO,
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
305 CODEC_ID_MACE3,
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
306 sizeof(MACEContext),
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
307 mace_decode_init,
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
308 NULL,
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
309 NULL,
7795
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
310 mace3_decode_frame,
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6710
diff changeset
311 .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 3:1"),
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
312 };
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
313
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
314 AVCodec mace6_decoder = {
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
315 "mace6",
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
316 CODEC_TYPE_AUDIO,
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
317 CODEC_ID_MACE6,
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
318 sizeof(MACEContext),
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
319 mace_decode_init,
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
320 NULL,
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
321 NULL,
7795
7f81fb0dd829 Simplify: use two distinct functions to decode MACE3 and MACE6, since the
vitor
parents: 7794
diff changeset
322 mace6_decode_frame,
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6710
diff changeset
323 .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 6:1"),
827
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
324 };
770578c6c300 added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support
michaelni
parents:
diff changeset
325