2 /* -----------------------------------------------------------------------------------------------------------
3 Software License for The Fraunhofer FDK AAC Codec Library for Android
5 © Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
9 The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements
10 the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio.
11 This FDK AAC Codec software is intended to be used on a wide variety of Android devices.
13 AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual
14 audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by
15 independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part
16 of the MPEG specifications.
18 Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer)
19 may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners
20 individually for the purpose of encoding or decoding bit streams in products that are compliant with
21 the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license
22 these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec
23 software may already be covered under those patent licenses when it is used for those licensed purposes only.
25 Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality,
26 are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional
27 applications information and documentation.
31 Redistribution and use in source and binary forms, with or without modification, are permitted without
32 payment of copyright license fees provided that you satisfy the following conditions:
34 You must retain the complete text of this software license in redistributions of the FDK AAC Codec or
35 your modifications thereto in source code form.
37 You must retain the complete text of this software license in the documentation and/or other materials
38 provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form.
39 You must make available free of charge copies of the complete source code of the FDK AAC Codec and your
40 modifications thereto to recipients of copies in binary form.
42 The name of Fraunhofer may not be used to endorse or promote products derived from this library without
43 prior written permission.
45 You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec
46 software or your modifications thereto.
48 Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software
49 and the date of any change. For modified versions of the FDK AAC Codec, the term
50 "Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term
51 "Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android."
55 NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer,
56 ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with
57 respect to this software.
59 You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized
60 by appropriate patent licenses.
64 This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors
65 "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties
66 of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
67 CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages,
68 including but not limited to procurement of substitute goods or services; loss of use, data, or profits,
69 or business interruption, however caused and on any theory of liability, whether in contract, strict
70 liability, or tort (including negligence), arising in any way out of the use of this software, even if
71 advised of the possibility of such damage.
73 5. CONTACT INFORMATION
75 Fraunhofer Institute for Integrated Circuits IIS
76 Attention: Audio and Multimedia Departments - FDK AAC LL
78 91058 Erlangen, Germany
80 www.iis.fraunhofer.de/amm
81 amm-info@iis.fraunhofer.de
82 ----------------------------------------------------------------------------------------------------------- */
84 /***************************** MPEG Audio Encoder ***************************
86 Initial author: N. Rettelbach
87 contents/description: Parametric Stereo bitstream encoder
89 ******************************************************************************/
95 #include "ps_bitenc.h"
98 inline UCHAR
FDKsbrEnc_WriteBits_ps(HANDLE_FDK_BITSTREAM hBitStream
, UINT value
,
99 const UINT numberOfBits
)
101 /* hBitStream == NULL happens here intentionally */
102 if(hBitStream
!=NULL
){
103 FDKwriteBits(hBitStream
, value
, numberOfBits
);
108 #define SI_SBR_EXTENSION_SIZE_BITS 4
109 #define SI_SBR_EXTENSION_ESC_COUNT_BITS 8
110 #define SI_SBR_EXTENSION_ID_BITS 2
111 #define EXTENSION_ID_PS_CODING 2
112 #define PS_EXT_ID_V0 0
114 static const INT iidDeltaCoarse_Offset
= 14;
115 static const INT iidDeltaCoarse_MaxVal
= 28;
116 static const INT iidDeltaFine_Offset
= 30;
117 static const INT iidDeltaFine_MaxVal
= 60;
119 /* PS Stereo Huffmantable: iidDeltaFreqCoarse */
120 static const UINT iidDeltaFreqCoarse_Length
[] =
122 17, 17, 17, 17, 16, 15, 13, 10, 9, 7,
123 6, 5, 4, 3, 1, 3, 4, 5, 6, 6,
124 8, 11, 13, 14, 14, 15, 17, 18, 18
126 static const UINT iidDeltaFreqCoarse_Code
[] =
128 0x0001fffb, 0x0001fffc, 0x0001fffd, 0x0001fffa, 0x0000fffc, 0x00007ffc, 0x00001ffd, 0x000003fe, 0x000001fe, 0x0000007e,
129 0x0000003c, 0x0000001d, 0x0000000d, 0x00000005, 0000000000, 0x00000004, 0x0000000c, 0x0000001c, 0x0000003d, 0x0000003e,
130 0x000000fe, 0x000007fe, 0x00001ffc, 0x00003ffc, 0x00003ffd, 0x00007ffd, 0x0001fffe, 0x0003fffe, 0x0003ffff
133 /* PS Stereo Huffmantable: iidDeltaFreqFine */
134 static const UINT iidDeltaFreqFine_Length
[] =
136 18, 18, 18, 18, 18, 18, 18, 18, 18, 17,
137 18, 17, 17, 16, 16, 15, 14, 14, 13, 12,
138 12, 11, 10, 10, 8, 7, 6, 5, 4, 3,
139 1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
140 11, 12, 13, 14, 14, 15, 16, 16, 17, 17,
141 18, 17, 18, 18, 18, 18, 18, 18, 18, 18,
144 static const UINT iidDeltaFreqFine_Code
[] =
146 0x0001feb4, 0x0001feb5, 0x0001fd76, 0x0001fd77, 0x0001fd74, 0x0001fd75, 0x0001fe8a, 0x0001fe8b, 0x0001fe88, 0x0000fe80,
147 0x0001feb6, 0x0000fe82, 0x0000feb8, 0x00007f42, 0x00007fae, 0x00003faf, 0x00001fd1, 0x00001fe9, 0x00000fe9, 0x000007ea,
148 0x000007fb, 0x000003fb, 0x000001fb, 0x000001ff, 0x0000007c, 0x0000003c, 0x0000001c, 0x0000000c, 0000000000, 0x00000001,
149 0x00000001, 0x00000002, 0x00000001, 0x0000000d, 0x0000001d, 0x0000003d, 0x0000007d, 0x000000fc, 0x000001fc, 0x000003fc,
150 0x000003f4, 0x000007eb, 0x00000fea, 0x00001fea, 0x00001fd6, 0x00003fd0, 0x00007faf, 0x00007f43, 0x0000feb9, 0x0000fe83,
151 0x0001feb7, 0x0000fe81, 0x0001fe89, 0x0001fe8e, 0x0001fe8f, 0x0001fe8c, 0x0001fe8d, 0x0001feb2, 0x0001feb3, 0x0001feb0,
155 /* PS Stereo Huffmantable: iidDeltaTimeCoarse */
156 static const UINT iidDeltaTimeCoarse_Length
[] =
158 19, 19, 19, 20, 20, 20, 17, 15, 12, 10,
159 8, 6, 4, 2, 1, 3, 5, 7, 9, 11,
160 13, 14, 17, 19, 20, 20, 20, 20, 20
162 static const UINT iidDeltaTimeCoarse_Code
[] =
164 0x0007fff9, 0x0007fffa, 0x0007fffb, 0x000ffff8, 0x000ffff9, 0x000ffffa, 0x0001fffd, 0x00007ffe, 0x00000ffe, 0x000003fe,
165 0x000000fe, 0x0000003e, 0x0000000e, 0x00000002, 0000000000, 0x00000006, 0x0000001e, 0x0000007e, 0x000001fe, 0x000007fe,
166 0x00001ffe, 0x00003ffe, 0x0001fffc, 0x0007fff8, 0x000ffffb, 0x000ffffc, 0x000ffffd, 0x000ffffe, 0x000fffff
169 /* PS Stereo Huffmantable: iidDeltaTimeFine */
170 static const UINT iidDeltaTimeFine_Length
[] =
172 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
173 15, 15, 15, 15, 15, 14, 14, 13, 13, 13,
174 12, 12, 11, 10, 9, 9, 7, 6, 5, 3,
175 1, 2, 5, 6, 7, 8, 9, 10, 11, 11,
176 12, 12, 13, 13, 14, 14, 15, 15, 15, 15,
177 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
180 static const UINT iidDeltaTimeFine_Code
[] =
182 0x00004ed4, 0x00004ed5, 0x00004ece, 0x00004ecf, 0x00004ecc, 0x00004ed6, 0x00004ed8, 0x00004f46, 0x00004f60, 0x00002718,
183 0x00002719, 0x00002764, 0x00002765, 0x0000276d, 0x000027b1, 0x000013b7, 0x000013d6, 0x000009c7, 0x000009e9, 0x000009ed,
184 0x000004ee, 0x000004f7, 0x00000278, 0x00000139, 0x0000009a, 0x0000009f, 0x00000020, 0x00000011, 0x0000000a, 0x00000003,
185 0x00000001, 0000000000, 0x0000000b, 0x00000012, 0x00000021, 0x0000004c, 0x0000009b, 0x0000013a, 0x00000279, 0x00000270,
186 0x000004ef, 0x000004e2, 0x000009ea, 0x000009d8, 0x000013d7, 0x000013d0, 0x000027b2, 0x000027a2, 0x0000271a, 0x0000271b,
187 0x00004f66, 0x00004f67, 0x00004f61, 0x00004f47, 0x00004ed9, 0x00004ed7, 0x00004ecd, 0x00004ed2, 0x00004ed3, 0x00004ed0,
191 static const INT iccDelta_Offset
= 7;
192 static const INT iccDelta_MaxVal
= 14;
193 /* PS Stereo Huffmantable: iccDeltaFreq */
194 static const UINT iccDeltaFreq_Length
[] =
196 14, 14, 12, 10, 7, 5, 3, 1, 2, 4,
199 static const UINT iccDeltaFreq_Code
[] =
201 0x00003fff, 0x00003ffe, 0x00000ffe, 0x000003fe, 0x0000007e, 0x0000001e, 0x00000006, 0000000000, 0x00000002, 0x0000000e,
202 0x0000003e, 0x000000fe, 0x000001fe, 0x000007fe, 0x00001ffe
205 /* PS Stereo Huffmantable: iccDeltaTime */
206 static const UINT iccDeltaTime_Length
[] =
208 14, 13, 11, 9, 7, 5, 3, 1, 2, 4,
211 static const UINT iccDeltaTime_Code
[] =
213 0x00003ffe, 0x00001ffe, 0x000007fe, 0x000001fe, 0x0000007e, 0x0000001e, 0x00000006, 0000000000, 0x00000002, 0x0000000e,
214 0x0000003e, 0x000000fe, 0x000003fe, 0x00000ffe, 0x00003fff
219 static const INT ipdDelta_Offset
= 0;
220 static const INT ipdDelta_MaxVal
= 7;
221 /* PS Stereo Huffmantable: ipdDeltaFreq */
222 static const UINT ipdDeltaFreq_Length
[] =
224 1, 3, 4, 4, 4, 4, 4, 4
226 static const UINT ipdDeltaFreq_Code
[] =
228 0x00000001, 0000000000, 0x00000006, 0x00000004, 0x00000002, 0x00000003, 0x00000005, 0x00000007
231 /* PS Stereo Huffmantable: ipdDeltaTime */
232 static const UINT ipdDeltaTime_Length
[] =
234 1, 3, 4, 5, 5, 4, 4, 3
236 static const UINT ipdDeltaTime_Code
[] =
238 0x00000001, 0x00000002, 0x00000002, 0x00000003, 0x00000002, 0000000000, 0x00000003, 0x00000003
242 static const INT opdDelta_Offset
= 0;
243 static const INT opdDelta_MaxVal
= 7;
244 /* PS Stereo Huffmantable: opdDeltaFreq */
245 static const UINT opdDeltaFreq_Length
[] =
247 1, 3, 4, 4, 5, 5, 4, 3
249 static const UINT opdDeltaFreq_Code
[] =
251 0x00000001, 0x00000001, 0x00000006, 0x00000004, 0x0000000f, 0x0000000e, 0x00000005, 0000000000,
254 /* PS Stereo Huffmantable: opdDeltaTime */
255 static const UINT opdDeltaTime_Length
[] =
257 1, 3, 4, 5, 5, 4, 4, 3
259 static const UINT opdDeltaTime_Code
[] =
261 0x00000001, 0x00000002, 0x00000001, 0x00000007, 0x00000006, 0000000000, 0x00000002, 0x00000003
264 static const INT psBands
[] =
270 static INT
getNoBands(UINT mode
)
278 return psBands
[mode
];
281 static INT
getIIDRes(INT iidMode
)
284 return PS_IID_RES_COARSE
;
286 return PS_IID_RES_FINE
;
290 encodeDeltaFreq(HANDLE_FDK_BITSTREAM hBitBuf
,
293 const UINT
*codeTable
,
294 const UINT
*lengthTable
,
295 const INT tableOffset
,
303 for(band
=0;band
<nBands
;band
++) {
304 INT delta
= (val
[band
] - lastVal
) + tableOffset
;
306 if( (delta
>maxVal
) || (delta
<0) ) {
308 delta
= delta
>0?maxVal
:0;
310 bitCnt
+= FDKsbrEnc_WriteBits_ps(hBitBuf
, codeTable
[delta
], lengthTable
[delta
]);
317 encodeDeltaTime(HANDLE_FDK_BITSTREAM hBitBuf
,
321 const UINT
*codeTable
,
322 const UINT
*lengthTable
,
323 const INT tableOffset
,
330 for(band
=0;band
<nBands
;band
++) {
331 INT delta
= (val
[band
] - valLast
[band
]) + tableOffset
;
332 if( (delta
>maxVal
) || (delta
<0) ) {
334 delta
= delta
>0?maxVal
:0;
336 bitCnt
+= FDKsbrEnc_WriteBits_ps(hBitBuf
, codeTable
[delta
], lengthTable
[delta
]);
342 INT
FDKsbrEnc_EncodeIid(HANDLE_FDK_BITSTREAM hBitBuf
,
344 const INT
*iidValLast
,
346 const PS_IID_RESOLUTION res
,
350 const UINT
*codeTable
;
351 const UINT
*lengthTable
;
359 case PS_IID_RES_COARSE
:
360 codeTable
= iidDeltaFreqCoarse_Code
;
361 lengthTable
= iidDeltaFreqCoarse_Length
;
362 bitCnt
+= encodeDeltaFreq(hBitBuf
, iidVal
, nBands
, codeTable
,
363 lengthTable
, iidDeltaCoarse_Offset
,
364 iidDeltaCoarse_MaxVal
, error
);
366 case PS_IID_RES_FINE
:
367 codeTable
= iidDeltaFreqFine_Code
;
368 lengthTable
= iidDeltaFreqFine_Length
;
369 bitCnt
+= encodeDeltaFreq(hBitBuf
, iidVal
, nBands
, codeTable
,
370 lengthTable
, iidDeltaFine_Offset
,
371 iidDeltaFine_MaxVal
, error
);
380 case PS_IID_RES_COARSE
:
381 codeTable
= iidDeltaTimeCoarse_Code
;
382 lengthTable
= iidDeltaTimeCoarse_Length
;
383 bitCnt
+= encodeDeltaTime(hBitBuf
, iidVal
, iidValLast
, nBands
, codeTable
,
384 lengthTable
, iidDeltaCoarse_Offset
,
385 iidDeltaCoarse_MaxVal
, error
);
387 case PS_IID_RES_FINE
:
388 codeTable
= iidDeltaTimeFine_Code
;
389 lengthTable
= iidDeltaTimeFine_Length
;
390 bitCnt
+= encodeDeltaTime(hBitBuf
, iidVal
, iidValLast
, nBands
, codeTable
,
391 lengthTable
, iidDeltaFine_Offset
,
392 iidDeltaFine_MaxVal
, error
);
407 INT
FDKsbrEnc_EncodeIcc(HANDLE_FDK_BITSTREAM hBitBuf
,
409 const INT
*iccValLast
,
414 const UINT
*codeTable
;
415 const UINT
*lengthTable
;
420 codeTable
= iccDeltaFreq_Code
;
421 lengthTable
= iccDeltaFreq_Length
;
422 bitCnt
+= encodeDeltaFreq(hBitBuf
, iccVal
, nBands
, codeTable
,
423 lengthTable
, iccDelta_Offset
, iccDelta_MaxVal
, error
);
427 codeTable
= iccDeltaTime_Code
;
428 lengthTable
= iccDeltaTime_Length
;
430 bitCnt
+= encodeDeltaTime(hBitBuf
, iccVal
, iccValLast
, nBands
, codeTable
,
431 lengthTable
, iccDelta_Offset
, iccDelta_MaxVal
, error
);
441 INT
FDKsbrEnc_EncodeIpd(HANDLE_FDK_BITSTREAM hBitBuf
,
443 const INT
*ipdValLast
,
448 const UINT
*codeTable
;
449 const UINT
*lengthTable
;
454 codeTable
= ipdDeltaFreq_Code
;
455 lengthTable
= ipdDeltaFreq_Length
;
456 bitCnt
+= encodeDeltaFreq(hBitBuf
, ipdVal
, nBands
, codeTable
,
457 lengthTable
, ipdDelta_Offset
, ipdDelta_MaxVal
, error
);
461 codeTable
= ipdDeltaTime_Code
;
462 lengthTable
= ipdDeltaTime_Length
;
464 bitCnt
+= encodeDeltaTime(hBitBuf
, ipdVal
, ipdValLast
, nBands
, codeTable
,
465 lengthTable
, ipdDelta_Offset
, ipdDelta_MaxVal
, error
);
475 INT
FDKsbrEnc_EncodeOpd(HANDLE_FDK_BITSTREAM hBitBuf
,
477 const INT
*opdValLast
,
482 const UINT
*codeTable
;
483 const UINT
*lengthTable
;
488 codeTable
= opdDeltaFreq_Code
;
489 lengthTable
= opdDeltaFreq_Length
;
490 bitCnt
+= encodeDeltaFreq(hBitBuf
, opdVal
, nBands
, codeTable
,
491 lengthTable
, opdDelta_Offset
, opdDelta_MaxVal
, error
);
495 codeTable
= opdDeltaTime_Code
;
496 lengthTable
= opdDeltaTime_Length
;
498 bitCnt
+= encodeDeltaTime(hBitBuf
, opdVal
, opdValLast
, nBands
, codeTable
,
499 lengthTable
, opdDelta_Offset
, opdDelta_MaxVal
, error
);
509 static INT
encodeIpdOpd(HANDLE_PS_OUT psOut
,
510 HANDLE_FDK_BITSTREAM hBitBuf
)
516 FDKsbrEnc_WriteBits_ps(hBitBuf
, psOut
->enableIpdOpd
, 1);
518 if(psOut
->enableIpdOpd
==1) {
519 INT
*ipdLast
= psOut
->ipdLast
;
520 INT
*opdLast
= psOut
->opdLast
;
522 for(env
=0; env
<psOut
->nEnvelopes
; env
++) {
523 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->deltaIPD
[env
], 1);
524 bitCnt
+= FDKsbrEnc_EncodeIpd( hBitBuf
,
527 getNoBands((UINT
)psOut
->iidMode
),
528 psOut
->deltaIPD
[env
],
531 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->deltaOPD
[env
], 1);
532 bitCnt
+= FDKsbrEnc_EncodeOpd( hBitBuf
,
535 getNoBands((UINT
)psOut
->iidMode
),
536 psOut
->deltaOPD
[env
],
540 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, 0, 1);
547 static INT
getEnvIdx(const INT nEnvelopes
, const INT frameClass
)
579 /* unsupported number of envelopes */
587 static INT
encodePSExtension(const HANDLE_PS_OUT psOut
,
588 HANDLE_FDK_BITSTREAM hBitBuf
)
592 if(psOut
->enableIpdOpd
==1) {
594 INT extSize
= (2 + encodeIpdOpd(psOut
,NULL
)+7)>>3;
597 bitCnt
+= FDKsbrEnc_WriteBits_ps(hBitBuf
, extSize
, 4);
600 bitCnt
+= FDKsbrEnc_WriteBits_ps(hBitBuf
, 15 , 4);
601 bitCnt
+= FDKsbrEnc_WriteBits_ps(hBitBuf
, (extSize
-15), 8);
604 /* write ipd opd data */
605 ipdOpdBits
+= FDKsbrEnc_WriteBits_ps(hBitBuf
, PS_EXT_ID_V0
, 2);
606 ipdOpdBits
+= encodeIpdOpd(psOut
, hBitBuf
);
608 /* byte align the ipd opd data */
610 ipdOpdBits
+= FDKsbrEnc_WriteBits_ps(hBitBuf
, 0, (8-(ipdOpdBits
%8)) );
612 bitCnt
+= ipdOpdBits
;
618 INT
FDKsbrEnc_WritePSBitstream(const HANDLE_PS_OUT psOut
,
619 HANDLE_FDK_BITSTREAM hBitBuf
)
629 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->enablePSHeader
, 1);
631 if(psOut
->enablePSHeader
) {
633 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->enableIID
, 1);
634 if(psOut
->enableIID
) {
635 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->iidMode
, 3);
637 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->enableICC
, 1);
638 if(psOut
->enableICC
) {
639 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->iccMode
, 3);
641 if(psOut
->enableIpdOpd
) {
644 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psExtEnable
, 1);
647 /* Frame class, number of envelopes */
648 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->frameClass
, 1);
649 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, getEnvIdx(psOut
->nEnvelopes
, psOut
->frameClass
), 2);
651 if(psOut
->frameClass
==1) {
652 for(env
=0; env
<psOut
->nEnvelopes
; env
++) {
653 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->frameBorder
[env
], 5);
657 if(psOut
->enableIID
==1) {
658 INT
*iidLast
= psOut
->iidLast
;
659 for(env
=0; env
<psOut
->nEnvelopes
; env
++) {
660 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->deltaIID
[env
], 1);
661 bitCnt
+= FDKsbrEnc_EncodeIid( hBitBuf
,
664 getNoBands((UINT
)psOut
->iidMode
),
665 (PS_IID_RESOLUTION
)getIIDRes(psOut
->iidMode
),
666 psOut
->deltaIID
[env
],
669 iidLast
= psOut
->iid
[env
];
673 if(psOut
->enableICC
==1) {
674 INT
*iccLast
= psOut
->iccLast
;
675 for(env
=0; env
<psOut
->nEnvelopes
; env
++) {
676 bitCnt
+= FDKsbrEnc_WriteBits_ps( hBitBuf
, psOut
->deltaICC
[env
], 1);
677 bitCnt
+= FDKsbrEnc_EncodeIcc( hBitBuf
,
680 getNoBands((UINT
)psOut
->iccMode
),
681 psOut
->deltaICC
[env
],
684 iccLast
= psOut
->icc
[env
];
689 bitCnt
+= encodePSExtension(psOut
, hBitBuf
);
692 } /* if(psOut != NULL) */