1 /* Copyright (c) 2023 Amazon 2 Written by Jan Buethe */ 3 /* 4 Redistribution and use in source and binary forms, with or without 5 modification, are permitted provided that the following conditions 6 are met: 7 8 - Redistributions of source code must retain the above copyright 9 notice, this list of conditions and the following disclaimer. 10 11 - Redistributions in binary form must reproduce the above copyright 12 notice, this list of conditions and the following disclaimer in the 13 documentation and/or other materials provided with the distribution. 14 15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 19 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 #ifndef OSCE_H 29 #define OSCE_H 30 31 32 #include "opus_types.h" 33 /*#include "osce_config.h"*/ 34 #ifndef DISABLE_LACE 35 #include "lace_data.h" 36 #endif 37 #ifndef DISABLE_NOLACE 38 #include "nolace_data.h" 39 #endif 40 #include "nndsp.h" 41 #include "nnet.h" 42 #include "osce_structs.h" 43 #include "structs.h" 44 45 #define OSCE_METHOD_NONE 0 46 #ifndef DISABLE_LACE 47 #define OSCE_METHOD_LACE 1 48 #endif 49 #ifndef DISABLE_NOLACE 50 #define OSCE_METHOD_NOLACE 2 51 #endif 52 53 #if !defined(DISABLE_NOLACE) 54 #define OSCE_DEFAULT_METHOD OSCE_METHOD_NOLACE 55 #define OSCE_MAX_RNN_NEURONS NOLACE_FNET_GRU_STATE_SIZE 56 #elif !defined(DISABLE_LACE) 57 #define OSCE_DEFAULT_METHOD OSCE_METHOD_LACE 58 #define OSCE_MAX_RNN_NEURONS LACE_FNET_GRU_STATE_SIZE 59 #else 60 #define OSCE_DEFAULT_METHOD OSCE_METHOD_NONE 61 #define OSCE_MAX_RNN_NEURONS 0 62 #endif 63 64 65 66 67 /* API */ 68 69 70 void osce_enhance_frame( 71 OSCEModel *model, /* I OSCE model struct */ 72 silk_decoder_state *psDec, /* I/O Decoder state */ 73 silk_decoder_control *psDecCtrl, /* I Decoder control */ 74 opus_int16 xq[], /* I/O Decoded speech */ 75 opus_int32 num_bits, /* I Size of SILK payload in bits */ 76 int arch /* I Run-time architecture */ 77 ); 78 79 80 int osce_load_models(OSCEModel *hModel, const void *data, int len); 81 void osce_reset(silk_OSCE_struct *hOSCE, int method); 82 83 84 #endif 85