From 5eeb5766718c32db20680cfc5ce7cee068df84f3 Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@jmvalin.ca>
Date: Sun, 18 Feb 2024 13:57:18 -0500
Subject: [PATCH] Instructions for reusing loss simulator

---
 dnn/lossgen.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 dnn/lossgen.h | 26 ++++++++++++++++++++++++++
 2 files changed, 76 insertions(+)

diff --git a/dnn/lossgen.c b/dnn/lossgen.c
index 4730e6973..308e24c01 100644
--- a/dnn/lossgen.c
+++ b/dnn/lossgen.c
@@ -1,3 +1,53 @@
+/* Copyright (c) 2023 Amazon */
+/*
+   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.
+*/
+
+/* This packet loss simulator can be used independently of the Opus codebase.
+   Do do that, you need to compile the following files:
+     dnn/lossgen.c
+     dnn/lossgen_data.c
+   
+   To to that, the following files are needed as #include
+     dnn/lossgen_data.h
+     dnn/lossgen.h
+     dnn/nnet_arch.h
+     dnn/nnet.h
+     dnn/parse_lpcnet_weights.c   (included despite being a C file)
+     dnn/vec_avx.h
+     dnn/vec.h
+     celt/os_support.h
+     celt/arch.h
+     celt/x86/x86_arch_macros.h
+     include/opus_defines.h
+     include/opus_types.h
+
+   
+   Additionally, the code in dnn/lossgen_demo.c can be used to generate losses from
+   the command line.
+*/
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/dnn/lossgen.h b/dnn/lossgen.h
index 06b771de2..3b704ec31 100644
--- a/dnn/lossgen.h
+++ b/dnn/lossgen.h
@@ -1,3 +1,29 @@
+/* Copyright (c) 2023 Amazon */
+/*
+   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.
+*/
+
 #ifndef LOSSGEN_H
 #define LOSSGEN_H
 
-- 
GitLab