Summary of the invention
The purpose of the application embodiment provides a kind of storing macro block information and device, to solve the problem that need cause taking a large amount of memory spaces in the prior art for each macroblock allocation memory cell.
For solving the problems of the technologies described above, the application embodiment provides following technical scheme:
A kind of storing macro block information comprises:
Setting closes on macro block correlation NMA memory cell, and the number of said NMA memory cell is the twice of every capable macroblock number N in the picture frame, and said N is a natural number;
Through the NMA mark of row macro block in top in N said each band of said NMA cell stores, through the NMA mark of non-top row macro block in N said each band of said NMA cell stores of residue.
Said NMA mark comprises: each macro block and its left side adjacent macroblocks, upper left adjacent macroblocks, the set of just going up the correlation of adjacent macroblocks and upper right adjacent macroblocks.
The said NMA of setting memory cell is specially:
The definition memory space is the array of 2N byte, and as a NMA memory cell, each said NMA memory cell is used for storing through four bit informations the set of said correlation with each byte space in the said array.
Said NMA mark through row macro block in top in N said each band of said NMA cell stores comprises:
When first band of the said picture frame of decoding, the said N of an initialization NMA memory cell writes the NMA flag sequence of each the top row macro block in said first band the NMA memory cell of correspondence.
Said NMA mark through row macro block in top in N said each band of said NMA cell stores comprises:
When non-first band of the said picture frame of decoding, upgrade said N NMA memory cell, the NMA flag sequence of each the top row macro block in said non-first band is write the NMA memory cell of correspondence.
Said NMA mark through non-top row macro block in N said each band of NMA cell stores of residue comprises:
Be positioned at NMA memory cell of non-top row macroblock allocation of same horizontal level in each band for picture frame;
In each said NMA memory cell, write the identical NMA mark of the non-top row macro block of said same horizontal level.
Also comprise:
When from the NMA memory cell, reading the NMA mark of first non-top row macro block, be changed to the value that is used for the correlation of the upper left macro block of mark in the said NMA mark uncorrelated.
A kind of macro block information storage device comprises:
The unit is set, is used for being provided with and closes on macro block correlation NMA memory cell, the number of said NMA memory cell is the twice of every capable macroblock number N in the picture frame, and said N is a natural number;
Memory cell is used for the NMA mark through N said each the band top row macro block of said NMA cell stores, through the NMA mark of non-top row macro block in N said each band of said NMA cell stores of residue.
Said NMA mark comprises: each macro block and its left side adjacent macroblocks, upper left adjacent macroblocks, the set of just going up the correlation of adjacent macroblocks and upper right adjacent macroblocks;
The said unit that is provided with specifically is used for, and the definition memory space is the array of 2N byte, and as a NMA memory cell, each said NMA memory cell is used for storing through four bit informations the set of said correlation with each byte space in the said array.
Said memory cell comprises:
The initialization storing sub-units, when being used for first band when the said picture frame of decoding, the said N of an initialization NMA memory cell writes the NMA flag sequence of each the top row macro block in said first band the NMA memory cell of correspondence;
The updated stored subelement when being used for non-first band when the said picture frame of decoding, upgrades said N NMA memory cell, the NMA flag sequence of each the top row macro block in said non-first band is write the NMA memory cell of correspondence.
Said memory cell comprises:
Distribute subelement, be used to the NMA memory cell of non-top row macroblock allocation that is positioned at same horizontal level in each band of picture frame;
Write subelement, be used for writing the identical NMA mark of the non-top row macro block of said same horizontal level in each said NMA memory cell.
Said memory cell also comprises:
Mark replacement subelement is used for when reading the NMA mark of first non-top row macro block from the NMA memory cell, being changed to the value that is used for the correlation of the upper left macro block of mark in the said NMA mark uncorrelated.
It is thus clear that; Be provided with among the application embodiment and close on macro block correlation NMA memory cell; The number of said NMA memory cell is the twice of every capable macroblock number N in the picture frame; Through the NMA mark of row macro block in top in N said each band of said NMA cell stores, through the NMA mark of non-top row macro block in N said each band of said NMA cell stores of residue.When using the application embodiment macro block information being stored, need not to be each macroblock allocation memory cell, but according to the difference of macro block position; Only need distribute a memory cell respectively for each top row macro block of each band; For the non-top row macro block that is positioned at same horizontal level, can pass through its NMA mark of cell stores, reduced the quantity of memory cell thus; Special when comprising a large amount of macro block in the picture frame, can reduce the memory space of macro block information.
Embodiment
The application embodiment provides a kind of storing macro block information and device.
NMA (Neighbour Macroblock Available; The adjacent macroblocks correlation) be meant the left side that a macro block is adjacent, upper left, just go up, whether upper right macro block exist association; Relevant macro block is represented to be positioned on the same band; And can be used as the reference of current macro, incoherent macro block is represented to be positioned on the different bands, can not be as the reference of current macro.In a video coding and decoding system, a picture frame is divided into one or more bands, and each band is made up of several macro blocks.When each macro block is handled, at first need obtain the NMA of this macro block, could confirm whether the adjacent macroblocks of this macro block can be used as the reference of this macro block, to confirm next step operation to this macro block.
The core of the application embodiment is, supposes that the macroblock number of every row in the definition picture frame is N, then can use N * 2 (i.e. two a macro-block line numbers) memory cell to realize the storage to the NMA of all macro blocks.Wherein, each cell stores be the correlation mark of a macro block and its adjacent macroblocks, i.e. NMA mark, NMA is marked with 4 bits, each bit respectively mark current macro and the left side that is close to, upper left, just go up, whether upper right macro block relevant.In a band, use N memory cell that the NMA mark value of non-top row macro block is stored, for a remaining N memory cell, then the NMA mark for each top row macro block respectively distributes 1 memory cell.Band is being carried out in the process of encoding and decoding,, then, from N memory cell of storage top row macro block NMA mark, obtaining its NMA mark according to the horizontal level at this row macro block place, top if scan top row macro block; If scan non-top row macro block, then, from N the memory cell of storing non-top row macro block NMA, obtain the NMA mark according to the horizontal level of this non-top row macro block.
According to such storage organization mode; The top row macro block NMA mark value of each band is not only relevant with its horizontal level; And relevant with the horizontal level of bar tape leader macro block, because the variation of first macroblock level position can bring the change of relative position between the row macro block of top; And the non-top row macro block NMA mark value of each band is only relevant with its horizontal level.In encoding-decoding process, the horizontal level of each bar tape leader macro block is constantly to change, and therefore before each band decoding, all need dynamically update the NMA value of top row macro block according to bar tape leader macroblock level position, but not the NMA value of top row macro block need not be upgraded.
In order to make those skilled in the art person understand the technical scheme among the application embodiment better; And make the above-mentioned purpose of the application embodiment, feature and advantage can be more obviously understandable, below in conjunction with accompanying drawing technical scheme among the application embodiment done further detailed explanation.
Referring to Fig. 1, be the first embodiment flow chart of the application's storing macro block information:
Step 101: be provided with and close on macro block correlation NMA memory cell, the number of this NMA memory cell is the twice of every capable macroblock number N in the picture frame.
In the present embodiment, the NMA mark comprises each macro block and its left side adjacent macroblocks, upper left adjacent macroblocks, the set of just going up the correlation of adjacent macroblocks and upper right adjacent macroblocks.When the NMA memory cell is set; Can define the array that memory space is a 2N byte in advance; With each byte space in the array as a NMA memory cell; Each NMA memory cell is used for being adjacent through four each macro blocks of bit information storage the set of the correlation of macro block, and wherein, N is a natural number.
Step 102: through the NMA mark of row macro block in top in N each band of NMA cell stores, through the NMA mark of non-top row macro block in N each band of NMA cell stores of residue.
Concrete; For top row macro block, when first band of decoded picture frame, initialization N NMA memory cell; The NMA flag sequence of each the top row macro block in first band is write corresponding NMA memory cell; When non-first band of decoded picture frame, upgrade N NMA memory cell, the NMA flag sequence of each the top row macro block in non-first band is write corresponding NMA memory cell; For non-top row macro block, be positioned at NMA memory cell of non-top row macroblock allocation of same horizontal level in each band for picture frame, in each said NMA memory cell, write the identical NMA mark of the non-top row macro block of same horizontal level.
Referring to Fig. 2, be the second embodiment flow chart of the application's storing macro block information, this embodiment shows in detail the storing process of macro block information:
Step 201: the definition memory space be the array of 2N byte, with each byte space in this array as a NMA memory cell.
Step 202: the NMA memory cell of non-top row macroblock allocation that is positioned at same horizontal level in each band for picture frame.
Step 203: the identical NMA mark that in each NMA memory cell of distributing, writes the non-top row macro block of same horizontal level.
Step 204: first band of decoded picture frame, initialization are used to store N NMA memory cell of top row macro block NMA mark, the NMA flag sequence of each the top row macro block in first band are write the NMA memory cell of correspondence.
Step 205: all bands of the picture frame that judges whether to have decoded, if, process ends then; Otherwise, execution in step 206.
Step 206: upgrade N the NMA memory cell that is used to store top row macro block NMA mark, will
The NMA flag sequence of each the top row macro block in non-first band writes corresponding NMA memory cell, returns step 205.
Need to prove; First macro block for non-top row; The macro block that is positioned at same horizontal level in when storage with it has all been stored same NMA value; But, therefore when from the NMA memory cell, reading the NMA mark of first non-top row macro block, the value that is used for the correlation of the upper left macro block of mark in this NMA mark is changed to uncorrelated getting final product because first macro block of non-top row has particularity.
Below in conjunction with an application example macro block information storing process among the application embodiment is described,, is the structural representation of the picture frame that comprises three bands referring to Fig. 3 A:
Among the application embodiment, what each memory cell was deposited is not the bar reel number, but the NMA mark of macro block, for the NMA mark of a macro block; Referring to the definition among Fig. 3 B, suppose that current macro is E, adjacent left side macro block is A; Upper left macro block is D, and just going up macro block is B, and upper right macro block is C; Then use 4 bit informations to define a NMA mark, the 0th bit of NMA mark puts 1 if macro block A is relevant with macro block E, and the 2nd bit puts 1 if macro block B is relevant with macro block E; The 2nd bit puts 1 if macro block C is relevant with macro block E, and the 3rd bit puts 1 if macro block D is relevant with macro block E, if uncorrelated with macro block E then corresponding bits puts 0.Hence one can see that, and four bit informations among the application embodiment in NMA mark are arranged according to the order of " DCBA ".
The horizontal level of picture frame comprises 11 macro blocks among Fig. 3 A, and the upright position comprises 9 macro blocks, then comprises 99 macro blocks altogether.Wherein, according to the horizontal order of macro block, macro block M00 belongs to first band to macro block M21, and macro block M22 belongs to second band to macro block M57, and macro block M58 belongs to the 3rd band to macro block M8A.Suppose to use a byte to define a memory cell,, need to use a size array NMA ARRAY that is 22 bytes to realize access macro block NMA then for the picture frame shown in Fig. 3 A.Wherein, in preceding 11 unit of array NMA_ARRAY, the NMA marker stores of non-top row macro block is in back 11 unit of array NMA_ARRAY with the NMA marker stores of band top row macro block.Because the NMA mark of each band top row macro block is relevant with the horizontal level of this tape leader macro block; Being that the horizontal level of the first macro block of band top row macro block can make the relative position between the row macro block of top change when changing, therefore be that memory cell of macroblock allocation is gone on each top of band; In a band, be positioned at the non-top row macro block of same horizontal level, it has identical NMA mark value, and therefore the some non-top row macro block of same horizontal level can a shared memory cell, for example M11 and M21, it has identical NMA mark.
Below in conjunction with Fig. 3 A, order is described the process of the NMA mark of three bands being stored decoding:
For non-top row macro block, the array location value of storing the NMA mark of non-top row macro block is constant, need not dynamically update according to current tape leader macro block position; Therefore it is following its corresponding value can be set: be positioned at same horizontal level and be non-top its NMA mark of row macro block of 0 and represent with NMA_ARRAY [11]=0x06; With macro block M10 is example, its left side, upper left, just go up, upper right relevance values is respectively " 0011 ", corresponds to the definition among Fig. 3 B; During according to " DCBA " sequence arrangement; This value corresponds to " 0110 ", is scaled 16 systems and is 6, then NMA_ARRAY [11]=0x06; Being positioned at same horizontal level and being non-top its NMA mark of row macro block of 1 to 9 representes with NMA_ARRAY [12~20]=0x0F; With macro block M42 is example, its left side, upper left, just go up, upper right relevance values is respectively " 1111 ", corresponds to the definition among Fig. 3 B; During according to " DCBA " sequence arrangement; This value corresponds to " 1111 ", is scaled 16 systems and is F, then NMA_ARRAY [11]=0x0F; Being positioned at same horizontal level and being non-top its NMA mark of row macro block of 10 representes with NMA_ARRAY [21]=0x0B; With macro block M1A is example, its left side, upper left, just go up, upper right relevance values is respectively " 1110 ", corresponds to the definition among Fig. 3 B; During according to " DCBA " sequence arrangement; This value correspond to " 1011, be scaled 16 systems and be B, then NMA_ARRAY [11]=0x0B.Special, in non-first trip macro block, except that the 1st non-top row macro block; The macro block that all the other horizontal levels are identical has identical NMA mark, but for the 1st non-top row macro block, need the upper left relevance values of the NMA mark of being stored be put 0; Just can obtain the NMA mark of the 1st non-first trip macro block; For example, for first the non-top row macro block M32 in second band, macro block M32 and macro block M42 and M52 are positioned at same horizontal level " 2 "; But the correlation of macro block M32 and upper left macro block is " 0 "; Therefore when getting access to the NMA mark of macro block M32, need the value of the upper left correlation of expression in this mark is changed to 0, be about to NMA correlation NMA_ARRAY [11+2]=0x0F and be revised as " 0x07 " according to row macroblock level position, non-top.
For top row macro block, at first, when the 1st band decoded; Array location to storage top row macro block NMA mark carries out initialization; Promptly preceding 11 unit to NMA_ARRAY carry out initialization, and the first macro block M00 horizontal level of first band is 0, and its top row macro block is respectively M00, M01, M02, M03, M04, M05, M06, M07, M08, M09, M0A; In initialization procedure; NMA_ARRAY [0]=0x00, promptly macro block M00 and its left side, upper left, just go up, the relevance values of upper right macro block is 0, NMA_ARRAY [1~10]=0x01; Be macro block M01 to M0A and the correlation of its left side macro block is 1, with upper left, just go up, the correlation of upper right macro block is 0.Hence one can see that, is the top row macro block of MB_X for horizontal level in current first band, and its corresponding NMA is labeled as NMA_ARRAY [MB_X]; For horizontal level is the non-top row macro block of MB_X, and its corresponding NMA mark value is NMA_ARRAY [11+MB_X];
Secondly, when the 2nd band decoded, this tape leader macro block M22 horizontal level was 2; Top row macro block is respectively M30, M31, M22, M23, M24, M25, M26, M27, M28, M29, M2A, and the NMA flag memory cell that storage is pushed up the row macro block upgrades, wherein; The NMA_ARRAY of macro block M30 [0]=0x00; The NMA_ARRAY of macro block M31 [1]=0x05, the NMA_ARRAY of macro block M22 [2]=0x00, macro block M23 is to NMA_ARRAY [3~10]=0x01 of macro block M2A; When obtaining the NMA mark; Such as decoded macroblock M31, judge that macro block M31 is top row macro block, then its NMA mark value is to be placed in preceding 11 unit of NMA_ARRAY; Judge that again macro block M31 horizontal level is 1; So corresponding NMA marker stores reads this NMA_ARRAY [1]=0x05 in NMA_ARRAY [1], expression macro block M31 has only the left side, upper right macro block can be for referencial use;
At last, when the 3rd band decoded, this tape leader macro block M58 horizontal level was 8; Top row macro block is respectively M60, M61, M62, M63, M64, M65, M66, M67, M58, M59, M5A; Upgrade pushing up capable macro block NMA flag memory cell, wherein, the NMA_ARRAY of macro block M60 [0]=0x00; Macro block M61 is to NMA_ARRAY [1~6]=0x01 of macro block M66; The NMA_ARRAY of macro block M67 [7]=0x05, the NMA_ARRAY of macro block M58 [8]=0x00, the NMA_ARRAY of macro block M59 to M5A [9~10]=0x01; Obtaining for the present level position is the top row macro block of MB_X, and its corresponding NMA mark value is exactly NMA_ARRAY [MB_X].
Description through above-mentioned application example can be known; In the prior art when the macro block information of picture frame shown in the storage map 3A; 99 memory cell need be set in advance, be memory cell of each macroblock allocation, and extremely 22 memory cell need be set in advance among the application embodiment; Just can realize storage, thereby reduce needed memory space in the decode procedure the NMA mark of each macro block.
Corresponding with the embodiment of the application's storing macro block information, the application also provides the embodiment of macro block information storage device.
Referring to Fig. 4, be the embodiment block diagram of the application's macro block information storage device.
This device comprises: unit 410 and memory cell 420 are set.
Wherein, unit 410 is set, is used for being provided with and closes on macro block correlation NMA memory cell, the number of said NMA memory cell is the twice of every capable macroblock number N in the picture frame, and said N is a natural number;
Memory cell 420 is used for the NMA mark through N said each the band top row macro block of said NMA cell stores, through the NMA mark of non-top row macro block in N said each band of said NMA cell stores of residue.
Wherein, the NMA mark comprises: each macro block and its left side adjacent macroblocks, upper left adjacent macroblocks, the set of just going up the correlation of adjacent macroblocks and upper right adjacent macroblocks; The said unit 410 that is provided with specifically is used for; The definition memory space is the array of 2N byte; As a NMA memory cell, each said NMA memory cell is used for storing through four bit informations the set of said correlation with each byte space in the said array.
Referring to Fig. 5, be the embodiment block diagram of memory cell 420 in the device shown in Figure 4.
This memory cell 420 comprises: initialization storing sub-units 421, updated stored subelement 422, distribute subelement 423, write subelement 424 and mark replacement subelement 425.
Initialization storing sub-units 421, when being used for first band when the said picture frame of decoding, the said N of an initialization NMA memory cell writes the NMA flag sequence of each the top row macro block in said first band the NMA memory cell of correspondence;
Updated stored subelement 422 when being used for non-first band when the said picture frame of decoding, upgrades said N NMA memory cell, the NMA flag sequence of each the top row macro block in said non-first band is write the NMA memory cell of correspondence.
Distribute subelement 423, be used to the NMA memory cell of non-top row macroblock allocation that is positioned at same horizontal level in each band of picture frame;
Write subelement 424, be used for writing the identical NMA mark of the non-top row macro block of said same horizontal level in each said NMA memory cell;
Mark replacement subelement 425 is used for when reading the NMA mark of first non-top row macro block from the NMA memory cell, being changed to the value that is used for the correlation of the upper left macro block of mark in the said NMA mark uncorrelated.
Description through above execution mode can be known; Be provided with among the application embodiment and close on macro block correlation NMA memory cell; The number of said NMA memory cell is the twice of every capable macroblock number N in the picture frame; Through the NMA mark of row macro block in top in N said each band of said NMA cell stores, through the NMA mark of non-top row macro block in N said each band of said NMA cell stores of residue.When using the application embodiment macro block information being stored, need not to be each macroblock allocation memory cell, but according to the difference of macro block position; Only need distribute a memory cell respectively for each top row macro block of each band; For the non-top row macro block that is positioned at same horizontal level, can pass through its NMA mark of cell stores, reduced the quantity of memory cell thus; Special when comprising a large amount of macro block in the picture frame, can reduce the memory space of macro block information.
Description through above execution mode can know, those skilled in the art can be well understood to the application and can realize by the mode that software adds essential general hardware platform.Based on such understanding; The part that the application's technical scheme contributes to prior art in essence in other words can be come out with the embodied of software product; This computer software product can be stored in the storage medium, like ROM/RAM, magnetic disc, CD etc., comprises that some instructions are with so that a computer equipment (can be a personal computer; Server, the perhaps network equipment etc.) carry out the described method of some part of each embodiment of the application or embodiment.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and identical similar part is mutually referring to getting final product between each embodiment, and each embodiment stresses all is the difference with other embodiment.Especially, for system embodiment, because it is basically similar in appearance to method embodiment, so description is fairly simple, relevant part gets final product referring to the part explanation of method embodiment.
The application can be used in numerous general or special purpose computingasystem environment or the configuration.For example: personal computer, server computer, handheld device or portable set, plate equipment, multicomputer system, the system based on microprocessor, set top box, programmable consumer-elcetronics devices, network PC, minicom, mainframe computer, comprise DCE of above any system or equipment or the like.
The application can describe in the general context of the computer executable instructions of being carried out by computer, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract, program, object, assembly, data structure or the like.Also can in DCE, put into practice the application, in these DCEs, by through communication network connected teleprocessing equipment execute the task.In DCE, program module can be arranged in this locality and the remote computer storage medium that comprises memory device.
Though described the application through embodiment, those of ordinary skills know, the application has many distortion and variation and the spirit that do not break away from the application, hope that appended claim comprises these distortion and variation and the spirit that do not break away from the application.