File size: 5,751 Bytes
b50f2a2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
//
// Copyright © 2025 Agora
// This file is part of TEN Framework, an open source project.
// Licensed under the Apache License, Version 2.0, with certain conditions.
// Refer to the "LICENSE" file in the root directory for more information.
//
#ifndef __FSCVRT_H__
#define __FSCVRT_H__
#define AUP_FSCVRT_MAX_INPUT_LEN (2400)
// max. number of samples each time can be fed in
#include <stdio.h>
typedef struct FscvrtStaticCfg_ {
int inputFs; // input stream sampling freq.
int outputFs; // output stream sampling freq.
int stepSz; // number of input samples per each proc.
int inputType; // input data type, 0: short, 1: float
int outputType; // output data type, 0: short, 1: float
} FscvrtStaticCfg;
typedef struct FscvrtInData_ {
const void* inDataSeq; // [stepSz], externally provided buffer
int outDataSeqLen;
// the length of externally provided buffer outDataSeq in OutData
} FscvrtInData;
typedef struct FscvrtOutData_ {
int nOutData; // number of samples in outDataSeq
// this value may vary by +-1 from frame-to-frame
// and the user needs to check if nOutData <= outDataSeqLen
// o.w. the buffer outDataSeq is not long enough
int outDataType; // output data type, 0: short, 1: float
void* outDataSeq; // [outDataSeqLen], externally provided buffer
} FscvrtOutData;
typedef struct FscvrtGetData_ {
int maxOutputStepSz; // max. number of output samples per each proc.
int delayInInputFs; // algorithm delay in terms of samples @ input fs
} FscvrtGetData;
#ifdef __cplusplus
extern "C" {
#endif
/****************************************************************************
* AUP_Fscvrt_create(...)
*
* This function creats a state handler from nothing, which is NOT ready for
* processing
*
* Input:
*
* Output:
* - stPtr : buffer to store the returned state handler
*
* Return value : 0 - Ok
* -1 - Error
*/
int AUP_Fscvrt_create(void** stPtr);
/****************************************************************************
* AUP_Fscvrt_destroy(...)
*
* destroy biquad instance, and releasing all the dynamically allocated memory
*
* Input:
* - stPtr : buffer of State Handler, after this method, this
* handler won't be usable anymore
*
* Output:
*
* Return value : 0 - Ok
* -1 - Error
*/
int AUP_Fscvrt_destroy(void** stPtr);
/****************************************************************************
* AUP_Fscvrt_memAllocate(...)
*
* This function sets Static Config params and does memory allocation
* operation
*
* Input:
* - stPtr : State Handler which was returned by _create
* - pCfg : static configuration parameters
*
* Output:
*
* Return value : 0 - Ok
* -1 - Error
*/
int AUP_Fscvrt_memAllocate(void* stPtr, const FscvrtStaticCfg* pCfg);
/****************************************************************************
* AUP_Fscvrt_init(...)
*
* This function resets (initialize) the XXXX module and gets it prepared for
* processing
*
* Input:
* - stPtr : State Handler which has gone through create and
* memAllocate
*
* Output:
*
* Return value : 0 - Ok
* -1 - Error
*/
int AUP_Fscvrt_init(void* stPtr);
/****************************************************************************
* AUP_Fscvrt_setDynamCfg(...)
*
* This function set dynamic (per-frame variable) configuration
*
* Input:
* - stPtr : State Handler which has gone through create and
* memAllocate
* - pCfg : configuration content
*
* Output:
*
* Return value : 0 - Ok
* -1 - Error
*/
int AUP_Fscvrt_setDynamCfg(void* stPtr);
/****************************************************************************
* AUP_Fscvrt_getStaticCfg(...)
*
* This function get static configuration status from XXXXX module
*
* Input:
* - stPtr : State Handler which has gone through create and
* memAllocate
*
* Output:
* - pCfg : configuration content
*
* Return value : 0 - Ok
* -1 - Error
*/
int AUP_Fscvrt_getStaticCfg(const void* stPtr, FscvrtStaticCfg* pCfg);
/****************************************************************************
* AUP_Fscvrt_getInfor(...)
*
* This function get subsidiary information from Fs-Converter module
*
* Input:
* - stPtr : State Handler which has gone through create and
* memAllocate
*
* Output:
* - FscvrtGetData : returned information
*
* Return value : 0 - Ok
* -1 - Error
*/
int AUP_Fscvrt_getInfor(const void* stPtr, FscvrtGetData* buff);
/****************************************************************************
* AUP_Fscvrt_proc(...)
*
* process a single frame
*
* Input:
* - stPtr : State Handler which has gone through create and
* memAllocate
* - pCtrl : per-frame variable control parameters
* - pIn : input data stream
*
* Output:
* - pOut : output data (mask, highband time-domain gain etc.)
*
* Return value : 0 - Ok
* -1 - Error
*/
int AUP_Fscvrt_proc(void* stPtr, const FscvrtInData* pIn, FscvrtOutData* pOut);
#ifdef __cplusplus
}
#endif
#endif // __FSCVRT_H__
|