The content of the invention
In view of this, it is an object of the invention to image rotation implementation method and device.In order to the embodiment for disclosing
Some aspects have a basic understanding, shown below is simple summary.The summarized section is not extensive overview, nor
Determine key/critical component or describe the protection domain of these embodiments.Its sole purpose is to be in simple form
Existing some concepts, in this, as the preamble of following detailed description.
The embodiment of the present invention provides a kind of image rotation implementation method, including:
Source storage format and source data form according to image to be rotated, the anglec of rotation of image, determine view data
Reading order;
Each rotary unit in view data is read according to the reading order for determining, circulator is sent to;
Circulator carries out pixel rotation, restructuring pixel rotation to the pixel in the rotary unit that will read according to the anglec of rotation
Rotary unit after turning, obtains the image of the corresponding anglec of rotation.
In some optional embodiments, when the anglec of rotation is 180 degree:
The reading order for determining view data, specifically includes:The sequence of addresses of rotary unit during by memory access
Inverted;Accordingly,
It is described that pixel rotation is carried out to pixel in the rotary unit that will read according to the anglec of rotation, after restructuring pixel rotation
Rotary unit, obtain the image of the corresponding anglec of rotation, specifically include:
Pixel order in each rotary unit is inverted;
Rotary unit after pixel inversion is reorganized by the sequence of addresses after reversion, the image after being processed
Data.
In some optional embodiments, the pixel order in each rotary unit is inverted, specifically included:
The one-row pixels that will be included in each rotary unit carry out order reversion;When carrying out order reversion, by described a line
Pixel is divided into the pixel groups of specified quantity, and the order to pixel groups is inverted, and order is carried out to the pixel in pixel groups
Reversion.
In some optional embodiments, when the anglec of rotation is 90 or 270 degree:
The reading order for determining view data, specifically includes:The sequence of addresses of rotary unit during by memory access
Enter line translation by the anglec of rotation;Accordingly,
It is described that pixel rotation is carried out to pixel in the rotary unit that will read according to the anglec of rotation, after restructuring pixel rotation
Rotary unit, obtain the image of the corresponding anglec of rotation, specifically include:
Pixel procession in each rotary unit is exchanged;
Rotary unit after ranks are exchanged, is entered according to the sequence of addresses after conversion in units of the rotary unit group selected
Row is reorganized, the view data after being processed.
In some optional embodiments, the pixel procession in each rotary unit is exchanged, specifically included:
The picture element matrix in rotary unit is filled according to the order that a row connect a row by circulator, is connect according still further to a line
The order of a line reads, and realizes exchanging the pixel procession in each rotary unit.
The embodiment of the present invention also provides a kind of image rotation and realizes device, including:
Determining module, for according to the source storage format and source data form, the anglec of rotation of image of image to be rotated, really
Determine the reading order of view data;
Memory access module, for reading each rotary unit in view data according to the reading order for determining, sends to
Circulator;
Circulator, for carrying out pixel rotation to the pixel in the rotary unit that will read according to the anglec of rotation;
Recombination module, for recombinating the postrotational rotary unit of pixel, obtains the image of the corresponding anglec of rotation.
In some optional embodiments, the determining module, specifically for when the anglec of rotation is 180 degree, by internal memory
The sequence of addresses of rotary unit during access is inverted;Accordingly,
The circulator, specifically for the pixel order in each rotary unit is inverted;
The recomposition unit, specifically for the rotary unit after pixel inversion is carried out again by the sequence of addresses after reversion
Tissue, the view data after being processed.
In some optional embodiments, the circulator, specifically for a line picture that will be included in each rotary unit
Element carries out order reversion;When carrying out order reversion, the one-row pixels are divided into the pixel groups of specified quantity, to the suitable of pixel groups
Sequence is inverted, and carries out order reversion to the pixel in pixel groups.
In some optional embodiments, the determining module, specifically for when the anglec of rotation is 90 or 270 degree, inciting somebody to action
The sequence of addresses of rotary unit during memory access enters line translation by the anglec of rotation;Accordingly,
The circulator, specifically for the pixel procession in each rotary unit is exchanged;
The recomposition unit, specifically for ranks are exchanged after rotary unit, according to the sequence of addresses after conversion selecting
Fixed rotary unit group is reorganized for unit, the view data after being processed.
In some optional embodiments, the circulator, specifically for by the picture element matrix in rotary unit according to one
Row connect the order filling of a row, are read according still further to order line by line, and realization carries out the pixel in each rotary unit
Ranks are exchanged.
Image rotation implementation method provided in an embodiment of the present invention and device, source storage format according to image to be rotated and
The anglec of rotation of source data form, image, determines the reading order of view data, suitable to change reading by way of hardware
The form of sequence realizes image rotation and data recombination, the postrotational view data of angle is obtained, using the side of hardware memory accesses
Formula is realized, the characteristics of for view data, is fully multiplexed memory source, reduces the requirement to hardware performance, reduces hardware cost
Input, meanwhile, improve processing speed and efficiency, the even image of big data quantity, it is also possible to treatment it is very timely.
For above-mentioned and related purpose, one or more embodiments include will be explained in below and in claim
In the feature that particularly points out.Following explanation and accompanying drawing describes some illustrative aspects in detail, and its indicate be only
Some modes in the utilizable various modes of principle of each embodiment.Other benefits and novel features will be under
The detailed description in face is considered in conjunction with the accompanying and becomes obvious, the disclosed embodiments be will include all these aspects and they
Be equal to.
Embodiment three
What the embodiment of the present invention three provided a kind of image rotation implementation method implements flow, its flow as shown in fig. 6,
The method comprises the following steps:
Step S301:Source storage format and source data form, 90 degree of the anglec of rotation of image according to image to be rotated or
270 degree, the sequence of addresses of rotary unit during by memory access enters line translation by the anglec of rotation.
The step is by DMA treatment.Wherein, 90 degree and 270 degree of difference of changing direction.It is real when 90 degree and 270 degree of degree rotate
As long as the order of each pixel is carried out the conversion of respective angles according to original storage format and data form on border, by
It is generally not once only to read a pixel to be read in internal memory, it is therefore desirable to sequence of addresses is carried out in units of rotary unit
Conversion process.
Step S302:Rotary unit after sequence of addresses is converted, sends circulator to.
Step S303:Pixel procession in each rotary unit is exchanged.
It is in fact a pixel array in one rotary unit, therefore not only the order of rotary unit will carry out respective corners
The conversion of degree, each pixel in pixel array in rotary unit will also carry out the conversion of respective angles.
Step S304:Rotary unit after ranks are exchanged, the rotary unit according to the sequence of addresses after conversion to select
Group is reorganized for unit, the view data after being processed.
The picture element matrix in rotary unit is filled according to the order that a row connect a row by circulator, is connect according still further to a line
The order of a line reads, and realizes exchanging the pixel procession in each rotary unit.
After pixel after rotary unit sequence of addresses is angularly converted and in rotary unit is also angularly converted, carry out again
Tissue, you can the view data after being inverted, the view data after reversion then correspond to be rotated by 90 ° or 270 degree after figure
Picture.
That is, for realize 90 °, 270 ° of rotation are, it is necessary to following 3 key steps:
1>Compared with 0 °, line translation will be entered according to the angle of rotation to ddr access sequence of addresses;
2>Ranks in cell block (block) are interchangeable;Cell block i.e. above-mentioned rotary unit.
3>Data in each block are reorganized according to the order of actual displayed.
The above 1>Realized by DMA, 2>Realized by Rotator, 3>Realized by RAM Controller.
The function that DMA is realized is described as follows:
The original image before rotation is illustrated in figure 7, each fine line grid represents a block, and it is Rotator
The minimum matrix unit that can be processed.
It is as shown in Figure 8 by the image after 90 ° of rotation.But, the read-write in RAM Controller for convenience
The generation of address, 1>In address mapping should with " cluster " (part that each solid wire frame is surrounded in Fig. 7) for unit again
Tissue (is described in detail) when RAM Controller are introduced.1>After treatment, the order of data is changed into:
56,24,48,16,40,8,32,0,
57,25,49,17,41,9,33,1,
58,26,50,18,42,10,34,2,
59,27,51,19,43,11,35,3,
60,28,52,20,44,12,36,4,
61,29,53,21,45,13,37,5,
62,30,54,22,46,14,38,6,
63,31,55,23,47,15,39,7.
By the image after 270 ° of rotation as shown in figure 9, the order of data is changed into:
7,39,15,47,23,55,31,63,
6,38,14,46,21,54,30,62,
5,37,13,45,20,53,29,61,
4,36,12,44,19,52,28,60,
3,35,11,43,18,51,27,59,
2,34,10,42,17,50,26,58,
1,33,9,41,16,49,25,57,
0,32,8,40,15,48,24,56.
The function that Rotator is realized is described as follows:
Row in one rotary unit (or saying block) are sequentially converted into row order by Rotator using a matrix.
Exactly the picture element matrix in rotary unit is filled according to the order that a row connect a row, is read according to order line by line.
If Figure 10, Figure 11, Figure 12 are the schematic diagram of circulator read-write order.Each unit represents a pixel, can be 32bpp,
16bpp, 8bpp etc..
It is 256bit with DMA output bit wides, as a example by Rotator outputs are 128bit, the rotation list of minimum recycling
First (block), referring to Figure 10, Figure 11, Figure 12, it indicates 90 °, the 270 ° block of rotation.Wherein, w0~wn is represented
The order for connecing a row according to a row is filled, and r0~rn is represented and read according to order line by line.
Figure 10, Figure 11 and Figure 12 are illustrated with 4 bits/pixels (byte/pixel), 2 bits/pixel (byte/ respectively
Pixel), 1 bits/pixel (byte/pixel) connects one for minimum pixel unit carries out a row.The order filling of row and a line connect
The situation that the order of a line reads.
Wherein, the order filling that a row connect a row is carried out from w0~w3 in Figure 10, often row includes 8 row, then from r0~r7
The order for carrying out line by line reads.The order filling that a row connect a row is carried out from w0~w7 in Figure 11, often row includes 16 row,
Then the order for being carried out line by line from r0~r15 reads.From w0~w15 a row being carried out in Figure 12 and connecing the order of a row filling out
Fill, often row includes 32 row, the order for then being carried out line by line from r0~r31 reads.
The function that RAM Controller are realized is described as follows:
Rotator output data be with block as order, but RAM Controller output data be according to light
Grid scanning screen-refresh namely from top to bottom from left to right is sequentially.Therefore, the effect of RAM controller be exactly by
Block's is sequentially converted into raster scan order.Different with type according to raw image data form, a block typically can
Across 4~32 row pixels.And a full line of whole two field picture can cross over multiple block.On the piece that RAM Controller are controlled
RAM, is filled with the order that a block meets a block, is fetched with screen-refresh order line by line.
Therefore, most intuitively idea is exactly to use a Pingpang Memory device, while being written and read.
Meanwhile, in order to reduce RAM sizes, and to solve the problems, such as that read/write address order is inconsistent, introduce with a kind of skilful
Wonderful read/write address control method.As the internal memory that Figure 13 to Figure 17 illustrates read-write order uses cyclic process.In order to
Simplify the computational methods of read/write address, reusable region should be the smaller the better in RAM.This is reused region and includes
Several block, this some block can be called " cluster " (cluster).Can reduce big to internal memory by the multiplexing of internal memory
Small requirement, cleverly internal memory multiplexing also improves the utilization rate of internal memory.
The reading process of pixel is described as follows in cluster:
With 32bpp, linear mode data instances, one includes 4x8 pixels, one by the block after matrix conversion
Cluster includes 8 block.
The detailed process of RAM accesses is as follows:
1>The arrangement mode of the block included in a cluster is illustrated such as Figure 13.Each in one cluster
Block is arranged in the manner depicted in fig. 13;As be from left to right respectively in Figure 13 block0, block1, block2,
Block3, block4, block5, block6, block7 totally 8 block, include 4x8pixel by taking block0 as an example, other
Block is similar to.
2>It is as shown in figure 14 fill order signal in a cluster.Each cluster includes 8 block, such as schemes
Block0, block1, block2, block3, block4, block5, block6, block7 totally 8 is from left to right respectively in 14
Individual block.RAM is with W0.0, W0.1 ... ..., W0.7;W1.0, W1.1 ... ..., W1.7;……;W7.0, W7.1 ... ... .W7.7
Order be filled, i.e., one arrange be filled.Each block needs to write action 8 times, so a cluster is total to
Need 64 and write action, referring specifically to as shown in figure 14.
3>It is as shown in figure 15 reading order signal in a cluster.When all of block is in a cluster
After filling is finished, can start with R0.0, R0.1 ... ..., R0.7;R1.0, R1.1 ... ..., R1.7;……;R7.0,
The order of R7.1 ... ..., R7.7 is read out.As shown in figure 15, read with this order, then pixel is exactly according to light
The Sequential output of grid scanning.
4>It is as shown in figure 16 the arrangement mode of block in second cluster after reading first cluster.Reading
During taking, the region for being changed into idle because of reading can be used to carry out the filling of the second wheel, i.e., second cluster's fills out
Fill.Each block in second cluster is arranged in the way of shown in Figure 16, is respectively from top to bottom in such as Figure 16
Block0, block1, block2, block3, block4, block5, block6, block7 totally 8 block.
5>It is as shown in figure 17 fill order signal in second cluster.The fill order of the second wheel is W0.0,
W0.1 ... ..., W0.7;W1.0, W1.1 ... ..., W1.7;……;W7.0, W7.1 ... ... .W7.7, this reading with the first round
Order is the same.It is as shown in figure 17, therefore, read from the first round finish to the second wheel filling finish need not be very long wait when
Between.
6>It is as shown in figure 18 reading order signal in second cluster.When RAM passes through the second filling taken turns again
After being fully written, the reading of the second wheel starts.As shown in figure 18, reading order is R0.0, R0.1 ... ..., R0.7;R1.0,
R1.1 ... ..., R1.7;……;R7.0, R7.1 ... ..., R7.7.
7>It is as shown in figure 19 the arrangement mode of block in the 3rd cluster after reading second cluster.As schemed
Shown in 19, in reading process, the region being available can be used to fill the cluster pixels of a new round.So clsuter
Middle piece of arrangement mode has just been returned to the arrangement mode of the first round (as shown in figure 13), into next recycling of internal memory
Process.
Above procedure is circulated always, until all of cluster is converted.
Read/write address intuitively can be calculated and showed very with three counters (counter).Count each
The counter of the line number that block is crossed over is referred to as location counter (unit counter);Count what each cluster was included
The counter of block numbers is referred to as block counter (block counter);Count each lane (circulation on chip
Groove) counter referred to as cluster counters (cluster counter) of cluster numbers that includes.The counting of each counter
Scope is as follows, after these counter count down to the respective upper limit, resets to 0:
Unit_counter={ 0, line_per_block };
Block_counter={ 0, block_per_cluster };
Cluster_counter={ 0, cluster_per_lane }.
It is above-mentioned to represent respectively:
Element count={ 0, every piece of line number };
Block count={ 0, the block number per cluster };
Cluster is counted={ 0, every number of clusters of circulation groove }.
Image if necessary to rotation is smaller, whole image only comprising if a block, block_counter and
Cluster_counter is 0.Only need to rotate the pixel in block in the case of this special case, can save anti-
The step of turning or convert the sequence of addresses of block.
In upper graph 13 to Figure 19 figures, the write address w0 of the first round, the reading address r0 of the first round, the write address of the second wheel
W1, the reading address r1 formula of the second wheel are as follows, characterized by three countings of counter:
W0={ unit_counter, cluster_counter, block_counter };
R0={ block_counter, cluster_counter, unit_counter };
W1={ block_counter, cluster_counter, unit_counter };
R1={ unit_counter, cluster_counter, block_counter }.
It is above-mentioned to represent respectively:
The write address w0={ element count, cluster is counted, block count } of the first round;
The reading address r0={ block count, cluster is counted, element count } of the first round;
The write address w1={ block count, cluster is counted, element count } of the second wheel;
The reading address r1={ element count, cluster is counted, block count } of the second wheel.
By the multiplexing of chip memory access, chip utilization rate is improve, using the idle component after having read, entered in time
Row next round is filled, and improves the processing speed that filling is read, and reduces processing latency.
Based on same inventive concept, the embodiment of the present invention also provides a kind of image rotation and realizes device, its structure such as Figure 20
It is shown, including:Determining module 201, memory access module 202, circulator 203 and recombination module 204.
Determining module 201, for source storage format and source data form, the anglec of rotation of image according to image to be rotated
Degree, determines the reading order of view data;
Memory access module 202, for reading each rotary unit in view data, transmission according to the reading order for determining
To circulator;
Circulator 203, for carrying out pixel rotation to the pixel in the rotary unit that will read according to the anglec of rotation;
Recombination module 204, for recombinating the postrotational rotary unit of pixel, obtains the image of the corresponding anglec of rotation.
Preferably, above-mentioned determining module 201, specifically for when the anglec of rotation be 180 degree when, rotation during by memory access
The sequence of addresses of unit is inverted;Accordingly,
Preferably, above-mentioned circulator 203, specifically for the pixel order in each rotary unit is inverted;
Preferably, above-mentioned recomposition unit 204, specifically for the rotary unit after pixel inversion is suitable by the address after reversion
Sequence is reorganized, the view data after being processed.
Preferably, above-mentioned circulator 203, it is anti-that the one-row pixels specifically for will be included in each rotary unit carry out order
Turn;When carrying out order reversion, the one-row pixels are divided into the pixel groups of specified quantity, the order to pixel groups is inverted,
And order reversion is carried out to the pixel in pixel groups.
Preferably, above-mentioned determining module 201, specifically for when the anglec of rotation is 90 or 270 degree, during by memory access
The sequence of addresses of rotary unit enters line translation by the anglec of rotation;Accordingly,
Preferably, above-mentioned circulator 203, specifically for the pixel procession in each rotary unit is exchanged;
Preferably, above-mentioned recomposition unit 204, specifically for ranks are exchanged after rotary unit, according to the ground after conversion
Location order is reorganized in units of the rotary unit group selected, the view data after being processed.
Preferably, above-mentioned circulator 203, specifically for the picture element matrix in rotary unit is connect into the suitable of a row according to a row
Sequence is filled, and is read according still further to order line by line, realizes exchanging the pixel procession in each rotary unit.
The above method and device of the embodiment of the present invention, rotation processing is done using the repeatable matrix for utilizing.Used in RAM
On by reading and writing the ingehious design of pointer, reduce size, reduce chip area.The method that the present invention is used be with hardware come
Realize, improve the response speed of rotation.Have wide range of applications, be applicable to mobile phone, panel computer etc. and move display chip.
Unless otherwise specific statement, term such as process, calculate, computing, determination, display etc. can refer to it is one or more
Individual treatment or action and/or the process of computing system or similar devices, the action and/or process will be indicated as processing system
The data manipulation of physics (such as electronics) amount in the register or memory of system and it is converted into and is similarly represented as processing system
Memory, register or other this type of informations storage, transmitting or display device in physical quantity other data.Information
Can be represented using any one of various different technologies and method with signal.For example, in above description
Data, instruction, order, information, signal, bit, symbol and the chip for referring to can use voltage, electric current, electromagnetic wave, magnetic field or grain
Son, light field or particle or its any combination are represented.
It should be understood that the particular order or level the step of during disclosed are the examples of illustrative methods.Based on setting
Meter preference, it should be appreciated that during the step of particular order or level can be in the feelings of the protection domain for not departing from the disclosure
Rearranged under condition.Appended claim to a method gives the key element of various steps with exemplary order, and not
It is to be limited to described particular order or level.
In above-mentioned detailed description, various features are combined in single embodiment together, to simplify the disclosure.No
This open method should be construed to reflect such intention, i.e. the embodiment of theme required for protection needs clear
The more features of feature stated in each claim to Chu.Conversely, that reflected such as appending claims
Sample, the present invention is in the state fewer than whole features of disclosed single embodiment.Therefore, appending claims is special
This is expressly incorporated into detailed description, and wherein each claim is alone as the single preferred embodiment of the present invention.
It should also be appreciated by one skilled in the art that the various illustrative box, the mould that are described with reference to the embodiments herein
Block, circuit and algorithm steps can be implemented as electronic hardware, computer software or its combination.In order to clearly demonstrate hardware and
Interchangeability between software, is carried out to various illustrative parts, frame, module, circuit and step around its function above
It is generally described.Hardware is implemented as this function and is also implemented as software, depending on specific application and to whole
The design constraint that system is applied.Those skilled in the art can be directed to each application-specific, be realized in the way of accommodation
Described function, but, it is this to realize that decision-making should not be construed as the protection domain away from the disclosure.
The step of method or algorithm with reference to described by the embodiments herein, can be embodied directly in hardware, be held by processor
Capable software module or its combination.Software module may be located at RAM memory, flash memory, ROM memory, eprom memory,
The storage of eeprom memory, register, hard disk, mobile disk, CD-ROM or any other form well known in the art is situated between
In matter.A kind of exemplary storage medium is connected to processor, so as to enable a processor to from the read information, and
Information can be write to the storage medium.Certainly, storage medium can also be the part of processor.Processor and storage medium
In may be located at ASIC.The ASIC may be located in user terminal.Certainly, processor and storage medium can also be used as discrete sets
Part is present in user terminal.
Realized for software, technology described in this application can be with the module of the herein described function of execution (for example, mistake
Journey, function etc.) realize.These software codes can be stored in memory cell and by computing device.Memory cell can
To realize in processor, it is also possible to realize outside processor, in the case of the latter, it via various means by correspondence
Processor is coupled to, these are all well known in the art.
Described above includes the citing of one or more embodiments.Certainly, in order to above-described embodiment is described and description portion
The all possible combination of part or method is impossible, but it will be appreciated by one of ordinary skill in the art that each is implemented
Example can do further combinations and permutations.Therefore, embodiment described herein is intended to fall into appended claims
Protection domain in all such changes, modifications and variations.Additionally, with regard to the term used in specification or claims
"comprising", the word cover mode similar to term " including ", solved as link word in the claims just as " including, "
As releasing.Additionally, the use of any one term "or" in the specification of claims being to represent " non-exclusionism
Or ".