Dirac - A Video Codec

Created by the British Broadcasting Corporation.


Public Member Functions | Private Member Functions | Private Attributes
dirac::ModeDecider Class Reference

Decides between superblock and block prediction modes. More...

#include <me_mode_decn.h>

Collaboration diagram for dirac::ModeDecider:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ModeDecider (const EncoderParams &encp)
 Constructor.
 ~ModeDecider ()
 Destructor.
void DoModeDecn (EncQueue &my_buffer, int pic_num)
 Does the actual mode decision.

Private Member Functions

 ModeDecider (const ModeDecider &cpy)
ModeDecideroperator= (const ModeDecider &rhs)
void DoSBDecn ()
void DoLevelDecn (int level)
 Make a mode decision given a particular level of decomposition.
float DoUnitDecn (const int xpos, const int ypos, const int level)
 Decide on a mode for a given prediction unit (block, sub-SB or SB)
void DoME (const int xpos, const int ypos, const int level)
 Do motion estimation for a prediction unit at a given level.
float ModeCost (const int xindex, const int yindex)
 Return a measure of the cost of coding a given mode.
ValueType GetDCPred (int xblock, int yblock)
 Get a prediction for the dc value of a block.
float GetDCVar (const ValueType dc_val, const ValueType dc_pred)
 Get a measure of DC value variance.
void SetDC (EncQueue &my_buffer, int pic_num)
 Go through all the intra blocks and extract the chroma dc values to be coded.
void SetDC (const PicArray &pic_data, MEData &me_data, CompSort cs)
 Called by previous fn for each component.
ValueType GetBlockDC (const PicArray &pic_data, int xloc, int yloc, int split, CompSort cs)
 Called by previous fn for each block.

Private Attributes

PictureSort m_psort
const EncoderParamsm_encparams
 A local reference to the encoder parameters.
const PicturePredParamsm_predparams
 A local pointer to the picture prediction params.
float m_lambda
 The Lagrangian parameter for motion estimation.
OneDArray< float > m_level_factor
 Correction factor for comparing SAD costs for different SB splittings.
OneDArray< float > m_mode_factor
 Correction factor for comparing mode costs for different SB splittings.
OneDArray< MEData * > m_me_data_set
 Motion vector data for each level of splitting.
const PicArraym_pic_data
const PicArraym_ref1_updata
const PicArraym_ref2_updata
int num_refs
IntraBlockDiffm_intradiff
BiBlockDiffm_bicheckdiff
int m_xsb_loc
int m_ysb_loc

Detailed Description

Loops over all the superblocks and decides on the best modes. A superblock is a square of 16 blocks. There are three possible splitting levels: level 0 means the superblock is considered as a single block; level 1 means the superblock is considered as 4 larger blocks, termed sub-superblocks; level 0 means the superblock is split right down to blocks.

In deciding which modes to adopt, the ModeDecider object calculates costs for all permutations, doing motion estimation for the level 1 and level 0 modes as these have not been calculated before. The process of decision for each is as follows. For each SB, we loop over the levels, and call DoLevelDecn. DoLevelDecn does motion estimation if it's necessary. Then it assumes that we don't have a common block mode and calls DoUnitDecn which finds the best mode for each unit in the SB at that level, individually. When we've got a best cost for that level we go up to the next one.


Constructor & Destructor Documentation

dirac::ModeDecider::ModeDecider ( const EncoderParams encp)

The constructor creates arrays for handling the motion vector data at splitting levels 0 and 1, as motion estimation must be performed for these levels.

dirac::ModeDecider::~ModeDecider ( )

The destructor destroys the classes created in the constructor

dirac::ModeDecider::ModeDecider ( const ModeDecider cpy)
private

Member Function Documentation

void dirac::ModeDecider::DoLevelDecn ( int  level)
private
void dirac::ModeDecider::DoME ( const int  xpos,
const int  ypos,
const int  level 
)
private
void dirac::ModeDecider::DoModeDecn ( EncQueue my_buffer,
int  pic_num 
)

Does the mode decision

Parameters:
my_bufferthe buffer of all the relevant frames
pic_numthe picture number for which motion estimation is being done
void dirac::ModeDecider::DoSBDecn ( )
private
float dirac::ModeDecider::DoUnitDecn ( const int  xpos,
const int  ypos,
const int  level 
)
private
ValueType dirac::ModeDecider::GetBlockDC ( const PicArray pic_data,
int  xloc,
int  yloc,
int  split,
CompSort  cs 
)
private
ValueType dirac::ModeDecider::GetDCPred ( int  xblock,
int  yblock 
)
private
float dirac::ModeDecider::GetDCVar ( const ValueType  dc_val,
const ValueType  dc_pred 
)
private
float dirac::ModeDecider::ModeCost ( const int  xindex,
const int  yindex 
)
private
ModeDecider& dirac::ModeDecider::operator= ( const ModeDecider rhs)
private
void dirac::ModeDecider::SetDC ( EncQueue my_buffer,
int  pic_num 
)
private
void dirac::ModeDecider::SetDC ( const PicArray pic_data,
MEData me_data,
CompSort  cs 
)
private

Member Data Documentation

BiBlockDiff* dirac::ModeDecider::m_bicheckdiff
private
const EncoderParams& dirac::ModeDecider::m_encparams
private
IntraBlockDiff* dirac::ModeDecider::m_intradiff
private
float dirac::ModeDecider::m_lambda
private
OneDArray<float> dirac::ModeDecider::m_level_factor
private
OneDArray< MEData* > dirac::ModeDecider::m_me_data_set
private
OneDArray<float> dirac::ModeDecider::m_mode_factor
private
const PicArray* dirac::ModeDecider::m_pic_data
private
const PicturePredParams* dirac::ModeDecider::m_predparams
private
PictureSort dirac::ModeDecider::m_psort
private
const PicArray* dirac::ModeDecider::m_ref1_updata
private
const PicArray* dirac::ModeDecider::m_ref2_updata
private
int dirac::ModeDecider::m_xsb_loc
private
int dirac::ModeDecider::m_ysb_loc
private
int dirac::ModeDecider::num_refs
private

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

© 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.