Doxygen Source Code Documentation
rate.h
Go to the documentation of this file.00001 /*===========================================================================* 00002 * rate.h * 00003 * * 00004 * Procedures concerned with rate control 00005 * * 00006 * EXPORTED PROCEDURES: * 00007 * getRateMode() 00008 * setBitRate() 00009 * getBitRate() 00010 * setBufferSize() 00011 * getBufferSize() 00012 * initRateControl() 00013 * targetRateControl() 00014 * updateRateControl() 00015 * MB_RateOut() 00016 * * 00017 *===========================================================================*/ 00018 00019 /* COPYRIGHT INFO HERE */ 00020 00021 #define VARIABLE_RATE 0 00022 #define FIXED_RATE 1 00023 00024 00025 /*==================* 00026 * Exported VARIABLES * 00027 *==================*/ 00028 00029 00030 extern int rc_bitsThisMB; 00031 extern int rc_numBlocks; 00032 extern int rc_totalQuant; 00033 extern int rc_quantOverride; 00034 00035 00036 /*=====================* 00037 * EXPORTED PROCEDURES * 00038 *=====================*/ 00039 00040 /*===========================================================================* 00041 * 00042 * initRateControl 00043 * 00044 * initialize the allocation parameters. 00045 *===========================================================================*/ 00046 extern int initRateControl _ANSI_ARGS_((void)); 00047 00048 00049 /*===========================================================================* 00050 * 00051 * targetRateControl 00052 * 00053 * Determine the target allocation for given picture type. 00054 * 00055 * RETURNS: target size in bits 00056 *===========================================================================*/ 00057 extern void targetRateControl _ANSI_ARGS_((MpegFrame *frame)); 00058 00059 00060 /*===========================================================================* 00061 * 00062 * MB_RateOut 00063 * 00064 * Prints out sampling of MB rate control data. Every "nth" block 00065 * stats are printed, with "n" controled by global RC_MB_SAMPLE_RATE 00066 * 00067 * RETURNS: nothing 00068 *===========================================================================*/ 00069 extern void MB_RateOut _ANSI_ARGS_((int type)); 00070 00071 00072 /*===========================================================================* 00073 * 00074 * updateRateControl 00075 * 00076 * Update the statistics kept, after end of frame 00077 * 00078 * RETURNS: nothing 00079 * 00080 * SIDE EFFECTS: many global variables 00081 *===========================================================================*/ 00082 extern void updateRateControl _ANSI_ARGS_((int type)); 00083 00084 00085 /*===========================================================================* 00086 * 00087 * needQScaleChange(current Q scale, 4 luminance blocks) 00088 * 00089 * 00090 * RETURNS: new Qscale 00091 *===========================================================================*/ 00092 extern int needQScaleChange _ANSI_ARGS_((int oldQScale, Block blk0, Block blk1, Block blk2, Block blk3)); 00093 00094 /*===========================================================================* 00095 * 00096 * incNumBlocks() 00097 * 00098 * 00099 * RETURNS: nothing 00100 *===========================================================================*/ 00101 extern void incNumBlocks _ANSI_ARGS_((int num)); 00102 00103 00104 /*===========================================================================* 00105 * 00106 * incMacroBlockBits() 00107 * 00108 * Increments the number of Macro Block bits and the total of Frame 00109 * bits by the number passed. 00110 * 00111 * RETURNS: nothing 00112 *===========================================================================*/ 00113 extern void incMacroBlockBits _ANSI_ARGS_((int num)); 00114 00115 00116 /*===========================================================================* 00117 * 00118 * SetRateControl () 00119 * 00120 * Checks the string parsed from the parameter file. Verifies 00121 * number and sets global values. 00122 * 00123 * RETURNS: nothing 00124 *===========================================================================*/ 00125 extern void SetRateControl _ANSI_ARGS_((char *charPtr)); 00126 00127 00128 /*===========================================================================* 00129 * 00130 * setBufferSize () 00131 * 00132 * Checks the string parsed from the parameter file. Verifies 00133 * number and sets global values. 00134 * 00135 * RETURNS: nothing 00136 *===========================================================================*/ 00137 extern void setBufferSize _ANSI_ARGS_((char *charPtr)); 00138 00139 00140 /*===========================================================================* 00141 * 00142 * getBufferSize () 00143 * 00144 * returns the buffer size read from the parameter file. Size is 00145 * in bits- not in units of 16k as written to the sequence header. 00146 * 00147 * RETURNS: int (or -1 if invalid) 00148 *===========================================================================*/ 00149 extern int getBufferSize _ANSI_ARGS_((void)); 00150 00151 00152 /*===========================================================================* 00153 * 00154 * setBitRate () 00155 * 00156 * Checks the string parsed from the parameter file. Verifies 00157 * number and sets global values. 00158 * 00159 * RETURNS: nothing 00160 * 00161 * SIDE EFFECTS: global variables 00162 *===========================================================================*/ 00163 extern void setBitRate _ANSI_ARGS_((char *charPtr)); 00164 00165 00166 /*===========================================================================* 00167 * 00168 * getBitRate () 00169 * 00170 * Returns the bit rate read from the parameter file. This is the 00171 * real rate in bits per second, not in 400 bit units as is written to 00172 * the sequence header. 00173 * 00174 * RETURNS: int (-1 if Variable mode operation) 00175 *===========================================================================*/ 00176 extern int getBitRate _ANSI_ARGS_((void)); 00177 00178 00179 /*===========================================================================* 00180 * 00181 * getRateMode () 00182 * 00183 * Returns the rate mode- interpreted waa either Fixed or Variable 00184 * 00185 * RETURNS: integer 00186 *===========================================================================*/ 00187 extern int getRateMode _ANSI_ARGS_((void)); 00188 00189 00190 /*===========================================================================* 00191 * 00192 * incQuantOverride() 00193 * 00194 * counter of override of quantization 00195 * 00196 * RETURNS: nothing 00197 *===========================================================================*/ 00198 extern void incQuantOverride _ANSI_ARGS_((int num)); 00199