CN102724510B - Code rate control algorithm based on fullness degree of virtual encoding buffer area - Google Patents

Code rate control algorithm based on fullness degree of virtual encoding buffer area Download PDF

Info

Publication number
CN102724510B
CN102724510B CN201210211763.1A CN201210211763A CN102724510B CN 102724510 B CN102724510 B CN 102724510B CN 201210211763 A CN201210211763 A CN 201210211763A CN 102724510 B CN102724510 B CN 102724510B
Authority
CN
China
Prior art keywords
currvbf
frame
value
fullness degree
quantization parameter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201210211763.1A
Other languages
Chinese (zh)
Other versions
CN102724510A (en
Inventor
杨新辉
刘任化
刘博远
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZHONGKE KAIYUAN INFORMATION TECHNOLOGY (BEIJING) Co Ltd
Original Assignee
ZHONGKE KAIYUAN INFORMATION TECHNOLOGY (BEIJING) Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZHONGKE KAIYUAN INFORMATION TECHNOLOGY (BEIJING) Co Ltd filed Critical ZHONGKE KAIYUAN INFORMATION TECHNOLOGY (BEIJING) Co Ltd
Priority to CN201210211763.1A priority Critical patent/CN102724510B/en
Publication of CN102724510A publication Critical patent/CN102724510A/en
Application granted granted Critical
Publication of CN102724510B publication Critical patent/CN102724510B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention provides code rate control algorithm based on the fullness degree of a virtual encoding buffer area, which meets the requirement of target code rate by strictly controlling the scope of the fullness degree of the virtual encoding buffer area on an encoding end, determines a quantization parameter (QP) value according to the fullness degree of a current virtual encoding buffer area and the change of the fullness degree of the virtual encoding buffer area after the last frame is encoded with the fullness degree of the current virtual buffer area, the change of the fullness degree and the quantization step length of the fullness degree as the input, determines the maximum and minimum QP values according to the complicacy mean of absolute difference (MAD) value of the original data or the residual data of an image or an audio frame, and restricts the scope of the QP value through the maximum and minimum QP values. According to the algorithm, a result is better balanced between code rate control convergence and image or audio quality by considering the changes of the actual complicacy of the image and audio data by strictly controlling the scope of the fullness degree of the virtual encoding buffer area on the encoding end.

Description

A kind of rate control algorithm based on virtual encoder buffering area fullness degree
Technical field
The invention belongs to digital audio/video coding techniques, be specifically related to the rate control algorithm of digital audio/video coding.
Background technology
Rate Control is one of very important technology in audio/video coding, its main task is effectively to control audio/video coder to choose quantization step, make the size of its output code flow meet the restriction of transmission channel actual bandwidth, and, obtain as far as possible optimum decoded picture or audio sample, Rate Control is the hot issue in audio/video coding technical research field always, any audio and video standard leaves its application of Rate Control and all can be restricted, more famous algorithm mainly contains MPEG-2TM-5 at present, MPEG-4VM8, and H.264JVT-F086 H.263TMN-8, JVT-G012 etc.
Generally speaking, we can be decomposed into two steps rate control algorithm, the first step is exactly so-called " position distribute (bit allocation) ", limited allocated bandwidth in the images such as image sets (GOP) or audio frame bag, frame and macro block or audio block or audio frequency unit; Second step calculates quantization parameter value (QP value) exactly, so that actual bit rate output and target bit rate are basically identical.The design object of rate control algorithm is exactly to realize the accurate control of optimum bit allocation and bit rate output, and its key is to set up accurate Mathematical Modeling.
For MPEG-2 TM-5, MPEG-4 VM8, H.263 TMN-8 and H.264JVT-F086, JVT-G012 scheduling algorithm is owing to will carrying out RDO(Rate distortion Optimization) iterative computation (position is distributed), its complexity higher (as JVT-F086 needs secondary coding); Due to large (as JVT_G012, the MPEG-4VM8) of predicated error of rate-distortion model (calculating quantization parameter), the control effect of target bit rate is bad, must realize CBR pattern by frame-skipping; And the larger or unavailable situation in complexity (as the MAD:Mean Average Difference) error of residual error data, target bit rate control effect is poor, and convergence is poor.
For these deficiencies, the present invention proposes a kind of computational complexity low, target bit rate control is the rate control algorithm based on virtual encoder buffering area fullness degree preferably, and coding after audio-visual quality suitable with existing algorithm, especially in some special situations (as the situation of complex scene and simple scenario switching), better effects if.This algorithm is by strictly control the scope of virtual encoder buffering area fullness degree at coding side, and considered the variation of image and voice data actual complex degree, consequently between Rate Control convergence and image and audio quality, arrives good balance.
Summary of the invention:
The present invention proposes a kind of rate control algorithm based on virtual encoder buffering area fullness degree, this algorithm meets the requirement of target bit rate by strictly control the scope of virtual encoder buffering area fullness degree at coding side, and determine quantization parameter QP value according to current virtual encoder buffering area fullness degree and the previous frame rear virtual encoder buffering area fullness degree situation of change of having encoded, in the time determining quantization parameter QP value, with current virtual buffering region fullness degree, the change degree of fullness degree and the quantization step of fullness degree are input, determine QP value, and determine minimax quantization parameter QP value according to the complexity MAD value of residual error data, by the scope of minimax parameter QP value restriction quantization parameter QP value.
Because this algorithm is directly to control virtual encoder buffering area fullness degree to control target bit rate, therefore can well control target bit rate.This encryption algorithm can determine quantization parameter QP value according to virtual encoder buffering area fullness degree and situation of change thereof, and make quantization parameter QP value approach the ideal quantized parameter QP value of corresponding target bit rate, and audio-visual quality does not have too large variation compared with existing algorithm.
The invention provides a kind of rate control algorithm based on virtual encoder buffering area fullness degree, described algorithm comprises the following steps:
The first step: the scope of restriction virtual encoder buffering area fullness degree is to meet the requirement of target bit rate;
Second step: the quantization step VBFCStep that calculates virtual encoder buffering area fullness degree;
The 3rd step: the changing value InitialDeltaQP that calculates audio frequency and video sequence the first frame quantization parameter value InitialQP and quantization parameter;
The 4th step: according to the virtual encoder buffering area fullness degree PrevVBF before former frame coding, the virtual encoder buffering area fullness degree CurrVBF before present frame coding and the quantization step VBFCStep of fullness degree, the changing value Δ QP of the quantization parameter of calculating based on former frame 1;
The 5th step: according to the virtual encoder buffering area fullness degree PrevVBF before former frame coding, the virtual encoder buffering area fullness degree CurrVBF before present frame coding and the quantization step VBFCStep of fullness degree, the changing value Δ QP of the quantization parameter of calculating based on former frame 2;
The 6th step: according to the change direction of virtual encoder buffering area fullness degree before and after former frame coding, and according to the quantization parameter value PrevQP of former frame, changing value Δ QP 1and Δ QP 2calculate current quantization parameter value CurrQP that will coded frame;
The 7th step: according to the complexity value CurrMAD of the mean value CurrMean linear prediction present frame residual error coefficient of the average value P revMean of the complexity value PrevMAD of former frame residual error data, the former data of former frame and the former data of present frame or directly calculate the complexity value CurrMAD of initial data according to the initial data of present frame;
The 8th step: calculate the minimax quantization parameter value MaxQP of present frame, MinQP according to the residual error data of present frame of calculating or the complexity value CurrMAD of initial data;
The 9th step: according to minimax parameter value MaxQP, the scope of the current quantization parameter value CurrQP that will coded frame of MinQP restriction;
The tenth step: the realization of the renewal of virtual encoder buffering area fullness degree after frame coding.
The beneficial effect of this algorithm is:
1) control target bit rate by direct control virtual encoder buffering area fullness degree, after coding, the code check of code stream is well positioned to meet the requirement of target bit rate, and code check is take target bit rate as axis, and fluctuating range is between [5%, 5%]; And can realize CBR pattern by frame-skipping in the scope allowing in encoder performance.
2) this algorithm does not have RDO iterative computation, does not need to carry out secondary coding, and computational complexity is low, be applicable to postponing to require stricter applied environment, as: visual telephone, video conference, the audiovisual applications that television broadcasting etc. are real-time.
3) due in the time determining QP value, considered the complexity of audio/video frames, therefore this algorithm audio-visual quality does not have too large variation compared with existing algorithm, even in some special situations (as complicated situation about switching with simple scenario), better effects if.
4) this algorithm to be to sacrifice a frame as cost, the complicated digital audio-video signal switching with simple scenario of response that can be very fast.And the quantization parameter determining final converge on desirable quantization parameter value.
5) this algorithm is practically applicable to (to can not get or can not get the complexity of frame comparatively accurately, residual error bit) in those condition constrained environments and realizes the Rate Control of audio/video coder very much.
Accompanying drawing explanation
Fig. 1 is the algorithm overall framework figure in the present invention;
Fig. 2 is the algorithm basic principle schematic in the present invention;
Fig. 3 is that in the present invention, former frame is encoded rear virtual encoder buffering area fullness degree away from zero axis schematic diagram;
Fig. 4 is the changing value Δ QP that calculates the quantization parameter based on former frame in the present invention 1flow chart;
Fig. 5 is that in the present invention, former frame is encoded rear virtual encoder buffering area fullness degree near zero axis schematic diagram;
Fig. 6 is the changing value Δ QP that calculates the quantization parameter based on former frame in the present invention 2flow chart.
Specific embodiment:
By directly controlling virtual encoder buffering area fullness degree, (virtual encoder buffering area refers to that coding side does not exist such buffering area to algorithm of the present invention, and it is present in decoding end; Fullness degree refers to the number of the bit number having in buffering area) scope control target bit rate, consider coded image and voice data complexity, and limit the possible span of quantization parameter according to the maximin of the state adjustment quantization parameter of virtual encoder buffering area fullness degree.The overall framework figure of this algorithm is referring to accompanying drawing 1.
This algorithm basic principle is as follows:
When virtual encoder buffering area, fullness degree departs from 0, by adjusting quantization parameter, i.e. Δ QP 1, make the size of data after coding start to increase or reduce from next frame, virtual encoder buffering area fullness degree is close to 0.
When image or audio frame complexity change in situation greatly, may no matter whether adjust quantization parameter, virtual encoder buffering area fullness degree still departs from 0, in this case by detecting the adjusted value of quantization parameter and the variation of virtual encoder buffering area, frame coding front and back fullness degree of frame, the quantization parameter of frame is done to a feedback modifiers, i.e. Δ QP 2, make its quantization parameter respond fast the variation of complexity, the size of data after frame coding starts to increase or reduce from lower two frames, and virtual encoder buffering area fullness degree is close to 0.
In the time that content frame suddenlys change, mode above can't well be controlled virtual encoder buffering area fullness degree, and this algorithm is taked the complexity value of computed image or audio frame, and estimates the scope of maximin quantization parameter restriction quantization parameter by complexity value.By weakening the impact of this catastrophe point, virtual encoder buffering area fullness degree is not departed from 0 too far away, and can make virtual encoder buffering area fullness degree close to 0 after follow-up several frames codings.The basic principle schematic of this algorithm is referring to accompanying drawing 2.
The step of this algorithm comprises:
The first step: the scope of restriction virtual encoder buffering area fullness degree is to meet the requirement of target bit rate.
According to the scope [MinVBF, MaxVBF] of the fullness degree of the big or small VBFSize of virtual buffering region and delay side-play amount DelayOffset restriction virtual buffering region, thus restriction Δ QP 1the maximum delay compensation rate of value and virtual buffering region, object is in order to process when the comparatively simple image of the code check coding with higher or voice data.
The computing formula of minimax fullness degree is as follows:
MinVBF = max ( DelayOffset - VBFSize , - DelayOffset + 1 2 ) × VBFScale 1 - - - ( 1 )
MaxVBF=VBFSize×VBFScale2 (2)
Wherein VBFScale1, VBFScale2 is constant factor, is determined by encoder type.The span of VBFScale1 is [0,1.0], and the span of VBFScale2 is [0.25,1.0], and their value comes from experiment statistics data.
Only have as the big or small VBFSize of virtual buffering region or postpone side-play amount DelayOffset while becoming, the scope of the fullness degree of virtual buffering region just need to recalculate.It completes in Rate Control initialization module.
Second step: the quantization step VBFCStep that calculates virtual encoder buffering area fullness degree.
Determine the quantization step of virtual encoder buffering area fullness degree according to the bit number FrmBitSize that is averagely allocated to every frame.In the 4th step below, will calculate Δ QP according to the virtual encoder buffering area fullness degree before and after the quantization step of fullness degree and former frame coding 1value will be calculated Δ QP according to the change degree of the virtual encoder buffering area fullness degree before and after the quantization step of fullness degree and former frame coding in the 5th step 2value.
The computing formula of the quantization step of virtual encoder buffering area fullness degree is:
VBFCStep=FrmBitSize*StepScale (3)
Wherein StepScale is constant factor, is determined by encoder type, and its span is [0.25,1.0], and its value comes from experiment statistics data.
For digital video, the quantization step of virtual encoder buffering area fullness degree changes the variation along with target bit rate or frame per second, and for digital audio, the quantization step of virtual encoder buffering area fullness degree changes the variation of the hits along with sample rate or every frame.It completes in Rate Control initialization module.
The 3rd step: the changing value InitialDeltaQP that calculates audio frequency and video sequence the first frame quantization parameter value InitialQP and quantization parameter:
According to target bit rate T arg etBitRate, frame per second FrmRate, and the changing value InitialDeltaQP of the hits of audio frame or the resolution FrmSize of frame of video calculating audio frequency and video sequence the first audio frequency or frame of video quantization parameter value InitialQP and quantization parameter:
Its computing formula is:
InitialDeltaQP = - CF × func ( bpp bpp c ) , bpp ≠ bpp c 0 , bpp ≡ bpp c - - - ( 4 )
IntialQP=QP c+InitialDel taQP (5)
bpp = T arg etBitRate FrmRate × FrmSize - - - ( 6 )
Wherein CF, QP c, bpp cfor constant factor, CF is determined by encoder type, QP c, bpp cdetermined by encoder specific implementation, their value comes from experiment; Bpp is the bit number of distributing to each audio sample or video pixel, and the function of func () is that bpp ratio is mapped as to quantization parameter value, sets according to encoder type, and it possesses following two character:
1) at bpp cthe continuity of promise InitiaIDeltaQP.
2) be monotonically increasing function.
As target bit rate T arg etBitRate, when the hits of frame per second FrmRate and audio frame or the resolution FrmSize of frame of video change, need to recalculate the first frame quantization parameter value InitialQP, it completes in Rate Control initialization module.
The 4th step: according to the virtual encoder buffering area fullness degree PrevVBF before former frame coding, the virtual encoder buffering area fullness degree CurrVBF before present frame coding and the quantization step VBFCStep of fullness degree, the changing value Δ QP of the quantization parameter of calculating based on former frame 1.
The adjustment principle of quantization parameter is as follows:
1) in the time of CurrVBF>PrevVBF >=0, illustrate after former frame has been encoded, virtual encoder buffering area fullness degree positive direction is away from 0, the instant code check after coding is higher than target bit rate, this situation, should increase quantization parameter value and make frame coded bit number be less than the target bit of average every frame, thereby make virtual encoder buffering area fullness degree close to 0.
2) in the time of CurrVBF<PrevVBF≤0, illustrate after former frame has been encoded, virtual encoder buffering area fullness degree negative direction is away from 0, the instant code check after coding is lower than target bit rate, this situation, should reduce quantization parameter value and make frame coded bit number be greater than the target bit of average every frame, thereby make virtual encoder buffering area fullness degree close to 0.
3) work as CurrVBF>0>PrevVBF, when CurrVBF>ABS (Pr evVBF), illustrate after former frame has been encoded, instant code check from coding forwards to higher than target bit rate lower than target bit rate, this situation, should increase quantization parameter value and make frame coded bit number be less than the target bit of average every frame, thereby make virtual encoder buffering area fullness degree close to 0.
4) work as CurrVBF<0<PrevVBF, when ABS (CurrVBF) >PrevVBF, illustrate after former frame has been encoded, instant code check from coding forwards to lower than target higher than target bit rate, this situation, should reduce quantization parameter value and make frame coded bit number be greater than the target bit of average every frame, thereby make virtual encoder buffering area fullness degree close to 0.
Describing said process with formula is:
B ( x ) = x VBFCStep - - - ( 7 )
&Delta; QP 1 = K 1 &times; B ( CurrVBF ) - K 2 &times; B ( PrevVBF ) , CurrVBF > PrevVBF &GreaterEqual; 0 K 1 &times; B ( ABS ( CurrVBF ) ) + K 2 &times; B ( PreVBF ) , CurrVBF < PrevVBF &le; 0 K 1 &times; B ( CurrVBF ) + K 2 &times; B ( PreVBF ) , CurrVBF > 0 > PrevVBF , CurrVBF > ABS ( PrevVBF ) K 1 &times; B ( ABS ( CurrVBF ) ) - K 2 &times; B ( PreVBF ) , CurrVBF < 0 < PrevVBF , ABS ( CurrVBF ) > PrevVBF 0 , ABS ( CurrVBF < = ABS ( PrevVBF ) - - - ( 8 )
Wherein K 1, K 2for constant factor, K 1>0, K 2>0, is determined by encoder type, and their value comes from experiment statistics data; Wherein B (x) represents virtual encoder buffering area fullness degree value and quantization parameter changing value Δ QP 1mapping function; Variable x represents virtual encoder buffering area fullness degree value.
For the first frame, there is no former frame, so Δ QP 1=0.
For other frame, make Δ QP 1effectively, the situation of change of virtual encoder buffering area, former frame coding front and back fullness degree is referring to accompanying drawing 2.
Calculate the changing value Δ QP of the quantization parameter based on former frame 1flow process referring to accompanying drawing 3.
The 5th step: according to the virtual encoder buffering area fullness degree PrevVBF before former frame coding, the virtual encoder buffering area fullness degree CurrVBF before present frame coding and the quantization step VBFCStep of fullness degree, the changing value Δ QP of the quantization parameter of calculating based on former frame 2.Its computing formula is:
&Delta;QP 2 = ABS ( PrevVBF - CurrVBF ) VBFCStep &times; CQPStep , ABS ( CurrVBF ) < ABS ( PrevVBF ) 0 , ABS ( CurrVBF ) > = ABS ( PrevVBF ) - - - ( 9 )
Wherein CQPStep is constant factor, is determined by encoder type, and its value comes from experiment statistics data.
For the first frame, there is no former frame, so Δ QP 2=0.
For other frame, make Δ QP 2effectively, the situation of change of virtual encoder buffering area, former frame coding front and back fullness degree is referring to accompanying drawing 4.
Under the precondition of ABS (CurrVBF) <ABS (PrevVBF), according to the virtual encoder buffering area fullness degree before and after former frame coding, and the changing value DeltaQP of the quantization parameter value of former frame and front cross frame judges that the main cause that virtual encoder buffering area fullness degree changes after former frame coding is the variation of quantization parameter value or the variation by frame complexity, and adjust Δ QP according to the result of judgement 2value.Judgment principle is as follows:
1) if PrevVBF>=0 and DeltaQP<0, the main cause that after former frame coding, virtual encoder buffering area fullness degree changes is that variation has greatly occurred frame complexity and is that complexity is to simple, therefore quantization parameter value should reduce the variation with response frame complexity, now Δ QP 2=-Δ QP 2.
2) if PrevVBF<0 and DeltaQP>0, the main cause that after former frame coding, virtual encoder buffering area fullness degree changes is that frame complexity variation has greatly occurred and is simple to complicated, and therefore quantization parameter value should increase the variation with response frame complexity.Now Δ QP 2symbol is constant.
3) if PrevVBF>=0 and DeltaQP>0, the main cause that after former frame coding, virtual encoder buffering area fullness degree changes is that the variation of quantization parameter value causes, now Δ QP 2=-Δ QP 2.
4) if PrevVBF<0 and DeltaQP<0, the main cause that after former frame coding, virtual encoder buffering area fullness degree changes is that the variation of quantization parameter value causes, now Δ QP 2symbol is constant.
5) if DeltaQP ≡ 0 further judge according to the complexity value Prev2MAD of the complexity value PrevlMAD of former frame and front cross frame.
If ABS (Prev1MAD-Prev2MAD)>=ThresholdMAD, the main cause that after former frame coding, virtual encoder buffering area fullness degree changes is that variation has greatly occurred frame complexity, Δ QP 2symbol contrary with the symbol of PrevVBF.
If ABS (Prev1MAD-Prev2MAD) is <ThresholdMAD, whether there is to change further judgement according to frame type, if do not changed, the main cause that after former frame coding, virtual encoder buffering area fullness degree changes is that variation has greatly occurred frame complexity, Δ QP 2symbol contrary with the symbol of PrevVBF.Otherwise Δ QP 2=0.
Wherein ThresholdMAD is constant factor, and it is different and different according to the method for calculating MAD value, and its value comes from experiment statistics data; ABS () is the operation that takes absolute value.
Calculate the changing value Δ QP of the quantization parameter based on former frame 2flow process see accompanying drawing 5.The 6th step: according to the change direction of virtual encoder buffering area fullness degree before and after former frame coding, and according to the quantization parameter value PrevQP of former frame, changing value Δ QP 1and Δ QP 2calculate the method for current quantization parameter value CurrQP that will coded frame.
After former frame has been encoded, before present frame will be encoded, according to changing value Δ QP 2and the quantization parameter value PrevQP of former frame, quantization parameter value PrevQP to former frame revises, and also according to the encoded situation of change of rear virtual encoder buffering area fullness degree of former frame, the correctness of the quantization parameter value PrevQP determining before former frame coding is fed back.
Its computing formula is:
PrevQP′=PrevQP+ΔQP 2 (10)
The quantization parameter value that wherein PrevQP is former frame, the quantization parameter value that PrevQP ' is revised former frame.
According to the symbol of virtual encoder buffering area fullness degree before present frame coding, and the quantization parameter value PrevQP' of revised former frame and changing value Δ QP 1calculate current quantization parameter value CurrQP that will coded frame.
Its computing formula is:
CurrQP Prev QP &prime; + &Delta;QP 1 , CurrVBF > 0 Prev QP &prime; - &Delta;QP 1 CurrVBF < 0 Prev QP &prime; , CurrVBF &equiv; 0 - - - ( 11 )
The 7th step: according to the complexity value PrevMAD(MAD:Mean Absolute Difference of former frame residual error data), the complexity value CurrMAD of the average value P revMean of former frame initial data and the mean value CurrMean linear prediction present frame residual error coefficient of present frame initial data or directly calculate the complexity value CurrMAD of initial data according to the initial data of present frame.
There is the method for sowing and calculate the complexity of present frame:
1) initial data by present frame is calculated the complexity value CurrMAD of present frame:
For digital video frame, its computing formula is:
CurrMAD i = 1 N &times; M &Sigma; x = 1 N &Sigma; y = 1 M | F i ( x , y ) - E i ( x , y ) |
Figure BDA00001794694600133
Wherein F i(x, y) is each component value of pixel three primary colors, and RGBB is total bit number (as RGB565, RGBB=16) that rgb format represents a pixel; RGB ithe bit number that three primary colors respectively take.
For digital audio frames, its computing formula is:
CurrMAD = 1 N &Sigma; x = 1 N | F ( x ) - E | (13)
E = 1 N &Sigma; x = 1 N F ( x )
Wherein F (x) is audio sample value.
2) by the complexity value PrevMAD of former frame, the average value P revMean of the initial data of former frame, the mean value CurrMean of present frame initial data, the complexity value CurrMAD of linear prediction present frame
Its computing formula is:
CurrMAD = CurrMean PrevMean &times; PrevMAD - - - ( 14 )
The complexity value that wherein PrevMAD is former frame.
For digital video frame, its computing formula is:
PrevMAD i = 1 N &times; M &Sigma; x = 1 N &Sigma; y = 1 M | Res i ( x , y ) - E i ( x , y ) |
Figure BDA00001794694600143
Figure BDA00001794694600144
Wherein Res i(x, y) is each component residual error coefficient value of pixel three primary colors.
For digital audio frames, its computing formula is:
CurrMAD = 1 N &Sigma; x = 1 N | Res ( x ) - E ( x ) | (16)
E ( x ) = 1 N &Sigma; x = 1 N Res ( x )
The residual error coefficient value that wherein Res (x) is audio sample.
The 8th step: calculate the minimax quantization parameter value MaxQP of present frame according to the complexity value CurrMAD of the residual error data of present frame or initial data, MinQP:
Its computing formula is:
Figure BDA00001794694600147
Figure BDA00001794694600151
Wherein MAD2QPScale 1, MAD2QPScale 2for from image or audio frame complexity value to the mapping-factor of quantization parameter value, determined by encoder type, its span is respectively [0.2,0.8], [1.5,3.0], their value comes from experiment statistics data; MIN_QP is minimum quantization parameter value, and MAX_QP is maximum quantization parameter value, is determined by the type of encoder.
Condition 1 is: CurrVBF≤-VBFStep × C_NUM (19)
Condition 2 is: CurrVBF >=VBFStep × C_NUM (20)
Wherein [VBFStep × C_NUM, VBFStep × C_NUM] wishes the domain of walker of virtual encoder buffering area fullness degree of controlling for Rate Control.
The 9th step: according to minimax parameter value MaxQP, the method for the scope of the current quantization parameter value CurrQP that will coded frame of MinQP restriction.
Its computing formula is:
CurrQP=min(MaxQP,max(MinQP,CurrQP)) (21)
The tenth step: the update method of virtual encoder buffering area fullness degree after frame coding.
Its computing formula is:
PrevVBF=CurrVBF
CurrVBF = FrmEncSize - T arg etBitRate FrmRate - - - ( 22 )
Wherein FrmEncSize is the size after frame has been encoded.
[embodiment mono-]
Below by a concrete example, the implementation method to this algorithm and device is described.
Bit rate control method disclosed herein can be for digital audio, in Video coding.For example, can be for MPEG2, H.263, and H.264, in the encoders such as MP3.
Introduce the specific implementation of each technical scheme main points as an example of encoder H.264 example, although this enforcement is introduced as an example of digital video code example, the method for introducing in this algorithm and device is equally applicable to the Rate Control of digital audio encoder.
1, the realization of the scope of restriction virtual encoder buffering area fullness degree
According to the big or small VBFSize of virtual CPB and postpone side-play amount DelayOffset and limit the scope of the fullness degree of virtual CPB.
The computing formula of minimax fullness degree is as follows:
MinVBF = _ max ( DelayOffset - VBFSize , - DelayOffset + 1 2 ) - - - ( 23 )
MaxVBF=VBFSize (24)
2, calculate the realization of the quantization step of virtual encoder buffering area fullness degree
Determine the quantization step of virtual encoder buffering area fullness degree according to the bit number FrmBitSize that is averagely allocated to every frame.
The computing formula of the quantization step of virtual encoder buffering area fullness degree is:
VBFCStep=FrmBitSize (25)
3, calculate the realization of the first frame quantization parameter value InitialQP and InitialDeltaQP
According to target bit rate T arg etBitRate, frame per second FrmRate, resolution FrmSize calculates the changing value InitialDeltaQP of frame of video quantization parameter value InitialQP and quantization parameter.
Its computing formula is:
InitialDeltaQP = - 6 &times; log 2 ( bpp bpp c ) , bpp &NotEqual; bpp c 0 , bpp &equiv; bpp c - - - ( 26 )
InitialQP=QP c+InitialDel taQP (27)
bpp = T arg etBitRate FrmRate &times; FrmSize - - - ( 28 )
The wherein span of T arg etBitRate: >=64Kbps; The span of FrmRate is: [1,60fps]; The span of FrmSize is: [QCIF, FHD:1920*1080p]; QP c, bpp caccording to difference H.264 encoder realize slightly different.
4, calculate the changing value Δ QP of the quantization parameter based on former frame 1realization
According to the virtual encoder buffering area fullness degree PrevVBF before former frame coding, the virtual encoder buffering area fullness degree CurrVBF before present frame coding and the quantization step VBFCStep of fullness degree, the changing value Δ QP of the quantization parameter of calculating based on former frame 1.
Its computing formula is:
B ( x ) = x VBFCStep - - - ( 29 )
&Delta; QP 1 = 2 &times; B ( CurrVBF ) - B ( PrevVBF ) , CurrVBF > PrevVBF &GreaterEqual; 0 2 &times; B ( ABS ( CurrVBF ) ) + B ( PreVBF ) , CurrVBF < PrevVBF &le; 0 2 &times; B ( CurrVBF ) + B ( PreVBF ) , CurrVBF > 0 > PrevVBF , CurrVBF > ABS ( PrevVBF ) 2 &times; B ( ABS ( CurrVBF ) ) - B ( PreVBF ) , CurrVBF < 0 < PrevVBF , ABS ( CurrVBF ) > PrevVBF 0 , ABS ( CurrVBF < = ABS ( PrevVBF ) - - - ( 30 )
ABS () is the operation that takes absolute value.
5, calculate the changing value Δ QP of the quantization parameter based on former frame 2realization
According to the virtual encoder buffering area fullness degree PrevVBF before former frame coding, the virtual encoder buffering area fullness degree CurrVBF before present frame coding and the quantization step VBFCStep of fullness degree, the changing value Δ QP of the quantization parameter of calculating based on former frame 2.
Its computing formula is:
&Delta;QP 2 = ABS ( PrevVBF - CurrVBF ) VBFStep &times; 2 , ABS ( CurrVBF ) < ABS ( PrevVBF ) 0 , ABS ( CurrVBF ) > = ABS ( PrevVBF ) - - - ( 31 )
6, calculate the realization of current quantization parameter value CurrQP that will coded frame
According to the symbol of virtual encoder buffering area fullness degree before present frame coding, and the quantization parameter value PrevQP of former frame, changing value Δ QP 1and Δ QP 2calculate current quantization parameter value CurrQP that will coded frame.
Its computing formula is:
PrevQP′=PrevQP+ΔQP 2 (32)
CurrQP Prev QP &prime; + &Delta;QP 1 , CurrVBF > 0 Prev QP &prime; - &Delta;QP 1 CurrVBF < 0 Prev QP &prime; , CurrVBF &equiv; 0 - - - ( 33 )
7, calculate or predict the realization of the complexity value CurrMAD of present frame
1) initial data by present frame is calculated the complexity value CurrMAD of present frame
Its computing formula is:
CurrMAD i = 1 N &times; M &Sigma; x = 1 N &Sigma; y = 1 M | F i ( x , y ) - E i ( x , y ) | (34)
E i ( x , y ) = 1 N &times; M &Sigma; x = 1 N &Sigma; y = 1 M F i ( x , y ) , i &Element; { Y , U , V }
Figure BDA00001794694600184
8, minimax quantization parameter value MaxQP, the method for MinQP are set
Calculate the minimax quantization parameter value MaxQP of present frame according to the complexity value CurrMAD of the residual error data of present frame or former data, MinQP.
Its computing formula is:
9, the method for the quantization parameter value CurrQP of restriction present frame
According to minimax parameter value MaxQP, the scope of the current quantization parameter value CurrQP that will coded frame of MinQP restriction.
Its computing formula is:
CurrQP=min(MaxQP,max(MinQP,CurrQP)) (37)
10, the realization of the renewal of virtual encoder buffering area fullness degree after frame coding
Its computing formula is:
PrevVBF=CurrVBF
CurrVBF = FrmEncSize - T arg etBitRate FrmRate - - - ( 38 )
Wherein FrmEncSize is the size after frame has been encoded.
Algorithm in the present invention is by strictly controlling the scope of virtual encoder buffering area fullness degree at coding side, and consider the variation of image and voice data actual complex degree consequently between Rate Control convergence and image or audio quality, to arrive good balance.

