CN102769753A - H.264 coder and coding method - Google Patents

H.264 coder and coding method Download PDF

Info

Publication number
CN102769753A
CN102769753A CN2012102722249A CN201210272224A CN102769753A CN 102769753 A CN102769753 A CN 102769753A CN 2012102722249 A CN2012102722249 A CN 2012102722249A CN 201210272224 A CN201210272224 A CN 201210272224A CN 102769753 A CN102769753 A CN 102769753A
Authority
CN
China
Prior art keywords
data
frame
unit
prediction
reference data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012102722249A
Other languages
Chinese (zh)
Other versions
CN102769753B (en
Inventor
郑宇驰
李�杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Omnivision Technologies Shanghai Co Ltd
Original Assignee
Omnivision Technologies Shanghai 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 Omnivision Technologies Shanghai Co Ltd filed Critical Omnivision Technologies Shanghai Co Ltd
Priority to CN201210272224.9A priority Critical patent/CN102769753B/en
Publication of CN102769753A publication Critical patent/CN102769753A/en
Application granted granted Critical
Publication of CN102769753B publication Critical patent/CN102769753B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides an H.264 coder and a coding method. When interframe prediction is implemented, a proper search window is set and a reference code stream is decoded so as to obtain reference data required by a current macro block; a related storage space only comprises the code stream used as a reference and partial reference data, and the storage space is far smaller than a frame of images, so the storage space of a reference frame required by the H.264 coder is effectively reduced; meanwhile, because an off-chip memory is not used, the cost of the whole H.264 coder and the system power consumption are effectively reduced; and moreover, as the reading and writing performances of an on-chip memory are far better than those of the off-chip memory, the throughput rate of storage data can be greatly improved while the image quality is guaranteed when a large-size image is coded.

Description

H264 encoder and coding method
Technical field
The present invention relates to technical field of image processing, relate in particular to a kind of H.264 encoder and coding method.
Background technology
H.264 standard is a kind of high-performance digital video decoding standard that joint video team (JVT, Joint Video Team) proposes, and its maximum advantage is to have very high data compression rate.Under the condition of equal picture quality; H.264 compression ratio can reach 2 times of MPEG-4; Why so high compression ratio can be arranged; This is because H.264 comprised a series of new characteristics, such as multiframe reference, the motion compensation of change piece size, also has high-precision sub-pix motion compensation, block elimination effect filter or the like.
According to standard code H.264, macro block (Macroblock or abbreviation MB) type is mainly divided two big types: (Intra) coding and interframe (Inter) are encoded in the frame.Intraframe coding uses the adjacent data of current macro to give a forecast, and deducts predicted value with the current macro data then, thereby produces residual error data, at last this residual error is carried out follow-up encoding process, and whole process need not used the data of other images.And interframe encode need utilize the reconstructed image of having encoded to do prediction; Promptly in reconstructed image, search out and the data matching piece of current block; Because video image redundancy in time; Inter prediction often can find the data of mating current block than infra-frame prediction more, has so just improved the entire image compression performance.This shows, use interframe encode can improve the compression performance of video image, but when doing inter prediction, need certain memory space to remove to store some reconstructed images, or be called reference frame (reference frame) image.According to standard H.264, reference frame at least 1 frame can be 16 frames at most, if required image encoded size big (for example VGA:640x480), the memory space of this reference frame is still very considerable so.
As shown in Figure 1, disclosed H.264 encoder comprises following submodule at present:
Current Frame: input current image date;
ME/MC:Motion Estimation/Motion Compensation promptly realizes inter prediction;
Choose Intra Mode:, select best intra prediction mode through the cost of relatively encoding;
Intra Prediction:, realize infra-frame prediction according to the frame mode of the best;
Mode Decision: the size according to the coding cost selects to use infra-frame prediction or inter prediction;
DCT/Q: realize the dct transform (being integral discrete cosine transform) and the quantification of forward;
Entropy Encoder: entropy coding module;
IDCT/InvQ: realize reverse dct transform and inverse quantization;
Deblocking: image is carried out filtering in order to reduce blocking effect;
Chip external memory: reference frame data 1 ~ 16 Reference Frames that 1 ~ 16 frame is provided.
H.264 standard adopt integral discrete cosine transform (being dct transform) and the dynamic range that quantizes to come the correlation in the removal of images signal and reduce image encoding to reach the purpose of compression.In Fig. 1, the residual error data Dn that is obtained by present frame gets into the entropy coding module on the one hand and encodes through behind the dct transform and quantification treatment of forward, provides the code stream (bitstream) after the image compression then; On the other hand; After getting into reverse dct transform and inverse quantization; Add predicted value, just obtained data reconstruction Fn', this data reconstruction can be used as the infra-frame prediction that adjacent piece value is participated in present frame; And be written into chip external memory after their process loop Deblocking filtering, can be used as the reference data of the inter prediction of subsequent frame.
Though the H.264 encoder of prior art can be realized inter prediction through using chip external memory; When satisfying the coding of large-size images to the space of memory and the high request of data throughput; But can increase system cost and system power dissipation greatly owing to the very high data throughput of chip external memory on the other hand, make this H.264 encoder can not satisfy the requirement of low power consuming devices.
Summary of the invention
The object of the present invention is to provide a kind of H.264 encoder and coding method, can when guaranteeing picture quality, practice thrift the memory space of reference frame, improve data throughput, reduce system cost and system power dissipation.
For addressing the above problem, the present invention proposes a kind of H.264 encoder, comprising:
The coding subsystem; Be used to import the data of present image, infra-frame prediction or the inter prediction that carries out current macro to be obtaining the residual error data of said current macro, said residual error data carried out the code stream of the said current macro of output behind dct transform and quantification and the entropy coding; Wherein, When current macro is carried out inter prediction, set the search window of current macro, and in said search window, be ready to the reference data of needs;
The code stream cache module is used for buffer memory with reference to code stream, and described is that reference frame image is through the code stream after encoding with reference to code stream;
The decoding subsystem is used for said reference code stream is carried out entropy decoding and reverse dct transform and inverse quantization, needed reference data when obtaining said coding subsystem and carrying out inter prediction;
The reference data cache module is used for the reference data that the said decoding subsystem of buffer memory obtains, and needed reference data in the search window when for said coding subsystem the inter prediction of current macro being provided.
Further, said coding subsystem comprises:
Control unit is used to import the current macro data, and provides a macro block enabling signal and be distributed to other unit to notify other unit starting macro block corresponding calculated;
Ask the residual error unit; Be used to carry out the infra-frame prediction or the inter prediction of current macro, obtain the residual error data of said current macro, wherein; When current macro is carried out inter prediction; Set the search window of current macro, and in said search window, be ready to needed reference data, this reference data is to obtain through reference code stream is decoded;
Forward dct transform and quantifying unit are used for said residual error data is carried out forward dct transform and quantification;
The entropy coding unit is used for said residual error data after forward dct transform and the quantification being carried out entropy coding, generates the code stream of said current macro;
Reverse dct transform and inverse quantization unit are used for the forward dct transform and the residual error data after quantizing is carried out reverse dct transform and inverse quantization;
Reconfiguration unit is used for the infra-frame prediction or the data behind the inter prediction of residual error data behind reverse dct transform and the inverse quantization and said current macro are carried out addition, obtains reconstruct data, for the infra-frame prediction of next macro block provides reference data.
Further, the said residual error unit of asking comprises:
Predictive mode is selected module, and the size that is used for according to the coding cost is that current macro is selected infra-frame prediction or inter-frame forecast mode;
The inter prediction module is used under inter-frame forecast mode, is current macro setting search window, and from said reference data cache module, selects the reference data that said search window needs, and according to said reference data current macro is carried out inter prediction;
Intra prediction mode is selected module, is used for the reconstruct data that the previous macro block of having encoded of basis obtains, and selects the optimum frame inner estimation mode of current macro;
Intra-framed prediction module is used for according to said optimum frame inner estimation mode and said reconstruct data said current macro being carried out infra-frame prediction;
Multichannel is selected module, is used to realize that predictive mode selects the selection of the prediction data of module, intra-framed prediction module and the output of inter prediction module.
Further, said decoding subsystem comprises:
The entropy decoding unit is used for said reference code stream is carried out the entropy decoding;
Reverse dct transform and inverse quantization unit are used for the residual error coefficient of said entropy decoding unit output is carried out reverse dct transform and inverse quantization;
Intraprediction unit is used for carrying out infra-frame prediction according to the intra prediction mode of said entropy decoding unit output;
Reconfiguration unit is used for the residual error data of reverse dct transform and the inverse quantization unit output of decoding subsystem and the prediction data that intraprediction unit is exported are carried out addition, obtains reconstruct data, needed reference data in the search window during as the macro block inter prediction.
Further, the intra-framed prediction module of the intraprediction unit of said decoding subsystem and said coding subsystem is an independently intra predictor generator of multiplexing same intra predictor generator or two.
Further, the reverse dct transform of the reverse dct transform of said decoding subsystem and inverse quantization unit and said coding subsystem and inverse quantization unit are multiplexing same reverse dct transform/inverse DCT or two independently reverse dct transform/inverse DCTs.
Further, said decoding subsystem also comprises: filter unit is used for before the reference data that said decoding subsystem obtains is cached to said reference data cache module, said reference data being carried out filtering.
Further; Said reference data cache module is a circulating memory; Be provided with the memory space of certain macroblock number; When the reference data that the said decoding subsystem of buffer memory obtains, the reference data of current acquisition covers the reference data that can not re-use when carrying out inter prediction in the said circulating memory.
Further, the computing formula of the macroblock number S of said reference data cache module storage is:
S=Ceil(sw_height_by_pix/16)*pic_width_by_mb-(pic_width_by_mb-Ceil(sw_width_by_pix/16))+1
Wherein, Ceil (x) expression is more than or equal to the smallest positive integral of x;
Sw_height_by_pix is to be the height of the search window of unit representation with the pixel;
Sw_width_by_pix is to be the width of the search window of unit representation with the pixel;
Pic_width_by_mb is to be the width of the image of unit representation with the macro block.
Further, the said reference data of said reference data cache module buffer memory also comprises the data of P frame, and the data of said P frame are reference data coding through the coding subsystem with an I frame and obtain through said decoding subsystem decoding.
Further, when said coding subsystem is encoded to the follow-up P frame of the present image of input, be reference data with I frame data in the said reference data cache module or P frame data.
Further, said decoding subsystem comprises the I frame decoding system of reference data of P frame decoding system and the said I frame type of the reference data that is used to provide said P frame type.
Further, said I frame decoding system comprises:
The first entropy decoding unit is used for said I frame reference code stream with reference to code stream is carried out the entropy decoding;
First reverse dct transform and the inverse quantization unit is used for the residual error coefficient of said first entropy decoding unit output is carried out reverse dct transform and inverse quantization;
First intraprediction unit is used for carrying out infra-frame prediction according to the intra prediction mode of said first entropy decoding unit output;
First reconfiguration unit; Be used for the residual error data of the said first reverse dct transform and inverse quantization unit output and the prediction data of first intraprediction unit output are carried out addition; Obtain the reconstruct data of said I frame, needed reference data in its search window when being used for the P frame with reference to the decoding of code stream or as the inter prediction of current macro with reference to code stream;
First filter unit is used for the reference data of first reconfiguration unit is carried out filtering.
Further, said P frame decoding system comprises:
The second entropy decoding unit is used for said P frame reference code stream with reference to code stream is carried out the entropy decoding;
Second reverse dct transform and the inverse quantization unit is used for the residual error coefficient of the said second entropy decoding unit is carried out reverse dct transform and inverse quantization;
Second intraprediction unit is used for carrying out infra-frame prediction according to the intra prediction mode of said second entropy decoding unit output;
Second inter prediction unit is used for carrying out inter prediction according to the reconstruct data of described first reconfiguration unit and the motion vector of said second entropy decoding unit output;
Second reconfiguration unit; Be used for the residual error data of the said second reverse dct transform and inverse quantization unit output and the prediction data of second intraprediction unit or the output of second inter prediction unit are carried out addition; Obtain the reconstruct data of said P frame, needed reference data in its search window when being used for the inter prediction of said current macro with reference to code stream;
Second filter unit is used for the reference data of second reconfiguration unit is carried out filtering.
Accordingly, the present invention also provides a kind of coding method H.264, may further comprise the steps:
(1) judge whether current macro need carry out inter prediction, if do not need inter prediction, then current macro is encoded, and change step (4) over to, inter prediction then gets into next step if desired;
(2) be current macro setting search window, judge whether the reference data in the search window is ready to, if, then current macro is encoded according to reference data, change step (4) over to, if not, then get into next step;
(3) reference code stream is decoded, obtain the reference data of a macro block, return step (2);
(4) judge whether to finish coding,, then handle next macro block and return step (1) if do not finish.
Further, said reference data is the reference data of I frame type.
Further, said reference data comprises the reference data of P frame type, the reference data of said P frame type be the reference frame data with the I frame type serve as with reference to encode, decoding obtains.
Further, in step (1), when not needing inter prediction, the process that current macro is encoded comprises:
The reference data that obtains after the previous coded macroblocks reconstruction processing of foundation is carried out the infra-frame prediction of current macro, obtains intra prediction value, deducts this predicted value with the current macro data again, obtains the residual error data of said current macro;
Said current macro residual error data is carried out forward dct transform and quantification;
With said residual error data after forward dct transform and the quantification is carried out entropy coding, generate the code stream and the buffer memory of said current macro;
Residual error data to after forward dct transform and the quantification is carried out reverse dct transform and inverse quantization;
Prediction data to residual error data behind reverse dct transform and the inverse quantization and said optimum prediction mode is carried out reconstruct, obtains being used for the reference data of the infra-frame prediction of next macro block.
Further, in step (2), the process of in search window, preparing the reference data of current macro comprises:
Reference code stream to buffer memory carries out the entropy decoding;
Residual error coefficient to obtaining through the entropy decoding carries out reverse dct transform and inverse quantization;
Intra prediction mode according to entropy decoding output carries out infra-frame prediction;
Residual error data behind reverse dct transform and the inverse quantization and the prediction data behind the infra-frame prediction are carried out reconstruct, the reference data and the buffer memory that need in the search window when obtaining the inter prediction of current macro.
Further, in step (2), after the reference data in search window was ready to, the process of current macro being encoded according to reference data comprised:
Carry out the inter prediction of current macro according to said reference data; Through comparing the coding cost of infra-frame prediction and inter prediction; Select of the optimum prediction mode output of the less predictive mode of coding cost, and obtain the residual error data of said current macro as current macro;
Said current macro residual error data is carried out forward dct transform and quantification;
With said residual error data after forward dct transform and the quantification is carried out entropy coding, generate the code stream and the buffer memory of said current macro;
Residual error data to after forward dct transform and the quantification is carried out reverse dct transform and inverse quantization;
Prediction data to residual error data behind reverse dct transform and the inverse quantization and said optimum prediction mode is carried out reconstruct, obtains being used for the reference data of the infra-frame prediction of next macro block.
Compared with prior art; H.264 encoder and the coding method that provides according to the invention; When realizing inter prediction, obtain the required reference data of current macro through the setting search window, the memory space that relates to only comprises the reference code stream and the partial reference data of storage; Size is far smaller than the size of a two field picture, thereby has effectively reduced the H.264 memory space of the required reference frame of encoder; Simultaneously owing to do not use chip external memory; The cost of whole H.264 encoder and system power dissipation are effectively reduced; And, because the readwrite performance of sheet stored generally will be much better than the sheet external memory, so when carrying out the large-size images coding; Can when guaranteeing picture quality, improve the storage data throughput greatly.
Description of drawings
Fig. 1 is the structural representation of a kind of H.264 encoder of prior art;
Fig. 2 is the structural representation of H.264 encoder of the present invention;
Fig. 3 is the simple and easy flow chart of the coding work of H.264 encoder of the present invention;
Fig. 4 is the structural representation of the H.264 encoder of the embodiment of the invention one;
Fig. 5 is the coded sequence and the referring-to relation sketch map of the H.264 encoder of the embodiment of the invention one;
Fig. 6 is the corresponding search window position sketch map of macro block of the H.264 encoder of the embodiment of the invention one;
Fig. 7 is the macro block corresponding relation sketch map of coding/decoding subsystem of the H.264 encoder of the embodiment of the invention one;
Fig. 8 is the structural representation of the H.264 encoder of the embodiment of the invention two;
Fig. 9 is the macro block corresponding relation sketch map of coding/decoding subsystem of the H.264 encoder of the embodiment of the invention two;
Figure 10 is the structural representation of the H.264 encoder of the embodiment of the invention three;
Figure 11 is the coded sequence and the referring-to relation sketch map of the H.264 encoder of the embodiment of the invention three;
Figure 12 is the macro block corresponding relation sketch map of coding/decoding subsystem of the H.264 encoder of the embodiment of the invention three.
Embodiment
Because the inter prediction macro block is divided into predicted macroblock and bidirectional interframe predictive macro block between forward frame, thus in standard H.264 three kinds of main frame types of existence: I frame, P frame and B frame.Wherein all macro blocks of I frame all are infra-frame predictions, and the P frame has comprised predicted macroblock and infra-frame prediction macro block between forward frame, and the B frame has then comprised bidirectional interframe predictive macro block and infra-frame prediction macro block.Certainly, realize that P frame and B frame coding need reference frame, the I frame does not then need.
Therefore, H.264 encoder and coding method that the present invention proposes mainly comprise the following aspects:
Code stream (bitstream) behind the storage of reference frames coding is promptly with reference to code stream;
During inter prediction, set a certain size search window (search window), search optimum Match blocks of data all carries out in search window;
Through reference code stream is decoded, obtain the required search window data of current macro, and store these data;
Consider the independence that reference code stream is decoded, so be the I frame with reference to having a frame in the code stream at least.
Therefore, please refer to Fig. 2, H.264 encoder provided by the invention mainly comprises following four parts:
Coding subsystem 10; Be used to import the data of present image, infra-frame prediction or the inter prediction that carries out current macro to be obtaining the residual error data of said current macro, said residual error data carried out the code stream of the said current macro of output behind dct transform and quantification and the entropy coding; Wherein, When current macro is carried out inter prediction, set the search window of current macro, and in said search window, be ready to the reference data of needs;
Code stream cache module 20; Be used for buffer memory with reference to code stream; Described is that reference frame image is through the code stream after encoding with reference to code stream; If promptly present frame can be used to the reference frame of subsequent frame, the code stream of all macro blocks of present frame can be preserved always so, up to this frame as a reference the attribute of frame be cancelled; If present frame is not used to the reference frame of subsequent frame, the code stream of current macro is after being seen off coded system so, and such as writing the SD card, these code streams can be covered by follow-up bit stream data;
Decoding subsystem 30 is used for said reference code stream is carried out entropy decoding and reverse dct transform and inverse quantization, needed reference data in the search window when obtaining the inter prediction of current macro;
Reference data cache module 40 is used for the reference data that the said decoding subsystem of buffer memory obtains, and needed reference data in the search window when for said coding subsystem the inter prediction of current macro being provided.
Please refer to Fig. 3; The coding/decoding process of H.264 encoder provided by the invention is that unit carries out with macro block (MB) all; And when current MB is encoded; The decoding subsystem also can be worked simultaneously, is that next macro block is prepared reference data in advance, can effectively improve the coding rate of whole system.When the realization inter prediction of current macro; Set the search window of current macro; And in said search window, be ready to the reference data that needs, if the reference data of preparation is then called decoding subsystem 30; Raster scan order according to macro block is further decoded to reference code stream, obtains the described reference data of current macro inter prediction.
Below in conjunction with accompanying drawing and specific embodiment further explain is done in H.264 encoder and coding method that the present invention proposes.
Embodiment one
Please refer to Fig. 4, present embodiment provides a kind of H.264 encoder, comprises following four parts:
Coding subsystem 10; Be used to import the data of present image, infra-frame prediction or the inter prediction that carries out current macro to be obtaining the residual error data of said current macro, said residual error data carried out the code stream of the said current macro of output behind dct transform and quantification and the entropy coding; Wherein, When current macro is carried out inter prediction, set the search window of current macro, and in said search window, be ready to the reference data of needs;
Code stream cache module Bitstream Buffer20 is used for buffer memory with reference to code stream, and described is that reference frame image is through the code stream after encoding with reference to code stream;
Decoding subsystem 30 is used for said reference code stream is decoded and reverse dct transform and inverse quantization, needed reference data in the search window when obtaining the inter prediction of current macro;
Reference data cache module Reference Data40 is used for the reference data that the said decoding subsystem of buffer memory obtains, and needed reference data in the search window when for said coding subsystem the inter prediction of current macro being provided.
Please continue with reference to figure 4, in the present embodiment, coding subsystem 10 comprises following subelement:
Control unit Current Frame101 is used to import the current macro data, and provides a macro block enabling signal and be distributed to other unit to notify other unit starting macro block corresponding calculated;
Ask the residual error unit; Be used to carry out the infra-frame prediction or the inter prediction of current macro, obtain the residual error data of said current macro, wherein; When current macro is carried out inter prediction; Set the search window of current macro, and in said search window, be ready to the reference data of needs, this reference data is to obtain through reference code stream is decoded;
Forward dct transform and quantifying unit DCT/Q103 are used for said residual error data is carried out forward dct transform and quantification;
Entropy coding unit Entropy Encoder104 is used for said residual error data after forward dct transform and the quantification being carried out entropy coding, generates the code stream of said current macro;
Reverse dct transform and inverse quantization unit IDCT/InvQ105 are used for the forward dct transform and the residual error data after quantizing is carried out reverse dct transform and inverse quantization;
Reconfiguration unit 106 is used for the infra-frame prediction or the data behind the inter prediction of residual error data behind reverse dct transform and the inverse quantization and said current macro are carried out addition, obtains reconstruct data, for the infra-frame prediction of next macro block provides reference data.
Please continue with reference to figure 4, in the present embodiment, the said residual error unit of asking comprises following submodule:
Predictive mode is selected module Mode Decision102a, and the size that is used for according to the coding cost is that current macro is selected infra-frame prediction or inter-frame forecast mode;
Inter prediction module ME/MC (Motion Estimation/Motion Compensation) 102b; Be used under inter-frame forecast mode; Be current macro setting search window; And from said reference data cache module, select the reference data that said search window needs, and current macro is carried out inter prediction according to said reference data;
Infra-frame prediction is selected module Choose Intra Mode102c; Be used for the reconstruct data that obtains according to the macro block of before having encoded, through the optimum frame inner estimation mode of the minimum predictive mode of cost of selecting to encode of the coding cost of each intra prediction mode relatively as current macro;
Intra-framed prediction module Intra Prediction 102d is used for according to said optimum frame inner estimation mode and said reconstruct data said current macro being carried out infra-frame prediction;
Multichannel is selected module MUX102e, is used to realize that predictive mode selects the selection of the prediction data of module 102a, inter prediction module 102b and intra-framed prediction module 102d output;
Computing module 102f is used for the input data of current macro and infra-frame prediction or inter prediction data are subtracted each other, and obtains the residual error data of current macro.
Please continue with reference to figure 4, in the present embodiment, said decoding subsystem 30 comprises following subelement:
Entropy decoding unit Entropy Decoder301 is used for said reference code stream is carried out the entropy decoding;
Reverse dct transform and inverse quantization unit IDCT/InvQ302 are used for the residual error coefficient of said entropy decoding unit output is carried out reverse dct transform and inverse quantization;
Intraprediction unit Intra Prediction303 is used for carrying out infra-frame prediction according to the intra prediction mode of said entropy decoding unit output and the reconstruct data of previous decoded macro block;
Reconfiguration unit 304; Be used for the residual error data of reverse dct transform and inverse quantization unit 302 outputs and the prediction data of intraprediction unit 303 outputs are carried out addition; Obtain reconstruct data, needed reference data in its search window when this reconstruct data is the inter prediction of current macro.
In the present embodiment, the intraprediction unit of said decoding subsystem 30 303 is with said to ask the intra-framed prediction module 102d of residual error unit be two independently intra predictor generators; The reverse dct transform of said decoding subsystem 30 and inverse quantization unit 302 are two independently reverse dct transform/inverse DCTs with the reverse dct transform and the inverse quantization unit 105 of said coding subsystem 10.
In the present embodiment; Said decoding subsystem 30 also comprises: filter unit Deblocking305; Be used for before the reference data that said reconfiguration unit 304 obtains is cached to said reference data cache module, said reference data being carried out filtering, to reduce blocking effect.In other embodiments of the invention, also can save Deblocking305.
In the present embodiment, Bitstream Buffer20 and Reference Data40 are preferably SRAM.Wherein, the size of Bitstream Buffer20 is relevant with coded image size and the quantization parameter selected for use.In addition, if realize B frame coding, so necessary first buffer memory current image date, the next frame image encoding is encoded after accomplishing again by the time, and this has increased the memory space of coded system.Therefore, in order to reduce memory space and reduction coded system cost, the H.264 encoder of present embodiment more is applicable to I frame and P frame coding.
In the present embodiment; Said reference data cache module Reference Data40 is a circulating memory (cyclic buffer); Be provided with the memory space of certain macroblock number; When the reference data that the said decoding subsystem of buffer memory obtains, the reference data of current acquisition will cover the reference data that can not be used to inter prediction in the said circulating memory again, that is to say that the newly-generated data of decoding can cover " old " data; The primitive of storing as Reference Data40 is a macro block, and the macroblock number S of its minimum needs storage can represent with following formula so:
S=Ceil(sw_height_by_pix/16)*pic_width_by_mb-(pic_width_by_mb-Ceil(sw_width_by_pix/16))+1
Wherein, Ceil (x) expression is more than or equal to the smallest positive integral of x;
Sw_height_by_pix is to be the height of the search window of unit representation with the pixel;
Sw_width_by_pix is to be the width of the search window of unit representation with the pixel;
Pic_width_by_mb is to be the width of the image of unit representation with the macro block.
Illustrate the concrete operation method based on H.264 encoder shown in Figure 4 below, need to suppose image encoded to be of a size of 640x480, picture format is Y: Cb:Cr=4:2:0, and the size of search window is 592x48.At first; The memory space minimum that can obtain Reference Data40 according to the formula of above-mentioned macroblock number is 118 macro blocks, but in order to read and write the convenience of addressing, setting this storage size is 120 macro blocks; I.e. three complete macro block bars (MB-line), just 45Kbyte; In addition, the I frame code stream size of a VGA image generally can be controlled in the 25Kbyte.To sum up, in order to realize the P frame coding of VGA image, traditional H.264 encoder need be stored a reference picture at least, i.e. the memory space of 450Kbyte, and use the coding method of the H.264 encoder of present embodiment, then only need the memory space of 70Kbyte.Detailed process is seen Fig. 5, Fig. 6, Fig. 7.
Fig. 5 is the H.264 encoder image encoding order and the referring-to relation between them of present embodiment.What be worth explanation is; The P frame can not be limited only with reference to the nearest I frame in front; The P-24 frame is if do reference with the I-0 frame in for example scheming; Must guarantee that so the code stream of I-0 frame also is stored in the Bitstream Buffer20, and do not covered that the cost of paying has certainly increased memory space exactly by the code stream of I-22 frame; In addition, the P frame number between two I frames also is can be arbitrarily.
Fig. 6 has described the moving process of search window position.Search window that frame of broken lines is first macro block of P frame (being MB0) among the figure; Along with the order of coded macroblocks according to raster scan (raster scan) increases progressively; The also corresponding change in the position of search window so, another frame of broken lines is the search window of MB59 in the P frame among the figure.Though the size of search window can freely be set; But in practical application; The sheet stored space that coded system had is fixed, so can be according to retrodict out the maximum of search window of the formula of the macroblock number of above-mentioned Reference Data40 storage.
Fig. 7 is coding/decoding subsystem start-up time and their relativeness separately.The decoding subsystem can be started working in advance, according to the order of raster scan (raster scan) macro block of reference frame is decoded, for current P frame is prepared reference data.After the required reference data of the search window of first macro block of P frame all was ready to, the coding subsystem was started working, and next coding/decoding carries out simultaneously.When the decoding subsystem proceeds to MB120; The memory space of reference data has been filled with among the Reference Data40; At this time will cover the space of originally depositing the MB0 data to the decoded data of MB120; Because the data of MB0 have been used as reference data never again, promptly so-called circulation storage.At last, the decoding subsystem can finish in advance, if subsequent frame remains a P frame, the subsystem of decoding so can be decoded to reference frame again.
Need to prove,, can strengthen search window on the one hand if promote the coding efficiency of the H.264 encoder of present embodiment; Can store several frames on the other hand with reference to code stream more, form the multiframe reference.These 2 all is the reference data of mating current macro more in order to find, and cost has increased sheet stored space exactly certainly, needs only used memory space less than traditional implementation, and it is exactly significant doing so like this.
Embodiment two
For the H.264 hardware realization of encoder, need consider from following four aspects usually: 1). hard-wired area; 2). the highest frequency of work clock; 3). coding rate, promptly handle the required clock cycle of each macro block (cycles); 4). coding efficiency, the code stream that promptly under identical picture quality, generates is more little good more.And these several aspects are interactional, for example will reduce used area, will share a part of logical block or reduce memory space, will reduce coding rate or coding efficiency so; If improve the maximum functional clock frequency, will increase area so generally speaking; If the lifting coding efficiency generally can strengthen computation complexity and memory space,, increased area so again so that predicted value can be mated the current macro data more.
Hard-wired four factors based on above-mentioned H.264 encoder are considered; Present embodiment provides a kind of H.264 encoder that can save area relatively; Wherein coding subsystem is conciliate the numeral system can the multiplexing part same logical block; The functional module of for example multiplexing reverse DCT/ inverse quantization and infra-frame prediction please refer to Fig. 8, and concrete structure comprises:
Coding subsystem 10; Be used to import the data of present image, infra-frame prediction or the inter prediction that carries out current macro to be obtaining the residual error data of said current macro, said residual error data carried out the code stream of the said current macro of output behind dct transform and quantification and the entropy coding; Wherein, When current macro is carried out inter prediction, set the search window of current macro, and in said search window, be ready to the reference data of needs;
Code stream cache module Bitstream Buffer20; Be used for buffer memory with reference to code stream; Described is the code stream after reference frame image is encoded with reference to code stream; If promptly present frame can be used to the reference frame of subsequent frame, the code stream of all macro blocks of present frame can be preserved always so, up to this frame as a reference the attribute of frame be cancelled; If present frame is not used to the reference frame of subsequent frame, the code stream of current macro is after being seen off coded system so, and such as writing the SD card, these code streams can be covered by follow-up bit stream data;
Decoding subsystem 30 is used for reference code stream is carried out entropy decoding and reverse dct transform and inverse quantization, needed reference data in the search window when obtaining the inter prediction of current macro;
Reference data cache module Reference Data40 is used for the reference data that the said decoding subsystem of buffer memory obtains, and needed reference data in the search window when for said coding subsystem the inter prediction of current macro being provided.
Please continue with reference to figure 8, in the present embodiment, coding subsystem 10 comprises following subelement:
Control unit Current Frame101 is used to import the current macro data, and provides a macro block enabling signal and be distributed to other unit to notify other unit starting macro block corresponding calculated;
Ask the residual error unit; Be used to carry out the infra-frame prediction or the inter prediction of current macro, obtain the residual error data of said current macro, wherein; When current macro is carried out inter prediction; Set the search window of current macro, and in said search window, be ready to the reference data of needs, this reference data is to obtain through reference code stream is decoded;
Forward dct transform and quantifying unit DCT/Q 103 are used for said residual error data is carried out forward dct transform and quantification;
Entropy coding unit Entropy Encoder 104 is used for said residual error data after forward dct transform and the quantification being carried out entropy coding, generates the code stream of said current macro;
Reverse dct transform and inverse quantization unit IDCT/InvQ105 are used for the forward dct transform and the residual error data after quantizing is carried out reverse dct transform and inverse quantization;
Reconfiguration unit 106 is used for the infra-frame prediction or the prediction data behind the inter prediction of residual error data Dn behind reverse dct transform and the inverse quantization and said current macro are carried out addition, obtains reconstruct data, for the infra-frame prediction of next macro block provides reference data.
Please continue with reference to figure 8, in the present embodiment, the said residual error unit of asking comprises following submodule:
Predictive mode is selected module Mode Decision102a, and the size that is used for according to the coding cost is that current macro is selected infra-frame prediction or inter-frame forecast mode;
Inter prediction module ME/MC (Motion Estimation/Motion Compensation) 102b; Be used under inter-frame forecast mode; Be current macro setting search window; And from said reference data cache module, select the reference data that said search window needs, and current macro is carried out inter prediction according to said reference data;
Infra-frame prediction is selected module Choose Intra Mode 102c, is used for the reconstruct data that the previous macro block of having encoded of basis obtains, and through comparing the coding cost of each intra prediction mode, selects the optimum frame inner estimation mode of current macro;
Intra-framed prediction module Intra Prediction 102d is used for according to said optimum frame inner estimation mode and said reconstruct data said current macro being carried out infra-frame prediction;
Multichannel is selected module MUX 102e, is used to realize that predictive mode selects the selection of the prediction data of module 102a, inter prediction module 102b and intra-framed prediction module 102d output;
Computing module 102f is used for the input data of current macro and infra-frame prediction or inter prediction data are subtracted each other, and obtains the residual error data of current macro.
Please continue with reference to figure 8, in the present embodiment, said decoding subsystem 30 comprises following subelement:
Entropy decoding unit Entropy Decoder 301 is used for said reference code stream is carried out the entropy decoding;
Reverse dct transform and inverse quantization unit IDCT/InvQ105, the reverse dct transform of promptly said coding subsystem 10 and inverse quantization unit 105 are used for the residual error coefficient of said entropy decoding unit output is carried out reverse dct transform and inverse quantization;
Intraprediction unit Intra Prediction 102d, the promptly said intra-framed prediction module 102d that asks the residual error unit is used for carrying out infra-frame prediction according to the intra prediction mode of said entropy decoding unit 301 outputs and the reconstruct data of previous decoded macro block;
Reconfiguration unit 304; Be used for the residual error data of reverse dct transform and inverse quantization unit 105 outputs and the prediction data after the intra-framed prediction module 102d output are carried out addition; Obtain reconstruct data, needed reference data in the search window during as the macro block inter prediction.
In the present embodiment; Said decoding subsystem 30 also comprises: filter unit Deblocking 305; Be used for before the reference data that said reconfiguration unit 304 obtains is cached to said reference data cache module, said reference data being carried out filtering, to reduce blocking effect.In other embodiments of the invention, also can save Deblocking 305.
Please refer to Fig. 9; Because the coding subsystem partial logic of having conciliate the numeral system multiplexing in the H.264 encoder of present embodiment; The subsystem of encoding is so conciliate the numeral system and just can not be worked simultaneously; Can only adopt timesharing to carry out Code And Decode, handling a macro block data so just needs the more clock cycle, so the relative embodiment of coding rate is once descending to some extent.
Embodiment three
Likewise; Hard-wired four factors based on the H.264 encoder described in the embodiment two are considered; Present embodiment provide a kind of through several frames of many storages with reference to code stream to form multiframe with reference to the H.264 encoder that promotes coding efficiency, please refer to Figure 10, concrete structure comprises:
Coding subsystem 10; Be used to import the data of present image, infra-frame prediction or the inter prediction that carries out current macro to be obtaining the residual error data of said current macro, said residual error data carried out the code stream of the said current macro of output behind dct transform and quantification and the entropy coding; Wherein, When current macro is carried out inter prediction, set the search window of current macro, and in said search window, be ready to the reference data of needs;
Code stream cache module Bitstream Buffer20; Be used for buffer memory with reference to code stream; Described is the code stream after reference frame image is encoded with reference to code stream; If promptly present frame can be used to the reference frame of subsequent frame, the code stream of all macro blocks of present frame can be preserved always so, up to this frame as a reference the attribute of frame be cancelled; If present frame is not used to the reference frame of subsequent frame, the code stream of current macro is after being seen off coded system so, and such as writing the SD card, these code streams can be covered by follow-up bit stream data;
Decoding subsystem 30 is used for the reference code of institute's buffer memory stream is carried out entropy decoding and reverse dct transform and inverse quantization, needed reference data in the search window when obtaining the inter prediction of current macro;
Reference data cache module Reference Data40 is used for the reference data that the said decoding subsystem of buffer memory obtains, and needed reference data in the search window when for said coding subsystem the inter prediction of current macro being provided.
Please continue with reference to Figure 10, in the present embodiment, coding subsystem 10 comprises following subelement:
Control unit Current Frame101 is used to import the current macro data, and provides a macro block enabling signal and be distributed to other unit to notify other unit starting macro block corresponding calculated;
Ask the residual error unit; Be used to carry out the infra-frame prediction or the inter prediction of current macro, obtain the residual error data of said current macro, wherein; When current macro is carried out inter prediction; Set the search window of current macro, and in said search window, be ready to the reference data of needs, this reference data is to obtain through reference code stream is decoded;
Forward dct transform and quantifying unit DCT/Q103 are used for said residual error data is carried out forward dct transform and quantification;
Entropy coding unit Entropy Encoder104 is used for said residual error data after forward dct transform and the quantification being carried out entropy coding, generates the code stream of said current macro;
Reverse dct transform and inverse quantization unit IDCT/InvQ105 are used for the forward dct transform and the residual error data after quantizing is carried out reverse dct transform and inverse quantization;
Reconfiguration unit 106 is used for the infra-frame prediction or the prediction data behind the inter prediction of residual error data Dn behind reverse dct transform and the inverse quantization and said current macro are carried out addition, obtains being used for the reference data of the infra-frame prediction of next macro block.
Please continue with reference to Figure 10, in the present embodiment, the said residual error unit of asking comprises following submodule:
Predictive mode is selected module Mode Decision102a, and the size that is used for according to the coding cost is that current macro is selected infra-frame prediction or inter-frame forecast mode;
Inter prediction module ME/MC (Motion Estimation/Motion Compensation) 102b; Be used under inter-frame forecast mode; Be current macro setting search window; And from said reference data cache module, select the reference data that said search window needs, and current macro is carried out inter prediction according to said reference data;
Infra-frame prediction is selected module Choose Intra Mode102c; Be used for the reconstruct data that obtains according to the macro block of before having encoded, through the optimum frame inner estimation mode of the minimum predictive mode of cost of selecting to encode of the coding cost of each intra prediction mode relatively as current macro;
Intra-framed prediction module Intra Prediction 102d is used for according to said optimum frame inner estimation mode and said reconstruct data said current macro being carried out infra-frame prediction;
Multichannel is selected module MUX102e, is used to realize that predictive mode selects the selection of the prediction data of module 102a, inter prediction module 102b and intra-framed prediction module 102d output;
Computing module 102f is used for the input data of current macro and infra-frame prediction or inter prediction data are subtracted each other, and obtains the residual error data of current macro.
Please continue with reference to Figure 10; In the present embodiment; Because P frame data are as a reference wherein arranged; So will increase the logic that a cover can be decoded to the P frame in the subsystem in decoding, therefore, said decoding subsystem 30 comprises the I frame decoding system of reference data of P frame decoding system and the said I frame type of the reference data that is used to provide said P frame type.
Wherein, please continue with reference to Figure 10, said I frame decoding system comprises:
The first entropy decoding unit Entropy Decoder 301b is used for said I frame reference code stream with reference to code stream is carried out the entropy decoding;
First reverse dct transform and the inverse quantization unit IDCT/InvQ 302b is used for the residual error coefficient of said first entropy decoding unit 301b output is carried out reverse dct transform and inverse quantization;
The first intraprediction unit Intra Prediction 303b is used for carrying out infra-frame prediction according to the intra prediction mode of said first entropy decoding unit 301b output;
The first reconfiguration unit 304b; Be used for the residual error data of the said first reverse dct transform and inverse quantization unit 302b output and the prediction data of first intraprediction unit 303b output are carried out addition; Needed reference data in its search window when obtaining the inter prediction of the current macro that said I frame provides with reference to code stream, the inter prediction when this reference data can be used for the P frame with reference to code stream decoding simultaneously.
The first filter unit Deblocking 305b is used for the reference data of the first reconfiguration unit 304b is carried out filtering.
Said P frame decoding system comprises:
The second entropy decoding unit Entropy Decoder 301a is used for said P frame reference code stream with reference to code stream is carried out the entropy decoding;
Second reverse dct transform and the inverse quantization unit IDCT/InvQ 302a is used for the residual error coefficient of said second entropy decoding unit 301a output is carried out reverse dct transform and inverse quantization;
The second intraprediction unit Intra Prediction 303a is used for carrying out infra-frame prediction according to the intra prediction mode of said second entropy decoding unit 301a output;
The second inter prediction unit MC 306 is used for carrying out inter prediction according to the reconstruct data of the described first reconfiguration unit 304b and the motion vector of said second entropy decoding unit 301a output;
MUX MUX 307 is used to realize the selection of the prediction data of the second intraprediction unit Intra Prediction 303a and the second inter prediction unit MC, 306 outputs;
The second reconfiguration unit 304a; Be used for the residual error data of the said second reverse dct transform and inverse quantization unit 302a output and the prediction data after the second intraprediction unit 303a or 306 processing of second inter prediction unit are carried out addition; Obtain the reconstruct data of said P frame with reference to code stream; Needed reference data in its search window when being used for the inter prediction of said current macro; If it is infra-frame prediction that this reference code flows next macro block, this reconstruct data is also as the reference data of predicting in the decoding time frame so;
The second filter unit Deblocking 305a is used for the reference data of the second reconfiguration unit 304a is carried out filtering.
Please continue with reference to Figure 10; In the present embodiment, the reference data cache module comprises that the P frame buffer module 402 and being used to of I frame buffer module 401, the buffer memory P frame type of the reference data that is used for buffer memory I frame type selects the selector 403 of the reference data of I frame type or P frame type.
In other embodiments of the invention; Also can save Deblocking 305a, 305b; Also can reference implementation the principle of example two; The module or/or the cell mesh of identical function in coding subsystem and the decoding subsystem is multiplexing, and multiplexing back only can influence the relativeness of coding/decoding subsystem operation.
Shown in Figure 11 is the coded sequence and the referring-to relation of the H.264 encoder of present embodiment.What be worth explanation is that the P ' frame of frame must be after the I frame as a reference, and this P ' frame must be for referencial use with the I frame.In addition, the subsequent P frame both can use P ' frame for referencial use, also can use the reference frame (being the I frame) of P ' frame for referencial use.
Figure 12 has described the relativeness of coding/decoding subsystem operation.This figure supposes that still coded image is of a size of 640x480, and search window size is 592x48.Can know by Figure 12,, could decode to P ' frame then if present frame will will solve the reference frame (being the I frame) of P ' frame earlier so with reference to P ' frame, more than two steps could encode to current P frame after accomplishing.
Though the H.264 encoder of present embodiment has increased the implementation complexity of system, and increased sheet stored space,, therefore improved the performance of coded system, can be used as a kind of selection of practical application because the multiframe reference is provided.
In addition, the present invention also provides a kind of coding method H.264, may further comprise the steps:
(1) judge whether current macro need carry out inter prediction, if do not need inter prediction, then current macro is encoded, and change step (4) over to, inter prediction then gets into next step if desired;
(2) be current macro setting search window, judge whether the reference data in the search window is ready to, if, then current macro is encoded according to reference data, change step (4) over to, if not, then get into next step;
(3) reference code stream is decoded, obtain the reference data of a macro block, return step (2);
(4) judge whether to finish coding,, then handle next macro block and return step (1) if do not finish.
Wherein said reference data can be the reference data of I frame type, can also comprise the reference data of P frame type, the reference data of said P frame type be the reference frame data with the I frame type serve as with reference to encode, decoding obtains.
In step (1), when not needing inter prediction, the process that current macro is encoded comprises:
The reference data that obtains after the previous coded macroblocks reconstruction processing of foundation is carried out the infra-frame prediction of current macro, obtains intra prediction value, deducts this predicted value with the current macro data again, obtains the residual error data of said current macro;
Said current macro residual error data is carried out forward dct transform and quantification;
With said residual error data after forward dct transform and the quantification is carried out entropy coding, generate the code stream and the buffer memory of said current macro;
Residual error data to after forward dct transform and the quantification is carried out reverse dct transform and inverse quantization;
Prediction data to residual error data behind reverse dct transform and the inverse quantization and said optimum prediction mode is carried out reconstruct, obtains being used for the reference data of the infra-frame prediction of next macro block.
In step (2), the process of in search window, preparing the reference data of current macro comprises:
Reference code stream to buffer memory carries out the entropy decoding;
Residual error coefficient to obtaining through the entropy decoding carries out reverse dct transform and inverse quantization;
Intra prediction mode according to entropy decoding output carries out infra-frame prediction;
Residual error data behind reverse dct transform and the inverse quantization and the prediction data behind the infra-frame prediction are carried out reconstruct, the reference data and the buffer memory that need in the search window when obtaining the inter prediction of current macro.
In step (2), after the reference data in search window was ready to, the process of current macro being encoded according to reference data comprised:
Carry out the inter prediction of current macro according to said reference data; Through comparing the coding cost of infra-frame prediction and inter prediction; Select of the optimum prediction mode output of the less predictive mode of coding cost, and obtain the residual error data of said current macro as current macro;
Said current macro residual error data is carried out forward dct transform and quantification;
With said residual error data after forward dct transform and the quantification is carried out entropy coding, generate the code stream and the buffer memory of said current macro;
Residual error data to after forward dct transform and the quantification is carried out reverse dct transform and inverse quantization;
Prediction data to residual error data behind reverse dct transform and the inverse quantization and said optimum prediction mode is carried out reconstruct, obtains being used for the reference data of the infra-frame prediction of next macro block.
Can know from the above mentioned; H.264 encoder and coding method that present embodiment proposes are not all initial data of storage of reference frames; But refine to macro-block level; The required reference data of storage current macro, these reference datas obtain through reference code stream is decoded again, add that with reference to code stream the memory space of some reference datas has just replaced the memory space of whole reference frame like this.Because the reference data of being deposited must comprise the data of whole search window; So the memory space of reference data is relevant with search window size; And according to the image compression performance; The size of search window can freely be set, but generally can be far smaller than the size of a two field picture, has so just reduced the H.264 required memory space of encoder.Therefore according to said method, make and utilize less on-chip SRAM just can H.264 encode that concrete hardware implementations is as shown in Figure 3.Owing to do not use chip external memory, the cost of so whole coded system has reduced, and has also reduced system power dissipation simultaneously.And the readwrite performance of on-chip SRAM generally will be much better than the outer SDRAM memory of sheet, so when carrying out the large-size images coding, the data throughput of memory can not become problem yet.
In sum; H.264 encoder and the coding method that provides according to the invention; When realizing inter prediction, obtain the required reference data of current macro through the setting search window, the memory space that relates to only comprises the code stream and the partial reference data of storage; Size is far smaller than the size of a two field picture, thereby has effectively reduced the H.264 memory space of the required reference frame of encoder; Simultaneously owing to do not use chip external memory; The cost of whole H.264 encoder and system power dissipation are effectively reduced; And, because the readwrite performance of sheet stored generally will be much better than the sheet external memory, so when carrying out the large-size images coding; Can when guaranteeing picture quality, improve the storage data throughput greatly.
Obviously, those skilled in the art can carry out various changes and modification to invention and not break away from the spirit and scope of the present invention.Like this, belong within the scope of claim of the present invention and equivalent technologies thereof if of the present invention these are revised with modification, then the present invention also is intended to comprise these changes and modification interior.

