CN106791848A - A kind of Two Pass bit rate control methods based on HEVC - Google Patents

A kind of Two Pass bit rate control methods based on HEVC Download PDF

Info

Publication number
CN106791848A
CN106791848A CN201611183575.7A CN201611183575A CN106791848A CN 106791848 A CN106791848 A CN 106791848A CN 201611183575 A CN201611183575 A CN 201611183575A CN 106791848 A CN106791848 A CN 106791848A
Authority
CN
China
Prior art keywords
bit
lcu
rate
frame
video
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.)
Granted
Application number
CN201611183575.7A
Other languages
Chinese (zh)
Other versions
CN106791848B (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.)
Hennan Electric Power Survey and Design Institute
Original Assignee
Hennan Electric Power Survey and Design Institute
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 Hennan Electric Power Survey and Design Institute filed Critical Hennan Electric Power Survey and Design Institute
Priority to CN201611183575.7A priority Critical patent/CN106791848B/en
Publication of CN106791848A publication Critical patent/CN106791848A/en
Application granted granted Critical
Publication of CN106791848B publication Critical patent/CN106791848B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • H04N19/147Data rate or code amount at the encoder output according to rate distortion criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/114Adapting the group of pictures [GOP] structure, e.g. number of B-frames between two anchor frames
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/189Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding
    • H04N19/19Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding using optimisation based on Lagrange multipliers

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The present invention relates to technical field of video coding, more particularly to a kind of Two Pass bit rate control methods based on HEVC.The method is concretely comprised the following steps:Step 1, quick pre encoded video sequence, and collect the statistical information of correspondence coding unit;Step 2, according to the statistical information above collected, will carry out bit distribution, the fitting of rate-distortion model parameter training and the calculating of quantization parameter QP.Present invention has the advantages that:Under the different target bit rate of height, video sequence average peak signal to noise ratio PSNR of the present invention different for complexity, resolution ratio has lifting, averagely improves 0.42dB;In terms of rate control accuracy, code check error of the invention has reduction for different video sequence, averagely reduces 4.81%.

Description

