Summary of the invention
The present invention provides a kind of video encoding/decoding method and device, not high for solving video decoding degree of parallelism in the prior art
And it is limited to the band number of video data encoder, cause decoding speed lower, the poor problem of decoding efficiency.
The first aspect of the invention is to provide a kind of video encoding/decoding method, comprising:
The corresponding data to be decoded of each image in video data are successively obtained, in the corresponding data to be decoded of described image
It include: multiple maximum coding units;
Current maximum coding unit to be decoded in the corresponding data to be decoded of described image is successively obtained, if described current
Maximum coding unit to be decoded includes interframe encode unit, then is calculated according to the interframe prediction block that interframe encode unit includes
It obtains to reference encoder information first to the maximum coding unit serial number in reference picture, and/or according to interframe encode unit
Including interframe prediction block calculate obtain to reference pixel information second to the maximum coding unit serial number in reference picture;
Described first is obtained to current just in decoded maximum coding unit serial number in reference picture, and/or described in obtaining
The second maximum coding unit serial number to currently filtered in reference picture;
If described first is just compiling greater than described to reference in decoded maximum coding unit serial number to current in reference picture
Code information first in reference picture maximum coding unit serial number and/or described second in reference picture it is current
The maximum coding unit serial number of filtering be greater than it is described to reference pixel information second to the maximum coding unit in reference picture
Serial number is then decoded the current maximum coding unit to be decoded, and judges the current maximum coding to be decoded
Whether the sequence number of unit is greater than default maximum coding unit quantity;
If the sequence number of the current maximum coding unit to be decoded is greater than default maximum coding unit quantity, obtain
Current maximum coding unit to be filtered is filtered current maximum coding unit to be filtered.
Further, the method also includes:
It is corresponding to be decoded to judge whether the sequence number of the current maximum coding unit to be decoded is equal to described image
The sequence number of the last one maximum coding unit in data;
If the sequence number of the current maximum coding unit to be decoded is equal in the corresponding data to be decoded of described image
The sequence number of the last one maximum coding unit then obtains unfiltered all maximums in the corresponding data to be decoded of described image
Coding unit, and unfiltered all maximum coding units in the corresponding data to be decoded of described image are successively filtered.
Further, the interframe prediction block for including according to interframe encode unit calculates to obtain and exist to reference encoder information
First to the maximum coding unit serial number in reference picture, comprising:
Motion information storage unit is described first to the position in reference picture where obtaining the information to reference encoder
It sets;
According to motion information storage unit where the information to reference encoder described first to the position in reference picture
It sets, calculates maximum coding unit where obtaining the information to reference encoder described first to the position in reference picture;
According to maximum coding unit where the information to reference encoder described first to the position in reference picture, meter
Calculate it is described to reference encoder information described first to the maximum coding unit serial number in reference picture.
Further, the interframe prediction block for including according to interframe encode unit calculates to obtain and exist to reference pixel information
Second to the maximum coding unit serial number in reference picture, comprising:
The Pixel Information of interframe prediction block described in the interframe encode unit is obtained, the Pixel Information includes: described
The top left corner pixel coordinate of interframe prediction block, the height of the width of the interframe prediction block and the interframe prediction block;
Obtain the interframe prediction block to reference pixel information in the second movement to the pixel region in reference picture
Vector;
The bottom right angular coordinate of the pixel region is calculated according to the motion vector and the Pixel Information;
The bottom right angular coordinate is compensated according to preset offset;
The bottom right angular coordinate is compensated according to preset propagation;
The bottom right angular coordinate is calculated described second to the maximum coding unit serial number in reference picture.
Further, the method further include:
If described first is described wait join to currently just be less than or equal in decoded maximum coding unit serial number in reference picture
Encoded information is examined first to the maximum coding unit serial number in reference picture, and/or, described second to current in reference picture
The maximum coding unit serial number filtered be less than or equal to it is described to reference pixel information second to the maximum in reference picture
Coding unit serial number then waits described first to be decoded and/or wait described second to carry out to reference picture to reference picture
Filtering, until described first is described to reference encoder to currently just be greater than in decoded maximum coding unit serial number in reference picture
Information first to the maximum coding unit serial number and/or described second in reference picture to currently filtered in reference picture
The maximum coding unit serial number of wave be greater than it is described to reference pixel information second to the maximum coding unit sequence in reference picture
Until number.
Further, the method further include:
If the current maximum coding unit to be decoded does not include interframe encode unit, to described current to be decoded
Maximum coding unit be decoded, and it is default to judge whether the sequence number of the current maximum coding unit to be decoded is greater than
The sequence of the last one maximum coding unit in maximum coding unit quantity or data to be decoded corresponding equal to described image
Number;If the sequence number of the current maximum coding unit to be decoded is greater than default maximum coding unit quantity, obtain current
Maximum coding unit to be filtered is filtered current maximum coding unit to be filtered;Described image is corresponding to be decoded
In data in current maximum coding unit serial number data to be decoded corresponding to the image to be decoded it is current it is to be filtered most
Difference between big coding unit serial number is default maximum coding unit quantity;If the current maximum coding unit to be decoded
Sequence number be equal to the corresponding data to be decoded of described image in the last one maximum coding unit sequence number, then obtain described in
Unfiltered all maximum coding units in the corresponding data to be decoded of image, and in the corresponding data to be decoded of described image
Unfiltered all maximum coding units are successively filtered.
In the present invention, by successively obtaining the corresponding data to be decoded of each image in video data, image it is corresponding to
It include: multiple maximum coding units in decoding data;Current maximum to be decoded in data to be decoded corresponding to image
Before coding unit is decoded, whether the current maximum coding unit to be decoded of first judgement includes interframe encode unit, if so,
Then just it is being greater than to reference encoder information in decoded maximum coding unit serial number to reference picture to current in reference picture
In maximum coding unit serial number, and/or to which currently the maximum coding unit serial number that is filtering is greater than wait join in reference picture
Pixel Information is examined when the maximum coding unit serial number in reference picture, current maximum coding unit to be decoded is solved
Code, and judge whether the sequence number of current maximum coding unit to be decoded is greater than default maximum coding unit quantity;If current
The sequence number of maximum coding unit to be decoded is greater than default maximum coding unit quantity, then obtains current maximum to be filtered and compile
Code unit is filtered current maximum coding unit to be filtered.To realize parallel decoding and filtering, band knot is avoided
The limitation of structure improves decoding speed, improves decoding efficiency.
The second aspect of the invention is to provide a kind of video decoder, comprising:
Module is obtained, for successively obtaining the corresponding data to be decoded of each image in video data, described image is corresponding
Data to be decoded in include: multiple maximum coding units;
The acquisition module is also used to, and successively obtains current maximum to be decoded in the corresponding data to be decoded of described image
Coding unit;
Computing module, for when the current maximum coding unit to be decoded includes interframe encode unit, according to
The interframe prediction block that interframe encode unit includes is calculated to obtain and be compiled first to the maximum in reference picture to reference encoder information
Code unit number, and/or the interframe prediction block for including according to interframe encode unit calculate acquisition to reference pixel information second
To the maximum coding unit serial number in reference picture;
The acquisition module is also used to obtain described first to current just in decoded maximum coding unit in reference picture
Serial number, and/or obtain the described second maximum coding unit serial number to currently filter in reference picture;
First decoder module is used for described first to current just in decoded maximum coding unit serial number in reference picture
Greater than it is described to reference encoder information first to the maximum coding unit serial number and/or described second in reference picture wait join
Examine in image the maximum coding unit serial number currently filtered be greater than it is described to reference pixel information second to reference picture
In maximum coding unit serial number when, the current maximum coding unit to be decoded is decoded, and judges described current
Whether the sequence number of maximum coding unit to be decoded is greater than default maximum coding unit quantity;If it is described it is current it is to be decoded most
The sequence number of big coding unit is greater than default maximum coding unit quantity, then obtains current maximum coding unit to be filtered, right
Current maximum coding unit to be filtered is filtered.
Further, first deciphering module is also used to judge the sequence of the current maximum coding unit to be decoded
Whether row number is equal to the sequence number of the last one maximum coding unit in the corresponding data to be decoded of described image;Described current
It is single that the sequence number of maximum coding unit to be decoded is equal to the last one maximum coding in the corresponding data to be decoded of described image
When the sequence number of member, unfiltered all maximum coding units in the corresponding data to be decoded of described image are obtained, and to described
Unfiltered all maximum coding units are successively filtered in the corresponding data to be decoded of image.
Further, the computing module is specifically used for,
The computing module is specifically used for,
Motion information storage unit is described first to the position in reference picture where obtaining the information to reference encoder
It sets;
According to motion information storage unit where the information to reference encoder described first to the position in reference picture
It sets, calculates maximum coding unit where obtaining the information to reference encoder described first to the position in reference picture;
According to maximum coding unit where the information to reference encoder described first to the position in reference picture, meter
Calculate it is described to reference encoder information described first to the maximum coding unit serial number in reference picture.
Further, the computing module is specifically used for,
The Pixel Information of interframe prediction block described in the interframe encode unit is obtained, the Pixel Information includes: described
The top left corner pixel coordinate of interframe prediction block, the height of the width of the interframe prediction block and the interframe prediction block;
Obtain the interframe prediction block to reference pixel information in the second movement to the pixel region in reference picture
Vector;
The bottom right angular coordinate of the pixel region is calculated according to the motion vector and the Pixel Information;
The bottom right angular coordinate is compensated according to preset offset;
The bottom right angular coordinate is compensated according to preset propagation;
The bottom right angular coordinate is calculated described second to the maximum coding unit serial number in reference picture.
Further, the judgment module is also used to, described first to current just in decoded maximum in reference picture
Coding unit serial number be less than or equal to it is described to reference encoder information first to the maximum coding unit serial number in reference picture,
And/or described second in reference picture currently the maximum coding unit serial number that is filtering be less than or equal to it is described to reference image
Prime information when the maximum coding unit serial number in reference picture, waits described first to be decoded to reference picture second
And/or wait and described second being filtered to reference picture, until described first in reference picture it is current just it is decoded most
Big coding unit serial number be greater than it is described to reference encoder information first to the maximum coding unit serial number in reference picture, and/
Or the described second maximum coding unit serial number to currently filter in reference picture exists greater than described to reference pixel information
Until second to the maximum coding unit serial number in reference picture.
Further, the device further include: the second decoder module;
Second decoder module, for not including interframe encode unit in the maximum coding unit to be decoded
When, the current maximum coding unit to be decoded is decoded, and judge the current maximum coding unit to be decoded
Sequence number whether be greater than default maximum coding unit quantity or be equal to the corresponding data to be decoded of described image in last
The sequence number of a maximum coding unit;If the sequence number of the current maximum coding unit to be decoded is greater than default maximum coding
Element number then obtains current maximum coding unit to be filtered, is filtered to current maximum coding unit to be filtered;Institute
State current maximum coding unit serial number number to be decoded corresponding to the image to be decoded in the corresponding data to be decoded of image
Difference between current maximum coding unit serial number to be filtered is default maximum coding unit quantity;If it is described currently to
The sequence number of decoded maximum coding unit is equal to the last one maximum coding unit in the corresponding data to be decoded of described image
Sequence number, then obtain unfiltered all maximum coding units in the corresponding data to be decoded of described image, and to the figure
As unfiltered all maximum coding units are successively filtered in corresponding data to be decoded.
In the present invention, by successively obtaining the corresponding data to be decoded of each image in video data, image it is corresponding to
It include: multiple maximum coding units in decoding data;Current maximum to be decoded in data to be decoded corresponding to image
Before coding unit is decoded, whether the current maximum coding unit to be decoded of first judgement includes interframe encode unit, if so,
Then just it is being greater than to reference encoder information in decoded maximum coding unit serial number to reference picture to current in reference picture
In maximum coding unit serial number, and/or to which currently the maximum coding unit serial number that is filtering is greater than wait join in reference picture
Pixel Information is examined when the maximum coding unit serial number in reference picture, current maximum coding unit to be decoded is solved
Code, and judge whether the sequence number of current maximum coding unit to be decoded is greater than default maximum coding unit quantity;If current
The sequence number of maximum coding unit to be decoded is greater than default maximum coding unit quantity, then obtains current maximum to be filtered and compile
Code unit is filtered current maximum coding unit to be filtered.To realize parallel decoding and filtering, band knot is avoided
The limitation of structure improves decoding speed, improves decoding efficiency.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
Fig. 1 is the flow chart of video encoding/decoding method one embodiment provided by the invention, as shown in Figure 1, comprising:
101, the corresponding data to be decoded of each image in video data are successively obtained, in the corresponding data to be decoded of image
It include: multiple maximum coding units.
The executing subject of video encoding/decoding method provided by the invention is video decoder, and video decoder specifically can be with
To carry out the decoded software of video, or the hardware of software is installed.
The process that the corresponding data to be decoded of each image in video data are obtained in step 101 can specifically include: (1)
Video sequence head is parsed, includes the data packet of the predicable of all images in video sequence head;(2) it parses in image head
Data, the data in image head include the attribute of correspondence image;(3) it reads after the image head until next image head
Data, the data to be decoded as piece image;If first encountering sequence head or sequence tail after the image head, the figure is read
Data to be decoded as the data after head until the sequence head until or before sequence tail, as piece image;It (4) will be from video
The general character attribute parsed in sequence head, invests in the data to be decoded of piece image, becomes the complete to be decoded of piece image
Data.
Wherein, the size of maximum coding unit is as defined in coding standard.In H.264 (AVC) standard, maximum coding
The size of unit is 16x16 luminance pixel block;In AVS2-P2 standard, the size of maximum coding unit can be 16x16 brightness
Block of pixels, 32x32 luminance pixel block, 64x64 luminance pixel block, encoder from can coding when therefrom select.
102, current maximum coding unit to be decoded in the corresponding data to be decoded of image is successively obtained.
In the present embodiment, current maximum coding unit to be decoded is made of several coding units in data to be decoded, is compiled
The size of code unit is less than or equal to the size of current maximum coding unit to be decoded.Coding unit can be inter prediction encoding
Unit can also be intra prediction encoding unit.It include several interframe prediction blocks in interframe encode unit.
If 103, current maximum coding unit to be decoded includes interframe encode unit, according to interframe encode unit packet
The interframe prediction block included, which calculates, to be obtained to reference encoder information first to the maximum coding unit serial number in reference picture, and/
Or the interframe prediction block for according to interframe encode unit including is calculated and is obtained to reference pixel information second in reference picture
Maximum coding unit serial number.
In the present embodiment, judgement is currently to be decoded most successively to be judged to current maximum coding unit to be decoded
It whether include interframe encode unit in big coding unit.
Wherein, if current maximum coding unit to be decoded includes interframe encode unit, illustrate current to be decoded
Maximum coding unit need to be referred to reference picture when being decoded to reference encoder information.Current maximum coding to be decoded is single
Member both can with reference in the corresponding data to be decoded of this image to reference encoder information, can also be corresponding with reference to other images
Therefore band reference encoder information in data to be decoded can be image to reference picture, be also possible to other images.
It wherein, is to be advised in coding standard to encoded information obtained in reference picture decoding process to reference encoder information
The acquisition modes of image decoding process and reference encoder information are determined.Reference encoder information may include: type of prediction and fortune
Dynamic vector etc..
It wherein, is to be advised in filter performance criteria to Pixel Information obtained in reference picture filtering to reference pixel information
Determine the acquisition modes of image filtering process and reference pixel information,
Wherein, first can be different width to reference picture to reference picture to reference picture and second, or
Same width waits for reference picture.
104, first is obtained to current just in decoded maximum coding unit serial number, and/or acquisition second in reference picture
Maximum coding unit serial number to currently filtered in reference picture.
Specifically, in the present embodiment, first can be obtained to current just in decoded maximum coding unit sequence in reference picture
Number, second can also be obtained to the current maximum coding unit serial number that is filtering in reference picture, or obtain acquisition the simultaneously
One to current just in decoded maximum coding unit serial number and second to currently filter in reference picture in reference picture
Maximum coding unit serial number.
If 105, first is just being greater than in decoded maximum coding unit serial number to reference encoder letter to current in reference picture
It ceases first to the maximum coding unit serial number and/or second in reference picture to currently filtered most in reference picture
Big coding unit serial number is greater than to reference pixel information second to the maximum coding unit serial number in reference picture, then to current
Maximum coding unit to be decoded is decoded, and it is pre- to judge whether the sequence number of current maximum coding unit to be decoded is greater than
If maximum coding unit quantity;If the sequence number of the current maximum coding unit to be decoded is greater than default maximum coding unit
Quantity then obtains current maximum coding unit to be filtered, is filtered to current maximum coding unit to be filtered.
Specifically, in the present embodiment, judge first to current just in decoded maximum coding unit serial number in reference picture
Whether it is greater than to reference encoder information first to the maximum coding unit serial number in reference picture, and/or judges second wait join
Examine whether the maximum coding unit serial number currently filtered in image is greater than to reference pixel information second to reference picture
In maximum coding unit serial number.
Specifically, it in the present embodiment, can determine whether first to current just in decoded maximum coding unit sequence in reference picture
Number whether it is greater than to reference encoder information first to the maximum coding unit serial number in reference picture, or judges second wait join
Examine whether the maximum coding unit serial number currently filtered in image is greater than to reference pixel information second to reference picture
In maximum coding unit serial number, or judged simultaneously first to current just in decoded maximum coding unit sequence in reference picture
Number whether be greater than to reference encoder information first to the maximum coding unit serial number and second in reference picture to reference picture
In currently the maximum coding unit serial number that is filtering whether be greater than to reference pixel information second in reference picture most
Big coding unit serial number.
Wherein, in the present embodiment, if first to currently just be greater than in decoded maximum coding unit serial number in reference picture
It is to reference encoder information first to the maximum coding unit serial number in reference picture, then single to current maximum coding to be decoded
Member is decoded.
Alternatively, believing if the second maximum coding unit serial number to currently filter in reference picture is greater than to reference pixel
Breath to the maximum coding unit serial number in reference picture, is then decoded current maximum coding unit to be decoded second.
Alternatively, if first is just being greater than in decoded maximum coding unit serial number to reference encoder letter to current in reference picture
It ceases first to the maximum coding unit serial number in reference picture and the second maximum volume to currently filtered in reference picture
Code unit number is greater than to reference pixel information second to the maximum coding unit serial number in reference picture, then to currently wait solve
The maximum coding unit of code is decoded.
After being decoded to current maximum coding unit to be decoded, the sequence of the current maximum coding unit to be decoded of judgement
Whether row number is greater than default maximum coding unit quantity, if so, obtain current maximum coding unit to be filtered, to currently to
The maximum coding unit of filtering is filtered.
Wherein, presetting maximum coding unit quantity is current maximum coding to be decoded in the corresponding data to be decoded of image
Difference in unit number data to be decoded corresponding with image between current maximum coding unit serial number to be filtered, setting
Numerical value it is related with specific coding standard, can according to the professional knowledge of Video coding determine.
Wherein, if default maximum coding unit quantity is id_distance, the maximum in the corresponding data to be decoded of image
The quantity of coding unit is id_count, current just in decoded maximum coding unit serial number in the corresponding data to be decoded of image
For id_decode, the maximum coding unit serial number id_filter that is currently being filtered in the corresponding data to be decoded of image.
It obtains current just in decoded maximum coding unit serial number, and acquisition image in the corresponding data to be decoded of image
The process of the maximum coding unit serial number currently filtered in corresponding data to be decoded can specifically include: (1) to figure
Before being decoded as corresponding data to be decoded, first id_decode and id_filter are initialized: id_decode=
0;Id_filter=id_decode-id_distance;(2) successively in the corresponding data to be decoded of decoding image it is each most
Big coding unit, every when having decoded a maximum coding unit, id_decode=id_decode+1;Id_filter=id_
decode–id_distance;(3) if id_filter >=0, the maximum coding unit of serial number id_filter is filtered
Wave;Id_filter=id_filter+1;(4) if id_decode==id_count, indicate that image decoding is completed, then to sequence
Number it is greater than or equal to id_filter and is successively filtered less than the maximum coding unit of id_count.
Further, on the basis of embodiment shown in Fig. 1, this method further include: the current maximum volume to be decoded of judgement
Whether the sequence number of code unit is equal to the sequence number of the last one maximum coding unit in the corresponding data to be decoded of image;If working as
The sequence number of preceding maximum coding unit to be decoded is equal to the last one maximum coding unit in the corresponding data to be decoded of image
Sequence number, then obtain unfiltered all maximum coding units in the corresponding data to be decoded of image, and corresponding to image
Unfiltered all maximum coding units are successively filtered in data to be decoded.
Further, on the basis of embodiment shown in Fig. 1, this method further include: if first to current in reference picture
Just it is less than or equal to reference encoder information first in decoded maximum coding unit serial number to the maximum coding in reference picture
Unit number, and/or, the second maximum coding unit serial number to currently filter in reference picture is less than or equal to reference image
Prime information second to the maximum coding unit serial number in reference picture, then wait first be decoded to reference picture and/or
Second is waited to be filtered to reference picture, up to first to current just in decoded maximum coding unit serial number in reference picture
Greater than to reference encoder information first to the maximum coding unit serial number and/or second in reference picture in reference picture
The maximum coding unit serial number currently filtered is greater than to reference pixel information second to the maximum coding in reference picture
Until unit number.
Further, on the basis of embodiment shown in Fig. 1, this method further include: if current maximum coding to be decoded
Unit does not include interframe encode unit, then is decoded to current maximum coding unit to be decoded, and judge currently wait solve
Whether the sequence number of the maximum coding unit of code is greater than default maximum coding unit quantity or corresponding to be decoded equal to image
The sequence number of the last one maximum coding unit in data;If the sequence number of current maximum coding unit to be decoded is greater than default
Maximum coding unit quantity then obtains current maximum coding unit to be filtered, to current maximum coding unit to be filtered into
Row filtering;Current maximum coding unit serial number number to be decoded corresponding with image to be decoded in the corresponding data to be decoded of image
Difference between current maximum coding unit serial number to be filtered is default maximum coding unit quantity;If current to be decoded
Maximum coding unit sequence number be equal to the corresponding data to be decoded of image in the last one maximum coding unit sequence number,
Unfiltered all maximum coding units in the corresponding data to be decoded of image are then obtained, and to the corresponding data to be decoded of image
In unfiltered all maximum coding units be successively filtered.
It is illustrated so that a width has the image of 48 maximum coding units as an example below, as shown in Fig. 2, Fig. 2 is the present invention
Image decoding and the schematic diagram of filtering in the video encoding/decoding method of offer.There are 48 maximum coding units for a width
A thread synchronization can be used to complete decoding and filtering for the image of (Largest Coding Unit, LCU).When decoding
When LCU 38, can at most complete on LCU 27 part and its forefoot area filtering.It, can be complete when LCU38, which is decoded, to be completed
At the filtering of part on LCU28, then start the decoding of LCU39.When LCU47, which is decoded, to be completed, i.e. entire image decoding is completed
When, the filtering of remaining area can be sequentially completed.Therefore, the filtering in piece image is synchronous carry out with decoding.If realizing
Image level is parallel, not only can be with parallel decoding, but also can not also be limited by encoding strip thereof number with parallel filtering, degree of parallelism.
Since there are dependences between the image of video, so image level need to carry out synchronizing between image parallel.Between image
Dependence can be divided into encoded information reference and Filtered Picture prime information with reference to two kinds.Other images need to refer to present image
When, it is only necessary to know that present image may know that decoded region and the region filtered just in decoded maximum coding unit.
When decoding LCU 38, LCU 37 and its maximum coding unit before have decoded, part and its before on LCU 27
Maximum coding unit has filtered.If other threads need to refer to the encoded information after LCU 37, or with reference to after LCU 27
Pixel Information then needs to wait for, and the maximum coding unit decoding where referenced encoded information is completed or referenced Pixel Information
Maximum coding unit filtering in place is completed;Otherwise it directly refers to, without waiting.
Image level multi-threaded parallel coding/decoding method is realized by the thread pool of a first in first out.In thread pool, each
Decoding thread obtain a decoding image handle after start to decode, it is each decoding image handle in include its referenced by wait refer to
The pointer of image handle, therefore decoding thread can obtain the decoding progress to reference picture in real time.
To avoid causing to decode to reference picture prior to present image and completing and discharge, in turn because asynchronous between multithreading
The output of image random ordering or the failure of image handle are caused, needs to synchronize multithreading, to guarantee the suitable of multithreading release image
Sequence is still identical as the single thread release sequence of image.For this purpose, devising the thread pool framework of first in first out.Such as Fig. 3 a, Fig. 3 b and
Shown in Fig. 3 c, by taking thread tankage is equal to 4 as an example:
When starting decoding, image P0~P3 is sequentially allocated and starts parallel decoding to thread T0~T3;When image P0 is decoded
When completion, is discharged from thread T0, image P4 is distributed into thread T0 and starts to decode, because image P1, which possesses it, waits for reference picture
The handle h0 of P0, so thread T0 release image P0 can't influence the decoding of image P1.When image P1, which is decoded, to be completed, from line
Journey T1 release, distributes to thread T1 for image P5 and starts to decode, image P0 is deleted because not being referenced.
It is completed assuming that image P1 is decoded prior to image P0, thread T1, which also has to wait for thread T0, to be terminated, i.e., in thread pool
Thread starts and exits the sequence according to first in first out --- decoding order and solution for every piece image, when multithreading
Code environment, with equivalence when single thread.
Experiment shows to realize the method, can realize that multithreading decoding can be on the basis of realizing that single thread is decoded
Significant acceleration can be obtained on multi-core processor.
1 LentAVS2Dec of table each thread decoding speed (i7-4790,3.60GHz x 4,8.00GB, Win8.1Pro
x64)
In the present embodiment, by successively obtaining the corresponding data to be decoded of each image in video data, image is corresponding
It include: multiple maximum coding units in data to be decoded;In data to be decoded corresponding to image it is current it is to be decoded most
Before big coding unit is decoded, whether the current maximum coding unit to be decoded of first judgement includes interframe encode unit, if
Have, is then just being greater than to reference encoder information in decoded maximum coding unit serial number to reference to figure to current in reference picture
Maximum coding unit serial number as in, and/or in reference picture currently the maximum coding unit serial number that is filtering be greater than to
Reference pixel information carries out current maximum coding unit to be decoded when the maximum coding unit serial number in reference picture
Decoding, and judge whether the sequence number of current maximum coding unit to be decoded is greater than default maximum coding unit quantity or waits
The sequence number of the last one maximum coding unit in the corresponding data to be decoded of image;If current maximum coding to be decoded is single
The sequence number of member is greater than default maximum coding unit quantity, then obtains current maximum coding unit to be filtered, to current to be filtered
The maximum coding unit of wave is filtered;If it is corresponding wait solve that the sequence number of current maximum coding unit to be decoded is equal to image
The sequence number of the last one maximum coding unit in code data then obtains unfiltered all in the corresponding data to be decoded of image
Maximum coding unit, and unfiltered all maximum coding units in the corresponding data to be decoded of image are successively filtered.
To realize parallel decoding and filtering, the limitation of ribbon structure is avoided, improves decoding speed, improves decoding efficiency.
Fig. 4 is the flow chart of video encoding/decoding method one embodiment provided by the invention, as shown in figure 4, reality shown in Fig. 1
On the basis of applying example, step 103 includes:
1031, it obtains to motion information storage unit where reference encoder information first to the position in reference picture.
Wherein, after maximum coding unit is decoded, corresponding encoded information can be saved into motion information storage unit, so
Afterwards first to find " the fortune for storing required reference encoder information in numerous " the motion information storage units " in reference picture
Dynamic information memory cell ".Lookup method is exactly calculating process here.Motion information storage unit provides by coding standard, no
It H.265 and in AVS2-P2 is all being 16x16 luminance pixel block size greater than " maximum coding unit ".
1032, according to motion information storage unit where reference encoder information first to the position in reference picture,
It calculates and obtains to maximum coding unit where reference encoder information first to the position in reference picture.
1033, according to maximum coding unit where reference encoder information first to the position in reference picture, calculate
To reference encoder information first to the maximum coding unit serial number in reference picture.
Wherein it is possible to by being denoted as to motion information storage unit where reference encoder information to the position in reference picture
(misu_x,misu_y)。
To maximum coding unit where reference encoder information first to the position (lcu_x, lcu_y) in reference picture
Shown in calculation formula such as formula (1) and formula (2):
Lcu_x=misu_x > > (lcu_size_in_bit-misu_size_in_bit) (1)
Lcu_y=misu_y > > (lcu_size_in_bit-misu_size_in_bit) (2)
To reference encoder information in the first calculation formula such as formula (3) to the maximum coding unit serial number in reference picture
It is shown:
Id_ref_decoded=lcu_y*lcu_width+lcu_x (3)
Wherein, lcu_size_in_bit indicate maximum coding unit size with 2 for bottom logarithm, value can be according to video
Sequence head export, value range are provided by coding standard;Misu_size_in_bit indicates motion information storage unit size
With 2 for bottom logarithm, value provides by coding standard;Lcu_width indicates of horizontal direction maximum coding unit in image
Number, can be determined by derived video attribute in video sequence head.
1034, the Pixel Information of interframe prediction block in interframe coding unit is obtained, Pixel Information includes: interframe prediction block
Top left corner pixel coordinate, the width of interframe prediction block and the height of interframe prediction block.
Wherein it is possible to which the top left corner pixel coordinate of interframe prediction block is denoted as (x0, y0), the width of interframe prediction block is remembered
For width, the height of interframe prediction block is denoted as height.
1035, obtain interframe prediction block to reference pixel information in the second movement to the pixel region in reference picture
Vector.
1036, the bottom right angular coordinate of pixel region is calculated according to motion vector and Pixel Information.
Wherein it is possible to which motion vector is denoted as (mv.x, mv.y).
The calculation formula of the bottom right angular coordinate (x, y) of pixel region can be as shown in formula (4) and formula (5):
X=x0+width+ (mv.x > > shift) (4)
Y=y0+height+ (mv.y > > shift) (5)
Wherein, shift is to divide pixel precision shift amount, can be determined according to coding standard and video format.For YUV420
For the video of format, the shift=2 of luma prediction block, the shift=3. of colorimetric prediction block
1037, bottom right angular coordinate is compensated according to preset offset.
Wherein, due to the pixel in the basic unit of filtering not instead of interframe prediction block, if interframe prediction block is moved to left
Dry pixel (offset.x) moves up the pixel region in the filter unit of several pixels (offset.y) again.Therefore, pixel region is used
Whether interframe prediction block where the angular coordinate of domain bottom right has decoded to determine whether when can refer to, and needs plus this offset.This
A offset can be determined by coding standard, be denoted as (offset.x, offset.y), and the formula of compensated bottom right angular coordinate is such as public
Shown in formula (6) and formula (7):
X=x+offset.x (6)
Y=y+offset.y (7)
1038, bottom right angular coordinate is compensated according to preset propagation.
Wherein, since newly encoded Standard General all supports the inter-prediction for dividing pixel precision, if with reference to location of pixels is divided
Pixel, it is also necessary to be carried out according to several whole pixels (expand.y) of whole pixels (expand.x) several below pixel region and right side
Interpolation can just obtain the reference pixel on pixel region lower boundary and right margin.This propagation can be determining according to coding standard,
It is denoted as (expand.x, expand.y), as shown in formula (8) and formula (9):
If(mv.x&frac)
X=x+expand.x (8)
If(mv.y&frac)
Y=y+expand.y (9)
Wherein, frac indicates pixel precision digit, can be determined according to coding standard and video format.For the view of YUV420
For frequency format, the frac=0x03 of luma prediction block, the frac=0x07 of colorimetric prediction block.
1039, bottom right angular coordinate is calculated second to the maximum coding unit serial number in reference picture.
Specifically, (10) successively calculate pixel region to formula (14) second in reference picture according to the following formula
Maximum coding unit serial number where position, and the pixel region including bottom right angular coordinate;
Lcu_x=x > > (lcu_size_in_bit-lcu_shift) (10)
Lcu_y=y > > (lcu_size_in_bit-lcu_shift) (11)
Lcu_x=clip3 (0, lcu_width-1, lcu_x) (12)
Lcu_y=clip3 (0, lcu_height-1, lcu_y) (13)
Id_ref_filtered=lcu_y*lcu_width+lcu_x (14)
Wherein: lcu_size_in_bit indicate maximum coding unit size with 2 for bottom logarithm, value can be according to video
Sequence head export, value range are provided by coding standard;Lcu_shift indicate maximum coding unit size with 2 for bottom pair
Number, is determined by video format, and for YUV420 video, the lcu_shift=0 of maximum coding unit luminance component is maximum
The lcu_shift=1 of coding unit chromatic component;Lcu_width indicates that second encodes to horizontal direction maximum in reference picture
The number of unit can be determined by derived video attribute in video sequence head;Lcu_height expression second is to reference picture
The number of middle vertical direction maximum coding unit can be determined by derived video attribute in video sequence head;clip3(min,
Max, x) function usually provides in a standard, the value of variable x is limited in the section [min, max] by expression.Due to some codings
Standard permission second is counted to the pixel (extension that coding standard is generally specified as image edge pixels) outside reference picture
(x, y) calculated is possible to beyond image range, namely (lcu_x, lcu_y) may exceed image range, therefore with clip3 function
Limit value range.
In the present embodiment, by successively obtaining the corresponding data to be decoded of each image in video data, image is corresponding
It include: multiple maximum coding units in data to be decoded;In data to be decoded corresponding to image it is current it is to be decoded most
Before big coding unit is decoded, whether the current maximum coding unit to be decoded of first judgement includes interframe encode unit, if
Have, is then just being greater than to reference encoder information in decoded maximum coding unit serial number to reference to figure to current in reference picture
Maximum coding unit serial number as in, and/or in reference picture currently the maximum coding unit serial number that is filtering be greater than to
Reference pixel information carries out current maximum coding unit to be decoded when the maximum coding unit serial number in reference picture
Decoding, and judge whether the sequence number of current maximum coding unit to be decoded is greater than default maximum coding unit quantity;If working as
The sequence number of preceding maximum coding unit to be decoded is greater than default maximum coding unit quantity, then obtains current maximum to be filtered
Coding unit is filtered current maximum coding unit to be filtered.To realize parallel decoding and filtering, band is avoided
The limitation of structure improves decoding speed, improves decoding efficiency.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above-mentioned each method embodiment can lead to
The relevant hardware of program instruction is crossed to complete.Program above-mentioned can be stored in a computer readable storage medium.The journey
When being executed, execution includes the steps that above-mentioned each method embodiment to sequence;And storage medium above-mentioned include: ROM, RAM, magnetic disk or
The various media that can store program code such as person's CD.
Fig. 4 is the structural schematic diagram of video decoder one embodiment provided by the invention, as shown in Figure 4, comprising:
Module 41 is obtained, for successively obtaining the corresponding data to be decoded of each image in video data, image is corresponding
It include: multiple maximum coding units in data to be decoded;
It obtains module 41 to be also used to, it is single successively to obtain current maximum coding to be decoded in the corresponding data to be decoded of image
Member;
Computing module 42, for when current maximum coding unit to be decoded includes interframe encode unit, according to frame
Between coding unit include interframe prediction block calculate obtain to reference encoder information first in reference picture maximum coding
Unit number, and/or the interframe prediction block that includes according to interframe encode unit calculate obtain to reference pixel information second to
Maximum coding unit serial number in reference picture;
Module 41 is obtained, is also used to obtain first to current just in decoded maximum coding unit serial number in reference picture,
And/or obtain the second maximum coding unit serial number to currently filter in reference picture;
First decoder module 43, for first in reference picture it is current just in decoded maximum coding unit serial number it is big
In to reference encoder information first in reference picture maximum coding unit serial number and/or second in reference picture when
The preceding maximum coding unit serial number filtered is greater than single to the maximum coding in reference picture second to reference pixel information
When first serial number, current maximum coding unit to be decoded is decoded, and judges current maximum coding unit to be decoded
Whether sequence number is greater than default maximum coding unit quantity;If the sequence number of current maximum coding unit to be decoded is greater than default
Maximum coding unit quantity then obtains current maximum coding unit to be filtered, to current maximum coding unit to be filtered into
Row filtering.
Wherein, video decoder provided by the invention, which is specifically as follows, carries out the decoded software of video, or is equipped with
The hardware of software.The process for obtaining the corresponding data to be decoded of each image in the acquisition video data of module 41 specifically can wrap
It includes: (1) parsing video sequence head, include the data packet of the predicable of all images in video sequence head;(2) image is parsed
Data in head, the data in image head include the attribute of correspondence image;(3) image head is read later until next image
Data before head, the data to be decoded as piece image;If first encountering sequence head or sequence tail after the image head, read
Take data of the image head later until sequence head or before sequence tail, the data to be decoded as piece image;(4) will
The general character attribute parsed from video sequence head, invests in the data to be decoded of piece image, becomes the complete of piece image
Data to be decoded.
Further, the first deciphering module 43 is also used to judge that the sequence number of current maximum coding unit to be decoded is
The no sequence number equal to the last one maximum coding unit in the corresponding data to be decoded of image;In current maximum volume to be decoded
When the sequence number of code unit is equal to the sequence number of the last one maximum coding unit in the corresponding data to be decoded of image, figure is obtained
As unfiltered all maximum coding units in corresponding data to be decoded, and to unfiltered in the corresponding data to be decoded of image
All maximum coding units be successively filtered.
Further, computing module 42 is specifically used for, and obtains and exists to motion information storage unit where reference encoder information
First to the position in reference picture;According to motion information storage unit where reference encoder information first to reference picture
In position, calculate and obtain to maximum coding unit where reference encoder information first to the position in reference picture;According to
To maximum coding unit where reference encoder information first to the position in reference picture, calculate to reference encoder information the
One to the maximum coding unit serial number in reference picture.
Further, computing module 42 is specifically used for, and obtains the Pixel Information of interframe prediction block in interframe coding unit, as
Prime information includes: the top left corner pixel coordinate of interframe prediction block, the width of interframe prediction block and the height of interframe prediction block;
Obtain interframe prediction block to reference pixel information in the second motion vector to the pixel region in reference picture;According to movement
Vector and Pixel Information calculate the bottom right angular coordinate of pixel region;Bottom right angular coordinate is mended according to preset offset
It repays;Bottom right angular coordinate is compensated according to preset propagation;Calculate bottom right angular coordinate second in reference picture most
Big coding unit serial number.
In conjunction with reference Fig. 5, on the basis of the embodiment shown in fig. 4, the device further include: judgment module 44 and the second decoding
Module 45;
Further, judgment module 44 are used for first to current just in decoded maximum coding unit in reference picture
Serial number is less than or equal to reference encoder information first to the maximum coding unit serial number in reference picture, and/or, second wait join
The maximum coding unit serial number currently filtered in image is examined to be less than or equal to reference pixel information second to reference picture
In maximum coding unit serial number when, wait first be decoded and/or wait to reference picture second to reference picture progress
Filtering, until first is just being greater than to reference encoder information in decoded maximum coding unit serial number the to current in reference picture
One to the maximum coding unit serial number and/or the second maximum coding to currently filter in reference picture in reference picture
Unit number be greater than to reference pixel information second to the maximum coding unit serial number in reference picture until.
Second decoder module 45, for when maximum coding unit to be decoded does not include interframe encode unit, to working as
Preceding maximum coding unit to be decoded is decoded, and judges whether the sequence number of current maximum coding unit to be decoded is greater than
The sequence of the last one maximum coding unit in default maximum coding unit quantity or data to be decoded corresponding equal to image
Number;If the sequence number of current maximum coding unit to be decoded is greater than default maximum coding unit quantity, obtain current to be filtered
The maximum coding unit of wave is filtered current maximum coding unit to be filtered;In the corresponding data to be decoded of image when
Current maximum coding unit sequence to be filtered in preceding maximum coding unit serial number to be decoded data to be decoded corresponding with image
Difference between number is default maximum coding unit quantity;If the sequence number of current maximum coding unit to be decoded is equal to image
The sequence number of the last one maximum coding unit in corresponding data to be decoded then obtains in the corresponding data to be decoded of image not
All maximum coding units of filtering, and successively to unfiltered all maximum coding units in the corresponding data to be decoded of image
It is filtered.
In the present embodiment, by successively obtaining the corresponding data to be decoded of each image in video data, image is corresponding
It include: multiple maximum coding units in data to be decoded;In data to be decoded corresponding to image it is current it is to be decoded most
Before big coding unit is decoded, whether the current maximum coding unit to be decoded of first judgement includes interframe encode unit, if
Have, is then just being greater than to reference encoder information in decoded maximum coding unit serial number to reference to figure to current in reference picture
Maximum coding unit serial number as in, and/or in reference picture currently the maximum coding unit serial number that is filtering be greater than to
Reference pixel information carries out current maximum coding unit to be decoded when the maximum coding unit serial number in reference picture
Decoding, and judge whether the sequence number of current maximum coding unit to be decoded is greater than default maximum coding unit quantity;If working as
The sequence number of preceding maximum coding unit to be decoded is greater than default maximum coding unit quantity, then obtains current maximum to be filtered
Coding unit is filtered current maximum coding unit to be filtered;To realize parallel decoding and filtering, band is avoided
The limitation of structure improves decoding speed, improves decoding efficiency.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent
Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to
So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into
Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution
The range of scheme.