mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-05 18:10:24 +00:00
Separate left/right audio channels for stereo audio files.
No _SNDRAW or PLAY yet. Also removed need for sound capability strings.
This commit is contained in:
parent
79ffcc50b3
commit
2089a95b8b
|
@ -1 +0,0 @@
|
|||
This first release only bases on pc-mingw32. But it is very easy to move to other GCC complier.
|
|
@ -1,198 +0,0 @@
|
|||
//
|
||||
//
|
||||
// MP3decoder.cpp: implementation of the MP3decoder class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "mpglib\mpg123.h"
|
||||
#include "mpglib\mpglib.h"
|
||||
#include "MP3decoder.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
MP3decoder::MP3decoder()
|
||||
{
|
||||
}
|
||||
|
||||
MP3decoder::~MP3decoder()
|
||||
{
|
||||
}
|
||||
|
||||
bool MP3decoder::OpenStream(char* pcfilename,int *isample,int *ichannel,int *ibyte,void * ptSettings, int *bufsizebyte)
|
||||
{
|
||||
unsigned char vbrbuf[VBRHEADERSIZE+36];
|
||||
|
||||
m_pos = 0;
|
||||
m_outsize = 0;
|
||||
fin = fopen( pcfilename, "rb" );
|
||||
if( !fin )
|
||||
return 0;
|
||||
|
||||
fseek(fin,0,SEEK_END);
|
||||
m_nInFileSize = ftell(fin);
|
||||
fseek(fin, 0, SEEK_SET);
|
||||
|
||||
InitMP3(&mp);
|
||||
|
||||
int nlen = 0;
|
||||
|
||||
nlen = fread(buf, sizeof(BYTE), 16384, fin);
|
||||
if( nlen < 16384)
|
||||
return 0;
|
||||
|
||||
int ret = decodeMP3(&mp,buf,nlen,out,8192,&m_outsize); //find good data
|
||||
if( ret != MP3_OK )
|
||||
return 0;
|
||||
|
||||
m_pos += m_outsize;
|
||||
/* if( ret != MP3_OK ){
|
||||
while( ret != MP3_OK ){
|
||||
ret = decodeMP3(&mp,NULL,0,out,8192,&m_outsize);
|
||||
m_pos += m_outsize;
|
||||
ret = decodeMP3(&mp,NULL,0,out,8192,&m_outsize);
|
||||
m_pos += m_outsize;
|
||||
if( ret == MP3_NEED_MORE ) //tried 16384 bytes, so failed
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
*bufsizebyte = BUFFER_SIZE;
|
||||
*isample = freqs[mp.fr.sampling_frequency];
|
||||
*ibyte = 2;
|
||||
*ichannel = mp.fr.stereo;
|
||||
|
||||
memcpy(vbrbuf, mp.tail->pnt + mp.ndatabegin, VBRHEADERSIZE+36);
|
||||
if (GetVbrTag(&vbrtag,(BYTE*)vbrbuf)) {
|
||||
if( vbrtag.frames < 1 || vbrtag.bytes < 1 )
|
||||
return 0;
|
||||
int cur_bitrate = (int)(vbrtag.bytes*8/(vbrtag.frames*576.0*(mp.fr.lsf?1:2)/freqs[mp.fr.sampling_frequency]));
|
||||
m_length = vbrtag.frames*576.0*(mp.fr.lsf?1:2)/freqs[mp.fr.sampling_frequency]*1000;
|
||||
m_nbytes = vbrtag.bytes;
|
||||
m_hasVbrtag = 1;
|
||||
} else {
|
||||
double bpf = 0, tpf = 0;
|
||||
|
||||
bpf = compute_bpf(&mp.fr);
|
||||
tpf = compute_tpf(&mp.fr);
|
||||
|
||||
m_length = (DWORD)((double)(m_nInFileSize)/bpf*tpf)*1000;
|
||||
m_hasVbrtag = 0;
|
||||
}
|
||||
|
||||
fseek(fin,16384,SEEK_SET);
|
||||
|
||||
m_dwRestBufSize = 0;
|
||||
m_seeked = false;
|
||||
m_bfeof = false;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int MP3decoder::Decode(BYTE* pbout)
|
||||
{
|
||||
DWORD nTotalSize = 0;
|
||||
int ret;
|
||||
|
||||
if( m_bfeof )
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
if( m_dwRestBufSize ){
|
||||
CopyMemory( pbout, m_pbRestBuf, m_dwRestBufSize );
|
||||
nTotalSize += m_dwRestBufSize;
|
||||
m_dwRestBufSize = 0;
|
||||
}
|
||||
|
||||
if( m_outsize ){
|
||||
if( nTotalSize + m_outsize > BUFFER_SIZE ){
|
||||
DWORD nRest = BUFFER_SIZE - nTotalSize;
|
||||
CopyMemory( pbout + nTotalSize, out, nRest );
|
||||
CopyMemory( m_pbRestBuf, out + nRest, m_outsize - nRest);
|
||||
nTotalSize += nRest;
|
||||
m_dwRestBufSize = m_outsize - nRest;
|
||||
m_outsize = 0;
|
||||
break;
|
||||
}else{
|
||||
CopyMemory( pbout + nTotalSize, out, m_outsize );
|
||||
nTotalSize += m_outsize;
|
||||
m_outsize = 0;
|
||||
if( nTotalSize == BUFFER_SIZE )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ret = decodeMP3(&mp,NULL,0,out,8192,&m_outsize);
|
||||
m_pos += m_outsize;
|
||||
|
||||
if( ret != MP3_OK ){
|
||||
if( feof( fin ) ) {
|
||||
m_bfeof = true;
|
||||
break;
|
||||
}
|
||||
int nlen = fread(buf, sizeof(BYTE), 16384, fin);
|
||||
ret = decodeMP3(&mp,buf,nlen,out,8192,&m_outsize);
|
||||
m_pos += m_outsize;
|
||||
}
|
||||
|
||||
if(m_seeked){
|
||||
m_seeked = false;
|
||||
int nlen = fread(buf, sizeof(BYTE), 16384, fin);
|
||||
if( feof( fin ) )
|
||||
break;
|
||||
ret = decodeMP3(&mp,buf,nlen,out,8192,&m_outsize);
|
||||
m_pos += m_outsize;
|
||||
nTotalSize = 0;
|
||||
}
|
||||
|
||||
|
||||
} while( 1 );
|
||||
|
||||
return nTotalSize;
|
||||
}
|
||||
|
||||
bool MP3decoder::CloseStream()
|
||||
{
|
||||
ExitMP3(&mp);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
DWORD MP3decoder::GetTotalTime(char * pcfilename) // 1/1000 sec
|
||||
{
|
||||
int ntmp = 0;
|
||||
|
||||
if(!OpenStream(pcfilename, &ntmp, &ntmp, &ntmp, NULL, &ntmp))
|
||||
return 0;
|
||||
CloseStream();
|
||||
return m_length;
|
||||
}
|
||||
|
||||
|
||||
DWORD _stdcall MP3decoder::GetPos( void )
|
||||
{
|
||||
return double(m_pos) / double(freqs[mp.fr.sampling_frequency]) / double(mp.fr.stereo) / 2.0 * 1000.0;
|
||||
}
|
||||
|
||||
bool _stdcall MP3decoder::SetPos( DWORD aiPosMS )
|
||||
{
|
||||
int offs = 0;
|
||||
|
||||
if (m_hasVbrtag) {
|
||||
offs = SeekPoint(vbrtag.toc,m_nInFileSize,(double)aiPosMS*100/(double)m_length);
|
||||
|
||||
fseek(fin, offs, SEEK_SET);
|
||||
|
||||
m_pos = (double)aiPosMS / 1000.0 * double(freqs[mp.fr.sampling_frequency]) * double(mp.fr.stereo) * 2.0;
|
||||
|
||||
} else {
|
||||
fseek(fin, double(m_nInFileSize) * ((double)aiPosMS / (double)m_length), SEEK_SET);
|
||||
m_pos = (double)aiPosMS / 1000.0 * double(freqs[mp.fr.sampling_frequency]) * double(mp.fr.stereo) * 2.0;
|
||||
}
|
||||
|
||||
m_seeked = true;
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
//
|
||||
// MP3decoder.h: interface for the MP3decoder class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
class MP3decoder
|
||||
{
|
||||
public:
|
||||
|
||||
MP3decoder();
|
||||
~MP3decoder();
|
||||
|
||||
bool _stdcall OpenStream(char* pcfilename,int *isample,int *ichannel,int *ibyte,void * ptSettings, int *bufsizebyte);
|
||||
int _stdcall Decode(BYTE* pbout);
|
||||
bool _stdcall CloseStream();
|
||||
DWORD _stdcall GetTotalTime(char * pcfilename);
|
||||
DWORD _stdcall GetPos( void ); // 1/1000 sec
|
||||
bool _stdcall SetPos( DWORD aiPosMS ); // 1/1000 sec
|
||||
|
||||
private:
|
||||
DWORD m_pos;
|
||||
struct mpstr mp;
|
||||
char buf[16384];
|
||||
char m_pbRestBuf[8192];
|
||||
char out[8192];
|
||||
int m_outsize;
|
||||
FILE * fin;
|
||||
|
||||
DWORD m_dwBufSize;
|
||||
DWORD m_dwRestBufSize;
|
||||
|
||||
const static DWORD BUFFER_SIZE = 16384;
|
||||
VBRTAGDATA vbrtag;
|
||||
int m_length;
|
||||
DWORD m_nInFileSize;
|
||||
int m_nbytes;
|
||||
int m_hasVbrtag;
|
||||
|
||||
bool m_seeked;
|
||||
bool m_bfeof;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_MP3DECODER_H__6A643246_395C_487E_BE15_CC621BBA084A__INCLUDED_)
|
|
@ -1,51 +0,0 @@
|
|||
# Project: mpglib
|
||||
# Makefile created by Dev-C++ 4.9.9.1
|
||||
|
||||
CPP = g++.exe
|
||||
CC = gcc.exe
|
||||
WINDRES = windres.exe
|
||||
RES =
|
||||
OBJ = mpglib/common.o mpglib/dct64_i386.o mpglib/decode_i386.o mpglib/interface.o mpglib/layer2.o mpglib/layer3.o mpglib/tabinit.o $(RES)
|
||||
LINKOBJ = mpglib/common.o mpglib/dct64_i386.o mpglib/decode_i386.o mpglib/interface.o mpglib/layer2.o mpglib/layer3.o mpglib/tabinit.o $(RES)
|
||||
LIBS = -L"d:/Dev-Cpp/lib" --no-export-all-symbols --add-stdcall-alias
|
||||
INCS = -I"d:/Dev-Cpp/include"
|
||||
CXXINCS = -I"d:/Dev-Cpp/include/c++/3.3.1" -I"d:/Dev-Cpp/include/c++/3.3.1/mingw32" -I"d:/Dev-Cpp/include/c++/3.3.1/backward" -I"d:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include" -I"d:/Dev-Cpp/include"
|
||||
BIN = mpglib.dll
|
||||
CXXFLAGS = $(CXXINCS) -DBUILDING_DLL=1
|
||||
CFLAGS = $(INCS) -DBUILDING_DLL=1
|
||||
|
||||
.PHONY: all all-before all-after clean clean-custom
|
||||
|
||||
all: all-before mpglib.dll all-after
|
||||
|
||||
|
||||
clean: clean-custom
|
||||
rm -f $(OBJ) $(BIN)
|
||||
|
||||
DLLWRAP=dllwrap.exe
|
||||
DEFFILE=libmpglib.def
|
||||
STATICLIB=libmpglib.a
|
||||
|
||||
$(BIN): $(LINKOBJ)
|
||||
$(DLLWRAP) --output-def $(DEFFILE) --driver-name c++ --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN)
|
||||
|
||||
mpglib/common.o: mpglib/common.c
|
||||
$(CPP) -c mpglib/common.c -o mpglib/common.o $(CXXFLAGS)
|
||||
|
||||
mpglib/dct64_i386.o: mpglib/dct64_i386.c
|
||||
$(CPP) -c mpglib/dct64_i386.c -o mpglib/dct64_i386.o $(CXXFLAGS)
|
||||
|
||||
mpglib/decode_i386.o: mpglib/decode_i386.c
|
||||
$(CPP) -c mpglib/decode_i386.c -o mpglib/decode_i386.o $(CXXFLAGS)
|
||||
|
||||
mpglib/interface.o: mpglib/interface.c
|
||||
$(CPP) -c mpglib/interface.c -o mpglib/interface.o $(CXXFLAGS)
|
||||
|
||||
mpglib/layer2.o: mpglib/layer2.c
|
||||
$(CPP) -c mpglib/layer2.c -o mpglib/layer2.o $(CXXFLAGS)
|
||||
|
||||
mpglib/layer3.o: mpglib/layer3.c
|
||||
$(CPP) -c mpglib/layer3.c -o mpglib/layer3.o $(CXXFLAGS)
|
||||
|
||||
mpglib/tabinit.o: mpglib/tabinit.c
|
||||
$(CPP) -c mpglib/tabinit.c -o mpglib/tabinit.o $(CXXFLAGS)
|
|
@ -1,504 +0,0 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
|
@ -1,358 +0,0 @@
|
|||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "mpg123.h"
|
||||
|
||||
|
||||
const int tabsel_123[2][3][16] = {
|
||||
{ {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,},
|
||||
{0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,},
|
||||
{0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} },
|
||||
|
||||
{ {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,},
|
||||
{0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,},
|
||||
{0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} }
|
||||
};
|
||||
|
||||
const long freqs[9] = { 44100, 48000, 32000,
|
||||
22050, 24000, 16000 ,
|
||||
11025 , 12000 , 8000 };
|
||||
|
||||
|
||||
#define HDRCMPMASK 0xfffffd00
|
||||
|
||||
int head_check(unsigned long head)
|
||||
{
|
||||
if( (head & 0xffe00000) != 0xffe00000)
|
||||
return FALSE;
|
||||
if(!((head>>17)&3))
|
||||
return FALSE;
|
||||
if( ((head>>12)&0xf) == 0xf)
|
||||
return FALSE;
|
||||
if( ((head>>10)&0x3) == 0x3 )
|
||||
return FALSE;
|
||||
if ((head & 0xffff0000) == 0xfffe0000)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* the code a header and write the information
|
||||
* into the frame structure
|
||||
*/
|
||||
int decode_header(struct mpstr *mp, struct frame *fr,unsigned long newhead)
|
||||
{
|
||||
long ltmp;
|
||||
|
||||
if( newhead & (1<<20) ) {
|
||||
fr->lsf = (newhead & (1<<19)) ? 0x0 : 0x1;
|
||||
fr->mpeg25 = 0;
|
||||
}
|
||||
else {
|
||||
fr->lsf = 1;
|
||||
fr->mpeg25 = 1;
|
||||
}
|
||||
|
||||
|
||||
fr->lay = 4-((newhead>>17)&3);
|
||||
if( ((newhead>>10)&0x3) == 0x3) {
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Stream error\n");
|
||||
exit(1);
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
}
|
||||
if(fr->mpeg25) {
|
||||
fr->sampling_frequency = 6 + ((newhead>>10)&0x3);
|
||||
}
|
||||
else
|
||||
fr->sampling_frequency = ((newhead>>10)&0x3) + (fr->lsf*3);
|
||||
fr->error_protection = ((newhead>>16)&0x1)^0x1;
|
||||
|
||||
if(fr->mpeg25) /* allow Bitrate change for 2.5 ... */
|
||||
fr->bitrate_index = ((newhead>>12)&0xf);
|
||||
|
||||
fr->bitrate_index = ((newhead>>12)&0xf);
|
||||
fr->padding = ((newhead>>9)&0x1);
|
||||
fr->extension = ((newhead>>8)&0x1);
|
||||
fr->mode = ((newhead>>6)&0x3);
|
||||
fr->mode_ext = ((newhead>>4)&0x3);
|
||||
fr->copyright = ((newhead>>3)&0x1);
|
||||
fr->original = ((newhead>>2)&0x1);
|
||||
fr->emphasis = newhead & 0x3;
|
||||
|
||||
fr->stereo = (fr->mode == MPG_MD_MONO) ? 1 : 2;
|
||||
|
||||
if(!fr->bitrate_index)
|
||||
{
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Free format not supported.\n");
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
switch(fr->lay)
|
||||
{
|
||||
case 1:
|
||||
#if 0
|
||||
fr->do_layer = do_layer1;
|
||||
fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
|
||||
(fr->mode_ext<<2)+4 : 32;
|
||||
fr->framesize = (long) tabsel_123[fr->lsf][0][fr->bitrate_index] * 12000;
|
||||
fr->framesize /= freqs[fr->sampling_frequency];
|
||||
fr->framesize = ((fr->framesize+fr->padding)<<2)-4;
|
||||
#else
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"layer=1 Not supported!\n");
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
#if 1
|
||||
fr->do_layer = do_layer2;
|
||||
// in layer2.c
|
||||
// II_select_table(fr);
|
||||
// fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
|
||||
// (fr->mode_ext<<2)+4 : fr->II_sblimit;
|
||||
fr->framesize = (long) tabsel_123[fr->lsf][1][fr->bitrate_index] * 144000;
|
||||
fr->framesize /= freqs[fr->sampling_frequency];
|
||||
fr->framesize += fr->padding - 4;
|
||||
#endif
|
||||
break;
|
||||
case 3:
|
||||
fr->do_layer = do_layer3;
|
||||
#if 0
|
||||
if(fr->lsf)
|
||||
ssize = (fr->stereo == 1) ? 9 : 17;
|
||||
else
|
||||
ssize = (fr->stereo == 1) ? 17 : 32;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if(fr->error_protection)
|
||||
ssize += 2;
|
||||
#endif
|
||||
|
||||
/* ------- BEGIN OF MODIFICATIONS FOR mpglib.dll
|
||||
Because LCC-Win32 made the Program crash at this
|
||||
point, the following modification was necessary.
|
||||
fr->framesize = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000;
|
||||
fr->framesize /= freqs[fr->sampling_frequency]<<(fr->lsf);
|
||||
fr->framesize = fr->framesize + fr->padding - 4;
|
||||
*/
|
||||
ltmp = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000;
|
||||
ltmp /= freqs[fr->sampling_frequency]<<(fr->lsf);
|
||||
ltmp = ltmp + fr->padding - 4;
|
||||
fr->framesize=ltmp;
|
||||
/* ------- END OF MODIFICATIONS FOR mpglib.dll
|
||||
*/
|
||||
|
||||
break;
|
||||
default:
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Sorry, unknown layer type.\n");
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* print_header(fr); */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
unsigned int getbits(struct StaticData * psd, int number_of_bits)
|
||||
{
|
||||
unsigned long rval;
|
||||
|
||||
if(!number_of_bits)
|
||||
return 0;
|
||||
|
||||
{
|
||||
rval = psd->wordpointer[0];
|
||||
rval <<= 8;
|
||||
rval |= psd->wordpointer[1];
|
||||
rval <<= 8;
|
||||
rval |= psd->wordpointer[2];
|
||||
rval <<= psd->bitindex;
|
||||
rval &= 0xffffff;
|
||||
|
||||
psd->bitindex += number_of_bits;
|
||||
|
||||
rval >>= (24-number_of_bits);
|
||||
|
||||
psd->wordpointer += (psd->bitindex>>3);
|
||||
psd->bitindex &= 7;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
unsigned int getbits_fast(struct StaticData * psd, int number_of_bits)
|
||||
{
|
||||
unsigned long rval;
|
||||
|
||||
{
|
||||
rval = psd->wordpointer[0];
|
||||
rval <<= 8;
|
||||
rval |= psd->wordpointer[1];
|
||||
rval <<= psd->bitindex;
|
||||
rval &= 0xffff;
|
||||
psd->bitindex += number_of_bits;
|
||||
|
||||
rval >>= (16-number_of_bits);
|
||||
|
||||
psd->wordpointer += (psd->bitindex>>3);
|
||||
psd->bitindex &= 7;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
/********************************/
|
||||
|
||||
double compute_bpf(struct frame *fr)
|
||||
{
|
||||
double bpf;
|
||||
|
||||
switch(fr->lay) {
|
||||
case 1:
|
||||
bpf = tabsel_123[fr->lsf][0][fr->bitrate_index];
|
||||
bpf *= 12000.0 * 4.0;
|
||||
bpf /= freqs[fr->sampling_frequency] <<(fr->lsf);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
bpf = tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index]; bpf *= 144000;
|
||||
bpf /= freqs[fr->sampling_frequency] << (fr->lsf);
|
||||
break;
|
||||
default:
|
||||
bpf = 1.0;
|
||||
}
|
||||
|
||||
return bpf;
|
||||
}
|
||||
|
||||
double compute_tpf(struct frame *fr)
|
||||
{
|
||||
static int bs[4] = { 0,384,1152,1152 };
|
||||
double tpf;
|
||||
|
||||
tpf = (double) bs[fr->lay];
|
||||
tpf /= freqs[fr->sampling_frequency] << (fr->lsf);
|
||||
return tpf;
|
||||
}
|
||||
|
||||
int ExtractI4(unsigned char *buf)
|
||||
{
|
||||
int x;
|
||||
x = buf[0];
|
||||
x <<= 8;
|
||||
x |= buf[1];
|
||||
x <<= 8;
|
||||
x |= buf[2];
|
||||
x <<= 8;
|
||||
x |= buf[3];
|
||||
return x;
|
||||
}
|
||||
|
||||
int GetVbrTag(VBRTAGDATA *pTagData, unsigned char *buf)
|
||||
{
|
||||
int i, head_flags;
|
||||
int h_id, h_mode, h_sr_index;
|
||||
static int sr_table[4] = { 44100, 48000, 32000, 99999 };
|
||||
|
||||
pTagData->flags = 0;
|
||||
|
||||
h_id = (buf[1] >> 3) & 1;
|
||||
h_sr_index = (buf[2] >> 2) & 3;
|
||||
h_mode = (buf[3] >> 6) & 3;
|
||||
|
||||
if( h_id )
|
||||
{
|
||||
if( h_mode != 3 ) buf+=(32+4);
|
||||
else buf+=(17+4);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( h_mode != 3 ) buf+=(17+4);
|
||||
else buf+=(9+4);
|
||||
}
|
||||
|
||||
if( buf[0] != VBRTag[0] ) return 0;
|
||||
if( buf[1] != VBRTag[1] ) return 0;
|
||||
if( buf[2] != VBRTag[2] ) return 0;
|
||||
if( buf[3] != VBRTag[3] ) return 0;
|
||||
|
||||
buf+=4;
|
||||
|
||||
pTagData->h_id = h_id;
|
||||
|
||||
pTagData->samprate = sr_table[h_sr_index];
|
||||
|
||||
if( h_id == 0 )
|
||||
pTagData->samprate >>= 1;
|
||||
|
||||
head_flags = pTagData->flags = ExtractI4(buf); buf+=4;
|
||||
|
||||
if( head_flags & FRAMES_FLAG )
|
||||
{
|
||||
pTagData->frames = ExtractI4(buf); buf+=4;
|
||||
}
|
||||
|
||||
if( head_flags & BYTES_FLAG )
|
||||
{
|
||||
pTagData->bytes = ExtractI4(buf); buf+=4;
|
||||
}
|
||||
|
||||
if( head_flags & TOC_FLAG )
|
||||
{
|
||||
if( pTagData->toc != NULL )
|
||||
{
|
||||
for(i=0;i<NUMTOCENTRIES;i++)
|
||||
pTagData->toc[i] = buf[i];
|
||||
}
|
||||
buf+=NUMTOCENTRIES;
|
||||
}
|
||||
|
||||
pTagData->vbr_scale = -1;
|
||||
|
||||
if( head_flags & VBR_SCALE_FLAG )
|
||||
{
|
||||
pTagData->vbr_scale = ExtractI4(buf); buf+=4;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int SeekPoint(unsigned char TOC[NUMTOCENTRIES], int file_bytes, double percent)
|
||||
{
|
||||
/* interpolate in TOC to get file seek point in bytes */
|
||||
int a, seekpoint;
|
||||
double fa, fb, fx;
|
||||
|
||||
if( percent < (double)0.0 ) percent = (double)0.0;
|
||||
if( percent > (double)100.0 ) percent = (double)100.0;
|
||||
|
||||
a = (int)percent;
|
||||
if( a > 99 ) a = 99;
|
||||
fa = TOC[a];
|
||||
if( a < 99 ) {
|
||||
fb = TOC[a+1];
|
||||
} else {
|
||||
fb = (double)256.0;
|
||||
}
|
||||
|
||||
fx = fa + (fb-fa)*(percent-a);
|
||||
|
||||
seekpoint = (int)(((double)(1.0/256.0))*fx*file_bytes);
|
||||
|
||||
return seekpoint;
|
||||
}
|
||||
|
|
@ -1,314 +0,0 @@
|
|||
/*
|
||||
* Discrete Cosine Tansform (DCT) for subband synthesis
|
||||
* optimized for machines with no auto-increment.
|
||||
* The performance is highly compiler dependend. Maybe
|
||||
* the dct64.c version for 'normal' processor may be faster
|
||||
* even for Intel processors.
|
||||
*/
|
||||
|
||||
#include "mpg123.h"
|
||||
|
||||
static void dct64_1(struct StaticData * psd, real *out0,real *out1,real *b1,real *b2,real *samples)
|
||||
{
|
||||
|
||||
{
|
||||
register real *costab = psd->pnts[0];
|
||||
|
||||
b1[0x00] = samples[0x00] + samples[0x1F];
|
||||
b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0];
|
||||
|
||||
b1[0x01] = samples[0x01] + samples[0x1E];
|
||||
b1[0x1E] = (samples[0x01] - samples[0x1E]) * costab[0x1];
|
||||
|
||||
b1[0x02] = samples[0x02] + samples[0x1D];
|
||||
b1[0x1D] = (samples[0x02] - samples[0x1D]) * costab[0x2];
|
||||
|
||||
b1[0x03] = samples[0x03] + samples[0x1C];
|
||||
b1[0x1C] = (samples[0x03] - samples[0x1C]) * costab[0x3];
|
||||
|
||||
b1[0x04] = samples[0x04] + samples[0x1B];
|
||||
b1[0x1B] = (samples[0x04] - samples[0x1B]) * costab[0x4];
|
||||
|
||||
b1[0x05] = samples[0x05] + samples[0x1A];
|
||||
b1[0x1A] = (samples[0x05] - samples[0x1A]) * costab[0x5];
|
||||
|
||||
b1[0x06] = samples[0x06] + samples[0x19];
|
||||
b1[0x19] = (samples[0x06] - samples[0x19]) * costab[0x6];
|
||||
|
||||
b1[0x07] = samples[0x07] + samples[0x18];
|
||||
b1[0x18] = (samples[0x07] - samples[0x18]) * costab[0x7];
|
||||
|
||||
b1[0x08] = samples[0x08] + samples[0x17];
|
||||
b1[0x17] = (samples[0x08] - samples[0x17]) * costab[0x8];
|
||||
|
||||
b1[0x09] = samples[0x09] + samples[0x16];
|
||||
b1[0x16] = (samples[0x09] - samples[0x16]) * costab[0x9];
|
||||
|
||||
b1[0x0A] = samples[0x0A] + samples[0x15];
|
||||
b1[0x15] = (samples[0x0A] - samples[0x15]) * costab[0xA];
|
||||
|
||||
b1[0x0B] = samples[0x0B] + samples[0x14];
|
||||
b1[0x14] = (samples[0x0B] - samples[0x14]) * costab[0xB];
|
||||
|
||||
b1[0x0C] = samples[0x0C] + samples[0x13];
|
||||
b1[0x13] = (samples[0x0C] - samples[0x13]) * costab[0xC];
|
||||
|
||||
b1[0x0D] = samples[0x0D] + samples[0x12];
|
||||
b1[0x12] = (samples[0x0D] - samples[0x12]) * costab[0xD];
|
||||
|
||||
b1[0x0E] = samples[0x0E] + samples[0x11];
|
||||
b1[0x11] = (samples[0x0E] - samples[0x11]) * costab[0xE];
|
||||
|
||||
b1[0x0F] = samples[0x0F] + samples[0x10];
|
||||
b1[0x10] = (samples[0x0F] - samples[0x10]) * costab[0xF];
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
register real *costab = psd->pnts[1];
|
||||
|
||||
b2[0x00] = b1[0x00] + b1[0x0F];
|
||||
b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0];
|
||||
b2[0x01] = b1[0x01] + b1[0x0E];
|
||||
b2[0x0E] = (b1[0x01] - b1[0x0E]) * costab[1];
|
||||
b2[0x02] = b1[0x02] + b1[0x0D];
|
||||
b2[0x0D] = (b1[0x02] - b1[0x0D]) * costab[2];
|
||||
b2[0x03] = b1[0x03] + b1[0x0C];
|
||||
b2[0x0C] = (b1[0x03] - b1[0x0C]) * costab[3];
|
||||
b2[0x04] = b1[0x04] + b1[0x0B];
|
||||
b2[0x0B] = (b1[0x04] - b1[0x0B]) * costab[4];
|
||||
b2[0x05] = b1[0x05] + b1[0x0A];
|
||||
b2[0x0A] = (b1[0x05] - b1[0x0A]) * costab[5];
|
||||
b2[0x06] = b1[0x06] + b1[0x09];
|
||||
b2[0x09] = (b1[0x06] - b1[0x09]) * costab[6];
|
||||
b2[0x07] = b1[0x07] + b1[0x08];
|
||||
b2[0x08] = (b1[0x07] - b1[0x08]) * costab[7];
|
||||
|
||||
b2[0x10] = b1[0x10] + b1[0x1F];
|
||||
b2[0x1F] = (b1[0x1F] - b1[0x10]) * costab[0];
|
||||
b2[0x11] = b1[0x11] + b1[0x1E];
|
||||
b2[0x1E] = (b1[0x1E] - b1[0x11]) * costab[1];
|
||||
b2[0x12] = b1[0x12] + b1[0x1D];
|
||||
b2[0x1D] = (b1[0x1D] - b1[0x12]) * costab[2];
|
||||
b2[0x13] = b1[0x13] + b1[0x1C];
|
||||
b2[0x1C] = (b1[0x1C] - b1[0x13]) * costab[3];
|
||||
b2[0x14] = b1[0x14] + b1[0x1B];
|
||||
b2[0x1B] = (b1[0x1B] - b1[0x14]) * costab[4];
|
||||
b2[0x15] = b1[0x15] + b1[0x1A];
|
||||
b2[0x1A] = (b1[0x1A] - b1[0x15]) * costab[5];
|
||||
b2[0x16] = b1[0x16] + b1[0x19];
|
||||
b2[0x19] = (b1[0x19] - b1[0x16]) * costab[6];
|
||||
b2[0x17] = b1[0x17] + b1[0x18];
|
||||
b2[0x18] = (b1[0x18] - b1[0x17]) * costab[7];
|
||||
}
|
||||
|
||||
{
|
||||
register real *costab = psd->pnts[2];
|
||||
|
||||
b1[0x00] = b2[0x00] + b2[0x07];
|
||||
b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0];
|
||||
b1[0x01] = b2[0x01] + b2[0x06];
|
||||
b1[0x06] = (b2[0x01] - b2[0x06]) * costab[1];
|
||||
b1[0x02] = b2[0x02] + b2[0x05];
|
||||
b1[0x05] = (b2[0x02] - b2[0x05]) * costab[2];
|
||||
b1[0x03] = b2[0x03] + b2[0x04];
|
||||
b1[0x04] = (b2[0x03] - b2[0x04]) * costab[3];
|
||||
|
||||
b1[0x08] = b2[0x08] + b2[0x0F];
|
||||
b1[0x0F] = (b2[0x0F] - b2[0x08]) * costab[0];
|
||||
b1[0x09] = b2[0x09] + b2[0x0E];
|
||||
b1[0x0E] = (b2[0x0E] - b2[0x09]) * costab[1];
|
||||
b1[0x0A] = b2[0x0A] + b2[0x0D];
|
||||
b1[0x0D] = (b2[0x0D] - b2[0x0A]) * costab[2];
|
||||
b1[0x0B] = b2[0x0B] + b2[0x0C];
|
||||
b1[0x0C] = (b2[0x0C] - b2[0x0B]) * costab[3];
|
||||
|
||||
b1[0x10] = b2[0x10] + b2[0x17];
|
||||
b1[0x17] = (b2[0x10] - b2[0x17]) * costab[0];
|
||||
b1[0x11] = b2[0x11] + b2[0x16];
|
||||
b1[0x16] = (b2[0x11] - b2[0x16]) * costab[1];
|
||||
b1[0x12] = b2[0x12] + b2[0x15];
|
||||
b1[0x15] = (b2[0x12] - b2[0x15]) * costab[2];
|
||||
b1[0x13] = b2[0x13] + b2[0x14];
|
||||
b1[0x14] = (b2[0x13] - b2[0x14]) * costab[3];
|
||||
|
||||
b1[0x18] = b2[0x18] + b2[0x1F];
|
||||
b1[0x1F] = (b2[0x1F] - b2[0x18]) * costab[0];
|
||||
b1[0x19] = b2[0x19] + b2[0x1E];
|
||||
b1[0x1E] = (b2[0x1E] - b2[0x19]) * costab[1];
|
||||
b1[0x1A] = b2[0x1A] + b2[0x1D];
|
||||
b1[0x1D] = (b2[0x1D] - b2[0x1A]) * costab[2];
|
||||
b1[0x1B] = b2[0x1B] + b2[0x1C];
|
||||
b1[0x1C] = (b2[0x1C] - b2[0x1B]) * costab[3];
|
||||
}
|
||||
|
||||
{
|
||||
register real const cos0 = psd->pnts[3][0];
|
||||
register real const cos1 = psd->pnts[3][1];
|
||||
|
||||
b2[0x00] = b1[0x00] + b1[0x03];
|
||||
b2[0x03] = (b1[0x00] - b1[0x03]) * cos0;
|
||||
b2[0x01] = b1[0x01] + b1[0x02];
|
||||
b2[0x02] = (b1[0x01] - b1[0x02]) * cos1;
|
||||
|
||||
b2[0x04] = b1[0x04] + b1[0x07];
|
||||
b2[0x07] = (b1[0x07] - b1[0x04]) * cos0;
|
||||
b2[0x05] = b1[0x05] + b1[0x06];
|
||||
b2[0x06] = (b1[0x06] - b1[0x05]) * cos1;
|
||||
|
||||
b2[0x08] = b1[0x08] + b1[0x0B];
|
||||
b2[0x0B] = (b1[0x08] - b1[0x0B]) * cos0;
|
||||
b2[0x09] = b1[0x09] + b1[0x0A];
|
||||
b2[0x0A] = (b1[0x09] - b1[0x0A]) * cos1;
|
||||
|
||||
b2[0x0C] = b1[0x0C] + b1[0x0F];
|
||||
b2[0x0F] = (b1[0x0F] - b1[0x0C]) * cos0;
|
||||
b2[0x0D] = b1[0x0D] + b1[0x0E];
|
||||
b2[0x0E] = (b1[0x0E] - b1[0x0D]) * cos1;
|
||||
|
||||
b2[0x10] = b1[0x10] + b1[0x13];
|
||||
b2[0x13] = (b1[0x10] - b1[0x13]) * cos0;
|
||||
b2[0x11] = b1[0x11] + b1[0x12];
|
||||
b2[0x12] = (b1[0x11] - b1[0x12]) * cos1;
|
||||
|
||||
b2[0x14] = b1[0x14] + b1[0x17];
|
||||
b2[0x17] = (b1[0x17] - b1[0x14]) * cos0;
|
||||
b2[0x15] = b1[0x15] + b1[0x16];
|
||||
b2[0x16] = (b1[0x16] - b1[0x15]) * cos1;
|
||||
|
||||
b2[0x18] = b1[0x18] + b1[0x1B];
|
||||
b2[0x1B] = (b1[0x18] - b1[0x1B]) * cos0;
|
||||
b2[0x19] = b1[0x19] + b1[0x1A];
|
||||
b2[0x1A] = (b1[0x19] - b1[0x1A]) * cos1;
|
||||
|
||||
b2[0x1C] = b1[0x1C] + b1[0x1F];
|
||||
b2[0x1F] = (b1[0x1F] - b1[0x1C]) * cos0;
|
||||
b2[0x1D] = b1[0x1D] + b1[0x1E];
|
||||
b2[0x1E] = (b1[0x1E] - b1[0x1D]) * cos1;
|
||||
}
|
||||
|
||||
{
|
||||
register real const cos0 = psd->pnts[4][0];
|
||||
|
||||
b1[0x00] = b2[0x00] + b2[0x01];
|
||||
b1[0x01] = (b2[0x00] - b2[0x01]) * cos0;
|
||||
b1[0x02] = b2[0x02] + b2[0x03];
|
||||
b1[0x03] = (b2[0x03] - b2[0x02]) * cos0;
|
||||
b1[0x02] += b1[0x03];
|
||||
|
||||
b1[0x04] = b2[0x04] + b2[0x05];
|
||||
b1[0x05] = (b2[0x04] - b2[0x05]) * cos0;
|
||||
b1[0x06] = b2[0x06] + b2[0x07];
|
||||
b1[0x07] = (b2[0x07] - b2[0x06]) * cos0;
|
||||
b1[0x06] += b1[0x07];
|
||||
b1[0x04] += b1[0x06];
|
||||
b1[0x06] += b1[0x05];
|
||||
b1[0x05] += b1[0x07];
|
||||
|
||||
b1[0x08] = b2[0x08] + b2[0x09];
|
||||
b1[0x09] = (b2[0x08] - b2[0x09]) * cos0;
|
||||
b1[0x0A] = b2[0x0A] + b2[0x0B];
|
||||
b1[0x0B] = (b2[0x0B] - b2[0x0A]) * cos0;
|
||||
b1[0x0A] += b1[0x0B];
|
||||
|
||||
b1[0x0C] = b2[0x0C] + b2[0x0D];
|
||||
b1[0x0D] = (b2[0x0C] - b2[0x0D]) * cos0;
|
||||
b1[0x0E] = b2[0x0E] + b2[0x0F];
|
||||
b1[0x0F] = (b2[0x0F] - b2[0x0E]) * cos0;
|
||||
b1[0x0E] += b1[0x0F];
|
||||
b1[0x0C] += b1[0x0E];
|
||||
b1[0x0E] += b1[0x0D];
|
||||
b1[0x0D] += b1[0x0F];
|
||||
|
||||
b1[0x10] = b2[0x10] + b2[0x11];
|
||||
b1[0x11] = (b2[0x10] - b2[0x11]) * cos0;
|
||||
b1[0x12] = b2[0x12] + b2[0x13];
|
||||
b1[0x13] = (b2[0x13] - b2[0x12]) * cos0;
|
||||
b1[0x12] += b1[0x13];
|
||||
|
||||
b1[0x14] = b2[0x14] + b2[0x15];
|
||||
b1[0x15] = (b2[0x14] - b2[0x15]) * cos0;
|
||||
b1[0x16] = b2[0x16] + b2[0x17];
|
||||
b1[0x17] = (b2[0x17] - b2[0x16]) * cos0;
|
||||
b1[0x16] += b1[0x17];
|
||||
b1[0x14] += b1[0x16];
|
||||
b1[0x16] += b1[0x15];
|
||||
b1[0x15] += b1[0x17];
|
||||
|
||||
b1[0x18] = b2[0x18] + b2[0x19];
|
||||
b1[0x19] = (b2[0x18] - b2[0x19]) * cos0;
|
||||
b1[0x1A] = b2[0x1A] + b2[0x1B];
|
||||
b1[0x1B] = (b2[0x1B] - b2[0x1A]) * cos0;
|
||||
b1[0x1A] += b1[0x1B];
|
||||
|
||||
b1[0x1C] = b2[0x1C] + b2[0x1D];
|
||||
b1[0x1D] = (b2[0x1C] - b2[0x1D]) * cos0;
|
||||
b1[0x1E] = b2[0x1E] + b2[0x1F];
|
||||
b1[0x1F] = (b2[0x1F] - b2[0x1E]) * cos0;
|
||||
b1[0x1E] += b1[0x1F];
|
||||
b1[0x1C] += b1[0x1E];
|
||||
b1[0x1E] += b1[0x1D];
|
||||
b1[0x1D] += b1[0x1F];
|
||||
}
|
||||
|
||||
out0[0x10*16] = b1[0x00];
|
||||
out0[0x10*12] = b1[0x04];
|
||||
out0[0x10* 8] = b1[0x02];
|
||||
out0[0x10* 4] = b1[0x06];
|
||||
out0[0x10* 0] = b1[0x01];
|
||||
out1[0x10* 0] = b1[0x01];
|
||||
out1[0x10* 4] = b1[0x05];
|
||||
out1[0x10* 8] = b1[0x03];
|
||||
out1[0x10*12] = b1[0x07];
|
||||
|
||||
b1[0x08] += b1[0x0C];
|
||||
out0[0x10*14] = b1[0x08];
|
||||
b1[0x0C] += b1[0x0a];
|
||||
out0[0x10*10] = b1[0x0C];
|
||||
b1[0x0A] += b1[0x0E];
|
||||
out0[0x10* 6] = b1[0x0A];
|
||||
b1[0x0E] += b1[0x09];
|
||||
out0[0x10* 2] = b1[0x0E];
|
||||
b1[0x09] += b1[0x0D];
|
||||
out1[0x10* 2] = b1[0x09];
|
||||
b1[0x0D] += b1[0x0B];
|
||||
out1[0x10* 6] = b1[0x0D];
|
||||
b1[0x0B] += b1[0x0F];
|
||||
out1[0x10*10] = b1[0x0B];
|
||||
out1[0x10*14] = b1[0x0F];
|
||||
|
||||
b1[0x18] += b1[0x1C];
|
||||
out0[0x10*15] = b1[0x10] + b1[0x18];
|
||||
out0[0x10*13] = b1[0x18] + b1[0x14];
|
||||
b1[0x1C] += b1[0x1a];
|
||||
out0[0x10*11] = b1[0x14] + b1[0x1C];
|
||||
out0[0x10* 9] = b1[0x1C] + b1[0x12];
|
||||
b1[0x1A] += b1[0x1E];
|
||||
out0[0x10* 7] = b1[0x12] + b1[0x1A];
|
||||
out0[0x10* 5] = b1[0x1A] + b1[0x16];
|
||||
b1[0x1E] += b1[0x19];
|
||||
out0[0x10* 3] = b1[0x16] + b1[0x1E];
|
||||
out0[0x10* 1] = b1[0x1E] + b1[0x11];
|
||||
b1[0x19] += b1[0x1D];
|
||||
out1[0x10* 1] = b1[0x11] + b1[0x19];
|
||||
out1[0x10* 3] = b1[0x19] + b1[0x15];
|
||||
b1[0x1D] += b1[0x1B];
|
||||
out1[0x10* 5] = b1[0x15] + b1[0x1D];
|
||||
out1[0x10* 7] = b1[0x1D] + b1[0x13];
|
||||
b1[0x1B] += b1[0x1F];
|
||||
out1[0x10* 9] = b1[0x13] + b1[0x1B];
|
||||
out1[0x10*11] = b1[0x1B] + b1[0x17];
|
||||
out1[0x10*13] = b1[0x17] + b1[0x1F];
|
||||
out1[0x10*15] = b1[0x1F];
|
||||
}
|
||||
|
||||
/*
|
||||
* the call via dct64 is a trick to force GCC to use
|
||||
* (new) registers for the b1,b2 pointer to the bufs[xx] field
|
||||
*/
|
||||
void dct64(struct StaticData * psd, real *a,real *b,real *c)
|
||||
{
|
||||
real bufs[0x40];
|
||||
dct64_1(psd, a,b,bufs,bufs+0x20,c);
|
||||
}
|
||||
|
|
@ -1,261 +0,0 @@
|
|||
/*
|
||||
* Mpeg Layer-1,2,3 audio decoder
|
||||
* ------------------------------
|
||||
* copyright (c) 1995,1996,1997 by Michael Hipp, All rights reserved.
|
||||
* See also 'README'
|
||||
*
|
||||
* slighlty optimized for machines without autoincrement/decrement.
|
||||
* The performance is highly compiler dependend. Maybe
|
||||
* the decode.c version for 'normal' processor may be faster
|
||||
* even for Intel processors.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpg123.h"
|
||||
#include "mpglib.h"
|
||||
|
||||
/* old WRITE_SAMPLE */
|
||||
#define WRITE_SAMPLE(samples,sum,clip) \
|
||||
if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \
|
||||
else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \
|
||||
else { *(samples) = sum; }
|
||||
|
||||
int synth_1to1_mono(struct StaticData * psd, struct mpstr * gmp, real *bandPtr,unsigned char *samples,int *pnt)
|
||||
{
|
||||
short samples_tmp[64];
|
||||
short *tmp1 = samples_tmp;
|
||||
int i,ret;
|
||||
int pnt1 = 0;
|
||||
|
||||
ret = synth_1to1(psd, gmp, bandPtr,0,(unsigned char *) samples_tmp,&pnt1);
|
||||
samples += *pnt;
|
||||
|
||||
for(i=0;i<32;i++) {
|
||||
*( (short *) samples) = *tmp1;
|
||||
samples += 2;
|
||||
tmp1 += 2;
|
||||
}
|
||||
*pnt += 64;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int synth_1to1(struct StaticData * psd, struct mpstr * gmp, real *bandPtr,int channel,unsigned char *out,int *pnt)
|
||||
{
|
||||
const int step = 2;
|
||||
|
||||
int bo;
|
||||
|
||||
short *samples = (short *) (out + *pnt);
|
||||
|
||||
real *b0,(*buf)[0x110];
|
||||
int clip = 0;
|
||||
int bo1;
|
||||
|
||||
bo = gmp->synth_bo;
|
||||
|
||||
if(!channel) {
|
||||
bo--;
|
||||
bo &= 0xf;
|
||||
buf = gmp->synth_buffs[0];
|
||||
}
|
||||
else {
|
||||
samples++;
|
||||
buf = gmp->synth_buffs[1];
|
||||
}
|
||||
|
||||
if(bo & 0x1) {
|
||||
b0 = buf[0];
|
||||
bo1 = bo;
|
||||
dct64(psd, buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr);
|
||||
}
|
||||
else {
|
||||
b0 = buf[1];
|
||||
bo1 = bo+1;
|
||||
dct64(psd, buf[0]+bo,buf[1]+bo+1,bandPtr);
|
||||
}
|
||||
|
||||
gmp->synth_bo = bo;
|
||||
|
||||
{
|
||||
register int j;
|
||||
real *window = psd->decwin + 16 - bo1;
|
||||
|
||||
for (j=16;j;j--,b0+=0x10,window+=0x20,samples+=step)
|
||||
{
|
||||
real sum;
|
||||
sum = window[0x0] * b0[0x0];
|
||||
sum -= window[0x1] * b0[0x1];
|
||||
sum += window[0x2] * b0[0x2];
|
||||
sum -= window[0x3] * b0[0x3];
|
||||
sum += window[0x4] * b0[0x4];
|
||||
sum -= window[0x5] * b0[0x5];
|
||||
sum += window[0x6] * b0[0x6];
|
||||
sum -= window[0x7] * b0[0x7];
|
||||
sum += window[0x8] * b0[0x8];
|
||||
sum -= window[0x9] * b0[0x9];
|
||||
sum += window[0xA] * b0[0xA];
|
||||
sum -= window[0xB] * b0[0xB];
|
||||
sum += window[0xC] * b0[0xC];
|
||||
sum -= window[0xD] * b0[0xD];
|
||||
sum += window[0xE] * b0[0xE];
|
||||
sum -= window[0xF] * b0[0xF];
|
||||
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
}
|
||||
|
||||
{
|
||||
real sum;
|
||||
sum = window[0x0] * b0[0x0];
|
||||
sum += window[0x2] * b0[0x2];
|
||||
sum += window[0x4] * b0[0x4];
|
||||
sum += window[0x6] * b0[0x6];
|
||||
sum += window[0x8] * b0[0x8];
|
||||
sum += window[0xA] * b0[0xA];
|
||||
sum += window[0xC] * b0[0xC];
|
||||
sum += window[0xE] * b0[0xE];
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
b0-=0x10,window-=0x20,samples+=step;
|
||||
}
|
||||
window += bo1<<1;
|
||||
|
||||
for (j=15;j;j--,b0-=0x10,window-=0x20,samples+=step)
|
||||
{
|
||||
real sum;
|
||||
sum = -window[-0x1] * b0[0x0];
|
||||
sum -= window[-0x2] * b0[0x1];
|
||||
sum -= window[-0x3] * b0[0x2];
|
||||
sum -= window[-0x4] * b0[0x3];
|
||||
sum -= window[-0x5] * b0[0x4];
|
||||
sum -= window[-0x6] * b0[0x5];
|
||||
sum -= window[-0x7] * b0[0x6];
|
||||
sum -= window[-0x8] * b0[0x7];
|
||||
sum -= window[-0x9] * b0[0x8];
|
||||
sum -= window[-0xA] * b0[0x9];
|
||||
sum -= window[-0xB] * b0[0xA];
|
||||
sum -= window[-0xC] * b0[0xB];
|
||||
sum -= window[-0xD] * b0[0xC];
|
||||
sum -= window[-0xE] * b0[0xD];
|
||||
sum -= window[-0xF] * b0[0xE];
|
||||
sum -= window[-0x0] * b0[0xF];
|
||||
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
}
|
||||
}
|
||||
*pnt += 128;
|
||||
|
||||
return clip;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int tsynth_1to1(struct StaticData * psd, real *bandPtr,int channel,unsigned char *out,int *pnt)
|
||||
{
|
||||
const int step = 2;
|
||||
|
||||
short *samples = (short *) (out + *pnt);
|
||||
|
||||
real *b0,(*buf)[0x110];
|
||||
int clip = 0;
|
||||
int bo1;
|
||||
|
||||
if(!channel) {
|
||||
psd->bo--;
|
||||
psd->bo &= 0xf;
|
||||
buf = psd->buffs[0];
|
||||
}
|
||||
else {
|
||||
samples++;
|
||||
buf = psd->buffs[1];
|
||||
}
|
||||
|
||||
if(psd->bo & 0x1) {
|
||||
b0 = buf[0];
|
||||
bo1 = psd->bo;
|
||||
dct64(psd, buf[1]+((psd->bo+1)&0xf),buf[0]+psd->bo,bandPtr);
|
||||
}
|
||||
else {
|
||||
b0 = buf[1];
|
||||
bo1 = psd->bo+1;
|
||||
dct64(psd, buf[0]+psd->bo,buf[1]+psd->bo+1,bandPtr);
|
||||
}
|
||||
|
||||
{
|
||||
register int j;
|
||||
real *window = psd->decwin + 16 - bo1;
|
||||
|
||||
for (j=16;j;j--,b0+=0x10,window+=0x20,samples+=step)
|
||||
{
|
||||
real sum;
|
||||
sum = window[0x0] * b0[0x0];
|
||||
sum -= window[0x1] * b0[0x1];
|
||||
sum += window[0x2] * b0[0x2];
|
||||
sum -= window[0x3] * b0[0x3];
|
||||
sum += window[0x4] * b0[0x4];
|
||||
sum -= window[0x5] * b0[0x5];
|
||||
sum += window[0x6] * b0[0x6];
|
||||
sum -= window[0x7] * b0[0x7];
|
||||
sum += window[0x8] * b0[0x8];
|
||||
sum -= window[0x9] * b0[0x9];
|
||||
sum += window[0xA] * b0[0xA];
|
||||
sum -= window[0xB] * b0[0xB];
|
||||
sum += window[0xC] * b0[0xC];
|
||||
sum -= window[0xD] * b0[0xD];
|
||||
sum += window[0xE] * b0[0xE];
|
||||
sum -= window[0xF] * b0[0xF];
|
||||
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
}
|
||||
|
||||
{
|
||||
real sum;
|
||||
sum = window[0x0] * b0[0x0];
|
||||
sum += window[0x2] * b0[0x2];
|
||||
sum += window[0x4] * b0[0x4];
|
||||
sum += window[0x6] * b0[0x6];
|
||||
sum += window[0x8] * b0[0x8];
|
||||
sum += window[0xA] * b0[0xA];
|
||||
sum += window[0xC] * b0[0xC];
|
||||
sum += window[0xE] * b0[0xE];
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
b0-=0x10,window-=0x20,samples+=step;
|
||||
}
|
||||
window += bo1<<1;
|
||||
|
||||
for (j=15;j;j--,b0-=0x10,window-=0x20,samples+=step)
|
||||
{
|
||||
real sum;
|
||||
sum = -window[-0x1] * b0[0x0];
|
||||
sum -= window[-0x2] * b0[0x1];
|
||||
sum -= window[-0x3] * b0[0x2];
|
||||
sum -= window[-0x4] * b0[0x3];
|
||||
sum -= window[-0x5] * b0[0x4];
|
||||
sum -= window[-0x6] * b0[0x5];
|
||||
sum -= window[-0x7] * b0[0x6];
|
||||
sum -= window[-0x8] * b0[0x7];
|
||||
sum -= window[-0x9] * b0[0x8];
|
||||
sum -= window[-0xA] * b0[0x9];
|
||||
sum -= window[-0xB] * b0[0xA];
|
||||
sum -= window[-0xC] * b0[0xB];
|
||||
sum -= window[-0xD] * b0[0xC];
|
||||
sum -= window[-0xE] * b0[0xD];
|
||||
sum -= window[-0xF] * b0[0xE];
|
||||
sum -= window[-0x0] * b0[0xF];
|
||||
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
}
|
||||
}
|
||||
*pnt += 128;
|
||||
|
||||
return clip;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,332 +0,0 @@
|
|||
/*
|
||||
* huffman tables ... recalcualted to work with my optimzed
|
||||
* decoder scheme (MH)
|
||||
*
|
||||
* probably we could save a few bytes of memory, because the
|
||||
* smaller tables are often the part of a bigger table
|
||||
*/
|
||||
|
||||
struct newhuff
|
||||
{
|
||||
unsigned int linbits;
|
||||
const short *table;
|
||||
};
|
||||
|
||||
const short tab0[] =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
const short tab1[] =
|
||||
{
|
||||
-5, -3, -1, 17, 1, 16, 0
|
||||
};
|
||||
|
||||
const short tab2[] =
|
||||
{
|
||||
-15, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 17, -1, 1,
|
||||
16, 0
|
||||
};
|
||||
|
||||
const short tab3[] =
|
||||
{
|
||||
-13, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 16, 17, -1,
|
||||
1, 0
|
||||
};
|
||||
|
||||
const short tab5[] =
|
||||
{
|
||||
-29, -25, -23, -15, -7, -5, -3, -1, 51, 35, 50, 49, -3, -1, 19,
|
||||
3, -1, 48, 34, -3, -1, 18, 33, -1, 2, 32, 17, -1, 1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab6[] =
|
||||
{
|
||||
-25, -19, -13, -9, -5, -3, -1, 51, 3, 35, -1, 50, 48, -1, 19,
|
||||
49, -3, -1, 34, 2, 18, -3, -1, 33, 32, 1, -1, 17, -1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab7[] =
|
||||
{
|
||||
-69, -65, -57, -39, -29, -17, -11, -7, -3, -1, 85, 69, -1, 84, 83,
|
||||
-1, 53, 68, -3, -1, 37, 82, 21, -5, -1, 81, -1, 5, 52, -1,
|
||||
80, -1, 67, 51, -5, -3, -1, 36, 66, 20, -1, 65, 64, -11, -7,
|
||||
-3, -1, 4, 35, -1, 50, 3, -1, 19, 49, -3, -1, 48, 34, 18,
|
||||
-5, -1, 33, -1, 2, 32, 17, -1, 1, 16, 0
|
||||
};
|
||||
|
||||
const short tab8[] =
|
||||
{
|
||||
-65, -63, -59, -45, -31, -19, -13, -7, -5, -3, -1, 85, 84, 69, 83,
|
||||
-3, -1, 53, 68, 37, -3, -1, 82, 5, 21, -5, -1, 81, -1, 52,
|
||||
67, -3, -1, 80, 51, 36, -5, -3, -1, 66, 20, 65, -3, -1, 4,
|
||||
64, -1, 35, 50, -9, -7, -3, -1, 19, 49, -1, 3, 48, 34, -1,
|
||||
2, 32, -1, 18, 33, 17, -3, -1, 1, 16, 0
|
||||
};
|
||||
|
||||
const short tab9[] =
|
||||
{
|
||||
-63, -53, -41, -29, -19, -11, -5, -3, -1, 85, 69, 53, -1, 83, -1,
|
||||
84, 5, -3, -1, 68, 37, -1, 82, 21, -3, -1, 81, 52, -1, 67,
|
||||
-1, 80, 4, -7, -3, -1, 36, 66, -1, 51, 64, -1, 20, 65, -5,
|
||||
-3, -1, 35, 50, 19, -1, 49, -1, 3, 48, -5, -3, -1, 34, 2,
|
||||
18, -1, 33, 32, -3, -1, 17, 1, -1, 16, 0
|
||||
};
|
||||
|
||||
const short tab10[] =
|
||||
{
|
||||
-125,-121,-111, -83, -55, -35, -21, -13, -7, -3, -1, 119, 103, -1, 118,
|
||||
87, -3, -1, 117, 102, 71, -3, -1, 116, 86, -1, 101, 55, -9, -3,
|
||||
-1, 115, 70, -3, -1, 85, 84, 99, -1, 39, 114, -11, -5, -3, -1,
|
||||
100, 7, 112, -1, 98, -1, 69, 53, -5, -1, 6, -1, 83, 68, 23,
|
||||
-17, -5, -1, 113, -1, 54, 38, -5, -3, -1, 37, 82, 21, -1, 81,
|
||||
-1, 52, 67, -3, -1, 22, 97, -1, 96, -1, 5, 80, -19, -11, -7,
|
||||
-3, -1, 36, 66, -1, 51, 4, -1, 20, 65, -3, -1, 64, 35, -1,
|
||||
50, 3, -3, -1, 19, 49, -1, 48, 34, -7, -3, -1, 18, 33, -1,
|
||||
2, 32, 17, -1, 1, 16, 0
|
||||
};
|
||||
|
||||
const short tab11[] =
|
||||
{
|
||||
-121,-113, -89, -59, -43, -27, -17, -7, -3, -1, 119, 103, -1, 118, 117,
|
||||
-3, -1, 102, 71, -1, 116, -1, 87, 85, -5, -3, -1, 86, 101, 55,
|
||||
-1, 115, 70, -9, -7, -3, -1, 69, 84, -1, 53, 83, 39, -1, 114,
|
||||
-1, 100, 7, -5, -1, 113, -1, 23, 112, -3, -1, 54, 99, -1, 96,
|
||||
-1, 68, 37, -13, -7, -5, -3, -1, 82, 5, 21, 98, -3, -1, 38,
|
||||
6, 22, -5, -1, 97, -1, 81, 52, -5, -1, 80, -1, 67, 51, -1,
|
||||
36, 66, -15, -11, -7, -3, -1, 20, 65, -1, 4, 64, -1, 35, 50,
|
||||
-1, 19, 49, -5, -3, -1, 3, 48, 34, 33, -5, -1, 18, -1, 2,
|
||||
32, 17, -3, -1, 1, 16, 0
|
||||
};
|
||||
|
||||
const short tab12[] =
|
||||
{
|
||||
-115, -99, -73, -45, -27, -17, -9, -5, -3, -1, 119, 103, 118, -1, 87,
|
||||
117, -3, -1, 102, 71, -1, 116, 101, -3, -1, 86, 55, -3, -1, 115,
|
||||
85, 39, -7, -3, -1, 114, 70, -1, 100, 23, -5, -1, 113, -1, 7,
|
||||
112, -1, 54, 99, -13, -9, -3, -1, 69, 84, -1, 68, -1, 6, 5,
|
||||
-1, 38, 98, -5, -1, 97, -1, 22, 96, -3, -1, 53, 83, -1, 37,
|
||||
82, -17, -7, -3, -1, 21, 81, -1, 52, 67, -5, -3, -1, 80, 4,
|
||||
36, -1, 66, 20, -3, -1, 51, 65, -1, 35, 50, -11, -7, -5, -3,
|
||||
-1, 64, 3, 48, 19, -1, 49, 34, -1, 18, 33, -7, -5, -3, -1,
|
||||
2, 32, 0, 17, -1, 1, 16
|
||||
};
|
||||
|
||||
const short tab13[] =
|
||||
{
|
||||
-509,-503,-475,-405,-333,-265,-205,-153,-115, -83, -53, -35, -21, -13, -9,
|
||||
-7, -5, -3, -1, 254, 252, 253, 237, 255, -1, 239, 223, -3, -1, 238,
|
||||
207, -1, 222, 191, -9, -3, -1, 251, 206, -1, 220, -1, 175, 233, -1,
|
||||
236, 221, -9, -5, -3, -1, 250, 205, 190, -1, 235, 159, -3, -1, 249,
|
||||
234, -1, 189, 219, -17, -9, -3, -1, 143, 248, -1, 204, -1, 174, 158,
|
||||
-5, -1, 142, -1, 127, 126, 247, -5, -1, 218, -1, 173, 188, -3, -1,
|
||||
203, 246, 111, -15, -7, -3, -1, 232, 95, -1, 157, 217, -3, -1, 245,
|
||||
231, -1, 172, 187, -9, -3, -1, 79, 244, -3, -1, 202, 230, 243, -1,
|
||||
63, -1, 141, 216, -21, -9, -3, -1, 47, 242, -3, -1, 110, 156, 15,
|
||||
-5, -3, -1, 201, 94, 171, -3, -1, 125, 215, 78, -11, -5, -3, -1,
|
||||
200, 214, 62, -1, 185, -1, 155, 170, -1, 31, 241, -23, -13, -5, -1,
|
||||
240, -1, 186, 229, -3, -1, 228, 140, -1, 109, 227, -5, -1, 226, -1,
|
||||
46, 14, -1, 30, 225, -15, -7, -3, -1, 224, 93, -1, 213, 124, -3,
|
||||
-1, 199, 77, -1, 139, 184, -7, -3, -1, 212, 154, -1, 169, 108, -1,
|
||||
198, 61, -37, -21, -9, -5, -3, -1, 211, 123, 45, -1, 210, 29, -5,
|
||||
-1, 183, -1, 92, 197, -3, -1, 153, 122, 195, -7, -5, -3, -1, 167,
|
||||
151, 75, 209, -3, -1, 13, 208, -1, 138, 168, -11, -7, -3, -1, 76,
|
||||
196, -1, 107, 182, -1, 60, 44, -3, -1, 194, 91, -3, -1, 181, 137,
|
||||
28, -43, -23, -11, -5, -1, 193, -1, 152, 12, -1, 192, -1, 180, 106,
|
||||
-5, -3, -1, 166, 121, 59, -1, 179, -1, 136, 90, -11, -5, -1, 43,
|
||||
-1, 165, 105, -1, 164, -1, 120, 135, -5, -1, 148, -1, 119, 118, 178,
|
||||
-11, -3, -1, 27, 177, -3, -1, 11, 176, -1, 150, 74, -7, -3, -1,
|
||||
58, 163, -1, 89, 149, -1, 42, 162, -47, -23, -9, -3, -1, 26, 161,
|
||||
-3, -1, 10, 104, 160, -5, -3, -1, 134, 73, 147, -3, -1, 57, 88,
|
||||
-1, 133, 103, -9, -3, -1, 41, 146, -3, -1, 87, 117, 56, -5, -1,
|
||||
131, -1, 102, 71, -3, -1, 116, 86, -1, 101, 115, -11, -3, -1, 25,
|
||||
145, -3, -1, 9, 144, -1, 72, 132, -7, -5, -1, 114, -1, 70, 100,
|
||||
40, -1, 130, 24, -41, -27, -11, -5, -3, -1, 55, 39, 23, -1, 113,
|
||||
-1, 85, 7, -7, -3, -1, 112, 54, -1, 99, 69, -3, -1, 84, 38,
|
||||
-1, 98, 53, -5, -1, 129, -1, 8, 128, -3, -1, 22, 97, -1, 6,
|
||||
96, -13, -9, -5, -3, -1, 83, 68, 37, -1, 82, 5, -1, 21, 81,
|
||||
-7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51, 20, -19, -11,
|
||||
-5, -1, 65, -1, 4, 64, -3, -1, 35, 50, 19, -3, -1, 49, 3,
|
||||
-1, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1, 17, 1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab15[] =
|
||||
{
|
||||
-495,-445,-355,-263,-183,-115, -77, -43, -27, -13, -7, -3, -1, 255, 239,
|
||||
-1, 254, 223, -1, 238, -1, 253, 207, -7, -3, -1, 252, 222, -1, 237,
|
||||
191, -1, 251, -1, 206, 236, -7, -3, -1, 221, 175, -1, 250, 190, -3,
|
||||
-1, 235, 205, -1, 220, 159, -15, -7, -3, -1, 249, 234, -1, 189, 219,
|
||||
-3, -1, 143, 248, -1, 204, 158, -7, -3, -1, 233, 127, -1, 247, 173,
|
||||
-3, -1, 218, 188, -1, 111, -1, 174, 15, -19, -11, -3, -1, 203, 246,
|
||||
-3, -1, 142, 232, -1, 95, 157, -3, -1, 245, 126, -1, 231, 172, -9,
|
||||
-3, -1, 202, 187, -3, -1, 217, 141, 79, -3, -1, 244, 63, -1, 243,
|
||||
216, -33, -17, -9, -3, -1, 230, 47, -1, 242, -1, 110, 240, -3, -1,
|
||||
31, 241, -1, 156, 201, -7, -3, -1, 94, 171, -1, 186, 229, -3, -1,
|
||||
125, 215, -1, 78, 228, -15, -7, -3, -1, 140, 200, -1, 62, 109, -3,
|
||||
-1, 214, 227, -1, 155, 185, -7, -3, -1, 46, 170, -1, 226, 30, -5,
|
||||
-1, 225, -1, 14, 224, -1, 93, 213, -45, -25, -13, -7, -3, -1, 124,
|
||||
199, -1, 77, 139, -1, 212, -1, 184, 154, -7, -3, -1, 169, 108, -1,
|
||||
198, 61, -1, 211, 210, -9, -5, -3, -1, 45, 13, 29, -1, 123, 183,
|
||||
-5, -1, 209, -1, 92, 208, -1, 197, 138, -17, -7, -3, -1, 168, 76,
|
||||
-1, 196, 107, -5, -1, 182, -1, 153, 12, -1, 60, 195, -9, -3, -1,
|
||||
122, 167, -1, 166, -1, 192, 11, -1, 194, -1, 44, 91, -55, -29, -15,
|
||||
-7, -3, -1, 181, 28, -1, 137, 152, -3, -1, 193, 75, -1, 180, 106,
|
||||
-5, -3, -1, 59, 121, 179, -3, -1, 151, 136, -1, 43, 90, -11, -5,
|
||||
-1, 178, -1, 165, 27, -1, 177, -1, 176, 105, -7, -3, -1, 150, 74,
|
||||
-1, 164, 120, -3, -1, 135, 58, 163, -17, -7, -3, -1, 89, 149, -1,
|
||||
42, 162, -3, -1, 26, 161, -3, -1, 10, 160, 104, -7, -3, -1, 134,
|
||||
73, -1, 148, 57, -5, -1, 147, -1, 119, 9, -1, 88, 133, -53, -29,
|
||||
-13, -7, -3, -1, 41, 103, -1, 118, 146, -1, 145, -1, 25, 144, -7,
|
||||
-3, -1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102, 71, -7,
|
||||
-3, -1, 40, 130, -1, 24, 129, -7, -3, -1, 116, 8, -1, 128, 86,
|
||||
-3, -1, 101, 55, -1, 115, 70, -17, -7, -3, -1, 39, 114, -1, 100,
|
||||
23, -3, -1, 85, 113, -3, -1, 7, 112, 54, -7, -3, -1, 99, 69,
|
||||
-1, 84, 38, -3, -1, 98, 22, -3, -1, 6, 96, 53, -33, -19, -9,
|
||||
-5, -1, 97, -1, 83, 68, -1, 37, 82, -3, -1, 21, 81, -3, -1,
|
||||
5, 80, 52, -7, -3, -1, 67, 36, -1, 66, 51, -1, 65, -1, 20,
|
||||
4, -9, -3, -1, 35, 50, -3, -1, 64, 3, 19, -3, -1, 49, 48,
|
||||
34, -9, -7, -3, -1, 18, 33, -1, 2, 32, 17, -3, -1, 1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab16[] =
|
||||
{
|
||||
-509,-503,-461,-323,-103, -37, -27, -15, -7, -3, -1, 239, 254, -1, 223,
|
||||
253, -3, -1, 207, 252, -1, 191, 251, -5, -1, 175, -1, 250, 159, -3,
|
||||
-1, 249, 248, 143, -7, -3, -1, 127, 247, -1, 111, 246, 255, -9, -5,
|
||||
-3, -1, 95, 245, 79, -1, 244, 243, -53, -1, 240, -1, 63, -29, -19,
|
||||
-13, -7, -5, -1, 206, -1, 236, 221, 222, -1, 233, -1, 234, 217, -1,
|
||||
238, -1, 237, 235, -3, -1, 190, 205, -3, -1, 220, 219, 174, -11, -5,
|
||||
-1, 204, -1, 173, 218, -3, -1, 126, 172, 202, -5, -3, -1, 201, 125,
|
||||
94, 189, 242, -93, -5, -3, -1, 47, 15, 31, -1, 241, -49, -25, -13,
|
||||
-5, -1, 158, -1, 188, 203, -3, -1, 142, 232, -1, 157, 231, -7, -3,
|
||||
-1, 187, 141, -1, 216, 110, -1, 230, 156, -13, -7, -3, -1, 171, 186,
|
||||
-1, 229, 215, -1, 78, -1, 228, 140, -3, -1, 200, 62, -1, 109, -1,
|
||||
214, 155, -19, -11, -5, -3, -1, 185, 170, 225, -1, 212, -1, 184, 169,
|
||||
-5, -1, 123, -1, 183, 208, 227, -7, -3, -1, 14, 224, -1, 93, 213,
|
||||
-3, -1, 124, 199, -1, 77, 139, -75, -45, -27, -13, -7, -3, -1, 154,
|
||||
108, -1, 198, 61, -3, -1, 92, 197, 13, -7, -3, -1, 138, 168, -1,
|
||||
153, 76, -3, -1, 182, 122, 60, -11, -5, -3, -1, 91, 137, 28, -1,
|
||||
192, -1, 152, 121, -1, 226, -1, 46, 30, -15, -7, -3, -1, 211, 45,
|
||||
-1, 210, 209, -5, -1, 59, -1, 151, 136, 29, -7, -3, -1, 196, 107,
|
||||
-1, 195, 167, -1, 44, -1, 194, 181, -23, -13, -7, -3, -1, 193, 12,
|
||||
-1, 75, 180, -3, -1, 106, 166, 179, -5, -3, -1, 90, 165, 43, -1,
|
||||
178, 27, -13, -5, -1, 177, -1, 11, 176, -3, -1, 105, 150, -1, 74,
|
||||
164, -5, -3, -1, 120, 135, 163, -3, -1, 58, 89, 42, -97, -57, -33,
|
||||
-19, -11, -5, -3, -1, 149, 104, 161, -3, -1, 134, 119, 148, -5, -3,
|
||||
-1, 73, 87, 103, 162, -5, -1, 26, -1, 10, 160, -3, -1, 57, 147,
|
||||
-1, 88, 133, -9, -3, -1, 41, 146, -3, -1, 118, 9, 25, -5, -1,
|
||||
145, -1, 144, 72, -3, -1, 132, 117, -1, 56, 131, -21, -11, -5, -3,
|
||||
-1, 102, 40, 130, -3, -1, 71, 116, 24, -3, -1, 129, 128, -3, -1,
|
||||
8, 86, 55, -9, -5, -1, 115, -1, 101, 70, -1, 39, 114, -5, -3,
|
||||
-1, 100, 85, 7, 23, -23, -13, -5, -1, 113, -1, 112, 54, -3, -1,
|
||||
99, 69, -1, 84, 38, -3, -1, 98, 22, -1, 97, -1, 6, 96, -9,
|
||||
-5, -1, 83, -1, 53, 68, -1, 37, 82, -1, 81, -1, 21, 5, -33,
|
||||
-23, -13, -7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51, 20,
|
||||
-5, -1, 65, -1, 4, 64, -1, 35, 50, -3, -1, 19, 49, -3, -1,
|
||||
3, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1, 17, 1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab24[] =
|
||||
{
|
||||
-451,-117, -43, -25, -15, -7, -3, -1, 239, 254, -1, 223, 253, -3, -1,
|
||||
207, 252, -1, 191, 251, -5, -1, 250, -1, 175, 159, -1, 249, 248, -9,
|
||||
-5, -3, -1, 143, 127, 247, -1, 111, 246, -3, -1, 95, 245, -1, 79,
|
||||
244, -71, -7, -3, -1, 63, 243, -1, 47, 242, -5, -1, 241, -1, 31,
|
||||
240, -25, -9, -1, 15, -3, -1, 238, 222, -1, 237, 206, -7, -3, -1,
|
||||
236, 221, -1, 190, 235, -3, -1, 205, 220, -1, 174, 234, -15, -7, -3,
|
||||
-1, 189, 219, -1, 204, 158, -3, -1, 233, 173, -1, 218, 188, -7, -3,
|
||||
-1, 203, 142, -1, 232, 157, -3, -1, 217, 126, -1, 231, 172, 255,-235,
|
||||
-143, -77, -45, -25, -15, -7, -3, -1, 202, 187, -1, 141, 216, -5, -3,
|
||||
-1, 14, 224, 13, 230, -5, -3, -1, 110, 156, 201, -1, 94, 186, -9,
|
||||
-5, -1, 229, -1, 171, 125, -1, 215, 228, -3, -1, 140, 200, -3, -1,
|
||||
78, 46, 62, -15, -7, -3, -1, 109, 214, -1, 227, 155, -3, -1, 185,
|
||||
170, -1, 226, 30, -7, -3, -1, 225, 93, -1, 213, 124, -3, -1, 199,
|
||||
77, -1, 139, 184, -31, -15, -7, -3, -1, 212, 154, -1, 169, 108, -3,
|
||||
-1, 198, 61, -1, 211, 45, -7, -3, -1, 210, 29, -1, 123, 183, -3,
|
||||
-1, 209, 92, -1, 197, 138, -17, -7, -3, -1, 168, 153, -1, 76, 196,
|
||||
-3, -1, 107, 182, -3, -1, 208, 12, 60, -7, -3, -1, 195, 122, -1,
|
||||
167, 44, -3, -1, 194, 91, -1, 181, 28, -57, -35, -19, -7, -3, -1,
|
||||
137, 152, -1, 193, 75, -5, -3, -1, 192, 11, 59, -3, -1, 176, 10,
|
||||
26, -5, -1, 180, -1, 106, 166, -3, -1, 121, 151, -3, -1, 160, 9,
|
||||
144, -9, -3, -1, 179, 136, -3, -1, 43, 90, 178, -7, -3, -1, 165,
|
||||
27, -1, 177, 105, -1, 150, 164, -17, -9, -5, -3, -1, 74, 120, 135,
|
||||
-1, 58, 163, -3, -1, 89, 149, -1, 42, 162, -7, -3, -1, 161, 104,
|
||||
-1, 134, 119, -3, -1, 73, 148, -1, 57, 147, -63, -31, -15, -7, -3,
|
||||
-1, 88, 133, -1, 41, 103, -3, -1, 118, 146, -1, 25, 145, -7, -3,
|
||||
-1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102, 40, -17, -7,
|
||||
-3, -1, 130, 24, -1, 71, 116, -5, -1, 129, -1, 8, 128, -1, 86,
|
||||
101, -7, -5, -1, 23, -1, 7, 112, 115, -3, -1, 55, 39, 114, -15,
|
||||
-7, -3, -1, 70, 100, -1, 85, 113, -3, -1, 54, 99, -1, 69, 84,
|
||||
-7, -3, -1, 38, 98, -1, 22, 97, -5, -3, -1, 6, 96, 53, -1,
|
||||
83, 68, -51, -37, -23, -15, -9, -3, -1, 37, 82, -1, 21, -1, 5,
|
||||
80, -1, 81, -1, 52, 67, -3, -1, 36, 66, -1, 51, 20, -9, -5,
|
||||
-1, 65, -1, 4, 64, -1, 35, 50, -1, 19, 49, -7, -5, -3, -1,
|
||||
3, 48, 34, 18, -1, 33, -1, 2, 32, -3, -1, 17, 1, -1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab_c0[] =
|
||||
{
|
||||
-29, -21, -13, -7, -3, -1, 11, 15, -1, 13, 14, -3, -1, 7, 5,
|
||||
9, -3, -1, 6, 3, -1, 10, 12, -3, -1, 2, 1, -1, 4, 8,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab_c1[] =
|
||||
{
|
||||
-15, -7, -3, -1, 15, 14, -1, 13, 12, -3, -1, 11, 10, -1, 9,
|
||||
8, -7, -3, -1, 7, 6, -1, 5, 4, -3, -1, 3, 2, -1, 1,
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
|
||||
const struct newhuff ht[] =
|
||||
{
|
||||
{ /* 0 */ 0 , tab0 } ,
|
||||
{ /* 2 */ 0 , tab1 } ,
|
||||
{ /* 3 */ 0 , tab2 } ,
|
||||
{ /* 3 */ 0 , tab3 } ,
|
||||
{ /* 0 */ 0 , tab0 } ,
|
||||
{ /* 4 */ 0 , tab5 } ,
|
||||
{ /* 4 */ 0 , tab6 } ,
|
||||
{ /* 6 */ 0 , tab7 } ,
|
||||
{ /* 6 */ 0 , tab8 } ,
|
||||
{ /* 6 */ 0 , tab9 } ,
|
||||
{ /* 8 */ 0 , tab10 } ,
|
||||
{ /* 8 */ 0 , tab11 } ,
|
||||
{ /* 8 */ 0 , tab12 } ,
|
||||
{ /* 16 */ 0 , tab13 } ,
|
||||
{ /* 0 */ 0 , tab0 } ,
|
||||
{ /* 16 */ 0 , tab15 } ,
|
||||
|
||||
{ /* 16 */ 1 , tab16 } ,
|
||||
{ /* 16 */ 2 , tab16 } ,
|
||||
{ /* 16 */ 3 , tab16 } ,
|
||||
{ /* 16 */ 4 , tab16 } ,
|
||||
{ /* 16 */ 6 , tab16 } ,
|
||||
{ /* 16 */ 8 , tab16 } ,
|
||||
{ /* 16 */ 10, tab16 } ,
|
||||
{ /* 16 */ 13, tab16 } ,
|
||||
{ /* 16 */ 4 , tab24 } ,
|
||||
{ /* 16 */ 5 , tab24 } ,
|
||||
{ /* 16 */ 6 , tab24 } ,
|
||||
{ /* 16 */ 7 , tab24 } ,
|
||||
{ /* 16 */ 8 , tab24 } ,
|
||||
{ /* 16 */ 9 , tab24 } ,
|
||||
{ /* 16 */ 11, tab24 } ,
|
||||
{ /* 16 */ 13, tab24 }
|
||||
};
|
||||
|
||||
const struct newhuff htc[] =
|
||||
{
|
||||
{ /* 1 , 1 , */ 0 , tab_c0 } ,
|
||||
{ /* 1 , 1 , */ 0 , tab_c1 }
|
||||
};
|
||||
|
||||
|
|
@ -1,253 +0,0 @@
|
|||
/*
|
||||
* External functions declared as __declspec(dllexport)
|
||||
* to work in a Win32 DLL (use mpglibdll.h to access)
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mpg123.h"
|
||||
#include "mpglib.h"
|
||||
|
||||
void initStaticData(struct StaticData * psd)
|
||||
{
|
||||
psd->pnts[0] = psd->cos64;
|
||||
psd->pnts[1] = psd->cos32;
|
||||
psd->pnts[2] = psd->cos16;
|
||||
psd->pnts[3] = psd->cos8;
|
||||
psd->pnts[4] = psd->cos4;
|
||||
|
||||
psd->bo = 1;
|
||||
}
|
||||
|
||||
|
||||
int InitMP3(struct mpstr *mp)
|
||||
{
|
||||
memset(mp,0,sizeof(struct mpstr));
|
||||
|
||||
initStaticData(&mp->psd);
|
||||
|
||||
mp->framesize = 0;
|
||||
mp->fsizeold = -1;
|
||||
mp->bsize = 0;
|
||||
mp->head = mp->tail = NULL;
|
||||
mp->fr.single = -1;
|
||||
mp->bsnum = 0;
|
||||
mp->synth_bo = 1;
|
||||
|
||||
make_decode_tables(&mp->psd, 32767);
|
||||
init_layer3(&mp->psd, SBLIMIT);
|
||||
|
||||
mp->fr.II_sblimit=SBLIMIT;
|
||||
init_layer2(&mp->psd);
|
||||
|
||||
return !0;
|
||||
}
|
||||
|
||||
void ExitMP3(struct mpstr *mp)
|
||||
{
|
||||
struct buf *b,*bn;
|
||||
|
||||
b = mp->tail;
|
||||
while(b) {
|
||||
free(b->pnt);
|
||||
bn = b->next;
|
||||
free(b);
|
||||
b = bn;
|
||||
}
|
||||
}
|
||||
|
||||
static struct buf *addbuf(struct mpstr *mp,char *buf,int size)
|
||||
{
|
||||
struct buf *nbuf;
|
||||
|
||||
nbuf = (struct buf*) malloc( sizeof(struct buf) );
|
||||
if(!nbuf) {
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Out of memory!\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
nbuf->pnt = (unsigned char*) malloc(size);
|
||||
if(!nbuf->pnt) {
|
||||
free(nbuf);
|
||||
return NULL;
|
||||
}
|
||||
nbuf->size = size;
|
||||
memcpy(nbuf->pnt,buf,size);
|
||||
nbuf->next = NULL;
|
||||
nbuf->prev = mp->head;
|
||||
nbuf->pos = 0;
|
||||
|
||||
if(!mp->tail) {
|
||||
mp->tail = nbuf;
|
||||
}
|
||||
else {
|
||||
mp->head->next = nbuf;
|
||||
}
|
||||
|
||||
mp->head = nbuf;
|
||||
mp->bsize += size;
|
||||
|
||||
return nbuf;
|
||||
}
|
||||
|
||||
static void remove_buf(struct mpstr *mp)
|
||||
{
|
||||
struct buf *buf = mp->tail;
|
||||
|
||||
mp->tail = buf->next;
|
||||
if(mp->tail)
|
||||
mp->tail->prev = NULL;
|
||||
else {
|
||||
mp->tail = mp->head = NULL;
|
||||
}
|
||||
|
||||
free(buf->pnt);
|
||||
free(buf);
|
||||
|
||||
}
|
||||
|
||||
static int read_buf_byte(struct mpstr *mp)
|
||||
{
|
||||
unsigned int b;
|
||||
|
||||
int pos;
|
||||
|
||||
pos = mp->tail->pos;
|
||||
while(pos >= mp->tail->size) {
|
||||
remove_buf(mp);
|
||||
if(!mp->tail) {
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Fatal error!\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
pos = mp->tail->pos;
|
||||
}
|
||||
|
||||
b = mp->tail->pnt[pos];
|
||||
mp->bsize--;
|
||||
mp->tail->pos++;
|
||||
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
static void read_head(struct mpstr *mp)
|
||||
{
|
||||
unsigned long head = 0;
|
||||
int i;
|
||||
|
||||
while(mp->tail){
|
||||
head <<= 8;
|
||||
head |= read_buf_byte(mp);
|
||||
head &= 0xffffffff;
|
||||
if(head_check(head))
|
||||
break;
|
||||
}
|
||||
|
||||
mp->header = head;
|
||||
}
|
||||
|
||||
int decodeMP3(struct mpstr *mp, char *in, int isize,
|
||||
char *out, int osize, int *done)
|
||||
{
|
||||
int len;
|
||||
|
||||
if(osize < 4608) {
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"To less out space\n");
|
||||
#endif
|
||||
return MP3_ERR;
|
||||
}
|
||||
|
||||
if(in) {
|
||||
if(addbuf(mp, in, isize) == NULL) {
|
||||
return MP3_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* First decode header */
|
||||
if(mp->framesize == 0) {
|
||||
if(mp->bsize < 4) {
|
||||
return MP3_NEED_MORE;
|
||||
}
|
||||
read_head(mp);
|
||||
if(mp->tail)
|
||||
mp->ndatabegin = mp->tail->pos - 4;
|
||||
if (decode_header(mp, &mp->fr,mp->header) <= 0 )
|
||||
return MP3_ERR;
|
||||
|
||||
mp->framesize = mp->fr.framesize;
|
||||
}
|
||||
|
||||
/* printf(" fr.framesize = %i \n",mp->fr.framesize);
|
||||
printf(" bsize = %i \n",mp->bsize);
|
||||
*/
|
||||
|
||||
if(mp->fr.framesize > mp->bsize) {
|
||||
return MP3_NEED_MORE;
|
||||
}
|
||||
mp->psd.wordpointer = mp->bsspace[mp->bsnum] + 512;
|
||||
mp->bsnum = (mp->bsnum + 1) & 0x1;
|
||||
mp->psd.bitindex = 0;
|
||||
|
||||
len = 0;
|
||||
while(len < mp->framesize) {
|
||||
int nlen;
|
||||
int blen = mp->tail->size - mp->tail->pos;
|
||||
if( (mp->framesize - len) <= blen) {
|
||||
nlen = mp->framesize-len;
|
||||
}
|
||||
else {
|
||||
nlen = blen;
|
||||
}
|
||||
memcpy(mp->psd.wordpointer+len,mp->tail->pnt+mp->tail->pos,nlen);
|
||||
len += nlen;
|
||||
mp->tail->pos += nlen;
|
||||
mp->bsize -= nlen;
|
||||
if(mp->tail->pos == mp->tail->size) {
|
||||
remove_buf(mp);
|
||||
}
|
||||
}
|
||||
|
||||
*done = 0;
|
||||
if(mp->fr.error_protection)
|
||||
getbits(&mp->psd, 16);
|
||||
|
||||
// FOR mpglib.dll: see if error and return it
|
||||
if ((&mp->fr)->do_layer(&mp->psd, mp, &mp->fr, (unsigned char*) out, done) < 0)
|
||||
return MP3_ERR;
|
||||
|
||||
mp->fsizeold = mp->framesize;
|
||||
mp->framesize = 0;
|
||||
return MP3_OK;
|
||||
}
|
||||
|
||||
int set_pointer(struct StaticData * psd, struct mpstr * gmp, long backstep)
|
||||
{
|
||||
unsigned char *bsbufold;
|
||||
|
||||
if(gmp->fsizeold < 0 && backstep > 0) {
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Can't step back %ld!\n",backstep);
|
||||
#endif
|
||||
return MP3_ERR;
|
||||
}
|
||||
bsbufold = gmp->bsspace[gmp->bsnum] + 512;
|
||||
psd->wordpointer -= backstep;
|
||||
if (backstep)
|
||||
memcpy(psd->wordpointer,bsbufold+gmp->fsizeold-backstep,backstep);
|
||||
psd->bitindex = 0;
|
||||
return MP3_OK;
|
||||
}
|
||||
|
||||
|
||||
void MessageI(int i)
|
||||
{
|
||||
char s[100];
|
||||
sprintf(s, "%d", i);
|
||||
// MessageBox (NULL, s, "Debug/Integer", 0);
|
||||
}
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* Layer 2 Alloc tables ..
|
||||
* most other tables are calculated on program start (which is (of course)
|
||||
* not ISO-conform) ..
|
||||
* Layer-3 huffman table is in huffman.h
|
||||
*/
|
||||
|
||||
/* Layer 2 */
|
||||
struct al_table
|
||||
{
|
||||
short bits;
|
||||
short d;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const struct al_table alloc_0[] = {
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767} };
|
||||
|
||||
const struct al_table alloc_1[] = {
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767} };
|
||||
|
||||
const struct al_table alloc_2[] = {
|
||||
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
|
||||
{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
|
||||
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
|
||||
{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} };
|
||||
|
||||
const struct al_table alloc_3[] = {
|
||||
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
|
||||
{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
|
||||
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
|
||||
{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} };
|
||||
|
||||
const struct al_table alloc_4[] = {
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9} };
|
||||
|
|
@ -1,315 +0,0 @@
|
|||
/*
|
||||
* Mpeg Layer-2 audio decoder
|
||||
* --------------------------
|
||||
* copyright (c) 1995 by Michael Hipp, All rights reserved. See also 'README'
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mpg123.h"
|
||||
#include "l2tables.h"
|
||||
|
||||
void init_layer2(struct StaticData * psd)
|
||||
{
|
||||
|
||||
const double mulmul[27] = {
|
||||
0.0 , -2.0/3.0 , 2.0/3.0 ,
|
||||
2.0/7.0 , 2.0/15.0 , 2.0/31.0, 2.0/63.0 , 2.0/127.0 , 2.0/255.0 ,
|
||||
2.0/511.0 , 2.0/1023.0 , 2.0/2047.0 , 2.0/4095.0 , 2.0/8191.0 ,
|
||||
2.0/16383.0 , 2.0/32767.0 , 2.0/65535.0 ,
|
||||
-4.0/5.0 , -2.0/5.0 , 2.0/5.0, 4.0/5.0 ,
|
||||
-8.0/9.0 , -4.0/9.0 , -2.0/9.0 , 2.0/9.0 , 4.0/9.0 , 8.0/9.0 };
|
||||
|
||||
const int base[3][9] = {
|
||||
{ 1 , 0, 2 , } ,
|
||||
{ 17, 18, 0 , 19, 20 , } ,
|
||||
{ 21, 1, 22, 23, 0, 24, 25, 2, 26 } };
|
||||
|
||||
int i,j,k,l,len;
|
||||
real *table;
|
||||
const int tablen[3] = { 3 , 5 , 9 };
|
||||
int *itable,*tables[3];
|
||||
|
||||
tables[0] = psd->grp_3tab;
|
||||
tables[1] = psd->grp_5tab;
|
||||
tables[2] = psd->grp_9tab;
|
||||
|
||||
for(i=0;i<3;i++)
|
||||
{
|
||||
itable = tables[i];
|
||||
len = tablen[i];
|
||||
for(j=0;j<len;j++)
|
||||
for(k=0;k<len;k++)
|
||||
for(l=0;l<len;l++)
|
||||
{
|
||||
*itable++ = base[i][l];
|
||||
*itable++ = base[i][k];
|
||||
*itable++ = base[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for(k=0;k<27;k++)
|
||||
{
|
||||
double m=mulmul[k];
|
||||
table = psd->muls[k];
|
||||
for(j=3,i=0;i<63;i++,j--)
|
||||
*table++ = m * pow(2.0,(double) j / 3.0);
|
||||
*table++ = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void II_step_one(struct StaticData * psd, unsigned int *bit_alloc,int *scale,struct frame *fr)
|
||||
{
|
||||
|
||||
int stereo = fr->stereo-1;
|
||||
int sblimit = fr->II_sblimit;
|
||||
int jsbound = fr->jsbound;
|
||||
int sblimit2 = fr->II_sblimit<<stereo;
|
||||
const struct al_table *alloc1 = fr->alloc;
|
||||
int i;
|
||||
unsigned int *scfsi,*bita;
|
||||
int sc,step;
|
||||
|
||||
bita = bit_alloc;
|
||||
if(stereo)
|
||||
{
|
||||
for (i=jsbound;i;i--,alloc1+=(1<<step))
|
||||
{
|
||||
*bita++ = (char) getbits(psd, step=alloc1->bits);
|
||||
*bita++ = (char) getbits(psd, step);
|
||||
}
|
||||
for (i=sblimit-jsbound;i;i--,alloc1+=(1<<step))
|
||||
{
|
||||
bita[0] = (char) getbits(psd, step=alloc1->bits);
|
||||
bita[1] = bita[0];
|
||||
bita+=2;
|
||||
}
|
||||
bita = bit_alloc;
|
||||
scfsi=psd->scfsi_buf;
|
||||
for (i=sblimit2;i;i--)
|
||||
if (*bita++)
|
||||
*scfsi++ = (char) getbits_fast(psd, 2);
|
||||
}
|
||||
else /* mono */
|
||||
{
|
||||
for (i=sblimit;i;i--,alloc1+=(1<<step))
|
||||
*bita++ = (char) getbits(psd, step=alloc1->bits);
|
||||
bita = bit_alloc;
|
||||
scfsi=psd->scfsi_buf;
|
||||
for (i=sblimit;i;i--)
|
||||
if (*bita++)
|
||||
*scfsi++ = (char) getbits_fast(psd, 2);
|
||||
}
|
||||
|
||||
bita = bit_alloc;
|
||||
scfsi=psd->scfsi_buf;
|
||||
for (i=sblimit2;i;i--)
|
||||
if (*bita++)
|
||||
switch (*scfsi++)
|
||||
{
|
||||
case 0:
|
||||
*scale++ = getbits_fast(psd, 6);
|
||||
*scale++ = getbits_fast(psd, 6);
|
||||
*scale++ = getbits_fast(psd, 6);
|
||||
break;
|
||||
case 1 :
|
||||
*scale++ = sc = getbits_fast(psd, 6);
|
||||
*scale++ = sc;
|
||||
*scale++ = getbits_fast(psd, 6);
|
||||
break;
|
||||
case 2:
|
||||
*scale++ = sc = getbits_fast(psd, 6);
|
||||
*scale++ = sc;
|
||||
*scale++ = sc;
|
||||
break;
|
||||
default: /* case 3 */
|
||||
*scale++ = getbits_fast(psd, 6);
|
||||
*scale++ = sc = getbits_fast(psd, 6);
|
||||
*scale++ = sc;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void II_step_two(struct StaticData * psd, unsigned int *bit_alloc,real fraction[2][4][SBLIMIT],int *scale,struct frame *fr,int x1)
|
||||
{
|
||||
|
||||
int i,j,k,ba;
|
||||
int stereo = fr->stereo;
|
||||
int sblimit = fr->II_sblimit;
|
||||
int jsbound = fr->jsbound;
|
||||
const struct al_table *alloc2,*alloc1 = fr->alloc;
|
||||
unsigned int *bita=bit_alloc;
|
||||
int d1,step;
|
||||
|
||||
for (i=0;i<jsbound;i++,alloc1+=(1<<step))
|
||||
{
|
||||
step = alloc1->bits;
|
||||
for (j=0;j<stereo;j++)
|
||||
{
|
||||
if ( (ba=*bita++) )
|
||||
{
|
||||
k=(alloc2 = alloc1+ba)->bits;
|
||||
if( (d1=alloc2->d) < 0)
|
||||
{
|
||||
real cm=psd->muls[k][scale[x1]];
|
||||
fraction[j][0][i] = ((real) ((int)getbits(psd, k) + d1)) * cm;
|
||||
fraction[j][1][i] = ((real) ((int)getbits(psd, k) + d1)) * cm;
|
||||
fraction[j][2][i] = ((real) ((int)getbits(psd, k) + d1)) * cm;
|
||||
}
|
||||
else
|
||||
{
|
||||
int *table[10];
|
||||
|
||||
unsigned int idx,*tab,m=scale[x1];
|
||||
|
||||
memset(table, 0, sizeof(NULL));
|
||||
|
||||
table[3] = psd->grp_3tab;
|
||||
table[5] = psd->grp_5tab;
|
||||
table[9] = psd->grp_9tab;
|
||||
|
||||
idx = (unsigned int) getbits(psd, k);
|
||||
tab = (unsigned int *) (table[d1] + idx + idx + idx);
|
||||
fraction[j][0][i] = psd->muls[*tab++][m];
|
||||
fraction[j][1][i] = psd->muls[*tab++][m];
|
||||
fraction[j][2][i] = psd->muls[*tab][m];
|
||||
}
|
||||
scale+=3;
|
||||
}
|
||||
else
|
||||
fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=jsbound;i<sblimit;i++,alloc1+=(1<<step))
|
||||
{
|
||||
step = alloc1->bits;
|
||||
bita++; /* channel 1 and channel 2 bitalloc are the same */
|
||||
if ( (ba=*bita++) )
|
||||
{
|
||||
k=(alloc2 = alloc1+ba)->bits;
|
||||
if( (d1=alloc2->d) < 0)
|
||||
{
|
||||
real cm;
|
||||
cm=psd->muls[k][scale[x1+3]];
|
||||
fraction[1][0][i] = (fraction[0][0][i] = (real) ((int)getbits(psd, k) + d1) ) * cm;
|
||||
fraction[1][1][i] = (fraction[0][1][i] = (real) ((int)getbits(psd, k) + d1) ) * cm;
|
||||
fraction[1][2][i] = (fraction[0][2][i] = (real) ((int)getbits(psd, k) + d1) ) * cm;
|
||||
cm=psd->muls[k][scale[x1]];
|
||||
fraction[0][0][i] *= cm; fraction[0][1][i] *= cm; fraction[0][2][i] *= cm;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
int *table[10];
|
||||
unsigned int idx,*tab,m1,m2;
|
||||
memset(table, 0, sizeof(NULL));
|
||||
|
||||
table[3] = psd->grp_3tab;
|
||||
table[5] = psd->grp_5tab;
|
||||
table[9] = psd->grp_9tab;
|
||||
|
||||
m1 = scale[x1]; m2 = scale[x1+3];
|
||||
idx = (unsigned int) getbits(psd, k);
|
||||
tab = (unsigned int *) (table[d1] + idx + idx + idx);
|
||||
fraction[0][0][i] = psd->muls[*tab][m1]; fraction[1][0][i] = psd->muls[*tab++][m2];
|
||||
fraction[0][1][i] = psd->muls[*tab][m1]; fraction[1][1][i] = psd->muls[*tab++][m2];
|
||||
fraction[0][2][i] = psd->muls[*tab][m1]; fraction[1][2][i] = psd->muls[*tab][m2];
|
||||
}
|
||||
scale+=6;
|
||||
}
|
||||
else {
|
||||
fraction[0][0][i] = fraction[0][1][i] = fraction[0][2][i] =
|
||||
fraction[1][0][i] = fraction[1][1][i] = fraction[1][2][i] = 0.0;
|
||||
}
|
||||
/*
|
||||
should we use individual scalefac for channel 2 or
|
||||
is the current way the right one , where we just copy channel 1 to
|
||||
channel 2 ??
|
||||
The current 'strange' thing is, that we throw away the scalefac
|
||||
values for the second channel ...!!
|
||||
-> changed .. now we use the scalefac values of channel one !!
|
||||
*/
|
||||
}
|
||||
|
||||
// if(sblimit > (fr->down_sample_sblimit) )
|
||||
// sblimit = fr->down_sample_sblimit;
|
||||
|
||||
if(sblimit > (fr->II_sblimit) )
|
||||
sblimit = fr->II_sblimit;
|
||||
|
||||
for(i=sblimit;i<SBLIMIT;i++)
|
||||
for (j=0;j<stereo;j++)
|
||||
fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 0.0;
|
||||
|
||||
}
|
||||
|
||||
void II_select_table(struct frame *fr)
|
||||
{
|
||||
const int translate[3][2][16] =
|
||||
{ { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } ,
|
||||
{ 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } ,
|
||||
{ { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } ,
|
||||
{ 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } ,
|
||||
{ { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } ,
|
||||
{ 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } };
|
||||
|
||||
int table,sblim;
|
||||
const struct al_table *tables[5] =
|
||||
{ alloc_0, alloc_1, alloc_2, alloc_3 , alloc_4 };
|
||||
const int sblims[5] = { 27 , 30 , 8, 12 , 30 };
|
||||
|
||||
if(fr->lsf)
|
||||
table = 4;
|
||||
else
|
||||
table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index];
|
||||
|
||||
sblim = sblims[table];
|
||||
|
||||
fr->alloc = tables[table];
|
||||
fr->II_sblimit = sblim;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int do_layer2(struct StaticData * psd, struct mpstr * gmp, struct frame *fr,unsigned char *pcm_sample,int *pcm_point)
|
||||
{
|
||||
int clip=0;
|
||||
int i,j;
|
||||
int stereo = fr->stereo;
|
||||
real fraction[2][4][SBLIMIT]; /* pick_table clears unused subbands */
|
||||
unsigned int bit_alloc[64];
|
||||
int scale[192];
|
||||
int single = fr->single;
|
||||
|
||||
II_select_table(fr);
|
||||
fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
|
||||
(fr->mode_ext<<2)+4 : fr->II_sblimit;
|
||||
|
||||
if(stereo == 1 || single == 3)
|
||||
single = 0;
|
||||
|
||||
II_step_one(psd, bit_alloc, scale, fr);
|
||||
|
||||
for (i=0;i<SCALE_BLOCK;i++)
|
||||
{
|
||||
II_step_two(psd, bit_alloc,fraction,scale,fr,i>>2);
|
||||
for (j=0;j<3;j++)
|
||||
{
|
||||
if(single >= 0)
|
||||
{
|
||||
clip += synth_1to1_mono(psd, gmp, fraction[single][j],pcm_sample,pcm_point);
|
||||
}
|
||||
else {
|
||||
int p1 = *pcm_point;
|
||||
clip += synth_1to1(psd, gmp, fraction[0][j],0,pcm_sample,&p1);
|
||||
clip += synth_1to1(psd, gmp, fraction[1][j],1,pcm_sample,pcm_point);
|
||||
}
|
||||
}
|
||||
}
|
||||
return clip;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,253 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/signal.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
//#ifdef _WIN32
|
||||
# undef WIN32
|
||||
# define WIN32
|
||||
|
||||
# define M_PI 3.14159265358979323846
|
||||
# define M_SQRT2 1.41421356237309504880
|
||||
# define REAL_IS_FLOAT
|
||||
# define NEW_DCT9
|
||||
|
||||
# define random rand
|
||||
# define srandom srand
|
||||
|
||||
//#endif
|
||||
|
||||
#ifdef REAL_IS_FLOAT
|
||||
# define real float
|
||||
#elif defined(REAL_IS_LONG_DOUBLE)
|
||||
# define real long double
|
||||
#else
|
||||
# define real double
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define INLINE inline
|
||||
#else
|
||||
#define INLINE
|
||||
#endif
|
||||
|
||||
/* AUDIOBUFSIZE = n*64 with n=1,2,3 ... */
|
||||
#define AUDIOBUFSIZE 16384
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#define SBLIMIT 32
|
||||
#define SSLIMIT 18
|
||||
|
||||
#define SCALE_BLOCK 12 /* Layer 2 */
|
||||
|
||||
#define MPG_MD_STEREO 0
|
||||
#define MPG_MD_JOINT_STEREO 1
|
||||
#define MPG_MD_DUAL_CHANNEL 2
|
||||
#define MPG_MD_MONO 3
|
||||
|
||||
#define MAXFRAMESIZE 1792
|
||||
|
||||
|
||||
/* Pre Shift fo 16 to 8 bit converter table */
|
||||
#define AUSHIFT (3)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct StaticData {
|
||||
|
||||
//layer3
|
||||
real ispow[8207];
|
||||
real aa_ca[8],aa_cs[8];
|
||||
real COS1[12][6];
|
||||
real win[4][36];
|
||||
real win1[4][36];
|
||||
real gainpow2[256+118+4];
|
||||
real COS9[9];
|
||||
real COS6_1,COS6_2;
|
||||
real tfcos36[9];
|
||||
real tfcos12[3];
|
||||
|
||||
int mapbuf0[9][152];
|
||||
int mapbuf1[9][156];
|
||||
int mapbuf2[9][44];
|
||||
int *map[9][3];
|
||||
int *mapend[9][3];
|
||||
|
||||
unsigned int n_slen2[512];
|
||||
unsigned int i_slen2[256];
|
||||
|
||||
real tan1_1[16],tan2_1[16],tan1_2[16],tan2_2[16];
|
||||
real pow1_1[2][16],pow2_1[2][16],pow1_2[2][16],pow2_2[2][16];
|
||||
|
||||
int longLimit[9][23];
|
||||
int shortLimit[9][14];
|
||||
|
||||
real hybridIn[2][SBLIMIT][SSLIMIT];
|
||||
real hybridOut[2][SSLIMIT][SBLIMIT];
|
||||
|
||||
//common
|
||||
int bitindex;
|
||||
unsigned char *wordpointer;
|
||||
|
||||
//decode_i386
|
||||
real buffs[2][2][0x110];
|
||||
int bo;
|
||||
|
||||
//layer2
|
||||
int grp_3tab[32 * 3]; /* used: 27 */
|
||||
int grp_5tab[128 * 3]; /* used: 125 */
|
||||
int grp_9tab[1024 * 3]; /* used: 729 */
|
||||
|
||||
real muls[27][64]; /* also used by layer 1 */
|
||||
unsigned int scfsi_buf[64];
|
||||
|
||||
//tabinit
|
||||
real decwin[512+32];
|
||||
real cos64[16],cos32[8],cos16[4],cos8[2],cos4[1];
|
||||
real *pnts[5];
|
||||
};
|
||||
|
||||
/*
|
||||
* the ith entry determines the seek point for
|
||||
* i-percent duration
|
||||
* seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes
|
||||
* e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes
|
||||
*/
|
||||
|
||||
|
||||
#define FRAMES_FLAG 0x0001
|
||||
#define BYTES_FLAG 0x0002
|
||||
#define TOC_FLAG 0x0004
|
||||
#define VBR_SCALE_FLAG 0x0008
|
||||
|
||||
#define NUMTOCENTRIES 100
|
||||
|
||||
#define FRAMES_AND_BYTES (FRAMES_FLAG | BYTES_FLAG)
|
||||
|
||||
const static char VBRTag[]={"Xing"};
|
||||
|
||||
/*structure to receive extracted header */
|
||||
/* toc may be NULL*/
|
||||
typedef struct
|
||||
{
|
||||
int h_id; /* from MPEG header, 0=MPEG2, 1=MPEG1 */
|
||||
int samprate; /* determined from MPEG header */
|
||||
int flags; /* from Vbr header data */
|
||||
int frames; /* total bit stream frames from Vbr header data */
|
||||
int bytes; /* total bit stream bytes from Vbr header data*/
|
||||
int vbr_scale; /* encoded vbr scale from Vbr header data*/
|
||||
unsigned char toc[NUMTOCENTRIES]; /* may be NULL if toc not desired*/
|
||||
} VBRTAGDATA;
|
||||
/*
|
||||
// 4 bytes for Header Tag
|
||||
// 4 bytes for Header Flags
|
||||
// 100 bytes for entry (NUMTOCENTRIES)
|
||||
// 4 bytes for FRAME SIZE
|
||||
// 4 bytes for STREAM_SIZE
|
||||
// 4 bytes for VBR SCALE. a VBR quality indicator: 0=best 100=worst
|
||||
// 20 bytes for LAME tag. for example, "LAME3.12 (beta 6)"
|
||||
// ___________
|
||||
// 140 bytes
|
||||
*/
|
||||
|
||||
#define VBRHEADERSIZE (NUMTOCENTRIES+4+4+4+4+4)
|
||||
|
||||
int GetVbrTag(VBRTAGDATA *pTagData, unsigned char *buf);
|
||||
|
||||
struct frame {
|
||||
int stereo;
|
||||
int jsbound;
|
||||
int single;
|
||||
int lsf;
|
||||
int mpeg25;
|
||||
int header_change;
|
||||
int lay;
|
||||
int error_protection;
|
||||
int bitrate_index;
|
||||
int sampling_frequency;
|
||||
int padding;
|
||||
int extension;
|
||||
int mode;
|
||||
int mode_ext;
|
||||
int copyright;
|
||||
int original;
|
||||
int emphasis;
|
||||
int framesize; /* computed framesize */
|
||||
int II_sblimit; /* Layer 2 */
|
||||
const struct al_table *alloc; /* Layer 2 */
|
||||
int (*do_layer)(struct StaticData * psd, struct mpstr * gmp, struct frame *fr, unsigned char *pcm_sample, int *pcm_point);/* Layer 2 */
|
||||
};
|
||||
|
||||
/* extern unsigned int get1bit(void);*/
|
||||
extern unsigned int getbits(struct StaticData * psd, int);
|
||||
extern unsigned int getbits_fast(struct StaticData * psd, int);
|
||||
extern int set_pointer(struct StaticData * psd, struct mpstr * gmp, long backstep);
|
||||
|
||||
extern int do_layer3(struct StaticData * psd, struct mpstr * gmp, struct frame *fr, unsigned char *pcm_sample, int *pcm_point);
|
||||
extern int do_layer2(struct StaticData * psd, struct mpstr * gmp, struct frame *fr,unsigned char *,int *);
|
||||
|
||||
extern int head_check(unsigned long head);
|
||||
extern int ExtractI4(unsigned char *buf);
|
||||
extern int decode_header(struct mpstr *mp, struct frame *fr,unsigned long newhead);
|
||||
|
||||
struct gr_info_s {
|
||||
int scfsi;
|
||||
unsigned part2_3_length;
|
||||
unsigned big_values;
|
||||
unsigned scalefac_compress;
|
||||
unsigned block_type;
|
||||
unsigned mixed_block_flag;
|
||||
unsigned table_select[3];
|
||||
unsigned subblock_gain[3];
|
||||
unsigned maxband[3];
|
||||
unsigned maxbandl;
|
||||
unsigned maxb;
|
||||
unsigned region1start;
|
||||
unsigned region2start;
|
||||
unsigned preflag;
|
||||
unsigned scalefac_scale;
|
||||
unsigned count1table_select;
|
||||
real *full_gain[3];
|
||||
real *pow2gain;
|
||||
};
|
||||
|
||||
struct III_sideinfo
|
||||
{
|
||||
unsigned main_data_begin;
|
||||
unsigned private_bits;
|
||||
struct {
|
||||
struct gr_info_s gr[2];
|
||||
} ch[2];
|
||||
};
|
||||
|
||||
extern int synth_1to1 (struct StaticData * psd, struct mpstr * gmp, real *bandPtr,int channel,unsigned char *out,int *pnt);
|
||||
extern int tsynth_1to1 (struct StaticData * psd, real *,int,unsigned char *,int *);
|
||||
extern int synth_1to1_mono (struct StaticData * psd, struct mpstr * gmp, real *,unsigned char *,int *);
|
||||
|
||||
extern void init_layer3(struct StaticData * psd, int);
|
||||
extern void init_layer2(struct StaticData * psd);
|
||||
extern void make_decode_tables(struct StaticData * psd, long scaleval);
|
||||
extern void dct64(struct StaticData * psd, real *,real *,real *);
|
||||
|
||||
const extern long freqs[9];
|
||||
|
||||
/* Preserves exiting */
|
||||
|
||||
#define BE_QUIET
|
||||
|
||||
/* Windows debugging message */
|
||||
void MessageI(int i);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,53 +0,0 @@
|
|||
struct buf {
|
||||
unsigned char *pnt;
|
||||
long size;
|
||||
long pos;
|
||||
struct buf *next;
|
||||
struct buf *prev;
|
||||
};
|
||||
|
||||
struct framebuf {
|
||||
struct buf *buf;
|
||||
long pos;
|
||||
struct frame *next;
|
||||
struct frame *prev;
|
||||
};
|
||||
|
||||
struct mpstr {
|
||||
struct buf *head,*tail;
|
||||
int bsize;
|
||||
int framesize;
|
||||
int fsizeold;
|
||||
struct frame fr;
|
||||
unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */
|
||||
real hybrid_block[2][2][SBLIMIT*SSLIMIT];
|
||||
int hybrid_blc[2];
|
||||
unsigned long header;
|
||||
int bsnum;
|
||||
real synth_buffs[2][2][0x110];
|
||||
int synth_bo;
|
||||
struct StaticData psd;
|
||||
long ndatabegin;
|
||||
};
|
||||
|
||||
|
||||
#define MP3_ERR -1
|
||||
#define MP3_OK 0
|
||||
#define MP3_NEED_MORE 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
__declspec(dllexport) int InitMP3(struct mpstr *mp);
|
||||
__declspec(dllexport) int decodeMP3(struct mpstr *mp,char *inmemory,int inmemsize,
|
||||
char *outmemory,int outmemsize,int *done);
|
||||
__declspec(dllexport) void ExitMP3(struct mpstr *mp);
|
||||
__declspec(dllexport) double compute_bpf(struct frame *fr);
|
||||
__declspec(dllexport) double compute_tpf(struct frame *fr);
|
||||
__declspec(dllexport) int GetVbrTag(VBRTAGDATA *pTagData, unsigned char *buf);
|
||||
__declspec(dllexport) int SeekPoint(unsigned char TOC[NUMTOCENTRIES], int file_bytes, double percent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,70 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "mpg123.h"
|
||||
|
||||
const long intwinbase[] = {
|
||||
0, -1, -1, -1, -1, -1, -1, -2, -2, -2,
|
||||
-2, -3, -3, -4, -4, -5, -5, -6, -7, -7,
|
||||
-8, -9, -10, -11, -13, -14, -16, -17, -19, -21,
|
||||
-24, -26, -29, -31, -35, -38, -41, -45, -49, -53,
|
||||
-58, -63, -68, -73, -79, -85, -91, -97, -104, -111,
|
||||
-117, -125, -132, -139, -147, -154, -161, -169, -176, -183,
|
||||
-190, -196, -202, -208, -213, -218, -222, -225, -227, -228,
|
||||
-228, -227, -224, -221, -215, -208, -200, -189, -177, -163,
|
||||
-146, -127, -106, -83, -57, -29, 2, 36, 72, 111,
|
||||
153, 197, 244, 294, 347, 401, 459, 519, 581, 645,
|
||||
711, 779, 848, 919, 991, 1064, 1137, 1210, 1283, 1356,
|
||||
1428, 1498, 1567, 1634, 1698, 1759, 1817, 1870, 1919, 1962,
|
||||
2001, 2032, 2057, 2075, 2085, 2087, 2080, 2063, 2037, 2000,
|
||||
1952, 1893, 1822, 1739, 1644, 1535, 1414, 1280, 1131, 970,
|
||||
794, 605, 402, 185, -45, -288, -545, -814, -1095, -1388,
|
||||
-1692, -2006, -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788,
|
||||
-5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597, -7910, -8209,
|
||||
-8491, -8755, -8998, -9219, -9416, -9585, -9727, -9838, -9916, -9959,
|
||||
-9966, -9935, -9863, -9750, -9592, -9389, -9139, -8840, -8492, -8092,
|
||||
-7640, -7134, -6574, -5959, -5288, -4561, -3776, -2935, -2037, -1082,
|
||||
-70, 998, 2122, 3300, 4533, 5818, 7154, 8540, 9975, 11455,
|
||||
12980, 14548, 16155, 17799, 19478, 21189, 22929, 24694, 26482, 28289,
|
||||
30112, 31947, 33791, 35640, 37489, 39336, 41176, 43006, 44821, 46617,
|
||||
48390, 50137, 51853, 53534, 55178, 56778, 58333, 59838, 61289, 62684,
|
||||
64019, 65290, 66494, 67629, 68692, 69679, 70590, 71420, 72169, 72835,
|
||||
73415, 73908, 74313, 74630, 74856, 74992, 75038 };
|
||||
|
||||
void make_decode_tables(struct StaticData * psd, long scaleval)
|
||||
{
|
||||
int i,j,k,kr,divv;
|
||||
|
||||
real *table,*costab;
|
||||
|
||||
|
||||
for(i=0;i<5;i++)
|
||||
{
|
||||
kr=0x10>>i; divv=0x40>>i;
|
||||
costab = psd->pnts[i];
|
||||
for(k=0;k<kr;k++)
|
||||
costab[k] = 1.0 / (2.0 * cos(M_PI * ((double) k * 2.0 + 1.0) / (double) divv));
|
||||
}
|
||||
|
||||
table = psd->decwin;
|
||||
scaleval = -scaleval;
|
||||
for(i=0,j=0;i<256;i++,j++,table+=32)
|
||||
{
|
||||
if(table < psd->decwin+512+16)
|
||||
table[16] = table[0] = (double) intwinbase[j] / 65536.0 * (double) scaleval;
|
||||
if(i % 32 == 31)
|
||||
table -= 1023;
|
||||
if(i % 64 == 63)
|
||||
scaleval = - scaleval;
|
||||
}
|
||||
|
||||
for( /* i=256 */ ;i<512;i++,j--,table+=32)
|
||||
{
|
||||
if(table < psd->decwin+512+16)
|
||||
table[16] = table[0] = (double) intwinbase[j] / 65536.0 * (double) scaleval;
|
||||
if(i % 32 == 31)
|
||||
table -= 1023;
|
||||
if(i % 64 == 63)
|
||||
scaleval = - scaleval;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
mpglibdll cross-platform with source (LGPL)
|
||||
Version 0.10, Dec 2004
|
||||
|
||||
WHAT'S THIS
|
||||
The new mpglib.dll is base on mpglib.dll (Win32) with adapted from mpglib by
|
||||
Martin Pesch (http://www.rz.uni-frankfurt.de/~pesch)
|
||||
The VBR compatibility has improved. It can work with
|
||||
cross-platform compiler GCC(mingw32), So it can compile on Linux, FreeBSD, etc..
|
||||
Full Object Oriented and Thread Safe library, no global variable with Thread Safe problem.
|
||||
Include MP3decoder.h and .cpp is a wapper class, and it have some useful function
|
||||
like getpos and setpos, they are vbr supported.
|
||||
|
||||
I want the mpg123 engine can have a better future compare to libmad, Because mpg123's
|
||||
decoding quality is good.
|
||||
|
||||
PLEASE NOTE
|
||||
|
||||
The mpglib is originally provided by Michael Hipp under
|
||||
the GNU Lesser General Public Licence (LGPL). So even this
|
||||
modified version is provided under the LGPL (see lgpl.txt).
|
||||
You find the mpg123 project at http://www.mpg123.de. I used the
|
||||
mpglib with optimized Huffman tables from the Lame project
|
||||
wich is reachable under http://www.sulaco.org/mp3.
|
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -1,160 +0,0 @@
|
|||
/**
|
||||
* Babel JavaScript Support
|
||||
*
|
||||
* Copyright (C) 2008 Edgewall Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://babel.edgewall.org/wiki/License.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals. For the exact contribution history, see the revision
|
||||
* history and logs, available at http://babel.edgewall.org/log/.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A simple module that provides a gettext like translation interface.
|
||||
* The catalog passed to load() must be a object conforming to this
|
||||
* interface::
|
||||
*
|
||||
* {
|
||||
* messages: an object of {msgid: translations} items where
|
||||
* translations is an array of messages or a single
|
||||
* string if the message is not pluralizable.
|
||||
* plural_expr: the plural expression for the language.
|
||||
* locale: the identifier for this locale.
|
||||
* domain: the name of the domain.
|
||||
* }
|
||||
*
|
||||
* Missing elements in the object are ignored.
|
||||
*
|
||||
* Typical usage::
|
||||
*
|
||||
* var translations = babel.Translations.load(...).install();
|
||||
*/
|
||||
var babel = new function() {
|
||||
|
||||
var defaultPluralExpr = function(n) { return n == 1 ? 0 : 1; };
|
||||
var formatRegex = /%?%(?:\(([^\)]+)\))?([disr])/g;
|
||||
|
||||
/**
|
||||
* A translations object implementing the gettext interface
|
||||
*/
|
||||
var Translations = this.Translations = function(locale, domain) {
|
||||
this.messages = {};
|
||||
this.locale = locale || 'unknown';
|
||||
this.domain = domain || 'messages';
|
||||
this.pluralexpr = defaultPluralExpr;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new translations object from the catalog and return it.
|
||||
* See the babel-module comment for more details.
|
||||
*/
|
||||
Translations.load = function(catalog) {
|
||||
var rv = new Translations();
|
||||
rv.load(catalog);
|
||||
return rv;
|
||||
};
|
||||
|
||||
Translations.prototype = {
|
||||
/**
|
||||
* translate a single string.
|
||||
*/
|
||||
gettext: function(string) {
|
||||
var translated = this.messages[string];
|
||||
if (typeof translated == 'undefined')
|
||||
return string;
|
||||
return (typeof translated == 'string') ? translated : translated[0];
|
||||
},
|
||||
|
||||
/**
|
||||
* translate a pluralizable string
|
||||
*/
|
||||
ngettext: function(singular, plural, n) {
|
||||
var translated = this.messages[singular];
|
||||
if (typeof translated == 'undefined')
|
||||
return (n == 1) ? singular : plural;
|
||||
return translated[this.pluralexpr(n)];
|
||||
},
|
||||
|
||||
/**
|
||||
* Install this translation document wide. After this call, there are
|
||||
* three new methods on the window object: _, gettext and ngettext
|
||||
*/
|
||||
install: function() {
|
||||
var self = this;
|
||||
window._ = window.gettext = function(string) {
|
||||
return self.gettext(string);
|
||||
};
|
||||
window.ngettext = function(singular, plural, n) {
|
||||
return self.ngettext(singular, plural, n);
|
||||
};
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Works like Translations.load but updates the instance rather
|
||||
* then creating a new one.
|
||||
*/
|
||||
load: function(catalog) {
|
||||
if (catalog.messages)
|
||||
this.update(catalog.messages)
|
||||
if (catalog.plural_expr)
|
||||
this.setPluralExpr(catalog.plural_expr);
|
||||
if (catalog.locale)
|
||||
this.locale = catalog.locale;
|
||||
if (catalog.domain)
|
||||
this.domain = catalog.domain;
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the translations with the object of messages.
|
||||
*/
|
||||
update: function(mapping) {
|
||||
for (var key in mapping)
|
||||
if (mapping.hasOwnProperty(key))
|
||||
this.messages[key] = mapping[key];
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the plural expression
|
||||
*/
|
||||
setPluralExpr: function(expr) {
|
||||
this.pluralexpr = new Function('n', 'return +(' + expr + ')');
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A python inspired string formatting function. Supports named and
|
||||
* positional placeholders and "s", "d" and "i" as type characters
|
||||
* without any formatting specifications.
|
||||
*
|
||||
* Examples::
|
||||
*
|
||||
* babel.format(_('Hello %s'), name)
|
||||
* babel.format(_('Progress: %(percent)s%%'), {percent: 100})
|
||||
*/
|
||||
this.format = function() {
|
||||
var arg, string = arguments[0], idx = 0;
|
||||
if (arguments.length == 1)
|
||||
return string;
|
||||
else if (arguments.length == 2 && typeof arguments[1] == 'object')
|
||||
arg = arguments[1];
|
||||
else {
|
||||
arg = [];
|
||||
for (var i = 1, n = arguments.length; i != n; ++i)
|
||||
arg[i - 1] = arguments[i];
|
||||
}
|
||||
return string.replace(formatRegex, function(all, name, type) {
|
||||
if (all[0] == all[1]) return all.substring(1);
|
||||
var value = arg[name || idx++];
|
||||
return (type == 'i' || type == 'd') ? +value : value;
|
||||
});
|
||||
}
|
||||
|
||||
};
|
|
@ -1,209 +0,0 @@
|
|||
#prefs { margin-top: -0.6em }
|
||||
* html #prefs { width: 34em } /* Set width only for IE */
|
||||
#prefs fieldset { margin: 0; }
|
||||
#prefs fieldset label { display: block }
|
||||
#prefs .buttons { margin-top: -2.3em }
|
||||
#prefs .choice {
|
||||
float: left;
|
||||
margin: 0 .6em 0 .3em;
|
||||
border-right: 1px dotted #d7d7d7;
|
||||
}
|
||||
|
||||
#file-legend { margin-top: 3em; }
|
||||
|
||||
/* Browser */
|
||||
h1 { margin: 0; padding: 0 0 .5em }
|
||||
h1 :link, h1 :visited, h1 .filename { border: none; padding: 0 .2em }
|
||||
h1 :link, h1 :visited { color: #b00 }
|
||||
h1 .first:link, h1 .first:visited { color: #998 }
|
||||
h1 .sep { color: #666; padding: 0 .1em }
|
||||
h1 .pathentry { float: left }
|
||||
|
||||
#jumprev, #jumploc { float: right; font-size: 10px; margin: 0 0 0.6em }
|
||||
#jumprev form, #jumploc form { margin: 0 }
|
||||
#jumprev input, #jumploc select, #jumploc input {
|
||||
font-size: 10px;
|
||||
margin: 0;
|
||||
}
|
||||
#jumploc div.buttons { margin: 0;}
|
||||
#jumploc { margin-right: 2em;}
|
||||
|
||||
/* Browser file annotations */
|
||||
table.code th.blame { width: 5em; }
|
||||
table.code th.blame a { color: #ddd; }
|
||||
|
||||
div.message {
|
||||
background: #f7f7f0;
|
||||
border: 3px double #d7d7d7;
|
||||
margin: 0;
|
||||
padding: 8px;
|
||||
/* Note: border width and padding must be compensated for in the placement */
|
||||
}
|
||||
|
||||
div.message div.inlinebuttons { float: right; }
|
||||
|
||||
/* Styles for the directory entries table
|
||||
(extends the styles for "table.listing") */
|
||||
table.dirlist { margin-top: 0 }
|
||||
table.dirlist td.rev, table.dirlist td.age, table.dirlist td.author, table.dirlist td.change {
|
||||
color: #888;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
}
|
||||
table.dirlist td.rev {
|
||||
font-family: monospace;
|
||||
letter-spacing: -0.08em;
|
||||
font-size: 90%;
|
||||
text-align: right;
|
||||
}
|
||||
table.dirlist td.size {
|
||||
color: #888;
|
||||
white-space: nowrap;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
font-size: 70%;
|
||||
}
|
||||
table.dirlist td.age {
|
||||
border-width: 0 2px 0 0;
|
||||
border-style: solid;
|
||||
font-size: 85%;
|
||||
}
|
||||
table.dirlist td.name { width: 100% }
|
||||
table.dirlist td.name a, table.dirlist td.name span {
|
||||
background-position: 0% 50%;
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 20px;
|
||||
}
|
||||
table.dirlist td.name a.parent { background-image: url(../parent.png) }
|
||||
table.dirlist td.name div { white-space: pre }
|
||||
table.dirlist tr span.expander {
|
||||
background-image: url(../expander_normal.png);
|
||||
cursor: pointer;
|
||||
padding-left: 8px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
table.dirlist tr span.expander:hover {
|
||||
background-image: url(../expander_normal_hover.png);
|
||||
}
|
||||
table.dirlist tr.expanded span.expander {
|
||||
background-image: url(../expander_open.png);
|
||||
padding-left: 12px;
|
||||
margin-left: 0;
|
||||
}
|
||||
table.dirlist tr.expanded span.expander:hover {
|
||||
background-image: url(../expander_open_hover.png);
|
||||
}
|
||||
table.dirlist td.name a.dir { background-image: url(../folder.png) }
|
||||
table.dirlist td.name a.file { background-image: url(../file.png); display: block }
|
||||
table.dirlist td.name a, table.dirlist td.rev a { border-bottom: none }
|
||||
table.dirlist td.author, table.dirlist td.change { font-size: 85% }
|
||||
table.dirlist td.rev a.chgset {
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(../changeset.png);
|
||||
background-position: 100% 50%;
|
||||
padding: 0 0 0 5px;
|
||||
margin: 0 5px 0 0;
|
||||
}
|
||||
table.dirlist td.description { padding-left: 2em }
|
||||
table.dirlist td.description > :first-child { margin-top: 0 }
|
||||
table.dirlist td.description > :last-child { margin-bottom: 0 }
|
||||
|
||||
table.dirlist td span.loading {
|
||||
background-image: url(../loading.gif);
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
#content.browser div.description { padding: 0 0.5em }
|
||||
|
||||
/* Style for the ''View Changes'' button and the diff preparation form */
|
||||
#anydiff { margin: 0 0 1em; float: left }
|
||||
#anydiff form, #anydiff div, #anydiff h2 { display: inline }
|
||||
#anydiff form th { text-align: right }
|
||||
#anydiff input { vertical-align: baseline; margin: 0 -0.5em 0 1em }
|
||||
@media print {
|
||||
#anydiff form { display: none }
|
||||
}
|
||||
|
||||
/* Log */
|
||||
tr.diff input { padding: 0 1em; margin: 0 }
|
||||
|
||||
@media print {
|
||||
th.diff, td.diff { display: none }
|
||||
}
|
||||
|
||||
/* Styles for the revision log table (extends the styles for "table.listing") */
|
||||
table.chglist { margin-top: 0 }
|
||||
.chglist td.diff, .chglist td.rev, .chglist td.age,
|
||||
.chglist td.author, .chglist td.change {
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.chglist td.author { color: #888 }
|
||||
.chglist td.change span {
|
||||
border: 1px solid #999;
|
||||
display: block;
|
||||
margin: .2em .5em 0 0;
|
||||
width: .8em; height: .8em;
|
||||
}
|
||||
.chglist td.diff { padding: 1px }
|
||||
.chglist td.change .comment { display: none }
|
||||
.chglist td.age { font-size: 85% }
|
||||
.chglist td.author { font-size: 85% }
|
||||
.chglist td.rev {
|
||||
font-family: monospace;
|
||||
letter-spacing: -0.08em;
|
||||
font-size: 90%;
|
||||
text-align: right;
|
||||
}
|
||||
.chglist td.rev a { border-bottom: none }
|
||||
.chglist td.rev a.chgset {
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(../changeset.png);
|
||||
background-position: 100% 50%;
|
||||
padding: 0 0 0 5px;
|
||||
margin: 0 5px 0 0;
|
||||
}
|
||||
|
||||
.chglist td.summary, .chglist td.log {
|
||||
width: 100%;
|
||||
font-size: 85%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.chglist td.summary *, .chglist td.log * { margin-top: 0 }
|
||||
/* verbose mode */
|
||||
.chglist tr.verbose { border-top: none }
|
||||
.chglist tr.verbose td.filler, .chglist tr.verbose td.log {
|
||||
border: none;
|
||||
border-bottom: 1px solid #ddd;
|
||||
color: #333;
|
||||
}
|
||||
.chglist tr.verbose td { border: none; }
|
||||
.chglist tr.verbose td.diff, .chglist tr.verbose td.filler {
|
||||
border-left: 1px solid #ddd;
|
||||
}
|
||||
.chglist tr.verbose td.summary, .chglist tr.verbose td.log {
|
||||
border-right: 1px solid #ddd;
|
||||
}
|
||||
|
||||
#paging { margin: 1em 0 }
|
||||
|
||||
/* Styles for the revision info in the file view (see also trac.css) */
|
||||
#info { margin: 0; }
|
||||
#info .props {
|
||||
color: #666;
|
||||
list-style: square;
|
||||
margin: 0 0 .4em 1.6em;
|
||||
padding: 0;
|
||||
}
|
||||
#info .props > li { padding: 2px 0; overflow: auto; }
|
||||
.trac-toggledeleted {
|
||||
display: none;
|
||||
margin-left: 3em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Styles for the HTML preview */
|
||||
#preview { background: #fff; clear: both; margin: 0 }
|
||||
#preview .code-block { border-top: 1px solid #999; margin: 0 }
|
||||
#preview .image-file { overflow: hidden }
|
||||
#preview .image-file img { max-width: 100% }
|
|
@ -1,175 +0,0 @@
|
|||
div.code {
|
||||
background: #f7f7f7;
|
||||
border: 1px solid #d7d7d7;
|
||||
margin: 1em 1.75em;
|
||||
padding: .25em;
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
div.code pre { margin: 0; }
|
||||
|
||||
table.code {
|
||||
border: 1px solid #ddd;
|
||||
border-spacing: 0;
|
||||
border-top: 0;
|
||||
border-collapse: collapse;
|
||||
empty-cells: show;
|
||||
font-size: 12px;
|
||||
line-height: 130%;
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
}
|
||||
table.code th {
|
||||
border-right: 1px solid #d7d7d7;
|
||||
border-bottom: 1px solid #998;
|
||||
font-size: 11px;
|
||||
}
|
||||
table.code th.lineno { width: 4em }
|
||||
table.code thead th {
|
||||
background: #eee;
|
||||
border-top: 1px solid #d7d7d7;
|
||||
color: #999;
|
||||
padding: 0 .25em;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.code thead th.content {
|
||||
text-align: left;
|
||||
}
|
||||
table.code thead th.content span.recover {
|
||||
background: #f7f7f7;
|
||||
border-left: 1px solid;
|
||||
border-right: 1px solid;
|
||||
cursor: pointer;
|
||||
margin: 0 1em 0 0;
|
||||
padding: 0 .5em;
|
||||
}
|
||||
table.code tbody th {
|
||||
background: #eed;
|
||||
color: #886;
|
||||
font-weight: normal;
|
||||
padding: 0 .5em;
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.code tbody th :link, table.code tbody th :visited {
|
||||
border: none;
|
||||
color: #886;
|
||||
text-decoration: none;
|
||||
}
|
||||
table.code tbody th :link:hover, table.code tbody th :visited:hover {
|
||||
color: #000;
|
||||
}
|
||||
table.code td {
|
||||
font: normal 11px monospace;
|
||||
overflow: hidden;
|
||||
padding: 1px 2px;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.code tr.hilite th {
|
||||
background: #ccf;
|
||||
}
|
||||
table.code tr.hilite td {
|
||||
background: #ddf;
|
||||
}
|
||||
.image-file { background: #eee; padding: .3em }
|
||||
.image-file img { background: url(../imggrid.png) }
|
||||
|
||||
/* Default */
|
||||
.code-block span { font-family: monospace; }
|
||||
|
||||
/* Comments */
|
||||
.code-comment, .css_comment, .c_comment, .c_commentdoc, .c_commentline,
|
||||
.c_commentlinedoc, .h_comment,.pl_commentline, .p_commentblock,
|
||||
.p_commentline, .hphp_comment, .hphp_commentblock, .hphp_commentline,
|
||||
.yaml_comment {
|
||||
color: #998;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Language keyword */
|
||||
.code-keyword, .pl_word { color: #789; font-weight: bold }
|
||||
|
||||
/* Type */
|
||||
.code-type, .c_word, .c_word2, .p_classname, .hphp_classname{
|
||||
color: #468;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Function */
|
||||
.code-func, .p_defname {
|
||||
color: #900;
|
||||
font-weight: bold;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* Pre-processor */
|
||||
.code-prep, .c_preprocessor, .pl_preprocessor, .yaml_identifier {
|
||||
color: #999;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Language construct */
|
||||
.code-lang, .p_word { color: #000; font-weight: bold }
|
||||
|
||||
/* String */
|
||||
.code-string, .c_string, .c_stringeol, .css_doublestring, .css_singlestring,
|
||||
.h_singlestring, .h_doublestring, .pl_string, .pl_string_q, .pl_string_qq,
|
||||
.pl_string_qr, .pl_string_qw, .pl_string_qx, .pl_backticks, .pl_character,
|
||||
.p_string, .p_stringeol, .hphp_string, .hphp_stringeol, .hphp_triple,
|
||||
.hphp_tripledouble, .p_character, .p_triple, .p_tripledouble {
|
||||
color: #b84;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* Variable name */
|
||||
.code-var { color: #f9f }
|
||||
|
||||
/* SilverCity-specific styles */
|
||||
.css_id, .css_class, .css_pseudoclass, .css_tag { color: #900000 }
|
||||
.css_directive { color: #009000; font-weight: bold }
|
||||
.css_important { color: blue }
|
||||
.css_operator { color: #000090; font-weight: bold }
|
||||
.css_tag { font-weight: bold }
|
||||
.css_unknown_identifier, .css_unknown_pseudoclass { color: red }
|
||||
.css_value { color: navy }
|
||||
.c_commentdockeyword { color: navy; font-weight: bold }
|
||||
.c_commentdockeyworderror { color: red; font-weight: bold }
|
||||
.c_character, .c_regex, .c_uuid, .c_verbatim { color: olive }
|
||||
.c_number { color: #099 }
|
||||
.h_asp { color: #ff0 }
|
||||
.h_aspat { color: #ffdf00 }
|
||||
.h_attribute { color: teal }
|
||||
.h_attributeunknown { color: red }
|
||||
.h_cdata { color: #373 }
|
||||
.h_entity { color: purple }
|
||||
.h_number { color: #099 }
|
||||
.h_other { color: purple }
|
||||
.h_script, .h_tag, .h_tagend { color: navy }
|
||||
.h_tagunknown { color: red }
|
||||
.h_xmlend, .h_xmlstart { color: blue }
|
||||
.pl_datasection { color: olive }
|
||||
.pl_error { color: red; font-weight: bold }
|
||||
.pl_hash { color: #000 }
|
||||
.pl_here_delim, .pl_here_q, .pl_here_qq, .pl_here_qx, .pl_longquote { color: olive }
|
||||
.pl_number { color: #099 }
|
||||
.pl_pod { font-style: italic }
|
||||
.pl_regex, .pl_regsubst { color: olive }
|
||||
.p_number { color: #099 }
|
||||
.hphp_character { color: olive }
|
||||
.hphp_defname { color: #099; font-weight: bold }
|
||||
.hphp_number { color: #099 }
|
||||
.hphp_word { color: navy; font-weight: bold }
|
||||
.yaml_document { color: gray; font-style: italic }
|
||||
.yaml_keyword { color: #808 }
|
||||
.yaml_number { color: #800 }
|
||||
.yaml_reference { color: #088 }
|
||||
.v_comment { color: gray; font-style: italic }
|
||||
.v_commentline, .v_commentlinebang { color: red; font-style: italic }
|
||||
.v_number, .v_preprocessor { color: #099 }
|
||||
.v_string, .v_stringeol { color: olive }
|
||||
.v_user{ color: blue; font-weight: bold }
|
||||
.v_word, .v_word3 { color: navy; font-weight: bold }
|
||||
.v_word2 { color: green; font-weight: bold }
|
|
@ -1,82 +0,0 @@
|
|||
(function($){
|
||||
|
||||
$.fn.enableFolding = function(autofold, snap) {
|
||||
var fragId = document.location.hash;
|
||||
if (fragId && /^#no\d+$/.test(fragId))
|
||||
fragId = parseInt(fragId.substr(3));
|
||||
if (snap == undefined)
|
||||
snap = false;
|
||||
|
||||
var count = 1;
|
||||
return this.each(function() {
|
||||
// Use first child <a> as a trigger, or generate a trigger from the text
|
||||
var trigger = $(this).children("a").eq(0);
|
||||
if (trigger.length == 0) {
|
||||
trigger = $("<a" + (snap? " id='no" + count + "'": "")
|
||||
+ " href='#no" + count + "'></a>");
|
||||
trigger.text($(this).text());
|
||||
$(this).text("");
|
||||
$(this).append(trigger);
|
||||
}
|
||||
|
||||
trigger.click(function() {
|
||||
var div = $(this.parentNode.parentNode).toggleClass("collapsed");
|
||||
return snap && !div.hasClass("collapsed");
|
||||
});
|
||||
if (autofold && (count != fragId))
|
||||
trigger.parents().eq(1).addClass("collapsed");
|
||||
count++;
|
||||
});
|
||||
}
|
||||
|
||||
/** Enable columns of a table to be hidden by clicking on the column header.
|
||||
*
|
||||
* +------------------+------+---- ... ---+---------------------+
|
||||
* |column_headers[0] | ... | | column_headers[k-1] | <- c_h_row
|
||||
* +==================+======+==== ... ===+=====================+
|
||||
* | row_headers[0] | row_headers[1] | row_headers[1*k-1] | <- rows[0]
|
||||
* | row_headers[k] | row_headers[k+1] | row_headers[2*k-1] | <- rows[1]
|
||||
* ...
|
||||
*/
|
||||
$.fn.enableCollapsibleColumns = function(recovery_area) {
|
||||
// column headers
|
||||
var c_h_row = $('thead tr', this);
|
||||
var column_headers = $('th', c_h_row).not(recovery_area);
|
||||
var k = column_headers.length;
|
||||
// row headers
|
||||
var tbody = $('tbody', this);
|
||||
var row_headers = $('th', tbody);
|
||||
var rows = $('tr', tbody);
|
||||
var n = row_headers.length / k;
|
||||
|
||||
// add a 'hide' callback to each column header
|
||||
column_headers.each(function(j) {
|
||||
function hide() {
|
||||
// remove and save column j
|
||||
var th = $(this);
|
||||
th.css('display', 'none');
|
||||
for ( var i = 0; i < n; i++ )
|
||||
row_headers.eq(i*k+j).css('display', 'none');
|
||||
// create a recovery button and its "show" callback
|
||||
recovery_area.prepend($("<span></span>").addClass("recover")
|
||||
.text(babel.format(_("Show %(title)s"), {title: th.text()}))
|
||||
.click(function() {
|
||||
$(this).remove();
|
||||
th.show();
|
||||
if ($.browser.msie)
|
||||
for ( var i = 0; i < n; i++ )
|
||||
row_headers.eq(i*k+j).show();
|
||||
else // much faster, but not supported by IExplorer
|
||||
for ( var i = 0; i < n; i++ )
|
||||
row_headers.eq(i*k+j).css('display', 'table-cell');
|
||||
})
|
||||
);
|
||||
};
|
||||
$(this).click(hide)
|
||||
.css('cursor', 'pointer')
|
||||
.attr('title', babel.format(_("%(title)s (click to hide column)"),
|
||||
{title: $(this).attr('title')}));
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery);
|
|
@ -1,154 +0,0 @@
|
|||
/*!
|
||||
* jQuery JavaScript Library v1.4.2
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* http://sizzlejs.com/
|
||||
* Copyright 2010, The Dojo Foundation
|
||||
* Released under the MIT, BSD, and GPL Licenses.
|
||||
*
|
||||
* Date: Sat Feb 13 22:33:48 2010 -0500
|
||||
*/
|
||||
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
|
||||
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
|
||||
j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
|
||||
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
|
||||
true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
|
||||
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
|
||||
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
|
||||
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
|
||||
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
|
||||
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
|
||||
c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
|
||||
L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
|
||||
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
|
||||
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
|
||||
d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
|
||||
a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
|
||||
!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
|
||||
true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
|
||||
var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
|
||||
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
|
||||
false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
|
||||
s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
|
||||
applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
|
||||
else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
|
||||
a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
|
||||
w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
|
||||
cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
|
||||
i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
|
||||
" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
|
||||
this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
|
||||
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
|
||||
c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
|
||||
a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
|
||||
function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
|
||||
k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
|
||||
C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
|
||||
null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
|
||||
e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
|
||||
f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
|
||||
if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
|
||||
fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
|
||||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
|
||||
"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
|
||||
a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
|
||||
isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
|
||||
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
|
||||
if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
|
||||
e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
|
||||
"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
|
||||
d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
|
||||
!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
|
||||
toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
|
||||
u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
|
||||
function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
|
||||
if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
|
||||
e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
|
||||
t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
|
||||
g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
|
||||
for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
|
||||
1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
|
||||
CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
|
||||
relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
|
||||
l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
|
||||
h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
|
||||
CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
|
||||
g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
|
||||
text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
|
||||
setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
|
||||
h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
|
||||
m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
|
||||
"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
|
||||
h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
|
||||
!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
|
||||
h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
|
||||
q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
|
||||
if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
|
||||
(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
|
||||
function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
|
||||
gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
|
||||
c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
|
||||
{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
|
||||
"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
|
||||
d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
|
||||
a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
|
||||
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
|
||||
a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
|
||||
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
|
||||
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
|
||||
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
|
||||
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
|
||||
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
|
||||
""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
|
||||
this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
|
||||
u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
|
||||
1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
|
||||
return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
|
||||
""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
|
||||
c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
|
||||
c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
|
||||
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
|
||||
Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
|
||||
"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
|
||||
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
|
||||
a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
|
||||
"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
|
||||
serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
|
||||
function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
|
||||
global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
|
||||
e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
|
||||
"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
|
||||
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
|
||||
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
|
||||
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
|
||||
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
|
||||
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
|
||||
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
|
||||
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
|
||||
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
|
||||
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
|
||||
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
|
||||
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
|
||||
j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
|
||||
this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
|
||||
"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
|
||||
c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
|
||||
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
|
||||
this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
|
||||
e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
|
||||
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
|
||||
function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
|
||||
this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
|
||||
k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
|
||||
f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
|
||||
a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
|
||||
c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
|
||||
d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
|
||||
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
|
||||
"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
|
||||
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
|
|
@ -1,62 +0,0 @@
|
|||
(function($){
|
||||
|
||||
/* Adapted from http://www.kryogenix.org/code/browser/searchhi/ */
|
||||
$.fn.highlightText = function(text, className) {
|
||||
function highlight(node) {
|
||||
if (node.nodeType == 3) { // Node.TEXT_NODE
|
||||
var val = node.nodeValue;
|
||||
var pos = val.toLowerCase().indexOf(text);
|
||||
if (pos >= 0 && !$(node.parentNode).hasClass(className)) {
|
||||
var span = document.createElement("span");
|
||||
span.className = className;
|
||||
var txt = document.createTextNode(val.substr(pos, text.length));
|
||||
span.appendChild(txt);
|
||||
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
|
||||
document.createTextNode(val.substr(pos + text.length)),
|
||||
node.nextSibling));
|
||||
node.nodeValue = val.substr(0, pos);
|
||||
}
|
||||
} else if (!$(node).is("button, select, textarea")) {
|
||||
$.each(node.childNodes, function() { highlight(this) });
|
||||
}
|
||||
}
|
||||
return this.each(function() { highlight(this) });
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
var elems = $(".searchable");
|
||||
if (!elems.length) return;
|
||||
|
||||
function getSearchTerms(url) {
|
||||
if (url.indexOf("?") == -1) return [];
|
||||
var params = url.substr(url.indexOf("?") + 1).split("&");
|
||||
for (var p in params) {
|
||||
var param = params[p].split("=");
|
||||
if (param.length < 2) continue;
|
||||
if (param[0] == "q" || param[0] == "p") {// q= for Google, p= for Yahoo
|
||||
var query = decodeURIComponent(param[1].replace(/\+/g, " "));
|
||||
if (query[0] == "!") query = query.slice(1);
|
||||
var terms = [];
|
||||
$.each(query.split(/(".*?"|'.*?'|\s+)/), function() {
|
||||
if (terms.length < 10) {
|
||||
term = this.replace(/^\s+$/, "")
|
||||
.replace(/^['"]/, "")
|
||||
.replace(/['"]$/, "");
|
||||
if (term.length >= 3)
|
||||
terms.push(term);
|
||||
}
|
||||
});
|
||||
return terms;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
var terms = getSearchTerms(document.URL);
|
||||
if (!terms.length) terms = getSearchTerms(document.referrer);
|
||||
$.each(terms, function(idx) {
|
||||
elems.highlightText(this.toLowerCase(), "searchword" + (idx % 5));
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
|
@ -1,121 +0,0 @@
|
|||
div.code pre .hll { background-color: #ffffcc }
|
||||
div.code pre { background: #ffffff; }
|
||||
div.code pre .c { color: #999988; font-style: italic } /* Comment */
|
||||
div.code pre .err { color: #a61717; background-color: #e3d2d2 } /* Error */
|
||||
div.code pre .k { font-weight: bold } /* Keyword */
|
||||
div.code pre .o { font-weight: bold } /* Operator */
|
||||
div.code pre .cm { color: #999988; font-style: italic } /* Comment.Multiline */
|
||||
div.code pre .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
|
||||
div.code pre .c1 { color: #999988; font-style: italic } /* Comment.Single */
|
||||
div.code pre .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
|
||||
div.code pre .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
|
||||
div.code pre .ge { font-style: italic } /* Generic.Emph */
|
||||
div.code pre .gr { color: #aa0000 } /* Generic.Error */
|
||||
div.code pre .gh { color: #999999 } /* Generic.Heading */
|
||||
div.code pre .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
|
||||
div.code pre .go { color: #888888 } /* Generic.Output */
|
||||
div.code pre .gp { color: #555555 } /* Generic.Prompt */
|
||||
div.code pre .gs { font-weight: bold } /* Generic.Strong */
|
||||
div.code pre .gu { color: #aaaaaa } /* Generic.Subheading */
|
||||
div.code pre .gt { color: #aa0000 } /* Generic.Traceback */
|
||||
div.code pre .kc { font-weight: bold } /* Keyword.Constant */
|
||||
div.code pre .kd { font-weight: bold } /* Keyword.Declaration */
|
||||
div.code pre .kn { font-weight: bold } /* Keyword.Namespace */
|
||||
div.code pre .kp { font-weight: bold } /* Keyword.Pseudo */
|
||||
div.code pre .kr { font-weight: bold } /* Keyword.Reserved */
|
||||
div.code pre .kt { color: #445588; font-weight: bold } /* Keyword.Type */
|
||||
div.code pre .m { color: #009999 } /* Literal.Number */
|
||||
div.code pre .s { color: #bb8844 } /* Literal.String */
|
||||
div.code pre .na { color: #008080 } /* Name.Attribute */
|
||||
div.code pre .nb { color: #999999 } /* Name.Builtin */
|
||||
div.code pre .nc { color: #445588; font-weight: bold } /* Name.Class */
|
||||
div.code pre .no { color: #008080 } /* Name.Constant */
|
||||
div.code pre .ni { color: #800080 } /* Name.Entity */
|
||||
div.code pre .ne { color: #990000; font-weight: bold } /* Name.Exception */
|
||||
div.code pre .nf { color: #990000; font-weight: bold } /* Name.Function */
|
||||
div.code pre .nn { color: #555555 } /* Name.Namespace */
|
||||
div.code pre .nt { color: #000080 } /* Name.Tag */
|
||||
div.code pre .nv { color: #008080 } /* Name.Variable */
|
||||
div.code pre .ow { font-weight: bold } /* Operator.Word */
|
||||
div.code pre .w { color: #bbbbbb } /* Text.Whitespace */
|
||||
div.code pre .mf { color: #009999 } /* Literal.Number.Float */
|
||||
div.code pre .mh { color: #009999 } /* Literal.Number.Hex */
|
||||
div.code pre .mi { color: #009999 } /* Literal.Number.Integer */
|
||||
div.code pre .mo { color: #009999 } /* Literal.Number.Oct */
|
||||
div.code pre .sb { color: #bb8844 } /* Literal.String.Backtick */
|
||||
div.code pre .sc { color: #bb8844 } /* Literal.String.Char */
|
||||
div.code pre .sd { color: #bb8844 } /* Literal.String.Doc */
|
||||
div.code pre .s2 { color: #bb8844 } /* Literal.String.Double */
|
||||
div.code pre .se { color: #bb8844 } /* Literal.String.Escape */
|
||||
div.code pre .sh { color: #bb8844 } /* Literal.String.Heredoc */
|
||||
div.code pre .si { color: #bb8844 } /* Literal.String.Interpol */
|
||||
div.code pre .sx { color: #bb8844 } /* Literal.String.Other */
|
||||
div.code pre .sr { color: #808000 } /* Literal.String.Regex */
|
||||
div.code pre .s1 { color: #bb8844 } /* Literal.String.Single */
|
||||
div.code pre .ss { color: #bb8844 } /* Literal.String.Symbol */
|
||||
div.code pre .bp { color: #999999 } /* Name.Builtin.Pseudo */
|
||||
div.code pre .vc { color: #008080 } /* Name.Variable.Class */
|
||||
div.code pre .vg { color: #008080 } /* Name.Variable.Global */
|
||||
div.code pre .vi { color: #008080 } /* Name.Variable.Instance */
|
||||
div.code pre .il { color: #009999 } /* Literal.Number.Integer.Long */
|
||||
|
||||
table.code td .hll { background-color: #ffffcc }
|
||||
table.code td { background: #ffffff; }
|
||||
table.code td .c { color: #999988; font-style: italic } /* Comment */
|
||||
table.code td .err { color: #a61717; background-color: #e3d2d2 } /* Error */
|
||||
table.code td .k { font-weight: bold } /* Keyword */
|
||||
table.code td .o { font-weight: bold } /* Operator */
|
||||
table.code td .cm { color: #999988; font-style: italic } /* Comment.Multiline */
|
||||
table.code td .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
|
||||
table.code td .c1 { color: #999988; font-style: italic } /* Comment.Single */
|
||||
table.code td .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
|
||||
table.code td .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
|
||||
table.code td .ge { font-style: italic } /* Generic.Emph */
|
||||
table.code td .gr { color: #aa0000 } /* Generic.Error */
|
||||
table.code td .gh { color: #999999 } /* Generic.Heading */
|
||||
table.code td .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
|
||||
table.code td .go { color: #888888 } /* Generic.Output */
|
||||
table.code td .gp { color: #555555 } /* Generic.Prompt */
|
||||
table.code td .gs { font-weight: bold } /* Generic.Strong */
|
||||
table.code td .gu { color: #aaaaaa } /* Generic.Subheading */
|
||||
table.code td .gt { color: #aa0000 } /* Generic.Traceback */
|
||||
table.code td .kc { font-weight: bold } /* Keyword.Constant */
|
||||
table.code td .kd { font-weight: bold } /* Keyword.Declaration */
|
||||
table.code td .kn { font-weight: bold } /* Keyword.Namespace */
|
||||
table.code td .kp { font-weight: bold } /* Keyword.Pseudo */
|
||||
table.code td .kr { font-weight: bold } /* Keyword.Reserved */
|
||||
table.code td .kt { color: #445588; font-weight: bold } /* Keyword.Type */
|
||||
table.code td .m { color: #009999 } /* Literal.Number */
|
||||
table.code td .s { color: #bb8844 } /* Literal.String */
|
||||
table.code td .na { color: #008080 } /* Name.Attribute */
|
||||
table.code td .nb { color: #999999 } /* Name.Builtin */
|
||||
table.code td .nc { color: #445588; font-weight: bold } /* Name.Class */
|
||||
table.code td .no { color: #008080 } /* Name.Constant */
|
||||
table.code td .ni { color: #800080 } /* Name.Entity */
|
||||
table.code td .ne { color: #990000; font-weight: bold } /* Name.Exception */
|
||||
table.code td .nf { color: #990000; font-weight: bold } /* Name.Function */
|
||||
table.code td .nn { color: #555555 } /* Name.Namespace */
|
||||
table.code td .nt { color: #000080 } /* Name.Tag */
|
||||
table.code td .nv { color: #008080 } /* Name.Variable */
|
||||
table.code td .ow { font-weight: bold } /* Operator.Word */
|
||||
table.code td .w { color: #bbbbbb } /* Text.Whitespace */
|
||||
table.code td .mf { color: #009999 } /* Literal.Number.Float */
|
||||
table.code td .mh { color: #009999 } /* Literal.Number.Hex */
|
||||
table.code td .mi { color: #009999 } /* Literal.Number.Integer */
|
||||
table.code td .mo { color: #009999 } /* Literal.Number.Oct */
|
||||
table.code td .sb { color: #bb8844 } /* Literal.String.Backtick */
|
||||
table.code td .sc { color: #bb8844 } /* Literal.String.Char */
|
||||
table.code td .sd { color: #bb8844 } /* Literal.String.Doc */
|
||||
table.code td .s2 { color: #bb8844 } /* Literal.String.Double */
|
||||
table.code td .se { color: #bb8844 } /* Literal.String.Escape */
|
||||
table.code td .sh { color: #bb8844 } /* Literal.String.Heredoc */
|
||||
table.code td .si { color: #bb8844 } /* Literal.String.Interpol */
|
||||
table.code td .sx { color: #bb8844 } /* Literal.String.Other */
|
||||
table.code td .sr { color: #808000 } /* Literal.String.Regex */
|
||||
table.code td .s1 { color: #bb8844 } /* Literal.String.Single */
|
||||
table.code td .ss { color: #bb8844 } /* Literal.String.Symbol */
|
||||
table.code td .bp { color: #999999 } /* Name.Builtin.Pseudo */
|
||||
table.code td .vc { color: #008080 } /* Name.Variable.Class */
|
||||
table.code td .vg { color: #008080 } /* Name.Variable.Global */
|
||||
table.code td .vi { color: #008080 } /* Name.Variable.Instance */
|
||||
table.code td .il { color: #009999 } /* Literal.Number.Integer.Long */
|
|
@ -1,133 +0,0 @@
|
|||
(function($){
|
||||
|
||||
if (typeof _ == 'undefined')
|
||||
babel.Translations.load({}).install();
|
||||
|
||||
$.fn.addAnchor = function(title) {
|
||||
title = title || _("Link here");
|
||||
return this.filter("*[id]").each(function() {
|
||||
$("<a class='anchor'> \u00B6</a>").attr("href", "#" + this.id)
|
||||
.attr("title", title).appendTo(this);
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.checked = function(checked) {
|
||||
if (checked == undefined) { // getter
|
||||
if (!this.length) return false;
|
||||
return this.get(0).checked;
|
||||
} else { // setter
|
||||
return this.each(function() {
|
||||
this.checked = checked;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.enable = function(enabled) {
|
||||
if (enabled == undefined) enabled = true;
|
||||
return this.each(function() {
|
||||
this.disabled = !enabled;
|
||||
var label = $(this).parents("label");
|
||||
if (!label.length && this.id) {
|
||||
label = $("label[for='" + this.id + "']");
|
||||
}
|
||||
if (!enabled) {
|
||||
label.addClass("disabled");
|
||||
} else {
|
||||
label.removeClass("disabled");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.getAbsolutePos = function() {
|
||||
return this.map(function() {
|
||||
var left = this.offsetLeft;
|
||||
var top = this.offsetTop;
|
||||
var parent = this.offsetParent;
|
||||
while (parent) {
|
||||
left += parent.offsetLeft;
|
||||
top += parent.offsetTop;
|
||||
parent = parent.offsetParent;
|
||||
}
|
||||
return {left: left, top: top};
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.scrollToTop = function() {
|
||||
return this.each(function() {
|
||||
scrollTo(0, $(this).getAbsolutePos()[0].top);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
$.loadStyleSheet = function(href, type) {
|
||||
type = type || "text/css";
|
||||
$(document).ready(function() {
|
||||
if (document.createStyleSheet) { // MSIE
|
||||
document.createStyleSheet(href);
|
||||
} else {
|
||||
$("<link rel='stylesheet' type='" + type + "' href='" + href + "' />")
|
||||
.appendTo("head");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Escape special HTML characters (&<>")
|
||||
var quote = {"&": "&", "<": "<", ">": ">", '"': """};
|
||||
|
||||
$.htmlEscape = function(value) {
|
||||
if (typeof value != "string")
|
||||
return value;
|
||||
return value.replace(/[&<>"]/g, function(c) { return quote[c]; });
|
||||
}
|
||||
|
||||
function format(str, args, escape) {
|
||||
var kwargs = args[args.length - 1];
|
||||
return str.replace(/\${?(\w+)}?/g, function(_, k) {
|
||||
var result;
|
||||
if (k.length == 1 && k >= '0' && k <= '9')
|
||||
result = args[k - '0'];
|
||||
else
|
||||
result = kwargs[k];
|
||||
return escape ? escape(result) : result;
|
||||
});
|
||||
}
|
||||
|
||||
// Expand positional ($1 .. $9) and keyword ($name) arguments in a string.
|
||||
// The htmlFormat() version HTML-escapes arguments prior to substitution.
|
||||
$.format = function(str) {
|
||||
return format(str, arguments);
|
||||
}
|
||||
|
||||
$.htmlFormat = function(str) {
|
||||
return format(str, arguments, $.htmlEscape);
|
||||
}
|
||||
|
||||
$.template = $.format; // For backward compatibility
|
||||
|
||||
// Used for dynamically updating the height of a textarea
|
||||
window.resizeTextArea = function (id, rows) {
|
||||
var textarea = $("#" + id).get(0);
|
||||
if (!textarea || textarea.rows == undefined) return;
|
||||
$(textarea).height("");
|
||||
textarea.rows = rows;
|
||||
}
|
||||
|
||||
// The following are defined for backwards compatibility with releases prior
|
||||
// to Trac 0.11
|
||||
|
||||
window.addEvent = function(elem, type, func) {
|
||||
$(elem).bind(type, func);
|
||||
}
|
||||
window.addHeadingLinks = function(container, title) {
|
||||
$.each(["h1", "h2", "h3", "h4", "h5", "h6"], function() {
|
||||
$(this, container).addAnchor(title);
|
||||
});
|
||||
}
|
||||
window.enableControl = function(id, enabled) {
|
||||
$("#" + id).enable(enabled);
|
||||
}
|
||||
window.getAncestorByTagName = function(elem, tagName) {
|
||||
return $(elem).parents(tagName).get(0);
|
||||
}
|
||||
|
||||
})(jQuery);
|
|
@ -1,624 +0,0 @@
|
|||
body { background: #fff; color: #000; margin: 10px; padding: 0; }
|
||||
body, th, tr {
|
||||
font: normal 13px Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif;
|
||||
}
|
||||
h1, h2, h3, h4 {
|
||||
font-family: Arial,Verdana,'Bitstream Vera Sans',Helvetica,sans-serif;
|
||||
font-weight: bold;
|
||||
letter-spacing: -0.018em;
|
||||
page-break-after: avoid;
|
||||
}
|
||||
h1 { font-size: 19px; margin: .15em 1em 0.5em 0 }
|
||||
h2 { font-size: 16px }
|
||||
h3 { font-size: 14px }
|
||||
hr { border: none; border-top: 1px solid #ccb; margin: 2em 0 }
|
||||
address { font-style: normal }
|
||||
img { border: none }
|
||||
|
||||
.underline { text-decoration: underline }
|
||||
ol.loweralpha { list-style-type: lower-alpha }
|
||||
ol.upperalpha { list-style-type: upper-alpha }
|
||||
ol.lowerroman { list-style-type: lower-roman }
|
||||
ol.upperroman { list-style-type: upper-roman }
|
||||
ol.arabic { list-style-type: decimal }
|
||||
|
||||
/* Link styles */
|
||||
:link, :visited {
|
||||
text-decoration: none;
|
||||
color: #b00;
|
||||
border-bottom: 1px dotted #bbb;
|
||||
}
|
||||
:link:hover, :visited:hover { background-color: #eee; color: #555 }
|
||||
h1 :link, h1 :visited ,h2 :link, h2 :visited, h3 :link, h3 :visited,
|
||||
h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited {
|
||||
color: inherit;
|
||||
}
|
||||
.trac-rawlink { border-bottom: none }
|
||||
|
||||
/* Heading anchors */
|
||||
.anchor:link, .anchor:visited {
|
||||
border: none;
|
||||
color: #d7d7d7;
|
||||
font-size: .8em;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
* > .anchor:link, * > .anchor:visited {
|
||||
visibility: hidden;
|
||||
}
|
||||
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor,
|
||||
h4:hover .anchor, h5:hover .anchor, h6:hover .anchor,
|
||||
span:hover .anchor {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
@media screen {
|
||||
a.ext-link .icon {
|
||||
background: url(../extlink.gif) center center no-repeat;
|
||||
padding-left: 12px;
|
||||
}
|
||||
a.mail-link .icon {
|
||||
background: url(../envelope.png) center center no-repeat;
|
||||
padding-left: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Forms */
|
||||
input, textarea, select { margin: 2px }
|
||||
input, select { vertical-align: middle }
|
||||
input[type=button], input[type=submit], input[type=reset] {
|
||||
background: #eee;
|
||||
color: #222;
|
||||
border: 1px outset #ccc;
|
||||
padding: .1em .5em;
|
||||
}
|
||||
input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {
|
||||
background: #ccb;
|
||||
}
|
||||
input[type=button][disabled], input[type=submit][disabled],
|
||||
input[type=reset][disabled] {
|
||||
background: #f6f6f6;
|
||||
border-style: solid;
|
||||
color: #999;
|
||||
}
|
||||
input[type=text], input.textwidget, textarea { border: 1px solid #d7d7d7 }
|
||||
input[type=text], input.textwidget { padding: .25em .5em }
|
||||
input[type=text]:focus, input.textwidget:focus, textarea:focus {
|
||||
border: 1px solid #886;
|
||||
}
|
||||
option { border-bottom: 1px dotted #d7d7d7 }
|
||||
fieldset { border: 1px solid #d7d7d7; padding: .5em; margin: 1em 0 }
|
||||
p.hint, span.hint { color: #666; font-size: 85%; font-style: italic; margin: .5em 0;
|
||||
padding-left: 1em;
|
||||
}
|
||||
fieldset.iefix {
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
* html fieldset.iefix { width: 98% }
|
||||
fieldset.iefix p { margin: 0 }
|
||||
legend { color: #999; padding: 0 .25em; font-size: 90%; font-weight: bold }
|
||||
label.disabled { color: #d7d7d7 }
|
||||
.buttons { margin: .5em .5em .5em 0 }
|
||||
.buttons form, .buttons form div { display: inline }
|
||||
.buttons input { margin: 1em .5em .1em 0 }
|
||||
.inlinebuttons input {
|
||||
font-size: 70%;
|
||||
border-width: 1px;
|
||||
border-style: dotted;
|
||||
margin: 0 .1em;
|
||||
padding: 0.1em;
|
||||
background: none;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
#header hr { display: none }
|
||||
#header h1 { margin: 1.5em 0 -1.5em; padding: 0 }
|
||||
#header img { border: none; margin: 0 0 -3em }
|
||||
#header :link, #header :visited, #header :link:hover, #header :visited:hover {
|
||||
background: transparent;
|
||||
color: #555;
|
||||
margin-bottom: 2px;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
#header h1 :link:hover, #header h1 :visited:hover { color: #000 }
|
||||
|
||||
/* Quick search */
|
||||
#search {
|
||||
clear: both;
|
||||
font-size: 10px;
|
||||
height: 2.2em;
|
||||
margin: 0 0 1em;
|
||||
text-align: right;
|
||||
}
|
||||
#search input { font-size: 10px }
|
||||
#search label { display: none }
|
||||
|
||||
/* Navigation */
|
||||
.nav h2, .nav hr { display: none }
|
||||
.nav ul {
|
||||
font-size: 10px;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
text-align: right;
|
||||
}
|
||||
.nav li {
|
||||
border-right: 1px solid #d7d7d7;
|
||||
display: inline;
|
||||
padding: 0 .75em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.nav li.last { border-right: none }
|
||||
|
||||
/* Main navigation bar */
|
||||
#mainnav {
|
||||
background: #fff url(../topbar_gradient.png) 0 0;
|
||||
border: 1px solid #000;
|
||||
font: normal 10px verdana,'Bitstream Vera Sans',helvetica,arial,sans-serif;
|
||||
margin: .66em 0 .33em;
|
||||
padding: .2em 0;
|
||||
}
|
||||
#mainnav li { border-right: none; padding: .25em 0 }
|
||||
#mainnav :link, #mainnav :visited {
|
||||
background: url(../dots.gif) 0 0 no-repeat;
|
||||
border-right: 1px solid #fff;
|
||||
border-bottom: none;
|
||||
border-left: 1px solid #555;
|
||||
color: #000;
|
||||
padding: .2em 20px;
|
||||
}
|
||||
* html #mainnav :link, * html #mainnav :visited { background-position: 1px 0 }
|
||||
#mainnav :link:hover, #mainnav :visited:hover {
|
||||
background-color: #ccc;
|
||||
border-right: 1px solid #ddd;
|
||||
}
|
||||
#mainnav .active :link, #mainnav .active :visited {
|
||||
background: #000 url(../topbar_gradient2.png) 0 0 repeat-x;
|
||||
border-top: none;
|
||||
border-right: 1px solid #000;
|
||||
color: #eee;
|
||||
font-weight: bold;
|
||||
}
|
||||
#mainnav .active :link:hover, #mainnav .active :visited:hover {
|
||||
border-right: 1px solid #000;
|
||||
}
|
||||
|
||||
/* Context-dependent navigation links */
|
||||
#ctxtnav { min-height: 1em }
|
||||
#ctxtnav li ul {
|
||||
background: #f7f7f7;
|
||||
color: #ccc;
|
||||
border: 1px solid;
|
||||
padding: 0;
|
||||
display: inline;
|
||||
margin: 0;
|
||||
}
|
||||
#ctxtnav li li { padding: 0; }
|
||||
#ctxtnav li li :link, #ctxtnav li li :visited { padding: 0 1em }
|
||||
#ctxtnav li li :link:hover, #ctxtnav li li :visited:hover {
|
||||
background: #bba;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.trac-nav, .trac-topnav {
|
||||
float: right;
|
||||
font-size: 80%;
|
||||
}
|
||||
.trac-topnav {
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
/* Alternate links */
|
||||
#altlinks { clear: both; text-align: center }
|
||||
#altlinks h3 { font-size: 12px; letter-spacing: normal; margin: 0 }
|
||||
#altlinks ul { list-style: none; margin: 0; padding: 0 0 1em }
|
||||
#altlinks li {
|
||||
border-right: 1px solid #d7d7d7;
|
||||
display: inline;
|
||||
font-size: 11px;
|
||||
line-height: 1.5;
|
||||
padding: 0 1em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#altlinks li.last { border-right: none }
|
||||
#altlinks li :link, #altlinks li :visited {
|
||||
background-repeat: no-repeat;
|
||||
color: #666;
|
||||
border: none;
|
||||
padding: 0 0 2px;
|
||||
}
|
||||
#altlinks li a.ics { background-image: url(../ics.png); padding-left: 22px }
|
||||
#altlinks li a.rss { background-image: url(../feed.png); padding-left: 20px }
|
||||
|
||||
/* Footer */
|
||||
#footer {
|
||||
clear: both;
|
||||
color: #bbb;
|
||||
font-size: 10px;
|
||||
border-top: 1px solid;
|
||||
height: 31px;
|
||||
padding: .25em 0;
|
||||
}
|
||||
#footer :link, #footer :visited { color: #bbb; }
|
||||
#footer hr { display: none }
|
||||
#footer #tracpowered { border: 0; float: left }
|
||||
#footer #tracpowered:hover { background: transparent }
|
||||
#footer p { margin: 0 }
|
||||
#footer p.left {
|
||||
float: left;
|
||||
margin-left: 1em;
|
||||
padding: 0 1em;
|
||||
border-left: 1px solid #d7d7d7;
|
||||
border-right: 1px solid #d7d7d7;
|
||||
}
|
||||
#footer p.right {
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#content { padding-bottom: 2em; position: relative }
|
||||
|
||||
#help {
|
||||
clear: both;
|
||||
color: #999;
|
||||
font-size: 90%;
|
||||
margin: 1em;
|
||||
text-align: right;
|
||||
}
|
||||
#help :link, #help :visited { cursor: help }
|
||||
#help hr { display: none }
|
||||
|
||||
/* Section folding */
|
||||
.foldable :link, .foldable :visited {
|
||||
background: url(../expanded.png) 0 50% no-repeat;
|
||||
border: none;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.foldable :link:hover, .foldable :visited:hover { background-color: transparent }
|
||||
.collapsed > .foldable :link, .collapsed > .foldable :visited {
|
||||
background-image: url(../collapsed.png);
|
||||
}
|
||||
.collapsed > div, .collapsed > table, .collapsed > ul, .collapsed > dl { display: none }
|
||||
fieldset > legend.foldable :link, fieldset > legend.foldable :visited {
|
||||
color: #666;
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
/* Page preferences form */
|
||||
#prefs {
|
||||
background: #f7f7f0;
|
||||
border: 1px outset #998;
|
||||
float: right;
|
||||
font-size: 9px;
|
||||
padding: .8em;
|
||||
position: relative;
|
||||
margin: 0 1em 1em;
|
||||
}
|
||||
* html #prefs { width: 26em } /* Set width only for IE */
|
||||
#prefs input, #prefs select { font-size: 9px; vertical-align: middle }
|
||||
#prefs fieldset {
|
||||
background: transparent;
|
||||
border: none;
|
||||
margin: .5em;
|
||||
padding: 0;
|
||||
}
|
||||
#prefs fieldset legend {
|
||||
background: transparent;
|
||||
color: #000;
|
||||
font-size: 9px;
|
||||
font-weight: normal;
|
||||
margin: 0 0 0 -1.5em;
|
||||
padding: 0;
|
||||
}
|
||||
#prefs .buttons { text-align: right }
|
||||
|
||||
/* Version information (browser, wiki, attachments) */
|
||||
#info {
|
||||
margin: 1em 0 0 0;
|
||||
background: #f7f7f0;
|
||||
border: 1px solid #d7d7d7;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
clear: both;
|
||||
width: 100%;
|
||||
}
|
||||
#info th, #info td { font-size: 85%; padding: 2px .5em; vertical-align: top }
|
||||
#info th { font-weight: bold; text-align: left; white-space: nowrap }
|
||||
#info td.message { width: 100% }
|
||||
#info .message ul { padding: 0; margin: 0 2em }
|
||||
#info .message p { margin: 0; padding: 0 }
|
||||
|
||||
/* Wiki */
|
||||
.wikipage { padding-left: 18px }
|
||||
.wikipage h1, .wikipage h2, .wikipage h3 { margin-left: -18px }
|
||||
.wikipage table h1, .wikipage table h2, .wikipage table h3 { margin-left: 0px }
|
||||
div.compact > p:first-child { margin-top: 0 }
|
||||
div.compact > p:last-child { margin-bottom: 0 }
|
||||
|
||||
a.missing:link, a.missing:visited, a.missing, span.missing,
|
||||
a.forbidden, span.forbidden { color: #998 }
|
||||
a.missing:hover { color: #000 }
|
||||
a.closed:link, a.closed:visited, span.closed { text-decoration: line-through }
|
||||
|
||||
/* User-selectable styles for blocks */
|
||||
.important {
|
||||
background: #fcb;
|
||||
border: 1px dotted #d00;
|
||||
color: #500;
|
||||
padding: 0 .5em 0 .5em;
|
||||
margin: .5em;
|
||||
}
|
||||
|
||||
dl.wiki dt { font-weight: bold }
|
||||
dl.compact dt { float: left; padding-right: .5em }
|
||||
dl.compact dd { margin: 0; padding: 0 }
|
||||
|
||||
pre.wiki, pre.literal-block {
|
||||
background: #f7f7f7;
|
||||
border: 1px solid #d7d7d7;
|
||||
margin: 1em 1.75em;
|
||||
padding: .25em;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
blockquote.citation {
|
||||
margin: -0.6em 0;
|
||||
border-style: solid;
|
||||
border-width: 0 0 0 2px;
|
||||
padding-left: .5em;
|
||||
border-color: #b44;
|
||||
}
|
||||
.citation blockquote.citation { border-color: #4b4; }
|
||||
.citation .citation blockquote.citation { border-color: #44b; }
|
||||
.citation .citation .citation blockquote.citation { border-color: #c55; }
|
||||
|
||||
table.wiki {
|
||||
border: 1px solid #ccc;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
table.wiki td { border: 1px solid #ccc; padding: .1em .25em; }
|
||||
table.wiki th {
|
||||
border: 1px solid #bbb;
|
||||
padding: .1em .25em;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.wikitoolbar {
|
||||
margin-top: 0.3em;
|
||||
margin-left: 2px;
|
||||
border: solid #d7d7d7;
|
||||
border-width: 1px 1px 1px 0;
|
||||
height: 18px;
|
||||
width: 234px;
|
||||
}
|
||||
.wikitoolbar :link, .wikitoolbar :visited {
|
||||
background: transparent url(../edit_toolbar.png) no-repeat;
|
||||
border: 1px solid #fff;
|
||||
border-left-color: #d7d7d7;
|
||||
cursor: default;
|
||||
display: block;
|
||||
float: left;
|
||||
width: 24px;
|
||||
height: 16px;
|
||||
}
|
||||
.wikitoolbar :link:hover, .wikitoolbar :visited:hover {
|
||||
background-color: transparent;
|
||||
border: 1px solid #fb2;
|
||||
}
|
||||
.wikitoolbar a#em { background-position: 0 0 }
|
||||
.wikitoolbar a#strong { background-position: 0 -16px }
|
||||
.wikitoolbar a#heading { background-position: 0 -32px }
|
||||
.wikitoolbar a#link { background-position: 0 -48px }
|
||||
.wikitoolbar a#code { background-position: 0 -64px }
|
||||
.wikitoolbar a#hr { background-position: 0 -80px }
|
||||
.wikitoolbar a#np { background-position: 0 -96px }
|
||||
.wikitoolbar a#br { background-position: 0 -112px }
|
||||
.wikitoolbar a#img { background-position: 0 -128px }
|
||||
|
||||
/* Textarea resizer */
|
||||
div.trac-resizable { display: table; width: 1px }
|
||||
div.trac-resizable > div { display: table-cell }
|
||||
div.trac-resizable textarea { display: block; margin-bottom: 0 }
|
||||
div.trac-grip {
|
||||
height: 5px;
|
||||
overflow: hidden;
|
||||
background: #eee url(../grip.png) no-repeat center 1px;
|
||||
border: 1px solid #ddd;
|
||||
border-top-width: 0;
|
||||
cursor: s-resize;
|
||||
}
|
||||
|
||||
/* Styles for the form for adding attachments. */
|
||||
#attachment .field { margin-top: 1.3em }
|
||||
#attachment label { padding-left: .2em }
|
||||
#attachment fieldset { margin-top: 2em }
|
||||
#attachment fieldset .field { float: left; margin: 0 1em .5em 0 }
|
||||
#attachment .options { float: left; padding: 0 0 1em 1em }
|
||||
#attachment br { clear: left }
|
||||
.attachment #preview { margin-top: 1em }
|
||||
|
||||
/* Styles for the list of attachments. */
|
||||
#attachments > div { border: 1px outset #996; padding: 1em }
|
||||
#attachments .attachments { margin-left: 2em; padding: 0 }
|
||||
#attachments dt { display: list-item; list-style: square; }
|
||||
#attachments dd { font-style: italic; margin-left: 0; padding-left: 0; }
|
||||
|
||||
/* Styles for tabular listings such as those used for displaying directory
|
||||
contents and report results. */
|
||||
table.listing {
|
||||
clear: both;
|
||||
border-bottom: 1px solid #d7d7d7;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
margin-top: 1em;
|
||||
width: 100%;
|
||||
}
|
||||
table.listing th { text-align: left; padding: 0 1em .1em 0; font-size: 12px }
|
||||
table.listing thead tr { background: #f7f7f0 }
|
||||
table.listing thead th {
|
||||
border: 1px solid #d7d7d7;
|
||||
border-bottom-color: #999;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
padding: 2px .5em;
|
||||
vertical-align: bottom;
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.listing thead th :link:hover, table.listing thead th :visited:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
table.listing thead th a { border: none; padding-right: 12px }
|
||||
table.listing th.asc a, table.listing th.desc a {
|
||||
font-weight: bold;
|
||||
background-position: 100% 50%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
table.listing th.asc a { background-image: url(../asc.png) }
|
||||
table.listing th.desc a { background-image: url(../desc.png) }
|
||||
table.listing tbody td, table.listing tbody th {
|
||||
border: 1px dotted #ddd;
|
||||
padding: .3em .5em;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.listing tbody td a:hover, table.listing tbody th a:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
table.listing tbody tr { border-top: 1px solid #ddd }
|
||||
table.listing tbody tr.even { background-color: #fcfcfc }
|
||||
table.listing tbody tr.odd { background-color: #f7f7f7 }
|
||||
table.listing tbody tr:hover { background: #eed !important }
|
||||
table.listing tbody tr.focus { background: #ddf !important }
|
||||
|
||||
/* Styles for the page history table
|
||||
(extends the styles for "table.listing") */
|
||||
#fieldhist td { padding: 0 .5em }
|
||||
#fieldhist td.date, #fieldhist td.diff, #fieldhist td.version,
|
||||
#fieldhist td.author {
|
||||
white-space: nowrap;
|
||||
}
|
||||
#fieldhist td.version { text-align: center }
|
||||
#fieldhist td.comment { width: 100% }
|
||||
|
||||
/* Auto-completion interface */
|
||||
.suggestions { background: #fff; border: 1px solid #886; color: #222; }
|
||||
.suggestions ul {
|
||||
font-family: sans-serif;
|
||||
max-height: 20em;
|
||||
min-height: 3em;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
overflow: auto;
|
||||
padding: 0;
|
||||
width: 440px;
|
||||
}
|
||||
* html .suggestions ul { height: 10em; }
|
||||
.suggestions li { background: #fff; cursor: pointer; padding: 2px 5px }
|
||||
.suggestions li.selected { background: #b9b9b9 }
|
||||
|
||||
/* Styles for the error page (and rst errors) */
|
||||
#content.error .message, div.system-message {
|
||||
background: #fdc;
|
||||
border: 2px solid #d00;
|
||||
color: #500;
|
||||
padding: .5em;
|
||||
margin: 1em 0;
|
||||
}
|
||||
#content.error div.message pre, div.system-message pre {
|
||||
margin-left: 1em;
|
||||
overflow: hidden;
|
||||
white-space: normal;
|
||||
}
|
||||
div.system-message p { margin: 0; }
|
||||
div.system-message p.system-message-title { font-weight: bold; }
|
||||
|
||||
#warning.system-message, .warning.system-message { background: #ffb; border: 1px solid #000; }
|
||||
#warning.system-message li { list-style-type: square; }
|
||||
|
||||
#notice.system-message, .notice.system-message { background: #dfd; border: 1px solid #000; }
|
||||
#notice.system-message li { list-style-type: square; }
|
||||
|
||||
#content.error form.newticket { display: inline; }
|
||||
#content.error form.newticket textarea { display: none; }
|
||||
|
||||
#content.error #systeminfo, #content.error #plugins { margin: 1em; width: auto; }
|
||||
#content.error #systeminfo th, #content.error #systeminfo td,
|
||||
#content.error #plugins th, #content.error #plugins td { font-size: 90%; }
|
||||
#content.error #systeminfo th, #content.error #plugins th { background: #f7f7f7; font-weight: bold; }
|
||||
|
||||
#content.error #traceback { margin-left: 1em; }
|
||||
#content.error #traceback :link, #content.error #traceback :visited {
|
||||
border: none;
|
||||
}
|
||||
#content.error #tbtoggle { font-size: 80%; }
|
||||
#content.error #traceback div { margin-left: 1em; }
|
||||
#content.error #traceback h3 { font-size: 95%; margin: .5em 0 0; }
|
||||
#content.error #traceback :link var, #content.error #traceback :visited var {
|
||||
font-family: monospace;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
}
|
||||
#content.error #traceback span.file { color: #666; font-size: 85%; }
|
||||
#content.error #traceback ul { list-style: none; margin: .5em 0; padding: 0; }
|
||||
#content.error #traceback table.code td { white-space: pre; font-size: 90%; }
|
||||
#content.error #traceback table.code tr.current td { background: #e6e6e6; }
|
||||
#content.error #traceback table { margin: .5em 0 1em; }
|
||||
#content.error #traceback th, #content.error #traceback td {
|
||||
font-size: 85%; padding: 1px;
|
||||
}
|
||||
#content.error #traceback th var {
|
||||
font-family: monospace;
|
||||
font-style: normal;
|
||||
}
|
||||
#content.error #traceback td code { white-space: pre; }
|
||||
#content.error #traceback pre { font-size: 95%; }
|
||||
|
||||
#content.error #plugins td.file { color: #666; }
|
||||
|
||||
#content .paging { margin: 0 0 2em; padding: .5em 0 0;
|
||||
font-size: 85%; line-height: 2em; text-align: center;
|
||||
}
|
||||
#content .paging .current {
|
||||
padding: .1em .3em;
|
||||
border: 1px solid #333;
|
||||
background: #999; color: #fff;
|
||||
}
|
||||
|
||||
#content .paging :link, #content .paging :visited {
|
||||
padding: .1em .3em;
|
||||
border: 1px solid #666;
|
||||
background: transparent; color: #666;
|
||||
}
|
||||
#content .paging :link:hover, #content .paging :visited:hover {
|
||||
background: #999; color: #fff; border-color: #333;
|
||||
}
|
||||
#content .paging .previous a,
|
||||
#content .paging .next a {
|
||||
font-size: 150%; font-weight: bold; border: none;
|
||||
}
|
||||
#content .paging .previous a:hover,
|
||||
#content .paging .next a:hover {
|
||||
background: transparent; color: #666;
|
||||
}
|
||||
|
||||
#content h2 .numresults { color: #666; font-size: 90%; }
|
||||
|
||||
/* Styles for search word highlighting */
|
||||
@media screen {
|
||||
.searchword0 { background: #ff9 }
|
||||
.searchword1 { background: #cfc }
|
||||
.searchword2 { background: #cff }
|
||||
.searchword3 { background: #ccf }
|
||||
.searchword4 { background: #fcf }
|
||||
}
|
||||
|
||||
@media print {
|
||||
#header, #altlinks, #footer, #help { display: none }
|
||||
.nav, form, .buttons form, form .buttons, form .inlinebuttons,
|
||||
.noprint, .trac-rawlink, .trac-nav, .trac-topnav {
|
||||
display: none;
|
||||
}
|
||||
form.printableform { display: block }
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
|
@ -1,66 +0,0 @@
|
|||
|
||||
|
||||
//*********************************************************
|
||||
//decode in_buf to out_buf
|
||||
#define MP3_ERR -1
|
||||
#define MP3_OK 0
|
||||
#define MP3_NEED_MORE 1
|
||||
|
||||
|
||||
int status;
|
||||
struct mpstr mp;
|
||||
InitMP3(&mp);
|
||||
int inlen;
|
||||
inlen=21759;
|
||||
int outlen;
|
||||
outlen=0;
|
||||
int OUT_BUF_SIZE;
|
||||
OUT_BUF_SIZE=50000000;
|
||||
|
||||
char *bufin;
|
||||
bufin=(char*)((uptrszint)((&(((uint8*)(__ARRAY_UBYTE_IN_BUF[0]))[array_check(( 0 )-__ARRAY_UBYTE_IN_BUF[4],__ARRAY_UBYTE_IN_BUF[5])]))));
|
||||
char *bufout;
|
||||
bufout=(char*)((uptrszint)((&(((uint8*)(__ARRAY_UBYTE_OUT_BUF[0]))[array_check(( 0 )-__ARRAY_UBYTE_OUT_BUF[4],__ARRAY_UBYTE_OUT_BUF[5])]))));
|
||||
|
||||
|
||||
status = decodeMP3(&mp,bufin,inlen,bufout,OUT_BUF_SIZE,&outlen);
|
||||
bufout+=outlen;
|
||||
|
||||
ddd:
|
||||
|
||||
status = decodeMP3(&mp,NULL,0,bufout,OUT_BUF_SIZE,&outlen);
|
||||
bufout+=outlen;
|
||||
|
||||
if ((status==0)&&(outlen!=0)) goto ddd;
|
||||
|
||||
//status = decodeMP3(&mp,buf,len,out,8192,&size);
|
||||
/*
|
||||
|
||||
while(1) {
|
||||
37 len = read(0,buf,16384);
|
||||
38 if(len <= 0)
|
||||
39 break;
|
||||
40 ret = decodeMP3(&mp,buf,len,out,8192,&size);
|
||||
41 while(ret == MP3_OK) {
|
||||
42 write(1,out,size);
|
||||
43 ret = decodeMP3(&mp,NULL,0,out,8192,&size);
|
||||
44 }
|
||||
45 }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Initialize buffer
|
||||
status = decodeMP3(&mp,bufin,inlen,bufout,OUT_BUF_SIZE,&outlen);
|
||||
qbs_print(qbs_str(status),1);
|
||||
qbs_print(qbs_str(outlen),1);
|
||||
|
||||
// Decode buffer
|
||||
// status = decodeMP3(&mp,NULL,0,bufout,OUT_BUF_SIZE,&outlen);
|
||||
status = decodeMP3(&mp,NULL,0,bufout,OUT_BUF_SIZE,&outlen);
|
||||
qbs_print(qbs_str(status),1);
|
||||
qbs_print(qbs_str(outlen),1);
|
||||
*/
|
|
@ -1,196 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<link href="mpg123__to__wav_8c_source_files/02.css" rel="stylesheet" type="text/css">
|
||||
<meta name="author" content="Michael Hipp & Thomas Orgis">
|
||||
<meta name="copyright" content="Michael Hipp & Thomas Orgis">
|
||||
<meta name="publisher" content="Thomas Orgis">
|
||||
|
||||
<title>libmpg123: mpg123_to_wav.c Source File</title>
|
||||
<link href="mpg123__to__wav_8c_source_files/doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="center">
|
||||
<a href="http://www.mpg123.de/index.shtml" title="mpg123 website entry page"><img alt="mpg123 logo" src="mpg123__to__wav_8c_source_files/logo-current.png"></a>
|
||||
<div>
|
||||
<a href="http://www.mpg123.de/download.shtml">download</a>
|
||||
:
|
||||
<a href="http://www.mpg123.de/cgi-bin/viewvc.cgi">svn</a>
|
||||
::
|
||||
<a href="http://www.mpg123.de/features.shtml">features</a>
|
||||
::
|
||||
<a href="http://sourceforge.net/projects/mpg123">sf.net project</a>
|
||||
-
|
||||
<a href="http://sourceforge.net/tracker/?atid=733194&group_id=135704&func=browse">bug tracker</a>
|
||||
::
|
||||
<a href="http://www.mpg123.de/cgi-bin/news.cgi">news archive</a>
|
||||
</div>
|
||||
<div>
|
||||
<a href="http://www.mpg123.de/api/">libmpg123 API</a>
|
||||
::
|
||||
<a href="http://www.mpg123.de/hacking.shtml">hacking</a>
|
||||
::
|
||||
<a href="http://www.mpg123.de/testing.shtml">testing</a>
|
||||
::
|
||||
<a href="http://www.mpg123.de/benchmarking.shtml">benchmarking</a>
|
||||
::
|
||||
<a href="http://www.mpg123.de/faq.shtml">FAQ</a>
|
||||
::
|
||||
<a href="http://www.mpg123.de/links.shtml">links</a>
|
||||
::
|
||||
<a href="http://www.mpg123.de/contact.shtml">contact</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="padding:1em;">
|
||||
<strong>Note:</strong>
|
||||
This API doc is automatically generated from the current development
|
||||
version that you can get via Subversion or as a daily snapshot from <a href="http://mpg123.org/snapshot">http://mpg123.org/snapshot</a>.
|
||||
There may be differences (additions) compared to the latest stable release. See <a href="http://mpg123.org/cgi-bin/viewvc.cgi/trunk/NEWS.libmpg123?view=markup">NEWS.libmpg123</a> and the overall <a href="http://mpg123.org/cgi-bin/viewvc.cgi/trunk/NEWS?view=markup">NEWS</a> file on libmpg123 versions and important changes between them.<br>
|
||||
Let me emphasize that the policy for libmpg123 is to always stay backwards compatible -- only <em>additions</em> are planned (and it's not yet planned to change the plans;-).
|
||||
</div>
|
||||
<!-- Generated by Doxygen 1.7.1 -->
|
||||
<script type="text/javascript"><!--
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
--></script>
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<h1>mpg123_to_wav.c</h1> </div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<a href="http://www.mpg123.de/api/mpg123__to__wav_8c.shtml">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||
<a name="l00002"></a>00002 <span class="comment"> mpg123_to_wav.c</span>
|
||||
<a name="l00003"></a>00003 <span class="comment"></span>
|
||||
<a name="l00004"></a>00004 <span class="comment"> copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1</span>
|
||||
<a name="l00005"></a>00005 <span class="comment"> see COPYING and AUTHORS files in distribution or http://mpg123.org</span>
|
||||
<a name="l00006"></a>00006 <span class="comment"> initially written by Nicholas Humfrey</span>
|
||||
<a name="l00007"></a>00007 <span class="comment">*/</span>
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include <stdio.h></span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include <strings.h></span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include <<a class="code" href="http://www.mpg123.de/api/mpg123_8h.shtml">mpg123.h</a>></span>
|
||||
<a name="l00012"></a>00012 <span class="preprocessor">#include <sndfile.h></span>
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="keywordtype">void</span> usage()
|
||||
<a name="l00016"></a>00016 {
|
||||
<a name="l00017"></a>00017 printf(<span class="stringliteral">"Usage: mpg123_to_wav <input> <output> [s16|f32 [ <buffersize>]]\n"</span>);
|
||||
<a name="l00018"></a>00018 exit(99);
|
||||
<a name="l00019"></a>00019 }
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a>00021 <span class="keywordtype">void</span> cleanup(<a class="code" href="http://www.mpg123.de/api/group__mpg123__init.shtml#ga6728e2839a395f3a07d4514da659faca">mpg123_handle</a> *mh)
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="comment">/* It's really to late for error checks here;-) */</span>
|
||||
<a name="l00024"></a>00024 <a class="code" href="http://www.mpg123.de/api/group__mpg123__input.shtml#ga9648ec0771f8f21646f3215fa97a52bd">mpg123_close</a>(mh);
|
||||
<a name="l00025"></a>00025 <a class="code" href="http://www.mpg123.de/api/group__mpg123__init.shtml#ga0b289fffd405c287a13283883a5590ff">mpg123_delete</a>(mh);
|
||||
<a name="l00026"></a>00026 <a class="code" href="http://www.mpg123.de/api/group__mpg123__init.shtml#gaa156beb645b863aed906fc5a279ce56e">mpg123_exit</a>();
|
||||
<a name="l00027"></a>00027 }
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00029"></a>00029 <span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[])
|
||||
<a name="l00030"></a>00030 {
|
||||
<a name="l00031"></a>00031 SNDFILE* sndfile = NULL;
|
||||
<a name="l00032"></a>00032 SF_INFO sfinfo;
|
||||
<a name="l00033"></a>00033 <a class="code" href="http://www.mpg123.de/api/group__mpg123__init.shtml#ga6728e2839a395f3a07d4514da659faca">mpg123_handle</a> *mh = NULL;
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* buffer = NULL;
|
||||
<a name="l00035"></a>00035 <span class="keywordtype">size_t</span> buffer_size = 0;
|
||||
<a name="l00036"></a>00036 <span class="keywordtype">size_t</span> done = 0;
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">int</span> channels = 0, encoding = 0;
|
||||
<a name="l00038"></a>00038 <span class="keywordtype">long</span> rate = 0;
|
||||
<a name="l00039"></a>00039 <span class="keywordtype">int</span> err = MPG123_OK;
|
||||
<a name="l00040"></a>00040 off_t samples = 0;
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a>00042 <span class="keywordflow">if</span> (argc<3) usage();
|
||||
<a name="l00043"></a>00043 printf( <span class="stringliteral">"Input file: %s\n"</span>, argv[1]);
|
||||
<a name="l00044"></a>00044 printf( <span class="stringliteral">"Output file: %s\n"</span>, argv[2]);
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00046"></a>00046 err = <a class="code" href="http://www.mpg123.de/api/group__mpg123__init.shtml#gab4ec9458b44a971249634b6b5f002b13">mpg123_init</a>();
|
||||
<a name="l00047"></a>00047 <span class="keywordflow">if</span>(err != <a class="code" href="http://www.mpg123.de/api/group__mpg123__error.shtml#ggac50432012aeaf7c23014de3198dfa5fdaf2a2fd03e8a2cc34d676f1a416f482e0">MPG123_OK</a> || (mh = <a class="code" href="http://www.mpg123.de/api/group__mpg123__init.shtml#ga16294920e5b0889d1a9a5f44acc95bcb">mpg123_new</a>(NULL, &err)) == NULL)
|
||||
<a name="l00048"></a>00048 {
|
||||
<a name="l00049"></a>00049 fprintf(stderr, <span class="stringliteral">"Basic setup goes wrong: %s"</span>, <a class="code" href="http://www.mpg123.de/api/group__mpg123__error.shtml#ga0d5be9516e74a2e979b741987383e163">mpg123_plain_strerror</a>(err));
|
||||
<a name="l00050"></a>00050 cleanup(mh);
|
||||
<a name="l00051"></a>00051 <span class="keywordflow">return</span> -1;
|
||||
<a name="l00052"></a>00052 }
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00054"></a>00054 <span class="comment">/* Simple hack to enable floating point output. */</span>
|
||||
<a name="l00055"></a>00055 <span class="keywordflow">if</span>(argc >= 4 && !strcmp(argv[3], <span class="stringliteral">"f32"</span>)) <a class="code" href="http://www.mpg123.de/api/group__mpg123__init.shtml#gace722e63ce9a280a7bc81f689579e2d1">mpg123_param</a>(mh, <a class="code" href="http://www.mpg123.de/api/group__mpg123__init.shtml#gga73a8ff3363028b89afc72b3ea032b9cba827123f9e1f1632205edf3cc2ffcbc57">MPG123_ADD_FLAGS</a>, <a class="code" href="http://www.mpg123.de/api/group__mpg123__init.shtml#gga12f1bf1105a9b0c1501b20516a9719d4a14f7a0feff933f06ae34db03d73aa1db">MPG123_FORCE_FLOAT</a>, 0.);
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00057"></a>00057 <span class="comment">/* Let mpg123 work with the file, that excludes MPG123_NEED_MORE messages. */</span>
|
||||
<a name="l00058"></a>00058 <span class="keywordflow">if</span>( <a class="code" href="http://www.mpg123.de/api/group__mpg123__input.shtml#ga92823034f354dd58b11ac7adace153c5">mpg123_open</a>(mh, argv[1]) != <a class="code" href="http://www.mpg123.de/api/group__mpg123__error.shtml#ggac50432012aeaf7c23014de3198dfa5fdaf2a2fd03e8a2cc34d676f1a416f482e0">MPG123_OK</a>
|
||||
<a name="l00059"></a>00059 <span class="comment">/* Peek into track and get first output format. */</span>
|
||||
<a name="l00060"></a>00060 || <a class="code" href="http://www.mpg123.de/api/group__mpg123__output.shtml#ga3becc3c7115b0bf57cfb25f30391c448">mpg123_getformat</a>(mh, &rate, &channels, &encoding) != <a class="code" href="http://www.mpg123.de/api/group__mpg123__error.shtml#ggac50432012aeaf7c23014de3198dfa5fdaf2a2fd03e8a2cc34d676f1a416f482e0">MPG123_OK</a> )
|
||||
<a name="l00061"></a>00061 {
|
||||
<a name="l00062"></a>00062 fprintf( stderr, <span class="stringliteral">"Trouble with mpg123: %s\n"</span>, <a class="code" href="http://www.mpg123.de/api/group__mpg123__error.shtml#ga1ec2703febfdf074b8e78c575b704e61">mpg123_strerror</a>(mh) );
|
||||
<a name="l00063"></a>00063 cleanup(mh);
|
||||
<a name="l00064"></a>00064 <span class="keywordflow">return</span> -1;
|
||||
<a name="l00065"></a>00065 }
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <span class="keywordflow">if</span>(encoding != <a class="code" href="http://www.mpg123.de/api/group__mpg123__output.shtml#ggafc8cdd60a8d3c30a09249869d835c634a0bbd04130b54eb8e4b336e8551459279">MPG123_ENC_SIGNED_16</a> && encoding != <a class="code" href="http://www.mpg123.de/api/group__mpg123__output.shtml#ggafc8cdd60a8d3c30a09249869d835c634afee3f81a5b7f53cd8a1613e05b942fd7">MPG123_ENC_FLOAT_32</a>)
|
||||
<a name="l00068"></a>00068 { <span class="comment">/* Signed 16 is the default output format anyways; it would actually by only different if we forced it.</span>
|
||||
<a name="l00069"></a>00069 <span class="comment"> So this check is here just for this explanation. */</span>
|
||||
<a name="l00070"></a>00070 cleanup(mh);
|
||||
<a name="l00071"></a>00071 fprintf(stderr, <span class="stringliteral">"Bad encoding: 0x%x!\n"</span>, encoding);
|
||||
<a name="l00072"></a>00072 <span class="keywordflow">return</span> -2;
|
||||
<a name="l00073"></a>00073 }
|
||||
<a name="l00074"></a>00074 <span class="comment">/* Ensure that this output format will not change (it could, when we allow it). */</span>
|
||||
<a name="l00075"></a>00075 <a class="code" href="http://www.mpg123.de/api/group__mpg123__output.shtml#ga187d1ae72e014925639ba5af532d7d2f">mpg123_format_none</a>(mh);
|
||||
<a name="l00076"></a>00076 <a class="code" href="http://www.mpg123.de/api/group__mpg123__output.shtml#gadedc4685ecc8ca298d71e31d0d0d9bfb">mpg123_format</a>(mh, rate, channels, encoding);
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 bzero(&sfinfo, <span class="keyword">sizeof</span>(sfinfo) );
|
||||
<a name="l00079"></a>00079 sfinfo.samplerate = rate;
|
||||
<a name="l00080"></a>00080 sfinfo.channels = channels;
|
||||
<a name="l00081"></a>00081 sfinfo.format = SF_FORMAT_WAV|(encoding == <a class="code" href="http://www.mpg123.de/api/group__mpg123__output.shtml#ggafc8cdd60a8d3c30a09249869d835c634a0bbd04130b54eb8e4b336e8551459279">MPG123_ENC_SIGNED_16</a> ? SF_FORMAT_PCM_16 : SF_FORMAT_FLOAT);
|
||||
<a name="l00082"></a>00082 printf(<span class="stringliteral">"Creating WAV with %i channels and %liHz.\n"</span>, channels, rate);
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 sndfile = sf_open(argv[2], SFM_WRITE, &sfinfo);
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">if</span>(sndfile == NULL){ fprintf(stderr, <span class="stringliteral">"Cannot open output file!\n"</span>); cleanup(mh); <span class="keywordflow">return</span> -2; }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="comment">/* Buffer could be almost any size here, mpg123_outblock() is just some recommendation.</span>
|
||||
<a name="l00088"></a>00088 <span class="comment"> Important, especially for sndfile writing, is that the size is a multiple of sample size. */</span>
|
||||
<a name="l00089"></a>00089 buffer_size = argc >= 5 ? atol(argv[4]) : <a class="code" href="http://www.mpg123.de/api/group__mpg123__lowio.shtml#ga9e300b83abb001f09fa6f9fb6769912a">mpg123_outblock</a>(mh);
|
||||
<a name="l00090"></a>00090 buffer = malloc( buffer_size );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="keywordflow">do</span>
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 sf_count_t more_samples;
|
||||
<a name="l00095"></a>00095 err = <a class="code" href="http://www.mpg123.de/api/group__mpg123__input.shtml#ga2777c4c390a18fe289f2a491fa390707">mpg123_read</a>( mh, buffer, buffer_size, &done );
|
||||
<a name="l00096"></a>00096 more_samples = encoding == <a class="code" href="http://www.mpg123.de/api/group__mpg123__output.shtml#ggafc8cdd60a8d3c30a09249869d835c634a0bbd04130b54eb8e4b336e8551459279">MPG123_ENC_SIGNED_16</a>
|
||||
<a name="l00097"></a>00097 ? sf_write_short(sndfile, (<span class="keywordtype">short</span>*)buffer, done/<span class="keyword">sizeof</span>(<span class="keywordtype">short</span>))
|
||||
<a name="l00098"></a>00098 : sf_write_float(sndfile, (float*)buffer, done/sizeof(float));
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">if</span>(more_samples < 0 || more_samples*<a class="code" href="http://www.mpg123.de/api/group__mpg123__output.shtml#gae36f200d7e13ab9c735c5f06870d8984">mpg123_encsize</a>(encoding) != done)
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 fprintf(stderr, <span class="stringliteral">"Warning: Written number of samples does not match the byte count we got from libmpg123: %li != %li\n"</span>, (<span class="keywordtype">long</span>)(more_samples*<a class="code" href="http://www.mpg123.de/api/group__mpg123__output.shtml#gae36f200d7e13ab9c735c5f06870d8984">mpg123_encsize</a>(encoding)), (<span class="keywordtype">long</span>)done);
|
||||
<a name="l00102"></a>00102 }
|
||||
<a name="l00103"></a>00103 samples += more_samples;
|
||||
<a name="l00104"></a>00104 <span class="comment">/* We are not in feeder mode, so MPG123_OK, MPG123_ERR and MPG123_NEW_FORMAT are the only possibilities.</span>
|
||||
<a name="l00105"></a>00105 <span class="comment"> We do not handle a new format, MPG123_DONE is the end... so abort on anything not MPG123_OK. */</span>
|
||||
<a name="l00106"></a>00106 } <span class="keywordflow">while</span> (err==<a class="code" href="http://www.mpg123.de/api/group__mpg123__error.shtml#ggac50432012aeaf7c23014de3198dfa5fdaf2a2fd03e8a2cc34d676f1a416f482e0">MPG123_OK</a>);
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="keywordflow">if</span>(err != <a class="code" href="http://www.mpg123.de/api/group__mpg123__error.shtml#ggac50432012aeaf7c23014de3198dfa5fdaa70ae24fcae9de17ba5d7196898557ba">MPG123_DONE</a>)
|
||||
<a name="l00109"></a>00109 fprintf( stderr, <span class="stringliteral">"Warning: Decoding ended prematurely because: %s\n"</span>,
|
||||
<a name="l00110"></a>00110 err == <a class="code" href="http://www.mpg123.de/api/group__mpg123__error.shtml#ggac50432012aeaf7c23014de3198dfa5fda416b4ef6c8cdc461fe210327819192cd">MPG123_ERR</a> ? <a class="code" href="http://www.mpg123.de/api/group__mpg123__error.shtml#ga1ec2703febfdf074b8e78c575b704e61">mpg123_strerror</a>(mh) : <a class="code" href="http://www.mpg123.de/api/group__mpg123__error.shtml#ga0d5be9516e74a2e979b741987383e163">mpg123_plain_strerror</a>(err) );
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 sf_close( sndfile );
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 samples /= channels;
|
||||
<a name="l00115"></a>00115 printf(<span class="stringliteral">"%li samples written.\n"</span>, (<span class="keywordtype">long</span>)samples);
|
||||
<a name="l00116"></a>00116 cleanup(mh);
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">return</span> 0;
|
||||
<a name="l00118"></a>00118 }
|
||||
</pre></div></div>
|
||||
|
||||
<!--- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Defines</a></div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="" name="MSearchResults" id="MSearchResults" frameborder="0">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<hr class="footer"><address class="footer"><small>Generated on Thu May 3 2012 09:49:21 for libmpg123 by
|
||||
<a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="mpg123__to__wav_8c_source_files/doxygen.png" alt="doxygen"></a> 1.7.1 </small></address>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -1,63 +0,0 @@
|
|||
html
|
||||
{
|
||||
background: #e0e0ff no-repeat top right;
|
||||
color: #000000;
|
||||
cursor: default;
|
||||
direction: ltr;
|
||||
font: 87.5%/1.5 'lucida sans unicode', 'lucida grande', sans-serif;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
margin-top:10pt;
|
||||
margin-right:10pt;
|
||||
margin-bottom:10pt;
|
||||
margin-left:10pt;
|
||||
}
|
||||
|
||||
img {border: none;}
|
||||
|
||||
.big { font-size:200%; }
|
||||
.reallybig { font-size:300%; }
|
||||
.center{ text-align:center; }
|
||||
|
||||
/*
|
||||
a:link { color:#FFA100; text-decoration:none; font-weight:bold; }
|
||||
a:visited { color:#CA8000; text-decoration:none; font-weight:bold; }
|
||||
a:hover { color:#FFA100; text-decoration:underline; }
|
||||
a:active { color:#FFFFFF; text-decoration:none; }
|
||||
*/
|
||||
|
||||
h1, h2, h3 {font-family: inherit; color: #330000 }
|
||||
|
||||
p { width:90%; text-align:left; margin-left:5%; }
|
||||
ul { width:80%; text-align:left; margin-left:10%; }
|
||||
|
||||
/*
|
||||
table { width:90%; text-align:left; margin-left:5%; }
|
||||
|
||||
pre { width:90%; text-align:left; margin-left:5%; }
|
||||
*/
|
||||
|
||||
hr { width:80%; }
|
||||
|
||||
.boxed {border: 1px solid #666666; padding: .5em;}
|
||||
|
||||
.newsblock
|
||||
{
|
||||
background-color: #ccdddd;
|
||||
margin-left:1.5cm;
|
||||
margin-right:1.5cm;
|
||||
padding-bottom: .5em;
|
||||
}
|
||||
.newshead { background-color: #000055; padding: 0.5em; font-weight: bold; }
|
||||
.newshead a:link { color:#FFA100; text-decoration:none; font-weight:bold; }
|
||||
.newshead a:visited { color:#CA8000; text-decoration:none; font-weight:bold; }
|
||||
.newshead a:hover { color:#FFA100; text-decoration:underline; }
|
||||
.newshead a:active { color:#FFFFFF; text-decoration:none; }
|
||||
|
||||
.newsdate { color: #ee4400; }
|
||||
.newstitle { color: #ffffff; }
|
||||
.newsby { color: #bbbbbb; }
|
||||
|
||||
.code { font-family: monospace; }
|
|
@ -1,359 +0,0 @@
|
|||
/* BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
|
||||
font-family: Geneva, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
BODY,TD {
|
||||
font-size: 90%;
|
||||
}
|
||||
H1 {
|
||||
text-align: center;
|
||||
font-size: 160%;
|
||||
}
|
||||
H2 {
|
||||
font-size: 120%;
|
||||
}
|
||||
H3 {
|
||||
font-size: 100%;
|
||||
}
|
||||
CAPTION { font-weight: bold } */
|
||||
DIV.qindex {
|
||||
width: 100%;
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
line-height: 140%;
|
||||
}
|
||||
DIV.nav {
|
||||
width: 100%;
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
line-height: 140%;
|
||||
}
|
||||
DIV.navtab {
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
margin-right: 15px;
|
||||
padding: 2px;
|
||||
}
|
||||
TD.navtab {
|
||||
font-size: 70%;
|
||||
}
|
||||
A.qindex {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #1A419D;
|
||||
}
|
||||
A.qindex:visited {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #1A419D
|
||||
}
|
||||
A.qindex:hover {
|
||||
text-decoration: none;
|
||||
background-color: #ddddff;
|
||||
}
|
||||
A.qindexHL {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff;
|
||||
border: 1px double #9295C2;
|
||||
}
|
||||
A.qindexHL:hover {
|
||||
text-decoration: none;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff;
|
||||
}
|
||||
A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff }
|
||||
A.el { text-decoration: none; font-weight: bold }
|
||||
A.elRef { font-weight: bold }
|
||||
A.code:link { text-decoration: none; font-weight: normal; color: #0000FF}
|
||||
A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF}
|
||||
A.codeRef:link { font-weight: normal; color: #0000FF}
|
||||
A.codeRef:visited { font-weight: normal; color: #0000FF}
|
||||
A:hover { text-decoration: none; background-color: #f2f2ff }
|
||||
DL.el { margin-left: -1cm }
|
||||
.fragment {
|
||||
font-family: monospace, fixed;
|
||||
font-size: 95%;
|
||||
}
|
||||
PRE.fragment {
|
||||
border: 1px solid #CCCCCC;
|
||||
background-color: #f5f5f5;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 4px;
|
||||
margin-left: 2px;
|
||||
margin-right: 8px;
|
||||
padding-left: 6px;
|
||||
padding-right: 6px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
|
||||
|
||||
DIV.groupHeader {
|
||||
margin-left: 16px;
|
||||
margin-top: 12px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% }
|
||||
/*BODY {
|
||||
background: white;
|
||||
color: black;
|
||||
margin-right: 20px;
|
||||
margin-left: 20px;
|
||||
} */
|
||||
TD.indexkey {
|
||||
background-color: #e8eef2;
|
||||
font-weight: bold;
|
||||
padding-right : 10px;
|
||||
padding-top : 2px;
|
||||
padding-left : 10px;
|
||||
padding-bottom : 2px;
|
||||
margin-left : 0px;
|
||||
margin-right : 0px;
|
||||
margin-top : 2px;
|
||||
margin-bottom : 2px;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
TD.indexvalue {
|
||||
background-color: #e8eef2;
|
||||
font-style: italic;
|
||||
padding-right : 10px;
|
||||
padding-top : 2px;
|
||||
padding-left : 10px;
|
||||
padding-bottom : 2px;
|
||||
margin-left : 0px;
|
||||
margin-right : 0px;
|
||||
margin-top : 2px;
|
||||
margin-bottom : 2px;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
TR.memlist {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
P.formulaDsp { text-align: center; }
|
||||
IMG.formulaDsp { }
|
||||
IMG.formulaInl { vertical-align: middle; }
|
||||
SPAN.keyword { color: #008000 }
|
||||
SPAN.keywordtype { color: #604020 }
|
||||
SPAN.keywordflow { color: #e08000 }
|
||||
SPAN.comment { color: #800000 }
|
||||
SPAN.preprocessor { color: #806020 }
|
||||
SPAN.stringliteral { color: #002080 }
|
||||
SPAN.charliteral { color: #008080 }
|
||||
.mdescLeft {
|
||||
padding: 0px 8px 4px 8px;
|
||||
font-size: 80%;
|
||||
font-style: italic;
|
||||
background-color: #FAFAFA;
|
||||
border-top: 1px none #E0E0E0;
|
||||
border-right: 1px none #E0E0E0;
|
||||
border-bottom: 1px none #E0E0E0;
|
||||
border-left: 1px none #E0E0E0;
|
||||
margin: 0px;
|
||||
}
|
||||
.mdescRight {
|
||||
padding: 0px 8px 4px 8px;
|
||||
font-size: 80%;
|
||||
font-style: italic;
|
||||
background-color: #FAFAFA;
|
||||
border-top: 1px none #E0E0E0;
|
||||
border-right: 1px none #E0E0E0;
|
||||
border-bottom: 1px none #E0E0E0;
|
||||
border-left: 1px none #E0E0E0;
|
||||
margin: 0px;
|
||||
}
|
||||
.memItemLeft {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memItemRight {
|
||||
padding: 1px 8px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplItemLeft {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: none;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplItemRight {
|
||||
padding: 1px 8px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: none;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplParams {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
color: #606060;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.search { color: #003399;
|
||||
font-weight: bold;
|
||||
}
|
||||
FORM.search {
|
||||
margin-bottom: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
INPUT.search { font-size: 75%;
|
||||
color: #000080;
|
||||
font-weight: normal;
|
||||
background-color: #e8eef2;
|
||||
}
|
||||
TD.tiny { font-size: 75%;
|
||||
}
|
||||
a {
|
||||
color: #1A41A8;
|
||||
}
|
||||
a:visited {
|
||||
color: #2A3798;
|
||||
}
|
||||
.dirtab { padding: 4px;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #84b0c7;
|
||||
}
|
||||
TH.dirtab { background: #e8eef2;
|
||||
font-weight: bold;
|
||||
}
|
||||
HR { height: 1px;
|
||||
border: none;
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
|
||||
/* Style for detailed member documentation */
|
||||
.memtemplate {
|
||||
font-size: 80%;
|
||||
color: #606060;
|
||||
font-weight: normal;
|
||||
margin-left: 3px;
|
||||
}
|
||||
.memnav {
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
margin-right: 15px;
|
||||
padding: 2px;
|
||||
}
|
||||
.memitem {
|
||||
padding: 4px;
|
||||
background-color: #eef3f5;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #dedeee;
|
||||
-moz-border-radius: 8px 8px 8px 8px;
|
||||
}
|
||||
.memname {
|
||||
white-space: nowrap;
|
||||
font-weight: bold;
|
||||
}
|
||||
.memdoc{
|
||||
padding-left: 10px;
|
||||
}
|
||||
.memproto {
|
||||
background-color: #d5e1e8;
|
||||
width: 100%;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #84b0c7;
|
||||
font-weight: bold;
|
||||
-moz-border-radius: 8px 8px 8px 8px;
|
||||
}
|
||||
.paramkey {
|
||||
text-align: right;
|
||||
}
|
||||
.paramtype {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.paramname {
|
||||
color: #602020;
|
||||
font-style: italic;
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* End Styling for detailed member documentation */
|
||||
|
||||
/* for the tree view */
|
||||
.ftvtree {
|
||||
font-family: sans-serif;
|
||||
margin:0.5em;
|
||||
}
|
||||
.directory { font-size: 9pt; font-weight: bold; }
|
||||
.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; }
|
||||
.directory > h3 { margin-top: 0; }
|
||||
.directory p { margin: 0px; white-space: nowrap; }
|
||||
.directory div { display: none; margin: 0px; }
|
||||
.directory img { vertical-align: -30%; }
|
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 27 KiB |
|
@ -1,128 +0,0 @@
|
|||
This is a derivative work of the MP3 library from the mpg123 player,
|
||||
specifically the 0.59r version. The home page for the player is
|
||||
http://mpg123.org/ This software is under the GPL license. The GPL.TXT
|
||||
file included with this software explains the license. Michael Hipp the
|
||||
author of the mpg123 player may still be doing licenses other than GPL.
|
||||
|
||||
|
||||
|
||||
SRC\MAUI\DEMOS\MPGMP3\LIB\ <= contains mpglib sources
|
||||
SRC\MAUI\DEMOS\MPGMP3\DEFS\ <= contains mpglib defs <used with player applications as well >
|
||||
SRC\MAUI\DEMOS\MPGMP3\PLAYER\ <= contains sample MP3 player for use with MAUI
|
||||
OS9000\<CPU>\CMDS\MAUIDEMO\mpgplay <= OS9 MP3 player
|
||||
OS9000\<CPU>\LIB\mpglib.l <= O-CODE library for MPGMP3
|
||||
OS9000\<CPU>\LIB\HOST3\mpglib.il <= I-CODE library for MPGMP3
|
||||
|
||||
|
||||
struct mpstr mp;
|
||||
/* Initialize the MP3 decoder */
|
||||
InitMP3(&mp);
|
||||
|
||||
/* Initialize buffer */
|
||||
status = decodeMP3(&mp,bufin,inlen,bufout,OUT_BUF_SIZE,&outlen);
|
||||
|
||||
/* Decode buffer */
|
||||
status = decodeMP3(&mp,NULL,0,bufout,OUT_BUF_SIZE,&outlen);
|
||||
|
||||
/* Exit the MP3 decoder */
|
||||
ExitMP3(&mp);
|
||||
|
||||
|
||||
|
||||
Function information:
|
||||
|
||||
BOOL InitMP3(struct mpstr *mp);
|
||||
|
||||
int decodeMP3(struct mpstr *mp,char *inmemory,int inmemsize,
|
||||
char *outmemory,int outmemsize,int *done);
|
||||
|
||||
|
||||
void ExitMP3(struct mpstr *mp);
|
||||
|
||||
|
||||
|
||||
Status return information:
|
||||
'decodeMP3' will return the following status information.
|
||||
|
||||
#define MP3_ERR -1
|
||||
#define MP3_OK 0
|
||||
#define MP3_NEED_MORE 1
|
||||
|
||||
|
||||
|
||||
|
||||
The "mpstr" structure contains the following.
|
||||
|
||||
struct mpstr {
|
||||
struct buf *head,*tail;
|
||||
int bsize;
|
||||
int framesize;
|
||||
int fsizeold;
|
||||
struct frame fr;
|
||||
unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */
|
||||
real hybrid_block[2][2][SBLIMIT*SSLIMIT];
|
||||
int hybrid_blc[2];
|
||||
unsigned long header;
|
||||
int bsnum;
|
||||
real synth_buffs[2][2][0x110];
|
||||
int synth_bo;
|
||||
};
|
||||
|
||||
|
||||
Once the MP3 header is read you may use this structure to find out details as desired.
|
||||
|
||||
#if defined(SHOW_FRAME)
|
||||
printf("FRAME: stereo %d jsbound %d single %d lsf %d\n",
|
||||
mp.fr.stereo,
|
||||
mp.fr.jsbound,
|
||||
mp.fr.single,
|
||||
mp.fr.lsf);
|
||||
printf("mpeg25 %d header_change %d lay %d error_protection %d\n",
|
||||
mp.fr.mpeg25,
|
||||
mp.fr.header_change,
|
||||
mp.fr.lay,
|
||||
mp.fr.error_protection);
|
||||
printf("bitrate_index %d sampling_frequency %d padding %d extension %d\n",
|
||||
mp.fr.bitrate_index,
|
||||
mp.fr.sampling_frequency,
|
||||
mp.fr.padding,
|
||||
mp.fr.extension);
|
||||
printf("mode %d mode_ext %d copyright %d original %d\n",
|
||||
mp.fr.mode,
|
||||
mp.fr.mode_ext,
|
||||
mp.fr.copyright,
|
||||
mp.fr.original);
|
||||
printf("emphasis %d framesize %d\n",
|
||||
mp.fr.emphasis,
|
||||
mp.fr.framesize);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
For more information refer to the mpglib.h, mpg123.h and mpgplay.c sources.
|
||||
|
||||
MPGPLAY
|
||||
This program is not designed to be a full featured MP3 player
|
||||
rather this program is designed to show how to use the MPGMP3
|
||||
library sources as well sound map managment to the MAUI sound
|
||||
system.
|
||||
|
||||
MPGPLAY uses the "mpglib.il" MPG library based on MPG123 sources.
|
||||
Three functions are all that is required to decompress MP3
|
||||
information either from a file or a stream.
|
||||
|
||||
InitMP3(&mp);
|
||||
decodeMP3(&mp,bufin,inlen,bufout,OUT_BUF_SIZE,&outlen);
|
||||
ExitMP3(&mp);
|
||||
|
||||
When decompressing MP3 images we create as many SMAP slots as
|
||||
required. We will start the sound maps playing and continue
|
||||
decompressing the next block while the current blocks are
|
||||
played. This method provides very clean playback even on
|
||||
slower machines (133Mhz or greater should be fine).
|
||||
|
||||
On X86 and ARM we will run with INTEGER based code by default.
|
||||
This will allow playing of MP3's even on 486SX based processors.
|
||||
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
<script>window.googleJavaScriptRedirect=1</script><script>var f={};f.navigateTo=function(b,a,g){if(b!=a&&b.google){if(b.google.r){b.google.r=0;b.location.href=g;a.location.replace("about:blank");}}else{a.location.replace(g);}};f.navigateTo(window.parent,window,"http://impala.utopia.free.fr/pd/patchs/externals_libs/d_mp3/d_mp3.c");
|
||||
</script><noscript><META http-equiv="refresh" content="0;URL='http://impala.utopia.free.fr/pd/patchs/externals_libs/d_mp3/d_mp3.c'"></noscript>
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
g++ -c ../../src/common.c -o temp/common.o
|
||||
g++ -c ../../src/dct64_i386.c -o temp/dct64_i386.o
|
||||
g++ -c ../../src/decode_i386.c -o temp/decode_i386.o
|
||||
g++ -c ../../src/interface.c -o temp/interface.o
|
||||
g++ -c ../../src/layer2.c -o temp/layer2.o
|
||||
g++ -c ../../src/layer3.c -o temp/layer3.o
|
||||
g++ -c ../../src/tabinit.c -o temp/tabinit.o
|
||||
ar rcs src.a temp/common.o temp/dct64_i386.o temp/decode_i386.o temp/interface.o temp/layer2.o temp/layer3.o temp/tabinit.o
|
||||
echo "Press any key to continue..."
|
||||
Pause()
|
||||
{
|
||||
OLDCONFIG=`stty -g`
|
||||
stty -icanon -echo min 1 time 0
|
||||
dd count=1 2>/dev/null
|
||||
stty $OLDCONFIG
|
||||
}
|
||||
Pause
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
cd "$(dirname "$0")"
|
||||
g++ -c ../../src/common.c -o temp/common.o
|
||||
g++ -c ../../src/dct64_i386.c -o temp/dct64_i386.o
|
||||
g++ -c ../../src/decode_i386.c -o temp/decode_i386.o
|
||||
g++ -c ../../src/interface.c -o temp/interface.o
|
||||
g++ -c ../../src/layer2.c -o temp/layer2.o
|
||||
g++ -c ../../src/layer3.c -o temp/layer3.o
|
||||
g++ -c ../../src/tabinit.c -o temp/tabinit.o
|
||||
ar rcs src.a temp/common.o temp/dct64_i386.o temp/decode_i386.o temp/interface.o temp/layer2.o temp/layer3.o temp/tabinit.o
|
||||
echo "Press any key to continue..."
|
||||
Pause()
|
||||
{
|
||||
OLDCONFIG=`stty -g`
|
||||
stty -icanon -echo min 1 time 0
|
||||
dd count=1 2>/dev/null
|
||||
stty $OLDCONFIG
|
||||
}
|
||||
Pause
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
..\..\..\..\..\..\c_compiler\bin\g++ -c ..\..\src\common.c -o temp\common.o
|
||||
..\..\..\..\..\..\c_compiler\bin\g++ -c ..\..\src\dct64_i386.c -o temp\dct64_i386.o
|
||||
..\..\..\..\..\..\c_compiler\bin\g++ -c ..\..\src\decode_i386.c -o temp\decode_i386.o
|
||||
..\..\..\..\..\..\c_compiler\bin\g++ -c ..\..\src\interface.c -o temp\interface.o
|
||||
..\..\..\..\..\..\c_compiler\bin\g++ -c ..\..\src\layer2.c -o temp\layer2.o
|
||||
..\..\..\..\..\..\c_compiler\bin\g++ -c ..\..\src\layer3.c -o temp\layer3.o
|
||||
..\..\..\..\..\..\c_compiler\bin\g++ -c ..\..\src\tabinit.c -o temp\tabinit.o
|
||||
..\..\..\..\..\..\c_compiler\bin\ar rcs src.a temp\common.o temp\dct64_i386.o temp\decode_i386.o temp\interface.o temp\layer2.o temp\layer3.o temp\tabinit.o
|
||||
pause
|
|
@ -1,85 +0,0 @@
|
|||
#ifndef DEPENDENCY_AUDIO_DECODE_MP3
|
||||
//Stubs:
|
||||
//(none required)
|
||||
#else
|
||||
|
||||
#ifdef QB64_BACKSLASH_FILESYSTEM
|
||||
#include "src\\mpg123.h"
|
||||
#include "src\\mpglib.h"
|
||||
#else
|
||||
#include "src/mpg123.h"
|
||||
#include "src/mpglib.h"
|
||||
#endif
|
||||
|
||||
//mpg123 decoding 'stuff'
|
||||
int frequencies[9] = { 44100, 48000, 32000, 22050, 24000, 16000 , 11025 , 12000 , 8000 };
|
||||
int bitrates[15] = { 0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320 };
|
||||
#define MP3_ERR -1
|
||||
#define MP3_OK 0
|
||||
#define MP3_NEED_MORE 1
|
||||
|
||||
snd_sequence_struct *snd_decode_mp3(uint8 *buffer,int32 bytes){
|
||||
|
||||
static int status;
|
||||
static struct mpstr mp;
|
||||
InitMP3(&mp);
|
||||
static int inlen;
|
||||
static int outlen;
|
||||
outlen=0;
|
||||
static int OUT_BUF_SIZE;
|
||||
OUT_BUF_SIZE=8192;
|
||||
static char *bufin,*bufin_backup;
|
||||
static char *bufout,*bufout_backup;
|
||||
static int32 bufout_size;
|
||||
static int32 out_bytes;
|
||||
|
||||
inlen=bytes;
|
||||
bufin=(char*)buffer; bufin_backup=bufin;
|
||||
|
||||
bufout_size=1000000;
|
||||
bufout=(char*)malloc(bufout_size); bufout_backup=bufout;
|
||||
|
||||
out_bytes=0;
|
||||
|
||||
status = decodeMP3(&mp,bufin,inlen,bufout,OUT_BUF_SIZE,&outlen);
|
||||
bufout+=outlen;
|
||||
out_bytes+=outlen;
|
||||
ddd:
|
||||
status = decodeMP3(&mp,NULL,NULL,bufout,OUT_BUF_SIZE,&outlen);
|
||||
bufout+=outlen;
|
||||
out_bytes+=outlen;
|
||||
|
||||
if (out_bytes>((bufout_size*3)/4)){//if buffer 75%+ full double its size
|
||||
bufout_size*=2;
|
||||
bufout_backup=(char*)realloc(bufout_backup,bufout_size);
|
||||
bufout=bufout_backup+out_bytes;
|
||||
}
|
||||
|
||||
|
||||
if (status==0) goto ddd;
|
||||
|
||||
//trim bufout
|
||||
bufout=bufout_backup;
|
||||
bufout=(char*)realloc(bufout,out_bytes);
|
||||
|
||||
//attach bufout to new sequence
|
||||
static int32 seq_handle; seq_handle=list_add(snd_sequences);
|
||||
static snd_sequence_struct *seq; seq=(snd_sequence_struct*)list_get(snd_sequences,seq_handle);
|
||||
|
||||
memset(seq,0,sizeof(snd_sequence_struct));
|
||||
seq->references=1;
|
||||
seq->data=(uint8*)bufout;
|
||||
seq->data_size=out_bytes;
|
||||
seq->channels=mp.fr.stereo;
|
||||
seq->endian=0;//native
|
||||
//***signed 16-bit 44100***
|
||||
seq->is_unsigned=0;
|
||||
seq->sample_rate=44100;
|
||||
seq->bits_per_sample=16;
|
||||
|
||||
return seq;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,364 +0,0 @@
|
|||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "mpg123.h"
|
||||
|
||||
|
||||
const int tabsel_123[2][3][16] = {
|
||||
{ {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,},
|
||||
{0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,},
|
||||
{0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} },
|
||||
|
||||
{ {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,},
|
||||
{0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,},
|
||||
{0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} }
|
||||
};
|
||||
|
||||
const long freqs[9] = { 44100, 48000, 32000,
|
||||
22050, 24000, 16000 ,
|
||||
11025 , 12000 , 8000 };
|
||||
|
||||
|
||||
#define HDRCMPMASK 0xfffffd00
|
||||
|
||||
int head_check(unsigned long head)
|
||||
{
|
||||
if( (head & 0xffe00000) != 0xffe00000)
|
||||
return FALSE;
|
||||
if(!((head>>17)&3))
|
||||
return FALSE;
|
||||
if( ((head>>12)&0xf) == 0xf)
|
||||
return FALSE;
|
||||
if( ((head>>10)&0x3) == 0x3 )
|
||||
return FALSE;
|
||||
if ((head & 0xffff0000) == 0xfffe0000)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* the code a header and write the information
|
||||
* into the frame structure
|
||||
*/
|
||||
int decode_header(struct mpstr *mp, struct frame *fr,unsigned long newhead)
|
||||
{
|
||||
long ltmp;
|
||||
|
||||
if( newhead & (1<<20) ) {
|
||||
fr->lsf = (newhead & (1<<19)) ? 0x0 : 0x1;
|
||||
fr->mpeg25 = 0;
|
||||
}
|
||||
else {
|
||||
fr->lsf = 1;
|
||||
fr->mpeg25 = 1;
|
||||
}
|
||||
|
||||
|
||||
fr->lay = 4-((newhead>>17)&3);
|
||||
if( ((newhead>>10)&0x3) == 0x3) {
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Stream error\n");
|
||||
exit(1);
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
}
|
||||
if(fr->mpeg25) {
|
||||
fr->sampling_frequency = 6 + ((newhead>>10)&0x3);
|
||||
}
|
||||
else
|
||||
fr->sampling_frequency = ((newhead>>10)&0x3) + (fr->lsf*3);
|
||||
fr->error_protection = ((newhead>>16)&0x1)^0x1;
|
||||
|
||||
if(fr->mpeg25) /* allow Bitrate change for 2.5 ... */
|
||||
fr->bitrate_index = ((newhead>>12)&0xf);
|
||||
|
||||
fr->bitrate_index = ((newhead>>12)&0xf);
|
||||
fr->padding = ((newhead>>9)&0x1);
|
||||
fr->extension = ((newhead>>8)&0x1);
|
||||
fr->mode = ((newhead>>6)&0x3);
|
||||
fr->mode_ext = ((newhead>>4)&0x3);
|
||||
fr->copyright = ((newhead>>3)&0x1);
|
||||
fr->original = ((newhead>>2)&0x1);
|
||||
fr->emphasis = newhead & 0x3;
|
||||
|
||||
fr->stereo = (fr->mode == MPG_MD_MONO) ? 1 : 2;
|
||||
|
||||
if(!fr->bitrate_index)
|
||||
{
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Free format not supported.\n");
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
switch(fr->lay)
|
||||
{
|
||||
case 1:
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
|
||||
fr->do_layer = do_layer1;
|
||||
fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
|
||||
(fr->mode_ext<<2)+4 : 32;
|
||||
fr->framesize = (long) tabsel_123[fr->lsf][0][fr->bitrate_index] * 12000;
|
||||
fr->framesize /= freqs[fr->sampling_frequency];
|
||||
fr->framesize = ((fr->framesize+fr->padding)<<2)-4;
|
||||
#else
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"layer=1 Not supported!\n");
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
#if 1
|
||||
fr->do_layer = do_layer2;
|
||||
|
||||
// in layer2.c
|
||||
// II_select_table(fr);
|
||||
// fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
|
||||
// (fr->mode_ext<<2)+4 : fr->II_sblimit;
|
||||
fr->framesize = (long) tabsel_123[fr->lsf][1][fr->bitrate_index] * 144000;
|
||||
fr->framesize /= freqs[fr->sampling_frequency];
|
||||
fr->framesize += fr->padding - 4;
|
||||
#endif
|
||||
break;
|
||||
case 3:
|
||||
fr->do_layer = do_layer3;
|
||||
#if 0
|
||||
if(fr->lsf)
|
||||
ssize = (fr->stereo == 1) ? 9 : 17;
|
||||
else
|
||||
ssize = (fr->stereo == 1) ? 17 : 32;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if(fr->error_protection)
|
||||
ssize += 2;
|
||||
#endif
|
||||
|
||||
/* ------- BEGIN OF MODIFICATIONS FOR mpglib.dll
|
||||
Because LCC-Win32 made the Program crash at this
|
||||
point, the following modification was necessary.
|
||||
fr->framesize = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000;
|
||||
fr->framesize /= freqs[fr->sampling_frequency]<<(fr->lsf);
|
||||
fr->framesize = fr->framesize + fr->padding - 4;
|
||||
*/
|
||||
ltmp = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000;
|
||||
ltmp /= freqs[fr->sampling_frequency]<<(fr->lsf);
|
||||
ltmp = ltmp + fr->padding - 4;
|
||||
fr->framesize=ltmp;
|
||||
/* ------- END OF MODIFICATIONS FOR mpglib.dll
|
||||
*/
|
||||
|
||||
break;
|
||||
default:
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Sorry, unknown layer type.\n");
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* print_header(fr); */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
unsigned int getbits(struct StaticData * psd, int number_of_bits)
|
||||
{
|
||||
unsigned long rval;
|
||||
|
||||
if(!number_of_bits)
|
||||
return 0;
|
||||
|
||||
{
|
||||
rval = psd->wordpointer[0];
|
||||
rval <<= 8;
|
||||
rval |= psd->wordpointer[1];
|
||||
rval <<= 8;
|
||||
rval |= psd->wordpointer[2];
|
||||
rval <<= psd->bitindex;
|
||||
rval &= 0xffffff;
|
||||
|
||||
psd->bitindex += number_of_bits;
|
||||
|
||||
rval >>= (24-number_of_bits);
|
||||
|
||||
psd->wordpointer += (psd->bitindex>>3);
|
||||
psd->bitindex &= 7;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
unsigned int getbits_fast(struct StaticData * psd, int number_of_bits)
|
||||
{
|
||||
unsigned long rval;
|
||||
|
||||
{
|
||||
rval = psd->wordpointer[0];
|
||||
rval <<= 8;
|
||||
rval |= psd->wordpointer[1];
|
||||
rval <<= psd->bitindex;
|
||||
rval &= 0xffff;
|
||||
psd->bitindex += number_of_bits;
|
||||
|
||||
rval >>= (16-number_of_bits);
|
||||
|
||||
psd->wordpointer += (psd->bitindex>>3);
|
||||
psd->bitindex &= 7;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
/********************************/
|
||||
|
||||
double compute_bpf(struct frame *fr)
|
||||
{
|
||||
double bpf;
|
||||
|
||||
switch(fr->lay) {
|
||||
case 1:
|
||||
bpf = tabsel_123[fr->lsf][0][fr->bitrate_index];
|
||||
bpf *= 12000.0 * 4.0;
|
||||
bpf /= freqs[fr->sampling_frequency] <<(fr->lsf);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
bpf = tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index]; bpf *= 144000;
|
||||
bpf /= freqs[fr->sampling_frequency] << (fr->lsf);
|
||||
break;
|
||||
default:
|
||||
bpf = 1.0;
|
||||
}
|
||||
|
||||
return bpf;
|
||||
}
|
||||
|
||||
double compute_tpf(struct frame *fr)
|
||||
{
|
||||
static int bs[4] = { 0,384,1152,1152 };
|
||||
double tpf;
|
||||
|
||||
tpf = (double) bs[fr->lay];
|
||||
tpf /= freqs[fr->sampling_frequency] << (fr->lsf);
|
||||
return tpf;
|
||||
}
|
||||
|
||||
int ExtractI4(unsigned char *buf)
|
||||
{
|
||||
int x;
|
||||
x = buf[0];
|
||||
x <<= 8;
|
||||
x |= buf[1];
|
||||
x <<= 8;
|
||||
x |= buf[2];
|
||||
x <<= 8;
|
||||
x |= buf[3];
|
||||
return x;
|
||||
}
|
||||
|
||||
int GetVbrTag(VBRTAGDATA *pTagData, unsigned char *buf)
|
||||
{
|
||||
int i, head_flags;
|
||||
int h_id, h_mode, h_sr_index;
|
||||
static int sr_table[4] = { 44100, 48000, 32000, 99999 };
|
||||
|
||||
pTagData->flags = 0;
|
||||
|
||||
h_id = (buf[1] >> 3) & 1;
|
||||
h_sr_index = (buf[2] >> 2) & 3;
|
||||
h_mode = (buf[3] >> 6) & 3;
|
||||
|
||||
if( h_id )
|
||||
{
|
||||
if( h_mode != 3 ) buf+=(32+4);
|
||||
else buf+=(17+4);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( h_mode != 3 ) buf+=(17+4);
|
||||
else buf+=(9+4);
|
||||
}
|
||||
|
||||
if( buf[0] != VBRTag[0] ) return 0;
|
||||
if( buf[1] != VBRTag[1] ) return 0;
|
||||
if( buf[2] != VBRTag[2] ) return 0;
|
||||
if( buf[3] != VBRTag[3] ) return 0;
|
||||
|
||||
buf+=4;
|
||||
|
||||
pTagData->h_id = h_id;
|
||||
|
||||
pTagData->samprate = sr_table[h_sr_index];
|
||||
|
||||
if( h_id == 0 )
|
||||
pTagData->samprate >>= 1;
|
||||
|
||||
head_flags = pTagData->flags = ExtractI4(buf); buf+=4;
|
||||
|
||||
if( head_flags & FRAMES_FLAG )
|
||||
{
|
||||
pTagData->frames = ExtractI4(buf); buf+=4;
|
||||
}
|
||||
|
||||
if( head_flags & BYTES_FLAG )
|
||||
{
|
||||
pTagData->bytes = ExtractI4(buf); buf+=4;
|
||||
}
|
||||
|
||||
if( head_flags & TOC_FLAG )
|
||||
{
|
||||
if( pTagData->toc != NULL )
|
||||
{
|
||||
for(i=0;i<NUMTOCENTRIES;i++)
|
||||
pTagData->toc[i] = buf[i];
|
||||
}
|
||||
buf+=NUMTOCENTRIES;
|
||||
}
|
||||
|
||||
pTagData->vbr_scale = -1;
|
||||
|
||||
if( head_flags & VBR_SCALE_FLAG )
|
||||
{
|
||||
pTagData->vbr_scale = ExtractI4(buf); buf+=4;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int SeekPoint(unsigned char TOC[NUMTOCENTRIES], int file_bytes, double percent)
|
||||
{
|
||||
/* interpolate in TOC to get file seek point in bytes */
|
||||
int a, seekpoint;
|
||||
double fa, fb, fx;
|
||||
|
||||
if( percent < (double)0.0 ) percent = (double)0.0;
|
||||
if( percent > (double)100.0 ) percent = (double)100.0;
|
||||
|
||||
a = (int)percent;
|
||||
if( a > 99 ) a = 99;
|
||||
fa = TOC[a];
|
||||
if( a < 99 ) {
|
||||
fb = TOC[a+1];
|
||||
} else {
|
||||
fb = (double)256.0;
|
||||
}
|
||||
|
||||
fx = fa + (fb-fa)*(percent-a);
|
||||
|
||||
seekpoint = (int)(((double)(1.0/256.0))*fx*file_bytes);
|
||||
|
||||
return seekpoint;
|
||||
}
|
||||
|
|
@ -1,314 +0,0 @@
|
|||
/*
|
||||
* Discrete Cosine Tansform (DCT) for subband synthesis
|
||||
* optimized for machines with no auto-increment.
|
||||
* The performance is highly compiler dependend. Maybe
|
||||
* the dct64.c version for 'normal' processor may be faster
|
||||
* even for Intel processors.
|
||||
*/
|
||||
|
||||
#include "mpg123.h"
|
||||
|
||||
static void dct64_1(struct StaticData * psd, real *out0,real *out1,real *b1,real *b2,real *samples)
|
||||
{
|
||||
|
||||
{
|
||||
register real *costab = psd->pnts[0];
|
||||
|
||||
b1[0x00] = samples[0x00] + samples[0x1F];
|
||||
b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0];
|
||||
|
||||
b1[0x01] = samples[0x01] + samples[0x1E];
|
||||
b1[0x1E] = (samples[0x01] - samples[0x1E]) * costab[0x1];
|
||||
|
||||
b1[0x02] = samples[0x02] + samples[0x1D];
|
||||
b1[0x1D] = (samples[0x02] - samples[0x1D]) * costab[0x2];
|
||||
|
||||
b1[0x03] = samples[0x03] + samples[0x1C];
|
||||
b1[0x1C] = (samples[0x03] - samples[0x1C]) * costab[0x3];
|
||||
|
||||
b1[0x04] = samples[0x04] + samples[0x1B];
|
||||
b1[0x1B] = (samples[0x04] - samples[0x1B]) * costab[0x4];
|
||||
|
||||
b1[0x05] = samples[0x05] + samples[0x1A];
|
||||
b1[0x1A] = (samples[0x05] - samples[0x1A]) * costab[0x5];
|
||||
|
||||
b1[0x06] = samples[0x06] + samples[0x19];
|
||||
b1[0x19] = (samples[0x06] - samples[0x19]) * costab[0x6];
|
||||
|
||||
b1[0x07] = samples[0x07] + samples[0x18];
|
||||
b1[0x18] = (samples[0x07] - samples[0x18]) * costab[0x7];
|
||||
|
||||
b1[0x08] = samples[0x08] + samples[0x17];
|
||||
b1[0x17] = (samples[0x08] - samples[0x17]) * costab[0x8];
|
||||
|
||||
b1[0x09] = samples[0x09] + samples[0x16];
|
||||
b1[0x16] = (samples[0x09] - samples[0x16]) * costab[0x9];
|
||||
|
||||
b1[0x0A] = samples[0x0A] + samples[0x15];
|
||||
b1[0x15] = (samples[0x0A] - samples[0x15]) * costab[0xA];
|
||||
|
||||
b1[0x0B] = samples[0x0B] + samples[0x14];
|
||||
b1[0x14] = (samples[0x0B] - samples[0x14]) * costab[0xB];
|
||||
|
||||
b1[0x0C] = samples[0x0C] + samples[0x13];
|
||||
b1[0x13] = (samples[0x0C] - samples[0x13]) * costab[0xC];
|
||||
|
||||
b1[0x0D] = samples[0x0D] + samples[0x12];
|
||||
b1[0x12] = (samples[0x0D] - samples[0x12]) * costab[0xD];
|
||||
|
||||
b1[0x0E] = samples[0x0E] + samples[0x11];
|
||||
b1[0x11] = (samples[0x0E] - samples[0x11]) * costab[0xE];
|
||||
|
||||
b1[0x0F] = samples[0x0F] + samples[0x10];
|
||||
b1[0x10] = (samples[0x0F] - samples[0x10]) * costab[0xF];
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
register real *costab = psd->pnts[1];
|
||||
|
||||
b2[0x00] = b1[0x00] + b1[0x0F];
|
||||
b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0];
|
||||
b2[0x01] = b1[0x01] + b1[0x0E];
|
||||
b2[0x0E] = (b1[0x01] - b1[0x0E]) * costab[1];
|
||||
b2[0x02] = b1[0x02] + b1[0x0D];
|
||||
b2[0x0D] = (b1[0x02] - b1[0x0D]) * costab[2];
|
||||
b2[0x03] = b1[0x03] + b1[0x0C];
|
||||
b2[0x0C] = (b1[0x03] - b1[0x0C]) * costab[3];
|
||||
b2[0x04] = b1[0x04] + b1[0x0B];
|
||||
b2[0x0B] = (b1[0x04] - b1[0x0B]) * costab[4];
|
||||
b2[0x05] = b1[0x05] + b1[0x0A];
|
||||
b2[0x0A] = (b1[0x05] - b1[0x0A]) * costab[5];
|
||||
b2[0x06] = b1[0x06] + b1[0x09];
|
||||
b2[0x09] = (b1[0x06] - b1[0x09]) * costab[6];
|
||||
b2[0x07] = b1[0x07] + b1[0x08];
|
||||
b2[0x08] = (b1[0x07] - b1[0x08]) * costab[7];
|
||||
|
||||
b2[0x10] = b1[0x10] + b1[0x1F];
|
||||
b2[0x1F] = (b1[0x1F] - b1[0x10]) * costab[0];
|
||||
b2[0x11] = b1[0x11] + b1[0x1E];
|
||||
b2[0x1E] = (b1[0x1E] - b1[0x11]) * costab[1];
|
||||
b2[0x12] = b1[0x12] + b1[0x1D];
|
||||
b2[0x1D] = (b1[0x1D] - b1[0x12]) * costab[2];
|
||||
b2[0x13] = b1[0x13] + b1[0x1C];
|
||||
b2[0x1C] = (b1[0x1C] - b1[0x13]) * costab[3];
|
||||
b2[0x14] = b1[0x14] + b1[0x1B];
|
||||
b2[0x1B] = (b1[0x1B] - b1[0x14]) * costab[4];
|
||||
b2[0x15] = b1[0x15] + b1[0x1A];
|
||||
b2[0x1A] = (b1[0x1A] - b1[0x15]) * costab[5];
|
||||
b2[0x16] = b1[0x16] + b1[0x19];
|
||||
b2[0x19] = (b1[0x19] - b1[0x16]) * costab[6];
|
||||
b2[0x17] = b1[0x17] + b1[0x18];
|
||||
b2[0x18] = (b1[0x18] - b1[0x17]) * costab[7];
|
||||
}
|
||||
|
||||
{
|
||||
register real *costab = psd->pnts[2];
|
||||
|
||||
b1[0x00] = b2[0x00] + b2[0x07];
|
||||
b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0];
|
||||
b1[0x01] = b2[0x01] + b2[0x06];
|
||||
b1[0x06] = (b2[0x01] - b2[0x06]) * costab[1];
|
||||
b1[0x02] = b2[0x02] + b2[0x05];
|
||||
b1[0x05] = (b2[0x02] - b2[0x05]) * costab[2];
|
||||
b1[0x03] = b2[0x03] + b2[0x04];
|
||||
b1[0x04] = (b2[0x03] - b2[0x04]) * costab[3];
|
||||
|
||||
b1[0x08] = b2[0x08] + b2[0x0F];
|
||||
b1[0x0F] = (b2[0x0F] - b2[0x08]) * costab[0];
|
||||
b1[0x09] = b2[0x09] + b2[0x0E];
|
||||
b1[0x0E] = (b2[0x0E] - b2[0x09]) * costab[1];
|
||||
b1[0x0A] = b2[0x0A] + b2[0x0D];
|
||||
b1[0x0D] = (b2[0x0D] - b2[0x0A]) * costab[2];
|
||||
b1[0x0B] = b2[0x0B] + b2[0x0C];
|
||||
b1[0x0C] = (b2[0x0C] - b2[0x0B]) * costab[3];
|
||||
|
||||
b1[0x10] = b2[0x10] + b2[0x17];
|
||||
b1[0x17] = (b2[0x10] - b2[0x17]) * costab[0];
|
||||
b1[0x11] = b2[0x11] + b2[0x16];
|
||||
b1[0x16] = (b2[0x11] - b2[0x16]) * costab[1];
|
||||
b1[0x12] = b2[0x12] + b2[0x15];
|
||||
b1[0x15] = (b2[0x12] - b2[0x15]) * costab[2];
|
||||
b1[0x13] = b2[0x13] + b2[0x14];
|
||||
b1[0x14] = (b2[0x13] - b2[0x14]) * costab[3];
|
||||
|
||||
b1[0x18] = b2[0x18] + b2[0x1F];
|
||||
b1[0x1F] = (b2[0x1F] - b2[0x18]) * costab[0];
|
||||
b1[0x19] = b2[0x19] + b2[0x1E];
|
||||
b1[0x1E] = (b2[0x1E] - b2[0x19]) * costab[1];
|
||||
b1[0x1A] = b2[0x1A] + b2[0x1D];
|
||||
b1[0x1D] = (b2[0x1D] - b2[0x1A]) * costab[2];
|
||||
b1[0x1B] = b2[0x1B] + b2[0x1C];
|
||||
b1[0x1C] = (b2[0x1C] - b2[0x1B]) * costab[3];
|
||||
}
|
||||
|
||||
{
|
||||
register real const cos0 = psd->pnts[3][0];
|
||||
register real const cos1 = psd->pnts[3][1];
|
||||
|
||||
b2[0x00] = b1[0x00] + b1[0x03];
|
||||
b2[0x03] = (b1[0x00] - b1[0x03]) * cos0;
|
||||
b2[0x01] = b1[0x01] + b1[0x02];
|
||||
b2[0x02] = (b1[0x01] - b1[0x02]) * cos1;
|
||||
|
||||
b2[0x04] = b1[0x04] + b1[0x07];
|
||||
b2[0x07] = (b1[0x07] - b1[0x04]) * cos0;
|
||||
b2[0x05] = b1[0x05] + b1[0x06];
|
||||
b2[0x06] = (b1[0x06] - b1[0x05]) * cos1;
|
||||
|
||||
b2[0x08] = b1[0x08] + b1[0x0B];
|
||||
b2[0x0B] = (b1[0x08] - b1[0x0B]) * cos0;
|
||||
b2[0x09] = b1[0x09] + b1[0x0A];
|
||||
b2[0x0A] = (b1[0x09] - b1[0x0A]) * cos1;
|
||||
|
||||
b2[0x0C] = b1[0x0C] + b1[0x0F];
|
||||
b2[0x0F] = (b1[0x0F] - b1[0x0C]) * cos0;
|
||||
b2[0x0D] = b1[0x0D] + b1[0x0E];
|
||||
b2[0x0E] = (b1[0x0E] - b1[0x0D]) * cos1;
|
||||
|
||||
b2[0x10] = b1[0x10] + b1[0x13];
|
||||
b2[0x13] = (b1[0x10] - b1[0x13]) * cos0;
|
||||
b2[0x11] = b1[0x11] + b1[0x12];
|
||||
b2[0x12] = (b1[0x11] - b1[0x12]) * cos1;
|
||||
|
||||
b2[0x14] = b1[0x14] + b1[0x17];
|
||||
b2[0x17] = (b1[0x17] - b1[0x14]) * cos0;
|
||||
b2[0x15] = b1[0x15] + b1[0x16];
|
||||
b2[0x16] = (b1[0x16] - b1[0x15]) * cos1;
|
||||
|
||||
b2[0x18] = b1[0x18] + b1[0x1B];
|
||||
b2[0x1B] = (b1[0x18] - b1[0x1B]) * cos0;
|
||||
b2[0x19] = b1[0x19] + b1[0x1A];
|
||||
b2[0x1A] = (b1[0x19] - b1[0x1A]) * cos1;
|
||||
|
||||
b2[0x1C] = b1[0x1C] + b1[0x1F];
|
||||
b2[0x1F] = (b1[0x1F] - b1[0x1C]) * cos0;
|
||||
b2[0x1D] = b1[0x1D] + b1[0x1E];
|
||||
b2[0x1E] = (b1[0x1E] - b1[0x1D]) * cos1;
|
||||
}
|
||||
|
||||
{
|
||||
register real const cos0 = psd->pnts[4][0];
|
||||
|
||||
b1[0x00] = b2[0x00] + b2[0x01];
|
||||
b1[0x01] = (b2[0x00] - b2[0x01]) * cos0;
|
||||
b1[0x02] = b2[0x02] + b2[0x03];
|
||||
b1[0x03] = (b2[0x03] - b2[0x02]) * cos0;
|
||||
b1[0x02] += b1[0x03];
|
||||
|
||||
b1[0x04] = b2[0x04] + b2[0x05];
|
||||
b1[0x05] = (b2[0x04] - b2[0x05]) * cos0;
|
||||
b1[0x06] = b2[0x06] + b2[0x07];
|
||||
b1[0x07] = (b2[0x07] - b2[0x06]) * cos0;
|
||||
b1[0x06] += b1[0x07];
|
||||
b1[0x04] += b1[0x06];
|
||||
b1[0x06] += b1[0x05];
|
||||
b1[0x05] += b1[0x07];
|
||||
|
||||
b1[0x08] = b2[0x08] + b2[0x09];
|
||||
b1[0x09] = (b2[0x08] - b2[0x09]) * cos0;
|
||||
b1[0x0A] = b2[0x0A] + b2[0x0B];
|
||||
b1[0x0B] = (b2[0x0B] - b2[0x0A]) * cos0;
|
||||
b1[0x0A] += b1[0x0B];
|
||||
|
||||
b1[0x0C] = b2[0x0C] + b2[0x0D];
|
||||
b1[0x0D] = (b2[0x0C] - b2[0x0D]) * cos0;
|
||||
b1[0x0E] = b2[0x0E] + b2[0x0F];
|
||||
b1[0x0F] = (b2[0x0F] - b2[0x0E]) * cos0;
|
||||
b1[0x0E] += b1[0x0F];
|
||||
b1[0x0C] += b1[0x0E];
|
||||
b1[0x0E] += b1[0x0D];
|
||||
b1[0x0D] += b1[0x0F];
|
||||
|
||||
b1[0x10] = b2[0x10] + b2[0x11];
|
||||
b1[0x11] = (b2[0x10] - b2[0x11]) * cos0;
|
||||
b1[0x12] = b2[0x12] + b2[0x13];
|
||||
b1[0x13] = (b2[0x13] - b2[0x12]) * cos0;
|
||||
b1[0x12] += b1[0x13];
|
||||
|
||||
b1[0x14] = b2[0x14] + b2[0x15];
|
||||
b1[0x15] = (b2[0x14] - b2[0x15]) * cos0;
|
||||
b1[0x16] = b2[0x16] + b2[0x17];
|
||||
b1[0x17] = (b2[0x17] - b2[0x16]) * cos0;
|
||||
b1[0x16] += b1[0x17];
|
||||
b1[0x14] += b1[0x16];
|
||||
b1[0x16] += b1[0x15];
|
||||
b1[0x15] += b1[0x17];
|
||||
|
||||
b1[0x18] = b2[0x18] + b2[0x19];
|
||||
b1[0x19] = (b2[0x18] - b2[0x19]) * cos0;
|
||||
b1[0x1A] = b2[0x1A] + b2[0x1B];
|
||||
b1[0x1B] = (b2[0x1B] - b2[0x1A]) * cos0;
|
||||
b1[0x1A] += b1[0x1B];
|
||||
|
||||
b1[0x1C] = b2[0x1C] + b2[0x1D];
|
||||
b1[0x1D] = (b2[0x1C] - b2[0x1D]) * cos0;
|
||||
b1[0x1E] = b2[0x1E] + b2[0x1F];
|
||||
b1[0x1F] = (b2[0x1F] - b2[0x1E]) * cos0;
|
||||
b1[0x1E] += b1[0x1F];
|
||||
b1[0x1C] += b1[0x1E];
|
||||
b1[0x1E] += b1[0x1D];
|
||||
b1[0x1D] += b1[0x1F];
|
||||
}
|
||||
|
||||
out0[0x10*16] = b1[0x00];
|
||||
out0[0x10*12] = b1[0x04];
|
||||
out0[0x10* 8] = b1[0x02];
|
||||
out0[0x10* 4] = b1[0x06];
|
||||
out0[0x10* 0] = b1[0x01];
|
||||
out1[0x10* 0] = b1[0x01];
|
||||
out1[0x10* 4] = b1[0x05];
|
||||
out1[0x10* 8] = b1[0x03];
|
||||
out1[0x10*12] = b1[0x07];
|
||||
|
||||
b1[0x08] += b1[0x0C];
|
||||
out0[0x10*14] = b1[0x08];
|
||||
b1[0x0C] += b1[0x0a];
|
||||
out0[0x10*10] = b1[0x0C];
|
||||
b1[0x0A] += b1[0x0E];
|
||||
out0[0x10* 6] = b1[0x0A];
|
||||
b1[0x0E] += b1[0x09];
|
||||
out0[0x10* 2] = b1[0x0E];
|
||||
b1[0x09] += b1[0x0D];
|
||||
out1[0x10* 2] = b1[0x09];
|
||||
b1[0x0D] += b1[0x0B];
|
||||
out1[0x10* 6] = b1[0x0D];
|
||||
b1[0x0B] += b1[0x0F];
|
||||
out1[0x10*10] = b1[0x0B];
|
||||
out1[0x10*14] = b1[0x0F];
|
||||
|
||||
b1[0x18] += b1[0x1C];
|
||||
out0[0x10*15] = b1[0x10] + b1[0x18];
|
||||
out0[0x10*13] = b1[0x18] + b1[0x14];
|
||||
b1[0x1C] += b1[0x1a];
|
||||
out0[0x10*11] = b1[0x14] + b1[0x1C];
|
||||
out0[0x10* 9] = b1[0x1C] + b1[0x12];
|
||||
b1[0x1A] += b1[0x1E];
|
||||
out0[0x10* 7] = b1[0x12] + b1[0x1A];
|
||||
out0[0x10* 5] = b1[0x1A] + b1[0x16];
|
||||
b1[0x1E] += b1[0x19];
|
||||
out0[0x10* 3] = b1[0x16] + b1[0x1E];
|
||||
out0[0x10* 1] = b1[0x1E] + b1[0x11];
|
||||
b1[0x19] += b1[0x1D];
|
||||
out1[0x10* 1] = b1[0x11] + b1[0x19];
|
||||
out1[0x10* 3] = b1[0x19] + b1[0x15];
|
||||
b1[0x1D] += b1[0x1B];
|
||||
out1[0x10* 5] = b1[0x15] + b1[0x1D];
|
||||
out1[0x10* 7] = b1[0x1D] + b1[0x13];
|
||||
b1[0x1B] += b1[0x1F];
|
||||
out1[0x10* 9] = b1[0x13] + b1[0x1B];
|
||||
out1[0x10*11] = b1[0x1B] + b1[0x17];
|
||||
out1[0x10*13] = b1[0x17] + b1[0x1F];
|
||||
out1[0x10*15] = b1[0x1F];
|
||||
}
|
||||
|
||||
/*
|
||||
* the call via dct64 is a trick to force GCC to use
|
||||
* (new) registers for the b1,b2 pointer to the bufs[xx] field
|
||||
*/
|
||||
void dct64(struct StaticData * psd, real *a,real *b,real *c)
|
||||
{
|
||||
real bufs[0x40];
|
||||
dct64_1(psd, a,b,bufs,bufs+0x20,c);
|
||||
}
|
||||
|
|
@ -1,261 +0,0 @@
|
|||
/*
|
||||
* Mpeg Layer-1,2,3 audio decoder
|
||||
* ------------------------------
|
||||
* copyright (c) 1995,1996,1997 by Michael Hipp, All rights reserved.
|
||||
* See also 'README'
|
||||
*
|
||||
* slighlty optimized for machines without autoincrement/decrement.
|
||||
* The performance is highly compiler dependend. Maybe
|
||||
* the decode.c version for 'normal' processor may be faster
|
||||
* even for Intel processors.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpg123.h"
|
||||
#include "mpglib.h"
|
||||
|
||||
/* old WRITE_SAMPLE */
|
||||
#define WRITE_SAMPLE(samples,sum,clip) \
|
||||
if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \
|
||||
else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \
|
||||
else { *(samples) = sum; }
|
||||
|
||||
int synth_1to1_mono(struct StaticData * psd, struct mpstr * gmp, real *bandPtr,unsigned char *samples,int *pnt)
|
||||
{
|
||||
short samples_tmp[64];
|
||||
short *tmp1 = samples_tmp;
|
||||
int i,ret;
|
||||
int pnt1 = 0;
|
||||
|
||||
ret = synth_1to1(psd, gmp, bandPtr,0,(unsigned char *) samples_tmp,&pnt1);
|
||||
samples += *pnt;
|
||||
|
||||
for(i=0;i<32;i++) {
|
||||
*( (short *) samples) = *tmp1;
|
||||
samples += 2;
|
||||
tmp1 += 2;
|
||||
}
|
||||
*pnt += 64;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int synth_1to1(struct StaticData * psd, struct mpstr * gmp, real *bandPtr,int channel,unsigned char *out,int *pnt)
|
||||
{
|
||||
const int step = 2;
|
||||
|
||||
int bo;
|
||||
|
||||
short *samples = (short *) (out + *pnt);
|
||||
|
||||
real *b0,(*buf)[0x110];
|
||||
int clip = 0;
|
||||
int bo1;
|
||||
|
||||
bo = gmp->synth_bo;
|
||||
|
||||
if(!channel) {
|
||||
bo--;
|
||||
bo &= 0xf;
|
||||
buf = gmp->synth_buffs[0];
|
||||
}
|
||||
else {
|
||||
samples++;
|
||||
buf = gmp->synth_buffs[1];
|
||||
}
|
||||
|
||||
if(bo & 0x1) {
|
||||
b0 = buf[0];
|
||||
bo1 = bo;
|
||||
dct64(psd, buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr);
|
||||
}
|
||||
else {
|
||||
b0 = buf[1];
|
||||
bo1 = bo+1;
|
||||
dct64(psd, buf[0]+bo,buf[1]+bo+1,bandPtr);
|
||||
}
|
||||
|
||||
gmp->synth_bo = bo;
|
||||
|
||||
{
|
||||
register int j;
|
||||
real *window = psd->decwin + 16 - bo1;
|
||||
|
||||
for (j=16;j;j--,b0+=0x10,window+=0x20,samples+=step)
|
||||
{
|
||||
real sum;
|
||||
sum = window[0x0] * b0[0x0];
|
||||
sum -= window[0x1] * b0[0x1];
|
||||
sum += window[0x2] * b0[0x2];
|
||||
sum -= window[0x3] * b0[0x3];
|
||||
sum += window[0x4] * b0[0x4];
|
||||
sum -= window[0x5] * b0[0x5];
|
||||
sum += window[0x6] * b0[0x6];
|
||||
sum -= window[0x7] * b0[0x7];
|
||||
sum += window[0x8] * b0[0x8];
|
||||
sum -= window[0x9] * b0[0x9];
|
||||
sum += window[0xA] * b0[0xA];
|
||||
sum -= window[0xB] * b0[0xB];
|
||||
sum += window[0xC] * b0[0xC];
|
||||
sum -= window[0xD] * b0[0xD];
|
||||
sum += window[0xE] * b0[0xE];
|
||||
sum -= window[0xF] * b0[0xF];
|
||||
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
}
|
||||
|
||||
{
|
||||
real sum;
|
||||
sum = window[0x0] * b0[0x0];
|
||||
sum += window[0x2] * b0[0x2];
|
||||
sum += window[0x4] * b0[0x4];
|
||||
sum += window[0x6] * b0[0x6];
|
||||
sum += window[0x8] * b0[0x8];
|
||||
sum += window[0xA] * b0[0xA];
|
||||
sum += window[0xC] * b0[0xC];
|
||||
sum += window[0xE] * b0[0xE];
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
b0-=0x10,window-=0x20,samples+=step;
|
||||
}
|
||||
window += bo1<<1;
|
||||
|
||||
for (j=15;j;j--,b0-=0x10,window-=0x20,samples+=step)
|
||||
{
|
||||
real sum;
|
||||
sum = -window[-0x1] * b0[0x0];
|
||||
sum -= window[-0x2] * b0[0x1];
|
||||
sum -= window[-0x3] * b0[0x2];
|
||||
sum -= window[-0x4] * b0[0x3];
|
||||
sum -= window[-0x5] * b0[0x4];
|
||||
sum -= window[-0x6] * b0[0x5];
|
||||
sum -= window[-0x7] * b0[0x6];
|
||||
sum -= window[-0x8] * b0[0x7];
|
||||
sum -= window[-0x9] * b0[0x8];
|
||||
sum -= window[-0xA] * b0[0x9];
|
||||
sum -= window[-0xB] * b0[0xA];
|
||||
sum -= window[-0xC] * b0[0xB];
|
||||
sum -= window[-0xD] * b0[0xC];
|
||||
sum -= window[-0xE] * b0[0xD];
|
||||
sum -= window[-0xF] * b0[0xE];
|
||||
sum -= window[-0x0] * b0[0xF];
|
||||
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
}
|
||||
}
|
||||
*pnt += 128;
|
||||
|
||||
return clip;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int tsynth_1to1(struct StaticData * psd, real *bandPtr,int channel,unsigned char *out,int *pnt)
|
||||
{
|
||||
const int step = 2;
|
||||
|
||||
short *samples = (short *) (out + *pnt);
|
||||
|
||||
real *b0,(*buf)[0x110];
|
||||
int clip = 0;
|
||||
int bo1;
|
||||
|
||||
if(!channel) {
|
||||
psd->bo--;
|
||||
psd->bo &= 0xf;
|
||||
buf = psd->buffs[0];
|
||||
}
|
||||
else {
|
||||
samples++;
|
||||
buf = psd->buffs[1];
|
||||
}
|
||||
|
||||
if(psd->bo & 0x1) {
|
||||
b0 = buf[0];
|
||||
bo1 = psd->bo;
|
||||
dct64(psd, buf[1]+((psd->bo+1)&0xf),buf[0]+psd->bo,bandPtr);
|
||||
}
|
||||
else {
|
||||
b0 = buf[1];
|
||||
bo1 = psd->bo+1;
|
||||
dct64(psd, buf[0]+psd->bo,buf[1]+psd->bo+1,bandPtr);
|
||||
}
|
||||
|
||||
{
|
||||
register int j;
|
||||
real *window = psd->decwin + 16 - bo1;
|
||||
|
||||
for (j=16;j;j--,b0+=0x10,window+=0x20,samples+=step)
|
||||
{
|
||||
real sum;
|
||||
sum = window[0x0] * b0[0x0];
|
||||
sum -= window[0x1] * b0[0x1];
|
||||
sum += window[0x2] * b0[0x2];
|
||||
sum -= window[0x3] * b0[0x3];
|
||||
sum += window[0x4] * b0[0x4];
|
||||
sum -= window[0x5] * b0[0x5];
|
||||
sum += window[0x6] * b0[0x6];
|
||||
sum -= window[0x7] * b0[0x7];
|
||||
sum += window[0x8] * b0[0x8];
|
||||
sum -= window[0x9] * b0[0x9];
|
||||
sum += window[0xA] * b0[0xA];
|
||||
sum -= window[0xB] * b0[0xB];
|
||||
sum += window[0xC] * b0[0xC];
|
||||
sum -= window[0xD] * b0[0xD];
|
||||
sum += window[0xE] * b0[0xE];
|
||||
sum -= window[0xF] * b0[0xF];
|
||||
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
}
|
||||
|
||||
{
|
||||
real sum;
|
||||
sum = window[0x0] * b0[0x0];
|
||||
sum += window[0x2] * b0[0x2];
|
||||
sum += window[0x4] * b0[0x4];
|
||||
sum += window[0x6] * b0[0x6];
|
||||
sum += window[0x8] * b0[0x8];
|
||||
sum += window[0xA] * b0[0xA];
|
||||
sum += window[0xC] * b0[0xC];
|
||||
sum += window[0xE] * b0[0xE];
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
b0-=0x10,window-=0x20,samples+=step;
|
||||
}
|
||||
window += bo1<<1;
|
||||
|
||||
for (j=15;j;j--,b0-=0x10,window-=0x20,samples+=step)
|
||||
{
|
||||
real sum;
|
||||
sum = -window[-0x1] * b0[0x0];
|
||||
sum -= window[-0x2] * b0[0x1];
|
||||
sum -= window[-0x3] * b0[0x2];
|
||||
sum -= window[-0x4] * b0[0x3];
|
||||
sum -= window[-0x5] * b0[0x4];
|
||||
sum -= window[-0x6] * b0[0x5];
|
||||
sum -= window[-0x7] * b0[0x6];
|
||||
sum -= window[-0x8] * b0[0x7];
|
||||
sum -= window[-0x9] * b0[0x8];
|
||||
sum -= window[-0xA] * b0[0x9];
|
||||
sum -= window[-0xB] * b0[0xA];
|
||||
sum -= window[-0xC] * b0[0xB];
|
||||
sum -= window[-0xD] * b0[0xC];
|
||||
sum -= window[-0xE] * b0[0xD];
|
||||
sum -= window[-0xF] * b0[0xE];
|
||||
sum -= window[-0x0] * b0[0xF];
|
||||
|
||||
WRITE_SAMPLE(samples,sum,clip);
|
||||
}
|
||||
}
|
||||
*pnt += 128;
|
||||
|
||||
return clip;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,332 +0,0 @@
|
|||
/*
|
||||
* huffman tables ... recalcualted to work with my optimzed
|
||||
* decoder scheme (MH)
|
||||
*
|
||||
* probably we could save a few bytes of memory, because the
|
||||
* smaller tables are often the part of a bigger table
|
||||
*/
|
||||
|
||||
struct newhuff
|
||||
{
|
||||
unsigned int linbits;
|
||||
const short *table;
|
||||
};
|
||||
|
||||
const short tab0[] =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
const short tab1[] =
|
||||
{
|
||||
-5, -3, -1, 17, 1, 16, 0
|
||||
};
|
||||
|
||||
const short tab2[] =
|
||||
{
|
||||
-15, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 17, -1, 1,
|
||||
16, 0
|
||||
};
|
||||
|
||||
const short tab3[] =
|
||||
{
|
||||
-13, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 16, 17, -1,
|
||||
1, 0
|
||||
};
|
||||
|
||||
const short tab5[] =
|
||||
{
|
||||
-29, -25, -23, -15, -7, -5, -3, -1, 51, 35, 50, 49, -3, -1, 19,
|
||||
3, -1, 48, 34, -3, -1, 18, 33, -1, 2, 32, 17, -1, 1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab6[] =
|
||||
{
|
||||
-25, -19, -13, -9, -5, -3, -1, 51, 3, 35, -1, 50, 48, -1, 19,
|
||||
49, -3, -1, 34, 2, 18, -3, -1, 33, 32, 1, -1, 17, -1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab7[] =
|
||||
{
|
||||
-69, -65, -57, -39, -29, -17, -11, -7, -3, -1, 85, 69, -1, 84, 83,
|
||||
-1, 53, 68, -3, -1, 37, 82, 21, -5, -1, 81, -1, 5, 52, -1,
|
||||
80, -1, 67, 51, -5, -3, -1, 36, 66, 20, -1, 65, 64, -11, -7,
|
||||
-3, -1, 4, 35, -1, 50, 3, -1, 19, 49, -3, -1, 48, 34, 18,
|
||||
-5, -1, 33, -1, 2, 32, 17, -1, 1, 16, 0
|
||||
};
|
||||
|
||||
const short tab8[] =
|
||||
{
|
||||
-65, -63, -59, -45, -31, -19, -13, -7, -5, -3, -1, 85, 84, 69, 83,
|
||||
-3, -1, 53, 68, 37, -3, -1, 82, 5, 21, -5, -1, 81, -1, 52,
|
||||
67, -3, -1, 80, 51, 36, -5, -3, -1, 66, 20, 65, -3, -1, 4,
|
||||
64, -1, 35, 50, -9, -7, -3, -1, 19, 49, -1, 3, 48, 34, -1,
|
||||
2, 32, -1, 18, 33, 17, -3, -1, 1, 16, 0
|
||||
};
|
||||
|
||||
const short tab9[] =
|
||||
{
|
||||
-63, -53, -41, -29, -19, -11, -5, -3, -1, 85, 69, 53, -1, 83, -1,
|
||||
84, 5, -3, -1, 68, 37, -1, 82, 21, -3, -1, 81, 52, -1, 67,
|
||||
-1, 80, 4, -7, -3, -1, 36, 66, -1, 51, 64, -1, 20, 65, -5,
|
||||
-3, -1, 35, 50, 19, -1, 49, -1, 3, 48, -5, -3, -1, 34, 2,
|
||||
18, -1, 33, 32, -3, -1, 17, 1, -1, 16, 0
|
||||
};
|
||||
|
||||
const short tab10[] =
|
||||
{
|
||||
-125,-121,-111, -83, -55, -35, -21, -13, -7, -3, -1, 119, 103, -1, 118,
|
||||
87, -3, -1, 117, 102, 71, -3, -1, 116, 86, -1, 101, 55, -9, -3,
|
||||
-1, 115, 70, -3, -1, 85, 84, 99, -1, 39, 114, -11, -5, -3, -1,
|
||||
100, 7, 112, -1, 98, -1, 69, 53, -5, -1, 6, -1, 83, 68, 23,
|
||||
-17, -5, -1, 113, -1, 54, 38, -5, -3, -1, 37, 82, 21, -1, 81,
|
||||
-1, 52, 67, -3, -1, 22, 97, -1, 96, -1, 5, 80, -19, -11, -7,
|
||||
-3, -1, 36, 66, -1, 51, 4, -1, 20, 65, -3, -1, 64, 35, -1,
|
||||
50, 3, -3, -1, 19, 49, -1, 48, 34, -7, -3, -1, 18, 33, -1,
|
||||
2, 32, 17, -1, 1, 16, 0
|
||||
};
|
||||
|
||||
const short tab11[] =
|
||||
{
|
||||
-121,-113, -89, -59, -43, -27, -17, -7, -3, -1, 119, 103, -1, 118, 117,
|
||||
-3, -1, 102, 71, -1, 116, -1, 87, 85, -5, -3, -1, 86, 101, 55,
|
||||
-1, 115, 70, -9, -7, -3, -1, 69, 84, -1, 53, 83, 39, -1, 114,
|
||||
-1, 100, 7, -5, -1, 113, -1, 23, 112, -3, -1, 54, 99, -1, 96,
|
||||
-1, 68, 37, -13, -7, -5, -3, -1, 82, 5, 21, 98, -3, -1, 38,
|
||||
6, 22, -5, -1, 97, -1, 81, 52, -5, -1, 80, -1, 67, 51, -1,
|
||||
36, 66, -15, -11, -7, -3, -1, 20, 65, -1, 4, 64, -1, 35, 50,
|
||||
-1, 19, 49, -5, -3, -1, 3, 48, 34, 33, -5, -1, 18, -1, 2,
|
||||
32, 17, -3, -1, 1, 16, 0
|
||||
};
|
||||
|
||||
const short tab12[] =
|
||||
{
|
||||
-115, -99, -73, -45, -27, -17, -9, -5, -3, -1, 119, 103, 118, -1, 87,
|
||||
117, -3, -1, 102, 71, -1, 116, 101, -3, -1, 86, 55, -3, -1, 115,
|
||||
85, 39, -7, -3, -1, 114, 70, -1, 100, 23, -5, -1, 113, -1, 7,
|
||||
112, -1, 54, 99, -13, -9, -3, -1, 69, 84, -1, 68, -1, 6, 5,
|
||||
-1, 38, 98, -5, -1, 97, -1, 22, 96, -3, -1, 53, 83, -1, 37,
|
||||
82, -17, -7, -3, -1, 21, 81, -1, 52, 67, -5, -3, -1, 80, 4,
|
||||
36, -1, 66, 20, -3, -1, 51, 65, -1, 35, 50, -11, -7, -5, -3,
|
||||
-1, 64, 3, 48, 19, -1, 49, 34, -1, 18, 33, -7, -5, -3, -1,
|
||||
2, 32, 0, 17, -1, 1, 16
|
||||
};
|
||||
|
||||
const short tab13[] =
|
||||
{
|
||||
-509,-503,-475,-405,-333,-265,-205,-153,-115, -83, -53, -35, -21, -13, -9,
|
||||
-7, -5, -3, -1, 254, 252, 253, 237, 255, -1, 239, 223, -3, -1, 238,
|
||||
207, -1, 222, 191, -9, -3, -1, 251, 206, -1, 220, -1, 175, 233, -1,
|
||||
236, 221, -9, -5, -3, -1, 250, 205, 190, -1, 235, 159, -3, -1, 249,
|
||||
234, -1, 189, 219, -17, -9, -3, -1, 143, 248, -1, 204, -1, 174, 158,
|
||||
-5, -1, 142, -1, 127, 126, 247, -5, -1, 218, -1, 173, 188, -3, -1,
|
||||
203, 246, 111, -15, -7, -3, -1, 232, 95, -1, 157, 217, -3, -1, 245,
|
||||
231, -1, 172, 187, -9, -3, -1, 79, 244, -3, -1, 202, 230, 243, -1,
|
||||
63, -1, 141, 216, -21, -9, -3, -1, 47, 242, -3, -1, 110, 156, 15,
|
||||
-5, -3, -1, 201, 94, 171, -3, -1, 125, 215, 78, -11, -5, -3, -1,
|
||||
200, 214, 62, -1, 185, -1, 155, 170, -1, 31, 241, -23, -13, -5, -1,
|
||||
240, -1, 186, 229, -3, -1, 228, 140, -1, 109, 227, -5, -1, 226, -1,
|
||||
46, 14, -1, 30, 225, -15, -7, -3, -1, 224, 93, -1, 213, 124, -3,
|
||||
-1, 199, 77, -1, 139, 184, -7, -3, -1, 212, 154, -1, 169, 108, -1,
|
||||
198, 61, -37, -21, -9, -5, -3, -1, 211, 123, 45, -1, 210, 29, -5,
|
||||
-1, 183, -1, 92, 197, -3, -1, 153, 122, 195, -7, -5, -3, -1, 167,
|
||||
151, 75, 209, -3, -1, 13, 208, -1, 138, 168, -11, -7, -3, -1, 76,
|
||||
196, -1, 107, 182, -1, 60, 44, -3, -1, 194, 91, -3, -1, 181, 137,
|
||||
28, -43, -23, -11, -5, -1, 193, -1, 152, 12, -1, 192, -1, 180, 106,
|
||||
-5, -3, -1, 166, 121, 59, -1, 179, -1, 136, 90, -11, -5, -1, 43,
|
||||
-1, 165, 105, -1, 164, -1, 120, 135, -5, -1, 148, -1, 119, 118, 178,
|
||||
-11, -3, -1, 27, 177, -3, -1, 11, 176, -1, 150, 74, -7, -3, -1,
|
||||
58, 163, -1, 89, 149, -1, 42, 162, -47, -23, -9, -3, -1, 26, 161,
|
||||
-3, -1, 10, 104, 160, -5, -3, -1, 134, 73, 147, -3, -1, 57, 88,
|
||||
-1, 133, 103, -9, -3, -1, 41, 146, -3, -1, 87, 117, 56, -5, -1,
|
||||
131, -1, 102, 71, -3, -1, 116, 86, -1, 101, 115, -11, -3, -1, 25,
|
||||
145, -3, -1, 9, 144, -1, 72, 132, -7, -5, -1, 114, -1, 70, 100,
|
||||
40, -1, 130, 24, -41, -27, -11, -5, -3, -1, 55, 39, 23, -1, 113,
|
||||
-1, 85, 7, -7, -3, -1, 112, 54, -1, 99, 69, -3, -1, 84, 38,
|
||||
-1, 98, 53, -5, -1, 129, -1, 8, 128, -3, -1, 22, 97, -1, 6,
|
||||
96, -13, -9, -5, -3, -1, 83, 68, 37, -1, 82, 5, -1, 21, 81,
|
||||
-7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51, 20, -19, -11,
|
||||
-5, -1, 65, -1, 4, 64, -3, -1, 35, 50, 19, -3, -1, 49, 3,
|
||||
-1, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1, 17, 1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab15[] =
|
||||
{
|
||||
-495,-445,-355,-263,-183,-115, -77, -43, -27, -13, -7, -3, -1, 255, 239,
|
||||
-1, 254, 223, -1, 238, -1, 253, 207, -7, -3, -1, 252, 222, -1, 237,
|
||||
191, -1, 251, -1, 206, 236, -7, -3, -1, 221, 175, -1, 250, 190, -3,
|
||||
-1, 235, 205, -1, 220, 159, -15, -7, -3, -1, 249, 234, -1, 189, 219,
|
||||
-3, -1, 143, 248, -1, 204, 158, -7, -3, -1, 233, 127, -1, 247, 173,
|
||||
-3, -1, 218, 188, -1, 111, -1, 174, 15, -19, -11, -3, -1, 203, 246,
|
||||
-3, -1, 142, 232, -1, 95, 157, -3, -1, 245, 126, -1, 231, 172, -9,
|
||||
-3, -1, 202, 187, -3, -1, 217, 141, 79, -3, -1, 244, 63, -1, 243,
|
||||
216, -33, -17, -9, -3, -1, 230, 47, -1, 242, -1, 110, 240, -3, -1,
|
||||
31, 241, -1, 156, 201, -7, -3, -1, 94, 171, -1, 186, 229, -3, -1,
|
||||
125, 215, -1, 78, 228, -15, -7, -3, -1, 140, 200, -1, 62, 109, -3,
|
||||
-1, 214, 227, -1, 155, 185, -7, -3, -1, 46, 170, -1, 226, 30, -5,
|
||||
-1, 225, -1, 14, 224, -1, 93, 213, -45, -25, -13, -7, -3, -1, 124,
|
||||
199, -1, 77, 139, -1, 212, -1, 184, 154, -7, -3, -1, 169, 108, -1,
|
||||
198, 61, -1, 211, 210, -9, -5, -3, -1, 45, 13, 29, -1, 123, 183,
|
||||
-5, -1, 209, -1, 92, 208, -1, 197, 138, -17, -7, -3, -1, 168, 76,
|
||||
-1, 196, 107, -5, -1, 182, -1, 153, 12, -1, 60, 195, -9, -3, -1,
|
||||
122, 167, -1, 166, -1, 192, 11, -1, 194, -1, 44, 91, -55, -29, -15,
|
||||
-7, -3, -1, 181, 28, -1, 137, 152, -3, -1, 193, 75, -1, 180, 106,
|
||||
-5, -3, -1, 59, 121, 179, -3, -1, 151, 136, -1, 43, 90, -11, -5,
|
||||
-1, 178, -1, 165, 27, -1, 177, -1, 176, 105, -7, -3, -1, 150, 74,
|
||||
-1, 164, 120, -3, -1, 135, 58, 163, -17, -7, -3, -1, 89, 149, -1,
|
||||
42, 162, -3, -1, 26, 161, -3, -1, 10, 160, 104, -7, -3, -1, 134,
|
||||
73, -1, 148, 57, -5, -1, 147, -1, 119, 9, -1, 88, 133, -53, -29,
|
||||
-13, -7, -3, -1, 41, 103, -1, 118, 146, -1, 145, -1, 25, 144, -7,
|
||||
-3, -1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102, 71, -7,
|
||||
-3, -1, 40, 130, -1, 24, 129, -7, -3, -1, 116, 8, -1, 128, 86,
|
||||
-3, -1, 101, 55, -1, 115, 70, -17, -7, -3, -1, 39, 114, -1, 100,
|
||||
23, -3, -1, 85, 113, -3, -1, 7, 112, 54, -7, -3, -1, 99, 69,
|
||||
-1, 84, 38, -3, -1, 98, 22, -3, -1, 6, 96, 53, -33, -19, -9,
|
||||
-5, -1, 97, -1, 83, 68, -1, 37, 82, -3, -1, 21, 81, -3, -1,
|
||||
5, 80, 52, -7, -3, -1, 67, 36, -1, 66, 51, -1, 65, -1, 20,
|
||||
4, -9, -3, -1, 35, 50, -3, -1, 64, 3, 19, -3, -1, 49, 48,
|
||||
34, -9, -7, -3, -1, 18, 33, -1, 2, 32, 17, -3, -1, 1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab16[] =
|
||||
{
|
||||
-509,-503,-461,-323,-103, -37, -27, -15, -7, -3, -1, 239, 254, -1, 223,
|
||||
253, -3, -1, 207, 252, -1, 191, 251, -5, -1, 175, -1, 250, 159, -3,
|
||||
-1, 249, 248, 143, -7, -3, -1, 127, 247, -1, 111, 246, 255, -9, -5,
|
||||
-3, -1, 95, 245, 79, -1, 244, 243, -53, -1, 240, -1, 63, -29, -19,
|
||||
-13, -7, -5, -1, 206, -1, 236, 221, 222, -1, 233, -1, 234, 217, -1,
|
||||
238, -1, 237, 235, -3, -1, 190, 205, -3, -1, 220, 219, 174, -11, -5,
|
||||
-1, 204, -1, 173, 218, -3, -1, 126, 172, 202, -5, -3, -1, 201, 125,
|
||||
94, 189, 242, -93, -5, -3, -1, 47, 15, 31, -1, 241, -49, -25, -13,
|
||||
-5, -1, 158, -1, 188, 203, -3, -1, 142, 232, -1, 157, 231, -7, -3,
|
||||
-1, 187, 141, -1, 216, 110, -1, 230, 156, -13, -7, -3, -1, 171, 186,
|
||||
-1, 229, 215, -1, 78, -1, 228, 140, -3, -1, 200, 62, -1, 109, -1,
|
||||
214, 155, -19, -11, -5, -3, -1, 185, 170, 225, -1, 212, -1, 184, 169,
|
||||
-5, -1, 123, -1, 183, 208, 227, -7, -3, -1, 14, 224, -1, 93, 213,
|
||||
-3, -1, 124, 199, -1, 77, 139, -75, -45, -27, -13, -7, -3, -1, 154,
|
||||
108, -1, 198, 61, -3, -1, 92, 197, 13, -7, -3, -1, 138, 168, -1,
|
||||
153, 76, -3, -1, 182, 122, 60, -11, -5, -3, -1, 91, 137, 28, -1,
|
||||
192, -1, 152, 121, -1, 226, -1, 46, 30, -15, -7, -3, -1, 211, 45,
|
||||
-1, 210, 209, -5, -1, 59, -1, 151, 136, 29, -7, -3, -1, 196, 107,
|
||||
-1, 195, 167, -1, 44, -1, 194, 181, -23, -13, -7, -3, -1, 193, 12,
|
||||
-1, 75, 180, -3, -1, 106, 166, 179, -5, -3, -1, 90, 165, 43, -1,
|
||||
178, 27, -13, -5, -1, 177, -1, 11, 176, -3, -1, 105, 150, -1, 74,
|
||||
164, -5, -3, -1, 120, 135, 163, -3, -1, 58, 89, 42, -97, -57, -33,
|
||||
-19, -11, -5, -3, -1, 149, 104, 161, -3, -1, 134, 119, 148, -5, -3,
|
||||
-1, 73, 87, 103, 162, -5, -1, 26, -1, 10, 160, -3, -1, 57, 147,
|
||||
-1, 88, 133, -9, -3, -1, 41, 146, -3, -1, 118, 9, 25, -5, -1,
|
||||
145, -1, 144, 72, -3, -1, 132, 117, -1, 56, 131, -21, -11, -5, -3,
|
||||
-1, 102, 40, 130, -3, -1, 71, 116, 24, -3, -1, 129, 128, -3, -1,
|
||||
8, 86, 55, -9, -5, -1, 115, -1, 101, 70, -1, 39, 114, -5, -3,
|
||||
-1, 100, 85, 7, 23, -23, -13, -5, -1, 113, -1, 112, 54, -3, -1,
|
||||
99, 69, -1, 84, 38, -3, -1, 98, 22, -1, 97, -1, 6, 96, -9,
|
||||
-5, -1, 83, -1, 53, 68, -1, 37, 82, -1, 81, -1, 21, 5, -33,
|
||||
-23, -13, -7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51, 20,
|
||||
-5, -1, 65, -1, 4, 64, -1, 35, 50, -3, -1, 19, 49, -3, -1,
|
||||
3, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1, 17, 1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab24[] =
|
||||
{
|
||||
-451,-117, -43, -25, -15, -7, -3, -1, 239, 254, -1, 223, 253, -3, -1,
|
||||
207, 252, -1, 191, 251, -5, -1, 250, -1, 175, 159, -1, 249, 248, -9,
|
||||
-5, -3, -1, 143, 127, 247, -1, 111, 246, -3, -1, 95, 245, -1, 79,
|
||||
244, -71, -7, -3, -1, 63, 243, -1, 47, 242, -5, -1, 241, -1, 31,
|
||||
240, -25, -9, -1, 15, -3, -1, 238, 222, -1, 237, 206, -7, -3, -1,
|
||||
236, 221, -1, 190, 235, -3, -1, 205, 220, -1, 174, 234, -15, -7, -3,
|
||||
-1, 189, 219, -1, 204, 158, -3, -1, 233, 173, -1, 218, 188, -7, -3,
|
||||
-1, 203, 142, -1, 232, 157, -3, -1, 217, 126, -1, 231, 172, 255,-235,
|
||||
-143, -77, -45, -25, -15, -7, -3, -1, 202, 187, -1, 141, 216, -5, -3,
|
||||
-1, 14, 224, 13, 230, -5, -3, -1, 110, 156, 201, -1, 94, 186, -9,
|
||||
-5, -1, 229, -1, 171, 125, -1, 215, 228, -3, -1, 140, 200, -3, -1,
|
||||
78, 46, 62, -15, -7, -3, -1, 109, 214, -1, 227, 155, -3, -1, 185,
|
||||
170, -1, 226, 30, -7, -3, -1, 225, 93, -1, 213, 124, -3, -1, 199,
|
||||
77, -1, 139, 184, -31, -15, -7, -3, -1, 212, 154, -1, 169, 108, -3,
|
||||
-1, 198, 61, -1, 211, 45, -7, -3, -1, 210, 29, -1, 123, 183, -3,
|
||||
-1, 209, 92, -1, 197, 138, -17, -7, -3, -1, 168, 153, -1, 76, 196,
|
||||
-3, -1, 107, 182, -3, -1, 208, 12, 60, -7, -3, -1, 195, 122, -1,
|
||||
167, 44, -3, -1, 194, 91, -1, 181, 28, -57, -35, -19, -7, -3, -1,
|
||||
137, 152, -1, 193, 75, -5, -3, -1, 192, 11, 59, -3, -1, 176, 10,
|
||||
26, -5, -1, 180, -1, 106, 166, -3, -1, 121, 151, -3, -1, 160, 9,
|
||||
144, -9, -3, -1, 179, 136, -3, -1, 43, 90, 178, -7, -3, -1, 165,
|
||||
27, -1, 177, 105, -1, 150, 164, -17, -9, -5, -3, -1, 74, 120, 135,
|
||||
-1, 58, 163, -3, -1, 89, 149, -1, 42, 162, -7, -3, -1, 161, 104,
|
||||
-1, 134, 119, -3, -1, 73, 148, -1, 57, 147, -63, -31, -15, -7, -3,
|
||||
-1, 88, 133, -1, 41, 103, -3, -1, 118, 146, -1, 25, 145, -7, -3,
|
||||
-1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102, 40, -17, -7,
|
||||
-3, -1, 130, 24, -1, 71, 116, -5, -1, 129, -1, 8, 128, -1, 86,
|
||||
101, -7, -5, -1, 23, -1, 7, 112, 115, -3, -1, 55, 39, 114, -15,
|
||||
-7, -3, -1, 70, 100, -1, 85, 113, -3, -1, 54, 99, -1, 69, 84,
|
||||
-7, -3, -1, 38, 98, -1, 22, 97, -5, -3, -1, 6, 96, 53, -1,
|
||||
83, 68, -51, -37, -23, -15, -9, -3, -1, 37, 82, -1, 21, -1, 5,
|
||||
80, -1, 81, -1, 52, 67, -3, -1, 36, 66, -1, 51, 20, -9, -5,
|
||||
-1, 65, -1, 4, 64, -1, 35, 50, -1, 19, 49, -7, -5, -3, -1,
|
||||
3, 48, 34, 18, -1, 33, -1, 2, 32, -3, -1, 17, 1, -1, 16,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab_c0[] =
|
||||
{
|
||||
-29, -21, -13, -7, -3, -1, 11, 15, -1, 13, 14, -3, -1, 7, 5,
|
||||
9, -3, -1, 6, 3, -1, 10, 12, -3, -1, 2, 1, -1, 4, 8,
|
||||
0
|
||||
};
|
||||
|
||||
const short tab_c1[] =
|
||||
{
|
||||
-15, -7, -3, -1, 15, 14, -1, 13, 12, -3, -1, 11, 10, -1, 9,
|
||||
8, -7, -3, -1, 7, 6, -1, 5, 4, -3, -1, 3, 2, -1, 1,
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
|
||||
const struct newhuff ht[] =
|
||||
{
|
||||
{ /* 0 */ 0 , tab0 } ,
|
||||
{ /* 2 */ 0 , tab1 } ,
|
||||
{ /* 3 */ 0 , tab2 } ,
|
||||
{ /* 3 */ 0 , tab3 } ,
|
||||
{ /* 0 */ 0 , tab0 } ,
|
||||
{ /* 4 */ 0 , tab5 } ,
|
||||
{ /* 4 */ 0 , tab6 } ,
|
||||
{ /* 6 */ 0 , tab7 } ,
|
||||
{ /* 6 */ 0 , tab8 } ,
|
||||
{ /* 6 */ 0 , tab9 } ,
|
||||
{ /* 8 */ 0 , tab10 } ,
|
||||
{ /* 8 */ 0 , tab11 } ,
|
||||
{ /* 8 */ 0 , tab12 } ,
|
||||
{ /* 16 */ 0 , tab13 } ,
|
||||
{ /* 0 */ 0 , tab0 } ,
|
||||
{ /* 16 */ 0 , tab15 } ,
|
||||
|
||||
{ /* 16 */ 1 , tab16 } ,
|
||||
{ /* 16 */ 2 , tab16 } ,
|
||||
{ /* 16 */ 3 , tab16 } ,
|
||||
{ /* 16 */ 4 , tab16 } ,
|
||||
{ /* 16 */ 6 , tab16 } ,
|
||||
{ /* 16 */ 8 , tab16 } ,
|
||||
{ /* 16 */ 10, tab16 } ,
|
||||
{ /* 16 */ 13, tab16 } ,
|
||||
{ /* 16 */ 4 , tab24 } ,
|
||||
{ /* 16 */ 5 , tab24 } ,
|
||||
{ /* 16 */ 6 , tab24 } ,
|
||||
{ /* 16 */ 7 , tab24 } ,
|
||||
{ /* 16 */ 8 , tab24 } ,
|
||||
{ /* 16 */ 9 , tab24 } ,
|
||||
{ /* 16 */ 11, tab24 } ,
|
||||
{ /* 16 */ 13, tab24 }
|
||||
};
|
||||
|
||||
const struct newhuff htc[] =
|
||||
{
|
||||
{ /* 1 , 1 , */ 0 , tab_c0 } ,
|
||||
{ /* 1 , 1 , */ 0 , tab_c1 }
|
||||
};
|
||||
|
||||
|
|
@ -1,271 +0,0 @@
|
|||
/*
|
||||
* External functions declared as __declspec(dllexport)
|
||||
* to work in a Win32 DLL (use mpglibdll.h to access)
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mpg123.h"
|
||||
#include "mpglib.h"
|
||||
|
||||
void initStaticData(struct StaticData * psd)
|
||||
{
|
||||
psd->pnts[0] = psd->cos64;
|
||||
psd->pnts[1] = psd->cos32;
|
||||
psd->pnts[2] = psd->cos16;
|
||||
psd->pnts[3] = psd->cos8;
|
||||
psd->pnts[4] = psd->cos4;
|
||||
|
||||
psd->bo = 1;
|
||||
}
|
||||
|
||||
|
||||
int InitMP3(struct mpstr *mp)
|
||||
{
|
||||
memset(mp,0,sizeof(struct mpstr));
|
||||
|
||||
initStaticData(&mp->psd);
|
||||
|
||||
mp->framesize = 0;
|
||||
mp->fsizeold = -1;
|
||||
mp->bsize = 0;
|
||||
mp->head = mp->tail = NULL;
|
||||
mp->fr.single = -1;
|
||||
mp->bsnum = 0;
|
||||
mp->synth_bo = 1;
|
||||
|
||||
make_decode_tables(&mp->psd, 32767);
|
||||
init_layer3(&mp->psd, SBLIMIT);
|
||||
|
||||
mp->fr.II_sblimit=SBLIMIT;
|
||||
init_layer2(&mp->psd);
|
||||
|
||||
return !0;
|
||||
}
|
||||
|
||||
void ExitMP3(struct mpstr *mp)
|
||||
{
|
||||
struct buf *b,*bn;
|
||||
|
||||
b = mp->tail;
|
||||
while(b) {
|
||||
free(b->pnt);
|
||||
bn = b->next;
|
||||
free(b);
|
||||
b = bn;
|
||||
}
|
||||
}
|
||||
|
||||
static struct buf *addbuf(struct mpstr *mp,char *buf,int size)
|
||||
{
|
||||
struct buf *nbuf;
|
||||
|
||||
nbuf = (struct buf*) malloc( sizeof(struct buf) );
|
||||
if(!nbuf) {
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Out of memory!\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
nbuf->pnt = (unsigned char*) malloc(size);
|
||||
if(!nbuf->pnt) {
|
||||
free(nbuf);
|
||||
return NULL;
|
||||
}
|
||||
nbuf->size = size;
|
||||
memcpy(nbuf->pnt,buf,size);
|
||||
nbuf->next = NULL;
|
||||
nbuf->prev = mp->head;
|
||||
nbuf->pos = 0;
|
||||
|
||||
if(!mp->tail) {
|
||||
mp->tail = nbuf;
|
||||
}
|
||||
else {
|
||||
mp->head->next = nbuf;
|
||||
}
|
||||
|
||||
mp->head = nbuf;
|
||||
mp->bsize += size;
|
||||
|
||||
return nbuf;
|
||||
}
|
||||
|
||||
static void remove_buf(struct mpstr *mp)
|
||||
{
|
||||
struct buf *buf = mp->tail;
|
||||
|
||||
mp->tail = buf->next;
|
||||
if(mp->tail)
|
||||
mp->tail->prev = NULL;
|
||||
else {
|
||||
mp->tail = mp->head = NULL;
|
||||
}
|
||||
|
||||
free(buf->pnt);
|
||||
free(buf);
|
||||
|
||||
}
|
||||
|
||||
static int read_buf_byte(struct mpstr *mp)
|
||||
{
|
||||
unsigned int b;
|
||||
|
||||
int pos;
|
||||
|
||||
pos = mp->tail->pos;
|
||||
while(pos >= mp->tail->size) {
|
||||
remove_buf(mp);
|
||||
if(!mp->tail) {
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Fatal error!\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
pos = mp->tail->pos;
|
||||
}
|
||||
|
||||
b = mp->tail->pnt[pos];
|
||||
mp->bsize--;
|
||||
mp->tail->pos++;
|
||||
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
static void read_head(struct mpstr *mp)
|
||||
{
|
||||
unsigned long head = 0;
|
||||
int i;
|
||||
|
||||
while(mp->tail){
|
||||
head <<= 8;
|
||||
head |= read_buf_byte(mp);
|
||||
head &= 0xffffffff;
|
||||
if(head_check(head))
|
||||
break;
|
||||
}
|
||||
|
||||
mp->header = head;
|
||||
}
|
||||
|
||||
int decodeMP3(struct mpstr *mp, char *in, int isize,
|
||||
char *out, int osize, int *done)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
int len;
|
||||
|
||||
if(osize < 4608) {
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"To less out space\n");
|
||||
#endif
|
||||
return MP3_ERR;
|
||||
}
|
||||
|
||||
if(in) {
|
||||
if(addbuf(mp, in, isize) == NULL) {
|
||||
return MP3_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* First decode header */
|
||||
if(mp->framesize == 0) {
|
||||
if(mp->bsize < 4) {
|
||||
return MP3_NEED_MORE;
|
||||
}
|
||||
read_head(mp);
|
||||
if(mp->tail)
|
||||
mp->ndatabegin = mp->tail->pos - 4;
|
||||
if (decode_header(mp, &mp->fr,mp->header) <= 0 )
|
||||
return MP3_ERR;
|
||||
|
||||
mp->framesize = mp->fr.framesize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* printf(" fr.framesize = %i \n",mp->fr.framesize);
|
||||
printf(" bsize = %i \n",mp->bsize);
|
||||
*/
|
||||
|
||||
if(mp->fr.framesize > mp->bsize) {
|
||||
return MP3_NEED_MORE;
|
||||
}
|
||||
mp->psd.wordpointer = mp->bsspace[mp->bsnum] + 512;
|
||||
mp->bsnum = (mp->bsnum + 1) & 0x1;
|
||||
mp->psd.bitindex = 0;
|
||||
|
||||
len = 0;
|
||||
while(len < mp->framesize) {
|
||||
int nlen;
|
||||
int blen = mp->tail->size - mp->tail->pos;
|
||||
if( (mp->framesize - len) <= blen) {
|
||||
nlen = mp->framesize-len;
|
||||
}
|
||||
else {
|
||||
nlen = blen;
|
||||
}
|
||||
memcpy(mp->psd.wordpointer+len,mp->tail->pnt+mp->tail->pos,nlen);
|
||||
len += nlen;
|
||||
mp->tail->pos += nlen;
|
||||
mp->bsize -= nlen;
|
||||
if(mp->tail->pos == mp->tail->size) {
|
||||
remove_buf(mp);
|
||||
}
|
||||
}
|
||||
|
||||
*done = 0;
|
||||
|
||||
|
||||
|
||||
if(mp->fr.error_protection){
|
||||
getbits(&mp->psd, 16);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// FOR mpglib.dll: see if error and return it
|
||||
|
||||
|
||||
if ((&mp->fr)->do_layer(&mp->psd, mp, &mp->fr, (unsigned char*) out, done) < 0)
|
||||
return MP3_ERR;
|
||||
|
||||
mp->fsizeold = mp->framesize;
|
||||
mp->framesize = 0;
|
||||
|
||||
|
||||
return MP3_OK;
|
||||
}
|
||||
|
||||
int set_pointer(struct StaticData * psd, struct mpstr * gmp, long backstep)
|
||||
{
|
||||
unsigned char *bsbufold;
|
||||
|
||||
if(gmp->fsizeold < 0 && backstep > 0) {
|
||||
#ifndef BE_QUIET
|
||||
fprintf(stderr,"Can't step back %ld!\n",backstep);
|
||||
#endif
|
||||
return MP3_ERR;
|
||||
}
|
||||
bsbufold = gmp->bsspace[gmp->bsnum] + 512;
|
||||
psd->wordpointer -= backstep;
|
||||
if (backstep)
|
||||
memcpy(psd->wordpointer,bsbufold+gmp->fsizeold-backstep,backstep);
|
||||
psd->bitindex = 0;
|
||||
return MP3_OK;
|
||||
}
|
||||
|
||||
|
||||
void MessageI(int i)
|
||||
{
|
||||
char s[100];
|
||||
sprintf(s, "%d", i);
|
||||
// MessageBox (NULL, s, "Debug/Integer", 0);
|
||||
}
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* Layer 2 Alloc tables ..
|
||||
* most other tables are calculated on program start (which is (of course)
|
||||
* not ISO-conform) ..
|
||||
* Layer-3 huffman table is in huffman.h
|
||||
*/
|
||||
|
||||
/* Layer 2 */
|
||||
struct al_table
|
||||
{
|
||||
short bits;
|
||||
short d;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const struct al_table alloc_0[] = {
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767} };
|
||||
|
||||
const struct al_table alloc_1[] = {
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
|
||||
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767},
|
||||
{2,0},{5,3},{7,5},{16,-32767} };
|
||||
|
||||
const struct al_table alloc_2[] = {
|
||||
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
|
||||
{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
|
||||
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
|
||||
{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} };
|
||||
|
||||
const struct al_table alloc_3[] = {
|
||||
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
|
||||
{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
|
||||
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
|
||||
{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} };
|
||||
|
||||
const struct al_table alloc_4[] = {
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
|
||||
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
|
||||
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9},
|
||||
{2,0},{5,3},{7,5},{10,9} };
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
/*
|
||||
* Mpeg Layer-1 audio decoder
|
||||
* --------------------------
|
||||
* copyright (c) 1995 by Michael Hipp, All rights reserved. See also 'README'
|
||||
* near unoptimzed ...
|
||||
*
|
||||
* may have a few bugs after last optimization ...
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mpg123.h"
|
||||
|
||||
void I_step_one(unsigned int balloc[], unsigned int scale_index[2][SBLIMIT],struct frame *fr)
|
||||
{
|
||||
unsigned int *ba=balloc;
|
||||
unsigned int *sca = (unsigned int *) scale_index;
|
||||
|
||||
if(fr->stereo) {
|
||||
int i;
|
||||
int jsbound = fr->jsbound;
|
||||
for (i=0;i<jsbound;i++) {
|
||||
*ba++ = getbits(4);
|
||||
*ba++ = getbits(4);
|
||||
}
|
||||
for (i=jsbound;i<SBLIMIT;i++)
|
||||
*ba++ = getbits(4);
|
||||
|
||||
ba = balloc;
|
||||
|
||||
for (i=0;i<jsbound;i++) {
|
||||
if ((*ba++))
|
||||
*sca++ = getbits(6);
|
||||
if ((*ba++))
|
||||
*sca++ = getbits(6);
|
||||
}
|
||||
for (i=jsbound;i<SBLIMIT;i++)
|
||||
if ((*ba++)) {
|
||||
*sca++ = getbits(6);
|
||||
*sca++ = getbits(6);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int i;
|
||||
for (i=0;i<SBLIMIT;i++)
|
||||
*ba++ = getbits(4);
|
||||
ba = balloc;
|
||||
for (i=0;i<SBLIMIT;i++)
|
||||
if ((*ba++))
|
||||
*sca++ = getbits(6);
|
||||
}
|
||||
}
|
||||
|
||||
void I_step_two(real fraction[2][SBLIMIT],unsigned int balloc[2*SBLIMIT],
|
||||
unsigned int scale_index[2][SBLIMIT],struct frame *fr)
|
||||
{
|
||||
int i,n;
|
||||
int smpb[2*SBLIMIT]; /* values: 0-65535 */
|
||||
int *sample;
|
||||
register unsigned int *ba;
|
||||
register unsigned int *sca = (unsigned int *) scale_index;
|
||||
|
||||
if(fr->stereo) {
|
||||
int jsbound = fr->jsbound;
|
||||
register real *f0 = fraction[0];
|
||||
register real *f1 = fraction[1];
|
||||
ba = balloc;
|
||||
for (sample=smpb,i=0;i<jsbound;i++) {
|
||||
if ((n = *ba++))
|
||||
*sample++ = getbits(n+1);
|
||||
if ((n = *ba++))
|
||||
*sample++ = getbits(n+1);
|
||||
}
|
||||
for (i=jsbound;i<SBLIMIT;i++)
|
||||
if ((n = *ba++))
|
||||
*sample++ = getbits(n+1);
|
||||
|
||||
ba = balloc;
|
||||
for (sample=smpb,i=0;i<jsbound;i++) {
|
||||
if((n=*ba++))
|
||||
*f0++ = (real) ( ((-1)<<n) + (*sample++) + 1) * muls[n+1][*sca++];
|
||||
else
|
||||
*f0++ = 0.0;
|
||||
if((n=*ba++))
|
||||
*f1++ = (real) ( ((-1)<<n) + (*sample++) + 1) * muls[n+1][*sca++];
|
||||
else
|
||||
*f1++ = 0.0;
|
||||
}
|
||||
for (i=jsbound;i<SBLIMIT;i++) {
|
||||
if ((n=*ba++)) {
|
||||
real samp = ( ((-1)<<n) + (*sample++) + 1);
|
||||
*f0++ = samp * muls[n+1][*sca++];
|
||||
*f1++ = samp * muls[n+1][*sca++];
|
||||
}
|
||||
else
|
||||
*f0++ = *f1++ = 0.0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
register real *f0 = fraction[0];
|
||||
ba = balloc;
|
||||
for (sample=smpb,i=0;i<SBLIMIT;i++)
|
||||
if ((n = *ba++))
|
||||
*sample++ = getbits(n+1);
|
||||
ba = balloc;
|
||||
for (sample=smpb,i=0;i<SBLIMIT;i++) {
|
||||
if((n=*ba++))
|
||||
*f0++ = (real) ( ((-1)<<n) + (*sample++) + 1) * muls[n+1][*sca++];
|
||||
else
|
||||
*f0++ = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int do_layer1(struct frame *fr,unsigned char *pcm_sample,int *pcm_point)
|
||||
{
|
||||
int clip=0;
|
||||
int i,stereo = fr->stereo;
|
||||
unsigned int balloc[2*SBLIMIT];
|
||||
unsigned int scale_index[2][SBLIMIT];
|
||||
real fraction[2][SBLIMIT];
|
||||
int single = fr->single;
|
||||
|
||||
fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32;
|
||||
|
||||
if(stereo == 1 || single == 3)
|
||||
single = 0;
|
||||
|
||||
I_step_one(balloc,scale_index,fr);
|
||||
|
||||
for (i=0;i<SCALE_BLOCK;i++)
|
||||
{
|
||||
I_step_two(fraction,balloc,scale_index,fr);
|
||||
|
||||
if(single >= 0) {
|
||||
clip += synth_1to1_mono( (real*)fraction[single],pcm_sample,pcm_point);
|
||||
}
|
||||
else {
|
||||
int p1 = *pcm_point;
|
||||
clip += synth_1to1( (real*)fraction[0],0,pcm_sample,&p1);
|
||||
clip += synth_1to1( (real*)fraction[1],1,pcm_sample,pcm_point);
|
||||
}
|
||||
}
|
||||
|
||||
return clip;
|
||||
}
|
||||
|
||||
|
|
@ -1,315 +0,0 @@
|
|||
/*
|
||||
* Mpeg Layer-2 audio decoder
|
||||
* --------------------------
|
||||
* copyright (c) 1995 by Michael Hipp, All rights reserved. See also 'README'
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mpg123.h"
|
||||
#include "l2tables.h"
|
||||
|
||||
void init_layer2(struct StaticData * psd)
|
||||
{
|
||||
|
||||
const double mulmul[27] = {
|
||||
0.0 , -2.0/3.0 , 2.0/3.0 ,
|
||||
2.0/7.0 , 2.0/15.0 , 2.0/31.0, 2.0/63.0 , 2.0/127.0 , 2.0/255.0 ,
|
||||
2.0/511.0 , 2.0/1023.0 , 2.0/2047.0 , 2.0/4095.0 , 2.0/8191.0 ,
|
||||
2.0/16383.0 , 2.0/32767.0 , 2.0/65535.0 ,
|
||||
-4.0/5.0 , -2.0/5.0 , 2.0/5.0, 4.0/5.0 ,
|
||||
-8.0/9.0 , -4.0/9.0 , -2.0/9.0 , 2.0/9.0 , 4.0/9.0 , 8.0/9.0 };
|
||||
|
||||
const int base[3][9] = {
|
||||
{ 1 , 0, 2 , } ,
|
||||
{ 17, 18, 0 , 19, 20 , } ,
|
||||
{ 21, 1, 22, 23, 0, 24, 25, 2, 26 } };
|
||||
|
||||
int i,j,k,l,len;
|
||||
real *table;
|
||||
const int tablen[3] = { 3 , 5 , 9 };
|
||||
int *itable,*tables[3];
|
||||
|
||||
tables[0] = psd->grp_3tab;
|
||||
tables[1] = psd->grp_5tab;
|
||||
tables[2] = psd->grp_9tab;
|
||||
|
||||
for(i=0;i<3;i++)
|
||||
{
|
||||
itable = tables[i];
|
||||
len = tablen[i];
|
||||
for(j=0;j<len;j++)
|
||||
for(k=0;k<len;k++)
|
||||
for(l=0;l<len;l++)
|
||||
{
|
||||
*itable++ = base[i][l];
|
||||
*itable++ = base[i][k];
|
||||
*itable++ = base[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for(k=0;k<27;k++)
|
||||
{
|
||||
double m=mulmul[k];
|
||||
table = psd->muls[k];
|
||||
for(j=3,i=0;i<63;i++,j--)
|
||||
*table++ = m * pow(2.0,(double) j / 3.0);
|
||||
*table++ = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void II_step_one(struct StaticData * psd, unsigned int *bit_alloc,int *scale,struct frame *fr)
|
||||
{
|
||||
|
||||
int stereo = fr->stereo-1;
|
||||
int sblimit = fr->II_sblimit;
|
||||
int jsbound = fr->jsbound;
|
||||
int sblimit2 = fr->II_sblimit<<stereo;
|
||||
const struct al_table *alloc1 = fr->alloc;
|
||||
int i;
|
||||
unsigned int *scfsi,*bita;
|
||||
int sc,step;
|
||||
|
||||
bita = bit_alloc;
|
||||
if(stereo)
|
||||
{
|
||||
for (i=jsbound;i;i--,alloc1+=(1<<step))
|
||||
{
|
||||
*bita++ = (char) getbits(psd, step=alloc1->bits);
|
||||
*bita++ = (char) getbits(psd, step);
|
||||
}
|
||||
for (i=sblimit-jsbound;i;i--,alloc1+=(1<<step))
|
||||
{
|
||||
bita[0] = (char) getbits(psd, step=alloc1->bits);
|
||||
bita[1] = bita[0];
|
||||
bita+=2;
|
||||
}
|
||||
bita = bit_alloc;
|
||||
scfsi=psd->scfsi_buf;
|
||||
for (i=sblimit2;i;i--)
|
||||
if (*bita++)
|
||||
*scfsi++ = (char) getbits_fast(psd, 2);
|
||||
}
|
||||
else /* mono */
|
||||
{
|
||||
for (i=sblimit;i;i--,alloc1+=(1<<step))
|
||||
*bita++ = (char) getbits(psd, step=alloc1->bits);
|
||||
bita = bit_alloc;
|
||||
scfsi=psd->scfsi_buf;
|
||||
for (i=sblimit;i;i--)
|
||||
if (*bita++)
|
||||
*scfsi++ = (char) getbits_fast(psd, 2);
|
||||
}
|
||||
|
||||
bita = bit_alloc;
|
||||
scfsi=psd->scfsi_buf;
|
||||
for (i=sblimit2;i;i--)
|
||||
if (*bita++)
|
||||
switch (*scfsi++)
|
||||
{
|
||||
case 0:
|
||||
*scale++ = getbits_fast(psd, 6);
|
||||
*scale++ = getbits_fast(psd, 6);
|
||||
*scale++ = getbits_fast(psd, 6);
|
||||
break;
|
||||
case 1 :
|
||||
*scale++ = sc = getbits_fast(psd, 6);
|
||||
*scale++ = sc;
|
||||
*scale++ = getbits_fast(psd, 6);
|
||||
break;
|
||||
case 2:
|
||||
*scale++ = sc = getbits_fast(psd, 6);
|
||||
*scale++ = sc;
|
||||
*scale++ = sc;
|
||||
break;
|
||||
default: /* case 3 */
|
||||
*scale++ = getbits_fast(psd, 6);
|
||||
*scale++ = sc = getbits_fast(psd, 6);
|
||||
*scale++ = sc;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void II_step_two(struct StaticData * psd, unsigned int *bit_alloc,real fraction[2][4][SBLIMIT],int *scale,struct frame *fr,int x1)
|
||||
{
|
||||
|
||||
int i,j,k,ba;
|
||||
int stereo = fr->stereo;
|
||||
int sblimit = fr->II_sblimit;
|
||||
int jsbound = fr->jsbound;
|
||||
const struct al_table *alloc2,*alloc1 = fr->alloc;
|
||||
unsigned int *bita=bit_alloc;
|
||||
int d1,step;
|
||||
|
||||
for (i=0;i<jsbound;i++,alloc1+=(1<<step))
|
||||
{
|
||||
step = alloc1->bits;
|
||||
for (j=0;j<stereo;j++)
|
||||
{
|
||||
if ( (ba=*bita++) )
|
||||
{
|
||||
k=(alloc2 = alloc1+ba)->bits;
|
||||
if( (d1=alloc2->d) < 0)
|
||||
{
|
||||
real cm=psd->muls[k][scale[x1]];
|
||||
fraction[j][0][i] = ((real) ((int)getbits(psd, k) + d1)) * cm;
|
||||
fraction[j][1][i] = ((real) ((int)getbits(psd, k) + d1)) * cm;
|
||||
fraction[j][2][i] = ((real) ((int)getbits(psd, k) + d1)) * cm;
|
||||
}
|
||||
else
|
||||
{
|
||||
int *table[10];
|
||||
|
||||
unsigned int idx,*tab,m=scale[x1];
|
||||
|
||||
memset(table, 0, sizeof(NULL));
|
||||
|
||||
table[3] = psd->grp_3tab;
|
||||
table[5] = psd->grp_5tab;
|
||||
table[9] = psd->grp_9tab;
|
||||
|
||||
idx = (unsigned int) getbits(psd, k);
|
||||
tab = (unsigned int *) (table[d1] + idx + idx + idx);
|
||||
fraction[j][0][i] = psd->muls[*tab++][m];
|
||||
fraction[j][1][i] = psd->muls[*tab++][m];
|
||||
fraction[j][2][i] = psd->muls[*tab][m];
|
||||
}
|
||||
scale+=3;
|
||||
}
|
||||
else
|
||||
fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=jsbound;i<sblimit;i++,alloc1+=(1<<step))
|
||||
{
|
||||
step = alloc1->bits;
|
||||
bita++; /* channel 1 and channel 2 bitalloc are the same */
|
||||
if ( (ba=*bita++) )
|
||||
{
|
||||
k=(alloc2 = alloc1+ba)->bits;
|
||||
if( (d1=alloc2->d) < 0)
|
||||
{
|
||||
real cm;
|
||||
cm=psd->muls[k][scale[x1+3]];
|
||||
fraction[1][0][i] = (fraction[0][0][i] = (real) ((int)getbits(psd, k) + d1) ) * cm;
|
||||
fraction[1][1][i] = (fraction[0][1][i] = (real) ((int)getbits(psd, k) + d1) ) * cm;
|
||||
fraction[1][2][i] = (fraction[0][2][i] = (real) ((int)getbits(psd, k) + d1) ) * cm;
|
||||
cm=psd->muls[k][scale[x1]];
|
||||
fraction[0][0][i] *= cm; fraction[0][1][i] *= cm; fraction[0][2][i] *= cm;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
int *table[10];
|
||||
unsigned int idx,*tab,m1,m2;
|
||||
memset(table, 0, sizeof(NULL));
|
||||
|
||||
table[3] = psd->grp_3tab;
|
||||
table[5] = psd->grp_5tab;
|
||||
table[9] = psd->grp_9tab;
|
||||
|
||||
m1 = scale[x1]; m2 = scale[x1+3];
|
||||
idx = (unsigned int) getbits(psd, k);
|
||||
tab = (unsigned int *) (table[d1] + idx + idx + idx);
|
||||
fraction[0][0][i] = psd->muls[*tab][m1]; fraction[1][0][i] = psd->muls[*tab++][m2];
|
||||
fraction[0][1][i] = psd->muls[*tab][m1]; fraction[1][1][i] = psd->muls[*tab++][m2];
|
||||
fraction[0][2][i] = psd->muls[*tab][m1]; fraction[1][2][i] = psd->muls[*tab][m2];
|
||||
}
|
||||
scale+=6;
|
||||
}
|
||||
else {
|
||||
fraction[0][0][i] = fraction[0][1][i] = fraction[0][2][i] =
|
||||
fraction[1][0][i] = fraction[1][1][i] = fraction[1][2][i] = 0.0;
|
||||
}
|
||||
/*
|
||||
should we use individual scalefac for channel 2 or
|
||||
is the current way the right one , where we just copy channel 1 to
|
||||
channel 2 ??
|
||||
The current 'strange' thing is, that we throw away the scalefac
|
||||
values for the second channel ...!!
|
||||
-> changed .. now we use the scalefac values of channel one !!
|
||||
*/
|
||||
}
|
||||
|
||||
// if(sblimit > (fr->down_sample_sblimit) )
|
||||
// sblimit = fr->down_sample_sblimit;
|
||||
|
||||
if(sblimit > (fr->II_sblimit) )
|
||||
sblimit = fr->II_sblimit;
|
||||
|
||||
for(i=sblimit;i<SBLIMIT;i++)
|
||||
for (j=0;j<stereo;j++)
|
||||
fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 0.0;
|
||||
|
||||
}
|
||||
|
||||
void II_select_table(struct frame *fr)
|
||||
{
|
||||
const int translate[3][2][16] =
|
||||
{ { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } ,
|
||||
{ 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } ,
|
||||
{ { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } ,
|
||||
{ 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } ,
|
||||
{ { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } ,
|
||||
{ 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } };
|
||||
|
||||
int table,sblim;
|
||||
const struct al_table *tables[5] =
|
||||
{ alloc_0, alloc_1, alloc_2, alloc_3 , alloc_4 };
|
||||
const int sblims[5] = { 27 , 30 , 8, 12 , 30 };
|
||||
|
||||
if(fr->lsf)
|
||||
table = 4;
|
||||
else
|
||||
table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index];
|
||||
|
||||
sblim = sblims[table];
|
||||
|
||||
fr->alloc = tables[table];
|
||||
fr->II_sblimit = sblim;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int do_layer2(struct StaticData * psd, struct mpstr * gmp, struct frame *fr,unsigned char *pcm_sample,int *pcm_point)
|
||||
{
|
||||
int clip=0;
|
||||
int i,j;
|
||||
int stereo = fr->stereo;
|
||||
real fraction[2][4][SBLIMIT]; /* pick_table clears unused subbands */
|
||||
unsigned int bit_alloc[64];
|
||||
int scale[192];
|
||||
int single = fr->single;
|
||||
|
||||
II_select_table(fr);
|
||||
fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
|
||||
(fr->mode_ext<<2)+4 : fr->II_sblimit;
|
||||
|
||||
if(stereo == 1 || single == 3)
|
||||
single = 0;
|
||||
|
||||
II_step_one(psd, bit_alloc, scale, fr);
|
||||
|
||||
for (i=0;i<SCALE_BLOCK;i++)
|
||||
{
|
||||
II_step_two(psd, bit_alloc,fraction,scale,fr,i>>2);
|
||||
for (j=0;j<3;j++)
|
||||
{
|
||||
if(single >= 0)
|
||||
{
|
||||
clip += synth_1to1_mono(psd, gmp, fraction[single][j],pcm_sample,pcm_point);
|
||||
}
|
||||
else {
|
||||
int p1 = *pcm_point;
|
||||
clip += synth_1to1(psd, gmp, fraction[0][j],0,pcm_sample,&p1);
|
||||
clip += synth_1to1(psd, gmp, fraction[1][j],1,pcm_sample,pcm_point);
|
||||
}
|
||||
}
|
||||
}
|
||||
return clip;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,253 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/signal.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
//#ifdef _WIN32
|
||||
# undef WIN32
|
||||
# define WIN32
|
||||
|
||||
# define M_PI 3.14159265358979323846
|
||||
# define M_SQRT2 1.41421356237309504880
|
||||
# define REAL_IS_FLOAT
|
||||
# define NEW_DCT9
|
||||
|
||||
# define random rand
|
||||
# define srandom srand
|
||||
|
||||
//#endif
|
||||
|
||||
#ifdef REAL_IS_FLOAT
|
||||
# define real float
|
||||
#elif defined(REAL_IS_LONG_DOUBLE)
|
||||
# define real long double
|
||||
#else
|
||||
# define real double
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define INLINE inline
|
||||
#else
|
||||
#define INLINE
|
||||
#endif
|
||||
|
||||
/* AUDIOBUFSIZE = n*64 with n=1,2,3 ... */
|
||||
#define AUDIOBUFSIZE 16384
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#define SBLIMIT 32
|
||||
#define SSLIMIT 18
|
||||
|
||||
#define SCALE_BLOCK 12 /* Layer 2 */
|
||||
|
||||
#define MPG_MD_STEREO 0
|
||||
#define MPG_MD_JOINT_STEREO 1
|
||||
#define MPG_MD_DUAL_CHANNEL 2
|
||||
#define MPG_MD_MONO 3
|
||||
|
||||
#define MAXFRAMESIZE 1792
|
||||
|
||||
|
||||
/* Pre Shift fo 16 to 8 bit converter table */
|
||||
#define AUSHIFT (3)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct StaticData {
|
||||
|
||||
//layer3
|
||||
real ispow[8207];
|
||||
real aa_ca[8],aa_cs[8];
|
||||
real COS1[12][6];
|
||||
real win[4][36];
|
||||
real win1[4][36];
|
||||
real gainpow2[256+118+4];
|
||||
real COS9[9];
|
||||
real COS6_1,COS6_2;
|
||||
real tfcos36[9];
|
||||
real tfcos12[3];
|
||||
|
||||
int mapbuf0[9][152];
|
||||
int mapbuf1[9][156];
|
||||
int mapbuf2[9][44];
|
||||
int *map[9][3];
|
||||
int *mapend[9][3];
|
||||
|
||||
unsigned int n_slen2[512];
|
||||
unsigned int i_slen2[256];
|
||||
|
||||
real tan1_1[16],tan2_1[16],tan1_2[16],tan2_2[16];
|
||||
real pow1_1[2][16],pow2_1[2][16],pow1_2[2][16],pow2_2[2][16];
|
||||
|
||||
int longLimit[9][23];
|
||||
int shortLimit[9][14];
|
||||
|
||||
real hybridIn[2][SBLIMIT][SSLIMIT];
|
||||
real hybridOut[2][SSLIMIT][SBLIMIT];
|
||||
|
||||
//common
|
||||
int bitindex;
|
||||
unsigned char *wordpointer;
|
||||
|
||||
//decode_i386
|
||||
real buffs[2][2][0x110];
|
||||
int bo;
|
||||
|
||||
//layer2
|
||||
int grp_3tab[32 * 3]; /* used: 27 */
|
||||
int grp_5tab[128 * 3]; /* used: 125 */
|
||||
int grp_9tab[1024 * 3]; /* used: 729 */
|
||||
|
||||
real muls[27][64]; /* also used by layer 1 */
|
||||
unsigned int scfsi_buf[64];
|
||||
|
||||
//tabinit
|
||||
real decwin[512+32];
|
||||
real cos64[16],cos32[8],cos16[4],cos8[2],cos4[1];
|
||||
real *pnts[5];
|
||||
};
|
||||
|
||||
/*
|
||||
* the ith entry determines the seek point for
|
||||
* i-percent duration
|
||||
* seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes
|
||||
* e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes
|
||||
*/
|
||||
|
||||
|
||||
#define FRAMES_FLAG 0x0001
|
||||
#define BYTES_FLAG 0x0002
|
||||
#define TOC_FLAG 0x0004
|
||||
#define VBR_SCALE_FLAG 0x0008
|
||||
|
||||
#define NUMTOCENTRIES 100
|
||||
|
||||
#define FRAMES_AND_BYTES (FRAMES_FLAG | BYTES_FLAG)
|
||||
|
||||
const static char VBRTag[]={"Xing"};
|
||||
|
||||
/*structure to receive extracted header */
|
||||
/* toc may be NULL*/
|
||||
typedef struct
|
||||
{
|
||||
int h_id; /* from MPEG header, 0=MPEG2, 1=MPEG1 */
|
||||
int samprate; /* determined from MPEG header */
|
||||
int flags; /* from Vbr header data */
|
||||
int frames; /* total bit stream frames from Vbr header data */
|
||||
int bytes; /* total bit stream bytes from Vbr header data*/
|
||||
int vbr_scale; /* encoded vbr scale from Vbr header data*/
|
||||
unsigned char toc[NUMTOCENTRIES]; /* may be NULL if toc not desired*/
|
||||
} VBRTAGDATA;
|
||||
/*
|
||||
// 4 bytes for Header Tag
|
||||
// 4 bytes for Header Flags
|
||||
// 100 bytes for entry (NUMTOCENTRIES)
|
||||
// 4 bytes for FRAME SIZE
|
||||
// 4 bytes for STREAM_SIZE
|
||||
// 4 bytes for VBR SCALE. a VBR quality indicator: 0=best 100=worst
|
||||
// 20 bytes for LAME tag. for example, "LAME3.12 (beta 6)"
|
||||
// ___________
|
||||
// 140 bytes
|
||||
*/
|
||||
|
||||
#define VBRHEADERSIZE (NUMTOCENTRIES+4+4+4+4+4)
|
||||
|
||||
int GetVbrTag(VBRTAGDATA *pTagData, unsigned char *buf);
|
||||
|
||||
struct frame {
|
||||
int stereo;
|
||||
int jsbound;
|
||||
int single;
|
||||
int lsf;
|
||||
int mpeg25;
|
||||
int header_change;
|
||||
int lay;
|
||||
int error_protection;
|
||||
int bitrate_index;
|
||||
int sampling_frequency;
|
||||
int padding;
|
||||
int extension;
|
||||
int mode;
|
||||
int mode_ext;
|
||||
int copyright;
|
||||
int original;
|
||||
int emphasis;
|
||||
int framesize; /* computed framesize */
|
||||
int II_sblimit; /* Layer 2 */
|
||||
const struct al_table *alloc; /* Layer 2 */
|
||||
int (*do_layer)(struct StaticData * psd, struct mpstr * gmp, struct frame *fr, unsigned char *pcm_sample, int *pcm_point);/* Layer 2 */
|
||||
};
|
||||
|
||||
/* extern unsigned int get1bit(void);*/
|
||||
extern unsigned int getbits(struct StaticData * psd, int);
|
||||
extern unsigned int getbits_fast(struct StaticData * psd, int);
|
||||
extern int set_pointer(struct StaticData * psd, struct mpstr * gmp, long backstep);
|
||||
|
||||
extern int do_layer3(struct StaticData * psd, struct mpstr * gmp, struct frame *fr, unsigned char *pcm_sample, int *pcm_point);
|
||||
extern int do_layer2(struct StaticData * psd, struct mpstr * gmp, struct frame *fr,unsigned char *,int *);
|
||||
|
||||
extern int head_check(unsigned long head);
|
||||
extern int ExtractI4(unsigned char *buf);
|
||||
extern int decode_header(struct mpstr *mp, struct frame *fr,unsigned long newhead);
|
||||
|
||||
struct gr_info_s {
|
||||
int scfsi;
|
||||
unsigned part2_3_length;
|
||||
unsigned big_values;
|
||||
unsigned scalefac_compress;
|
||||
unsigned block_type;
|
||||
unsigned mixed_block_flag;
|
||||
unsigned table_select[3];
|
||||
unsigned subblock_gain[3];
|
||||
unsigned maxband[3];
|
||||
unsigned maxbandl;
|
||||
unsigned maxb;
|
||||
unsigned region1start;
|
||||
unsigned region2start;
|
||||
unsigned preflag;
|
||||
unsigned scalefac_scale;
|
||||
unsigned count1table_select;
|
||||
real *full_gain[3];
|
||||
real *pow2gain;
|
||||
};
|
||||
|
||||
struct III_sideinfo
|
||||
{
|
||||
unsigned main_data_begin;
|
||||
unsigned private_bits;
|
||||
struct {
|
||||
struct gr_info_s gr[2];
|
||||
} ch[2];
|
||||
};
|
||||
|
||||
extern int synth_1to1 (struct StaticData * psd, struct mpstr * gmp, real *bandPtr,int channel,unsigned char *out,int *pnt);
|
||||
extern int tsynth_1to1 (struct StaticData * psd, real *,int,unsigned char *,int *);
|
||||
extern int synth_1to1_mono (struct StaticData * psd, struct mpstr * gmp, real *,unsigned char *,int *);
|
||||
|
||||
extern void init_layer3(struct StaticData * psd, int);
|
||||
extern void init_layer2(struct StaticData * psd);
|
||||
extern void make_decode_tables(struct StaticData * psd, long scaleval);
|
||||
extern void dct64(struct StaticData * psd, real *,real *,real *);
|
||||
|
||||
const extern long freqs[9];
|
||||
|
||||
/* Preserves exiting */
|
||||
|
||||
#define BE_QUIET
|
||||
|
||||
/* Windows debugging message */
|
||||
void MessageI(int i);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,63 +0,0 @@
|
|||
struct buf {
|
||||
unsigned char *pnt;
|
||||
long size;
|
||||
long pos;
|
||||
struct buf *next;
|
||||
struct buf *prev;
|
||||
};
|
||||
|
||||
struct framebuf {
|
||||
struct buf *buf;
|
||||
long pos;
|
||||
struct frame *next;
|
||||
struct frame *prev;
|
||||
};
|
||||
|
||||
struct mpstr {
|
||||
struct buf *head,*tail;
|
||||
int bsize;
|
||||
int framesize;
|
||||
int fsizeold;
|
||||
struct frame fr;
|
||||
unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */
|
||||
real hybrid_block[2][2][SBLIMIT*SSLIMIT];
|
||||
int hybrid_blc[2];
|
||||
unsigned long header;
|
||||
int bsnum;
|
||||
real synth_buffs[2][2][0x110];
|
||||
int synth_bo;
|
||||
struct StaticData psd;
|
||||
long ndatabegin;
|
||||
};
|
||||
|
||||
|
||||
#define MP3_ERR -1
|
||||
#define MP3_OK 0
|
||||
#define MP3_NEED_MORE 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int InitMP3(struct mpstr *mp);
|
||||
int decodeMP3(struct mpstr *mp,char *inmemory,int inmemsize,
|
||||
char *outmemory,int outmemsize,int *done);
|
||||
void ExitMP3(struct mpstr *mp);
|
||||
double compute_bpf(struct frame *fr);
|
||||
double compute_tpf(struct frame *fr);
|
||||
int GetVbrTag(VBRTAGDATA *pTagData, unsigned char *buf);
|
||||
int SeekPoint(unsigned char TOC[NUMTOCENTRIES], int file_bytes, double percent);
|
||||
/*
|
||||
__declspec(dllexport) int InitMP3(struct mpstr *mp);
|
||||
__declspec(dllexport) int decodeMP3(struct mpstr *mp,char *inmemory,int inmemsize,
|
||||
char *outmemory,int outmemsize,int *done);
|
||||
__declspec(dllexport) void ExitMP3(struct mpstr *mp);
|
||||
__declspec(dllexport) double compute_bpf(struct frame *fr);
|
||||
__declspec(dllexport) double compute_tpf(struct frame *fr);
|
||||
__declspec(dllexport) int GetVbrTag(VBRTAGDATA *pTagData, unsigned char *buf);
|
||||
__declspec(dllexport) int SeekPoint(unsigned char TOC[NUMTOCENTRIES], int file_bytes, double percent);
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,70 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "mpg123.h"
|
||||
|
||||
const long intwinbase[] = {
|
||||
0, -1, -1, -1, -1, -1, -1, -2, -2, -2,
|
||||
-2, -3, -3, -4, -4, -5, -5, -6, -7, -7,
|
||||
-8, -9, -10, -11, -13, -14, -16, -17, -19, -21,
|
||||
-24, -26, -29, -31, -35, -38, -41, -45, -49, -53,
|
||||
-58, -63, -68, -73, -79, -85, -91, -97, -104, -111,
|
||||
-117, -125, -132, -139, -147, -154, -161, -169, -176, -183,
|
||||
-190, -196, -202, -208, -213, -218, -222, -225, -227, -228,
|
||||
-228, -227, -224, -221, -215, -208, -200, -189, -177, -163,
|
||||
-146, -127, -106, -83, -57, -29, 2, 36, 72, 111,
|
||||
153, 197, 244, 294, 347, 401, 459, 519, 581, 645,
|
||||
711, 779, 848, 919, 991, 1064, 1137, 1210, 1283, 1356,
|
||||
1428, 1498, 1567, 1634, 1698, 1759, 1817, 1870, 1919, 1962,
|
||||
2001, 2032, 2057, 2075, 2085, 2087, 2080, 2063, 2037, 2000,
|
||||
1952, 1893, 1822, 1739, 1644, 1535, 1414, 1280, 1131, 970,
|
||||
794, 605, 402, 185, -45, -288, -545, -814, -1095, -1388,
|
||||
-1692, -2006, -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788,
|
||||
-5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597, -7910, -8209,
|
||||
-8491, -8755, -8998, -9219, -9416, -9585, -9727, -9838, -9916, -9959,
|
||||
-9966, -9935, -9863, -9750, -9592, -9389, -9139, -8840, -8492, -8092,
|
||||
-7640, -7134, -6574, -5959, -5288, -4561, -3776, -2935, -2037, -1082,
|
||||
-70, 998, 2122, 3300, 4533, 5818, 7154, 8540, 9975, 11455,
|
||||
12980, 14548, 16155, 17799, 19478, 21189, 22929, 24694, 26482, 28289,
|
||||
30112, 31947, 33791, 35640, 37489, 39336, 41176, 43006, 44821, 46617,
|
||||
48390, 50137, 51853, 53534, 55178, 56778, 58333, 59838, 61289, 62684,
|
||||
64019, 65290, 66494, 67629, 68692, 69679, 70590, 71420, 72169, 72835,
|
||||
73415, 73908, 74313, 74630, 74856, 74992, 75038 };
|
||||
|
||||
void make_decode_tables(struct StaticData * psd, long scaleval)
|
||||
{
|
||||
int i,j,k,kr,divv;
|
||||
|
||||
real *table,*costab;
|
||||
|
||||
|
||||
for(i=0;i<5;i++)
|
||||
{
|
||||
kr=0x10>>i; divv=0x40>>i;
|
||||
costab = psd->pnts[i];
|
||||
for(k=0;k<kr;k++)
|
||||
costab[k] = 1.0 / (2.0 * cos(M_PI * ((double) k * 2.0 + 1.0) / (double) divv));
|
||||
}
|
||||
|
||||
table = psd->decwin;
|
||||
scaleval = -scaleval;
|
||||
for(i=0,j=0;i<256;i++,j++,table+=32)
|
||||
{
|
||||
if(table < psd->decwin+512+16)
|
||||
table[16] = table[0] = (double) intwinbase[j] / 65536.0 * (double) scaleval;
|
||||
if(i % 32 == 31)
|
||||
table -= 1023;
|
||||
if(i % 64 == 63)
|
||||
scaleval = - scaleval;
|
||||
}
|
||||
|
||||
for( /* i=256 */ ;i<512;i++,j--,table+=32)
|
||||
{
|
||||
if(table < psd->decwin+512+16)
|
||||
table[16] = table[0] = (double) intwinbase[j] / 65536.0 * (double) scaleval;
|
||||
if(i % 32 == 31)
|
||||
table -= 1023;
|
||||
if(i % 64 == 63)
|
||||
scaleval = - scaleval;
|
||||
}
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ static int32 seq_handle; seq_handle=list_add(snd_sequences);
|
|||
static snd_sequence_struct *seq; seq=(snd_sequence_struct*)list_get(snd_sequences,seq_handle);
|
||||
memset(seq,0,sizeof(snd_sequence_struct));
|
||||
seq->references=1;
|
||||
seq->data=(uint8*)sample_buffer;
|
||||
seq->data=(uint16*)sample_buffer;
|
||||
seq->data_size=bytes_out;
|
||||
seq->channels=info.channels;
|
||||
seq->endian=0;//native
|
||||
|
|
|
@ -36,7 +36,7 @@ snd_sequence_struct *snd_decode_ogg(uint8 *buffer,int32 bytes){
|
|||
seq->bits_per_sample=16;
|
||||
seq->endian=0;//native
|
||||
seq->is_unsigned=0;
|
||||
seq->data=(uint8*)out;
|
||||
seq->data=(uint16*)out;
|
||||
seq->data_size=result*2*channels;
|
||||
|
||||
|
||||
|
|
|
@ -39,44 +39,8 @@ int32 func__sndopen(qbs* filename,qbs* requirements,int32 passed){
|
|||
|
||||
static qbs *s1=NULL;
|
||||
if (!s1) s1=qbs_new(0,0);
|
||||
static qbs *req=NULL;
|
||||
if (!req) req=qbs_new(0,0);
|
||||
static qbs *s3=NULL;
|
||||
if (!s3) s3=qbs_new(0,0);
|
||||
|
||||
static uint8 r[32];
|
||||
static int32 i,i2,i3;
|
||||
//check requirements
|
||||
memset(r,0,32);
|
||||
if (passed){
|
||||
if (requirements->len){
|
||||
i=1;
|
||||
qbs_set(req,qbs_ucase(requirements));//convert tmp str to perm str
|
||||
nextrequirement:
|
||||
i2=func_instr(i,req,qbs_new_txt(","),1);
|
||||
if (i2){
|
||||
qbs_set(s1,func_mid(req,i,i2-i,1));
|
||||
}else{
|
||||
qbs_set(s1,func_mid(req,i,req->len-i+1,1));
|
||||
}
|
||||
qbs_set(s1,qbs_rtrim(qbs_ltrim(s1)));
|
||||
if (qbs_equal(s1,qbs_new_txt("SYNC"))){r[0]++; goto valid;}
|
||||
if (qbs_equal(s1,qbs_new_txt("VOL"))){r[1]++; goto valid;}
|
||||
if (qbs_equal(s1,qbs_new_txt("PAUSE"))){r[2]++; goto valid;}
|
||||
if (qbs_equal(s1,qbs_new_txt("LEN"))){r[3]++; goto valid;}
|
||||
if (qbs_equal(s1,qbs_new_txt("SETPOS"))){r[4]++; goto valid;}
|
||||
error(5); return 0;//invalid requirements
|
||||
valid:
|
||||
if (i2){i=i2+1; goto nextrequirement;}
|
||||
for (i=0;i<32;i++) if (r[i]>1){error(5); return 0;}//cannot define requirements twice
|
||||
}//->len
|
||||
}//passed
|
||||
qbs_set(s1,qbs_add(filename,qbs_new_txt_len("\0",1)));//s1=filename+CHR$(0)
|
||||
|
||||
if (!r[0]){//NOT SYNC
|
||||
if (snd_stream_handle){error(5); return 0;}//stream in use
|
||||
}
|
||||
|
||||
//load file
|
||||
if (s1->len==1) return 0;//return invalid handle if null length string
|
||||
static int32 fh,result;
|
||||
|
@ -143,7 +107,7 @@ got_seq:
|
|||
if (bps!=2){
|
||||
new_data=(uint8*)malloc(samples*2);
|
||||
}else{
|
||||
new_data=seq->data;
|
||||
new_data=(uint8*)seq->data;
|
||||
}
|
||||
static int32 i,v;
|
||||
for (i=0;i<samples;i++){
|
||||
|
@ -169,7 +133,7 @@ got_seq:
|
|||
//place new value into array
|
||||
((int16*)new_data)[i]=v;
|
||||
}//i
|
||||
if (bps!=2){free(seq->data); seq->data=new_data; seq->data_size=samples*2;}
|
||||
if (bps!=2){free(seq->data); seq->data=(uint16*)new_data; seq->data_size=samples*2;}
|
||||
//update seq info
|
||||
seq->bits_per_sample=16;
|
||||
seq->is_unsigned=0;
|
||||
|
@ -215,7 +179,7 @@ got_seq:
|
|||
//establish real size of new data and update seq
|
||||
free(seq->data); //That was the old data
|
||||
seq->data_size = out_len * seq->channels * 2; //remember out_len is perchannel, and each sample is 2 bytes
|
||||
seq->data = (uint8_t *)realloc(resampled, seq->data_size); //we overestimated the array size before, so make it the correct size now
|
||||
seq->data = (uint16_t *)realloc(resampled, seq->data_size); //we overestimated the array size before, so make it the correct size now
|
||||
if (!seq->data) { //realloc could fail
|
||||
free(resampled);
|
||||
return 0;
|
||||
|
@ -223,15 +187,38 @@ got_seq:
|
|||
seq->sample_rate = snd_frequency;
|
||||
}
|
||||
|
||||
if (seq->channels==1){
|
||||
seq->data_mono=seq->data;
|
||||
seq->data_mono_size=seq->data_size;
|
||||
//Unpack stereo data into separate left/right buffers
|
||||
if (seq->channels == 1) {
|
||||
seq->channels = 1;
|
||||
seq->data_left = seq->data;
|
||||
seq->data_left_size = seq->data_size;
|
||||
seq->data_right = NULL;
|
||||
seq->data_right_size = 0;
|
||||
}
|
||||
if (seq->channels==2){
|
||||
seq->data_stereo=seq->data;
|
||||
seq->data_stereo_size=seq->data_size;
|
||||
else if (seq->channels == 2) {
|
||||
seq->data_left_size = seq->data_right_size = seq->data_size / 2;
|
||||
seq->data_left = (uint16_t *)malloc(seq->data_size / 2);
|
||||
if (!seq->data_left) {
|
||||
free(seq->data);
|
||||
return 0;
|
||||
}
|
||||
seq->data_right = (uint16_t *)malloc(seq->data_size / 2);
|
||||
if (!seq->data_right) {
|
||||
free(seq->data_left);
|
||||
free(seq->data);
|
||||
return 0;
|
||||
}
|
||||
for (int sample = 0; sample < seq->data_size / 4; sample++) {
|
||||
seq->data_left[sample] = seq->data[sample * 2];
|
||||
seq->data_right[sample] = seq->data[sample * 2 + 1];
|
||||
}
|
||||
free(seq->data);
|
||||
seq->data = NULL;
|
||||
}
|
||||
if (seq->channels>2) return 0;
|
||||
else {
|
||||
free(seq->data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//attach sequence to handle (& inc. refs)
|
||||
//create snd handle
|
||||
|
@ -242,12 +229,18 @@ got_seq:
|
|||
snd->type=2;
|
||||
snd->seq=seq;
|
||||
snd->volume=1.0;
|
||||
snd->capability=r[0]*SND_CAPABILITY_SYNC+r[1]*SND_CAPABILITY_VOL+r[2]*SND_CAPABILITY_PAUSE+r[3]*SND_CAPABILITY_LEN+r[4]*SND_CAPABILITY_SETPOS;
|
||||
if (!r[0]){
|
||||
snd->streamed=1;//NOT SYNC
|
||||
snd_stream_handle=handle;
|
||||
}
|
||||
|
||||
if (seq->channels == 1) {
|
||||
snd->bal_left_x = snd->bal_left_y = snd->bal_left_z = 0;
|
||||
}
|
||||
else if (seq->channels == 2) {
|
||||
snd->bal_left_x = -1;
|
||||
snd->bal_left_y = snd->bal_left_z = 0;
|
||||
snd->bal_right_x = 1;
|
||||
snd->bal_right_y = snd->bal_right_z = 0;
|
||||
}
|
||||
snd->bal_update = 1;
|
||||
sndupdate(snd);
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ seq->sample_rate=*(uint32*)&buffer[24];
|
|||
seq->bits_per_sample=*(uint16*)&buffer[34];
|
||||
seq->endian=1;//little (Microsoft format)
|
||||
seq->is_unsigned=0; if (seq->bits_per_sample==8) seq->is_unsigned=1;
|
||||
seq->data=(uint8*)bufout;
|
||||
seq->data=(uint16*)bufout;
|
||||
seq->data_size=out_bytes;
|
||||
|
||||
//qbs_print(qbs_str((int32)seq->channels),1);
|
||||
|
@ -62,4 +62,4 @@ return seq;
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -514,7 +514,7 @@ extern void sub__sndlimit(int32 handle,double limit);
|
|||
extern void sub__sndstop(int32 handle);
|
||||
extern void sub__sndsetpos(int32 handle,double sec);
|
||||
extern double func__sndgetpos(int32 handle);
|
||||
extern void sub__sndbal(int32 handle,double x,double y,double z,int32 passed);
|
||||
extern void sub__sndbal(int32 handle,double x, double y, double z, int32 channel, int32 passed);
|
||||
extern void sub__sndplay(int32 handle);
|
||||
extern void sub__sndloop(int32 handle);
|
||||
extern int32 func__sndcopy(int32 handle);
|
||||
|
|
|
@ -11817,14 +11817,6 @@ END IF
|
|||
IF DEPENDENCY(DEPENDENCY_AUDIO_DECODE) THEN
|
||||
'General decoder
|
||||
defines$ = defines$ + defines_header$ + "DEPENDENCY_AUDIO_DECODE"
|
||||
'MP3 decoder (deprecated)
|
||||
d1$ = "parts\audio\decode\mp3"
|
||||
d2$ = d1$ + "\os\" + o$
|
||||
d3$ = "internal\c\" + d2$
|
||||
IF _FILEEXISTS(d3$ + "\src.a") = 0 THEN 'rebuild?
|
||||
Build d3$
|
||||
END IF
|
||||
libs$ = libs$ + " " + d2$ + "\src.a"
|
||||
'MINI_MP3 decoder
|
||||
d1$ = "parts\audio\decode\mp3_mini"
|
||||
d2$ = d1$ + "\os\" + o$
|
||||
|
|
|
@ -1725,9 +1725,9 @@ clearid
|
|||
id.n = "_SNDBAL": id.Dependency = DEPENDENCY_AUDIO_OUT
|
||||
id.subfunc = 2
|
||||
id.callname = "sub__sndbal"
|
||||
id.args = 4
|
||||
id.arg = MKL$(ULONGTYPE - ISPOINTER) + MKL$(FLOATTYPE - ISPOINTER) + MKL$(FLOATTYPE - ISPOINTER) + MKL$(FLOATTYPE - ISPOINTER)
|
||||
id.specialformat = "?,[?][,[?][,[?]]]"
|
||||
id.args = 5
|
||||
id.arg = MKL$(ULONGTYPE - ISPOINTER) + MKL$(FLOATTYPE - ISPOINTER) + MKL$(FLOATTYPE - ISPOINTER) + MKL$(FLOATTYPE - ISPOINTER) + MKL$(ULONGTYPE - ISPOINTER)
|
||||
id.specialformat = "?,[?][,[?][,[?][,[?]]]]"
|
||||
id.NoCloud = 1
|
||||
regid
|
||||
|
||||
|
|
Loading…
Reference in a new issue