mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-24 06:35:41 +00:00
219 lines
6.9 KiB
C
219 lines
6.9 KiB
C
/**
|
|
** Supermodel
|
|
** A Sega Model 3 Arcade Emulator.
|
|
** Copyright 2011 Bart Trzynadlowski, Nik Henson
|
|
**
|
|
** This file is part of Supermodel.
|
|
**
|
|
** Supermodel is free software: you can redistribute it and/or modify it under
|
|
** the terms of the GNU General Public License as published by the Free
|
|
** Software Foundation, either version 3 of the License, or (at your option)
|
|
** any later version.
|
|
**
|
|
** Supermodel 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 General Public License for
|
|
** more details.
|
|
**
|
|
** You should have received a copy of the GNU General Public License along
|
|
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
|
|
**/
|
|
|
|
/*
|
|
* layer2.h
|
|
*
|
|
* Amp library internal header file.
|
|
*/
|
|
|
|
|
|
/* this file is a part of amp software, (C) tomislav uzelac 1996,1997
|
|
*/
|
|
/* layer2.h
|
|
* Tomislav Uzelac - cca. Feb 1996
|
|
*/
|
|
|
|
|
|
extern int layer2_frame(struct AUDIO_HEADER *header,int cnt);
|
|
|
|
#ifdef LAYER2
|
|
|
|
int layer2_frame(struct AUDIO_HEADER *header,int cnt);
|
|
float requantize_sample(unsigned short s4,unsigned short nlevels,float c,float d,float factor);
|
|
void convert_samplecode(unsigned int samplecode,unsigned int nlevels,unsigned short* sb_sample_buf);
|
|
|
|
char t_nbal0[27]={4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2};
|
|
char t_nbal1[30]={4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2};
|
|
char t_nbal2[8] ={4,4,3,3,3,3,3,3};
|
|
char t_nbal3[12]={4,4,3,3,3,3,3,3,3,3,3,3};
|
|
char t_nbalMPG2[30]={4,4,4,4,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};
|
|
|
|
char t_alloc0[27][16] = { /* table B.2a ISO/IEC 11172-3 */
|
|
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
|
|
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
|
|
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,17},
|
|
{0,1,2,17},
|
|
{0,1,2,17},
|
|
{0,1,2,17}};
|
|
|
|
char t_alloc1[30][16] = { /* table B.2b ISO/IEC 11172-3 */
|
|
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
|
|
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
|
|
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,3,4,5,6,17},
|
|
{0,1,2,17},
|
|
{0,1,2,17},
|
|
{0,1,2,17},
|
|
{0,1,2,17},
|
|
{0,1,2,17},
|
|
{0,1,2,17},
|
|
{0,1,2,17}};
|
|
|
|
char t_alloc2[8][16] = { /* table B.2c ISO/IEC 11172-3 */
|
|
{0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16},
|
|
{0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127}};
|
|
|
|
char t_alloc3[12][16] = { /* table B.2d ISO/IEC 11172-3 */
|
|
{0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16},
|
|
{0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127},
|
|
{0,1,2,4,5,6,7,127}};
|
|
|
|
char t_allocMPG2[30][16] = { /* table B.1. ISO/IEC 13818-3 */
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
|
|
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
|
|
{0,1,2,4,5,6,7,8},
|
|
{0,1,2,4,5,6,7,8},
|
|
{0,1,2,4,5,6,7,8},
|
|
{0,1,2,4,5,6,7,8},
|
|
{0,1,2,4,5,6,7,8},
|
|
{0,1,2,4,5,6,7,8},
|
|
{0,1,2,4,5,6,7,8},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4},
|
|
{0,1,2,4}};
|
|
|
|
double t_scalefactor[64] = {
|
|
2.00000000000000, 1.58740105196820, 1.25992104989487,
|
|
1.00000000000000, 0.79370052598410, 0.62996052494744, 0.50000000000000,
|
|
0.39685026299205, 0.31498026247372, 0.25000000000000, 0.19842513149602,
|
|
0.15749013123686, 0.12500000000000, 0.09921256574801, 0.07874506561843,
|
|
0.06250000000000, 0.04960628287401, 0.03937253280921, 0.03125000000000,
|
|
0.02480314143700, 0.01968626640461, 0.01562500000000, 0.01240157071850,
|
|
0.00984313320230, 0.00781250000000, 0.00620078535925, 0.00492156660115,
|
|
0.00390625000000, 0.00310039267963, 0.00246078330058, 0.00195312500000,
|
|
0.00155019633981, 0.00123039165029, 0.00097656250000, 0.00077509816991,
|
|
0.00061519582514, 0.00048828125000, 0.00038754908495, 0.00030759791257,
|
|
0.00024414062500, 0.00019377454248, 0.00015379895629, 0.00012207031250,
|
|
0.00009688727124, 0.00007689947814, 0.00006103515625, 0.00004844363562,
|
|
0.00003844973907, 0.00003051757813, 0.00002422181781, 0.00001922486954,
|
|
0.00001525878906, 0.00001211090890, 0.00000961243477, 0.00000762939453,
|
|
0.00000605545445, 0.00000480621738, 0.00000381469727, 0.00000302772723,
|
|
0.00000240310869, 0.00000190734863, 0.00000151386361, 0.00000120155435,
|
|
1E-20};
|
|
|
|
double t_c[18] = { 0,
|
|
1.33333333333, 1.60000000000, 1.14285714286,
|
|
1.77777777777, 1.06666666666, 1.03225806452,
|
|
1.01587301587, 1.00787401575, 1.00392156863,
|
|
1.00195694716, 1.00097751711, 1.00048851979,
|
|
1.00024420024, 1.00012208522, 1.00006103888,
|
|
1.00003051851, 1.00001525902 };
|
|
|
|
double t_d[18] = {0,
|
|
0.500000000, 0.500000000, 0.250000000, 0.500000000,
|
|
0.125000000, 0.062500000, 0.031250000, 0.015625000,
|
|
0.007812500, 0.003906250, 0.001953125, 0.0009765625,
|
|
0.00048828125,0.00024414063,0.00012207031,
|
|
0.00006103516,0.00003051758 };
|
|
|
|
float t_dd[18]={ -1.0f, -0.5f, -0.5f, -0.75f, -0.5f, -0.875f, -0.9375f, -0.96875f, -0.984375f,
|
|
-0.992188f, -0.996094f, -0.998047f, -0.999023f, -0.999512f, -0.999756f, -0.999878f, -0.999939f,
|
|
-0.999969f};
|
|
|
|
char t_grouping[18]={0,3,5,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
|
|
|
/*
|
|
int t_nlevels[18] = {0,3,5,7,9,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};
|
|
*/
|
|
int t_nlevels[18] = {0,3,7,7,15,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};
|
|
|
|
|
|
float t_nli[18]={ 0.0f, 0.5f, 0.25f, 0.25f, 0.125f, 0.125f, 0.0625f, 0.03125f, 0.015625f, 0.0078125f, 0.00390625f,
|
|
0.00195313f, 0.000976563f, 0.000488281f, 0.000244141f, 0.00012207f, 6.10352e-05f, 3.05176e-05f};
|
|
|
|
int t_bpc[18] = {0,5,7,3,10,4,5,6,7,8,9,10,11,12,13,14,15,16};
|
|
|
|
#endif /* LAYER2 */
|