Claims (14)

1. an encoder H.264 is characterized in that, comprising:
The coding subsystem; Be used to import the data of present image, infra-frame prediction or the inter prediction that carries out current macro to be obtaining the residual error data of said current macro, said residual error data carried out the code stream of the said current macro of output behind dct transform and quantification and the entropy coding; Wherein, When current macro is carried out inter prediction, set the search window of current macro, and in search window, be ready to the reference data of needs;
The code stream cache module is used for buffer memory with reference to code stream, and described is that reference frame image is through the code stream after encoding with reference to code stream;
The decoding subsystem is used for said reference code stream is carried out entropy decoding and reverse dct transform and inverse quantization, needed reference data when obtaining said coding subsystem and carrying out inter prediction;
The reference data cache module is used for the reference data that the said decoding subsystem of buffer memory obtains, and needed reference data in the search window when for said coding subsystem the inter prediction of current macro being provided.
2. H.264 encoder as claimed in claim 1 is characterized in that, said coding subsystem comprises:
Control unit is used to import the current macro data, and provides a macro block enabling signal and be distributed to other unit to notify other unit starting macro block corresponding calculated;
Ask the residual error unit; Be used to carry out the infra-frame prediction or the inter prediction of current macro, obtain the residual error data of said current macro, wherein; When current macro is carried out inter prediction; Set the search window of current macro, and in said search window, be ready to needed reference data, this reference data is to obtain through reference code stream is decoded;
Forward dct transform and quantifying unit are used for said residual error data is carried out forward dct transform and quantification;
The entropy coding unit is used for said residual error data after forward dct transform and the quantification being carried out entropy coding, generates the code stream of said current macro;
Reverse dct transform and inverse quantization unit are used for the forward dct transform and the residual error data after quantizing is carried out reverse dct transform and inverse quantization;
Reconfiguration unit is used for the infra-frame prediction or the prediction data behind the inter prediction of residual error data behind reverse dct transform and the inverse quantization and said current macro are carried out addition, obtains reconstruct data, for the infra-frame prediction of next macro block provides reference data.
3. H.264 encoder as claimed in claim 2 is characterized in that, the said residual error unit of asking comprises:
Predictive mode is selected module, and the size that is used for according to the coding cost is that current macro is selected infra-frame prediction or inter-frame forecast mode;
The inter prediction module is used under inter-frame forecast mode, is current macro setting search window, and from said reference data cache module, selects the reference data that said search window needs, and according to said reference data current macro is carried out inter prediction;
Intra prediction mode is selected module, is used for the reconstruct data that the previous macro block of having encoded of basis obtains, and selects the optimum frame inner estimation mode of the minimum predictive mode of coding cost as current macro;
Intra-framed prediction module is used for according to said optimum frame inner estimation mode and said reconstruct data current macro being carried out infra-frame prediction;
Multichannel is selected module, is used to realize that predictive mode selects the selection of the prediction data of module, intra-framed prediction module and the output of inter prediction module.
4. H.264 encoder as claimed in claim 2 is characterized in that, said decoding subsystem comprises:
The entropy decoding unit is used for reference code stream is carried out the entropy decoding;
Reverse dct transform and inverse quantization unit are used for the residual error coefficient of said entropy decoding unit output is carried out reverse dct transform and inverse quantization;
Intraprediction unit is used for carrying out infra-frame prediction according to the intra prediction mode of said entropy decoding unit output and the reconstruct data of previous decoded macro block;
Reconfiguration unit; Be used for the residual error data of the reverse dct transform of said decoding subsystem and inverse quantization unit output and the prediction data of intraprediction unit output are carried out addition; Obtain reconstruct data, needed reference data in the search window during as the macro block inter prediction.
5. H.264 encoder as claimed in claim 4 is characterized in that, it is independently intra predictor generator of multiplexing same intra predictor generator or two that the intraprediction unit of said decoding subsystem and said is asked the intra-framed prediction module of residual error unit.
6. H.264 encoder as claimed in claim 4; It is characterized in that the reverse dct transform of the reverse dct transform of said decoding subsystem and inverse quantization unit and said coding subsystem and inverse quantization unit are multiplexing same reverse dct transform/inverse DCT or two independently reverse dct transform/inverse DCTs.
7. H.264 encoder as claimed in claim 4; It is characterized in that; Said decoding subsystem also comprises: filter unit is used for before the reference data that said decoding subsystem obtains is cached to said reference data cache module, said reference data being carried out filtering.
8. H.264 encoder as claimed in claim 1; It is characterized in that; Said reference data cache module is a circulating memory; When the reference data that the said decoding subsystem of buffer memory obtains, the reference data of current acquisition covers the reference data that can not re-use when carrying out inter prediction in the said circulating memory.
9. H.264 encoder as claimed in claim 8 is characterized in that said reference data cache module is provided with the memory space of certain macroblock number, and the computing formula of the macroblock number S of its storage is:
S=Ceil(sw_height_by_pix/16)*pic_width_by_mb-(pic_width_by_mb-Ceil(sw_width_by_pix/16))+1
Wherein, Ceil (x) expression is more than or equal to the smallest positive integral of x;
Sw_height_by_pix is to be the height of the search window of unit representation with the pixel;
Sw_width_by_pix is to be the width of the search window of unit representation with the pixel;
Pic_width_by_mb is to be the width of the image of unit representation with the macro block.
10. H.264 encoder as claimed in claim 1 is characterized in that, said decoding subsystem comprises the I frame decoding system of the reference data that is used to provide the I frame type, and said I frame decoding system comprises:
The first entropy decoding unit is used for said I frame reference code stream with reference to code stream is carried out the entropy decoding;
First reverse dct transform and the inverse quantization unit is used for the residual error coefficient of said first entropy decoding unit output is carried out reverse dct transform and inverse quantization;
First intraprediction unit is used for carrying out infra-frame prediction according to the intra prediction mode of said first entropy decoding unit output;
First reconfiguration unit; Be used for the residual error data of the said first reverse dct transform and inverse quantization unit output and the prediction data of first intra-framed prediction module output are carried out addition; Obtain the reconstruct data of said I frame, needed reference data in its search window when being used for the P frame with reference to the decoding of code stream or as the inter prediction of current macro with reference to code stream;
First filter unit is used for the reference data of first reconfiguration unit is carried out filtering.
11. H.264 encoder as claimed in claim 10 is characterized in that, said decoding subsystem also comprises the P frame decoding system of the reference data that is used to provide the P frame type, and said P frame decoding system comprises:
The second entropy decoding unit is used for said P frame reference code stream with reference to code stream is carried out the entropy decoding;
Second reverse dct transform and the inverse quantization unit is used for the residual error coefficient of the said second entropy decoding unit is carried out reverse dct transform and inverse quantization;
Second intraprediction unit is used for carrying out infra-frame prediction according to the intra prediction mode of said second entropy decoding unit output;
Second inter prediction unit is used for carrying out inter prediction according to the reconstruct data of described first reconfiguration unit and the motion vector of said second entropy decoding unit output;
Second reconfiguration unit; Be used for the residual error data of the said second reverse dct transform and inverse quantization unit output and the prediction data of second intraprediction unit or the output of second inter prediction unit are carried out addition; Obtain the reconstruct data of said P frame, needed reference data in its search window when being used for the inter prediction of said current macro with reference to code stream;
Second filter unit is used for the reference data of second reconfiguration unit is carried out filtering.
12. a H.264 coding method is characterized in that, comprises the steps:
(1) judges whether current macro need carry out inter prediction, if do not need inter prediction, then current macro is encoded, and changes step (4) over to, and inter prediction then gets into next step if desired;
(2) be current macro setting search window, judge whether the reference data in the search window is ready to, if, then current macro is encoded according to reference data, change step (4) over to, if not, then get into next step;
(3) reference code stream is decoded, obtain the reference data of a macro block, return step (2);
(4) judge whether to finish coding,, then handle next macro block and return step (1) if do not finish.
13. H.264 coding method as claimed in claim 12 is characterized in that, said reference data is the reference data of I frame type.
14. H.264 coding method as claimed in claim 12 is characterized in that said reference data comprises the reference data of P frame type, the reference data of said P frame type be the reference frame data with the I frame type serve as with reference to encode, decoding obtains.
CN201210272224.9A 2012-08-02 2012-08-02 H264 encoder and coding method Active CN102769753B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210272224.9A CN102769753B (en) 2012-08-02 2012-08-02 H264 encoder and coding method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210272224.9A CN102769753B (en) 2012-08-02 2012-08-02 H264 encoder and coding method

