CN104320657B - The predicting mode selecting method of HEVC lossless video encodings and corresponding coding method - Google Patents
The predicting mode selecting method of HEVC lossless video encodings and corresponding coding method Download PDFInfo
- Publication number
- CN104320657B CN104320657B CN201410609275.5A CN201410609275A CN104320657B CN 104320657 B CN104320657 B CN 104320657B CN 201410609275 A CN201410609275 A CN 201410609275A CN 104320657 B CN104320657 B CN 104320657B
- Authority
- CN
- China
- Prior art keywords
- prediction
- bit rate
- intra
- frame
- inter
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 50
- 238000010187 selection method Methods 0.000 claims description 11
- 230000008569 process Effects 0.000 claims description 10
- 230000008859 change Effects 0.000 claims description 4
- 241000372285 Isanda Species 0.000 claims description 3
- 238000004364 calculation method Methods 0.000 abstract description 7
- 230000000694 effects Effects 0.000 abstract description 5
- 230000015556 catabolic process Effects 0.000 abstract description 3
- 238000006731 degradation reaction Methods 0.000 abstract description 3
- 230000002411 adverse Effects 0.000 abstract description 2
- 230000006835 compression Effects 0.000 description 47
- 238000007906 compression Methods 0.000 description 47
- 238000013139 quantization Methods 0.000 description 17
- 238000012360 testing method Methods 0.000 description 12
- 238000001914 filtration Methods 0.000 description 4
- 230000008520 organization Effects 0.000 description 4
- 239000010754 BS 2869 Class F Substances 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 230000009466 transformation Effects 0.000 description 3
- 241000777300 Congiopodidae Species 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 230000007423 decrease Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 230000003750 conditioning effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003121 nonmonotonic effect Effects 0.000 description 1
- 230000001151 other effect Effects 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The present invention proposes a kind of predicting mode selecting method of HEVC lossless video encodings and corresponding coding method, the infra-frame prediction and inter prediction that the system of selection initializes each LCU of the frame of video first are used for RDO Lagrange's multiplier and carry out infra-frame prediction and inter prediction, selecting optimal mode is used to encode, bit rate needed for the calculation code frame, it is used as initial reference bits rate, then the multiplier for changing K LCU of the frame selects optimal mode for encoding again, calculate current bit rate, calculate the difference between current bit rate and reference bits rate, receive or refuse the multiplier after changing according to predetermined rule, and it regard current bit rate as reference bits rate when receiving, judge whether without changing multiplier again, when need not, then terminate, otherwise iteration is come back for.The method of the present invention changes very little to the original coding structures of HEVC, eliminates the adverse effect that QP is brought to lossless mode code efficiency in primary standard, coding bit rate has substantial degradation.
Description
Technical Field
The present invention relates to the field of video coding, and more particularly, to a prediction mode selection method for HEVC lossless video coding and a video coding method based on the method.
Background
In recent years, with the development of communication technology and multimedia technology, there is an increasing demand for multimedia communication such as video. However, the data size of video is huge, and video data that is not compressed by encoding cannot be transmitted in the existing channel basically. To meet the above various requirements, various video coding schemes have been proposed internationally. Since the nineties of the last century, the international telecommunication union telecommunication standardization organization itu.t and the international organization for standardization ISO jointly set a series of international standards and recommendations on video compression codecs, of which the h.26x series of video compression standards proposed by ITU and the MPEG series of international standards proposed by ISO/IEC JTC have the greatest impact. In 1 month 2013, a Video coding standardization organization JCT-vc (joint Video Team on Video coding) formally releases a latest generation Video coding international standard, namely a high performance Video standard hevc (high Efficiency Video coding), and under the same Video subjective quality, the bit rate of the Video coding standardization organization is about 50% of that of the previous generation Video coding standard h.264/AVC.
The coding basic framework of HEVC is similar to the previous h.264/AVC standard and still employs a hybrid coding mode. The whole encoding process mainly comprises the following steps: predicting, transforming, quantizing and entropy coding. The prediction part is divided into two major categories, intra prediction and inter prediction. The intra-frame prediction uses reconstructed pixels of the current frame as reference pixels to perform preliminary prediction, and the inter-frame prediction uses reconstructed pixel values of the previous or later frames as references. And subtracting the original pixel value of the current block from the obtained predicted value to obtain a residual error, carrying out transform quantization on the residual error to obtain a transform coefficient, and finally carrying out entropy coding on the transform coefficient to obtain a final code stream. No matter the prediction is interframe prediction or intraframe prediction, the information of the reconstructed image is needed, therefore, in the coding process, the residual image needs to be subjected to inverse transformation quantization, then the residual image is added with the predicted value, finally, the noise in the video image is filtered through a loop filter, and meanwhile, the video image degradation influence such as blocking effect and the like can be avoided.
In the HEVC standard, there are two main classes of coding modes, lossy compression and lossless compression. For most video transmitted over the internet, proper lossy compression can reduce the bit rate well, thereby increasing the efficiency of the transmission. And the lossless compression also has great application in the fields of medical videos, remote sensing videos, fingerprints and the like. In the HEVC standard, lossless compression exists as an extension of lossy compression. Since quantization has distortion, and in HEVC, transform and quantization are combined, the transform process also has distortion, and thus in HEVC lossless compression coding, the transform quantization process is turned off. In addition, since pixels before and after encoding are undistorted, loop filtering is not needed, and the HEVC lossless compression operation skips the loop filtering process. That is, in the current HEVC lossless compression operation, there are only two parts, prediction and entropy coding. It can be seen that the quality of prediction will directly affect the performance of HEVC lossless compression.
As mentioned above, the prediction of HEVC is divided into intra prediction and inter prediction. For intra prediction, the direction of prediction is up to 35 modes. Each mode corresponds to an intra prediction direction, as shown in fig. 1. Such a fine pattern facilitates finding a pattern that best removes intra redundancy, thereby maximizing intra coding performance. In HEVC, Rate Distortion Optimization (RDO) is used to select the best mode, i.e., a mode with the smallest RD cost is selected as the prediction mode. RDcost is calculated as shown in equation (1):
RD cost=D+λR (1)
where D represents the distortion of the reconstructed image block and the original image block, R represents the bit rate required for encoding the prediction block in the mode (including the encoded residual and the bit rate required for encoding the prediction mode), and λ is a lagrangian multiplier used to weigh the bit rate in the RD cost, which can be obtained by calculating formula (2):
λ=Qpfactor×2(QP-12)/3(2)
wherein, QP is a quantization parameter (quantization parameter) for indicating different quantization step sizes, the larger the QP is, the larger the quantization step size is, i.e. the larger the generated quantization distortion is, and Qpfactor is a quantization coefficient, which is a constant in the formula and is determined by specific coding conditions such as frame type.
As can be seen from the formula (1), when calculating each RD cost, two parts, D and R, need to be calculated, and particularly, when calculating D, the residual image (the difference between the predicted image and the original image) needs to be transformed, quantized, and inversely transformed, quantized, and reconstructed to obtain the reconstructed image block, and then the distortion is calculated, which has a very high computation load. If the rate distortion is calculated for these 35 modes directly when the best mode is selected, the amount of calculation is very high. In order to reduce the operation amount, HEVC first adopts a coarse method to calculate RD cost to select several better candidate modes, and then performs accurate RD cost calculation on the several candidate modes to select the best mode. The rough way is to use simple Hadamard transform of residual image blocks to replace the complex distortion D calculation, thereby effectively reducing the complexity.
For inter prediction, the encoder looks for the most similar image block to the prediction block around the reference frame prediction block position. To find the best matching image block, the precision of the motion vector in HEVC reaches 1/4 pixels. Similarly, when comparing the image block at which position of the reference frame is used as the reference block, the position with the minimum RD cost is also found. Similar to intra prediction, if the optimal image block is found in the range of 64 × 64 with an accuracy of 1/4 pixels, then RDcost of 16384 times will be calculated, which is also very heavy. To reduce the amount of computation, HEVC performs a coarse search using a method of calculating the absolute difference and sad (sum of absolute distortion) instead of the calculation of the actual distortion degree in motion search.
In many current applications, the demand for lossless compression of video is increasing, and since the lossless coding mode of HEVC can provide a higher compression rate, the application of the lossless compression coding of video will also be wider. In the mainstream applications of the HEVC standard, such as set-top boxes, video monitoring, etc., high coding efficiency is required, and thus some distortion has to be generated as a cost, that is, most of the mainstream applications are lossy compression. However, above the HEVC lossy compression standard, it is obviously impractical to develop a new set of coding tools to achieve as good a lossless coding efficiency as possible. Therefore, when designing the HEVC lossless coding scheme, we should follow such design principles: the existing HEVC lossy coding structure is utilized as much as possible, the proposed lossless coding scheme has the advantages of changing the original lossy coding structure as little as possible, and simultaneously considering the balance of coding efficiency and complexity.
As can be seen from the above description, HEVC lossless compression is relatively lossy compression, and only three parts of transform, quantization and loop filtering are skipped, while the strategies of prediction and entropy coding remain the same. Lossy compression requires equalizing the reconstructed video quality and the coding bit rate for coding. Unlike lossy compression, in lossless compression, D in formula (1) is finally zero, so there is no problem of quality degradation of reconstructed video, and the only goal of encoding is to reduce the bit rate as much as possible at the allowable codec complexity. In lossless compression, if D is accurately calculated, the resulting distortion D is zero, and at this time, regardless of λ, the minimized RD cost is equivalent to the minimized bit rate R, so the original lossy compression strategy at this time is still applicable to lossless compression. However, it is impossible to accurately calculate RD cost for each mode regardless of intra prediction or inter prediction, and the above-mentioned coarse selection strategy must be used. In lossy compression, the difference between D obtained through rough calculation and actual D is not large, and in lossless compression, the difference between D obtained through rough calculation and D which is actually zero is large, at this time, the candidate modes obtained according to the formulas (1) and (2) do not necessarily include an actual optimal mode, and therefore the final coding performance is not necessarily optimal. Equations (1), (2) must be redefined in order to obtain better lossless compression performance.
In addition, during lossy compression, the QP can be adjusted to obtain code streams with different qualities and different bit rates, so as to meet the requirements of different application scenarios. This is because, on the one hand, adjusting QP can achieve different λ, thereby adjusting the trade-off relationship between bitrate and reconstructed image quality in RD cost. On the other hand, the most important aspect is that the smaller the QP, the smaller the quantization error, the better the decoded reconstructed video image quality, but the higher the bit rate of the code stream generated by the encoding. Therefore, in lossy compression, the bit rate decreases with increasing QP, while the video image decoding reconstruction quality decreases with increasing QP, as other coding conditions are the same. However, in lossless compression, there is no quantization already, except for adjusting λ, QP has really no other effect. Fig. 2 is a graph of the variation of the sequence Racehorse bit rate with QP (HM10.0) in lossless compression coding, and it can be seen from fig. 2 that, in lossless compression, the bit rate of the coded stream has a non-monotonic relationship with QP, and the minimum bit rate cannot be achieved either when the QP is minimum (0 when the coded video is 8 bits, and-12 when the coded video is 10 bits) or maximum (51 when the coded video is 8 bits, and 39 when the coded video is 10 bits). Thus, for lossless compression, the effect of the QP, the coding parameter, is different, and its correspondence to λ is no longer determined as shown in equation (2).
Disclosure of Invention
In view of the above, the present invention provides a prediction mode selection method for HEVC lossless video coding, so as to readjust a coarse selection strategy for many modes in a coding prediction process, thereby reducing a lossless compression bit rate to the maximum extent.
In order to achieve the above object, the present invention provides 1 a prediction mode selection method for HEVC lossless video coding, including the following steps performed in sequence:
s1 Lagrangian multiplier for RDO using intra prediction and inter prediction of each LCU of a video frame for one video frameAndinitializing, performing intra-frame prediction and inter-frame prediction, selecting an optimal intra-frame prediction mode and an optimal inter-frame prediction mode, selecting an optimal mode from the optimal intra-frame prediction mode and the optimal inter-frame prediction mode for encoding, and calculating a bit rate required for encoding the frame as an initial reference bit rate R0I, j represent the location coordinates of the LCU; s2, changing the K LCUs of the video frameAndperforming intra-frame prediction and inter-frame prediction, selecting the best intra-frame prediction mode and the best inter-frame prediction mode, selecting the best mode from the best intra-frame prediction mode and the best inter-frame prediction mode for encoding, calculating the frame of the video to be encodedThe required bit rate is taken as the current bit rate R', K is a natural number; s3, calculating the difference value Delta R between the current bit rate and the reference bit rate, and accepting or rejecting the changed bit rate according to a preset ruleAndand upon acceptance, using the current bit rate as the reference bit rate; s4, judging whether the change of the image is not needed any moreAndwhen no more changes are needed, then the current one isAndas a finalAndotherwise, the process returns to step S2.
Preferably, in step S1, the lagrangian multiplierAndis initialized toAndthe above-mentionedThe value range is [3, 8 ]]SaidThe value range is [0.5, 1.5 ]]。
Preferably, in step S1, for intra prediction, the one in the minimization formula (8) is usedThe cost criterion selects a candidate mode from a plurality of intra-frame prediction modes, and then selects the best intra-frame prediction mode from the candidate modes according to a formula (1), wherein the formula is as follows:
RD cost=D+λR (1)
wherein,representing a coarse rate-distortion cost of intra prediction, DintraPrediction residual distortion for intra prediction; rintraRepresenting a bit rate required for encoding prediction information other than residual information in intra prediction; λ is the Lagrange multiplier; d is the actual residual distortion of the intra prediction, R is the actual coding bit rate, and RD cost represents the actual rate-distortion cost.
Preferably, in step S1, for inter prediction, the one in the minimization formula (9) is usedThe cost criterion selects the optimal MV and the corresponding reference frame, and then the optimal inter-frame prediction mode is selected from each inter-frame mode according to a formula (1), wherein the formula is as follows:
RD cost=D+λR (1)
wherein,representing the coarse rate-distortion cost of inter prediction, DinterPrediction residual distortion for inter prediction, RinterThe bit rate required by encoding other prediction information except residual information in the inter-frame prediction is represented, wherein lambda is a Lagrange multiplier, and D is the actual residual distortion of the intra-frame prediction; r is the actual coding bit rate and RD cost represents the actual rate-distortion cost.
Preferably, in step S2, K is the number of LCUs contained in each column of the video frame.
Preferably, in step S3, if Δ R ≦ 0, the changed value is acceptedAndotherwise, the value is calculated as exp (-delta R/R)0) Is received with probability ofAnd
preferably, step S3 is: recording the number of iterations Ti and continuously rejecting said iterations in the course of said iterationAndof the number of iterations Ti reaches oneThe threshold value of iteration number THI, or the number of consecutive rejections Tr reaches a threshold value of consecutive rejections THr, the current value is setAndas a finalAnd
preferably, step S1 further includes initializing the number of iterations Ti and the number of consecutive rejections Tr to 0.
Preferably, in step S1, the THi value range is [1, 1000], and the THr value range is [1, 50 ].
The invention further provides an HEVC lossless video coding method, which comprises the prediction mode selection method for the HEVC lossless video coding.
According to the technical scheme, the prediction mode selection method for the HEVC lossless video coding has the following advantages: the original coding structure of the HEVC is slightly changed, and the existing coding tool of the HEVC is fully utilized; because transformation and quantization are skipped in HEVC lossless coding, the QP coding tool has no practical significance in lossless compression, and the method eliminates the adverse effect of the QP in the original standard on the coding efficiency; compared with a lossless compression method in HM10.0, the coding bit rate of the method is greatly reduced, under three coding environments of RA-Main, LDB-Main and LDP-Main, the bit rate of the method is averagely reduced by 1.2-1.4%, particularly F-type test sequences, and the bit rate saving which is averagely as high as 2.5-2.9% is obtained.
Drawings
FIG. 1 is a diagram illustrating the corresponding directions of various intra prediction modes in the prior art;
FIG. 2 is a graph of sequence Racehorse bit rate versus QP variation (HM10.0) in lossless compression coding;
FIG. 3 is a schematic diagram of the Lagrangian multiplier for RDO for intra-prediction and inter-prediction per LCU (each block in the figure represents one LCU);
fig. 4 is a specific flowchart of the prediction mode selection method of HEVC lossless video coding according to the present invention.
Detailed Description
In order that the objects, technical solutions and advantages of the present invention will become more apparent, the present invention will be further described in detail with reference to the accompanying drawings in conjunction with the following specific embodiments.
In the HEVC standard, there are two main classes of coding modes, lossy compression and lossless compression. In lossless compression, there is no reconstruction distortion, and thus its sole purpose is to minimize the bit rate, i.e. to minimize the bit rate R. Since lossless compression exists only as an extension of HEVC, in principle no major modifications to the original HEVC are desired. In the case of a coarse mode selection, the variables in equation (1) are different from those in the case of a precise selection, wherein the distortion D of the reconstructed image block and the original image block essentially represents a distortion function related to the residual, i.e. the distortion D is a function of the residual
D=f(residue) (3)
Where residual represents the residual.
Likewise, RpredInfoIndicating the bit rate required to encode the prediction mode. When performing intra prediction, RpredInfoIndicating the bit rate required to encode the corresponding direction of the mode, and R is the bit rate required to perform inter-frame predictionpredInfoIndicating the bit rate required to encode the mode-corresponding Motion Vector (MV) information. Since the following are pairsThe residual information is entropy coded, and it can be considered that the larger the residual is, the larger the bit rate required for subsequently coding the residual is, i.e. the residual is
Rresidue=αf(residue),α>0 (4)
Wherein R isresidueIndicating the bit rate actually required to encode the residual information and α the scaling factor.
The final bit rate R required for a certain modetotalSum of bit rate required for encoding residual and bit rate required for encoding prediction mode information other than residual information, i.e. sum of bit rate required for encoding residual and bit rate required for encoding prediction mode information other than residual information
Rtotal=Rresidue+RpredInfo(5)
From equations (4), (5):
Rtotal=αf(residue)+RpredInfo=αD+RpredInfo(6)
since α > 0, then, R is minimizedtotalEquivalent to minimizing Rtotal/α, i.e. minimization
D+RpredInfo/α (7)
Comparing equations (1) and (7), it can be found that, when λ is 1/α, RD cost in equation (1) is minimized and final bit rate R is minimizedtotalAre consistent. Thus, only find RresidueAnd f (residual) is obtained by α, i.e., λ is 1/α, i.e., the lossless mode selection, i.e., the lossless coding bit rate, can be optimized based on the original lossy mode selection optimization strategy.
How this proportional relationship α is obtained will be analyzed below.
As described above, in the HEVC lossless compression standard, there is no transformation and quantization of the residual, so after obtaining the residual, entropy coding is performed directly, so entropy coding is an important factor that affects the bit rate required for the subsequent coding of the residual. In the residual entropy Coding of the HEVC standard, Context-based adaptive Binary Arithmetic Coding (CABAC) is used for entropy Coding. In the CABAC entropy coding of the HEVC standard, except that the initialization of the context probability model of each frame is related to the QP, the QP is not involved in other parts. In CABAC, the context model is adaptively adjusted during the encoding process, so as to optimize the encoding efficiency. Therefore, the initial context probability model only affects the encoding of the very few residual bits at the beginning, and the effect on the overall residual encoding is very small, so that the effect of QP on the final encoding efficiency during entropy encoding can be considered to be very small. Thus, it can be considered that α has no significant relationship with QP. However, as can be seen from equation (2), in the lossy compression, λ ═ 1/α is closely related to QP, which is the difference between the lossless compression and the lossy compression in the HEVC standard prediction mode selection.
Therefore, the invention provides a method for designing the lambda parameter completely independent of QP.
Considering the difference in residual characteristics of each block, the following method tries to find the optimal lagrangian multiplier combination of each Largest Coding Unit (LCU) in a certain frame.
Fig. 3 is a schematic diagram of the lagrangian multiplier for RDO for intra-prediction and inter-prediction per LCU (each block in the figure represents one LCU). As shown in FIG. 3, the present invention first uses intra-prediction and inter-prediction for each LCU for the Lagrangian multiplier for RDOAndare all initialized toAndthe value range is [3, 8 ]],The value range is [0.5, 1.5 ]]The value range is obtained based on the Test sequence and Test Conditions provided in the literature (F.Bossen, "Common Test Conditions and software references Configurations", JCT-VC document, JCTVC-L1100, Geneva, Jan.2013), and can be adjusted according to the actual coding Conditions. Setting the continuous rejection times Tr and the iteration times Ti as 0, and obtaining the coding bit rate R of the current parameter after coding the frame0Randomly varying K LCUsAndand coding, wherein K is a natural number, calculating the bit rate R 'required by coding the frame under a new Lagrange multiplier, and calculating the bit rate difference delta R ═ R' -R0If delta R is less than or equal to 0, the Lagrange multiplier is accepted as a new Lagrange multiplier, otherwise exp (-delta R/R) is used0) Is accepted as the new lagrangian multiplier. If the new Lagrangian multiplier is accepted, the number of consecutive rejections Tr is set to 0 and R is made0Otherwise, the number of consecutive rejections Tr is increased by 1. Next, the number of iterations Ti is increased by 1.
After updating the continuous rejection times Tr and the iteration times Ti, judging the following two conditions:
(1) whether the number of consecutive rejections Tr is less than a threshold THr;
(2) whether the number of iterations Ti is less than the threshold THi.
Wherein, the value range of THI is [1, 1000%]The value range of THr is [1, 50]]. The value range is obtained based on a Test sequence and a Test condition provided in documents (F.Bossen, "Common Test Conditions and Software references", JCT-VC document, JCTVC-L1100, Geneva, Jan.2013), and can be adjusted according to an actual coding condition. If both of these two conditions are satisfied, thenRandomly varying K LCUs based on the pre-Lagrange multiplierAndand carrying out next encoding, calculating the encoding bit rate R' under the new Lagrange multiplier, calculating the delta R again, determining whether to receive the new Lagrange multiplier or not by adopting the same strategy according to the delta R, and updating the continuous rejection times Tr and the iteration times Ti. If only one of the two conditions is not met, the latest Lagrange multiplier is used as the optimal setting of the Lagrange multiplier of each LCU intra-frame prediction and inter-frame prediction of the current frame, and the encoding of the frame is finished.
And continuously and repeatedly circulating the steps until one of the conditions (1) and (2) is not met, and taking the latest Lagrangian multiplier as the optimal setting of the Lagrangian multipliers of each LCU intra-frame prediction and inter-frame prediction of the current frame. This concludes the encoding of the frame.
Fig. 4 is a flowchart of a prediction mode selection method for HEVC lossless video coding according to the present invention, and as shown, the method includes the following steps:
s1, initializing Lagrangian multiplier for RDO of intra prediction and inter prediction of each LCU of a video frameAndand performing intra prediction and inter prediction, selecting an optimal intra prediction mode and an optimal inter prediction mode, selecting an optimal mode from the optimal intra prediction mode and the optimal inter prediction mode for encoding, and calculating a bit rate required for encoding the frame as an initial reference bit rate R0And i, j represent the location coordinates of the LCU.
And initializes the number of consecutive rejections Tr and the number of iterations Ti.
For example, in one particular embodiment, intra-prediction and inter-prediction for each LCU are used for the Lagrangian multiplier for RDOAndare all arranged asAndandset to 5 and 1, respectively. Both the number of consecutive rejections Tr and the number of iterations Ti are initialized to 0.
Then, in the detailed implementation, the present invention proposes that for intra prediction, the minimization of the equation (8) can be usedSelecting a candidate mode from a plurality of intra-frame prediction modes according to the cost criterion, and selecting the best intra-frame prediction mode from the candidate modes according to a formula (1); for inter prediction, the one in the minimization formula (9) is usedAnd selecting the optimal MV according to the cost criterion, and selecting the optimal inter-frame prediction mode from the inter-frame modes according to the formula (1).
Wherein,representing the coarse rate-distortion cost of inter-prediction and intra-prediction, respectively, DintraAnd DinterThe prediction residual distortion for intra prediction and inter prediction, respectively, can be represented by the sum of absolute differences of the predicted value and the original value. RintraAnd DinterRespectively, indicating the bit rates required for encoding prediction information other than residual information in intra prediction and inter prediction.
Selecting the best mode from the best intra-frame prediction mode and the best intra-frame prediction mode to carry out prediction and entropy coding, and then obtaining the current bit required by coding the frame as the reference bit rate R0。
Step S2, the changing of the K LCUs of the video frameAndthe method comprises the steps of carrying out intra-frame prediction and inter-frame prediction, selecting an optimal intra-frame prediction mode and an optimal inter-frame prediction mode, selecting the optimal mode from the optimal intra-frame prediction mode and the optimal inter-frame prediction mode for coding, and calculating the bit rate required by coding the frame as the current bit rate R', K is a natural number.
In a specific embodiment, the value of K cannot be too small, otherwise, the optimal parameter combination cannot be obtained finally; nor too large, or the computational complexity will be very high. K may be the number of LCUs contained in each column of the video frame.
Step S3, calculating the difference value Delta R between the current bit rate and the reference bit rate, and accepting or rejecting the changed bit rate according to a predetermined ruleAndand the current bit rate is taken as the reference bit rate upon acceptance.
Specifically, Δ R ═ R' -R is used0The difference Δ R is calculated. If Δ R is less than or equal to 0, accepting the altered versionAndotherwise, the value is calculated as exp (-delta R/R)0) Is received with probability ofAndis receiving theAndwhen it is, let R0=R′。
Step S4, judging whether the change of the image is not neededAndwhen no more changes are needed, then the current one isAndas a finalAndotherwise, the process returns to step S2.
In one embodiment, the number of iterations Ti is recorded and said successive rejections are performed during the iterationAndif the iteration number Ti reaches an iteration number threshold value or the continuous rejection number Tr reaches a continuous rejection number threshold value, the current number is determinedAndas a finalAndin a particular embodiment, Ti and Tr may be initialized to 0 in step S1. When iteration is performed, the iteration number Ti is added by 1 in each iteration. If it is as describedAndif the number of consecutive rejections is accepted, the number of consecutive rejections Tr is set to 0, otherwise the number of consecutive rejections Tr is increased by 1. The value range of THI may be [1, 1000]]The value range of THr can be [1, 50]]。
For the HEVC lossless video coding method of the present invention, the prediction mode is selected according to the above prediction mode selection methodAndlossless video coding is performed.
Examples
To verify the beneficial effects of the present invention, the method is implemented on the latest HEVC reference code HM10.0, and compared with the original lossless coding method of skipping transform, quantization, and filtering in the reference code. In the simulation comparison, Test sequences and Test Conditions provided in literatures (F.Bossen, "Common Test conditionings and Software ReferenceConfigurations," JCT-VC document, JCTVC-L1100, Geneva, Jan.2013) were used as simulation comparison environments. The method adopts three coding environments, namely Random Access Main file coding (RA-Main), low-delay B Main file coding (LDB-Main) and low-delay P Main file coding (LDP-Main). We tested all video sequences from class a to class F, where class F is a screen recorded video sequence, and the resolution of the sequences is different, and there are many resolutions 1280 × 720, 1024 × 768, and 832 × 480, and the resolutions of the video sequences of other classes are shown in table 1. Since the default encoding mode in the reference software HM10.0 is lossy encoding, we need to set the flag indicating whether or not lossless encoding is performed in the configuration file to 1, i.e. lossless encoding is performed.
TABLE 1 various test sequences
Sequence type | Resolution ratio |
Class A | 2560×1600 |
Class B | 1920×1080 |
Class C | 832×480 |
Class D | 416×240 |
Class E | 1280×720 |
Tables 2-4 show the bit rates of the original lossless coding method in HM10.0 and the method proposed by the present invention under three coding environments, RA-Main, LDB-Main and LDP-Main, respectively, where the bit rate saving rate is obtained by the following formula:
bit rate change rate 100 × (inventive bit rate-original method bit rate)/original method bit rate%.
TABLE 2 Experimental results in RA-Main configuration Environment
TABLE 3 Experimental results under LDB-Main configuration Environment
TABLE 4 Experimental results under LDP-Main configuration Environment
From tables 2-4, we can see that the coding bit rate of the present invention is greatly reduced compared to the lossless compression method in HM 10.0. The bit rate of the method of the invention is reduced by 1.2-1.4% on average in three coding environments, in particular class F test sequences, which achieve bit rate savings on average up to 2.5-2.9%.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention and are not intended to limit the present invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A prediction mode selection method for HEVC lossless video coding comprises the following steps in sequence:
s1 Lagrangian multiplier for RDO using intra prediction and inter prediction of each LCU of a video frame for one video frameAndinitialPerforming intra-frame prediction and inter-frame prediction, selecting an optimal intra-frame prediction mode and an optimal inter-frame prediction mode, selecting an optimal mode from the optimal intra-frame prediction mode and the optimal inter-frame prediction mode for encoding, and calculating a bit rate required for encoding the frame as an initial reference bit rate R0I, j represent the location coordinates of the LCU;
s2, changing the K LCUs of the video frameAndperforming intra-frame prediction and inter-frame prediction, selecting an optimal intra-frame prediction mode and an optimal inter-frame prediction mode, selecting the optimal mode from the optimal intra-frame prediction mode and the optimal inter-frame prediction mode for encoding, and calculating a bit rate required for encoding the video frame as a current bit rate R', K being a natural number;
s3, calculating the difference value Delta R between the current bit rate and the reference bit rate, and accepting or rejecting the changed bit rate according to a preset ruleAndand upon acceptance, using the current bit rate as the reference bit rate;
s4, judging whether the change of the image is not needed any moreAndwhen no more changes are needed, then the current one isAndas a finalAndotherwise, the process returns to step S2.
2. The method of claim 1, wherein in step S1, the Lagrangian multiplier is used for selecting the prediction mode of HEVC lossless video codingAndis initialized toAndthe above-mentionedThe value range is [3, 8 ]]SaidThe value range is [0.5, 1.5 ]]。
3. The method of claim 1, wherein in step S1, for intra prediction, the method of minimizing the prediction mode in equation (8) is usedCost accuracyThen a candidate mode is selected from the plurality of intra prediction modes, and then the best intra prediction mode is selected from the candidate modes according to formula (1), which is shown below:
<mrow> <msubsup> <mi>J</mi> <mrow> <mi>i</mi> <mo>,</mo> <mi>j</mi> </mrow> <mi>intra</mi> </msubsup> <mo>=</mo> <msub> <mi>D</mi> <mi>intra</mi> </msub> <mo>+</mo> <msubsup> <mi>&lambda;</mi> <mrow> <mi>i</mi> <mo>,</mo> <mi>j</mi> </mrow> <mi>intra</mi> </msubsup> <msub> <mi>R</mi> <mi>intra</mi> </msub> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>8</mn> <mo>)</mo> </mrow> </mrow>
RD cost=D+λR (1)
wherein,representing a coarse rate-distortion cost of intra prediction, DintraPrediction residual distortion for intra prediction; rintraRepresenting a bit rate required for encoding prediction information other than residual information in intra prediction; λ is the Lagrange multiplier; d is the actual residual distortion of the intra prediction, R is the actual coding bit rate, and RD cost represents the actual rate-distortion cost.
4. The method of claim 1, wherein in step S1, the method of minimizing the prediction mode in equation (9) is used for inter predictionThe cost criterion selects the optimal MV and the corresponding reference frame, and then the optimal inter-frame prediction mode is selected from each inter-frame mode according to a formula (1), wherein the formula is as follows:
<mrow> <msubsup> <mi>J</mi> <mrow> <mi>i</mi> <mo>,</mo> <mi>j</mi> </mrow> <mi>inter</mi> </msubsup> <mo>=</mo> <msub> <mi>D</mi> <mi>inter</mi> </msub> <mo>+</mo> <msubsup> <mi>&lambda;</mi> <mrow> <mi>i</mi> <mo>,</mo> <mi>j</mi> </mrow> <mi>inter</mi> </msubsup> <msub> <mi>R</mi> <mi>inter</mi> </msub> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>9</mn> <mo>)</mo> </mrow> </mrow>
RD cost=D+λR (1)
wherein,representing the coarse rate-distortion cost of inter prediction, DinterPrediction residual distortion for inter prediction, RinterThe bit rate required by encoding other prediction information except residual information in the inter-frame prediction is represented, wherein lambda is a Lagrange multiplier, and D is the actual residual distortion of the intra-frame prediction; r is the actual coding bit rate and RD cost represents the actual rate-distortion cost.
5. The method of claim 1, wherein in step S2, K is the number of LCUs contained in each column of the video frame.
6. The method of claim 1, wherein in step S3, if Δ R ≦ 0, the modified prediction mode is acceptedAndotherwise, the value is calculated as exp (-delta R/R)0) Is received with probability ofAnd
7. the method of claim 1, wherein step S3 is implemented as follows: recording the number of iterations Ti and continuously rejecting said iterations in the course of said iterationAndif the iteration number Ti reaches an iteration number threshold THi, or the continuous rejection number Tr reaches a continuous rejection number threshold THr, the current value is determinedAndas a finalAnd
8. the method of claim 7, wherein THI is in the range of [1, 1000], and THr is in the range of [1, 50 ].
9. The method of claim 7, further comprising initializing said number of iterations Ti and number of consecutive rejections Tr to 0 at step S1.
10. An HEVC lossless video coding method comprising the prediction mode selection method of HEVC lossless video coding as claimed in any one of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410609275.5A CN104320657B (en) | 2014-10-31 | 2014-10-31 | The predicting mode selecting method of HEVC lossless video encodings and corresponding coding method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410609275.5A CN104320657B (en) | 2014-10-31 | 2014-10-31 | The predicting mode selecting method of HEVC lossless video encodings and corresponding coding method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104320657A CN104320657A (en) | 2015-01-28 |
CN104320657B true CN104320657B (en) | 2017-11-03 |
Family
ID=52375818
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410609275.5A Active CN104320657B (en) | 2014-10-31 | 2014-10-31 | The predicting mode selecting method of HEVC lossless video encodings and corresponding coding method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104320657B (en) |
Families Citing this family (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105959611B (en) * | 2016-07-14 | 2018-09-21 | 同观科技(深圳)有限公司 | A kind of the interframe fast transcoding method and device of adaptive slave H264 to HEVC |
CN108347602B (en) * | 2017-01-22 | 2021-07-30 | 上海澜至半导体有限公司 | Method and apparatus for lossless compression of video data |
US10797723B2 (en) | 2017-03-14 | 2020-10-06 | International Business Machines Corporation | Building a context model ensemble in a context mixing compressor |
CN110300310B (en) * | 2018-03-23 | 2021-01-15 | 华为技术有限公司 | Image coding method, device and computer storage medium |
CN110381323B (en) * | 2018-04-12 | 2021-10-26 | 福州瑞芯微电子股份有限公司 | Inter-frame prediction-based lossless compression system and method for assisting frame motion vector information |
CN109361924B (en) * | 2018-10-26 | 2020-11-10 | 西安科锐盛创新科技有限公司 | Image coding method and device |
CN109547780B (en) * | 2018-10-26 | 2020-06-23 | 武汉天娱动画设计有限公司 | Image coding method and device |
CN109660806B (en) * | 2018-12-27 | 2021-01-29 | 上海众源网络有限公司 | Encoding method and device and electronic equipment |
CN112118444B (en) * | 2019-06-20 | 2022-11-25 | 杭州海康威视数字技术股份有限公司 | Encoding method and device |
MX2022004015A (en) * | 2019-10-05 | 2022-05-02 | Lg Electronics Inc | Image or video coding based on signaling of transform skip- and palette coding-related information. |
CN111882564A (en) * | 2020-07-27 | 2020-11-03 | 山东大学 | Compression processing method for ultra-high definition medical pathological image |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1708991A (en) * | 2002-11-08 | 2005-12-14 | 苹果电脑有限公司 | Method and apparatus for controlling rate-distortion tradeoff using lagrange multiplier and visual masking |
CN1846446A (en) * | 2003-09-03 | 2006-10-11 | 汤姆森许可贸易公司 | Process and arrangement for encoding video pictures |
CN101651831A (en) * | 2003-01-08 | 2010-02-17 | 苹果公司 | Method and apparatus for improved coding mode selection |
CN101960466A (en) * | 2007-09-11 | 2011-01-26 | 彩升集团有限公司 | Rate distortion optimization for inter mode generation for error resilient video coding |
CN102625102A (en) * | 2011-12-22 | 2012-08-01 | 北京航空航天大学 | H.264/scalable video coding medius-grain scalability (SVC MGS) coding-oriented rate distortion mode selection method |
-
2014
- 2014-10-31 CN CN201410609275.5A patent/CN104320657B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1708991A (en) * | 2002-11-08 | 2005-12-14 | 苹果电脑有限公司 | Method and apparatus for controlling rate-distortion tradeoff using lagrange multiplier and visual masking |
CN101651831A (en) * | 2003-01-08 | 2010-02-17 | 苹果公司 | Method and apparatus for improved coding mode selection |
CN1846446A (en) * | 2003-09-03 | 2006-10-11 | 汤姆森许可贸易公司 | Process and arrangement for encoding video pictures |
CN101960466A (en) * | 2007-09-11 | 2011-01-26 | 彩升集团有限公司 | Rate distortion optimization for inter mode generation for error resilient video coding |
CN102625102A (en) * | 2011-12-22 | 2012-08-01 | 北京航空航天大学 | H.264/scalable video coding medius-grain scalability (SVC MGS) coding-oriented rate distortion mode selection method |
Also Published As
Publication number | Publication date |
---|---|
CN104320657A (en) | 2015-01-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104320657B (en) | The predicting mode selecting method of HEVC lossless video encodings and corresponding coding method | |
US20230267649A1 (en) | Apparatus and method for coding/decoding image selectively using discrete cosine/sine transform | |
US7792193B2 (en) | Image encoding/decoding method and apparatus therefor | |
KR100813963B1 (en) | Method and apparatus for loseless encoding and decoding image | |
KR101232420B1 (en) | Rate-distortion quantization for context-adaptive variable length coding (cavlc) | |
US10091526B2 (en) | Method and apparatus for motion vector encoding/decoding using spatial division, and method and apparatus for image encoding/decoding using same | |
CN103329522B (en) | For the method using dictionary encoding video | |
US8144770B2 (en) | Apparatus and method for encoding moving picture | |
KR20050045746A (en) | Method and device for motion estimation using tree-structured variable block size | |
JP2006140758A (en) | Method, apparatus and program for encoding moving image | |
US8149918B2 (en) | Method of estimating coded block pattern and method of determining block mode using the same for moving picture encoder | |
US20130235938A1 (en) | Rate-distortion optimized transform and quantization system | |
US8559519B2 (en) | Method and device for video encoding using predicted residuals | |
EP2343901A1 (en) | Method and device for video encoding using predicted residuals | |
CN103327325A (en) | Intra-frame prediction mode rapid self-adaptation selection method based on HEVC standard | |
US8675726B2 (en) | Method and encoder for constrained soft-decision quantization in data compression | |
CN104685884A (en) | Improved architecture for hybrid video codec | |
US20180249160A1 (en) | Vector quantization for video coding using codebook generated by selected training signals | |
US20090041119A1 (en) | Method and Device for Coding a Video Image | |
KR100856392B1 (en) | Video Encoding and Decoding Apparatus and Method referencing Reconstructed Blocks of a Current Frame | |
Huang et al. | Acceleration of rate-distortion optimized quantization for H. 264/AVC | |
JP4130617B2 (en) | Moving picture coding method and moving picture coding apparatus | |
CA2732218C (en) | Method and encoder for constrained soft-decision quantization in data compression | |
CN104320660B (en) | Rate-distortion optimization method and coding method for lossless video encoding | |
KR20080013843A (en) | Method and apparatus for loseless encoding and decoding image |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |