| 1 |
.. SPDX-FileCopyrightText: 2019-2020 Intel Corporation |
| 2 |
.. |
| 3 |
.. SPDX-License-Identifier: CC-BY-4.0 |
| 4 |
|
| 5 |
============== |
| 6 |
Video Encoding |
| 7 |
============== |
| 8 |
|
| 9 |
The :term:`ENCODE` class of functions take raw frames as input and compresses |
| 10 |
them into a bitstream. |
| 11 |
|
| 12 |
Input frames usually come encoded in a repeated pattern called the Group of |
| 13 |
Picture (GOP) sequence. For example, a GOP sequence can start with an |
| 14 |
I-frame followed by a few B-frames, a P-frame, and so on. ENCODE uses an MPEG-2 |
| 15 |
style GOP sequence structure that can specify the length of the sequence and the |
| 16 |
distance between two keyframes: I- or P-frames. A GOP sequence ensures that the |
| 17 |
segments of a bitstream do not completely depend upon each other. It also enables |
| 18 |
decoding applications to reposition the bitstream. |
| 19 |
|
| 20 |
ENCODE processes input frames in two ways; |
| 21 |
|
| 22 |
* **Display order:** ENCODE receives input frames in the display order. GOP structure |
| 23 |
parameters specify the GOP sequence during ENCODE initialization. Scene changes resulting from the video processing stage of a pipeline can alter the GOP |
| 24 |
sequence. |
| 25 |
|
| 26 |
* **Encoded order:** ENCODE receives input frames in their encoding order. The |
| 27 |
application must specify the exact input frame type for encoding. ENCODE |
| 28 |
references GOP parameters to determine when to insert information, such as an end-of-sequence, into the bitstream. |
| 29 |
|
| 30 |
An ENCODE output consists of one frame of a bitstream with the time stamp |
| 31 |
passed from the input frame. The time stamp is used for multiplexing subsequent |
| 32 |
video with other associated data such as audio. |vpl_short_name| provides only pure video |
| 33 |
stream encoding. The application must provide its own multiplexing. |
| 34 |
|
| 35 |
ENCODE supports the following bitrate control algorithms: constant bitrate, |
| 36 |
variable bitrate (VBR), and constant quantization parameter (QP). In the |
| 37 |
constant bitrate mode, ENCODE performs stuffing when the size of the |
| 38 |
least-compressed frame is smaller than what is required to meet the hypothetical |
| 39 |
reference decoder (HRD) buffer requirements (or VBR requirements). (Stuffing is a process that |
| 40 |
appends zeros to the end of encoded frames.) |