encoder.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * encoder.h include file
  3. *
  4. * Copyright (c) 2000 Mark Taylor
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef LAME_ENCODER_H
  22. #define LAME_ENCODER_H
  23. /***********************************************************************
  24. *
  25. * encoder and decoder delays
  26. *
  27. ***********************************************************************/
  28. /*
  29. * layer III enc->dec delay: 1056 (1057?) (observed)
  30. * layer II enc->dec delay: 480 (481?) (observed)
  31. *
  32. * polyphase 256-16 (dec or enc) = 240
  33. * mdct 256+32 (9*32) (dec or enc) = 288
  34. * total: 512+16
  35. *
  36. * My guess is that delay of polyphase filterbank is actualy 240.5
  37. * (there are technical reasons for this, see postings in mp3encoder).
  38. * So total Encode+Decode delay = ENCDELAY + 528 + 1
  39. */
  40. /*
  41. * ENCDELAY The encoder delay.
  42. *
  43. * Minimum allowed is MDCTDELAY (see below)
  44. *
  45. * The first 96 samples will be attenuated, so using a value less than 96
  46. * will result in corrupt data for the first 96-ENCDELAY samples.
  47. *
  48. * suggested: 576
  49. * set to 1160 to sync with FhG.
  50. */
  51. #define ENCDELAY 576
  52. /*
  53. * delay of the MDCT used in mdct.c
  54. * original ISO routines had a delay of 528!
  55. * Takehiro's routines:
  56. */
  57. #define MDCTDELAY 48
  58. #define FFTOFFSET (224+MDCTDELAY)
  59. /*
  60. * Most decoders, including the one we use, have a delay of 528 samples.
  61. */
  62. #define DECDELAY 528
  63. /* number of subbands */
  64. #define SBLIMIT 32
  65. /* parition bands bands */
  66. #define CBANDS 64
  67. /* number of critical bands/scale factor bands where masking is computed*/
  68. #define SBPSY_l 21
  69. #define SBPSY_s 12
  70. /* total number of scalefactor bands encoded */
  71. #define SBMAX_l 22
  72. #define SBMAX_s 13
  73. /* FFT sizes */
  74. #define BLKSIZE 1024
  75. #define HBLKSIZE (BLKSIZE/2 + 1)
  76. #define BLKSIZE_s 256
  77. #define HBLKSIZE_s (BLKSIZE_s/2 + 1)
  78. /* #define switch_pe 1800 */
  79. #define NORM_TYPE 0
  80. #define START_TYPE 1
  81. #define SHORT_TYPE 2
  82. #define STOP_TYPE 3
  83. /*
  84. * Mode Extention:
  85. * When we are in stereo mode, there are 4 possible methods to store these
  86. * two channels. The stereo modes -m? are using a subset of them.
  87. *
  88. * -ms: MPG_MD_LR_LR
  89. * -mj: MPG_MD_LR_LR and MPG_MD_MS_LR
  90. * -mf: MPG_MD_MS_LR
  91. * -mi: all
  92. */
  93. #define MPG_MD_LR_LR 0
  94. #define MPG_MD_LR_I 1
  95. #define MPG_MD_MS_LR 2
  96. #define MPG_MD_MS_I 3
  97. #include "machine.h"
  98. #include "lame.h"
  99. int lame_encode_mp3_frame (
  100. lame_global_flags* const gfp,
  101. sample_t* inbuf_l,
  102. sample_t* inbuf_r,
  103. unsigned char* mp3buf,
  104. int mp3buf_size );
  105. #endif /* LAME_ENCODER_H */