A kind of Two-Pass bit rate control methods based on HEVC
Technical field
The present invention relates to technical field of video coding, more particularly to a kind of Two-Pass Rate Control sides based on HEVC Method.
Background technology
With the continuous progress of video coding technique, major video develops to high definition and ultra high-definition direction, brings therewith The surge of the video data volume, in order to reach compression performance higher, JCT-VC joints group is proposed H.265/HEVC video and compiles Code standard, H.264/AVC the compression performance of standard improves one times than ever.In the practical application of video encoding standard, code Rate is controlled, i.e., optimal video quality is obtained under set target bit rate, is indispensable key component in Video coding, It is also the focus of field of video encoding research.
In the practical application of coding and decoding video, it is possible to use bandwidth resources be often limited.Answering per frame video , all as video content is being continually changing, video complexity is higher, and the number of coded bits of output also can be higher, if not right for miscellaneous degree Code stream is controlled by, and the video code rate obtained after coding will be continually changing, and the code check being widely varied can not meet actual biography The requirement of defeated channel and transmission bandwidth, so, Rate Control is essential in the practical application of video encoding standard.
Rate Control is under current bandwidth limitation, target bit rate to be matched by certain bit rate control method and is obtained A kind of technological means of optimal video quality.Rate-distortion optimization (Rate-Distortion Optimization, RDO) be exactly Optimal coding parameter is selected under the guidance of rate distortion theory, is taken between the distortion caused after encoding bit rate output and compression Balance most preferably is obtained, i.e., reduces code check as far as possible on the premise of video quality is ensured, or in identical bit rate output condition Under lift video quality as far as possible.Rate-distortion optimization theory occupies highly important effect in Rate Control.
" the discrete source coding theory under fidelity criterion " that rate distortion theory is most delivered early in nineteen fifty-nine by Shannon and Gradually paid close attention to by scholar, mainly in the case where certain distortion is allowed, the limit of information source compression be what this ask Topic, makes definitions and discusses to rate distortion function R (D) first.The scholar and expert of association area constantly study it after Afterwards, rate distortion theory gradually improvement and systematization.
The quality of video and the size of final output code stream are all mainly influenceed by quantizing process, to same video using not Same quantization parameter can obtain different code checks and video quality.So, the main purpose of Rate Control is to obtain one group of quantization Parameter QP, is used to the follow-up coding flow of control, is finally reached the requirement of target bit rate.Wherein, emphasis is exactly to find code Mapping relations between rate and quantization parameter, and model is set up, so as to obtain required quantization parameter by target bit rate.
The infra-frame prediction and inter-frame prediction method used in video encoding standard so that the dependence between encoding block is very By force, the separated consideration that their distortion performance can not be independent.Therefore, although rate distortion function provides quantization parameter set Relation and distortion, code check between, but it is extremely complex that quantization parameter is directly solved using rate distortion function.Actual In coding standard application, Rate Control is generally divided into two steps and carries out, as shown in figure 1, wherein, the first step is bit distribution Target bit rate, is exactly assigned to image sets (GOP), frame (Frame) and volume by (Bit Allocation) by certain rule On the image as unit such as code block (CTU);Second step is exactly to set up suitable rate-distortion model to calculate quantization parameter (QP), after control Continuous quantizer so that the code check of final output can match given target bit rate.
(1) bit distribution
Maximum encoding block (Largest Coding Unit, LCU) is H.265/HEVC can be with the base of absolute coding in standard This unit, H.264/AVC in standard correspondingly be macro block (Micro Block, MB).For HEVC standard, Rate Control The minimum unit that can be controlled, i.e., can be that its minimum unit for individually distributing quantization parameter be also LCU.The first of Rate Control Step is Data Rate Distribution, i.e. bit distribution.Bit distribution is progressively segmented, and common practices is as shown in Fig. 2 first by under target bit rate Total bit number first distributed into GOP image sets by certain rule, then successively by Data Rate Distribution to each two field picture, and then distribute To LCU grades.Meanwhile, an elementary area has often been encoded in every one-level, it is right just according to the situation for encoding actually used bit number Subsequent bits distribution is adjusted and updates, i.e., follow-up bit distribution is updated using remaining bits number.
(2) calculating of quantization parameter QP
The second step of Rate Control is that the result for obtaining bit distribution by the first step goes to try to achieve one group of quantization parameter QP, emphasis It is exactly the foundation to rate distortion relational model between code check and quantization parameter QP.The precision of rate-distortion model is final defeated decision Whether the code stream for going out can reach the key of target bit rate requirement, have decisive significance to the performance of rate control module.Video Domain expert and scholar conduct extensive research to rate-distortion model, establish the approximate model of many rate distortion relations, main Will be by first-order linear model, secondary model, exponential model, logarithmic model, R- λ models etc..
The content of the invention
In order to solve the problems, such as prior art, the present invention provides a kind of HEVC Rate Control sides based on Two-Pass Method.
The technical scheme is that:A kind of Two-Pass bit rate control methods based on HEVC, the specific step of the method Suddenly it is:
Step 1, quick pre encoded video sequence, and collect the statistical information of correspondence coding unit;
Step 2, will according to the statistical information above collected, carry out bit distribution, the fitting of rate-distortion model parameter training with And the calculating of quantization parameter QP.
A kind of Two-Pass bit rate control methods based on HEVC are further comprising the steps of:Would generally be first before Video coding It is divided into several small GOP image sets, a GOP image sets to generally include an at least two field picture;Generally enter one per two field picture Step is divided into some code blocks (LCU), so as to further encode.
Described image has three kinds of classifications:I frames, P frames and B frames;Wherein, I frames are intracoded frame, can only refer to this two field picture Interior pixel is predicted, while can be the key frame in predictive coding as P frames and the reference frame of B frames, the present invention be carried The bit rate control method for going out will pay close attention to the Rate Control of I frames, i.e. intraframe predictive coding.
The step 1 is comprised the following steps:
Step a:Initialization;For giving video sequence, fixed quantization parameter is configured in the cfg configuration files of coding QP values, while RateControl parameters are set into 0, close Rate Control switch;
Step b:CU is divided;The given video sequence of input, in function TEncCu::To current video in xCompressCU () Each LCU of sequence is recursively divided;
Step c:Judge whether to be divided into 16 × 16;Using the condition whether depth uiDepth variables are less than 3 is divided, sentence It is disconnected current whether to divide to 16 × 16 levels, such as less than 3, then continue to divide;Otherwise, then prove that current LCU has been divided into 16 × 16 levels, can carry out next step operation;
Step d:Determine whether image boundary;Using border Rule of judgment, image boundary is determined whether, if side Boundary, it is possible to there is the situation that border LCU can not be divided exactly by 16, then continue to be divided down to 8 × 8 pieces, then carries out follow-up Prediction, transition coding process;
Step e:Collect the statistical information of the video sequence that coding is produced;It is important that to the bit number shared by each LCU block, Bit number, video frequency output code check, the collection of video distortion information of whole frame;Wherein, the bit number of the bit number of LCU and whole frame Information, can use as complexity when subsequent bits are distributed;Code check, distortion information can then constitute (R, D) sample point, Fitting for subsequent parameter is used;
Step f:Change QP values, the cataloged procedure of repeat step a to step e, until traversal 22,27,32,37 4 kind of QP Value.
The step 2 includes that bit distribution, rate-distortion model are set up and quantization parameter QP calculates three major parts, specifically Step is:
Step I:Frame level bit is distributed;In TEncRCSeq::In create () function, according to target bit rate and current sequence Frame per second, calculate target bit, and target bit is averagely allocated to each frame;
Step II:Modification TEncCu::UpdateLCUDataISlice () function, by the complexity benchmark of LCU by The SATD of 64 8 × 8 originally and, be revised as fixing when QP is 22 the LCU bit numbers collected in step, that is, define file pointer Function return value is assigned to what is arranged by raster scan order successively with the bit number information of the reading LCU from file for variable The complexity variable m_costIntra of LCU;
Step III:Each LCU in traversal present frame, by the cumulative of the complexity variable m_costIntra of all LCU Be assigned to m_totalCostIntra variables, the variable represents total complexity of present frame;
Step IV:In function TEncRCPic::It is each LCU distributing bit in getLCUInitTargetBits (), Formula is as follows:
TCurrLCU=(TCurrPic-BitHeader-BitCoded)×CCurrLCU
Wherein, CCurrLCUIt is the complexity of current LCU, B1stCurrLCUIt is the ratio of current LCU being collected into First-Pass Special number, BNotCodedLCUsIt is the bit number of uncoded LCU in the present frame that is collected into step 1;
Step V:Using video code rate, the distortion information collected in step 1, on the basis of hyperbola R-D models, fitting Model parameter C, K of current video sequence;
Step VI:According to R-D models and the corresponding relation of R- λ models, model parameter α, β of R- λ models is calculated;
Step VII:R- λ models according to on-line training model parameter, using the bit in step IV being current LCU distribution Number, calculates the λ value for current LCU, and check whether to meet constraint;
Step VIII:According in step VII obtain λ value and formula QP=4.2005ln λ+13.7122 described in λ with Relation between QP, calculates the QP values for current LCU quantizing process, and checks whether to meet constraint;
Step IV:The QP values collection obtained in applying step VIII, carries out complete cataloged procedure.
Compared with prior art, present invention has the advantages that:
1) under the different target bit rate of height, compared to the standard bit rate control method in HM16.0, patent of the present invention The video sequence that the Two-Pass fast method average peak signal to noise ratio PSNR of proposition are different for complexity, resolution ratio is equal There is lifting, averagely improve 0.42dB, the PSNR liftings for video sequence under target bit rate high are the most obvious, reach as high as 3.14dB;
2) in terms of rate control accuracy, the code check error of patent bit rate control method of the present invention is for different video sequence There is reduction, averagely reduce 4.81%, equally, for the Rate Control error reduction under target bit rate high significantly, most Height can reduce by 24.6% code check error.
Brief description of the drawings
Fig. 1 Rate Control basic procedures;
Fig. 2 bits distribute basic procedure;
Fig. 3 different types Image Coding output bit number compares;
Fig. 4 First-Pass algorithm flows;
Fig. 5 LCU statistical information storage orders;
Fig. 6 Second-Pass algorithm flows;
Fig. 7 supports the Two-Pass fast algorithm flows of on-line training.
Specific embodiment
The present invention proposes a kind of HEVC bit rate control methods based on Two-Pass, and its specific method is as follows:
Several small GOP image sets would generally be first divided into before Video coding, if a GOP image sets are generally included Dry two field picture, these images have three kinds of classifications:I frames (Intra Frame), P frames (Predictive Frame) and B frames (Bi- directional Interpolate Prediction Frame).Wherein, P frames are forward-predictive-coded frames, before may be referred to The encoded frame in face carries out inter prediction, eliminates the time redundancy between successive frame;B frames are bi-directional predicted interpolated value coded frames, both May be referred to the pixel of above encoded frame, it is also possible to encoded with reference to frame below;I frames are intracoded frame, Zhi Nengcan The pixel examined in this two field picture is predicted, and can simultaneously serve as the reference frame of P frames and B frames, is the key frame in predictive coding, Occupy highly important position in predictive coding, each GOP image sets is generally using I frames as the first frame.I frames include a width The all important information of image, can independently be decoded, and the decoding of P frames and B frames will depend on I frames ability above complete Into.Meanwhile, in whole compressed video stream, I frames can take more bit, in some instances it may even be possible to be several times as much as P frames and B frames.It is such as attached Fig. 3 show " RaceHorses " sequence (IBBBPBBB structures) under fixed quantisation parameter, and different images type coding is exported The comparing of bit number.I frames coding output bit number at most, about the 2 of P frames times, 10 times of B frames.In summary as can be seen that I frames occupy highly important status in whole coded video sequence, and Rate Control is carried out to I frames, can be to whole video sequence Compression efficiency have vital influence.Therefore, bit rate control method proposed by the invention will pay close attention to I frames, i.e. frame The Rate Control of intraprediction encoding.
The present invention is broadly divided into two steps:The quick pre encoded video sequence in step 1 (First-Pass), and collect The statistical informations such as the complexity of correspondence coding unit;In step 2 (Second-Pass), by according to the statistics letter above collected Breath, carries out bit distribution, the fitting of rate-distortion model parameter training and the calculating of quantization parameter QP.
1. step 1 (First-Pass)
Step 1 (First-Pass) coding is the first step of Two-Pass bit rate control methods proposed by the present invention, mainly The statistical information important for collecting video sequence.For on-line training model parameter, in the modified Two- that the present invention is carried , it is necessary to carry out multiple precoding in Pass bit rate control methods, to obtain multigroup real code check and the mistake of current video sequence Genuine corresponding relation, and then it is fitted the model parameter for adapting to current video sequence.Multiple precoding will cause First-Pass's The binary encoding time is multiplied, and coding rate has been dragged slowly significantly.Therefore, the present invention proposes a kind of method of quick precoding, 16 × 16 block of pixels will be all divided into per two field picture in step 1 (First-Pass), i.e., only to dividing the CU blocks that depth is 3 Precoding is carried out, statistical information is collected, wherein emphasis is considered border condition in implementation process.The present invention is marked using HM Under different quantization fine degrees that what quasi- software model was recommended can most reflect the compression effectiveness of video four kinds of fixed QP values (22, 27th, 32,37) encoded, that is, carried out four times quick precodings, obtained 4 couple (R, D) sample point of each frame of current sequence, used In the fitting of follow-up model parameter;Meanwhile, encoded in the case where quantization parameter QP values take 22, by 16 × 16 in each LCU The bit information that block of pixels is counted on is added, as the complexity information of the LCU blocks, to carry out follow-up Second-Pass Coding.The step of using quick precoding 1 (First-Pass) flow is as shown in Figure 4.
In improved Two-Pass fast methods, the realization of First-Pass codings mainly has following steps:
Step a:Initialization.For giving video sequence, fixed quantization parameter is configured in the cfg configuration files of coding QP values, while RateControl parameters are set into 0, close Rate Control switch;
Step b:CU is divided.The given video sequence of input, in function TEncCu::To current video in xCompressCU () Each LCU of sequence is recursively divided;
Step c:Judge whether to be divided into 16 × 16.Using the condition whether depth uiDepth variables are less than 3 is divided, sentence It is disconnected current whether to divide to 16 × 16 levels, such as less than 3, then continue to divide;Such as it is not less than 3, then proves that current LCU has been divided To 16 × 16 levels, next step operation can be carried out;
Step d:Determine whether image boundary.Using border Rule of judgment, image boundary is determined whether, if side Boundary, it is possible to there is the situation that border LCU can not be divided exactly by 16, then continue to be divided down to 8 × 8 pieces, then carries out follow-up Prediction, conversion Equal-coding pass;
Step e:Collect the statistical information of the video sequence that coding is produced.It is important that to the bit number shared by each LCU block, Bit number, video frequency output code check, the collection of video distortion information of whole frame.Wherein, the bit number of the bit number of LCU and whole frame Information, can use as complexity when subsequent bits are distributed;Code check, distortion information can then constitute (R, D) sample point, Fitting for subsequent parameter is used.
Step f:Change QP values, the cataloged procedure of repeat step a to step e, until traversal 22,27,32,37 4 kind of QP Value.
Wherein, storage order of the statistical information of each LCU in output file is suitable according to the raster scanning shown in accompanying drawing 5 Sequence, stores successively from left to right, from top to bottom.Meanwhile, the LCU bit numbers collected in First-Pass account for the ratio of whole frame bit number Rate, the elaborate degree benchmark that will be used as patent of the present invention, for bit distribution in follow-up Second-Pass codings When use.
Additionally, the distortion information of video is represented using MSE, MSE be rebuild video data and original video sequence data it Between mean square deviation, shown in its computing formula such as formula (1).Wherein, the original value of pixel is represented, the reconstructed value of pixel is represented, n is represented Pixel total number.
The code rate information of video represented using bpp, i.e., the bit number shared by average each pixel, its computing formula such as formula (2) shown in.Wherein, bit represents the total bit number of present frame, PtotalThe total pixel number of present frame is represented, w represents the figure of present frame Image width degree, h represents the picture altitude of present frame.
Ptotal=w × h (2)
2. step 2 (Second-Pass)
Step 2 (Second-Pass) coding is the second step of the Two-Pass bit rate control methods that patent of the present invention is proposed, It is the committed step of Two-Pass methods.Step 2 (Second-Pass) coding is main to have bit distribution, rate-distortion model to set up Three major parts are calculated with quantization parameter QP, the specific method and implementation of each part will be in detail situated between below Continue:
(1) bit distribution
For intraframe predictive coding, the parameter setting of full I frames is 1 equivalent to each GOP size, wherein only including one Two field picture, that is, 1 I frame.So, for frame in Rate Control, according to the strategy that layering bit is distributed, GOP grades of ratio Spy's distribution is equivalent to be frame level bit distribution that the bit number that will be removed under the target bit rate outside header is evenly distributed to often One I two field picture.
The pixel that I two field pictures can only refer to the encoded CU blocks of this frame is predicted coding, therefore, compare in frame in Rate Control The emphasis of special allocation step is exactly LCU grades of Bit distribution method.Here, patent of the present invention uses elaborate degree benchmark It is each LCU distributing bit as weight.I.e. using in First-Pass collect each LCU bit number account for correspondence frame always than The ratio of special number as the LCU complexity, be its distributing bit under current goal code check.Assuming that the general objective ratio of present frame Special number is that bit number is shared by header, and the encoded actually used total bit number of block of pixels is, then the ratio that current LCU can get Special number can be represented with formula (3):
TCurrLCU=(TCurrPic-BitHeader-BitCoded)×CCurrLCU
Wherein, CCurrLCUIt is the complexity of current LCU, B1stCurrLCUIt is the ratio of current LCU being collected into First-Pass Special number, BNotCodedLCUsIt is the bit number of uncoded LCU in the present frame that is collected into First-Pass.
(2) rate distortion modeling
The target of video encoding standard is to reach definition higher using less bit number all the time, and this target can To be expressed as Constrained problem.Solving the problems, such as an effective method of the constrained rate-distortion optimization is, bright using glug Day multiplier optimization (Lagrange Operator Algorithm), constrained optimization problem is converted into unconstrained optimization and is asked Topic.After introducing Lagrange multiplier, Constrained problem can be converted into the form of formula (4).
I.e.:
If the rate-distortion optimization problem in Video coding being regarded as optimal balance being obtained between code check and distortion, So, Lagrange multiplier λ is exactly to adjust the key balanced between code check and distortion.From froming the perspective of in physical significance, Lagrange multiplies Sub- λ is exactly the slope of rate distortion curve.
H.265/HEVC by the R-D models of hyperbolic form in standard classical Rate Control motion K0103, such as formula (6) It is described, the relation between code check R and Lagrange multiplier λ is deduced, final foundation is rate-distortion model, as described in formula (7), Wherein, α and β are unified model parameter, and empirical value 3.2003 and -1.367 is taken respectively.The Two-Pass code checks that the present invention is realized Using the R- λ models as rate-distortion model of the present invention in control method.But unified model parameter is not used, but is utilized By the repeatedly statistical information such as code check, distortion of video sequence of quick precoding collection in step 1 (First-Pass), for Each video sequence, on-line training adapts to the model parameter of each video sequence.
D (R)=CRK (6)
In step 2 of the invention (Second-Pass) coding stage, using the code collected in step 1 (First-Pass) The statistical information of rate R and distortion D, corresponding 4 groups of (R, D) sampling points can be obtained to each video sequence, with formula (6) as mould Type, the sampling point group to each sequence carries out parameter fitting, can obtain the empirical value of the model parameter C and K of each video sequence. Further according to R-D models and the relation of R- λ models, as described in formula (7), the pass between parameter C, K and parameter alpha, β can be derived System, as described in formula (8) and formula (9).
α=- CK (8)
β=K-1 (9)
Then, can be calculated according to formula (8) and formula (9) be adapted to current video sequence R- λ models model parameter α and β, substitutes into formula (7), can not only be used for the on-line training R- λ models of current video sequence.
(3) quantization parameter QP is calculated
By above-mentioned on-line training process, using the R- λ models for obtaining, present encoding list is partially distributed to according to (1st) The code check of unit, calculates corresponding λ value, further according to the corresponding relation between λ and quantization parameter QP, as described in formula (10), calculates QP values are tried to achieve, and for next code process.
QP=4.2005ln λ+13.7122 (10)
Meanwhile, in order to reduce the fluctuation of adjacent encoder cell picture quality, the quantization parameter QP difference controls of adjacent LCU are existed Within 1, current LCU and its image level QP difference controls are within 2.
In summary introduce and analyze, can by the method for step 2 (Second-Pass) implement step be summarized as with Under several steps:
Step I:Frame level bit is distributed.In TEncRCSeq::In create () function, according to target bit rate and current sequence Frame per second, calculate target bit, and target bit is averagely allocated to each frame;
Step II:Modification TEncCu::UpdateLCUDataISlice () function, by the complexity benchmark of LCU by The SATD of 64 8 × 8 originally and be revised as the LCU bit numbers collected in First-Pass, that is, define file pointer variable with The bit number information of LCU is read in from file, function return value is assigned to answering by the LCU of raster scan order arrangement successively Miscellaneous degree variable m_costIntra;
Step III:Each LCU in traversal present frame, by the cumulative of the complexity variable m_costIntra of all LCU Be assigned to m_totalCostIntra variables, the variable represents total complexity of present frame;
Step IV:In function TEncRCPic::It is every according to the method for formula (3) in getLCUInitTargetBits () One LCU distributing bit;
Step V:Using information such as video code rate, the distortions collected in step 1 (First-Pass), with hyperbola R-D moulds On the basis of type, model parameter C, K of current video sequence is fitted;
Step VI:According to R-D models and the corresponding relation of R- λ models, the model parameter α and β of R- λ models are calculated;
Step VII:R- λ models according to on-line training model parameter, using the bit in step IV being current LCU distribution Number, calculates the λ value for current LCU, and check whether to meet constraint;
Step VIII:The relation between λ and QP according to described in the λ value and formula (10) obtained in step VII, calculates and uses In the QP values of current LCU quantizing process, and check whether to meet constraint;
Step IV:The QP values collection obtained in applying step VIII, carries out complete cataloged procedure.
In sum, Two-Pass fast algorithms proposed by the present invention realize flow as shown in fig. 7, implementing step It is as follows:
Step 1 (First-Pass stages)
Step 1):Input video sequence, to every frame video all only to divide depth be 3, i.e., all be divided into 16 × 16 Code block carries out precoding, if current block is image boundary, continues to be divided into 8 × 8 sizes being encoded again, wherein, precoding The quantization parameter QP values that process is used are the fixed value being previously set;
Step 2):All 16 × 16 pieces (including the boundary pixel blocks less than 16 × 16) that will be included in each LCU are shared Bit number is added, and as the bit number shared by current LCU, by Z-shaped scanning sequency, is sequentially output standby in file;
Step 3):The statistical informations such as overall code check, distortion after video sequence coding are collected as follow-up rate-distortion model The sample point of parameter fitting, and export to standby in file;
Step 4):Change QP values, (present invention takes four kinds of different QP values to repeat above step:22nd, 27,32,37 reality is carried out Test);
Step 2 (Second-Pass stages)
Step 5):Current goal code check is configured in " encoder_intra_main.cfg " configuration file, by target Bit number under code check is evenly distributed to each frame;
Step 6):On the basis of the remaining total bit number after bit used by present frame removes encoded LCU, by step 2) in The complexity weight of the preceding LCU for collecting, the present invention is defined by fixing the statistical information collected when QP is 22, is current LCU distribution Bit;
Step 7):Using step 3) in the information such as video code rate, distortion collected, on the basis of hyperbola R-D models, intend Close model parameter C, K of current video sequence;
Step 8):According to R-D models and the corresponding relation of R- λ models, the model parameter α and β of R- λ models are calculated;
Step 9):The R- λ models gone out to the above-mentioned on-line training of present frame application, according to step 6) the middle bit feelings distributed Condition, calculates the λ value for being applied to current coded unit, and then calculates QP values, and makees a definite limitation to QP values, adjacent to reduce The video quality fluctuation of coding unit;
Step 10):Using step 9) in the QP values that obtain carry out the coding of entire video sequence, output bit flow.
Experimental data shows, under the different target bit rate of height, compared to the standard rate control algorithm in HM16.0, Video Two-Pass fast algorithms average peak signal to noise ratio PSNR proposed by the present invention different for complexity, resolution ratio Sequence has lifting, averagely improves 0.42dB, and the PSNR liftings for video sequence under target bit rate high are the most obvious, highest Up to 3.14dB;In terms of rate control accuracy, the code check error of rate control algorithm of the present invention is equal for different video sequence There is reduction, averagely reduce 4.81%, equally, for the Rate Control error reduction under target bit rate high significantly, highest 24.6% code check error can be reduced.
Above-described is only the preferred embodiment of the present invention, it is noted that for a person skilled in the art, Under the premise of general idea of the present invention is not departed from, some changes and improvements can also be made, these should also be considered as of the invention Protection domain.

