blob: 7aff26bee3a95119b35934a75173e16d8642a386 [file] [log] [blame]
Gloria Wang37fe1582010-03-12 14:53:20 -08001/************************************************************************
Gloria Wang2da723a2010-03-18 15:56:16 -07002 * Copyright (C) 2002-2009, Xiph.org Foundation
3 * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd
Gloria Wang37fe1582010-03-12 14:53:20 -08004 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
Gloria Wang2da723a2010-03-18 15:56:16 -07007 * modification, are permitted provided that the following conditions
8 * are met:
Gloria Wang37fe1582010-03-12 14:53:20 -08009 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
Gloria Wang2da723a2010-03-18 15:56:16 -070016 * * Neither the names of the Xiph.org Foundation nor Pinknoise
17 * Productions Ltd nor the names of its contributors may be used to
18 * endorse or promote products derived from this software without
19 * specific prior written permission.
Gloria Wang37fe1582010-03-12 14:53:20 -080020 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 ************************************************************************
Gloria Wang79130732010-02-08 14:41:04 -080033
34 function: basic shared codebook operations
35
Gloria Wang37fe1582010-03-12 14:53:20 -080036 ************************************************************************/
Gloria Wang79130732010-02-08 14:41:04 -080037
38#ifndef _V_CODEBOOK_H_
39#define _V_CODEBOOK_H_
40
41#include "ogg.h"
42
43typedef struct codebook{
44 /* Top 15 used in ARM code */
45 int dec_maxlength;
46 void *dec_table;
47 int dec_method;
48 int dec_type; /* 0 = entry number
49 1 = packed vector of values
50 2 = packed vector of column offsets, maptype 1
51 3 = scalar offset into value array, maptype 2 */
52 int q_bits;
53 long dim; /* codebook dimensions (elements per vector) */
54 int q_delp;
55 int q_minp;
56 ogg_int32_t q_del;
57 ogg_int32_t q_min;
58 int q_seq;
59 int q_pack;
60 void *q_val;
61 long used_entries; /* populated codebook entries */
62 ogg_int32_t *dec_buf;
63
64 /* C only */
65 int dec_nodeb;
66 int dec_leafw;
67
68 long entries; /* codebook entries */
69
70} codebook;
71
72extern void vorbis_book_clear(codebook *b);
73extern int vorbis_book_unpack(oggpack_buffer *b,codebook *c);
74
75extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
76extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a,
77 oggpack_buffer *b,int n,int point);
78extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a,
79 oggpack_buffer *b,int n,int point);
80extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a,
81 oggpack_buffer *b,int n,int point);
82extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,
83 long off,int ch,
84 oggpack_buffer *b,int n,int point);
85
86extern int _ilog(unsigned int v);
87
88
89#endif