134680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)/* Copyright (C) 2002 Jean-Marc Valin */
234680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)/**
334680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   @file vq.h
434680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   @brief Vector quantization
534680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)*/
634680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)/*
734680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   Redistribution and use in source and binary forms, with or without
834680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   modification, are permitted provided that the following conditions
934680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   are met:
1034680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
1134680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   - Redistributions of source code must retain the above copyright
1234680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   notice, this list of conditions and the following disclaimer.
1334680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
1434680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   - Redistributions in binary form must reproduce the above copyright
1534680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   notice, this list of conditions and the following disclaimer in the
1634680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   documentation and/or other materials provided with the distribution.
1734680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
1834680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   - Neither the name of the Xiph.org Foundation nor the names of its
1934680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   contributors may be used to endorse or promote products derived from
2034680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   this software without specific prior written permission.
2134680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
2234680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2334680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2434680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2534680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
2634680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2734680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2834680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2934680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
3034680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
3134680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3234680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3334680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)*/
3434680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
3534680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)#ifndef VQ_H
3634680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)#define VQ_H
3734680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
3834680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)#include "arch.h"
3934680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
4034680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)int scal_quant(spx_word16_t in, const spx_word16_t *boundary, int entries);
4134680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)int scal_quant32(spx_word32_t in, const spx_word32_t *boundary, int entries);
4234680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
4334680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)#ifdef _USE_SSE
4434680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)#include <xmmintrin.h>
4534680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)void vq_nbest(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
4634680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
4734680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)void vq_nbest_sign(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
4834680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)#else
4934680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
5034680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
5134680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)void vq_nbest_sign(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
5234680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)#endif
5334680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)
5434680572440d7894ef8dafce81d8039ed80726a2Torne (Richard Coles)#endif
55