📄 mp3enc_psychoacoustic_int.c
字号:
/*
//
// INTEL CORPORATION PROPRIETARY INFORMATION
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Intel Corporation and may not be copied
// or disclosed except in accordance with the terms of that agreement.
// Copyright(c) 2003-2006 Intel Corporation. All Rights Reserved.
//
// Intel Integrated Performance Primitives AAC Encode Sample for Windows*
//
// By downloading and installing this sample, you hereby agree that the
// accompanying Materials are being provided to you under the terms and
// conditions of the End User License Agreement for the Intel Integrated
// Performance Primitives product previously accepted by you. Please refer
// to the file ippEULA.rtf or ippEULA.txt located in the root directory of your Intel IPP
// product installation for more information.
//
// MPEG-4 and AAC are international standards promoted by ISO, IEC, ITU, ETSI
// and other organizations. Implementations of these standards, or the standard
// enabled platforms may require licenses from various entities, including
// Intel Corporation.
//
*/
#include "mp3enc_own_int.h"
#define N_SHORT 256
#define N_LONG 1024
/****************************************************************************/
typedef struct _ptbl_s {
Ipp16s numlines;
Ipp32s qthr;
Ipp32s SNR;
Ipp16s bval;
} ptbl_s;
typedef struct _p2sb {
Ipp32s bu;
Ipp32s bo;
Ipp32s w1;
Ipp32s w2;
} p2sb;
static const p2sb mp3ienc_p2sb_l[3][SBBND_L] = {
{ /* freq = 44100 */
{ 0, 4, 536870911, 30064771},
{ 4, 7, 506806143, 328028127},
{ 7, 11, 208842783, 89657439},
{11, 14, 447213471, 387620799},
{14, 17, 149250111, 74625055},
{17, 18, 462245855, 492310623},
{18, 21, 44560283, 312995743},
{21, 24, 223875167, 134217727},
{24, 27, 402653183, 432181087},
{27, 30, 104152959, 308163903},
{30, 33, 228707007, 288299679},
{33, 36, 248571231, 439697279},
{36, 40, 96636767, 53687091},
{40, 43, 483183807, 251255583},
{43, 46, 285615327, 334470591},
{46, 49, 201863455, 241591903},
{49, 52, 295279007, 296352735},
{52, 55, 240518175, 216358975},
{55, 57, 320511935, 345207999},
{57, 59, 191662911, 387620799},
{59, 61, 149250111, 515396063},
},
{ /* freq = 48000 */
{ 0, 4, 536870911, 30064771},
{ 4, 7, 506806143, 328028127},
{ 7, 11, 208842783, 89657439},
{11, 14, 447213471, 387620799},
{14, 17, 149250111, 343060511},
{17, 19, 193810399, 223875167},
{19, 22, 312995743, 44560283},
{22, 24, 492310623, 402653183},
{24, 27, 134217727, 223875167},
{27, 30, 312995743, 347892351},
{30, 33, 188978559, 328028127},
{33, 36, 208842783, 335544319},
{36, 40, 201326591, 77309407},
{40, 43, 459561503, 208842783},
{43, 46, 328028127, 85899343},
{46, 49, 450971551, 116500983},
{49, 52, 420369919, 98784247},
{52, 54, 438086655, 475667615},
{54, 57, 61203283, 168040591},
{57, 59, 368830303, 242665647},
{59, 60, 294205247, 487478783},
},
{ /* freq = 32000 */
{ 0, 2, 536870911, 283467839},
{ 2, 4, 253403071, 163745631},
{ 4, 6, 372588415, 44560283},
{ 6, 7, 492310623, 462245855},
{ 7, 9, 74625055, 343060511},
{ 9, 11, 193810399, 223875167},
{11, 14, 312995743, 44560283},
{14, 16, 492310623, 402653183},
{16, 19, 134217727, 467077695},
{19, 22, 69793215, 447213471},
{22, 26, 89657439, 208842783},
{26, 30, 328028127, 256624287},
{30, 34, 280246623, 17716739},
{34, 37, 519154175, 492310623},
{37, 41, 44560283, 331249343},
{41, 44, 205621551, 534186559},
{44, 48, 2684354, 147102623},
{48, 51, 389768287, 257698031},
{51, 54, 278635999, 140123311},
{54, 56, 396747615, 474593887},
{56, 58, 62277023, 536870911},
}
};
static const p2sb mp3ienc_p2sb_s[3][SBBND_S] = {
{ /* freq = 44100 */
{ 0, 2, 536870911, 89657439},
{ 3, 5, 447213471, 447213471},
{ 5, 8, 89657439, 268435455},
{ 8, 11, 268435455, 89657439},
{11, 15, 447213471, 89657439},
{15, 20, 447213471, 134217727},
{20, 23, 402653183, 312995743},
{23, 27, 223875167, 29527899},
{27, 30, 506806143, 201326591},
{30, 33, 335544319, 161061279},
{33, 36, 375809631, 89657439},
{36, 38, 447213471, 536870911},
},
{ /* freq = 48000 */
{ 0, 2, 536870911, 89657439},
{ 3, 5, 447213471, 447213471},
{ 5, 8, 89657439, 268435455},
{ 8, 11, 268435455, 89657439},
{11, 15, 447213471, 89657439},
{15, 19, 447213471, 312995743},
{19, 22, 223875167, 492310623},
{22, 26, 44560283, 506806143},
{26, 30, 29527899, 22548577},
{30, 32, 514322335, 304405791},
{32, 35, 232465103, 89657439},
{35, 37, 447213471, 331786207},
},
{ /* freq = 32000 */
{ 0, 2, 536870911, 89657439},
{ 3, 5, 447213471, 447213471},
{ 5, 8, 89657439, 268435455},
{ 8, 11, 268435455, 89657439},
{11, 15, 447213471, 89657439},
{15, 20, 447213471, 134217727},
{20, 24, 402653183, 134217727},
{24, 29, 402653183, 29527899},
{29, 33, 506806143, 201326591},
{33, 37, 335544319, 253403071},
{37, 40, 283467839, 503048031},
{40, 41, 33285995, 536870911},
},
};
static const ptbl_s mp3ienc_ptbl_s[3][CBANDS_s] = {
{ /* freq = 44100 */
{ 1, 148504, 644109759, 0},
{ 1, 29622, 633159871, 1762},
{ 1, 950, 633159871, 3524},
{ 1, 294, 632515775, 5173},
{ 1, 294, 634448063, 6569},
{ 1, 294, 633159871, 7784},
{ 1, 294, 629939327, 8910},
{ 1, 294, 622854143, 9884},
{ 1, 294, 610615999, 10756},
{ 1, 294, 599022079, 11552},
{ 1, 294, 706652735, 12285},
{ 1, 294, 672634431, 12915},
{ 1, 294, 653305855, 13513},
{ 1, 294, 618514431, 14064},
{ 1, 294, 579084159, 14568},
{ 1, 294, 541973311, 15032},
{ 1, 294, 504862431, 15472},
{ 1, 294, 456154399, 15864},
{ 1, 294, 476256127, 16256},
{ 2, 589, 664903039, 16917},
{ 2, 589, 706902783, 17505},
{ 2, 589, 654507775, 18026},
{ 2, 589, 590946687, 18488},
{ 2, 589, 525667679, 18894},
{ 2, 589, 510206879, 19282},
{ 3, 884, 565178687, 19714},
{ 3, 884, 606407487, 20195},
{ 3, 1769, 566896511, 20641},
{ 3, 1769, 520514079, 21049},
{ 3, 1769, 485297791, 21431},
{ 4, 3735, 601378495, 21806},
{ 4, 3735, 621782399, 22198},
{ 5, 14811, 608895743, 22585},
{ 5, 14811, 573457343, 22954},
{ 5, 14811, 662251519, 23305},
{ 7, 207421, 669982079, 23665},
{ 7, 207421, 667405247, 24024},
{ 7, 207421, 653232575, 24376},
{19, 5629968, 671997055, 24728},
},
{ /* freq = 48000 38 */
{ 1, 148504, 644109759, 0},
{ 1, 29622, 637024511, 1918},
{ 1, 950, 637024511, 3836},
{ 1, 294, 631871615, 5563},
{ 1, 294, 634448063, 7014},
{ 1, 294, 633803967, 8295},
{ 1, 294, 631227519, 9449},
{ 1, 294, 623498239, 10436},
{ 1, 294, 614480703, 11337},
{ 1, 294, 598377919, 12137},
{ 1, 294, 700467583, 12842},
{ 1, 294, 682685311, 13498},
{ 1, 294, 652532735, 14097},
{ 1, 294, 612329279, 14638},
{ 1, 294, 577537855, 15143},
{ 1, 294, 532695583, 15600},
{ 1, 294, 497904127, 16027},
{ 1, 294, 457700703, 16437},
{ 1, 294, 427548095, 16786},
{ 2, 589, 657171583, 17437},
{ 2, 589, 696595583, 18011},
{ 2, 589, 632175551, 18513},
{ 2, 589, 571191167, 18954},
{ 2, 589, 523949823, 19366},
{ 2, 589, 467260159, 19738},
{ 2, 589, 453517215, 20087},
{ 3, 1769, 533398079, 20498},
{ 3, 1769, 578062655, 20957},
{ 3, 1769, 545423167, 21380},
{ 4, 3735, 537692735, 21796},
{ 4, 3735, 682994111, 22221},
{ 5, 14811, 660442431, 22636},
{ 5, 14811, 621782399, 23030},
{ 5, 14811, 591713471, 23403},
{ 7, 207421, 711211775, 23775},
{ 7, 207421, 720230783, 24159},
{11, 325943, 680289535, 24525},
{17, 5037326, 617156607, 24872},
},
{ /* freq = 32000 */
{ 1, 148504, 644109759, 0},
{ 1, 29622, 634448063, 1278},
{ 1, 2949, 633159871, 2557},
{ 1, 950, 633159871, 3836},
{ 1, 294, 631871615, 5021},
{ 1, 294, 628006975, 6095},
{ 1, 294, 617701247, 7014},
{ 1, 294, 608039615, 7877},
{ 1, 294, 600954367, 8695},
{ 1, 294, 592580927, 9449},
{ 1, 294, 689643583, 10122},
{ 1, 294, 667222463, 10741},
{ 1, 294, 648667007, 11337},
{ 1, 294, 607690431, 11870},
{ 1, 294, 583723007, 12385},
{ 1, 294, 539653823, 12842},
{ 1, 294, 520325279, 13299},
{ 1, 294, 467751551, 13698},
{ 1, 294, 486306975, 14097},
{ 2, 589, 682685311, 14806},
{ 2, 589, 736965503, 15443},
{ 2, 589, 712056383, 16027},
{ 2, 589, 658802495, 16549},
{ 2, 589, 605548543, 17018},
{ 2, 589, 547141055, 17449},
{ 2, 589, 484438847, 17829},
{ 2, 589, 472413759, 18195},
{ 3, 884, 517937279, 18595},
{ 3, 884, 545423167, 19024},
{ 3, 884, 508488991, 19430},
{ 3, 884, 572383423, 19797},
{ 3, 884, 556275071, 20145},
{ 4, 2359, 609969599, 20527},
{ 4, 2359, 637890751, 20932},
{ 4, 2359, 731826623, 21320},
{ 5, 4685, 690596927, 21688},
{ 5, 4685, 672558975, 22044},
{ 6, 5636, 698327487, 22414},
{ 7, 20742, 810305215, 22787},
{ 7, 20742, 780238207, 23145},
{ 8, 23691, 882923327, 23499},
{10, 296321, 889794303, 23857},
},
};
/****************************************************************************/
static const Ipp16s mp3ienc_pa_numlines_l[3][CBANDS_l] = {
{
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,
4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 9, 9, 9, 10, 10, 11, 14, 14,
15, 20, 20, 21, 27, 27, 36, 73, 18, /* {47,*/
},
{
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4,
4, 4, 4, 5, 5, 5, 6, 7, 7, 8, 8, 8, 10, 10, 10, 13, 13, 14,
18, 18, 20, 25, 25, 35, 67, 67,
},
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -