cannam@86: /******************************************************************** cannam@86: * * cannam@86: * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * cannam@86: * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * cannam@86: * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * cannam@86: * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * cannam@86: * * cannam@86: * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * cannam@86: * by the Xiph.Org Foundation http://www.xiph.org/ * cannam@86: * * cannam@86: ******************************************************************** cannam@86: cannam@86: function: libvorbis codec headers cannam@86: last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $ cannam@86: cannam@86: ********************************************************************/ cannam@86: cannam@86: #ifndef _V_CODECI_H_ cannam@86: #define _V_CODECI_H_ cannam@86: cannam@86: #include "envelope.h" cannam@86: #include "codebook.h" cannam@86: cannam@86: #define BLOCKTYPE_IMPULSE 0 cannam@86: #define BLOCKTYPE_PADDING 1 cannam@86: #define BLOCKTYPE_TRANSITION 0 cannam@86: #define BLOCKTYPE_LONG 1 cannam@86: cannam@86: #define PACKETBLOBS 15 cannam@86: cannam@86: typedef struct vorbis_block_internal{ cannam@86: float **pcmdelay; /* this is a pointer into local storage */ cannam@86: float ampmax; cannam@86: int blocktype; cannam@86: cannam@86: oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed; cannam@86: blob [PACKETBLOBS/2] points to cannam@86: the oggpack_buffer in the cannam@86: main vorbis_block */ cannam@86: } vorbis_block_internal; cannam@86: cannam@86: typedef void vorbis_look_floor; cannam@86: typedef void vorbis_look_residue; cannam@86: typedef void vorbis_look_transform; cannam@86: cannam@86: /* mode ************************************************************/ cannam@86: typedef struct { cannam@86: int blockflag; cannam@86: int windowtype; cannam@86: int transformtype; cannam@86: int mapping; cannam@86: } vorbis_info_mode; cannam@86: cannam@86: typedef void vorbis_info_floor; cannam@86: typedef void vorbis_info_residue; cannam@86: typedef void vorbis_info_mapping; cannam@86: cannam@86: #include "psy.h" cannam@86: #include "bitrate.h" cannam@86: cannam@86: typedef struct private_state { cannam@86: /* local lookup storage */ cannam@86: envelope_lookup *ve; /* envelope lookup */ cannam@86: int window[2]; cannam@86: vorbis_look_transform **transform[2]; /* block, type */ cannam@86: drft_lookup fft_look[2]; cannam@86: cannam@86: int modebits; cannam@86: vorbis_look_floor **flr; cannam@86: vorbis_look_residue **residue; cannam@86: vorbis_look_psy *psy; cannam@86: vorbis_look_psy_global *psy_g_look; cannam@86: cannam@86: /* local storage, only used on the encoding side. This way the cannam@86: application does not need to worry about freeing some packets' cannam@86: memory and not others'; packet storage is always tracked. cannam@86: Cleared next call to a _dsp_ function */ cannam@86: unsigned char *header; cannam@86: unsigned char *header1; cannam@86: unsigned char *header2; cannam@86: cannam@86: bitrate_manager_state bms; cannam@86: cannam@86: ogg_int64_t sample_count; cannam@86: } private_state; cannam@86: cannam@86: /* codec_setup_info contains all the setup information specific to the cannam@86: specific compression/decompression mode in progress (eg, cannam@86: psychoacoustic settings, channel setup, options, codebook cannam@86: etc). cannam@86: *********************************************************************/ cannam@86: cannam@86: #include "highlevel.h" cannam@86: typedef struct codec_setup_info { cannam@86: cannam@86: /* Vorbis supports only short and long blocks, but allows the cannam@86: encoder to choose the sizes */ cannam@86: cannam@86: long blocksizes[2]; cannam@86: cannam@86: /* modes are the primary means of supporting on-the-fly different cannam@86: blocksizes, different channel mappings (LR or M/A), cannam@86: different residue backends, etc. Each mode consists of a cannam@86: blocksize flag and a mapping (along with the mapping setup */ cannam@86: cannam@86: int modes; cannam@86: int maps; cannam@86: int floors; cannam@86: int residues; cannam@86: int books; cannam@86: int psys; /* encode only */ cannam@86: cannam@86: vorbis_info_mode *mode_param[64]; cannam@86: int map_type[64]; cannam@86: vorbis_info_mapping *map_param[64]; cannam@86: int floor_type[64]; cannam@86: vorbis_info_floor *floor_param[64]; cannam@86: int residue_type[64]; cannam@86: vorbis_info_residue *residue_param[64]; cannam@86: static_codebook *book_param[256]; cannam@86: codebook *fullbooks; cannam@86: cannam@86: vorbis_info_psy *psy_param[4]; /* encode only */ cannam@86: vorbis_info_psy_global psy_g_param; cannam@86: cannam@86: bitrate_manager_info bi; cannam@86: highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a cannam@86: highly redundant structure, but cannam@86: improves clarity of program flow. */ cannam@86: int halfrate_flag; /* painless downsample for decode */ cannam@86: } codec_setup_info; cannam@86: cannam@86: extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi); cannam@86: extern void _vp_global_free(vorbis_look_psy_global *look); cannam@86: cannam@86: cannam@86: cannam@86: typedef struct { cannam@86: int sorted_index[VIF_POSIT+2]; cannam@86: int forward_index[VIF_POSIT+2]; cannam@86: int reverse_index[VIF_POSIT+2]; cannam@86: cannam@86: int hineighbor[VIF_POSIT]; cannam@86: int loneighbor[VIF_POSIT]; cannam@86: int posts; cannam@86: cannam@86: int n; cannam@86: int quant_q; cannam@86: vorbis_info_floor1 *vi; cannam@86: cannam@86: long phrasebits; cannam@86: long postbits; cannam@86: long frames; cannam@86: } vorbis_look_floor1; cannam@86: cannam@86: cannam@86: cannam@86: extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look, cannam@86: const float *logmdct, /* in */ cannam@86: const float *logmask); cannam@86: extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look, cannam@86: int *A,int *B, cannam@86: int del); cannam@86: extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, cannam@86: vorbis_look_floor1 *look, cannam@86: int *post,int *ilogmask); cannam@86: #endif