Code rate control method and encoder

文档序号:1925583 发布日期:2021-12-03 浏览:2次 中文

阅读说明:本技术 码率控制方法及编码器 (Code rate control method and encoder ) 是由 周瑜锋 李日 谢亚光 陈勇 于 2021-08-27 设计创作,主要内容包括:本发明公开了一种码率控制方法及编码器,方法包括:S1,在预处理阶段,根据当前帧与前一帧的基于宏块的直方图差异的统计,对当前帧是否为场景切换帧进行判断,根据场景切换检测结果,在码率控制前调整帧处理顺序;S2,根据当前帧的当前帧或宏块的绝对误差和失真来估计当前帧的预测比特以及量化参数,当经过若干帧的编码之后,视频缓冲校验器状态在一个合理范围内;S3,一帧分成多个宏块,调整每个宏块的量化参数;S4,编码完整帧之后,根据该帧的实际编码量化参数以及实际编码比特更新帧级预测模型参数,根据预测比特以及实际比特对视频缓冲校验器状态进行相应的更新,使下一个未编码帧在帧级码控分配量化参数时得到最新的视频缓冲校验器状态。(The invention discloses a code rate control method and a coder, wherein the method comprises the following steps: s1, in the preprocessing stage, according to the statistics of the histogram difference of the current frame and the previous frame based on the macro block, judging whether the current frame is a scene switching frame, and according to the scene switching detection result, adjusting the frame processing sequence before the code rate control; s2, estimating the prediction bit and quantization parameter of the current frame according to the absolute error and distortion of the current frame or macro block of the current frame, when the video buffer checker is in a reasonable range after encoding several frames; s3, dividing a frame into a plurality of macro blocks, and adjusting the quantization parameter of each macro block; and S4, after the whole frame is coded, updating the frame-level prediction model parameters according to the actual coding quantization parameters and the actual coding bits of the frame, and correspondingly updating the state of the video buffer checker according to the prediction bits and the actual bits, so that the latest video buffer checker state is obtained when the next uncoded frame is subjected to frame-level code-controlled distribution of quantization parameters.)

1. A method for rate control, comprising the steps of:

s1, in the preprocessing stage, according to the statistics of the histogram difference of the current frame and the previous frame based on the macro block, judging whether the current frame is a scene switching frame, and according to the scene switching detection result, adjusting the frame processing sequence before the code rate control;

s2, estimating the prediction bit and quantization parameter of the current frame according to the absolute error and distortion of the current frame or macro block of the current frame, when the video buffer checker is in a reasonable range after encoding several frames;

s3, dividing a frame into a plurality of macro blocks, and adjusting the quantization parameter of each macro block;

and S4, after the whole frame is coded, firstly, updating the frame-level prediction model parameters according to the actual coding quantization parameters and the actual coding bits of the frame, and correspondingly updating the state of the video buffer checker according to the prediction bits and the actual bits, so that the latest state of the video buffer checker can be obtained when the quantization parameters are allocated to the next uncoded frame in the frame-level code control mode.

2. The code rate control method of claim 1, wherein the S2 further comprises: the method comprises the steps of taking the frame number of a current frame as a starting point, looking back at a plurality of frames, predicting the predicted bit of a prediction model of the frames by a frame-level prediction model according to the initial coding parameter value related to a quantization parameter and the absolute error and distortion of the current frame or a macro block of the corresponding frame, predicting the change condition of the state of a video buffer checker after the frames according to the predicted bit of each frame, jumping out the current coding parameter related to the quantization parameter and correspondingly increasing or decreasing the coding parameter value related to the quantization parameter when the state of the video buffer checker is about to underflow or overflow, and predicting the predicted bit of each frame again, wherein after the frames are coded, the state of the video buffer checker is in a reasonable range.

3. The code rate control method of claim 1, wherein the S3 further comprises: in the process of coding a frame, firstly, a line-level prediction model is updated according to actual bits of a coded macro block, then, the bits of the non-coded macro block are predicted according to the absolute error and distortion of a previous frame or the macro block of the non-coded macro block, line-level bit prediction is carried out when the non-coded macro block is coded into a diagonal macro block of each line, whether the danger of overflow and underflow exists or not is judged according to the state of a video buffer checker and the frame bits predicted by the line level, and quantization parameters of the residual non-coded macro blocks are adjusted in time.