Claims (7)

1. the rate control algorithm based on virtual encoder buffering area fullness degree, is characterized in that, described algorithm comprises the following steps:
The first step: the scope of restriction virtual encoder buffering area fullness degree is to meet the requirement of target bit rate;
Second step: the quantization step VBFCStep that calculates virtual encoder buffering area fullness degree;
The 3rd step: the changing value InitialDeltaQP that calculates audio frequency and video sequence the first frame quantization parameter value InitialQP and quantization parameter;
The 4th step: according to the virtual encoder buffering area fullness degree PrevVBF before former frame coding, the virtual encoder buffering area fullness degree CurrVBF before present frame coding and the quantization step VBFCStep of fullness degree, the changing value Δ QP of the quantization parameter of calculating based on former frame 1; Its computing formula is:
B ( x ) = x VBFCStep
&Delta;QP 1 = K 1 &times; B ( CurrVBF ) - K 2 &times; B ( PrevVBF ) , CurrVBF > PrevVBF &GreaterEqual; 0 K 1 &times; B ( ABS ( CurrVBF ) ) + K 2 &times; B ( PreVBF ) , CurrVBF < PrevVBF &le; 0 K 1 &times; B ( CurrVBF ) + K 2 &times; B ( PreVBF ) , CurrVBF > 0 > PrevVBF , CurrVBF > ABS ( PrevVBF ) K 1 &times; B ( ABS ( CurrVBF ) ) - K 2 &times; B ( PreVBF ) , CurrVBF < 0 < PrevVBF , ABS ( CurrVBF ) > PrevVBF 0 , ABS ( CurrVBF ) < = ABS ( PrevVBF )
Wherein K 1, K 2for constant factor, K 1>0, K 2>0, is determined by encoder type, and their value comes from experiment statistics data; Wherein B (x) represents virtual encoder buffering area fullness degree value and quantization parameter changing value Δ QP 1mapping function; Variable x represents virtual encoder buffering area fullness degree value;
The 5th step: according to the virtual encoder buffering area fullness degree PrevVBF before former frame coding, the virtual encoder buffering area fullness degree CurrVBF before present frame coding and the quantization step VBFCStep of fullness degree, the changing value Δ QP of the quantization parameter of calculating based on former frame 2; Its computing formula is:
&Delta;QP 2 = ABS ( PrevVBF - CurrVBF ) VBFCStep &times; CQPStep , ABS ( CurrVBF ) < ABS ( PrevVBF ) 0 , ABS ( CurrVBF ) > = ABS ( PrevVBF )
Wherein CQPStep is constant factor, is determined by encoder type, and its value comes from experiment statistics data;
The 6th step: according to the change direction of virtual encoder buffering area fullness degree before and after former frame coding, and according to the quantization parameter value PrevQP of former frame, changing value Δ QP 1and Δ QP 2calculate current quantization parameter value CurrQP that will coded frame; Its computing formula is:
CurrQP PrevQP &prime; + &Delta;QP 1 , CurrVBF > 0 PrevQP &prime; - &Delta;QP 1 CurrVBF < 0 PrevQP &prime; , CurrVBF &equiv; 0 , PrevQP′=PrevQP+ΔQP 2
The quantization parameter value that wherein PrevQP is former frame, the quantization parameter value that PrevQP ' is revised former frame;
The 7th step: according to the complexity value CurrMAD of the mean value CurrMean linear prediction present frame residual error coefficient of the average value P revMean of the complexity value PrevMAD of former frame residual error data, the former data of former frame and the former data of present frame or directly calculate the complexity value CurrMAD of initial data according to the initial data of present frame;
The 8th step: calculate the minimax quantization parameter value MaxQP of present frame, MinQP according to the residual error data of present frame of calculating or the complexity value CurrMAD of initial data;
The 9th step: according to minimax parameter value MaxQP, the scope of the current quantization parameter value CurrQP that will coded frame of MinQP restriction;
The tenth step: the realization of the renewal of virtual encoder buffering area fullness degree after frame coding.
2. rate control algorithm according to claim 1, it is characterized in that, in the described first step, be that wherein computing formula is as follows according to the scope [MinVBF, MaxVBF] of the fullness degree of the big or small VBFSize of virtual buffering region and delay side-play amount DelayOffset restriction virtual buffering region:
MinVBF = max ( DelayOffset - VBFSize , - DelayOffset + 1 2 ) &times; VBFScale 1
MaxVBF=VBFSize×VBFScale2
VBFScale1, VBFScale2 is constant factor, is determined by encoder type.
3. rate control algorithm according to claim 1, it is characterized in that, in described second step, be the quantization step VBFCStep that determines virtual encoder buffering area fullness degree according to the bit number FrmBitSize that is averagely allocated to every frame, its computing formula is: VBFCStep=FrmBitSize*StepScale, wherein StepScale is constant factor, is determined by encoder type.
4. rate control algorithm according to claim 1, is characterized in that, the computing formula of described the 3rd step is as follows:
InitialDeltaQP = - CF &times; func ( bpp bpp c ) , bpp &NotEqual; bpp c 0 , bpp &equiv; bpp c
IntialQP=QP c+InitialDeltaQP
Figure FDA0000471950530000033
wherein TargetBitRate is target bit rate, FrmRate frame per second, the hits that FrmSize is audio frame or the resolution of frame of video; CF, QP c, bpp cfor constant factor, CF is determined by encoder type, QP c, bpp cdetermined by encoder specific implementation; Bpp is the bit number of distributing to each audio sample or video pixel, and the function of func () is that bpp ratio is mapped as to quantization parameter value.
5. rate control algorithm according to claim 1, is characterized in that, the computing formula of described the 8th step is:
Figure FDA0000471950530000041
Figure FDA0000471950530000042
Wherein MAD2QPScale 1, MAD2QPScale 2for from image or audio frame complexity value to the mapping-factor of quantization parameter value, determined by encoder type, its span is respectively [0.2,0.8], [1.5,3.0], MIN_QP is minimum quantization parameter value, and MAX_QP is maximum quantization parameter value, is determined by the type of encoder;
Condition 1 is: CurrVBF≤-VBFStep × C_NUM
Condition 2 is: CurrVBF >=VBFStep × C_NUM
Wherein [VBFStep × C_NUM, VBFStep × C_NUM] wishes the domain of walker of virtual encoder buffering area fullness degree of controlling for Rate Control.
6. rate control algorithm according to claim 1, is characterized in that, the concrete grammar of described the 9th step is: CurrQP=min (MaxQP, max (MinQP, CurrQP)).
7. rate control algorithm according to claim 4, is characterized in that, the method for upgrading in described the tenth step is:
PrevVBF=CurrVBF
CurrVBF = FrmEncSize - T arg etBitRate FrmRate
Wherein FrmEncSize is the size after frame has been encoded.
CN201210211763.1A 2012-06-21 2012-06-21 Code rate control algorithm based on fullness degree of virtual encoding buffer area Expired - Fee Related CN102724510B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210211763.1A CN102724510B (en) 2012-06-21 2012-06-21 Code rate control algorithm based on fullness degree of virtual encoding buffer area

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210211763.1A CN102724510B (en) 2012-06-21 2012-06-21 Code rate control algorithm based on fullness degree of virtual encoding buffer area

