# 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>`

Collaboration diagram for dirac::RateController:

[legend]

List of all members.

## Public Member Functions

- RateController (int trate, SourceParams &srcp, EncoderParams &encp)
    Default constructor.
- void CalcNextQualFactor (const FrameParams &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.
- double IntraQualFactor ()
    Return I frame qf.
- double QualFactor ()
    Return qf.

## Private Member Functions

- double TargetSubgroupRate ()
- double ProjectedSubgroupRate ()
- void Allocate ()
    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 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 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.
- const int m_target_rate
    Target bit rate in kbps.
- int m_Iframe_bits
    Number of bits for I frame.
- int m_L1frame_bits
    Number of bits for L1 frame.
- 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.
- int m_total_GOP_bits
    Total Number of bits in a GOP.
- int m_picture_bits
    Mean number of bits in a picture.
- const int m_buffer_size
    Size of the decoded bit buffer.
- int m_buffer_bits
    Number of bits in the buffer.
- int m_current_GOP_bits
    The Number of bits currently left for allocating the remaining frames in a 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::CalcNextQualFactor | ( | const FrameParams & | fparams,
|  | int | num_bits |
| ) |  |  |

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

double dirac::RateController::IntraQualFactor | ( |  | ) | `[inline]`

References m_I_qf.

double dirac::RateController::QualFactor | ( |  | ) | `[inline]`

References m_qf.

double dirac::RateController::TargetSubgroupRate | ( |  | ) | `[private]`

double dirac::RateController::ProjectedSubgroupRate | ( |  | ) | `[private]`

void dirac::RateController::Allocate | ( |  | ) | `[private]`

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

void dirac::RateController::SetIntraQualFactor | ( | double | value | ) | `[inline, private]`

References m_I_qf.

void dirac::RateController::SetFrameDistribution | ( |  | ) | `[private]`

float dirac::RateController::ReviewQualityFactor | ( | const float | qfac,
|  | const int | num_bits |
| ) |  |  | `[private]`

float dirac::RateController::ClipQualityFactor | ( | const float | qfac | ) | `[private]`

void dirac::RateController::UpdateBuffer | ( | const int | num_bits | ) | `[private]`

## Member Data Documentation

double dirac::RateController::m_qf`[private]`

Referenced by QualFactor().

double dirac::RateController::m_I_qf`[private]`

Referenced by IntraQualFactor(), and SetIntraQualFactor().

const int dirac::RateController::m_target_rate`[private]`

int dirac::RateController::m_Iframe_bits`[private]`

int dirac::RateController::m_L1frame_bits`[private]`

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]`

int dirac::RateController::m_total_GOP_bits`[private]`

int dirac::RateController::m_picture_bits`[private]`

const int dirac::RateController::m_buffer_size`[private]`

int dirac::RateController::m_buffer_bits`[private]`

int dirac::RateController::m_current_GOP_bits`[private]`

double dirac::RateController::m_GOP_duration`[private]`

EncoderParams& dirac::RateController::m_encparams`[private]`

FrameComplexity dirac::RateController::m_frame_complexity`[private]`

int dirac::RateController::m_fcount`[private]`

bool dirac::RateController::m_intra_only`[private]`

int dirac::RateController::m_L2_complexity_sum`[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.