Publications (2)

Publication Number Publication Date
CN102769753A true CN102769753A (en) 2012-11-07
CN102769753B CN102769753B (en) 2015-12-09

Family

ID=47096989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210272224.9A Active CN102769753B (en) 2012-08-02 2012-08-02 H264 encoder and coding method

Country Status (1)

Country Link
CN (1) CN102769753B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104038766A (en) * 2014-05-14 2014-09-10 三星电子(中国)研发中心 Device used for using image frames as basis to execute parallel video coding and method thereof
CN105530517A (en) * 2014-09-29 2016-04-27 炬芯(珠海)科技有限公司 Decoder and lossy decoding video image method
CN110035293A (en) * 2019-04-22 2019-07-19 湖南国科微电子股份有限公司 Electronic equipment and image coded data storage method and device
CN110798684A (en) * 2019-09-30 2020-02-14 武汉兴图新科电子股份有限公司 Image segment peak-shifting coding transmission method
CN111343456A (en) * 2018-12-18 2020-06-26 瑞萨电子株式会社 Video encoding apparatus, method of operating the same, and vehicle equipped with the video encoding apparatus
WO2023193701A1 (en) * 2022-04-06 2023-10-12 展讯通信(上海)有限公司 Image coding method and apparatus

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1905677A (en) * 2006-08-07 2007-01-31 清华大学 Data buffer storage method of variable size block motion compensation and implementing apparatus thereof
CN1964495A (en) * 2006-12-08 2007-05-16 北京中星微电子有限公司 A method and device for carrying out buffer control to real time digital video stream
CN101340588A (en) * 2008-08-20 2009-01-07 炬力集成电路设计有限公司 Motion estimation method, apparatus and multimedia processor
CN101502125A (en) * 2006-09-06 2009-08-05 索尼株式会社 Image data processing method, program for image data processing method, recording medium with recorded program for image data processing method and image data processing device
CN101924938A (en) * 2010-08-11 2010-12-22 上海交通大学 Method for processing adjacent block information in video decoding macro-block prediction and boundary filtering

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1905677A (en) * 2006-08-07 2007-01-31 清华大学 Data buffer storage method of variable size block motion compensation and implementing apparatus thereof
CN101502125A (en) * 2006-09-06 2009-08-05 索尼株式会社 Image data processing method, program for image data processing method, recording medium with recorded program for image data processing method and image data processing device
CN1964495A (en) * 2006-12-08 2007-05-16 北京中星微电子有限公司 A method and device for carrying out buffer control to real time digital video stream
CN101340588A (en) * 2008-08-20 2009-01-07 炬力集成电路设计有限公司 Motion estimation method, apparatus and multimedia processor
CN101924938A (en) * 2010-08-11 2010-12-22 上海交通大学 Method for processing adjacent block information in video decoding macro-block prediction and boundary filtering

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104038766A (en) * 2014-05-14 2014-09-10 三星电子(中国)研发中心 Device used for using image frames as basis to execute parallel video coding and method thereof
CN105530517A (en) * 2014-09-29 2016-04-27 炬芯(珠海)科技有限公司 Decoder and lossy decoding video image method
CN105530517B (en) * 2014-09-29 2018-07-31 炬芯(珠海)科技有限公司 A kind of decoder and the method for damaging decoding video images
CN111343456A (en) * 2018-12-18 2020-06-26 瑞萨电子株式会社 Video encoding apparatus, method of operating the same, and vehicle equipped with the video encoding apparatus
CN110035293A (en) * 2019-04-22 2019-07-19 湖南国科微电子股份有限公司 Electronic equipment and image coded data storage method and device
CN110035293B (en) * 2019-04-22 2022-01-11 湖南国科微电子股份有限公司 Electronic equipment and image coded data storage method and device
CN110798684A (en) * 2019-09-30 2020-02-14 武汉兴图新科电子股份有限公司 Image segment peak-shifting coding transmission method
WO2023193701A1 (en) * 2022-04-06 2023-10-12 展讯通信(上海)有限公司 Image coding method and apparatus

