⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mp3enc_psychoacoustic_int.cpp

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/*////                  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-2005 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 ipplic.htm 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 "umc_mp3_enc_int.h"#define  N_SHORT 256#define  N_LONG 1024namespace UMC {/****************************************************************************/const short mp3enc_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,    },    {        2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,        3,   3,   3,   3,   3,   3,   3,   3,   3,   4,   4,   4,   5,   5,   5,   5,   5,   6,        6,   6,   8,   8,   8,  10,  10,  10,  12,  12,  13,  14,  14,  16,  20,  20,  23,  27,        27,  32,  37,  37,  12,  24,    }};short imp3enc_bval_l[3][CBANDS_l] = {    {        0, 441, 881, 1323, 1764, 2204, 2646, 3087, 3527, 3969, 4381, 4782,        5178, 5545, 5912, 6576, 7194, 7791, 8364, 8919, 9427, 9893, 10341,        10767, 11179, 11564, 11931, 12284, 12691, 13158, 13595, 14009, 14399,        14756, 15105, 15481, 15880, 16264, 16653, 17053, 17428, 17790, 18169,        18538, 18889, 19232, 19589, 19954, 20314, 20663, 21002, 21352, 21704,        22047, 22394, 22747, 23099, 23447, 23789, 24129, 24470, 24810, 25028,    },    {        0, 480, 960, 1439, 1920, 2400, 2880, 3359, 3840, 4299, 4736, 5168, 5568,        5967, 6336, 6678, 7346, 7988, 8603, 9181, 9711, 10205, 10676, 11126, 11549,        11949, 12331, 12683, 13026, 13429, 13887, 14319, 14715, 15094, 15503, 15936,        16345, 16715, 17064, 17428, 17789, 18132, 18478, 18839, 19212, 19578, 19933,        20282, 20642, 21014, 21374, 21723, 22070, 22417, 22764, 23110, 23458, 23805,        24148, 24488, 24827, 25165, 0,    },    {        320, 960, 1600, 2240, 2880, 3520, 4142, 4736, 5297, 5834, 6333, 6793, 7239,        7671, 8094, 8504, 8903, 9281, 9711, 10205, 10676, 11126, 11549, 11949, 12331,        12683, 13026, 13405, 13811, 14205, 14610, 15031, 15428, 15794, 16149, 16506,        16861, 17210, 17569, 17938, 18297, 18652, 19008, 19355, 19700, 20049, 20403,        20755, 21100, 21446, 21798, 22154, 22507, 22854, 23199, 23544, 23885, 24223,        24511, 24818, 0, 0, 0,    },};const short ipa_hann_window_long[1024] = {    0, 0, 1, 3, 6, 9, 13, 17, 22, 27, 33, 40, 48, 56, 64, 74,    83, 94, 105, 117, 129, 142, 155, 170, 184, 200, 216, 232, 249, 267, 286, 305,    324, 344, 365, 387, 409, 431, 455, 478, 503, 528, 553, 580, 606, 634, 662, 690,    720, 749, 780, 811, 842, 874, 907, 940, 974, 1009, 1044, 1079, 1116, 1152, 1190, 1227,    1266, 1305, 1345, 1385, 1426, 1467, 1509, 1551, 1594, 1638, 1682, 1726, 1772, 1817, 1864, 1910,    1958, 2006, 2054, 2103, 2153, 2203, 2254, 2305, 2356, 2409, 2461, 2515, 2568, 2623, 2678, 2733,    2789, 2845, 2902, 2959, 3017, 3076, 3134, 3194, 3254, 3314, 3375, 3436, 3498, 3561, 3623, 3687,    3750, 3815, 3879, 3945, 4010, 4076, 4143, 4210, 4278, 4346, 4414, 4483, 4552, 4622, 4692, 4763,    4834, 4905, 4977, 5050, 5123, 5196, 5269, 5343, 5418, 5493, 5568, 5644, 5720, 5797, 5873, 5951,    6029, 6107, 6185, 6264, 6343, 6423, 6503, 6583, 6664, 6745, 6827, 6908, 6991, 7073, 7156, 7239,    7323, 7407, 7491, 7576, 7661, 7746, 7831, 7917, 8004, 8090, 8177, 8264, 8352, 8439, 8527, 8616,    8705, 8793, 8883, 8972, 9062, 9152, 9242, 9333, 9424, 9515, 9606, 9698, 9790, 9882, 9975, 10067,    10160, 10253, 10347, 10440, 10534, 10628, 10722, 10817, 10911, 11006, 11101, 11196, 11292, 11388, 11483, 11579,    11676, 11772, 11869, 11965, 12062, 12159, 12256, 12354, 12451, 12549, 12647, 12745, 12843, 12941, 13039, 13138,    13236, 13335, 13434, 13533, 13632, 13731, 13830, 13930, 14029, 14129, 14228, 14328, 14428, 14528, 14628, 14728,    14828, 14928, 15028, 15128, 15228, 15329, 15429, 15529, 15630, 15730, 15831, 15931, 16032, 16132, 16233, 16333,    16434, 16534, 16635, 16735, 16836, 16936, 17037, 17137, 17238, 17338, 17438, 17539, 17639, 17739, 17839, 17939,    18039, 18139, 18239, 18339, 18439, 18539, 18638, 18738, 18837, 18937, 19036, 19135, 19234, 19333, 19432, 19531,    19629, 19728, 19826, 19924, 20022, 20120, 20218, 20316, 20413, 20511, 20608, 20705, 20802, 20898, 20995, 21091,    21188, 21284, 21379, 21475, 21571, 21666, 21761, 21856, 21950, 22045, 22139, 22233, 22327, 22420, 22514, 22607,    22700, 22792, 22885, 22977, 23069, 23161, 23252, 23343, 23434, 23525, 23615, 23705, 23795, 23884, 23974, 24062,    24151, 24240, 24328, 24415, 24503, 24590, 24677, 24763, 24850, 24936, 25021, 25106, 25191, 25276, 25360, 25444,    25528, 25611, 25694, 25776, 25859, 25940, 26022, 26103, 26184, 26264, 26344, 26424, 26503, 26582, 26660, 26738,    26816, 26894, 26970, 27047, 27123, 27199, 27274, 27349, 27424, 27498, 27571, 27644, 27717, 27790, 27862, 27933,    28004, 28075, 28145, 28215, 28284, 28353, 28421, 28489, 28557, 28624, 28691, 28757, 28822, 28888, 28952, 29017,    29080, 29144, 29206, 29269, 29331, 29392, 29453, 29513, 29573, 29633, 29691, 29750, 29808, 29865, 29922, 29978,    30034, 30089, 30144, 30199, 30252, 30306, 30358, 30411, 30462, 30513, 30564, 30614, 30664, 30713, 30761, 30809,    30857, 30903, 30950, 30995, 31041, 31085, 31129, 31173, 31216, 31258, 31300, 31341, 31382, 31422, 31462, 31501,    31540, 31577, 31615, 31651, 31688, 31723, 31758, 31793, 31827, 31860, 31893, 31925, 31956, 31987, 32018, 32047,    32077, 32105, 32133, 32161, 32187, 32214, 32239, 32264, 32289, 32312, 32336, 32358, 32380, 32402, 32423, 32443,    32462, 32481, 32500, 32518, 32535, 32551, 32567, 32583, 32597, 32612, 32625, 32638, 32650, 32662, 32673, 32684,    32693, 32703, 32711, 32719, 32727, 32734, 32740, 32745, 32750, 32754, 32758, 32761, 32764, 32766, 32767, 32767,    32767, 32767, 32766, 32764, 32761, 32758, 32754, 32750, 32745, 32740, 32734, 32727, 32719, 32711, 32703, 32693,    32684, 32673, 32662, 32650, 32638, 32625, 32612, 32597, 32583, 32567, 32551, 32535, 32518, 32500, 32481, 32462,    32443, 32423, 32402, 32380, 32358, 32336, 32312, 32289, 32264, 32239, 32214, 32187, 32161, 32133, 32105, 32077,    32047, 32018, 31987, 31956, 31925, 31893, 31860, 31827, 31793, 31758, 31723, 31688, 31651, 31615, 31577, 31540,    31501, 31462, 31422, 31382, 31341, 31300, 31258, 31216, 31173, 31129, 31085, 31041, 30995, 30950, 30903, 30857,    30809, 30761, 30713, 30664, 30614, 30564, 30513, 30462, 30411, 30358, 30306, 30252, 30199, 30144, 30089, 30034,    29978, 29922, 29865, 29808, 29750, 29691, 29633, 29573, 29513, 29453, 29392, 29331, 29269, 29206, 29144, 29080,    29017, 28952, 28888, 28822, 28757, 28691, 28624, 28557, 28489, 28421, 28353, 28284, 28215, 28145, 28075, 28004,    27933, 27862, 27790, 27717, 27644, 27571, 27498, 27424, 27349, 27274, 27199, 27123, 27047, 26970, 26894, 26816,    26738, 26660, 26582, 26503, 26424, 26344, 26264, 26184, 26103, 26022, 25940, 25859, 25776, 25694, 25611, 25528,    25444, 25360, 25276, 25191, 25106, 25021, 24936, 24850, 24763, 24677, 24590, 24503, 24415, 24328, 24240, 24151,    24062, 23974, 23884, 23795, 23705, 23615, 23525, 23434, 23343, 23252, 23161, 23069, 22977, 22885, 22792, 22700,    22607, 22514, 22420, 22327, 22233, 22139, 22045, 21950, 21856, 21761, 21666, 21571, 21475, 21379, 21284, 21188,    21091, 20995, 20898, 20802, 20705, 20608, 20511, 20413, 20316, 20218, 20120, 20022, 19924, 19826, 19728, 19629,    19531, 19432, 19333, 19234, 19135, 19036, 18937, 18837, 18738, 18638, 18539, 18439, 18339, 18239, 18139, 18039,    17939, 17839, 17739, 17639, 17539, 17438, 17338, 17238, 17137, 17037, 16936, 16836, 16735, 16635, 16534, 16434,    16333, 16233, 16132, 16032, 15931, 15831, 15730, 15630, 15529, 15429, 15329, 15228, 15128, 15028, 14928, 14828,    14728, 14628, 14528, 14428, 14328, 14228, 14129, 14029, 13930, 13830, 13731, 13632, 13533, 13434, 13335, 13236,    13138, 13039, 12941, 12843, 12745, 12647, 12549, 12451, 12354, 12256, 12159, 12062, 11965, 11869, 11772, 11676,    11579, 11483, 11388, 11292, 11196, 11101, 11006, 10911, 10817, 10722, 10628, 10534, 10440, 10347, 10253, 10160,    10067, 9975, 9882, 9790, 9698, 9606, 9515, 9424, 9333, 9242, 9152, 9062, 8972, 8883, 8793, 8705,    8616, 8527, 8439, 8352, 8264, 8177, 8090, 8004, 7917, 7831, 7746, 7661, 7576, 7491, 7407, 7323,    7239, 7156, 7073, 6991, 6908, 6827, 6745, 6664, 6583, 6503, 6423, 6343, 6264, 6185, 6107, 6029,    5951, 5873, 5797, 5720, 5644, 5568, 5493, 5418, 5343, 5269, 5196, 5123, 5050, 4977, 4905, 4834,    4763, 4692, 4622, 4552, 4483, 4414, 4346, 4278, 4210, 4143, 4076, 4010, 3945, 3879, 3815, 3750,    3687, 3623, 3561, 3498, 3436, 3375, 3314, 3254, 3194, 3134, 3076, 3017, 2959, 2902, 2845, 2789,    2733, 2678, 2623, 2568, 2515, 2461, 2409, 2356, 2305, 2254, 2203, 2153, 2103, 2054, 2006, 1958,    1910, 1864, 1817, 1772, 1726, 1682, 1638, 1594, 1551, 1509, 1467, 1426, 1385, 1345, 1305, 1266,    1227, 1190, 1152, 1116, 1079, 1044, 1009, 974, 940, 907, 874, 842, 811, 780, 749, 720,    690, 662, 634, 606, 580, 553, 528, 503, 478, 455, 431, 409, 387, 365, 344, 324,    305, 286, 267, 249, 232, 216, 200, 184, 170, 155, 142, 129, 117, 105, 94, 83,    74, 64, 56, 48, 40, 33, 27, 22, 17, 13, 9, 6, 3, 1, 0, 0,};const short ipa_hann_window_short[256] = {    1, 11, 30, 60, 99, 149, 208, 276, 355, 443, 541, 648, 765, 891, 1026, 1171,    1325, 1488, 1660, 1840, 2030, 2228, 2435, 2650, 2873, 3105, 3345, 3592, 3847, 4110, 4380, 4657,    4941, 5233, 5530, 5835, 6146, 6463, 6786, 7115, 7449, 7789, 8134, 8483, 8838, 9197, 9561, 9928,    10300, 10675, 11054, 11435, 11820, 12208, 12598, 12990, 13385, 13781, 14179, 14578, 14978, 15379, 15780, 16182,    16585, 16987, 17388, 17789, 18189, 18588, 18986, 19382, 19777, 20169, 20559, 20947, 21332, 21713, 22092, 22467,    22839, 23206, 23570, 23929, 24284, 24633, 24978, 25318, 25652, 25981, 26304, 26621, 26932, 27237, 27534, 27826,    28110, 28387, 28657, 28920, 29175, 29422, 29662, 29894, 30117, 30332, 30539, 30737, 30927, 31107, 31279, 31442,    31596, 31741, 31876, 32002, 32119, 32226, 32324, 32412, 32491, 32559, 32618, 32668, 32707, 32737, 32756, 32766,    32766, 32756, 32737, 32707, 32668, 32618, 32559, 32491, 32412, 32324, 32226, 32119, 32002, 31876, 31741, 31596,    31442, 31279, 31107, 30927, 30737, 30539, 30332, 30117, 29894, 29662, 29422, 29175, 28920, 28657, 28387, 28110,    27826, 27534, 27237, 26932, 26621, 26304, 25981, 25652, 25318, 24978, 24633, 24284, 23929, 23570, 23206, 22839,    22467, 22092, 21713, 21332, 20947, 20559, 20169, 19777, 19382, 18986, 18588, 18189, 17789, 17388, 16987, 16585,    16182, 15780, 15379, 14978, 14578, 14179, 13781, 13385, 12990, 12598, 12208, 11820, 11435, 11054, 10675, 10300,    9928, 9561, 9197, 8838, 8483, 8134, 7789, 7449, 7115, 6786, 6463, 6146, 5835, 5530, 5233, 4941,    4657, 4380, 4110, 3847, 3592, 3345, 3105, 2873, 2650, 2435, 2228, 2030, 1840, 1660, 1488, 1325,    1171, 1026, 891, 765, 648, 541, 443, 355, 276, 208, 149, 99, 60, 30, 11, 1,};#define FIND_NORM_SHIFT_16S(pSrc, len, shift) \{                                             \  Ipp16s _min0, _max0;                        \  int    _min, _max;                          \                                              \  ippsMinMax_16s(pSrc, len, &_min0, &_max0);  \                                              \  _min = -((int)_min0);                       \  _max = _max0;                               \                                              \  if (_min > _max) {                          \    _max = _min - 1;                          \  }                                           \                                              \  shift = 0;                                  \                                              \  if (_max > 0) {                             \    while (_max <= 16383) {                   \      _max = _max << 1;                       \      shift++;                                \    }                                         \  }                                           \}/****************************************************************************/void MP3EncoderInt::psy_long_window(Ipp16s *input_data,                     Ipp32s* rsqr_long,                     Ipp32s* rsqr_longScale,                     int ch){  VM_ALIGN16_DECL(Ipp16s)  sw[N_LONG];  VM_ALIGN16_DECL(Ipp16s)  abs_sw[N_LONG];  VM_ALIGN16_DECL(Ipp16s)  fft_line[N_LONG+2];  VM_ALIGN16_DECL(Ipp32s) e_b[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp32s)  c_b[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp32s)  ecb[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp32s)  ct[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp32s)  tmp_ecb[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp32s)  tmp_ct[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp32s)  ecb_h_limit[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp32s)  ecb_l_limit[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp32s)  ltmp0[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp16s)  c_w[1024];  VM_ALIGN16_DECL(Ipp16s)  tmp_ln[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp16s)  tmp_ln0[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp16s)  tmp_ln1[MAX_PPT_LONG];  VM_ALIGN16_DECL(Ipp16s)  tmp[NUM_UNPRED_LINES_LONG];  VM_ALIGN16_DECL(Ipp16s)  tmp0[NUM_UNPRED_LINES_LONG];  VM_ALIGN16_DECL(Ipp16s)  tmp1[NUM_UNPRED_LINES_LONG];  VM_ALIGN16_DECL(Ipp16s)  tmp2[NUM_UNPRED_LINES_LONG];  VM_ALIGN16_DECL(Ipp16s)  tmp3[NUM_UNPRED_LINES_LONG];  VM_ALIGN16_DECL(Ipp16s)  tmp4[NUM_UNPRED_LINES_LONG];  VM_ALIGN16_DECL(Ipp16s)  tmp5[NUM_UNPRED_LINES_LONG];  VM_ALIGN16_DECL(Ipp16s)  denum[NUM_UNPRED_LINES_LONG];  VM_ALIGN16_DECL(Ipp16s)  r_pred[NUM_UNPRED_LINES_LONG];  VM_ALIGN16_DECL(Ipp16s)  re_pred[NUM_UNPRED_LINES_LONG];  VM_ALIGN16_DECL(Ipp16s)  im_pred[NUM_UNPRED_LINES_LONG];  Ipp16s        *r, *r_prev, *r_prev_prev;  Ipp16s        *re, *re_prev, *re_prev_prev;  Ipp16s        *im, *im_prev, *im_prev_prev;  Ipp16s        *tmp_dst[2];  Ipp32s        *nb,*nb_l;  int           b, scaleFactor;  Ipp32s        sum;  int           shift0, shift1, shift;  int           rScaleFactor, r_prevScaleFactor;  int           r_prev_prevScaleFactor, r_predScaleFactor;  int           nb_ScaleFactor, nb_lScaleFactor;  int current_f_r_index, prev_f_r_index, prev_prev_f_r_index;  int index;  current_f_r_index = ipa_current_f_r_index[ch];  prev_f_r_index = current_f_r_index - 1;  if (prev_f_r_index < 0) prev_f_r_index = 2;  prev_prev_f_r_index = prev_f_r_index - 1;  if (prev_prev_f_r_index < 0) prev_prev_f_r_index = 2;  ippsMul_16s_Sfs(input_data, ipa_hann_window_long,                   sw, pa_iblen_long * 2, 15);  ippsAbs_16s(sw, abs_sw, 2 * pa_iblen_long);  ippsSum_16s32s_Sfs(abs_sw, 2 * pa_iblen_long, &sum, 0);  scaleFactor = 0;  if (sum != 0) {    if (sum > 32768) {      while (sum > 32768) {        sum >>= 1;        scaleFactor++;      }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -