# Dirac - A Video Codec

Created by the British Broadcasting Corporation.

Public Member Functions | Private Member Functions | Private Attributes | List of all members
dirac::RateController Class Reference

A clas for allocation the bits to each and every types of frames in a GOP.

`#include <rate_control.h>`

## Public Member Functions
| RateController (int trate, SourceParams &srcp, EncoderParams &encp)
| Default constructor. More...
void | CalcNextQualFactor (const PictureParams &fparams, int num_bits)
| Calculate the Quality factor of the next frame to encode. More...
void | CalcNextIntraQualFactor ()
| Calculate the Quality factor of the next I frame to encode. More...
void | SetCutPictureQualFactor ()
| Use the long-term average intra quality factor. More...
double | IntraQualFactor ()
| Return I frame qf. More...
double | QualFactor ()
| Return qf. More...
void | Report ()
| Report the allocation to picture types. More...

## Private Member Functions
double | TargetSubgroupRate ()
double | ProjectedSubgroupRate ()
void | Allocate (const int fnum)
| Allocate the bits to each type of frame in a GOP. More...
void | CalcTotalBits (const SourceParams &sourceparams)
| Calculate the total number of bits in a GOP. More...
void | SetIntraQualFactor (double value)
| Set the value of Current IQF. More...
void | SetFrameDistribution ()
| Set the number of I, L1 and L2 frames in the GOP. More...
float | ReviewQualityFactor (const float qfac, const long int num_bits)
| Review the quality factor to make sure it's being set sensibly. More...
float | ClipQualityFactor (const float qfac)
| Clip the quality factor to something sensible. More...
void | UpdateBuffer (const long int num_bits)
| Update the internal decoder buffer model. More...

## Private Attributes
double | m_qf
| Current Quality Factor. More...
double | m_I_qf
| I frame Quality Factor. More...
double | m_I_qf_long_term
| Long-term average of I frame Quality Factor. More...
const int | m_target_rate
| Target bit rate in kbps. More...
long int | m_Iframe_bits
| Number of bits for I frame. More...
long int | m_L1frame_bits
| Number of bits for L1 frame. More...
long int | m_L2frame_bits
| Number of bits for L2 frame. More...
int | m_num_Iframe
| Number of I frames. More...
int | m_num_L1frame
| Number of L1 frames. More...
int | m_num_L2frame
| Number of L2 frames. More...
long int | m_total_GOP_bits
| Total Number of bits in a GOP. More...
long int | m_picture_bits
| Mean number of bits in a picture. More...
const long int | m_buffer_size
| Size of the decoded bit buffer. More...
long int | m_buffer_bits
| Number of bits in the buffer. More...
long int | m_old_buffer_bits
| The old buffer occupancy. More...
double | m_buffer_rate_of_change
| The rate of change of buffer occupancy. More...
long int | m_GOP_target
| The target number of bits for the current GOP. More...
double | m_GOP_duration
| The duration of a GOP. More...
EncoderParams & | m_encparams
| A reference to the encoder parameters. More...
FrameComplexity | m_frame_complexity
| A class to hold the frame complexity object. More...
int | m_fcount
| A frame counter, giving the position within a subgroup. More...
bool | m_intra_only
int | m_L2_complexity_sum

## Constructor & Destructor Documentation

dirac::RateController::RateController | ( | int | trate,
|  | SourceParams & | srcp,
|  | EncoderParams & | encp
| ) |  |

## Member Function Documentation

void dirac::RateController::Allocate | ( | const int | fnum | ) |
| private

void dirac::RateController::CalcNextIntraQualFactor | ( |  | ) |

void dirac::RateController::CalcNextQualFactor | ( | const PictureParams & | fparams,
|  | int | num_bits
| ) |  |

void dirac::RateController::CalcTotalBits | ( | const SourceParams & | sourceparams | ) |
| private

float dirac::RateController::ClipQualityFactor | ( | const float | qfac | ) |
| private

double dirac::RateController::IntraQualFactor | ( |  | ) |
| inline

References m_I_qf.

double dirac::RateController::ProjectedSubgroupRate | ( |  | ) |
| private

double dirac::RateController::QualFactor | ( |  | ) |
| inline

References m_qf.

void dirac::RateController::Report | ( |  | ) |

float dirac::RateController::ReviewQualityFactor | ( | const float | qfac,
|  | const long int | num_bits
| ) |  |
| private

void dirac::RateController::SetCutPictureQualFactor | ( |  | ) |

void dirac::RateController::SetFrameDistribution | ( |  | ) |
| private

void dirac::RateController::SetIntraQualFactor | ( | double | value | ) |
| inline private

References m_I_qf.

double dirac::RateController::TargetSubgroupRate | ( |  | ) |
| private

void dirac::RateController::UpdateBuffer | ( | const long int | num_bits | ) |
| private

## Member Data Documentation

long int dirac::RateController::m_buffer_bits
| private

double dirac::RateController::m_buffer_rate_of_change
| private

const long int dirac::RateController::m_buffer_size
| private

EncoderParams& dirac::RateController::m_encparams
| private

int dirac::RateController::m_fcount
| private

FrameComplexity dirac::RateController::m_frame_complexity
| private

double dirac::RateController::m_GOP_duration
| private

long int dirac::RateController::m_GOP_target
| private

double dirac::RateController::m_I_qf
| private

Referenced by IntraQualFactor(), and SetIntraQualFactor().

double dirac::RateController::m_I_qf_long_term
| private

long int dirac::RateController::m_Iframe_bits
| private

bool dirac::RateController::m_intra_only
| private

long int dirac::RateController::m_L1frame_bits
| private

int dirac::RateController::m_L2_complexity_sum
| private

long int dirac::RateController::m_L2frame_bits
| private

int dirac::RateController::m_num_Iframe
| private

int dirac::RateController::m_num_L1frame
| private

int dirac::RateController::m_num_L2frame
| private

long int dirac::RateController::m_old_buffer_bits
| private

long int dirac::RateController::m_picture_bits
| private

double dirac::RateController::m_qf
| private

Referenced by QualFactor().

const int dirac::RateController::m_target_rate
| private

long int dirac::RateController::m_total_GOP_bits
| private

The documentation for this class was generated from the following file:

- rate_control.h

© 2004 British Broadcasting Corporation. Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.