spbstd.h
上传用户:luckfish
上传日期:2021-12-16
资源大小:77k
文件大小:3k
源码类别:

语音压缩

开发平台:

Visual C++

  1. /*
  2. 2.4 kbps MELP Proposed Federal Standard speech coder
  3. version 1.2
  4. Copyright (c) 1996, Texas Instruments, Inc.  
  5. Texas Instruments has intellectual property rights on the MELP
  6. algorithm.  The Texas Instruments contact for licensing issues for
  7. commercial and non-government use is William Gordon, Director,
  8. Government Contracts, Texas Instruments Incorporated, Semiconductor
  9. Group (phone 972 480 7442).
  10. */
  11. /*
  12.    spbstd.h   SPB standard header file.
  13.    Copyright (c) 1995 by Texas Instruments, Inc.  All rights reserved.
  14. */
  15. #ifndef _spbstd_h
  16. #define _spbstd_h
  17. /*
  18. ** Needed include files.
  19. */
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <string.h>
  23. #include <math.h>
  24. /* OSTYPE-dependent definitions/macros. */
  25. #ifdef SunOS4
  26. /* some standard C function definitions missing from SunOS4 */
  27. extern int fclose(FILE *stream);
  28. extern int fprintf(FILE *stream, const char *format, ...);
  29. extern size_t fread(void *ptr, size_t size, size_t nobj, FILE *stream);
  30. extern int fseek(FILE *stream, long offset, int origin);
  31. extern size_t fwrite(const void *ptr, size_t size, size_t nobj, FILE *stream);
  32. extern int printf(const char *format, ...);
  33. extern long random(void);
  34. extern int sscanf (char *s, const char *format, ...);
  35. extern void rewind(FILE *stream);
  36. #else
  37. #endif
  38. /*
  39. ** Constant definitions.
  40. */
  41. #ifndef FALSE
  42. #define FALSE           0
  43. #endif
  44. #ifndef M_PI
  45. #define     M_PI    3.14159265358979323846
  46. #endif
  47. #ifndef PI
  48. #define PI              M_PI
  49. #endif
  50. #ifndef TRUE
  51. #define TRUE            1
  52. #endif
  53. #ifndef TWOPI
  54. #define TWOPI 6.28318530717958647692
  55. #endif
  56. /*
  57. ** Macros.
  58. */
  59. #ifndef FREE
  60. #define FREE(v)         if(v)(void)free((void*)(v))
  61. #endif
  62. #ifndef program_abort
  63. #define program_abort(s1,s2,i1,i2) (void)fprintf(stderr,"%s: %s (instance %d, line %d)",s1,s2,i1,i2),exit(1)
  64. #endif
  65. #ifndef SQR
  66. #define SQR(x)          ((x)*(x))
  67. #endif
  68. /* Generic memory allocation/deallocation macros. */
  69. #define MEM_ALLOC(alloc_routine, v, n, type) 
  70.         if(((v) = (type*) alloc_routine((n) * sizeof(type)))!=NULL)
  71.                 ; else program_abort(__FILE__,"MEM_ALLOC",0,__LINE__)
  72. #define MEM_2ALLOC(alloc_routine,v,n,k,type) 
  73.                 if((v=(type**)alloc_routine(sizeof(type*)*(n)))!=NULL
  74.    &&(v[0]=(type*)alloc_routine(sizeof(type)*(n)*(k)))!=NULL)
  75.                      {int u__i; for(u__i=1; u__i < n; u__i++)
  76.                                 v[u__i] = &v[u__i-1][k];
  77.                      }
  78.                 else
  79.                         program_abort(__FILE__,"MEM_2ALLOC",0,__LINE__)
  80. #define MEM_FREE(free_routine, v) 
  81.     free_routine(v)
  82. #define MEM_2FREE(free_routine, v) 
  83.     if (1) { free_routine((v)[0]); free_routine(v); } else exit(1)
  84. /* lint-dependent macros. */
  85. #ifdef lint
  86. #define MALLOC(n)   (malloc((unsigned)(n)),NULL)
  87. #define VA_ARG(v,type) (v,(type)NULL)
  88. #else
  89. #define MALLOC(n)   malloc((unsigned)(n))
  90. #define VA_ARG(v,type) va_arg(v,type)
  91. #endif
  92. #endif /* #ifndef _spbstd_h */