Claims (3)

1. a kind of Two-Pass bit rate control methods based on HEVC, it is characterised in that:The method is concretely comprised the following steps:
Step 1, quick pre encoded video sequence, and collect the statistical information of correspondence coding unit;
Step 2, according to the statistical information above collected, will carry out bit distribution, the fitting of rate-distortion model parameter training and measures Change the calculating of parameter QP, output bit flow.
2. a kind of Two-Pass bit rate control methods based on HEVC according to claim 1, it is characterised in that:The step Rapid 1 comprises the following steps:
Step a:Initialization;For giving video sequence, fixed quantization parameter QP is configured in the cfg configuration files of coding Value, while RateControl parameters are set into 0, closes Rate Control switch;
Step b:CU is divided;The given video sequence of input, in function TEncCu::To current video sequence in xCompressCU () Each LCU recursively divided;
Step c:Judge whether to be divided into 16 × 16;Using the condition whether depth uiDepth variables are less than 3 is divided, judge to work as It is preceding whether to divide to 16 × 16 levels, such as less than 3, then continue to divide;Otherwise, then prove that current LCU has been divided into 16 × 16 Level, can carry out next step operation;
Step d:Determine whether image boundary;Using border Rule of judgment, image boundary is determined whether, if border, have There may be the situation that border LCU can not be divided exactly by 16, then continue to be divided down to 8 × 8 pieces, then carry out follow-up prediction, Transition coding process;
Step e:Collect the statistical information of the video sequence that coding is produced;It is important that to the bit number shared by each LCU block, whole The bit number of frame, video frequency output code check, the collection of video distortion information;Wherein, the bit number letter of the bit number of LCU and whole frame Breath, can use as complexity when subsequent bits are distributed;Code check, distortion information can then constitute (R, D) sample point, supply The fitting of subsequent parameter is used;
Step f:Change QP values, the cataloged procedure of repeat step a to step e, until traversal 22,27,32,37 4 kind of QP value.
3. a kind of Two-Pass bit rate control methods based on HEVC according to claim 1 and 2, it is characterised in that:Institute State step 2 to be set up including bit distribution, rate-distortion model and quantization parameter QP three major parts of calculating, concretely comprise the following steps:
Step I:Frame level bit is distributed;In TEncRCSeq::In create () function, according to target bit rate and the frame of current sequence Rate, calculates target bit, and target bit is averagely allocated into each frame;
Step II:Modification TEncCu::UpdateLCUDataISlice () function, by the complexity benchmark of LCU by original 64 8 × 8 SATD and, be revised as fixing when QP is 22 the LCU bit numbers collected in step 1, that is, define file pointer and become Measure to read in the bit number information of LCU from file, function return value is assigned to the LCU arranged by raster scan order successively Complexity variable m_costIntra;
Step III:Each LCU in traversal present frame, by the cumulative and tax of the complexity variable m_costIntra of all LCU It is worth and gives m_totalCostIntra variables, the variable represents total complexity of present frame;
Step IV:In function TEncRCPic::It is each LCU distributing bits, formula in getLCUInitTargetBits () It is as follows:
TCurrLCU=(TCurrPic-BitHeader-BitCoded)×CCurrLCU
C C u r r L C U = B 1 s t C u r r L C U Σ B N o t C o d e d L C U s
Wherein, CCurrLCUIt is the complexity of current LCU, B1stCurrLCUIt is the bit of current LCU being collected into First-Pass Number, BNotCodedLCUsIt is the bit number of uncoded LCU in the present frame that is collected into step 1;
Step V:Using video code rate, the distortion information collected in step 1, on the basis of hyperbola R-D models, fitting is current Model parameter C, K of video sequence;
Step VI:According to R-D models and the corresponding relation of R- λ models, model parameter α, β of R- λ models is calculated;
Step VII:R- λ models according to on-line training model parameter, using the bit number in step IV being current LCU distribution, meter The λ value for current LCU is calculated, and checks whether to meet constraint;
Step VIII:λ and QP according to described in the λ value and formula QP=4.2005ln λ+13.7122 obtained in step VII it Between relation, calculate the QP values for current LCU quantizing process, and check whether to meet constraint;
Step IV:The QP values collection obtained in applying step VIII, carries out complete cataloged procedure, output bit flow.
CN201611183575.7A 2016-12-20 2016-12-20 Two-Pass code rate control method based on HEVC Active CN106791848B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611183575.7A CN106791848B (en) 2016-12-20 2016-12-20 Two-Pass code rate control method based on HEVC

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611183575.7A CN106791848B (en) 2016-12-20 2016-12-20 Two-Pass code rate control method based on HEVC

