winamp/Src/vlb/imdct.cpp

876 lines
39 KiB
C++

/* $Header: /cvs/root/winamp/vlb/imdct.cpp,v 1.2 2011/06/13 02:06:03 audiodsp Exp $ */
/***************************************************************************\
*
* Copyright 2000-2002 Dolby Laboratories, Inc. All Rights
* Reserved. Do not copy. Do not distribute.
* Confidential information.
*
* (C) copyright Fraunhofer - IIS (1998)
* All Rights Reserved
*
* filename: imdct.cpp
* project : MPEG-2 AAC Decoder
* contents/description: inverse modified discrete cosine transform
*
\***************************************************************************/
#include "block.h"
static const float CosTable_2048 [2048] =
{
0.500000F, 0.500001F, 0.500004F, 0.500007F, 0.500012F, 0.500018F, 0.500025F, 0.500033F,
0.500043F, 0.500053F, 0.500065F, 0.500078F, 0.500092F, 0.500107F, 0.500124F, 0.500141F,
0.500160F, 0.500180F, 0.500201F, 0.500224F, 0.500247F, 0.500272F, 0.500298F, 0.500325F,
0.500353F, 0.500383F, 0.500413F, 0.500445F, 0.500478F, 0.500512F, 0.500548F, 0.500584F,
0.500622F, 0.500661F, 0.500701F, 0.500742F, 0.500785F, 0.500828F, 0.500873F, 0.500919F,
0.500966F, 0.501015F, 0.501064F, 0.501115F, 0.501167F, 0.501220F, 0.501275F, 0.501330F,
0.501387F, 0.501445F, 0.501504F, 0.501564F, 0.501626F, 0.501689F, 0.501752F, 0.501818F,
0.501884F, 0.501951F, 0.502020F, 0.502090F, 0.502161F, 0.502233F, 0.502307F, 0.502381F,
0.502457F, 0.502535F, 0.502613F, 0.502692F, 0.502773F, 0.502855F, 0.502938F, 0.503023F,
0.503108F, 0.503195F, 0.503283F, 0.503372F, 0.503463F, 0.503554F, 0.503647F, 0.503741F,
0.503837F, 0.503933F, 0.504031F, 0.504130F, 0.504230F, 0.504331F, 0.504434F, 0.504538F,
0.504643F, 0.504750F, 0.504857F, 0.504966F, 0.505076F, 0.505187F, 0.505300F, 0.505414F,
0.505529F, 0.505645F, 0.505762F, 0.505881F, 0.506001F, 0.506122F, 0.506245F, 0.506369F,
0.506494F, 0.506620F, 0.506747F, 0.506876F, 0.507006F, 0.507137F, 0.507270F, 0.507404F,
0.507539F, 0.507675F, 0.507813F, 0.507952F, 0.508092F, 0.508233F, 0.508376F, 0.508520F,
0.508665F, 0.508812F, 0.508960F, 0.509109F, 0.509259F, 0.509411F, 0.509564F, 0.509718F,
0.509874F, 0.510030F, 0.510189F, 0.510348F, 0.510509F, 0.510671F, 0.510834F, 0.510999F,
0.511165F, 0.511332F, 0.511501F, 0.511671F, 0.511842F, 0.512014F, 0.512188F, 0.512363F,
0.512540F, 0.512718F, 0.512897F, 0.513077F, 0.513259F, 0.513442F, 0.513627F, 0.513813F,
0.514000F, 0.514189F, 0.514379F, 0.514570F, 0.514762F, 0.514956F, 0.515152F, 0.515348F,
0.515547F, 0.515746F, 0.515947F, 0.516149F, 0.516352F, 0.516557F, 0.516764F, 0.516971F,
0.517180F, 0.517391F, 0.517603F, 0.517816F, 0.518031F, 0.518247F, 0.518464F, 0.518683F,
0.518903F, 0.519125F, 0.519348F, 0.519572F, 0.519798F, 0.520025F, 0.520254F, 0.520484F,
0.520716F, 0.520949F, 0.521183F, 0.521419F, 0.521657F, 0.521895F, 0.522136F, 0.522377F,
0.522620F, 0.522865F, 0.523111F, 0.523359F, 0.523608F, 0.523858F, 0.524110F, 0.524363F,
0.524618F, 0.524875F, 0.525132F, 0.525392F, 0.525653F, 0.525915F, 0.526179F, 0.526444F,
0.526711F, 0.526979F, 0.527249F, 0.527521F, 0.527793F, 0.528068F, 0.528344F, 0.528621F,
0.528900F, 0.529181F, 0.529463F, 0.529747F, 0.530032F, 0.530319F, 0.530607F, 0.530897F,
0.531189F, 0.531482F, 0.531776F, 0.532072F, 0.532370F, 0.532670F, 0.532970F, 0.533273F,
0.533577F, 0.533883F, 0.534190F, 0.534499F, 0.534810F, 0.535122F, 0.535436F, 0.535751F,
0.536069F, 0.536387F, 0.536708F, 0.537030F, 0.537353F, 0.537679F, 0.538006F, 0.538334F,
0.538665F, 0.538997F, 0.539331F, 0.539666F, 0.540003F, 0.540342F, 0.540682F, 0.541024F,
0.541368F, 0.541714F, 0.542061F, 0.542410F, 0.542761F, 0.543113F, 0.543468F, 0.543824F,
0.544181F, 0.544541F, 0.544902F, 0.545265F, 0.545630F, 0.545996F, 0.546365F, 0.546735F,
0.547107F, 0.547480F, 0.547856F, 0.548233F, 0.548612F, 0.548993F, 0.549376F, 0.549760F,
0.550147F, 0.550535F, 0.550925F, 0.551317F, 0.551711F, 0.552107F, 0.552504F, 0.552903F,
0.553305F, 0.553708F, 0.554113F, 0.554520F, 0.554929F, 0.555340F, 0.555752F, 0.556167F,
0.556584F, 0.557002F, 0.557422F, 0.557845F, 0.558269F, 0.558695F, 0.559124F, 0.559554F,
0.559986F, 0.560420F, 0.560857F, 0.561295F, 0.561735F, 0.562177F, 0.562621F, 0.563068F,
0.563516F, 0.563966F, 0.564419F, 0.564873F, 0.565330F, 0.565788F, 0.566249F, 0.566712F,
0.567177F, 0.567644F, 0.568113F, 0.568584F, 0.569057F, 0.569533F, 0.570010F, 0.570490F,
0.570972F, 0.571456F, 0.571942F, 0.572430F, 0.572921F, 0.573414F, 0.573909F, 0.574406F,
0.574905F, 0.575407F, 0.575911F, 0.576417F, 0.576925F, 0.577436F, 0.577948F, 0.578463F,
0.578981F, 0.579501F, 0.580023F, 0.580547F, 0.581073F, 0.581602F, 0.582134F, 0.582667F,
0.583203F, 0.583742F, 0.584282F, 0.584825F, 0.585371F, 0.585919F, 0.586469F, 0.587022F,
0.587577F, 0.588134F, 0.588694F, 0.589257F, 0.589822F, 0.590389F, 0.590959F, 0.591531F,
0.592106F, 0.592684F, 0.593264F, 0.593846F, 0.594431F, 0.595019F, 0.595609F, 0.596201F,
0.596797F, 0.597395F, 0.597995F, 0.598598F, 0.599204F, 0.599812F, 0.600423F, 0.601037F,
0.601653F, 0.602272F, 0.602894F, 0.603519F, 0.604146F, 0.604776F, 0.605408F, 0.606044F,
0.606682F, 0.607323F, 0.607967F, 0.608613F, 0.609262F, 0.609915F, 0.610570F, 0.611227F,
0.611888F, 0.612552F, 0.613218F, 0.613887F, 0.614560F, 0.615235F, 0.615913F, 0.616594F,
0.617278F, 0.617965F, 0.618655F, 0.619348F, 0.620044F, 0.620743F, 0.621445F, 0.622150F,
0.622859F, 0.623570F, 0.624284F, 0.625002F, 0.625722F, 0.626446F, 0.627173F, 0.627903F,
0.628636F, 0.629373F, 0.630113F, 0.630856F, 0.631602F, 0.632351F, 0.633104F, 0.633860F,
0.634619F, 0.635382F, 0.636147F, 0.636917F, 0.637689F, 0.638465F, 0.639245F, 0.640028F,
0.640814F, 0.641604F, 0.642397F, 0.643193F, 0.643994F, 0.644797F, 0.645604F, 0.646415F,
0.647229F, 0.648047F, 0.648869F, 0.649694F, 0.650523F, 0.651355F, 0.652191F, 0.653031F,
0.653874F, 0.654721F, 0.655572F, 0.656427F, 0.657285F, 0.658147F, 0.659014F, 0.659883F,
0.660757F, 0.661635F, 0.662516F, 0.663402F, 0.664291F, 0.665184F, 0.666082F, 0.666983F,
0.667888F, 0.668798F, 0.669711F, 0.670629F, 0.671550F, 0.672476F, 0.673406F, 0.674340F,
0.675278F, 0.676220F, 0.677167F, 0.678118F, 0.679073F, 0.680033F, 0.680996F, 0.681964F,
0.682937F, 0.683914F, 0.684895F, 0.685881F, 0.686871F, 0.687866F, 0.688865F, 0.689869F,
0.690877F, 0.691890F, 0.692907F, 0.693929F, 0.694956F, 0.695987F, 0.697024F, 0.698064F,
0.699110F, 0.700160F, 0.701216F, 0.702276F, 0.703341F, 0.704411F, 0.705485F, 0.706565F,
0.707650F, 0.708739F, 0.709834F, 0.710934F, 0.712039F, 0.713149F, 0.714264F, 0.715384F,
0.716510F, 0.717641F, 0.718777F, 0.719918F, 0.721065F, 0.722217F, 0.723374F, 0.724537F,
0.725705F, 0.726879F, 0.728058F, 0.729243F, 0.730434F, 0.731630F, 0.732832F, 0.734039F,
0.735252F, 0.736471F, 0.737696F, 0.738926F, 0.740162F, 0.741405F, 0.742653F, 0.743907F,
0.745167F, 0.746433F, 0.747705F, 0.748984F, 0.750268F, 0.751559F, 0.752856F, 0.754159F,
0.755468F, 0.756784F, 0.758106F, 0.759435F, 0.760770F, 0.762112F, 0.763460F, 0.764814F,
0.766176F, 0.767544F, 0.768918F, 0.770300F, 0.771688F, 0.773083F, 0.774485F, 0.775894F,
0.777309F, 0.778732F, 0.780162F, 0.781599F, 0.783043F, 0.784495F, 0.785953F, 0.787419F,
0.788892F, 0.790373F, 0.791861F, 0.793356F, 0.794859F, 0.796370F, 0.797888F, 0.799414F,
0.800948F, 0.802489F, 0.804038F, 0.805596F, 0.807161F, 0.808734F, 0.810315F, 0.811904F,
0.813502F, 0.815108F, 0.816721F, 0.818344F, 0.819974F, 0.821614F, 0.823261F, 0.824917F,
0.826582F, 0.828256F, 0.829938F, 0.831629F, 0.833329F, 0.835038F, 0.836756F, 0.838483F,
0.840219F, 0.841964F, 0.843719F, 0.845482F, 0.847256F, 0.849038F, 0.850830F, 0.852632F,
0.854444F, 0.856265F, 0.858096F, 0.859937F, 0.861788F, 0.863648F, 0.865519F, 0.867400F,
0.869292F, 0.871193F, 0.873105F, 0.875028F, 0.876961F, 0.878905F, 0.880859F, 0.882824F,
0.884800F, 0.886787F, 0.888786F, 0.890795F, 0.892815F, 0.894847F, 0.896890F, 0.898945F,
0.901011F, 0.903089F, 0.905178F, 0.907279F, 0.909393F, 0.911518F, 0.913655F, 0.915805F,
0.917967F, 0.920141F, 0.922328F, 0.924528F, 0.926740F, 0.928965F, 0.931202F, 0.933453F,
0.935717F, 0.937994F, 0.940285F, 0.942589F, 0.944906F, 0.947238F, 0.949582F, 0.951941F,
0.954314F, 0.956701F, 0.959102F, 0.961518F, 0.963948F, 0.966392F, 0.968851F, 0.971326F,
0.973815F, 0.976319F, 0.978838F, 0.981373F, 0.983923F, 0.986489F, 0.989071F, 0.991668F,
0.994282F, 0.996911F, 0.999557F, 1.002220F, 1.004899F, 1.007595F, 1.010307F, 1.013037F,
1.015784F, 1.018548F, 1.021330F, 1.024129F, 1.026946F, 1.029781F, 1.032635F, 1.035506F,
1.038396F, 1.041305F, 1.044233F, 1.047179F, 1.050145F, 1.053130F, 1.056134F, 1.059158F,
1.062202F, 1.065266F, 1.068351F, 1.071455F, 1.074581F, 1.077727F, 1.080894F, 1.084083F,
1.087293F, 1.090524F, 1.093778F, 1.097053F, 1.100351F, 1.103671F, 1.107014F, 1.110380F,
1.113769F, 1.117181F, 1.120618F, 1.124077F, 1.127561F, 1.131070F, 1.134603F, 1.138160F,
1.141743F, 1.145351F, 1.148985F, 1.152645F, 1.156330F, 1.160042F, 1.163781F, 1.167547F,
1.171340F, 1.175160F, 1.179008F, 1.182885F, 1.186789F, 1.190723F, 1.194685F, 1.198676F,
1.202698F, 1.206749F, 1.210830F, 1.214942F, 1.219085F, 1.223259F, 1.227464F, 1.231702F,
1.235972F, 1.240274F, 1.244610F, 1.248978F, 1.253381F, 1.257818F, 1.262289F, 1.266795F,
1.271336F, 1.275913F, 1.280526F, 1.285176F, 1.289863F, 1.294587F, 1.299348F, 1.304148F,
1.308987F, 1.313865F, 1.318782F, 1.323740F, 1.328738F, 1.333777F, 1.338858F, 1.343980F,
1.349146F, 1.354354F, 1.359606F, 1.364902F, 1.370242F, 1.375628F, 1.381060F, 1.386537F,
1.392062F, 1.397635F, 1.403255F, 1.408924F, 1.414643F, 1.420411F, 1.426230F, 1.432101F,
1.438023F, 1.443998F, 1.450026F, 1.456108F, 1.462245F, 1.468437F, 1.474685F, 1.480990F,
1.487353F, 1.493775F, 1.500255F, 1.506796F, 1.513397F, 1.520061F, 1.526786F, 1.533575F,
1.540429F, 1.547348F, 1.554332F, 1.561384F, 1.568504F, 1.575692F, 1.582951F, 1.590281F,
1.597682F, 1.605157F, 1.612705F, 1.620329F, 1.628029F, 1.635807F, 1.643663F, 1.651598F,
1.659615F, 1.667714F, 1.675896F, 1.684163F, 1.692516F, 1.700956F, 1.709485F, 1.718104F,
1.726814F, 1.735617F, 1.744514F, 1.753508F, 1.762598F, 1.771788F, 1.781078F, 1.790470F,
1.799966F, 1.809568F, 1.819277F, 1.829095F, 1.839024F, 1.849066F, 1.859222F, 1.869495F,
1.879887F, 1.890399F, 1.901034F, 1.911794F, 1.922681F, 1.933697F, 1.944844F, 1.956126F,
1.967544F, 1.979101F, 1.990799F, 2.002640F, 2.014629F, 2.026766F, 2.039056F, 2.051500F,
2.064102F, 2.076865F, 2.089791F, 2.102884F, 2.116148F, 2.129585F, 2.143198F, 2.156992F,
2.170970F, 2.185135F, 2.199492F, 2.214044F, 2.228794F, 2.243748F, 2.258910F, 2.274283F,
2.289872F, 2.305682F, 2.321717F, 2.337982F, 2.354483F, 2.371223F, 2.388209F, 2.405446F,
2.422939F, 2.440694F, 2.458717F, 2.477015F, 2.495592F, 2.514456F, 2.533614F, 2.553072F,
2.572837F, 2.592917F, 2.613318F, 2.634050F, 2.655119F, 2.676535F, 2.698305F, 2.720439F,
2.742945F, 2.765834F, 2.789114F, 2.812796F, 2.836891F, 2.861409F, 2.886361F, 2.911759F,
2.937614F, 2.963941F, 2.990750F, 3.018056F, 3.045872F, 3.074214F, 3.103095F, 3.132531F,
3.162538F, 3.193134F, 3.224335F, 3.256160F, 3.288627F, 3.321755F, 3.355566F, 3.390081F,
3.425320F, 3.461309F, 3.498070F, 3.535629F, 3.574011F, 3.613245F, 3.653358F, 3.694381F,
3.736344F, 3.779280F, 3.823224F, 3.868211F, 3.914279F, 3.961467F, 4.009816F, 4.059369F,
4.110172F, 4.162272F, 4.215721F, 4.270570F, 4.326876F, 4.384697F, 4.444094F, 4.505134F,
4.567885F, 4.632419F, 4.698814F, 4.767152F, 4.837518F, 4.910005F, 4.984708F, 5.061732F,
5.141187F, 5.223187F, 5.307859F, 5.395334F, 5.485753F, 5.579268F, 5.676041F, 5.776243F,
5.880061F, 5.987694F, 6.099355F, 6.215275F, 6.335701F, 6.460902F, 6.591167F, 6.726808F,
6.868167F, 7.015611F, 7.169541F, 7.330395F, 7.498651F, 7.674831F, 7.859508F, 8.053311F,
8.256933F, 8.471140F, 8.696777F, 8.934786F, 9.186211F, 9.452218F, 9.734114F, 10.033366F,
10.351625F, 10.690763F, 11.052902F, 11.440462F, 11.856219F, 12.303363F, 12.785587F, 13.307186F,
13.873188F, 14.489513F, 15.163182F, 15.902588F, 16.717843F, 17.621247F, 18.627913F, 19.756614F,
21.030970F, 22.481117F, 24.146120F, 26.077544F, 28.344889F, 31.044135F, 34.311669F, 38.348066F,
43.460868F, 50.146880F, 59.264216F, 72.433758F, 93.128825F, 130.380047F, 217.299736F, 651.898673F,
0.500001F, 0.500005F, 0.500015F, 0.500029F, 0.500048F, 0.500071F, 0.500099F, 0.500132F,
0.500170F, 0.500212F, 0.500260F, 0.500311F, 0.500368F, 0.500429F, 0.500495F, 0.500566F,
0.500641F, 0.500722F, 0.500806F, 0.500896F, 0.500991F, 0.501090F, 0.501194F, 0.501302F,
0.501416F, 0.501534F, 0.501657F, 0.501785F, 0.501917F, 0.502055F, 0.502197F, 0.502344F,
0.502496F, 0.502652F, 0.502814F, 0.502980F, 0.503151F, 0.503327F, 0.503508F, 0.503694F,
0.503885F, 0.504080F, 0.504281F, 0.504486F, 0.504696F, 0.504911F, 0.505131F, 0.505357F,
0.505587F, 0.505822F, 0.506062F, 0.506307F, 0.506557F, 0.506812F, 0.507072F, 0.507337F,
0.507607F, 0.507882F, 0.508162F, 0.508448F, 0.508738F, 0.509034F, 0.509335F, 0.509641F,
0.509952F, 0.510268F, 0.510590F, 0.510916F, 0.511248F, 0.511585F, 0.511928F, 0.512276F,
0.512629F, 0.512987F, 0.513351F, 0.513720F, 0.514094F, 0.514474F, 0.514859F, 0.515250F,
0.515646F, 0.516048F, 0.516455F, 0.516867F, 0.517285F, 0.517709F, 0.518138F, 0.518573F,
0.519014F, 0.519460F, 0.519912F, 0.520369F, 0.520832F, 0.521301F, 0.521776F, 0.522256F,
0.522742F, 0.523235F, 0.523733F, 0.524236F, 0.524746F, 0.525262F, 0.525784F, 0.526311F,
0.526845F, 0.527385F, 0.527930F, 0.528482F, 0.529041F, 0.529605F, 0.530175F, 0.530752F,
0.531335F, 0.531924F, 0.532520F, 0.533122F, 0.533730F, 0.534345F, 0.534966F, 0.535594F,
0.536228F, 0.536869F, 0.537516F, 0.538170F, 0.538831F, 0.539498F, 0.540172F, 0.540853F,
0.541541F, 0.542235F, 0.542937F, 0.543645F, 0.544361F, 0.545083F, 0.545813F, 0.546549F,
0.547293F, 0.548044F, 0.548802F, 0.549568F, 0.550341F, 0.551121F, 0.551908F, 0.552704F,
0.553506F, 0.554316F, 0.555134F, 0.555959F, 0.556793F, 0.557633F, 0.558482F, 0.559339F,
0.560203F, 0.561075F, 0.561956F, 0.562844F, 0.563741F, 0.564646F, 0.565559F, 0.566480F,
0.567410F, 0.568348F, 0.569295F, 0.570250F, 0.571214F, 0.572186F, 0.573167F, 0.574157F,
0.575156F, 0.576163F, 0.577180F, 0.578206F, 0.579240F, 0.580284F, 0.581338F, 0.582400F,
0.583472F, 0.584554F, 0.585644F, 0.586745F, 0.587855F, 0.588975F, 0.590105F, 0.591245F,
0.592395F, 0.593555F, 0.594725F, 0.595905F, 0.597095F, 0.598296F, 0.599508F, 0.600730F,
0.601963F, 0.603206F, 0.604460F, 0.605726F, 0.607002F, 0.608289F, 0.609588F, 0.610898F,
0.612219F, 0.613552F, 0.614897F, 0.616253F, 0.617621F, 0.619001F, 0.620393F, 0.621797F,
0.623214F, 0.624643F, 0.626084F, 0.627538F, 0.629004F, 0.630484F, 0.631976F, 0.633481F,
0.635000F, 0.636532F, 0.638077F, 0.639636F, 0.641208F, 0.642795F, 0.644395F, 0.646009F,
0.647638F, 0.649281F, 0.650938F, 0.652610F, 0.654297F, 0.655999F, 0.657716F, 0.659448F,
0.661195F, 0.662959F, 0.664737F, 0.666532F, 0.668343F, 0.670169F, 0.672013F, 0.673872F,
0.675749F, 0.677642F, 0.679552F, 0.681480F, 0.683425F, 0.685387F, 0.687368F, 0.689366F,
0.691383F, 0.693418F, 0.695471F, 0.697543F, 0.699635F, 0.701745F, 0.703875F, 0.706025F,
0.708194F, 0.710383F, 0.712593F, 0.714824F, 0.717075F, 0.719347F, 0.721640F, 0.723955F,
0.726292F, 0.728650F, 0.731031F, 0.733435F, 0.735861F, 0.738310F, 0.740783F, 0.743279F,
0.745799F, 0.748344F, 0.750913F, 0.753507F, 0.756126F, 0.758770F, 0.761440F, 0.764136F,
0.766859F, 0.769608F, 0.772385F, 0.775188F, 0.778020F, 0.780880F, 0.783768F, 0.786685F,
0.789632F, 0.792608F, 0.795614F, 0.798650F, 0.801717F, 0.804816F, 0.807946F, 0.811109F,
0.814304F, 0.817532F, 0.820793F, 0.824088F, 0.827418F, 0.830782F, 0.834182F, 0.837618F,
0.841090F, 0.844599F, 0.848146F, 0.851730F, 0.855353F, 0.859015F, 0.862717F, 0.866459F,
0.870241F, 0.874065F, 0.877931F, 0.881840F, 0.885793F, 0.889789F, 0.893830F, 0.897916F,
0.902048F, 0.906227F, 0.910454F, 0.914729F, 0.919053F, 0.923426F, 0.927851F, 0.932326F,
0.936854F, 0.941435F, 0.946070F, 0.950760F, 0.955506F, 0.960308F, 0.965168F, 0.970087F,
0.975065F, 0.980104F, 0.985204F, 0.990367F, 0.995595F, 1.000887F, 1.006245F, 1.011670F,
1.017164F, 1.022727F, 1.028362F, 1.034068F, 1.039848F, 1.045703F, 1.051635F, 1.057644F,
1.063732F, 1.069900F, 1.076151F, 1.082486F, 1.088906F, 1.095413F, 1.102008F, 1.108694F,
1.115472F, 1.122344F, 1.129313F, 1.136378F, 1.143544F, 1.150812F, 1.158183F, 1.165661F,
1.173247F, 1.180943F, 1.188752F, 1.196677F, 1.204719F, 1.212882F, 1.221168F, 1.229579F,
1.238119F, 1.246790F, 1.255595F, 1.264538F, 1.273620F, 1.282847F, 1.292220F, 1.301744F,
1.311421F, 1.321256F, 1.331252F, 1.341414F, 1.351744F, 1.362248F, 1.372929F, 1.383793F,
1.394842F, 1.406083F, 1.417521F, 1.429159F, 1.441004F, 1.453060F, 1.465334F, 1.477831F,
1.490557F, 1.503518F, 1.516721F, 1.530173F, 1.543880F, 1.557850F, 1.572089F, 1.586607F,
1.601410F, 1.616508F, 1.631908F, 1.647620F, 1.663654F, 1.680019F, 1.696725F, 1.713783F,
1.731204F, 1.748999F, 1.767181F, 1.785761F, 1.804754F, 1.824172F, 1.844031F, 1.864344F,
1.885128F, 1.906398F, 1.928172F, 1.950468F, 1.973305F, 1.996701F, 2.020679F, 2.045258F,
2.070463F, 2.096317F, 2.122844F, 2.150072F, 2.178029F, 2.206743F, 2.236246F, 2.266570F,
2.297749F, 2.329820F, 2.362822F, 2.396796F, 2.431783F, 2.467831F, 2.504988F, 2.543305F,
2.582837F, 2.623642F, 2.665783F, 2.709326F, 2.754341F, 2.800904F, 2.849096F, 2.899003F,
2.950718F, 3.004340F, 3.059976F, 3.117742F, 3.177762F, 3.240168F, 3.305107F, 3.372734F,
3.443220F, 3.516748F, 3.593520F, 3.673754F, 3.757688F, 3.845585F, 3.937730F, 4.034439F,
4.136057F, 4.242967F, 4.355593F, 4.474405F, 4.599924F, 4.732735F, 4.873491F, 5.022924F,
5.181861F, 5.351237F, 5.532114F, 5.725702F, 5.933388F, 6.156768F, 6.397687F, 6.658295F,
6.941104F, 7.249074F, 7.585716F, 7.955227F, 8.362662F, 8.814173F, 9.317313F, 9.881472F,
10.518458F, 11.243340F, 12.075649F, 13.041169F, 14.174650F, 15.524081F, 17.157657F, 19.175663F,
21.731872F, 25.074687F, 29.633163F, 36.217742F, 46.565084F, 65.190503F, 108.650157F, 325.949442F,
0.500002F, 0.500021F, 0.500059F, 0.500115F, 0.500191F, 0.500285F, 0.500398F, 0.500530F,
0.500681F, 0.500851F, 0.501040F, 0.501247F, 0.501474F, 0.501720F, 0.501986F, 0.502270F,
0.502574F, 0.502896F, 0.503239F, 0.503601F, 0.503982F, 0.504383F, 0.504803F, 0.505243F,
0.505703F, 0.506183F, 0.506683F, 0.507204F, 0.507744F, 0.508304F, 0.508885F, 0.509487F,
0.510109F, 0.510752F, 0.511416F, 0.512101F, 0.512807F, 0.513535F, 0.514283F, 0.515054F,
0.515846F, 0.516660F, 0.517497F, 0.518355F, 0.519236F, 0.520140F, 0.521066F, 0.522015F,
0.522988F, 0.523984F, 0.525003F, 0.526047F, 0.527114F, 0.528206F, 0.529322F, 0.530463F,
0.531629F, 0.532820F, 0.534036F, 0.535279F, 0.536547F, 0.537842F, 0.539163F, 0.540512F,
0.541887F, 0.543290F, 0.544721F, 0.546180F, 0.547668F, 0.549184F, 0.550730F, 0.552305F,
0.553910F, 0.555546F, 0.557212F, 0.558909F, 0.560638F, 0.562399F, 0.564192F, 0.566019F,
0.567878F, 0.569771F, 0.571699F, 0.573661F, 0.575658F, 0.577692F, 0.579761F, 0.581868F,
0.584012F, 0.586194F, 0.588414F, 0.590674F, 0.592973F, 0.595313F, 0.597695F, 0.600118F,
0.602583F, 0.605092F, 0.607644F, 0.610242F, 0.612884F, 0.615574F, 0.618310F, 0.621094F,
0.623927F, 0.626809F, 0.629742F, 0.632727F, 0.635764F, 0.638855F, 0.642000F, 0.645200F,
0.648458F, 0.651772F, 0.655146F, 0.658580F, 0.662075F, 0.665633F, 0.669254F, 0.672940F,
0.676693F, 0.680514F, 0.684404F, 0.688365F, 0.692398F, 0.696505F, 0.700688F, 0.704947F,
0.709286F, 0.713706F, 0.718208F, 0.722795F, 0.727468F, 0.732230F, 0.737083F, 0.742028F,
0.747069F, 0.752207F, 0.757445F, 0.762785F, 0.768230F, 0.773783F, 0.779446F, 0.785223F,
0.791116F, 0.797128F, 0.803263F, 0.809523F, 0.815913F, 0.822436F, 0.829096F, 0.835896F,
0.842840F, 0.849933F, 0.857179F, 0.864583F, 0.872148F, 0.879881F, 0.887785F, 0.895867F,
0.904132F, 0.912585F, 0.921233F, 0.930082F, 0.939138F, 0.948408F, 0.957900F, 0.967620F,
0.977577F, 0.987778F, 0.998232F, 1.008949F, 1.019937F, 1.031206F, 1.042766F, 1.054629F,
1.066806F, 1.079308F, 1.092148F, 1.105340F, 1.118897F, 1.132833F, 1.147165F, 1.161909F,
1.177081F, 1.192700F, 1.208786F, 1.225358F, 1.242438F, 1.260049F, 1.278215F, 1.296963F,
1.316319F, 1.336312F, 1.356974F, 1.378338F, 1.400439F, 1.423314F, 1.447005F, 1.471554F,
1.497008F, 1.523416F, 1.550832F, 1.579313F, 1.608922F, 1.639725F, 1.671794F, 1.705209F,
1.740054F, 1.776420F, 1.814409F, 1.854130F, 1.895701F, 1.939254F, 1.984932F, 2.032892F,
2.083307F, 2.136369F, 2.192289F, 2.251303F, 2.313671F, 2.379685F, 2.449672F, 2.523998F,
2.603077F, 2.687375F, 2.777424F, 2.873830F, 2.977284F, 3.088586F, 3.208658F, 3.338574F,
3.479591F, 3.633190F, 3.801124F, 3.985493F, 4.188825F, 4.414194F, 4.665379F, 4.947073F,
5.265181F, 5.627237F, 6.043007F, 6.525382F, 7.091739F, 7.766070F, 8.582473F, 9.591092F,
10.868813F, 12.539837F, 14.818691F, 18.110597F, 23.283884F, 32.596211F, 54.325654F, 162.974915F,
0.500009F, 0.500085F, 0.500235F, 0.500462F, 0.500763F, 0.501141F, 0.501595F, 0.502125F,
0.502733F, 0.503417F, 0.504180F, 0.505021F, 0.505941F, 0.506941F, 0.508022F, 0.509184F,
0.510428F, 0.511756F, 0.513168F, 0.514666F, 0.516250F, 0.517923F, 0.519685F, 0.521538F,
0.523483F, 0.525522F, 0.527657F, 0.529889F, 0.532221F, 0.534654F, 0.537191F, 0.539834F,
0.542585F, 0.545447F, 0.548422F, 0.551514F, 0.554724F, 0.558057F, 0.561515F, 0.565101F,
0.568820F, 0.572675F, 0.576671F, 0.580810F, 0.585098F, 0.589539F, 0.594138F, 0.598901F,
0.603832F, 0.608937F, 0.614223F, 0.619696F, 0.625362F, 0.631228F, 0.637303F, 0.643593F,
0.650108F, 0.656856F, 0.663846F, 0.671089F, 0.678595F, 0.686375F, 0.694442F, 0.702808F,
0.711486F, 0.720491F, 0.729838F, 0.739544F, 0.749625F, 0.760102F, 0.770993F, 0.782320F,
0.794107F, 0.806377F, 0.819158F, 0.832478F, 0.846368F, 0.860861F, 0.875993F, 0.891804F,
0.908335F, 0.925632F, 0.943746F, 0.962731F, 0.982646F, 1.003557F, 1.025536F, 1.048659F,
1.073015F, 1.098699F, 1.125816F, 1.154484F, 1.184833F, 1.217009F, 1.251175F, 1.287515F,
1.326234F, 1.367566F, 1.411777F, 1.459169F, 1.510089F, 1.564935F, 1.624170F, 1.688329F,
1.758041F, 1.834046F, 1.917221F, 2.008616F, 2.109495F, 2.221394F, 2.346203F, 2.486268F,
2.644542F, 2.824791F, 3.031899F, 3.272312F, 3.554715F, 3.891108F, 4.298538F, 4.802076F,
5.440166F, 6.274908F, 7.413567F, 9.058751F, 11.644627F, 16.300023F, 27.163978F, 81.487842F,
0.500038F, 0.500339F, 0.500943F, 0.501851F, 0.503065F, 0.504590F, 0.506431F, 0.508592F,
0.511082F, 0.513906F, 0.517076F, 0.520600F, 0.524491F, 0.528761F, 0.533425F, 0.538499F,
0.544002F, 0.549953F, 0.556375F, 0.563292F, 0.570731F, 0.578722F, 0.587299F, 0.596499F,
0.606362F, 0.616936F, 0.628269F, 0.640420F, 0.653452F, 0.667435F, 0.682450F, 0.698587F,
0.715946F, 0.734645F, 0.754813F, 0.776601F, 0.800180F, 0.825749F, 0.853537F, 0.883811F,
0.916884F, 0.953126F, 0.992973F, 1.036949F, 1.085685F, 1.139949F, 1.200683F, 1.269061F,
1.346558F, 1.435055F, 1.536994F, 1.655597F, 1.795205F, 1.961818F, 2.163958F, 2.414160F,
2.731645F, 3.147462F, 3.715243F, 4.536291F, 5.827688F, 8.153849F, 13.584290F, 40.744688F,
0.500151F, 0.501358F, 0.503789F, 0.507471F, 0.512451F, 0.518793F, 0.526577F, 0.535910F,
0.546920F, 0.559770F, 0.574655F, 0.591819F, 0.611557F, 0.634239F, 0.660320F, 0.690372F,
0.725121F, 0.765494F, 0.812702F, 0.868345F, 0.934584F, 1.014408F, 1.112072F, 1.233833F,
1.389294F, 1.593972F, 1.874676F, 2.282050F, 2.924628F, 4.084611F, 6.796751F, 20.373878F,
0.500603F, 0.505471F, 0.515447F, 0.531043F, 0.553104F, 0.582935F, 0.622504F, 0.674808F,
0.744536F, 0.839350F, 0.972568F, 1.169440F, 1.484165F, 2.057781F, 3.407608F, 10.190008F,
0.502419F, 0.522499F, 0.566944F, 0.646822F, 0.788155F, 1.060678F, 1.722447F, 5.101149F,
0.509796F, 0.601345F, 0.899976F, 2.562915F, 0.541196F, 1.306563F, 0.707107F, 0.000000F
} ;
static const float CosTable_256 [256] =
{
0.500009F, 0.500085F, 0.500235F, 0.500462F, 0.500763F, 0.501141F, 0.501595F, 0.502125F,
0.502733F, 0.503417F, 0.504180F, 0.505021F, 0.505941F, 0.506941F, 0.508022F, 0.509184F,
0.510428F, 0.511756F, 0.513168F, 0.514666F, 0.516250F, 0.517923F, 0.519685F, 0.521538F,
0.523483F, 0.525522F, 0.527657F, 0.529889F, 0.532221F, 0.534654F, 0.537191F, 0.539834F,
0.542585F, 0.545447F, 0.548422F, 0.551514F, 0.554724F, 0.558057F, 0.561515F, 0.565101F,
0.568820F, 0.572675F, 0.576671F, 0.580810F, 0.585098F, 0.589539F, 0.594138F, 0.598901F,
0.603832F, 0.608937F, 0.614223F, 0.619696F, 0.625362F, 0.631228F, 0.637303F, 0.643593F,
0.650108F, 0.656856F, 0.663846F, 0.671089F, 0.678595F, 0.686375F, 0.694442F, 0.702808F,
0.711486F, 0.720491F, 0.729838F, 0.739544F, 0.749625F, 0.760102F, 0.770993F, 0.782320F,
0.794107F, 0.806377F, 0.819158F, 0.832478F, 0.846368F, 0.860861F, 0.875993F, 0.891804F,
0.908335F, 0.925632F, 0.943746F, 0.962731F, 0.982646F, 1.003557F, 1.025536F, 1.048659F,
1.073015F, 1.098699F, 1.125816F, 1.154484F, 1.184833F, 1.217009F, 1.251175F, 1.287515F,
1.326234F, 1.367566F, 1.411777F, 1.459169F, 1.510089F, 1.564935F, 1.624170F, 1.688329F,
1.758041F, 1.834046F, 1.917221F, 2.008616F, 2.109495F, 2.221394F, 2.346203F, 2.486268F,
2.644542F, 2.824791F, 3.031899F, 3.272312F, 3.554715F, 3.891108F, 4.298538F, 4.802076F,
5.440166F, 6.274908F, 7.413567F, 9.058751F, 11.644627F, 16.300023F, 27.163978F, 81.487842F,
0.500038F, 0.500339F, 0.500943F, 0.501851F, 0.503065F, 0.504590F, 0.506431F, 0.508592F,
0.511082F, 0.513906F, 0.517076F, 0.520600F, 0.524491F, 0.528761F, 0.533425F, 0.538499F,
0.544002F, 0.549953F, 0.556375F, 0.563292F, 0.570731F, 0.578722F, 0.587299F, 0.596499F,
0.606362F, 0.616936F, 0.628269F, 0.640420F, 0.653452F, 0.667435F, 0.682450F, 0.698587F,
0.715946F, 0.734645F, 0.754813F, 0.776601F, 0.800180F, 0.825749F, 0.853537F, 0.883811F,
0.916884F, 0.953126F, 0.992973F, 1.036949F, 1.085685F, 1.139949F, 1.200683F, 1.269061F,
1.346558F, 1.435055F, 1.536994F, 1.655597F, 1.795205F, 1.961818F, 2.163958F, 2.414160F,
2.731645F, 3.147462F, 3.715243F, 4.536291F, 5.827688F, 8.153849F, 13.584290F, 40.744688F,
0.500151F, 0.501358F, 0.503789F, 0.507471F, 0.512451F, 0.518793F, 0.526577F, 0.535910F,
0.546920F, 0.559770F, 0.574655F, 0.591819F, 0.611557F, 0.634239F, 0.660320F, 0.690372F,
0.725121F, 0.765494F, 0.812702F, 0.868345F, 0.934584F, 1.014408F, 1.112072F, 1.233833F,
1.389294F, 1.593972F, 1.874676F, 2.282050F, 2.924628F, 4.084611F, 6.796751F, 20.373878F,
0.500603F, 0.505471F, 0.515447F, 0.531043F, 0.553104F, 0.582935F, 0.622504F, 0.674808F,
0.744536F, 0.839350F, 0.972568F, 1.169440F, 1.484165F, 2.057781F, 3.407608F, 10.190008F,
0.502419F, 0.522499F, 0.566944F, 0.646822F, 0.788155F, 1.060678F, 1.722447F, 5.101149F,
0.509796F, 0.601345F, 0.899976F, 2.562915F, 0.541196F, 1.306563F, 0.707107F, 0.000000F
} ;
void CBlock::Dct16 (float vec [], const float cosTerms [])
{
float tmp_e0, tmp_e1, tmp_e2, tmp_e3, tmp_e4, tmp_e5, tmp_e6, tmp_e7 ;
float tmp_o0, tmp_o1, tmp_o2, tmp_o3, tmp_o4, tmp_o5, tmp_o6, tmp_o7 ;
tmp_e0 = vec [0] + vec [15] ;
tmp_e1 = vec [1] + vec [14] ;
tmp_e2 = vec [2] + vec [13] ;
tmp_e3 = vec [3] + vec [12] ;
tmp_e4 = vec [4] + vec [11] ;
tmp_e5 = vec [5] + vec [10] ;
tmp_e6 = vec [6] + vec [9] ;
tmp_e7 = vec [7] + vec [8] ;
tmp_o0 = (vec [0] - vec [15]) * cosTerms [0] ;
tmp_o1 = (vec [1] - vec [14]) * cosTerms [1] ;
tmp_o2 = (vec [2] - vec [13]) * cosTerms [2] ;
tmp_o3 = (vec [3] - vec [12]) * cosTerms [3] ;
tmp_o4 = (vec [4] - vec [11]) * cosTerms [4] ;
tmp_o5 = (vec [5] - vec [10]) * cosTerms [5] ;
tmp_o6 = (vec [6] - vec [9]) * cosTerms [6] ;
tmp_o7 = (vec [7] - vec [8]) * cosTerms [7] ;
// dct8 (tmp_e, cosTerms + 8) ;
float itmp_e0, itmp_e1, itmp_e2, itmp_e3 ;
float itmp_o0, itmp_o1, itmp_o2, itmp_o3 ;
itmp_e0 = tmp_e0 + tmp_e7 ;
itmp_e1 = tmp_e1 + tmp_e6 ;
itmp_e2 = tmp_e2 + tmp_e5 ;
itmp_e3 = tmp_e3 + tmp_e4 ;
itmp_o0 = (tmp_e0 - tmp_e7) * cosTerms [8] ;
itmp_o1 = (tmp_e1 - tmp_e6) * cosTerms [9] ;
itmp_o2 = (tmp_e2 - tmp_e5) * cosTerms [10] ;
itmp_o3 = (tmp_e3 - tmp_e4) * cosTerms [11] ;
float cosTerms12 = cosTerms [12] ;
float cosTerms13 = cosTerms [13] ;
float cosTerms14 = cosTerms [14] ;
// even part
float tmp0, tmp1, tmp2, tmp3 ;
tmp0 = itmp_e0 + itmp_e3 ;
tmp1 = (itmp_e0 - itmp_e3) * cosTerms12 ;
tmp2 = itmp_e1 + itmp_e2 ;
tmp3 = (itmp_e1 - itmp_e2) * cosTerms13 ;
vec [0] = tmp0 + tmp2 ;
vec [4] = tmp1 + tmp3;
vec [12] = (tmp1 - tmp3) * cosTerms14 ;
vec [8] = (tmp0 - tmp2) * cosTerms14 ;
vec [4] += vec [12] ;
// odd part
tmp0 = itmp_o0 + itmp_o3 ;
tmp2 = itmp_o1 + itmp_o2 ;
tmp1 = (itmp_o0 - itmp_o3) * cosTerms12 ;
tmp3 = (itmp_o1 - itmp_o2) * cosTerms13 ;
itmp_o0 = tmp0 + tmp2 ;
itmp_o1 = tmp1 + tmp3;
itmp_o3 = (tmp1 - tmp3) * cosTerms14 ;
itmp_o2 = (tmp0 - tmp2) * cosTerms14 ;
itmp_o1 += itmp_o3 ;
vec [2] = itmp_o0 + itmp_o1 ;
vec [6] = itmp_o1 + itmp_o2 ;
vec [10] = itmp_o2 + itmp_o3 ;
vec [14] = itmp_o3 ;
// dct8 (tmp_o, cosTerms + 8) ;
itmp_e0 = tmp_o0 + tmp_o7 ;
itmp_e1 = tmp_o1 + tmp_o6 ;
itmp_e2 = tmp_o2 + tmp_o5 ;
itmp_e3 = tmp_o3 + tmp_o4 ;
itmp_o0 = (tmp_o0 - tmp_o7) * cosTerms [8] ;
itmp_o1 = (tmp_o1 - tmp_o6) * cosTerms [9] ;
itmp_o2 = (tmp_o2 - tmp_o5) * cosTerms [10] ;
itmp_o3 = (tmp_o3 - tmp_o4) * cosTerms [11] ;
// even part
tmp0 = itmp_e0 + itmp_e3 ;
tmp1 = (itmp_e0 - itmp_e3) * cosTerms12 ;
tmp2 = itmp_e1 + itmp_e2 ;
tmp3 = (itmp_e1 - itmp_e2) * cosTerms13 ;
tmp_o0 = tmp0 + tmp2 ;
tmp_o2 = tmp1 + tmp3;
tmp_o6 = (tmp1 - tmp3) * cosTerms14 ;
tmp_o4 = (tmp0 - tmp2) * cosTerms14 ;
tmp_o2 += tmp_o6 ;
// odd part
tmp0 = itmp_o0 + itmp_o3 ;
tmp2 = itmp_o1 + itmp_o2 ;
tmp1 = (itmp_o0 - itmp_o3) * cosTerms12 ;
tmp3 = (itmp_o1 - itmp_o2) * cosTerms13 ;
itmp_o0 = tmp0 + tmp2 ;
itmp_o1 = tmp1 + tmp3;
itmp_o3 = (tmp1 - tmp3) * cosTerms14 ;
itmp_o2 = (tmp0 - tmp2) * cosTerms14 ;
itmp_o1 += itmp_o3 ;
tmp_o1 = itmp_o0 + itmp_o1 ;
tmp_o3 = itmp_o1 + itmp_o2 ;
tmp_o5 = itmp_o2 + itmp_o3 ;
vec [1] = tmp_o0 + tmp_o1 ;
vec [3] = tmp_o1 + tmp_o2 ;
vec [5] = tmp_o2 + tmp_o3 ;
vec [7] = tmp_o3 + tmp_o4 ;
vec [9] = tmp_o4 + tmp_o5 ;
vec [11] = tmp_o5 + tmp_o6 ;
vec [13] = tmp_o6 + itmp_o3 ;
vec [15] = itmp_o3 ;
}
void CBlock::Dct128 (float vec [], const float cosTerms [])
{
float tmp_e4 [64], tmp_o4 [64] ;
float tmp_e5 [32], tmp_o5 [32] ;
float tmp_e6 [16], tmp_o6 [16] ;
Split (vec, tmp_e4, tmp_o4, cosTerms, 128) ;
Split (tmp_e4, tmp_e5, tmp_o5, cosTerms + 64, 64) ;
Split (tmp_e5, tmp_e6, tmp_o6, cosTerms + 96, 32) ;
Dct16 (tmp_e6, cosTerms + 112) ; // Even Terms
Dct16 (tmp_o6, cosTerms + 112) ; // Odd Terms
Merge (tmp_e5, tmp_e6, tmp_o6, 32) ;
Split (tmp_o5, tmp_e6, tmp_o6, cosTerms + 96, 32) ;
Dct16 (tmp_e6, cosTerms + 112) ; // Even Terms
Dct16 (tmp_o6, cosTerms + 112) ; // Odd Terms
Merge (tmp_o5, tmp_e6, tmp_o6, 32) ;
Merge (tmp_e4, tmp_e5, tmp_o5, 64) ;
Split (tmp_o4, tmp_e5, tmp_o5, cosTerms + 64, 64) ;
Split (tmp_e5, tmp_e6, tmp_o6, cosTerms + 96, 32) ;
Dct16 (tmp_e6, cosTerms + 112) ; // Even Terms
Dct16 (tmp_o6, cosTerms + 112) ; // Odd Terms
Merge (tmp_e5, tmp_e6, tmp_o6, 32) ;
Split (tmp_o5, tmp_e6, tmp_o6, cosTerms + 96, 32) ;
Dct16 (tmp_e6, cosTerms + 112) ; // Even Terms
Dct16 (tmp_o6, cosTerms + 112) ; // Odd Terms
Merge (tmp_o5, tmp_e6, tmp_o6, 32) ;
Merge (tmp_o4, tmp_e5, tmp_o5, 64) ;
Merge (vec, tmp_e4, tmp_o4, 128) ;
}
void CBlock::Dct1024 (float vec [], const float cosTerms [])
{
float tmp_e0 [512], tmp_o0 [512] ;
float tmp_e1 [256], tmp_o1 [256] ;
float tmp_e2 [128], tmp_o2 [128] ;
Split (vec, tmp_e0, tmp_o0, cosTerms, 1024) ;
Split (tmp_e0, tmp_e1, tmp_o1, cosTerms + 512, 512) ;
Split (tmp_e1, tmp_e2, tmp_o2, cosTerms + 768, 256) ;
Dct128 (tmp_e2, cosTerms + 896) ; // Even Terms
Dct128 (tmp_o2, cosTerms + 896) ; // Odd Terms
Merge (tmp_e1, tmp_e2, tmp_o2, 256) ;
Split (tmp_o1, tmp_e2, tmp_o2, cosTerms + 768, 256) ;
Dct128 (tmp_e2, cosTerms + 896) ; // Even Terms
Dct128 (tmp_o2, cosTerms + 896) ; // Odd Terms
Merge (tmp_o1, tmp_e2, tmp_o2, 256) ;
Merge (tmp_e0, tmp_e1, tmp_o1, 512) ;
Split (tmp_o0, tmp_e1, tmp_o1, cosTerms + 512, 512) ;
Split (tmp_e1, tmp_e2, tmp_o2, cosTerms + 768, 256) ;
Dct128 (tmp_e2, cosTerms + 896) ; // Even Terms
Dct128 (tmp_o2, cosTerms + 896) ; // Odd Terms
Merge (tmp_e1, tmp_e2, tmp_o2, 256) ;
Split (tmp_o1, tmp_e2, tmp_o2, cosTerms + 768, 256) ;
Dct128 (tmp_e2, cosTerms + 896) ; // Even Terms
Dct128 (tmp_o2, cosTerms + 896) ; // Odd Terms
Merge (tmp_o1, tmp_e2, tmp_o2, 256) ;
Merge (tmp_o0, tmp_e1, tmp_o1, 512) ;
Merge (vec, tmp_e0, tmp_o0, 1024) ;
}
void CLongBlock::InverseTransform (float data [])
{
const int N = 2048 ;
float tmp_out [N / 2] ;
int i ;
for (i = 0 ; i < N / 2 ; i++)
{
tmp_out [i] = (data [i] * (2.0F / N))* CosTable_2048 [i] ;
}
Dct1024 (tmp_out, &CosTable_2048 [N / 2]) ;
for (i = 0 ; i < N / 2 - 1 ; i++)
{
tmp_out [i] += tmp_out [i + 1] ;
}
for (i = 0 ; i < N / 4 ; i++)
{
data [i] = tmp_out [N / 4 + i] ;
data [N / 2 - i - 1] = -tmp_out [N / 4 + i] ;
data [N / 2 + N / 4 + i] = -tmp_out [i] ;
data [N / 2 + N / 4 - i - 1] = -tmp_out [i] ;
}
}
void CShortBlock::InverseTransform (float data [])
{
const int N = 256 ;
float tmp_out [N / 2] ;
int i ;
for (i = 0 ; i < N / 2 ; i++)
{
tmp_out [i] = (data [i] * (2.0F / N)) * CosTable_256 [i] ;
}
Dct128 (tmp_out, &CosTable_256 [N / 2]) ;
for (i = 0 ; i < N / 2 - 1 ; i++)
{
tmp_out [i] += tmp_out [i + 1] ;
}
for (i = 0 ; i < N / 4 ; i++)
{
data [i] = tmp_out [N / 4 + i] ;
data [N / 2 - i - 1] = -tmp_out [N / 4 + i] ;
data [N / 2 + N / 4 + i] = -tmp_out [i] ;
data [N / 2 + N / 4 - i -1] = -tmp_out [i] ;
}
}
#if defined (WIN32) && defined (_M_IX86)
#pragma message (__FILE__": using x86 inline assembler")
void CBlock::Split (const float vector [], float tmp_e [], float tmp_o [], const float cosTerms [], int vecsize)
{
// tmp_e [i] = t0 + t1 ;
// tmp_o [i] = (t0 - t1) * cosTerms [i] ;
_asm
{
mov ecx, vecsize
shr ecx, 1
mov esi, dword ptr [vector]
mov edi, dword ptr [cosTerms]
mov eax, dword ptr [tmp_e]
mov ebx, dword ptr [tmp_o]
mov edx, dword ptr [vecsize]
shl edx, 2
add edx, esi
fldz
label :
fld dword ptr [esi]
fld dword ptr [esi]
fsub dword ptr [edx-4]
fxch st(1)
fadd dword ptr [edx-4]
fxch st(2)
fld dword ptr [esi+4]
fld dword ptr [esi+4]
fsub dword ptr [edx-8]
fxch st(1)
fadd dword ptr [edx-8]
fxch st(3)
fmul dword ptr [edi]
fxch st(4)
fstp dword ptr [eax]
fmul dword ptr [edi+4]
fxch st(2)
fstp dword ptr [eax+4]
fxch st(2)
fstp dword ptr [ebx]
add esi, 8
add edi, 8
fstp dword ptr [ebx+4]
// // //
fld dword ptr [esi]
fld dword ptr [esi]
fsub dword ptr [edx-12]
fxch st(1)
fadd dword ptr [edx-12]
fxch st(2)
fld dword ptr [esi+4]
fld dword ptr [esi+4]
fsub dword ptr [edx-16]
fxch st(1)
fadd dword ptr [edx-16]
fxch st(3)
fmul dword ptr [edi]
fxch st(4)
fstp dword ptr [eax+8]
fmul dword ptr [edi+4]
fxch st(2)
fstp dword ptr [eax+12]
fxch st(2)
fstp dword ptr [ebx+8]
add esi, 8
add edi, 8
fstp dword ptr [ebx+12]
// // //
sub edx, 16
add eax, 16
add ebx, 16
sub ecx, 4
jne label
fstp st(0)
}
}
void CBlock::Merge (float vector [], const float tmp_e [], const float tmp_o [], int vecsize)
{
__asm
{
mov ecx, vecsize
shr ecx, 1
sub ecx, 8
mov edx, dword ptr [tmp_o]
mov edi, dword ptr [tmp_e]
mov esi, dword ptr [vector]
label :
fld dword ptr [edx + ecx*4]
fadd dword ptr [edx + ecx*4 + 4]
fld dword ptr [edx + ecx*4 + 4]
fadd dword ptr [edx + ecx*4 + 8]
fld dword ptr [edx + ecx*4 + 8]
fadd dword ptr [edx + ecx*4 + 12]
fld dword ptr [edx + ecx*4 + 12]
fadd dword ptr [edx + ecx*4 + 16]
fxch st(3)
fstp dword ptr [esi + ecx*8 + 4]
mov eax, dword ptr [edi + ecx*4]
mov ebx, dword ptr [edi + ecx*4 + 4]
fstp dword ptr [esi + ecx*8 + 20]
mov dword ptr [esi + ecx*8], eax
mov dword ptr [esi + ecx*8 + 8], ebx
fstp dword ptr [esi + ecx*8 + 12]
mov eax, dword ptr [edi + ecx*4 + 8]
mov ebx, dword ptr [edi + ecx*4 + 12]
fstp dword ptr [esi + ecx*8 + 28]
mov dword ptr [esi + ecx*8 + 16], eax
mov dword ptr [esi + ecx*8 + 24], ebx
fld dword ptr [edx + ecx*4 + 16]
fadd dword ptr [edx + ecx*4 + 20]
fld dword ptr [edx + ecx*4 + 20]
fadd dword ptr [edx + ecx*4 + 24]
fld dword ptr [edx + ecx*4 + 24]
fadd dword ptr [edx + ecx*4 + 28]
fld dword ptr [edx + ecx*4 + 28]
fadd dword ptr [edx + ecx*4 + 32]
fxch st(3)
fstp dword ptr [esi + ecx*8 + 36]
mov eax, dword ptr [edi + ecx*4 + 16]
mov ebx, dword ptr [edi + ecx*4 + 20]
fstp dword ptr [esi + ecx*8 + 52]
mov dword ptr [esi + ecx*8 + 32], eax
mov dword ptr [esi + ecx*8 + 40], ebx
fstp dword ptr [esi + ecx*8 + 44]
mov eax, dword ptr [edi + ecx*4 + 24]
mov ebx, dword ptr [edi + ecx*4 + 28]
fstp dword ptr [esi + ecx*8 + 60]
mov dword ptr [esi + ecx*8 + 48], eax
mov dword ptr [esi + ecx*8 + 56], ebx
sub ecx, 8
jne label
// zero element
fld dword ptr [edx]
fadd dword ptr [edx + 4]
fld dword ptr [edx + 4]
fadd dword ptr [edx + 8]
fld dword ptr [edx + 8]
fadd dword ptr [edx + 12]
fld dword ptr [edx + 12]
fadd dword ptr [edx + 16]
fxch st(3)
fstp dword ptr [esi + 4]
mov eax, dword ptr [edi]
mov ebx, dword ptr [edi + 4]
fstp dword ptr [esi + 20]
mov dword ptr [esi], eax
mov dword ptr [esi + 8], ebx
fstp dword ptr [esi + 12]
mov eax, dword ptr [edi + 8]
mov ebx, dword ptr [edi + 12]
fstp dword ptr [esi + 28]
mov dword ptr [esi + 16], eax
mov dword ptr [esi + 24], ebx
fld dword ptr [edx + 16]
fadd dword ptr [edx + 20]
fld dword ptr [edx + 20]
fadd dword ptr [edx + 24]
fld dword ptr [edx + 24]
fadd dword ptr [edx + 28]
fld dword ptr [edx + 28]
fadd dword ptr [edx + 32]
fxch st(3)
fstp dword ptr [esi + 36]
mov eax, dword ptr [edi + 16]
mov ebx, dword ptr [edi + 20]
fstp dword ptr [esi + 52]
mov dword ptr [esi + 32], eax
mov dword ptr [esi + 40], ebx
fstp dword ptr [esi + 44]
mov eax, dword ptr [edi + 24]
mov ebx, dword ptr [edi + 28]
fstp dword ptr [esi + 60]
mov dword ptr [esi + 48], eax
mov dword ptr [esi + 56], ebx
}
vector [vecsize - 2] = tmp_e [vecsize / 2 - 1] ;
vector [vecsize - 1] = tmp_o [vecsize / 2 - 1] ;
}
#else
void CBlock::Split (const float vector [], float tmp_e [], float tmp_o [], const float cosTerms [], int vecsize)
{
for (int i = 0 ; i < vecsize / 2 ; i++)
{
tmp_e [i] = vector [i] + vector [vecsize - i - 1] ;
tmp_o [i] = (vector [i] - vector [vecsize - i - 1]) * cosTerms [i] ;
}
}
void CBlock::Merge (float vector [], const float tmp_e [], const float tmp_o [], int vecsize)
{
for (int i = 0 ; i < vecsize / 2 - 1 ; i++)
{
vector [i * 2] = tmp_e [i] ;
vector [i * 2 + 1] = tmp_o [i] + tmp_o [i + 1] ;
}
vector [vecsize - 2] = tmp_e [vecsize / 2 - 1] ;
vector [vecsize - 1] = tmp_o [vecsize / 2 - 1] ;
}
#endif