vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

bitrate.h (2710B)


      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-2002             *
      9  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
     10  *                                                                  *
     11  ********************************************************************
     12 
     13  function: bitrate tracking and management
     14  last mod: $Id: bitrate.h 1919 2005-07-24 14:18:04Z baford $
     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   ogg_uint32_t  *queue_binned;
     28   ogg_uint32_t  *queue_actual;
     29   int            queue_size;
     30 
     31   int            queue_head;
     32   int            queue_bins;
     33 
     34   long          *avg_binacc;
     35   int            avg_center;
     36   int            avg_tail;
     37   ogg_uint32_t   avg_centeracc;
     38   ogg_uint32_t   avg_sampleacc;
     39   ogg_uint32_t   avg_sampledesired;
     40   ogg_uint32_t   avg_centerdesired;
     41 
     42   long          *minmax_binstack;
     43   long          *minmax_posstack;
     44   long          *minmax_limitstack;
     45   long           minmax_stackptr;
     46 
     47   long           minmax_acctotal;
     48   int            minmax_tail;
     49   ogg_uint32_t   minmax_sampleacc;
     50   ogg_uint32_t   minmax_sampledesired;
     51 
     52   int            next_to_flush;
     53   int            last_to_flush;
     54   
     55   double         avgfloat;
     56 
     57   /* unfortunately, we need to hold queued packet data somewhere */
     58   oggpack_buffer *packetbuffers;
     59   ogg_packet     *packets;
     60 
     61 } bitrate_manager_state;
     62 
     63 typedef struct bitrate_manager_info{
     64   /* detailed bitrate management setup */
     65   double queue_avg_time;
     66   double queue_avg_center;
     67   double queue_minmax_time;
     68   double queue_hardmin;
     69   double queue_hardmax;
     70   double queue_avgmin;
     71   double queue_avgmax;
     72 
     73   double avgfloat_downslew_max;
     74   double avgfloat_upslew_max;
     75 
     76 } bitrate_manager_info;
     77 
     78 extern void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bs);
     79 extern void vorbis_bitrate_clear(bitrate_manager_state *bs);
     80 extern int vorbis_bitrate_managed(vorbis_block *vb);
     81 extern int vorbis_bitrate_addblock(vorbis_block *vb);
     82 extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op);
     83 
     84 #endif