Publications (2)

Publication Number Publication Date
CN106791848A true CN106791848A (en) 2017-05-31
CN106791848B CN106791848B (en) 2020-01-03

Family

ID=58895805

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611183575.7A Active CN106791848B (en) 2016-12-20 2016-12-20 Two-Pass code rate control method based on HEVC

Country Status (1)

Country Link
CN (1) CN106791848B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107277520A (en) * 2017-07-11 2017-10-20 中国科学技术大学 The bit rate control method of infra-frame prediction
CN107592535A (en) * 2017-08-18 2018-01-16 西安邮电大学 H.265/HEVC image layer bit rate control method
CN109120934A (en) * 2018-09-25 2019-01-01 杭州电子科技大学 A kind of frame level quantization parameter calculation method suitable for HEVC Video coding
CN110324615A (en) * 2018-03-30 2019-10-11 华为技术有限公司 A kind of code rate allocation method and device
CN110351555A (en) * 2018-04-03 2019-10-18 朱政 Multipass based on intensified learning goes through video frequency coding rate distribution and control optimization method
CN113382242A (en) * 2021-05-20 2021-09-10 北京大学深圳研究生院 Code rate control method, device, equipment and computer readable storage medium
CN114466189A (en) * 2021-12-27 2022-05-10 浙江大华技术股份有限公司 Code rate control method, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060256857A1 (en) * 2005-05-16 2006-11-16 Douglas Chin Method and system for rate control in a video encoder
CN101287123A (en) * 2008-05-23 2008-10-15 清华大学 Code rate controlling method for video coding based on Rho domain
CN103067720A (en) * 2013-02-05 2013-04-24 南京信息工程大学 Macroblock layer rate control method based on H264 video encoding standard
CN104104951A (en) * 2014-07-30 2014-10-15 北京邮电大学 Rate control method for screen content coding in HEVC
CN104159095A (en) * 2014-02-19 2014-11-19 上海大学 Code rate control method for multi-view texture video and depth map coding

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060256857A1 (en) * 2005-05-16 2006-11-16 Douglas Chin Method and system for rate control in a video encoder
CN101287123A (en) * 2008-05-23 2008-10-15 清华大学 Code rate controlling method for video coding based on Rho domain
CN103067720A (en) * 2013-02-05 2013-04-24 南京信息工程大学 Macroblock layer rate control method based on H264 video encoding standard
CN104159095A (en) * 2014-02-19 2014-11-19 上海大学 Code rate control method for multi-view texture video and depth map coding
CN104104951A (en) * 2014-07-30 2014-10-15 北京邮电大学 Rate control method for screen content coding in HEVC

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YEO-JIN YOON ET AL.: "A New Rate Control Method for Hierarchical Video Coding in HEVC", 《IEEE INTERNATIONAL SYMPOSIUM ON》 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107277520A (en) * 2017-07-11 2017-10-20 中国科学技术大学 The bit rate control method of infra-frame prediction
CN107277520B (en) * 2017-07-11 2020-05-12 中国科学技术大学 Code rate control method for intra-frame prediction
CN107592535A (en) * 2017-08-18 2018-01-16 西安邮电大学 H.265/HEVC image layer bit rate control method
CN107592535B (en) * 2017-08-18 2020-09-01 西安邮电大学 H.265/HEVC image layer code rate control method
CN110324615A (en) * 2018-03-30 2019-10-11 华为技术有限公司 A kind of code rate allocation method and device
CN110351555A (en) * 2018-04-03 2019-10-18 朱政 Multipass based on intensified learning goes through video frequency coding rate distribution and control optimization method
CN109120934A (en) * 2018-09-25 2019-01-01 杭州电子科技大学 A kind of frame level quantization parameter calculation method suitable for HEVC Video coding
CN109120934B (en) * 2018-09-25 2020-06-23 杭州电子科技大学 Frame-level quantization parameter calculation method suitable for HEVC video coding
CN113382242A (en) * 2021-05-20 2021-09-10 北京大学深圳研究生院 Code rate control method, device, equipment and computer readable storage medium
CN114466189A (en) * 2021-12-27 2022-05-10 浙江大华技术股份有限公司 Code rate control method, electronic device and storage medium
CN114466189B (en) * 2021-12-27 2024-05-28 浙江大华技术股份有限公司 Code rate control method, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN106791848B (en) 2020-01-03

