Path: blob/master/thirdparty/libvorbis/codec_internal.h
9903 views
/********************************************************************1* *2* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *3* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *4* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *5* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *6* *7* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *8* by the Xiph.Org Foundation https://xiph.org/ *9* *10********************************************************************1112function: libvorbis codec headers1314********************************************************************/1516#ifndef _V_CODECI_H_17#define _V_CODECI_H_1819#include "envelope.h"20#include "codebook.h"2122#define BLOCKTYPE_IMPULSE 023#define BLOCKTYPE_PADDING 124#define BLOCKTYPE_TRANSITION 025#define BLOCKTYPE_LONG 12627#define PACKETBLOBS 152829typedef struct vorbis_block_internal{30float **pcmdelay; /* this is a pointer into local storage */31float ampmax;32int blocktype;3334oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;35blob [PACKETBLOBS/2] points to36the oggpack_buffer in the37main vorbis_block */38} vorbis_block_internal;3940typedef void vorbis_look_floor;41typedef void vorbis_look_residue;42typedef void vorbis_look_transform;4344/* mode ************************************************************/45typedef struct {46int blockflag;47int windowtype;48int transformtype;49int mapping;50} vorbis_info_mode;5152typedef void vorbis_info_floor;53typedef void vorbis_info_residue;54typedef void vorbis_info_mapping;5556#include "psy.h"57#include "bitrate.h"5859typedef struct private_state {60/* local lookup storage */61envelope_lookup *ve; /* envelope lookup */62int window[2];63vorbis_look_transform **transform[2]; /* block, type */64drft_lookup fft_look[2];6566int modebits;67vorbis_look_floor **flr;68vorbis_look_residue **residue;69vorbis_look_psy *psy;70vorbis_look_psy_global *psy_g_look;7172/* local storage, only used on the encoding side. This way the73application does not need to worry about freeing some packets'74memory and not others'; packet storage is always tracked.75Cleared next call to a _dsp_ function */76unsigned char *header;77unsigned char *header1;78unsigned char *header2;7980bitrate_manager_state bms;8182ogg_int64_t sample_count;83} private_state;8485/* codec_setup_info contains all the setup information specific to the86specific compression/decompression mode in progress (eg,87psychoacoustic settings, channel setup, options, codebook88etc).89*********************************************************************/9091#include "highlevel.h"92typedef struct codec_setup_info {9394/* Vorbis supports only short and long blocks, but allows the95encoder to choose the sizes */9697long blocksizes[2];9899/* modes are the primary means of supporting on-the-fly different100blocksizes, different channel mappings (LR or M/A),101different residue backends, etc. Each mode consists of a102blocksize flag and a mapping (along with the mapping setup */103104int modes;105int maps;106int floors;107int residues;108int books;109int psys; /* encode only */110111vorbis_info_mode *mode_param[64];112int map_type[64];113vorbis_info_mapping *map_param[64];114int floor_type[64];115vorbis_info_floor *floor_param[64];116int residue_type[64];117vorbis_info_residue *residue_param[64];118static_codebook *book_param[256];119codebook *fullbooks;120121vorbis_info_psy *psy_param[4]; /* encode only */122vorbis_info_psy_global psy_g_param;123124bitrate_manager_info bi;125highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a126highly redundant structure, but127improves clarity of program flow. */128int halfrate_flag; /* painless downsample for decode */129} codec_setup_info;130131extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);132extern void _vp_global_free(vorbis_look_psy_global *look);133134135136typedef struct {137int sorted_index[VIF_POSIT+2];138int forward_index[VIF_POSIT+2];139int reverse_index[VIF_POSIT+2];140141int hineighbor[VIF_POSIT];142int loneighbor[VIF_POSIT];143int posts;144145int n;146int quant_q;147vorbis_info_floor1 *vi;148149long phrasebits;150long postbits;151long frames;152} vorbis_look_floor1;153154155156extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,157const float *logmdct, /* in */158const float *logmask);159extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,160int *A,int *B,161int del);162extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,163vorbis_look_floor1 *look,164int *post,int *ilogmask);165#endif166167168