added pdf2pdf tool
[swftools.git] / lib / bladeenc / formatbitstream2.h
1 /*
2                         (c) Copyright 1998-2000 - Tord Jansson
3                         ======================================
4
5                 This file is part of the BladeEnc MP3 Encoder, based on
6                 ISO's reference code for MPEG Layer 3 compression, and might
7                 contain smaller or larger sections that are directly taken
8                 from ISO's reference code.
9
10                 All changes to the ISO reference code herein are either
11                 copyrighted by Tord Jansson (tord.jansson@swipnet.se)
12                 or sublicensed to Tord Jansson by a third party.
13
14         BladeEnc is free software; you can redistribute this file
15         and/or modify it under the terms of the GNU Lesser General Public
16         License as published by the Free Software Foundation; either
17         version 2.1 of the License, or (at your option) any later version.
18
19
20
21         ------------    Changes    ------------
22
23         2000-12-15  Andre Piotrowski
24
25         -       reformatted
26 */
27
28 #ifndef         __FORMATBITSTREAM2__
29 #define         __FORMATBITSTREAM2__
30
31
32
33
34
35 #define         MAX_CHANNELS                    2
36 #define         MAX_GRANULES                    2
37
38
39
40
41
42
43 /*____ Structure Definitions ________________________________________________*/
44
45 typedef         struct
46                         {
47                                 unsigned int                    value;
48                                 int                                             length;
49                         }                                       BitHolderElement;
50
51
52 typedef         struct
53                         {
54                                 int                                             max_elements;
55                                 int                                             nrEntries;
56                                 BitHolderElement                *element;
57                         }                                       BitHolder;
58
59
60 typedef         struct BF_FrameData
61                         {
62                                 int                                             frameLength;
63                                 int                                             nGranules;
64                                 int                                             nChannels;
65                                 BitHolder                               header;
66                                 BitHolder                               frameSI;
67                                 BitHolder                                  channelSI[MAX_CHANNELS];
68                                 BitHolder                                 spectrumSI[MAX_GRANULES][MAX_CHANNELS];
69                                 BitHolder                               scaleFactors[MAX_GRANULES][MAX_CHANNELS];
70                                 BitHolder                                  codedData[MAX_GRANULES][MAX_CHANNELS];
71                                 BitHolder                               userSpectrum[MAX_GRANULES][MAX_CHANNELS];
72                                 BitHolder                               userFrameData;
73                         }                                       BF_FrameData;
74
75
76 typedef         struct BF_FrameResults
77                         {
78                                 int                                             SILength;
79                                 int                                             mainDataLength;
80                                 int                                             nextBackPtr;
81                         }                                       BF_FrameResults;
82
83
84
85
86
87 /*____ Function Prototypes __________________________________________________*/
88
89 BitHolder                               *initBitHolder (BitHolder *wp, int elements);
90 void                                    exitBitHolder (BitHolder *wp);
91 void                                    addBits (BitHolder *wp, unsigned int value, int length);
92 void                                    writeFrame (BF_FrameData *psFrame, BF_FrameResults *results);
93 void                                    initFormatBitstream (void);
94 void                                    exitFormatBitstream (void);
95 void                                    flushFrame (void);
96
97
98
99
100
101 #endif   /* __FORMATBITSTREAM2__ */