A kind of H.264 coding method of ultralow time delay and encoderTechnical field
The present invention relates to video encoding techniques, especially one H.264 coding techniques.
Background technology
In the strong Internet video chat of interactivity or video conference, video time delay is crucial systematic function quality index.If slowed-down video is bigger than normal, the interchange perception of user so can be had a strong impact on.
In addition, in unmanned aerial vehicle (UAV) control field, existing unmanned aerial vehicle (UAV) control is that the streaming media image beamed back based on remote control controls as feedback signal.In order to control unmanned plane, the time delay showing from transducer transmission video to compression engine to decoded picture is less than 100 milliseconds usually.
But existing transmission of video all exists time delay, it comprises encoding time delay, transmission delay, decoding time delay, and wherein encoding time delay account for the very most of of transmission delay.The time delay of current most of Video coding is all more than 200 milliseconds, and for above specific application, time delay can not meet the demands.
Summary of the invention
Technical problem to be solved by this invention is: for above-mentioned Problems existing, provides a kind of H.264 coding method of ultralow time delay.
H.264 the coding method of a kind of ultralow time delay provided by the invention, comprising:
Step 1: preliminary treatment is carried out to the video of input;
Step 2: several video lines in the pretreated video of buffer memory;
Step 3: frame prediction is carried out to described some video lines;
Step 4: frame is predicted the outcome and carries out DCT coding and quantification successively;
Step 5: the quantized result in step 4 and motion vector are carried out entropy code;
Step 6: the result of entropy code is carried out cushioning rear output;
Wherein, described frame prediction comprises further:
Step 31: the result that front some video lines and operations for motion compensation obtain is carried out superposing and buffer memory;
Step 32: the content of the content of step 31 buffer memory and step 2 buffer memory is carried out estimation and obtains motion vector;
Step 33: the content of motion vector and step 31 buffer memory is carried out operations for motion compensation;
Step 34: the result deducting operations for motion compensation from the content of step 2 buffer memory obtains the result of frame prediction.
Further, the acquisition methods of described front some video lines comprises:
Step 311: the result of step 4 is carried out inverse quantization;
Step 312: the result of inverse quantization is carried out IDCT computing.
Further, described some video lines are 16 video lines.
Present invention also offers a kind of H.264 encoder of ultralow time delay, comprising:
Pretreatment unit, for carrying out preliminary treatment by the video of input;
First frame buffer unit, for the some video lines in the pretreated video of buffer memory;
Frame predicting unit, for carrying out frame prediction to described some video lines;
DCT coding unit, for carrying out DCT coding to the result after frame prediction;
Quantifying unit, for quantizing the result after DCT coding;
Entropy code unit, for carrying out entropy code by quantized result and motion vector;
Buffer cell, for being undertaken cushioning rear output by the result of entropy code;
Wherein, described frame predicting unit comprises further:
Adder unit, the result for front some video lines and operations for motion compensation being obtained carries out superposing and buffer memory;
Second frame buffer unit, for the result that buffer memory adder unit exports;
Motion estimation unit, obtains motion vector for the content of the content of the second buffer unit buffer memory and the first buffer unit buffer memory is carried out estimation;
Motion compensation units, for carrying out operations for motion compensation by the content of motion vector and the second buffer unit buffer memory;
Subtrator, the result for deducting operations for motion compensation in the content from the first buffer unit buffer memory obtains the result of frame prediction.
Further, also comprise:
Inverse quantization unit, carries out inverse quantization for result quantifying unit exported;
IDCT unit, obtains front some video lines for the result of inverse quantization being carried out IDCT computing.
In sum, owing to have employed technique scheme, the invention has the beneficial effects as follows:
The present invention only prestores when encoding the some video lines in frame of video instead of the complete frame of video that prestores, greatly reduce the time of prestoring, reduce coding delay, compared to common coding delay more than 200 milliseconds, time delay can be reduced within 1 millisecond by the present invention, can be good at meeting Video chat or unmanned aerial vehicle (UAV) control to the ultralow delay requirement of Video coding.
Accompanying drawing explanation
Examples of the present invention will be described by way of reference to the accompanying drawings, wherein:
Fig. 1 is FB(flow block) of encoding in the present invention.
Embodiment
All features disclosed in this specification, or the step in disclosed all methods or process, except mutually exclusive feature and/or step, all can combine by any way.
Arbitrary feature disclosed in this specification, unless specifically stated otherwise, all can be replaced by other equivalences or the alternative features with similar object.That is, unless specifically stated otherwise, each feature is an example in a series of equivalence or similar characteristics.
Traditional H.264 coding delay represents with frame usually, as must cushion time of a whole frame before compression starts.Suppose that coding rate can improve, so double to reduce coding delay by means of only frame rate, that is, when frame rate is 30fps, every frame time delay is 33 milliseconds, and when frame rate is 60fps, every frame time delay is then 16.5 milliseconds.
But such low time delay still can not meet the requirement of some specific occasion to ultralow time delay.
The present invention, by optimizing frame buffer module when H.264 encoding, when not buffer memory and the complete frame of video of non-caching one, only cushions several video lines, just starts compressed encoding, reduce coding delay further.
As shown in Figure 1, a specific embodiment of coding method of the present invention comprises:
Step 1: preliminary treatment is carried out to the video of input;
Step 2: several video lines in the pretreated video of buffer memory;
Step 3: frame prediction is carried out to described some video lines;
Step 4: frame is predicted the outcome and carries out DCT coding and quantification successively;
Step 5: the quantized result in step 4 and motion vector are carried out entropy code;
Step 6: the result of entropy code is carried out cushioning rear output;
Wherein, described frame prediction comprises further:
Step 31: the result that front some video lines and operations for motion compensation obtain is carried out superposing and buffer memory;
Step 32: the content of the content of step 31 buffer memory and step 2 buffer memory is carried out estimation and obtains motion vector;
Step 33: the content of motion vector and step 31 buffer memory is carried out operations for motion compensation;
Step 34: the result deducting operations for motion compensation from the content of step 2 buffer memory obtains the result of frame prediction.
The acquisition methods of described front some video lines comprises:
Step 311: the result of step 4 is carried out inverse quantization;
Step 312: the result of inverse quantization is carried out IDCT computing.
The preliminary treatment mentioned in the present invention, DCT coding, quantification, entropy code, inverse quantization, IDCT, estimation and motion compensation are the technology in H.264 coding standard, do not repeat them here its detailed step.
In a preferred embodiment, the video line number of buffer memory is 16, but should not be interpreted as restriction of the present invention by 16, can the video line of buffer memory varying number according to concrete delay requirement, but can affect code efficiency when the video line of buffer memory is very few.
For the video flowing of 1080p30 frame, (frame rate is 30fps, 1080p represents that 1080 row are lined by line scan), time delay when adopting the inventive method coding is 16/1080/30=494 microsecond, and time delay is less than 500 microseconds (16 video lines represent 16 row in whole frame 1080 row).And for 480p30 video flowing, time delay is then lower than 1 millisecond.Cushion 16 video lines, compare and cushion a whole frame, code efficiency reduces about 20%, but coding delay reduces to 500 microseconds from 33 milliseconds.For the special applications of some ultralow delay requirement, be effectively like this.
The present invention is not limited to aforesaid embodiment.The present invention expands to any new feature of disclosing in this manual or any combination newly, and the step of the arbitrary new method disclosed or process or any combination newly.