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