• 沒有找到結果。

4. Pure Hardware Rate Control

4.2. Hardware Rate Control Approach

In general, rate control mechanism exploits correlation between rate and distortion and uses the R-D model to get adequate quantization parameter. After encoding one frame or macroblock, the R-D model should be refined and parameters are re-calculated for next time estimation. Because the parameters in R-D model are sequence dependent and vary with the image content, the accurate number of bits, quantization parameter, and relative information can be obtained only after actual encoding operation.

In order to avoid using complicated mathematic operation to estimate QP and modifying model parameters after encoding either each frame or macroblock, it is not suitable to utilize the R-D model for hardware. By using a different way to model

record the accurate QP under the situation of current SAD and target number of bits for current frame or macroblock. With this method, there’s no need to worry about using a wrong R-D model. Therefore, the proposed method is more adaptive to variable video features. The method utilizes previous accurate data point to acquire one QP for encoding. When one frame or macroblock is to be encoded, the target number of bits and SAD value for current MB are utilized to index the table and acquire the QP. A large amount of interrupt service time for each MB executed in the system core is saved by implementing the h/w rate control with the lookup up table and other logic into the accelerator. Although the SAD and target number of bits are used in this approach, because the lookup table is also implemented in the accelerator core, the SAD could be pass directly from the motion estimator without interrupt to MCU.

4.2.1. Process Flow of the H/W Rate Control Method

There are three main processes for the table look-up method. The detail is described as follows.

4.2.1.1. Modeling Table Initialization

What a rate control mechanism does is to select a quantization parameter according to the target bits of current frame or macroblock and complexity which shows how difficult to encode the residual and is measured as SAD or MSE.

Quantization only affects the number of bits used to code quantized DCT coefficients.

Therefore, the number of bits which codes texture and SAD are used to index the lookup table.

Before indexing the lookup table to acquire a MB’s QP, one of the major issues is how to acquire the initial content of the modeling table. Here the initial modeling table is obtained from the result of encoding some sequence and this modeling table is saved into a storage device such as ROM. When encoding is started, the modeling table stored in the device is loaded into the memory for indexing. Experiments show that different contents of initial modeling table would not affect the coding result strictly.

Fig 8. Modeling Table in Hardware Rate Control

Fig 8 shows a modeling table to be looked up in hardware rate control, in which the complexity can be measured by SAD or any other cost functions. The number of texture bits and SAD are used to index this table and both of them are clustered into groups of bins. Naturally, in Fig 8 QP1 is larger than QP2 , and smaller than QP3.

This means that at the same SAD value, the more texture bits are available, the smaller the QP is. On the other hand, while having the same texture bits, the larger SAD it has, the larger QP it is. By using this characteristic, the initial modeling table could be interpolated for the entries which are not generated after encoding entire sequence.

4.2.2. Modeling Table Indexing

Once the lookup table (LUT) initialization is done, the rate control can be started.

In the beginning of encoding a frame, the rate control computes the frame target bits based on the buffer status. Furthermore, a MB target bit can be calculated in the MB-level. On the other hand, the SAD value is acquired from the motion estimator.

The SAD and the target bit for the current MB are used for indexing the LUT. By weighting the QP read out from the LUT with the current average QP, the new QP value for the current MB can be assigned to the quantizer. The weighting mechanism here is to reduce the effect by the inappropriate QP from the table with large variation due to different video sequence features.

4.2.3. Update Modeling Table

After texture encoding of MB is done, the actual encoding bits on current MB can be acquired. Such as the updating actions in general rate control algorithm, after encoding one frame or MB, the accurate QP should be saved (updated) into the modeling table indexed by the actual bit number and corresponding SAD values for later bit rate estimation and indexing. By continuous modifying modeling table, the validity of the table can be maintained even though the video sequence varies with image content, and this is somewhat similar with the refinement of R-D model parameters which adapts R-D model to be used with the change of sequence characteristics. In addition to updating the modeling table, updating of the buffer control for next frame encoding is required.

相關文件