4. The code rate control method of any of claims 1 to 3, wherein in S1, adjusting the frame processing sequence before the code rate control according to the scene change detection result specifically comprises: if the current frame is a scene switching frame, processing the frame strictly according to a frame sequence number; if the distance memory is the scene switching frame, the current frame is temporarily stored in a message queue and is not sent to the code rate control module until the last scene switching frame is sent to the code rate control processing module; if the scene switching frame does not exist in the distance, the current frame is directly sent to the code rate control processing module.

5. An encoder, comprising:

the pre-processing image decision kernel is used for carrying out scene switching detection on each frame according to the statistics of the histogram difference of the current frame and the previous frame based on the macro block;

the image management kernel is used for adjusting the frame processing sequence before the code rate control according to the scene switching detection result;

the code rate control kernel is used for estimating the prediction bit and the quantization parameter of the current frame according to the absolute error and the distortion of the current frame or the macro block of the current frame, and the state of the video buffer checker is in a reasonable range after a plurality of frames are coded;

the coding and decoding kernel is used for dividing a frame into a plurality of macro blocks and adjusting the quantization parameter of each macro block;

and the entropy coding kernel is used for feeding back the actual bit consumption of the frame to the code rate control kernel after the entire frame is subjected to entropy coding, calculating the actual coding average quantization parameter of the frame and the corresponding coding parameter value related to the quantization parameter by taking the macro block as a unit after the code rate control kernel receives the feedback bit, updating the frame-level prediction model parameter, and finally updating the state of the video buffer checker for the quantization parameter distribution of the subsequent uncoded frame.

6. The encoder of claim 5, wherein the image management kernel further comprises means for processing the current frame strictly by frame number if the frame is a scene cut frame; if the distance memory is the scene switching frame, the current frame is temporarily stored in a message queue and is not sent to the code rate control module until the last scene switching frame is sent to the code rate control processing module; if the scene switching frame does not exist in the distance, the current frame is directly sent to the code rate control processing module.

7. The encoder of claim 5, wherein the rate control kernel further comprises: the method comprises the steps of taking the frame number of a current frame as a starting point, looking back at a plurality of frames, predicting the predicted bit of a prediction model of the frames by a frame-level prediction model according to the initial coding parameter value related to a quantization parameter and the absolute error and distortion of the current frame or a macro block of the corresponding frame, predicting the change condition of the state of a video buffer checker after the frames according to the predicted bit of each frame, jumping out the current coding parameter related to the quantization parameter and correspondingly increasing or decreasing the coding parameter value related to the quantization parameter when the state of the video buffer checker is about to underflow or overflow, and predicting the predicted bit of each frame again, wherein after the frames are coded, the state of the video buffer checker is in a reasonable range.

8. The encoder of claim 5, wherein the codec core further comprises: in the process of coding a frame, firstly, a line-level prediction model is updated according to actual bits of a coded macro block, then, the bits of the non-coded macro block are predicted according to the absolute error and distortion of a previous frame or the macro block of the non-coded macro block, line-level bit prediction is carried out when the non-coded macro block is coded into a diagonal macro block of each line, whether the danger of overflow and underflow exists or not is judged according to the state of a video buffer checker and the frame bits predicted by the line level, and quantization parameters of the residual non-coded macro blocks are adjusted in time.

Technical Field

The invention belongs to the technical field of video coding, and particularly relates to a code rate control method and an encoder.

Background

