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