xref: /aosp_15_r20/external/libopus/dnn/osce_features.h (revision a58d3d2adb790c104798cd88c8a3aff4fa8b82cc)
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_FEATURES_H
29 #define OSCE_FEATURES_H
30 
31 
32 #include "structs.h"
33 #include "opus_types.h"
34 
35 #define OSCE_NUMBITS_BUGFIX
36 
37 void osce_calculate_features(
38     silk_decoder_state          *psDec,                         /* I/O  Decoder state                               */
39     silk_decoder_control        *psDecCtrl,                     /* I    Decoder control                             */
40     float                       *features,                      /* O    input features                              */
41     float                       *numbits,                       /* O    numbits and smoothed numbits                */
42     int                         *periods,                       /* O    pitch lags on subframe basis                */
43     const opus_int16            xq[],                           /* I    Decoded speech                              */
44     opus_int32                  num_bits                        /* I    Size of SILK payload in bits                */
45 );
46 
47 
48 void osce_cross_fade_10ms(float *x_enhanced, float *x_in, int length);
49 
50 #endif
51