hi_resampler_api.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef _HI_RESAMPLER_API_H_
  2. #define _HI_RESAMPLER_API_H_
  3. #include "hi_type.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #define MAXFRAMESIZE 2048
  8. /**************************************************************************************
  9. * Function: HI_Resampler_Create
  10. *
  11. * Description: allocate memory for platform-specific data
  12. * clear all the user-accessible fields
  13. *
  14. * Inputs: inrate: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000
  15. * outrate: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000
  16. * chans: 1 or 2
  17. * Outputs: none
  18. *
  19. * Return: handle to Resampler instance, 0 if malloc fails
  20. **************************************************************************************/
  21. HI_VOID* HI_Resampler_Create(HI_S32 s32Inrate, HI_S32 s32Outrate, HI_S32 s32Chans);
  22. /**************************************************************************************
  23. * Function: HI_Resampler_Process
  24. *
  25. * Description: Resample pcm data to specific samplerate, only for interlaced format
  26. *
  27. * Inputs: inst: valid Resampler instance pointer (HResampler)
  28. * inbuf: pointer to inputbuf
  29. * insamps: input number of sample pointers
  30. * Outputs: outbuf: pointer to outputbuf
  31. *
  32. * Return: output sample number per-channel
  33. * Notes: sure insamps < MAXFRAMESIZE
  34. **************************************************************************************/
  35. HI_S32 HI_Resampler_Process(HI_VOID* inst, HI_S16* s16Inbuf, HI_S32 s32Insamps, HI_S16* s16Outbuf);
  36. /**************************************************************************************
  37. * Function: HI_Resampler_Destroy
  38. *
  39. * Description: free platform-specific data allocated by ResamplerCreate
  40. *
  41. * Inputs: valid Resampler instance pointer (HResampler)
  42. * Outputs: none
  43. *
  44. * Return: none
  45. **************************************************************************************/
  46. HI_VOID HI_Resampler_Destroy(HI_VOID* inst);
  47. /*******************************************************************************
  48. * Function: HI_Resampler_GetMaxOutputNum
  49. *
  50. * Description: Caculate max output number at specific input number
  51. *
  52. * Inputs: inst: valid Resampler instance pointer (HI_HANDLE)
  53. * insamps: input data number per-channel, insamps must be even
  54. * Outputs: none
  55. * Return: >=0: Success, return the max output number per-channel
  56. * other: Fail, return error code
  57. * Notes:
  58. * 1 if stereo(chans==2), sure insamps%2 == 0
  59. ******************************************************************************/
  60. HI_S32 HI_Resampler_GetMaxOutputNum(HI_VOID* inst, HI_S32 s32Insamps);
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif