Blame lib/codec_internal.h

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