Also Published As

Publication number Publication date
CN102769753B (en) 2015-12-09

Similar Documents

Publication Publication Date Title
KR101279266B1 (en) Flexible macroblock ordering with reduced data traffic and power consumption
KR101030209B1 (en) Efficient memory fetching for motion compensation video decoding process
US9807410B2 (en) Late-stage mode conversions in pipelined video encoders
JP4182442B2 (en) Image data processing apparatus, image data processing method, image data processing method program, and recording medium storing image data processing method program
US9473778B2 (en) Skip thresholding in pipelined video encoders
US8009740B2 (en) Method and system for a parametrized multi-standard deblocking filter for video compression systems
US9948934B2 (en) Estimating rate costs in video encoding operations using entropy encoding statistics
CN102769753B (en) H264 encoder and coding method
CN103460700A (en) Method for decoding image in intra prediction mode
AU2013210274A1 (en) Video decoder, video encoder, video decoding method, and video encoding method
CN104937941A (en) Method for determining predictor blocks for a spatially scalable video codec
KR102390162B1 (en) Apparatus and method for encoding data
EP2517471A1 (en) Temporal and spatial video block reordering in a decoder to improve cache hits
US20120155540A1 (en) Pixel retrieval for frame reconstruction
CN106688234B (en) Processor system, Video Codec and method for image transformation
CN102348119B (en) Predictive coding apparatus and control method thereof
KR20120096452A (en) Methods and apparatus for spatially varying residue coding
Silveira et al. Efficient reference frame compression scheme for video coding systems: algorithm and VLSI design
CN102714717A (en) Low-cost video encoder
WO2021196035A1 (en) Video coding method and apparatus
TWI736528B (en) Multimedia codec, application processor including the same, and method of operating the application processor
CN102801980B (en) A kind of decoding device for scalable video and method
US20130064298A1 (en) Concurrent access shared buffer in a video encoder
JP2007325119A (en) Image processing apparatus and method
US20170323454A1 (en) Apparatus and method for efficient motion estimation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant