xoreos  0.0.5
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Video::Bink::BinkVideoTrack Class Reference
Inheritance diagram for Video::Bink::BinkVideoTrack:
Inheritance graph
[legend]
Collaboration diagram for Video::Bink::BinkVideoTrack:
Collaboration graph
[legend]

Classes

struct  Bundle
 Data structure used for decoding a single Bink data type. More...
 
struct  DecodeContext
 A decoder state. More...
 
struct  Huffman
 Data structure for decoding and translating Huffman'd data. More...
 

Public Member Functions

 BinkVideoTrack (uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, bool swapPlanes, bool hasAlpha, uint32 id)
 
uint32 getWidth () const
 
uint32 getHeight () const
 
int getCurFrame () const
 
int getFrameCount () const
 
void decodePacket (Graphics::Surface &surface, VideoFrame &frame)
 Decode a video packet. More...
 

Protected Member Functions

Common::Rational getFrameRate () const
 

Private Types

enum  Source {
  kSourceBlockTypes = 0, kSourceSubBlockTypes, kSourceColors, kSourcePattern,
  kSourceXOff, kSourceYOff, kSourceIntraDC, kSourceInterDC,
  kSourceRun, kSourceMAX
}
 IDs for different data types used in Bink video codec. More...
 
enum  BlockType {
  kBlockSkip = 0, kBlockScaled, kBlockMotion, kBlockRun,
  kBlockResidue, kBlockIntra, kBlockFill, kBlockInter,
  kBlockPattern, kBlockRaw
}
 Bink video block types. More...
 

Private Member Functions

void initBundles ()
 Initialize the bundles. More...
 
void initHuffman ()
 Initialize the Huffman decoders. More...
 
void videoPacket (VideoFrame &video)
 Decode a video packet. More...
 
void decodePlane (VideoFrame &video, int planeIdx, bool isChroma)
 Decode a plane. More...
 
void readBundle (VideoFrame &video, Source source)
 Read/Initialize a bundle for decoding a plane. More...
 
void readHuffman (VideoFrame &video, Huffman &huffman)
 Read the symbols for a Huffman code. More...
 
void mergeHuffmanSymbols (VideoFrame &video, byte *dst, const byte *src, int size)
 Merge two Huffman symbol lists. More...
 
byte getHuffmanSymbol (VideoFrame &video, Huffman &huffman)
 Read and translate a symbol out of a Huffman code. More...
 
int32 getBundleValue (Source source)
 Get a direct value out of a bundle. More...
 
uint32 readBundleCount (VideoFrame &video, Bundle &bundle)
 Read a count value out of a bundle. More...
 
void blockSkip (DecodeContext &ctx)
 
void blockScaledSkip (DecodeContext &ctx)
 
void blockScaledRun (DecodeContext &ctx)
 
void blockScaledIntra (DecodeContext &ctx)
 
void blockScaledFill (DecodeContext &ctx)
 
void blockScaledPattern (DecodeContext &ctx)
 
void blockScaledRaw (DecodeContext &ctx)
 
void blockScaled (DecodeContext &ctx)
 
void blockMotion (DecodeContext &ctx)
 
void blockRun (DecodeContext &ctx)
 
void blockResidue (DecodeContext &ctx)
 
void blockIntra (DecodeContext &ctx)
 
void blockFill (DecodeContext &ctx)
 
void blockInter (DecodeContext &ctx)
 
void blockPattern (DecodeContext &ctx)
 
void blockRaw (DecodeContext &ctx)
 
void readRuns (VideoFrame &video, Bundle &bundle)
 
void readMotionValues (VideoFrame &video, Bundle &bundle)
 
void readBlockTypes (VideoFrame &video, Bundle &bundle)
 
void readPatterns (VideoFrame &video, Bundle &bundle)
 
void readColors (VideoFrame &video, Bundle &bundle)
 
