From 0edb3954e863218f756cc637ecd10eb742b115b6 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Fri, 2 Dec 2022 16:22:03 -0500 Subject: [PATCH] Minor cleanup --- silk/dred_coding.c | 6 +- silk/dred_coding.h | 6 +- silk/dred_encoder.c | 10 +-- silk/dred_encoder.h | 6 +- silk/dred_entropy.c | 194 -------------------------------------------- 5 files changed, 14 insertions(+), 208 deletions(-) delete mode 100644 silk/dred_entropy.c diff --git a/silk/dred_coding.c b/silk/dred_coding.c index 9b0381d2..e6f65f7f 100644 --- a/silk/dred_coding.c +++ b/silk/dred_coding.c @@ -25,13 +25,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include - #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include +#include + #include "celt/entenc.h" #include "celt/vq.h" #include "celt/cwrs.h" diff --git a/silk/dred_coding.h b/silk/dred_coding.h index 9f8c9c63..a36f93d9 100644 --- a/silk/dred_coding.h +++ b/silk/dred_coding.h @@ -25,8 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _DRED_CODING_H -#define _DRED_CODING_H +#ifndef DRED_CODING_H +#define DRED_CODING_H #include "opus_types.h" #include "entcode.h" @@ -39,4 +39,4 @@ void dred_decode_state(ec_enc *dec, float *x); void dred_decode_latents(ec_dec *dec, float *x, const opus_uint16 *scale, const opus_uint16 *r, const opus_uint16 *p0); -#endif \ No newline at end of file +#endif diff --git a/silk/dred_encoder.c b/silk/dred_encoder.c index 5470b952..a77e273e 100644 --- a/silk/dred_encoder.c +++ b/silk/dred_encoder.c @@ -25,6 +25,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #if 1 @@ -32,10 +36,6 @@ #include #endif -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "dred_encoder.h" #include "dred_coding.h" #include "celt/entenc.h" @@ -140,4 +140,4 @@ void dred_encode_silk_frame(DREDEnc *enc, const opus_int16 *silk_frame) dred_deinit_decoder(&dec); #endif -} \ No newline at end of file +} diff --git a/silk/dred_encoder.h b/silk/dred_encoder.h index a8bb7cbf..e5f67c0e 100644 --- a/silk/dred_encoder.h +++ b/silk/dred_encoder.h @@ -25,8 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _DRED_ENCODER_H -#define _DRED_ENCODER_H +#ifndef DRED_ENCODER_H +#define DRED_ENCODER_H #include "lpcnet.h" #include "dred_config.h" @@ -53,4 +53,4 @@ void dred_deinit_encoder(DREDEnc *enc); void dred_encode_silk_frame(DREDEnc *enc, const opus_int16 *silk_frame); -#endif \ No newline at end of file +#endif diff --git a/silk/dred_entropy.c b/silk/dred_entropy.c deleted file mode 100644 index ac01f48b..00000000 --- a/silk/dred_entropy.c +++ /dev/null @@ -1,194 +0,0 @@ -/* Copyright (c) 2022 Amazon - Written by Jean-Marc Valin */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include "celt/vq.h" -#include "celt/cwrs.h" - -#define LATENT_DIM 80 -#define PVQ_DIM 24 -#define PVQ_K 82 - -static void encode_pvq(const int *iy, int N, int K, ec_enc *enc) { - int fits; - celt_assert(N==24 || N==12 || N==6); - fits = (N==24 && K<=9) || (N==12 && K<=16) || (N==6); - /*printf("encode(%d,%d), fits=%d\n", N, K, fits);*/ - if (fits) encode_pulses(iy, N, K, enc); - else { - int N2 = N/2; - int K0=0; - int i; - for (i=0;i - -#define DATA_SIZE 10000 - -int main() -{ - ec_enc enc; - ec_dec dec; - int iter; - int bytes; - opus_int16 scale[LATENT_DIM]; - opus_int16 dzone[LATENT_DIM]; - opus_int16 r[LATENT_DIM]; - opus_int16 p0[LATENT_DIM]; - unsigned char *ptr; - int k; - - for (k=0;k