The AVS (Audio Video coding Standard) is a short for the series of standards of advanced Audio and Video coding of information technology, is a second generation source coding Standard with independent intellectual property rights in China, and is also a common basic Standard of the digital Audio and Video industry. By combining the Scalable Video Technology (SVT) of Intel, the Scalable Video Technology of AVS3(Scalable Video Technology of AVS3, SVT-AVS3) modularizes and sufficiently decouples each flow of the AVS3 encoder, realizes better frame-level and segment-level highly parallel encoding in a multi-core processor, and effectively improves the encoding speed of the AVS 3. The SVT-AVS3 adopts a hybrid coding framework, and the whole coding process comprises the modules of intra-frame prediction, inter-frame prediction, transformation quantization, inverse quantization and inverse transformation, loop filtering, entropy coding and the like. For an application scenario of ultra high definition video, block partitions of the SVT-AVS3 include quad-tree (QT) partitions, Binary Tree (BT) partitions, and enhanced quad-tree (EQT) partitions, and different partition types are used to adapt to different texture directions to improve coding efficiency. Meanwhile, SVT-AVS3 uses Coding Units (CUs), Prediction Units (PUs), and Transform Units (TUs), where the size of CUs supports recursive partitioning from 128x128 to 4x4, flexible CU partitioning in order to match the texture complexity of the image itself. SVT-AVS3 adds many key technologies, and coding technologies such as Adaptive Motion Vector precision (AMVR), History-Based Motion Vector Prediction (HMVP), advanced Motion Vector Expression (UMVE), Affine Motion Compensation (AMC), and Position-Based transformation (PBT) are used to improve coding efficiency, in addition to more flexible block partitioning.

By modularizing the AVS3 encoding flow, each module is responsible for corresponding encoding tasks and is independent of each other, and the encoding speed of the SVT-AVS3 is greatly improved due to high parallelization. SVT-AVS3 assigns different encoding tasks to different kernels (Kernels), each Kernel may be assigned one or more threads, and the work between Kemel is independent of each other. The method comprises an image analysis Kernel (PictureAnalyzsKernel), a code rate control Kernel (RatecontrolKernel), an image decision Kernel (PictureDecisionKernel), a motion estimation Kernel (MofioneEstimionKernel), a coding and decoding Kernel (EncDecKernel), an entropy coding Kernel (EntpyCodingKernel) and the like, wherein each Kernel carries out corresponding processing after receiving a task and sends a processing result to the next Kernel through a message queue for next-step processing, so that the division of labor between each Kernel is clear and the parallelism is improved.

The high degree of parallelism of the SVT-AVS3 speeds up the encoding process of AVS3, making SVT-AVS3 widely used in low-latency encoding scenarios, such as 8K event live broadcasting. However, the rate control model of the SVT-AVS3 encoder has unsatisfactory control on the accuracy of the encoding rate and the rate fluctuation, so that the wide application of the SVT-AVS3 encoder in low-latency live broadcast scenes is limited.

The original rate control model of the SVT-AVS3 looks back at a plurality of frames for the current coding frame, calculates the total target consumption bit of the frames according to the target rate and the frame rate, and then searches the optimal value by circulating QP in the range of Quantitative Parameter (QP) to make the bit consumption after coding the frames with the current QP close to the target bit as much as possible. The code rate control model does not consider the influence of a single frame on the code rate fluctuation, so that the code rate fluctuation is easy to be larger, and in addition, the actual code rate control precision has larger errors. The absolute error and distortion (SAD) of each frame represent the coding complexity of each frame, an optimal QP is found for the current frame according to the VBV state and bit consumption is estimated, and then the VBV state is adjusted for coding QP adjustment of the next frame, so as to achieve the purpose of controlling code rate fluctuation. After a frame has been encoded, the encoded bit is used as feedback to update the parameters of the prediction model and the VBV state. Due to the multithreading characteristic of the SVT-AVS3 encoder, the frame sequence of the code rate control processing has a certain disorder, and the challenge of code rate control is increased.

Disclosure of Invention

The technical problem to be solved by the invention is to provide a code rate control method and an encoder, which are used for strictly controlling the code rate fluctuation under the condition of improving the code rate control precision based on a VBV (visual basic) code rate control model, so that the code rate fluctuation is in a reasonable range, and the encoding delay is reduced.

In order to solve the technical problems, the invention adopts the following technical scheme:

an aspect of the embodiments of the present invention provides a code rate control method, including the following steps:

