OpenCore
1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
subband.c
Go to the documentation of this file.
1
/* ***** BEGIN LICENSE BLOCK *****
2
* Version: RCSL 1.0/RPSL 1.0
3
*
4
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
5
*
6
* The contents of this file, and the files included with this file, are
7
* subject to the current version of the RealNetworks Public Source License
8
* Version 1.0 (the "RPSL") available at
9
* http://www.helixcommunity.org/content/rpsl unless you have licensed
10
* the file under the RealNetworks Community Source License Version 1.0
11
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
12
* in which case the RCSL will apply. You may also obtain the license terms
13
* directly from RealNetworks. You may not use this file except in
14
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
15
* applicable to this file, the RCSL. Please see the applicable RPSL or
16
* RCSL for the rights, obligations and limitations governing use of the
17
* contents of the file.
18
*
19
* This file is part of the Helix DNA Technology. RealNetworks is the
20
* developer of the Original Code and owns the copyrights in the portions
21
* it created.
22
*
23
* This file, and the files included with this file, is distributed and made
24
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
25
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
26
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
27
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
28
*
29
* Technology Compatibility Kit Test Suite(s) Location:
30
* http://www.helixcommunity.org/content/tck
31
*
32
* Contributor(s):
33
*
34
* ***** END LICENSE BLOCK ***** */
35
36
/**************************************************************************************
37
* Fixed-point MP3 decoder
38
* Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
39
* June 2003
40
*
41
* subband.c - subband transform (synthesis filterbank implemented via 32-point DCT
42
* followed by polyphase filter)
43
**************************************************************************************/
44
45
#include "
coder.h
"
46
#include "
assembly.h
"
47
48
/**************************************************************************************
49
* Function: Subband
50
*
51
* Description: do subband transform on all the blocks in one granule, all channels
52
*
53
* Inputs: filled MP3DecInfo structure, after calling IMDCT for all channels
54
* vbuf[ch] and vindex[ch] must be preserved between calls
55
*
56
* Outputs: decoded PCM data, interleaved LRLRLR... if stereo
57
*
58
* Return: 0 on success, -1 if null input pointers
59
**************************************************************************************/
60
int
Subband
(
MP3DecInfo
*mp3DecInfo,
short
*pcmBuf)
61
{
62
int
b;
63
IMDCTInfo
*mi;
64
SubbandInfo
*sbi;
65
66
/* validate pointers */
67
if
(!mp3DecInfo || !mp3DecInfo->
HuffmanInfoPS
|| !mp3DecInfo->
IMDCTInfoPS
|| !mp3DecInfo->
SubbandInfoPS
)
68
return
-1;
69
70
mi = (
IMDCTInfo
*)(mp3DecInfo->
IMDCTInfoPS
);
71
sbi = (
SubbandInfo
*)(mp3DecInfo->
SubbandInfoPS
);
72
73
if
(mp3DecInfo->
nChans
== 2) {
74
/* stereo */
75
for
(b = 0; b <
BLOCK_SIZE
; b++) {
76
FDCT32
(mi->
outBuf
[0][b], sbi->
vbuf
+ 0*32, sbi->
vindex
, (b & 0x01), mi->
gb
[0]);
77
FDCT32
(mi->
outBuf
[1][b], sbi->
vbuf
+ 1*32, sbi->
vindex
, (b & 0x01), mi->
gb
[1]);
78
PolyphaseStereo
(pcmBuf, sbi->
vbuf
+ sbi->
vindex
+
VBUF_LENGTH
* (b & 0x01),
polyCoef
);
79
sbi->
vindex
= (sbi->
vindex
- (b & 0x01)) & 7;
80
pcmBuf += (2 *
NBANDS
);
81
}
82
}
else
{
83
/* mono */
84
for
(b = 0; b <
BLOCK_SIZE
; b++) {
85
FDCT32
(mi->
outBuf
[0][b], sbi->
vbuf
+ 0*32, sbi->
vindex
, (b & 0x01), mi->
gb
[0]);
86
PolyphaseMono
(pcmBuf, sbi->
vbuf
+ sbi->
vindex
+
VBUF_LENGTH
* (b & 0x01),
polyCoef
);
87
sbi->
vindex
= (sbi->
vindex
- (b & 0x01)) & 7;
88
pcmBuf +=
NBANDS
;
89
}
90
}
91
92
return
0;
93
}
94
assembly.h
coder.h
PolyphaseStereo
#define PolyphaseStereo
Definition
coder.h:101
VBUF_LENGTH
#define VBUF_LENGTH
Definition
coder.h:90
NBANDS
#define NBANDS
Definition
coder.h:88
FDCT32
#define FDCT32
Definition
coder.h:102
PolyphaseMono
#define PolyphaseMono
Definition
coder.h:100
BLOCK_SIZE
#define BLOCK_SIZE
Definition
coder.h:87
polyCoef
#define polyCoef
Definition
coder.h:109
Subband
#define Subband
Definition
statname.h:72
_IMDCTInfo
Definition
coder.h:211
_IMDCTInfo::gb
int gb[MAX_NCHAN]
Definition
coder.h:217
_IMDCTInfo::outBuf
int outBuf[MAX_NCHAN][BLOCK_SIZE][NBANDS]
Definition
coder.h:212
_MP3DecInfo
Definition
mp3common.h:64
_MP3DecInfo::IMDCTInfoPS
void * IMDCTInfoPS
Definition
mp3common.h:71
_MP3DecInfo::nChans
int nChans
Definition
mp3common.h:83
_MP3DecInfo::HuffmanInfoPS
void * HuffmanInfoPS
Definition
mp3common.h:69
_MP3DecInfo::SubbandInfoPS
void * SubbandInfoPS
Definition
mp3common.h:72
_SubbandInfo
Definition
coder.h:253
_SubbandInfo::vindex
int vindex
Definition
coder.h:255
_SubbandInfo::vbuf
int vbuf[MAX_NCHAN *VBUF_LENGTH]
Definition
coder.h:254
Library
OcMp3Lib
helix
subband.c
Generated by
1.12.0