void readDCS (VideoFrame &video, Bundle &bundle, int startBits, bool hasSign)
 
void readDCTCoeffs (VideoFrame &video, int16 *block, bool isIntra)
 Reads 8x8 block of DCT coefficients. More...
 
void readResidue (VideoFrame &video, int16 *block, int masksCount)
 Reads 8x8 block with residue after motion compensation. More...
 
void IDCT (int16 *block)
 
void IDCTPut (DecodeContext &ctx, int16 *block)
 
void IDCTAdd (DecodeContext &ctx, int16 *block)
 

Private Attributes

uint32 _width
 
uint32 _height
 
int _curFrame
 Current Frame. More...
 
int _frameCount
 
Common::Rational _frameRate
 The frame rate of the video. More...
 
bool _swapPlanes
 Are the planes ordered (A)YVU instead of (A)YUV? More...
 
bool _hasAlpha
 Do video frames have alpha? More...
 
uint32 _id
 The BIK FourCC. More...
 
Bundle _bundles [kSourceMAX]
 Bundles for decoding all data types. More...
 
Common::ScopedPtr< Common::Huffman_huffman [16]
 The 16 Huffman codebooks used in Bink decoding. More...
 
Huffman _colHighHuffman [16]
 Huffman codebooks to use for decoding high nibbles in color data types. More...
 
int _colLastVal
 Value of the last decoded high nibble in color data types. More...
 
Common::ScopedArray< byte_curPlanes [4]
 The 4 color planes, YUVA, current frame. More...
 
Common::ScopedArray< byte_oldPlanes [4]
 The 4 color planes, YUVA, last frame. More...
 

Detailed Description

Definition at line 175 of file bink.h.

Member Enumeration Documentation

◆ BlockType

Bink video block types.

Enumerator
kBlockSkip 

Skipped block.

kBlockScaled 

Block has size 16x16.

kBlockMotion 

Block is copied from previous frame with some offset.

kBlockRun 

Block is composed from runs of colors with custom scan order.

kBlockResidue 

Motion block with some difference added.

kBlockIntra 

Intra DCT block.

kBlockFill 

Block is filled with single color.

kBlockInter 

Motion block with DCT applied to the difference.

kBlockPattern 

Block is filled with two colors following custom pattern.

kBlockRaw 

Uncoded 8x8 block.

Definition at line 231 of file bink.h.

◆ Source

IDs for different data types used in Bink video codec.

Enumerator
kSourceBlockTypes 

8x8 block types.

kSourceSubBlockTypes 

16x16 block types (a subset of 8x8 block types).

kSourceColors 

Pixel values used for different block types.

kSourcePattern 

8-bit values for 2-color pattern fill.

kSourceXOff 

X components of motion value.

kSourceYOff 

Y components of motion value.

kSourceIntraDC 

DC values for intrablocks with DCT.

kSourceInterDC 

DC values for interblocks with DCT.

kSourceRun 

Run lengths for special fill block.

kSourceMAX 

Definition at line 216 of file bink.h.

Constructor & Destructor Documentation

◆ BinkVideoTrack()

Video::Bink::BinkVideoTrack::BinkVideoTrack ( uint32  width,
uint32  height,
uint32  frameCount,
const Common::Rational frameRate,
bool  swapPlanes,
bool  hasAlpha,
uint32  id 
)

Definition at line 1608 of file bink.cpp.

References _curPlanes, _height, _oldPlanes, _width, initBundles(), initHuffman(), and Common::ScopedPtrBase< T, Deallocator >::reset().

Here is the call graph for this function:

Member Function Documentation

◆ blockFill()

void Video::Bink::BinkVideoTrack::blockFill ( DecodeContext ctx)
private

◆ blockInter()

void Video::Bink::BinkVideoTrack::blockInter ( DecodeContext ctx)
private

Definition at line 867 of file bink.cpp.

References Video::Bink::BinkVideoTrack::DecodeContext::video.

