CN109874012A - A kind of method for video coding, encoder, electronic equipment and medium - Google Patents

A kind of method for video coding, encoder, electronic equipment and medium Download PDF

Info

Publication number
CN109874012A
CN109874012A CN201711261657.3A CN201711261657A CN109874012A CN 109874012 A CN109874012 A CN 109874012A CN 201711261657 A CN201711261657 A CN 201711261657A CN 109874012 A CN109874012 A CN 109874012A
Authority
CN
China
Prior art keywords
block
transformation coefficient
quantization
quantization parameter
frame data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201711261657.3A
Other languages
Chinese (zh)
Other versions
CN109874012B (en
Inventor
范娟婷
朱政
张贤国
张二丽
金星
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201711261657.3A priority Critical patent/CN109874012B/en
Priority to PCT/CN2018/119146 priority patent/WO2019109906A1/en
Publication of CN109874012A publication Critical patent/CN109874012A/en
Application granted granted Critical
Publication of CN109874012B publication Critical patent/CN109874012B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/91Entropy coding, e.g. variable length coding [VLC] or arithmetic coding

Abstract

The embodiment of the invention provides a kind of method for video coding, encoder, electronic equipment and media, and wherein method for video coding, is applied to encoder, are directed to each obtained transformation coefficient block of video requency frame data block to be encoded this method comprises: obtaining;Each transformation coefficient in transformation coefficient block is compared with preset threshold respectively, the transformation coefficient for being less than the preset threshold is replaced with 0, obtains new transformation coefficient block;Judge whether new transformation coefficient block is stand growth model;If new transformation coefficient block is stand growth model, the number for encoding non-zero transform coefficient in the video requency frame data block is 0, terminates the coding to the video requency frame data block;If new transformation coefficient block is not stand growth model, transformation coefficient block is subjected to quantification treatment, the quantization parameter block after being quantified;According to the quantization parameter block after quantization, entropy coding is carried out.

Description

A kind of method for video coding, encoder, electronic equipment and medium
Technical field
The present invention relates to technical field of video coding, more particularly to a kind of method for video coding, encoder, electronic equipment And medium.
Background technique
Continuous improvement with the continuous development and people of multimedia digital Video Applications to video cloud computing demand, it is original The data volume of source of video information has made existing transmission network bandwidth and storage resource unbearable.Therefore, to vision signal Compression has become one of academic research and the hot spot of industrial application both at home and abroad at present.Video compress, also referred to as Video coding, Purpose is the redundancy eliminated between vision signal.
Referring to Fig. 1, Fig. 1 be at present using high efficiency Video coding (High Efficiency Video Coding, HEVC) the basic flow chart that the video encoder of standard is encoded.The basic procedure includes:
Block partiting step: encoder receives the vision signal of input, and the image of vision signal or frame are divided into wait compile Code block, block to be encoded are usually square block, and the block of other non-squares is also allowed, which is generally 8x8,16x16,32x32,64x64;
Prediction steps: predicting the vision signal in current block to be encoded, obtains the prediction signal in reference block;It will The pixel of reference block and current block to be encoded corresponding position makees difference two-by-two, forms the residual signals in residual block;
Shift step: by the residual signals in residual block from airspace Spectrum Conversion to frequency domain, then passing through predetermined linear operation, Residual signals energy in residual block is concentrated on the transformation coefficient of a small number of preset quantity low frequencies, obtains the energy in transform domain Measure the transformation coefficient block with two-dimensional transformation coefficient more concentrated;
Quantization step: right using the preset quantitative information of encoder and the pixel locating depth information extracted from block to be encoded Two-dimensional transformation coefficient is quantified in transformation coefficient block, and the quantization parameter in quantization parameter block after quantization is reduced into Coefficient more smaller than transformation coefficient in script transformation coefficient block;
Entropy code step: according to the quantization parameter block after quantization, entropy coding is carried out, final code stream is formed.
Although prior art video encoder realizes compressed encoding, but coding rate is still to be improved.
Summary of the invention
The embodiment of the present invention is designed to provide a kind of method for video coding, encoder, electronic equipment and medium, to mention High coding rate.Specific technical solution is as follows:
In a first aspect, the embodiment of the invention provides a kind of method for video coding, comprising:
It obtains and is directed to each obtained transformation coefficient block of video requency frame data block to be encoded;
Each transformation coefficient in above-mentioned transformation coefficient block is compared with preset threshold respectively, will be less than above-mentioned default The transformation coefficient of threshold value replaces with 0, obtains new transformation coefficient block;
Judge whether above-mentioned new transformation coefficient block is stand growth model;
If above-mentioned new transformation coefficient block is stand growth model, of non-zero transform coefficient in the video requency frame data block is encoded Number is 0, terminates the coding to the video requency frame data block;
If above-mentioned new transformation coefficient block is not stand growth model, above-mentioned transformation coefficient block is subjected to quantification treatment, is obtained Quantization parameter block after quantization;
According to the quantization parameter block after above-mentioned quantization, entropy coding is carried out.
Optionally, the above-mentioned quantization parameter block according to after above-mentioned quantization carries out entropy coding, comprising:
Whether the quantization parameter block after judging above-mentioned quantization is stand growth model;
If it is determined that quantization parameter block after above-mentioned quantization is stand growth model, then it is non-in the quantization parameter block after encoding the quantization The number of zero quantization parameter is 0, terminates the coding to the video requency frame data block;
If it is determined that the quantization parameter block after above-mentioned quantization is not stand growth model, then the quantization parameter block after the quantization is carried out Entropy coding.
Optionally, above-mentioned acquisition is directed to each obtained transformation coefficient block of video requency frame data block to be encoded, comprising:
For each above-mentioned video requency frame data block to be encoded, is predicted, it is corresponding residual to obtain the video requency frame data block Poor block;
Spectrum Conversion is carried out to the corresponding residual block of the video requency frame data block, obtains above-mentioned transformation coefficient block.
Optionally, above-mentioned preset threshold precalculates acquisition by following formula:
Wherein, Th (x, y) is the corresponding preset threshold of transformation coefficient in above-mentioned transformation coefficient block, wherein Th (x, y) In (x, y) be transformation coefficient be in the position in above-mentioned transformation coefficient block, transformation coefficient block be two-dimensional matrix when, x be it is upper The row of the transformation coefficient present position in transformation coefficient block is stated, y is the transformation coefficient present position in above-mentioned transformation coefficient block Column, QP are preset quantization parameter, and shift is shift value, and the value of shift is 29-B-M, and wherein B is video frame to be encoded The pixel locating depth information of data block, M are the size of the corresponding residual block of video requency frame data block, which is the residual error of N × N Block, M=log2N, offset are deviant, and offset value is
G={ G0,G1,G2,G3,G4,G5}={ 2-4/6,2-3/6,2-2/6,2-1/6,20,21/6, f={ f0,f1,f2,f3,f4,f5} ={ 26214,23302,20560,18396,16384,14564 }, w (x, y) are the preset quantization weight factor, and factor is pre- If threshold factor, the value range of factor is [1,1.5].
It is optionally, above-mentioned that above-mentioned transformation coefficient block is subjected to quantification treatment, comprising:
Using the pixel locating depth information of preset quantitative information and above-mentioned video requency frame data block to be encoded, to above-mentioned transformation Coefficient block carries out quantification treatment.
Optionally, it is calculated by following formula:
Acquisition amount Quantization parameter block after change,
Wherein, Q (x, y) indicates the quantization parameter block after above-mentioned quantization, and (x, y) in Q (x, y) is that coefficient is in above-mentioned amount The position in quantization parameter block after change, when quantization parameter block after quantization is two-dimensional matrix, x is the quantization after above-mentioned quantization The row of quantization parameter present position in coefficient block, y are the quantization parameter present position in the quantization parameter block after above-mentioned quantization Column, Y (x, y) is transformation coefficient in above-mentioned transformation coefficient block at position, wherein (x, y) is that transformation coefficient is in above-mentioned Position in transformation coefficient block, when transformation coefficient block is two-dimensional matrix, x is locating for the transformation coefficient in above-mentioned transformation coefficient block The row of position, y are the column of the transformation coefficient present position in above-mentioned transformation coefficient block, and sign (Y (x, y)) indicates above-mentioned transformation series The collection of the positive and negative values of transformation coefficient in several piece, sign (Y (x, y)) value is combined into { -1,0,1 }.
Optionally, the above-mentioned quantization parameter block to after the quantization carries out entropy coding, comprising:
According to preset order, first non-zero quantized coefficients corresponding first of the quantization parameter block after determining each quantization A position and corresponding second position of the last one non-zero quantized coefficients;
By the quantization parameter block after each quantization from corresponding first non-zero quantized coefficients in first position, to second All quantization parameters between the last one corresponding non-zero quantized coefficients of position carry out entropy coding.
Second aspect, the embodiment of the invention provides a kind of encoders, comprising:
First obtains module, is directed to each obtained transformation coefficient block of video requency frame data block to be encoded for obtaining;
Compare replacement module, for comparing each transformation coefficient in above-mentioned transformation coefficient block with preset threshold respectively Compared with, by be less than above-mentioned preset threshold transformation coefficient replace with 0, obtain new transformation coefficient block;
Judgment module, for judging whether above-mentioned new transformation coefficient block is stand growth model;
First coding module encodes the video requency frame data block if being stand growth model for above-mentioned new transformation coefficient block The number of middle non-zero transform coefficient is 0, terminates the coding to the video requency frame data block;
Second obtains module, if not being stand growth model for above-mentioned new transformation coefficient block, by above-mentioned transformation coefficient block Carry out quantification treatment, the quantization parameter block after being quantified;
Second coding module, for carrying out entropy coding according to the quantization parameter block after above-mentioned quantization.
Optionally, above-mentioned second coding module, for specifically including:
Judging submodule, for judging whether the quantization parameter block after above-mentioned quantization is stand growth model;
First encoding submodule, for if it is determined that quantization parameter block after above-mentioned quantization is stand growth model, then encoding the amount The number of non-zero quantized coefficients is 0 in quantization parameter block after change, terminates the coding to the video requency frame data block;
Second encoding submodule, for if it is determined that the quantization parameter block after above-mentioned quantization is not stand growth model, then to the amount Quantization parameter block after change carries out entropy coding.
Optionally, above-mentioned first module is obtained, comprising:
It predicts submodule, for being directed to each above-mentioned video requency frame data block to be encoded, is predicted, obtain the video frame The corresponding residual block of data block;
Acquisition submodule obtains above-mentioned transformation for carrying out Spectrum Conversion to the corresponding residual block of the video requency frame data block Coefficient block.
Optionally, which precalculates acquisition by following formula:
Wherein, Th (x, y) is the corresponding preset threshold of transformation coefficient in the transformation coefficient block, wherein in Th (x, y) (x, y) be transformation coefficient be in the position in the transformation coefficient block, transformation coefficient block be two-dimensional matrix when, x be the transformation The row of transformation coefficient present position in coefficient block, y are the column of the transformation coefficient present position in the transformation coefficient block, and QP is pre- If quantization parameter, shift is shift value, and the value of shift is 29-B-M, and wherein B is video requency frame data block to be encoded Pixel locating depth information, M are the size of the corresponding residual block of video requency frame data block, which is the residual block of N × N, M= log2N, offset are deviant, and offset value is
G={ G0,G1,G2,G3,G4,G5}={ 2-4/6,2-3/6,2-2/6,2-1/6,20,21/6, f={ f0,f1,f2,f3,f4,f5} ={ 26214,23302,20560,18396,16384,14564 }, w (x, y) are the preset quantization weight factor, and factor is pre- If threshold factor, the value range of factor is [1,1.5].
Optionally, which is specifically used for utilizing preset quantitative information and the video requency frame data to be encoded The pixel locating depth information of block carries out quantification treatment to the transformation coefficient block.
Optionally, which is specifically used for calculating by following formula:
Quantified Quantization parameter block afterwards,
Wherein, Q (x, y) indicates the quantization parameter block after the quantization, and (x, y) in Q (x, y) is after coefficient is in the quantization Quantization parameter block in position, when quantization parameter block after quantization is two-dimensional matrix, x is the quantization parameter block after the quantization In quantization parameter present position row, y be the quantization after quantization parameter block in quantization parameter present position column, Y (x, It y) is the transformation coefficient in the transformation coefficient block at position, wherein (x, y) is that transformation coefficient is in the transformation coefficient block Position, transformation coefficient block be two-dimensional matrix when, x be the transformation coefficient block in transformation coefficient present position row, y be should The column of transformation coefficient present position in transformation coefficient block, sign (Y (x, y)) indicate that transformation coefficient is just in the transformation coefficient block The collection of negative value, sign (Y (x, y)) value is combined into { -1,0,1 }.
Optionally, above-mentioned second encoding submodule, is specifically used for:
According to preset order, first non-zero quantized coefficients corresponding first of the quantization parameter block after determining each quantization A position and corresponding second position of the last one non-zero quantized coefficients;
By the quantization parameter block after each quantization from corresponding first non-zero quantized coefficients in first position, to second All quantization parameters between the last one corresponding non-zero quantized coefficients of position carry out entropy coding.
The third aspect, the embodiment of the invention provides a kind of electronic equipment, including encoder and machine readable storage medium, Above-mentioned machine readable storage medium is stored with the machine-executable instruction that can be executed by above-mentioned encoder, on above-mentioned encoder It states machine-executable instruction to promote: realizing the above-mentioned method for video coding step of first aspect.
Fourth aspect, the embodiment of the invention provides a kind of electronic equipment, including processor and machine readable storage medium, The machine readable storage medium is stored with the machine-executable instruction that can be executed by the processor, and the processor is by institute It states machine-executable instruction to promote: realizing the above-mentioned method for video coding step of first aspect.
5th aspect, the embodiment of the invention provides a kind of computer readable storage medium, storage in above-mentioned storage medium There is computer program, first aspect above-mentioned method for video coding step is realized when above-mentioned computer program is executed by processor.
6th aspect, the embodiment of the invention provides a kind of computer program products comprising instruction, when it is in computer When upper operation, so that computer executes the above-mentioned method for video coding step of first aspect.
7th aspect, the embodiment of the invention provides a kind of computer programs, when run on a computer, make to succeed in one's scheme Calculation machine executes the method for video coding step for realizing that first aspect is above-mentioned.
A kind of method for video coding, encoder, electronic equipment and medium provided in an embodiment of the present invention, by by transformation series The transformation coefficient for being less than the preset threshold compared with preset threshold, is replaced with 0, such as respectively by each transformation coefficient in several piece The new transformation coefficient block of fruit is stand growth model, then transformation coefficient corresponding before the transformation coefficient block replacement transformation coefficient new to this Block is without quantifying, and the number of non-zero transform coefficient is 0 in encoded o frame data block, terminates coding;If new transformation series Several piece is not stand growth model, then the corresponding transformation coefficient block amount of progress before only replacing transformation coefficient to the new transformation coefficient block Change processing, the quantization parameter block after being quantified;According to the quantization parameter block after quantization, entropy coding is carried out.
It can be seen that due in the embodiment of the present invention new transformation coefficient block be stand growth model when, the transformation series new to this Several piece transformation coefficient block corresponding before replacing transformation coefficient is without quantifying, and non-zero becomes in direct coding video requency frame data block The number for changing coefficient is 0, therefore reduces the quantity for carrying out the transformation coefficient block of entropy coding, and then improve coding rate.
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.
Detailed description of the invention
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 technical 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 It obtains other drawings based on these drawings.
Fig. 1 is basic flow chart of the prior art using the video encoder of high efficiency video standard;
Fig. 2 is the first flow diagram of the method for video coding of the embodiment of the present invention;
Fig. 3 is second of flow diagram of the method for video coding of the embodiment of the present invention;
Fig. 4 is the first structure diagram of the encoder of the embodiment of the present invention;
Fig. 5 is the overall framework figure of video encoder applied by the embodiment of the present invention;
Fig. 6 is the first structure diagram of the electronic equipment of the embodiment of the present invention;
Fig. 7 is the second structural schematic diagram of the electronic equipment of the embodiment of the present invention.
Specific embodiment
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 description, 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.
Compressed encoding is although realized for prior art video encoder, but the feelings that coding rate is still to be improved Condition, the embodiment of the invention provides a kind of method for video coding, encoder, electronic equipment and media, to improve coding rate.
Method for video coding is provided for the embodiments of the invention first below to be introduced.
Method for video coding provided by the embodiment of the present invention can be applied to encoder, also can be applied to processor, In the embodiment of the present invention with no restrictions.
As shown in Fig. 2, a kind of method for video coding provided by the embodiment of the present invention, may include steps of:
Step 201, it obtains and is directed to each obtained transformation coefficient block of video requency frame data block to be encoded.
In a specific embodiment, this step can be obtained as follows for each video frame number to be encoded According to the obtained transformation coefficient block of block:
It is first directed to each video requency frame data block to be encoded, is predicted, it is corresponding to obtain the video requency frame data block Residual block;Spectrum Conversion is carried out to the corresponding residual block of the video requency frame data block again, obtains the transformation coefficient block.
In other embodiments, each obtained transformation coefficient block of video requency frame data block to be encoded will can be first directed to It stores into a preset database, this step 201 can directly obtain transformation data block from preset database.
In the present embodiment, video requency frame data block to be encoded can be the video requency frame data block of 4x4, be also possible to 8x8's Video requency frame data block is also possible to the video requency frame data block of 16x16, can also be the video requency frame data block of 32x32, does not do herein It limits.Any video requency frame data block that the embodiment of the present invention may be implemented belongs to the protection scope of the embodiment of the present invention, herein A different citing.
Step 202, each transformation coefficient in transformation coefficient block is compared with preset threshold respectively, will be less than default The transformation coefficient of threshold value replaces with 0, obtains new transformation coefficient block.
In a specific embodiment, preset threshold can based on experience value or industrial requirement is preset, and generally should Preset threshold is numerical value more than or equal to 0, for example, the numerical value can in 0 to 3 value range value.The number of the value Value is bigger, and the partial information of the transformation coefficient loss in transformation coefficient block is more.The setting of specific preset threshold, can basis Depending on actual conditions.Since the embodiment of the present invention has only used a preset threshold, the process for completing above-mentioned comparison is relatively convenient.
In other specific embodiments, for the pixel locating depth of different quantitative information and video requency frame data block to be encoded Information, calculates corresponding preset threshold, and by preset quantitative information, pixel depth information and corresponding preset threshold, protects It leaves and.The preset quantitative information includes: the preset quantization weight factor and preset quantization parameter.In this way in entire video In cataloged procedure, the preset threshold that method for video coding can be pre-saved directly using this is just pre- without calculating this in real time If threshold value, it is possible to reduce occupy the running memory of Video coding.
After obtaining video requency frame data block to be encoded, preset quantitative information and video frame number to be encoded can be first obtained According to the pixel locating depth information of block, from the preset threshold pre-saved, each transformation coefficient pair in the transformation coefficient block is searched The preset threshold answered.
The preset threshold is calculated by following formula and is obtained:
Wherein, Th (x, y) is the corresponding preset threshold of transformation coefficient in transformation coefficient block, wherein in Th (x, y) (x, y) is that transformation coefficient is in the position in the transformation coefficient block, and when transformation coefficient block is two-dimensional matrix, x is the transformation series The row of transformation coefficient present position in several piece, y are the column of the transformation coefficient present position in the transformation coefficient block, and QP is default Quantization parameter, shift is shift value, and the value of shift is 29-B-M, and wherein B is the picture of video requency frame data block to be encoded Plain locating depth information, M are the size of the corresponding residual block of video requency frame data block, which is the residual block of N × N, M= log2N, offset are deviant, and offset value is
G={ G0,G1,G2,G3,G4,G5}={ 2-4/6,2-3/6,2-2/6,2-1/6,20,21/6, f={ f0,f1,f2,f3,f4, f5}={ 26214,23302,20560,18396,16384,14564 }, w (x, y) is the preset quantization weight factor, w (x, y) 1 can be equal to, it is not limited here, factor is preset threshold factor, and the value range of factor is [1,1.5], above-mentioned Preset threshold can change size by threshold factor.
Above-mentioned Th (x, y) formula is specifically derived by what is be derived by as follows:
If new transformation coefficient block is stand growth model, need full All Q (x, y) of foot are respectively less than 1;At this point, new transformation coefficient block | Y (x, y) | it then needs to meet following formula,Wherein, factor=1 is then enabled | Y (x, y) | < Th (x, y) is obtained It arrives
As factor=1, if not considering theoretically Precision and rounding-off problem when quantization, will not bring any additional quantization to lose, it is, the quantization system after quantization Several piece is exactly stand growth model, but coding rate is also restrained at this time;As factor > 1, additional quantization loss can be introduced, It is, full zero coefficient may be replaced all with the transformation coefficient in the corresponding transformation coefficient block of non-full zero block, to bring Quantization loss, but under the premise of losing tolerable, coding rate has promotion.The threshold value multiplied in above-mentioned Th (x, y) because Sub- factor is to weigh loss and acceleration.In general, factor is bigger, threshold value is then bigger, and corresponding coding loss is bigger, The acceleration of encoder is bigger.The factor can be adjusted according to user demand.
User can weigh quantization loss and scramble time, set the size of preset threshold according to self-demand.Therefore, The preset threshold reduces the binary encoding time under the premise of not loss coding performance as far as possible, improves the rate of coding.
Preset quantitative information in above-mentioned formula includes: preset quantization parameter, preset quantization step, preset amount Change weight factor.
In general, above-mentioned QS (Quantization Step, quantization step) describes the size of quantization degree, QS (QP)= (21/6)QP-4, and quantization step can be by QP (Quantization Parameter, quantization parameter) quantificational expression.Quantization can To be divided into different grades according to different quantization steps, quantization parameter is generally divided into 52 grades, i.e., and 0 to 51.
The step-length range that quantization can choose is bigger, and step-length is bigger, and quantized result is more coarse, and the information of loss is more, Compression performance is also higher.User selects step-length in the step-length range according to self-demand so that encoder more odd jobs control The code rate and quality of video flowing processed.
The size of weight can be arranged in the above-mentioned quantization weight factor according to the importance of different location, be traditionally arranged to be 1 i.e. table Show no weight.
Above-mentioned pixel locating depth information refers to digit used in each pixel (bit).Pixel locating depth information can be 8 bits. Common vision signal is all made of 8 bit locating depths, and semaphore request is relatively high, for example (High-Dynamic Range, height are dynamic by HDR State illumination render image) video, the video is using 10 bits, 12 bits.
Pixel bit depth determines the presumable number of colours of each pixel of color image, or determines the every of gray level image A presumable number of greyscale levels of pixel.For example, each pixel of a width color image is indicated with tri- components of R, G, B, if often A component is with 8, then a pixel shares 24 expressions, that is to say, that pixel bit depth information is 24, and each pixel can To be 224, i.e. one of 16777216 millions kind colors.In this way, pixel bit depth information is referred to as picture depth. As soon as the digit of pixel represented by the pixel locating depth information is more, the number of color that can be expressed is more, and representated by pixel Depth is deeper.Under normal circumstances, pixel bit depth is deeper, and data volume is bigger, and required transmission bandwidth and memory space are just It is bigger.On the contrary, will affect the quality of image if pixel bit depth is too shallow, image seems that people is allowed to feel very coarse without certainly So.
Step 203, judge whether new transformation coefficient block is stand growth model, if new transformation coefficient block is stand growth model, It executes step 204 and thens follow the steps 205 if new transformation coefficient block is not stand growth model;
In this step, exactly judge the transformation coefficient whether all zero in new transformation coefficient block, can be parallel one Row or a column ground carry out the transformation coefficient in new transformation coefficient block to judge whether the transformation coefficient is zero, can also be serial The transformation coefficient in new transformation coefficient block is judged one by one, here without limitation.Judge in new transformation coefficient block Transformation coefficient whether the parallel mode for being zero, efficiency is relatively high, and judges that the transformation coefficient in new transformation coefficient block is one by one The no serial mode for being zero, current occupancy running memory are smaller.
Step 204, the number for encoding non-zero transform coefficient in the video requency frame data block is 0, is terminated to the video requency frame data The coding of block.
It is non-in the direct coding video requency frame data block when new transformation coefficient block is stand growth model in the embodiment of the present invention The number of null transformation coefficient is 0, not to transformation coefficient block corresponding before new transformation coefficient block replacement transformation coefficient into Row quantization and entropy coding, just terminate the coding to the video requency frame data block.
Step 205, which is subjected to quantification treatment, the quantization parameter block after being quantified.
In the embodiment of the present invention, only when new transformation coefficient block is not stand growth model, the just transformation coefficient block new to this Corresponding transformation coefficient block is quantified before replacement transformation coefficient.
Specifically, can be calculated by formula in the embodiment of the present invention:
Acquisition amount Quantization parameter block after change,
Wherein, Q (x, y) indicates the quantization parameter block after quantization, and (x, y) in Q (x, y) is after coefficient is in the quantization Position in quantization parameter block, when quantization parameter block after quantization is two-dimensional matrix, x is in the quantization parameter block after the quantization Quantization parameter present position row, y be the quantization after quantization parameter block in quantization parameter present position column, Y (x, y) For the transformation coefficient in the transformation coefficient block at position, wherein (x, y) is that transformation coefficient is in the transformation coefficient block Position, when transformation coefficient block is two-dimensional matrix, x is the row of the transformation coefficient present position in the transformation coefficient block, and y is the change Change the column of the transformation coefficient present position in coefficient block, sign (Y (x, y)) indicates the positive and negative of transformation coefficient in the transformation coefficient block Value, the collection of sign (Y (x, y)) value are combined into { -1,0,1 }.Using above-mentioned formula, may be implemented only when new transformation coefficient block When not being stand growth model, transformation coefficient block corresponding before the new transformation coefficient block replacement transformation coefficient is quantified, with Improve the accuracy of quantization.
In a specific embodiment, following steps are utilized in above-mentioned steps 205, which is carried out at quantization Reason:
Using the pixel locating depth information of preset quantitative information and above-mentioned video requency frame data block to be encoded, to the transformation series Several piece carries out quantification treatment.
In order to weigh visual quality and compression performance, using quantization.The quantization is first by the transformation series after Spectrum Conversion Several piece, rounding treatment and is zoomed in and out using division.Quantization makes the transformation coefficient in transformation coefficient block lose partial information.In this way The loss of partial information can be allowed for, user is reduced under the premise of not reducing the visual effect of user's viewing video Unnecessary information in the video that vision is seen.
Step 206, according to the quantization parameter block after the quantization, entropy coding is carried out.
After quantization parameter block after being quantified, so that it may according to the quantization parameter block after quantization, carry out entropy coding.Entropy is compiled After the completion of code, the Video coding to video requency frame data block to be encoded is just completed.Above-mentioned entropy coding includes: Shannon (Shannon) coding, Huffman (Huffman) coding and arithmetic coding (arithmeticcoding)).Different one action herein Example.
It can be seen that due in the embodiment of the present invention for new transformation coefficient block be stand growth model when, the change new to this Corresponding transformation coefficient block is non-in direct coding video requency frame data block without quantifying before changing coefficient block replacement transformation coefficient The number of null transformation coefficient is 0, therefore reduces the quantity for carrying out the transformation coefficient block of entropy coding, and then improves coding speed Degree.
Shown in Figure 3, the specific overall flow of the method for video coding of the embodiment of the present invention includes the following steps:
Step 301, each video requency frame data block and other video informations to be encoded are obtained, other video informations include The coefficient value and preset quantitative information of coefficient value, transformation coefficient block in video requency frame data block.
Step 302, each transformation coefficient in transformation coefficient block is compared with preset threshold respectively.
Step 303, judge whole transformation coefficients in transformation coefficient block, if all less than preset threshold;If incomplete Portion is less than, and thens follow the steps 304, if all less than step 306 is executed.
Step 304, transformation coefficient block corresponding before new transformation coefficient block replacement transformation coefficient is carried out at quantization Reason, the quantization parameter block after being quantified.
Step 305, judge to quantify whether coefficient block is stand growth model.If so, executing step 307;If there are still non-zeros Coefficient thens follow the steps 308.
Step 306, the transformation coefficient for being less than preset threshold is replaced with 0, obtains new transformation coefficient block, and judged new Transformation coefficient block be stand growth model, then execute step 307.
Step 307, the number for encoding non-zero transform coefficient in the video requency frame data block is 0.
Step 308, the quantization parameter block after quantization is subjected to entropy coding.Specifically, by the number of non-zero quantized coefficients and All quantization parameters in coded data block between first non-zero quantized coefficients and the last one non-zero quantized coefficients carry out entropy Coding.
In a specific embodiment, above-mentioned steps 308 include:
According to preset order, first non-zero quantized coefficients corresponding first of the quantization parameter block after determining each quantization A position and corresponding second position of the last one non-zero quantized coefficients;
By in the quantization parameter block after each quantization from corresponding first non-zero quantized coefficients in first position, to second All quantization parameters between the last one corresponding non-zero quantized coefficients of a position carry out entropy coding.
Using the embodiment of the present invention, may be implemented to carry out entropy volume to the quantization parameter block after the corresponding quantization of non-full zero block Code, loss of coding performance are smaller.
Entropy coding is carried out to the quantization parameter block after the corresponding quantization of non-full zero block, specific implementation is exemplified below:
Citing one: it assuming that the video requency frame data block of the 4x4 has already passed through the step of prediction, transformation, quantization, obtains corresponding Quantization parameter block after quantization;
The data block that quantization parameter block after the quantization is 4x4 carries out entropy coding to the data block of the 4x4:
By the data block of each 4x4 from corresponding first non-zero quantized coefficients in first position, to second position pair All quantization parameters between the last one non-zero quantized coefficients answered carry out entropy coding.
Citing two: it assuming that the video requency frame data block of the 8x8 has already passed through the step of prediction, transformation, quantization, obtains corresponding Quantization parameter block after quantization;
The data block that quantization parameter block after the quantization is 8x8 carries out entropy coding to the data block of the 8x8: it is possible, firstly, to The data block of the 8x8 is divided into the data block of 4 4x4, then the data block of this 4 4x4 is compiled according to preset order Number, for example, the number of the data block of 4 4x4 is respectively 01,02,03,04;
The data block that judgement number is 02 and 04 corresponding 4x4 is stand growth model, then the number of 4x4 corresponding to number 02 and 04 According to all quantization parameters in block, the number of non-zero quantized coefficients is 0 in the quantization parameter block after encoding the quantization, is terminated to this The coding of video requency frame data block.
The data block that judgement number is 01,03 corresponding 4x4 is not stand growth model, and searching number is 01 corresponding 4x4 Data block in, first position of first non-zero quantized coefficients and second position of the last one non-zero quantized coefficients;
It searches in the data block that number is 03 corresponding 4x4, first position of first non-zero quantized coefficients, and last Second position of one non-zero quantized coefficients;
Will number be 01 corresponding 4x4 data block from corresponding first non-zero quantized coefficients in first position to second All quantization parameters between the last one corresponding non-zero quantized coefficients of a position, and
The data block that number is 03 corresponding 4x4 is from corresponding first non-zero quantized coefficients in first position to second All quantization parameters between the last one corresponding non-zero quantized coefficients of position carry out entropy coding.Above-mentioned preset order according to Industrial requirement is configured.
It is merely illustrative above, similarly, the video requency frame data block of 16x16 or the video requency frame data block of 32x32 can also To realize above-mentioned implementation procedure, details are not described herein.Any method that can carry out entropy coding with the quantization parameter block after quantifying Belong to the protection scope of the embodiment of the present invention.
In other specific embodiments, entropy coding is carried out to the quantization parameter block after the corresponding quantization of non-full zero block, specifically Realization is exemplified below:
Assuming that the video requency frame data block of the 8x8 has already passed through the step of prediction, transformation, quantization, after obtaining corresponding quantization Quantization parameter block;
The data block that quantization parameter block after the quantization is 8x8 carries out entropy coding to the data block of the 8x8: it is possible, firstly, to The data block of the 8x8 is divided into the data block of 4 4x4, then the data block of this 4 4x4 is compiled according to preset order Number, for example, the number of the data block of 4 4x4 is respectively 1,2,3,4;
When the data block that number is 1,2,3,4 corresponding 4x4 is not stand growth model, it is assumed that number is the number of 2 corresponding 4x4 Quantization parameter and number according to block are that the quantization parameter of the data block of 3 corresponding 4x4 distinguishes all non-zero quantized coefficients, according to The secondary data block for searching 1,2,3,4 corresponding 4x4, searches first non-zero in the data block that number is 1 corresponding 4x4 First position of quantization parameter, and the last one non-zero quantized coefficients is searched in the data block that number is 4 corresponding 4x4 Second position;
By corresponding first non-zero quantized coefficients in first position, warp knit from the data block that number is 1 corresponding 4x4 Number for 2 corresponding 4x4 all quantization parameter of data block, the numbered all quantization system of data block for being 3 corresponding 4x4 Number, it is all between the last one corresponding non-zero quantized coefficients of second position in the data block for being 4 corresponding 4x4 to numbering Quantization parameter carries out entropy coding.Above-mentioned preset order can be configured according to industrial requirement.
It can be seen that due in the embodiment of the present invention new transformation coefficient block be stand growth model when, the transformation series new to this Several piece transformation coefficient block corresponding before replacing transformation coefficient is without quantifying, and non-zero becomes in direct coding video requency frame data block The number for changing coefficient is 0, therefore reduces the quantity for carrying out the transformation coefficient block of entropy coding, and then improve coding rate.
Using the method for video coding of the embodiment of the present invention, the scramble time of video encoder can be reduced, reality can be passed through Testing data is proved.
Specific experiment data are as shown in table 1 below, which is the Video coding that encoder utilizes the embodiment of the present invention What method was tested, when experiment, threshold factor factor is set as 1.1.As the following table 1 be existing coding method with Using the comparing result of the method for video coding of the embodiment of the present invention, average value required by the comparing result that table 2 obtains for table 1.
For the parameter, Δ fps in Tables 1 and 2, can be obtained by following formula.
Determine Δ fps.
Wherein, Δ fps indicates FPSproposedWith FPSanchorRatio.Δ fps can characterize the coding rate of encoder Whether accelerate.Fps indicates frame per second per second, it is, the frame number per second frame number that video can play each second in other words.Its In, FPSanchorIndicate the frame per second FPS, FPS using existing encoder encoded video segmentproposedIndicate that same encoder is adopted With the frame per second FPS after the fast encoding method based on transformation coefficient of the embodiment of the present invention, FPS in Tables 1 and 2anchor、 FPSproposedCorresponding positive value indicates to accelerate, and corresponding negative value indicates to slow down, and Δ fps, which is greater than 100%, to be indicated to accelerate.100% expression Encoder utilizes the method for video coding of the embodiment of the present invention, and obtained coding frame per second and same encoder use existing video Coding method, obtained coding frame per second are identical.
Table 1
In Tables 1 and 2 video clip be respectively classA, classB, classC, classD, classE, 15fps, 30fps,20fps,show,others.Wherein, classA, classB, classC, classD, classE are standard test video Segment.15fps, 30fps, 20fps, show, others are the customized video clip of user, it is, according to user demand The video clip of interception.The image or frame of the corresponding vision signal of the video clip can be divided into data to be encoded block, utilize The data to be encoded block divided, executes the method for video coding of the embodiment of the present invention.
Wherein, U, V are respectively two carrier chrominance signals, and Y is luminance signal, and YUV is to merge signal, and BD-rate indicates performance. Wherein, when negative value, under the conditions of indicating identical PSNR (Peak Signal to Noise Ratio) Y-PSNR, code rate subtracts Few, coding efficiency improves.Positive value is that code rate increases, coding efficiency decline.Coding efficiency includes compression performance.
It is illustrated with video clip classA, the corresponding coding efficiency of Y declines the corresponding coding efficiency of 1.62%, U and mentions The corresponding coding efficiency decline 1.35% of 0.34%, YUV of the high corresponding coding efficiency raising of 0.14%, V, Δ fps are 111.91%, the coding characterized with 11.91% accelerates, this 11.91% subtracts 100% institute by Δ fps corresponding 111.91% It obtains.It says so method for video coding of the bright video clip classA Jing Guo the embodiment of the present invention and existing method for video coding It compares, the method for video coding of the embodiment of the present invention makes code rate improve 11.91%.
Table 2
By the method for video coding of the visible embodiment of the present invention of table 2, when factor is set as 1.1, the embodiment of the present invention Method for video coding compared with existing method for video coding, although by corresponding the being separately encoded property of Y, U, V, YUV of BD-rate 1.09% can be declined, coding efficiency improves 0.42%, coding efficiency and improves 0.31%, coding efficiency decline 0.86% it is found that compiling Code performance has a certain impact, and still, subtracting 100% obtained 10.47% or so by Δ fps corresponding 110.47% can Know, code rate improves 10.471%.Therefore, the method for video coding of the embodiment of the present invention, accelerates code rate.
As shown in figure 4, the embodiment of the invention provides a kind of encoders, comprising:
First obtains module 401, is directed to each obtained transformation coefficient of video requency frame data block to be encoded for obtaining Block;
Compare replacement module 402, for by each transformation coefficient in above-mentioned transformation coefficient block respectively with preset threshold into Row compares, and the transformation coefficient for being less than above-mentioned preset threshold is replaced with 0, obtains new transformation coefficient block;
Judgment module 403, for judging whether above-mentioned new transformation coefficient block is stand growth model;
First coding module 404 encodes the video requency frame data if being stand growth model for above-mentioned new transformation coefficient block The number of non-zero transform coefficient is 0 in block, terminates the coding to the video requency frame data block;
Second obtains module 405, if not being stand growth model for above-mentioned new transformation coefficient block, by above-mentioned transformation coefficient Block carries out quantification treatment, the quantization parameter block after being quantified;
Second coding module 406, for carrying out entropy coding according to the quantization parameter block after above-mentioned quantization.
It can be seen that due in the embodiment of the present invention new transformation coefficient block be stand growth model when, the transformation series new to this Several piece transformation coefficient block corresponding before replacing transformation coefficient is without quantifying, and non-zero becomes in direct coding video requency frame data block The number for changing coefficient is 0, therefore reduces the quantity for carrying out the transformation coefficient block of entropy coding, and then improve coding rate.
Optionally, above-mentioned second coding module, for specifically including:
Judging submodule, for judging whether the quantization parameter block after above-mentioned quantization is stand growth model;
First encoding submodule, for if it is determined that quantization parameter block after above-mentioned quantization is stand growth model, then encoding the amount The number of non-zero quantized coefficients is 0 in quantization parameter block after change, terminates the coding to the video requency frame data block;
Second encoding submodule, for if it is determined that the quantization parameter block after above-mentioned quantization is not stand growth model, then to the amount Quantization parameter block after change carries out entropy coding.
Optionally, above-mentioned first module is obtained, comprising:
It predicts submodule, for being directed to each above-mentioned video requency frame data block to be encoded, is predicted, obtain the video frame The corresponding residual block of data block;
Acquisition submodule obtains above-mentioned transformation for carrying out Spectrum Conversion to the corresponding residual block of the video requency frame data block Coefficient block.
Optionally, which precalculates acquisition by following formula:
Wherein, Th (x, y) is the corresponding preset threshold of transformation coefficient in the transformation coefficient block, wherein in Th (x, y) (x, y) be transformation coefficient be in the position in the transformation coefficient block, transformation coefficient block be two-dimensional matrix when, x be the transformation The row of transformation coefficient present position in coefficient block, y are the column of the transformation coefficient present position in the transformation coefficient block, and QP is pre- If quantization parameter, shift is shift value, and the value of shift is 29-B-M, and wherein B is video requency frame data block to be encoded Pixel locating depth information, M are the size of the corresponding residual block of video requency frame data block, which is the residual block of N × N, M= log2N, offset are deviant, and offset value is
G={ G0,G1,G2,G3,G4,G5}={ 2-4/6,2-3/6,2-2/6,2-1/6,20,21/6, f={ f0,f1,f2,f3,f4,f5} ={ 26214,23302,20560,18396,16384,14564 }, w (x, y) are the preset quantization weight factor, and factor is pre- If threshold factor, the value range of factor is [1,1.5].
Optionally, which is specifically used for utilizing preset quantitative information and the video requency frame data to be encoded The pixel locating depth information of block carries out quantification treatment to the transformation coefficient block.
Optionally, which is specifically used for calculating by following formula:
Acquisition amount Quantization parameter block after change,
Wherein, Q (x, y) indicates the quantization parameter block after the quantization, and (x, y) in Q (x, y) is after coefficient is in the quantization Quantization parameter block in position, when quantization parameter block after quantization is two-dimensional matrix, x is the quantization parameter block after the quantization In quantization parameter present position row, y be the quantization after quantization parameter block in quantization parameter present position column, Y (x, It y) is the transformation coefficient in the transformation coefficient block at position, wherein (x, y) is that transformation coefficient is in the transformation coefficient block Position, transformation coefficient block be two-dimensional matrix when, x be the transformation coefficient block in transformation coefficient present position row, y be should The column of transformation coefficient present position in transformation coefficient block, sign (Y (x, y)) indicate that transformation coefficient is just in the transformation coefficient block The collection of negative value, sign (Y (x, y)) value is combined into { -1,0,1 }.
Optionally, above-mentioned second encoding submodule, is specifically used for:
According to preset order, first non-zero quantized coefficients corresponding first of the quantization parameter block after determining each quantization A position and corresponding second position of the last one non-zero quantized coefficients;
By the quantization parameter block after each quantization from corresponding first non-zero quantized coefficients in first position, to second All quantization parameters between the last one corresponding non-zero quantized coefficients of position carry out entropy coding.
The embodiment of the present invention can be applied to referring to encoder as figure 5 illustrates.For meeting existing video encoding standard, compile The video that code generates can be decoded directly by common player.The encoder can also implement function such as: for each wait compile The video requency frame data block of code block selects optimal interframe encode type from various interframe encode types according to rate distortion criterion, Motion information and encoded reconstructed frame information are obtained, video requency frame data block is carried out using selected interframe encode type pre- It surveys, and utilizes motion information and encoded reconstructed frame information, the predicted value of block to be encoded is obtained, to predicted value and block to be encoded Pixel value make the difference, obtain residual values, residual values are successively converted, quantifies, scan, entropy coding operation, be incorporated into code stream, together When motion information is incorporated into code stream, complete cataloged procedure, which includes: to encode forward, encode backward.
Quantization parameter after quantization can also be scanned the quantization parameter after quantization, according to pre- by above-mentioned encoder It surveys and mapping mode selects scanning sequency, the two-dimensional quantization parameter in quantization parameter block after making quantization is transformed into one-dimensional amount Change coefficient sequence, scan resulting one-dimensional quantization parameter sequence and tend to descending arrangement, wherein the default scanning is suitable Sequence includes: Z-type scan pattern, horizontal sweep mode and vertical sweep mode, is swept by rate-distortion optimization criterion at these three It retouches and selects one group of optimal scan pattern in mode;Successively one-dimensional quantization parameter sequence inputting is compiled to entropy coder Code, and the selection information of scan pattern is incorporated into code stream, form final code stream.
Encoder can be according to one or more standard or specifications, such as H.264MPEG-4 (Moving Picture Experts Group, dynamic image expert group), H.265 high efficiency Video coding or HEVC (High Efficiency Video Coding, high efficiency Video coding) and other standards, to undertake video compress and decompress and/or realize Video Codec. The embodiment of the present invention is not limited to any particular video frequency coding standard or specification.
The embodiment of the invention provides a kind of electronic equipment, as shown in fig. 6, including that encoder 61 and machine readable storage are situated between Matter 62, above-mentioned machine readable storage medium are stored with the machine-executable instruction that can be executed by above-mentioned encoder, above-mentioned coding Device is promoted by above-mentioned machine-executable instruction: realize following steps:
It obtains and is directed to each obtained transformation coefficient block of video requency frame data block to be encoded;
Each transformation coefficient in above-mentioned transformation coefficient block is compared with preset threshold respectively, will be less than above-mentioned default The transformation coefficient of threshold value replaces with 0, obtains new transformation coefficient block;
Judge whether above-mentioned new transformation coefficient block is stand growth model;
If above-mentioned new transformation coefficient block is stand growth model, of non-zero transform coefficient in the video requency frame data block is encoded Number is 0, terminates the coding to the video requency frame data block;
If above-mentioned new transformation coefficient block is not stand growth model, above-mentioned transformation coefficient block is subjected to quantification treatment, is obtained Quantization parameter block after quantization;
According to the quantization parameter block after above-mentioned quantization, entropy coding is carried out.
It can be seen that due in the embodiment of the present invention new transformation coefficient block be stand growth model when, the transformation series new to this Several piece transformation coefficient block corresponding before replacing transformation coefficient is without quantifying, and non-zero becomes in direct coding video requency frame data block The number for changing coefficient is 0, therefore reduces the quantity for carrying out the transformation coefficient block of entropy coding, and then improve coding rate.
The embodiment of the invention also provides a kind of electronic equipment, including processor and machine readable storage medium, above-mentioned machines Device readable storage medium storing program for executing is stored with the machine-executable instruction that can be executed by above-mentioned processor, and above-mentioned processor is by above-mentioned machine Executable instruction promotes: realize following steps:
It obtains and is directed to each obtained transformation coefficient block of video requency frame data block to be encoded;
Each transformation coefficient in above-mentioned transformation coefficient block is compared with preset threshold respectively, will be less than above-mentioned default The transformation coefficient of threshold value replaces with 0, obtains new transformation coefficient block;
Judge whether above-mentioned new transformation coefficient block is stand growth model;
If above-mentioned new transformation coefficient block is stand growth model, of non-zero transform coefficient in the video requency frame data block is encoded Number is 0, terminates the coding to the video requency frame data block;
If above-mentioned new transformation coefficient block is not stand growth model, above-mentioned transformation coefficient block is subjected to quantification treatment, is obtained Quantization parameter block after quantization;
According to the quantization parameter block after above-mentioned quantization, entropy coding is carried out.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit, CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal Processing, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete Door or transistor logic, discrete hardware components.
It can be seen that due in the embodiment of the present invention new transformation coefficient block be stand growth model when, the transformation series new to this Several piece transformation coefficient block corresponding before replacing transformation coefficient is without quantifying, and non-zero becomes in direct coding video requency frame data block The number for changing coefficient is 0, therefore reduces the quantity for carrying out the transformation coefficient block of entropy coding, and then improve coding rate.
The embodiment of the invention also provides a kind of electronic equipment, as shown in fig. 7, comprises processor 701, communication interface 702, Memory 703 and communication bus 704, wherein processor 701, communication interface 702, memory 703 are complete by communication bus 704 At mutual communication,
Memory 703, for storing computer program;
Processor 701 when for executing the program stored on memory 703, realizes following steps:
It obtains and is directed to each obtained transformation coefficient block of video requency frame data block to be encoded;
Each transformation coefficient in above-mentioned transformation coefficient block is compared with preset threshold respectively, will be less than above-mentioned default The transformation coefficient of threshold value replaces with 0, obtains new transformation coefficient block;
Judge whether above-mentioned new transformation coefficient block is stand growth model;
If above-mentioned new transformation coefficient block is stand growth model, of non-zero transform coefficient in the video requency frame data block is encoded Number is 0, terminates the coding to the video requency frame data block;
If above-mentioned new transformation coefficient block is not stand growth model, above-mentioned transformation coefficient block is subjected to quantification treatment, is obtained Quantization parameter block after quantization;
According to the quantization parameter block after above-mentioned quantization, entropy coding is carried out.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..For just It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easy The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit, CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal Processing, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete Door or transistor logic, discrete hardware components.
Method provided in an embodiment of the present invention can be applied to electronic equipment.Specifically, the electronic equipment can be with are as follows: desk-top Computer, portable computer, intelligent mobile terminal, server etc..It is not limited thereto, it is any that electricity of the invention may be implemented Sub- equipment, all belongs to the scope of protection of the present invention.
It can be seen that due in the embodiment of the present invention new transformation coefficient block be stand growth model when, the transformation series new to this Several piece transformation coefficient block corresponding before replacing transformation coefficient is without quantifying, and non-zero becomes in direct coding video requency frame data block The number for changing coefficient is 0, therefore reduces the quantity for carrying out the transformation coefficient block of entropy coding, and then improve coding rate.
The embodiment of the invention provides a kind of computer readable storage medium, computer journey is stored in above-mentioned storage medium Sequence, above-mentioned computer program realize following steps when being executed by processor: obtaining for each video requency frame data block to be encoded Obtained transformation coefficient block;
Each transformation coefficient in above-mentioned transformation coefficient block is compared with preset threshold respectively, will be less than above-mentioned default The transformation coefficient of threshold value replaces with 0, obtains new transformation coefficient block;
Judge whether above-mentioned new transformation coefficient block is stand growth model;
If above-mentioned new transformation coefficient block is stand growth model, of non-zero transform coefficient in the video requency frame data block is encoded Number is 0, terminates the coding to the video requency frame data block;
If above-mentioned new transformation coefficient block is not stand growth model, above-mentioned transformation coefficient block is subjected to quantification treatment, is obtained Quantization parameter block after quantization;
According to the quantization parameter block after above-mentioned quantization, entropy coding is carried out.
It can be seen that due in the embodiment of the present invention new transformation coefficient block be stand growth model when, the transformation series new to this Several piece transformation coefficient block corresponding before replacing transformation coefficient is without quantifying, and non-zero becomes in direct coding video requency frame data block The number for changing coefficient is 0, therefore reduces the quantity for carrying out the transformation coefficient block of entropy coding, and then improve coding rate.
The embodiment of the invention provides a kind of computer program products comprising instruction, when run on a computer, So that computer executes above-mentioned method for video coding step.
The embodiment of the invention provides a kind of computer programs, when run on a computer, so that computer executes Realize above-mentioned method for video coding step.
For encoder/electronic equipment/storage medium/computer program product/computer program embodiments, due to It is substantially similar to embodiment of the method, so being described relatively simple, related place is referring to the part explanation of embodiment of the method It can.
It should be noted that, in this document, 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 including 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 the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for coding For device/electronic equipment/storage medium/computer program product/computer program embodiments, since it is substantially similar to method Embodiment, so being described relatively simple, the relevent part can refer to the partial explaination of embodiments of method.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention It is interior.

Claims (16)

1. a kind of method for video coding characterized by comprising
It obtains and is directed to each obtained transformation coefficient block of video requency frame data block to be encoded;
Each transformation coefficient in the transformation coefficient block is compared with preset threshold respectively, the preset threshold will be less than Transformation coefficient replace with 0, obtain new transformation coefficient block;
Judge whether the new transformation coefficient block is stand growth model;
If the new transformation coefficient block is stand growth model, the number for encoding non-zero transform coefficient in the video requency frame data block is 0, terminate the coding to the video requency frame data block;
If the new transformation coefficient block is not stand growth model, the transformation coefficient block is subjected to quantification treatment, is quantified Quantization parameter block afterwards;
According to the quantization parameter block after the quantization, entropy coding is carried out.
2. method for video coding according to claim 1, which is characterized in that the quantization parameter according to after the quantization Block carries out entropy coding, comprising:
Whether the quantization parameter block after judging the quantization is stand growth model;
If it is determined that the quantization parameter block after the quantization is stand growth model, then non-zero amount in the quantization parameter block after encoding the quantization The number for changing coefficient is 0, terminates the coding to the video requency frame data block;
If it is determined that the quantization parameter block after the quantization is not stand growth model, then entropy volume is carried out to the quantization parameter block after the quantization Code.
3. method for video coding according to claim 1 or 2, which is characterized in that described to obtain for each to be encoded The obtained transformation coefficient block of video requency frame data block, comprising:
It for each video requency frame data block to be encoded, is predicted, obtains the corresponding residual block of video requency frame data block;
Spectrum Conversion is carried out to the corresponding residual block of the video requency frame data block, obtains the transformation coefficient block.
4. method for video coding according to claim 3, which is characterized in that
The preset threshold precalculates acquisition by following formula:
Wherein, Th (x, y) is the corresponding preset threshold of transformation coefficient in the transformation coefficient block, wherein in Th (x, y) (x, y) is that transformation coefficient is in the position in the transformation coefficient block, and when transformation coefficient block is two-dimensional matrix, x is the change The row of the transformation coefficient present position in coefficient block is changed, y is the column of the transformation coefficient present position in the transformation coefficient block, QP For preset quantization parameter, shift is shift value, and the value of shift is 29-B-M, and wherein B is video requency frame data to be encoded The pixel locating depth information of block, M are the size of the corresponding residual block of video requency frame data block, which is the residual block of N × N, M =log2N, offset are deviant, and offset value is
G={ G0,G1,G2,G3,G4,G5}={ 2-4/6,2-3/6,2-2/6,2-1/6,20,21/6, f={ f0,f1,f2,f3,f4,f5}= { 26214,23302,20560,18396,16384,14564 }, w (x, y) are the preset quantization weight factor, and factor is default Threshold factor, the value range of factor is [1,1.5].
5. method for video coding according to claim 4, which is characterized in that
It is described that the transformation coefficient block is subjected to quantification treatment, comprising:
Using the pixel locating depth information of preset quantitative information and the video requency frame data block to be encoded, to the transformation coefficient Block carries out quantification treatment.
6. method for video coding according to claim 5, which is characterized in that calculated by following formula:
After being quantified Quantization parameter block,
Wherein, Q (x, y) indicates the quantization parameter block after the quantization, and (x, y) in Q (x, y) is after coefficient is in the quantization Quantization parameter block in position, when quantization parameter block after quantization is two-dimensional matrix, x is the quantization parameter after the quantization The row of quantization parameter present position in block, y are the column of the quantization parameter present position in the quantization parameter block after the quantization, Y (x, y) is the transformation coefficient in the transformation coefficient block at position, wherein (x, y) is that transformation coefficient is in the transformation Position in coefficient block, when transformation coefficient block is two-dimensional matrix, x is the transformation coefficient present position in the transformation coefficient block Row, y is the column of the transformation coefficient present position in the transformation coefficient block, and sign (Y (x, y)) indicates the transformation coefficient block The collection of the positive and negative values of middle transformation coefficient, sign (Y (x, y)) value is combined into { -1,0,1 }.
7. method for video coding according to claim 2, which is characterized in that
Quantization parameter block after the described pair of quantization carries out entropy coding, comprising:
According to preset order, corresponding first position of first non-zero quantized coefficients of the quantization parameter block after determining each quantization It sets and corresponding second position of the last one non-zero quantized coefficients;
By the quantization parameter block after each quantization from corresponding first non-zero quantized coefficients in first position, to second position All quantization parameters between the last one corresponding non-zero quantized coefficients carry out entropy coding.
8. a kind of encoder characterized by comprising
First obtains module, is directed to each obtained transformation coefficient block of video requency frame data block to be encoded for obtaining;
Compare replacement module, for each transformation coefficient in the transformation coefficient block to be compared with preset threshold respectively, The transformation coefficient for being less than the preset threshold is replaced with 0, obtains new transformation coefficient block;
Judgment module, for judging whether the new transformation coefficient block is stand growth model;
First coding module encodes non-in the video requency frame data block if being stand growth model for the new transformation coefficient block The number of null transformation coefficient is 0, terminates the coding to the video requency frame data block;
Second acquisition module carries out the transformation coefficient block if not being stand growth model for the new transformation coefficient block Quantification treatment, the quantization parameter block after being quantified;
Second coding module, for carrying out entropy coding according to the quantization parameter block after the quantization.
9. encoder according to claim 8, which is characterized in that second coding module, for specifically including:
Judging submodule, for judging whether the quantization parameter block after the quantization is stand growth model;
First encoding submodule, for if it is determined that the quantization parameter block after the quantization is stand growth model, then after encoding the quantization Quantization parameter block in the numbers of non-zero quantized coefficients be 0, terminate to the coding of the video requency frame data block;
Second encoding submodule, for if it is determined that the quantization parameter block after the quantization is not stand growth model, then to the quantization after Quantization parameter block carry out entropy coding.
10. encoder according to claim 8 or claim 9, which is characterized in that described first obtains module, comprising:
It predicts submodule, for being directed to each video requency frame data block to be encoded, is predicted, obtain the video requency frame data The corresponding residual block of block;
Acquisition submodule obtains the transformation coefficient for carrying out Spectrum Conversion to the corresponding residual block of the video requency frame data block Block.
11. encoder according to claim 10, which is characterized in that the preset threshold is precalculated by following formula It obtains:
Wherein, Th (x, y) is the corresponding preset threshold of transformation coefficient in the transformation coefficient block, wherein in Th (x, y) (x, y) is that transformation coefficient is in the position in the transformation coefficient block, and when transformation coefficient block is two-dimensional matrix, x is the change The row of the transformation coefficient present position in coefficient block is changed, y is the column of the transformation coefficient present position in the transformation coefficient block, QP For preset quantization parameter, shift is shift value, and the value of shift is 29-B-M, and wherein B is video requency frame data to be encoded The pixel locating depth information of block, M are the size of the corresponding residual block of video requency frame data block, which is the residual block of N × N, M =log2N, offset are deviant, and offset value is
G={ G0,G1,G2,G3,G4,G5}={ 2-4/6,2-3/6,2-2/6,2-1/6,20,21/6, f={ f0,f1,f2,f3,f4,f5}= { 26214,23302,20560,18396,16384,14564 }, w (x, y) are the preset quantization weight factor, and factor is default Threshold factor, the value range of factor is [1,1.5].
12. encoder according to claim 11, which is characterized in that described second, which obtains module, is specifically used for using default Quantitative information and the video requency frame data block to be encoded pixel locating depth information, the transformation coefficient block is carried out at quantization Reason.
13. encoder according to claim 12, which is characterized in that described second, which obtains module, is specifically used for by as follows Formula calculates:
After being quantified Quantization parameter block,
Wherein, Q (x, y) indicates the quantization parameter block after the quantization, and (x, y) in Q (x, y) is after coefficient is in the quantization Quantization parameter block in position, when quantization parameter block after quantization is two-dimensional matrix, x is the quantization parameter after the quantization The row of quantization parameter present position in block, y are the column of the quantization parameter present position in the quantization parameter block after the quantization, Y (x, y) is the transformation coefficient in the transformation coefficient block at position, wherein (x, y) is that transformation coefficient is in the transformation Position in coefficient block, when transformation coefficient block is two-dimensional matrix, x is the transformation coefficient present position in the transformation coefficient block Row, y is the column of the transformation coefficient present position in the transformation coefficient block, and sign (Y (x, y)) indicates the transformation coefficient block The collection of the positive and negative values of middle transformation coefficient, sign (Y (x, y)) value is combined into { -1,0,1 }.
14. encoder according to claim 9, which is characterized in that
Second encoding submodule, is specifically used for:
According to preset order, corresponding first position of first non-zero quantized coefficients of the quantization parameter block after determining each quantization It sets and corresponding second position of the last one non-zero quantized coefficients;
By the quantization parameter block after each quantization from corresponding first non-zero quantized coefficients in first position, to second position All quantization parameters between the last one corresponding non-zero quantized coefficients carry out entropy coding.
15. a kind of electronic equipment, which is characterized in that including processor and machine readable storage medium, the machine readable storage Media storage has the machine-executable instruction that can be executed by the processor, and the processor is by the machine-executable instruction Promote: realizing method and step as claimed in claim 1 to 7.
16. a kind of computer readable storage medium, which is characterized in that computer program is stored in the storage medium, it is described Method and step as claimed in claim 1 to 7 is realized when computer program is executed by processor.
CN201711261657.3A 2017-12-04 2017-12-04 Video coding method, encoder, electronic device and medium Active CN109874012B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201711261657.3A CN109874012B (en) 2017-12-04 2017-12-04 Video coding method, encoder, electronic device and medium
PCT/CN2018/119146 WO2019109906A1 (en) 2017-12-04 2018-12-04 Video encoding method, encoder, electronic device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711261657.3A CN109874012B (en) 2017-12-04 2017-12-04 Video coding method, encoder, electronic device and medium

Publications (2)

Publication Number Publication Date
CN109874012A true CN109874012A (en) 2019-06-11
CN109874012B CN109874012B (en) 2020-09-11

Family

ID=66750052

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711261657.3A Active CN109874012B (en) 2017-12-04 2017-12-04 Video coding method, encoder, electronic device and medium

Country Status (2)

Country Link
CN (1) CN109874012B (en)
WO (1) WO2019109906A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112543338A (en) * 2020-10-16 2021-03-23 腾讯科技(深圳)有限公司 Video decoding method and device, computer readable medium and electronic equipment
WO2021135856A1 (en) * 2019-12-31 2021-07-08 腾讯科技(深圳)有限公司 Video coding method and apparatus, video decoding method and apparatus, device, and storage medium
WO2022205297A1 (en) * 2021-04-01 2022-10-06 深圳市大疆创新科技有限公司 Data processing method and device, chip, unmanned aerial vehicle, and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101193304A (en) * 2007-09-14 2008-06-04 四川虹微技术有限公司 An implementation method for quick conversion and quantification of video coding
CN103098469A (en) * 2010-07-09 2013-05-08 三星电子株式会社 Method and apparatus for entropy encoding/decoding a transform coefficient
CN103220514A (en) * 2012-01-20 2013-07-24 索尼公司 Coefficient coding harmonization in HEVC
CN103796033A (en) * 2014-01-24 2014-05-14 同济大学 Efficient video coding zero-coefficient early detection method
WO2015038510A1 (en) * 2013-09-16 2015-03-19 Magnum Semiconductor, Inc. Apparatuses and methods for adjusting coefficients using dead zones
CN104469378A (en) * 2013-09-19 2015-03-25 黑莓有限公司 Coding position data for the last non-zero transform coefficient in a coefficient group
US9247257B1 (en) * 2011-11-30 2016-01-26 Google Inc. Segmentation based entropy encoding and decoding
CN105306956A (en) * 2015-11-13 2016-02-03 浙江工商大学 Method for increasing discrete cosine transform processing speed of HEVC coder

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1770863A (en) * 2004-11-02 2006-05-10 华为技术有限公司 Method for confirming zero block pre-determination condition and zero block pre-determination method
KR100773761B1 (en) * 2006-09-14 2007-11-09 한국전자통신연구원 The apparatus and method of moving picture encoding
CN101795404A (en) * 2009-10-21 2010-08-04 深圳市融创天下科技发展有限公司 Quantized step size based zero block threshold value determination method and zero block prejudging method
CN108777790B (en) * 2010-04-13 2021-02-09 Ge视频压缩有限责任公司 Apparatus for decoding saliency map and apparatus and method for encoding saliency map
US9264724B2 (en) * 2013-10-11 2016-02-16 Blackberry Limited Sign coding for blocks with transform skipped

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101193304A (en) * 2007-09-14 2008-06-04 四川虹微技术有限公司 An implementation method for quick conversion and quantification of video coding
CN103098469A (en) * 2010-07-09 2013-05-08 三星电子株式会社 Method and apparatus for entropy encoding/decoding a transform coefficient
US9247257B1 (en) * 2011-11-30 2016-01-26 Google Inc. Segmentation based entropy encoding and decoding
CN103220514A (en) * 2012-01-20 2013-07-24 索尼公司 Coefficient coding harmonization in HEVC
WO2015038510A1 (en) * 2013-09-16 2015-03-19 Magnum Semiconductor, Inc. Apparatuses and methods for adjusting coefficients using dead zones
CN104469378A (en) * 2013-09-19 2015-03-25 黑莓有限公司 Coding position data for the last non-zero transform coefficient in a coefficient group
CN103796033A (en) * 2014-01-24 2014-05-14 同济大学 Efficient video coding zero-coefficient early detection method
CN105306956A (en) * 2015-11-13 2016-02-03 浙江工商大学 Method for increasing discrete cosine transform processing speed of HEVC coder

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
BUMSHIK LEE等: "An All-Zero Block Detection Scheme for Low-Complexity HEVC Encoders", 《IEEE TRANSACTIONS ON MULTIMEDIA》 *
HENGLU WEI等: "An efficient all zero block detection algorithm based on frequency characteristics of DCT in HEVC", 《2015 VISUAL COMMUNICATIONS AND IMAGE PROCESSING (VCIP)》 *
HONGFEI FAN等: "Hybrid Zero Block Detection for High Efficiency Video Coding", 《IEEE TRANSACTIONS ON MULTIMEDIA》 *
JING CUI等: "An Adaptive and Low-Complexity All-zero Block Detection for HEVC Encoder", 《2017 IEEE INTERNATIONAL SYMPOSIUM ON CIRCUITS AND SYSTEMS (ISCAS)》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021135856A1 (en) * 2019-12-31 2021-07-08 腾讯科技(深圳)有限公司 Video coding method and apparatus, video decoding method and apparatus, device, and storage medium
CN112543338A (en) * 2020-10-16 2021-03-23 腾讯科技(深圳)有限公司 Video decoding method and device, computer readable medium and electronic equipment
CN112543338B (en) * 2020-10-16 2022-03-04 腾讯科技(深圳)有限公司 Video decoding method and device, computer readable medium and electronic equipment
WO2022205297A1 (en) * 2021-04-01 2022-10-06 深圳市大疆创新科技有限公司 Data processing method and device, chip, unmanned aerial vehicle, and storage medium

Also Published As

Publication number Publication date
CN109874012B (en) 2020-09-11
WO2019109906A1 (en) 2019-06-13

Similar Documents

Publication Publication Date Title
CN104935943B (en) The method being decoded to intra prediction mode
CN102845060B (en) Data compression for video
CN104969552B (en) The reduced intra prediction mode decision of storage
CN100355289C (en) Adaptive variable-length coding methods for image data
CN101971631B (en) Adaptive intra mode selection
CN103200402B (en) The method for removing deblocking man-made noise
CN110235444A (en) Use the intra prediction of a plurality of reference line
CN104205845B (en) LM patterns with unified bit wide multiplier
CN109845269A (en) Image treatment method, the image-decoding using it and coding method
CN103220511A (en) Logical intra mode naming in HEVC video coding
CN103596004A (en) Intra-frame prediction method and device based on mathematical statistics and classification training in HEVC
CN103931186B (en) Picture decoding apparatus
CN104937936A (en) Mode decision simplification for intra prediction
WO2011101453A2 (en) Data compression for video
CN109218730A (en) Reference pixel reduction for LM intra prediction
CN103024383A (en) Intra-frame lossless compression coding method based on HEVC (high efficiency video coding) frame
CN102598663A (en) Method and apparatus for encoding and decoding image by using rotational transform
CN109874012A (en) A kind of method for video coding, encoder, electronic equipment and medium
CN108322745A (en) Fast selecting method in a kind of frame based on inseparable quadratic transformation pattern
CN103945220A (en) Quantized optimization method used for high-efficiency video coding
CN107277506A (en) A kind of motion vector accuracy fast selecting method and device based on adaptive motion vector precision
CN104333755B (en) The CU based on SKIP/Merge RD Cost of B frames shifts to an earlier date terminating method in HEVC
CN101202915A (en) Method and apparatus for selecting frame inner forecasting mode
CN1194544C (en) Video encoding method based on prediction time and space domain conerent movement vectors
CN104488268B (en) Spatial prediction with increased number of possible coding mode

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