Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.2 KiB

  1. /* Copyright (C) 2002 Jean-Marc Valin
  2. File: vbr.h
  3. VBR-related routines
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions
  6. are met:
  7. - Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. - Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. - Neither the name of the Xiph.org Foundation nor the names of its
  13. contributors may be used to endorse or promote products derived from
  14. this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  16. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  17. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  18. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
  19. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  20. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  22. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  23. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  24. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifndef VBR_H
  28. #define VBR_H
  29. #define VBR_MEMORY_SIZE 5
  30. extern float vbr_nb_thresh[9][11];
  31. extern float vbr_hb_thresh[5][11];
  32. extern float vbr_uhb_thresh[2][11];
  33. typedef struct VBRState {
  34. float energy_alpha;
  35. float average_energy;
  36. float last_energy;
  37. float last_log_energy[VBR_MEMORY_SIZE];
  38. float accum_sum;
  39. float last_pitch_coef;
  40. float soft_pitch;
  41. float last_quality;
  42. float noise_level;
  43. float noise_accum;
  44. float noise_accum_count;
  45. int consec_noise;
  46. } VBRState;
  47. void vbr_init(VBRState *vbr);
  48. float vbr_analysis(VBRState *vbr, float *sig, int len, int pitch, float pitch_coef);
  49. void vbr_destroy(VBRState *vbr);
  50. #endif