Similar Documents

Publication Publication Date Title
CN106791848A (en) A kind of Two Pass bit rate control methods based on HEVC
CN101395923B (en) Method and apparatus for determining in picture signal encoding the bit allocation for groups of pixel blocks in a picture
DE69836052T2 (en) Method and apparatus for image processing, and data recording medium
CN100536573C (en) Inframe prediction method used for video frequency coding
CN104796705B (en) A kind of HEVC Video codings rate-distortion optimization and rate control algorithm based on SSIM
KR100304103B1 (en) Method for finding re-quantization step sizes resulting in abrupt bit-rate reduction and rate control method using it
US6912255B2 (en) Bit rate control through selective modification of DCT coefficients
KR100307618B1 (en) Device and method for encoding image
CN103051901B (en) Video data coding device and method for coding video data
CN104320657B (en) The predicting mode selecting method of HEVC lossless video encodings and corresponding coding method
CN107277520B (en) Code rate control method for intra-frame prediction
CN101653003A (en) Be used for the quantification of hybrid video coding
CN104185024B (en) A kind of HEVC quantization parameter optimization methods based on total bitrate and entropy model
CN106231320A (en) A kind of unicode rate control method supporting multi-host parallel to encode and system
CN103152565A (en) Image decoding method and image coding method
CN104333761B (en) A kind of HEVC elementary cells level bit-rate distribution method
CN107222748A (en) The treating method and apparatus of view data code check
CN106657998A (en) KVM video coding quantization parameter range control method
CN102754440A (en) Image encoding method, image encoding device and imaging system
KR19980074651A (en) Rate control device for MPEG video signal using fuzzy control
JP3777002B2 (en) Video signal encoding method and video signal encoding apparatus
CN105430395B (en) A kind of HEVC CTU level bit-rate control methods based on optimum bit distribution
CN100448295C (en) Integration code rate control method of low complexity
JPH10336654A (en) Image encoder
CN100505874C (en) Video-frequency encoding-rate controlling method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 450007 Zhengzhou Zhongyuan Road, Henan, No. 212

Applicant after: China Electric Power Construction Group Henan electric survey and Design Institute Co., Ltd.

Address before: 450007 Zhengzhou Zhongyuan Road, Henan, No. 212

Applicant before: Hennan Electric Power Survey & Design Institute

GR01 Patent grant
GR01 Patent grant