lame_global_flags.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #ifndef LAME_GLOBAL_FLAGS_H
  2. #define LAME_GLOBAL_FLAGS_H
  3. #ifndef lame_internal_flags_defined
  4. #define lame_internal_flags_defined
  5. struct lame_internal_flags;
  6. typedef struct lame_internal_flags lame_internal_flags;
  7. #endif
  8. typedef enum short_block_e {
  9. short_block_not_set = -1, /* allow LAME to decide */
  10. short_block_allowed = 0, /* LAME may use them, even different block types for L/R */
  11. short_block_coupled, /* LAME may use them, but always same block types in L/R */
  12. short_block_dispensed, /* LAME will not use short blocks, long blocks only */
  13. short_block_forced /* LAME will not use long blocks, short blocks only */
  14. } short_block_t;
  15. /***********************************************************************
  16. *
  17. * Control Parameters set by User. These parameters are here for
  18. * backwards compatibility with the old, non-shared lib API.
  19. * Please use the lame_set_variablename() functions below
  20. *
  21. *
  22. ***********************************************************************/
  23. struct lame_global_struct {
  24. unsigned int class_id;
  25. /* input description */
  26. unsigned long num_samples; /* number of samples. default=2^32-1 */
  27. int num_channels; /* input number of channels. default=2 */
  28. int samplerate_in; /* input_samp_rate in Hz. default=44.1 kHz */
  29. int samplerate_out; /* output_samp_rate.
  30. default: LAME picks best value
  31. at least not used for MP3 decoding:
  32. Remember 44.1 kHz MP3s and AC97 */
  33. float scale; /* scale input by this amount before encoding
  34. at least not used for MP3 decoding */
  35. float scale_left; /* scale input of channel 0 (left) by this
  36. amount before encoding */
  37. float scale_right; /* scale input of channel 1 (right) by this
  38. amount before encoding */
  39. /* general control params */
  40. int analysis; /* collect data for a MP3 frame analyzer? */
  41. int write_lame_tag; /* add Xing VBR tag? */
  42. int decode_only; /* use lame/mpglib to convert mp3 to wav */
  43. int quality; /* quality setting 0=best, 9=worst default=5 */
  44. MPEG_mode mode; /* see enum in lame.h
  45. default = LAME picks best value */
  46. int force_ms; /* force M/S mode. requires mode=1 */
  47. int free_format; /* use free format? default=0 */
  48. int findReplayGain; /* find the RG value? default=0 */
  49. int decode_on_the_fly; /* decode on the fly? default=0 */
  50. int write_id3tag_automatic; /* 1 (default) writes ID3 tags, 0 not */
  51. int nogap_total;
  52. int nogap_current;
  53. int substep_shaping;
  54. int noise_shaping;
  55. int subblock_gain; /* 0 = no, 1 = yes */
  56. int use_best_huffman; /* 0 = no. 1=outside loop 2=inside loop(slow) */
  57. /*
  58. * set either brate>0 or compression_ratio>0, LAME will compute
  59. * the value of the variable not set.
  60. * Default is compression_ratio = 11.025
  61. */
  62. int brate; /* bitrate */
  63. float compression_ratio; /* sizeof(wav file)/sizeof(mp3 file) */
  64. /* frame params */
  65. int copyright; /* mark as copyright. default=0 */
  66. int original; /* mark as original. default=1 */
  67. int extension; /* the MP3 'private extension' bit.
  68. Meaningless */
  69. int emphasis; /* Input PCM is emphased PCM (for
  70. instance from one of the rarely
  71. emphased CDs), it is STRONGLY not
  72. recommended to use this, because
  73. psycho does not take it into account,
  74. and last but not least many decoders
  75. don't care about these bits */
  76. int error_protection; /* use 2 bytes per frame for a CRC
  77. checksum. default=0 */
  78. int strict_ISO; /* enforce ISO spec as much as possible */
  79. int disable_reservoir; /* use bit reservoir? */
  80. /* quantization/noise shaping */
  81. int quant_comp;
  82. int quant_comp_short;
  83. int experimentalY;
  84. int experimentalZ;
  85. int exp_nspsytune;
  86. int preset;
  87. /* VBR control */
  88. vbr_mode VBR;
  89. float VBR_q_frac; /* Range [0,...,1[ */
  90. int VBR_q; /* Range [0,...,9] */
  91. int VBR_mean_bitrate_kbps;
  92. int VBR_min_bitrate_kbps;
  93. int VBR_max_bitrate_kbps;
  94. int VBR_hard_min; /* strictly enforce VBR_min_bitrate
  95. normaly, it will be violated for analog
  96. silence */
  97. /* resampling and filtering */
  98. int lowpassfreq; /* freq in Hz. 0=lame choses.
  99. -1=no filter */
  100. int highpassfreq; /* freq in Hz. 0=lame choses.
  101. -1=no filter */
  102. int lowpasswidth; /* freq width of filter, in Hz
  103. (default=15%) */
  104. int highpasswidth; /* freq width of filter, in Hz
  105. (default=15%) */
  106. /*
  107. * psycho acoustics and other arguments which you should not change
  108. * unless you know what you are doing
  109. */
  110. float maskingadjust;
  111. float maskingadjust_short;
  112. int ATHonly; /* only use ATH */
  113. int ATHshort; /* only use ATH for short blocks */
  114. int noATH; /* disable ATH */
  115. int ATHtype; /* select ATH formula */
  116. float ATHcurve; /* change ATH formula 4 shape */
  117. float ATH_lower_db; /* lower ATH by this many db */
  118. int athaa_type; /* select ATH auto-adjust scheme */
  119. float athaa_sensitivity; /* dB, tune active region of auto-level */
  120. short_block_t short_blocks;
  121. int useTemporal; /* use temporal masking effect */
  122. float interChRatio;
  123. float msfix; /* Naoki's adjustment of Mid/Side maskings */
  124. int tune; /* 0 off, 1 on */
  125. float tune_value_a; /* used to pass values for debugging and stuff */
  126. float attackthre; /* attack threshold for L/R/M channel */
  127. float attackthre_s; /* attack threshold for S channel */
  128. struct {
  129. void (*msgf) (const char *format, va_list ap);
  130. void (*debugf) (const char *format, va_list ap);
  131. void (*errorf) (const char *format, va_list ap);
  132. } report;
  133. /************************************************************************/
  134. /* internal variables, do not set... */
  135. /* provided because they may be of use to calling application */
  136. /************************************************************************/
  137. int lame_allocated_gfp; /* is this struct owned by calling
  138. program or lame? */
  139. /**************************************************************************/
  140. /* more internal variables are stored in this structure: */
  141. /**************************************************************************/
  142. lame_internal_flags *internal_flags;
  143. struct {
  144. int mmx;
  145. int amd3dnow;
  146. int sse;
  147. } asm_optimizations;
  148. };
  149. int is_lame_global_flags_valid(const lame_global_flags * gfp);
  150. #endif /* LAME_GLOBAL_FLAGS_H */