ATI VCR2

From MultimediaWiki
Jump to navigation Jump to search

General description

ATI VCR2 is essentially a subset of MPEG-2 video. ATI Video Capture Cards use this format. The Compression is done in the hardware. There is a driver for Win9x that is dedicated to play back VCR2 videos without ATI Hardware.

VCR2 Video frames

VCR2 uses only Intra-frames. Data for each frame consists of the following pieces: optional Sequence header, optional Sequence header extension, optional GOP (group of pictures) header, Picture header, Picture header extension, Slice Layer and Macroblock Layer with actual picture data.

To see which header comes as next, just check the bitstream for a start code. The following start codes are defined:

  1. SEQ_HEAD_START_CODE 0x000001B3
  2. EXTENSION_START_CODE 0x000001B5
  3. GOP_START_CODE 0x000001B8
  4. PIC_START_CODE 0x00000100

Sequence Header

This header is optional. Its presence is indicated by the SEQ_HEAD_START_CODE. It has the following format:

  • Horizontal size (12 bits)

This is the width of the encoded picture.

  • Vertical size (12 bits)

This is the height of the encoded picture.

  • Pixel aspect ratio (4 bits)

This is always set = 1 (1:1) for the VCR2.

  • Frame rate (4 bits)

frame rate. This value is ignored in the decoder. Check the AVI container for actual frame rate.

  • Frame rate (18 bits)

bit rate of the bitstream in units of 400 bits/second, rounded upwards.

  • Marker bit (1 bit)

should be set = 1.

  • Video Buffering Verfier (VBV) buffer size (10 bits)

ignored.

  • Constrained parameters flag (1 bit)

ignored.

  • Load intra quantizer matrix flag (1 bit)

always = 0.

  • Load non-intra quantizer matrix flag (1 bit)

always = 0.

Sequence Header Extension

This extension is optional. Its presence is indicated by the EXTENSION_START_CODE and the extension type = 1 (see below). It has the following format:

  • Extension type (4 bits)

set = 1 for the sequence header extension. This is sent after the EXTENSION_START_CODE.

  • Profile/level escape (1 bit)

ignored.

  • Profile (3 bits)

ignored.

  • Level (4 bits)

ignored.

  • Progressive sequence flag (1 bit)

ignored.

  • Chroma format code (2 bits)

ignored.

  • Horizontal size extension (2 bits)

extends the size given in the sequence header. Thus, the width of the encoding picture = (horiz_size_ext << 12) | (horiz_size).

  • Vertical size extension (2 bits)

extends the size given in the sequence header. Thus, the height of the encoding picture = (vert_size_ext << 12) | (vert_size).

  • Bit rate extension (12 bits)

ignored.

  • Marker bit (1 bit)

should be set = 1.

  • VBV buffer size extension (8 bits)

ignored.

  • Low delay flag (1 bit)

ignored.

  • Frame rate extension numerator (2 bits)
  • Frame rate extension denominator (5 bits)

both ignored.

GOP Header

This header is optional. Its presence is indicated by the GOP_START_CODE. It has the following format:

  • Time code (25 bits)

contains: drop frame flag (1 bit), hours (5 bits), minutes (6 bits), marker bit (should be = 1), seconds (6 bits), frames (6 bits).

  • Closed GOP flag (1 bit)

ignored.

  • Broken link flag (1 bit)

ignored.

Picture Header

This header must be present in the VCR2 video stream. It´s preceeded by the PIC_START_CODE. It has the following format:

  • Temporal reference (10 bits)

ignored.

  • Frame type (3 bits)

always = 1 (Intra) for the VCR2.

  • VBV delay (16 bits)

ignored.

  • Extra bit picture flag (1 bit)

always = 0.

Picture Header Extension

This extension must be present in the VCR2 video stream. It´s preceeded by the EXTENSION_START_CODE. It has the following format:

  • Extension type (4 bits)

set = 8 for the picture header extension.

  • Forward horizontal (4 bits)

ignored.

  • Forward vertical (4 bits)

ignored.

  • Backward horizontal (4 bits)

ignored.

  • Backward vertical (4 bits)

ignored.

  • Intra DC precision (2 bits)

ignored.

  • Picture structure (2 bits)

ignored.

  • Top field first flag (1 bit)

ignored.

  • frame_pred_frame_dct flag (1 bit)

ignored.

  • Concealment motion vectors flag (1 bit)

ignored.

  • q_scale type flag (1 bit)

ignored.

  • Intra vlc format flag (1 bit)

ignored.

  • Alternate scan flag (1 bit)

used. See the MPEG-2 specification for details.

  • Repeat first field flag (1 bit)

ignored.

  • Chroma 420 type flag (1 bit)

ignored.

  • Progressive frame flag (1 bit)

ignored.

  • Composite display flag (1 bit)

ignored.

Slice Layer

The Slice Layer must be present in the VCR2 video stream. It has the following format:

  • Slice start code (32 bits)

the first 24 bits have the value of 0x000001. The last 8 bits indicate the number of the slice in the range 0x01 - 0xAF.

  • Quantizer scale (5 bits)

an unsigned integer used to scale the reconstruction level of the DCT coefficients. 0 is forbidden.

  • Extra bit slice flag (1 bit)

always = 0 in the VCR2.

Macroblock Layer

The Macroblock Layer must be present in the VCR2 video stream. It contains data for the all macroblocks in the current slice. It has the following format:

(UNFINISHED)