# Region-of-Interest Based Coding Scheme for Live Videos
## 2 Related Works  
The objective of video encoding rate control is to closely approximate a predefined constant target bit rate while minimizing quality degradation. Central to this task, the rate control algorithm seeks to determine the most suitable Quantization Parameter (QP) for each video segment under the condition that the encoded bitrate \(R_{v}(QP)\) does not exceed the maximum allowed limit, denoted by \(R_{max}\). This constraint is crucial because quantization inherently compresses video signals at reduced bitrates, with \(R_{max}\) being the fixed upper bound on the total number of bits, and \(R_{v}(QP)\) representing the actual number of encoded bits in the live stream.  
In the context of video coding, rate control typically integrates Rate-Distortion Optimization (RDO), as described in Equation (1). Given the QP assigned by the rate control process, RDO strives to minimize the cost function within each Coding Unit (CU), thereby reducing the overall cost of the encoded video.  
To address these challenges, an explicit Rate-Distortion model is required to correlate the average bitrate with the QP value. A variety of studies have been conducted to develop such models that associate perceived video quality with bitrate. Various rate models have emerged, ranging from simple linear expressions to more intricate mathematical formulations. For instance, the reference software for HEVC encoding in [20] employs a linear model for bit rate estimation. In contrast, the quadratic model is often represented as follows:  
\[R=C_{1}\times MAD/QP+C_{1}\times MAD/QP^{2} \tag{2}\]  
where \(C_{1}\) and \(C_{2}\) are the model parameters, has been adopted in VM8 for MPEG4 [21], H.264/AVC [22] and also for HEVC [23].  
These models play a pivotal role in achieving the delicate balance between video quality and bitrate constraints in video encoding applications.  
As previously mentioned, each rate control model is tailored for video encoding systems operating under specific conditions. However, the core objective of all these methods is to allocate an optimal number of bits and determine the quantization parameters for every coding unit. The encoder's rate controller operates across three principal levels: Group of Pictures (GOP), frame, and Coding Unit (CU) [12]:  
1. GOP Level: At this level, input parameters include the target bit rate, sequence frame rate, GOP size, and virtual buffer occupancy. The rate control algorithm calculates the average number of bits per GOP.
2. Frame Level: This stage involves considering the average bit allocation per frame, where a fixed target bit amount is set for the current frame. Bit allocation takes into account the hierarchical structure of the frames, followed by the application of the \(R-\lambda\) model to compute the frame-level QP.
3. CU Level: The process unfolds in three stages. Firstly, the required bit allocation for each CU is calculated based on the frame budget and the Mean Absolute Difference (MAD) of that CU. Secondly, using the established frame budget, the \(R-\lambda\) model is employed to calculate a \(\lambda\) value within a fixed QP range for each CU. Finally, Rate-Distortion Optimization (RDO) is performed to find the optimal mode decision, which refers back to the given QP.  
In summary, the rate control mechanism at these different levels ensures a systematic and adaptive approach to bitrate management while maintaining optimal video quality throughout the encoding process.