A kind of method and apparatus of image rotation
Technical field
The invention belongs to image rotation processing field, relate in particular to a kind of method and apparatus of image rotation.
Background technology
(Direct Memory Access DMA), is a kind of mechanism of quick transmission data in direct memory access (DMA).Data transfer can be from the adaptive internal memory that snaps into, from the internal memory to the adapter or from one section internal memory to another section internal memory.The importance of DMA technology is, utilizes it not needing when data transmit to carry out central processing unit (Central Processing Unit, participation CPU).Dma controller is all arranged on every computer motherboard, and computing machine is programmed to it usually, and (Read-Only Memory ROM) comes stored routine, and these programmed control DMA transmits data with the read-only memory device on the adapter.In case the controller initialization is finished, data begin to transmit, and DMA just can break away from CPU, independently finish data and transmit.In DMA transmits the blink of beginning, there are two processors to be this DMA work basically, an executive routine code, one is transmitted data.
The portable multimedia processor mainly is divided into three parts: data are obtained stored logic and equipment, data processing centre (DPC) and data delivery control, and terminal presents logic and equipment.Data obtain stored logic and equipment comprises that mainly data collection in worksite logic, deposit data logic, data are to data processing centre's conveying and passback logic; Data processing centre (DPC) then mainly is responsible for data content with file property and resolves to human signal content that can direct feel, and data delivery control then is responsible for presenting according to terminal the specification of logical device and is carried content to it; Terminal presents logic and equipment then mainly comprises signal working area, signal output apparatus.
All disassembled into the matrix dot array element of specific size owing to handled image information of data processing centre (DPC) and video information, by the data delivery steering logic these matrix dot array elements are combined into to send to behind the complete image again and present terminal, so the most direct realization image rotating method can be realized with the direct content of revising the signal working area that presents terminal of software.Certainly the result who does like this is that software overhead is very big, particularly present terminal when having strict time requirement in presenting, the calculated amount of software approach is very surprising, not only run counter to portable multimedia processor low-power consumption requirement, or even the time requirement that presents terminal does not reach yet.
Therefore portable multimedia is more prone to the rotation of direct hardware control logic.Therefore when presenting the demanding terminal image to certain direction rotation, data processing centre (DPC) must combine rotation and data delivery steering logic matrix unit reorganization rotation in the content element of matrix dot array element could realize the rotation requirement smoothly.
Consider cost factor, hardware can't be in order to provide special like this display requirement in design process, and increase considerably internal resource.General a kind of way is exactly the method by software, directly revise need data presented with the purpose that reaches rotation stint no sacrifice part system performance; Perhaps another kind of way is exactly the form that constraint shows display image, and the bound fraction hardware logic reaches requirement by the inner rotation of hardware
In the prior art, realize that the image rotation has following two kinds of methods nothing more than:
Method 1: a kind of modification discrete cosine transform (Discrete Cosine Transform, DCT) order of output data sequence and ranks direction, make the next stage logic when visit DCT local buffer, a plurality of matrix datas unit has been the image that rotates through, by last steering logic with the data recombination one-level, make up all matrix data unit, to realize the rotation of entire image.This method is a method the most frequently used in the existing hardware design, but relatively stricter for the dimensional requirement of the target image that rotates, picture size must be the integral multiple of a plurality of matrix datas unit.
Method 2: a kind of hard-wired method that is used for around user definition reference point image rotating.In the method, receive the user definition reference point, this user definition reference point can define outside image.Then, a position of computed image, thus this location definition after the user definition reference point rotation position of described image.Calculate then from the order of the one or more image pixels of memory fetch.This sequential definition is around the user definition reference point rotation rotation of described image afterwards.After this, according to the order of calculating from the memory fetch image pixel.This method has the characteristics of software operation basically, can realize rotating at any angle, and the relevant hardware logic is very complicated.
All disassembled into the matrix dot array element of specific size owing to handled image information of data processing centre (DPC) and video information, by the data delivery steering logic these matrix dot array elements are combined into to send to behind the complete image again and present terminal, so the most direct realization image rotating method can be realized with the direct content of revising the signal working area that presents terminal of software.Certainly the result who does like this is that software overhead is very big, particularly present terminal when having strict time requirement in presenting, the calculated amount of software approach is very surprising, not only run counter to portable multimedia processor low-power consumption requirement, or even the time requirement that presents terminal does not reach yet.
Consumer portable equipment is very responsive to the ratio of performance and cost.Based on the rotation processing of software approach,, consume too many CPU time, and greatly reduce system performance though can satisfy various dirigibility requirements; And the energy of rotation of traditional hardware mode can be realized rotation preferably to the image of agreement dimensional characteristic, but for the image that does not satisfy these sizes, the expanded images size produces the image hemstitching to satisfy dimension constraint, or is deleting that picture size reduced image information to satisfy dimension constraint.
Summary of the invention
The purpose of the embodiment of the invention is to provide a kind of front end image rotating method, too many CPU time and the hardware problem excessive to the image rotating goal constraint of software consumes when being intended to solve exist in the prior art image is rotated.
The embodiment of the invention is achieved in that a kind of front end image rotating method, said method comprising the steps of:
The number of once visiting pixel according to target sense of rotation and front end is one or more independently data cells with image division;
According to the target sense of rotation data cell that marks off and the point of data cell inside are regrouped;
Image after the establishment is sent to terminal.
Another purpose of the embodiment of the invention is to provide a kind of terminal image read method, said method comprising the steps of:
Image after reception is regrouped the point of the data cell that marks off and data cell inside;
Read successively according to the data cell after the rotary mode read operation will not regrouped and the point of data cell inside.
Another purpose of the embodiment of the invention is to provide a kind of front end image orbiting facility, and described equipment comprises:
The image division module, the number that is used for once visiting according to target sense of rotation and terminal pixel is one or more independently data cells with image division;
The data cell compiling module is used for according to the target sense of rotation data cell that marks off and the point of data cell inside being regrouped; And
The image sending module is used for the image after the establishment is sent to terminal.
Another purpose of the embodiment of the invention is to provide a kind of terminal image fetch equipment, and described equipment comprises:
The image receiver module is used to receive the image after the point of the data cell that marks off and data cell inside regrouped; And
Data cell is read module, is used for reading successively according to the data cell after the rotary mode read operation will not regrouped and the point of data cell inside.
The present invention is by being one or more independently data cells with image division, be sent to terminal according to the target sense of rotation to after the regrouping of the point of the data cell that marks off and data cell inside, terminal receives the image after having worked out, read successively according to the data cell after the rotary mode read operation will not regrouped and the point of data cell inside, realized the rotation of entire image under arbitrarily angled.
Description of drawings
Fig. 1 is the realization flow figure of the front end image rotating method that provides of the embodiment of the invention;
Fig. 2 is the realization flow figure of the terminal image read method that provides of the embodiment of the invention;
Fig. 3 is the precedence diagram of reading of 3 * 5 processing unit Central Plains pixels that 11 * 13 image division are gone out that provide of the embodiment of the invention;
Fig. 4 is that pixel is arranged and read precedence diagram after the rotation of 3 * 5 processing units that 11 * 13 image division the are gone out expectation that provides of the embodiment of the invention;
Fig. 5 be the embodiment of the invention provide this 3 * 5 processing unit is disassembled after one of structural drawing;
Fig. 6 be the embodiment of the invention provide this 3 * 5 processing unit is disassembled after structural drawing two;
Fig. 7 is the data ordering precedence diagram under the 270 degree rotary mode controls provided by the invention;
Fig. 8 be the embodiment of the invention provide this 3 * 5 processing unit is disassembled after one of structural drawing read precedence diagram;
Fig. 9 be the embodiment of the invention provide this 3 * 5 processing unit is disassembled after structural drawing two read precedence diagram;
Figure 10 is the structural drawing of the front end image orbiting facility that provides of the embodiment of the invention;
Figure 11 is the structural drawing of the terminal image fetch equipment that provides of the embodiment of the invention.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer,, the present invention is further elaborated below in conjunction with drawings and Examples.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
The present invention is by being one or more independently data cells with image division, be sent to terminal according to the target sense of rotation to after the regrouping of the point of the data cell that marks off and data cell inside, terminal receives the image after having worked out, reads successively according to the data cell after the rotary mode read operation will not regrouped and the point of data cell inside.
Fig. 1 shows the realization flow of front end image rotating method provided by the invention, and details are as follows.
In step S101, the number of once visiting pixel according to target sense of rotation and terminal is one or more independently data cells with image division.
In specific implementation process,, so that a data unit is only arranged, then get final product in the rotation that is rotated when handling only this data cell internal point when size of images is enough little.
When the image of handling has a data unit incessantly, compressed image demoder with routine is an example, the fundamental of its processing is that the unit is 8 * 8 lattice block, such circuit is in decoded picture size 11 * 13 luminance components, the processing unit of dividing just will be 8 * 8,3 * 8,8 * 5,3 * 5.
In step S102, the data cell that marks off and the point of data cell inside are regrouped according to the target sense of rotation.
Dma control logic with 270 degree rotations is that example illustrates the process that the data cell that marks off is regrouped, as shown in Figure 7, (1) elementary cell is 8 * 8 lattice block, data wherein with from left to right, from top to bottom arrangement mode, (2), (3) are (1) right side elementary cell successively.
Note image_width, image_height is the original width of image, buffer_address is the first address of display buffer.
Under rotary mode not:
Be buffer_address by reference on the first time,
Be buffer_address+8 by reference on the second time.
Under 270 degree rotary modes:
Just become buffer_address+ (image_width-8) * image_height on the first time by reference,
For the second time uploading address modification is buffer_address+ (image_width-16) * image_height.
When the more than fundamental unit of image, should make suitable modification according to the later relation of corresponding elementary cell key element rotation by reference on each unit key element.
With the fundamental of handling is that the unit is that the compressed image demoder of the routine of 8 * 8 lattice block is that example illustrates the process that the point of the data cell inside that marks off is regrouped, the rotation of 270 degree still this picture is taken place, each local buffer read-write cell is 2 points, restructuring graph with 3 * 5 processing units that mark off is an example, Fig. 3 arranges for the former pixel of this 3 * 5 processing unit and reads order, make image that 270 degree rotations take place, reaching after the rotation of this 3 * 5 processing unit expectation shown in Figure 4 pixel arranges and reads order, at first image is divided into as shown in Figure 5 and Figure 6 image, target according to 270 rotations, on image carried out after the regrouping by reference, Fig. 5 just becomes Fig. 8, and Fig. 6 just becomes Fig. 9.
In step S103, after the point of the data cell that marks off and data cell inside is regrouped, this image is sent.
As embodiments of the invention, the method that the order of point in image of each data cell that marks off and data cell inside regrouped comprises reads to reorder, write the mode that reorders and read and write the combination of reordering.
Fig. 2 shows the realization flow of terminal image read method provided by the invention, and details are as follows.
In step S201, receive the image after the point of the data cell that marks off and data cell inside regrouped.
In step S202, the data cell after will regrouping according to read operation under the rotary mode not and the point of data cell inside are read successively.
Be example still with the dma control logic of 270 degree rotations, as shown in Figure 7, read-write combination by front-end controlling circuit, the data dot matrix in (1) has satisfied clockwise 270 degrees of data arrangement modes in inside, and for example lastrow data have changed into the first from left column data.Dma control logic at first is converted into the initial transfer address of DMA the address in the lower left corner in the display buffer when reading the data of (1) unit, and thinks that to read (1) operation as broad as long with the read operation under the rotary mode not.
Dma control logic is when reading (2) cell data, can not be as rotary mode is not following, 8 points that just simply move to right on the address get final product, but will cross over the address space of 8 row picture altitudes, the address of last Unit (2) in the display buffer that could mate from the lower left corner.
According to such dma control logic, image will be finished the splicing and the rotation of entire image at last from the lower-left to upper right filling.
Figure 10 shows the structure of front end image orbiting facility provided by the invention, and details are as follows.
The number that image division module 11 is once visited pixel according to target sense of rotation and terminal is one or more independently data cells with image division, data cell compiling module 12 is regrouped the data cell that marks off and the order of point in image of data cell inside according to the target sense of rotation, concrete compilation process is stated at preamble, just repeat no more, the image after image sending module 13 will be worked out is sent to terminal herein.
Figure 11 shows the structure of terminal image fetch equipment provided by the invention, and details are as follows.
Image after the point to the data cell that marks off and data cell inside that image receiver module 21 receiving front-ends send is regrouped, data cell is read module 22 and is read successively according to the data cell after the rotary mode read operation will not regrouped and the point of data cell inside.
The above only is preferred embodiment of the present invention, not in order to restriction the present invention, all any modifications of being done within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.