s1, in the preprocessing stage, according to the statistics of the histogram difference of the current frame and the previous frame based on the macro block, judging whether the current frame is a scene switching frame, and according to the scene switching detection result, adjusting the frame processing sequence before the code rate control;

s2, estimating the prediction bit and quantization parameter of the current frame according to the absolute error and distortion of the current frame or macro block of the current frame, when the video buffer checker is in a reasonable range after encoding several frames;

s3, dividing a frame into a plurality of macro blocks, and adjusting the quantization parameter of each macro block;

and S4, after the whole frame is coded, firstly, updating the frame-level prediction model parameters according to the actual coding quantization parameters and the actual coding bits of the frame, and correspondingly updating the state of the video buffer checker according to the prediction bits and the actual bits, so that the latest state of the video buffer checker can be obtained when the quantization parameters are allocated to the next uncoded frame in the frame-level code control mode.

Preferably, S2 further specifically includes: the method comprises the steps of taking the frame number of a current frame as a starting point, looking back at a plurality of frames, predicting the predicted bit of a prediction model of the frames by a frame-level prediction model according to the initial coding parameter value related to a quantization parameter and the absolute error and distortion of the current frame or a macro block of the corresponding frame, predicting the change condition of the state of a video buffer checker after the frames according to the predicted bit of each frame, jumping out the current coding parameter related to the quantization parameter and correspondingly increasing or decreasing the coding parameter value related to the quantization parameter when the state of the video buffer checker is about to underflow or overflow, and predicting the predicted bit of each frame again, wherein after the frames are coded, the state of the video buffer checker is in a reasonable range.

Preferably, S3 further specifically includes: in the process of coding a frame, firstly, a line-level prediction model is updated according to actual bits of a coded macro block, then, the bits of the non-coded macro block are predicted according to the absolute error and distortion of a previous frame or the macro block of the non-coded macro block, line-level bit prediction is carried out when the non-coded macro block is coded into a diagonal macro block of each line, whether the danger of overflow and underflow exists or not is judged according to the state of a video buffer checker and the frame bits predicted by the line level, and quantization parameters of the residual non-coded macro blocks are adjusted in time.

Preferably, in S1, adjusting the frame processing sequence before rate control according to the scene change detection result specifically includes: if the current frame is a scene switching frame, processing the frame strictly according to a frame sequence number; if the distance memory is the scene switching frame, the current frame is temporarily stored in a message queue and is not sent to the code rate control module until the last scene switching frame is sent to the code rate control processing module; if the scene switching frame does not exist in the distance, the current frame is directly sent to the code rate control processing module.

Yet another aspect of the embodiments of the present invention provides an encoder, including:

the pre-processing image decision kernel is used for carrying out scene switching detection on each frame according to the statistics of the histogram difference of the current frame and the previous frame based on the macro block;

the image management kernel is used for adjusting the frame processing sequence before the code rate control according to the scene switching detection result;

the code rate control kernel is used for estimating the prediction bit and the quantization parameter of the current frame according to the absolute error and the distortion of the current frame or the macro block of the current frame, and the state of the video buffer checker is in a reasonable range after a plurality of frames are coded;

the coding and decoding kernel is used for dividing a frame into a plurality of macro blocks and adjusting the quantization parameter of each macro block;

and the entropy coding kernel is used for feeding back the actual bit consumption of the frame to the code rate control kernel after the entire frame is subjected to entropy coding, calculating the actual coding average quantization parameter of the frame and the corresponding coding parameter value related to the quantization parameter by taking the macro block as a unit after the code rate control kernel receives the feedback bit, updating the frame-level prediction model parameter, and finally updating the state of the video buffer checker for the quantization parameter distribution of the subsequent uncoded frame.

Preferably, the image management kernel further comprises a processing unit configured to process the current frame strictly according to the frame number if the current frame is a scene change frame; if the distance memory is the scene switching frame, the current frame is temporarily stored in a message queue and is not sent to the code rate control module until the last scene switching frame is sent to the code rate control processing module; if the scene switching frame does not exist in the distance, the current frame is directly sent to the code rate control processing module.

