[go: up one dir, main page]

CN109618160A - A kind of method for video coding calculated based on motion information and residual information - Google Patents

A kind of method for video coding calculated based on motion information and residual information Download PDF

Info

Publication number
CN109618160A
CN109618160A CN201811336152.3A CN201811336152A CN109618160A CN 109618160 A CN109618160 A CN 109618160A CN 201811336152 A CN201811336152 A CN 201811336152A CN 109618160 A CN109618160 A CN 109618160A
Authority
CN
China
Prior art keywords
encoded
video frame
resolution
frame
information
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.)
Pending
Application number
CN201811336152.3A
Other languages
Chinese (zh)
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.)
Jianhu Yunfei Data Technology Co Ltd
Original Assignee
Jianhu Yunfei Data 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 Jianhu Yunfei Data Technology Co Ltd filed Critical Jianhu Yunfei Data Technology Co Ltd
Priority to CN201811336152.3A priority Critical patent/CN109618160A/en
Publication of CN109618160A publication Critical patent/CN109618160A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • H04N19/137Motion inside a coding unit, e.g. average field, frame or block difference
    • H04N19/139Analysis of motion vectors, e.g. their magnitude, direction, variance or reliability
    • 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/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • 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
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/513Processing of motion vectors
    • H04N19/517Processing of motion vectors by encoding
    • H04N19/52Processing of motion vectors by encoding by predictive encoding

Landscapes

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

Abstract

This application involves a kind of method for video coding calculated based on motion information and residual information, using the present invention when to being encoded there are the encoded video frame of different resolution situation, under the target resolution represented by the target motion vectors resolution information determined according to resolution ratio configuration information, the corresponding target motion vectors of each block to be encoded and predicted motion vector in video frame to be encoded are determined, to improve the accuracy of coding.

Description

