bitrate.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. ********************************************************************/
  14. #ifndef _V_BITRATE_H_
  15. #define _V_BITRATE_H_
  16. #include "vorbis/codec.h"
  17. #include "codec_internal.h"
  18. #include "os.h"
  19. /* encode side bitrate tracking */
  20. typedef struct bitrate_manager_state {
  21. int managed;
  22. long avg_reservoir;
  23. long minmax_reservoir;
  24. long avg_bitsper;
  25. long min_bitsper;
  26. long max_bitsper;
  27. long short_per_long;
  28. double avgfloat;
  29. vorbis_block *vb;
  30. int choice;
  31. } bitrate_manager_state;
  32. typedef struct bitrate_manager_info{
  33. long avg_rate;
  34. long min_rate;
  35. long max_rate;
  36. long reservoir_bits;
  37. double reservoir_bias;
  38. double slew_damp;
  39. } bitrate_manager_info;
  40. extern void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bs);
  41. extern void vorbis_bitrate_clear(bitrate_manager_state *bs);
  42. extern int vorbis_bitrate_managed(vorbis_block *vb);
  43. extern int vorbis_bitrate_addblock(vorbis_block *vb);
  44. extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op);
  45. #endif