media/libtremor/lib/backends.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libtremor/lib/backends.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,131 @@
     1.4 +/********************************************************************
     1.5 + *                                                                  *
     1.6 + * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
     1.7 + *                                                                  *
     1.8 + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
     1.9 + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
    1.10 + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
    1.11 + *                                                                  *
    1.12 + * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
    1.13 + * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
    1.14 + *                                                                  *
    1.15 + ********************************************************************
    1.16 +
    1.17 + function: backend and mapping structures
    1.18 +
    1.19 + ********************************************************************/
    1.20 +
    1.21 +/* this is exposed up here because we need it for static modes.
    1.22 +   Lookups for each backend aren't exposed because there's no reason
    1.23 +   to do so */
    1.24 +
    1.25 +#ifndef _vorbis_backend_h_
    1.26 +#define _vorbis_backend_h_
    1.27 +
    1.28 +#include "codec_internal.h"
    1.29 +
    1.30 +/* this would all be simpler/shorter with templates, but.... */
    1.31 +/* Transform backend generic *************************************/
    1.32 +
    1.33 +/* only mdct right now.  Flesh it out more if we ever transcend mdct
    1.34 +   in the transform domain */
    1.35 +
    1.36 +/* Floor backend generic *****************************************/
    1.37 +typedef struct{
    1.38 +  vorbis_info_floor     *(*unpack)(vorbis_info *,oggpack_buffer *);
    1.39 +  vorbis_look_floor     *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
    1.40 +				   vorbis_info_floor *);
    1.41 +  void (*free_info) (vorbis_info_floor *);
    1.42 +  void (*free_look) (vorbis_look_floor *);
    1.43 +  void *(*inverse1)  (struct vorbis_block *,vorbis_look_floor *);
    1.44 +  int   (*inverse2)  (struct vorbis_block *,vorbis_look_floor *,
    1.45 +		     void *buffer,ogg_int32_t *);
    1.46 +} vorbis_func_floor;
    1.47 +
    1.48 +typedef struct{
    1.49 +  int   order;
    1.50 +  long  rate;
    1.51 +  long  barkmap;
    1.52 +
    1.53 +  int   ampbits;
    1.54 +  int   ampdB;
    1.55 +
    1.56 +  int   numbooks; /* <= 16 */
    1.57 +  int   books[16];
    1.58 +
    1.59 +} vorbis_info_floor0;
    1.60 +
    1.61 +#define VIF_POSIT 63
    1.62 +#define VIF_CLASS 16
    1.63 +#define VIF_PARTS 31
    1.64 +typedef struct{
    1.65 +  int   partitions;                /* 0 to 31 */
    1.66 +  int   partitionclass[VIF_PARTS]; /* 0 to 15 */
    1.67 +
    1.68 +  int   class_dim[VIF_CLASS];        /* 1 to 8 */
    1.69 +  int   class_subs[VIF_CLASS];       /* 0,1,2,3 (bits: 1<<n poss) */
    1.70 +  int   class_book[VIF_CLASS];       /* subs ^ dim entries */
    1.71 +  int   class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
    1.72 +
    1.73 +
    1.74 +  int   mult;                      /* 1 2 3 or 4 */ 
    1.75 +  int   postlist[VIF_POSIT+2];    /* first two implicit */ 
    1.76 +
    1.77 +} vorbis_info_floor1;
    1.78 +
    1.79 +/* Residue backend generic *****************************************/
    1.80 +typedef struct{
    1.81 +  vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
    1.82 +  vorbis_look_residue *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
    1.83 +				 vorbis_info_residue *);
    1.84 +  void (*free_info)    (vorbis_info_residue *);
    1.85 +  void (*free_look)    (vorbis_look_residue *);
    1.86 +  int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
    1.87 +			ogg_int32_t **,int *,int);
    1.88 +} vorbis_func_residue;
    1.89 +
    1.90 +typedef struct vorbis_info_residue0{
    1.91 +/* block-partitioned VQ coded straight residue */
    1.92 +  long  begin;
    1.93 +  long  end;
    1.94 +
    1.95 +  /* first stage (lossless partitioning) */
    1.96 +  int    grouping;         /* group n vectors per partition */
    1.97 +  int    partitions;       /* possible codebooks for a partition */
    1.98 +  int    partvals;         /* partitions ^ groupbook dim */
    1.99 +  int    groupbook;        /* huffbook for partitioning */
   1.100 +  int    secondstages[64]; /* expanded out to pointers in lookup */
   1.101 +  int    booklist[512];    /* list of second stage books */
   1.102 +} vorbis_info_residue0;
   1.103 +
   1.104 +/* Mapping backend generic *****************************************/
   1.105 +typedef struct{
   1.106 +  vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
   1.107 +  vorbis_look_mapping *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
   1.108 +				 vorbis_info_mapping *);
   1.109 +  void (*free_info)    (vorbis_info_mapping *);
   1.110 +  void (*free_look)    (vorbis_look_mapping *);
   1.111 +  int  (*inverse)      (struct vorbis_block *vb,vorbis_look_mapping *);
   1.112 +} vorbis_func_mapping;
   1.113 +
   1.114 +typedef struct vorbis_info_mapping0{
   1.115 +  int   submaps;  /* <= 16 */
   1.116 +  int   chmuxlist[256];   /* up to 256 channels in a Vorbis stream */
   1.117 +  
   1.118 +  int   floorsubmap[16];   /* [mux] submap to floors */
   1.119 +  int   residuesubmap[16]; /* [mux] submap to residue */
   1.120 +
   1.121 +  int   psy[2]; /* by blocktype; impulse/padding for short,
   1.122 +                   transition/normal for long */
   1.123 +
   1.124 +  int   coupling_steps;
   1.125 +  int   coupling_mag[256];
   1.126 +  int   coupling_ang[256];
   1.127 +} vorbis_info_mapping0;
   1.128 +
   1.129 +#endif
   1.130 +
   1.131 +
   1.132 +
   1.133 +
   1.134 +

mercurial