A kind of method for video coding calculated based on motion information and residual information
Technical field
The present invention relates to technical field of video compression more particularly to a kind of views calculated based on motion information and residual information Frequency coding method.
Background technique
Traditional encoder without distinguishing encodes video frame, in fact it could happen that certain scene videos are ropy to ask Topic, when encoding without distinction for all video frames, there are the ropy situations of partial video frame.
Summary of the invention
The embodiment of the invention provides a kind of method for video coding calculated based on motion information and residual information, including such as Lower step:
Obtain original video frame;
Obtain the corresponding behavior pattern of the original video frame;
The original video frame is handled according to the behavior pattern, obtains video frame to be encoded;
According to the resolution ratio configuration information of the video frame to be encoded, target motion vectors resolution information is determined;
According to the target motion vectors resolution information, determine that each block to be encoded is corresponding in video frame to be encoded Target motion vectors: it under the current resolution in the video frame to be encoded, determines in the video frame to be encoded respectively wait compile The corresponding initial motion vectors of code block;It is described to be encoded when handling to obtain using down-sampling behavior pattern by original video frame When video frame, according to the current resolution information of the video frame to be encoded and the target motion vectors resolution information, really Fixed first vector median filters parameter;According to the first vector median filters parameter, the initial motion vectors are transformed in the mesh Mark the target motion vectors under resolution ratio;
In encoding the video frame to be encoded when each block to be encoded, for current block to be encoded, determine it is described currently to Reference frame where reference block corresponding to encoding block;In the reference frame, the determining and current block to be encoded picture position Corresponding image block;Obtain described image block corresponding to and the target motion vectors under the target resolution, as institute State the predicted motion vector of current block to be encoded;
According to the motion residuals between each target motion vectors and corresponding predicted motion vector, coded data is obtained.
A kind of method for video coding calculated based on motion information and residual information provided in an embodiment of the present invention, to depositing When the encoded video frame of different resolution situation is encoded, in the target motion vectors determined according to resolution ratio configuration information Under target resolution represented by resolution information, each corresponding target movement of block to be encoded in video frame to be encoded is determined Vector sum predicted motion vector, to improve the accuracy of coding.
Specific embodiment
It is main to wrap the embodiment of the invention provides a kind of method for video coding calculated based on motion information and residual information Include following steps:
Step 1, video frame to be encoded is obtained.
Wherein, video frame to be encoded is that the original video frame by inputting is handled to obtain according to corresponding behavior pattern. Different video frames to be encoded have that resolution ratio is different, indicate that the resolution ratio of different video frames to be encoded can be identical It can also be different.For example, including original video frame A and original video frame B in video sequence, wherein original video frame A and original Video frame B may be handled according to different behavior patterns, and therefore, original video frame A and original video frame B are corresponding The resolution ratio of video frame to be encoded may be different.
Video frame is to constitute the unit of video.The corresponding one or more sequence of frames of video of one video.One video sequence It may include multiple original video frames.Original video frame can be the video frame acquired in real time, such as can be through terminal The video frame that camera obtains in real time is also possible to the corresponding video frame of pre-stored video sequence.Original video frame can be with It is I frame, P frame or B frame, wherein I frame is intra prediction frame, and P frame is forward predicted frame, and B frame is bi-directional predicted frames, P frame and B frame Each encoding block can be encoded using intra prediction mode or using inter-prediction mode.
When video frame to be encoded is directly the original video frame of input, if the resolution ratio one of each original video frame of input It causes, then the resolution ratio of video frames to be encoded different at this time is identical;If there are resolution ratio differences for each original video frame of input The case where, then the situation that video frames to be encoded different at this time is different there is also resolution ratio.
The video obtained after video frame to be encoded is handled by certain behavior pattern the original video frame of input When frame, since the behavior pattern to original video frame is possible different (such as different oversampling ratios etc.), then what processing obtained The video frame to be encoded situation different there is also resolution ratio.For example, the resolution ratio of original video frame is 800*800 pixel, work as row When for mode be horizontal and vertical direction carries out 1/2 down-sampling, the resolution ratio that down-sampling obtains video frame to be encoded is 400*400 pixel;When behavior pattern is that horizontal and vertical direction carries out 1/4 down-sampling, down-sampling obtains view to be encoded The resolution ratio of frequency frame is 200*200 pixel.In this way, the resolution ratio for the video frame to be processed that processing obtains is different.Wherein, using than The ratio that example obtains for the resolution ratio after sampling divided by the resolution ratio before sampling.When down-sampling, oversampling ratio is less than 1, up-sampling When oversampling ratio be greater than 1, when oversampling ratio be 1 when, do not change resolution ratio.It is appreciated that Video coding includes a circulation Process.After getting frame video frame to be encoded and encoding and obtain the coded data of the video frame to be encoded, continue to obtain new Frame video frame to be encoded encoded, until completing coding to all video frame to be encoded.Wherein, computer equipment exists It, can multiframe video frame parallel encoding to be encoded when treating encoded video frame and being encoded.
It also include the process of a circulation when being encoded to frame video frame to be encoded.To the video to be encoded After a block to be encoded in frame completes coding, continue to encode next block to be encoded, until to the video to be encoded All blocks to be encoded of frame, which encode, to be completed.Wherein, computer equipment, can multiple blocks to be encoded when encoding to block to be encoded Parallel encoding.
Step 2, according to the resolution ratio configuration information of video frame to be encoded, target motion vectors resolution information is determined.Point Resolution information is data relevant to resolution ratio.Resolution information specifically can be resolution ratio itself or oversampling ratio etc..Point Resolution configuration information is information that is preconfigured and being used to indicate the resolution ratio of required use when processing motion vector.It can To understand, the resolution information sheet of resolution ratio configuration information required use when can directly be the processing motion vector of configuration Body is also possible to the resolution information method of determination of configuration.Resolution information method of determination, when for determining processing motion vector The classification of used resolution information handles motion vector for determining the resolution information using which kind of classification.
The classification of used resolution information when handling motion vector, can be this classification of original resolution information or This classification of current resolution information.It is appreciated that original resolution information is the resolution information of original video frame.Current point Resolution information is the resolution information of current video frame to be encoded.It is appreciated that working as determined by resolution information method of determination When the classification of resolution information is original resolution information, then it can be differentiated original resolution information as target motion vectors Rate information.It, then can be with when the classification of the resolution information determined by the resolution information method of determination is current resolution information Using the current resolution information of video frame to be encoded as target motion vectors resolution information.
Since each video frame to be encoded has that resolution ratio is different, so current resolution and revocable resolution Rate, it is different to be encoded when the classification of the resolution information determined by the resolution information method of determination is current resolution information For video frame according to corresponding resolution information method of determination, identified target motion vectors resolution information can be different.
It can be for for frame level configuration resolution ratio configuration information;It can also be for group grade (i.e. this level of video frame group) configuration point Resolution configuration information can also configure resolution ratio configuration information for sequence-level (i.e. this level of video sequence).For example, Assuming that for group grade configure a resolution ratio configuration information, then for corresponding to the original video frame under a certain video frame group wait compile For code video frame, resolution ratio configuration information corresponding to each video frame to be encoded is corresponding point configured of the video frame group Resolution configuration information.
Resolution ratio configuration information is corresponding with target motion vectors resolution information.Target motion vectors resolution information can be with It is the original resolution information of original video frame, is also possible to the current resolution information of video frame to be encoded.Original resolution Information is data relevant to the original resolution of original video frame.Current resolution information is worked as with video frame to be encoded The relevant data of preceding resolution ratio, for indicating the current resolution of video frame to be encoded.Therefore, computer equipment can configure use Using the resolution ratio configuration information of original resolution information when instruction handles motion vector, instruction processing also may be configured to Using the resolution ratio configuration information of current resolution information when motion vector.
Step 3, it under the target resolution represented by target motion vectors resolution information, determines in video frame to be encoded Each corresponding target motion vectors of block to be encoded.
Motion vector is displacement of the block to be encoded relative to the reference block of the block to be encoded in Video coding.Block to be encoded Reference block is the data to be referred to when encoding to block to be encoded.Motion vector is used to be decoded treating decoding block When find to be decoded piece of the reference block, to rebuild to be decoded piece.Target motion vectors are the movement under target resolution Vector.
Resolution ratio corresponding to motion vector indicates resolution ratio corresponding to the unit of motion vector.
Reference frame in video frame to be encoded where the reference block of each block to be encoded, according to type of prediction it is different without Together.Video frame to be encoded can be I frame, P frame or B frame.Wherein I frame is intra prediction frame, and P frame is forward predicted frame, and B frame is Bi-directional predicted frames.So, reference frame where the reference block of each block to be encoded can be this video frame, forward reference frame, backward reference Frame or bi-directionally referenced frame.The quantity of reference frame can be one or more.Reference frame is to treat encoded video frame to be encoded when institute The video frame that need to be referred to.It will be understood by those skilled in the art that reference frame encoded obtained volume before being video frame to be encoded The video frame that code data are rebuild.
For the block to be encoded in a certain video frame to be encoded, the reference block of the block to be encoded is searched on reference frame It afterwards, can direct target resolution represented by the target motion vectors resolution information corresponding to resolution ratio configuration information Under, target motion vectors are calculated, the movement arrow of block to be encoded can also be calculated under the current resolution of the video frame to be encoded Amount.If calculating the motion vector of block to be encoded under the current resolution of the video frame to be encoded, computer equipment can By target resolution represented by target motion vectors resolution information, it is compared with the resolution ratio of video frame to be encoded.When When the two is consistent, then the motion vector under the resolution ratio of video frame to be encoded, the target as under target resolution move Vector;When the two is inconsistent, computer equipment then by the motion vector under the resolution ratio of video frame to be encoded, is transformed to Target motion vectors under target resolution.
Step 4, obtain that each block to be encoded is corresponding and predicted motion vector under target resolution.
Wherein, predicted motion vector is the motion vector of prediction.When treating encoded video frame and being encoded, directly treat The motion vector of each block to be encoded is encoded in encoded video frame, and data volume is larger.In order to reduce the data volume of coded data (bit number), the motion vector that can treat each block to be encoded in encoded video frame are predicted, the prediction of each encoding block is obtained Motion vector, so that the difference of motion vector and predicted motion vector directly to each block to be encoded encodes.
In an embodiment of the present invention, the calculation of predicted motion vector is not limited.Computer equipment can be using The motion vector of encoding block carrys out operation and obtains the prediction vectors of block to be encoded.For example, can be by current block to be encoded The corresponding motion vector of multiple adjacent coded blocks mean value, the predicted motion vector as current block to be encoded;Alternatively, can With by reference frame with the motion vector of current block to be encoded corresponding image block on picture position, as current block to be encoded Predicted motion vector etc..
Resolution ratio corresponding to the motion vector of coded block is then mesh represented by target motion vectors resolution information Mark resolution ratio.So, since predicted motion vector be obtained by the motion vector of coded block come operation, so, prediction Target resolution represented by resolution ratio corresponding to motion vector and target motion vectors resolution information.
Under one group of video frame to be encoded or frame video frame to be encoded, the target of each block to be encoded of coding is moved Vector and predicted motion vector carry out operation to target motion vectors and predicted motion vector again at this time under unified resolution ratio When, operation result corresponding to each block to be encoded also under unified resolution ratio, the encoder of computer equipment to respectively to It, will not be because of the resolution ratio of operation result corresponding to different blocks to be encoded when operation result corresponding to encoding block is encoded Difference needs the parameter for frequently adjusting encoder to influence coding quality, and code efficiency can be improved.
Encoder needs to adjust the parameter of encoder when encoding to the data under different resolution ratio.Different The video frame to be encoded has that resolution ratio is different, and the different blocks to be encoded of video frame to be encoded for same frame The data situation different there is also resolution ratio for coding.Therefore, one frame of one group of video frame group or coding can encoded When video frame, a target motion vectors resolution information can be specified by resolution ratio configuration information, the number that will be used to encode According under unification to target resolution represented by the target motion vectors resolution information, it can not only guarantee coding quality, but also can To improve code efficiency.
Step 5, according to the motion residuals between each target motion vectors and corresponding predicted motion vector, coded number is obtained According to.
Wherein, motion residuals are the differences of motion vector and predicted motion vector.Specifically, computer equipment can be to current Each block to be encoded in video frame to be encoded, target motion vectors and predicted motion vector meter all in accordance with each block to be encoded Motion residuals are calculated, then the motion residuals of each block to be encoded are encoded to obtain coded data.Here cataloged procedure can be with Including at least one of transformation, quantization and entropy coding.
The above-mentioned method for video coding calculated based on motion information and residual information, to there are different resolution situations When encoded video frame is encoded, represented by the target motion vectors resolution information determined according to resolution ratio configuration information Under target resolution, the corresponding target motion vectors of each block to be encoded and predicted motion arrow in video frame to be encoded are determined Amount, so, according to the target motion vectors under same resolution ratio and the motion residuals between corresponding predicted motion vector, obtains The coded data arrived is more accurate, to improve coding quality.Moreover, according to the target motion vectors under same resolution ratio The coded data that motion residuals between corresponding predicted motion vector obtain, reduces the data volume of coded data.In addition, logical The method for video coding calculated based on motion information and residual information is crossed, can be realized the video to be encoded to different resolution The coded treatment of frame improves the flexibility of coding.
It can also not have to be pre-configured with resolution ratio configuration information corresponding with video frame to be encoded, but one can be preset Or multiple motion vector resolution informations choose target motion vectors resolution ratio from preset motion vector resolution information Information determines video frame to be encoded then under the target resolution represented by the target motion vectors resolution information chosen In each corresponding target motion vectors of block to be encoded.It is respectively right that computer equipment can continue to execute each block to be encoded of acquisition Predicted motion vector answer and under target resolution;And it is sweared according to each target motion vectors and corresponding predicted motion Motion residuals between amount, the step of obtaining the coded data of video frame to be encoded.Wherein, coded data includes indicating that target is differentiated The identification information of rate.It is appreciated that the identification information can inform decoding end used target when coding side is encoded Resolution ratio.
Specifically, step 1 specifically includes: obtaining original video frame;Obtain the corresponding behavior pattern of original video frame;According to Behavior pattern handles original video frame, obtains video frame to be encoded;Behavior pattern is full resolution behavior pattern or adopts Sample behavior pattern.
Wherein, the corresponding behavior pattern of original video frame is chosen from candidate behavior pattern, candidate behavior mould Formula includes at least one of full resolution behavior pattern and sampling behavior pattern.Sampling behavior pattern includes down-sampling behavior mould Formula and up-sampling behavior pattern.
It, then can be by original video frame directly as video to be encoded when behavior pattern is full resolution behavior pattern Frame.When behavior pattern is down-sampling behavior pattern, then down-sampling processing can be carried out to original video frame, obtain view to be encoded Frequency frame.It is smaller than the resolution ratio of original video frame using the resolution ratio for the video frame to be encoded that down-sampling behavior pattern obtains.
The method for obtaining the corresponding behavior pattern of original video frame can be set according to actual needs.For example, it may be obtaining The corresponding processing parameter of original video frame is taken, corresponding behavior pattern is obtained according to processing parameter.Processing parameter is for determining The parameter of behavior pattern, the behavior pattern specifically used, which can according to need, to be configured.In one embodiment, processing parameter It may include according to the corresponding present encoding information of original video frame of input and at least one of characteristics of image.
The ratio of down-sampling can be according to executing setting for the method for video coding calculated with residual information based on motion information The standby processor ability such as terminal or server obtains.The corresponding down-sampling ratio of the strong equipment of processor processing capacity is big, The corresponding down-sampling ratio of the weak equipment of processor processing capacity is small.Processor processing capacity and down-sampling ratio can be set Corresponding relationship, when being encoded, obtain processor processing capacity, according to processor processing capacity obtain it is corresponding under adopt Sample ratio.For example, it is the corresponding down-sampling ratio of 1/8,32 bit processors that the corresponding down-sampling ratio of 16 bit processors, which can be set, Example is 1/4.
The ratio of down-sampling can be obtained according to original video frame as the frequency or number of reference frame, can be set down Oversampling ratio and original video frame are as the frequency of reference frame or the corresponding relationship of number.Wherein, original video frame is as ginseng The frequency for examining frame is high or often, then down-sampling ratio is big.Original video frame is low as the frequency of reference frame or number is few, Then down-sampling ratio is small.For example, the frequency as reference frame is high, then corresponding down-sampling ratio is big for I frame, it can be 1/ 2.For P frame, the frequency as reference frame is low, then corresponding down-sampling ratio is small, such as can be 1/4.By according to original Video frame obtains down-sampling ratio as the frequency or number of reference frame, when original video frame as the frequency of reference frame it is high or Person often when, picture quality is preferable, therefore can be improved the accuracy predicted, reduce pixel residual error, improve code pattern The quality of picture.
The method of down-sampling can be according to executing setting for the method for video coding calculated with residual information based on motion information The standby processor ability such as terminal or server obtains.The equipment corresponding Downsapling method strong for processor processing capacity Complexity is high, and the corresponding Downsapling method complexity of the weak equipment of processor processing capacity is low.Processor processing energy can be set The corresponding relationship of power and Downsapling method obtains processor processing capacity when being encoded, and handles energy according to processor Power obtains corresponding Downsapling method.
When being handled using down-sampling behavior pattern original video frame, can also according to different Downsapling method or under adopt Sample ratio carries out down-sampling, is handled original video frame more flexible.
It can be obtained according at least one of the corresponding present encoding information of original video frame and image feature information The corresponding behavior pattern of original video frame.Present encoding information refers to the video compress parameter information that video is obtained in coding, It is one or more such as frame type, motion vector, quantization parameter, source video sequence, code rate, frame per second and resolution ratio.Characteristics of image Information refers to information relevant to picture material, one or more including image motion information and image texture information, such as Edge etc..Present encoding information and image feature information reflect the corresponding scene of video frame, details complexity or movement Severe degree etc., such as moving scene can determine whether by the one or more in motion vector, quantization parameter or code rate, quantify Parameter then general motion intense greatly, then representative image scene is big moving scene to motion vector greatly.Can also according to encoded I frame with The code rate ratio in judgement of P frame or encoded I frame and B frame is judged as static image if ratio is more than the first preset threshold, If ratio less than the second preset threshold, can determine whether as motion intense image.Or target pair is directly tracked according to picture material As being determined whether according to the movement velocity of target object for big moving scene.The information content that code rate one can periodically express is certain, right In the scene of motion intense, time domain information amount is big, and the code rate that can be used for expression of space domain information accordingly is just few, therefore uses Low resolution can reach preferable picture quality effect, be more likely to selection down-sampling mode and encoded.Class is predicted by frame Type can determine screen switching scene, can also influence the determining behavior pattern tended to other frames according to frame type of prediction.Such as I Frame or there are screen switching headed by frame is general, the quality of I frame affects the quality of subsequent P frame or B frame, so intra prediction frame phase Than being more likely to selection full resolution behavior pattern in MB of prediction frame, to guarantee picture quality.Because P frame can be used as B frame Reference frame, P frame image quality affect the picture quality of subsequent B frame, so compared to using B frame if using P frame coding Coding is more likely to selection full resolution behavior pattern.View to be encoded is determined by image feature information, such as image texture information The Texture complication of frequency frame, if texture is complicated, the details for including is more, then image spatial information (si) is more, can if carrying out down-sampling More detailed information can be lost due to down-sampling, video quality be influenced, so the video frame to be encoded of texture complexity is compared to line It manages simple video frame to be encoded and is more likely to selection full resolution processing.
Original can be obtained according to the size relation of the corresponding current quantisation parameter of original video frame and quantization parameter threshold value The corresponding resolution ratio of beginning video frame.If current quantisation parameter is greater than quantization parameter threshold value, it is determined that behavior pattern is down-sampling Otherwise behavior pattern determines that behavior pattern is full resolution behavior pattern.Quantization parameter threshold value can be according in original video frame Before, the ratio of the Intra-coded blocks of encoded forward coding video frame obtains, and can preset intra-frame prediction block ratio It can be closed according to corresponding with the corresponding relationship of quantization parameter threshold value thus after the intra-frame prediction block ratio of present frame has been determined System determines quantization parameter threshold value corresponding with the intra-frame prediction block ratio of present frame.Fixed quantisation parameter is encoded, it is current to measure Changing parameter can be corresponding fixed quantisation parameter value.Cbr (constant bit rate) is encoded, then can be calculated according to code rate Controlling model Obtain the corresponding current quantisation parameter of original video frame.Alternatively, can be using the corresponding quantization parameter of reference frame as original video The corresponding current quantisation parameter of frame.In the embodiment of the present invention, the more big general movement of current quantisation parameter is more violent, acute for movement Strong scene is more likely to selection down-sampling behavior pattern.
The relationship of intra-frame prediction block ratio and quantization parameter threshold value is positive correlation.For example, can rule of thumb, in advance Determine the corresponding relationship of intra-frame prediction block ratio Intra0 Yu quantization parameter threshold value QPTH are as follows:
After obtaining the corresponding behavior pattern of original video frame, can according to behavior pattern to original video frame at Reason, obtains video frame to be encoded, by the behavior pattern of flexible choice video frame, handles original video frame, reduces former The resolution ratio of beginning video frame is to reduce the data volumes of data to be encoded.
In one embodiment, this method further include: the corresponding behavior pattern information of behavior pattern is added to original view In the corresponding coded data of frequency frame.
Behavior pattern information can be added in coded data and retouch for describing behavior pattern used by original video frame State the flag bit of behavior pattern.The value of the corresponding flag bit of each behavior pattern can according to need setting.For example, working as behavior mould When formula is full resolution behavior pattern, corresponding flag bit can be 0, corresponding when behavior pattern is down-sampling behavior pattern Flag bit can be 1.In one embodiment, behavior pattern information is added in the corresponding frame level head information of coded data.
The down-sampling behavior pattern information that down-sampling is carried out to original video frame can also be added to original video frame pair In the coded data answered, so that decoding end is when getting coded data, it can be according to down-sampling behavior pattern acquisition of information pair The method that reconstruction video frame is up-sampled and up-sampling ratio answered.Down-sampling behavior pattern information includes down-sampling side At least one of method information and down-sampling percent information.Downsapling method information can be in the point of addition of coded data One in corresponding group of grade head information, sequence-level head information and frame level head information, Downsapling method information is in coded data Point of addition can be determined according to the corresponding sphere of action of Downsapling method.Addition of the down-sampling percent information in coded data Position can be any of corresponding group of grade head information, sequence-level head information and frame level head information.Down-sampling ratio letter The point of addition ceased in coded data can determine that sphere of action refers to applicable according to the corresponding sphere of action of down-sampling ratio Range.For example, if the range of down-sampling proportional action is a video group, it can be by the corresponding down-sampling ratio of the video group Example information is added in the corresponding head information of the video group.If the range of down-sampling proportional action is video sequence, adopted by under Sample percent information is added to the corresponding sequence-level head information of the video sequence, under indicating that each video frame of the video sequence uses The corresponding down-sampling ratio of oversampling ratio information carries out down-sampling processing.
Under the target resolution represented by target motion vectors resolution information, determine in video frame to be encoded respectively wait compile The corresponding target motion vectors of code block include: to determine video frame to be encoded under the current resolution of video frame to be encoded In each corresponding initial motion vectors of block to be encoded;Represented by current resolution and target motion vectors resolution information Target resolution it is inconsistent when, initial motion vectors are transformed to the target motion vectors under target resolution.Wherein, to The initial motion vectors of encoding block are the motion vectors under the current resolution of video frame to be encoded where the block to be encoded.
For the block to be encoded in a certain video frame to be encoded, the reference block of the block to be encoded is searched on reference frame Afterwards, target movement arrow can be calculated directly under the target resolution represented by the target motion vectors resolution information chosen Amount, can also calculate the motion vector of block to be encoded under the current resolution of the video frame to be encoded.If to be encoded at this The motion vector of block to be encoded is calculated under the current resolution of video frame, the unit for the motion vector being calculated at this time is corresponding Resolution ratio is the current resolution of the video frame to be encoded, and the motion vector being calculated at this time is initial motion vectors.
It can be by the current resolution of target resolution represented by target motion vectors resolution information and video frame to be encoded Rate is compared, and when two resolution ratio are consistent, then the corresponding resolution ratio of the unit of initial motion vectors is target resolution, Also there is no need to convert to initial motion vectors.
Target resolution represented by target motion vectors resolution information is original video corresponding to video frame to be encoded The original resolution of frame.When current resolution and target resolution represented by target motion vectors resolution information are inconsistent When, it includes: under being used by original video frame that initial motion vectors, which are transformed to the target motion vectors under target resolution, When sampling behavior pattern handles to obtain video frame to be encoded, then by the corresponding initial motion of each encoding block of video frame to be encoded Vector is the target motion vectors under original resolution.
The video frame to be encoded that original video frame uses down-sampling behavior pattern to handle, current resolution are less than original The original resolution (i.e. the two is inconsistent) of beginning video frame, so, when target resolution is original resolution, it is necessary to treat The initial motion vectors of encoded video frame are converted, by the corresponding initial motion vectors of each encoding block of video frame to be encoded The target motion vectors being transformed under original resolution.
When current resolution and target resolution are inconsistent, initial motion vectors are transformed under target resolution Target motion vectors include: the current resolution information and target motion vectors resolution information according to video frame to be encoded, really Fixed first vector median filters parameter;According to the first vector median filters parameter, initial motion vectors are transformed under target resolution Target motion vectors.
Vector median filters parameter is for converting motion vector.After obtaining initial motion vectors, will can initially it transport Dynamic vector is multiplied with the first vector median filters parameter, and obtained product is target motion vectors.
Since resolution information can be resolution ratio or the two kinds of data of oversampling ratio, then the first vector median filters Parameter specifically may is that the target motion vectors resolution information under same type, the current resolution with video frame to be encoded The ratio of information.It is appreciated that same type, refers to the type and video frame to be encoded of target motion vectors resolution information The type of current resolution information is identical, for example, just belonging to same type, if the two one is if both resolution ratio Resolution ratio is not belonging to same type as soon as being down-sampling ratio.
First vector median filters parameter may include two: the vector median filters parameter of horizontal direction and the vector of vertical direction Conversion parameter.For example, target motion vectors resolution information is resolution ratio, and specially 900*900, video frame to be encoded are worked as Preceding resolution information is resolution ratio, and specially 450*600.Then the vector median filters parameter of horizontal direction is 900/450=2, is hung down Histogram to vector median filters parameter be 900/600=1.5.
The current resolution of the target resolution represented by target motion vectors resolution information and video frame to be encoded It is inconsistent, the initial motion vectors under current resolution are adjusted under target resolution, in subsequent calculating motion residuals, It is unified to arrive under identical resolution ratio with another parameter for calculating motion residuals, that is, predicted motion vector, to guarantee to transport The accuracy of dynamic residual error and the data volume of control motion residuals.
Obtain that each block to be encoded is corresponding and predicted motion vector under target resolution include: coding to In encoded video frame when each block to be encoded, then for current block to be encoded, the place of reference block corresponding to current block to be encoded is determined Reference frame;In reference frame, determination corresponding image block on picture position with current block to be encoded;It is right to obtain image block institute Target motion vectors answering and under target resolution, the predicted motion vector as current block to be encoded.
Reference frame is the video frame for treating required reference when encoded video frame is encoded.It is appreciated that reference frame be to The video frame that encoded obtained coded data is rebuild before encoded video frame.The reference frame of video frame to be encoded can To be one or more.
Computer equipment is according to preset reference frame Selection Strategy, can be after the reference frame for choosing video frame to be encoded When treating that each block to be encoded is encoded in encoded video frame with reference to the reference frame, for current block to be encoded, in reference frame Search and the matched reference block of current block to be encoded.It is searching with after the matched reference block of current block to be encoded, is then determining Reference frame where the reference block.
Corresponding image block, acquisition on picture position with current block to be encoded can be determined in the determining reference frame Target motion vectors corresponding to the image block and under target resolution, the predicted motion as current block to be encoded are sweared Amount.Picture position correspondence specifically can be image pixel correspondence or image coordinate is corresponding.
The video frame that encoded obtained coded data is rebuild before being video frame to be encoded due to reference frame, If so rebuilding in the coded data of the reference frame there are motion vector under target resolution and corresponding with the image block, Namely target motion vectors when, can directly acquire the target motion vectors as current block to be encoded predicted motion swear Amount;If rebuilding in the coded data of the reference frame, there is no motion vectors under target resolution and corresponding with the image block When, then it is the target under target resolution by motion vector transform corresponding with the image block in the data for rebuilding the reference frame Motion vector.
It rebuilds corresponding with the presence or absence of under target resolution and with reference frame image block in the coded data of reference frame Motion vector, it is related with target motion vectors resolution information selected when the coded data of the coding and rebuilding reference frame.When The target motion vectors resolution information chosen when the coded data of the coding and rebuilding reference frame is moved with the target currently chosen When vector resolution information indicates identical target resolution, then rebuild in the coded data of reference frame that there are target resolutions Under and the corresponding motion vector of image block with reference frame;The mesh chosen when the coded data of the coding and rebuilding reference frame Marking motion vector resolution information indicates different target resolutions from the target motion vectors resolution information currently chosen When, then rebuild in the coded data of reference frame that there is no the corresponding movements of under target resolution and with reference frame image block Vector.
Resolution ratio represented by target motion vectors resolution information is the current resolution of video frame to be encoded.It obtains Target motion vectors corresponding to image block and under target resolution, as the predicted motion vector of current block to be encoded, It include: the initial motion vectors for obtaining image block under the resolution ratio of reference frame;When the resolution ratio and current resolution of reference frame When inconsistent, then the initial motion vectors of image block are transformed to after the target motion vectors under current resolution, as working as The predicted motion vector of preceding block to be encoded.
The video frame that encoded obtained coded data is rebuild before being video frame to be encoded due to reference frame. Coded by the coded data for rebuilding reference frame from and for the preceding video frame to be encoded of coding, in coding, also can According to the resolution ratio configuration information of video frame to be encoded, target motion vectors resolution information is determined.
The initial motion vectors of image block are transformed to after the target motion vectors under current resolution, as currently to The predicted motion vector of encoding block includes: the resolution information and target motion vectors resolution information according to reference frame, is obtained Second vector median filters parameter;According to the second vector median filters parameter, the initial motion vectors of image block are transformed in current resolution Target motion vectors under rate.
Second vector median filters parameter, can be between the resolution information of reference frame and target motion vectors resolution information Ratio.The resolution information of reference frame is used to indicate the resolution ratio of reference frame.
According to the second vector median filters parameter, the initial motion vectors of image block are transformed to the target under current resolution Motion vector, using the target motion vectors obtained after transformation as the predicted motion vector of current block to be encoded.
In the predicted motion arrow of the block to be encoded using the motion vector of the image block in reference frame as current frame to be encoded When amount, according to the resolution ratio of reference frame and the target resolution chosen for current frame to be encoded, come block to be encoded flexibly Predicted motion vector is adjusted to resolution ratio identical with the motion vector of block to be encoded, to improve coding quality, control coding Data volume.
Obtaining the corresponding behavior pattern of original video frame includes: to obtain the corresponding processing parameter of original video frame, according to place Reason parameter determines the corresponding behavior pattern of original video frame;The corresponding behavior pattern information of behavior pattern is added to original video It include: when cannot be reappeared in decoding process when processing parameter, by the corresponding behavior of behavior pattern in the corresponding coded data of frame Pattern information is added in the corresponding coded data of original video frame.
Processing parameter may include in the corresponding image coding information of original video frame and image feature information at least One.Processing parameter cannot reappear in decoding process to be referred to and cannot obtain or will not generate the processing during decoded Parameter.For example, if processing parameter is information corresponding with the picture material of original video frame, and image is believed in an encoding process For breath in the presence of loss, then there are difference with original video frame for the decoding video frame of decoding end, therefore, will not obtain in decoding process To the corresponding information of picture material of original video frame, i.e. the corresponding information of picture material cannot reappear in decoding process.It compiles It needs to calculate rate distortion costs during code, and does not calculate rate distortion costs in decoding process, then when processing parameter includes that rate is lost When true cost, then the processing parameter cannot reappear in decoding process.
When processing parameter can reappear in decoding end, the corresponding behavior pattern information of behavior pattern can be added to In the corresponding coded data of original video frame, the corresponding behavior pattern information of behavior pattern can not also be added to original video In the corresponding coded data of frame.Wherein, the corresponding behavior pattern information of behavior pattern is added to the corresponding volume of original video frame When in code data, decoding end can read behavior pattern information from coded data, no longer need to obtain behavior according to processing data Mode.When the corresponding behavior pattern information of behavior pattern not being added in the corresponding coded data of original video frame, by solving Decoding apparatus is determined and the consistent behavior pattern of coding side according to processing parameter, it is possible to reduce the data volume of coded data.
Under the resolution ratio of video frame to be encoded, treats encoded video frame and encoded to obtain the corresponding volume of original video frame The step for code data further include: obtain the corresponding reference frame of video frame to be encoded;Under the resolution ratio of video frame to be encoded, root Encoded video frame is treated according to reference frame to be encoded, and the corresponding coded data of original video frame is obtained.
The reference frame video frame that encoded obtained data are rebuild before being video frame to be encoded.View to be encoded The number of the corresponding reference frame of frequency frame can be one or more.Such as when video frame to be encoded is P frame, then corresponding reference frame can Think 1.When video frame to be encoded is B frame, then corresponding reference frame can be 2.The corresponding reference frame of video frame to be encoded It can be and obtained according to referring-to relation, referring-to relation is determined according to each video encoding and decoding standard.
Obtain the corresponding reference frame of video frame to be encoded include: obtain first with reference to rule, first with reference to rule include to The resolution sizes relationship of encoded video frame and reference frame;According to first with reference to the corresponding reference of Rule video frame to be encoded Frame.
First has determined the resolution sizes restriction relation of video frame to be encoded and reference frame, resolution sizes with reference to rule Relationship includes the video frame to be encoded at least one identical and different as the resolution ratio of reference frame.When the first reference rule includes When video frame to be encoded is identical as the resolution ratio of reference frame, the first reference rule can also include video frame to be encoded and reference frame Resolution ratio behavior pattern with reference to rule.Behavior pattern may include the full video to be encoded for differentiating behavior pattern with reference to rule Frame refers to down-sampling behavior with reference to the reference frame of full resolution behavior pattern and the video frame to be encoded of down-sampling behavior pattern The one or two of the reference frame of mode.When the first resolution ratio with reference to rule including video frame to be encoded and reference frame is not identical When, first can also resolution ratio of the resolution ratio including video frame to be encoded greater than reference frame and video to be encoded with reference to rule The resolution ratio of frame is less than the one or two of the resolution ratio of reference frame.
First can specifically include original resolution video frame to be encoded with reference to rule can join with reference to down-sampling resolution ratio Original resolution reference frame, original resolution video frame to be encoded can be referred to by examining frame, down-sampling resolution ratio video frame to be encoded The ginseng of down-sampling resolution ratio can be referred to reference to original resolution reference frame and down-sampling resolution ratio video frame to be encoded Examine one of frame or a variety of.Wherein, original resolution video frame to be encoded, refer to the video frame to be encoded resolution ratio and its The resolution ratio of corresponding original video frame is identical.Original resolution reference frame refers to that the resolution ratio of the reference frame is corresponding The resolution ratio of original video frame is identical.Down-sampling resolution ratio video frame to be encoded refers to that the video frame to be encoded is to corresponding Original video frame carries out what down-sampling was handled.Down-sampling resolution reference frame refers to that the reference frame is to corresponding original Video frame carries out what down-sampling was handled.After first is obtained with reference to rule, Rule video to be encoded is referred to according to first The corresponding reference frame of frame, the reference frame made meet first with reference to rule.
Under the resolution ratio of video frame to be encoded, treats encoded video frame and encoded to obtain the corresponding volume of original video frame Code data further include: be added to first in the corresponding coded data of original video frame with reference to the corresponding Rule Information of rule.
The corresponding reference frame of available video frame to be encoded, is predicted to obtain pixel residual error according to reference frame, and right Pixel residual error converted, quantify and entropy coding obtains the corresponding coded data of original video frame.Wherein, coded data is obtained During, according to the resolution ratio of video frame to be encoded to the corresponding position of each block to be encoded of reference frame, video frame to be encoded At least one of confidence breath, the corresponding location information of each reference block of reference frame and motion vector are handled.It obtains After reference frame, reference block corresponding with the block to be encoded of video frame to be encoded can be obtained from reference frame, according to reference block pair Block to be encoded is encoded.Reference frame can also be handled according to the resolution ratio of video frame to be encoded, obtain corresponding mesh Reference frame is marked, target reference block corresponding with the block to be encoded of video frame to be encoded is obtained from object reference frame, according to target Reference block encodes block to be encoded, obtains the corresponding coded data of original video frame.
Under the resolution ratio of video frame to be encoded, treats encoded video frame and encoded to obtain the corresponding volume of original video frame Code data include: to obtain corresponding coding mode when video frame to be encoded is encoded under the resolution ratio of video frame to be encoded; The corresponding coding mode information of coding mode is added in the corresponding coded data of original video frame.
Coding mode is and carries out encoding related behavior pattern.Such as reference frame is decoded when may include coding The up-sampling mode of video frame use after reconstruction is adopted with reference to the corresponding rule of rule and to reference frame progress sampling processing One or more of sample loading mode and the corresponding resolution ratio of motion vector.By by the corresponding coding mode information of coding mode It is added to the corresponding coded data of original video frame, it is corresponding that when decoding can treat decoding video frame according to coding mode information Coded data is decoded.
The corresponding coding mode information of coding mode can not also be added in coded data.But in encoding and decoding standard In preset coding mode, corresponding with coding mode decoding process is set in decoding end.Or coding side and decoding Matched coding mode and decoding process can be calculated according to identical or corresponding algorithm in end.For example, in encoding and decoding Top sampling method and the method phase that is up-sampled to reference frame when decoding are carried out to reference frame when presetting coding in standard Together.
It treats encoded video frame according to reference frame to be encoded, obtaining the corresponding coded data of original video frame includes: root Sampling processing is carried out to reference frame according to the resolution information of video frame to be encoded;According to the reference frame after sampling processing to be encoded Video frame is encoded, and the corresponding coded data of original video frame is obtained.
Sampling processing is to be sampled by the resolution information of video frame to be encoded to reference frame, after making sampling processing The matched process of the resolution information of reference frame.When carrying out sampling processing, it can first determine that sample mode, sample mode include One of image element interpolation mode after direct image element interpolation mode and sampling.Direct image element interpolation mode is directly to reference Frame carries out image element interpolation processing, and image element interpolation mode carries out after sampling processing again at image element interpolation reference frame after sampling Reason.
Image element interpolation is to obtain the reference data of point pixel scale by reference to the reference data interpolation of pixel whole in frame Process.
During treating encoded video frame and being encoded, need in reference frame using motion search technology find with The corresponding reference block of block to be encoded in video frame to be encoded, the motion information according to block to be encoded relative to reference block are calculated Motion vector encodes motion vector to inform position of the corresponding reference data of decoding end reference block in reference frame, Thus, by carrying out image element interpolation processing to reference frame, the resolution ratio of the reference frame obtained after image element interpolation processing is higher, Video frame to be encoded can carry out estimation according to the higher reference frame of resolution ratio, to improve the accurate of estimation Degree promotes coding quality.
Under the resolution ratio of video frame to be encoded, treats encoded video frame and encoded to obtain the corresponding volume of original video frame Code data include: that will carry out the corresponding sample mode information of sampling processing to reference frame to be added to the corresponding coded data of reference frame In.Reference frame carries out the corresponding sample mode information of sampling processing and can be corresponding sequence-level in the point of addition of coded data Head information, group any of grade head information and frame level head information, sample mode information can in the point of addition of coded data To be determined according to the corresponding sphere of action of sample mode.Sample mode information can be added to the corresponding coded number of original video frame According to frame level head information in, indicate that original video frame corresponding reference frame when encoded uses that sample mode information is corresponding adopts Sample loading mode carries out image element interpolation processing.
It can be determined according to the proportionate relationship between the resolution ratio of video frame to be encoded and the resolution ratio of reference frame to reference frame The ratio sampled.For example, the resolution ratio of original video frame is 2M*2N, by original video frame according to full resolution Behavior pattern is handled, i.e., directly using original video frame as video frame to be encoded, then the resolution ratio of video frame to be encoded is 2M*2N, and the original video frame that can be used as reference frame is handled according to down-sampling behavior pattern, working as after obtaining down-sampling The resolution ratio of preceding reference frame to be encoded is M*2N, then the resolution ratio of the corresponding reference frame obtained after rebuilding is also M*2N, then It determines that and up-sampling treatment is carried out with wide 2, high 1 oversampling ratio to reference frame, obtain identical as video frame resolution to be encoded Frame.If by being handled according to down-sampling behavior pattern original video frame, the video frame to be encoded obtained after down-sampling Resolution ratio be M*N, and the original video frame that can be used as reference frame is handled according to full resolution behavior pattern, then heavy The resolution ratio of the reference frame obtained after building is 2M*2N, it is determined that is carried out down to reference frame with wide, Gao Junwei 1/2 oversampling ratio Sampling processing obtains frame identical with video frame resolution to be encoded.
It is usually identical in the resolution ratio due to original video frame, can according to original video frame carry out down-sampling obtain to Down-sampling ratio corresponding to encoded video frame, and down-sampling is carried out to the original video frame that can be used as reference frame and is obtained wait compile Down-sampling ratio corresponding to code reference frame, determines the ratio sampled to reference frame.
The method of sampling sampled to reference frame obtains video frame to be encoded with to original video frame progress down-sampling Sampling algorithm matching, i.e., carry out down-sampling algorithm used by down-sampling to reference frame, adopt with encoded video frame is treated Down-sampling algorithm used by sample is identical.Used by being up-sampled to reference frame up-sample algorithm, be with to original video Frame carries out the opposite sampling algorithm of down-sampling algorithm used by down-sampling.
The sampling algorithm sampled to reference frame carries out the sampling algorithm of down-sampling use with encoded video frame is treated Match, can further improve reference frame and down-sampling treated the images match degree of video frame to be encoded, further increase interframe The accuracy of prediction reduces pixel residual error, improves the quality of coded image.
After carrying out sampling processing to reference frame, search is obtained similar with block to be encoded from the reference frame after sampling processing For image block as reference block, the pixel value difference for calculating block to be encoded and reference block obtains pixel residual error;According to block to be encoded with it is right The displacement for the reference block answered obtains the corresponding motion vector of block to be encoded;It is obtained according to obtained motion vector and pixel residual error To coded data.
The corresponding motion vector of block to be encoded can be converted according to target motion vectors resolution information, be obtained Target motion vectors under target resolution generate coded data according to target motion vectors and pixel residual error.Wherein, root The corresponding motion vector of block to be encoded is converted according to target motion vectors resolution information, obtains the side of target motion vectors Method is described below.It is appreciated that the resolution ratio that target motion vectors resolution information indicates, as target resolution.
Directly target motion vectors itself can be carried out the coded treatment such as quantifying, obtain coded data.In another reality Apply in example, the motion residuals between target motion vectors and corresponding predicted motion vector can also be calculated, to motion residuals into Row coding, obtains coded data, is further reduced amount of coded data.
Carrying out sampling processing to reference frame according to the resolution information of video frame to be encoded includes: according to video frame to be encoded Resolution information and estimation pixel precision to reference frame carry out sampling processing.
Wherein, estimation pixel precision is that the unit of the corresponding motion vector of block to be encoded in video frame to be encoded is long Degree.Coding side, can be according to the estimation pixel precision of acquisition when treating the block to be encoded in encoded video frame and being encoded The unit length of the corresponding motion vector of block to be encoded is refined, the motion vector obtained in this way is more fine and accurate, It is then desired to which the estimation pixel precision according to acquisition carries out sampling processing to reference frame, then according to the ginseng after sampling processing It examines frame and calculates the corresponding motion vector of each block to be encoded in video frame to be encoded, encoded to obtain wait compile based on the motion vector The corresponding coded data of code video frame.
The resolution information that reference frame can be obtained, according to the image element interpolation mode that video frame to be encoded uses, and to The resolution information of encoded video frame, the resolution information of reference frame and the corresponding estimation pixel essence of video frame to be encoded Degree determination carries out which kind of sampling processing method, the corresponding oversampling ratio of sampling processing and picture element interpolation precision to reference frame.
It can be the corresponding estimation picture of video frame configuration to be encoded according to the image feature information of video frame to be encoded Plain precision.Image feature information is the information of the feature of image in characterization video frame to be encoded.Image feature information includes should be to At least one of size, texture information, movement velocity of encoded video frame etc., can integrate a variety of image feature informations determine to The corresponding estimation pixel precision of encoded video frame.
Image data entrained by video frame to be encoded is more complicated, and image information is abundanter, corresponding estimation pixel Precision is higher.For example, when carrying out inter-prediction to P frame, can be used higher estimation pixel precision calculate in P frame respectively to The corresponding motion vector of encoding block, and when carrying out inter-prediction to B frame, lower estimation pixel precision can be used and calculate The corresponding motion vector of each block to be encoded in B frame.
Sampling processing is carried out to reference frame according to the resolution information of video frame to be encoded and estimation pixel precision It include: that picture element interpolation precision is calculated according to the resolution information and estimation pixel precision of video frame to be encoded;Root Image element interpolation processing directly is carried out to reference frame according to picture element interpolation precision.
Specifically, picture element interpolation precision is that the corresponding pixel precision of image element interpolation is carried out to reference frame.When divide pixel insert Value mode is direct image element interpolation mode, and expression can directly carry out image element interpolation processing to reference frame.It therefore can root Picture element interpolation precision is calculated according to the resolution information and estimation pixel precision of video frame to be encoded.Ginseng can be calculated The ratio for examining the resolution information of frame and the resolution information of video frame to be encoded, according to ratio and estimation pixel precision Obtain picture element interpolation precision.
When the resolution ratio of reference frame is greater than the resolution ratio of video frame to be encoded, the data of pixel are partially divided in reference frame It can directly be multiplexed, can be used as and corresponding with estimation pixel precision divide pixel corresponding data.For example, video frame to be encoded Resolution ratio be M*N, the resolution ratio of reference frame is 2M*2N, if estimation pixel precision is 1/2, picture element interpolation precision is 1, So reference frame can not have to carry out image element interpolation processing and directly use;If estimation pixel precision is 1/4, then counting It is 1/2 that calculation, which obtains picture element interpolation precision, can carry out image element interpolation processing to reference frame with 1/2 picture element interpolation precision.
In one embodiment, the resolution of resolution ratio and reference frame represented by the resolution information of video frame to be encoded When rate is identical, then image element interpolation processing is directly carried out to reference frame according to estimation pixel precision.
Specifically, original video frame is handled to obtain video frame to be encoded by differentiating behavior pattern entirely, and is referred to When the resolution ratio of frame is also former resolution ratio, then the resolution ratio of video frame to be encoded and the resolution ratio of reference frame are identical.It is appreciated that Former resolution ratio refers to the resolution ratio of original video frame.Alternatively, handle to original video frame by down-sampling behavior pattern To video frame to be encoded, and reference frame frame is also the coded number encoded using the identical down-sampling behavior pattern using ratio It is obtained according to reconstruction, then the resolution ratio of video frame to be encoded and the resolution ratio of reference frame are identical.It is possible to be directly based upon fortune Dynamic estimation pixel precision directly carries out image element interpolation processing to reference frame, also, image element interpolation handles corresponding pixel and inserts It is identical with estimation pixel precision to be worth precision.
In one embodiment, according to the resolution information of video frame to be encoded and estimation pixel precision to reference It includes: to carry out sampling processing to reference frame according to the resolution information of video frame to be encoded that frame, which carries out sampling processing,;According to movement Estimate pixel precision, image element interpolation processing is carried out to the reference frame that sampling processing obtains.
Image element interpolation mode after the corresponding image element interpolation mode of video frame to be encoded is sampling, expression will be to reference Frame first carries out sampling processing, obtains middle reference frame identical with video frame resolution to be encoded, then carry out to intermediate reference frame Image element interpolation processing obtains image element interpolation treated reference frame.
When the resolution ratio represented by the resolution information of video frame to be encoded is less than the resolution ratio of reference frame, then according to The resolution information of encoded video frame carries out down-sampling processing to reference frame, obtains middle reference frame, is then based on view to be encoded The corresponding estimation pixel precision of frequency frame carries out image element interpolation processing to intermediate reference frame, after obtaining image element interpolation processing Reference frame.
It can not selection target motion vector resolution information.So, for present encoding block, computer equipment can according to The current resolution information of encoded video frame and the resolution information of reference frame determine coordinate conversion parameter;It obtains current to be encoded The first location information of block obtains the second location information of the corresponding reference block of current block to be encoded;According to coordinate conversion parameter, The corresponding target motion vectors of current block to be encoded are calculated in first location information and second location information.
Current resolution information, for indicating the current resolution of video frame to be encoded.Current block to be encoded is original view Currently need to carry out the block to be encoded of predictive coding in frequency frame.Reference block is pre- for carrying out to current block to be encoded in reference frame Survey the image block of coding.The corresponding first location information of current block to be encoded can use the coordinate representation of pixel.It is current to be encoded The corresponding first location information of block may include the corresponding coordinate of whole pixels of current block to be encoded, and current block to be encoded is corresponding First location information be also possible to include one or more pixels of current block to be encoded coordinate.Reference block corresponding second Location information may include the corresponding coordinate of whole pixels of reference block, and the corresponding second location information of reference block is also possible to wrap Include the coordinate of one or more pixels of reference block.For example, can current block to be encoded first pixel coordinate conduct The coordinate value of current block to be encoded, using the coordinate of first pixel of reference block as the coordinate value of reference block.
It can use coordinate conversion parameter to convert first location information, obtain corresponding first and shift one's position letter Breath, the difference for shifting one's position information and second location information according to first obtain target motion vectors.Or it can use coordinate Transformation parameter converts second location information, obtains corresponding second and shifts one's position information, according to first location information with The difference of second bit map confidence breath obtains target motion vectors.
Coordinate conversion parameter is big resolution information in the resolution ratio of video frame to be encoded and the resolution information of reference frame The ratio obtained divided by small resolution information.Wherein, the corresponding resolution of the small resolution ratio of the corresponding resolution ratio of big resolution information Rate is big.Coordinate conversion parameter with video frame to be encoded and the location information of the frame of resolution information small in reference frame for being become It changes.It in the embodiment of the present invention, is converted by the corresponding location information of frame to small resolution information, target fortune can be reduced The value of dynamic vector reduces the data volume of coded data.
Coordinate conversion parameter is small resolution information in the resolution ratio of video frame to be encoded and the resolution information of reference frame The ratio obtained divided by big resolution information.Coordinate conversion parameter is for treating in encoded video frame and reference frame, big resolution ratio The location information of the frame of information is converted.
In the embodiment of the present invention, location information is converted by coordinate conversion parameter, so that obtained location information Under same quantization scale, the value of target motion vectors can be reduced, reduces the data volume of coded data.
In one embodiment, obtaining the corresponding behavior pattern of original video frame includes: to calculate target prediction type to wait compiling Ratio of the code block in the corresponding forward coding video frame of original video frame;According to the corresponding behavior of ratio-dependent original video frame Mode.
Type of prediction block to be encoded is the corresponding block to be encoded of frame type of prediction.The ratio of target prediction type can be frame One or both of the corresponding ratio of interior block to be encoded and the corresponding ratio of interframe block to be encoded.Target prediction type waits compiling Ratio of the code block in the corresponding forward coding video frame of original video frame can be the target prediction type block to be encoded and its The ratio of his type of prediction block to be encoded is also possible to the ratio of the type block to be encoded and total block to be encoded quantity.Specifically may be used To be configured as needed.Such as in available forward coding video frame in frame block to be encoded the first quantity, forward direction compile Second quantity of interframe block to be encoded in code video frame.According to the first quantity and the second quantity be calculated in frame block to be encoded with The ratio of interframe block to be encoded, or the third quantity of whole blocks to be encoded of forward coding video frame is counted, according to the first number The ratio of block to be encoded and third data volume in frame is calculated in amount and third quantity.It can also be according to the second quantity and third quantity The ratio of interframe block to be encoded and third data volume is calculated.
Forward coding video frame refers to original video frame is encoded before coded video frame, the forward direction of acquisition The particular number of encoded video frame can customize, and compile for example, forward coding video frame can be the previous of original video frame The encoded video frame of code, forward coding video frame are also possible to preceding 4 encoded encoded video frames of original video frame.It is counting After calculation obtains the corresponding ratio in forward coding video frame of target prediction type block to be encoded, according to the ratio being calculated Determine the corresponding behavior pattern of original video frame.If the quantity of the forward coding video frame got is multiple, it can calculate The corresponding ratio in each forward coding video frame of different type block to be encoded is obtained, is weighted according to each ratio Toatl proportion is calculated, determines the corresponding behavior pattern of original video frame further according to toatl proportion and preset threshold.Wherein, forward direction regards The corresponding weight of frequency frame can be negatively correlated relationship with the coding distance of forward coding video frame and original video frame.
Ratio of the block to be encoded in forward coding video frame in frame can be calculated in forward coding video frame, when ratio is big When targets threshold, determine that behavior pattern is down-sampling behavior pattern.
Ratio corresponding for block to be encoded in frame can be when the ratio is greater than targets threshold, determine original video The corresponding behavior pattern of frame is down-sampling behavior pattern, otherwise determines that the corresponding behavior pattern of video frame is full resolution behavior mould Formula.Such as, when ratio is greater than targets threshold, determine that the corresponding behavior pattern of original video frame is down-sampling behavior pattern, otherwise Determine that the corresponding behavior pattern of video frame is full resolution behavior pattern.
If the ratio of block to be encoded is big in frame, illustrate that video council is relatively complicated or video frame between correlation Spend relatively low, therefore obtained pixel residual error is bigger, therefore is more likely to be encoded using down-sampling behavior pattern, reduces Amount of coded data.
Wherein targets threshold can be determined according to the behavior pattern of the corresponding reference frame of original video frame.Work as original video When the behavior pattern of the corresponding reference frame of frame is down-sampling behavior pattern, the first preset threshold T1 is obtained, by the first preset threshold T1 is as targets threshold.Similarly, when the behavior pattern of the corresponding reference frame of original video frame is full resolution behavior pattern, The second preset threshold T2 is obtained, using the second preset threshold T2 as targets threshold.Further, corresponding according to original video frame Reference frame resolution information get targets threshold after, according in targets threshold and forward coding video frame in frame it is to be encoded The behavior pattern of ratio-dependent original video frame of the block in forward coding video frame.Wherein, when preceding into encoded video frame frame When ratio of the interior block to be encoded in forward coding video frame is greater than targets threshold, the corresponding behavior pattern of original video frame is determined For down-sampling behavior pattern.
Second preset threshold is greater than the first preset threshold, in this way, working as the corresponding behavior pattern full resolution behavior of reference frame When mode, original video frame is more likely to using full resolution behavior pattern, original when reference frame is down-sampling behavior pattern Video frame is more likely to using down-sampling behavior pattern.
Before obtaining original video frame, the method for video coding based on motion information and residual information calculating further include: obtain The corresponding input video sequence of original video frame is taken, the corresponding target video sequential coding mode of input video sequence is obtained, In, target video sequential coding mode includes constant resolution coding mode or mixed-resolution coding mode;Judge target Whether video sequence coding mode is mixed-resolution coding mode, if so, the step of obtaining original video frame is executed, if It is no, then constant resolution coding is carried out to each original video frame of input video sequence.
Input video sequence may include multiple original video frames.When target video sequential coding mode is constant resolution When coding mode, each original video frame of input video sequence is encoded under identical resolution ratio such as full resolution , when target video sequential coding mode is mixed-resolution coding mode, then obtain the corresponding row of each original video frame For mode, original video frame is handled according to behavior pattern, obtains video frame to be encoded, carried out according to video frame to be encoded Coding, the resolution ratio of video frame to be encoded can be identical as the resolution ratio of original video frame, can also be than point of original video frame Resolution is small, and input video sequence may exist the video frame to be encoded of different resolution.Therefore when video sequence coding mode is When mixed-resolution coding mode, the video calculated based on motion information and residual information provided in above-described embodiment is provided and is compiled Code method.
Obtaining the corresponding target video sequential coding mode of input video sequence includes: acquisition current context information, currently Environmental information includes at least one of present encoding environmental information and current decoding environmental information information;Believed according to current environment It ceases and determines the corresponding target video sequential coding mode of input video sequence.
Environmental information may include that characterization executes setting for the method for video coding calculated based on motion information with residual information Information, the characterization of standby processing capacity execute the information and current application scene of the processing capacity of the equipment of video encoding/decoding method One of information is a variety of.Processing capacity can be indicated with processing speed.For example, the equipment strong for processing capacity, Since processing speed is fast, corresponding target video sequential coding mode is full resolution coding mode (it is appreciated that full resolution Coding mode is a kind of constant resolution coding mode in special circumstances), it is currently answered when current application scene information is corresponding With scene be real-time application scenarios when, video sequence coding mode be mixed-resolution coding mode.When current application scene is believed When ceasing the non real-time application scenarios of corresponding current application scene, video sequence coding mode is constant resolution coding mode.It can Current context information relationship corresponding with video sequence coding mode is arranged, after obtaining current context information, according to current Environmental information and the corresponding relationship of video sequence coding mode obtain the corresponding target video sequential coding mould of input video sequence Formula.For example, the processing speed of the equipment of the method for video coding calculated based on motion information with residual information can be set and hold The corresponding relationship of the average value of the processing speed of the equipment of row video encoding/decoding method and video sequence coding mode, when being based on The processing speed of the equipment for the method for video coding that motion information and residual information calculate and the equipment for executing video encoding/decoding method Processing speed after, calculate average value, target video sequential coding mode is obtained according to average value.Current application scene whether be Real-time application scenarios, which can according to need, to be configured.For example, vt applications scene, game application scene are application in real time Scene, the Video coding in video website, the corresponding application scenarios of the coding of offline video can be non real-time application scenarios.
When video sequence coding mode is constant resolution coding mode, to each original video of input video sequence Frame carries out constant resolution coding.
Under the resolution ratio of video frame to be encoded, treats encoded video frame and encoded to obtain the corresponding volume of original video frame Code data include: that the corresponding video sequence coding pattern information of target video sequential coding mode is added in coded data.
Video coding framework includes constant resolution coding framework and mixed-resolution coding framework, is regarded when obtaining input After frequency sequence, decision is carried out to video sequence coding mode at video sequence coding pattern acquiring module, when target video sequence Column coding mode is mixed-resolution coding mode, then is encoded using mixed-resolution coding framework, when target video sequence When column coding mode is constant resolution coding mode, constant resolution coding is carried out using constant resolution coding framework.

