CN108574841A - A kind of coding method and device based on adaptive quantizing parameter - Google Patents
A kind of coding method and device based on adaptive quantizing parameter Download PDFInfo
- Publication number
- CN108574841A CN108574841A CN201710130401.2A CN201710130401A CN108574841A CN 108574841 A CN108574841 A CN 108574841A CN 201710130401 A CN201710130401 A CN 201710130401A CN 108574841 A CN108574841 A CN 108574841A
- Authority
- CN
- China
- Prior art keywords
- coding
- preset
- encoded
- quality
- coding unit
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/102—Methods 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/124—Quantisation
Abstract
An embodiment of the present invention provides a kind of coding methods based on adaptive quantizing parameter and device, method to include:Obtain the quantization parameter of coding unit to be encoded;According to preset quality threshold, preset coding unit size, quantization parameter, coding unit to be encoded is encoded, acquisition includes the coding result of multiple mass figures;Compare mass figures and quality threshold, when being unsatisfactory for preset first quality judging condition there are a mass figures, reduce quantization parameter, and coding is re-started to coding unit to be encoded, until coding result meets preset first quality judging condition;When all mass figures meet preset first quality judging condition, and when being unsatisfactory for preset second quality judging condition there are a mass figures, increase quantization parameter, and coding is re-started to coding unit to be encoded, until coding result meets the first quality judging condition, the second quality judging condition.
Description
Technical field
The present invention relates to field of video encoding, more particularly to a kind of coding method based on adaptive quantizing parameter and dress
It sets.
Background technology
With the development of internet and Digital object identifier, Video Applications be deep into people work, life it is each
A corner, such as carry out video conference, shooting, viewing, download and transmitting video image.Video Applications have become internet
And the maximum hot spot of digital multimedia field.
Main problem is coding and decoding video, especially video coding process in Video Applications, needs to pass through original image
Coded treatment, the smaller coded image of boil down to occupied space is to carry out network storage or network transmission, therefore, how to obtain
The compression efficiency of higher Video coding becomes the matter of utmost importance of field of video encoding.And in video coding process, QP
The determination of (Quantization Parameter, quantization parameter) is a critical issue, and the size of QP directly influences coding
Quality and compression efficiency, QP is bigger, and the distortion of coded image and original image is bigger, and the quality of coding is poorer;QP is smaller, coding
The encoder bit rate of image is bigger, causes the occupied space of coded image bigger, compression efficiency is lower.
Existing method for video coding considers the referring-to relation of video interframe to determine the QP of each coding unit, and root
Video coding is carried out one by one to coding unit according to the QP of each coding unit, obtains the higher coding result of overall compression efficiency.
When this method obtains overall compression efficiency higher coding result, cataloged procedure is using being fixed the QP of each coding unit
Value, but the distortion that this value mode may result in some coding units is excessive, influences video image binary encoding
Quality, to cannot be satisfied demand of the specific application scene to coding quality, the applied field of specific application scene such as HD video
Scape etc..
Invention content
The embodiment of the present invention is designed to provide a kind of coding method based on adaptive quantizing parameter and device, can
The quantization parameter for adaptively changing coding unit to be encoded reduces the distortion of coding unit to be encoded, disclosure satisfy that specific
Demand of the application scenarios to coding quality.Specific technical solution is as follows:
The embodiment of the invention discloses a kind of coding methods based on adaptive quantizing parameter, including:
Obtain the quantization parameter of coding unit to be encoded;
According to preset quality threshold, preset coding unit size, the quantization parameter, to coding unit to be encoded
It is encoded, obtains the coding result of coding unit to be encoded, the coding result includes multiple mass figures;
Compare the mass figures and the quality threshold, when there are a mass figures to be unsatisfactory for preset first mass
When decision condition, quantization parameter is reduced, and according to the quantization parameter after the quality threshold, the coding unit size, reduction,
Coding is re-started to coding unit to be encoded, until coding result meets the preset first quality judging condition;
When all mass figures meet preset first quality judging condition, and there are a mass figures to be unsatisfactory for presetting
The second quality judging condition when, increase quantization parameter, and according to the quality threshold, the coding unit size, increase after
Quantization parameter, coding is re-started to coding unit to be encoded, until coding result meets the first quality judging item
Part, the second quality judging condition.
Optionally, described that coding unit to be encoded is encoded, including:
Using corresponding, the encoded historical frames image of frame image where coding unit to be encoded, obtain to be encoded
The reference encoder unit of coding unit;
Coding unit to be encoded is obtained, the difference with the pixel of the reference encoder unit carries out the difference
Discrete cosine transform obtains the frequency domain data of difference;
According to the relationship of preset quantization parameter and quantization step, the corresponding quantization step of quantization parameter is obtained, and utilize
The quantization step quantifies the frequency domain data of the difference, the data of the coding unit to be encoded after being quantified;
Entropy coding is carried out to the data of the coding unit to be encoded after the quantization, obtains coding result.
Optionally, described when being unsatisfactory for preset first quality judging condition there are a mass figures, reduce quantization
Parameter, including:
When being unsatisfactory for preset first quality judging condition there are a mass figures, it is pre- that quantization parameter is reduced first
If quantity;
Correspondingly, it is described when all mass figures meet preset first quality judging condition, and there are a mass numbers
When value is unsatisfactory for preset second quality judging condition, increase quantization parameter, including:
When all mass figures meet preset first quality judging condition, and there are a mass figures to be unsatisfactory for presetting
The second quality judging condition when, by quantization parameter increase the first preset quantity.
Optionally, described that quantization parameter is reduced by the first preset quantity, later, the method further includes:
First counter, which counts, adds one, and the number counted in first counter is more than preset first count value
When, it sends and reminds instruction, wherein the prompting instruction carries counts corresponding coding knot for the last time in the first counter
Fruit.
Optionally, described that quantization parameter is increased by the first preset quantity, later, the method further includes:
Second counter, which counts, adds one, and the number counted in second counter is more than preset second count value
When, it sends and reminds instruction, wherein the prompting instruction carries counts corresponding coding knot for the last time in the second counter
Fruit.
Optionally, described up to coding result meets the preset first quality judging condition, described preset second
Quality judging condition, later, the method further includes:
Preserve the coding result of the coding unit to be encoded.
Optionally, the preset quality threshold is:
The upper limit threshold of the pixel mean square deviation MSD of the NxN blocks of preset reconstruction image and original image, wherein the N is
Preset natural number;
Correspondingly, the mass figures, are:
The divided multiple corresponding MSD of NxN blocks of coding unit to be encoded;
Correspondingly, the first quality judging condition is, MSD is less than the upper limit threshold of MSD, the second quality judging item
Part is the upper limit threshold of MSD and the difference of MSD, is less than the first preset difference value.
Optionally, the preset quality threshold is:
The lower threshold of Y-PSNR PSNR;
Correspondingly, the mass figures, are:
The PSNR;
Correspondingly, the first quality judging condition is, PSNR is more than the lower threshold of PSNR, second quality judging
Condition is the difference of the lower threshold of PSNR and PSNR, is less than the second preset difference value.
The embodiment of the invention also discloses a kind of code devices based on adaptive quantizing parameter, including:
Acquisition module, the quantization parameter for obtaining coding unit to be encoded;
Coding module, for according to preset quality threshold, preset coding unit size, the quantization parameter, treating
The coding unit of coding is encoded, and the coding result of coding unit to be encoded is obtained, and the coding result includes multiple matter
Numerical quantity;
First determination module, for the mass figures and the quality threshold, when there are a mass figures not
When meeting preset first quality judging condition, quantization parameter is reduced, and according to the quality threshold, the coding unit ruler
It is very little, reduce after quantization parameter, coding is re-started to coding unit to be encoded, up to coding result meet it is described preset
First quality judging condition;
Second determination module meets preset first quality judging condition for working as all mass figures, and there are one
When mass figures are unsatisfactory for preset second quality judging condition, increase quantization parameter, and according to the quality threshold, the volume
Quantization parameter after code unit size, increase, coding is re-started to coding unit to be encoded, until coding result meets institute
State the first quality judging condition, the second quality judging condition.
Optionally, the coding module, including:
Submodule is predicted, for utilizing corresponding, the encoded historical frames figure of frame image where coding unit to be encoded
Picture obtains the reference encoder unit of coding unit to be encoded;
Transformation submodule, for obtaining coding unit to be encoded, the difference with the pixel of the reference encoder unit,
The difference is subjected to discrete cosine transform, obtains the frequency domain data of difference;
Quantify submodule, for the relationship according to preset quantization parameter and quantization step, it is corresponding to obtain quantization parameter
Quantization step, and the frequency domain data of the difference is quantified using the quantization step, it is to be encoded after being quantified
The data of coding unit;
Entropy coding submodule carries out entropy coding for the data to the coding unit to be encoded after the quantization, obtains
Coding result.
Optionally, first determination module, is specifically used for:
When being unsatisfactory for preset first quality judging condition there are a mass figures, it is pre- that quantization parameter is reduced first
If quantity;
Correspondingly, second determination module, is specifically used for:
When all mass figures meet preset first quality judging condition, and there are a mass figures to be unsatisfactory for presetting
The second quality judging condition when, by quantization parameter increase the first preset quantity.
Optionally, first determination module, is additionally operable to:
First counter, which counts, adds one, and the number counted in first counter is more than preset first count value
When, it sends and reminds instruction, wherein the prompting instruction carries counts corresponding coding knot for the last time in the first counter
Fruit.
Optionally, second determination module, is additionally operable to:
Second counter, which counts, adds one, and the number counted in second counter is more than preset second count value
When, it sends and reminds instruction, wherein the prompting instruction carries counts corresponding coding knot for the last time in the second counter
Fruit.
Optionally, described device further includes:
Preserving module, for until coding result meets the preset first quality judging condition, described preset the
After two quality judging conditions, the coding result of the coding unit to be encoded is preserved.
Optionally, the preset quality threshold is:
The upper limit threshold of the pixel mean square deviation MSD of the NxN blocks of preset reconstruction image and original image, wherein the N is
Preset natural number;
Correspondingly, the mass figures, are:
The divided multiple corresponding MSD of NxN blocks of coding unit to be encoded;
Correspondingly, the first quality judging condition is, MSD is less than the upper limit threshold of MSD, the second quality judging item
Part is the upper limit threshold of MSD and the difference of MSD, is less than the first preset difference value.
Optionally, the preset quality threshold is:
The lower threshold of Y-PSNR PSNR;
Correspondingly, the mass figures, are:
The PSNR;
Correspondingly, the first quality judging condition is, PSNR is more than the lower threshold of PSNR, second quality judging
Condition is the difference of the lower threshold of PSNR and PSNR, is less than the second preset difference value.
Coding method and device provided in an embodiment of the present invention based on adaptive quantizing parameter, are added in an encoding process
Preset quality threshold, after the coding result for obtaining coding unit to be encoded, multiple mass numbers in the coding result
Value and preset quality threshold reduce quantization when being unsatisfactory for preset first quality judging condition there are a mass figures
Parameter, and according to the quantization parameter after the quality threshold, the coding unit size, reduction, to coding unit to be encoded
Coding is re-started, until coding result meets the preset first quality judging condition.When all mass figures meet in advance
If the first quality judging condition, and when being unsatisfactory for preset second quality judging condition there are a mass figures, incrementss
Change parameter, and according to the quantization parameter after the quality threshold, the coding unit size, increase, to coding list to be encoded
Member re-starts coding, until coding result meets the first quality judging condition, the second quality judging condition.
In cataloged procedure compared with the prior art, the quantization parameter of coding unit to be encoded is fixed value, the present invention
Embodiment can adaptively be changed to be encoded according to quality threshold, the first quality judging condition and the second quality judging condition
The quantization parameter of coding unit reduces the distortion of unit to be encoded, obtains the first quality judging condition and the second quality judging item
Under part limitation, ensure coding quality and the higher coding result of compression efficiency, using the embodiment of the present invention to each to be encoded
Coding unit encoded, the coding unit to be encoded for occurring being distorted is recompiled in time, can be avoided to complete
After the completion of portion's coding unit coding to be encoded, due to being distorted the case where larger whole recompiles.Therefore, the present invention is implemented
Example can effectively improve the compression efficiency of coding under the premise of meeting specific application scene, disclosure satisfy that specific application scene pair
The demand of coding quality.
Certainly, it implements any of the products of the present invention or method must be not necessarily required to reach all the above excellent simultaneously
Point.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
Obtain other attached drawings according to these attached drawings.
Fig. 1 is a kind of flow chart of the coding method based on adaptive quantizing parameter of the embodiment of the present invention;
Fig. 2 is another flow chart of the coding method based on adaptive quantizing parameter of the embodiment of the present invention;
Fig. 3 is the flow chart of the example based on method shown in Fig. 2;
Fig. 4 is the flow chart of another example based on method shown in Fig. 2;
Fig. 5 is a kind of structure chart of the code device based on adaptive quantizing parameter of the embodiment of the present invention;
Fig. 6 is another structure chart of the code device based on adaptive quantizing parameter of the embodiment of the present invention.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a kind of coding method based on adaptive quantizing parameter and devices, can adaptively more
The quantization parameter for changing coding unit to be encoded reduces the distortion of coding unit to be encoded, disclosure satisfy that specific application scene
Demand to coding quality.
A kind of coding method based on adaptive quantizing parameter provided in an embodiment of the present invention is introduced first below.
The data volume of uncompressed video image is huge, causes storage difficult, as a DVD can only store several seconds
Uncompressed video image;Or causing transmission difficult, such as 1,000,000 one second digital TV video frequency of bandwidth for transmission needs about 4 minutes
Deng.Therefore it needs to compress video image to reduce memory space and improve transmission rate.And because being deposited in video image
In redundancy, as having between image adjacent pixel between the adjacent image of the spatial redundancy of stronger correlation, video sequence
The similar time redundancy of content, the different coding redundancy of probability that different pixel values occur, people vision system to certain details
Insensitive visual redundancy etc. so that video image can be compressed.An important indicator for evaluating compression effectiveness is compression
Efficiency, compression efficiency is higher, and expression compression effectiveness is better.Video image is encoded, the video image after being encoded regards
Frequency cataloged procedure, that is, to process that video image is compressed.But it is likely to occur video in Video coding compression process
The loss of image, loss are presented as the distortion of video image, and distortion is bigger, encodes compressed video image and original video image
Difference it is bigger, in fact it could happen that pixel missing, clarity be deteriorated etc., lead to the of poor quality of Video coding.
One frame of video image to be compressed is divided into multiple coding units by existing method for video coding, and each coding is single
Member is to include the blocks of multiple pixels, and cataloged procedure is encoded one by one to each coding unit, obtain overall compression efficiency compared with
High coding result, existing cataloged procedure may result in code segment unit to meet the requirement of overall compression performance
QP values it is improper, and then cause the distortion of some coding units excessive, to influence the quality of video image binary encoding, because
This cannot be satisfied demand of the specific application scene to coding quality, such as the application scenarios demand of limitation coding loss.
The quality threshold of limitation coding quality is added in coding unit cataloged procedure to be encoded in the embodiment of the present invention,
After the completion of coding, compare quality threshold and the mass figures in coding result, the first quality judging condition is unsatisfactory for existing
In the case of, or meet the first quality judging condition but exist be unsatisfactory for the second quality judging condition in the case of, to quantization
Parameter carries out corresponding adjustment, and re-starts coding using the quantization parameter after adjustment, until coding result meets the first matter
Measure decision condition and the second quality judging condition.The fixation value of the quantization parameter of coding unit compared to the prior art, this
Inventive embodiments can adaptively adjust quantization parameter according to coding result, and carry out according to the limitation of quality judging condition
It recompiles, therefore the distortion of unit to be encoded can be reduced, obtain the first quality judging condition and the second quality judging condition
Under limitation, ensure coding quality and the higher coding result of compression efficiency.
Referring to Fig. 1, Fig. 1 is a kind of flow chart of the coding method based on adaptive quantizing parameter of the embodiment of the present invention,
Include the following steps:
Step 101, the quantization parameter of coding unit to be encoded is obtained.
The embodiment of the present invention is executed by processor.Processor can be encoder, the computer with encoding function, or set
Set software etc. in a computer.
Coding unit is the base unit of Video coding, can be the block of pixels of different sizes.Such as 32 × 32 picture
Plain block etc..
Quantization parameter is that the parameter of quantization encoding, is expressed as QP in Video coding.
In Video coding, quantization encoding is a committed step, and the parameter of quantization encoding actual use is QStep
(Quantization Step, quantization step), quantization parameter QP is mainly used for, and the correspondence according to QP and QStep is
QStep provides index, and QP can be considered as the serial number of QStep, and each QP corresponds to a QStep.Such as solution is H.264 compiled in coding standard
In code device, for luminance coding, QP values 0~51 are corresponding, and Qstep shares 52 values.Different coding standards has respectively
Self-corresponding QP and Qstep relationships.
It when QP is minimized 0, indicates that quantization is most fine, on the contrary, when QP is maximized 51, indicates that quantization is most coarse.QP
Influence of the size of value to the quality and compression efficiency of Video coding is embodied in, and QP is bigger, the mistake of coded image and original image
Very bigger, the quality of Video coding is poorer;QP is smaller, and the encoder bit rate of coded image is bigger, causes the occupancy of coded image empty
Between it is bigger, compression efficiency is lower.Therefore, it in actual video cataloged procedure, needs to obtain under coding quality and compression efficiency balance
Suitable QP then obtains the corresponding QStep of QP to complete quantization cataloged procedure.
Step 102, according to preset quality threshold, preset coding unit size, quantization parameter, to coding to be encoded
Unit is encoded, and the coding result of coding unit to be encoded is obtained, and coding result includes multiple mass figures.
The process of Video coding is actually the process compressed to original image.The compression of video image can be divided
To be compressed with the lossless video of the image indifference after decompression before compression, being discrepant with the image after decompression before compression
Video compress is damaged, damaging video compress keeps encoding and decoding image different, needs a kind of means come before and after evaluating coding, or decoding
The quality of front and back image.Quality evaluation has evaluating objective quality, subjective quality assessment etc..The method of common evaluating objective quality
Have SAD (Sum of Absolute Difference, absolute error and), SSD (Sum of Squared Difference, it is poor
The quadratic sum of value), MAD (Mean Absolute, average absolute value difference), MSD (Mean Squared Difference, rebuild
The pixel mean square deviation of the NxN blocks of image and original image), SNR (Signal Noise Rate, signal-to-noise ratio), PSNR (Peak
Signal to noise ratio, Y-PSNR) etc..The method of quality evaluation can be with the model form body of quality evaluation
It is existing, such as MSD models, PSNR models.
In the embodiment of the present invention, quality threshold is preset, weighs the threshold value of video encoding quality, can be various video
Threshold value in coding quality evaluation method includes the lower threshold MINPSNR of upper limit threshold MAXMSD, PSNR etc. of MSD.
Coding unit size is the size of coding unit, can be sizes, such as 4 × 4,8 × 8,16 × 16,32 × 32
Deng.It should be noted that the selection of coding unit size can influence coding result, if coding unit size is smaller, allow to encode
The difference of image and original image is smaller, and the precision of coding is higher, but time complexity can be caused excessively high.Therefore in actual coding
In the process, it needs to select suitable coding unit size according to the scene demand of Video coding.
Coding unit to be encoded is encoded, existing various video coding method, such as coding standard may be used
H264/AVC, coding standard HEVC etc..Specific cataloged procedure is the prior art, and this will not be repeated here.
Coding result includes the image and multiple mass figures after encoding, wherein mass figures are corresponding with quality threshold
's.
Step 103, compare mass figures and quality threshold, when there are a mass figures to be unsatisfactory for preset first mass
When decision condition, quantization parameter is reduced, and according to the quantization parameter after quality threshold, coding unit size, reduction, to be encoded
Coding unit re-start coding, until coding result meets preset first quality judging condition.
First quality judging condition is the decision condition of the relationship of preset mass figures and quality threshold.Including quality
Numerical value is less than quality threshold or mass figures are more than quality threshold etc..
The embodiment of the present invention is different from the prior art, and the quantization parameter of coding unit to be encoded immobilizes, but
By comparing the mass figures in quality threshold and coding result, if in the presence of the first quality judging condition, decrement is unsatisfactory for
Change parameter, and uses the quantization parameter after reducing and quality threshold, coding unit size again to coding unit weight to be encoded
Newly encoded.The coding quality of Video coding can be improved by reducing quantization parameter.
Step 104, when all mass figures meet preset first quality judging condition, and there are a mass figures not
When meeting preset second quality judging condition, increase quantization parameter, and according to quality threshold, coding unit size, increase after
Quantization parameter, coding is re-started to coding unit to be encoded, until coding result meets the first quality judging condition, the
Two quality judging conditions.
Second quality judging condition is the decision condition of the relationship of preset mass figures and quality threshold.Including quality
Numerical value is more than the degree etc. of quality threshold less than the degree or mass figures of quality threshold.
The first quality judging condition is not used only in the embodiment of the present invention, also under the conditions of meeting the first quality judging, continues
Compare quality threshold and the mass figures in coding result, if meet the second quality judging condition, if in the presence of being unsatisfactory for second
The case where quality judging condition, then increase quantization parameter, with realize ensure coding result meet quality threshold restriction basis
On, by increasing QP, the appropriate encoder bit rate for reducing current coded unit improves the purpose of compression efficiency.And after using increase
Quantization parameter and quality threshold, coding unit size, coding is re-started to coding unit to be encoded again.The present invention is real
Two quality judging conditions of example are applied, adaptive adjusting quantization parameter can reduce the distortion of coding unit to be encoded
Meanwhile improving the compression efficiency of coding.
Coding method provided in an embodiment of the present invention based on adaptive quantizing parameter, is added preset in an encoding process
Quality threshold, after the coding result for obtaining coding unit to be encoded, compare in coding result multiple mass figures with it is preset
Quality threshold, when being unsatisfactory for preset first quality judging condition there are a mass figures, reduction quantization parameter, and according to
Quantization parameter after quality threshold, coding unit size, reduction re-starts coding to coding unit to be encoded, until compiling
Code result meets preset first quality judging condition.When all mass figures meet preset first quality judging condition, and
When being unsatisfactory for preset second quality judging condition there are a mass figures, increase quantization parameter, and according to quality threshold, volume
Code unit size, the quantization parameter after increase, coding is re-started to coding unit to be encoded, until coding result satisfaction the
One quality judging condition, the second quality judging condition.
In cataloged procedure compared with the prior art, the quantization parameter of coding unit to be encoded is fixed value, the present invention
Embodiment can adaptively be changed to be encoded according to quality threshold, the first quality judging condition and the second quality judging condition
The quantization parameter of coding unit reduces the distortion of unit to be encoded, obtains the first quality judging condition and the second quality judging item
Under part limitation, ensure coding quality and the higher coding result of compression efficiency, using the embodiment of the present invention to each to be encoded
Coding unit encoded, the coding unit to be encoded for being unsatisfactory for quality judging condition to there is distortion in time carries out again
Coding can avoid after the completion of being encoded to coding unit all to be encoded, due to being distorted the larger feelings all recompiled
Condition.Therefore, the embodiment of the present invention can improve code efficiency and the compression ratio of coding, disclosure satisfy that specific application scene to coding
The demand of quality.
On the basis of Fig. 1, as preferred embodiment, referring to Fig. 2, Fig. 2 is the embodiment of the present invention based on adaptive quantity
Another flow chart for changing the coding method of parameter, includes the following steps:
Step 201, the quantization parameter of coding unit to be encoded is obtained.
In the embodiment of the present invention, quantization parameter can be default value, or pass through other quantization parameter determination methods
Obtained numerical value, such as every frame are that each frame determines using the setting method for fixing QP, or according to preset bit rate control method
The methods of initial Q P, and then determine each unit QP to be encoded.Therefore the embodiment of the present invention can be used alone, can also be with it
His quantization parameter determines that method is connected, and carries out encoding video pictures.
Step 202, according to preset quality threshold, preset coding unit size, quantization parameter, to coding to be encoded
Unit is encoded, and the coding result of coding unit to be encoded is obtained, and coding result includes multiple mass figures.
Quality threshold in the embodiment of the present invention is introduced in a manner of the subjective model of quality, wherein subjective model
It needs to be reasonably selected according to the application scenarios and use demand of video image.
Traditional coding method is commonly referred to as hybrid coding method, mainly includes the following steps that:
The first step, predictive coding utilize corresponding, the encoded historical frames figure of frame image where coding unit to be encoded
Picture obtains the reference encoder unit of coding unit to be encoded.
By existing video image knowledge it is found that video image is divided into multiframe, a frame video image can be divided into more
A coding unit carries out Video coding, and such as current video image to be encoded is the 5th frame, then can utilize the encoded of preceding 4 frame
The video image of completion obtains the reference picture of the video image of the 5th frame, includes in the reference picture of the video image of the 5th frame
Multiple reference encoder units, wherein the corresponding reference encoder unit of coding unit to be encoded in the 5th frame may be preceding 4 frame
Coding unit in video image any frame.
Second step, transition coding obtain coding unit to be encoded, the difference with the pixel of reference encoder unit, will
Difference carries out discrete cosine transform, obtains the frequency domain data of difference.
Coding unit to be encoded is commonly referred to as residual error, transition coding with the difference of the pixel of reference encoder unit
Residual error is converted to remove frequency domain correlation, image is converted into frequency-region signal by transition coding from time-domain signal, and will
Tremendously low frequency region in quantity set.
Third walks, quantization encoding, and according to the relationship of preset quantization parameter and quantization step, it is corresponding to obtain quantization parameter
Quantization step, and the frequency domain data of difference is quantified using quantization step, the coding unit to be encoded after being quantified
Data.
Quantization is reduction image code length under the premise of not reducing visual effect, is reduced unnecessary in recovery of vision
Information, quantization encoding quantify the data after transformation, can reduce the dynamic range of image coding, by with more coarse
Data indicate fine data to reduce the data volume of coding, can remove the visual redundancy in video sequence to a certain extent.Amount
Change is generally divided into scalar quantization and vector quantization, and common coding criterion carries out scalar as H.265 using a kind of scale quantizer
Quantization, the quantization to converting residual error coefficient have used the quantizer of 52 grades of step-lengths, quantization step to be incremented by with 12.5%, have used quantization
Parameter is indexed quantization step, and quantization parameter often increases by 6, and quantization step is increased by one times, and corresponding coding quality also can
There is certain decline.
4th step, entropy coding carry out entropy coding to the data of the coding unit to be encoded after quantization, obtain coding knot
Fruit.Entropy coding is encoded to the data after quantization, to remove coding redundancy.Wherein, coding result includes the figure after coding
Picture, multiple mass figures corresponding with quality threshold.
Step 203, compare mass figures and quality threshold, when there are a mass figures to be unsatisfactory for preset first mass
When decision condition, quantization parameter is reduced by the first preset quantity, and according to the amount after quality threshold, coding unit size, reduction
Change parameter, coding is re-started to coding unit to be encoded, until coding result meets preset first quality judging condition.
After obtaining coding result, the embodiment of the present invention is according to the relationship of coding result and subjective model, to quantization parameter
It is adjusted, specifically, when being unsatisfactory for preset first quality judging condition there are a mass figures, quantization parameter is subtracted
Few first preset quantity.And recompiled according to the QP after adjustment, until coding result meets preset first quality judging item
Part.Wherein, the first preset quantity is the numerical value according to industrial requirement or being manually arranged, such as 1,2.
The embodiment of the present invention considers the limitation of subjective model in an encoding process, encoding target occurs after avoiding end-of-encode
The case where being unsatisfactory for subjective model.But in view of in one and same coding frame, QP has big difference and can lead to boundary effect.Therefore this hair
According to practical application scene, the number recompiled to coding unit to be encoded limits bright embodiment.Namely in step
After rapid 203, the embodiment of the invention also includes the first counter, which counts, adds one, and the number counted in the first counter is more than
It when preset first count value, sends and reminds instruction, wherein remind instruction to carry and counted for the last time in the first counter
Corresponding coding result.Wherein the first count value is the preset limits value for recompiling number, such as 3.The present invention is implemented
The first different count values can be arranged according to actual scene demand in example.
The method of the embodiment of the present invention further includes decision being carried out to reminding to instruct, specifically, receiving in the first counter most
Once count corresponding coding result afterwards, or stop this coding etc..
Step 204, when all mass figures meet preset first quality judging condition, and there are a mass figures not
When meeting preset second quality judging condition, quantization parameter is increased by the first preset quantity, and single according to quality threshold, coding
Quantization parameter after elemental size, increase re-starts coding to coding unit to be encoded, until coding result meets the first matter
Measure decision condition, the second quality judging condition.
Ibid, the embodiment of the present invention is according to practical application scene, the coding recompiled to coding unit to be encoded
Number is limited.Namely after step 204, the embodiment of the invention also includes the second counter, which counts, adds one, and second
It when the number that counter counts is more than preset second count value, sends and reminds instruction, wherein instruction is reminded to carry second
Corresponding coding result is counted in counter for the last time.Wherein the second count value is the preset limit for recompiling number
Value processed, such as 2.The second different count values can be arranged according to actual scene demand in the embodiment of the present invention.
The method of the embodiment of the present invention further includes decision being carried out to reminding to instruct, specifically, receiving in the second counter most
Once count corresponding coding result afterwards, or stop this coding etc..
Step 205, the coding result of coding unit to be encoded is preserved.
After coding result meets the first quality judging condition, the second quality judging condition, coding list to be encoded is preserved
The coding result of member.Later, the embodiment of the present invention continues the cataloged procedure of next coding unit to be encoded, repeat with
Upper step 201 is to step 205, until completing the coding of all coding units to be encoded of video image to be encoded, obtains
Complete coded sequence, that is, obtain the video image after complete coding.
Coding method provided in an embodiment of the present invention based on adaptive quantizing parameter utilizes subjectivity in an encoding process
Preset quality threshold is added in model, after the coding result for obtaining coding unit to be encoded, compares multiple matter in coding result
Numerical quantity will be measured with preset quality threshold when being unsatisfactory for preset first quality judging condition there are a mass figures
Change parameter and reduce by the first preset quantity, and according to the quantization parameter after quality threshold, coding unit size, reduction, to be encoded
Coding unit re-start coding, until coding result meets preset first quality judging condition.When all mass figures
When meeting preset first quality judging condition, and preset second quality judging condition be unsatisfactory for there are a mass figures,
Quantization parameter is increased by the first preset quantity, and according to the quantization parameter after quality threshold, coding unit size, increase, is treated
The coding unit of coding re-starts coding, until coding result meets the first quality judging condition, the second quality judging condition.
In cataloged procedure compared with the prior art, the quantization parameter of coding unit to be encoded is fixed value, the present invention
Embodiment can adaptively be changed to be encoded according to subjective model, the first quality judging condition and the second quality judging condition
The quantization parameter of coding unit reduces the distortion of unit to be encoded, obtains the first quality judging condition and the second quality judging item
Under part limitation, ensure coding quality and the higher coding result of compression efficiency, using the embodiment of the present invention to each to be encoded
Coding unit encoded, the coding unit to be encoded for being unsatisfactory for quality judging condition to there is distortion in time carries out again
Coding can avoid after the completion of being encoded to coding unit all to be encoded, due to being distorted the larger feelings all recompiled
Condition.The embodiment of the present invention makes the coding of entire coded sequence by the limitation in an encoding process to coding unit coding loss
Loss is kept in a certain range, and then the compression efficiency of coding can be improved under the conditions of meeting subjective model.Therefore, originally
Inventive embodiments can improve code efficiency and the compression efficiency of coding, disclosure satisfy that need of the specific application scene to coding quality
It asks.
It is the flow chart of the example based on method shown in Fig. 2 referring to Fig. 3, Fig. 3, including:
Step 301, the QP of coding unit to be encoded is obtained.
Step 302, according to preset MAXMSD, preset coding unit size and QP, to coding unit to be encoded into
Row coding, obtains the coding result of coding unit to be encoded, coding result includes multiple MSD.
In the embodiment of the present invention, the subjective model used is MSD model, specifically, it is single that subjective model, which selects N × N blocks,
The MSD values of member are weighing criteria, wherein N=4, and set the permitted maximum MSD of coding result MSD as 8, that is, as matter
Measure the upper limit threshold MAXMSD=8 of the MSD of threshold value.Coding unit is sized to 32x32.It should be noted that N is to preset certainly
So number, can be arranged as required to different natural numbers, such as 8,16.
HEVC encoders etc. may be used in the embodiment of the present invention, and cataloged procedure repeats no more.
Step 303, the MSD and MAXMSD of more all N × N blocks, if meeting preset first quality judging condition is
MSD is less than the upper limit threshold of MSD, that is, MSD<MAXMSD.
Coding unit to be encoded contains multiple N × N blocks, and all N × N blocks are each in statistical coding result of the embodiment of the present invention
Self-corresponding MSD, with MAXMSD, if it is MSD to meet preset first quality judging condition<MAXMSD.
If be unsatisfactory for preset first quality judging condition there are a MSD, 304, QP-1 are thened follow the steps, and return
Step 302 is executed, according to the QP after MAXMSD, coding unit size and reduction, volume is re-started to coding unit to be encoded
Code, until coding result meets preset first quality judging condition.
If all MSD meet preset first quality judging condition, 305 are thened follow the steps, judges whether to meet the second matter
It is the upper limit threshold of MSD and the difference of MSD to measure decision condition, is less than the first preset difference value, that is, MAXMSD-MSD≤3.Its
In the first preset difference value value be 3.It should be noted that the first preset difference value can be arranged as required to the number that other are more than 0
Value.
If be unsatisfactory for preset second quality judging condition there are a MSD, 306, QP+1 are thened follow the steps, and return
Step 302 is executed, according to the QP after MAXMSD, coding unit size and increase, volume is re-started to coding unit to be encoded
Code, until coding result meets the first quality judging condition, the second quality judging condition.
It should be noted that in the embodiment of the present invention, QP increases or the number of reduction nevertheless suffers from limitation, what QP was reduced
Number is no more than the first count value, and the increased numbers of QP are no more than the second count value.In the embodiment of the present invention, first counts
The preferred value of numerical value is 3, and the preferred value of the second count value is 2.
If all MSD meet preset first quality judging condition, the second quality judging condition, 307 are thened follow the steps, is protected
Deposit the coding result of coding unit to be encoded.
Subjective mould is added in coding method provided in an embodiment of the present invention based on adaptive quantizing parameter in an encoding process
Type MSD after the coding result for obtaining coding unit to be encoded, compares multiple MSD and MAXMSD in coding result, when there are one
It is MSD that a MSD, which is unsatisfactory for preset first quality judging condition,<When MAXMSD, by QP-1, and according to MAXMSD, coding unit
QP after size, reduction re-starts coding to coding unit to be encoded, until coding result meets preset first mass
Decision condition.When all MSD meet preset first quality judging condition, and there are a MSD to be unsatisfactory for preset second matter
When amount decision condition is MAXMSD-MSD≤3, by QP+1, and according to the QP after MAXMSD, coding unit size, increase, treat
The coding unit of coding re-starts coding, until coding result meets the first quality judging condition, the second quality judging condition.
In cataloged procedure compared with the prior art, the quantization parameter of coding unit to be encoded is fixed value, the present invention
Embodiment can adaptively be changed to be encoded according to subjective model MSD, the first quality judging condition and the second quality judging condition
Coding unit quantization parameter, reduce the distortion of unit to be encoded, obtain the first quality judging condition and the second quality judging
Under condition limitation, ensures coding quality and the higher coding result of compression efficiency, wait compiling to each using the embodiment of the present invention
The coding unit of code is encoded, and the coding unit to be encoded for being unsatisfactory for quality judging condition to there is distortion in time carries out weight
It is newly encoded, it can avoid to after the completion of coding unit coding all to be encoded, all being recompiled since distortion is larger
Situation.The embodiment of the present invention makes the volume of entire coded sequence by the limitation in an encoding process to coding unit coding loss
Code loss is kept in a certain range, and then the compression efficiency of coding can be improved under the conditions of meeting subjective model MSD.Cause
This, the embodiment of the present invention can improve code efficiency and the compression efficiency of coding, disclosure satisfy that specific application scene to encoding matter
The demand of amount.
Referring to Fig. 4, Fig. 4 is the flow chart of another example based on method shown in Fig. 2, including:
Step 401, the QP of coding unit to be encoded is obtained.
Step 402, according to preset MINPSNR, preset coding unit size and QP, to coding unit to be encoded into
Row coding, obtains the coding result of coding unit to be encoded, and coding result includes a PSNR.
In the embodiment of the present invention, the subjective model used sets the permitted minimums of coding result PSNR for PSNR models
PSNR is 39, that is, the PSNR as quality threshold lower threshold MINPSNR=39.Coding unit is sized to
32x32。
HEVC encoders etc. may be used in the embodiment of the present invention, and cataloged procedure repeats no more.
Step 303, compare PSNR and MINPSNR, if meet preset first quality judging condition and be more than for PSNR
The lower threshold of PSNR, that is, PSNR>MINPSNR.
If be unsatisfactory for preset first quality judging condition there are PSNR, 404, QP-1 are thened follow the steps, and return and hold
Row step 402 re-starts volume according to the QP after MINPSNR, coding unit size and reduction to coding unit to be encoded
Code, until coding result meets preset first quality judging condition.
If PSNR meets preset first quality judging condition, 405 are thened follow the steps, judges whether that meeting the second mass sentences
Fixed condition is the difference of the lower threshold of PSNR and PSNR, is less than the second preset difference value, that is, PSNR-MINPSNR≤2.Its
In the second preset difference value value be 2.It should be noted that the second preset difference value can be arranged as required to the number that other are more than 0
Value.
If be unsatisfactory for preset second quality judging condition there are PSNR, 406, QP+1 are thened follow the steps, and return and hold
Row step 402 re-starts volume according to the QP after MINPSNR, coding unit size and increase to coding unit to be encoded
Code, until coding result meets the first quality judging condition, the second quality judging condition.
It should be noted that in the embodiment of the present invention, QP increases or the number of reduction nevertheless suffers from limitation, what QP was reduced
Number is no more than the first count value, and the increased numbers of QP are no more than the second count value.In the embodiment of the present invention, first counts
The preferred value of numerical value is 3, and the preferred value of the second count value is 2.
If PSNR meets preset first quality judging condition, the second quality judging condition, 407 are thened follow the steps, is preserved
The coding result of coding unit to be encoded.
Subjective mould is added in coding method provided in an embodiment of the present invention based on adaptive quantizing parameter in an encoding process
Type PSNR after the coding result for obtaining coding unit to be encoded, compares PSNR and MINPSNR in coding result, works as presence
It is PSNR that PSNR, which is unsatisfactory for preset first quality judging condition,>When MINPSNR, by QP-1, and it is single according to MINPSNR, coding
QP after elemental size, reduction re-starts coding to coding unit to be encoded, until coding result meets preset first matter
Measure decision condition.When PSNR meets preset first quality judging condition, and it is unsatisfactory for preset second mass there are PSNR and sentences
When fixed condition is PSNR-MINPSNR≤2, by QP+1, and according to the QP after MINPSNR, coding unit size, increase, volume is treated
The coding unit of code re-starts coding, until coding result meets the first quality judging condition, the second quality judging condition.
In cataloged procedure compared with the prior art, the quantization parameter of coding unit to be encoded is fixed value, the present invention
Embodiment can adaptively be changed according to subjective model PSNR, the first quality judging condition and the second quality judging condition and wait compiling
The quantization parameter of the coding unit of code reduces the distortion of unit to be encoded, obtains the first quality judging condition and the second mass is sentenced
Under fixed condition limitation, ensures coding quality and the higher coding result of compression efficiency, waited for each using the embodiment of the present invention
The coding unit of coding is encoded, and the coding unit to be encoded for being unsatisfactory for quality judging condition to there is distortion in time carries out
It recompiles, can avoid to after the completion of coding unit coding all to be encoded, being recompiled due to being distorted larger whole
The case where.The embodiment of the present invention makes entire coded sequence by the limitation in an encoding process to coding unit coding loss
Coding loss is kept in a certain range, and then the compression effect of coding can be improved under the conditions of meeting subjective model PSNR
Rate.Therefore, the embodiment of the present invention can improve code efficiency and the compression efficiency of coding, disclosure satisfy that specific application scene to compiling
The demand of code quality.
Referring to Fig. 5, Fig. 5 is a kind of structure chart of the code device based on adaptive quantizing parameter of the embodiment of the present invention,
Including:
Acquisition module 501, the quantization parameter for obtaining coding unit to be encoded.
Coding module 502, for according to preset quality threshold, preset coding unit size, quantization parameter, treating volume
The coding unit of code is encoded, and obtains the coding result of coding unit to be encoded, coding result includes multiple mass figures.
First determination module 503, for comparing mass figures and quality threshold, when there are a mass figures be unsatisfactory for it is pre-
If the first quality judging condition when, quantization parameter is reduced, and according to the quantization after quality threshold, coding unit size, reduction
Parameter re-starts coding to coding unit to be encoded, until coding result meets preset first quality judging condition.
Second determination module 504 meets preset first quality judging condition for working as all mass figures, and there are one
When a mass figures are unsatisfactory for preset second quality judging condition, increase quantization parameter, and according to quality threshold, coding unit
Quantization parameter after size, increase re-starts coding to coding unit to be encoded, until coding result meets the first mass
Decision condition, the second quality judging condition.
Code device provided in an embodiment of the present invention based on adaptive quantizing parameter, is added preset in an encoding process
Quality threshold, after the coding result for obtaining coding unit to be encoded, compare in coding result multiple mass figures with it is preset
Quality threshold, when being unsatisfactory for preset first quality judging condition there are a mass figures, reduction quantization parameter, and according to
Quantization parameter after quality threshold, coding unit size, reduction re-starts coding to coding unit to be encoded, until compiling
Code result meets preset first quality judging condition.When all mass figures meet preset first quality judging condition, and
When being unsatisfactory for preset second quality judging condition there are a mass figures, increase quantization parameter, and according to quality threshold, volume
Code unit size, the quantization parameter after increase, coding is re-started to coding unit to be encoded, until coding result satisfaction the
One quality judging condition, the second quality judging condition.
In cataloged procedure compared with the prior art, the quantization parameter of coding unit to be encoded is fixed value, the present invention
Embodiment can adaptively be changed to be encoded according to quality threshold, the first quality judging condition and the second quality judging condition
The quantization parameter of coding unit reduces the distortion of unit to be encoded, obtains the first quality judging condition and the second quality judging item
Under part limitation, ensure coding quality and the higher coding result of compression efficiency, using the embodiment of the present invention to each to be encoded
Coding unit encoded, the coding unit to be encoded for being unsatisfactory for quality judging condition to there is distortion in time carries out again
Coding can avoid after the completion of being encoded to coding unit all to be encoded, due to being distorted the larger feelings all recompiled
Condition.Therefore, the embodiment of the present invention can improve code efficiency and the compression ratio of coding, disclosure satisfy that specific application scene to coding
The demand of quality.It should be noted that the device of the embodiment of the present invention is to apply the above-mentioned coding based on adaptive quantizing parameter
The device of method, then all embodiments of coding method of the above application based on adaptive quantizing parameter be suitable for the device,
And it can reach same or analogous advantageous effect.
Referring to Fig. 6, Fig. 6 is another structure of the code device based on adaptive quantizing parameter of the embodiment of the present invention
Figure, including:
In the embodiment of the present invention, coding module 602, including:
Submodule 6021 is predicted, for utilizing corresponding, the encoded history of frame image where coding unit to be encoded
Frame image obtains the reference encoder unit of coding unit to be encoded.
Transformation submodule 6022, for obtaining coding unit to be encoded, the difference with the pixel of reference encoder unit,
Difference is subjected to discrete cosine transform, obtains the frequency domain data of difference.
Quantify submodule 6023, for the relationship according to preset quantization parameter and quantization step, obtains quantization parameter pair
The quantization step answered, and the frequency domain data of difference is quantified using quantization step, the coding to be encoded after being quantified
The data of unit.
Entropy coding submodule 6024 carries out entropy coding for the data to the coding unit to be encoded after quantization, obtains
Coding result.
In the embodiment of the present invention, the first determination module 603 is specifically used for:
When being unsatisfactory for preset first quality judging condition there are a mass figures, it is pre- that quantization parameter is reduced first
If quantity.
Correspondingly, the second determination module 604, is specifically used for:
When all mass figures meet preset first quality judging condition, and there are a mass figures to be unsatisfactory for presetting
The second quality judging condition when, by quantization parameter increase the first preset quantity.
In the embodiment of the present invention, the first determination module 603 is additionally operable to:
First counter, which counts, adds one, and when the number that the first counter counts is more than preset first count value,
It sends and reminds instruction, wherein remind instruction to carry and count corresponding coding result in the first counter for the last time.
In the embodiment of the present invention, the second determination module 604 is additionally operable to:
Second counter, which counts, adds one, and when the number that the second counter counts is more than preset second count value,
It sends and reminds instruction, wherein remind instruction to carry and count corresponding coding result in the second counter for the last time.
In the embodiment of the present invention, device further includes:
Preserving module 605, for until coding result meets preset first quality judging condition, preset second mass
After decision condition, the coding result of coding unit to be encoded is preserved.
In the embodiment of the present invention, preset quality threshold is:The picture of the NxN blocks of preset reconstruction image and original image
The upper limit threshold of plain mean square deviation MSD, wherein N is preset natural number.
Correspondingly, mass figures, are:The divided multiple corresponding MSD of NxN blocks of coding unit to be encoded.
Correspondingly, the first quality judging condition is, MSD is less than the upper limit threshold of MSD, and the second quality judging condition is MSD
Upper limit threshold and MSD difference, be less than the first preset difference value.
In the embodiment of the present invention, preset quality threshold is:The lower threshold of Y-PSNR PSNR.
Correspondingly, mass figures, are:PSNR.
Correspondingly, the first quality judging condition is, PSNR is more than the lower threshold of PSNR, and the second quality judging condition is,
The difference of the lower threshold of PSNR and PSNR is less than the second preset difference value.
Code device provided in an embodiment of the present invention based on adaptive quantizing parameter, is added preset in an encoding process
Quality threshold, after the coding result for obtaining coding unit to be encoded, compare in coding result multiple mass figures with it is preset
Quality threshold, when being unsatisfactory for preset first quality judging condition there are a mass figures, reduction quantization parameter, and according to
Quantization parameter after quality threshold, coding unit size, reduction re-starts coding to coding unit to be encoded, until compiling
Code result meets preset first quality judging condition.When all mass figures meet preset first quality judging condition, and
When being unsatisfactory for preset second quality judging condition there are a mass figures, increase quantization parameter, and according to quality threshold, volume
Code unit size, the quantization parameter after increase, coding is re-started to coding unit to be encoded, until coding result satisfaction the
One quality judging condition, the second quality judging condition.
In cataloged procedure compared with the prior art, the quantization parameter of coding unit to be encoded is fixed value, the present invention
Embodiment can adaptively be changed to be encoded according to quality threshold, the first quality judging condition and the second quality judging condition
The quantization parameter of coding unit reduces the distortion of unit to be encoded, obtains the first quality judging condition and the second quality judging item
Under part limitation, ensure coding quality and the higher coding result of compression efficiency, using the embodiment of the present invention to each to be encoded
Coding unit encoded, the coding unit to be encoded for being unsatisfactory for quality judging condition to there is distortion in time carries out again
Coding can avoid after the completion of being encoded to coding unit all to be encoded, due to being distorted the larger feelings all recompiled
Condition.Therefore, the embodiment of the present invention can improve code efficiency and the compression ratio of coding, disclosure satisfy that specific application scene to coding
The demand of quality.
It should be noted that the device of the embodiment of the present invention is the device using the above method, then above-mentioned all embodiments
It is suitable for the device, and can reaches same or analogous advantageous effect.
It should be noted that herein, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also include other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including element.
Each embodiment in this specification is all made of relevant mode and describes, identical similar portion between each embodiment
Point just to refer each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so description is fairly simple, related place is referring to embodiment of the method
Part explanation.
The above is merely preferred embodiments of the present invention, it is not intended to limit the scope of the present invention.It is all in this hair
Any modification, equivalent replacement, improvement and so within bright spirit and principle, are included within the scope of protection of the present invention.
Claims (16)
1. a kind of coding method based on adaptive quantizing parameter, which is characterized in that including:
Obtain the quantization parameter of coding unit to be encoded;
According to preset quality threshold, preset coding unit size, the quantization parameter, coding unit to be encoded is carried out
Coding, obtains the coding result of coding unit to be encoded, the coding result includes multiple mass figures;
Compare the mass figures and the quality threshold, when there are a mass figures to be unsatisfactory for preset first quality judging
When condition, quantization parameter is reduced, and according to the quantization parameter after the quality threshold, the coding unit size, reduction, treat
The coding unit of coding re-starts coding, until coding result meets the preset first quality judging condition;
When all mass figures meet preset first quality judging condition, and there are a mass figures to be unsatisfactory for preset
When two quality judging conditions, increase quantization parameter, and according to the amount after the quality threshold, the coding unit size, increase
Change parameter, coding is re-started to coding unit to be encoded, until coding result meets the first quality judging condition, institute
State the second quality judging condition.
2. according to the method described in claim 1, it is characterized in that, described encode coding unit to be encoded, including:
Using corresponding, the encoded historical frames image of frame image where coding unit to be encoded, coding to be encoded is obtained
The reference encoder unit of unit;
Coding unit to be encoded is obtained, the difference with the pixel of the reference encoder unit carries out the difference discrete
Cosine transform obtains the frequency domain data of difference;
According to the relationship of preset quantization parameter and quantization step, the corresponding quantization step of quantization parameter is obtained, and described in utilization
Quantization step quantifies the frequency domain data of the difference, the data of the coding unit to be encoded after being quantified;
Entropy coding is carried out to the data of the coding unit to be encoded after the quantization, obtains coding result.
3. according to the method described in claim 1, it is characterized in that, described when there are a mass figures to be unsatisfactory for preset the
When one quality judging condition, quantization parameter is reduced, including:
When being unsatisfactory for preset first quality judging condition there are a mass figures, quantization parameter is reduced by the first present count
Amount;
Correspondingly, described when all mass figures meet preset first quality judging condition, and there are a mass figures not
When meeting preset second quality judging condition, increase quantization parameter, including:
When all mass figures meet preset first quality judging condition, and there are a mass figures to be unsatisfactory for preset
When two quality judging conditions, quantization parameter is increased by the first preset quantity.
4. according to the method described in claim 3, it is characterized in that, it is described by quantization parameter reduce the first preset quantity, later,
The method further includes:
First counter, which counts, adds one, and when the number that first counter counts is more than preset first count value,
It sends and reminds instruction, wherein the prompting instruction carries counts corresponding coding result for the last time in the first counter.
5. according to the method described in claim 3, it is characterized in that, it is described by quantization parameter increase the first preset quantity, later,
The method further includes:
Second counter, which counts, adds one, and when the number that second counter counts is more than preset second count value,
It sends and reminds instruction, wherein the prompting instruction carries counts corresponding coding result for the last time in the second counter.
6. according to the method described in claim 1, it is characterized in that, described until coding result meets preset first matter
Decision condition, the preset second quality judging condition are measured, later, the method further includes:
Preserve the coding result of the coding unit to be encoded.
7. according to the method described in claim 1, it is characterized in that, the preset quality threshold, is:
The upper limit threshold of the pixel mean square deviation MSD of the NxN blocks of preset reconstruction image and original image, wherein the N is default
Natural number;
Correspondingly, the mass figures, are:
The divided multiple corresponding MSD of NxN blocks of coding unit to be encoded;
Correspondingly, the first quality judging condition is, MSD is less than the upper limit threshold of MSD, the second quality judging condition
For the upper limit threshold of MSD and the difference of MSD are less than the first preset difference value.
8. according to the method described in claim 1, it is characterized in that, the preset quality threshold, is:
The lower threshold of Y-PSNR PSNR;
Correspondingly, the mass figures, are:
The PSNR;
Correspondingly, the first quality judging condition is, PSNR is more than the lower threshold of PSNR, the second quality judging condition
For the difference of the lower threshold of PSNR and PSNR is less than the second preset difference value.
9. a kind of code device based on adaptive quantizing parameter, which is characterized in that including:
Acquisition module, the quantization parameter for obtaining coding unit to be encoded;
Coding module is used for according to preset quality threshold, preset coding unit size, the quantization parameter, to be encoded
Coding unit encoded, obtain the coding result of coding unit to be encoded, the coding result includes multiple mass numbers
Value;
First determination module, for the mass figures and the quality threshold, when there are a mass figures to be unsatisfactory for
When preset first quality judging condition, reduce quantization parameter, and according to the quality threshold, the coding unit size, subtract
Quantization parameter after few, coding is re-started to coding unit to be encoded, until coding result meets described preset first
Quality judging condition;
Second determination module meets preset first quality judging condition for working as all mass figures, and there are a quality
When numerical value is unsatisfactory for preset second quality judging condition, increase quantization parameter, and single according to the quality threshold, the coding
Quantization parameter after elemental size, increase re-starts coding to coding unit to be encoded, until coding result meets described the
One quality judging condition, the second quality judging condition.
10. device according to claim 9, which is characterized in that the coding module, including:
Submodule is predicted, for using corresponding, the encoded historical frames image of frame image where coding unit to be encoded, obtaining
Take the reference encoder unit of coding unit to be encoded;
Transformation submodule, for obtaining coding unit to be encoded, the difference with the pixel of the reference encoder unit, by institute
It states difference and carries out discrete cosine transform, obtain the frequency domain data of difference;
Quantify submodule, for the relationship according to preset quantization parameter and quantization step, obtains the corresponding quantization of quantization parameter
Step-length, and the frequency domain data of the difference is quantified using the quantization step, the coding to be encoded after being quantified
The data of unit;
Entropy coding submodule carries out entropy coding for the data to the coding unit to be encoded after the quantization, is encoded
As a result.
11. device according to claim 9, which is characterized in that first determination module is specifically used for:
When being unsatisfactory for preset first quality judging condition there are a mass figures, quantization parameter is reduced by the first present count
Amount;
Correspondingly, second determination module, is specifically used for:
When all mass figures meet preset first quality judging condition, and there are a mass figures to be unsatisfactory for preset
When two quality judging conditions, quantization parameter is increased by the first preset quantity.
12. according to the devices described in claim 11, which is characterized in that first determination module is additionally operable to:
First counter, which counts, adds one, and when the number that first counter counts is more than preset first count value,
It sends and reminds instruction, wherein the prompting instruction carries counts corresponding coding result for the last time in the first counter.
13. according to the devices described in claim 11, which is characterized in that second determination module is additionally operable to:
Second counter, which counts, adds one, and when the number that second counter counts is more than preset second count value,
It sends and reminds instruction, wherein the prompting instruction carries counts corresponding coding result for the last time in the second counter.
14. device according to claim 9, which is characterized in that described device further includes:
Preserving module, for until coding result meets the preset first quality judging condition, preset second matter
After measuring decision condition, the coding result of the coding unit to be encoded is preserved.
15. device according to claim 9, which is characterized in that the preset quality threshold is:
The upper limit threshold of the pixel mean square deviation MSD of the NxN blocks of preset reconstruction image and original image, wherein the N is default
Natural number;
Correspondingly, the mass figures, are:
The divided multiple corresponding MSD of NxN blocks of coding unit to be encoded;
Correspondingly, the first quality judging condition is, MSD is less than the upper limit threshold of MSD, the second quality judging condition
For the upper limit threshold of MSD and the difference of MSD are less than the first preset difference value.
16. device according to claim 9, which is characterized in that the preset quality threshold is:
The lower threshold of Y-PSNR PSNR;
Correspondingly, the mass figures, are:
The PSNR;
Correspondingly, the first quality judging condition is, PSNR is more than the lower threshold of PSNR, the second quality judging condition
For the difference of the lower threshold of PSNR and PSNR is less than the second preset difference value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710130401.2A CN108574841B (en) | 2017-03-07 | 2017-03-07 | Coding method and device based on self-adaptive quantization parameter |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710130401.2A CN108574841B (en) | 2017-03-07 | 2017-03-07 | Coding method and device based on self-adaptive quantization parameter |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108574841A true CN108574841A (en) | 2018-09-25 |
CN108574841B CN108574841B (en) | 2020-10-30 |
Family
ID=63576986
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710130401.2A Active CN108574841B (en) | 2017-03-07 | 2017-03-07 | Coding method and device based on self-adaptive quantization parameter |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108574841B (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109803146A (en) * | 2019-04-04 | 2019-05-24 | 网易(杭州)网络有限公司 | The second-compressed method and apparatus of video |
CN110225340A (en) * | 2019-05-31 | 2019-09-10 | 北京猿力未来科技有限公司 | A kind of control method and device of Video coding calculate equipment and storage medium |
CN110298895A (en) * | 2019-05-08 | 2019-10-01 | 平安科技(深圳)有限公司 | Picture compression method, apparatus, equipment and storage medium based on artificial intelligence |
WO2021136056A1 (en) * | 2019-12-31 | 2021-07-08 | 华为技术有限公司 | Encoding method and encoder |
CN113115040A (en) * | 2021-04-20 | 2021-07-13 | 上海交通大学 | Visual lossless image compression method and device |
CN114697656A (en) * | 2020-12-31 | 2022-07-01 | 浙江宇视科技有限公司 | Encoding method, encoding device, electronic equipment and medium |
CN115665425A (en) * | 2022-11-16 | 2023-01-31 | 北极星云空间技术股份有限公司 | Progressive picture transmission method suitable for satellite short message communication |
CN116600106A (en) * | 2023-05-18 | 2023-08-15 | 深圳聚源视芯科技有限公司 | Image compression method and system capable of dynamically adjusting compression rate |
WO2023173852A1 (en) * | 2022-03-15 | 2023-09-21 | 华为技术有限公司 | Image encoding method and apparatus, and device |
CN115665425B (en) * | 2022-11-16 | 2024-04-19 | 北极星云空间技术股份有限公司 | Progressive picture transmission method suitable for satellite short message communication |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020010938A1 (en) * | 2000-05-31 | 2002-01-24 | Qian Zhang | Resource allocation in multi-stream IP network for optimized quality of service |
WO2007086589A1 (en) * | 2006-01-25 | 2007-08-02 | Matsushita Electric Industrial Co., Ltd. | Video transcoding with suppression on drift errors |
CN101202912A (en) * | 2007-11-30 | 2008-06-18 | 上海广电(集团)有限公司中央研究院 | Method for controlling balanced code rate and picture quality code rate |
CN101547349A (en) * | 2009-04-27 | 2009-09-30 | 宁波大学 | Method for controlling code rate of secondary AVS encoding of video signal |
CN101658035A (en) * | 2007-04-23 | 2010-02-24 | 高通股份有限公司 | The method and system that is used for quality controlled encoding |
CN101895759A (en) * | 2010-07-28 | 2010-11-24 | 南京信息工程大学 | H.264 code rate control method |
CN102685472A (en) * | 2011-03-08 | 2012-09-19 | 华为技术有限公司 | Method, device and system of data transmission |
CN102932641A (en) * | 2012-11-13 | 2013-02-13 | 北京大学 | Constant quality code rate controlling method |
CN103124347A (en) * | 2012-10-22 | 2013-05-29 | 上海大学 | Method for guiding multi-view video coding quantization process by visual perception characteristics |
CN103188493A (en) * | 2011-12-28 | 2013-07-03 | 佳能株式会社 | Image encoding apparatus and image encoding method |
CN104581157A (en) * | 2015-01-26 | 2015-04-29 | 东南大学 | JPEG 2000 area-of-interest coding method based on pre-truncation |
-
2017
- 2017-03-07 CN CN201710130401.2A patent/CN108574841B/en active Active
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020010938A1 (en) * | 2000-05-31 | 2002-01-24 | Qian Zhang | Resource allocation in multi-stream IP network for optimized quality of service |
WO2007086589A1 (en) * | 2006-01-25 | 2007-08-02 | Matsushita Electric Industrial Co., Ltd. | Video transcoding with suppression on drift errors |
CN101658035A (en) * | 2007-04-23 | 2010-02-24 | 高通股份有限公司 | The method and system that is used for quality controlled encoding |
CN101202912A (en) * | 2007-11-30 | 2008-06-18 | 上海广电(集团)有限公司中央研究院 | Method for controlling balanced code rate and picture quality code rate |
CN101547349A (en) * | 2009-04-27 | 2009-09-30 | 宁波大学 | Method for controlling code rate of secondary AVS encoding of video signal |
CN101895759A (en) * | 2010-07-28 | 2010-11-24 | 南京信息工程大学 | H.264 code rate control method |
CN102685472A (en) * | 2011-03-08 | 2012-09-19 | 华为技术有限公司 | Method, device and system of data transmission |
CN103188493A (en) * | 2011-12-28 | 2013-07-03 | 佳能株式会社 | Image encoding apparatus and image encoding method |
CN103124347A (en) * | 2012-10-22 | 2013-05-29 | 上海大学 | Method for guiding multi-view video coding quantization process by visual perception characteristics |
CN102932641A (en) * | 2012-11-13 | 2013-02-13 | 北京大学 | Constant quality code rate controlling method |
CN104581157A (en) * | 2015-01-26 | 2015-04-29 | 东南大学 | JPEG 2000 area-of-interest coding method based on pre-truncation |
Non-Patent Citations (1)
Title |
---|
朱向军,朱善安: "H.264/AVC中计算复杂度可调的快速模式选择算法", 《中国图象图形学报》 * |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109803146B (en) * | 2019-04-04 | 2021-05-25 | 网易(杭州)网络有限公司 | Method, apparatus, medium, and device for secondary compression of video |
CN109803146A (en) * | 2019-04-04 | 2019-05-24 | 网易(杭州)网络有限公司 | The second-compressed method and apparatus of video |
CN110298895A (en) * | 2019-05-08 | 2019-10-01 | 平安科技(深圳)有限公司 | Picture compression method, apparatus, equipment and storage medium based on artificial intelligence |
CN110225340A (en) * | 2019-05-31 | 2019-09-10 | 北京猿力未来科技有限公司 | A kind of control method and device of Video coding calculate equipment and storage medium |
CN110225340B (en) * | 2019-05-31 | 2021-07-09 | 北京猿力未来科技有限公司 | Control method and device for video coding, computing equipment and storage medium |
WO2021136056A1 (en) * | 2019-12-31 | 2021-07-08 | 华为技术有限公司 | Encoding method and encoder |
CN113132728A (en) * | 2019-12-31 | 2021-07-16 | 上海海思技术有限公司 | Encoding method and encoder |
CN114697656B (en) * | 2020-12-31 | 2024-02-13 | 浙江宇视科技有限公司 | Encoding method, encoding device, electronic equipment and medium |
CN114697656A (en) * | 2020-12-31 | 2022-07-01 | 浙江宇视科技有限公司 | Encoding method, encoding device, electronic equipment and medium |
CN113115040A (en) * | 2021-04-20 | 2021-07-13 | 上海交通大学 | Visual lossless image compression method and device |
WO2023173852A1 (en) * | 2022-03-15 | 2023-09-21 | 华为技术有限公司 | Image encoding method and apparatus, and device |
CN115665425A (en) * | 2022-11-16 | 2023-01-31 | 北极星云空间技术股份有限公司 | Progressive picture transmission method suitable for satellite short message communication |
CN115665425B (en) * | 2022-11-16 | 2024-04-19 | 北极星云空间技术股份有限公司 | Progressive picture transmission method suitable for satellite short message communication |
CN116600106A (en) * | 2023-05-18 | 2023-08-15 | 深圳聚源视芯科技有限公司 | Image compression method and system capable of dynamically adjusting compression rate |
CN116600106B (en) * | 2023-05-18 | 2024-04-09 | 深圳聚源视芯科技有限公司 | Image compression method and system capable of dynamically adjusting compression rate |
Also Published As
Publication number | Publication date |
---|---|
CN108574841B (en) | 2020-10-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108574841A (en) | A kind of coding method and device based on adaptive quantizing parameter | |
AU735938B2 (en) | Adaptive rate control for digital video compression | |
RU2414093C2 (en) | Method and apparatus, and video coding/decoding programme | |
CN1726709B (en) | Method and device for encoding image of uncompressed digital video frequency sequence | |
CN101534436B (en) | Allocation method of video image macro-block-level self-adaptive code-rates | |
CN110692243B (en) | Mixing of probabilities for entropy coding in video compression | |
CN107211145A (en) | The almost video recompression of virtually lossless | |
CN104378636B (en) | A kind of video encoding method and device | |
WO2023274074A1 (en) | Systems and methods for image filtering | |
CN108200431B (en) | Bit allocation method for video coding code rate control frame layer | |
JP2007049680A (en) | Image compression device and method | |
EP3545677A1 (en) | Methods and apparatuses for encoding and decoding video based on perceptual metric classification | |
US20150063461A1 (en) | Methods and apparatuses for adjusting macroblock quantization parameters to improve visual quality for lossy video encoding | |
JP2004336103A (en) | Image information compression apparatus | |
KR20100102386A (en) | Method and apparatus for encoding/decoding image based on residual value static adaptive code table selection | |
JP6373033B2 (en) | Encoding apparatus and encoding method | |
CN108900838A (en) | A kind of Rate-distortion optimization method based on HDR-VDP-2 distortion criterion | |
KR20200035380A (en) | A method of controlling bit rate and an apparatus therefor | |
CN101472182B (en) | Virtually lossless video data compression | |
CN104902285B (en) | A kind of method for encoding images | |
CN110099274A (en) | Estimate the video quality of experience | |
CN107018430B (en) | The method and apparatus of compression and decompression for binary data | |
WO2018109455A1 (en) | Motion compensation techniques for video | |
CN116527909A (en) | Method, apparatus, device, storage medium and program product for transmitting coding parameters | |
CN103974079B (en) | MPEG-4 single grade encoding method and device based on all phase position biorthogonal transform |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |