examples/sfexamples/oggvorbiscodec/src/tremor/backends.h

00001 /********************************************************************
00002  *                                                                  *
00003  * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
00004  *                                                                  *
00005  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
00006  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
00007  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
00008  *                                                                  *
00009  * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
00010  * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
00011  *                                                                  *
00012  ********************************************************************
00013 
00014  function: backend and mapping structures
00015 
00016  ********************************************************************/
00017 
00018 /* this is exposed up here because we need it for static modes.
00019    Lookups for each backend aren't exposed because there's no reason
00020    to do so */
00021 
00022 #ifndef _vorbis_backend_h_
00023 #define _vorbis_backend_h_
00024 
00025 #include "codec_internal.h"
00026 
00027 /* this would all be simpler/shorter with templates, but.... */
00028 /* Transform backend generic *************************************/
00029 
00030 /* only mdct right now.  Flesh it out more if we ever transcend mdct
00031    in the transform domain */
00032 
00033 /* Floor backend generic *****************************************/
00034 typedef struct{
00035   vorbis_info_floor     *(*unpack)(vorbis_info *,oggpack_buffer *);
00036   vorbis_look_floor     *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
00037                                    vorbis_info_floor *);
00038   void (*free_info) (vorbis_info_floor *);
00039   void (*free_look) (vorbis_look_floor *);
00040   void *(*inverse1)  (struct vorbis_block *,vorbis_look_floor *);
00041   int   (*inverse2)  (struct vorbis_block *,vorbis_look_floor *,
00042                      void *buffer,ogg_int32_t *);
00043 } vorbis_func_floor;
00044 
00045 typedef struct{
00046   int   order;
00047   long  rate;
00048   long  barkmap;
00049 
00050   int   ampbits;
00051   int   ampdB;
00052 
00053   int   numbooks; /* <= 16 */
00054   int   books[16];
00055 
00056 } vorbis_info_floor0;
00057 
00058 #define VIF_POSIT 63
00059 #define VIF_CLASS 16
00060 #define VIF_PARTS 31
00061 typedef struct{
00062   int   partitions;                /* 0 to 31 */
00063   int   partitionclass[VIF_PARTS]; /* 0 to 15 */
00064 
00065   int   class_dim[VIF_CLASS];        /* 1 to 8 */
00066   int   class_subs[VIF_CLASS];       /* 0,1,2,3 (bits: 1<<n poss) */
00067   int   class_book[VIF_CLASS];       /* subs ^ dim entries */
00068   int   class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
00069 
00070 
00071   int   mult;                      /* 1 2 3 or 4 */ 
00072   int   postlist[VIF_POSIT+2];    /* first two implicit */ 
00073 
00074 } vorbis_info_floor1;
00075 
00076 /* Residue backend generic *****************************************/
00077 typedef struct{
00078   vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
00079   vorbis_look_residue *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
00080                                  vorbis_info_residue *);
00081   void (*free_info)    (vorbis_info_residue *);
00082   void (*free_look)    (vorbis_look_residue *);
00083   int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
00084                         ogg_int32_t **,int *,int);
00085 } vorbis_func_residue;
00086 
00087 typedef struct vorbis_info_residue0{
00088 /* block-partitioned VQ coded straight residue */
00089   long  begin;
00090   long  end;
00091 
00092   /* first stage (lossless partitioning) */
00093   int    grouping;         /* group n vectors per partition */
00094   int    partitions;       /* possible codebooks for a partition */
00095   int    groupbook;        /* huffbook for partitioning */
00096   int    secondstages[64]; /* expanded out to pointers in lookup */
00097   int    booklist[256];    /* list of second stage books */
00098 } vorbis_info_residue0;
00099 
00100 /* Mapping backend generic *****************************************/
00101 typedef struct{
00102   vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
00103   vorbis_look_mapping *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
00104                                  vorbis_info_mapping *);
00105   void (*free_info)    (vorbis_info_mapping *);
00106   void (*free_look)    (vorbis_look_mapping *);
00107   int  (*inverse)      (struct vorbis_block *vb,vorbis_look_mapping *);
00108 } vorbis_func_mapping;
00109 
00110 typedef struct vorbis_info_mapping0{
00111   int   submaps;  /* <= 16 */
00112   int   chmuxlist[256];   /* up to 256 channels in a Vorbis stream */
00113   
00114   int   floorsubmap[16];   /* [mux] submap to floors */
00115   int   residuesubmap[16]; /* [mux] submap to residue */
00116 
00117   int   psy[2]; /* by blocktype; impulse/padding for short,
00118                    transition/normal for long */
00119 
00120   int   coupling_steps;
00121   int   coupling_mag[256];
00122   int   coupling_ang[256];
00123 } vorbis_info_mapping0;
00124 
00125 #endif
00126 
00127 
00128 
00129 
00130 

Generated by  doxygen 1.6.2