talk about what is intra-frame prediction and inter-frame prediction in the encoding process before understanding I-frame B-frame P-frames 1. Intra-frame predictive coding
Intra-frame encoding is used to reduce spatial redundancy of images. In order to improve the efficiency of intra-frame coding, the spatial correlation of adjacent macro blocks is fully utilized in a given frame, and adjacent macro blocks usually contain similar attributes. Therefore, in the case of a given macro block encoding, the first can be based on the surrounding macro-block prediction (typically based on the upper left macro block, the left macro block and the macro block above, because this macro block has been encoded), and then the difference between the predicted value and the actual value of the code, so that compared to directly to the frame encoding, can
H. 9 provides a 4x4 pixel macro block prediction with 1 DC predictions and 8 directional predictions. In the diagram, the adjacent block A to I a total of 9 pixels have been encoded, can be used to predict, if we choose Mode 4, then, A, B, C, D4 pixels are predicted to be equal to the value of E, E, F, G, H4 pixels are predicted to be equal to the value of F, for the image contains little space information in the flat area, It also supports 16x16 in-frame encoding. 2. Inter-frame Predictive coding
Inter-frame predictive coding uses time redundancy in continuous frames to estimate and compensate for motion. The motion compensation of H. B supports most of the key features of the previous video coding standard, and it also flexibly adds more functions, in addition to supporting P-frame and frame, a new inter-stream transfer frame--SP frame is supported. When the stream contains SP frames, it can quickly switch between streams with similar content but with different bitrate, while supporting both random access and fast replay modes. The motion estimates of H. 4 have the following characteristics. (1) macro block segmentation of different sizes and shapes
The motion compensation for each 16x16 pixel macro block can take different sizes and shapes, and H. 7 is supported in Figure 4. The motion compensation of the small block mode improves the performance of the motion details, reduces the block effect and improves the quality of the image. (2) High precision sub-pixel motion compensation
The motion estimation of half-pixel accuracy is used in h.263, while the motion estimate of 1/4 or 1/8 pixel accuracy can be used in H. In the case of requiring the same precision, the residual error after the motion estimation using 1/4 or 1/8 pixel accuracy is smaller than that of the h.263 using half-pixel precision motion estimation. In this way, with the same accuracy, the bit rate required in the inter-frame coding is smaller. (3) Multi-frame prediction
With optional multi-frame prediction, the 5 different reference frames are selectable between frames, providing better error correction performance, which improves video image quality. This feature is mainly used in the following situations: Periodic motion, translational motion, and changing the camera's lens back and forth between two different scenes. (4) Go to block filter
The adaptive removal of block effect filters is defined in H. V, which can handle the horizontal and vertical block edges in the prediction loop, greatly reducing the block effect. I -frame B-frame P-Frame
In video compression, each frame represents a still image. And in the actual compression, will take a variety of algorithms to reduce the data capacity, where IPB is the most common.
To put it simply, I-frame is a keyframe, which belongs to intra-frame compression. Is the same as the compression of AVI. P is the meaning of the forward search. B is a two-way search. They are all based on I-frames to compress the data.
I-frames represent keyframes, which you can understand as a complete reservation for this frame, and only need this frame of data for decoding (because it contains the full picture)
The P-frame represents the difference between this frame and a previous keyframe (or P-frame), which needs to be decoded to create the final picture by overlaying the differences defined by this frame with the previously cached screen. (That is, the difference frame, p frame does not have the complete picture data, only with the previous frame of the picture difference of data)
B-Frame is a two-way differential frame, that is, B-frame recording is the difference between this frame and the front and back frame (more complex, there are 4 cases), in other words, to decode the B-frame, not only to obtain the previous cache screen, but also to decode the screen after the image and the frame data overlay to obtain the final picture B-Frame compression rate is high, but the CPU will be more tired when decoding ~.
From the above explanation, we know that I and P decoding algorithm is relatively simple, resource consumption is relatively small, I as long as the completion of the line, p, but also only need the decoder to cache the previous screen, encountered p when using the cache before the screen is good, if the video stream only I and P, decoder can no matter the data behind, Reading side decoding, linear forward, everyone is very comfortable.
But many movies on the network use B-frame, because B-frame record is the difference between the frame, compared to P-frame can save more space, but in this case, the file is small, the decoder is troublesome, because in decoding, not only to use the screen before the cache, but also know the next I or P screen (that is, pre-read pre- , B-frame can not simply throw away, because B-frame actually also contains the picture information, if simply discarded, and with the previous screen simple repetition, will cause the picture card (in fact, dropped frames), and because the network of movies in order to save space, often use a lot of B-frame, b frame with more, For a player that does not support B-frames, it can cause more trouble, and the picture will become more and more jammed.
Generally speaking, I compression rate is 7 (similar to JPG), p is 20,b can reach 50, the use of B-frame can save a lot of space, save space can be used to save more I frame, so that at the same rate, can provide better picture quality.