Publications (2)

Publication Number Publication Date
CN102724510A CN102724510A (en) 2012-10-10
CN102724510B true CN102724510B (en) 2014-05-28

Family

ID=46950155

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210211763.1A Expired - Fee Related CN102724510B (en) 2012-06-21 2012-06-21 Code rate control algorithm based on fullness degree of virtual encoding buffer area

Country Status (1)

Country Link
CN (1) CN102724510B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2512826B (en) * 2013-04-05 2017-05-10 Canon Kk Method and device for determining the value of a quantization parameter
CN103475934B (en) * 2013-09-13 2016-08-31 北京世纪鼎点软件有限公司 The Video coding flow control method that a kind of network-oriented is live
CN104079933B (en) * 2014-07-09 2018-07-27 上海君观信息技术有限公司 Low delay bit rate control method and bits allocation method suitable for HEVC
US9936203B2 (en) * 2015-04-13 2018-04-03 Qualcomm Incorporated Complex region detection for display stream compression
US20170280139A1 (en) * 2016-03-22 2017-09-28 Qualcomm Incorporated Apparatus and methods for adaptive calculation of quantization parameters in display stream compression
CN108540807B (en) * 2018-02-28 2019-05-31 北京达佳互联信息技术有限公司 The method, apparatus and terminal of video file transcoding
WO2020107449A1 (en) * 2018-11-30 2020-06-04 Oppo广东移动通信有限公司 Coding method, coder and computer storage medium
CN110300304B (en) * 2019-06-28 2022-04-12 广东中星微电子有限公司 Method and apparatus for compressing image sets
CN117676159A (en) * 2022-09-08 2024-03-08 华为技术有限公司 Decoding method, encoding method and related equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1138805A (en) * 1994-12-14 1996-12-25 大宇电子株式会社 Method and apparatus for deciding quantization parameter
CN1175853A (en) * 1996-06-26 1998-03-11 三星电子株式会社 Image encoding method and apparatus for controlling number of bits generated using quantization activities
CN101765003A (en) * 2008-12-23 2010-06-30 上海茂碧信息科技有限公司 Method for transmitting audio and video under environment of network with different speeds
CN101855907A (en) * 2007-11-07 2010-10-06 英国电讯有限公司 Video coding

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8441965B2 (en) * 2010-08-05 2013-05-14 Apple Inc. Methods and apparatus for reducing data transmission overhead

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1138805A (en) * 1994-12-14 1996-12-25 大宇电子株式会社 Method and apparatus for deciding quantization parameter
CN1175853A (en) * 1996-06-26 1998-03-11 三星电子株式会社 Image encoding method and apparatus for controlling number of bits generated using quantization activities
CN101855907A (en) * 2007-11-07 2010-10-06 英国电讯有限公司 Video coding
CN101765003A (en) * 2008-12-23 2010-06-30 上海茂碧信息科技有限公司 Method for transmitting audio and video under environment of network with different speeds

