diff mace.c @ 7813:0bd07f3d3556 libavcodec

Remove unused table entries.
author vitor
date Sun, 07 Sep 2008 13:55:26 +0000
parents 54348529f568
children 3cdedd7f0017
line wrap: on
line diff
--- a/mace.c	Sun Sep 07 13:47:30 2008 +0000
+++ b/mace.c	Sun Sep 07 13:55:26 2008 +0000
@@ -167,71 +167,71 @@
     { 0x25A7, 0x741F, 0x7FFF, 0x7FFF, 0x8000, 0x8000, 0x8BE0, 0xDA58 },
 };
 
-static const uint16_t MACEtab4[][8] = {
-    { 0x0040, 0x00D8, 0xFF27, 0xFFBF, 0, 0, 0, 0 },  { 0x0043, 0x00E2, 0xFF1D, 0xFFBC, 0, 0, 0, 0 },
-    { 0x0046, 0x00EC, 0xFF13, 0xFFB9, 0, 0, 0, 0 },  { 0x004A, 0x00F6, 0xFF09, 0xFFB5, 0, 0, 0, 0 },
-    { 0x004D, 0x0101, 0xFEFE, 0xFFB2, 0, 0, 0, 0 },  { 0x0050, 0x010C, 0xFEF3, 0xFFAF, 0, 0, 0, 0 },
-    { 0x0054, 0x0118, 0xFEE7, 0xFFAB, 0, 0, 0, 0 },  { 0x0058, 0x0126, 0xFED9, 0xFFA7, 0, 0, 0, 0 },
-    { 0x005C, 0x0133, 0xFECC, 0xFFA3, 0, 0, 0, 0 },  { 0x0060, 0x0141, 0xFEBE, 0xFF9F, 0, 0, 0, 0 },
-    { 0x0064, 0x014E, 0xFEB1, 0xFF9B, 0, 0, 0, 0 },  { 0x0068, 0x015E, 0xFEA1, 0xFF97, 0, 0, 0, 0 },
-    { 0x006D, 0x016D, 0xFE92, 0xFF92, 0, 0, 0, 0 },  { 0x0072, 0x017E, 0xFE81, 0xFF8D, 0, 0, 0, 0 },
-    { 0x0077, 0x018F, 0xFE70, 0xFF88, 0, 0, 0, 0 },  { 0x007C, 0x01A0, 0xFE5F, 0xFF83, 0, 0, 0, 0 },
-    { 0x0082, 0x01B2, 0xFE4D, 0xFF7D, 0, 0, 0, 0 },  { 0x0088, 0x01C6, 0xFE39, 0xFF77, 0, 0, 0, 0 },
-    { 0x008E, 0x01DB, 0xFE24, 0xFF71, 0, 0, 0, 0 },  { 0x0094, 0x01EF, 0xFE10, 0xFF6B, 0, 0, 0, 0 },
-    { 0x009B, 0x0207, 0xFDF8, 0xFF64, 0, 0, 0, 0 },  { 0x00A2, 0x021D, 0xFDE2, 0xFF5D, 0, 0, 0, 0 },
-    { 0x00A9, 0x0234, 0xFDCB, 0xFF56, 0, 0, 0, 0 },  { 0x00B0, 0x024E, 0xFDB1, 0xFF4F, 0, 0, 0, 0 },
-    { 0x00B9, 0x0269, 0xFD96, 0xFF46, 0, 0, 0, 0 },  { 0x00C1, 0x0284, 0xFD7B, 0xFF3E, 0, 0, 0, 0 },
-    { 0x00C9, 0x02A1, 0xFD5E, 0xFF36, 0, 0, 0, 0 },  { 0x00D2, 0x02BF, 0xFD40, 0xFF2D, 0, 0, 0, 0 },
-    { 0x00DC, 0x02DF, 0xFD20, 0xFF23, 0, 0, 0, 0 },  { 0x00E6, 0x02FF, 0xFD00, 0xFF19, 0, 0, 0, 0 },
-    { 0x00F0, 0x0321, 0xFCDE, 0xFF0F, 0, 0, 0, 0 },  { 0x00FB, 0x0346, 0xFCB9, 0xFF04, 0, 0, 0, 0 },
-    { 0x0106, 0x036C, 0xFC93, 0xFEF9, 0, 0, 0, 0 },  { 0x0112, 0x0392, 0xFC6D, 0xFEED, 0, 0, 0, 0 },
-    { 0x011E, 0x03BB, 0xFC44, 0xFEE1, 0, 0, 0, 0 },  { 0x012B, 0x03E5, 0xFC1A, 0xFED4, 0, 0, 0, 0 },
-    { 0x0138, 0x0411, 0xFBEE, 0xFEC7, 0, 0, 0, 0 },  { 0x0146, 0x0441, 0xFBBE, 0xFEB9, 0, 0, 0, 0 },
-    { 0x0155, 0x0472, 0xFB8D, 0xFEAA, 0, 0, 0, 0 },  { 0x0164, 0x04A4, 0xFB5B, 0xFE9B, 0, 0, 0, 0 },
-    { 0x0174, 0x04D9, 0xFB26, 0xFE8B, 0, 0, 0, 0 },  { 0x0184, 0x0511, 0xFAEE, 0xFE7B, 0, 0, 0, 0 },
-    { 0x0196, 0x054A, 0xFAB5, 0xFE69, 0, 0, 0, 0 },  { 0x01A8, 0x0587, 0xFA78, 0xFE57, 0, 0, 0, 0 },
-    { 0x01BB, 0x05C6, 0xFA39, 0xFE44, 0, 0, 0, 0 },  { 0x01CE, 0x0608, 0xF9F7, 0xFE31, 0, 0, 0, 0 },
-    { 0x01E3, 0x064D, 0xF9B2, 0xFE1C, 0, 0, 0, 0 },  { 0x01F9, 0x0694, 0xF96B, 0xFE06, 0, 0, 0, 0 },
-    { 0x020F, 0x06E0, 0xF91F, 0xFDF0, 0, 0, 0, 0 },  { 0x0227, 0x072E, 0xF8D1, 0xFDD8, 0, 0, 0, 0 },
-    { 0x0240, 0x0781, 0xF87E, 0xFDBF, 0, 0, 0, 0 },  { 0x0259, 0x07D7, 0xF828, 0xFDA6, 0, 0, 0, 0 },
-    { 0x0274, 0x0831, 0xF7CE, 0xFD8B, 0, 0, 0, 0 },  { 0x0290, 0x088E, 0xF771, 0xFD6F, 0, 0, 0, 0 },
-    { 0x02AE, 0x08F0, 0xF70F, 0xFD51, 0, 0, 0, 0 },  { 0x02CC, 0x0955, 0xF6AA, 0xFD33, 0, 0, 0, 0 },
-    { 0x02EC, 0x09C0, 0xF63F, 0xFD13, 0, 0, 0, 0 },  { 0x030D, 0x0A2F, 0xF5D0, 0xFCF2, 0, 0, 0, 0 },
-    { 0x0330, 0x0AA4, 0xF55B, 0xFCCF, 0, 0, 0, 0 },  { 0x0355, 0x0B1E, 0xF4E1, 0xFCAA, 0, 0, 0, 0 },
-    { 0x037B, 0x0B9D, 0xF462, 0xFC84, 0, 0, 0, 0 },  { 0x03A2, 0x0C20, 0xF3DF, 0xFC5D, 0, 0, 0, 0 },
-    { 0x03CC, 0x0CAB, 0xF354, 0xFC33, 0, 0, 0, 0 },  { 0x03F8, 0x0D3D, 0xF2C2, 0xFC07, 0, 0, 0, 0 },
-    { 0x0425, 0x0DD3, 0xF22C, 0xFBDA, 0, 0, 0, 0 },  { 0x0454, 0x0E72, 0xF18D, 0xFBAB, 0, 0, 0, 0 },
-    { 0x0486, 0x0F16, 0xF0E9, 0xFB79, 0, 0, 0, 0 },  { 0x04B9, 0x0FC3, 0xF03C, 0xFB46, 0, 0, 0, 0 },
-    { 0x04F0, 0x1078, 0xEF87, 0xFB0F, 0, 0, 0, 0 },  { 0x0528, 0x1133, 0xEECC, 0xFAD7, 0, 0, 0, 0 },
-    { 0x0563, 0x11F7, 0xEE08, 0xFA9C, 0, 0, 0, 0 },  { 0x05A1, 0x12C6, 0xED39, 0xFA5E, 0, 0, 0, 0 },
-    { 0x05E1, 0x139B, 0xEC64, 0xFA1E, 0, 0, 0, 0 },  { 0x0624, 0x147C, 0xEB83, 0xF9DB, 0, 0, 0, 0 },
-    { 0x066A, 0x1565, 0xEA9A, 0xF995, 0, 0, 0, 0 },  { 0x06B3, 0x165A, 0xE9A5, 0xF94C, 0, 0, 0, 0 },
-    { 0x0700, 0x175A, 0xE8A5, 0xF8FF, 0, 0, 0, 0 },  { 0x0750, 0x1865, 0xE79A, 0xF8AF, 0, 0, 0, 0 },
-    { 0x07A3, 0x197A, 0xE685, 0xF85C, 0, 0, 0, 0 },  { 0x07FB, 0x1A9D, 0xE562, 0xF804, 0, 0, 0, 0 },
-    { 0x0856, 0x1BCE, 0xE431, 0xF7A9, 0, 0, 0, 0 },  { 0x08B5, 0x1D0C, 0xE2F3, 0xF74A, 0, 0, 0, 0 },
-    { 0x0919, 0x1E57, 0xE1A8, 0xF6E6, 0, 0, 0, 0 },  { 0x0980, 0x1FB2, 0xE04D, 0xF67F, 0, 0, 0, 0 },
-    { 0x09ED, 0x211D, 0xDEE2, 0xF612, 0, 0, 0, 0 },  { 0x0A5F, 0x2296, 0xDD69, 0xF5A0, 0, 0, 0, 0 },
-    { 0x0AD5, 0x2422, 0xDBDD, 0xF52A, 0, 0, 0, 0 },  { 0x0B51, 0x25BF, 0xDA40, 0xF4AE, 0, 0, 0, 0 },
-    { 0x0BD2, 0x276E, 0xD891, 0xF42D, 0, 0, 0, 0 },  { 0x0C5A, 0x2932, 0xD6CD, 0xF3A5, 0, 0, 0, 0 },
-    { 0x0CE7, 0x2B08, 0xD4F7, 0xF318, 0, 0, 0, 0 },  { 0x0D7A, 0x2CF4, 0xD30B, 0xF285, 0, 0, 0, 0 },
-    { 0x0E14, 0x2EF4, 0xD10B, 0xF1EB, 0, 0, 0, 0 },  { 0x0EB5, 0x310C, 0xCEF3, 0xF14A, 0, 0, 0, 0 },
-    { 0x0F5D, 0x333E, 0xCCC1, 0xF0A2, 0, 0, 0, 0 },  { 0x100C, 0x3587, 0xCA78, 0xEFF3, 0, 0, 0, 0 },
-    { 0x10C4, 0x37EB, 0xC814, 0xEF3B, 0, 0, 0, 0 },  { 0x1183, 0x3A69, 0xC596, 0xEE7C, 0, 0, 0, 0 },
-    { 0x124B, 0x3D05, 0xC2FA, 0xEDB4, 0, 0, 0, 0 },  { 0x131C, 0x3FBE, 0xC041, 0xECE3, 0, 0, 0, 0 },
-    { 0x13F7, 0x4296, 0xBD69, 0xEC08, 0, 0, 0, 0 },  { 0x14DB, 0x458F, 0xBA70, 0xEB24, 0, 0, 0, 0 },
-    { 0x15C9, 0x48AA, 0xB755, 0xEA36, 0, 0, 0, 0 },  { 0x16C2, 0x4BE9, 0xB416, 0xE93D, 0, 0, 0, 0 },
-    { 0x17C6, 0x4F4C, 0xB0B3, 0xE839, 0, 0, 0, 0 },  { 0x18D6, 0x52D5, 0xAD2A, 0xE729, 0, 0, 0, 0 },
-    { 0x19F2, 0x5688, 0xA977, 0xE60D, 0, 0, 0, 0 },  { 0x1B1A, 0x5A65, 0xA59A, 0xE4E5, 0, 0, 0, 0 },
-    { 0x1C50, 0x5E6D, 0xA192, 0xE3AF, 0, 0, 0, 0 },  { 0x1D93, 0x62A4, 0x9D5B, 0xE26C, 0, 0, 0, 0 },
-    { 0x1EE5, 0x670C, 0x98F3, 0xE11A, 0, 0, 0, 0 },  { 0x2046, 0x6BA5, 0x945A, 0xDFB9, 0, 0, 0, 0 },
-    { 0x21B7, 0x7072, 0x8F8D, 0xDE48, 0, 0, 0, 0 },  { 0x2338, 0x7578, 0x8A87, 0xDCC7, 0, 0, 0, 0 },
-    { 0x24CB, 0x7AB5, 0x854A, 0xDB34, 0, 0, 0, 0 },  { 0x266F, 0x7FFF, 0x8000, 0xD990, 0, 0, 0, 0 },
-    { 0x2826, 0x7FFF, 0x8000, 0xD7D9, 0, 0, 0, 0 },  { 0x29F1, 0x7FFF, 0x8000, 0xD60E, 0, 0, 0, 0 },
-    { 0x2BD0, 0x7FFF, 0x8000, 0xD42F, 0, 0, 0, 0 },  { 0x2DC5, 0x7FFF, 0x8000, 0xD23A, 0, 0, 0, 0 },
-    { 0x2FD0, 0x7FFF, 0x8000, 0xD02F, 0, 0, 0, 0 },  { 0x31F2, 0x7FFF, 0x8000, 0xCE0D, 0, 0, 0, 0 },
-    { 0x342C, 0x7FFF, 0x8000, 0xCBD3, 0, 0, 0, 0 },  { 0x3681, 0x7FFF, 0x8000, 0xC97E, 0, 0, 0, 0 },
-    { 0x38F0, 0x7FFF, 0x8000, 0xC70F, 0, 0, 0, 0 },  { 0x3B7A, 0x7FFF, 0x8000, 0xC485, 0, 0, 0, 0 },
-    { 0x3E22, 0x7FFF, 0x8000, 0xC1DD, 0, 0, 0, 0 },  { 0x40E7, 0x7FFF, 0x8000, 0xBF18, 0, 0, 0, 0 },
+static const uint16_t MACEtab4[][4] = {
+    { 0x0040, 0x00D8, 0xFF27, 0xFFBF },  { 0x0043, 0x00E2, 0xFF1D, 0xFFBC },
+    { 0x0046, 0x00EC, 0xFF13, 0xFFB9 },  { 0x004A, 0x00F6, 0xFF09, 0xFFB5 },
+    { 0x004D, 0x0101, 0xFEFE, 0xFFB2 },  { 0x0050, 0x010C, 0xFEF3, 0xFFAF },
+    { 0x0054, 0x0118, 0xFEE7, 0xFFAB },  { 0x0058, 0x0126, 0xFED9, 0xFFA7 },
+    { 0x005C, 0x0133, 0xFECC, 0xFFA3 },  { 0x0060, 0x0141, 0xFEBE, 0xFF9F },
+    { 0x0064, 0x014E, 0xFEB1, 0xFF9B },  { 0x0068, 0x015E, 0xFEA1, 0xFF97 },
+    { 0x006D, 0x016D, 0xFE92, 0xFF92 },  { 0x0072, 0x017E, 0xFE81, 0xFF8D },
+    { 0x0077, 0x018F, 0xFE70, 0xFF88 },  { 0x007C, 0x01A0, 0xFE5F, 0xFF83 },
+    { 0x0082, 0x01B2, 0xFE4D, 0xFF7D },  { 0x0088, 0x01C6, 0xFE39, 0xFF77 },
+    { 0x008E, 0x01DB, 0xFE24, 0xFF71 },  { 0x0094, 0x01EF, 0xFE10, 0xFF6B },
+    { 0x009B, 0x0207, 0xFDF8, 0xFF64 },  { 0x00A2, 0x021D, 0xFDE2, 0xFF5D },
+    { 0x00A9, 0x0234, 0xFDCB, 0xFF56 },  { 0x00B0, 0x024E, 0xFDB1, 0xFF4F },
+    { 0x00B9, 0x0269, 0xFD96, 0xFF46 },  { 0x00C1, 0x0284, 0xFD7B, 0xFF3E },
+    { 0x00C9, 0x02A1, 0xFD5E, 0xFF36 },  { 0x00D2, 0x02BF, 0xFD40, 0xFF2D },
+    { 0x00DC, 0x02DF, 0xFD20, 0xFF23 },  { 0x00E6, 0x02FF, 0xFD00, 0xFF19 },
+    { 0x00F0, 0x0321, 0xFCDE, 0xFF0F },  { 0x00FB, 0x0346, 0xFCB9, 0xFF04 },
+    { 0x0106, 0x036C, 0xFC93, 0xFEF9 },  { 0x0112, 0x0392, 0xFC6D, 0xFEED },
+    { 0x011E, 0x03BB, 0xFC44, 0xFEE1 },  { 0x012B, 0x03E5, 0xFC1A, 0xFED4 },
+    { 0x0138, 0x0411, 0xFBEE, 0xFEC7 },  { 0x0146, 0x0441, 0xFBBE, 0xFEB9 },
+    { 0x0155, 0x0472, 0xFB8D, 0xFEAA },  { 0x0164, 0x04A4, 0xFB5B, 0xFE9B },
+    { 0x0174, 0x04D9, 0xFB26, 0xFE8B },  { 0x0184, 0x0511, 0xFAEE, 0xFE7B },
+    { 0x0196, 0x054A, 0xFAB5, 0xFE69 },  { 0x01A8, 0x0587, 0xFA78, 0xFE57 },
+    { 0x01BB, 0x05C6, 0xFA39, 0xFE44 },  { 0x01CE, 0x0608, 0xF9F7, 0xFE31 },
+    { 0x01E3, 0x064D, 0xF9B2, 0xFE1C },  { 0x01F9, 0x0694, 0xF96B, 0xFE06 },
+    { 0x020F, 0x06E0, 0xF91F, 0xFDF0 },  { 0x0227, 0x072E, 0xF8D1, 0xFDD8 },
+    { 0x0240, 0x0781, 0xF87E, 0xFDBF },  { 0x0259, 0x07D7, 0xF828, 0xFDA6 },
+    { 0x0274, 0x0831, 0xF7CE, 0xFD8B },  { 0x0290, 0x088E, 0xF771, 0xFD6F },
+    { 0x02AE, 0x08F0, 0xF70F, 0xFD51 },  { 0x02CC, 0x0955, 0xF6AA, 0xFD33 },
+    { 0x02EC, 0x09C0, 0xF63F, 0xFD13 },  { 0x030D, 0x0A2F, 0xF5D0, 0xFCF2 },
+    { 0x0330, 0x0AA4, 0xF55B, 0xFCCF },  { 0x0355, 0x0B1E, 0xF4E1, 0xFCAA },
+    { 0x037B, 0x0B9D, 0xF462, 0xFC84 },  { 0x03A2, 0x0C20, 0xF3DF, 0xFC5D },
+    { 0x03CC, 0x0CAB, 0xF354, 0xFC33 },  { 0x03F8, 0x0D3D, 0xF2C2, 0xFC07 },
+    { 0x0425, 0x0DD3, 0xF22C, 0xFBDA },  { 0x0454, 0x0E72, 0xF18D, 0xFBAB },
+    { 0x0486, 0x0F16, 0xF0E9, 0xFB79 },  { 0x04B9, 0x0FC3, 0xF03C, 0xFB46 },
+    { 0x04F0, 0x1078, 0xEF87, 0xFB0F },  { 0x0528, 0x1133, 0xEECC, 0xFAD7 },
+    { 0x0563, 0x11F7, 0xEE08, 0xFA9C },  { 0x05A1, 0x12C6, 0xED39, 0xFA5E },
+    { 0x05E1, 0x139B, 0xEC64, 0xFA1E },  { 0x0624, 0x147C, 0xEB83, 0xF9DB },
+    { 0x066A, 0x1565, 0xEA9A, 0xF995 },  { 0x06B3, 0x165A, 0xE9A5, 0xF94C },
+    { 0x0700, 0x175A, 0xE8A5, 0xF8FF },  { 0x0750, 0x1865, 0xE79A, 0xF8AF },
+    { 0x07A3, 0x197A, 0xE685, 0xF85C },  { 0x07FB, 0x1A9D, 0xE562, 0xF804 },
+    { 0x0856, 0x1BCE, 0xE431, 0xF7A9 },  { 0x08B5, 0x1D0C, 0xE2F3, 0xF74A },
+    { 0x0919, 0x1E57, 0xE1A8, 0xF6E6 },  { 0x0980, 0x1FB2, 0xE04D, 0xF67F },
+    { 0x09ED, 0x211D, 0xDEE2, 0xF612 },  { 0x0A5F, 0x2296, 0xDD69, 0xF5A0 },
+    { 0x0AD5, 0x2422, 0xDBDD, 0xF52A },  { 0x0B51, 0x25BF, 0xDA40, 0xF4AE },
+    { 0x0BD2, 0x276E, 0xD891, 0xF42D },  { 0x0C5A, 0x2932, 0xD6CD, 0xF3A5 },
+    { 0x0CE7, 0x2B08, 0xD4F7, 0xF318 },  { 0x0D7A, 0x2CF4, 0xD30B, 0xF285 },
+    { 0x0E14, 0x2EF4, 0xD10B, 0xF1EB },  { 0x0EB5, 0x310C, 0xCEF3, 0xF14A },
+    { 0x0F5D, 0x333E, 0xCCC1, 0xF0A2 },  { 0x100C, 0x3587, 0xCA78, 0xEFF3 },
+    { 0x10C4, 0x37EB, 0xC814, 0xEF3B },  { 0x1183, 0x3A69, 0xC596, 0xEE7C },
+    { 0x124B, 0x3D05, 0xC2FA, 0xEDB4 },  { 0x131C, 0x3FBE, 0xC041, 0xECE3 },
+    { 0x13F7, 0x4296, 0xBD69, 0xEC08 },  { 0x14DB, 0x458F, 0xBA70, 0xEB24 },
+    { 0x15C9, 0x48AA, 0xB755, 0xEA36 },  { 0x16C2, 0x4BE9, 0xB416, 0xE93D },
+    { 0x17C6, 0x4F4C, 0xB0B3, 0xE839 },  { 0x18D6, 0x52D5, 0xAD2A, 0xE729 },
+    { 0x19F2, 0x5688, 0xA977, 0xE60D },  { 0x1B1A, 0x5A65, 0xA59A, 0xE4E5 },
+    { 0x1C50, 0x5E6D, 0xA192, 0xE3AF },  { 0x1D93, 0x62A4, 0x9D5B, 0xE26C },
+    { 0x1EE5, 0x670C, 0x98F3, 0xE11A },  { 0x2046, 0x6BA5, 0x945A, 0xDFB9 },
+    { 0x21B7, 0x7072, 0x8F8D, 0xDE48 },  { 0x2338, 0x7578, 0x8A87, 0xDCC7 },
+    { 0x24CB, 0x7AB5, 0x854A, 0xDB34 },  { 0x266F, 0x7FFF, 0x8000, 0xD990 },
+    { 0x2826, 0x7FFF, 0x8000, 0xD7D9 },  { 0x29F1, 0x7FFF, 0x8000, 0xD60E },
+    { 0x2BD0, 0x7FFF, 0x8000, 0xD42F },  { 0x2DC5, 0x7FFF, 0x8000, 0xD23A },
+    { 0x2FD0, 0x7FFF, 0x8000, 0xD02F },  { 0x31F2, 0x7FFF, 0x8000, 0xCE0D },
+    { 0x342C, 0x7FFF, 0x8000, 0xCBD3 },  { 0x3681, 0x7FFF, 0x8000, 0xC97E },
+    { 0x38F0, 0x7FFF, 0x8000, 0xC70F },  { 0x3B7A, 0x7FFF, 0x8000, 0xC485 },
+    { 0x3E22, 0x7FFF, 0x8000, 0xC1DD },  { 0x40E7, 0x7FFF, 0x8000, 0xBF18 },
 };
 
 #define QT_8S_2_16S(x) (((x) & 0xFF00) | (((x) >> 8) & 0xFF))
@@ -260,11 +260,12 @@
 
 static void chomp3(ChannelData *ctx, int16_t *output, uint8_t val,
                    const uint16_t tab1[],
-                   const uint16_t tab2[][8], uint32_t numChannels)
+                   const uint16_t *tab2, int tab2_stride,
+                   uint32_t numChannels)
 {
     short current;
 
-    current = (short) tab2[(ctx->index & 0x7f0) >> 4][val];
+    current = (short)tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + val];
 
     current = mace_broken_clip_int16(current + ctx->lev);
 