◆ blockIntra()

void Video::Bink::BinkVideoTrack::blockIntra ( DecodeContext ctx)
private

Definition at line 848 of file bink.cpp.

References Video::Bink::BinkVideoTrack::DecodeContext::video.

◆ blockMotion()

void Video::Bink::BinkVideoTrack::blockMotion ( DecodeContext ctx)
private

◆ blockPattern()

void Video::Bink::BinkVideoTrack::blockPattern ( DecodeContext ctx)
private

◆ blockRaw()

void Video::Bink::BinkVideoTrack::blockRaw ( DecodeContext ctx)
private

◆ blockResidue()

void Video::Bink::BinkVideoTrack::blockResidue ( DecodeContext ctx)
private

◆ blockRun()

void Video::Bink::BinkVideoTrack::blockRun ( DecodeContext ctx)
private

◆ blockScaled()

void Video::Bink::BinkVideoTrack::blockScaled ( DecodeContext ctx)
private

◆ blockScaledFill()

void Video::Bink::BinkVideoTrack::blockScaledFill ( DecodeContext ctx)
private

◆ blockScaledIntra()

void Video::Bink::BinkVideoTrack::blockScaledIntra ( DecodeContext ctx)
private

◆ blockScaledPattern()

void Video::Bink::BinkVideoTrack::blockScaledPattern ( DecodeContext ctx)
private

◆ blockScaledRaw()

void Video::Bink::BinkVideoTrack::blockScaledRaw ( DecodeContext ctx)
private

◆ blockScaledRun()

void Video::Bink::BinkVideoTrack::blockScaledRun ( DecodeContext ctx)
private

◆ blockScaledSkip()

void Video::Bink::BinkVideoTrack::blockScaledSkip ( DecodeContext ctx)
private

◆ blockSkip()

void Video::Bink::BinkVideoTrack::blockSkip ( DecodeContext ctx)
private

◆ decodePacket()

void Video::Bink::BinkVideoTrack::decodePacket ( Graphics::Surface surface,
VideoFrame frame 
)

◆ decodePlane()

void Video::Bink::BinkVideoTrack::decodePlane ( VideoFrame video,
int  planeIdx,
bool  isChroma 
)
private

Decode a plane.

Definition at line 239 of file bink.cpp.

References _height, _width, Video::Bink::VideoFrame::bits, kDCStartBits, Common::BitStream::pos(), Common::BitStream::skip(), and Video::Bink::BinkVideoTrack::DecodeContext::video.

Referenced by decodePacket().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBundleValue()

int32 Video::Bink::BinkVideoTrack::getBundleValue ( Source  source)
private

Get a direct value out of a bundle.

Definition at line 621 of file bink.cpp.

◆ getCurFrame()

int Video::Bink::BinkVideoTrack::getCurFrame ( ) const
inline

Definition at line 181 of file bink.h.

References _curFrame.

Referenced by Video::Bink::decodeNextTrackFrame().

Here is the caller graph for this function:

◆ getFrameCount()

int Video::Bink::BinkVideoTrack::getFrameCount ( ) const
inline

Definition at line 182 of file bink.h.

References _frameCount.

◆ getFrameRate()

Common::Rational Video::Bink::BinkVideoTrack::getFrameRate ( ) const
inlineprotected

Definition at line 188 of file bink.h.

References _frameRate.

◆ getHeight()

uint32 Video::Bink::BinkVideoTrack::getHeight ( ) const
inline

Definition at line 180 of file bink.h.

References _height.

◆ getHuffmanSymbol()

byte Video::Bink::BinkVideoTrack::getHuffmanSymbol ( VideoFrame video,
Huffman huffman 
)
private

Read and translate a symbol out of a Huffman code.

Definition at line 617 of file bink.cpp.

References Video::Bink::VideoFrame::bits, Video::Bink::BinkVideoTrack::Huffman::index, and Video::Bink::BinkVideoTrack::Huffman::symbols.

