# Dirac - A Video Codec

Created by the British Broadcasting Corporation.

# dirac::RateController Class Reference

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

`#include <rate_control.h>`

List of all members.

## Public Member Functions

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

## Private Member Functions

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

## Private Attributes

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