Summary of the invention
The purpose of the embodiment of the present application provides a kind of storing macro block information and device, to solve the problem that needs to cause taking for each macroblock allocation memory cell a large amount of memory spaces in the prior art.
For solving the problems of the technologies described above, the embodiment of the present application 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 described NMA memory cell is the twice of every capable macroblock number N in the picture frame, and described N is a natural number;
By the NMA mark of top line macro block in N described each band of described NMA cell stores, by the NMA mark of non-top line macro block in N described each band of described NMA cell stores of residue.
Described 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 described NMA of setting memory cell is specially:
The definition memory space is the array of 2N byte, and as a NMA memory cell, each described NMA memory cell is used for storing by four bit informations the set of described correlation with each byte space in the described array.
Described NMA mark by top line macro block in N described each band of described NMA cell stores comprises:
When first band of the described picture frame of decoding, the described N of an initialization NMA memory cell writes the NMA flag sequence of each the top line macro block in described first band the NMA memory cell of correspondence.
Described NMA mark by top line macro block in N described each band of described NMA cell stores comprises:
When non-first band of the described picture frame of decoding, upgrade described N NMA memory cell, the NMA flag sequence of each the top line macro block in described non-first band is write the NMA memory cell of correspondence.
Described NMA mark by non-top line macro block in N described each band of NMA cell stores of residue comprises:
Be positioned at NMA memory cell of non-top line macroblock allocation of same horizontal level in each band for picture frame;
In each described NMA memory cell, write the identical NMA mark of the non-top line macro block of described same horizontal level.
Also comprise:
When from the NMA memory cell, reading the NMA mark of first non-top line macro block, be changed to the value that is used for the correlation of the upper left macro block of mark in the described 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 described NMA memory cell is the twice of every capable macroblock number N in the picture frame, and described N is a natural number;
Memory cell is used for the NMA mark by N described each the band top line macro block of described NMA cell stores, by the NMA mark of non-top line macro block in N described each band of described NMA cell stores of residue.
Described 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 described 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 described NMA memory cell is used for storing by four bit informations the set of described correlation with each byte space in the described array.
Described memory cell comprises:
The initialization storing sub-units, when being used for first band when the described picture frame of decoding, the described N of an initialization NMA memory cell writes the NMA flag sequence of each the top line macro block in described first band the NMA memory cell of correspondence;
The updated stored subelement when being used for non-first band when the described picture frame of decoding, upgrades described N NMA memory cell, the NMA flag sequence of each the top line macro block in described non-first band is write the NMA memory cell of correspondence.
Described memory cell comprises:
Distribute subelement, be used to the NMA memory cell of non-top line 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 line macro block of described same horizontal level in each described NMA memory cell.
Described memory cell also comprises:
Mark replacement subelement is used for being changed to the value that is used for the correlation of the upper left macro block of mark in the described NMA mark uncorrelated when reading the NMA mark of first non-top line macro block from the NMA memory cell.
As seen, be provided with in the embodiment of the present application and close on macro block correlation NMA memory cell, the number of described NMA memory cell is the twice of every capable macroblock number N in the picture frame, by the NMA mark of top line macro block in N described each band of described NMA cell stores, by the NMA mark of non-top line macro block in N described each band of described NMA cell stores of residue.When application the embodiment of the present application is stored macro block information, 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 line macro block of each band, for the non-top line 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 embodiment of the present application 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 to obtain the NMA of this macro block, could determine whether the adjacent macroblocks of this macro block can be used as the reference of this macro block, to determine next step operation to this macro block.
The core of the embodiment of the present application 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 line macro block is stored, for a remaining N memory cell, then respectively distribute 1 memory cell for the NMA mark of each top line macro block.Band is being carried out in the process of encoding and decoding,, then, from N memory cell of storage top line macro block NMA mark, obtaining its NMA mark according to the horizontal level at this top line macro block place if scan the top line macro block; If scan non-top line macro block, then, from N the memory cell of storing non-top line macro block NMA, obtain the NMA mark according to the horizontal level of this non-top line macro block.
According to such storage organization mode, the top line macro block NMA mark value of each band is not only relevant with its horizontal level, and, because change that the variation of first macroblock level position can bring top line macro block between relative position relevant with the horizontal level of bar tape leader macro block; And the non-top line 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 to dynamically update according to bar tape leader macroblock level position the NMA value of top line macro block, but not the NMA value of top line macro block need not be upgraded.
In order to make those skilled in the art person understand technical scheme in the embodiment of the present application better, and the above-mentioned purpose of the embodiment of the present application, feature and advantage can be become apparent more, below in conjunction with accompanying drawing technical scheme in the embodiment of the present application is described in further detail.
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 pre-defined memory space be the array of 2N byte, with each byte space in the array as a NMA memory cell, each NMA memory cell is used for storing the set that each macro block is adjacent the correlation of macro block by four bit informations, wherein, N is a natural number.
Step 102: by the NMA mark of top line macro block in N each band of NMA cell stores, by the NMA mark of non-top line macro block in N each band of NMA cell stores of residue.
Concrete, for the top line macro block, when first band of decoded picture frame, initialization N NMA memory cell, the NMA flag sequence of each the top line 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 line macro block in non-first band is write corresponding NMA memory cell; For non-top line macro block, be positioned at NMA memory cell of non-top line macroblock allocation of same horizontal level in each band for picture frame, in each described NMA memory cell, write the identical NMA mark of the non-top line 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 line 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 line 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 line macro block NMA mark, the NMA flag sequence of each the top line 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 line macro block NMA mark, will
The NMA flag sequence of each the top line macro block in non-first band writes corresponding NMA memory cell, returns step 205.
Need to prove, first macro block for non-top line, the macro block that is positioned at same horizontal level with it when storage has all been stored same NMA value, but because first macro block of non-top line has particularity, therefore when from the NMA memory cell, reading the NMA mark of first non-top line 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.
Below in conjunction with an application example macro block information storing process in the embodiment of the present application is described,, is the structural representation of the picture frame that comprises three bands referring to Fig. 3 A:
In the embodiment of the present application, what each memory cell was deposited is not the bar reel number, but the NMA mark of macro block, NMA mark for a macro block, referring to the definition among Fig. 3 B, suppose that current macro is E, adjacent left side macro block is A, and upper left macro block is D, just going up macro block is B, upper right macro block is C, then uses 4 bit informations to define a NMA mark, and the 0th bit of NMA mark puts 1 if macro block A is relevant with macro block E, 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 in the embodiment of the present application 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, then for the picture frame shown in Fig. 3 A, the array NMA ARRAY that it is 22 bytes that needs use a size realizes the access to macro block NMA.Wherein, in preceding 11 unit of array NMA_ARRAY, the NMA marker stores of non-top line macro block is in back 11 unit of array NMA_ARRAY with the NMA marker stores of band top line macro block.Because the NMA mark of each band top line 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 line macro block can make the relative position between the top line macro block change when changing, is memory cell of each top line macroblock allocation of band therefore; In a band, be positioned at the non-top line macro block of same horizontal level, it has identical NMA mark value, and therefore the some non-top line 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 line macro block, the array location value of storing the NMA mark of non-top line macro block is constant, do not need to dynamically update according to current tape leader macro block position, therefore it is as follows its corresponding value can be set: be positioned at same horizontal level and be its NMA mark of non-top line macro block NMA_ARRAY[11 of 0]=0x06 represents, with macro block M10 is example, its left side, upper left, just go up, upper right relevance values is respectively " 0011 ", correspond to the definition among Fig. 3 B, during according to " DCBA " sequence arrangement, this value corresponds to " 0110 ", be scaled 16 systems and be 6, then NMA_ARRAY[11]=0x06; Be positioned at same horizontal level and be its NMA mark of non-top line macro block of 1 to 9 with NMA_ARRAY[12~20]=0x0F represents, with macro block M42 is example, its left side, upper left, just go up, upper right relevance values is respectively " 1111 ", correspond 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; Be positioned at same horizontal level and be its NMA mark of non-top line macro block NMA_ARRAY[21 of 10]=0x0B represents, with macro block M1A is example, its left side, upper left, just go up, upper right relevance values is respectively " 1110 ", correspond 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.Especially, in non-first trip macro block, except that the 1st non-top line macro block, the macro block that all the other horizontal levels are identical has identical NMA mark, but for the 1st non-top line macro block, the upper left relevance values of the NMA mark stored need be put 0, just can obtain the NMA mark of the 1st non-first trip macro block, for example, for first the non-top line 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 and will the value of the upper left correlation of expression be changed to 0 in this mark, be about to NMA correlation NMA_ARRAY[11+2 according to non-top line macroblock level position]=0x0F is revised as " 0x07 ".
For the top line macro block, at first, when the 1st band decoded, array location to storage top line macro block NMA mark carries out initialization, promptly preceding 11 unit to NMA_ARRAY carry out initialization, the first macro block M00 horizontal level of first band is 0, its top line macro block is respectively M00, M01, M02, M03, M04, M05, M06, M07, M08, M09, M0A, in initialization procedure, NMA_ARRAY[0]=0x00, be 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, the correlation that is macro block M01 to M0A and 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 line 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 line 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 is 2, the top line macro block is respectively M30, M31, M22, M23, M24, M25, M26, M27, M28, M29, M2A, the NMA flag memory cell of storing the top line macro block is upgraded, wherein, the NMA_ARRAY[0 of macro block M30]=0x00, the NMA_ARRAY[1 of macro block M31]=0x05, the NMA_ARRAY[2 of macro block M22]=0x00, macro block M23 is to NMA_ARRAY[3~10 of macro block M2A]=0x01; When obtaining the NMA mark, such as decoded macroblock M31, judge that macro block M31 is the top line 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 Dui Ying NMA marker stores is at NMA_ARRAY[1] in, read this NMA_ARRAY[1]=0x05, 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 is 8, the top line macro block is respectively M60, M61, M62, M63, M64, M65, M66, M67, M58, M59, M5A, top line macro block NMA flag memory cell is upgraded, wherein, the NMA_ARRAY[0 of macro block M60]=0x00, macro block M61 is to NMA_ARRAY[1~6 of macro block M66]=0x01, the NMA_ARRAY[7 of macro block M67]=0x05, the NMA_ARRAY[8 of macro block M58]=0x00, the NMA_ARRAY[9 of macro block M59 to M5A~10]=0x01; Obtaining for the present level position is the top line macro block of MB_X, and its corresponding NMA mark value is exactly NMA_ARRAY[MB_X].
Description by above-mentioned application example as can be known, in the prior art when the macro block information of picture frame shown in the storage map 3A, need set in advance 99 memory cell, be memory cell of each macroblock allocation, and extremely need set in advance 22 memory cell in the embodiment of the present application, 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 described NMA memory cell is the twice of every capable macroblock number N in the picture frame, and described N is a natural number;
Memory cell 420 is used for the NMA mark by N described each the band top line macro block of described NMA cell stores, by the NMA mark of non-top line macro block in N described each band of described 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 described 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 described NMA memory cell is used for storing by four bit informations the set of described correlation with each byte space in the described 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 described picture frame of decoding, the described N of an initialization NMA memory cell writes the NMA flag sequence of each the top line macro block in described first band the NMA memory cell of correspondence;
Updated stored subelement 422 when being used for non-first band when the described picture frame of decoding, upgrades described N NMA memory cell, the NMA flag sequence of each the top line macro block in described non-first band is write the NMA memory cell of correspondence.
Distribute subelement 423, be used to the NMA memory cell of non-top line 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 line macro block of described same horizontal level in each described NMA memory cell;
Mark replacement subelement 425 is used for being changed to the value that is used for the correlation of the upper left macro block of mark in the described NMA mark uncorrelated when reading the NMA mark of first non-top line macro block from the NMA memory cell.
As seen through the above description of the embodiments, be provided with in the embodiment of the present application and close on macro block correlation NMA memory cell, the number of described NMA memory cell is the twice of every capable macroblock number N in the picture frame, by the NMA mark of top line macro block in N described each band of described NMA cell stores, by the NMA mark of non-top line macro block in N described each band of described NMA cell stores of residue.When application the embodiment of the present application is stored macro block information, 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 line macro block of each band, for the non-top line 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.
As seen through the above description of the embodiments, 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 embody with the form of software product, this computer software product can be stored in the storage medium, as ROM/RAM, magnetic disc, CD etc., comprise 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 difference with other embodiment.Especially, for system embodiment, because it is substantially 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 distributed computing environment (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 distributed computing environment (DCE), put into practice the application, in these distributed computing environment (DCE), by by communication network connected teleprocessing equipment execute the task.In distributed computing environment (DCE), program module can be arranged in the local and remote computer-readable storage medium that comprises memory device.
Though described the application by embodiment, those of ordinary skills know, the application has many distortion and variation and the spirit that do not break away from the application, wish that appended claim comprises these distortion and variation and the spirit that do not break away from the application.