◆ getWidth()

uint32 Video::Bink::BinkVideoTrack::getWidth ( ) const
inline

Definition at line 179 of file bink.h.

References _width.

◆ IDCT()

void Video::Bink::BinkVideoTrack::IDCT ( int16 block)
private

Definition at line 1577 of file bink.cpp.

References IDCT_ROW, and Video::IDCTCol().

Here is the call graph for this function:

◆ IDCTAdd()

void Video::Bink::BinkVideoTrack::IDCTAdd ( DecodeContext ctx,
int16 block 
)
private

◆ IDCTPut()

void Video::Bink::BinkVideoTrack::IDCTPut ( DecodeContext ctx,
int16 block 
)
private

Definition at line 1598 of file bink.cpp.

References Video::Bink::BinkVideoTrack::DecodeContext::dest, IDCT_ROW, Video::IDCTCol(), and Video::Bink::BinkVideoTrack::DecodeContext::pitch.

Here is the call graph for this function:

◆ initBundles()

void Video::Bink::BinkVideoTrack::initBundles ( )
private

Initialize the bundles.

Definition at line 583 of file bink.cpp.

References _height, _width, and Common::intLog2().

Referenced by BinkVideoTrack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initHuffman()

void Video::Bink::BinkVideoTrack::initHuffman ( )
private

Initialize the Huffman decoders.

Definition at line 612 of file bink.cpp.

References binkHuffmanCodes, and binkHuffmanLengths.

Referenced by BinkVideoTrack().

Here is the caller graph for this function:

◆ mergeHuffmanSymbols()

void Video::Bink::BinkVideoTrack::mergeHuffmanSymbols ( VideoFrame video,
byte dst,
const byte src,
int  size 
)
private

Merge two Huffman symbol lists.

Definition at line 418 of file bink.cpp.

References Video::Bink::VideoFrame::bits, and Common::BitStream::getBit().

Here is the call graph for this function:

◆ readBlockTypes()

void Video::Bink::BinkVideoTrack::readBlockTypes ( VideoFrame video,
Bundle bundle 
)
private

◆ readBundle()

void Video::Bink::BinkVideoTrack::readBundle ( VideoFrame video,
Source  source 
)
private

Read/Initialize a bundle for decoding a plane.

Definition at line 349 of file bink.cpp.

◆ readBundleCount()

uint32 Video::Bink::BinkVideoTrack::readBundleCount ( VideoFrame video,
Bundle bundle 
)
private

◆ readColors()

void Video::Bink::BinkVideoTrack::readColors ( VideoFrame video,
Bundle bundle 
)
private

◆ readDCS()

void Video::Bink::BinkVideoTrack::readDCS ( VideoFrame video,
Bundle bundle,
int  startBits,
bool  hasSign 
)
private

Definition at line 1060 of file bink.cpp.

References Video::Bink::VideoFrame::bits, Video::Bink::BinkVideoTrack::Bundle::curDec, Common::BitStream::getBit(), and Common::BitStream::getBits().

Here is the call graph for this function:

◆ readDCTCoeffs()

void Video::Bink::BinkVideoTrack::readDCTCoeffs ( VideoFrame video,
int16 block,
bool  isIntra 
)
private

Reads 8x8 block of DCT coefficients.

Definition at line 1126 of file bink.cpp.

References binkInterQuant, binkIntraQuant, binkScan, Video::Bink::VideoFrame::bits, Video::dequant(), Common::BitStream::getBit(), Common::BitStream::getBits(), and XOREOS_FALLTHROUGH.

Here is the call graph for this function:

◆ readHuffman()

void Video::Bink::BinkVideoTrack::readHuffman ( VideoFrame video,
Huffman huffman 
)
private

◆ readMotionValues()

void Video::Bink::BinkVideoTrack::readMotionValues ( VideoFrame video,
Bundle bundle 
)
private