Also Published As

Publication number Publication date
CN102724510A (en) 2012-10-10

Similar Documents

Publication Publication Date Title
CN102724510B (en) Code rate control algorithm based on fullness degree of virtual encoding buffer area
KR101518358B1 (en) A buffer-based rate control exploiting frame complexity buffer level and position of intra frames in video coding
CN102630013B (en) Bit rate control video compression method and device on basis of scene switching
CN101552917B (en) Bit rate control method for video compression
CN101795415B (en) Method and device for controlling code rate in video coding
CN102932641B (en) A kind of constant-quality bit rate control method
US20150172680A1 (en) Producing an Output Need Parameter for an Encoder
CN102036062B (en) Video coding method and device and electronic equipment
CN101252689A (en) Self-adapting code rate control method
CN102761741B (en) Video encoding code rate control system and method on basis of caches at encoding and decoding ends
US8085679B2 (en) Apparatuses and methods for controlling bit rates in variable bit rate video coding
CN102316313B (en) Low-complexity bit rate control method in embedded real-time video compression system
KR20110105875A (en) Moving picture encoding device, moving picture encoding method, and moving picture encoding computer program
CN105681793A (en) Very-low delay and high-performance video coding intra-frame code rate control method based on video content complexity adaption
WO2007109993A1 (en) Error control system, method, encoder and decoder for video coding
CN101754003B (en) Code rate control method for stabilizing video quality
CN100563338C (en) A kind of control method of constant code rate
CN100574442C (en) Bit rate control method based on image histogram
CN104967871B (en) A kind of statistic multiplexing system and method for Video coding code stream
Zhang et al. A two-pass rate control algorithm for H. 264/AVC high definition video coding
JP2017500830A (en) Method and apparatus for multipath adaptive quantization
JP2004320707A (en) Apparatus for simultaneously encoding multiple video information
CN102811349A (en) No-feedback multi-description distributed video coder-decoder capable of adjusting redundancy automatically
CN101984667A (en) Code rate control method and code rate controller
Xu et al. Rate control for consistent visual quality of H. 264/AVC encoding

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20140528

Termination date: 20210621

CF01 Termination of patent right due to non-payment of annual fee