Accompanying drawing explanation
Fig. 1 is the block schematic diagram that a kind of image data processing system is described according to one embodiment of the invention.
Fig. 2 is the block schematic diagram that a kind of image data processing system is described according to one embodiment of the invention.
Fig. 3 is the flow chart that a kind of image processing method is described according to one embodiment of the invention.
Fig. 4 illustrates according to one embodiment of the invention flow chart image block being carried out to Block predictions coding.
Fig. 5 is the thin portion flow chart of the image processing method according to one embodiment of the invention key diagram 4.
Fig. 6 illustrates under Block predictions coding, to the schematic diagram that the pixel in image block is predicted according to one embodiment of the invention.
Fig. 7 A ~ 7D is the schematic diagram that scan pattern is described according to one embodiment of the invention.
Fig. 8 is the thin portion flow chart of the image processing method according to one embodiment of the invention key diagram 4.
Fig. 9 illustrates according to one embodiment of the invention flow chart image block being carried out to linear predictive coding.
Figure 10 illustrates under linear predictive coding, to the schematic diagram that the pixel in image block is predicted according to one embodiment of the invention.
Figure 11 A ~ 11B illustrates according to one embodiment of the invention the schematic diagram encoded block being recorded in second graph buffer.
[symbol description]
100,200: image data processing system
110,210: the first graphics buffer
120,220: coding unit
122,222: line coding module
124,224: block coding module
126,226: comparison module
130,230: graphic process unit
132,232: motion compensating module
140,240: second graph buffer
150: the first decoding units
250: the first decoding units
260: display engine
602 ~ 610,1002 ~ 1010: prediction direction
1110 ~ 1130: encoded block
1140 ~ 1150: reservation bit
R1: walk crosswise
C1: in upright arrangement
L1 ~ L4: line block
S310 ~ S340, S410 ~ S440, S510 ~ S550: step
S810 ~ S890, S910 ~ S930: step
Embodiment
Conveniently video engine and display engine are to the access of view data in memory, the embodiment of the present invention will consider the block access features of video engine and the wire access features of display engine simultaneously, selects suitable image block to be of a size of compression unit to carry out the process of view data.The display engine of the present embodiment can once read maximum 32 pixels with burst mode (burst mode) from internal storage bus (internal memory bus), and can perform the burst mode of continuous 4 times in a request.Video engine then takes advantage of 4(4*4 with 4) size of pixel carries out image compression.In these cases, embodiment of the present invention preferred dimension is 32 take advantage of 4(32*4) image block of pixel carries out the image processing method of the embodiment of the present invention.That is, following embodiment is all described for the image block being of a size of 32*4 pixel.Application the present embodiment also can adjust the size of image block according to its demand, such as when internal storage bus once reads maximum 64 pixels with burst mode, and video engine then carries out image compression with the size of 8*8 pixel, then the image block being of a size of 64*8 pixel can be selected to realize following image data processing technique.
Fig. 1 is the block schematic diagram that a kind of image data processing system is described according to one embodiment of the invention.Image data processing system 100 comprises the first graphics buffer 110, coding unit 120, graphic process unit (GraphicsProcessing Unit, GPU) 130, second graph buffer 140 and the first decoding unit 150.First graphics buffer 110 is such as static RAM (SRAM) or similar element, with store images block, and second graph buffer 140 is such as dynamic random access memory (DRAM) or similar element, to store the encoded block after being encoded by original image block.
When carrying out image real time transfer, the image block after image processor 130 processes temporarily can be stored in the first graphics buffer 110.Coding unit 120 receives this image block from the first graphics buffer 110 and encodes to it, and is stored in second graph buffer 140 by the encoded block after coding.Special instruction, the coding unit 120 in the present embodiment comprises line coding module 122, block coding module 124 and comparison module 126.Line coding module 122 is used to carry out linear predictive coding to image block, and block coding module 124 is then used to carry out Block predictions coding to image block.Comparison module 126 in order to compare the first block data and the second block data that produce through two kinds of coded prediction thus, to select the block data possessed compared with small data quantity, and using the data of this block data as encoded block.Coding unit 120 by the data storing of encoded block in second graph buffer 140.
Graphic process unit 130 Main Function processes the picture signal of input.Specifically, graphic process unit 130 can will be multiple image block to the frame picture segmentation in picture signal, and these image block are stored into the first graphics buffer 110.Graphic process unit 130 comprises motion compensating module 132.Motion compensating module 132 is carrying out motion compensation (motion compensation, MC) second graph buffer 140 can be controlled time the encoded block be stored in wherein is delivered to the first decoding unit 150 decode, to restore image block to build frame picture, carry out the subsequent operation of motion compensation.
Fig. 2 is the block schematic diagram that a kind of image data processing system is described according to one embodiment of the invention.Please refer to Fig. 2, image data processing system 200 comprises the first graphics buffer 210, coding unit 220, graphic process unit 230, second graph buffer 240, second decoding unit 250 and display engine 260.Described herein, the function of the first graphics buffer 210, coding unit 220, second graph buffer 240, graphic process unit 230 and motion compensating module wherein 232 is similar to the element of same names in previous embodiment, therefore its detail with reference is aforementioned.
Be with the difference of previous embodiment, the image data processing system of the present embodiment is when carrying out Graphics Processing, display engine 260 is decoded to the encoded block be stored in second graph buffer 240 by the second decoding unit 250, and decoded image block is supplied to external screen or display device with display frame.
Fig. 3 is the flow chart that a kind of image processing method is described according to one embodiment of the invention.Please refer to Fig. 3, the method for the present embodiment is applicable to the image data processing system 100 of Fig. 1 or the image data processing system 200 of Fig. 2.Below coordinate Fig. 1 and Fig. 3 that the detailed process of the present embodiment method is described.
In step S310, the first graphics buffer 110 can obtain from image processor 130 carries out at least one image block after dividing processing to frame picture, and wherein this image block comprises multiple pixel.For example, frame picture is cut into multiple image block being of a size of 32*4 by graphic process unit 130, and the first graphics buffer 110 can obtain at least one image block comprising 32*4.
In step S320, the block coding module 124 in coding unit 120 can carry out Block predictions coding to obtain the first block data to the image block obtained.The detailed step that block coding module 124 pairs of image block carry out Block predictions coding is illustrated in Fig. 4 ~ Fig. 8, below will sequentially be described.
Please refer to Fig. 4, block coding module 124 pairs of image block carry out the flow process of Block predictions coding, comprise prediction (prediction), mathematic interpolation (differentiation) and custom coding (tailor-made coding) three key steps.When prediction and mathematic interpolation, in step S410, block coding module 124 can carry out the numerical value of each pixel in predicted picture block by the initial reference pixel of image block, to produce the predicted value of pixel, and according to the actual value of pixel and the difference of predicted value, produce the matrix of differences corresponding to image block.Initial reference pixel is the data of image being carried out former state compression, using as with reference to data.The assembly that the prediction of pixel number can be passed through median filter (median filter), boundary filter (edge filter), weight filter (weighted filter) or have an identity function is reached.
The detailed process of step S410 please refer to Fig. 5.It should be noted that " current pixel " described in the present embodiment represents the pixel that block coding module 124 will be predicted at present, its can using the contiguous and pixel having obtained predicted value as with reference to pixel to produce the predicted value of current pixel.In step S510, block coding module 124 usually can predict the numerical value of current pixel according to the reference image of current pixel, to produce the predicted value of current pixel.After obtaining the predicted value of current pixel, just enter step S520 from step S510, the actual value of current pixel can be deducted predicted value, to produce difference corresponding to current pixel by block coding module 124.In step S540, block coding module 124 sequentially using next pixel as current pixel, with next pixel is carried out step S510 and S520 operation, until last pixel in image block is also predicted and has been calculated difference (step S530).In step S550, the difference corresponding according to all pixels in image block produces matrix of differences.
In one embodiment, the first pixel of image block can be set as initial reference pixel by block coding module 124, and with this first pixel for benchmark, sequentially contiguous pixel is predicted, obtain the predicted value of all pixels in image block, and according to the actual value of all pixels and the difference of predicted value, produce the matrix of differences corresponding to image block.For the image block shown in Fig. 6, only illustrate the front 8*4 pixel be of a size of in the image block of 32*4 in the present embodiment, first the first pixel A of image block is set as initial reference pixel by block coding module 124, then the same next pixel B walking crosswise R1 is positioned at, the pixel A of previous vicinity can be predicted its numerical value (such as, arrow 602) as with reference to pixel.In like manner, the prediction being arranged in all pixels of R1 (such as pixel C, D etc.) can sequentially be completed.And be positioned at the next pixel E of same C1 in upright arrangement with pixel A, also using pixel A contiguous for top as predicting its numerical value (such as, arrow 604) with reference to pixel, in like manner, sequentially can complete the prediction being arranged in all pixels of C1 (such as pixel I, M etc.).For the pixel F not being positioned at R1 or C1, the pixel B of the pixel A of the pixel E of previous vicinity, oblique upper vicinity and top vicinity can be predicted its numerical value (such as with reference to pixel by it, arrow 606,608,610), in like manner, the predicted value of rest of pixels (such as pixel G, H, J, K, L etc.) can sequentially be completed.
Get back to the flow chart of Fig. 4, after producing matrix of differences, in step S420, matrix of differences can be divided into multiple difference sub-block according to default sub-block size by block coding module 124.For example, if preset sub-block to be of a size of 4*4, then block coding module 124 understands the matrix of differences that will correspond to the image block being of a size of 32*4, is divided into 8 difference sub-block being of a size of 4*4.
In step S430, the setting scan pattern that block coding module 124 selects each difference sub-block corresponding according to the condition of scanning from multiple picture element scan pattern.Specifically, block coding module 124 can be carried out scanning to the difference sub-block of each 4*4 of being of a size of and be inspected, wherein scan pattern is as shown in Fig. 7 A ~ 7D, is sequentially Z-type scanning (zigzag), upper right scanning (upright), horizontal sweep (horizontal) and vertical scanning (vertical).In Fig. 7 A ~ 7D, the numeral of 0 ~ 15 is illustrated respectively in above-mentioned different scan pattern the order that each pixel of difference sub-block scans.Block coding module 124 can be that the pixel quantity of zero is as the condition of scanning to calculate described difference sub-block pixel value from back to front in each scan pattern.In other words, block coding module 124 is passed through in each scan pattern, to calculate by the opposite sequence of 15 to 0 quantity that pixel value is zero continuously, and to have the setting scan pattern of the scan pattern at most continuously corresponding to zero pixel as this difference sub-block.It should be noted that under this kind of condition of scanning, select the scan pattern that continuous zero pixel in difference sub-block rear end is more, in the step of follow-up custom coding, the quantity of coding can be reduced.
After the setting scan pattern selecting each difference sub-block corresponding in step S430, just enter into custom coding and each step wherein of Block predictions coding flow process.In step S440, block coding module 124 according to the setting scan pattern selected in step S430, can set multiple flag to each difference sub-block, and encodes to produce the first block data to each difference sub-block respectively according to these flags.
The detailed process of step S440 please refer to Fig. 8.It should be noted that current difference sub-block in this specification is in order to represent that block coding module 124 will set the difference sub-block of flag at present.In the present embodiment, block coding module 124 can carry out the setting of these flags to each difference sub-block, until the flag of all difference sub-block has all set.After choosing setting scan pattern corresponding to current difference sub-block, in step S810, block coding module 124 can judge whether each numerical value of current difference sub-block is all zero.In step S820, when each numerical value of current difference sub-block is all zero, sub-block zero flag (cbf) of current difference sub-block can be set as 0 by block coding module 124, and does not need the coding this current difference sub-block being carried out to other.On the contrary, in step S830, when current difference sub-block has the numerical value of non-zero, the cbf of current difference sub-block can be set as 1, to carry out ensuing coding step by block coding module 124.
In step S840, block coding module 124 sets scan pattern flag (scan_mode) and non-zero scan flag (last_nonzero_x and last_nonzero_y) according to the setting scan pattern that current difference sub-block is corresponding, and the pixel number be positioned in setting scan pattern after non-zero scanning flag is all zero.In step S850, the numerical value flag (nonzero flag) that block coding module 124 is corresponding to each pixel setting be positioned at before non-zero scanning flag in setting scan pattern, wherein numerical value flag is in order to represent whether the pixel value of corresponding pixel is zero.
For example, if setting scan pattern corresponding to current difference sub-block is the Z-type scanning shown in Fig. 7 A, and in Z-type scanning, the numerical value being positioned at numeral 8 is the value of first non-zero run into from digital 15 inverses to 0, that is the numerical value being positioned at numeral 9 ~ 15 is all zero, then non-zero scan flag can become numeral 8 in the position of current difference sub-block by block coding module 124.Specifically, the two-dimensional space that numeral 8 illustrates at Fig. 7 A is positioned at x-axis to be 2 and y-axis is on the coordinate of 1, therefore, the binary code of 2 bits (bits) (binarycode) can be utilized to set non-zero scan flag respectively, such as, to represent the coordinate of numeral 8 in x-axis and y-axis, last_nonzero_x=10 and last_nonzero_y=01.After having set the non-zero scan flag corresponding to digital 8 positions, the pixel number according to the numeral 0 ~ 8 be arranged in before numeral 8 sets nonzero flag to the non-zero values of numeral 0 ~ 8.
In step S860, for the pixel set symbol gonfalon mark (sign flag) possessing nonzero flag, sign flag is used to the sign representing pixel number.In step S870, judge whether the absolute value possessing the pixel of symbol flag is greater than the first value, when the absolute value of pixel is greater than the first value, sets the first absolute value flag (larger_than1flag).In step S880, judge whether the absolute value possessing the pixel of the first absolute value flag is greater than the second value, when the absolute value of pixel is greater than the second value, sets the second absolute value flag (larger_than2flag).In step S890, the numerical value of the pixel possessing the second absolute value flag is deducted the 3rd value, and encodes, to produce the first block data according to the numerical value (minus3) specific coding deducts the 3rd value to this after, wherein above-mentioned 3rd value is greater than the second value, and the second value is greater than the first value.
In one embodiment, above-mentioned first value, the second value and the 3rd value can be respectively 1,2 and 3.With aforesaid embodiment, block coding module 124 has the pixel of nonzero flag to the pixel being arranged in numeral 0 ~ 8, set symbol gonfalon mark sign flag.And block coding module 124 is in these 8 pixels, the pixel setting larger_than1flag that absolute value is greater than 1, and from the pixel with larger_than1flag, select the pixel setting larger_than2flag that absolute value is greater than 2.Again the numerical value of the pixel with larger_than2flag is deducted 3, and select suitable coding to produce the first block data according to this through deducting the numerical value after 3.Above-mentioned suitable coding can with being foundation through deducting the greatest measure after 3, with from conventional coding, select the coding corresponding to the operable minimum code length of this greatest measure, wherein, conventional coding comprises this code of Lay (Rice coding), Glenn cloth coding (Golomb coding) etc.
Get back to the flow chart of Fig. 3, in step S330, the line coding module 122 in coding unit 120 can carry out linear predictive coding to obtain the second block data to image block.The detailed step that line coding module 122 pairs of image block carry out linear predictive coding is illustrated in Fig. 9 ~ Figure 10, below will sequentially be described.
Please refer to Fig. 9, the flow process that line coding module 122 pairs of image block carry out linear predictive coding is similar to the flow process that Block predictions is encoded, and is also to comprise prediction, mathematic interpolation and custom coding three key steps.When prediction and mathematic interpolation, in step S910, image block is divided into multiple line block by line coding module 122, is carried out the numerical value of each pixel in line of prediction block by the initial reference pixel of image block, to produce the predicted value of pixel.In step S920, the actual value of line coding module 122 according to pixel and the difference of predicted value, produce the linear difference matrix corresponding to line block.Above-mentioned steps S910 ~ S920 and step S410 ~ S420 is same or similar, therefore its details please refer to aforementioned.
In the present embodiment, image block can be divided into multiple line block by line coding module 122, then carries out predicting and mathematic interpolation in units of line block.For the image block shown in Figure 10, only illustrate the front 8*4 pixel of 32*4 image block in the present embodiment, 32*4 image block can be divided into 4 line blocks being of a size of 32*1 by line coding module 122, such as, is positioned at 4 line block L1 ~ L4 of the first row ~ fourth line in Figure 10.The first pixel A of L1 can be set as initial reference pixel by line coding module 122, and be positioned at the next pixel B of L1 equally, the pixel A of previous vicinity can be predicted its numerical value (such as with reference to pixel, arrow 1002), in like manner, the prediction being arranged in all pixels of L1 (such as pixel C, D etc.) can sequentially be completed.
Line block L2 ~ L4 can select two kinds of methods and predict in units of whole line block.First method is as with reference to pixel by the respective pixel of last line block; Second method is then as reference pixel by the previous pixel predicted in same line block.Can indicate in online block header about selecting the information of carrying out line Block predictions by any method.In this embodiment, the line block header of L2 selects above-mentioned first method, by the respective pixel in L1 as reference pixel.Such as, pixel E take pixel A as reference pixel (such as, arrow 1004), and pixel F take pixel B as reference pixel (such as, arrow 1006), uses each pixel of prediction L2.The line block header of L3 is then select second method, with being positioned at the previous pixel of L3 equally as reference pixel.Such as, pixel J with pixel I be reference pixel (such as, arrow 1008), pixel K with pixel J for reference pixel (such as, arrow 1010), use prediction L3 each pixel.It is noted that when selecting this second method, first pixel I also needs to be set as initial reference pixel, using the reference pixel as L3.
Illustrate how according to the actual value of pixel and the difference of predicted value at this, thus generation correspond to the linear difference matrix of line block and enter into custom coding and each step wherein of linear predictive coding flow process.In step S930, line coding module 122 pairs of linear difference matrix setting flags, and encode to produce the second block data to each linear difference matrix respectively according to these flags.Above-mentioned steps S930 and step S440 is same or similar, therefore its details please refer to aforementioned.
With the step performed by aforementioned zones block coding module 122 unlike, in the present embodiment, line coding module 122 is after sub-block zero flag (cbf) has set, the set action of scan pattern flag (scan_mode) and non-zero scan flag (last_nonzero_x and last_nonzero_y) can not be carried out, but directly enter setting numerical value flag (nonzero flag), the step of symbol flag (sign flag), and according to the first value, second value and the 3rd value set the first absolute value flag (larger_than1flag) and the second absolute value flag (larger_than2flag), finally, numerical value (minus3) after deducting the 3rd value is encoded, to produce the second block data.
Get back to the flow chart of Fig. 3, the first block data and the second block data are obtained in coding unit 120, and comparison module 126 can compare the first block data and the second block data that obtain, from wherein selecting the data possessed compared with small data quantity, as the data of encoded block corresponding to encoded block.This encoded block data is recorded in second graph buffer 140 by coding unit 120, carries out the operation of motion compensation or display image so that follow-up.It should be noted that, when the data volume of the first block data and the second block data is all greater than the original data volume of image block, image data processing system of the present invention can not process individual image block, and the legacy data of image block is directly recorded in second graph buffer 140.
Figure 11 A and 11B illustrates the embodiment encoded block being recorded in second graph buffer 140 and 240 in Fig. 1 and Fig. 2.First with reference to Figure 11 A, with YCbCr color space for example, the left side is the encoded block 1110 of size 32*4, is sequentially recorded in the second graph buffer of right Figure 16 * 16 bit group (bytes) by the coding of this encoded block 1110 for Y space, Cb space and Cr space.Uncoded reservation bit (the reserved bit in such as encoded block 1110) may be had in encoded block.With reference to Figure 11 B, when multiple encoded block 1120,1130 is recorded in second graph buffer, the reservation bit (reservation bit 1140 in such as encoded block 1120 and the reservation bit 1150 in encoded block 1130) do not used in each encoded block, waste can be caused to the memory space of second graph buffer, reservation bit in each encoded block can be deleted, to promote the storage usefulness of memory by the second graph buffer that therefore the present invention proposes.
In sum, the image data processing system of the embodiment of the present invention and the method for image real time transfer thereof, consider the block access features of video engine and the wire access features of display engine simultaneously, effectively can promote the efficiency that video engine and display engine access the view data in memory.In addition, the method of image real time transfer of the present invention considers Block predictions coding and linear predictive coding two kinds of coded systems simultaneously, and therefrom select the less coded system of data volume, and effectively can reduce the data volume of coding, and then reduce the frequency range of required consumption when image is carried out motion compensation and shown.
Although the present invention discloses as above with embodiment; so itself and be not used to limit the present invention, any art technical staff, without departing from the spirit and scope of the present invention; when doing a little change and retouching, therefore protection scope of the present invention is when being as the criterion depending on the accompanying claim person of defining.