◆ readPatterns()

void Video::Bink::BinkVideoTrack::readPatterns ( VideoFrame video,
Bundle bundle 
)
private

◆ readResidue()

void Video::Bink::BinkVideoTrack::readResidue ( VideoFrame video,
int16 block,
int  masksCount 
)
private

Reads 8x8 block with residue after motion compensation.

Definition at line 1225 of file bink.cpp.

References binkScan, Video::Bink::VideoFrame::bits, Common::BitStream::getBit(), Common::BitStream::getBits(), and XOREOS_FALLTHROUGH.

Here is the call graph for this function:

◆ readRuns()

void Video::Bink::BinkVideoTrack::readRuns ( VideoFrame video,
Bundle bundle 
)
private

◆ videoPacket()

void Video::Bink::BinkVideoTrack::videoPacket ( VideoFrame video)
private

Decode a video packet.

Member Data Documentation

◆ _bundles

Bundle Video::Bink::BinkVideoTrack::_bundles[kSourceMAX]
private

Bundles for decoding all data types.

Definition at line 281 of file bink.h.

◆ _colHighHuffman

Huffman Video::Bink::BinkVideoTrack::_colHighHuffman[16]
private

Huffman codebooks to use for decoding high nibbles in color data types.

Definition at line 286 of file bink.h.

◆ _colLastVal

int Video::Bink::BinkVideoTrack::_colLastVal
private

Value of the last decoded high nibble in color data types.

Definition at line 288 of file bink.h.

◆ _curFrame

int Video::Bink::BinkVideoTrack::_curFrame
private

Current Frame.

Definition at line 271 of file bink.h.

Referenced by decodePacket(), and getCurFrame().

◆ _curPlanes

Common::ScopedArray<byte> Video::Bink::BinkVideoTrack::_curPlanes[4]
private

The 4 color planes, YUVA, current frame.

Definition at line 290 of file bink.h.

Referenced by BinkVideoTrack(), and decodePacket().

◆ _frameCount

int Video::Bink::BinkVideoTrack::_frameCount
private

Definition at line 272 of file bink.h.

Referenced by getFrameCount().

◆ _frameRate

Common::Rational Video::Bink::BinkVideoTrack::_frameRate
private

The frame rate of the video.

Definition at line 274 of file bink.h.

Referenced by getFrameRate().

◆ _hasAlpha

bool Video::Bink::BinkVideoTrack::_hasAlpha
private

Do video frames have alpha?

Definition at line 277 of file bink.h.

Referenced by decodePacket().

◆ _height

uint32 Video::Bink::BinkVideoTrack::_height
private

Definition at line 269 of file bink.h.

Referenced by BinkVideoTrack(), decodePacket(), and getHeight().

◆ _huffman

Common::ScopedPtr<Common::Huffman> Video::Bink::BinkVideoTrack::_huffman[16]
private

The 16 Huffman codebooks used in Bink decoding.

Definition at line 283 of file bink.h.

◆ _id

uint32 Video::Bink::BinkVideoTrack::_id
private

The BIK FourCC.

Definition at line 279 of file bink.h.

Referenced by decodePacket().

◆ _oldPlanes

Common::ScopedArray<byte> Video::Bink::BinkVideoTrack::_oldPlanes[4]
private

The 4 color planes, YUVA, last frame.

Definition at line 291 of file bink.h.

Referenced by BinkVideoTrack(), and decodePacket().

◆ _swapPlanes

bool Video::Bink::BinkVideoTrack::_swapPlanes
private

Are the planes ordered (A)YVU instead of (A)YUV?

Definition at line 276 of file bink.h.

Referenced by decodePacket().

◆ _width

uint32 Video::Bink::BinkVideoTrack::_width
private

Definition at line 268 of file bink.h.

Referenced by BinkVideoTrack(), decodePacket(), and getWidth().


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