Claims (1)

1. a kind of data-encoding scheme calculated based on motion information and residual information characterized by comprising
Obtain original video frame;
Obtain the corresponding behavior pattern of the original video frame;
The original video frame is handled according to the behavior pattern, obtains video frame to be encoded;
According to the resolution ratio configuration information of the video frame to be encoded, target motion vectors resolution information is determined;
According to the target motion vectors resolution information, each corresponding target of block to be encoded in video frame to be encoded is determined Motion vector: under the current resolution in the video frame to be encoded, each block to be encoded in the video frame to be encoded is determined Corresponding initial motion vectors;When handling to obtain the video to be encoded using down-sampling behavior pattern by original video frame When frame, according to the current resolution information of the video frame to be encoded and the target motion vectors resolution information, is determined One vector median filters parameter;According to the first vector median filters parameter, the initial motion vectors are transformed in the target point Target motion vectors under resolution;
In encoding the video frame to be encoded when each block to be encoded, for current block to be encoded, determine described current to be encoded Reference frame where reference block corresponding to block;In the reference frame, determination is corresponding with the current block to be encoded picture position Image block;Obtain described image block corresponding to and the target motion vectors under the target resolution, work as described The predicted motion vector of preceding block to be encoded;
According to the motion residuals between each target motion vectors and corresponding predicted motion vector, coded data is obtained.
CN201811336152.3A 2018-11-12 2018-11-12 A kind of method for video coding calculated based on motion information and residual information Pending CN109618160A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811336152.3A CN109618160A (en) 2018-11-12 2018-11-12 A kind of method for video coding calculated based on motion information and residual information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811336152.3A CN109618160A (en) 2018-11-12 2018-11-12 A kind of method for video coding calculated based on motion information and residual information

