typedefs.h
上传用户:csczyc
上传日期:2021-02-19
资源大小:1051k
文件大小:4k
源码类别:

语音压缩

开发平台:

C/C++

  1. /*
  2. 2.4 kbps MELP Proposed Federal Standard speech coder
  3. Fixed-point C code, version 1.0
  4. Copyright (c) 1998, 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. The fixed-point version of the voice codec Mixed Excitation Linear
  11. Prediction (MELP) is based on specifications on the C-language software
  12. simulation contained in GSM 06.06 which is protected by copyright and
  13. is the property of the European Telecommunications Standards Institute
  14. (ETSI). This standard is available from the ETSI publication office
  15. tel. +33 (0)4 92 94 42 58. ETSI has granted a license to United States
  16. Department of Defense to use the C-language software simulation contained
  17. in GSM 06.06 for the purposes of the development of a fixed-point
  18. version of the voice codec Mixed Excitation Linear Prediction (MELP).
  19. Requests for authorization to make other use of the GSM 06.06 or
  20. otherwise distribute or modify them need to be addressed to the ETSI
  21. Secretariat fax: +33 493 65 47 16.
  22. */
  23. /* typedef statements of types used in all routines */
  24. #include <stdio.h>
  25. #include <stdlib.h>
  26. #ifndef __TYPEDEFS
  27. #define __TYPEDEFS
  28. #define LW_SIGN (int)0x80000000//mark       /* sign bit */
  29. #define LW_MIN (int)0x80000000//mark
  30. #define LW_MAX (int)0x7fffffff//mark
  31. #define SW_SIGN (short)0x8000          /* sign bit for Shortword type */
  32. #define SW_MIN (short)0x8000           /* smallest Ram */
  33. #define SW_MAX (short)0x7fff           /* largest Ram */
  34. /* Definition of Types *
  35.  ***********************/
  36. typedef  int Longword;  //mark           /* 32 bit "accumulator" (L_*) */
  37. typedef short int Shortword;           /* 16 bit "register"  (sw*) */
  38. typedef short int ShortwordRom;        /* 16 bit ROM data    (sr*) */
  39. typedef  int LongwordRom;//mark          /* 32 bit ROM data    (L_r*)  */
  40. typedef unsigned short UShortword;     /* 16 bit unsigned data */
  41. typedef unsigned int ULongword; //mark      /* 32 bit unsigned data */
  42. struct NormSw {                        /* normalized Shortword fractional
  43.                                         * number snr.man precedes snr.sh
  44.                                         * (the shift count)i */
  45.   Shortword man;                       /* "mantissa" stored in 16 bit
  46.                                         * location */
  47.   Shortword sh;                        /* the shift count, stored in 16 bit
  48.                                         * location */
  49. };
  50. /* Global constants *
  51.  ********************/
  52. #define NP 10                          /* order of the lpc filter */
  53. #define N_SUB 4                        /* number of subframes */
  54. #define F_LEN 160                      /* number of samples in a frame */
  55. #define S_LEN 40                       /* number of samples in a subframe */
  56. #define A_LEN 170                      /* LPC analysis length */
  57. #define OS_FCTR 6                      /* maximum LTP lag oversampling
  58.                                         * factor */
  59. #define OVERHANG 8                      /* comfort noise parameter:
  60.    number of frames averaged to 
  61.    CN generate reference */
  62. #define OH_SHIFT 3                      /* shift corresponding to 
  63.    OVERHANG */
  64. #define PN_INIT_SEED (Longword)0x1091988L /* initial seed for Comfort
  65.      noise pn-generator */
  66. #define strStr strStr16
  67. /* global variables */
  68. /********************/
  69. extern int giFrmCnt;                   /* 0,1,2,3,4..... */
  70. extern int giSfrmCnt;                  /* 0,1,2,3 */
  71. extern int giOverflow;
  72. extern int giCarry;
  73. extern int giRandomRF;
  74. /* Primary comfort noise/DTX state variable */
  75. extern Shortword gswDTXFrmCnt; /* encoders DTX frame counter */
  76. extern Shortword gswLastDTXFrmCnt; /* gswDTXFrmCnt delayed by 1 frame */
  77. /* !! upd !! PHILIPS #1*/
  78. extern int giDTXon;   /* DTX Mode on/off */
  79. /* !! end of update !! PHILIPS #1 */
  80. extern int  giWriteFile;
  81. extern FILE *gfpUtil;
  82. #endif