H.264 Learning (I)-concepts of frames and fields

Source: Internet
Author: User

I. What is a field?

Each TV frame is generated by scanning the screen twice, and the line of the second scan just fills the gaps left by the first scan. Each scan is called a field. Therefore, the 25-frame/second TV screen is actually 50 sets/second (for NTSC, 30 & 60 respectively-because I am a Chinese, so I use the pal value ).

To obtain the frame with the maximum details, you need to merge the information in the two fields. So far, these concepts are very simple, but it is not that easy to consider Dynamic Pictures. Because the camera will scan these two fields in sequence, all the files in the image will be moved to a different position from the first field in the second field. This will make the TV screen more smooth, but it is also a problem during editing.

Ii. computer and television

When a computer plays a video on a display, it only displays a series of complete frames, without the use of staggered TV techniques. Therefore, the video format and MPEG-1 for computer display are not used. Video editing software designed for these formats cannot process the scene correctly, so it is not suitable for generating videos for television. If your video will be played on TV, be sure to use the Editable program on the processor.

Iii. Overview

The original video frame (the original video data) is scanned in different ways according to the encoding needs to generate two video frames: continuous or interlaced video frames, the video frames in each row include the top field and the bottom field. The video frames scanned continuously (in-row mode) have different characteristics and encoding characteristics from the video frames scanned in the same row, produced the so-called frame encoding and field encoding. Generally, frame encoding is performed on the downlink frame. The interlace frame can be selected between the frame encoding and field encoding.

In frame encoding, the reference is a frame image, and frame motion compensation is used. The two fields are co-encoded. In the field encoding, the reference is a field image, and the two fields are encoded separately, use Field motion compensation.

Ii. Video Sequence frames and field encoding methods

1. Fixed Frame encoding (full frame)-All frames of a video sequence always adopt frame encoding.

2. Fixed field code (full field)

  Frames in a video sequence are divided into two independent encoding fields. Encoding Rules:

  1.An I frame can be encoded into two I fields or one I field and one P field, that is, II, IP.

 2. P frames can be encoded into two P fields or one P field and one B field, that is, PP and Pb.

 3. B frame can be encoded into two B fields, that is, BB.

3. Image Frame and field adaptive coding (PAFF)

  The video sequence can be encoded into one frame or two fields. The adaptive selection principle is based on the RD of each frame using this encoding method.


4. Macro Block-level frame and field adaptive (mbaff)

      In order to further improve the encoding efficiency, Macro Block-level frame field adaptation is adopted, and macro block-level pairs (MBP) are used as the basic encoding Unit (2)



      H.264 adopts the mbaff solution:


In the image where motion is relatively large, the field encoding is used, and frame encoding is used where motion is relatively small. The encoding sequence is as follows:

Differences between PAFF and mbaff in Video Encoding
 Each frame of the line-by-line scan image contains two fields. Therefore, there are three encoding methods for the line-by-line scan image:

 1. merge the two fields into one frame for encoding

 2. encode the two fields separately

 3. merge the two fields into one frame, but at the macro block level, divide one frame macro block into two macro blocks for encoding.

 The first two encoding methods are called Image Adaptive frame/field encoding (PAFF), and the third is Macro Block Adaptive frame/field encoding (mbaff ).

 For a motion image, because there is a large scanning interval between the fields, the spatial correlation between the adjacent two rows in the frame is smaller than that of the row-by-row scan image, therefore, encoding the two fields separately reduces the bitrate. For a non-motion image, there is a large spatial correlation between two adjacent lines. merging the two fields into one frame is more effective. Therefore, the PAFF encoding method can be used to adjust the encoding mode of the entire image and select frame encoding or field encoding.

 When an image has a moving area and a non-moving area at the same time, the disadvantage of PAFF is displayed. The adaptive granularity of PAFF is too coarse to meet the finer coding requirements, so mbaff came into being. Mbaff selects frame encoding or field Encoding Based on Macro Block. mbaff combines the two fields into one frame for encoding, but encodes each frame Macro Block (16x16) divided into 8*16 Macro Block pairs. For each frame Macro Block, compare the bitstream size produced by frame encoding and field encoding, and use the method that saves the most bit stream.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.