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 read
The 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 transmission
The 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 frame
The image data of input, the memory include M data storage area, for storing image data according to preset order, each
Data 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 determined
The 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 and
The data storage area number M, locating for the image data for determining the corresponding frame number for needing to read under present image output format
The corresponding address in second data storage area, the default null frame number are the image data stored in second data storage area
Input 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 area
It 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 area
According 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 memory
As data be nth frame input image data, the memory includes M data storage area, for storing according to preset order
Image 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 M
The 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 number
Between difference and the data storage area number M, determine the corresponding frame number for needing to read under present image output format
The corresponding address in second data storage area locating for image data, the default null frame number are to deposit in second data storage area
Difference 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 described
Image 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 module
State 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 memory
According 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 M
Enter 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 sky
Difference and data storage area number M between frame number, determine the corresponding frame number for needing to read under present image output format
The locating corresponding address in the second data storage area of image data difference, finally, correspondingly according to first data storage area
Location is written into the image data of memory and is written in the first data storage area, correspondingly according to second data storage area
Read 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 advance
Number devices count the currently image data frame number that has inputted, then according to the image data frame number currently inputted that counts with
And in subregion background storage data storage area number, determine currently input a frame image data need be written data storage
The 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 control
The 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 reading
Meet 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, complete
Site 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 on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment 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 DMA
Controller or the processor of other operations that data storage area of memory can be written and read.As shown in Figure 1, at the data
Reason 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 M
A 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 depositing
Store 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 memory
When carrying out subregion according to 4 data storage areas, 4 data storage areas of FIN0, FIN1, FIN2, FIN3 memory respectively, often
A 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, then
As 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 M
Data 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 and
Data 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 format
The 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-mentioned
Default 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 into
As 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-mentioned
Default 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 format
When, 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 3D
Image 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 area
When 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 written
Entering 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.Tool
Body, 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 Y1
Address, 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 memory
Memory block.
Wherein, the first above-mentioned corresponding relationship is the corresponding relationship of remainder and data storage area, and each remainder is one corresponding
The address of data storage area.Illustratively, the first above-mentioned corresponding relationship can be between remainder and the address of data storage area
First 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 with
And 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 format
The 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 remaining
Number 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 two
M 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 relationship
In, 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 data
Area.
Wherein, the image data stored in the second above-mentioned data storage area is the image data for needing to read, this second
Corresponding relationship of the corresponding relationship between remainder and data storage area, frame number of each remainder to the image data in requisition for reading
The address of data storage area.Illustratively, the second above-mentioned corresponding relationship can be between remainder and the address of data storage area
Second mapping table, and different image output formats corresponds to the second different mapping tables, every kind of image output format
The number of the address of the corresponding data storage area of remainder is corresponding with the image output format in corresponding second mapping table
The 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 table
The address of a corresponding data storage area, in this way, when data processing equipment obtains the address of the corresponding data storage area remainder Y2
When, the address of the corresponding data storage area remainder Y2 can be obtained first, then according to present image output format in requisition for
The 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 Y2
The address of next data storage area of storage area, until the address number of acquisition meets present image output format in requisition for reading
Image 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 memory
According 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 stores
Image 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 institute
The 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 receiver
After 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 to
The 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 2
Number 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 is
2, 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 remainder
It 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.If
The storage location for determining a currently received frame image data is data storage area FIN3, the corresponding two frame figures for needing to read
When 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 written
Into dma controller register, image data is controlled by dma controller and is transmitted over busses the specified address, the process
As WDMA0.While WDMA0 work, vout, which is interrupted, to be called, in vout interruption, by the corresponding FIN1 of read operation
It is written in dma controller with the address of FIN0, dma controller reads image data from FIN1 and FIN0 respectively, the process
As 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, should
Image data to be written to memory is the image data of nth frame input, which includes M data storage area, each
Data 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 extremely
The 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 number
Between difference and data storage area number M, determine the image of corresponding frame number for needing to read under present image output format
The locating corresponding address in the second data storage area of data difference, finally, will according to the corresponding address in first data storage area
Image 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 area
Take the image data stored in the second data storage area.In this way by carrying out subregion, and setting counter to memory in advance
Count the currently image data frame number that has inputted, then according to the image data frame number currently inputted that counts and point
The 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 written
The address of data storage area locating for address and the subsequent two field pictures data difference for needing to read, to be effectively controlled
Speed 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 meets
The 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 at
Reason method, which is applied to terminal device, for example, smart television, top box of digital machine, Web TV box, intelligence
Energy mobile phone, tablet computer and personal digital assistant (English: Personal Digital Assistant, abbreviation PDA) etc..Such as
Shown 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 memory
As data be nth frame input image data, which includes M data storage area, for according to preset order storage figure
As 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 M
Data 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 and
Data 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 format
The 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 into
The 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 22
According 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 memory
Image 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, obtain
The address of the corresponding data storage area remainder Y1, using the corresponding data storage area remainder Y1 as the image to be written to memory
The first data storage area that data needs are stored in, the corresponding relationship of first corresponding relationship between remainder and data storage area, often
The 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 number
M 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 corresponding
Address 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 current
Frame 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 obtained
The address for the data storage area answered, using the corresponding data storage area remainder Y2 as the second data storage area, which is deposited
The image data stored in storage area is the image data for needing to read, and second corresponding relationship is between remainder and data storage area
Corresponding 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, should
Image data to be written to memory is the image data of nth frame input, which includes M data storage area, each
Data 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 extremely
The 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 number
Between difference and data storage area number M, determine the image of corresponding frame number for needing to read under present image output format
The locating corresponding address in the second data storage area of data difference, finally, will according to the corresponding address in first data storage area
Image 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 area
Take the image data stored in the second data storage area.In this way by carrying out subregion, and setting counter to memory in advance
Count the currently image data frame number that has inputted, then according to the image data frame number currently inputted that counts and point
The 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 written
The address of data storage area locating for address and the subsequent two field pictures data difference for needing to read, to be effectively controlled
Speed 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 meets
The 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 function
The division progress of module can according to need and for example, in practical application by above-mentioned function distribution by different function moulds
Block is completed, i.e., the internal structure of device is divided into different functional modules, to complete all or part of function described above
Energy.The specific work process of the system, apparatus, and unit of foregoing description, can be with reference to corresponding in preceding method embodiment
Journey, details are not described herein.
In several embodiments provided herein, it should be understood that disclosed device and method can pass through it
Its mode is realized.For example, the apparatus embodiments described above are merely exemplary, for example, the module or unit
It divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components
It can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown or
The mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of device or unit
It 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 unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member 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 before
Embodiment is stated the application is described in detail, those skilled in the art should understand that: it still can be to preceding
Technical solution documented by each embodiment is stated to modify or equivalent replacement of some of the technical features;And these
It 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.