Preferably, the rate control kernel further specifically includes: the method comprises the steps of taking the frame number of a current frame as a starting point, looking back at a plurality of frames, predicting the predicted bit of a prediction model of the frames by a frame-level prediction model according to the initial coding parameter value related to a quantization parameter and the absolute error and distortion of the current frame or a macro block of the corresponding frame, predicting the change condition of the state of a video buffer checker after the frames according to the predicted bit of each frame, jumping out the current coding parameter related to the quantization parameter and correspondingly increasing or decreasing the coding parameter value related to the quantization parameter when the state of the video buffer checker is about to underflow or overflow, and predicting the predicted bit of each frame again, wherein after the frames are coded, the state of the video buffer checker is in a reasonable range.

Preferably, the codec kernel further specifically includes: in the process of coding a frame, firstly, a line-level prediction model is updated according to actual bits of a coded macro block, then, the bits of the non-coded macro block are predicted according to the absolute error and distortion of a previous frame or the macro block of the non-coded macro block, line-level bit prediction is carried out when the non-coded macro block is coded into a diagonal macro block of each line, whether the danger of overflow and underflow exists or not is judged according to the state of a video buffer checker and the frame bits predicted by the line level, and quantization parameters of the residual non-coded macro blocks are adjusted in time.

The invention has the following beneficial effects:

(1) due to disorder challenge caused by multithreading, in the preprocessing process of the SVT-AVS3, whether the current coding frame is a scene switching frame or not is detected, if the current frame is judged to be the scene switching frame, the processing sequence of the frame is adjusted in front of the code rate control module, the mixed processing of the complex scene frame and the simple scene frame is prevented from influencing the VBV state, and thus code rate fluctuation is strictly controlled.

(2) And the code rate control module predicts the coding bit and adjusts the frame-level coding quantization parameter through a frame-level prediction model according to the SAD and VBV states of the current frame. After the frame is actually encoded, the frame-level prediction model and the VBV state are updated according to the actually encoded bit and the quantization parameter value.

(3) During the encoding of a frame, the line-level prediction model is used to more accurately predict the encoded bits of the current frame based on the bits of the actual encoded macroblock and the SAD of the unencoded macroblock. The situation of upper and lower flows of VBV caused by inaccurate frame-level prediction is prevented by timely adjusting the quantization parameters of the macro block in the encoding process.

Drawings

FIG. 1 is a flowchart illustrating a method for rate control according to an embodiment of the present invention;

fig. 2 is a schematic block diagram of an encoder according to an embodiment of the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

Referring to fig. 1, a method for controlling a code rate according to an embodiment of the present invention includes the following steps:

s1, in the preprocessing stage, it is determined whether the current frame is a scene change frame according to the statistics of the macroblock-based histogram difference between the current frame and the previous frame. If the current frame and the previous frame belong to the same scene, the gray value difference of the two frames is small, namely the histogram difference is small; if the gray value of the current frame changes suddenly, and then the histogram and the previous frame have a large difference, the scene change is very likely to occur, and whether the scene change exists is judged by accumulating the histogram difference of the whole frame. Adjusting the frame processing sequence before controlling the code rate according to the scene switching detection result;

s2, estimating the prediction bit and quantization parameter of the current frame according to the absolute error and distortion of the current frame or macro block of the current frame, when the video buffer checker is in a reasonable range after encoding several frames;

s3, dividing a frame into a plurality of macro blocks, and adjusting the quantization parameter of each macro block;

and S4, after the whole frame is coded, firstly, updating the frame-level prediction model parameters according to the actual coding quantization parameters and the actual coding bits of the frame, and correspondingly updating the state of the video buffer checker according to the prediction bits and the actual bits, so that the latest state of the video buffer checker can be obtained when the quantization parameters are allocated to the next uncoded frame in the frame-level code control mode.

