Summary of the invention
The embodiment of the present invention provides a kind of data processing method and device, solves in the prior art since DMA is readThe frame number of image data is greater than the frame number for the image data that DMA write enters, so that read-write pursuit phenomenon occur, and then leads to transmissionThe problem of image data mistake.
In order to achieve the above objectives, the embodiment of the present invention adopts the following technical scheme that
In a first aspect, providing a kind of data processing method, comprising:
The frame image data to be written to memory is obtained, the image data to be written to memory is nth frameThe image data of input, the memory include M data storage area, for storing image data according to preset order, eachData storage area is for storing a frame image data;
According to the frame number N and data storage area number M, the image data to be written to memory is determinedThe corresponding address in the first data storage area for needing to be stored in, and according between the frame number N and default null frame number difference andThe data storage area number M, locating for the image data for determining the corresponding frame number for needing to read under present image output formatThe corresponding address in second data storage area, the default null frame number are the image data stored in second data storage areaInput the difference between frame number and the frame number N;
Institute is written into the image data to be written to memory according to the corresponding address in first data storage areaIt states in the first data storage area;
The picture number stored in second data storage area is read according to the corresponding address in second data storage areaAccording to.
Second aspect provides a kind of data processing equipment, comprising:
Module is obtained, for obtaining the frame image data to be written to memory, the figure to be written to memoryAs data be nth frame input image data, the memory includes M data storage area, for storing according to preset orderImage data, each data storage area is for storing a frame image data;
Determining module, it is described to be written to depositing for determining according to the frame number N and data storage area number MThe image data of reservoir needs the corresponding address in the first data storage area being stored in, and according to the frame number N and default null frame numberBetween difference and the data storage area number M, determine the corresponding frame number for needing to read under present image output formatThe corresponding address in second data storage area locating for image data, the default null frame number are to deposit in second data storage areaDifference between the input frame number of the image data of storage and the frame number N;
Writing module, the corresponding address in first data storage area for being determined according to the determining module will be describedImage data to be written to memory is written in first data storage area;
Institute is read in read module, the corresponding address in second data storage area for being determined according to the determining moduleState the image data stored in the second data storage area.
The data processing method and device that the embodiment of the present invention provides, obtain the frame picture number to be written to memoryAccording to, which is the image data of nth frame input, which includes M data storage area,Each data storage area stores a frame image data and determines to be written then according to frame number N and data storage area number MEnter the corresponding address in the first data storage area for needing to be stored in the image data of memory, and according to frame number N and default skyDifference and data storage area number M between frame number, determine the corresponding frame number for needing to read under present image output formatThe locating corresponding address in the second data storage area of image data difference, finally, correspondingly according to first data storage areaLocation is written into the image data of memory and is written in the first data storage area, correspondingly according to second data storage areaRead the image data stored in the second data storage area in location.In this way by carrying out subregion, and setting meter to memory in advanceNumber devices count the currently image data frame number that has inputted, then according to the image data frame number currently inputted that counts withAnd in subregion background storage data storage area number, determine currently input a frame image data need be written data storageThe address of data storage area locating for the address in area and the subsequent two field pictures data difference for needing to read, to effectively controlThe speed difference between read-write has been made, ensure that the relationship between the frame number of the image data of write-in and the frame number of the image data of readingMeet the needs of present image output format, avoids read-write Rethinking Catching-Up Issues.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, completeSite preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based onEmbodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every otherEmbodiment shall fall within the protection scope of the present invention.
The embodiment of the present invention provides a kind of data processing method, and the data processing equipment in the present embodiment can be DMAController or the processor of other operations that data storage area of memory can be written and read.As shown in Figure 1, at the dataReason method specifically comprises the following steps:
101, data processing equipment obtains the frame image data to be written to memory.
Wherein, the above-mentioned image data to be written to memory is the image data of nth frame input, and memory includes MA data storage area, this M data storage area are used to store image data according to preset order, and each data storage area is for depositingStore up a frame image data.
Illustratively, according to the memory configuration schematic diagram of the data storage area of memory shown in Fig. 2.The memoryWhen carrying out subregion according to 4 data storage areas, 4 data storage areas of FIN0, FIN1, FIN2, FIN3 memory respectively, oftenA frame image data is stored in a data storage area, and 4 frame image datas can be stored in the memory, every frame image data includes Y,Tri- components of U, V.Specifically, assuming that the initial address of the memory is BASEADDR, the size of every frame data is FSIZE, thenAs shown in Fig. 2, corresponding, the initial address of each data storage area is respectively as follows:
FIN0:BASEADDR;
FIN1:BASEADDR+FSIZE;
FIN2:BASEADDR+2*FSIZE;
FIN3:BASEADDR+3*FSIZE.
102, data processing equipment determines the image to be written to memory according to frame number N and data storage area number MData need the corresponding address in the first data storage area that is stored in, and according between frame number N and default null frame number difference andData storage area number M is determined second locating for the image data for the corresponding frame number for needing to read under present image output formatThe corresponding address in data storage area.
Wherein, the first above-mentioned data storage area and the second data storage area are the data storage area of the memory.It is above-mentionedDefault null frame number be data processing equipment in order to avoid the image data that the data processing equipment is read is the figure being currently written intoAs data either before image of the older data so as to cause shown in that is written rebound phenomenon occurs and is arranged, it is above-mentionedDefault null frame number and data storage area number between difference need be more than or equal to 1.
And above-mentioned image output format includes 3D rendering.For example, when above-mentioned image output format is 3D output formatWhen, since the image data of two frames can do the 3D effects such as left-right format, top-down format, interlaced format, in order to make 3DImage effect, the data processing equipment need to read the image data of two frames.
Preferably, after the data processing equipment carries out subregion to memory in advance, the number of obtained data storage areaWhen being 4, and present image output format be 3D output format when, corresponding default null frame number is preferably 1 or 2.
Illustratively, data processing equipment frame number N and data storage area number M in above-mentioned step 102, determines to be writtenEntering to the image data of memory needs the corresponding address in the first data storage area being stored in specifically include:
A1, data processing equipment determine the remainder Y1 between frame number N and data storage area number M.
Illustratively, after data processing equipment receives a frame image data from LVDS receiver, VIN interruption can be triggered,The data processing equipment counts the image data frame number inputted by frame counter when triggering VIN is interrupted every time at this time.ToolBody, which calculates remainder Y1 by formula one (Y1=N mod M), wherein Y1 ∈ 1,2 ... ..., M.
A2, data processing equipment are according to remainder Y1, from the first corresponding relationship, obtain the corresponding data storage area remainder Y1Address, the first data that the corresponding data storage area remainder Y1 is needed to be stored in as the image data to be written to memoryMemory block.
Wherein, the first above-mentioned corresponding relationship is the corresponding relationship of remainder and data storage area, and each remainder is one correspondingThe address of data storage area.Illustratively, the first above-mentioned corresponding relationship can be between remainder and the address of data storage areaFirst mapping table, the address of the corresponding data storage area of 1 each numerical value into M in first mapping table.
Illustratively, in above-mentioned step 102 data processing equipment according to the difference between frame number N and default null frame number withAnd data storage area number M, it determines locating for the image data for the corresponding frame number for needing to read under present image output formatThe corresponding address in two data storage areas specifically includes:
B1, data processing equipment determine that the number M's of difference and data storage area between frame number N and default null frame number is remainingNumber Y2, and determine present image output format to the frame number of the image data in requisition for reading.
Illustratively, if the preset default null frame number of data processing equipment is X, pass through (R=(N-X) mod of formula twoM remainder Y2) is calculated, wherein Y1 ∈ 1,2 ... ..., M.
B2, data processing equipment are according to remainder Y2 and the frame number for the image data for needing to read, from the second corresponding relationshipIn, the address of the corresponding data storage area remainder Y2 is obtained, is stored using the corresponding data storage area remainder Y2 as the second dataArea.
Wherein, the image data stored in the second above-mentioned data storage area is the image data for needing to read, this secondCorresponding relationship of the corresponding relationship between remainder and data storage area, frame number of each remainder to the image data in requisition for readingThe address of data storage area.Illustratively, the second above-mentioned corresponding relationship can be between remainder and the address of data storage areaSecond mapping table, and different image output formats corresponds to the second different mapping tables, every kind of image output formatThe number of the address of the corresponding data storage area of remainder is corresponding with the image output format in corresponding second mapping tableThe frame number for the image data for needing to read is identical.Certainly, 1 each numerical value into M can also be only in second mapping tableThe address of a corresponding data storage area, in this way, when data processing equipment obtains the address of the corresponding data storage area remainder Y2When, the address of the corresponding data storage area remainder Y2 can be obtained first, then according to present image output format in requisition forThe frame number of the image data of reading is continued to obtain the data and be deposited on the basis of the address of the corresponding data storage area remainder Y2The address of next data storage area of storage area, until the address number of acquisition meets present image output format in requisition for readingImage data frame number until.
103, data processing equipment is written into according to the corresponding address in the first data storage area to the picture number of memoryAccording in the first data storage area of write-in.
104, data processing equipment reads in the second data storage area according to the corresponding address in the second data storage area and storesImage data.
Illustratively, if the frame number of the image data currently inputted is N, the number of the data storage area of memory is 4,Default null frame number is 2, and when the frame number of the corresponding image data for needing to read of present image output format is 2.Referring to Fig. 3 instituteThe write-in for the image data shown is with the flow diagram read it is found that when data processing equipment receives a frame from LVDS receiverAfter image data, VIN interruption can be triggered, counter starts counting, the frame number N for the image data that statistics has currently inputted.Then,The storage location of a currently received frame image data is determined by the remainder that the number of frame number N and data storage area is 4, and is corresponded toThe storage location of two field pictures data that reads of needs by the difference and data storage area between frame number N and threshold value null frame number 2Number be 4 remainder determine.If the remainder of N and 4 is 0, it is put into FIN3;If remainder is 1, it is put into FIN2;If remainder is2, then it is put into FIN1;If remainder is 3, it is put into FIN0.(if N-2) with 4 remainder be 0, read FIN2 and FIN3;If remainderIt is 1, then reads FIN2 and FIN1;If remainder is 2, FIN0 and FIN1 are read;If remainder is 3, FIN0 and FIN3 are read.IfThe storage location for determining a currently received frame image data is data storage area FIN3, the corresponding two frame figures for needing to readWhen being respectively data storage area FIN1 and FIN0 as the storage location of data, then the address of the corresponding FIN3 of write operation is writtenInto dma controller register, image data is controlled by dma controller and is transmitted over busses the specified address, the processAs WDMA0.While WDMA0 work, vout, which is interrupted, to be called, in vout interruption, by the corresponding FIN1 of read operationIt is written in dma controller with the address of FIN0, dma controller reads image data from FIN1 and FIN0 respectively, the processAs RDMA0 and RDMA1.
The data processing method that the embodiment of the present invention provides obtains the frame image data to be written to memory, shouldImage data to be written to memory is the image data of nth frame input, which includes M data storage area, eachData storage area stores a frame image data, then according to frame number N and data storage area number M, determine it is to be written extremelyThe image data of memory needs the corresponding address in the first data storage area being stored in, and according to frame number N and default null frame numberBetween difference and data storage area number M, determine the image of corresponding frame number for needing to read under present image output formatThe locating corresponding address in the second data storage area of data difference, finally, will according to the corresponding address in first data storage areaImage data to be written to memory is written in the first data storage area, is read according to the corresponding address in second data storage areaTake the image data stored in the second data storage area.In this way by carrying out subregion, and setting counter to memory in advanceCount the currently image data frame number that has inputted, then according to the image data frame number currently inputted that counts and pointThe number of data storage area in area's background storage determines the data storage area that currently one frame image data of input needs to be writtenThe address of data storage area locating for address and the subsequent two field pictures data difference for needing to read, to be effectively controlledSpeed difference between read-write ensure that the relationship between the frame number of the image data of write-in and the frame number of the image data of reading meetsThe demand of present image output format avoids read-write Rethinking Catching-Up Issues.
The embodiment of the present invention provides a kind of data processing equipment, the data processing equipment for realizing above-mentioned data atReason method, which is applied to terminal device, for example, smart television, top box of digital machine, Web TV box, intelligenceEnergy mobile phone, tablet computer and personal digital assistant (English: Personal Digital Assistant, abbreviation PDA) etc..Such asShown in Fig. 4, which includes: to obtain module 21, determining module 22, writing module 23 and read module 24, in which:
Obtain module 21, for obtaining the frame image data to be written to memory, the figure to be written to memoryAs data be nth frame input image data, which includes M data storage area, for according to preset order storage figureAs data, each data storage area is for storing a frame image data.
Determining module 22, for determining the image to be written to memory according to frame number N and data storage area number MData need the corresponding address in the first data storage area that is stored in, and according between frame number N and default null frame number difference andData storage area number M is determined second locating for the image data for the corresponding frame number for needing to read under present image output formatThe corresponding address in data storage area.
Writing module 23, for according to determining module 22 determine the corresponding address in the first data storage area be written intoThe image data of memory is written in the first data storage area.
The second number is read in read module 24, the corresponding address in the second data storage area for being determined according to determining module 22According to the image data stored in memory block.
Optionally, determining module 22 according to frame number N and data storage area number M, determine it is to be written to memoryImage data needs to be specifically used for when the corresponding address in the first data storage area for being stored in:
Determine the remainder Y1 between frame number N and data storage area number M;According to remainder Y1, from the first corresponding relationship, obtainThe address of the corresponding data storage area remainder Y1, using the corresponding data storage area remainder Y1 as the image to be written to memoryThe first data storage area that data needs are stored in, the corresponding relationship of first corresponding relationship between remainder and data storage area, oftenThe address of the corresponding data storage area of a remainder.
Optionally, determining module 22 is according to the difference and data storage area number between frame number N and default null frame numberM determines that the second data storage area locating for the image data for the corresponding frame number for needing to read under present image output format is correspondingAddress when be specifically used for:
It determines the remainder Y2 of M between the difference and data storage area number between frame number N and default null frame number, and determines currentFrame number of the image output format to the image data in requisition for reading.
According to remainder Y2 and the frame number for the image data for needing to read, from the second corresponding relationship, Y2 pairs of remainder is obtainedThe address for the data storage area answered, using the corresponding data storage area remainder Y2 as the second data storage area, which is depositedThe image data stored in storage area is the image data for needing to read, and second corresponding relationship is between remainder and data storage areaCorresponding relationship, address of each remainder to the frame number data storage area of the image data in requisition for reading.
Wherein, the default null frame number in the present embodiment and the difference between data storage area number are more than or equal to 1.
The data processing equipment that the embodiment of the present invention provides obtains the frame image data to be written to memory, shouldImage data to be written to memory is the image data of nth frame input, which includes M data storage area, eachData storage area stores a frame image data, then according to frame number N and data storage area number M, determine it is to be written extremelyThe image data of memory needs the corresponding address in the first data storage area being stored in, and according to frame number N and default null frame numberBetween difference and data storage area number M, determine the image of corresponding frame number for needing to read under present image output formatThe locating corresponding address in the second data storage area of data difference, finally, will according to the corresponding address in first data storage areaImage data to be written to memory is written in the first data storage area, is read according to the corresponding address in second data storage areaTake the image data stored in the second data storage area.In this way by carrying out subregion, and setting counter to memory in advanceCount the currently image data frame number that has inputted, then according to the image data frame number currently inputted that counts and pointThe number of data storage area in area's background storage determines the data storage area that currently one frame image data of input needs to be writtenThe address of data storage area locating for address and the subsequent two field pictures data difference for needing to read, to be effectively controlledSpeed difference between read-write ensure that the relationship between the frame number of the image data of write-in and the frame number of the image data of reading meetsThe demand of present image output format avoids read-write Rethinking Catching-Up Issues.
It is apparent to those skilled in the art that for convenience and simplicity of description, only with above-mentioned each functionThe division progress of module can according to need and for example, in practical application by above-mentioned function distribution by different function mouldsBlock is completed, i.e., the internal structure of device is divided into different functional modules, to complete all or part of function described aboveEnergy.The specific work process of the system, apparatus, and unit of foregoing description, can be with reference to corresponding in preceding method embodimentJourney, details are not described herein.
In several embodiments provided herein, it should be understood that disclosed device and method can pass through itIts mode is realized.For example, the apparatus embodiments described above are merely exemplary, for example, the module or unitIt divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or componentsIt can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown orThe mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of device or unitIt closes or communicates to connect.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unitIt is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated listMember both can take the form of hardware realization, can also realize in the form of software functional units.
The above, above embodiments are only to illustrate the technical solution of the application, rather than its limitations;Although referring to beforeEmbodiment is stated the application is described in detail, those skilled in the art should understand that: it still can be to precedingTechnical solution documented by each embodiment is stated to modify or equivalent replacement of some of the technical features;And theseIt modifies or replaces, the spirit and scope of each embodiment technical solution of the application that it does not separate the essence of the corresponding technical solution.