Publications (1)

Publication Number Publication Date
CN109618160A true CN109618160A (en) 2019-04-12

Family

ID=66004127

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811336152.3A Pending CN109618160A (en) 2018-11-12 2018-11-12 A kind of method for video coding calculated based on motion information and residual information

Country Status (1)

Country Link
CN (1) CN109618160A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110572676A (en) * 2019-09-27 2019-12-13 腾讯科技(深圳)有限公司 video encoding method and apparatus, video decoding method and apparatus, and storage medium
CN110662060A (en) * 2019-09-27 2020-01-07 腾讯科技(深圳)有限公司 Video encoding method and apparatus, video decoding method and apparatus, and storage medium
CN112312133A (en) * 2020-10-30 2021-02-02 北京奇艺世纪科技有限公司 Video coding method and device, electronic equipment and readable storage medium
US20220021872A1 (en) * 2019-09-27 2022-01-20 Tencent Technology (Shenzhen) Company Limited Video encoding method and apparatus, video decoding method and apparatus, storage medium, and electronic device
CN114424560A (en) * 2019-09-20 2022-04-29 北京字节跳动网络技术有限公司 Adaptive resolution change and scalable codec for screen content

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114424560A (en) * 2019-09-20 2022-04-29 北京字节跳动网络技术有限公司 Adaptive resolution change and scalable codec for screen content
CN110572676A (en) * 2019-09-27 2019-12-13 腾讯科技(深圳)有限公司 video encoding method and apparatus, video decoding method and apparatus, and storage medium
CN110662060A (en) * 2019-09-27 2020-01-07 腾讯科技(深圳)有限公司 Video encoding method and apparatus, video decoding method and apparatus, and storage medium
US20220021872A1 (en) * 2019-09-27 2022-01-20 Tencent Technology (Shenzhen) Company Limited Video encoding method and apparatus, video decoding method and apparatus, storage medium, and electronic device
CN110572676B (en) * 2019-09-27 2023-12-12 腾讯科技(深圳)有限公司 Video encoding method and apparatus, video decoding method and apparatus, and storage medium
CN110662060B (en) * 2019-09-27 2024-02-09 腾讯科技(深圳)有限公司 Video encoding method and apparatus, video decoding method and apparatus, and storage medium
CN112312133A (en) * 2020-10-30 2021-02-02 北京奇艺世纪科技有限公司 Video coding method and device, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN109618160A (en) A kind of method for video coding calculated based on motion information and residual information
US11546627B2 (en) Moving picture decoding method and moving picture encoding method
CN108848380A (en) Video coding and decoding method, apparatus, computer equipment and storage medium
CN108769682A (en) Video coding, coding/decoding method, device, computer equipment and storage medium
CN109495746A (en) A kind of method for video coding based on motion vector adjustment
CN108833918A (en) Method for video coding, coding/decoding method, device, computer equipment and storage medium
CN108848381A (en) Method for video coding, coding/decoding method, device, computer equipment and storage medium
CN101584215B (en) Integrated spatial-temporal prediction
CN108833917A (en) Video coding, coding/decoding method, device, computer equipment and storage medium
CN100481952C (en) Method and apparatus for determining search range for adaptive motion vector for use in video encoder
CN109618159A (en) A kind of self-adaptive encoding method based on resolution ratio corresponding relationship
CN102047665A (en) Dynamic image encoding method and dynamic image decoding method
CN1154051A (en) Method and apparatus for detecting motion vectors
CN101366279A (en) Adaptive motion search range
CN109660800A (en) Method for estimating, device, electronic equipment and computer readable storage medium
CN100521744C (en) Image processing device and program
CN108401185B (en) Reference frame selection method, video transcoding method, electronic device and storage medium
CN108848377A (en) Video coding, coding/decoding method, device, computer equipment and storage medium
CN101883286A (en) Calibration method and device, and motion estimation method and device in motion estimation
JP2002125233A (en) Image compression system for weighting video contents
CN117395423A (en) Video image processing methods, devices, electronic equipment and storage media
CN101023672A (en) System and method for motion prediction in scalable video coding
CN112468808A (en) I frame target bandwidth allocation method and device based on reinforcement learning
CN109618167A (en) A kind of image encoding method based on interpolation processing
Laumer et al. Moving object detection in the H. 264/AVC compressed domain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190412

WD01 Invention patent application deemed withdrawn after publication