In S1, the adjusting the frame processing sequence before the rate control according to the scene change detection result specifically includes: if the current frame is a scene switching frame, processing the frame strictly according to a frame Number (Picture Number); if the distance is the scene switching frame, the current frame is temporarily stored in a message queue and is not sent to the code rate control module until the last scene switching frame is sent to the code rate control processing module in order to prevent the code rate fluctuation from being challenged by the simultaneous coding of complex and simple scenes; if the scene switching frames do not exist in the distance, the frames are the same scene, and the complexity difference is not large, the current frame is directly sent to the code rate control processing module.

The specific application example, S2, further specifically includes: the method comprises the steps of taking the frame number of a current frame as a starting point, looking back at a plurality of frames, predicting the predicted bit of a prediction model of the frames by a frame-level prediction model according to the initial coding parameter value related to a quantization parameter and the absolute error and distortion of the current frame or a macro block of the corresponding frame, predicting the change condition of the state of a video buffer checker after the frames according to the predicted bit of each frame, skipping the current coding parameter related to the quantization parameter and correspondingly increasing or decreasing the coding parameter value related to the quantization parameter when the state of the video buffer checker is about to underflow or overflow, and predicting the predicted bit of each frame again, wherein after the frames are coded, the VBV state of the video buffer checker is in a reasonable range.

The prediction relation between the prediction bit PredBat (the normal value range is 0-20 Mm) of the prediction model and the coding parameter Qcycle (the normal value range is 0-100) related to the quantization parameter is as follows:

wherein the frame-level product coefficient coeffpicFrame-level compensation coefficient offsetpicFrame level cumulative coefficient countpicRespectively, the parameters of the frame-level prediction model, and SAD the absolute error and distortion.

The reasonable range of the VBV state is usually 0.4-0.8, that is, the optimal coding quantization parameter of the current frame is found, and the relation (2) between the quantization parameter QP and the Qsacle is shown. After determining the optimal Qsacle and PredBit of the current frame, updating the VBV state (vbvbbufferfil), as shown in equation (3).

QP=12+6.0×log2(Qscale/0.85) (2)

vbvBufferfill-=PredBit (3)

In a specific application example, S3 further specifically includes: because the frame-level prediction model inevitably has errors, in order to prevent the upper underflow and the lower overflow of VBV caused by the frame-level prediction errors, in the process of encoding a frame, firstly, the line-level prediction model is updated according to the actual bits of the encoded macro block, and then, the bits of the non-encoded macro block are predicted according to the absolute error SAD and the distortion of the previous frame or the macro block of the non-encoded macro block, so as to more accurately predict the encoded bits of the current frame. The row-level bit prediction is shown as the formula (4) and the formula (5). And when the diagonal macro blocks of each line are coded, line-level bit prediction is carried out, whether the danger of upper overflow and underflow exists is judged according to the state of a video buffer checker and the frame bits of the line-level prediction, and the quantization parameters of the rest uncoded macro blocks are adjusted in time.

Wherein, the row-level product coefficient coeffrowRow-level compensation coefficient offsetrowRow level cumulative coefficient countrowRespectively, parameters of the line-level prediction model, SADencodedSum SADuncodedWhich respectively represent the SAD of the coded macroblock of the current frame and the SAD of the uncoded macroblock of the current frame.

PredBit=PredBituncoded+Bitencoded (5)

Wherein, PredBaituncodedAnd BituncodedRespectively representing the predicted bit of the non-coded macroblock and the accumulated bit of the coded macroblock of the current frame.

In a specific application example, in S4, after the entire frame is encoded, the frame-level prediction model parameters are updated according to the actual encoding quantization parameters and the actual encoding bits of the frame, and the process of updating the prediction model parameters at the line level and the frame level is the same as that of the equations (6) to (9). Where ActuALBit represents the actual coded bit, offset of the current frameoldRepresenting the multiplication coefficient, coeff, used when predicting bit beforetempAnd offsettempSaving computations for temporary variablesCoefficient value, coeffnewAnd offsetnewRepresenting the predictor product coefficient and the compensation coefficient updated according to the actual coding bit. Because the predicted bit and the actual bit of the frame level have errors, the VBV state needs to be updated correspondingly according to the predicted bit and the actual bit, so that the latest VBV state can be obtained when the next uncoded frame is subjected to frame-level code control allocation of quantization parameters. The VBV state (vbvbvbbufferfil) is updated as shown in equation (10).

