The content 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 the band number of video data encoder is limited to, cause the problem of decoding speed is relatively low, and decoding efficiency is poor.
The first aspect of the invention is to provide a kind of video encoding/decoding method, including:
Data to be decoded corresponding to each image in video data are obtained successively, in data to be decoded corresponding to described image
Including:Multiple maximum coding units;
Current maximum coding unit to be decoded in data to be decoded corresponding to described image is obtained successively, if described current
Maximum coding unit to be decoded includes interframe encode unit, then the interframe prediction block included according to interframe encode unit calculates
Obtain treat reference encoder information treat reference picture first in maximum coding unit sequence number, and/or according to interframe encode unit
Including interframe prediction block calculate obtain treat reference pixel information treat reference picture second in maximum coding unit sequence number;
Obtain described first and treat the current maximum coding unit sequence number decoded in reference picture, and/or described in acquisition
Second treats the current maximum coding unit sequence number filtered in reference picture;
If described first treats that the current maximum coding unit sequence number decoded is more than described treat with reference to volume in reference picture
Code information treat reference picture first in maximum coding unit sequence number, and/or described second treat in reference picture it is current
The maximum coding unit sequence number of filtering be more than it is described treat reference pixel information treat reference picture second in maximum coding unit
Sequence number, then the current maximum coding unit to be decoded is decoded, and judge the current maximum coding to be decoded
Whether the sequence number of unit is more than default maximum coding unit quantity;
If the sequence number of the current maximum coding unit to be decoded is more than default maximum coding unit quantity, obtain
Current maximum coding unit to be filtered, current maximum coding unit to be filtered is filtered.
Further, methods described also includes:
Judge whether the sequence number of the current maximum coding unit to be decoded is to be decoded equal to corresponding to described image
The sequence number of last maximum coding unit in data;
If the sequence number of the current maximum coding unit to be decoded is equal in data to be decoded corresponding to described image
The sequence number of last maximum coding unit, then obtain unfiltered all maximums in data to be decoded corresponding to described image
Coding unit, and unfiltered all maximum coding units in data to be decoded corresponding to described image are filtered successively.
Further, the interframe prediction block included according to interframe encode unit calculates acquisition and treats that reference encoder information exists
First treats the maximum coding unit sequence number in reference picture, including:
Treated described in acquisition movable information memory cell where reference encoder information treat reference picture described first in position
Put;
According to it is described treat movable information memory cell where reference encoder information treat reference picture described first in position
Put, calculate treated described in obtaining maximum coding unit where reference encoder information treat reference picture described first in position;
According to it is described treat maximum coding unit where reference encoder information treat reference picture described first in position, meter
Treated described in calculation reference encoder information treat reference picture described first in maximum coding unit sequence number.
Further, the interframe prediction block included according to interframe encode unit calculates acquisition and treats that reference pixel information exists
Second treats the maximum coding unit sequence number in reference picture, including:
The Pixel Information of interframe prediction block described in the interframe encode unit is obtained, the Pixel Information includes:It is described
The top left corner pixel coordinate of interframe prediction block, the width of the interframe prediction block, and the height of the interframe prediction block;
The interframe prediction block is obtained to treating reference pixel information in the second motion for treating 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 default offset;
The bottom right angular coordinate is compensated according to default propagation;
Calculate the maximum coding unit sequence number during the bottom right angular coordinate treats reference picture described second.
Further, described method also includes:
If described first treats that the current maximum coding unit sequence number decoded is waited to join less than or equal to described in reference picture
The maximum coding unit sequence number during coding information treats reference picture first is examined, and/or, described second treats in reference picture currently
The maximum coding unit sequence number filtered be less than or equal to it is described treat reference pixel information treat reference picture second in maximum
Coding unit sequence number, then described first is waited to treat that reference picture is decoded and/or waited described second to treat that reference picture is carried out
Filtering, until described first treats that the current maximum coding unit sequence number decoded treats reference encoder more than described in reference picture
Information treat reference picture first in maximum coding unit sequence number, and/or described second treat currently filtering in reference picture
The maximum coding unit sequence number of ripple be more than it is described treat reference pixel information treat reference picture second in maximum coding unit sequence
Untill number.
Further, described method also includes:
If the current maximum coding unit to be decoded does not include interframe encode unit, to described current to be decoded
Maximum coding unit decoded, and judge the current maximum coding unit to be decoded sequence number whether be more than it is default
Maximum coding unit quantity or the sequence equal to last maximum coding unit in data to be decoded corresponding to described image
Number;If the sequence number of the current maximum coding unit to be decoded is more than default maximum coding unit quantity, obtain current
Maximum coding unit to be filtered, current maximum coding unit to be filtered is filtered;It is to be decoded corresponding to described image
In data in current maximum coding unit sequence number data to be decoded corresponding with described image to be decoded it is currently to be filtered most
Difference between big coding unit sequence number is default maximum coding unit quantity;If the current maximum coding unit to be decoded
Sequence number be equal to data to be decoded corresponding to described image in last maximum coding unit sequence number, then obtain described in
Unfiltered all maximum coding units in data to be decoded corresponding to image, and in data to be decoded corresponding to described image
Unfiltered all maximum coding units are filtered successively.
In the present invention, by obtaining data to be decoded corresponding to each image in video data successively, treated corresponding to image
Decoding data includes:Multiple maximum coding units;Current maximum to be decoded in data to be decoded corresponding to image
Before coding unit is decoded, first judge whether current maximum coding unit to be decoded includes interframe encode unit, if so,
The maximum coding unit sequence number then currently decoded in reference picture is treated, which is more than, treats that reference encoder information is treating reference picture
In maximum coding unit sequence number, and/or treat in reference picture that the current maximum coding unit sequence number filtered is more than and wait to join
Pixel Information is examined when when the maximum coding unit sequence 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 more than default maximum coding unit quantity;It is if current
The sequence number of maximum coding unit to be decoded is more than default maximum coding unit quantity, then obtains current maximum volume to be filtered
Code unit, current maximum coding unit to be filtered is filtered.So as to realize parallel decoding and filtering, band knot is avoided
The limitation of structure, decoding speed is improved, improve decoding efficiency.
The second aspect of the invention is to provide a kind of video decoder, including:
Acquisition module, for obtaining data to be decoded corresponding to each image in video data successively, described image is corresponding
Data to be decoded include:Multiple maximum coding units;
The acquisition module is additionally operable to, and obtains current maximum to be decoded in data to be decoded corresponding to described image successively
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, which calculates to obtain, treats that reference encoder information treats that the maximum in reference picture is compiled first
Code unit number, and/or the interframe prediction block included according to interframe encode unit calculate acquisition and treat reference pixel information second
Treat the maximum coding unit sequence number in reference picture;
The acquisition module, it is additionally operable to obtain the described first maximum coding unit for treating currently decoding in reference picture
Sequence number, and/or obtain described second and treat the current maximum coding unit sequence number filtered in reference picture;
First decoder module, for treating the current maximum coding unit sequence number decoded in reference picture described first
More than it is described treat reference encoder information treat reference picture first in maximum coding unit sequence number, and/or described second wait to join
Examine the current maximum coding unit sequence number filtered in image and treat that reference pixel information treats reference picture second more than described
In maximum coding unit sequence 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 more 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 more 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, it is additionally operable to judge the sequence of the current maximum coding unit to be decoded
Whether row number is equal to the sequence number of last maximum coding unit in data to be decoded corresponding to described image;Described current
It is single that the sequence number of maximum coding unit to be decoded is equal to last maximum coding in data to be decoded corresponding to described image
During the sequence number of member, unfiltered all maximum coding units in data to be decoded corresponding to described image are obtained, and to described
Unfiltered all maximum coding units are filtered successively in data to be decoded corresponding to image.
Further, the computing module is specifically used for,
The computing module is specifically used for,
Treated described in acquisition movable information memory cell where reference encoder information treat reference picture described first in position
Put;
According to it is described treat movable information memory cell where reference encoder information treat reference picture described first in position
Put, calculate treated described in obtaining maximum coding unit where reference encoder information treat reference picture described first in position;
According to it is described treat maximum coding unit where reference encoder information treat reference picture described first in position, meter
Treated described in calculation reference encoder information treat reference picture described first in maximum coding unit sequence number.
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:It is described
The top left corner pixel coordinate of interframe prediction block, the width of the interframe prediction block, and the height of the interframe prediction block;
The interframe prediction block is obtained to treating reference pixel information in the second motion for treating 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 default offset;
The bottom right angular coordinate is compensated according to default propagation;
Calculate the maximum coding unit sequence number during the bottom right angular coordinate treats reference picture described second.
Further, the judge module is additionally operable to, and the current maximum decoded in reference picture is treated described first
Coding unit sequence number be less than or equal to it is described treat reference encoder information treat reference picture first in maximum coding unit sequence number,
And/or described second treat in reference picture that the current maximum coding unit sequence number filtered is less than or equal to described treat reference image
Prime information second when the maximum coding unit sequence number in reference picture when, wait and described first treat that reference picture is decoded
And/or wait described second to treat that reference picture is filtered, until described first treats currently decoding most in reference picture
Big coding unit sequence number be more than it is described treat reference encoder information treat reference picture first in maximum coding unit sequence number, and/
Or described second treat in reference picture that the current maximum coding unit sequence number filtered is more than and described treat that reference pixel information exists
Untill second treats the maximum coding unit sequence number in reference picture.
Further, described device also includes: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 more than default maximum coding unit quantity or equal to last in data to be decoded corresponding to described image
The sequence number of individual maximum coding unit;If the sequence number of the current maximum coding unit to be decoded is more than default maximum coding
Element number, then current maximum coding unit to be filtered is obtained, current maximum coding unit to be filtered is filtered;Institute
State current maximum coding unit sequence number number to be decoded corresponding with described image to be decoded in data to be decoded corresponding to image
Difference between current maximum coding unit sequence number to be filtered is default maximum coding unit quantity;If described currently treat
The sequence number of the maximum coding unit of decoding is equal to last maximum coding unit in data to be decoded corresponding to described image
Sequence number, then obtain corresponding to described image unfiltered all maximum coding units in data to be decoded, and to the figure
Unfiltered all maximum coding units are filtered successively in the data to be decoded as corresponding to.
In the present invention, by obtaining data to be decoded corresponding to each image in video data successively, treated corresponding to image
Decoding data includes:Multiple maximum coding units;Current maximum to be decoded in data to be decoded corresponding to image
Before coding unit is decoded, first judge whether current maximum coding unit to be decoded includes interframe encode unit, if so,
The maximum coding unit sequence number then currently decoded in reference picture is treated, which is more than, treats that reference encoder information is treating reference picture
In maximum coding unit sequence number, and/or treat in reference picture that the current maximum coding unit sequence number filtered is more than and wait to join
Pixel Information is examined when when the maximum coding unit sequence 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 more than default maximum coding unit quantity;It is if current
The sequence number of maximum coding unit to be decoded is more than default maximum coding unit quantity, then obtains current maximum volume to be filtered
Code unit, current maximum coding unit to be filtered is filtered.So as to realize parallel decoding and filtering, band knot is avoided
The limitation of structure, decoding speed is improved, improve decoding efficiency.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is
Part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art
The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
Fig. 1 is the flow chart of video encoding/decoding method one embodiment provided by the invention, as shown in figure 1, including:
101st, data to be decoded corresponding to each image in video data are obtained successively, in data to be decoded corresponding to image
Including:Multiple maximum coding units.
The executive agent of video encoding/decoding method provided by the invention is video decoder, and video decoder specifically can be with
To carry out the software of video decoding, or the hardware of software is installed.
The process of data to be decoded corresponding to each image in video data is obtained in step 101 can specifically include:(1)
Video sequence head is parsed, the packet of the predicable of all images is included in video sequence head;(2) parse in image head
Data, the data in image head include the attribute of correspondence image;(3) read after the image head before next image head
Data, the data to be decoded as piece image;If first running into sequence head or sequence tail after the image head, the figure is read
As the data after head before sequence head or before sequence tail, the data to be decoded as piece image;(4) will be from video
The general character attribute parsed in sequence head, is invested in the data to be decoded of piece image, turns into 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 blocks;In AVS2-P2 standards, the size of maximum coding unit can be 16x16 brightness
Block of pixels, 32x32 luminance pixels block, 64x64 luminance pixel blocks, encoder from can coding when therefrom select.
102nd, current maximum coding unit to be decoded in data to be decoded corresponding to image is obtained successively.
In the present embodiment, current maximum coding unit to be decoded is made up of some 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.Include several interframe prediction blocks in interframe encode unit.
The 103rd, if current maximum coding unit to be decoded includes interframe encode unit, according to interframe encode unit bag
The interframe prediction block that includes calculate obtain treat reference encoder information treat reference picture first in maximum coding unit sequence number, and/
Or the interframe prediction block that is included according to interframe encode unit is calculated in obtaining and treating that reference pixel information treats reference picture second
Maximum coding unit sequence number.
In the present embodiment, judgement is currently to be decoded most to be judged to current maximum coding unit to be decoded successively
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
Refer to treat reference picture when maximum coding unit is decoded treats reference encoder information.Current maximum coding to be decoded is single
Member both may be referred to treat reference encoder information in data to be decoded corresponding to this image, can also refer to corresponding to other images
Band reference encoder information in data to be decoded, therefore, it can be image or other images to treat reference picture.
Wherein, it is the coding information for treating to obtain in reference picture decoding process to treat reference encoder information, is advised in coding standard
The acquisition modes of image decoding process and reference encoder information are determined.Reference encoder information can include:Type of prediction and fortune
Dynamic vector etc..
Wherein, it is the Pixel Information for treating to obtain in reference picture filtering to treat reference pixel information, is advised in filter performance criteria
Determine the acquisition modes of image filtering process and reference pixel information,
Wherein, first treat that reference picture and second treats that reference picture can treat reference picture for different width, or
Same width treats reference picture.
104th, obtain first and treat the current maximum coding unit sequence number decoded in reference picture, and/or obtain second
Treat the current maximum coding unit sequence number filtered in reference picture.
Specifically, in the present embodiment, first can be obtained and treat the current maximum coding unit sequence decoded in reference picture
Number, it can also obtain second and treat in reference picture the current maximum coding unit sequence number filtered, or obtain acquisition the simultaneously
One treats that the current maximum coding unit sequence number decoded and second treats what is currently filtered in reference picture in reference picture
Maximum coding unit sequence number.
The 105th, if the first maximum coding unit sequence number for treating currently decoding in reference picture, which is more than, treats that reference encoder is believed
The maximum coding unit sequence number in treating reference picture first is ceased, and/or second treats currently filtering most in reference picture
Big coding unit sequence number be more than treat reference pixel information treat reference picture second in maximum coding unit sequence number, then to current
Maximum coding unit to be decoded is decoded, and judges whether the sequence number of current maximum coding unit to be decoded is more than in advance
If maximum coding unit quantity;If the sequence number of the current maximum coding unit to be decoded is more than default maximum coding unit
Quantity, then current maximum coding unit to be filtered is obtained, current maximum coding unit to be filtered is filtered.
Specifically, in the present embodiment, judge that first treats the current maximum coding unit sequence number decoded in reference picture
Whether be more than treat reference encoder information treat reference picture first in maximum coding unit sequence number, and/or judge that second waits to join
Examine in image the current maximum coding unit sequence number filtered and whether be more than and treat that reference pixel information treats reference picture second
In maximum coding unit sequence number.
Specifically, in the present embodiment, it can determine whether that first treats the current maximum coding unit sequence decoded in reference picture
Number whether be more than treat reference encoder information treat reference picture first in maximum coding unit sequence number, or judge that second waits to join
Examine in image the current maximum coding unit sequence number filtered and whether be more than and treat that reference pixel information treats reference picture second
In maximum coding unit sequence number, or judge that first treats in reference picture the current maximum coding unit sequence decoded simultaneously
Number whether be more than treat that reference encoder information treats that the maximum coding unit sequence number and second in reference picture treats reference picture first
In the current maximum coding unit sequence number filtered whether be more than and treat that reference pixel information is treated in reference picture most second
Big coding unit sequence number.
Wherein, in the present embodiment, if first treats that the current maximum coding unit sequence number decoded is more than in reference picture
Treat reference encoder information treat reference picture first in maximum coding unit sequence number, then it is single to current maximum coding to be decoded
Member is decoded.
Or if the second maximum coding unit sequence number for treating currently filtering in reference picture, which is more than, treats that reference pixel is believed
The maximum coding unit sequence number in treating reference picture second is ceased, then current maximum coding unit to be decoded is decoded.
Or if the first maximum coding unit sequence number for treating currently decoding in reference picture, which is more than, treats that reference encoder is believed
Cease first treat the maximum coding unit sequence number in reference picture and second treat in reference picture it is current filtering maximum compile
Code unit number be more than treat reference pixel information treat reference picture second in maximum coding unit sequence number, then to currently waiting to solve
The maximum coding unit of code is decoded.
After being decoded to current maximum coding unit to be decoded, the sequence of current maximum coding unit to be decoded is judged
Whether row number is more than default maximum coding unit quantity, if so, current maximum coding unit to be filtered is then obtained, to currently treating
The maximum coding unit of filtering is filtered.
Wherein, it is current maximum coding to be decoded in data to be decoded corresponding to image to preset maximum coding unit quantity
Difference in unit number data to be decoded corresponding with image between current maximum coding unit sequence number to be filtered, it sets
Numerical value it is relevant with specific coding standard, can be determined according to the professional knowledge of Video coding.
Wherein, if default maximum coding unit quantity is id_distance, the maximum in data to be decoded corresponding to image
The quantity of coding unit is id_count, the current maximum coding unit sequence number decoded in data to be decoded corresponding to image
For id_decode, the current maximum coding unit serial number id_filter filtered in data to be decoded corresponding to image.
The current maximum coding unit sequence number decoded in data to be decoded corresponding to image is obtained, and obtains image
The process of the current maximum coding unit sequence number filtered can specifically include in corresponding data to be decoded:(1) to figure
Before data to be decoded are decoded as corresponding to, first id_decode and id_filter are initialized:Id_decode=
0;Id_filter=id_decode-id_distance;(2) decode successively corresponding to image in data to be decoded it is each most
Big coding unit, when often having decoded a maximum coding unit, id_decode=id_decode+1;Id_filter=id_
decode–id_distance;(3) if id_filter>=0, then serial number id_filter maximum coding unit is filtered
Ripple;Id_filter=id_filter+1;(4) if id_decode==id_count, represent that image decoding is completed, then to sequence
Number it is more than or equal to id_filter and is filtered successively less than id_count maximum coding unit.
Further, on the basis of embodiment illustrated in fig. 1, this method also includes:Judge current maximum volume to be decoded
Whether the sequence number of code unit is equal to the sequence number of last maximum coding unit in data to be decoded corresponding to image;If work as
The sequence number of preceding maximum coding unit to be decoded is equal to last maximum coding unit in data to be decoded corresponding to image
Sequence number, then obtain corresponding to image unfiltered all maximum coding units in data to be decoded, and to corresponding to image
Unfiltered all maximum coding units are filtered successively in data to be decoded.
Further, on the basis of embodiment illustrated in fig. 1, this method also includes:If first treats in reference picture currently
The maximum coding unit sequence number decoded is less than or equal to treat that reference encoder information treats that the maximum in reference picture encodes first
Unit number, and/or, second treats that the current maximum coding unit sequence number filtered is less than or equal to treat reference image in reference picture
Prime information treat reference picture second in maximum coding unit sequence number, then wait first treat reference picture decoded and/or
Second is waited to treat that reference picture is filtered, until first treats the current maximum coding unit sequence number decoded in reference picture
More than treat reference encoder information treat reference picture first in maximum coding unit sequence number, and/or second treat in reference picture
The current maximum coding unit sequence number filtered, which is more than, treats that reference pixel information treats that the maximum in reference picture encodes second
Untill unit number.
Further, on the basis of embodiment illustrated in fig. 1, this method also includes:If current maximum coding to be decoded
Unit does not include interframe encode unit, then current maximum coding unit to be decoded is decoded, and judges currently to wait to solve
Whether the sequence number of the maximum coding unit of code is more than default maximum coding unit quantity or to be decoded equal to corresponding to image
The sequence number of last maximum coding unit in data;If the sequence number of current maximum coding unit to be decoded is more than default
Maximum coding unit quantity, then current maximum coding unit to be filtered is obtained, current maximum coding unit to be filtered is entered
Row filtering;Current maximum coding unit sequence number number to be decoded corresponding with image to be decoded in data to be decoded corresponding to image
Difference between current maximum coding unit sequence number to be filtered is default maximum coding unit quantity;It is if current to be decoded
Maximum coding unit sequence number be equal to data to be decoded corresponding to image in last maximum coding unit sequence number,
Unfiltered all maximum coding units in data to be decoded corresponding to image are then obtained, and to data to be decoded corresponding to image
In unfiltered all maximum coding units be filtered successively.
Illustrated below by taking the image that a width there are 48 maximum coding units as an example, 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
The image of (Largest Coding Unit, LCU), a thread synchronization can be used to complete decoding and filtering.Decoded when
During LCU 38, can at most complete the upper parts of LCU 27 and its forefoot area filtering.When LCU38, which is decoded, to be completed, you can complete
Into the filtering of LCU28 upper parts, then start LCU39 decoding.When LCU47, which is decoded, to be completed, i.e. entire image decoding is completed
When, you can it is sequentially completed the filtering of remaining area.Therefore, the filtering in piece image and decoding are synchronously carried out.If realize
Image level is parallel, not only can be with parallel decoding, and can also not limited with parallel filtering, degree of parallelism by encoding strip thereof number.
Due to dependence be present between the image of video, so image level need to carry out synchronization between image parallel.Between image
Dependence can be divided into coding information reference and Filtered Picture prime information refer to two kinds.Other images need to refer to present image
When, it is only necessary to know that the maximum coding unit that present image is decoding, you can know decoded region and the region filtered.
When decoding LCU 38, LCU 37 and its maximum coding unit before have decoded, upper parts of LCU 27 and its before
Maximum coding unit has filtered.If other threads need to refer to the coding information after LCU 37, or with reference to after LCU 27
Pixel Information, then need to wait for, the maximum coding unit decoding where referenced coding information is completed or referenced Pixel Information
Place maximum coding unit filtering is completed;Otherwise directly refer to, without waiting for.
Image level multi-threaded parallel coding/decoding method is realized by the thread pool of a first in first out.In thread pool, each
Decode after thread obtains a decoding image handle and start to decode, included in each decoding image handle and wait to refer to referenced by it
The pointer of image handle, therefore decoding thread can obtain the decoding progress for treating reference picture in real time.
To avoid because asynchronous between multithreading, cause to treat that reference picture decodes prior to present image to complete and discharging, and then
The out of order output of image or the failure of image handle are caused, it is necessary to be synchronized to multithreading, to ensure the suitable of multithreading release image
Sequence is still identical with the order of single thread release image.Therefore, devise the thread pool framework of first in first out.Such as Fig. 3 a, Fig. 3 b and
Shown in Fig. 3 c, so that 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
During completion, discharged from thread T0, image P4 is distributed into thread T0 and starts to decode, because image P1, which possesses it, treats reference picture
P0 handle h0, so thread T0 releases image P0 can't influence image P1 decoding.When image P1, which is decoded, to be completed, from line
Journey T1 is discharged, and image P5 is distributed into thread T1 and starts to decode, image P0 deletes because not being referenced.
Completed assuming that image P1 decodes 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 order according to first in first out --- for every piece image, decoding order and solution during multithreading
Code environment, with equivalence during single thread.
Experiment shows, realizes the method, can realize that multithreading decoding can be on the basis of single thread decoding is realized
Significant acceleration can be obtained on polycaryon processor.
The LentAVS2Dec of table 1 each thread decoding speed (i7-4790,3.60GHz x 4,8.00GB, Win8.1Pro
x64)
In the present embodiment, by obtaining data to be decoded corresponding to each image in video data successively, corresponding to image
Data to be decoded include:Multiple maximum coding units;In to data to be decoded corresponding to image it is current it is to be decoded most
Before big coding unit is decoded, first judge whether current maximum coding unit to be decoded includes interframe encode unit, if
Have, then the maximum coding unit sequence number currently decoded in reference picture is treated, which is more than, treats that reference encoder information is treating reference chart
Maximum coding unit sequence number as in, and/or treat in reference picture that the current maximum coding unit sequence number filtered is more than and treat
Reference pixel information is carried out when when the maximum coding unit sequence number in reference picture to current maximum coding unit to be decoded
Decoding, and judge whether the sequence number of current maximum coding unit to be decoded is more than default maximum coding unit quantity or waits
The sequence number of last maximum coding unit in data to be decoded corresponding to image;If current maximum coding to be decoded is single
The sequence number of member is more 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 ripple is filtered;Wait to solve if the sequence number of current maximum coding unit to be decoded is equal to corresponding to image
The sequence number of last maximum coding unit in code data, then obtain unfiltered all in data to be decoded corresponding to image
Maximum coding unit, and unfiltered all maximum coding units in data to be decoded corresponding to image are filtered successively.
So as 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, real shown in Fig. 1
On the basis of applying example, step 103 includes:
1031st, obtain treat movable information memory cell where reference encoder information treat reference picture first in position.
Wherein, after maximum coding unit is decoded, corresponding coding information can be preserved into movable information memory cell, so
Treat to find " the fortune of reference encoder information needed for storage in numerous " movable information memory cell " in reference picture first afterwards
Dynamic information memory cell ".Lookup method is exactly calculating process here.Movable information memory cell provides by coding standard, no
H.265 and in AVS2-P2 all it is being 16x16 luminance pixel block sizes more than " maximum coding unit ".
1032nd, the position during the movable information memory cell according to where treating reference encoder information treats reference picture first,
Calculate obtain treat maximum coding unit where reference encoder information treat reference picture first in position.
1033rd, the position during the maximum coding unit according to where treating reference encoder information treats reference picture first, calculate
Treat reference encoder information treat reference picture first in maximum coding unit sequence number.
Wherein it is possible to position of the movable information memory cell in reference picture is treated is designated as where treating reference encoder information
(misu_x,misu_y)。
Treat that maximum coding unit where reference encoder information treats the position (lcu_x, lcu_y) in reference picture first
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)
Treat reference encoder information in the first calculation formula such as formula (3) for treating the maximum coding unit sequence number in reference picture
It is shown:
Id_ref_decoded=lcu_y*lcu_width+lcu_x (3)
Wherein, lcu_size_in_bit represent maximum coding unit size with 2 for bottom logarithm, its value can be according to video
Sequence head is exported, and its span is provided by coding standard;Misu_size_in_bit represents movable information memory cell size
With 2 for bottom logarithm, its value provides by coding standard;Lcu_width represents of horizontal direction maximum coding unit in image
Number, can be determined by derived video attribute in video sequence head.
1034th, 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 designated as into (x0, y0), the width of interframe prediction block is remembered
For width, the height of interframe prediction block is designated as height.
1035th, interframe prediction block is obtained to treating reference pixel information in the second motion for treating the pixel region in reference picture
Vector.
1036th, the bottom right angular coordinate of pixel region is calculated according to motion vector and Pixel Information.
Wherein it is possible to motion vector is designated 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 can determine to divide pixel precision shift amount according to coding standard and video format.For YUV420
For the video of form, the shift=2 of luma prediction block, the shift=3. of colorimetric prediction block
1037th, bottom right angular coordinate is compensated according to default offset.
Wherein, because the base unit of filtering is not the pixel in interframe prediction block, if but interframe prediction block is moved to left
Dry pixel (offset.x) moves up the pixel region in some pixels (offset.y) filter unit again.Therefore, pixel region is used
, it is necessary to add this offset when whether interframe prediction block where the angular coordinate of domain bottom right has been decoded to judge whether to refer to.This
Individual offset can be determined by coding standard, be designated as (offset.x, offset.y), the formula such as public affairs of the bottom right angular coordinate after compensation
Shown in formula (6) and formula (7):
X=x+offset.x (6)
Y=y+offset.y (7)
1038th, bottom right angular coordinate is compensated according to default propagation.
Wherein, because newly encoded Standard General all supports the inter prediction of point pixel precision, if with reference to dividing location of pixels
Pixel, it is also necessary to carried out according to some whole pixels (expand.y) of some whole pixels (expand.x) below pixel region and right side
Interpolation, it can just obtain the reference pixel on pixel region lower boundary and right margin.This propagation can determine according to coding standard,
(expand.x, expand.y) is designated as, 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 represents pixel precision digit, can be determined according to coding standard and video format.For regarding for YUV420
For frequency form, the frac=0x03 of luma prediction block, the frac=0x07 of colorimetric prediction block.
1039th, the maximum coding unit sequence number during bottom right angular coordinate treats reference picture second is calculated.
Specifically, calculated successively according to below equation (10) to formula (14) during pixel region treats reference picture second
Maximum coding unit sequence 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 represent maximum coding unit size with 2 for bottom logarithm, its value can be according to video
Sequence head is exported, and its span is provided by coding standard;Lcu_shift represent maximum coding unit size with 2 for bottom pair
Number, is determined by video format, and for YUV420 videos, the lcu_shift=0 of maximum coding unit luminance component is maximum
The lcu_shift=1 of coding unit chromatic component;Lcu_width represents that second treats the maximum coding of horizontal direction in reference picture
The number of unit, it can be determined by derived video attribute in video sequence head;Lcu_height represents that second treats reference picture
The number of middle vertical direction maximum coding unit, it can be determined by derived video attribute in video sequence head;clip3(min,
Max, x) function generally provides, represents variable x value being limited in [min, max] section in a standard.Due to some codings
The pixel (coding standard is generally specified as the extension of image edge pixels) outside reference picture is treated in standard permission second, therefore is counted
(x, y) calculated is possible to exceed image range, namely (lcu_x, lcu_y) may exceed image range, therefore with clip3 functions
Limit span.
In the present embodiment, by obtaining data to be decoded corresponding to each image in video data successively, corresponding to image
Data to be decoded include:Multiple maximum coding units;In to data to be decoded corresponding to image it is current it is to be decoded most
Before big coding unit is decoded, first judge whether current maximum coding unit to be decoded includes interframe encode unit, if
Have, then the maximum coding unit sequence number currently decoded in reference picture is treated, which is more than, treats that reference encoder information is treating reference chart
Maximum coding unit sequence number as in, and/or treat in reference picture that the current maximum coding unit sequence number filtered is more than and treat
Reference pixel information is carried out when when the maximum coding unit sequence number in reference picture to current maximum coding unit to be decoded
Decoding, and judge whether the sequence number of current maximum coding unit to be decoded is more than default maximum coding unit quantity;If work as
The sequence number of preceding maximum coding unit to be decoded is more than default maximum coding unit quantity, then obtains current maximum to be filtered
Coding unit, current maximum coding unit to be filtered is filtered.So as to realize parallel decoding and filtering, band is avoided
The limitation of structure, decoding speed is improved, improve decoding efficiency.
One of ordinary skill in the art will appreciate that:Realizing all or part of step of above-mentioned each method embodiment can lead to
The related hardware of programmed instruction is crossed to complete.Foregoing program can be stored in a computer read/write memory medium.The journey
Sequence upon execution, execution the step of including above-mentioned each method embodiment;And foregoing storage medium includes:ROM, RAM, magnetic disc or
Person's CD etc. is various can be with the medium of store program codes.
Fig. 4 is the structural representation of video decoder one embodiment provided by the invention, as shown in figure 4, including:
Acquisition module 41, for obtaining data to be decoded corresponding to each image in video data successively, corresponding to image
Data to be decoded include:Multiple maximum coding units;
Acquisition module 41 is additionally operable to, and it is single to obtain current maximum coding to be decoded in data to be decoded corresponding to image successively
Member;
Computing module 42, for when current maximum coding unit to be decoded includes interframe encode unit, according to frame
Between the interframe prediction block that includes of coding unit calculate obtain treat reference encoder information treat reference picture first in maximum coding
Unit number, and/or the interframe prediction block included according to interframe encode unit calculate acquisition and treat that reference pixel information is treated second
Maximum coding unit sequence number in reference picture;
Acquisition module 41, it is additionally operable to obtain the first maximum coding unit sequence number for treating currently decoding in reference picture,
And/or obtain second and treat the current maximum coding unit sequence number filtered in reference picture;
First decoder module 43, for treating that the current maximum coding unit sequence number that is decoding is big in reference picture first
Maximum coding unit sequence number in treating that reference encoder information treats reference picture first, and/or second treat in reference picture when
The preceding maximum coding unit sequence number filtered, which is more than, treats that reference pixel information treats that the maximum coding in reference picture is single second
During first sequence number, current maximum coding unit to be decoded is decoded, and judges current maximum coding unit to be decoded
Whether sequence number is more than default maximum coding unit quantity;If the sequence number of current maximum coding unit to be decoded is more than default
Maximum coding unit quantity, then current maximum coding unit to be filtered is obtained, current maximum coding unit to be filtered is entered
Row filtering.
Wherein, video decoder provided by the invention is specifically as follows the software for carrying out video decoding, or is provided with
The hardware of software.Acquisition module 41 obtains the process of data to be decoded corresponding to each image in video data and can specifically wrapped
Include:(1) video sequence head is parsed, the packet of the predicable of all images is included in video sequence head;(2) analysis diagram picture
Data in head, the data in image head include the attribute of correspondence image;(3) image head is read afterwards until next image
Data before head, the data to be decoded as piece image;If first running into sequence head or sequence tail after the image head, read
Take data of the image head afterwards before 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, is invested in the data to be decoded of piece image, turns into the complete of piece image
Data to be decoded.
Further, the first deciphering module 43, the sequence number for being additionally operable to judge current maximum coding unit to be decoded are
The no sequence number for being equal to last maximum coding unit in data to be decoded corresponding to image;In current maximum volume to be decoded
When the sequence number of code unit is equal to the sequence number of last maximum coding unit in data to be decoded corresponding to image, figure is obtained
Unfiltered all maximum coding units in the data to be decoded as corresponding to, and to unfiltered in data to be decoded corresponding to image
All maximum coding units be filtered successively.
Further, computing module 42 is specifically used for, and acquisition treats that movable information memory cell where reference encoder information exists
First treats the position in reference picture;The movable information memory cell according to where treating reference encoder information treats reference picture first
In position, calculate obtain treat maximum coding unit where reference encoder information treat reference picture first in position;According to
Treat maximum coding unit where reference encoder information treat reference picture first in position, calculating treats reference encoder information the
One treats the maximum coding unit sequence 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;
Interframe prediction block is obtained to treating reference pixel information in the second motion vector for treating the pixel region in reference picture;According to motion
Vector and Pixel Information calculate the bottom right angular coordinate of pixel region;Bottom right angular coordinate is mended according to default offset
Repay;Bottom right angular coordinate is compensated according to default propagation;Bottom right angular coordinate is calculated to treat in reference picture most second
Big coding unit sequence number.
With reference to reference to figure 5, on the basis of embodiment illustrated in fig. 4, the device also includes:Judge module 44 and second decodes
Module 45;
Further, judge module 44, for treating the current maximum coding unit decoded in reference picture first
Sequence number be less than or equal to treat reference encoder information treat reference picture first in maximum coding unit sequence number, and/or, second waits to join
The current maximum coding unit sequence number filtered in image is examined to be less than or equal to treat that reference pixel information treats reference picture second
In maximum coding unit sequence number when, wait first treat reference picture decoded and/or waited second treat reference picture carry out
Filtering, until first treats in reference picture that the current maximum coding unit sequence number decoded is more than and treat reference encoder information the
One treats the maximum coding unit sequence number in reference picture, and/or second treats the current maximum coding filtered in reference picture
Unit number, which is more than, treats reference pixel information untill second treats the maximum coding unit sequence number in reference picture.
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 more than
Default maximum coding unit quantity or the sequence equal to last maximum coding unit in data to be decoded corresponding to image
Number;If the sequence number of current maximum coding unit to be decoded is more than default maximum coding unit quantity, obtain current to be filtered
The maximum coding unit of ripple, current maximum coding unit to be filtered is filtered;In data to be decoded corresponding to image when
Current maximum coding unit sequence to be filtered in preceding maximum coding unit sequence 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 last maximum coding unit in corresponding data to be decoded, then obtain in data to be decoded corresponding to image not
All maximum coding units of filtering, and to unfiltered all maximum coding units in data to be decoded corresponding to image successively
It is filtered.
In the present embodiment, by obtaining data to be decoded corresponding to each image in video data successively, corresponding to image
Data to be decoded include:Multiple maximum coding units;In to data to be decoded corresponding to image it is current it is to be decoded most
Before big coding unit is decoded, first judge whether current maximum coding unit to be decoded includes interframe encode unit, if
Have, then the maximum coding unit sequence number currently decoded in reference picture is treated, which is more than, treats that reference encoder information is treating reference chart
Maximum coding unit sequence number as in, and/or treat in reference picture that the current maximum coding unit sequence number filtered is more than and treat
Reference pixel information is carried out when when the maximum coding unit sequence number in reference picture to current maximum coding unit to be decoded
Decoding, and judge whether the sequence number of current maximum coding unit to be decoded is more than default maximum coding unit quantity;If work as
The sequence number of preceding maximum coding unit to be decoded is more than default maximum coding unit quantity, then obtains current maximum to be filtered
Coding unit, current maximum coding unit to be filtered is filtered;So as to realize parallel decoding and filtering, band is avoided
The limitation of structure, decoding speed is improved, improve decoding efficiency.
Finally it should be noted that:Various embodiments above is merely illustrative of the technical solution of the present invention, rather than its limitations;To the greatest extent
The present invention is described in detail with reference to foregoing embodiments for pipe, it will be understood by those within the art that:Its according to
The technical scheme described in foregoing embodiments can so be modified, either which part or all technical characteristic are entered
Row equivalent substitution;And these modifications or replacement, the essence of appropriate technical solution is departed from various embodiments of the present invention technology
The scope of scheme.