Specific embodiment
To keep the technical problem to be solved in the present invention, technical solution and advantage clearer, below in conjunction with attached drawing and tool
Body embodiment is described in detail.
On the one hand, the embodiment of the present invention provides a kind of method for improving image acquisition speed, as shown in Figure 1, being used for electronics
Circuit, electronic circuit include imaging sensor 11, image capture module 12, image processing module 13 and processor 14, and image passes
The input terminal of the output end connection image capture module 12 of sensor 11, the output end of image capture module 12 connect image procossing mould
The output end of the input terminal of block 13, image processing module 13 connects processor 14, as shown in Fig. 2, this method comprises:
Step S101: judge whether image processing module 13 exports image data and complete, if so, performing the next step
Suddenly, if not, repeating this step;
In this step, it is preferred that the value of the related register in 14 real-time detection image processing module 14 of processor, judgement
Whether one frame image data is transmitted, what the judgment method in this step can also be readily apparent that using those skilled in the art
Other methods.In addition, in this step, the deposit buffer area for being used on deposit image data is allocated in advance in memory, at image
It manages module 13 and image data is stored in pre-assigned deposit buffer area in memory.
Step S102: the image data output address of image processing module 13 is updated to new output address.
In this step, the reading buffer area for being used on and reading image data is allocated in advance in memory, when image procossing mould
After the completion of block 13 exports image data, processor 14 will be cached from deposit by way of more new image data output address
It is removed in buffer area, and caching is distributed to the reading buffer area for being used for processor 14 and reading image data, and after updating
New output address attach most importance to the caching in newly assigned deposit buffer area, exported for storing following image processing module 13
Image data.
In the present embodiment, only the caching for storing image data is removed from deposit buffer area, and it is slow to be added to reading
Deposit in area, there is no " copy " caching in image data, avoid in the prior art using " copy " and caused by the time damage
Consumption and system loss, therefore, compared with prior art, the present embodiment accelerates the acquisition speed of image data, reduces processing
The system loss of device.
As a kind of improvement of Fig. 2 embodiment, as shown in figure 3, the present embodiment further include:
Step S103: corresponding from the image data when needing using treated the image data of image processing module 13
Storage address in read the image data.
In the present embodiment, processor 14 is when needing using treated the image data of image processing module 13, Jiu Huijian
Whether there is image data in the corresponding storage address of altimetric image data, if so, then by image data from corresponding storage address
In read out and handled, wherein storage address is to read the buffer address that the image data is stored in buffer area.Fig. 2 is real
The step S103 applied in example and the present embodiment can be a continuous method, or two independent methods.
As a kind of improvement of Fig. 3 embodiment, as shown in figure 4, including: before the step S101
Step 100: pre-establishing deposit address table for recording the address that can be stored in image data and for recording
The reading address table of the address of prestored digital image data can be read, being prerecorded at least two in the deposit address table can
It is stored in the address of image data;
In this step, deposit address table and the foundation for reading address table can make the deposit of image data and read more have item
Reason, the image data that the processing of image processing module 13 is completed can be directly stored in deposit address table, and equally, processor 14 needs
When wanting image data, directly image data can also be taken out in reading address table, processor 14 do not need in memory into
Row is searched, the speed for further improving image data deposit and reading, in addition, storing image to make to be stored in address table
After data, additionally it is possible to store new image data in time, be stored into address table and be prerecorded at least two and can be stored in figure
As the address of data;
The step S101 is further are as follows:
Step S101 ': judge whether described image processing module exports image data and complete, if it is, by
The address of image data is stored in from deleting and being added in the reading address table in the deposit address table, is performed the next step
Suddenly, if it is not, then repeating this step.
In this step, will by the storage of treated the image data of image processing module 13 to deposit address table accordingly
In location, after the image data stored in the appropriate address for being stored in address table is transmitted, by being stored with for the deposit address table
The appropriate address of image data, which is added to, to be read in address table, the use of convenient processor 14.
In the present embodiment, foundation has deposit address table and reads address table, when image data is transmitted, will be stored in
The address of image data is deleted and is added to from deposit address table and read in address table, improves image data storage and reads
Convenience.
As the further improvement of Fig. 4 embodiment, as shown in figure 5, step S103 is further are as follows:
Step S1031: when needing using treated the image data of image processing module 13, judge that reading address table is
No is sky, if so, this step is repeated, if not, performing the next step rapid;
In this step, for processor 14 when using image data, it is in order to prevent that first detection, which reads whether address table is empty,
Reading in address table does not have image data and processor 14 is made to carry out acquisition movement, caused by the resource of waste processor 14 show
As.
Step S1032: the image data stored in the address read in address table is taken out;
Step S1033: the address for having been taken out image data is deleted from reading address table and is added to deposit address
In table.
The present embodiment has carried out further optimization to above-described embodiment, will have been taken out the address of image data from reading
It takes and deletes and be added in address table in deposit address table, it is new by treated the image of image processing module 13 for storing
Data are arranged the new address for being used to store image data without processor 14 in deposit address table, further increase
The acquisition speed of image data.
As the further improvement of Fig. 4 and embodiment illustrated in fig. 5, it is stored in address table and reading address table is all made of chained list knot
Structure.
In the present embodiment, list structure is storage organization discontinuous, non-sequential on a kind of physical memory cell, data element
The logical order of element is realized by the pointer link orders in chained list.The most apparent benefit of list structure is exactly conventional number
The mode of group arrangement associated item is different from data items sequence on memory body or disk, and the access of data often will be in difference
The middle conversion that puts in order.In the present embodiment, memory headroom can be made full use of using list structure, realizes that flexible memory is dynamic
State management.
In the following, a kind of specific embodiment of image data acquisition is provided in the present invention, as shown in Figure 6:
Step S1: system electrification;
Step S2: system initialization;
Step S3: n image data memory buffers are distributed from memory;
Step S4: the address of this n image data memory buffers is linked into chained list write_buf;
Step S5: the address that image processing module 13 exports image is set as first image in write_buf chained list
Data storage buffers;
Whether S6: one frame data of step are transmitted, if it is, performing the next step, if it is not, then repeating this step
Suddenly;
Step S7: the image data memory buffers for being stored with image data are removed from write_buf chained list, remaining figure
As data storage buffers successively move forward a position;
Step S8: the image data memory buffers for having image data are linked into the initial position of chained list read_buf;
Step S9: updating image processing module 13 to export the address of image is image data new in write_buf chained list
Memory buffers.
In the present embodiment, in step S3, image data memory buffers are in the deposit address table in the above embodiments
Caching;In step S4 and S9, write_buf is the structural body variable of the chained list for being stored in image data of definition, read_
Buf is the structural body variable of the chained list for reading image data of definition.
In the present embodiment, system can distribute n image data memory buffers when powering on first in memory, this
A n can be according to practical application, and minimum is 2, and in the present embodiment, preferably 4, the upper limit is unlimited, but it is commonly used when
20, after image data memory buffers are assigned are usually no more than, is linked into chained list write_buf one by one first,
For storing new received image data;Once having, to store a frame in some image data memory buffers in write_buf complete
Whole image just removes the image data memory buffers from write_buf, and the image data memory buffers are linked into chain
In table read_buf, used for processor 14.
In the following, a kind of specific embodiment that image data is read is additionally provided in the present invention, as shown in Figure 7:
Step S11: start to read image;
Step S12: whether chained list read_buf is stored with image data;
Step S13: first image data memory buffers in read_buf chained list are taken out;
Step S14: relevant treatment is carried out;
Step S15: processing is completed, which is removed from read_buf chained list, remaining image number
A position is successively moved forward according to caching;
Step S16: the image data memory buffers are linked into the end position of chained list write_buf.
In the present embodiment, whether when processor 14 needs to handle image, will detect in chained list read_buf has
Image data memory buffers have been linked into, if any, the address of image data memory buffers are obtained, then using therein
Image data carries out relevant processing.
Following structural body is defined in Fig. 6 and Fig. 7 embodiment:
Structural body is a kind of constructivity data, the compound type that it is made of different types of data item, and structural body is
Build dynamic data structure (such as chained list) highly useful tool.Chained list in the present embodiment is exactly by the data of structural body type
It is constituted.
It is the structural body of image data memory buffers defined in the present embodiment below:
Struct buf_info{
Unsigned int*bufaddr;
Unsigned int*list;
};
Wherein, bufaddr is directed toward the address in image buffer storage area;List is directed toward next image data memory buffers structural body
Address, default value NULL;
It is the list structure that deposit address table uses defined in the present embodiment below:
Struct listbuf{
Unsigned int*listhead;
};
Listhead is directed toward the address of first image data memory buffers structural body, default value NULL;
The present embodiment defines two chained list variables, struct listbuf write_buf and struct listbuf
Read_buf is linked into write_buf chained list if not having image data in image data memory buffers, new for storing
The image that the processing of image processing module 13 is completed;If having image data in image data memory buffers, it is linked into read_buf
Chained list is used for processor 14.
After being assigned well, address determines that image data memory buffers;Each image data memory buffers are corresponding
The structural body of one image data memory buffers:
Struct buf_info{
Unsigned int*bufaddr;
Unsigned int*list;
};
What is saved in variable bufaddr is exactly the address of image data memory buffers;And what variable list was saved is next
The first address of struct buf_info structural body corresponding to a image data memory buffers, and variable write_buf or
The first address of struct buf_info structural body corresponding to first image data memory buffers that read_buf is saved, this
Sample has just linked multiple images data storage buffers, forms a chained list.
In Fig. 6 and Fig. 7 embodiment, what is only operated is the address of image data memory buffers, and there is no copy image numbers
According to the image data in memory buffers.If image data memory buffers do not have image data, just image data is stored slow
The address deposited is put into write_buf chained list, and when saving new image data in this way, image processing module 13 can find this
Image data memory buffers;If image data memory buffers have image data, just by the address of image data memory buffers
It is put into read_buf chained list, when such processor 14 handles image, the image data memory buffers can be found.The reality
Apply in example, due to only operate be image data memory buffers address, rather than copy image data storage buffers, institute
To accelerate the acquisition speed of image, reduce the system consumption of processor 14.
On the other hand, the embodiment of the present invention also provides a kind of device for improving image acquisition speed, as shown in Figure 1, being used for
Electronic circuit, electronic circuit include imaging sensor 11, image capture module 12, image processing module 13 and processor 14, figure
As the input terminal of the output end connection image capture module 12 of sensor 11, the output end of image capture module 12 is connected at image
The input terminal of module 13 is managed, the output end of image processing module 13 connects processor 14, as shown in Figure 8, comprising:
First judgment module 111: completing for judging whether image processing module 13 exports image data, if so,
Update module is gone to, if it is not, then repeating;
Update module 112: for the image data output address of image processing module 13 to be updated to new output address.
In the present embodiment, only the caching for storing image data is removed from deposit buffer area, and it is slow to be added to reading
Deposit in area, there is no " copy " caching in image data, avoid in the prior art using " copy " and caused by the time damage
Consumption and system loss, therefore, compared with prior art, the present embodiment accelerates the acquisition speed of image data, reduces processing
The system loss of device.
As a kind of improvement of Fig. 8 embodiment, as shown in Figure 9, further includes:
Read module 113: for when needing using treated the image data of image processing module 13, from the picture number
According to reading the image data in corresponding storage address.
In the present embodiment, storage address is to read the buffer address that the image data is stored in buffer area.Fig. 2 embodiment with
Read module 113 in the present embodiment can be a continuous structure, or two independent structures.
As a kind of improvement of Fig. 9 embodiment, as shown in Figure 10, first judgment module 111 is connected with:
Logging modle 110: for pre-establish deposit address table for recording the address that can be stored in image data and
For recording the reading address table that can read the address of prestored digital image data, it is stored in address table and is prerecorded at least two
The address of image data can be stored in;
First judgment module 111 is further used for:
Judge whether described image processing module exports image data to complete, if it is, picture number will be stored in
According to address from deleting and being added in the reading address table in the deposit address table, go to update module, if it is not, then
It repeats.
In the present embodiment, foundation has deposit address table and reads address table, when image data is transmitted, will be stored in
The address of image data is deleted and is added to from deposit address table and read in address table, improves image data storage and reads
Convenience.
As the further improvement of Figure 10 embodiment, as shown in figure 11, read module 113 includes:
Second judgment module 1131: for when needing using treated the image data of image processing module 13, judgement
Read whether address table is empty, if so, this step is repeated, if not, performing the next step rapid;
Take out module 1132: for taking out the image data stored in the address read in address table;
Conversion module 1133: it is deposited for deleting and being added to the address for having been taken out image data from reading address table
Enter in address table.
The present embodiment has carried out further optimization to above-described embodiment, will have been taken out the address of image data from reading
It takes and deletes and be added in address table in deposit address table, it is new by treated the image of image processing module 13 for storing
Data are arranged the new address for being used to store image data without processor 14 in deposit address table, further increase
The acquisition speed of image data.
As the further improvement of Figure 10 and Figure 11 embodiment, deposit address table in logging modle 110 and address is read
Table is all made of list structure.
In the present embodiment, list structure is storage organization discontinuous, non-sequential on a kind of physical memory cell, data element
The logical order of element is realized by the pointer link orders in chained list.The most apparent benefit of list structure is exactly: conventional number
The mode of group arrangement associated item is different from these data items sequence on memory body or disk, and the access of data often will be
The different middle conversions that puts in order.In the present embodiment, calculator memory space can be made full use of using list structure, realizes spirit
Memory dynamic living manages.
The above is a preferred embodiment of the present invention, it is noted that for those skilled in the art
For, without departing from the principles of the present invention, it can also make several improvements and retouch, these improvements and modifications
It should be regarded as protection scope of the present invention.