@@ -276,11 +277,12 @@
 
 static void chomp6(ChannelData *ctx, int16_t *output, uint8_t val,
                    const uint16_t tab1[],
-                   const uint16_t tab2[][8], uint32_t numChannels)
+                   const uint16_t *tab2, int tab2_stride,
+                   uint32_t numChannels)
 {
     short current;
 
-    current = (short)tab2[(ctx->index & 0x7f0) >> 4][val];
+    current = (short)tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + val];
 
     if ((ctx->previous ^ current) >= 0) {
         ctx->factor = FFMIN(ctx->factor + 506, 32767);
@@ -330,13 +332,13 @@
             for (k=0; k < 2; k++) {
                 uint8_t pkt = buf[i*2 + j*2*avctx->channels + k];
                 chomp3(&ctx->chd[i], output, pkt       &7, MACEtab1, MACEtab2,
-                       avctx->channels);
+                       8, avctx->channels);
                 output += avctx->channels;
                 chomp3(&ctx->chd[i], output,(pkt >> 3) &3, MACEtab3, MACEtab4,
-                       avctx->channels);
+                       4, avctx->channels);
                 output += avctx->channels;
                 chomp3(&ctx->chd[i], output, pkt >> 5    , MACEtab1, MACEtab2,
-                       avctx->channels);
+                       8, avctx->channels);
                 output += avctx->channels;
             }
     }
@@ -361,13 +363,13 @@
             uint8_t pkt = buf[i + j*avctx->channels];
 
             chomp6(&ctx->chd[i], output, pkt >> 5     , MACEtab1, MACEtab2,
-                   avctx->channels);
+                   8, avctx->channels);
             output += avctx->channels << 1;
             chomp6(&ctx->chd[i], output,(pkt >> 3) & 3, MACEtab3, MACEtab4,
-                   avctx->channels);
+                   4, avctx->channels);
             output += avctx->channels << 1;
             chomp6(&ctx->chd[i], output, pkt       & 7, MACEtab1, MACEtab2,
-                   avctx->channels);
+                   8, avctx->channels);
             output += avctx->channels << 1;
         }
     }