~ubuntu-branches/ubuntu/wily/hedgewars/wily

« back to all changes in this revision

Viewing changes to misc/libtremor/codebook.h

  • Committer: Package Import Robot
  • Author(s): Dmitry E. Oboukhov
  • Date: 2011-09-23 10:16:55 UTC
  • mfrom: (1.2.11 upstream)
  • Revision ID: package-import@ubuntu.com-20110923101655-3977th2gc5n0a3pv
Tags: 0.9.16-1
* New upstream version.
 + Downloadable content! Simply click to install any content.
   New voices, hats, maps, themes, translations, music, scripts...
   Hedgewars is now more customisable than ever before! As time goes
   by we will be soliciting community content to feature on this page,
   so remember to check it from time to time. If you decide you want
   to go back to standard Hedgewars, just remove the Data directory
   from your Hedgewars config directory.
 + 3-D rendering! Diorama-like rendering of the game in a variety
   of 3D modes. Let us know which ones work best for you, we didn't
   really have the equipment to test them all.
 + Resizable game window.
 + New utilities! The Time Box will remove one of your hedgehogs
   from the game for a while, protecting from attack until it returns,
   somewhere else on the map. Land spray will allow you to build bridges,
   seal up holes, or just make life unpleasant for your enemies.
 + New single player: Bamboo Thicket, That Sinking Feeling, Newton and
   the Tree and multi-player: The Specialists, Space Invaders,
   Racer - scripts! And a ton more script hooks for scripters
 + New twists on old weapons. Drill strike, seduction and fire have
   been adjusted. Defective mines have been added, rope can attach to
   hogs/crates/barrels again, grenades now have variable bounce (use
   precise key + 1-5). Portal gun is now more usable in flight and
   all game actions are a lot faster.
 + New theme - Golf, dozens of new community hats and a new
   localised Default voice, Ukranian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/********************************************************************
 
2
 *                                                                  *
 
3
 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
 
4
 *                                                                  *
 
5
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
 
6
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
 
7
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
 
8
 *                                                                  *
 
9
 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
 
10
 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
 
11
 *                                                                  *
 
12
 ********************************************************************
 
13
 
 
14
 function: basic shared codebook operations
 
15
 
 
16
 ********************************************************************/
 
17
 
 
18
#ifndef _V_CODEBOOK_H_
 
19
#define _V_CODEBOOK_H_
 
20
 
 
21
#include "ogg.h"
 
22
 
 
23
/* This structure encapsulates huffman and VQ style encoding books; it
 
24
   doesn't do anything specific to either.
 
25
 
 
26
   valuelist/quantlist are nonNULL (and q_* significant) only if
 
27
   there's entry->value mapping to be done.
 
28
 
 
29
   If encode-side mapping must be done (and thus the entry needs to be
 
30
   hunted), the auxiliary encode pointer will point to a decision
 
31
   tree.  This is true of both VQ and huffman, but is mostly useful
 
32
   with VQ.
 
33
 
 
34
*/
 
35
 
 
36
typedef struct static_codebook{
 
37
  long   dim;            /* codebook dimensions (elements per vector) */
 
38
  long   entries;        /* codebook entries */
 
39
  long  *lengthlist;     /* codeword lengths in bits */
 
40
 
 
41
  /* mapping ***************************************************************/
 
42
  int    maptype;        /* 0=none
 
43
                            1=implicitly populated values from map column 
 
44
                            2=listed arbitrary values */
 
45
 
 
46
  /* The below does a linear, single monotonic sequence mapping. */
 
47
  long     q_min;       /* packed 32 bit float; quant value 0 maps to minval */
 
48
  long     q_delta;     /* packed 32 bit float; val 1 - val 0 == delta */
 
49
  int      q_quant;     /* bits: 0 < quant <= 16 */
 
50
  int      q_sequencep; /* bitflag */
 
51
 
 
52
  long     *quantlist;  /* map == 1: (int)(entries^(1/dim)) element column map
 
53
                           map == 2: list of dim*entries quantized entry vals
 
54
                        */
 
55
} static_codebook;
 
56
 
 
57
typedef struct codebook{
 
58
  long dim;           /* codebook dimensions (elements per vector) */
 
59
  long entries;       /* codebook entries */
 
60
  long used_entries;  /* populated codebook entries */
 
61
 
 
62
  /* the below are ordered by bitreversed codeword and only used
 
63
     entries are populated */
 
64
  int           binarypoint;
 
65
  ogg_int32_t  *valuelist;  /* list of dim*entries actual entry values */  
 
66
  ogg_uint32_t *codelist;   /* list of bitstream codewords for each entry */
 
67
 
 
68
  int          *dec_index;  
 
69
  char         *dec_codelengths;
 
70
  ogg_uint32_t *dec_firsttable;
 
71
  int           dec_firsttablen;
 
72
  int           dec_maxlength;
 
73
 
 
74
  long     q_min;       /* packed 32 bit float; quant value 0 maps to minval */
 
75
  long     q_delta;     /* packed 32 bit float; val 1 - val 0 == delta */
 
76
 
 
77
} codebook;
 
78
 
 
79
extern void vorbis_staticbook_clear(static_codebook *b);
 
80
extern void vorbis_staticbook_destroy(static_codebook *b);
 
81
extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
 
82
 
 
83
extern void vorbis_book_clear(codebook *b);
 
84
extern long _book_maptype1_quantvals(const static_codebook *b);
 
85
 
 
86
extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
 
87
 
 
88
extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
 
89
extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a, 
 
90
                                     oggpack_buffer *b,int n,int point);
 
91
extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a, 
 
92
                                    oggpack_buffer *b,int n,int point);
 
93
extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a, 
 
94
                                    oggpack_buffer *b,int n,int point);
 
95
extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,
 
96
                                     long off,int ch, 
 
97
                                    oggpack_buffer *b,int n,int point);
 
98
 
 
99
extern int _ilog(unsigned int v);
 
100
 
 
101
 
 
102
#endif