offsettemp=ActualBit×Qscale-coefftemp×SAD (7)

coeffnew=coeffold×0-5+coefftemp (8)

offsetnew=offsetold×0.5+offsettemp (9)

vbvBufferfill+=PredBit-ActualBit (10)

Corresponding to the embodiment of the method of the present invention, referring to fig. 2, a schematic block diagram of an encoder according to the embodiment of the present invention is shown, which includes a pre-processed image decision core 10, an image management core 20, a rate control core 30, an encoding and decoding core 40, and an entropy coding core 50, where the pre-processed image decision core 10 is configured to perform scene switching detection on each frame according to statistics of macroblock-based histogram differences between a current frame and a previous frame; an image management kernel 20, configured to adjust a frame processing sequence before rate control according to a scene change detection result; a code rate control kernel 30, configured to estimate a prediction bit and a quantization parameter of a current frame according to an absolute error and distortion of the current frame or a macroblock of the current frame, where after the current frame or macroblock is encoded, a state of a video buffer checker is within a reasonable range; a codec core 40 for dividing a frame into a plurality of macroblocks and adjusting a quantization parameter of each macroblock; the entropy coding kernel 50 is configured to feed back actual bit consumption of the frame to the rate control kernel after entropy coding the complete frame, calculate an actual coding average quantization parameter of the frame and a corresponding coding parameter value related to the quantization parameter in units of macro blocks after the rate control kernel receives the feedback bit, update a frame-level prediction model parameter, and finally update a video buffer checker state for quantization parameter allocation of a subsequent uncoded frame.

In a specific application example, the image management kernel 20 is further configured to, if the current frame is a scene change frame, process the current frame strictly according to a frame number; if the distance memory is the scene switching frame, the current frame is temporarily stored in a message queue and is not sent to the code rate control module until the last scene switching frame is sent to the code rate control processing module; if the scene switching frame does not exist in the distance, the current frame is directly sent to the code rate control processing module.

In a specific application example, the rate control kernel 30 further specifically includes: the method comprises the steps of taking the frame number of a current frame as a starting point, looking back at a plurality of frames, predicting the predicted bit of a prediction model of the frames by a frame-level prediction model according to the initial coding parameter value related to a quantization parameter and the absolute error and distortion of the current frame or a macro block of the corresponding frame, predicting the change condition of the state of a video buffer checker after the frames according to the predicted bit of each frame, jumping out the current coding parameter related to the quantization parameter and correspondingly increasing or decreasing the coding parameter value related to the quantization parameter when the state of the video buffer checker is about to underflow or overflow, and predicting the predicted bit of each frame again, wherein after the frames are coded, the state of the video buffer checker is in a reasonable range.

In a specific application example, the codec kernel 40 further specifically includes: in the process of coding a frame, firstly, a line-level prediction model is updated according to actual bits of a coded macro block, then, the bits of the non-coded macro block are predicted according to the absolute error and distortion of a previous frame or the macro block of the non-coded macro block, line-level bit prediction is carried out when the non-coded macro block is coded into a diagonal macro block of each line, whether the danger of overflow and underflow exists or not is judged according to the state of a video buffer checker and the frame bits predicted by the line level, and quantization parameters of the residual non-coded macro blocks are adjusted in time.

It can be understood by those skilled in the art that other technical implementation details in the encoder are the same as those of the above-mentioned rate control method, and are not described herein again.

In order to verify the effectiveness of the technical scheme, the SVT-AVS3 encoder realized by the method of the invention uses the ClassA and ClassB part general test sequence test of HEVC. The hardware configuration of the experimental platform is Intel (R) core (TM) [email protected], the memory is 16G, and Windows 1064-bit operating system. The encoding parameter is a group of pictures (GOP), the length is 25, the number of B frames is 7, and the number of reference frames is 2. In order to compare the influence of different code rate control models on the code rate fluctuation, an output Buffer (Buffer) is set to observe the change of the code rate in the coding process, wherein the Buffer subtracts the coding bit of the frame and adds the average bit of each frame under the target code rate after each frame is coded. And counting the coding effect difference of different code rate control models for each 1000 coded frames of each sequence, wherein the Buffer size is equal to the target code rate, and the initial Buffer value is equal to 0.7 multiplied by the Buffer size.

Table 1 shows the results of the code rate control precision and the code rate fluctuation condition of each test sequence which is coded by the method of the invention and compared with the original SVT-AVS3 coder. It can be seen that under the condition of ensuring the same coding quality, the code rate control accuracy of the proposed method is much higher than that of the original SVT-AVS3 encoder, wherein the average code rate control accuracy of the original SVT-AVS3 encoder in the tested sequence is 89.88%, and the control accuracy is lower, while the average code rate control accuracy of the method of the invention in the tested sequence is 99.46%, which can realize more accurate code rate control accuracy compared with the code rate control model of the original SVT-AVS3 encoder.

And comparing the influence of different code rate control models on code rate fluctuation by setting an output Buffer. Wherein, MaxBuffer represents the maximum Buffer state of the output Buffer in the whole sequence encoding process, and corresponding MinBuffer represents the minimum Buffer state. It should be noted that when the continuous coded frame bit is greater than the average bit, the output Buffer continuously decreases until a negative value occurs, and at this time, an underflow condition occurs, and a stuck phenomenon is easily caused, thereby reducing the user experience; when the continuous coding frame bit is smaller than the average bit, the output Buffer continuously rises, overflow occurs, but the overflow condition cannot cause obvious reduction of user experience. Comparing the code rate fluctuation conditions of the method and the original SVT-AVS3 encoder, the code rate of the original SVT-AVS3 encoder can be seen to have great fluctuation, the average fluctuation of the tested sequence reaches 2685.34ms, and underflow conditions all occur; the code rate fluctuation under the coding of the method is obviously reduced, the average fluctuation of the tested sequence is only 267.34ms, and the conditions of upper underflow and underflow do not occur. In addition, the method has little influence on the calculation complexity of the encoder, and the encoding speed is almost the same as that of the original SVT-AVS3 encoder. The method effectively improves the code rate control precision and the code rate fluctuation condition of the SVT-AVS3 encoder under the condition of ensuring the encoding quality, and has higher value for the low-delay application scene of the SVT-AVS3 encoder.

TABLE 1 comparison of the method of the present invention with the rate control results of the original SVT-AVS3 encoder

And comparing the influence of different code rate control models on code rate fluctuation by setting an output Buffer. Wherein, MaxBuffer represents the maximum Buffer state of the output Buffer in the whole sequence encoding process, and corresponding MinBuffer represents the minimum Buffer state. It should be noted that when the continuous coded frame bit is greater than the average bit, the output Buffer continuously decreases until a negative value occurs, and at this time, an underflow condition occurs, and a stuck phenomenon is easily caused, thereby reducing the user experience; when the continuous coding frame bit is smaller than the average bit, the output Buffer continuously rises, overflow occurs, but the overflow condition cannot cause obvious reduction of user experience. Comparing the code rate fluctuation conditions of the method and the original SVT-AVS3 encoder, the code rate of the original SVT-AVS3 encoder can be seen to have great fluctuation, the average fluctuation of the tested sequence reaches 2685.34ms, and underflow conditions all occur; the code rate fluctuation under the coding of the method is obviously reduced, the average fluctuation of the tested sequence is only 267.34ms, and the conditions of upper underflow and underflow do not occur. In addition, the method has little influence on the calculation complexity of the encoder, and the encoding speed is almost the same as that of the original SVT-AVS3 encoder. The method effectively improves the code rate control precision and the code rate fluctuation condition of the SVT-AVS3 encoder under the condition of ensuring the encoding quality, and has higher value for the low-delay application scene of the SVT-AVS3 encoder.

It is to be understood that the exemplary embodiments described herein are illustrative and not restrictive. Although one or more embodiments of the present invention have been described with reference to the accompanying drawings, it will be understood by those of ordinary skill in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present invention as defined by the following claims.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:特征量化方法和装置、编码器、通信系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类