blob: 7687b453fd9ef612762c65b4f59c6ce7e0f4b55b [file] [log] [blame]
The Android Open Source Project98913fe2009-03-15 16:47:32 -07001/* Copyright (C) 2002 Jean-Marc Valin & David Rowe */
2/**
3 @file cb_search.h
4 @brief Overlapped codebook search
5*/
6/*
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
9 are met:
10
11 - Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
13
14 - Redistributions in binary form must reproduce the above copyright
15 notice, this list of conditions and the following disclaimer in the
16 documentation and/or other materials provided with the distribution.
17
18 - Neither the name of the Xiph.org Foundation nor the names of its
19 contributors may be used to endorse or promote products derived from
20 this software without specific prior written permission.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
26 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33*/
34
35#ifndef CB_SEARCH_H
36#define CB_SEARCH_H
37
38#include <speex/speex_bits.h>
39#include "arch.h"
40
41/** Split codebook parameters. */
42typedef struct split_cb_params {
43 int subvect_size;
44 int nb_subvect;
45 const signed char *shape_cb;
46 int shape_bits;
47 int have_sign;
48} split_cb_params;
49
50
51void split_cb_search_shape_sign(
52spx_word16_t target[], /* target vector */
53spx_coef_t ak[], /* LPCs for this subframe */
54spx_coef_t awk1[], /* Weighted LPCs for this subframe */
55spx_coef_t awk2[], /* Weighted LPCs for this subframe */
56const void *par, /* Codebook/search parameters */
57int p, /* number of LPC coeffs */
58int nsf, /* number of samples in subframe */
59spx_sig_t *exc,
60spx_word16_t *r,
61SpeexBits *bits,
62char *stack,
63int complexity,
64int update_target
65);
66
67void split_cb_shape_sign_unquant(
68spx_sig_t *exc,
69const void *par, /* non-overlapping codebook */
70int nsf, /* number of samples in subframe */
71SpeexBits *bits,
72char *stack,
73spx_int32_t *seed
74);
75
76
77void noise_codebook_quant(
78spx_word16_t target[], /* target vector */
79spx_coef_t ak[], /* LPCs for this subframe */
80spx_coef_t awk1[], /* Weighted LPCs for this subframe */
81spx_coef_t awk2[], /* Weighted LPCs for this subframe */
82const void *par, /* Codebook/search parameters */
83int p, /* number of LPC coeffs */
84int nsf, /* number of samples in subframe */
85spx_sig_t *exc,
86spx_word16_t *r,
87SpeexBits *bits,
88char *stack,
89int complexity,
90int update_target
91);
92
93
94void noise_codebook_unquant(
95spx_sig_t *exc,
96const void *par, /* non-overlapping codebook */
97int nsf, /* number of samples in subframe */
98SpeexBits *bits,
99char *stack,
100spx_int32_t *seed
101);
102
103#endif