misc/libtremor/tremor/backends.h
author koda
Fri, 09 Nov 2012 23:11:53 +0100
branchwebgl
changeset 8006 7ca007615b88
parent 7859 519d5bc91dd3
permissions -rw-r--r--
no globs, sources not yet generated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7859
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     1
/********************************************************************
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     2
 *                                                                  *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     3
 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     4
 *                                                                  *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     5
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     6
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     7
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     8
 *                                                                  *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     9
 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    10
 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    11
 *                                                                  *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    12
 ********************************************************************
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    13
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    14
 function: backend and mapping structures
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    15
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    16
 ********************************************************************/
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    17
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    18
/* this is exposed up here because we need it for static modes.
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    19
   Lookups for each backend aren't exposed because there's no reason
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    20
   to do so */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    21
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    22
#ifndef _vorbis_backend_h_
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    23
#define _vorbis_backend_h_
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    24
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    25
#include "codec_internal.h"
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    26
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    27
/* this would all be simpler/shorter with templates, but.... */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    28
/* Transform backend generic *************************************/
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    29
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    30
/* only mdct right now.  Flesh it out more if we ever transcend mdct
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    31
   in the transform domain */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    32
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    33
/* Floor backend generic *****************************************/
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    34
typedef struct{
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    35
  vorbis_info_floor     *(*unpack)(vorbis_info *,oggpack_buffer *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    36
  vorbis_look_floor     *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    37
				   vorbis_info_floor *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    38
  void (*free_info) (vorbis_info_floor *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    39
  void (*free_look) (vorbis_look_floor *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    40
  void *(*inverse1)  (struct vorbis_block *,vorbis_look_floor *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    41
  int   (*inverse2)  (struct vorbis_block *,vorbis_look_floor *,
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    42
		     void *buffer,ogg_int32_t *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    43
} vorbis_func_floor;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    44
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    45
typedef struct{
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    46
  int   order;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    47
  long  rate;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    48
  long  barkmap;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    49
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    50
  int   ampbits;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    51
  int   ampdB;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    52
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    53
  int   numbooks; /* <= 16 */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    54
  int   books[16];
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    55
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    56
} vorbis_info_floor0;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    57
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    58
#define VIF_POSIT 63
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    59
#define VIF_CLASS 16
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    60
#define VIF_PARTS 31
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    61
typedef struct{
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    62
  int   partitions;                /* 0 to 31 */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    63
  int   partitionclass[VIF_PARTS]; /* 0 to 15 */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    64
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    65
  int   class_dim[VIF_CLASS];        /* 1 to 8 */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    66
  int   class_subs[VIF_CLASS];       /* 0,1,2,3 (bits: 1<<n poss) */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    67
  int   class_book[VIF_CLASS];       /* subs ^ dim entries */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    68
  int   class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    69
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    70
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    71
  int   mult;                      /* 1 2 3 or 4 */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    72
  int   postlist[VIF_POSIT+2];    /* first two implicit */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    73
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    74
} vorbis_info_floor1;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    75
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    76
/* Residue backend generic *****************************************/
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    77
typedef struct{
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    78
  vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    79
  vorbis_look_residue *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    80
				 vorbis_info_residue *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    81
  void (*free_info)    (vorbis_info_residue *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    82
  void (*free_look)    (vorbis_look_residue *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    83
  int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    84
			ogg_int32_t **,int *,int);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    85
} vorbis_func_residue;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    86
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    87
typedef struct vorbis_info_residue0{
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    88
/* block-partitioned VQ coded straight residue */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    89
  long  begin;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    90
  long  end;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    91
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    92
  /* first stage (lossless partitioning) */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    93
  int    grouping;         /* group n vectors per partition */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    94
  int    partitions;       /* possible codebooks for a partition */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    95
  int    groupbook;        /* huffbook for partitioning */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    96
  int    secondstages[64]; /* expanded out to pointers in lookup */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    97
  int    booklist[256];    /* list of second stage books */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    98
} vorbis_info_residue0;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    99
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   100
/* Mapping backend generic *****************************************/
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   101
typedef struct{
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   102
  vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   103
  vorbis_look_mapping *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   104
				 vorbis_info_mapping *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   105
  void (*free_info)    (vorbis_info_mapping *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   106
  void (*free_look)    (vorbis_look_mapping *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   107
  int  (*inverse)      (struct vorbis_block *vb,vorbis_look_mapping *);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   108
} vorbis_func_mapping;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   109
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   110
typedef struct vorbis_info_mapping0{
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   111
  int   submaps;  /* <= 16 */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   112
  int   chmuxlist[256];   /* up to 256 channels in a Vorbis stream */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   113
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   114
  int   floorsubmap[16];   /* [mux] submap to floors */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   115
  int   residuesubmap[16]; /* [mux] submap to residue */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   116
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   117
  int   psy[2]; /* by blocktype; impulse/padding for short,
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   118
                   transition/normal for long */
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   119
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   120
  int   coupling_steps;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   121
  int   coupling_mag[256];
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   122
  int   coupling_ang[256];
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   123
} vorbis_info_mapping0;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   124
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   125
#endif
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   126
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   127
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   128
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   129
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
   130