Home | History | Annotate | Download | only in lib
      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 
     13  function: bitrate tracking and management
     14  last mod: $Id: bitrate.h 13293 2007-07-24 00:09:47Z xiphmont $
     15 
     16  ********************************************************************/
     17 
     18 #ifndef _V_BITRATE_H_
     19 #define _V_BITRATE_H_
     20 
     21 #include "vorbis/codec.h"
     22 #include "codec_internal.h"
     23 #include "os.h"
     24 
     25 /* encode side bitrate tracking */
     26 typedef struct bitrate_manager_state {
     27   int            managed;
     28 
     29   long           avg_reservoir;
     30   long           minmax_reservoir;
     31   long           avg_bitsper;
     32   long           min_bitsper;
     33   long           max_bitsper;
     34 
     35   long           short_per_long;
     36   double         avgfloat;
     37 
     38   vorbis_block  *vb;
     39   int            choice;
     40 } bitrate_manager_state;
     41 
     42 typedef struct bitrate_manager_info{
     43   long           avg_rate;
     44   long           min_rate;
     45   long           max_rate;
     46   long           reservoir_bits;
     47   double         reservoir_bias;
     48 
     49   double         slew_damp;
     50 
     51 } bitrate_manager_info;
     52 
     53 extern void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bs);
     54 extern void vorbis_bitrate_clear(bitrate_manager_state *bs);
     55 extern int vorbis_bitrate_managed(vorbis_block *vb);
     56 extern int vorbis_bitrate_addblock(vorbis_block *vb);
     57 extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op);
     58 
     59 #endif
     60