bitrate.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /********************************************************************
  2. * *
  3. * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
  4. * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
  5. * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  6. * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
  7. * *
  8. * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
  9. * by the Xiph.Org Foundation http://www.xiph.org/ *
  10. * *
  11. ********************************************************************
  12. function: bitrate tracking and management
  13. last mod: $Id$
  14. ********************************************************************/
  15. #ifndef _V_BITRATE_H_
  16. #define _V_BITRATE_H_
  17. #include "vorbis/codec.h"
  18. #include "codec_internal.h"
  19. #include "os.h"
  20. /* encode side bitrate tracking */
  21. typedef struct bitrate_manager_state {
  22. int managed;
  23. long avg_reservoir;
  24. long minmax_reservoir;
  25. long avg_bitsper;
  26. long min_bitsper;
  27. long max_bitsper;
  28. long short_per_long;
  29. double avgfloat;
  30. vorbis_block *vb;
  31. int choice;
  32. } bitrate_manager_state;
  33. typedef struct bitrate_manager_info{
  34. long avg_rate;
  35. long min_rate;
  36. long max_rate;
  37. long reservoir_bits;
  38. double reservoir_bias;
  39. double slew_damp;
  40. } bitrate_manager_info;
  41. extern void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bs);
  42. extern void vorbis_bitrate_clear(bitrate_manager_state *bs);
  43. extern int vorbis_bitrate_managed(vorbis_block *vb);
  44. extern int vorbis_bitrate_addblock(vorbis_block *vb);
  45. extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op);
  46. #endif