VC-1 Data Structures: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
No edit summary
 
(more data structures)
Line 5: Line 5:
== Macroblocks, Blocks, and Sub-blocks ==
== Macroblocks, Blocks, and Sub-blocks ==
A macroblock embodies a 16x16 block of pixels in a [[YUV 4:2:0]] colorspace. A macroblock consists of 6 blocks: 4 8x8 Y blocks, 1 U block, and 1 V block. Further, these blocks maybe divided into sub-blocks of sizes 8x4, 4x8, or 4x4.
A macroblock embodies a 16x16 block of pixels in a [[YUV 4:2:0]] colorspace. A macroblock consists of 6 blocks: 4 8x8 Y blocks, 1 U block, and 1 V block. Further, these blocks maybe divided into sub-blocks of sizes 8x4, 4x8, or 4x4.
== Block Types ==
Note: enumerated numbers are defined in the SRD; specific numbers may or may not be relevant to independent implementation.
0: 8x8 inter-coded block
1: 8x4 inter-coded block
2: 4x8 inter-coded block
3: 4x4 inter-coded block
4: transform type not yet determined
5: intra-coded block, no AC prediction
6: intra-coded block, AC prediction of top row coefficients
7: intra-coded block, AC prediction of left column coefficients


== Intra Block ==
== Intra Block ==
Line 15: Line 26:


== Hybrid Prediction Modes ==
== Hybrid Prediction Modes ==
Note: enumerated numbers are defined in the SRD; specific numbers may or may not be relevant to independent implementation
Note: enumerated numbers are defined in the SRD; specific numbers may or may not be relevant to independent implementation.
* 0: predict from left
* 0: predict from left
* 1: predict from top
* 1: predict from top
Line 21: Line 32:


== Sub-block Patterns ==
== Sub-block Patterns ==
Note: enumerated numbers are defined in the SRD; specific numbers may or may not be relevant to independent implementation
Note: enumerated numbers are defined in the SRD; specific numbers may or may not be relevant to independent implementation.
* 0: 8x8 transform, coded
* 0: 8x8 transform, coded
* 1: 8x4 transform, bottom subblock coded
* 1: 8x4 transform, bottom subblock coded
Line 62: Line 73:
== Motion Vector History ==
== Motion Vector History ==
This data structure consists of an array of 4 motion vector data structures which stores the motion vector history for 4 Y blocks, used for direct mode.
This data structure consists of an array of 4 motion vector data structures which stores the motion vector history for 4 Y blocks, used for direct mode.
== Inter Block ==
An intra block data structure requires the following information:
* an array of 4 integers representing the number of non-zero coefficients (DC and AC together) for up to 4 sub-blocks in the block
* 2 motion structures, 1 for backward prediction and 1 for forward prediction
== Block ==
This is the information that the SRD maintains for an individual block:
* block type, as defined in [[VC-1 Data Structures#Block Types|Block Types]] section
* a flag indicating whether there are non-zero AC coefficients for an intra block, or non-zero DC or AC coefficients for an inter block
* a C union that contains either an intra or inter block data structure
== Quantizer ==
This data structure maintains information about quantization parameters.
* quantizer step, range 0..31
* quantizer half-step, either 0 or 1
* a flag indicating whether the quantization is uniform or non-uniform
== Motion Compensation Properties ==
These properties are associated with motion compensation:
* a block is intra-coded, or has 1, 2, or 4 motion vectors associated
* a block predicts backwards from a previous frame, from a forward frame, from both a backward or forward frame, or uses "direct" mode
* a flag that indicates whether MVs apply to interlaced fields
* a flag that indicates that "bottom field different direction to top"
* a flag that indicates "field transform"

Revision as of 17:03, 23 April 2006

Part of Understanding VC-1

This page is a discussion of the various data structures and constant enumerations employed in the SMPTE Reference Decoder (SRD) VC-1 reference implementation. These are mostly found in the file vc1types.h.

Macroblocks, Blocks, and Sub-blocks

A macroblock embodies a 16x16 block of pixels in a YUV 4:2:0 colorspace. A macroblock consists of 6 blocks: 4 8x8 Y blocks, 1 U block, and 1 V block. Further, these blocks maybe divided into sub-blocks of sizes 8x4, 4x8, or 4x4.

Block Types

Note: enumerated numbers are defined in the SRD; specific numbers may or may not be relevant to independent implementation. 0: 8x8 inter-coded block 1: 8x4 inter-coded block 2: 4x8 inter-coded block 3: 4x4 inter-coded block 4: transform type not yet determined 5: intra-coded block, no AC prediction 6: intra-coded block, AC prediction of top row coefficients 7: intra-coded block, AC prediction of left column coefficients

Intra Block

An intra block data structure requires the following information:

  • number of non-zero AC coefficients
  • quantized DC coefficient for prediction
  • 7 quantized AC coefficients along the top row of the block, used for prediction
  • 7 quantized AC coefficients along the left side of the block, used for prediction
  • 16 samples representing the bottom 2 8-pixel rows of the block, maintained for overlap smoothing filters

Hybrid Prediction Modes

Note: enumerated numbers are defined in the SRD; specific numbers may or may not be relevant to independent implementation.

  • 0: predict from left
  • 1: predict from top
  • 2: no hybrid prediction

Sub-block Patterns

Note: enumerated numbers are defined in the SRD; specific numbers may or may not be relevant to independent implementation.

  • 0: 8x8 transform, coded
  • 1: 8x4 transform, bottom subblock coded
  • 2: 8x4 transform, top subblock coded
  • 3: 8x4 transform, both subblocks coded
  • 4: 4x8 transform, right subblock coded
  • 5: 4x8 transform, left subblock coded
  • 6: 4x8 transform, both subblocks coded
  • 7: 4x4 transform, subblock pattern separate
  • 8: 8x8 transform, coded, whole MB
  • 9: 8x4 transform, bottom subblock coded, whole MB
  • 10: 8x4 transform, top subblock coded, whole MB
  • 11: 8x4 transform, both subblocks coded, whole MB
  • 12: 4x8 transform, right subblock coded, whole MB
  • 13: 4x8 transform, left subblock coded, whole MB
  • 14: 4x8 transform, both subblocks coded, whole MB
  • 15: 4x4 transform, subblocks pattern separate, whole MB

One more stray constant:

  • 8: MB level threshold

Motion Vector

This is the information maintained for an individual motion vector:

  • X offset
  • Y offset
  • a flag indicating whether the vector pertains to the top or bottom field of interlaced video

The (X, Y) vector is relative to the top-left coordinate of a block. The fractional pel resolution of the vectors depends on the motion vector coding mode.

Motion

This structure encapsulates motion vectors along with mode information.

  • prediction mode, as enumerated in Hybrid Prediction Modes
  • motion vector data structure
  • differential motion vector data structure, represented in quarter-pel units

The SRD contains the following not accompanying this data structure:

/*
 * If Two Reference Images (NUMREF=1) then:
 *      Y=2*(YValue)+PredFlag
 *      PredFlag: 0=dominant 1=non-dominant
*/

Motion Vector History

This data structure consists of an array of 4 motion vector data structures which stores the motion vector history for 4 Y blocks, used for direct mode.

Inter Block

An intra block data structure requires the following information:

  • an array of 4 integers representing the number of non-zero coefficients (DC and AC together) for up to 4 sub-blocks in the block
  • 2 motion structures, 1 for backward prediction and 1 for forward prediction

Block

This is the information that the SRD maintains for an individual block:

  • block type, as defined in Block Types section
  • a flag indicating whether there are non-zero AC coefficients for an intra block, or non-zero DC or AC coefficients for an inter block
  • a C union that contains either an intra or inter block data structure

Quantizer

This data structure maintains information about quantization parameters.

  • quantizer step, range 0..31
  • quantizer half-step, either 0 or 1
  • a flag indicating whether the quantization is uniform or non-uniform

Motion Compensation Properties

These properties are associated with motion compensation:

  • a block is intra-coded, or has 1, 2, or 4 motion vectors associated
  • a block predicts backwards from a previous frame, from a forward frame, from both a backward or forward frame, or uses "direct" mode
  • a flag that indicates whether MVs apply to interlaced fields
  • a flag that indicates that "bottom field different direction to top"
  • a flag that indicates "field transform"