├── .gitignore ├── hmp3 ├── RCSL.txt ├── src │ ├── pub │ │ ├── hxtypes.h │ │ ├── filter2.h │ │ ├── pcmhpm.h │ │ ├── enc.h │ │ ├── amod.h │ │ ├── bitallo.h │ │ ├── l3e.h │ │ ├── srcc.h │ │ ├── balow.h │ │ ├── bitallo1.h │ │ ├── bitallos.h │ │ ├── xhead.h │ │ ├── encapp.h │ │ └── bitallo3.h │ ├── test │ │ └── port.h │ ├── xsbt.c │ ├── xhwin.c │ ├── bitallo.cpp │ ├── emap.c │ ├── mhead.h │ ├── platform │ │ └── win │ │ │ └── i386 │ │ │ ├── spdc.asm │ │ │ ├── recip.inc │ │ │ ├── sqrt.inc │ │ │ ├── epartc.asm │ │ │ ├── tableaw2.inc │ │ │ └── mbexp.inc │ ├── filter2.c │ ├── tableaw2.h │ ├── detect.c │ ├── l3map.h │ ├── cnts.c │ ├── tcp.h │ ├── pow34.c │ ├── cnt.c │ ├── mp3low.h │ ├── sbt.c │ └── mhead.c ├── mp3enc_asm.sln └── LICENSE.txt ├── README.md └── Makefile /.gitignore: -------------------------------------------------------------------------------- 1 | builds/ 2 | .vscode/ -------------------------------------------------------------------------------- /hmp3/RCSL.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maikmerten/hmp3/HEAD/hmp3/RCSL.txt -------------------------------------------------------------------------------- /hmp3/src/pub/hxtypes.h: -------------------------------------------------------------------------------- 1 | #ifndef max 2 | #define max(a, b) (((a) > (b)) ? (a) : (b)) 3 | #endif 4 | #ifndef min 5 | #define min(a, b) (((a) < (b)) ? (a) : (b)) 6 | #endif 7 | 8 | #define HX_MAX(a, b) (((a) > (b)) ? (a) : (b)) 9 | #define HX_MIN(a, b) (((a) < (b)) ? (a) : (b)) 10 | -------------------------------------------------------------------------------- /hmp3/mp3enc_asm.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp3enc", "mp3enc_asm.vcxproj", "{12BE1F5C-DD4C-445B-AC0E-E12B8F98B1EF}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {12BE1F5C-DD4C-445B-AC0E-E12B8F98B1EF}.Debug|x86.ActiveCfg = Debug|Win32 15 | {12BE1F5C-DD4C-445B-AC0E-E12B8F98B1EF}.Debug|x86.Build.0 = Debug|Win32 16 | {12BE1F5C-DD4C-445B-AC0E-E12B8F98B1EF}.Release|x86.ActiveCfg = Release|Win32 17 | {12BE1F5C-DD4C-445B-AC0E-E12B8F98B1EF}.Release|x86.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /hmp3/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. 2 | 3 | The contents of this directory, and (except where otherwise 4 | indicated) the directories included within this directory, are 5 | subject to the current version of the RealNetworks Public Source 6 | License (the "RPSL") available at RPSL.txt in this directory, unless 7 | you have licensed the directory under the current version of the 8 | RealNetworks Community Source License (the "RCSL") available at 9 | RCSL.txt in this directory, in which case the RCSL will apply. You 10 | may also obtain the license terms directly from RealNetworks. You 11 | may not use the files in this directory except in compliance with the 12 | RPSL or, if you have a valid RCSL with RealNetworks applicable to 13 | this directory, the RCSL. Please see the applicable RPSL or RCSL for 14 | the rights, obligations and limitations governing use of the contents 15 | of the directory. 16 | 17 | This directory is part of the Helix DNA Technology. RealNetworks is 18 | the developer of the Original Code and owns the copyrights in the 19 | portions it created. 20 | 21 | This directory, and the directories included with this directory, are 22 | distributed and made available on an 'AS IS' basis, WITHOUT WARRANTY 23 | OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY 24 | DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY 25 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, 26 | QUIET ENJOYMENT OR NON-INFRINGEMENT. 27 | 28 | Technology Compatibility Kit Test Suite(s) Location: 29 | http://www.helixcommunity.org/content/tck 30 | 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hmp3 - Helix MP3 Encoder, with some additions 2 | 3 | This repository contains a version of the Helix MP3 Encoder with some maintenance work applied to build on modern systems. This targets mostly Linux-based machines (tested on x86-64 and ARM), but project files for Visual Studio 2015 are also included. 4 | 5 | ## On the license of the Helix MP3 Encoder 6 | 7 | This repository contains a source code copy of the Helix MP3 Encoder in the directory [./hmp3](./hmp3). Please study [./hmp3/LICENSE.txt](./hmp3/LICENSE.txt) for licensing information. 8 | 9 | ## On the license of other files in this repository 10 | 11 | Files in this repository outside of the [./hmp3](./hmp3) directory are licensed under the terms of the MIT License, unless noted otherwise. 12 | 13 | ## Compiling 14 | 15 | A Makefile tested on Linux is provided in this directory. With the usual build systems installed, a simple `make` should create a `hmp3` program binary in `builds/release`, along with compiled object files. 16 | 17 | A binary with debug symbols can be generated with `make debug`. 18 | 19 | ## Documentation 20 | 21 | The encoder is documented over at the [HydrogenAudio Wiki page of the Helix MP3 encoder](https://wiki.hydrogenaud.io/index.php?title=Helix_MP3_Encoder). 22 | 23 | ## Use examples 24 | 25 | * Create a ~128 kbps VBR MP3 file: 26 | 27 | `hmp3 input.wav output.mp3` 28 | 29 | * Create a 128 kbps CBR MP3 file: 30 | 31 | `hmp3 input.wav output.mp3 -B64` 32 | 33 | (Note that `-B` denotes the bitrate **per channel**, thus stereo input files are being encoded with 128 kbps.) 34 | 35 | * Create a ~185 kbps VBR MP3 file, encode frequencies above 16 kHz, with a highpass filter of 19 kHz applied: 36 | 37 | `hmp3 input.wav output.mp3 -V100 -HF2 -F19000` 38 | 39 | 40 | -------------------------------------------------------------------------------- /hmp3/src/test/port.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: 2024-04-26, Maik Merten 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _PORT_H_ 39 | #define _PORT_H_ 40 | 41 | #ifndef O_BINARY 42 | #define O_BINARY 0 43 | #endif 44 | 45 | 46 | #endif //_PORT_H_ 47 | -------------------------------------------------------------------------------- /hmp3/src/xsbt.c: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: xsbt.c,v 1.1 2005/07/13 17:22:21 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | void sbt_L3 ( float vbuf[], float samp[] ); 44 | 45 | /*====================================================================*/ 46 | void 47 | xsbt_init ( ) 48 | { 49 | } 50 | 51 | /*--------------------------------------------------------------------*/ 52 | void 53 | xsbt_L3 ( float vbuf[], float samp[] ) 54 | { 55 | sbt_L3 ( vbuf, samp ); 56 | } 57 | 58 | /*--------------------------------------------------------------------*/ 59 | -------------------------------------------------------------------------------- /hmp3/src/pub/filter2.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: 2024-03-16, Case 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _FILTER2_h_ 39 | #define _FILTER2_h_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" 43 | { 44 | #endif 45 | //---------------------------------------------- 46 | typedef struct 47 | { 48 | int select; 49 | float alpha; 50 | float d, d2; 51 | } 52 | FILTER2_CONTROL; 53 | 54 | void filter2_init ( int samprate, int filter_select, 55 | int monodual, FILTER2_CONTROL * fc2 ); 56 | 57 | void filter2 ( float pcm[], float *buf1, float *buf2, 58 | FILTER2_CONTROL * fc2 ); 59 | 60 | //---------------------------------------------- 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif // _FILTER2_h_ 66 | -------------------------------------------------------------------------------- /hmp3/src/xhwin.c: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: xhwin.c,v 1.1 2005/07/13 17:22:21 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | void hybrid ( float x1[], float x2[], float yout[], 44 | int btype, int nlong, int ntot ); 45 | void antialias ( float x[], int n ); 46 | 47 | /*====================================================================*/ 48 | void 49 | xhybrid ( float x1[], float x2[], float yout[], 50 | int btype, int nlong, int ntot ) 51 | { 52 | hybrid ( x1, x2, yout, btype, nlong, ntot ); 53 | } 54 | 55 | /*--------------------------------------------------------------------*/ 56 | void 57 | xantialias ( float x[], int n ) 58 | { 59 | antialias ( x, n ); 60 | } 61 | 62 | /*===============================================================*/ 63 | -------------------------------------------------------------------------------- /hmp3/src/pub/pcmhpm.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: 2024-04-10, Case 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _PCMHPM_H_ 39 | #define _PCMHPM_H_ 40 | 41 | #include 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | typedef struct 48 | { 49 | int channels; 50 | int bits; 51 | int rate; /* sample rate e.g. 44100 */ 52 | int type; /* 1: linear pcm (integer), 3: pcm (float), anything else unsupported (u-law etc) */ 53 | int bigendian; 54 | } 55 | F_INFO; 56 | 57 | int pcmhead_file ( FILE *handle, unsigned char *buf, int nbuf, F_INFO * f_info, uint64_t *data_size ); 58 | // parse wave header in endian independent way 59 | // fill in F_INFO struct 60 | // return offset to start of audio data, returns 0 for fail 61 | 62 | // big-little endian conversion 63 | int cvt_to_pcm_init ( int nch, int bits, int is_source_bigendian ) ; 64 | int cvt_to_pcm ( unsigned char *pcm, int bytes_in ) ; 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif // _PCMHPM_H_ 71 | -------------------------------------------------------------------------------- /hmp3/src/bitallo.cpp: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: 2024-03-14, Case 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #include "bitallo.h" 39 | 40 | /////////////////////////////////////////////////////////////////////////////// 41 | // Public Functions 42 | /////////////////////////////////////////////////////////////////////////////// 43 | CBitAllo::CBitAllo ( ): 44 | block_type ( 0 ) 45 | { 46 | } 47 | 48 | /*CBitAllo::~CBitAllo ( ) 49 | { 50 | }*/ 51 | 52 | //====================================================== 53 | int 54 | CBitAllo::ms_correlation ( float x[2][576], int n ) 55 | { 56 | int i; 57 | float a, b; 58 | float ss, sd; 59 | int r; 60 | 61 | sd = 0.0f; 62 | ss = 1.0f; 63 | for ( i = 0; i < n; i++ ) 64 | { 65 | a = x[0][i] * x[0][i]; 66 | b = x[1][i] * x[1][i]; 67 | ss += ( a + b ); 68 | a = a - b; 69 | if ( a < 0.0f ) 70 | a = -a; 71 | sd += a; 72 | } 73 | 74 | /*------- 75 | sd = 0.0f; 76 | ss = 100.0f; 77 | for(i=0;i 53 | #include 54 | #include 55 | #include 56 | 57 | extern int iframe; // for testing 58 | 59 | /*--------------------------------------------------------------------*/ 60 | void 61 | emapShort ( float xr[][192], float e[3][64], int nsum[68] ) 62 | { 63 | int i, j, k; 64 | float s0, s1, s2; 65 | int n, nn; 66 | 67 | i = 0; 68 | n = nsum[64] + nsum[65] + nsum[66]; // only nsum[66] should be set 69 | for ( j = 0; j < n; j++ ) 70 | { 71 | s0 = s1 = s2 = 0.0f; 72 | nn = nsum[j]; 73 | for ( k = 0; k < nn; k++, i++ ) 74 | { 75 | s0 += xr[0][i] * xr[0][i]; 76 | s1 += xr[1][i] * xr[1][i]; 77 | s2 += xr[2][i] * xr[2][i]; 78 | } 79 | e[0][j] = s0; 80 | e[1][j] = s1; 81 | e[2][j] = s2; 82 | } 83 | 84 | for ( ; j < 64; j++ ) 85 | { // this necessary? 86 | e[0][j] = 0.0f; 87 | e[1][j] = 0.0f; 88 | e[2][j] = 0.0f; 89 | } 90 | 91 | /*--- done ----*/ 92 | } 93 | 94 | /*--------------------------------------------------------------------*/ 95 | void 96 | emapLong ( float xr[576], float e[64], int nsum[68] ) 97 | { 98 | int i, j, k; 99 | float s; 100 | int n, nn; 101 | 102 | i = 0; 103 | n = nsum[64] + nsum[65] + nsum[66]; // only nsum[66] should be set 104 | for ( j = 0; j < n; j++ ) 105 | { 106 | s = 0.0f; 107 | nn = nsum[j]; 108 | for ( k = 0; k < nn; k++, i++ ) 109 | { 110 | s += xr[i] * xr[i]; 111 | } 112 | e[j] = s; 113 | } 114 | 115 | for ( ; j < 64; j++ ) 116 | { // this necessary? 117 | e[j] = 0.0f; 118 | } 119 | 120 | /*--- done ----*/ 121 | } 122 | 123 | /*--------------------------------------------------------------------*/ 124 | -------------------------------------------------------------------------------- /hmp3/src/mhead.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: mhead.h,v 1.1 2005/07/13 17:22:20 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | 39 | /* mpeg audio header */ 40 | typedef struct 41 | { 42 | int sync; /* 1 if valid sync */ 43 | int id; 44 | int option; 45 | int prot; 46 | int br_index; 47 | int sr_index; 48 | int pad; 49 | int private_bit; 50 | int mode; 51 | int mode_ext; 52 | int cr; 53 | int original; 54 | int emphasis; 55 | } 56 | MPEG_HEAD; 57 | 58 | /* portable mpeg audio decoder, decoder functions */ 59 | typedef struct 60 | { 61 | int in_bytes; 62 | int out_bytes; 63 | } 64 | IN_OUT; 65 | 66 | typedef struct 67 | { 68 | int channels; 69 | int outvalues; 70 | long samprate; 71 | int bits; 72 | int framebytes; 73 | int type; 74 | } 75 | DEC_INFO; 76 | 77 | #ifdef __cplusplus 78 | extern "C" 79 | { 80 | #endif 81 | 82 | int head_info ( unsigned char *buf, unsigned int n, MPEG_HEAD * h ); 83 | int head_info2 ( unsigned char *buf, 84 | unsigned int n, MPEG_HEAD * h, int *br ); 85 | 86 | /* head_info returns framebytes > 0 for success */ 87 | 88 | /* audio_decode_init returns 1 for success, 0 for fail */ 89 | 90 | /* audio_decode returns in_bytes = 0 on sync loss */ 91 | 92 | int audio_decode_init ( MPEG_HEAD * h, int framebytes_arg, 93 | int reduction_code, int transform_code, 94 | int convert_code, int freq_limit ); 95 | void audio_decode_info ( DEC_INFO * info ); 96 | IN_OUT audio_decode ( unsigned char *bs, short *pcm ); 97 | 98 | int audio_decode8_init ( MPEG_HEAD * h, int framebytes_arg, 99 | int reduction_code, int transform_code, 100 | int convert_code, int freq_limit ); 101 | void audio_decode8_info ( DEC_INFO * info ); 102 | IN_OUT audio_decode8 ( unsigned char *bs, short *pcmbuf ); 103 | 104 | /*-- integer decode --*/ 105 | int i_audio_decode_init ( MPEG_HEAD * h, int framebytes_arg, 106 | int reduction_code, int transform_code, 107 | int convert_code, int freq_limit ); 108 | void i_audio_decode_info ( DEC_INFO * info ); 109 | IN_OUT i_audio_decode ( unsigned char *bs, short *pcm ); 110 | 111 | #ifdef __cplusplus 112 | } 113 | #endif 114 | -------------------------------------------------------------------------------- /hmp3/src/pub/amod.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: amod.h,v 1.1 2005/07/13 17:22:24 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifdef _WINDOWS 39 | /*--------------------------------------------- 40 | MS C++ 4.1, disable warning of possible precision 41 | loss in floating point data tables 42 | and conversions by assignment 43 | -------------------------------------------------*/ 44 | #pragma warning(disable:4244) 45 | #endif 46 | 47 | typedef struct 48 | { 49 | float x; 50 | float y; 51 | } 52 | CPAIR; 53 | 54 | typedef struct 55 | { 56 | float r2; 57 | float t2; 58 | float r1; 59 | float t1; 60 | float r; 61 | float t; 62 | } 63 | RTHETA_BUF; 64 | 65 | typedef struct 66 | { 67 | float x0; 68 | float y0; 69 | float rr0; 70 | float r0; 71 | 72 | float x1; 73 | float y1; 74 | float rr1; 75 | float r1; 76 | 77 | float x2; 78 | float y2; 79 | float rr2; 80 | float r2; 81 | } 82 | L3RTHETA_BUF; 83 | 84 | /* --------- spd.c --------------*/ 85 | typedef struct 86 | { 87 | int count; 88 | int off; 89 | } 90 | SPD_CNTL; 91 | 92 | typedef struct 93 | { 94 | float thres; /* threshold for table gen, thres >= 0.0 */ 95 | SPD_CNTL *control; 96 | float *coef; 97 | int size; 98 | } 99 | SPD_SETUP; 100 | 101 | SPD_SETUP *spd_init_addr ( void ); 102 | 103 | /* --------- snr.c --------------*/ 104 | typedef struct 105 | { 106 | float tmn; 107 | float valmin; 108 | } 109 | SNR_TABLE; 110 | typedef struct 111 | { 112 | float tmn; 113 | float valmin; 114 | float qthres; 115 | } 116 | SNR_TABLE2; 117 | 118 | typedef struct 119 | { 120 | SNR_TABLE *tv; 121 | int *npart; 122 | float *qthres; /* layer 3 thres in quiet (abs thres) */ 123 | } 124 | SNR_SETUP; 125 | 126 | SNR_SETUP *snr_init_addr ( void ); 127 | 128 | /*---- Layer III smr, map calc partition to sf band --*/ 129 | typedef struct 130 | { 131 | int n; 132 | float w1; 133 | float w2; 134 | } 135 | MAP_TABLE; 136 | 137 | /* --------- ets.c --------------*/ 138 | typedef struct 139 | { 140 | float ivsum; 141 | int nsum; 142 | } 143 | ETS_CNTL; 144 | 145 | typedef struct 146 | { 147 | int *npart1; 148 | int *npart2; 149 | ETS_CNTL *nsum; 150 | float *tat; 151 | } 152 | ETS_SETUP; 153 | 154 | ETS_SETUP *ets_init_addr ( ); 155 | 156 | /*----------------------------------------*/ 157 | void fft1024 ( float *pcm, CPAIR * buf ); 158 | void fft512 ( float *pcm, CPAIR * buf ); 159 | 160 | /*---------------------------------------------------------------------*/ 161 | -------------------------------------------------------------------------------- /hmp3/src/pub/bitallo.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: 2024-03-14, Case 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _BITALLO_H_ 39 | #define _BITALLO_H_ 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include "l3e.h" 49 | 50 | #include "balow.h" // low level routines 51 | #include "hxtypes.h" 52 | 53 | typedef struct 54 | { 55 | int band_limit_left; 56 | int band_limit_right; 57 | int is_flag; 58 | int h_id; 59 | int hf_flag; 60 | int initialMNR; 61 | int vbr_flag; 62 | int MNRbias; 63 | int disable_taper; 64 | int *mnr_adjust; 65 | int test1; 66 | int test2; 67 | int test3; 68 | } 69 | BA_CONTROL; 70 | 71 | class CBitAllo 72 | { 73 | 74 | public: 75 | CBitAllo ( ); 76 | 77 | virtual ~CBitAllo ( ) = default; 78 | 79 | virtual void BitAllo ( float xr_arg[][576], SIG_MASK sm_arg[][36], 80 | int ch_arg, int nchan_arg, 81 | int min_bits_arg, int target_bits_arg, 82 | int max_bits_arg, int bit_pool_arg, 83 | SCALEFACT sf_out[], GR gr_data[], 84 | int ix_arg[][576], unsigned char signx_arg[][576], 85 | int ms_flag_arg ) = 0; 86 | 87 | virtual int BitAlloInit ( BA_CONTROL & ba_control ) = 0; 88 | 89 | virtual int ms_correlation2 ( float x[2][576], int block_type = 0 ) = 0; 90 | 91 | int ms_correlation ( float x[2][576], int n ); 92 | 93 | virtual void ba_out_stats ( ) = 0; // test routine 94 | 95 | //-data------------------------------------------------ 96 | protected: 97 | 98 | int nsf[2]; 99 | int nBand_l[22]; 100 | int startBand_l[24]; 101 | int nBand_s[13]; // extended to 192 lines 102 | int startBand_s[14]; 103 | 104 | int block_type; 105 | 106 | //-functions------------------------------------------------ 107 | 108 | // bit counter L3bacC.cpp 109 | INTPAIR subdivide2_quadregion ( int ixmax[], int ix[], int ncb, int ch ); 110 | // returns (nbig,nquads) 111 | void output_subdivide2 ( GR * gr_data, int ch ); 112 | // long block type 0 113 | int subdivide2 ( int ixmax[], int ix[], int ncb, int opti_flag, int ch ); 114 | // long block types 1/3 115 | int subdivide2BT13 ( int ixmax[], int ix[], int ncb, int opti_flag, 116 | int ch ); 117 | int region_aux ( int ixmax[], int ix[] ); 118 | int divide_region3 ( int c, int ixmax[], int ix[] ); 119 | 120 | }; 121 | 122 | #endif // _BITALLO_H_ 123 | -------------------------------------------------------------------------------- /hmp3/src/platform/win/i386/spdc.asm: -------------------------------------------------------------------------------- 1 | ; ***** BEGIN LICENSE BLOCK ***** 2 | ; Source last modified: $Id: spdc.asm,v 1.1 2005/07/13 17:22:23 rggammon Exp $ 3 | ; 4 | ; Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | ; 6 | ; The contents of this file, and the files included with this file, 7 | ; are subject to the current version of the RealNetworks Public 8 | ; Source License (the "RPSL") available at 9 | ; http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | ; the file under the current version of the RealNetworks Community 11 | ; Source License (the "RCSL") available at 12 | ; http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | ; will apply. You may also obtain the license terms directly from 14 | ; RealNetworks. You may not use this file except in compliance with 15 | ; the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | ; to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | ; the rights, obligations and limitations governing use of the 18 | ; contents of the file. 19 | ; 20 | ; This file is part of the Helix DNA Technology. RealNetworks is the 21 | ; developer of the Original Code and owns the copyrights in the 22 | ; portions it created. 23 | ; 24 | ; This file, and the files included with this file, is distributed 25 | ; and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | ; KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | ; ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | ; ENJOYMENT OR NON-INFRINGEMENT. 30 | ; 31 | ; Technology Compatibility Kit Test Suite(s) Location: 32 | ; http://www.helixcommunity.org/content/tck 33 | ; 34 | ; Contributor(s): 35 | ; 36 | ; ***** END LICENSE BLOCK ***** 37 | 38 | ;========================================= 39 | ; SpdC.ASM 40 | ; from spd.asm, modified for Mp3Enc Class 41 | ; 42 | ; MPEG Layer III encode 43 | ; acountic model, spreading function 44 | ; flat 32, masm 6.0 45 | ; 46 | ; old layer II spd.asm not valid for Layer III at 32kHz 47 | ; have N=2, rewritten for Layer III 11/16/98 48 | ; 49 | ;========================================== 50 | .386P 51 | OPTION PROC:PRIVATE 52 | OPTION CASEMAP:NOTPUBLIC 53 | ASSUME ds:FLAT, cs:FLAT, ss:FLAT 54 | 55 | ;========================================================= 56 | ;========================================================= 57 | _DATA SEGMENT PARA PUBLIC USE32 'DATA' 58 | 59 | 60 | _DATA ENDS 61 | ;========================================================= 62 | ;========================================================= 63 | _TEXT SEGMENT para PUBLIC USE32 'CODE' 64 | ;;========================================================== 65 | ;;========================================================== 66 | _spd PROC PUBLIC 67 | ;; 68 | ;;void spd(float e[2][64], float ec[2][64], SPD_CNTL c[65], float w[]) 69 | ;; 70 | ;; arguments 71 | e_addr textequ 72 | ec_addr textequ 73 | spd_cntl_arg textequ 74 | w_arg textequ 75 | 76 | npush = 4 77 | push esi 78 | push edi 79 | push ebx 80 | push ecx 81 | ;; 82 | w textequ 83 | spd_cntl textequ 84 | ;; 85 | ;; 86 | mov esi, e_addr 87 | mov edi, ec_addr 88 | mov ebx, w_arg ;; w[k] 89 | mov edx, spd_cntl_arg 90 | 91 | mov cl, byte ptr spd_cntl[8*64] ;; npart 92 | 93 | a100: 94 | mov eax, spd_cntl[4] ;; offset 95 | mov ch, byte ptr spd_cntl[0] ;; count 96 | fldz 97 | fldz 98 | add edx, 8 99 | a200: 100 | fld w 101 | fld dword ptr [esi+4*eax] 102 | fmul st, st(1) 103 | fld dword ptr [esi+4*eax][4*64] 104 | fmulp st(2), st 105 | faddp st(3), st 106 | faddp st(1), st 107 | inc eax 108 | add ebx, 4 109 | dec ch 110 | jg a200 111 | ;;----- 112 | fstp dword ptr [edi][4*64] 113 | fstp dword ptr [edi] 114 | add edi, 4 115 | dec cl 116 | jg a100 117 | ; 118 | pop ecx 119 | pop ebx 120 | pop edi 121 | pop esi 122 | 123 | ret 124 | ;; 125 | _spd ENDP 126 | ;==================================== 127 | _TEXT ENDS 128 | ;;================================== 129 | END 130 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2024, Maik Merten 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | # 5 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | # 7 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | # build directories for release, debug and profiling 10 | DIR_BUILDS=builds 11 | DIR_REL=$(DIR_BUILDS)/release 12 | DIR_DEB=$(DIR_BUILDS)/debug 13 | DIR_PRF=$(DIR_BUILDS)/profile 14 | 15 | # executable names for release and debug 16 | EXE_REL=hmp3 17 | EXE_DEB=hmp3 18 | EXE_PRF=hmp3 19 | 20 | # name of static library file 21 | ALIB=libhmp3.a 22 | 23 | # location of hmp3 source files 24 | SRC_PREFIX=./hmp3/src 25 | 26 | CC=gcc 27 | CC_WIN32=i686-w64-mingw32-gcc 28 | CC_WIN64=x86_64-w64-mingw32-gcc 29 | 30 | CFLAGS_COMMON=-O3 -flto=auto -c -I$(SRC_PREFIX)/pub -DIEEE_FLOAT -D_FILE_OFFSET_BITS=64 31 | CFLAGS_REL=$(CFLAGS_COMMON) 32 | CFLAGS_REL_WIN32=-march=pentium3 -mtune=pentium3 -mfpmath=sse $(CFLAGS_COMMON) 33 | CFLAGS_REL_WIN64=-march=x86-64 $(CFLAGS_COMMON) 34 | 35 | CFLAGS_DEB=-g -O0 -flto=auto -DDEBUG -c -I$(SRC_PREFIX)/pub -DIEEE_FLOAT -D_FILE_OFFSET_BITS=64 36 | CFLAGS_PRF=$(CFLAGS_REL) -g -pg 37 | LFLAGS=-lm -lstdc++ -flto=auto 38 | LFLAGS_MINGW=-lstdc++ -static 39 | 40 | AR=ar 41 | 42 | # source files for encoder library within SRC_PREFIX 43 | SRC_LIB_C=amodini2.c cnts.c detect.c emap.c l3init.c l3pack.c mhead.c pcmhpm.c setup.c spdsmr.c xhead.c cnt.c emdct.c filter2.c hwin.c l3math.c pow34.c sbt.c xhwin.c xsbt.c 44 | SRC_LIB_CPP=bitallo.cpp bitallo1.cpp bitallo3.cpp bitalloc.cpp bitallos.cpp bitallosc.cpp mp3enc.cpp srcc.cpp srccf.cpp 45 | 46 | # source files for encoder application 47 | SRC_APP=test/tomp3.cpp 48 | 49 | OBJS_LIB = $(SRC_LIB_C:.c=.o) 50 | OBJS_LIB +=$(SRC_LIB_CPP:.cpp=.o) 51 | 52 | OBJS_LIB_REL = $(addprefix $(DIR_REL)/,$(OBJS_LIB)) 53 | OBJS_LIB_DEB = $(addprefix $(DIR_DEB)/,$(OBJS_LIB)) 54 | OBJS_LIB_PRF = $(addprefix $(DIR_PRF)/,$(OBJS_LIB)) 55 | 56 | OBJS_APP_REL = $(addprefix $(DIR_REL)/, $(SRC_APP:.cpp=.o)) 57 | OBJS_APP_DEB = $(addprefix $(DIR_DEB)/, $(SRC_APP:.cpp=.o)) 58 | OBJS_APP_PRF = $(addprefix $(DIR_PRF)/, $(SRC_APP:.cpp=.o)) 59 | 60 | .PHONY: clean prep 61 | all: prep $(DIR_REL)/$(EXE_REL) 62 | debug: prep $(DIR_DEB)/$(EXE_DEB) 63 | profile: prep $(DIR_PRF)/$(EXE_PRF) 64 | 65 | release-win32: CC=$(CC_WIN32) 66 | release-win32: CFLAGS_REL=$(CFLAGS_REL_WIN32) 67 | release-win32: LFLAGS=$(LFLAGS_MINGW) 68 | release-win32: clean all 69 | 70 | release-win64: CC=$(CC_WIN64) 71 | release-win64: CFLAGS_REL=$(CFLAGS_REL_WIN64) 72 | release-win64: LFLAGS=$(LFLAGS_MINGW) 73 | release-win64: clean all 74 | 75 | 76 | # Release 77 | 78 | $(DIR_REL)/%.o: $(SRC_PREFIX)/%.c 79 | $(CC) $(CFLAGS_REL) -o $@ $< 80 | 81 | $(DIR_REL)/%.o: $(SRC_PREFIX)/%.cpp 82 | $(CC) $(CFLAGS_REL) -o $@ $< 83 | 84 | $(DIR_REL)/$(ALIB): $(OBJS_LIB_REL) 85 | $(AR) rcs $@ $^ 86 | 87 | $(DIR_REL)/$(EXE_REL): $(OBJS_LIB_REL) $(OBJS_APP_REL) 88 | $(CC) -o $@ $^ $(LFLAGS) 89 | 90 | 91 | # Debug 92 | 93 | $(DIR_DEB)/%.o: $(SRC_PREFIX)/%.c 94 | $(CC) $(CFLAGS_DEB) -o $@ $< 95 | 96 | $(DIR_DEB)/%.o: $(SRC_PREFIX)/%.cpp 97 | $(CC) $(CFLAGS_DEB) -o $@ $< 98 | 99 | $(DIR_DEB)/$(ALIB): $(OBJS_LIB_DEB) 100 | $(AR) rcs $@ $^ 101 | 102 | $(DIR_DEB)/$(EXE_DEB): $(OBJS_LIB_DEB) $(OBJS_APP_DEB) 103 | $(CC) -o $@ $^ $(LFLAGS) 104 | 105 | # Profile 106 | 107 | $(DIR_PRF)/%.o: $(SRC_PREFIX)/%.c 108 | $(CC) $(CFLAGS_PRF) -o $@ $< 109 | 110 | $(DIR_PRF)/%.o: $(SRC_PREFIX)/%.cpp 111 | $(CC) $(CFLAGS_PRF) -o $@ $< 112 | 113 | $(DIR_PRF)/$(ALIB): $(OBJS_LIB_PRF) 114 | $(AR) rcs $@ $^ 115 | 116 | $(DIR_PRF)/$(EXE_PRF): $(OBJS_LIB_PRF) $(OBJS_APP_PRF) 117 | $(CC) -o $@ $^ -pg $(LFLAGS) 118 | 119 | 120 | prep: 121 | @mkdir -p $(DIR_REL)/test $(DIR_DEB)/test $(DIR_PRF)/test 122 | 123 | clean: 124 | @rm -rf $(DIR_BUILDS) 125 | -------------------------------------------------------------------------------- /hmp3/src/pub/l3e.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: l3e.h,v 1.1 2005/07/13 17:22:24 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _L3E_H_ 39 | #define _L3E_H_ 40 | 41 | #define GLOBAL_GAIN_SCALE (4*15) 42 | 43 | /* #define GLOBAL_GAIN_SCALE 0 */ 44 | 45 | /*--------------------------------------------------------------*/ 46 | typedef struct 47 | { 48 | float sig; 49 | float mask; 50 | } 51 | SIG_MASK; 52 | 53 | /*--------------------------------------------------------------*/ 54 | typedef struct 55 | { 56 | int l[23]; 57 | int s[14]; 58 | } 59 | BAND_TABLE; 60 | 61 | /*--------------------------------------------------------------*/ 62 | typedef struct 63 | { 64 | unsigned char *bs_ptr; 65 | unsigned char *bs_ptr0; 66 | unsigned int bitbuf; 67 | int bits; 68 | } 69 | BITDAT; 70 | 71 | /*-- side info ---*/ 72 | typedef struct 73 | { 74 | int part2_3_length; 75 | int big_values; 76 | int global_gain; 77 | int scalefac_compress; 78 | int window_switching_flag; 79 | int block_type; 80 | int mixed_block_flag; 81 | int table_select[3]; 82 | int subblock_gain[3]; 83 | int region0_count; 84 | int region1_count; 85 | int preflag; 86 | int scalefac_scale; 87 | int count1table_select; 88 | int aux_nquads; // ba aux data 89 | int aux_bits; // ba huff data bit count 90 | int aux_not_null; // signals to encode sf+huff (even if huff=0) 91 | int aux_nreg[3]; // pairs in huff regions 92 | int block_type_prev; // aux, previous block type 0,1,2, 93 | int short_flag_current; // aux, 0/1 use short blocks 94 | int short_flag_next; // aux, 0/1 use short blocks 95 | } 96 | GR; 97 | typedef struct 98 | { 99 | int mode; 100 | int mode_ext; 101 | 102 | /*---------------*/ 103 | int main_data_begin; 104 | int private_bits; 105 | 106 | /*---------------*/ 107 | int scfsi[2]; /* 4 bit flags [ch] */ 108 | GR gr[2][2]; /* [gran][ch] */ 109 | } 110 | SIDE_INFO; 111 | 112 | /*-----------------------------------------------------------*/ 113 | 114 | /*-- scale factors ---*/ 115 | typedef struct 116 | { 117 | int l[23]; /* [cb] */ 118 | int s[3][13]; /* [window][cb] */ 119 | } 120 | SCALEFACT; 121 | 122 | /*-----------------------------------------------------------*/ 123 | typedef struct 124 | { 125 | int code; 126 | int len; 127 | } 128 | HUFF_STRUCT; 129 | 130 | //typedef struct { 131 | // unsigned char code; 132 | // unsigned char len; 133 | //} BYTE_HUFF_STRUCT; 134 | typedef struct 135 | { 136 | int code; 137 | int len; 138 | } 139 | BYTE_HUFF_STRUCT; 140 | 141 | ///*-----------------------------------------------------------*/ 142 | //typedef union { 143 | // int s; 144 | // float x; 145 | //} SAMPLE; 146 | ///*-----------------------------------------------------------*/ 147 | 148 | #endif // _L3E_H_ 149 | -------------------------------------------------------------------------------- /hmp3/src/filter2.c: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: 2024-03-16, Case 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | /* 39 | * Layer III MPEG audio encoder 40 | * encoder input short->float cast, optional DC blocking filter 41 | * 42 | */ 43 | 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include // memmove proto 49 | 50 | #include "filter2.h" 51 | 52 | // additional delay for Layer III 53 | // overlap = bufsize - 1152 54 | //#define OVERLAP 480 55 | //#define OVERLAP (2192-1152) 56 | // 3/14/00 buf increased one granule 57 | // 3/27/00 buf increased two granule 58 | #define OVERLAP ((2192+1152)-1152) 59 | 60 | /*====================================================================*/ 61 | void 62 | filter2_init ( int samprate, int filter_select, 63 | int monodual, FILTER2_CONTROL * fc2 ) 64 | { 65 | 66 | fc2->alpha = ( float ) ( 0.001 * 44100.0 / samprate ); /* set dc filter coef */ 67 | fc2->d = fc2->d2 = 0.0f; 68 | 69 | if ( filter_select < 0 ) 70 | filter_select = 0; // default = 0 71 | if ( filter_select > 1 ) 72 | filter_select = 1; // default = 1 73 | 74 | fc2->select = 2 * filter_select + monodual; 75 | 76 | } 77 | 78 | /*--------------------------------------------------------------------*/ 79 | void 80 | filter2 ( float pcm[], float *buf1, float *buf2, FILTER2_CONTROL * fc2 ) 81 | { 82 | int i; 83 | float *x, *y; 84 | float t, alpha, d, d2; 85 | 86 | switch ( fc2->select ) 87 | { 88 | case 0: 89 | // filter_mono0 90 | x = buf1 + 1152; 91 | memmove ( x, buf1, OVERLAP * sizeof ( float ) ); 92 | for ( i = 0; i < 1152; i++ ) 93 | *--x = pcm[i]; 94 | return; 95 | 96 | case 1: 97 | //filter_dual0 98 | x = buf1 + 1152; 99 | y = buf2 + 1152; 100 | memmove ( x, buf1, OVERLAP * sizeof ( float ) ); 101 | memmove ( y, buf2, OVERLAP * sizeof ( float ) ); 102 | for ( i = 0; i < 2304; i += 2 ) 103 | { 104 | *--x = pcm[i]; 105 | *--y = pcm[i + 1]; 106 | } 107 | return; 108 | 109 | case 2: 110 | //filter_mono_dc 111 | alpha = fc2->alpha; 112 | d = fc2->d; 113 | 114 | x = buf1 + 1152; 115 | memmove ( x, buf1, OVERLAP * sizeof ( float ) ); 116 | for ( i = 0; i < 1152; i++ ) 117 | { 118 | t = ( pcm[i] - d ); 119 | d = d + alpha * t; 120 | *--x = t; 121 | } 122 | 123 | fc2->alpha = alpha; 124 | fc2->d = d; 125 | return; 126 | 127 | case 3: 128 | //filter_dual_dc 129 | alpha = fc2->alpha; 130 | d = fc2->d; 131 | d2 = fc2->d2; 132 | 133 | x = buf1 + 1152; 134 | y = buf2 + 1152; 135 | memmove ( x, buf1, OVERLAP * sizeof ( float ) ); 136 | memmove ( y, buf2, OVERLAP * sizeof ( float ) ); 137 | for ( i = 0; i < 2304; i += 2 ) 138 | { 139 | t = ( float ) ( pcm[i] - d ); 140 | d = d + alpha * t; 141 | *--x = t; 142 | t = pcm[i + 1] - d2; 143 | d2 = d2 + alpha * t; 144 | *--y = t; 145 | } 146 | 147 | fc2->alpha = alpha; 148 | fc2->d = d; 149 | fc2->d2 = d2; 150 | return; 151 | } // end switch 152 | 153 | } 154 | 155 | /*====================================================================*/ 156 | -------------------------------------------------------------------------------- /hmp3/src/platform/win/i386/recip.inc: -------------------------------------------------------------------------------- 1 | ; ***** BEGIN LICENSE BLOCK ***** 2 | ; Source last modified: $Id: recip.inc,v 1.2 2005/08/09 20:43:45 karll Exp $ 3 | ; 4 | ; Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | ; 6 | ; The contents of this file, and the files included with this file, 7 | ; are subject to the current version of the RealNetworks Public 8 | ; Source License (the "RPSL") available at 9 | ; http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | ; the file under the current version of the RealNetworks Community 11 | ; Source License (the "RCSL") available at 12 | ; http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | ; will apply. You may also obtain the license terms directly from 14 | ; RealNetworks. You may not use this file except in compliance with 15 | ; the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | ; to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | ; the rights, obligations and limitations governing use of the 18 | ; contents of the file. 19 | ; 20 | ; This file is part of the Helix DNA Technology. RealNetworks is the 21 | ; developer of the Original Code and owns the copyrights in the 22 | ; portions it created. 23 | ; 24 | ; This file, and the files included with this file, is distributed 25 | ; and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | ; KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | ; ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | ; ENJOYMENT OR NON-INFRINGEMENT. 30 | ; 31 | ; Technology Compatibility Kit Test Suite(s) Location: 32 | ; http://www.helixcommunity.org/content/tck 33 | ; 34 | ; Contributor(s): 35 | ; 36 | ; ***** END LICENSE BLOCK ***** 37 | 38 | 39 | look_rec label dword 40 | dd 001001FF7h, 001005FB7h, 001009F36h, 00100DE74h, 001011D71h, 001015C2Ch 41 | dd 001019AA6h, 00101D8DCh, 0010216D0h, 001025480h, 0010291EDh, 00102CF16h 42 | dd 001030BFAh, 001034899h, 0010384F3h, 00103C107h, 00103FCD5h, 00104385Ch 43 | dd 00104739Ch, 00104AE95h, 00104E946h, 0010523AFh, 001055DCEh, 0010597A5h 44 | dd 00105D132h, 001060A74h, 00106436Ch, 001067C19h, 00106B47Bh, 00106EC90h 45 | dd 001072459h, 001075BD5h, 001079304h, 00107C9E5h, 001080077h, 0010836BBh 46 | dd 001086CAFh, 00108A253h, 00108D7A6h, 001090CA9h, 00109415Ah, 0010975BAh 47 | dd 00109A9C7h, 00109DD81h, 0010A10E7h, 0010A43FAh, 0010A76B7h, 0010AA920h 48 | dd 0010ADB33h, 0010B0CEFh, 0010B3E55h, 0010B6F63h, 0010BA01Ah, 0010BD078h 49 | dd 0010C007Ch, 0010C3027h, 0010C5F78h, 0010C8E6Eh, 0010CBD08h, 0010CEB47h 50 | dd 0010D1928h, 0010D46ACh, 0010D73D3h, 0010DA09Ah, 0010DCD03h, 0010DF90Bh 51 | dd 0010E24B3h, 0010E4FFAh, 0010E7AE0h, 0010EA562h, 0010ECF82h, 0010EF93Dh 52 | dd 0010F2295h, 0010F4B87h, 0010F7413h, 0010F9C38h, 0010FC3F7h, 0010FEB4Dh 53 | dd 00110123Bh, 0011038BFh, 001105ED9h, 001108488h, 00110A9CBh, 00110CEA2h 54 | dd 00110F30Ch, 001111708h, 001113A95h, 001115DB2h, 001118060h, 00111A29Ch 55 | dd 00111C466h, 00111E5BEh, 0011206A2h, 001122712h, 00112470Ch, 001126691h 56 | dd 00112859Eh, 00112A434h, 00112C251h, 00112DFF5h, 00112FD1Eh, 0011319CCh 57 | dd 0011335FEh, 0011351B3h, 001136CEAh, 0011387A2h, 00113A1DAh, 00113BB91h 58 | dd 00113D4C6h, 00113ED79h, 0011405A8h, 001141D52h, 001143476h, 001144B14h 59 | dd 00114612Ah, 0011476B7h, 001148BBAh, 00114A033h, 00114B420h, 00114C77Fh 60 | dd 00114DA51h, 00114EC93h, 00114FE45h, 001150F66h, 001151FF4h, 001152FEFh 61 | dd 001153F55h, 001154E25h, 001155C5Eh, 0011569FEh, 001157705h, 001158372h 62 | dd 001158F42h, 001159A75h, 00115A50Ah, 00115AEFFh, 00115B854h, 00115C105h 63 | dd 00115C914h, 00115D07Dh, 00115D741h, 00115DD5Dh, 00115E2D0h, 00115E798h 64 | dd 00115EBB5h, 00115EF25h, 00115F1E6h, 00115F3F8h, 00115F558h, 00115F605h 65 | dd 00115F5FEh, 00115F541h, 00115F3CDh, 00115F1A0h, 00115EEB8h, 00115EB15h 66 | dd 00115E6B4h, 00115E193h, 00115DBB2h, 00115D50Fh, 00115CDA7h, 00115C579h 67 | dd 00115BC84h, 00115B2C6h, 00115A83Dh, 001159CE7h, 0011590C3h, 0011583CEh 68 | dd 001157607h, 00115676Dh, 0011557FCh, 0011547B4h, 001153692h, 001152495h 69 | dd 0011511BAh, 00114FE00h, 00114E964h, 00114D3E5h, 00114BD80h, 00114A634h 70 | dd 001148DFEh, 0011474DDh, 001145ACDh, 001143FCDh, 0011423DBh, 0011406F4h 71 | dd 00113E917h, 00113CA40h, 00113AA6Fh, 00113899Fh, 0011367CFh, 0011344FDh 72 | dd 001132126h, 00112FC47h, 00112D65Fh, 00112AF6Ah, 001128766h, 001125E51h 73 | dd 001123428h, 0011208E8h, 00111DC8Eh, 00111AF18h, 001118083h, 0011150CDh 74 | dd 001111FF2h, 00110EDEFh, 00110BAC2h, 001108668h, 0011050DEh, 001101A20h 75 | dd 0010FE22Ch, 0010FA8FFh, 0010F6E95h, 0010F32EBh, 0010EF5FEh, 0010EB7CBh 76 | dd 0010E784Fh, 0010E3785h, 0010DF56Ch, 0010DB1FEh, 0010D6D39h, 0010D271Ah 77 | dd 0010CDF9Ch, 0010C96BCh, 0010C4C76h, 0010C00C7h, 0010BB3ABh, 0010B651Dh 78 | dd 0010B151Bh, 0010AC39Fh, 0010A70A6h, 0010A1C2Dh, 00109C62Eh, 001096EA5h 79 | dd 00109158Fh, 00108BAE7h, 001085EA9h, 0010800D0h, 00107A157h, 00107403Bh 80 | dd 00106DD76h, 001067904h, 0010612E0h, 00105AB05h, 00105416Eh, 00104D617h 81 | dd 0010468FAh, 00103FA11h, 001038959h, 0010316CBh, 00102A262h, 001022C19h 82 | dd 00101B3E9h, 0010139CEh, 00100BDC2h, 001003FBFh 83 | -------------------------------------------------------------------------------- /hmp3/src/platform/win/i386/sqrt.inc: -------------------------------------------------------------------------------- 1 | ; ***** BEGIN LICENSE BLOCK ***** 2 | ; Source last modified: $Id: sqrt.inc,v 1.2 2005/08/09 20:43:45 karll Exp $ 3 | ; 4 | ; Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | ; 6 | ; The contents of this file, and the files included with this file, 7 | ; are subject to the current version of the RealNetworks Public 8 | ; Source License (the "RPSL") available at 9 | ; http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | ; the file under the current version of the RealNetworks Community 11 | ; Source License (the "RCSL") available at 12 | ; http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | ; will apply. You may also obtain the license terms directly from 14 | ; RealNetworks. You may not use this file except in compliance with 15 | ; the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | ; to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | ; the rights, obligations and limitations governing use of the 18 | ; contents of the file. 19 | ; 20 | ; This file is part of the Helix DNA Technology. RealNetworks is the 21 | ; developer of the Original Code and owns the copyrights in the 22 | ; portions it created. 23 | ; 24 | ; This file, and the files included with this file, is distributed 25 | ; and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | ; KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | ; ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | ; ENJOYMENT OR NON-INFRINGEMENT. 30 | ; 31 | ; Technology Compatibility Kit Test Suite(s) Location: 32 | ; http://www.helixcommunity.org/content/tck 33 | ; 34 | ; Contributor(s): 35 | ; 36 | ; ***** END LICENSE BLOCK ***** 37 | 38 | 39 | look_sqrt label dword 40 | dd 01FB51F5Fh, 01FB553B0h, 01FB5874Fh, 01FB5BA3Fh, 01FB5EC80h, 01FB61E16h 41 | dd 01FB64F01h, 01FB67F45h, 01FB6AEE2h, 01FB6DDDBh, 01FB70C32h, 01FB739E8h 42 | dd 01FB766FEh, 01FB79377h, 01FB7BF54h, 01FB7EA98h, 01FB81542h, 01FB83F56h 43 | dd 01FB868D5h, 01FB891BFh, 01FB8BA18h, 01FB8E1DFh, 01FB90917h, 01FB92FC1h 44 | dd 01FB955DEh, 01FB97B71h, 01FB9A079h, 01FB9C4F9h, 01FB9E8F2h, 01FBA0C64h 45 | dd 01FBA2F53h, 01FBA51BDh, 01FBA73A6h, 01FBA950Eh, 01FBAB5F6h, 01FBAD65Fh 46 | dd 01FBAF64Bh, 01FBB15BBh, 01FBB34B0h, 01FBB532Ah, 01FBB712Ch, 01FBB8EB6h 47 | dd 01FBBABC9h, 01FBBC866h, 01FBBE48Fh, 01FBC0044h, 01FBC1B86h, 01FBC3657h 48 | dd 01FBC50B6h, 01FBC6AA6h, 01FBC8427h, 01FBC9D3Bh, 01FBCB5E1h, 01FBCCE1Bh 49 | dd 01FBCE5EAh, 01FBCFD4Eh, 01FBD1449h, 01FBD2ADCh, 01FBD4106h, 01FBD56CAh 50 | dd 01FBD6C28h, 01FBD8120h, 01FBD95B4h, 01FBDA9E4h, 01FBDBDB2h, 01FBDD11Dh 51 | dd 01FBDE426h, 01FBDF6CFh, 01FBE0919h, 01FBE1B03h, 01FBE2C8Eh, 01FBE3DBCh 52 | dd 01FBE4E8Dh, 01FBE5F01h, 01FBE6F1Ah, 01FBE7ED8h, 01FBE8E3Bh, 01FBE9D45h 53 | dd 01FBEABF6h, 01FBEBA4Fh, 01FBEC850h, 01FBED5F9h, 01FBEE34Dh, 01FBEF04Ah 54 | dd 01FBEFCF3h, 01FBF0946h, 01FBF1546h, 01FBF20F2h, 01FBF2C4Bh, 01FBF3752h 55 | dd 01FBF4208h, 01FBF4C6Ch, 01FBF567Fh, 01FBF6043h, 01FBF69B7h, 01FBF72DCh 56 | dd 01FBF7BB2h, 01FBF843Bh, 01FBF8C76h, 01FBF9464h, 01FBF9C06h, 01FBFA35Ch 57 | dd 01FBFAA66h, 01FBFB126h, 01FBFB79Bh, 01FBFBDC6h, 01FBFC3A8h, 01FBFC941h 58 | dd 01FBFCE91h, 01FBFD399h, 01FBFD85Ah, 01FBFDCD3h, 01FBFE106h, 01FBFE4F2h 59 | dd 01FBFE899h, 01FBFEBFAh, 01FBFEF16h, 01FBFF1EEh, 01FBFF481h, 01FBFF6D1h 60 | dd 01FBFF8DDh, 01FBFFAA7h, 01FBFFC2Dh, 01FBFFD72h, 01FBFFE75h, 01FBFFF37h 61 | dd 01FBFFFB8h, 01FBFFFF8h, 01FBFFFF0h, 01FBFFF71h, 01FBFFE74h, 01FBFFCFBh 62 | dd 01FBFFB06h, 01FBFF899h, 01FBFF5B3h, 01FBFF256h, 01FBFEE83h, 01FBFEA3Dh 63 | dd 01FBFE583h, 01FBFE058h, 01FBFDABCh, 01FBFD4B1h, 01FBFCE38h, 01FBFC752h 64 | dd 01FBFC000h, 01FBFB843h, 01FBFB01Dh, 01FBFA78Eh, 01FBF9E98h, 01FBF953Bh 65 | dd 01FBF8B79h, 01FBF8152h, 01FBF76C8h, 01FBF6BDCh, 01FBF608Eh, 01FBF54E0h 66 | dd 01FBF48D2h, 01FBF3C65h, 01FBF2F9Ah, 01FBF2273h, 01FBF14F0h, 01FBF0711h 67 | dd 01FBEF8D8h, 01FBEEA46h, 01FBEDB5Bh, 01FBECC18h, 01FBEBC7Eh, 01FBEAC8Eh 68 | dd 01FBE9C48h, 01FBE8BAEh, 01FBE7ABFh, 01FBE697Eh, 01FBE57E9h, 01FBE4603h 69 | dd 01FBE33CCh, 01FBE2145h, 01FBE0E6Dh, 01FBDFB47h, 01FBDE7D2h, 01FBDD410h 70 | dd 01FBDC000h, 01FBDABA4h, 01FBD96FCh, 01FBD8209h, 01FBD6CCCh, 01FBD5744h 71 | dd 01FBD4173h, 01FBD2B59h, 01FBD14F8h, 01FBCFE4Eh, 01FBCE75Dh, 01FBCD026h 72 | dd 01FBCB8A9h, 01FBCA0E7h, 01FBC88E0h, 01FBC7094h, 01FBC5805h, 01FBC3F32h 73 | dd 01FBC261Ch, 01FBC0CC5h, 01FBBF32Bh, 01FBBD950h, 01FBBBF34h, 01FBBA4D8h 74 | dd 01FBB8A3Dh, 01FBB6F61h, 01FBB5447h, 01FBB38EFh, 01FBB1D58h, 01FBB0184h 75 | dd 01FBAE572h, 01FBAC924h, 01FBAAC9Ah, 01FBA8FD4h, 01FBA72D2h, 01FBA5596h 76 | dd 01FBA381Fh, 01FBA1A6Dh, 01FB9FC82h, 01FB9DE5Eh, 01FB9C000h, 01FB9A16Ah 77 | dd 01FB9829Bh, 01FB96395h, 01FB94458h, 01FB924E3h, 01FB90537h, 01FB8E555h 78 | dd 01FB8C53Dh, 01FB8A4F0h, 01FB8846Dh, 01FB863B5h, 01FB842C8h, 01FB821A8h 79 | dd 01FB80053h, 01FB7DECAh, 01FB7BD0Fh, 01FB79B20h, 01FB778FFh, 01FB756ABh 80 | dd 01FB73426h, 01FB7116Eh, 01FB6EE85h, 01FB6CB6Ch, 01FB6A821h, 01FB684A6h 81 | dd 01FB660FBh, 01FB63D20h, 01FB61915h, 01FB5F4DBh, 01FB5D072h, 01FB5ABDAh 82 | dd 01FB58713h, 01FB5621Fh, 01FB53CFCh, 01FB517ACh 83 | -------------------------------------------------------------------------------- /hmp3/src/platform/win/i386/epartc.asm: -------------------------------------------------------------------------------- 1 | ; ***** BEGIN LICENSE BLOCK ***** 2 | ; Source last modified: $Id: epartc.asm,v 1.1 2005/07/13 17:22:23 rggammon Exp $ 3 | ; 4 | ; Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | ; 6 | ; The contents of this file, and the files included with this file, 7 | ; are subject to the current version of the RealNetworks Public 8 | ; Source License (the "RPSL") available at 9 | ; http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | ; the file under the current version of the RealNetworks Community 11 | ; Source License (the "RCSL") available at 12 | ; http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | ; will apply. You may also obtain the license terms directly from 14 | ; RealNetworks. You may not use this file except in compliance with 15 | ; the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | ; to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | ; the rights, obligations and limitations governing use of the 18 | ; contents of the file. 19 | ; 20 | ; This file is part of the Helix DNA Technology. RealNetworks is the 21 | ; developer of the Original Code and owns the copyrights in the 22 | ; portions it created. 23 | ; 24 | ; This file, and the files included with this file, is distributed 25 | ; and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | ; KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | ; ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | ; ENJOYMENT OR NON-INFRINGEMENT. 30 | ; 31 | ; Technology Compatibility Kit Test Suite(s) Location: 32 | ; http://www.helixcommunity.org/content/tck 33 | ; 34 | ; Contributor(s): 35 | ; 36 | ; ***** END LICENSE BLOCK ***** 37 | 38 | ;----------------------------------------- 39 | ; EpartC.ASM 40 | ; 41 | ; from Epart.asm modified for Mp3Enc Class 42 | ; 43 | ; MPEG Layer II encode 44 | ; acountic model II, partition 45 | ; masm 6.0 flat 32 46 | ; mod bigger calc partition sized for Layer III 47 | ; 48 | ;------------------------------------------- 49 | .486P 50 | OPTION PROC:PRIVATE 51 | OPTION CASEMAP:NOTPUBLIC 52 | ASSUME ds:FLAT, cs:FLAT, ss:FLAT 53 | ;========================================================= 54 | ;========================================================= 55 | ;========================================================= 56 | _DATA SEGMENT PARA PUBLIC USE32 'DATA' 57 | 58 | 59 | _DATA ENDS 60 | ;========================================================= 61 | ;========================================================= 62 | _TEXT SEGMENT para PUBLIC USE32 'CODE' 63 | ;========================================================= 64 | ;------------------------------------ 65 | _epart proc public 66 | ;; 67 | ;;void epart(float rr[], float pmeas[], float e[][64], int nsum[68]) 68 | ;; 69 | ;; arguments 70 | rr textequ 71 | pmeas textequ 72 | eout textequ 73 | nsum_arg textequ 74 | 75 | npush = (4) 76 | push esi 77 | push edi 78 | push ebx 79 | push ecx 80 | ;; 81 | nsum textequ <[edx]> 82 | 83 | mov edx, nsum_arg 84 | mov ebx, rr 85 | mov esi, pmeas 86 | mov edi, eout 87 | ;; 88 | ;; --- computed pred region 89 | mov ch, byte ptr nsum[4*64] 90 | mov al, byte ptr nsum[4*65] 91 | add ch, al 92 | mov ah, byte ptr nsum[4*66] ;; save for default pred region 93 | A_100: 94 | fldz 95 | fldz 96 | mov cl, byte ptr nsum 97 | A_150: 98 | fld dword ptr [ebx] ;; rr 99 | fadd st(1), st ;; sum rr 100 | fmul dword ptr [esi] ;; pmeas 101 | add ebx, 4 102 | add esi, 4 103 | dec cl 104 | faddp st(2), st ;; sum p*rr 105 | jne a_150 106 | 107 | add edx, 4 108 | fstp dword ptr [edi] 109 | fstp dword ptr [edi+4*64] 110 | add edi, 4 111 | dec ch 112 | jne a_100 113 | 114 | 115 | ;; --- default pred region 116 | test ah, ah 117 | jle done 118 | fld dword ptr [esi] ;; default pmeas 119 | A_200: 120 | fldz 121 | mov cl, byte ptr nsum[edx] 122 | A_250: 123 | fadd dword ptr [ebx] ;; rr 124 | add ebx, 4 125 | dec cl 126 | jne a_250 127 | add edx, 4 128 | fst dword ptr [edi] 129 | fmul st, st(1) 130 | fstp dword ptr [edi+4*64] 131 | add edi, 4 132 | dec ah 133 | jne a_200 134 | fstp st(0) ;; pop stack 135 | done: 136 | ;; zero fill 137 | mov ecx, 4*64 138 | sub ecx, edx 139 | jle exit 140 | xor eax, eax 141 | A_300: 142 | mov dword ptr [edi], eax 143 | mov dword ptr [edi+4*64], eax 144 | add edi, 4 145 | sub ecx, 4 146 | jg a_300 147 | ;; 148 | exit: 149 | pop ecx 150 | pop ebx 151 | pop edi 152 | pop esi 153 | 154 | ret 155 | ;; 156 | _epart ENDP 157 | ;---------------------------------- 158 | ;==================================== 159 | ;==================================== 160 | _TEXT ENDS 161 | ;==================================== 162 | END 163 | -------------------------------------------------------------------------------- /hmp3/src/pub/srcc.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: 2024-05-20, Maik Merten 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _SRCC_H_ 39 | #define _SRCC_H_ 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include "encapp.h" // need IN_OUT 48 | 49 | typedef struct 50 | { 51 | int ncase; // 52 | int minbuf; // number samples required in caller buffer for 1152 output 53 | // stage 1 (if any ) 54 | int nbuf; // number samples in stage1 output buffer 55 | int kbuf; // index into stage1 output = stage2 input 56 | int k1; // sample delta 57 | int m1; // filter fraction sample delta 58 | int n1; // n filters 59 | int ntaps1; 60 | int totcoef1; // total number filter coefs 61 | int am1; // accum filter delta 62 | int ic1; // coef index 63 | float coef1[21]; 64 | // 65 | int k; // sample delta 66 | int m; // filter fraction sample delta 67 | int n; // n filters 68 | int ntaps; 69 | int totcoef; // total number filter coefs 70 | int am; // accum filter delta 71 | int ic; // coef index 72 | float coef[1280]; // 1280 for 11025:32000 73 | // two stage intermediate buffers 74 | float buf[128 + 64]; // case 4 stage 1 output = stage2 input 75 | float buf2[128 + 64]; // case 4 stage 1 output = stage2 input 76 | } 77 | SRC_STRUCT; 78 | 79 | //typedef struct { 80 | //int in_bytes; 81 | //int out_bytes; 82 | //} IN_OUT; 83 | 84 | //================================================================= 85 | class Csrc 86 | { 87 | 88 | public: 89 | Csrc(); 90 | ~Csrc(); 91 | 92 | int sr_convert_init ( int source, int channels, int bits, int is_float, 93 | int target, int target_channels, 94 | int *encode_cutoff_freq ); 95 | IN_OUT sr_convert ( unsigned char xin[], float yout[] ); 96 | 97 | //-data------------------------------------------------ 98 | private: 99 | SRC_STRUCT src; 100 | 101 | unsigned int src_bytes_out; 102 | int src_filter; 103 | int m_channels, m_bits, m_is_float, m_frames_to_convert; 104 | float *itof_buf; 105 | 106 | //-functions------------------------------------------------ 107 | int gen_src_filter ( int source0, int target ); 108 | int gen_f1 ( float a[], int ntaps, int ncutoff, int nfilters, int m ); 109 | 110 | int src_filter_mono_case0 ( float x[], float y[] ); 111 | int src_filter_mono_case1 ( float x[], float y[] ); 112 | int src_filter_mono_case2 ( float x[], float y[] ); 113 | int src_filter_mono_case3 ( float x[], float y[] ); 114 | int src_filter_mono_case4 ( float x[], float y[] ); 115 | 116 | int src_filter_dual_case0 ( float x[], float y[] ); 117 | int src_filter_dual_case1 ( float x[][2], float y[][2] ); 118 | int src_filter_dual_case2 ( float x[][2], float y[][2] ); 119 | int src_filter_dual_case3 ( float x[][2], float y[][2] ); 120 | int src_filter_dual_case4 ( float x[][2], float y[][2] ); 121 | 122 | int src_filter_to_mono_case0 ( float x[][2], float y[] ); 123 | int src_filter_to_mono_case1 ( float x[][2], float y[] ); 124 | int src_filter_to_mono_case2 ( float x[][2], float y[] ); 125 | int src_filter_to_mono_case3 ( float x[][2], float y[] ); 126 | int src_filter_to_mono_case4 ( float x[][2], float y[] ); 127 | 128 | int stage1_mono ( float x[] ); 129 | int stage1_dual ( float x[][2] ); 130 | int stage1_to_mono ( float x[][2] ); 131 | 132 | }; 133 | 134 | #endif // _SRCC_H_ 135 | -------------------------------------------------------------------------------- /hmp3/src/pub/balow.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: balow.h,v 1.1 2005/07/13 17:34:48 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _BALOW_H_ 39 | #define _BALOW_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" 43 | { 44 | #endif 45 | //---------------------------------------------- 46 | typedef struct 47 | { 48 | int a; 49 | int b; 50 | } 51 | INTPAIR; 52 | float dbLog ( float x ); // full precision, needs 0.0 protection 53 | float dbLogB ( float x ); // max eps 0.01, no 0.0 protection required 54 | int mbLog ( float x ); // full precision, needs 0.0 protection 55 | 56 | #define mbLogB mbLogC 57 | int mbLogB ( float x ); // max eps 1mb, relative eps 5.8e-5 58 | // no 0.0 protection required 59 | int mbLogC ( float x ); // max eps = 4mb, relative eps = 1.5e-4 60 | // no 0.0 protection required 61 | 62 | float mbExp ( int mb ); // inverse mb log 63 | 64 | int round_to_int ( float x ); 65 | 66 | float pos_fmax ( float x, float y ); 67 | float pos_fmin ( float x, float y ); 68 | 69 | int LogSubber ( int mbNoise, int mbNoise2 ); 70 | 71 | void vect_fpow34 ( float x[], float x34[], int n ); 72 | float vect_fmax1 ( float x[], int n ); 73 | void vect_fmax2 ( float x[], int n, float *yout ); 74 | float vect_sign_sxx ( float x[], unsigned char sign[], int n ); 75 | 76 | int ifnc_noise_actual ( float x34[], float x[], 77 | int gsf, int n, int log_of_n ); 78 | int ifnc_ixnoise_actual ( int ix[], float x[], int sf, int n, int logn ); 79 | 80 | int vect_quant ( float x34[], int ix[], int gsf, int n ); 81 | int vect_quantB ( float x34[], int ix[], int gsf, int n ); 82 | int vect_quantB2 ( float x34[], int ix[], int gsf, int n, float qadjust ); 83 | int vect_quantB10x ( float x34[], int ix[], int gsf, int n ); 84 | void vect_ixmax_quantB ( float x34max[], int ixmax[], int gsf[], int n ); 85 | void vect_ix10xmax_quantB ( float x34max[], int ixmax[], int gsf[], 86 | int n ); 87 | int vect_quantX ( float x34[], int ix[], float igain34, int n ); 88 | int vect_quant_clip1 ( float x34[], int ix[], int gsf, int n ); 89 | void vect_limits ( int x[], int upper[], int lower[], int n ); 90 | void shave_01pairs ( float x34[], int ix[], int g, int n, float thres ); 91 | 92 | void fnc_ms_process ( float *xr, int n, unsigned char *ixsign ); 93 | void fnc_ms_process2 ( float *xr, int n, unsigned char *ixsign ); // no sqrt(2) scale 94 | void fnc_ms_sparse ( float *xr, int n, float thres ); 95 | void fnc_ms_sparse_sum ( float *xr, int n, float thres ); 96 | void fnc_sxx ( float *xr, int n, float *sxx ); 97 | int vect_imax ( int x[], int n ); 98 | 99 | INTPAIR ifnc_noise_actual_ms ( float *x34, 100 | float *x, int *sign_mask, 101 | int gsf0, int gsf1, int n, int logn_mb ); 102 | 103 | int ifnc_inverse_gsf_snr2 ( int *qx, float *y, int n ); 104 | int ifnc_inverse_gsf_xfer2 ( int *qx, float *y, int n ); 105 | 106 | void L3init_gen_band_table_long ( int *nBand_l ); 107 | void L3init_gen_band_table_short ( int *nBand_s ); 108 | int L3init_sfbl_limit2 ( int band_limit ); 109 | int L3init_sfbs_limit2 ( int band_limit ); 110 | 111 | /*-------- 112 | INTPAIR subdivide2_quadregion(int ixmax[], int ix[], int ncb, int ch); 113 | // returns (nbig,nquads) 114 | void output_subdivide2(GR *gr_data, int ch); 115 | int subdivide2(int ixmax[], int ix[], int ncb, int opti_flag, int ch); 116 | ----------*/ 117 | 118 | // bitallo1 119 | int L3init_sfbs_limit ( ); 120 | 121 | //---------------------------------------------- 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | 126 | #endif // _BALOW_H_ 127 | -------------------------------------------------------------------------------- /hmp3/src/platform/win/i386/tableaw2.inc: -------------------------------------------------------------------------------- 1 | ; ***** BEGIN LICENSE BLOCK ***** 2 | ; Source last modified: $Id: tableaw2.inc,v 1.1 2005/07/13 17:22:23 rggammon Exp $ 3 | ; 4 | ; Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | ; 6 | ; The contents of this file, and the files included with this file, 7 | ; are subject to the current version of the RealNetworks Public 8 | ; Source License (the "RPSL") available at 9 | ; http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | ; the file under the current version of the RealNetworks Community 11 | ; Source License (the "RCSL") available at 12 | ; http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | ; will apply. You may also obtain the license terms directly from 14 | ; RealNetworks. You may not use this file except in compliance with 15 | ; the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | ; to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | ; the rights, obligations and limitations governing use of the 18 | ; contents of the file. 19 | ; 20 | ; This file is part of the Helix DNA Technology. RealNetworks is the 21 | ; developer of the Original Code and owns the copyrights in the 22 | ; portions it created. 23 | ; 24 | ; This file, and the files included with this file, is distributed 25 | ; and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | ; KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | ; ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | ; ENJOYMENT OR NON-INFRINGEMENT. 30 | ; 31 | ; Technology Compatibility Kit Test Suite(s) Location: 32 | ; http://www.helixcommunity.org/content/tck 33 | ; 34 | ; Contributor(s): 35 | ; 36 | ; ***** END LICENSE BLOCK ***** 37 | 38 | 39 | ;; /*--- encoder window gen by tgena ----*/ 40 | DD -0.000002384, 0.000069618, -0.000021458, -0.004756451 41 | DD 0.030526638, 0.004638195, 0.000747204, 0.000049591 42 | DD -0.000001431, -0.000001192, 0.000030279, 0.000038862 43 | DD -0.000068664, 0.000044108, -0.002731085, -0.002036095 44 | DD 0.014945030, 0.015566349, 0.002285242, 0.002345562 45 | DD 0.000357151, 0.000389576, 0.000023127, 0.000026465 46 | DD -0.000001669, -0.000000954, 0.000025273, 0.000042200 47 | DD -0.000129938, 0.000095845, -0.003094673, -0.001705647 48 | DD 0.014612437, 0.015853405, 0.002244950, 0.002364159 49 | DD 0.000340462, 0.000404835, 0.000021696, 0.000027895 50 | DD -0.000001669, -0.000000954, 0.000019789, 0.000045061 51 | DD -0.000194073, 0.000144243, -0.003468514, -0.001387119 52 | DD 0.014266491, 0.016124010, 0.002197981, 0.002374411 53 | DD 0.000323296, 0.000419379, 0.000020266, 0.000029803 54 | DD -0.000001907, -0.000000716, 0.000013590, 0.000047684 55 | DD -0.000261068, 0.000189305, -0.003851652, -0.001080751 56 | DD 0.013907671, 0.016377449, 0.002145290, 0.002376080 57 | DD 0.000305891, 0.000433207, 0.000018835, 0.000031472 58 | DD -0.000002146, -0.000000716, 0.000006914, 0.000049591 59 | DD -0.000330925, 0.000231266, -0.004243613, -0.000786782 60 | DD 0.013536930, 0.016612768, 0.002087355, 0.002368689 61 | DD 0.000288487, 0.000445843, 0.000017405, 0.000033140 62 | DD -0.000002384, -0.000000477, -0.000000477, 0.000051260 63 | DD -0.000403404, 0.000269651, -0.004643917, -0.000505924 64 | DD 0.013155461, 0.016829968, 0.002024412, 0.002351523 65 | DD 0.000271082, 0.000457526, 0.000016213, 0.000035047 66 | DD -0.000002623, -0.000000477, -0.000008583, 0.000052691 67 | DD -0.000478268, 0.000305176, -0.005051852, -0.000237942 68 | DD 0.012763500, 0.017027855, 0.001957178, 0.002324581 69 | DD 0.000253678, 0.000467778, 0.000015021, 0.000036716 70 | DD -0.000003100, -0.000000477, -0.000017166, 0.000053406 71 | DD -0.000555516, 0.000337124, -0.005466699, 0.000016690 72 | DD 0.012362719, 0.017206431, 0.001885891, 0.002286911 73 | DD 0.000236273, 0.000477076, 0.000013829, 0.000038386 74 | DD -0.000003338, -0.000000477, -0.000026465, 0.000054121 75 | DD -0.000634909, 0.000365973, -0.005887509, 0.000257969 76 | DD 0.011953593, 0.017365217, 0.001811266, 0.002238512 77 | DD 0.000219107, 0.000484467, 0.000012636, 0.000040293 78 | DD -0.000003815, -0.000000239, -0.000036478, 0.000054360 79 | DD -0.000716210, 0.000391960, -0.006313801, 0.000485659 80 | DD 0.011537075, 0.017503500, 0.001733542, 0.002178908 81 | DD 0.000202179, 0.000490427, 0.000011683, 0.000041962 82 | DD -0.000004053, -0.000000239, -0.000046969, 0.000054360 83 | DD -0.000798940, 0.000414610, -0.006744623, 0.000699759 84 | DD 0.011114359, 0.017621041, 0.001653433, 0.002107620 85 | DD 0.000185728, 0.000494719, 0.000010729, 0.000043631 86 | DD -0.000004530, -0.000000239, -0.000058174, 0.000054121 87 | DD -0.000883341, 0.000434399, -0.007179261, 0.000900269 88 | DD 0.010686159, 0.017717600, 0.001570940, 0.002024650 89 | DD 0.000169516, 0.000497102, 0.000009775, 0.000045300 90 | DD -0.000005007, -0.000000239, -0.000070095, 0.000053644 91 | DD -0.000968695, 0.000451327, -0.007616759, 0.001087427 92 | DD 0.010253430, 0.017793178, 0.001487017, 0.001929283 93 | DD 0.000153780, 0.000497580, 0.000009060, 0.000046730 94 | DD -0.000005722, -0.000000239, -0.000082731, 0.000052929 95 | DD -0.001055002, 0.000465393, -0.008056402, 0.001260758 96 | DD 0.009817124, 0.017847061, 0.001401663, 0.001821518 97 | DD 0.000138521, 0.000495911, 0.000008345, 0.000048161 98 | DD -0.000006199, -0.000000239, -0.000095606, 0.000051976 99 | DD -0.001141548, 0.000476837, -0.008497238, 0.001420737 100 | DD 0.009378433, 0.017879486, 0.001315355, 0.001700878 101 | DD 0.000123739, 0.000491858, 0.000007391, 0.000049591 102 | DD -0.000006914, 0.000000000, -0.000109434, 0.000050783 103 | DD -0.001228571, 0.000485659, -0.008938074, 0.001567364 104 | DD 0.008938074, 0.017890454, 0.001228571, 0.001567364 105 | DD 0.000109434, 0.000485659, 0.000006914, 0.000050783 106 | -------------------------------------------------------------------------------- /hmp3/src/tableaw2.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: tableaw2.h,v 1.1 2005/07/13 17:22:21 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | /*--- encoder window gen by tgena ----*/ 39 | - 0.000002384f, 0.000069618f, -0.000021458f, -0.004756451f, 40 | 0.030526638f, 0.004638195f, 0.000747204f, 0.000049591f, 41 | -0.000001431f, -0.000001192f, 0.000030279f, 0.000038862f, 42 | -0.000068664f, 0.000044108f, -0.002731085f, -0.002036095f, 43 | 0.014945030f, 0.015566349f, 0.002285242f, 0.002345562f, 44 | 0.000357151f, 0.000389576f, 0.000023127f, 0.000026465f, 45 | -0.000001669f, -0.000000954f, 0.000025273f, 0.000042200f, 46 | -0.000129938f, 0.000095845f, -0.003094673f, -0.001705647f, 47 | 0.014612437f, 0.015853405f, 0.002244950f, 0.002364159f, 48 | 0.000340462f, 0.000404835f, 0.000021696f, 0.000027895f, 49 | -0.000001669f, -0.000000954f, 0.000019789f, 0.000045061f, 50 | -0.000194073f, 0.000144243f, -0.003468514f, -0.001387119f, 51 | 0.014266491f, 0.016124010f, 0.002197981f, 0.002374411f, 52 | 0.000323296f, 0.000419379f, 0.000020266f, 0.000029803f, 53 | -0.000001907f, -0.000000716f, 0.000013590f, 0.000047684f, 54 | -0.000261068f, 0.000189305f, -0.003851652f, -0.001080751f, 55 | 0.013907671f, 0.016377449f, 0.002145290f, 0.002376080f, 56 | 0.000305891f, 0.000433207f, 0.000018835f, 0.000031472f, 57 | -0.000002146f, -0.000000716f, 0.000006914f, 0.000049591f, 58 | -0.000330925f, 0.000231266f, -0.004243613f, -0.000786782f, 59 | 0.013536930f, 0.016612768f, 0.002087355f, 0.002368689f, 60 | 0.000288487f, 0.000445843f, 0.000017405f, 0.000033140f, 61 | -0.000002384f, -0.000000477f, -0.000000477f, 0.000051260f, 62 | -0.000403404f, 0.000269651f, -0.004643917f, -0.000505924f, 63 | 0.013155461f, 0.016829968f, 0.002024412f, 0.002351523f, 64 | 0.000271082f, 0.000457526f, 0.000016213f, 0.000035047f, 65 | -0.000002623f, -0.000000477f, -0.000008583f, 0.000052691f, 66 | -0.000478268f, 0.000305176f, -0.005051852f, -0.000237942f, 67 | 0.012763500f, 0.017027855f, 0.001957178f, 0.002324581f, 68 | 0.000253678f, 0.000467778f, 0.000015021f, 0.000036716f, 69 | -0.000003100f, -0.000000477f, -0.000017166f, 0.000053406f, 70 | -0.000555516f, 0.000337124f, -0.005466699f, 0.000016690f, 71 | 0.012362719f, 0.017206431f, 0.001885891f, 0.002286911f, 72 | 0.000236273f, 0.000477076f, 0.000013829f, 0.000038386f, 73 | -0.000003338f, -0.000000477f, -0.000026465f, 0.000054121f, 74 | -0.000634909f, 0.000365973f, -0.005887509f, 0.000257969f, 75 | 0.011953593f, 0.017365217f, 0.001811266f, 0.002238512f, 76 | 0.000219107f, 0.000484467f, 0.000012636f, 0.000040293f, 77 | -0.000003815f, -0.000000239f, -0.000036478f, 0.000054360f, 78 | -0.000716210f, 0.000391960f, -0.006313801f, 0.000485659f, 79 | 0.011537075f, 0.017503500f, 0.001733542f, 0.002178908f, 80 | 0.000202179f, 0.000490427f, 0.000011683f, 0.000041962f, 81 | -0.000004053f, -0.000000239f, -0.000046969f, 0.000054360f, 82 | -0.000798940f, 0.000414610f, -0.006744623f, 0.000699759f, 83 | 0.011114359f, 0.017621041f, 0.001653433f, 0.002107620f, 84 | 0.000185728f, 0.000494719f, 0.000010729f, 0.000043631f, 85 | -0.000004530f, -0.000000239f, -0.000058174f, 0.000054121f, 86 | -0.000883341f, 0.000434399f, -0.007179261f, 0.000900269f, 87 | 0.010686159f, 0.017717600f, 0.001570940f, 0.002024650f, 88 | 0.000169516f, 0.000497102f, 0.000009775f, 0.000045300f, 89 | -0.000005007f, -0.000000239f, -0.000070095f, 0.000053644f, 90 | -0.000968695f, 0.000451327f, -0.007616759f, 0.001087427f, 91 | 0.010253430f, 0.017793178f, 0.001487017f, 0.001929283f, 92 | 0.000153780f, 0.000497580f, 0.000009060f, 0.000046730f, 93 | -0.000005722f, -0.000000239f, -0.000082731f, 0.000052929f, 94 | -0.001055002f, 0.000465393f, -0.008056402f, 0.001260758f, 95 | 0.009817124f, 0.017847061f, 0.001401663f, 0.001821518f, 96 | 0.000138521f, 0.000495911f, 0.000008345f, 0.000048161f, 97 | -0.000006199f, -0.000000239f, -0.000095606f, 0.000051976f, 98 | -0.001141548f, 0.000476837f, -0.008497238f, 0.001420737f, 99 | 0.009378433f, 0.017879486f, 0.001315355f, 0.001700878f, 100 | 0.000123739f, 0.000491858f, 0.000007391f, 0.000049591f, 101 | -0.000006914f, 0.000000000f, -0.000109434f, 0.000050783f, 102 | -0.001228571f, 0.000485659f, -0.008938074f, 0.001567364f, 103 | 0.008938074f, 0.017890454f, 0.001228571f, 0.001567364f, 104 | 0.000109434f, 0.000485659f, 0.000006914f, 0.000050783f, 105 | -------------------------------------------------------------------------------- /hmp3/src/pub/bitallo1.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: bitallo1.h,v 1.1 2005/07/13 17:22:24 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _BITALLO1_H_ 39 | #define _BITALLO1_H_ 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include "l3e.h" 49 | #include "bitallo.h" 50 | 51 | class CBitAllo1:public CBitAllo 52 | { 53 | 54 | public: 55 | CBitAllo1 ( ); 56 | 57 | ~CBitAllo1 ( ); 58 | 59 | void BitAllo ( float xr_arg[][576], SIG_MASK sm_arg[][36], 60 | int ch_arg, int nchan_arg, 61 | int min_bits_arg, int target_bits_arg, int max_bits_arg, 62 | int bit_pool_arg, 63 | SCALEFACT sf_out[], GR gr_data[], 64 | int ix_arg[][576], 65 | unsigned char signx_arg[][576], int ms_flag_arg ); 66 | 67 | int BitAlloInit ( BA_CONTROL & ba_control ); 68 | 69 | int ms_correlation2 ( float x[2][576], int block_type = 0 ); 70 | 71 | void ba_out_stats ( ) 72 | { 73 | } // test routine 74 | 75 | //-data------------------------------------------------ 76 | private: 77 | 78 | int call_count; 79 | int nchan; 80 | int is_flag; 81 | int ms_flag; 82 | int ill_is_pos; 83 | int h_id; 84 | float running_a; 85 | 86 | int max_bits; /* must not exceed */ 87 | int min_bits; /* maybe wasted if less */ 88 | int max_cnt_bits; 89 | int target_bits; 90 | int target0_bits; 91 | int target0_min; 92 | int target0_max; 93 | int target_more; 94 | int bitadjust; /* running delta counted - estimated */ 95 | int counted_bits; 96 | int huff_bits[2]; 97 | 98 | /*-------------*/ 99 | int scalefactor_scale[2]; 100 | int preemp[2]; 101 | 102 | /*-------------*/ 103 | int nsfb_s; 104 | 105 | int gsf_save[2][21]; /* [ch] */ 106 | int bitadjust_save[2]; /* [ch] */ 107 | 108 | typedef float ARRAY576[576]; 109 | ARRAY576 *xr; 110 | typedef int intARRAY576[576]; 111 | intARRAY576 *ix; 112 | 113 | //typedef unsigned char ucharARRAY576[576]; 114 | //ucharARRAY576 *signx; 115 | 116 | float x34mm; /* max all bands (and both chans) */ 117 | float x34[2][576]; 118 | 119 | float xsxx[2][21]; 120 | 121 | float alpha_nmr; 122 | float ave_alpha_nmr; /* running average */ 123 | 124 | float mask[2][21]; 125 | float x34max[2][21]; 126 | float noise[2][21]; 127 | 128 | int ixmax[2][21]; 129 | int gzero[2][21]; /* quant to zero if gsf >= gzero */ 130 | int gmin[2][22]; // 4/26/99 min val for g, smaller may overflow quant 131 | int gsf[2][21]; /* G-sf */ 132 | int lastGsf[2][21]; // remember last G - sf, early out 133 | 134 | int sf[2][21]; 135 | int G[2]; 136 | 137 | float dGdB; /* delta G/delta bits, dG = dGdB*dB */ 138 | float dBG; /* 1/dGdB */ 139 | 140 | float look_log_cbw[21]; // log(sf band width) in db 141 | 142 | //float look_34igain[128]; // inverse (1.0/gain)**(3/4) 143 | //float look_gain[128]; // gain 144 | //float look_ix43[256]; // inverse quant 145 | 146 | float look_f_ixmax[256]; // noise estimate f(ixmax) in db 147 | float look_f_ix[256]; // noise estimate f(ix) in db 148 | 149 | /* big values of ix */ 150 | float look_f_big_ixmax[256]; // noise estimate f(ixmax) in db 151 | float look_f_big_ix[256]; // noise estimate f(ix) in db 152 | 153 | int look_bits[256]; // bit estimate x16 154 | 155 | float gz_con0; 156 | float gz_con1; 157 | float gz_con2; 158 | 159 | int look_is_pos[34]; 160 | float con707; 161 | 162 | // functio_noise selector 163 | int i_function_noise_cb; 164 | 165 | int int_dummy; 166 | 167 | // private functions 168 | void gen_atan ( ); 169 | void gen_bit_estimator ( ); 170 | void gen_noise_estimator ( ); 171 | 172 | void fnc_sf_final ( int ch ); 173 | void fnc_sf_final_MPEG1 ( int ch ); 174 | void fnc_sf_final_MPEG2 ( int ch ); 175 | 176 | void output_sf ( SCALEFACT sf_out[] ); 177 | void compute_x34 ( ); 178 | 179 | void smr_adj ( SIG_MASK sm[][36], unsigned char signx[][576] ); 180 | void smr_adj_joint ( SIG_MASK sm[][36], unsigned char signx[][576] ); 181 | 182 | int allo_2 ( ); 183 | void fnc_ixmax ( ); 184 | 185 | int fnc_bit_est ( ); 186 | int fnc_bit_seek ( ); 187 | int fnc_bit_seek2 ( ); 188 | void fnc_noise ( ); 189 | void fnc_noise_cb ( int i, int ch ); 190 | void fnc_noise2 ( ); 191 | void fnc_noise2_cb ( int i, int ch ); 192 | void fnc_noise2_init ( ); 193 | void fnc_ix_quant ( ); 194 | int fnc_noise_seek ( ); 195 | 196 | void function_noise_cb ( int cb, int ch ); 197 | 198 | int fnc_scale_factors ( ); 199 | 200 | }; 201 | 202 | #endif // _BITALLO1_H_ 203 | -------------------------------------------------------------------------------- /hmp3/src/detect.c: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: detect.c,v 1.1 2005/07/13 17:22:20 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include // memmove proto 43 | 44 | #include "balow.h" // mbLogC 45 | 46 | #include "hxtypes.h" 47 | 48 | //extern int iframe; // for testing 49 | 50 | //==================================================================== 51 | // detect based on SBT (Polyphase filter) output 52 | int 53 | attack_detectSBT_igr ( float sample[576], int eng[32], int short_flag_prev ) 54 | { 55 | int i, j, k; 56 | float x, sum; 57 | int a, a0, a1, a2; 58 | int m; 59 | 60 | //int v; 61 | float *y, *yy; 62 | 63 | // transient detector - input is sbt data, 64 | // sbt data used as bandpass filter 65 | // 66 | // The commented out parameter v may have some (future) 67 | // application in detecting passages (possibly speech) 68 | // that need more bits if encoded with long blocks 69 | 70 | #undef STARTBIN 71 | #undef NBINS 72 | 73 | // baseline is start=4 n = 10 74 | #define STARTBIN 4 75 | #define NBINS 14 76 | 77 | // SAMPLE ORGANIZED [32][18] [FREQ][TIME] 78 | // (sample is output from polyphase filter) 79 | // computes one granule 80 | // 81 | // eng[32] bigger than necessary 82 | 83 | // shift energy history 84 | memmove ( eng, eng + 9, 23 * sizeof ( int ) ); 85 | 86 | j = 23; 87 | yy = sample + ( 18 * STARTBIN ); 88 | for ( k = 0; k < 9; k++, j++ ) 89 | { 90 | y = yy; 91 | sum = 7.0e4f; // 92 | for ( i = 0; i < NBINS; i++ ) 93 | { // two time bins per iter 94 | x = y[0] * y[0]; 95 | sum += x; 96 | x = y[1] * y[1]; 97 | sum += x; 98 | // 99 | y += 18; // next freq bin 100 | } 101 | eng[j] = mbLogC ( sum ); 102 | yy += 2; // next pair time bins 103 | 104 | } 105 | 106 | #define JA (17) 107 | #define JB (29) 108 | 109 | //v = 0; 110 | m = 0; 111 | 112 | if ( short_flag_prev == 0 ) 113 | { 114 | for ( j = JA; j < JB; j++ ) 115 | { 116 | a0 = HX_MAX ( eng[j - 6], eng[j - 7] ); 117 | a1 = HX_MAX ( eng[j - 4], eng[j - 5] ); 118 | a2 = HX_MAX ( eng[j - 2], eng[j - 3] ); 119 | a1 = HX_MAX ( a1, a0 ); 120 | a = HX_MAX ( a1, a2 ); 121 | m = HX_MAX ( m, eng[j] - a ); 122 | 123 | //v += abs(eng[j] - eng[j-1]); 124 | } 125 | } 126 | else 127 | { // prev block was short 128 | for ( j = ( JA + 1 ); j < JB; j++ ) 129 | { 130 | a0 = HX_MAX ( eng[j - 6], eng[j - 7] ); 131 | a1 = HX_MAX ( eng[j - 4], eng[j - 5] ); 132 | a2 = HX_MAX ( eng[j - 2], eng[j - 3] ); 133 | a1 = HX_MAX ( a1, a0 ); 134 | a = HX_MAX ( a1, a2 ); 135 | m = HX_MAX ( m, eng[j] - a ); 136 | 137 | //v += abs(eng[j] - eng[j-1]); 138 | } 139 | } 140 | 141 | return m; 142 | } 143 | 144 | //==================================================================== 145 | // detect based on SBT (Polyphase filter) output 146 | int 147 | attack_detectSBT_igr_MPEG2 ( float sample[576], int eng[32], 148 | int short_flag_prev ) 149 | { 150 | int i, j, k; 151 | float x, sum; 152 | int a, a1, a2; 153 | int m; 154 | 155 | //int v; 156 | float *y, *yy; 157 | 158 | // transient detector - input is sbt data, 159 | // sbt data used as bandpass filter 160 | // 161 | // The commented out parameter v may have some (future) 162 | // application in detecting passages (possibly speech) 163 | // that need more bits if encoded with long blocks 164 | 165 | #undef STARTBIN 166 | #undef NBINS 167 | 168 | #define STARTBIN 8 169 | #define NBINS 20 170 | 171 | // SAMPLE ORGANIZED [32][18] [FREQ][TIME] 172 | // (sample is output from polyphase filter) 173 | // computes one granule 174 | // 175 | // eng[32] bigger than necessary 176 | 177 | // shift energy history 178 | memmove ( eng, eng + 9, 23 * sizeof ( int ) ); 179 | 180 | j = 23; 181 | yy = sample + ( 18 * STARTBIN ); 182 | for ( k = 0; k < 9; k++, j++ ) 183 | { 184 | y = yy; 185 | sum = 7.0e4f; // x^2 186 | for ( i = 0; i < NBINS; i++ ) 187 | { // two time bins per iter 188 | x = y[0] * y[0]; 189 | sum += x; 190 | x = y[1] * y[1]; 191 | sum += x; 192 | // 193 | y += 18; // next freq bin 194 | } 195 | eng[j] = mbLogC ( sum ); 196 | yy += 2; // next pair time bins 197 | } 198 | 199 | #define JA (17) 200 | #define JB (29) 201 | 202 | //v = 0; 203 | m = 0; 204 | 205 | if ( short_flag_prev == 0 ) 206 | { 207 | for ( j = JA; j < JB; j++ ) 208 | { 209 | a1 = HX_MAX ( eng[j - 4], eng[j - 5] ); 210 | a2 = HX_MAX ( eng[j - 2], eng[j - 3] ); 211 | a = HX_MAX ( a1, a2 ); 212 | m = HX_MAX ( m, eng[j] - a ); 213 | //v += abs(eng[j] - eng[j-1]); 214 | } 215 | } 216 | else 217 | { // prev block was short 218 | for ( j = ( JA + 1 ); j < JB; j++ ) 219 | { 220 | a1 = HX_MAX ( eng[j - 4], eng[j - 5] ); 221 | a2 = HX_MAX ( eng[j - 2], eng[j - 3] ); 222 | a = HX_MAX ( a1, a2 ); 223 | m = HX_MAX ( m, eng[j] - a ); 224 | //v += abs(eng[j] - eng[j-1]); 225 | } 226 | } 227 | 228 | return m; 229 | } 230 | 231 | //==================================================================== 232 | -------------------------------------------------------------------------------- /hmp3/src/pub/bitallos.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: bitallos.h,v 1.1 2005/07/13 17:34:48 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _BITALLOS_H_ 39 | #define _BITALLOS_H_ 40 | 41 | // short BitAllo 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | 50 | #include "l3e.h" 51 | 52 | #include "balow.h" // low level routines 53 | #include "hxtypes.h" 54 | #include "bitallo.h" // ba control structure 55 | 56 | #define g_offset 8 57 | // caution g_offset also defined in L3math!!! 58 | 59 | // delta from gzero to gmin, 60 | // theoretical value is 73+, 70 allows for rounding in gsf -> sf 61 | #define GMIN_OFFSET 70 62 | 63 | // per ch igr bits limited by part2_3length 64 | #define PART23 4021 65 | 66 | //========================================================= 67 | class CBitAlloShort 68 | { 69 | 70 | public: 71 | CBitAlloShort ( ); 72 | 73 | ~CBitAlloShort ( ); 74 | 75 | // returns feedback bits (huff bits before increasse/decrease) 76 | // for external MNR eedback adjustment 77 | int BitAllo ( float xr_arg[][3][192], SIG_MASK sm_arg[][3][12], 78 | int ch_arg, int nchan_arg, 79 | int min_bits_arg, int target_bits_arg, int max_bits_arg, 80 | int bit_pool_arg, 81 | SCALEFACT sf_out[], GR gr_data[], 82 | int ix_arg[][576], 83 | unsigned char signx_arg[][576], int ms_flag_arg, int MNR ); 84 | 85 | int BitAlloInit ( BA_CONTROL & bac ); 86 | 87 | int ms_correlation2Short ( float x[2][3][192] ); 88 | 89 | void ba_out_stats ( ); // test routine 90 | 91 | //-data------------------------------------------------ 92 | private: 93 | 94 | int vbr_flag; 95 | 96 | float gz_con1B; 97 | float gz_con2B; 98 | 99 | int ms_count; 100 | int call_count; 101 | int nchan; 102 | int is_flag; 103 | int ms_flag; 104 | int ill_is_pos; 105 | int h_id; 106 | 107 | int maxBits; /* must not exceed */ 108 | int maxTargetBits; 109 | int minTargetBits; /* maybe wasted if less */ 110 | int PoolBits; 111 | int max_cnt_bits; 112 | int TargetBits; 113 | int FeedbackBits; // for external mnr adjust 114 | int MNR; // long term MNR target in mb 115 | int deltaMNR; // 116 | int initialMNR; 117 | int activeBands; 118 | int huff_bits[2]; 119 | 120 | int nsf[2]; 121 | 122 | int nBand_s[13]; // 12 + band to Nyquist 123 | int startBand_s[14]; 124 | 125 | int nbmax[2]; 126 | int nbmax2[2]; 127 | int nbmax3[2]; 128 | 129 | int taperNT[12]; 130 | 131 | float dGdB; /* delta G/delta bits, dG = dGdB*dB */ 132 | 133 | typedef float ARRAY3_192[3][192]; 134 | ARRAY3_192 *xr; 135 | 136 | //typedef int intARRAY3_192[3][192]; 137 | //intARRAY3_192 *ix; 138 | //typedef unsigned char ucharARRAY3_192[3][192]; 139 | //ucharARRAY3_192 *signx; 140 | 141 | int ix[2][3][192]; 142 | unsigned char signx[2][3][192]; 143 | 144 | int look_log_cbwmb[16]; // log(sf band width) in mb 145 | 146 | float xsxx[2][3][16]; 147 | int Noise0[2][3][16]; // Noise at no-allo (signal) 148 | int NT[2][3][16]; // Noise Target (LR or ms) 149 | int Noise[2][3][16]; // Noise 150 | int snr[2][3][16]; // 151 | 152 | float x34max[2][3][16]; 153 | int ixmax[2][3][16]; 154 | int ix10xmax[2][3][16]; 155 | int gzero[2][3][16]; 156 | int gmin[2][3][16]; // 3/3/99 min val for g, smaller may overflow quant 157 | int gsf[2][3][16]; 158 | int sf[2][3][16]; 159 | int active_sf[2][3][16]; 160 | 161 | int subblock_gain[2][3]; 162 | int G[2][3]; // 163 | int GG[2]; 164 | 165 | float x34[2][3][192]; 166 | int ix10x[2][3][192]; 167 | 168 | // no preemp on short blocks 169 | int scalefactor_scale[2]; 170 | 171 | int *psf_upper_limit[2], *psf_lower_limit[2]; 172 | 173 | // vars for noise seek actual 174 | float *y34, *y; 175 | int *ysignmask; 176 | int NTarget, noise, dn, logn; 177 | int NTarget0, NTarget1; 178 | //-------- 179 | 180 | int int_dummy; 181 | 182 | //-functions------------------------------------------------ 183 | private: 184 | 185 | void output_sf ( SCALEFACT sf_out[] ); 186 | void startup ( SIG_MASK sm[][3][12], unsigned char signx[][3][192] ); 187 | void startup_ms ( SIG_MASK sm[][3][12], unsigned char signx[][3][192] ); 188 | void startup_ms2 ( SIG_MASK sm[][3][12], unsigned char signx[][3][192] ); 189 | void startup_adjustNT ( ); 190 | void startup_adjustNT1 ( ); 191 | 192 | void allocate ( ); 193 | 194 | void noise_seek_initial2 ( ); 195 | int decrease_noise ( int s0, int n ); 196 | int increase_noise ( int s0, int n ); 197 | void noise_seek_actual ( ); 198 | 199 | void quant ( ); 200 | void quantB ( ); 201 | 202 | int count_bits ( ); 203 | int count_bits_dual ( ); 204 | 205 | void fnc_sf_final ( int ch ); 206 | void fnc_scale_factors01 ( ); 207 | void fnc_scale_factors ( ); 208 | 209 | int increase_bits ( int bits0 ); 210 | int increase_bits_ms ( int bits0 ); 211 | int limit_bits ( int bits0 ); 212 | int limit_part23_bits ( ); 213 | int decrease_bits01 ( int bits0 ); 214 | int decrease_bits ( int bits0 ); 215 | int decrease_bits_ms ( int bits0 ); 216 | 217 | // bit counter functions 218 | int subdivide2 ( int ixmax[][16], int ix[][192], int ncb, int ch ); 219 | void output_subdivide2 ( GR * gr_data, int ch ); 220 | int ix_reorder[576]; // 221 | struct 222 | { 223 | int ntable_out[4]; 224 | int cbreg[3]; 225 | int nbig; 226 | int nquads; 227 | int bits; 228 | } 229 | save[2]; 230 | 231 | }; 232 | 233 | #endif // _BITALLOS_H_ 234 | -------------------------------------------------------------------------------- /hmp3/src/l3map.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: l3map.h,v 1.1 2005/07/13 17:22:20 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | 39 | /* ----------- gen bark partition mpeg2 samprate 22050 */ 40 | 41 | /* ----------- gen bark partition mpeg2 samprate 24000 */ 42 | 43 | /* ----------- gen bark partition mpeg2 samprate 16000 */ 44 | 45 | /* ----------- adjust mpeg2 thres samprate 22050 */ 46 | 47 | /* ----------- adjust mpeg2 thres samprate 24000 */ 48 | 49 | /* ----------- adjust mpeg2 thres samprate 16000 */ 50 | 51 | /* ----------- compute bark samprate 22050 */ 52 | 53 | /* ----------- compute bark samprate 24000 */ 54 | 55 | /* ----------- compute bark samprate 16000 */ 56 | 57 | /* ----------- compute bark samprate 44100 */ 58 | 59 | /* ----------- compute bark samprate 48000 */ 60 | 61 | /* ----------- compute bark samprate 32000 */ 62 | 63 | /* ----------- remap samprate 22050 */ 64 | 65 | /* ----------- remap samprate 24000 */ 66 | 67 | /* ----------- remap samprate 16000 */ 68 | 69 | /* ----------- remap samprate 44100 */ 70 | 71 | /* ----------- remap samprate 48000 */ 72 | 73 | /* ----------- remap samprate 32000 */ 74 | { 75 | { 76 | 77 | 78 | 79 | /*-- n w1 w2 generation by tgen.c t3gen.c --*/ 80 | 1, 1.000, 0.917, 81 | 2, 0.083, 0.583, 82 | 2, 0.417, 0.250, 83 | 1, 0.750, 0.917, 84 | 2, 0.083, 0.583, 85 | 2, 0.417, 0.250, 86 | 2, 0.750, 0.806, 87 | 2, 0.194, 0.833, 88 | 3, 0.167, 0.389, 89 | 2, 0.611, 0.903, 90 | 3, 0.097, 0.167, 91 | 2, 0.833, 0.435, 92 | 2, 0.565, 0.493, 93 | 2, 0.507, 0.383, 94 | 2, 0.617, 0.106, 95 | 1, 0.894, 0.718, 96 | 2, 0.282, 0.497, 97 | 2, 0.503, 0.167, 98 | 1, 0.833, 0.717, 2, 0.283, 0.030, 0, 0.970, 0.976,} 99 | , 100 | { 101 | 102 | /*-- Layer III map calc partition to sf band 24000 --*/ 103 | 104 | /*-- n w1 w2 generation by tgen.c t3gen.c --*/ 105 | 1, 1.000, 0.917, 106 | 2, 0.083, 0.583, 107 | 2, 0.417, 0.250, 108 | 1, 0.750, 0.917, 109 | 2, 0.083, 0.583, 110 | 2, 0.417, 0.250, 111 | 2, 0.750, 0.806, 112 | 3, 0.194, 0.167, 113 | 2, 0.833, 0.722, 114 | 2, 0.278, 0.903, 115 | 2, 0.097, 0.967, 116 | 2, 0.033, 0.806, 117 | 2, 0.194, 0.549, 118 | 2, 0.451, 0.250, 119 | 1, 0.750, 0.904, 120 | 2, 0.096, 0.552, 121 | 2, 0.448, 0.351, 122 | 2, 0.649, 0.081, 123 | 1, 0.919, 0.613, 1, 0.387, 0.837, 1, 0.163, 0.981,} 124 | , 125 | { 126 | 127 | /*-- Layer III map calc partition to sf band 16000 --*/ 128 | 129 | /*-- n w1 w2 generation by tgen.c t3gen.c --*/ 130 | 1, 1.000, 0.917, 131 | 2, 0.083, 0.583, 132 | 2, 0.417, 0.250, 133 | 1, 0.750, 0.917, 134 | 2, 0.083, 0.583, 135 | 1, 0.417, 0.833, 136 | 2, 0.167, 0.204, 137 | 2, 0.796, 0.167, 138 | 2, 0.833, 0.722, 139 | 3, 0.278, 0.403, 140 | 2, 0.597, 0.958, 141 | 3, 0.042, 0.522, 142 | 3, 0.478, 0.135, 143 | 2, 0.865, 0.479, 144 | 2, 0.521, 0.528, 145 | 2, 0.472, 0.466, 146 | 2, 0.534, 0.330, 147 | 2, 0.670, 0.176, 148 | 1, 0.824, 0.975, 2, 0.025, 0.664, 1, 0.336, 0.972,} 149 | ,} 150 | 151 | , 152 | { 153 | { 154 | 155 | /*-- Layer III map calc partition to sf band 44100 --*/ 156 | 157 | /*-- n w1 w2 generation by tgen.c t3gen.c --*/ 158 | 3, 1.000, 0.056, 159 | 2, 0.944, 0.611, 160 | 3, 0.389, 0.167, 161 | 2, 0.833, 0.722, 162 | 1, 0.278, 0.639, 163 | 1, 0.361, 0.417, 164 | 2, 0.583, 0.083, 165 | 1, 0.917, 0.750, 166 | 3, 0.250, 0.306, 167 | 1, 0.694, 0.907, 168 | 2, 0.093, 0.870, 169 | 3, 0.130, 0.069, 170 | 2, 0.931, 0.300, 171 | 2, 0.700, 0.546, 172 | 2, 0.454, 0.659, 173 | 2, 0.341, 0.500, 174 | 2, 0.500, 0.520, 175 | 2, 0.480, 0.270, 176 | 1, 0.730, 0.675, 1, 0.325, 0.759, 1, 0.241, 0.946,} 177 | , 178 | { 179 | 180 | /*-- Layer III map calc partition to sf band 48000 --*/ 181 | 182 | /*-- n w1 w2 generation by tgen.c t3gen.c --*/ 183 | 3, 1.000, 0.056, 184 | 2, 0.944, 0.611, 185 | 3, 0.389, 0.167, 186 | 2, 0.833, 0.722, 187 | 2, 0.278, 0.139, 188 | 0, 0.861, 0.917, 189 | 2, 0.083, 0.583, 190 | 2, 0.417, 0.250, 191 | 1, 0.750, 0.917, 192 | 2, 0.083, 0.981, 193 | 2, 0.019, 0.944, 194 | 2, 0.056, 0.875, 195 | 3, 0.125, 0.344, 196 | 2, 0.656, 0.454, 197 | 2, 0.546, 0.285, 198 | 2, 0.715, 0.317, 199 | 2, 0.683, 0.261, 200 | 1, 0.739, 0.925, 201 | 2, 0.075, 0.192, 1, 0.808, 0.273, 0, 0.727, 0.852,} 202 | , 203 | { 204 | 205 | /*-- Layer III map calc partition to sf band 32000 --*/ 206 | 207 | /*-- n w1 w2 generation by tgen.c t3gen.c --*/ 208 | 1, 1.000, 0.028, 209 | 0, 0.972, 0.806, 210 | 1, 0.194, 0.583, 211 | 1, 0.417, 0.361, 212 | 1, 0.639, 0.139, 213 | 0, 0.861, 0.917, 214 | 2, 0.083, 0.583, 215 | 2, 0.417, 0.250, 216 | 2, 0.750, 0.204, 217 | 2, 0.796, 0.167, 218 | 2, 0.833, 0.722, 219 | 3, 0.278, 0.597, 220 | 3, 0.403, 0.233, 221 | 3, 0.767, 0.083, 222 | 2, 0.917, 0.646, 223 | 3, 0.354, 0.079, 224 | 2, 0.921, 0.345, 225 | 2, 0.655, 0.531, 226 | 2, 0.469, 0.298, 1, 0.702, 0.898, 2, 0.102, 0.956,} 227 | ,} 228 | 229 | , 230 | 231 | /* done */ 232 | -------------------------------------------------------------------------------- /hmp3/src/pub/xhead.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: 2024-04-10, Case 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _XHEAD_H_ 39 | #define _XHEAD_H_ 40 | 41 | #include 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | // A Xing header may be present in the ancillary 48 | // data field of the first frame of an mp3 bitstream 49 | // The Xing header (optionally) contains 50 | // frames total number of audio frames in the bitstream 51 | // bytes total number of bytes in the bitstream 52 | // toc table of contents 53 | 54 | // toc (table of contents) gives seek points 55 | // for random access 56 | // the ith entry determines the seek point for 57 | // i-percent duration 58 | // seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes 59 | // e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes 60 | 61 | #define FRAMES_FLAG 0x0001 62 | #define BYTES_FLAG 0x0002 63 | #define TOC_FLAG 0x0004 64 | #define VBR_SCALE_FLAG 0x0008 65 | #define VBR_RESERVEDA_FLAG 0x0010 66 | #define VBR_RESERVEDB_FLAG 0x0020 67 | #define INFOTAG_FLAG 0x0040 68 | 69 | //**** see tomp3.c for an application example ****// 70 | 71 | unsigned short XingHeaderUpdateCRC ( unsigned short crc, unsigned char *data, int len) ; 72 | // Update a provide CRC value for a given data buffer. Intended to 73 | // generate the MusicCRC-field in the LAME info tag. 74 | // input: 75 | // crc current CRC value 76 | // *data pointer to data buffer 77 | // len number of bytes to be processec from buffer 78 | // output. 79 | // updated, reflected CRC 80 | 81 | 82 | // int XingHeaderBitrateIndex ( int h_mode, int bitrate) ; 83 | // helper function to convert a bitrate to a bitrate-index as 84 | // needed by XingHeader 85 | // input: 86 | // h_mode mpeg coding mode (0 = mpeg2, 1 = mpeg1) 87 | // bitrate bitrate in kbps 88 | // output: 89 | // a bitrate index 90 | 91 | 92 | int XingHeader ( int samprate, int h_mode, int cr_bit, int original, 93 | int flags, int frames, int bs_bytes, 94 | int vbr_scale, 95 | unsigned char *toc, unsigned char *buf, unsigned char *buf20, 96 | unsigned char *buf20B, int nBitRate ); 97 | // creates an mp3 frame that contains a Xing header 98 | // return 0 = fail or frame_bytes 99 | // input: 100 | // samprate sample rate (e.g. 44100) 101 | // h_mode mpeg coding mode 102 | // cr_bit copyright bit to set in MPEG frame header 103 | // original original/copy bit to set in MPEG frame header 104 | // vbr_scale vbr scale value to set in header 105 | // flags controls data included in header 106 | // e.g. flags = FRAMES_FLAG | BYTES_FLAG 107 | // e.g. flags = FRAMES_FLAG | BYTES_FLAG | TOC_FLAG 108 | // frames number frames in bitstream, including 109 | // the header frame, may be place holder, e.g. 0 110 | // bytes number bytes in bitstream, including 111 | // the header frame, may be place holder, e.g. 0 112 | // toc pointer to caller supplied toc buffer, 113 | // may be NULL. Use NULL for 1. no toc, 114 | // 2. place holder 3. toc constructed 115 | // by XingHeaderTOC 116 | // output 117 | // buf buffer to place the mp3 frame 118 | 119 | int XingHeaderUpdate ( int frames, int bs_bytes, 120 | int vbr_scale, 121 | unsigned char *toc, unsigned char *buf, 122 | unsigned char *buf20, unsigned char *buf20B ); 123 | // update the information in a previously created mp3 frame 124 | // that contains a Xing header 125 | // return 0 = fail, 1 = success 126 | // input 127 | // frames number of audio frames in bitstream 128 | // bytes number bytes in bitstream, including 129 | // the header frame, may be place holder, e.g. 0 130 | // toc pointer to caller supplied toc buffer, 131 | // may be NULL. Use NULL for 1. no toc, 132 | // 2. toc constructed by XingHeaderTOC 133 | // input/output 134 | // buf buffer containing mp3 frame to update 135 | 136 | int XingHeaderUpdateInfo ( unsigned int frames, int bs_bytes, 137 | int vbr_scale, 138 | unsigned char *toc, unsigned char *buf, 139 | unsigned char *buf20, unsigned char *buf20B, 140 | uint64_t samples_audio, 141 | unsigned int bytes_mp3, unsigned int lowpass, 142 | unsigned int in_samplerate, unsigned int out_samplerate, unsigned short musiccrc); 143 | // Update the information in a previously created mp3 frame 144 | // that contains a Xing header. 145 | // This version supports the LAME info header. 146 | // return 0 = fail, 1 = success 147 | // input 148 | // frames number of audio frames in bitstream 149 | // bytes number bytes in bitstream, including 150 | // the header frame, may be place holder, e.g. 0 151 | // toc pointer to caller supplied toc buffer, 152 | // may be NULL. Use NULL for 1. no toc, 153 | // 2. toc constructed by XingHeaderTOC 154 | // samples_audio number of actual audio samples 155 | // bytes_mp3 size of MP3 file 156 | // lowpass frequency of lowpass filter, in Hz 157 | // in_samplerate sample rate of input audio file, in Hz 158 | // musiccrc value for musicCRC-field of LAME info header 159 | // input/output 160 | // buf buffer containing mp3 frame to update 161 | 162 | 163 | 164 | int XingHeaderTOC ( int frames, int bs_bytes ); 165 | 166 | // Dynamically (single pass) build TOC 167 | // XingHeader must be called to initialize XingHeaderTOC 168 | // input 169 | // frames number of frames currently in bitstream, including 170 | // the header frame. 171 | // bytes number of bytes currently in bitstream, including 172 | // the header frame. 173 | // returns 174 | // toc_counter 175 | 176 | #ifdef __cplusplus 177 | } /* extern "C" */ 178 | #endif 179 | 180 | #endif /* _XHEAD_H_ */ 181 | -------------------------------------------------------------------------------- /hmp3/src/cnts.c: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: cnts.c,v 1.1 2005/07/13 17:22:20 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | // to match asm code, equality goes to higher index 45 | 46 | typedef struct 47 | { 48 | int bits; 49 | int index; 50 | } 51 | BI; 52 | 53 | // low=table a, high = table b 54 | static const int table_quad[] = { 55 | 0x00040001, 56 | 0x00050005, 57 | 0x00050005, 58 | 0x00060007, 59 | 0x00050005, 60 | 0x00060008, 61 | 0x00060007, 62 | 0x00070009, 63 | 0x00050005, 64 | 0x00060007, 65 | 0x00060007, 66 | 0x00070009, 67 | 0x00060007, 68 | 0x00070009, 69 | 0x00070009, 70 | 0x0008000A, 71 | }; 72 | 73 | /*--------- 74 | BI CountBits0Short(void *table, int ix[][192], int n); 75 | BI CountBits1Short(void *table, int ix[][192], int n); 76 | BI CountBits2Short(void *table, int ix[][192], int n); 77 | BI CountBits3Short(void *table, int ix[][192], int n); 78 | BI CountBits4Short(void *table, int ix[][192], int n); 79 | BI CountBits5Short(void *table, int ix[][192], int n); 80 | BI CountBitsQuad(int ix[][192], int nquads); // short and long same 81 | ------------*/ 82 | 83 | /*---------------------------------------------------------------*/ 84 | BI 85 | CountBits0Short ( void *table, int ix[], int n ) 86 | { 87 | BI bi; 88 | 89 | bi.bits = bi.index = 0; 90 | return bi; 91 | } 92 | 93 | /*---------------------------------------------------------------*/ 94 | BI 95 | CountBits1Short ( int table[][2], int ix[][192], int n ) 96 | { 97 | int i, bits, b0, b1, w; 98 | BI bi; 99 | 100 | if ( n <= 0 ) 101 | { 102 | bi.bits = bi.index = 0; 103 | return bi; 104 | } 105 | 106 | bits = 0; 107 | 108 | for ( w = 0; w < 3; w++ ) 109 | { 110 | for ( i = 0; i < n; i += 2 ) 111 | { 112 | bits += table[ix[w][i]][ix[w][i + 1]]; 113 | } 114 | } 115 | 116 | b0 = bits & 0xFFFF; 117 | b1 = ( bits >> 16 ) & 0xFFFF; 118 | if ( b0 < b1 ) 119 | { 120 | bi.bits = b0; 121 | bi.index = 0; 122 | } 123 | else 124 | { 125 | bi.bits = b1; 126 | bi.index = 1; 127 | } 128 | 129 | return bi; 130 | } 131 | 132 | /*---------------------------------------------------------------*/ 133 | BI 134 | CountBits2Short ( int table[][4], int ix[][192], int n ) 135 | { 136 | int i, bits, b0, b1, w; 137 | BI bi; 138 | 139 | if ( n <= 0 ) 140 | { 141 | bi.bits = bi.index = 0; 142 | return bi; 143 | } 144 | 145 | bits = 0; 146 | for ( w = 0; w < 3; w++ ) 147 | { 148 | for ( i = 0; i < n; i += 2 ) 149 | { 150 | bits += table[ix[w][i]][ix[w][i + 1]]; 151 | } 152 | } 153 | 154 | b0 = bits & 0xFFFF; 155 | b1 = ( bits >> 16 ) & 0xFFFF; 156 | if ( b0 < b1 ) 157 | { 158 | bi.bits = b0; 159 | bi.index = 0; 160 | } 161 | else 162 | { 163 | bi.bits = b1; 164 | bi.index = 1; 165 | } 166 | 167 | return bi; 168 | } 169 | 170 | /*---------------------------------------------------------------*/ 171 | BI 172 | CountBits3Short ( int table[][8][2], int ix[][192], int n ) 173 | { 174 | int i, bits0, bits1, b0, b1, w; 175 | BI bi; 176 | 177 | if ( n <= 0 ) 178 | { 179 | bi.bits = bi.index = 0; 180 | return bi; 181 | } 182 | 183 | bits0 = bits1 = 0; 184 | for ( w = 0; w < 3; w++ ) 185 | { 186 | for ( i = 0; i < n; i += 2 ) 187 | { 188 | bits0 += table[ix[w][i]][ix[w][i + 1]][0]; 189 | bits1 += table[ix[w][i]][ix[w][i + 1]][1]; 190 | } 191 | } 192 | 193 | b0 = bits0 & 0xFFFF; 194 | b1 = ( bits0 >> 16 ) & 0xFFFF; 195 | if ( b0 < b1 ) 196 | { 197 | bi.bits = b0; 198 | bi.index = 0; 199 | } 200 | else 201 | { 202 | bi.bits = b1; 203 | bi.index = 1; 204 | } 205 | 206 | b0 = bits1 & 0xFFFF; 207 | b1 = ( bits1 >> 16 ) & 0xFFFF; 208 | if ( b0 <= bi.bits ) 209 | { 210 | bi.bits = b0; 211 | bi.index = 2; 212 | } 213 | 214 | if ( b1 <= bi.bits ) 215 | { 216 | bi.bits = b1; 217 | bi.index = 3; 218 | } 219 | 220 | return bi; 221 | } 222 | 223 | /*---------------------------------------------------------------*/ 224 | BI 225 | CountBits4Short ( int table[][16], int ix[][192], int n ) 226 | { 227 | int i, bits, b0, b1, w; 228 | BI bi; 229 | 230 | if ( n <= 0 ) 231 | { 232 | bi.bits = bi.index = 0; 233 | return bi; 234 | } 235 | 236 | bits = 0; 237 | for ( w = 0; w < 3; w++ ) 238 | { 239 | for ( i = 0; i < n; i += 2 ) 240 | { 241 | bits += table[ix[w][i]][ix[w][i + 1]]; 242 | } 243 | } 244 | 245 | b0 = bits & 0xFFFF; 246 | b1 = ( bits >> 16 ) & 0xFFFF; 247 | if ( b0 < b1 ) 248 | { 249 | bi.bits = b0; 250 | bi.index = 0; 251 | } 252 | else 253 | { 254 | bi.bits = b1; 255 | bi.index = 1; 256 | } 257 | 258 | return bi; 259 | } 260 | 261 | /*---------------------------------------------------------------*/ 262 | BI 263 | CountBits5Short ( int table[][16], int ix[][192], int n ) // linbits 264 | { 265 | int i, bits, b0, b1, ix0, ix1, w; 266 | BI bi; 267 | 268 | if ( n <= 0 ) 269 | { 270 | bi.bits = bi.index = 0; 271 | return bi; 272 | } 273 | 274 | bits = 0; 275 | for ( w = 0; w < 3; w++ ) 276 | { 277 | for ( i = 0; i < n; i += 2 ) 278 | { 279 | ix0 = ix[w][i]; 280 | if ( ix0 > 15 ) 281 | ix0 = 15; 282 | ix1 = ix[w][i + 1]; 283 | if ( ix1 > 15 ) 284 | ix1 = 15; 285 | bits += table[ix0][ix1]; 286 | } 287 | } 288 | 289 | b0 = bits & 0xFFFF; 290 | b1 = ( bits >> 16 ) & 0xFFFF; 291 | if ( b0 < b1 ) 292 | { 293 | bi.bits = b0; 294 | bi.index = 0; 295 | } 296 | else 297 | { 298 | bi.bits = b1; 299 | bi.index = 1; 300 | } 301 | 302 | return bi; 303 | } 304 | 305 | /*---------------------------------------------------------------*/ 306 | -------------------------------------------------------------------------------- /hmp3/src/pub/encapp.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: encapp.h,v 1.2 2005/08/09 20:43:45 karll Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _ENCAPP_H_ 39 | #define _ENCAPP_H_ 40 | 41 | /*-------------- setup & control structure ---------------------*/ 42 | typedef struct 43 | { 44 | int mode; /* mode-0 stereo=0 mode-1 stereo=1 dual=2 mono=3 */ 45 | int bitrate; /* CBR PER CHANNEL bit rate, 1000's, default = -1 */ 46 | int samprate; /* samp rate e.g 44100 */ 47 | int nsbstereo; /* mode-1 only, stereo bands, 3-32 , for default set =-1 */ 48 | int filter_select; /* input filter selection - set to -1 for default */ 49 | int freq_limit; /* special purpose, set to 24000 */ 50 | int nsb_limit; /* special purpose, set to -1 */ 51 | //int npass; /* not used for Layer III - set to -1 */ 52 | //int npred; /* set to -1 */ 53 | int layer; /* 3=Layer III. Set to 3 */ 54 | int cr_bit; /* header copyright bit setting */ 55 | int original; /* header original/copy bit setting, original=1 */ 56 | int hf_flag; /* MPEG1 high frequency */ 57 | int vbr_flag; /* 1=vbr, 0=cbr */ 58 | int vbr_mnr; /* 0-150, suggested setting is 50 */ 59 | int vbr_br_limit; /* reserved for per chan vbr bitrate limit set to 160 */ 60 | int vbr_delta_mnr; /* special, set 0 default */ 61 | int chan_add_f0; /* channel adder start freq - set 24000 default */ 62 | int chan_add_f1; /* channel adder final freq - set 24000 default */ 63 | int sparse_scale; /* reserved set, to -1 (encoder chooses) */ 64 | int mnr_adjust[21]; /* special, set 0 default */ 65 | int cpu_select; /* 0=generic, 1=3DNow reserved, 2=Pentium III */ 66 | int quick; /* 0 = base, 1 = fast, -1 = encoder chooses */ 67 | int test1; /* special test, set to -1 */ 68 | int test2; /* special test, set to 0 */ 69 | int test3; /* special test, set to 0 */ 70 | int short_block_threshold; /* short_block_threshold, default 700 */ 71 | } 72 | E_CONTROL; 73 | 74 | /*--------- E_CONTROL encoder init ---------------------- 75 | mode 76 | Select encoding mode:mode-0 stereo=0 mode-1 stereo=1 dual=2 mono=3. 77 | Two channel modes require two channel input. 78 | 79 | bitrate 80 | Per channel bitrate in 1000's bits per second. 81 | Encoder will make a default selection if -1. 82 | 83 | samprate 84 | Sample rate in samples per second (e.g. 44100). Valid 85 | MPEG rates are 16000, 22050, 24000, 32000, 44100, and 48000. 86 | The encoder will encode at the nearest valid rate. 87 | 88 | nsbstereo 89 | Applies to mode-1 stereo mode only. Controls the use of 90 | intensity stereo coding. Number of subbands to 91 | encode in non-intensity stereo. Valid values are 3-32. 92 | No intensity stereo will be coded if >= 30. 93 | The encoder limits choices to valid values. The encoder 94 | will make a default selection if nsbstereo = -1. 95 | For MPEG2, should not be set lower that 8 except at 96 | very low bitrates. 97 | 98 | filter_select 99 | Selects input filtering: No filter = 0, 100 | DC blocking filter = 1. In general, the suggested setting 101 | is 0 for professionally produced material. The suggested 102 | setting is 1 for pcm captured by consumer quality sound 103 | cards. If set to -1 encoder will select a default value. 104 | 105 | npass 106 | Does not apply to Layer III. 107 | 108 | npred 109 | Special purpose use only. Sets number of frequency 110 | bins used in the acoustic model predictability measure 111 | computation. Set to -1. 112 | 113 | freq_limit 114 | Special purpose use only. Limits encoded subbands 115 | to specified frequency. Set to 24000. Same function as nsb_limit. 116 | 117 | nsb_limit 118 | Limits number of subbands encoded. For special purpose 119 | use only. Set to -1. 120 | 121 | hf_flag 122 | MPEG1 high frequency encoding. Allows coding above 16000Hz 123 | hf_flag=1 (mode-1 granules), hf=3 (all granules). 124 | 125 | vbr_flag 126 | Select variable bitrate operation. VBR=1, VBR=0 for CBR operation. 127 | 128 | vbr_mnr; 129 | Valid values are 0-150. Higher settings give higher SNR's 130 | and higher bitrates. Suggested starting setting is 50 131 | 132 | vbr_br_limit 133 | Per chan vbr bitrate limit (limitation is on br_index). 134 | Special purpose. Set to 160. 135 | 136 | ----------------------------------------------------*/ 137 | 138 | /*-------------------------------------------------------------------*/ 139 | 140 | /* mpeg audio header */ 141 | typedef struct 142 | { 143 | int sync; 144 | int id; 145 | int option; 146 | int prot; 147 | int br_index; 148 | int sr_index; 149 | int pad; 150 | int private_bit; 151 | int mode; 152 | int mode_ext; 153 | int cr; 154 | int original; 155 | int emphasis; 156 | } 157 | MPEG_HEAD; 158 | 159 | /*-------------------------------------------------------------------*/ 160 | typedef struct 161 | { 162 | int in_bytes; 163 | int out_bytes; 164 | } 165 | IN_OUT; 166 | 167 | #ifdef __cplusplus 168 | extern "C" 169 | { 170 | #endif 171 | 172 | /*xxxxxxxxxxxxx 173 | 174 | // MP3_audio_encode adds sample rate/type conversion layer 175 | int MP3_audio_encode_init( E_CONTROL *ec_arg, 176 | int input_type, int mpeg_select, int mono_convert ); 177 | IN_OUT MP3_audio_encode(void *pcm, unsigned char *bs_out); 178 | 179 | int L3_audio_encode_init( E_CONTROL *ec_arg); 180 | IN_OUT L3_audio_encode(void *pcm, unsigned char *bs_out); 181 | 182 | // aux routines 183 | void L3_audio_encode_info_string(char *s); // info only 184 | void L3_audio_encode_info_ec(E_CONTROL *ec); // info only 185 | void L3_audio_encode_info_head(MPEG_HEAD *head); // info only 186 | int L3_audio_encode_get_bitrate(); // info only 187 | float L3_audio_encode_get_bitrate_float(); // info only 188 | float L3_audio_encode_get_bitrate2_float(); // info only 189 | int L3_audio_encode_get_frames(); // info only 190 | 191 | typedef struct { 192 | int a; 193 | int b; 194 | } INT_PAIR; 195 | INT_PAIR L3_audio_encode_get_frames_bytes(); //info only 196 | // encoded trame count in x.a, encoded byte count in x.b 197 | 198 | xxxxxxxxxx*/ 199 | 200 | #ifdef __cplusplus 201 | } 202 | #endif 203 | 204 | #endif //_ENCAPP_H_ 205 | -------------------------------------------------------------------------------- /hmp3/src/tcp.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: tcp.h,v 1.1 2005/07/13 17:22:21 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | 57, 0, 39 | 40 | /*-- partition --*/ 41 | 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 42 | 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 43 | 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 44 | 16, 16, 17, 19, 20, 22, 23, 25, 26, 28, 45 | 29, 31, 32, 34, 35, 37, 38, 40, 41, 44, 46 | 45, 48, 49, 52, 53, 56, 57, 60, 61, 64, 47 | 65, 69, 70, 74, 75, 80, 81, 86, 87, 93, 48 | 94, 100, 101, 108, 109, 116, 117, 124, 125, 134, 49 | 135, 144, 145, 155, 156, 166, 167, 177, 178, 192, 50 | 193, 207, 208, 222, 223, 243, 244, 264, 265, 286, 51 | 287, 314, 315, 342, 343, 371, 372, 401, 402, 431, 52 | 432, 469, 470, 513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 53 | 54 | /*-- bval --*/ 55 | 0.00, 0.43, 0.86, 1.29, 1.72, 2.15, 2.58, 3.01, 3.45, 3.88, 56 | 4.28, 4.67, 5.06, 5.42, 5.77, 6.11, 6.73, 7.61, 8.44, 9.21, 57 | 9.88, 10.51, 11.11, 11.65, 12.24, 12.85, 13.41, 13.94, 14.42, 14.86, 58 | 15.32, 15.79, 16.26, 16.73, 17.19, 17.62, 18.05, 18.45, 18.83, 19.21, 59 | 19.60, 20.00, 20.38, 20.74, 21.12, 21.48, 21.84, 22.20, 22.56, 22.91, 60 | 23.26, 23.60, 23.95, 24.30, 24.65, 25.00, 25.33, 0.00, 0.00, 0.00, 61 | 0.0, 0.0, 0.0, 0.0, 62 | 63 | /*-- valmin --*/ 64 | 0.0, 0.0, 0.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 65 | 20.0, 20.0, 20.0, 20.0, 20.0, 17.0, 17.0, 15.0, 10.0, 7.0, 66 | 7.0, 4.4, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 67 | 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 68 | 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 69 | 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 3.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 70 | 71 | /*-- tmn --*/ 72 | 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 73 | 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 74 | 24.5, 25.0, 25.6, 26.2, 26.7, 27.4, 27.9, 28.4, 28.9, 29.4, 75 | 29.8, 30.3, 30.8, 31.2, 31.7, 32.1, 32.5, 32.9, 33.3, 33.7, 76 | 34.1, 34.5, 34.9, 35.2, 35.6, 36.0, 36.3, 36.7, 37.1, 37.4, 77 | 37.8, 38.1, 38.4, 38.8, 39.1, 39.5, 39.8, 0.0, 0.0, 0.0, 78 | 0.0, 0.0, 0.0, 0.0, 79 | 80 | /*-- table tcp convolution partition 48000 --*/ 81 | 82 | /*-- generation by tgena.c --*/ 83 | 58, 0, 84 | 85 | /*-- partition --*/ 86 | 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 87 | 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 88 | 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 89 | 16, 16, 17, 17, 18, 20, 21, 23, 24, 26, 90 | 27, 29, 30, 32, 33, 35, 36, 38, 39, 41, 91 | 42, 45, 46, 49, 50, 53, 54, 57, 58, 62, 92 | 63, 67, 68, 72, 73, 77, 78, 83, 84, 89, 93 | 90, 95, 96, 103, 104, 111, 112, 120, 121, 129, 94 | 130, 138, 139, 149, 150, 160, 161, 173, 174, 187, 95 | 188, 201, 202, 219, 220, 238, 239, 257, 258, 283, 96 | 284, 309, 310, 335, 336, 363, 364, 391, 392, 423, 97 | 424, 465, 466, 507, 508, 513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 98 | 99 | /*-- bval --*/ 100 | 0.00, 0.05, 0.94, 1.41, 1.88, 2.34, 2.81, 3.28, 3.75, 4.20, 101 | 4.63, 5.05, 5.44, 5.83, 6.19, 6.52, 6.86, 7.49, 8.40, 9.24, 102 | 9.97, 10.65, 11.28, 11.86, 12.39, 12.96, 13.56, 14.12, 14.62, 15.14, 103 | 15.67, 16.15, 16.58, 17.02, 17.44, 17.84, 18.24, 18.66, 19.07, 19.47, 104 | 19.85, 20.23, 20.63, 21.02, 21.40, 21.76, 22.12, 22.47, 22.83, 23.18, 105 | 23.53, 23.88, 24.23, 24.58, 24.93, 25.27, 25.61, 25.82, 0.00, 0.00, 106 | 0.0, 0.0, 0.0, 0.0, 107 | 108 | /*-- valmin --*/ 109 | 0.0, 0.0, 0.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 110 | 20.0, 20.0, 20.0, 20.0, 20.0, 17.0, 17.0, 15.0, 10.0, 7.0, 111 | 7.0, 4.4, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 112 | 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 113 | 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 114 | 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 3.5, 3.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 115 | 116 | /*-- tmn --*/ 117 | 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 118 | 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 119 | 24.5, 25.1, 25.8, 26.4, 26.9, 27.5, 28.1, 28.6, 29.1, 29.6, 120 | 30.2, 30.7, 31.1, 31.5, 31.9, 32.3, 32.7, 33.2, 33.6, 34.0, 121 | 34.3, 34.7, 35.1, 35.5, 35.9, 36.3, 36.6, 37.0, 37.3, 37.7, 122 | 38.0, 38.4, 38.7, 39.1, 39.4, 39.8, 40.1, 40.3, 0.0, 0.0, 123 | 0.0, 0.0, 0.0, 0.0, 124 | 125 | /*-- table tcp convolution partition 32000 --*/ 126 | 127 | /*-- generation by tgena.c --*/ 128 | 49, 0, 129 | 130 | /*-- partition --*/ 131 | 1, 1, 2, 4, 5, 7, 8, 10, 11, 13, 132 | 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 133 | 29, 31, 32, 34, 35, 37, 38, 41, 42, 45, 134 | 46, 49, 50, 53, 54, 57, 58, 61, 62, 65, 135 | 66, 70, 71, 75, 76, 81, 82, 87, 88, 93, 136 | 94, 99, 100, 106, 107, 113, 114, 120, 121, 129, 137 | 130, 138, 139, 148, 149, 159, 160, 170, 171, 183, 138 | 184, 196, 197, 210, 211, 225, 226, 240, 241, 258, 139 | 259, 279, 280, 300, 301, 326, 327, 354, 355, 382, 140 | 383, 420, 421, 458, 459, 496, 497, 513, 0, 0, 141 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 142 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143 | 144 | /*-- bval --*/ 145 | 0.00, 0.63, 1.56, 2.50, 3.44, 4.34, 5.17, 5.94, 6.63, 7.28, 146 | 7.90, 8.50, 9.06, 9.65, 10.28, 10.87, 11.41, 11.92, 12.39, 12.83, 147 | 13.29, 13.78, 14.27, 14.76, 15.22, 15.63, 16.06, 16.47, 16.86, 17.25, 148 | 17.65, 18.05, 18.42, 18.81, 19.18, 19.55, 19.93, 20.29, 20.65, 21.02, 149 | 21.38, 21.74, 22.10, 22.44, 22.79, 23.14, 23.49, 23.83, 24.07, 0.00, 150 | 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 151 | 0.0, 0.0, 0.0, 0.0, 152 | 153 | /*-- valmin --*/ 154 | 0.0, 0.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 17.0, 15.0, 155 | 15.0, 10.0, 7.0, 7.0, 4.4, 4.4, 4.5, 4.5, 4.5, 4.5, 156 | 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 157 | 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 158 | 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 0.0, 159 | 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 160 | 161 | /*-- tmn --*/ 162 | 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 163 | 24.5, 24.5, 24.5, 24.5, 24.8, 25.4, 25.9, 26.4, 26.9, 27.3, 164 | 27.8, 28.3, 28.8, 29.3, 29.7, 30.1, 30.6, 31.0, 31.4, 31.8, 165 | 32.2, 32.5, 32.9, 33.3, 33.7, 34.1, 34.4, 34.8, 35.2, 35.5, 166 | 35.9, 36.2, 36.6, 36.9, 37.3, 37.6, 38.0, 38.3, 38.6, 0.0, 167 | 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 168 | 169 | /* done */ 170 | -------------------------------------------------------------------------------- /hmp3/src/pow34.c: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: pow34.c,v 1.1 2005/07/13 17:22:20 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | static const union {signed int i; float f;} e34[] = { 44 | 0x000000000, 0x0103504F3, 0x0109837F0, 0x011000000, 45 | 0x0115744FD, 0x011B504F3, 0x0121837F0, 0x012800000, 46 | 0x012D744FD, 0x0133504F3, 0x0139837F0, 0x014000000, 47 | 0x0145744FD, 0x014B504F3, 0x0151837F0, 0x015800000, 48 | 0x015D744FD, 0x0163504F3, 0x0169837F0, 0x017000000, 49 | 0x0175744FD, 0x017B504F3, 0x0181837F0, 0x018800000, 50 | 0x018D744FD, 0x0193504F3, 0x0199837F0, 0x01A000000, 51 | 0x01A5744FD, 0x01AB504F3, 0x01B1837F0, 0x01B800000, 52 | 0x01BD744FD, 0x01C3504F3, 0x01C9837F0, 0x01D000000, 53 | 0x01D5744FD, 0x01DB504F3, 0x01E1837F0, 0x01E800000, 54 | 0x01ED744FD, 0x01F3504F3, 0x01F9837F0, 0x020000000, 55 | 0x0205744FD, 0x020B504F3, 0x0211837F0, 0x021800000, 56 | 0x021D744FD, 0x0223504F3, 0x0229837F0, 0x023000000, 57 | 0x0235744FD, 0x023B504F3, 0x0241837F0, 0x024800000, 58 | 0x024D744FD, 0x0253504F3, 0x0259837F0, 0x026000000, 59 | 0x0265744FD, 0x026B504F3, 0x0271837F0, 0x027800000, 60 | 0x027D744FD, 0x0283504F3, 0x0289837F0, 0x029000000, 61 | 0x0295744FD, 0x029B504F3, 0x02A1837F0, 0x02A800000, 62 | 0x02AD744FD, 0x02B3504F3, 0x02B9837F0, 0x02C000000, 63 | 0x02C5744FD, 0x02CB504F3, 0x02D1837F0, 0x02D800000, 64 | 0x02DD744FD, 0x02E3504F3, 0x02E9837F0, 0x02F000000, 65 | 0x02F5744FD, 0x02FB504F3, 0x0301837F0, 0x030800000, 66 | 0x030D744FD, 0x0313504F3, 0x0319837F0, 0x032000000, 67 | 0x0325744FD, 0x032B504F3, 0x0331837F0, 0x033800000, 68 | 0x033D744FD, 0x0343504F3, 0x0349837F0, 0x035000000, 69 | 0x0355744FD, 0x035B504F3, 0x0361837F0, 0x036800000, 70 | 0x036D744FD, 0x0373504F3, 0x0379837F0, 0x038000000, 71 | 0x0385744FD, 0x038B504F3, 0x0391837F0, 0x039800000, 72 | 0x039D744FD, 0x03A3504F3, 0x03A9837F0, 0x03B000000, 73 | 0x03B5744FD, 0x03BB504F3, 0x03C1837F0, 0x03C800000, 74 | 0x03CD744FD, 0x03D3504F3, 0x03D9837F0, 0x03E000000, 75 | 0x03E5744FD, 0x03EB504F3, 0x03F1837F0, 0x03F800000, 76 | 0x03FD744FD, 0x0403504F3, 0x0409837F0, 0x041000000, 77 | 0x0415744FD, 0x041B504F3, 0x0421837F0, 0x042800000, 78 | 0x042D744FD, 0x0433504F3, 0x0439837F0, 0x044000000, 79 | 0x0445744FD, 0x044B504F3, 0x0451837F0, 0x045800000, 80 | 0x045D744FD, 0x0463504F3, 0x0469837F0, 0x047000000, 81 | 0x0475744FD, 0x047B504F3, 0x0481837F0, 0x048800000, 82 | 0x048D744FD, 0x0493504F3, 0x0499837F0, 0x04A000000, 83 | 0x04A5744FD, 0x04AB504F3, 0x04B1837F0, 0x04B800000, 84 | 0x04BD744FD, 0x04C3504F3, 0x04C9837F0, 0x04D000000, 85 | 0x04D5744FD, 0x04DB504F3, 0x04E1837F0, 0x04E800000, 86 | 0x04ED744FD, 0x04F3504F3, 0x04F9837F0, 0x050000000, 87 | 0x0505744FD, 0x050B504F3, 0x0511837F0, 0x051800000, 88 | 0x051D744FD, 0x0523504F3, 0x0529837F0, 0x053000000, 89 | 0x0535744FD, 0x053B504F3, 0x0541837F0, 0x054800000, 90 | 0x054D744FD, 0x0553504F3, 0x0559837F0, 0x056000000, 91 | 0x0565744FD, 0x056B504F3, 0x0571837F0, 0x057800000, 92 | 0x057D744FD, 0x0583504F3, 0x0589837F0, 0x059000000, 93 | 0x0595744FD, 0x059B504F3, 0x05A1837F0, 0x05A800000, 94 | 0x05AD744FD, 0x05B3504F3, 0x05B9837F0, 0x05C000000, 95 | 0x05C5744FD, 0x05CB504F3, 0x05D1837F0, 0x05D800000, 96 | 0x05DD744FD, 0x05E3504F3, 0x05E9837F0, 0x05F000000, 97 | 0x05F5744FD, 0x05FB504F3, 0x0601837F0, 0x060800000, 98 | 0x060D744FD, 0x0613504F3, 0x0619837F0, 0x062000000, 99 | 0x0625744FD, 0x062B504F3, 0x0631837F0, 0x063800000, 100 | 0x063D744FD, 0x0643504F3, 0x0649837F0, 0x065000000, 101 | 0x0655744FD, 0x065B504F3, 0x0661837F0, 0x066800000, 102 | 0x066D744FD, 0x0673504F3, 0x0679837F0, 0x068000000, 103 | 0x0685744FD, 0x068B504F3, 0x0691837F0, 0x069800000, 104 | 0x069D744FD, 0x06A3504F3, 0x06A9837F0, 0x06B000000, 105 | 0x06B5744FD, 0x06BB504F3, 0x06C1837F0, 0x06C800000, 106 | 0x06CD744FD, 0x06D3504F3, 0x06D9837F0, 0x06E000000, 107 | 0x06E5744FD, 0x06EB504F3, 0x06F1837F0, 0x07F800000 108 | } ; 109 | 110 | static const union {signed int i; float f;} ab[] = { 111 | 0x03E82F5BA, 0x03F3E8806, 0x03E88E2EA, 0x03F3BBE0E, 112 | 0x03E8EB69B, 0x03F392714, 0x03E94763F, 0x03F36BB71, 113 | 0x03E9A231E, 0x03F34764B, 0x03E9FBE5A, 0x03F32538A, 114 | 0x03EA548FA, 0x03F304FAD, 0x03EAAC3E8, 0x03F2E67B3, 115 | 0x03EB02FFB, 0x03F2C9902, 0x03EB58DF2, 0x03F2AE156, 116 | 0x03EBADE80, 0x03F293EB5, 0x03EC02244, 0x03F27AF5E, 117 | 0x03EC559D4, 0x03F2631C7, 0x03ECA85B7, 0x03F24C491, 118 | 0x03ECFA66D, 0x03F236683, 0x03ED3DD93, 0x03F225006 119 | } ; 120 | 121 | /*------------------------------------------------------------------*/ 122 | float 123 | fpow34 ( float x ) 124 | { 125 | //return (float)pow(x, 0.75); 126 | //return (float)sqrt(sqrt(x*x*x)); 127 | return ( float ) sqrt ( x * sqrt ( x ) ); 128 | } 129 | 130 | /*------------------------------------------------------------------*/ 131 | void 132 | vect_fpow34 ( const float x[], float y[], int n ) 133 | { 134 | int i; 135 | 136 | //for(i=0;i> 19 ; 150 | unsigned int e2 = exponent >> (23-19) ; 151 | exponent &= 15 ; 152 | 153 | y[i] = (mant.f * ab[2*exponent + 1].f + ab[2*exponent].f) * e34[e2].f ; 154 | } 155 | #endif 156 | } 157 | 158 | /*------------------------------------------------------------------*/ 159 | float 160 | vect_fmax ( const float x[], int n ) // HX_MAX(x[i]) xmax >= 0.0 161 | { 162 | #ifndef IEEE_FLOAT 163 | int i; 164 | float xmax; 165 | 166 | xmax = 0.0f; 167 | for ( i = 0; i < n; i++ ) 168 | if ( x[i] > xmax ) 169 | xmax = x[i]; 170 | return xmax; 171 | #else 172 | /* reinterpret floating point as integer and compare. */ 173 | int i; 174 | signed int xmax = 0 ; 175 | union {signed int i; float f;} u ; 176 | 177 | signed int *p = (signed int *)x ; 178 | 179 | for ( i = 0; i < n; i++ ) 180 | if ( p[i] > xmax ) 181 | xmax = p[i]; 182 | u.i = xmax ; 183 | 184 | return u.f; 185 | #endif 186 | } 187 | 188 | /*------------------------------------------------------------------*/ 189 | -------------------------------------------------------------------------------- /hmp3/src/cnt.c: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: cnt.c,v 1.1 2005/07/13 17:22:20 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | // to match asm code, equality goes to higher index 46 | 47 | typedef struct 48 | { 49 | int bits; 50 | int index; 51 | } 52 | BI; 53 | 54 | // low=table a, high = table b 55 | static const int table_quad[] = { 56 | 0x00040001, 57 | 0x00050005, 58 | 0x00050005, 59 | 0x00060007, 60 | 0x00050005, 61 | 0x00060008, 62 | 0x00060007, 63 | 0x00070009, 64 | 0x00050005, 65 | 0x00060007, 66 | 0x00060007, 67 | 0x00070009, 68 | 0x00060007, 69 | 0x00070009, 70 | 0x00070009, 71 | 0x0008000A, 72 | }; 73 | 74 | /*--------- 75 | BI CountBits0(void *table, int ix[], int n); 76 | BI CountBits1(void *table, int ix[], int n); 77 | BI CountBits2(void *table, int ix[], int n); 78 | BI CountBits3(void *table, int ix[], int n); 79 | BI CountBits4(void *table, int ix[], int n); 80 | BI CountBits5(void *table, int ix[], int n); 81 | BI CountBitsQuad(int ix[], int nquads); 82 | ------------*/ 83 | 84 | /*---------------------------------------------------------------*/ 85 | BI 86 | CountBits0 ( void *table, int ix[], int n ) 87 | { 88 | BI bi; 89 | 90 | bi.bits = bi.index = 0; 91 | return bi; 92 | } 93 | 94 | /*---------------------------------------------------------------*/ 95 | BI 96 | CountBits1 ( int table[][2], int ix[], int n ) 97 | { 98 | int i, bits, b0, b1; 99 | BI bi; 100 | 101 | if ( n <= 0 ) 102 | { 103 | bi.bits = bi.index = 0; 104 | return bi; 105 | } 106 | 107 | bits = 0; 108 | for ( i = 0; i < n; i += 2 ) 109 | { 110 | bits += table[ix[i]][ix[i + 1]]; 111 | } 112 | 113 | b0 = bits & 0xFFFF; 114 | b1 = ( bits >> 16 ) & 0xFFFF; 115 | if ( b0 < b1 ) 116 | { 117 | bi.bits = b0; 118 | bi.index = 0; 119 | } 120 | else 121 | { 122 | bi.bits = b1; 123 | bi.index = 1; 124 | } 125 | 126 | return bi; 127 | } 128 | 129 | /*---------------------------------------------------------------*/ 130 | BI 131 | CountBits2 ( int table[][4], int ix[], int n ) 132 | { 133 | int i, bits, b0, b1; 134 | BI bi; 135 | 136 | if ( n <= 0 ) 137 | { 138 | bi.bits = bi.index = 0; 139 | return bi; 140 | } 141 | 142 | bits = 0; 143 | for ( i = 0; i < n; i += 2 ) 144 | { 145 | bits += table[ix[i]][ix[i + 1]]; 146 | } 147 | 148 | b0 = bits & 0xFFFF; 149 | b1 = ( bits >> 16 ) & 0xFFFF; 150 | if ( b0 < b1 ) 151 | { 152 | bi.bits = b0; 153 | bi.index = 0; 154 | } 155 | else 156 | { 157 | bi.bits = b1; 158 | bi.index = 1; 159 | } 160 | 161 | return bi; 162 | } 163 | 164 | /*---------------------------------------------------------------*/ 165 | BI 166 | CountBits3 ( int table[][8][2], int ix[], int n ) 167 | { 168 | int i, bits0, bits1, b0, b1; 169 | BI bi; 170 | 171 | if ( n <= 0 ) 172 | { 173 | bi.bits = bi.index = 0; 174 | return bi; 175 | } 176 | 177 | bits0 = bits1 = 0; 178 | for ( i = 0; i < n; i += 2 ) 179 | { 180 | bits0 += table[ix[i]][ix[i + 1]][0]; 181 | bits1 += table[ix[i]][ix[i + 1]][1]; 182 | } 183 | 184 | b0 = bits0 & 0xFFFF; 185 | b1 = ( bits0 >> 16 ) & 0xFFFF; 186 | if ( b0 < b1 ) 187 | { 188 | bi.bits = b0; 189 | bi.index = 0; 190 | } 191 | else 192 | { 193 | bi.bits = b1; 194 | bi.index = 1; 195 | } 196 | 197 | b0 = bits1 & 0xFFFF; 198 | b1 = ( bits1 >> 16 ) & 0xFFFF; 199 | if ( b0 <= bi.bits ) 200 | { 201 | bi.bits = b0; 202 | bi.index = 2; 203 | } 204 | 205 | if ( b1 <= bi.bits ) 206 | { 207 | bi.bits = b1; 208 | bi.index = 3; 209 | } 210 | 211 | return bi; 212 | } 213 | 214 | /*---------------------------------------------------------------*/ 215 | BI 216 | CountBits4 ( int table[][16], int ix[], int n ) 217 | { 218 | int i, bits, b0, b1; 219 | BI bi; 220 | 221 | if ( n <= 0 ) 222 | { 223 | bi.bits = bi.index = 0; 224 | return bi; 225 | } 226 | 227 | bits = 0; 228 | for ( i = 0; i < n; i += 2 ) 229 | { 230 | bits += table[ix[i]][ix[i + 1]]; 231 | } 232 | 233 | b0 = bits & 0xFFFF; 234 | b1 = ( bits >> 16 ) & 0xFFFF; 235 | if ( b0 < b1 ) 236 | { 237 | bi.bits = b0; 238 | bi.index = 0; 239 | } 240 | else 241 | { 242 | bi.bits = b1; 243 | bi.index = 1; 244 | } 245 | 246 | return bi; 247 | } 248 | 249 | /*---------------------------------------------------------------*/ 250 | BI 251 | CountBits5 ( int table[][16], int ix[], int n ) // linbits 252 | { 253 | int i, bits, b0, b1, ix0, ix1; 254 | BI bi; 255 | 256 | if ( n <= 0 ) 257 | { 258 | bi.bits = bi.index = 0; 259 | return bi; 260 | } 261 | 262 | bits = 0; 263 | for ( i = 0; i < n; i += 2 ) 264 | { 265 | ix0 = ix[i]; 266 | if ( ix0 > 15 ) 267 | ix0 = 15; 268 | ix1 = ix[i + 1]; 269 | if ( ix1 > 15 ) 270 | ix1 = 15; 271 | bits += table[ix0][ix1]; 272 | } 273 | 274 | b0 = bits & 0xFFFF; 275 | b1 = ( bits >> 16 ) & 0xFFFF; 276 | if ( b0 < b1 ) 277 | { 278 | bi.bits = b0; 279 | bi.index = 0; 280 | } 281 | else 282 | { 283 | bi.bits = b1; 284 | bi.index = 1; 285 | } 286 | 287 | return bi; 288 | } 289 | 290 | /*---------------------------------------------------------------*/ 291 | BI 292 | CountBitsQuad ( int ix[], int nquads ) 293 | { 294 | int i, k, j, bits, b0, b1; 295 | BI bi; 296 | 297 | if ( nquads <= 0 ) 298 | { 299 | bi.bits = bi.index = 0; 300 | return bi; 301 | } 302 | 303 | bits = 0; 304 | for ( k = 0, i = 0; i < nquads; i++, k += 4 ) 305 | { 306 | j = ( ix[k] << 3 ) + ( ix[k + 1] << 2 ) + ( ix[k + 2] << 1 ) + ix[k + 307 | 3]; 308 | bits += table_quad[j]; 309 | } 310 | 311 | b0 = bits & 0xFFFF; 312 | b1 = ( bits >> 16 ) & 0xFFFF; 313 | if ( b0 < b1 ) 314 | { 315 | bi.bits = b0; 316 | bi.index = 0; 317 | } 318 | else 319 | { 320 | bi.bits = b1; 321 | bi.index = 1; 322 | } 323 | 324 | return bi; 325 | } 326 | 327 | /*---------------------------------------------------------------*/ 328 | -------------------------------------------------------------------------------- /hmp3/src/mp3low.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: mp3low.h,v 1.1 2005/07/13 17:22:20 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _MP3LOW_H_ 39 | #define _MP3LOW_H_ 40 | 41 | #ifdef __cplusplus 42 | extern "C" 43 | { 44 | #endif 45 | //---------------------------------------------- 46 | 47 | void L3_outbits_init ( unsigned char *outbuf ); 48 | int L3_outbits_flush ( ); 49 | void L3_outbits ( unsigned int x, int nbits ); 50 | 51 | int setup_nband_L3 ( MPEG_HEAD * h ); 52 | void sbt_init ( void ); 53 | void xsbt_init ( void ); 54 | void L3table_init ( int sr_index, int h_id, int band_limit ); 55 | int L3freq_nearest_sf_band ( int sr_index_arg, int h_id_arg, int freq ); 56 | 57 | void b3FFT_init ( ); 58 | void xFFT_init ( ); // Pentium III sse 59 | 60 | void amod_init ( int f_select_arg, int nsb_arg, int npred_arg, int npolar_arg, int h_id_arg, int cpu_select, int nsum[], // epart 61 | SPD_CNTL spd_cntl[65], float w_spd[], // spd 62 | SNR_TABLE2 tv[64], int *snr_npart, // snr 63 | MAP_TABLE smr_map[21] ); // smr 64 | 65 | void amod_initLong ( int f_select_arg, int nsb_arg, int h_id_arg, int nsumShort[], // epart 66 | SPD_CNTL spd_cntlShort[65], float w_spdShort[] ); 67 | void amod_initShort ( int f_select_arg, int nsb_arg, int h_id_arg, int nsumShort[], // epart 68 | SPD_CNTL spd_cntlShort[65], float w_spdShort[] ); 69 | 70 | void bFFT1024RealHann ( float *input, float *fftbuf ); 71 | void bFFT1024RealHannApprox ( float *input, float *fftbuf ); 72 | void bFFT256RealHann ( float *input, float *fftbuf ); 73 | 74 | // Pentium III 75 | void xFFT1024RealHannApprox ( float *input, float *fftbuf ); 76 | void xFFT256RealHann ( float *input, float *fftbuf ); 77 | 78 | void aL3pred_shortGeo ( float *fftbuf_short, 79 | float *pmeas, int npred_short, int npred_short0 ); 80 | void aL3pred_longGeo ( float zgeobuf[2][2 * 256], float *fftbuf, 81 | float *pmeas, int npred_long );; 82 | // Pentium III sse preds 83 | void xL3pred_shortGeo ( float *fftbuf_short, 84 | float *pmeas, int npred_short, int npred_short0 ); 85 | void xL3pred_longGeo ( float zgeobuf[2][2 * 256], float *fftbuf, 86 | float *pmeas, int npred_long );; 87 | 88 | void map_xform ( float x[], float rrx[], int npolar ); 89 | void epart ( float rr[], float pmeas[], float e[][64], int nsum[68] ); 90 | void spd ( float e[2][64], float ec[2][64], SPD_CNTL c[65], float w[] ); 91 | void L3snrEcho ( float ec[2][64], SNR_TABLE2 tv[64], 92 | float ecsave[2][64], int npart ); 93 | void L3snr ( float ec[2][64], SNR_TABLE2 tv[64], 94 | float ecsave[2][64], int npart ); 95 | void L3smr ( float e[], float et[], SIG_MASK sm[], MAP_TABLE map[21] ); 96 | void L3mask ( float et[], float mask[], MAP_TABLE map[21] ); 97 | 98 | // quick acoustic 99 | void emapLong ( float xr[], float e[64], int nsum[68] ); 100 | void spd_smrLong ( float e[64], float esave[64], 101 | SPD_CNTL c[65], float w[], SIG_MASK sm[] ); 102 | //void spd_smrLongEcho(float e[64], float esave[64], 103 | // SPD_CNTL c[65], float w[], 104 | // SIG_MASK sm[]); 105 | void spd_smrLongEcho ( float e[64], float esave[64], 106 | SPD_CNTL c[65], float w[], 107 | SIG_MASK sm[], int block_type ); 108 | 109 | // short block acoustic 110 | //void emapShort(float xr[][192], float e[3][64], int nsum[68]); 111 | void emapShort ( float xr[], float e[3][64], int nsum[68] ); 112 | void spd_smrShort ( float e[3][64], float ecsave[], 113 | SPD_CNTL c[65], float w[], 114 | SIG_MASK sm[], int block_type_prev ); 115 | 116 | void sbt_L3 ( float *buf1, float *sample ); 117 | void xsbt_L3 ( float *buf1, float *sample ); 118 | void FreqInvert ( float *sample, int nsb_limit ); 119 | void hybrid ( float *sample, float *sample_prev, float *xr, 120 | int btype, int nlong, int ntot ); 121 | void hybridLong ( float *sample, float *sample_prev, float *xr, 122 | int btype, int nlong, int clear_flag ); 123 | void hybridShort ( float *sample, float *sample_prev, float *xr, int n ); 124 | void antialias ( float x[], int n ); 125 | void xantialias ( float x[], int n ); 126 | 127 | float *align16 ( float * ); 128 | 129 | //int ms_correlation(float x[2][576], int band_limit_stereo); 130 | //int ms_correlation2(float x[2][576]); 131 | 132 | int L3_pack_sf_MPEG1 ( SCALEFACT * sf, int block_type ); 133 | int L3_pack_sf_MPEG1B ( SCALEFACT * sf, int ch, int igr, int *pscfsi ); 134 | int L3_pack_sf_MPEG1B2 ( SCALEFACT * sf, int ch, int igr, 135 | int *pscfsi, int not_null ); 136 | int L3_pack_sf_MPEG2 ( SCALEFACT * sf, int is_chan, int nsf_stereo, 137 | int nsf_stereo_short, int block_type ); 138 | int L3_pack_huff ( GR * gr_data, int *ix, unsigned char *ixsign ); 139 | 140 | void L3_pack_side_MPEG1 ( unsigned char *bs_out, 141 | SIDE_INFO * side_info, int nchan ); 142 | void L3_pack_side_MPEG2 ( unsigned char *bs_out, 143 | SIDE_INFO * side_info, int nchan, int igr ); 144 | 145 | void mpeg_info_string ( MPEG_HEAD * h, char *s, E_CONTROL * ec ); 146 | 147 | int setup_header ( E_CONTROL * ec, MPEG_HEAD * h ); 148 | int setup_abcd ( MPEG_HEAD * h ); 149 | int setup_nsb ( MPEG_HEAD * h ); 150 | int setup_nbal ( MPEG_HEAD * h ); 151 | int setup_samprate ( MPEG_HEAD * h ); 152 | int setup_maxbits ( MPEG_HEAD * h, int totbitrate ); 153 | 154 | void dummy ( ); 155 | 156 | void attack_detect ( float pcm[], 157 | int eng[], float filter[2], int flags[2] ); 158 | void attack_detectSBT ( float sample[][576], 159 | int eng[], float filter[2], int flags[2] ); 160 | 161 | int attack_detect_igr ( float pcm[], int eng[], float filter[2] ); 162 | 163 | int attack_detectSBT_igr ( float sample[576], 164 | int eng[], int short_flag_prev ); 165 | 166 | int attack_detectSBT_igr_MPEG2 ( float sample[576], 167 | int eng[], int short_flag_prev ); 168 | 169 | //------ test code 170 | void out_f ( float *x, int n ); 171 | 172 | //---------------------------------------------- 173 | #ifdef __cplusplus 174 | } 175 | #endif 176 | 177 | #endif // _MP3LOW_H_ 178 | -------------------------------------------------------------------------------- /hmp3/src/pub/bitallo3.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: bitallo3.h,v 1.1 2005/07/13 17:22:24 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #ifndef _BITALLO3_H_ 39 | #define _BITALLO3_H_ 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include "l3e.h" 49 | #include "bitallo.h" 50 | #include "bitallos.h" // short block allocation 51 | 52 | #define DISABLE_BA_TAPER 53 | 54 | #define g_offset 8 55 | // caution g_offset also defined in L3math!!! 56 | 57 | // delta from gzero to gmin, 58 | // theoretical value is 73+, 70 allows for rounding in gsf -> sf 59 | #define GMIN_OFFSET 70 60 | 61 | // per ch igr bits limited by part2_3length 62 | #define PART23 4021 63 | 64 | //========================================================= 65 | class CBitAllo3:public CBitAllo 66 | { 67 | 68 | public: 69 | CBitAllo3 ( ); 70 | 71 | // ~CBitAllo3() {} 72 | ~CBitAllo3 ( ); 73 | 74 | void BitAllo ( float xr_arg[][576], SIG_MASK sm_arg[][36], 75 | int ch_arg, int nchan_arg, 76 | int min_bits_arg, int target_bits_arg, int max_bits_arg, 77 | int bit_pool_arg, 78 | SCALEFACT sf_out[], GR gr_data[], 79 | int ix_arg[][576], 80 | unsigned char signx_arg[][576], int ms_flag_arg ); 81 | 82 | int BitAlloInit ( BA_CONTROL & ba_control ); 83 | 84 | int ms_correlation2 ( float x[2][576], int block_type = 0 ); 85 | int ms_correlation201 ( float x[2][576], int block_type = 0 ); 86 | int ms_correlation202 ( float x[2][576], int block_type = 0 ); 87 | 88 | void ba_out_stats ( ); // test routine 89 | 90 | //-data------------------------------------------------ 91 | private: 92 | 93 | int hq_flag; 94 | int hf_flag; 95 | int vbr_flag; 96 | int hf_quant; 97 | int hf_quant_stereo[2]; 98 | int gsf_hf; 99 | int gsf_hf_stereo[2]; 100 | 101 | float gz_con1B; 102 | float gz_con2B; 103 | 104 | int totBits; 105 | int ms_count; 106 | int call_count; 107 | int nchan; 108 | int is_flag; 109 | int ms_flag; 110 | int ill_is_pos; 111 | int h_id; 112 | 113 | int maxBits; /* must not exceed */ 114 | int maxTargetBits; 115 | int minTargetBits; /* maybe wasted if less */ 116 | int PoolBits; 117 | int PoolFraction; 118 | int max_cnt_bits; 119 | int TargetBits; 120 | int MNR; // long term MNR target in mb 121 | int deltaMNR; // 122 | int initialMNR; 123 | //int bt1MNR; 124 | int activeBands; 125 | 126 | //int nsf[2]; // in base class 127 | int nsf2[2]; 128 | int nsf3[2]; // stereo hf allo 129 | 130 | //int nBand_l[22]; // in base class 131 | //int startBand_l[24]; 132 | //int nBand_s[12]; 133 | //int startBand_s[13]; 134 | 135 | int nbmax[2]; 136 | int nbmax2[2]; 137 | int nbmax3[2]; 138 | int huff_bits[2]; 139 | 140 | int taperNT[22]; 141 | 142 | float rnBand_l[22]; // 1.0/nBand_l 143 | 144 | float dGdB; /* delta G/delta bits, dG = dGdB*dB */ 145 | 146 | typedef float ARRAY576[576]; 147 | ARRAY576 *xr; 148 | typedef int intARRAY576[576]; 149 | intARRAY576 *ix; 150 | typedef unsigned char ucharARRAY576[576]; 151 | ucharARRAY576 *signx; 152 | 153 | int look_log_cbwmb[21 + 1]; // log(sf band width) in mb 154 | 155 | int snr[2][22]; 156 | float xsxx[2][22]; 157 | float xsxxms[2][22]; 158 | int Noise0[2][22]; // Noise at no-allo (signal) 159 | int Noise[2][22]; // Noise 160 | int NT[2][22]; // Noise Target (LR or ms) 161 | 162 | int NTadjust[2][22]; // estimator Noise Target adjust 163 | 164 | float x34max[2][22]; 165 | int ixmax[2][22]; 166 | int ix10xmax[2][22]; 167 | int gzero[2][22]; 168 | int gmin[2][22]; // 3/3/99 min val for g, smaller may overflow quant 169 | int gsf[2][22]; 170 | //int gsfq[2][22]; // gsf for inverse quant 171 | int sf[2][22]; 172 | int G[2]; 173 | int active_sf[2][22]; 174 | //float xigain34[2][22]; // fwd quant gain factors 175 | 176 | float x34[2][576]; 177 | int ix10x[2][576]; 178 | 179 | int preemp[2]; 180 | int scalefactor_scale[2]; 181 | 182 | int *psf_upper_limit[2], *psf_lower_limit[2]; 183 | 184 | // vars for noise seek actual 185 | float *y34, *y; 186 | int *ysignmask; 187 | int NTarget, noise, dn, logn; 188 | int NTarget0, NTarget1; 189 | //-------- 190 | 191 | BA_CONTROL ba_control; // added for testing 192 | 193 | int ms_correlation_memory; 194 | 195 | int int_dummy; 196 | 197 | //-functions------------------------------------------------ 198 | private: 199 | 200 | void mnr_feedback ( int activeBands, int bits, int block_type ); 201 | 202 | void output_sf ( SCALEFACT sf_out[] ); 203 | void startup ( SIG_MASK sm[][36], unsigned char signx[][576] ); 204 | void startup_ms ( SIG_MASK sm[][36], unsigned char signx[][576] ); 205 | void startup_ms2 ( SIG_MASK sm[][36], unsigned char signx[][576] ); 206 | void startup_adjustNT1 ( ); 207 | void startup_adjustNT1B ( ); 208 | void startup_adjustNT ( ); 209 | 210 | int allocate ( ); 211 | int allocate_ms ( ); 212 | 213 | void noise_seek_initial2 ( ); 214 | int decrease_noise ( int s0, int n ); 215 | int increase_noise ( int s0, int n ); 216 | void noise_seek_actual ( ); 217 | 218 | void lucky_noise ( ); 219 | void big_lucky_noise ( ); 220 | void big_lucky_noise2 ( ); 221 | int sfHeadRoom ( int ch ); 222 | 223 | void inverse_sf2 ( ); 224 | 225 | void quant ( int gsf[2][22] ); 226 | void quantB ( int gsf[2][22] ); 227 | void quantB10x ( int gsf[2][22] ); // used for thresholding 228 | 229 | void clear_hf ( ); 230 | void clear_hf_main ( ); 231 | 232 | void sparse_quad_counted ( int qx[], int n, int sparse_level ); 233 | void quantBhf ( ); 234 | void quantBhf_ms ( ); 235 | 236 | int count_bits ( ); 237 | int count_bits2 ( int opti_flag ); 238 | int count_bits_dual ( ); 239 | 240 | void fnc_sf_final ( int ch ); 241 | void fnc_sf_final_MPEG1 ( int ch ); 242 | void fnc_sf_final_MPEG2 ( int ch ); 243 | int fnc_scale_factors ( ); 244 | int fnc_scale_factors_ms ( ); 245 | 246 | void trade_side ( ); 247 | void trade_main ( ); 248 | void trade_dual ( ); 249 | 250 | void ms_sparse ( ); 251 | void ms_sparse_quads ( ); 252 | 253 | void hf_adjust ( ); 254 | void hf_adjust_ms ( ); 255 | 256 | int increase_bits ( int bits0 ); 257 | int increase_bits_ms01 ( int bits0 ); 258 | int increase_bits_ms ( int bits0 ); 259 | int limit_bits ( int bits0 ); 260 | int limit_part23_bits ( ); 261 | int decrease_bits01 ( int bits0 ); 262 | int decrease_bits ( int bits0 ); 263 | int decrease_bits_ms ( int bits0 ); 264 | 265 | // short bit allocation 266 | CBitAlloShort BitAlloShort; 267 | 268 | }; 269 | 270 | #endif // _BITALLO3_H_ 271 | -------------------------------------------------------------------------------- /hmp3/src/platform/win/i386/mbexp.inc: -------------------------------------------------------------------------------- 1 | ; ***** BEGIN LICENSE BLOCK ***** 2 | ; Source last modified: $Id: mbexp.inc,v 1.2 2005/08/09 20:43:45 karll Exp $ 3 | ; 4 | ; Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | ; 6 | ; The contents of this file, and the files included with this file, 7 | ; are subject to the current version of the RealNetworks Public 8 | ; Source License (the "RPSL") available at 9 | ; http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | ; the file under the current version of the RealNetworks Community 11 | ; Source License (the "RCSL") available at 12 | ; http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | ; will apply. You may also obtain the license terms directly from 14 | ; RealNetworks. You may not use this file except in compliance with 15 | ; the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | ; to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | ; the rights, obligations and limitations governing use of the 18 | ; contents of the file. 19 | ; 20 | ; This file is part of the Helix DNA Technology. RealNetworks is the 21 | ; developer of the Original Code and owns the copyrights in the 22 | ; portions it created. 23 | ; 24 | ; This file, and the files included with this file, is distributed 25 | ; and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | ; KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | ; ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | ; ENJOYMENT OR NON-INFRINGEMENT. 30 | ; 31 | ; Technology Compatibility Kit Test Suite(s) Location: 32 | ; http://www.helixcommunity.org/content/tck 33 | ; 34 | ; Contributor(s): 35 | ; 36 | ; ***** END LICENSE BLOCK ***** 37 | 38 | 39 | look_mbExpA label dword 40 | dd 03F800000h, 03FE6C949h, 040500E4Eh, 040BB9070h, 04129173Fh, 041986FD6h 41 | dd 042096C55h, 04277C6C4h, 042DF5F66h, 043495F57h, 043B589FEh, 04423A8B7h 42 | dd 044938A43h, 04505023Ah, 0456FD129h, 045D8327Ah, 04642E757h, 046AFB518h 43 | dd 0471E66DBh, 0478ECCF4h, 04800BC6Bh, 048681D02h, 048D14091h, 0493CA489h 44 | dd 049AA1026h, 04A19503Ah, 04A8A36A0h, 04AF9337Fh, 04B60A835h, 04BCA87C4h 45 | dd 04C369538h, 04CA499A0h, 04D146371h, 04D85C604h, 04DF1322Dh, 04E5970B9h 46 | dd 04EC4063Eh, 04F30B7BDh, 04F9F5006h, 0500F9F29h, 0508179ECh, 050E972AFh 47 | dd 051527497h, 051BDBA39h, 0522B0A7Ch, 0529A31E8h, 0530B0214h, 0537AA254h 48 | dd 053E1F2E8h, 0544BB1E5h, 054B7A1FCh, 055258BEBh, 055953DDFh, 056068AEFh 49 | dd 056729538h, 056DAB0CDh, 0574526CBh, 057B1BBDEh, 058203A89h, 058907293h 50 | dd 059023883h, 0596ACA53h, 059D3AA62h, 05A3ED181h, 05AAC0643h, 05B1B14E2h 51 | dd 05B8BCEB3h, 05BFC1344h, 05C633F82h, 05CCCDDBCh, 05D38B04Ch, 05DA67F9Bh 52 | dd 05E16198Fh, 05E8750FCh, 05EF3FA4Eh, 05F5BF2B8h, 05FC64901h, 06032C17Fh 53 | dd 060A12665h, 061114734h, 06182F833h, 061EC23F0h, 06254E1F5h, 062BFEA65h 54 | dd 0632D037Ch, 0639BF92Bh, 0640C9C7Fh, 0647D8653h, 064E48E05h, 0654E0B4Eh 55 | dd 065B9C029h, 0662774B2h, 06696F682h, 06708182Ch, 067756172h, 067DD367Ch 56 | dd 068476CE2h, 068B3C8A1h, 06922139Ch, 069921D0Eh, 06A03B8FDh, 06A6D7F8Bh 57 | dd 06AD61B53h, 06B4104E6h, 06BAE022Ah, 06C1CDEC3h, 06C8D6B7Bh, 06CFEFB85h 58 | dd 06D65DE75h, 06DCF3A9Bh, 06E3AD197h, 06EA86B32h, 06F17D4BBh, 06F88E081h 59 | dd 06FF6CAA7h, 0705E7C1Dh, 070C89271h, 07134D146h, 071A30231h, 07212F423h 60 | dd 072847AE3h, 072EEDD25h, 07357567Fh, 073C22106h, 0742F024Fh, 0749DC5AEh 61 | dd 0750E3BA7h, 07580396Eh, 0090DBC5Ch, 0097F8D58h, 009E661ECh, 00A4FB11Fh 62 | dd 00ABB3C6Fh, 00B28CB84h, 00B982B90h, 00C092EC9h, 00C7757CBh, 00CDEFB5Bh 63 | dd 00D490527h, 00DB538AFh, 00E235F6Bh, 00E93482Eh, 00F04C6A7h, 00F6F65C0h 64 | dd 00FD7D1A6h, 01042900Ch, 010AF6666h, 0111E1FE9h, 0118E8CFFh, 0120082C3h 65 | dd 01267B50Dh, 012D0E2D9h, 0133C500Ch, 013A9C3FCh, 014190B8Fh, 01489F8B9h 66 | dd 014F8C3E3h, 015604397h, 015CA2D0Fh, 016364372h, 016A44FE7h, 0171420FCh 67 | dd 017858A1Ah, 017F0C626h, 018590F57h, 018C3AE73h, 019306897h, 0199F08ACh 68 | dd 01A0F5ED6h, 01A813FEEh, 01AE90A21h, 01B521655h, 01BBD6540h, 01C2ABDE2h 69 | dd 01C99ECD9h, 01D0AC3D1h, 01D7A3213h, 01DE18DB6h, 01E4B56AAh, 01EB74FBEh 70 | dd 01F2541C6h, 01F94FB08h, 020064EADh, 020722893h, 020DA4EDBh, 02144CE7Fh 71 | dd 021B16C44h, 0221FF2C6h, 0229031E1h, 02301FE30h, 0236A612Ah, 023D34B95h 72 | dd 0243E7C0Bh, 024ABB937h, 0251ACF6Dh, 0258B9015h, 025FBA25Eh, 02662D9BBh 73 | dd 026CC81FBh, 027385D94h, 027A63509h, 02815D655h, 028871461h, 028F38D09h 74 | dd 0295B9035h, 029C5F033h, 02A327170h, 02AA0DE38h, 02B110623h, 02B82BD8Bh 75 | dd 02BEBBA2Dh, 02C54829Dh, 02CBF9470h, 02D2CB5FFh, 02D9BB34Fh, 02E0C5D86h 76 | dd 02E7D14C7h, 02EE427A8h, 02F4DAF05h, 02FB96CF8h, 0302729B2h, 03096B2E6h 77 | dd 03107DB38h, 03174F38Ch, 031DCD369h, 032471391h, 032B3781Ch, 03321CB05h 78 | dd 03391DB9Dh, 034037DFEh, 0346D152Ch, 034D5BB6Fh, 03540AE73h, 035ADB43Bh 79 | dd 0361C9881h, 0368D2C24h, 036FE8951h, 037657781h, 037CEDDCBh, 0383A7DEBh 80 | dd 038A81FC3h, 0391790BAh, 03988A333h, 039F65C1Fh, 03A5E1878h, 03AC8389Dh 81 | dd 03B34804Ah, 03BA2B92Fh, 03C12B252h, 03C843F8Eh, 03CEE722Ah, 03D56F60Dh 82 | dd 03DC1CA14h, 03E2EB3EDh, 03E9D7F04h, 03F0DFBF3h 83 | look_mbExpB label dword 84 | dd 03F800000h, 03F804B8Ah, 03F809740h, 03F80E323h, 03F812F33h, 03F817B70h 85 | dd 03F81C7D9h, 03F821470h, 03F826134h, 03F82AE25h, 03F82FB44h, 03F834890h 86 | dd 03F83960Ah, 03F83E3B1h, 03F843187h, 03F847F8Ah, 03F84CDBBh, 03F851C1Bh 87 | dd 03F856AA8h, 03F85B964h, 03F86084Fh, 03F865768h, 03F86A6B0h, 03F86F626h 88 | dd 03F8745CCh, 03F8795A0h, 03F87E5A4h, 03F8835D7h, 03F888639h, 03F88D6CAh 89 | dd 03F89278Bh, 03F89787Ch, 03F89C99Dh, 03F8A1AEDh, 03F8A6C6Dh, 03F8ABE1Eh 90 | dd 03F8B0FFFh, 03F8B6210h, 03F8BB451h, 03F8C06C3h, 03F8C5966h, 03F8CAC39h 91 | dd 03F8CFF3Dh, 03F8D5273h, 03F8DA5D9h, 03F8DF971h, 03F8E4D3Ah, 03F8EA134h 92 | dd 03F8EF560h, 03F8F49BEh, 03F8F9E4Dh, 03F8FF30Eh, 03F904802h, 03F909D27h 93 | dd 03F90F27Fh, 03F914809h, 03F919DC5h, 03F91F3B4h, 03F9249D6h, 03F92A02Bh 94 | dd 03F92F6B3h, 03F934D6Dh, 03F93A45Bh, 03F93FB7Ch, 03F9452D1h, 03F94AA59h 95 | dd 03F950215h, 03F955A04h, 03F95B228h, 03F960A7Fh, 03F96630Bh, 03F96BBCBh 96 | dd 03F9714BFh, 03F976DE8h, 03F97C745h, 03F9820D7h, 03F987A9Eh, 03F98D49Ah 97 | dd 03F992ECBh, 03F998931h, 03F99E3CDh, 03F9A3E9Eh, 03F9A99A5h, 03F9AF4E1h 98 | dd 03F9B5053h, 03F9BABFCh, 03F9C07DAh, 03F9C63EEh, 03F9CC039h, 03F9D1CBBh 99 | dd 03F9D7972h, 03F9DD661h, 03F9E3387h, 03F9E90E3h, 03F9EEE76h, 03F9F4C41h 100 | dd 03F9FAA43h, 03FA0087Dh, 03FA066EEh, 03FA0C597h, 03FA12478h, 03FA18391h 101 | dd 03FA1E2E1h, 03FA2426Bh, 03FA2A22Ch, 03FA30226h, 03FA36259h, 03FA3C2C4h 102 | dd 03FA42369h, 03FA48446h, 03FA4E55Ch, 03FA546ACh, 03FA5A836h, 03FA609F8h 103 | dd 03FA66BF5h, 03FA6CE2Bh, 03FA7309Ch, 03FA79346h, 03FA7F62Bh, 03FA8594Ah 104 | dd 03FA8BCA3h, 03FA92037h, 03FA98406h, 03FA9E810h, 03FAA4C55h, 03FAAB0D5h 105 | dd 03FAB1590h, 03FAB7A87h, 03FABDFB9h, 03FAC4527h, 03FACAAD1h, 03FAD10B7h 106 | dd 03FAD76D9h, 03FADDD37h, 03FAE43D2h, 03FAEAAA9h, 03FAF11BDh, 03FAF790Eh 107 | dd 03FAFE09Ch, 03FB04866h, 03FB0B06Eh, 03FB118B4h, 03FB18137h, 03FB1E9F8h 108 | dd 03FB252F6h, 03FB2BC33h, 03FB325ADh, 03FB38F66h, 03FB3F95Eh, 03FB46393h 109 | dd 03FB4CE08h, 03FB538BBh, 03FB5A3ADh, 03FB60EDFh, 03FB67A4Fh, 03FB6E5FFh 110 | dd 03FB751EFh, 03FB7BE1Eh, 03FB82A8Dh, 03FB8973Ch, 03FB9042Ch, 03FB9715Bh 111 | dd 03FB9DECBh, 03FBA4C7Ch, 03FBABA6Dh, 03FBB289Fh, 03FBB9712h, 03FBC05C7h 112 | dd 03FBC74BCh, 03FBCE3F4h, 03FBD536Ch, 03FBDC327h, 03FBE3324h, 03FBEA362h 113 | dd 03FBF13E3h, 03FBF84A6h, 03FBFF5ACh, 03FC066F5h, 03FC0D880h, 03FC14A4Eh 114 | dd 03FC1BC60h, 03FC22EB5h, 03FC2A14Dh, 03FC31429h, 03FC38749h, 03FC3FAADh 115 | dd 03FC46E54h, 03FC4E240h, 03FC55671h, 03FC5CAE6h, 03FC63F9Fh, 03FC6B49Eh 116 | dd 03FC729E2h, 03FC79F6Bh, 03FC81539h, 03FC88B4Dh, 03FC901A6h, 03FC97845h 117 | dd 03FC9EF2Bh, 03FCA6656h, 03FCADDC8h, 03FCB5580h, 03FCBCD7Fh, 03FCC45C5h 118 | dd 03FCCBE51h, 03FCD3725h, 03FCDB040h, 03FCE29A3h, 03FCEA34Dh, 03FCF1D3Fh 119 | dd 03FCF9779h, 03FD011FBh, 03FD08CC6h, 03FD107D9h, 03FD18334h, 03FD1FED8h 120 | dd 03FD27AC6h, 03FD2F6FCh, 03FD3737Ch, 03FD3F045h, 03FD46D58h, 03FD4EAB5h 121 | dd 03FD5685Bh, 03FD5E64Ch, 03FD66487h, 03FD6E30Dh, 03FD761DDh, 03FD7E0F8h 122 | dd 03FD8605Eh, 03FD8E010h, 03FD9600Ch, 03FD9E054h, 03FDA60E8h, 03FDAE1C8h 123 | dd 03FDB62F4h, 03FDBE46Ch, 03FDC6631h, 03FDCE842h, 03FDD6A9Fh, 03FDDED4Ah 124 | dd 03FDE7042h, 03FDEF387h, 03FDF771Ah, 03FDFFAFAh, 03FE07F28h, 03FE103A4h 125 | dd 03FE1886Eh, 03FE20D87h, 03FE292EEh, 03FE318A4h, 03FE39EA9h, 03FE424FDh 126 | dd 03FE4ABA0h, 03FE53293h, 03FE5B9D5h, 03FE64167h 127 | -------------------------------------------------------------------------------- /hmp3/src/sbt.c: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: sbt.c,v 1.1 2005/07/13 17:22:20 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | /*-- window ---*/ 44 | 45 | /*------------- window scaled for idct ! ----------*/ 46 | static const float wincoef[264] = { /* window coefs */ 47 | #include "tableaw2.h" 48 | }; 49 | 50 | /*-- idct ---*/ 51 | static float coef[32]; /* 32 pt inverse dct coefs */ 52 | static float a[32]; /* ping pong buffers */ 53 | static float b[32]; 54 | 55 | /*--------------------------------------------------------------------*/ 56 | void 57 | window ( const float vbuf[] ) 58 | { 59 | int i, j, k; 60 | const float *si, *bx; 61 | const float *coef; 62 | float sum1, sum2; 63 | 64 | /*-- output to dct ping-pong buf b --*/ 65 | si = vbuf + 16; 66 | bx = vbuf + 15; 67 | 68 | k = 0; 69 | coef = wincoef; 70 | 71 | /*-- first 1 --*/ 72 | sum1 = 0.0f; 73 | for ( j = 0; j < 512; j += 64 ) 74 | { 75 | sum1 += ( *coef++ ) * si[j]; 76 | } 77 | si++; 78 | b[k++] = sum1 ; 79 | 80 | /*-- 16 --*/ 81 | for ( i = 0; i < 16; i++ ) 82 | { 83 | sum1 = sum2 = 0.0f; 84 | for ( j = 0; j < 512; j += 64 ) 85 | { 86 | sum1 += ( *coef++ ) * si[j]; 87 | sum2 += ( *coef++ ) * bx[j]; 88 | } 89 | si++; 90 | bx--; 91 | b[k++] = sum1+sum2; 92 | } 93 | 94 | /*-- last 15 --*/ 95 | coef = wincoef + 247; 96 | bx += 64; 97 | for ( i = 0; i < 15; i++ ) 98 | { 99 | sum1 = sum2 = 0.0f; 100 | for ( j = 0; j < 512; j += 64 ) 101 | { 102 | sum1 += ( *coef-- ) * bx[j]; 103 | sum2 -= ( *coef-- ) * si[j]; 104 | } 105 | si++; 106 | bx--; 107 | b[k++] = sum1+sum2; 108 | } 109 | } 110 | 111 | /*======================================================================*/ 112 | int 113 | fidct_init ( ) /* gen coef for N=32 */ 114 | { 115 | int p, n, i, k; 116 | double t, pi; 117 | 118 | pi = 4.0 * atan ( 1.0 ); 119 | n = 16; 120 | k = 0; 121 | for ( i = 0; i < 5; i++, n = n / 2 ) 122 | { 123 | for ( p = 0; p < n; p++, k++ ) 124 | { 125 | t = ( pi / ( 4 * n ) ) * ( 2 * p + 1 ); 126 | coef[k] = ( float ) ( 2.0 * cos ( t ) ); 127 | } 128 | } 129 | return 1; 130 | } 131 | 132 | /*--------------------------------------------------------------*/ 133 | static void 134 | forward_ibf ( int m, int n, float x[], float f[] ) 135 | { 136 | int i, j, n2, n21; 137 | int p, q, p0; 138 | 139 | p0 = n - 1; 140 | n2 = n / 2; 141 | n21 = n2 - 1; 142 | for ( i = 0; i < m; i++, p0 += n ) 143 | { 144 | p = p0; 145 | q = p0; 146 | f[q] = x[p--]; 147 | f[q - n2] = x[p--]; 148 | q--; 149 | for ( j = 0; j < n21; j++ ) 150 | { 151 | f[q] = x[p--] - f[q + 1]; 152 | f[q - n2] = x[p--]; 153 | q--; 154 | } 155 | } 156 | } 157 | 158 | /*--------------------------------------------------------------*/ 159 | static void 160 | back_ibf ( int m, int n, const float x[], float f[], const float coef[] ) 161 | { 162 | int i, j, n2; 163 | int p, q, p0, k; 164 | 165 | p0 = 0; 166 | n2 = n / 2; 167 | for ( i = 0; i < m; i++, p0 += n ) 168 | { 169 | k = 0; 170 | p = p0; 171 | q = p + n - 1; 172 | for ( j = 0; j < n2; j++, p++, q--, k++ ) 173 | { 174 | float tmp = coef[k] * x[p + n2]; 175 | float t = x[p] ; 176 | f[p] = t + tmp; 177 | f[q] = t - tmp; 178 | } 179 | } 180 | } 181 | 182 | /*--------------------------------------------------------------*/ 183 | 184 | /*---------------- special last stage interleaved output -------*/ 185 | static void 186 | back_ibf_last ( float x[], float f[] ) 187 | { 188 | int p, q, k; 189 | float tmp; 190 | 191 | p = 0; 192 | q = 2 * 31; 193 | for ( k = 0; k < 16; k++, p += 2, q -= 2 ) 194 | { 195 | tmp = coef[k] * x[k + 16]; 196 | f[p] = x[k] + tmp; 197 | f[q] = x[k] - tmp; 198 | } 199 | } 200 | 201 | /*--------------------------------------------------------------*/ 202 | 203 | /*---- special last stage Layer III -------*/ 204 | static void 205 | back_ibf_last_L3 ( float x[], float f[] ) 206 | { 207 | int p, q, k; 208 | float tmp; 209 | 210 | p = 0; 211 | q = 18 * 31; 212 | for ( k = 0; k < 16; k++, p += 18, q -= 18 ) 213 | { 214 | tmp = coef[k] * x[k + 16]; 215 | f[p] = x[k] + tmp; 216 | f[q] = x[k] - tmp; 217 | } 218 | } 219 | 220 | /*--------------------------------------------------------------*/ 221 | void 222 | fidct ( float c[] ) 223 | { 224 | 225 | /*--- idct input must be scaled by window ------------------------*/ 226 | 227 | /*--- b[0]=x[0]; for(i=1;i<32;i++) b[i] = 0.5*x[i]; ----*/ 228 | 229 | forward_ibf ( 1, 32, b, a ); 230 | forward_ibf ( 2, 16, a, b ); 231 | forward_ibf ( 4, 8, b, a ); 232 | forward_ibf ( 8, 4, a, b ); 233 | back_ibf ( 16, 2, b, a, coef + 16 + 8 + 4 + 2 ); 234 | back_ibf ( 8, 4, a, b, coef + 16 + 8 + 4 ); 235 | back_ibf ( 4, 8, b, a, coef + 16 + 8 ); 236 | back_ibf ( 2, 16, a, b, coef + 16 ); 237 | back_ibf_last ( b, c ); 238 | } 239 | 240 | /*--------------------------------------------------------------*/ 241 | void 242 | fidct_L3 ( float c[] ) 243 | { 244 | 245 | /*--- idct input must be scaled by window ------------------------*/ 246 | 247 | /*--- b[0]=x[0]; for(i=1;i<32;i++) b[i] = 0.5*x[i]; ----*/ 248 | 249 | forward_ibf ( 1, 32, b, a ); 250 | forward_ibf ( 2, 16, a, b ); 251 | forward_ibf ( 4, 8, b, a ); 252 | forward_ibf ( 8, 4, a, b ); 253 | back_ibf ( 16, 2, b, a, coef + 16 + 8 + 4 + 2 ); 254 | back_ibf ( 8, 4, a, b, coef + 16 + 8 + 4 ); 255 | back_ibf ( 4, 8, b, a, coef + 16 + 8 ); 256 | back_ibf ( 2, 16, a, b, coef + 16 ); 257 | back_ibf_last_L3 ( b, c ); 258 | } 259 | 260 | /*====================================================================*/ 261 | void 262 | sbt_init ( ) 263 | { 264 | static int first_pass = 1; 265 | 266 | if ( first_pass ) 267 | { 268 | fidct_init ( ); 269 | first_pass = 0; 270 | } 271 | } 272 | 273 | /*====================================================================*/ 274 | void 275 | sbt ( float vbuf[], float samp[] ) 276 | { 277 | int i; 278 | 279 | vbuf += 1152; 280 | for ( i = 0; i < 36; i++ ) 281 | { 282 | vbuf -= 32; 283 | window ( vbuf ); 284 | fidct ( samp ); 285 | samp += 64; /* interleaved output */ 286 | } 287 | 288 | /*-- done --*/ 289 | } 290 | 291 | /*--------------------------------------------------------------------*/ 292 | void 293 | sbt_L3 ( float vbuf[], float samp[] ) 294 | { 295 | int i; 296 | 297 | /* do one granule */ 298 | 299 | vbuf += 576; 300 | for ( i = 0; i < 18; i++ ) 301 | { 302 | vbuf -= 32; 303 | window ( vbuf ); 304 | fidct_L3 ( samp ); 305 | samp++; 306 | } 307 | 308 | /*-- done --*/ 309 | } 310 | 311 | /*--------------------------------------------------------------------*/ 312 | -------------------------------------------------------------------------------- /hmp3/src/mhead.c: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Source last modified: $Id: mhead.c,v 1.1 2005/07/13 17:22:20 rggammon Exp $ 3 | * 4 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved. 5 | * 6 | * The contents of this file, and the files included with this file, 7 | * are subject to the current version of the RealNetworks Public 8 | * Source License (the "RPSL") available at 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed 10 | * the file under the current version of the RealNetworks Community 11 | * Source License (the "RCSL") available at 12 | * http://www.helixcommunity.org/content/rcsl, in which case the RCSL 13 | * will apply. You may also obtain the license terms directly from 14 | * RealNetworks. You may not use this file except in compliance with 15 | * the RPSL or, if you have a valid RCSL with RealNetworks applicable 16 | * to this file, the RCSL. Please see the applicable RPSL or RCSL for 17 | * the rights, obligations and limitations governing use of the 18 | * contents of the file. 19 | * 20 | * This file is part of the Helix DNA Technology. RealNetworks is the 21 | * developer of the Original Code and owns the copyrights in the 22 | * portions it created. 23 | * 24 | * This file, and the files included with this file, is distributed 25 | * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY 26 | * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS 27 | * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES 28 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET 29 | * ENJOYMENT OR NON-INFRINGEMENT. 30 | * 31 | * Technology Compatibility Kit Test Suite(s) Location: 32 | * http://www.helixcommunity.org/content/tck 33 | * 34 | * Contributor(s): 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | 38 | /* 39 | * 40 | * mpeg audio 41 | * extract info from mpeg header 42 | * portable version (adapted from c:\eco\mhead.c 43 | * 44 | * add Layer III 45 | * 46 | */ 47 | 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include "mhead.h" /* mpeg header structure */ 53 | 54 | static const int mp_br_table[2][16] = { 55 | 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0, 56 | 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0 57 | }; 58 | static const int mp_sr20_table[2][4] = { 59 | 441, 480, 320, -999, 882, 960, 640, -999 60 | }; 61 | 62 | static const int mp_br_tableL1[2][16] = { 63 | /* mpeg2 */ 64 | 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0, 65 | 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 66 | }; 67 | 68 | static const int mp_br_tableL3[2][16] = { 69 | /* mpeg 2 */ 70 | 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0, 71 | 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0 72 | }; 73 | 74 | static int find_sync ( unsigned char *buf, int n ); 75 | static int sync_scan ( unsigned char *buf, int n, int i0 ); 76 | static int sync_test ( unsigned char *buf, int n, int isync, int padbytes ); 77 | 78 | /*--------------------------------------------------------------*/ 79 | int 80 | head_info ( unsigned char *buf, unsigned int n, MPEG_HEAD * h ) 81 | { 82 | int framebytes; 83 | 84 | if ( n > 10000 ) 85 | n = 10000; /* limit scan for free format */ 86 | 87 | h->sync = 0; 88 | if ( buf[0] != 0xFF ) 89 | return 0; 90 | if ( ( buf[1] & 0xF0 ) != 0xF0 ) 91 | return 0; 92 | 93 | // mpeg 2.5 sync 94 | //if( ((buf[1] & 0xF0) != 0xF0) && ((buf[1] & 0xF0) != 0xE0) ) return 0; 95 | 96 | h->sync = 1; 97 | 98 | h->id = ( buf[1] & 0x08 ) >> 3; 99 | h->option = ( buf[1] & 0x06 ) >> 1; 100 | h->prot = ( buf[1] & 0x01 ); 101 | 102 | h->br_index = ( buf[2] & 0xf0 ) >> 4; 103 | h->sr_index = ( buf[2] & 0x0c ) >> 2; 104 | h->pad = ( buf[2] & 0x02 ) >> 1; 105 | h->private_bit = ( buf[2] & 0x01 ); 106 | h->mode = ( buf[3] & 0xc0 ) >> 6; 107 | h->mode_ext = ( buf[3] & 0x30 ) >> 4; 108 | h->cr = ( buf[3] & 0x08 ) >> 3; 109 | h->original = ( buf[3] & 0x04 ) >> 2; 110 | h->emphasis = ( buf[3] & 0x03 ); 111 | 112 | /* compute framebytes for Layer I, II, III */ 113 | if ( h->option < 1 ) 114 | return 0; 115 | if ( h->option > 3 ) 116 | return 0; 117 | 118 | framebytes = 0; 119 | 120 | if ( h->br_index > 0 ) 121 | { 122 | if ( h->option == 3 ) 123 | { /* layer I */ 124 | framebytes = 125 | 240 * mp_br_tableL1[h->id][h->br_index] 126 | / mp_sr20_table[h->id][h->sr_index]; 127 | framebytes = 4 * framebytes; 128 | } 129 | else if ( h->option == 2 ) 130 | { /* layer II */ 131 | framebytes = 132 | 2880 * mp_br_table[h->id][h->br_index] 133 | / mp_sr20_table[h->id][h->sr_index]; 134 | } 135 | else if ( h->option == 1 ) 136 | { /* layer III */ 137 | if ( h->id ) 138 | framebytes = 139 | 2880 * mp_br_tableL3[h->id][h->br_index] 140 | / mp_sr20_table[h->id][h->sr_index]; 141 | else 142 | framebytes = 143 | 1440 * mp_br_tableL3[h->id][h->br_index] 144 | / mp_sr20_table[h->id][h->sr_index]; 145 | 146 | } 147 | } 148 | else 149 | framebytes = find_sync ( buf, n ); /* free format */ 150 | 151 | return framebytes; 152 | } 153 | 154 | /*--------------------------------------------------------------*/ 155 | int 156 | head_info2 ( unsigned char *buf, unsigned int n, MPEG_HEAD * h, int *br ) 157 | { 158 | int framebytes; 159 | 160 | /*--- return br (in bits/sec) in addition to frame bytes ---*/ 161 | 162 | *br = 0; /*-- assume fail --*/ 163 | framebytes = head_info ( buf, n, h ); 164 | 165 | if ( framebytes == 0 ) 166 | return 0; 167 | 168 | if ( h->option == 1 ) 169 | { /* layer III */ 170 | if ( h->br_index > 0 ) 171 | *br = 1000 * mp_br_tableL3[h->id][h->br_index]; 172 | else 173 | { 174 | if ( h->id ) // mpeg1 175 | *br = 176 | 1000 * framebytes * mp_sr20_table[h->id][h->sr_index] / 177 | ( 144 * 20 ); 178 | else 179 | *br = 180 | 1000 * framebytes * mp_sr20_table[h->id][h->sr_index] / 181 | ( 72 * 20 ); 182 | } 183 | } 184 | if ( h->option == 2 ) 185 | { /* layer II */ 186 | if ( h->br_index > 0 ) 187 | *br = 1000 * mp_br_table[h->id][h->br_index]; 188 | else 189 | *br = 1000 * framebytes * mp_sr20_table[h->id][h->sr_index] 190 | / ( 144 * 20 ); 191 | } 192 | if ( h->option == 3 ) 193 | { /* layer I */ 194 | if ( h->br_index > 0 ) 195 | *br = 1000 * mp_br_tableL1[h->id][h->br_index]; 196 | else 197 | *br = 1000 * framebytes * mp_sr20_table[h->id][h->sr_index] 198 | / ( 48 * 20 ); 199 | } 200 | 201 | return framebytes; 202 | } 203 | 204 | /*--------------------------------------------------------------*/ 205 | static int 206 | compare ( unsigned char *buf, unsigned char *buf2 ) 207 | { 208 | if ( buf[0] != buf2[0] ) 209 | return 0; 210 | if ( buf[1] != buf2[1] ) 211 | return 0; 212 | return 1; 213 | } 214 | 215 | /*----------------------------------------------------------*/ 216 | 217 | /*-- does not scan for initial sync, initial sync assumed --*/ 218 | static int 219 | find_sync ( unsigned char *buf, int n ) 220 | { 221 | int i0, isync, nmatch, pad; 222 | int padbytes, option; 223 | 224 | /* mod 4/12/95 i0 change from 72, allows as low as 8kbits for mpeg1 */ 225 | i0 = 24; 226 | padbytes = 1; 227 | option = ( buf[1] & 0x06 ) >> 1; 228 | if ( option == 3 ) 229 | { 230 | padbytes = 4; 231 | i0 = 24; /* for shorter layer I frames */ 232 | } 233 | 234 | pad = ( buf[2] & 0x02 ) >> 1; 235 | 236 | n -= 3; /* need 3 bytes of header */ 237 | 238 | while ( i0 < 2000 ) 239 | { 240 | isync = sync_scan ( buf, n, i0 ); 241 | i0 = isync + 1; 242 | isync -= pad; 243 | if ( isync <= 0 ) 244 | return 0; 245 | nmatch = sync_test ( buf, n, isync, padbytes ); 246 | if ( nmatch > 0 ) 247 | return isync; 248 | } 249 | 250 | return 0; 251 | } 252 | 253 | /*------------------------------------------------------*/ 254 | 255 | /*---- scan for next sync, assume start is valid -------*/ 256 | 257 | /*---- return number bytes to next sync ----------------*/ 258 | static int 259 | sync_scan ( unsigned char *buf, int n, int i0 ) 260 | { 261 | int i; 262 | 263 | for ( i = i0; i < n; i++ ) 264 | if ( compare ( buf, buf + i ) ) 265 | return i; 266 | 267 | return 0; 268 | } 269 | 270 | /*------------------------------------------------------*/ 271 | 272 | /*- test consecutative syncs, input isync without pad --*/ 273 | static int 274 | sync_test ( unsigned char *buf, int n, int isync, int padbytes ) 275 | { 276 | int i, nmatch, pad; 277 | 278 | nmatch = 0; 279 | for ( i = 0;; ) 280 | { 281 | pad = padbytes * ( ( buf[i + 2] & 0x02 ) >> 1 ); 282 | i += ( pad + isync ); 283 | if ( i > n ) 284 | break; 285 | if ( !compare ( buf, buf + i ) ) 286 | return -nmatch; 287 | nmatch++; 288 | } 289 | return nmatch; 290 | } 291 | --------------------------------------------------------------------------------