ref: 542ddb70cb7f23baefda7129370dd4d73a075ba8
parent: 5ad0c0afd4c11aea61e4fb981eca7ebb496929d5
author: menno <menno>
date: Fri May 26 15:21:35 EDT 2006
Fixed stupid SBR downsampled filterbank bug
--- a/libfaad/sbr_dct.c
+++ b/libfaad/sbr_dct.c
@@ -27,7 +27,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_dct.c,v 1.17 2006/05/07 18:09:01 menno Exp $
+** $Id: sbr_dct.c,v 1.18 2006/05/26 19:21:35 menno Exp $
**/
@@ -487,6 +487,413 @@
f397 = MUL_C(COEF_CONST(1.0708550202783576), f300);
y[30] = f395 + f396;
y[1] = f397 - f396;
+}
+
+void DST4_32(real_t *y, real_t *x)
+{
+ real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9;
+ real_t f10, f11, f12, f13, f14, f15, f16, f17, f18, f19;
+ real_t f20, f21, f22, f23, f24, f25, f26, f27, f28, f29;
+ real_t f30, f31, f32, f33, f34, f35, f36, f37, f38, f39;
+ real_t f40, f41, f42, f43, f44, f45, f46, f47, f48, f49;
+ real_t f50, f51, f52, f53, f54, f55, f56, f57, f58, f59;
+ real_t f60, f61, f62, f63, f64, f65, f66, f67, f68, f69;
+ real_t f70, f71, f72, f73, f74, f75, f76, f77, f78, f79;
+ real_t f80, f81, f82, f83, f84, f85, f86, f87, f88, f89;
+ real_t f90, f91, f92, f93, f94, f95, f96, f97, f98, f99;
+ real_t f100, f101, f102, f103, f104, f105, f106, f107, f108, f109;
+ real_t f110, f111, f112, f113, f114, f115, f116, f117, f118, f119;
+ real_t f120, f121, f122, f123, f124, f125, f126, f127, f128, f129;
+ real_t f130, f131, f132, f133, f134, f135, f136, f137, f138, f139;
+ real_t f140, f141, f142, f143, f144, f145, f146, f147, f148, f149;
+ real_t f150, f151, f152, f153, f154, f155, f156, f157, f158, f159;
+ real_t f160, f161, f162, f163, f164, f165, f166, f167, f168, f169;
+ real_t f170, f171, f172, f173, f174, f175, f176, f177, f178, f179;
+ real_t f180, f181, f182, f183, f184, f185, f186, f187, f188, f189;
+ real_t f190, f191, f192, f193, f194, f195, f196, f197, f198, f199;
+ real_t f200, f201, f202, f203, f204, f205, f206, f207, f208, f209;
+ real_t f210, f211, f212, f213, f214, f215, f216, f217, f218, f219;
+ real_t f220, f221, f222, f223, f224, f225, f226, f227, f228, f229;
+ real_t f230, f231, f232, f233, f234, f235, f236, f237, f238, f239;
+ real_t f240, f241, f242, f243, f244, f245, f246, f247, f248, f249;
+ real_t f250, f251, f252, f253, f254, f255, f256, f257, f258, f259;
+ real_t f260, f261, f262, f263, f264, f265, f266, f267, f268, f269;
+ real_t f270, f271, f272, f273, f274, f275, f276, f277, f278, f279;
+ real_t f280, f281, f282, f283, f284, f285, f286, f287, f288, f289;
+ real_t f290, f291, f292, f293, f294, f295, f296, f297, f298, f299;
+ real_t f300, f301, f302, f303, f304, f305, f306, f307, f308, f309;
+ real_t f310, f311, f312, f313, f314, f315, f316, f317, f318, f319;
+ real_t f320, f321, f322, f323, f324, f325, f326, f327, f328, f329;
+ real_t f330, f331, f332, f333, f334, f335;
+
+ f0 = x[0] - x[1];
+ f1 = x[2] - x[1];
+ f2 = x[2] - x[3];
+ f3 = x[4] - x[3];
+ f4 = x[4] - x[5];
+ f5 = x[6] - x[5];
+ f6 = x[6] - x[7];
+ f7 = x[8] - x[7];
+ f8 = x[8] - x[9];
+ f9 = x[10] - x[9];
+ f10 = x[10] - x[11];
+ f11 = x[12] - x[11];
+ f12 = x[12] - x[13];
+ f13 = x[14] - x[13];
+ f14 = x[14] - x[15];
+ f15 = x[16] - x[15];
+ f16 = x[16] - x[17];
+ f17 = x[18] - x[17];
+ f18 = x[18] - x[19];
+ f19 = x[20] - x[19];
+ f20 = x[20] - x[21];
+ f21 = x[22] - x[21];
+ f22 = x[22] - x[23];
+ f23 = x[24] - x[23];
+ f24 = x[24] - x[25];
+ f25 = x[26] - x[25];
+ f26 = x[26] - x[27];
+ f27 = x[28] - x[27];
+ f28 = x[28] - x[29];
+ f29 = x[30] - x[29];
+ f30 = x[30] - x[31];
+ f31 = MUL_F(FRAC_CONST(0.7071067811865476), f15);
+ f32 = x[0] - f31;
+ f33 = x[0] + f31;
+ f34 = f7 + f23;
+ f35 = MUL_C(COEF_CONST(1.3065629648763766), f7);
+ f36 = MUL_F(FRAC_CONST(-0.9238795325112866), f34);
+ f37 = MUL_F(FRAC_CONST(-0.5411961001461967), f23);
+ f38 = f35 + f36;
+ f39 = f37 - f36;
+ f40 = f33 - f39;
+ f41 = f33 + f39;
+ f42 = f32 - f38;
+ f43 = f32 + f38;
+ f44 = f11 - f19;
+ f45 = f11 + f19;
+ f46 = MUL_F(FRAC_CONST(0.7071067811865476), f45);
+ f47 = f3 - f46;
+ f48 = f3 + f46;
+ f49 = MUL_F(FRAC_CONST(0.7071067811865476), f44);
+ f50 = f49 - f27;
+ f51 = f49 + f27;
+ f52 = f51 + f48;
+ f53 = MUL_F(FRAC_CONST(-0.7856949583871021), f51);
+ f54 = MUL_F(FRAC_CONST(0.9807852804032304), f52);
+ f55 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+ f56 = f53 + f54;
+ f57 = f55 - f54;
+ f58 = f50 + f47;
+ f59 = MUL_F(FRAC_CONST(-0.2758993792829430), f50);
+ f60 = MUL_F(FRAC_CONST(0.8314696123025452), f58);
+ f61 = MUL_C(COEF_CONST(1.3870398453221475), f47);
+ f62 = f59 + f60;
+ f63 = f61 - f60;
+ f64 = f41 - f56;
+ f65 = f41 + f56;
+ f66 = f43 - f62;
+ f67 = f43 + f62;
+ f68 = f42 - f63;
+ f69 = f42 + f63;
+ f70 = f40 - f57;
+ f71 = f40 + f57;
+ f72 = f5 - f9;
+ f73 = f5 + f9;
+ f74 = f13 - f17;
+ f75 = f13 + f17;
+ f76 = f21 - f25;
+ f77 = f21 + f25;
+ f78 = MUL_F(FRAC_CONST(0.7071067811865476), f75);
+ f79 = f1 - f78;
+ f80 = f1 + f78;
+ f81 = f73 + f77;
+ f82 = MUL_C(COEF_CONST(1.3065629648763766), f73);
+ f83 = MUL_F(FRAC_CONST(-0.9238795325112866), f81);
+ f84 = MUL_F(FRAC_CONST(-0.5411961001461967), f77);
+ f85 = f82 + f83;
+ f86 = f84 - f83;
+ f87 = f80 - f86;
+ f88 = f80 + f86;
+ f89 = f79 - f85;
+ f90 = f79 + f85;
+ f91 = MUL_F(FRAC_CONST(0.7071067811865476), f74);
+ f92 = f29 - f91;
+ f93 = f29 + f91;
+ f94 = f76 + f72;
+ f95 = MUL_C(COEF_CONST(1.3065629648763766), f76);
+ f96 = MUL_F(FRAC_CONST(-0.9238795325112866), f94);
+ f97 = MUL_F(FRAC_CONST(-0.5411961001461967), f72);
+ f98 = f95 + f96;
+ f99 = f97 - f96;
+ f100 = f93 - f99;
+ f101 = f93 + f99;
+ f102 = f92 - f98;
+ f103 = f92 + f98;
+ f104 = f101 + f88;
+ f105 = MUL_F(FRAC_CONST(-0.8971675863426361), f101);
+ f106 = MUL_F(FRAC_CONST(0.9951847266721968), f104);
+ f107 = MUL_C(COEF_CONST(1.0932018670017576), f88);
+ f108 = f105 + f106;
+ f109 = f107 - f106;
+ f110 = f90 - f103;
+ f111 = MUL_F(FRAC_CONST(-0.6666556584777466), f103);
+ f112 = MUL_F(FRAC_CONST(0.9569403357322089), f110);
+ f113 = MUL_C(COEF_CONST(1.2472250129866713), f90);
+ f114 = f112 - f111;
+ f115 = f113 - f112;
+ f116 = f102 + f89;
+ f117 = MUL_F(FRAC_CONST(-0.4105245275223571), f102);
+ f118 = MUL_F(FRAC_CONST(0.8819212643483549), f116);
+ f119 = MUL_C(COEF_CONST(1.3533180011743529), f89);
+ f120 = f117 + f118;
+ f121 = f119 - f118;
+ f122 = f87 - f100;
+ f123 = MUL_F(FRAC_CONST(-0.1386171691990915), f100);
+ f124 = MUL_F(FRAC_CONST(0.7730104533627370), f122);
+ f125 = MUL_C(COEF_CONST(1.4074037375263826), f87);
+ f126 = f124 - f123;
+ f127 = f125 - f124;
+ f128 = f65 - f108;
+ f129 = f65 + f108;
+ f130 = f67 - f114;
+ f131 = f67 + f114;
+ f132 = f69 - f120;
+ f133 = f69 + f120;
+ f134 = f71 - f126;
+ f135 = f71 + f126;
+ f136 = f70 - f127;
+ f137 = f70 + f127;
+ f138 = f68 - f121;
+ f139 = f68 + f121;
+ f140 = f66 - f115;
+ f141 = f66 + f115;
+ f142 = f64 - f109;
+ f143 = f64 + f109;
+ f144 = f0 + f30;
+ f145 = MUL_C(COEF_CONST(1.0478631305325901), f0);
+ f146 = MUL_F(FRAC_CONST(-0.9987954562051724), f144);
+ f147 = MUL_F(FRAC_CONST(-0.9497277818777548), f30);
+ f148 = f145 + f146;
+ f149 = f147 - f146;
+ f150 = f4 + f26;
+ f151 = MUL_F(FRAC_CONST(1.2130114330978077), f4);
+ f152 = MUL_F(FRAC_CONST(-0.9700312531945440), f150);
+ f153 = MUL_F(FRAC_CONST(-0.7270510732912803), f26);
+ f154 = f151 + f152;
+ f155 = f153 - f152;
+ f156 = f8 + f22;
+ f157 = MUL_C(COEF_CONST(1.3315443865537255), f8);
+ f158 = MUL_F(FRAC_CONST(-0.9039892931234433), f156);
+ f159 = MUL_F(FRAC_CONST(-0.4764341996931612), f22);
+ f160 = f157 + f158;
+ f161 = f159 - f158;
+ f162 = f12 + f18;
+ f163 = MUL_C(COEF_CONST(1.3989068359730781), f12);
+ f164 = MUL_F(FRAC_CONST(-0.8032075314806453), f162);
+ f165 = MUL_F(FRAC_CONST(-0.2075082269882124), f18);
+ f166 = f163 + f164;
+ f167 = f165 - f164;
+ f168 = f16 + f14;
+ f169 = MUL_C(COEF_CONST(1.4125100802019777), f16);
+ f170 = MUL_F(FRAC_CONST(-0.6715589548470187), f168);
+ f171 = MUL_F(FRAC_CONST(0.0693921705079402), f14);
+ f172 = f169 + f170;
+ f173 = f171 - f170;
+ f174 = f20 + f10;
+ f175 = MUL_C(COEF_CONST(1.3718313541934939), f20);
+ f176 = MUL_F(FRAC_CONST(-0.5141027441932219), f174);
+ f177 = MUL_F(FRAC_CONST(0.3436258658070501), f10);
+ f178 = f175 + f176;
+ f179 = f177 - f176;
+ f180 = f24 + f6;
+ f181 = MUL_C(COEF_CONST(1.2784339185752409), f24);
+ f182 = MUL_F(FRAC_CONST(-0.3368898533922200), f180);
+ f183 = MUL_F(FRAC_CONST(0.6046542117908008), f6);
+ f184 = f181 + f182;
+ f185 = f183 - f182;
+ f186 = f28 + f2;
+ f187 = MUL_C(COEF_CONST(1.1359069844201433), f28);
+ f188 = MUL_F(FRAC_CONST(-0.1467304744553624), f186);
+ f189 = MUL_F(FRAC_CONST(0.8424460355094185), f2);
+ f190 = f187 + f188;
+ f191 = f189 - f188;
+ f192 = f149 - f173;
+ f193 = f149 + f173;
+ f194 = f148 - f172;
+ f195 = f148 + f172;
+ f196 = f155 - f179;
+ f197 = f155 + f179;
+ f198 = f154 - f178;
+ f199 = f154 + f178;
+ f200 = f161 - f185;
+ f201 = f161 + f185;
+ f202 = f160 - f184;
+ f203 = f160 + f184;
+ f204 = f167 - f191;
+ f205 = f167 + f191;
+ f206 = f166 - f190;
+ f207 = f166 + f190;
+ f208 = f192 + f194;
+ f209 = MUL_C(COEF_CONST(1.1758756024193588), f192);
+ f210 = MUL_F(FRAC_CONST(-0.9807852804032304), f208);
+ f211 = MUL_F(FRAC_CONST(-0.7856949583871021), f194);
+ f212 = f209 + f210;
+ f213 = f211 - f210;
+ f214 = f196 + f198;
+ f215 = MUL_C(COEF_CONST(1.3870398453221475), f196);
+ f216 = MUL_F(FRAC_CONST(-0.5555702330196022), f214);
+ f217 = MUL_F(FRAC_CONST(0.2758993792829431), f198);
+ f218 = f215 + f216;
+ f219 = f217 - f216;
+ f220 = f200 + f202;
+ f221 = MUL_F(FRAC_CONST(0.7856949583871022), f200);
+ f222 = MUL_F(FRAC_CONST(0.1950903220161283), f220);
+ f223 = MUL_C(COEF_CONST(1.1758756024193586), f202);
+ f224 = f221 + f222;
+ f225 = f223 - f222;
+ f226 = f204 + f206;
+ f227 = MUL_F(FRAC_CONST(-0.2758993792829430), f204);
+ f228 = MUL_F(FRAC_CONST(0.8314696123025452), f226);
+ f229 = MUL_C(COEF_CONST(1.3870398453221475), f206);
+ f230 = f227 + f228;
+ f231 = f229 - f228;
+ f232 = f193 - f201;
+ f233 = f193 + f201;
+ f234 = f195 - f203;
+ f235 = f195 + f203;
+ f236 = f197 - f205;
+ f237 = f197 + f205;
+ f238 = f199 - f207;
+ f239 = f199 + f207;
+ f240 = f213 - f225;
+ f241 = f213 + f225;
+ f242 = f212 - f224;
+ f243 = f212 + f224;
+ f244 = f219 - f231;
+ f245 = f219 + f231;
+ f246 = f218 - f230;
+ f247 = f218 + f230;
+ f248 = f232 + f234;
+ f249 = MUL_C(COEF_CONST(1.3065629648763766), f232);
+ f250 = MUL_F(FRAC_CONST(-0.9238795325112866), f248);
+ f251 = MUL_F(FRAC_CONST(-0.5411961001461967), f234);
+ f252 = f249 + f250;
+ f253 = f251 - f250;
+ f254 = f236 + f238;
+ f255 = MUL_F(FRAC_CONST(0.5411961001461969), f236);
+ f256 = MUL_F(FRAC_CONST(0.3826834323650898), f254);
+ f257 = MUL_C(COEF_CONST(1.3065629648763766), f238);
+ f258 = f255 + f256;
+ f259 = f257 - f256;
+ f260 = f240 + f242;
+ f261 = MUL_C(COEF_CONST(1.3065629648763766), f240);
+ f262 = MUL_F(FRAC_CONST(-0.9238795325112866), f260);
+ f263 = MUL_F(FRAC_CONST(-0.5411961001461967), f242);
+ f264 = f261 + f262;
+ f265 = f263 - f262;
+ f266 = f244 + f246;
+ f267 = MUL_F(FRAC_CONST(0.5411961001461969), f244);
+ f268 = MUL_F(FRAC_CONST(0.3826834323650898), f266);
+ f269 = MUL_C(COEF_CONST(1.3065629648763766), f246);
+ f270 = f267 + f268;
+ f271 = f269 - f268;
+ f272 = f233 - f237;
+ f273 = f233 + f237;
+ f274 = f235 - f239;
+ f275 = f235 + f239;
+ f276 = f253 - f259;
+ f277 = f253 + f259;
+ f278 = f252 - f258;
+ f279 = f252 + f258;
+ f280 = f241 - f245;
+ f281 = f241 + f245;
+ f282 = f243 - f247;
+ f283 = f243 + f247;
+ f284 = f265 - f271;
+ f285 = f265 + f271;
+ f286 = f264 - f270;
+ f287 = f264 + f270;
+ f288 = f272 - f274;
+ f289 = f272 + f274;
+ f290 = MUL_F(FRAC_CONST(0.7071067811865474), f288);
+ f291 = MUL_F(FRAC_CONST(0.7071067811865474), f289);
+ f292 = f276 - f278;
+ f293 = f276 + f278;
+ f294 = MUL_F(FRAC_CONST(0.7071067811865474), f292);
+ f295 = MUL_F(FRAC_CONST(0.7071067811865474), f293);
+ f296 = f280 - f282;
+ f297 = f280 + f282;
+ f298 = MUL_F(FRAC_CONST(0.7071067811865474), f296);
+ f299 = MUL_F(FRAC_CONST(0.7071067811865474), f297);
+ f300 = f284 - f286;
+ f301 = f284 + f286;
+ f302 = MUL_F(FRAC_CONST(0.7071067811865474), f300);
+ f303 = MUL_F(FRAC_CONST(0.7071067811865474), f301);
+ f304 = f129 - f273;
+ f305 = f129 + f273;
+ f306 = f131 - f281;
+ f307 = f131 + f281;
+ f308 = f133 - f285;
+ f309 = f133 + f285;
+ f310 = f135 - f277;
+ f311 = f135 + f277;
+ f312 = f137 - f295;
+ f313 = f137 + f295;
+ f314 = f139 - f303;
+ f315 = f139 + f303;
+ f316 = f141 - f299;
+ f317 = f141 + f299;
+ f318 = f143 - f291;
+ f319 = f143 + f291;
+ f320 = f142 - f290;
+ f321 = f142 + f290;
+ f322 = f140 - f298;
+ f323 = f140 + f298;
+ f324 = f138 - f302;
+ f325 = f138 + f302;
+ f326 = f136 - f294;
+ f327 = f136 + f294;
+ f328 = f134 - f279;
+ f329 = f134 + f279;
+ f330 = f132 - f287;
+ f331 = f132 + f287;
+ f332 = f130 - f283;
+ f333 = f130 + f283;
+ f334 = f128 - f275;
+ f335 = f128 + f275;
+ y[31] = MUL_F(FRAC_CONST(0.5001506360206510), f305);
+ y[30] = MUL_F(FRAC_CONST(0.5013584524464084), f307);
+ y[29] = MUL_F(FRAC_CONST(0.5037887256810443), f309);
+ y[28] = MUL_F(FRAC_CONST(0.5074711720725553), f311);
+ y[27] = MUL_F(FRAC_CONST(0.5124514794082247), f313);
+ y[26] = MUL_F(FRAC_CONST(0.5187927131053328), f315);
+ y[25] = MUL_F(FRAC_CONST(0.5265773151542700), f317);
+ y[24] = MUL_F(FRAC_CONST(0.5359098169079920), f319);
+ y[23] = MUL_F(FRAC_CONST(0.5469204379855088), f321);
+ y[22] = MUL_F(FRAC_CONST(0.5597698129470802), f323);
+ y[21] = MUL_F(FRAC_CONST(0.5746551840326600), f325);
+ y[20] = MUL_F(FRAC_CONST(0.5918185358574165), f327);
+ y[19] = MUL_F(FRAC_CONST(0.6115573478825099), f329);
+ y[18] = MUL_F(FRAC_CONST(0.6342389366884031), f331);
+ y[17] = MUL_F(FRAC_CONST(0.6603198078137061), f333);
+ y[16] = MUL_F(FRAC_CONST(0.6903721282002123), f335);
+ y[15] = MUL_F(FRAC_CONST(0.7251205223771985), f334);
+ y[14] = MUL_F(FRAC_CONST(0.7654941649730891), f332);
+ y[13] = MUL_F(FRAC_CONST(0.8127020908144905), f330);
+ y[12] = MUL_F(FRAC_CONST(0.8683447152233481), f328);
+ y[11] = MUL_F(FRAC_CONST(0.9345835970364075), f326);
+ y[10] = MUL_C(COEF_CONST(1.0144082649970547), f324);
+ y[9] = MUL_C(COEF_CONST(1.1120716205797176), f322);
+ y[8] = MUL_C(COEF_CONST(1.2338327379765710), f320);
+ y[7] = MUL_C(COEF_CONST(1.3892939586328277), f318);
+ y[6] = MUL_C(COEF_CONST(1.5939722833856311), f316);
+ y[5] = MUL_C(COEF_CONST(1.8746759800084078), f314);
+ y[4] = MUL_C(COEF_CONST(2.2820500680051619), f312);
+ y[3] = MUL_C(COEF_CONST(2.9246284281582162), f310);
+ y[2] = MUL_C(COEF_CONST(4.0846110781292477), f308);
+ y[1] = MUL_C(COEF_CONST(6.7967507116736332), f306);
+ y[0] = MUL_R(REAL_CONST(20.3738781672314530), f304);
}
#ifdef SBR_LOW_POWER
--- a/libfaad/sbr_qmf.c
+++ b/libfaad/sbr_qmf.c
@@ -27,7 +27,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_qmf.c,v 1.29 2006/05/07 18:09:02 menno Exp $
+** $Id: sbr_qmf.c,v 1.30 2006/05/26 19:21:35 menno Exp $
**/
#include "common.h"
@@ -413,20 +413,20 @@
for (k = 0; k < 32; k++)
{
x1[k] = MUL_F(QMF_RE(X[l][k]), RE(qmf32_pre_twiddle[k])) - MUL_F(QMF_IM(X[l][k]), IM(qmf32_pre_twiddle[k]));
- x2[31-k] = MUL_F(QMF_IM(X[l][k]), RE(qmf32_pre_twiddle[k])) + MUL_F(QMF_RE(X[l][k]), IM(qmf32_pre_twiddle[k]));
+ x2[k] = MUL_F(QMF_IM(X[l][k]), RE(qmf32_pre_twiddle[k])) + MUL_F(QMF_RE(X[l][k]), IM(qmf32_pre_twiddle[k]));
#ifndef FIXED_POINT
x1[k] *= scale;
- x2[31-k] *= scale;
+ x2[k] *= scale;
#else
x1[k] >>= 1;
- x2[31-k] >>= 1;
+ x2[k] >>= 1;
#endif
}
/* transform */
DCT4_32(x1, x1);
- DCT4_32(x2, x2);
+ DST4_32(x2, x2);
for (n = 0; n < 32; n++)
{