1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
|
/*===========================================================================*
* rate.h *
* *
* Procedures concerned with rate control
* *
* EXPORTED PROCEDURES: *
* getRateMode()
* setBitRate()
* getBitRate()
* setBufferSize()
* getBufferSize()
* initRateControl()
* targetRateControl()
* updateRateControl()
* MB_RateOut()
* *
*===========================================================================*/
/* COPYRIGHT INFO HERE */
#define VARIABLE_RATE 0
#define FIXED_RATE 1
/*==================*
* Exported VARIABLES *
*==================*/
extern int rc_bitsThisMB;
extern int rc_numBlocks;
extern int rc_totalQuant;
extern int rc_quantOverride;
/*=====================*
* EXPORTED PROCEDURES *
*=====================*/
/*===========================================================================*
*
* initRateControl
*
* initialize the allocation parameters.
*===========================================================================*/
extern int initRateControl _ANSI_ARGS_((void));
/*===========================================================================*
*
* targetRateControl
*
* Determine the target allocation for given picture type.
*
* RETURNS: target size in bits
*===========================================================================*/
extern void targetRateControl _ANSI_ARGS_((MpegFrame *frame));
/*===========================================================================*
*
* MB_RateOut
*
* Prints out sampling of MB rate control data. Every "nth" block
* stats are printed, with "n" controled by global RC_MB_SAMPLE_RATE
*
* RETURNS: nothing
*===========================================================================*/
extern void MB_RateOut _ANSI_ARGS_((int type));
/*===========================================================================*
*
* updateRateControl
*
* Update the statistics kept, after end of frame
*
* RETURNS: nothing
*
* SIDE EFFECTS: many global variables
*===========================================================================*/
extern void updateRateControl _ANSI_ARGS_((int type));
/*===========================================================================*
*
* needQScaleChange(current Q scale, 4 luminance blocks)
*
*
* RETURNS: new Qscale
*===========================================================================*/
extern int needQScaleChange _ANSI_ARGS_((int oldQScale, Block blk0, Block blk1, Block blk2, Block blk3));
/*===========================================================================*
*
* incNumBlocks()
*
*
* RETURNS: nothing
*===========================================================================*/
extern void incNumBlocks _ANSI_ARGS_((int num));
/*===========================================================================*
*
* incMacroBlockBits()
*
* Increments the number of Macro Block bits and the total of Frame
* bits by the number passed.
*
* RETURNS: nothing
*===========================================================================*/
extern void incMacroBlockBits _ANSI_ARGS_((int num));
/*===========================================================================*
*
* SetRateControl ()
*
* Checks the string parsed from the parameter file. Verifies
* number and sets global values.
*
* RETURNS: nothing
*===========================================================================*/
extern void SetRateControl _ANSI_ARGS_((char *charPtr));
/*===========================================================================*
*
* setBufferSize ()
*
* Checks the string parsed from the parameter file. Verifies
* number and sets global values.
*
* RETURNS: nothing
*===========================================================================*/
extern void setBufferSize _ANSI_ARGS_((char *charPtr));
/*===========================================================================*
*
* getBufferSize ()
*
* returns the buffer size read from the parameter file. Size is
* in bits- not in units of 16k as written to the sequence header.
*
* RETURNS: int (or -1 if invalid)
*===========================================================================*/
extern int getBufferSize _ANSI_ARGS_((void));
/*===========================================================================*
*
* setBitRate ()
*
* Checks the string parsed from the parameter file. Verifies
* number and sets global values.
*
* RETURNS: nothing
*
* SIDE EFFECTS: global variables
*===========================================================================*/
extern void setBitRate _ANSI_ARGS_((char *charPtr));
/*===========================================================================*
*
* getBitRate ()
*
* Returns the bit rate read from the parameter file. This is the
* real rate in bits per second, not in 400 bit units as is written to
* the sequence header.
*
* RETURNS: int (-1 if Variable mode operation)
*===========================================================================*/
extern int getBitRate _ANSI_ARGS_((void));
/*===========================================================================*
*
* getRateMode ()
*
* Returns the rate mode- interpreted waa either Fixed or Variable
*
* RETURNS: integer
*===========================================================================*/
extern int getRateMode _ANSI_ARGS_((void));
/*===========================================================================*
*
* incQuantOverride()
*
* counter of override of quantization
*
* RETURNS: nothing
*===========================================================================*/
extern void incQuantOverride _ANSI_ARGS_((int num));
|