shithub: opus

Download patch

ref: 42a0972a111a4d93d5a8ef2dbb8fb2aa97be9986
parent: db48088e9f075f581fb87f03b1f7c7b74787a2f6
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Wed Jun 21 23:31:33 EDT 2023

Remove more useless code

--- a/dnn/common.c
+++ /dev/null
@@ -1,65 +1,0 @@
-
-/* Copyright (c) 2017-2019 Mozilla */
-/*
-   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 FOUNDATION 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 <stdio.h>
-#include "freq.h"
-#include "lpcnet_private.h"
-
-
-static void single_interp(float *x, const float *left, const float *right, int id)
-{
-    int i;
-    float ref[NB_BANDS];
-    float pred[3*NB_BANDS];
-    RNN_COPY(ref, x, NB_BANDS);
-    for (i=0;i<NB_BANDS;i++) pred[i] = .5f*(left[i] + right[i]);
-    for (i=0;i<NB_BANDS;i++) pred[NB_BANDS+i] = left[i];
-    for (i=0;i<NB_BANDS;i++) pred[2*NB_BANDS+i] = right[i];
-    for (i=0;i<NB_BANDS;i++) {
-      x[i] = pred[id*NB_BANDS + i];
-    }
-    if (0) {
-        float err = 0;
-        for (i=0;i<NB_BANDS;i++) {
-            err += (x[i]-ref[i])*(x[i]-ref[i]);
-        }
-        printf("%f\n", sqrt(err/NB_BANDS));
-    }
-}
-
-void perform_double_interp(float features[4][NB_TOTAL_FEATURES], const float *mem, int best_id) {
-    int id0, id1;
-    best_id += (best_id >= FORBIDDEN_INTERP);
-    id0 = best_id / 3;
-    id1 = best_id % 3;
-    single_interp(features[0], mem, features[1], id0);
-    single_interp(features[2], features[1], features[3], id1);
-}
--- a/dnn/lpcnet_private.h
+++ b/dnn/lpcnet_private.h
@@ -9,8 +9,6 @@
 #include "plc_data.h"
 #include "kiss99.h"
 
-#define BITS_PER_CHAR 8
-
 #define PITCH_MIN_PERIOD 32
 #define PITCH_MAX_PERIOD 256
 
@@ -17,11 +15,6 @@
 #define PITCH_FRAME_SIZE 320
 #define PITCH_BUF_SIZE (PITCH_MAX_PERIOD+PITCH_FRAME_SIZE)
 
-#define MULTI 4
-#define MULTI_MASK (MULTI-1)
-
-#define FORBIDDEN_INTERP 7
-
 #define PLC_MAX_FEC 100
 #define MAX_FEATURE_BUFFER_SIZE 4
 
@@ -98,8 +91,6 @@
 };
 
 void preemphasis(float *y, float *mem, const float *x, float coef, int N);
-
-void perform_double_interp(float features[4][NB_TOTAL_FEATURES], const float *mem, int best_id);
 
 void compute_frame_features(LPCNetEncState *st, const float *in);
 
--- a/lpcnet_sources.mk
+++ b/lpcnet_sources.mk
@@ -1,6 +1,5 @@
 LPCNET_SOURCES = \
 dnn/burg.c \
-dnn/common.c \
 dnn/freq.c \
 dnn/kiss99.c \
 dnn/lpcnet.c \
--