openshot-audio  0.1.7
codec_internal.h
Go to the documentation of this file.
1 /********************************************************************
2  * *
3  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7  * *
8  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9  * by the Xiph.Org Foundation http://www.xiph.org/ *
10  * *
11  ********************************************************************
12 
13  function: libvorbis codec headers
14  last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
15 
16  ********************************************************************/
17 
18 #ifndef _V_CODECI_H_
19 #define _V_CODECI_H_
20 
21 #include "envelope.h"
22 #include "codebook.h"
23 
24 #define BLOCKTYPE_IMPULSE 0
25 #define BLOCKTYPE_PADDING 1
26 #define BLOCKTYPE_TRANSITION 0
27 #define BLOCKTYPE_LONG 1
28 
29 #define PACKETBLOBS 15
30 
31 typedef struct vorbis_block_internal{
32  float **pcmdelay; /* this is a pointer into local storage */
33  float ampmax;
34  int blocktype;
35 
36  oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
37  blob [PACKETBLOBS/2] points to
38  the oggpack_buffer in the
39  main vorbis_block */
41 
42 typedef void vorbis_look_floor;
43 typedef void vorbis_look_residue;
44 typedef void vorbis_look_transform;
45 
46 /* mode ************************************************************/
47 typedef struct {
48  int blockflag;
51  int mapping;
53 
54 typedef void vorbis_info_floor;
55 typedef void vorbis_info_residue;
56 typedef void vorbis_info_mapping;
57 
58 #include "psy.h"
59 #include "bitrate.h"
60 
61 static int ilog(unsigned int v){
62  int ret=0;
63  while(v){
64  ret++;
65  v>>=1;
66  }
67  return(ret);
68 }
69 
70 static int ilog2(unsigned int v){
71  int ret=0;
72  if(v)--v;
73  while(v){
74  ret++;
75  v>>=1;
76  }
77  return(ret);
78 }
79 
80 
81 typedef struct private_state {
82  /* local lookup storage */
83  envelope_lookup *ve; /* envelope lookup */
84  int window[2];
85  vorbis_look_transform **transform[2]; /* block, type */
87 
88  int modebits;
93 
94  /* local storage, only used on the encoding side. This way the
95  application does not need to worry about freeing some packets'
96  memory and not others'; packet storage is always tracked.
97  Cleared next call to a _dsp_ function */
98  unsigned char *header;
99  unsigned char *header1;
100  unsigned char *header2;
101 
103 
105 } private_state;
106 
107 /* codec_setup_info contains all the setup information specific to the
108  specific compression/decompression mode in progress (eg,
109  psychoacoustic settings, channel setup, options, codebook
110  etc).
111 *********************************************************************/
112 
113 #include "highlevel.h"
114 typedef struct codec_setup_info {
115 
116  /* Vorbis supports only short and long blocks, but allows the
117  encoder to choose the sizes */
118 
119  long blocksizes[2];
120 
121  /* modes are the primary means of supporting on-the-fly different
122  blocksizes, different channel mappings (LR or M/A),
123  different residue backends, etc. Each mode consists of a
124  blocksize flag and a mapping (along with the mapping setup */
125 
126  int modes;
127  int maps;
128  int floors;
129  int residues;
130  int books;
131  int psys; /* encode only */
132 
134  int map_type[64];
136  int floor_type[64];
138  int residue_type[64];
142 
143  vorbis_info_psy *psy_param[4]; /* encode only */
145 
147  highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
148  highly redundant structure, but
149  improves clarity of program flow. */
150  int halfrate_flag; /* painless downsample for decode */
152 
154 extern void _vp_global_free(vorbis_look_psy_global *look);
155 
156 
157 
158 typedef struct {
159  int sorted_index[VIF_POSIT+2];
160  int forward_index[VIF_POSIT+2];
161  int reverse_index[VIF_POSIT+2];
162 
163  int hineighbor[VIF_POSIT];
164  int loneighbor[VIF_POSIT];
165  int posts;
166 
167  int n;
168  int quant_q;
170 
172  long postbits;
173  long frames;
175 
176 
177 
178 extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
179  const float *logmdct, /* in */
180  const float *logmask);
182  int *A,int *B,
183  int del);
184 extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
185  vorbis_look_floor1 *look,
186  int *post,int *ilogmask);
187 #endif
Definition: codec_internal.h:47
int blockflag
Definition: codec_internal.h:48
Definition: bitrate.h:26
#define VIF_POSIT
Definition: backends.h:58
vorbis_info_residue * residue_param[64]
Definition: codec_internal.h:139
#define PACKETBLOBS
Definition: codec_internal.h:29
Definition: psy.h:36
vorbis_look_psy_global * psy_g_look
Definition: codec_internal.h:92
int64_t ogg_int64_t
Definition: config_types.h:8
Definition: codec_internal.h:158
Definition: codebook.h:36
vorbis_info_floor * floor_param[64]
Definition: codec_internal.h:137
static_codebook * book_param[256]
Definition: codec_internal.h:140
void vorbis_info_floor
Definition: codec_internal.h:54
unsigned char * header
Definition: codec_internal.h:98
int books
Definition: codec_internal.h:130
int modebits
Definition: codec_internal.h:88
int transformtype
Definition: codec_internal.h:50
int window[2]
Definition: codec_internal.h:84
Definition: highlevel.h:25
vorbis_look_psy * psy
Definition: codec_internal.h:91
Definition: juce_ApplicationCommandID.h:65
Definition: psy.h:95
ogg_int64_t sample_count
Definition: codec_internal.h:104
Definition: psy.h:86
drft_lookup fft_look[2]
Definition: codec_internal.h:86
float ampmax
Definition: codec_internal.h:33
struct codec_setup_info codec_setup_info
long postbits
Definition: codec_internal.h:172
vorbis_info_mode * mode_param[64]
Definition: codec_internal.h:133
vorbis_look_psy_global * _vp_global_look(vorbis_info *vi)
Definition: psy.c:36
vorbis_look_floor ** flr
Definition: codec_internal.h:89
void vorbis_look_residue
Definition: codec_internal.h:43
Definition: backends.h:61
vorbis_look_transform ** transform[2]
Definition: codec_internal.h:85
int quant_q
Definition: codec_internal.h:168
vorbis_info_psy_global psy_g_param
Definition: codec_internal.h:144
int blocktype
Definition: codec_internal.h:34
unsigned char * header2
Definition: codec_internal.h:100
int residue_type[64]
Definition: codec_internal.h:138
bitrate_manager_state bms
Definition: codec_internal.h:102
void vorbis_look_floor
Definition: codec_internal.h:42
highlevel_encode_setup hi
Definition: codec_internal.h:147
int psys
Definition: codec_internal.h:131
struct vorbis_block_internal vorbis_block_internal
long blocksizes[2]
Definition: codec_internal.h:119
Definition: bitrate.h:42
int windowtype
Definition: codec_internal.h:49
oggpack_buffer * packetblob[PACKETBLOBS]
Definition: codec_internal.h:36
int modes
Definition: codec_internal.h:126
int map_type[64]
Definition: codec_internal.h:134
Definition: codec_internal.h:31
Definition: codebook.h:58
int maps
Definition: codec_internal.h:127
Definition: ogg.h:26
Definition: psy.h:66
Definition: codec.h:88
Definition: envelope.h:52
int posts
Definition: codec_internal.h:165
int halfrate_flag
Definition: codec_internal.h:150
int * floor1_interpolate_fit(vorbis_block *vb, vorbis_look_floor1 *look, int *A, int *B, int del)
Definition: floor1.c:727
vorbis_look_residue ** residue
Definition: codec_internal.h:90
envelope_lookup * ve
Definition: codec_internal.h:83
float ** pcmdelay
Definition: codec_internal.h:32
void vorbis_info_residue
Definition: codec_internal.h:55
Definition: codec_internal.h:114
void vorbis_look_transform
Definition: codec_internal.h:44
codebook * fullbooks
Definition: codec_internal.h:141
int floor_type[64]
Definition: codec_internal.h:136
vorbis_info_psy * psy_param[4]
Definition: codec_internal.h:143
void vorbis_info_mapping
Definition: codec_internal.h:56
unsigned char * header1
Definition: codec_internal.h:99
void _vp_global_free(vorbis_look_psy_global *look)
Definition: psy.c:48
Definition: smallft.h:23
Definition: codec_internal.h:81
struct private_state private_state
int mapping
Definition: codec_internal.h:51
int * floor1_fit(vorbis_block *vb, vorbis_look_floor1 *look, const float *logmdct, const float *logmask)
Definition: floor1.c:572
long phrasebits
Definition: codec_internal.h:171
long frames
Definition: codec_internal.h:173
bitrate_manager_info bi
Definition: codec_internal.h:146
int residues
Definition: codec_internal.h:129
Definition: codec.h:28
int floors
Definition: codec_internal.h:128
int n
Definition: codec_internal.h:167
int floor1_encode(oggpack_buffer *opb, vorbis_block *vb, vorbis_look_floor1 *look, int *post, int *ilogmask)
Definition: floor1.c:749
vorbis_info_floor1 * vi
Definition: codec_internal.h:169
vorbis_info_mapping * map_param[64]
Definition: codec_internal.h:135