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