Summary of the invention
For solving the problems referred to above, a kind of 3D picture display optimization implementation method towards mobile intelligent terminal of the present invention is by with intelligence
Scratch-pad storage (Scratchpads) on the processor of energy mobile terminal is memory space, improves 3D on intelligent mobile terminal
The treatment effeciency of picture.
For achieving the above object, the technical scheme is that
A kind of 3D picture display optimization implementation method towards mobile intelligent terminal, comprises the following steps:
A1: divide the scratch-pad storage space of mobile intelligent terminal processor, is divided into multiple scratch-pad storage page;
State when A2: use code analysis tool shows source code and the program operation of program to 3D picture is analyzed, and obtains
Status information when taking various source code and run;
A3: according to the analysis result of step A2, code and video data to 3D picture display program carry out cutting, obtain
The candidate that can be assigned to scratch-pad storage stores object;
A4: storing object for candidate increases compiling tutorial message, generates new program;
A5: dynamically distribute candidate during operation and store object.
Further, in step A2, described status information includes code and video data in described 3D picture display program
Segment information and use frequency.
Further, step A3 includes:
For code according to using frequency to carry out cutting: have one section of continuous code of identical use frequency being split is a code
Type candidate stores object;
For data according to using frequency to carry out cutting: have one group of identical use frequency continuously displaying data and be split is one
Data type candidate stores object.
Further, step A4 includes: each candidate stores object all increases compiling tutorial message during compiling, and generates new
Program, the compiling tutorial message that described newly-generated program is increased includes: code and the segmental information of video data, each
Candidate stores the numbering of object, and each candidate stores the attribute of object.
Further, step A5 includes:
A51: store object according to type of code candidate and data type candidate stores the quantity of object, calculate scratch-pad storage
Be supplied to both types candidate store object scratch-pad storage page allocation proportion and distribute respective numbers scratch-pad storage
Device page;
When A52: program is run, candidate stores object and loads according to execution sequence in a program, if this time scratch-pad
Memorizer does not has any valid data candidate then stores object to be loaded directly in scratch-pad storage, otherwise perform step
A53;
A53: if scratch-pad storage has be not used by can by type of code candidate store object use scratch-pad store
What device page and/or have was not used by can be stored, by data type candidate, the scratch-pad storage page that object uses, then waited by type of code
Choosing storage object and/or data type candidate store object and are loaded directly in corresponding scratch-pad storage page, otherwise perform step
A54;
A54: to there is no the type of code candidate accordingly not using scratch-pad storage page to load store object and/
Or data type candidate stores object, replacement policy is used to process.
Further, described step A54 includes:
When will be loaded into scratch-pad storage be type of code candidate store object Cx time, then check in scratch-pad storage
All allocated type of code candidates store object, select the type of code candidate using frequency minimum from scratch-pad storage
Storage object Cy, if the use frequency that type of code candidate stores object Cx stores object less than or equal to type of code candidate
The use frequency of Cy, then type of code candidate stores object Cx and is not added with being downloaded in scratch-pad storage;Otherwise use type of code
Candidate stores object Cx and type of code candidate is stored object Cy replaces out scratch-pad storage.
When will be loaded into scratch-pad storage be data type candidate store object Dx time, then check in scratch-pad storage
All allocated data type candidates store object, select the data type candidate using frequency minimum from scratch-pad storage
Storage object Dy, if the use frequency that data type candidate stores object Dx stores object less than or equal to data type candidate
The use frequency of Dy, then data type candidate stores object Dx and is not added with being downloaded in scratch-pad storage;Otherwise use data type
Candidate stores object Dx and data type candidate is stored object Dy replaces out scratch-pad storage.
The present invention uses the scratch-pad storage (Scratchpads) being integrated on mobile intelligent terminal chip, shows 3D picture
It is analyzed, obtains candidate and store object, and operationally candidate is stored object and be assigned to scratch-pad storage, utilize notepaper
Formula memorizer achieves 3D picture display optimization.The present invention compared with prior art, has a following good effect:
(1) high efficiency.Scratch-pad storage is on-chip memory, is the memorizer that in embedded system storage hierarchy, efficiency is the highest.
In the present invention, critical data and code are stored on Scratchpads, these are used the data and the visit of code that frequency is high
Ask and carry out in scratch-pad storage.Therefore, it is possible to realize the effective use to scratch-pad storage, improve 3D figure
The efficiency that sheet shows;
(2) low energy consumption.Scratch-pad storage does not has the hardware logic structure of complexity, critical data and code in technical solution of the present invention
Being stored on scratch-pad storage, the energy consumption of various storage access operations is energy consumption based on scratch-pad storage, so that this
Invention, by the use to scratch-pad storage, effectively reduces 3D picture and shows the energy consumption brought.
Therefore, the present invention is applicable to the 3D picture display optimization of mobile intelligent terminal, takes full advantage of scratch-pad storage and accesses
The feature that speed is fast, energy consumption is low, had both accelerated the processing speed of 3D picture, reduced again produced by 3D picture display program
Power consumption, improves the performance of program.
Detailed description of the invention
In order to make the purpose of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, to this
Bright it is further elaborated.Should be appreciated that specific embodiment described herein, and need not only in order to explain the present invention
In limiting the present invention.
A kind of 3D picture display optimization implementation method towards mobile intelligent terminal, comprises the steps:
Step A1: divide the scratch-pad storage space of mobile intelligent terminal processor, is divided into the storage of multiple scratch-pad
Device page.
For the Scratchpads space that size is M, sized by k, it is divided into m Scratchpads page: wherein m=M/k,
I.e. S0, S1..., Sm-1M Scratchpads page altogether.
For the Scratchpads space of M=24KB, k=4KB, quantity m of divided out Scratchpads page is
M=M/k=24KB/1KB=6, then number consecutively is S0, S1..., S5。
Step A2: state when use code analysis tool shows source code and the program operation of program to 3D picture is analyzed,
Status information when obtaining various source code and run.
Use code analysis tool that 3D picture display program is analyzed: to show program P, code analysis work for 3D picture
The state when source code of P and program can be run by tool is analyzed, status information when obtaining the various source code of P and run,
Such as Parallel Studio is such instrument.
Program P is shown for 3D picture, after using code analysis tool that P is analyzed, there is following analysis result (table
1):
Table 1
Step A3: according to the analysis result of step A2, code and video data to 3D picture display program carry out cutting,
Acquisition can be assigned to the candidate of scratch-pad storage and store object.
3D picture display program includes two parts, respectively code, video data;Code signing is C, video data labelling
For D;According to the analysis result in step A2, code C and video data D is carried out cutting:
For code C, carry out cutting according to using frequency: have one section of continuous code of identical use frequency being split is one
Candidate stores object, and numbers: C0, C1..., Cp-1, p candidate stores object altogether;CjThere is an attribute Freq
(Cj), Freq (Cj) it is CjUse frequency;
For video data D, carry out cutting according to using frequency: have one group of continuous data of identical use frequency be split into
One candidate stores object, and numbers: D0, D1..., Dq-1, q candidate stores object altogether;DjThere is an attribute
Freq(Dj), for DjUse frequency.
Program P is shown for 3D picture, according to table 1, carries out cutting:
For code C, code segment 1, code segment 2, code segment 3, code segment 4 cutting respectively are 1 storage object, and point
It is not numbered.Wherein, the numbered C of code segment 10, the numbered C of code segment 21, the numbered C of code segment 32, code segment 4
Numbered C3.Its Freq (Cj) attribute is respectively as follows:
Freq(C0)=20;
Freq(C1)=10;
Freq(C2)=5;
Freq(C3)=15.
All candidates generated by cutting code C store object and are referred to as type of code candidate and store object.
For data D, data segment 1, data segment 2, data segment 3, data segment 4, data segment 5, data segment 6, data segment 7,
Data segment 8 cutting respectively is 1 storage object, and is numbered respectively.Wherein, the numbered D of data segment 10, data segment 2
Numbered D1, the numbered D of data segment 32, the numbered D of data segment 43, the numbered D of data segment 54, data segment 6 is numbered
D5, the numbered D of data segment 76, the numbered D of data segment 87.Its Freq (Dj) attribute is respectively as follows:
Freq(D0)=3;
Freq(D1)=5;
Freq(D2)=10;
Freq(D3)=12;
Freq(D4)=15;
Freq(D5)=20;
Freq(D6)=8;
Freq(D7)=7.
All candidates generated by cutting data D store object and are referred to as data type candidate and store object.
Step A4: storing object for candidate increases compiling tutorial message, generates new program.
Each candidate stores object all increases compiling tutorial message during compiling, and generates new program;3D picture is shown
Program, the compiling tutorial message that its newly-generated program is increased includes: code C and the segmental information of data D, each candidate
The numbering of storage object, each candidate stores the attribute of object.
Program P, its newly-generated program P are shown for 3D picture ' the compiling tutorial message that increased includes:
To code C, including C0, C1, C2And C3Segmental information, C0, C1, C2And C3Attribute;
To data D, including D0, D1, D2, D3, D4, D5, D6And D7Segmental information, D0, D1, D2, D3,
D4, D5, D6And D7Attribute.
Step A5: dynamically distribute candidate during operation and store object.
Store quantity g of object according to type of code candidate and data type candidate stores quantity h of object, calculate Scratchpads
Both types candidate is stored allocation proportion r of object:
The allocation proportion that described type of code candidate stores object is r (g)=g/ (g+h);
Wherein, type of code candidate stores object and obtains Rg Scratchpads page;Data type candidate stores object and obtains Rh
Individual Scratchpads page, described Rg takes the downward round numbers of m*r (g), described Rh=(m-Rg).
When program is run, candidate stores object and loads according to execution sequence in a program, does not now have in Scratchpads
Any valid data, candidate stores object and can be loaded directly in Scratchpads;Wherein, it is loaded into Scratchpads's
Type of code candidate stores object less than or equal to Rg, is loaded into the data type candidate of Scratchpads and stores object and be less than
In Rh.
When Scratchpads whole occupied time, use replacement policy process:
When will be loaded into Scratchpads be type of code candidate store object Cx time, then check in Scratchpads all
The candidate of allocated type of code stores object, selects to use the candidate that frequency is minimum to store object Cy from Scratchpads,
Relatively Freq (Cx) and Freq (Cy), if Freq (Cx)≤Freq (Cy), then Cx is not added with being downloaded to Scratchpads
In;If Freq (Cx) > Freq (Cy), then use Cx that Cy is replaced out Scratchpads;
When will be loaded into Scratchpads be data type candidate store object Dx time, then check in Scratchpads all
The candidate of allocated data type stores object, selects to use the candidate that frequency is minimum to store object Dy from Scratchpads,
Relatively Freq (Dx) and Freq (Dy), if Freq (Dx)≤Freq (Dy), then Dx is not added with being downloaded to Scratchpads
In;If Freq (Dx) > Freq (Dy), then use Dx that Dy is replaced out Scratchpads.
For 3D picture show program P, its newly-generated program P ' the most dynamically distribution candidate store the situation of object such as
Shown in lower:
Store quantity g=4 of object according to type of code candidate and data type candidate stores quantity h=8 of object, calculate
Scratchpads stores allocation proportion r of object to both types candidate:
R=g/ (g+h)=4/ (4+8)=1/3;
Wherein, type of code candidate store object obtain Rg={m*r (g) round downwards=6*1/3}=2 Scratchpads page:
For S0And S1;Data type candidate stores object and obtains Rh={m-Rg}={6-2}=4 Scratchpads page, for S2、S3、
S4And S5。
When program is run, candidate stores object and loads according to execution sequence in a program, does not now have in Scratchpads
Any valid data, candidate stores object and can be loaded directly in Scratchpads.
Wherein, being loaded into the type of code candidate of Scratchpads and storing object is 2, respectively: C0At S0, C1At S1。
Being loaded into the data type candidate of Scratchpads and storing object is 4, respectively: D0At S2, D1At S3, D2?
S4, D3At S5。
If the life cycle of certain Cx terminates, the Scratchpads page marker at Cx place is for being not used by;If certain Dx
Life cycle terminate, the Scratchpads page marker at Dx place is for being not used by.
If Scratchpads having can be stored object use by type of code candidate Scratchpads page be not used by, then
The next type of code candidate will being loaded in Scratchpads stores object and is loaded directly into this Scratchpads page.
If Scratchpads having can be stored object use by data type candidate Scratchpads page be not used by, then
The next data type candidate will being loaded in Scratchpads stores object and is loaded directly into this Scratchpads page.
If Scratchpads whole occupied time, use replacement policy process:
Will be loaded into Scratchpads is that type of code candidate stores object C2, check and all in Scratchpads distribute
The candidate of type of code store object;Now the type of code candidate in Scratchpads stores object is C0And C1, its
In:
Freq(C0)=20;
Freq(C1)=10.
Due to Freq (C1) minimum, by Freq (C1) and Freq (C2) compare, find Freq (C1)>Freq(C2),
Do not replace.
Next will be loaded into Scratchpads is that type of code candidate stores object C3, check in Scratchpads all
The candidate of allocated type of code stores object;Now the type of code candidate in Scratchpads stores object is C0,
C1, wherein:
Freq(C0)=20;
Freq(C1)=10.
Due to Freq (C1) minimum, by Freq (C1) and Freq (C3) compare, find Freq (C1)<Freq(C3),
Use C3By C1Replace out from Scratchpads;The most now C0And C3Stay in Scratchpads, wherein C3At S1In.
Will be loaded into Scratchpads is that data type candidate stores object D4, check and all in Scratchpads distribute
The candidate of data type store object;Now the data type candidate in Scratchpads stores object is D0、D1、D2
And D3, wherein:
Freq(D0)=3;
Freq(D1)=5;
Freq(D2)=10;
Freq(D3)=12.
Due to Freq (D0) minimum, by Freq (D0) and Freq (D4) compare, find Freq (D4)>Freq(D0),
Use D4By D0Replace out from Scratchpads;The most now D4, D1, D2, D3Stay in Scratchpads, wherein
D4At S2In.
Next will be loaded into Scratchpads is that data type candidate stores object D5, check in Scratchpads all
The candidate of allocated data type stores object;Now the data type candidate in Scratchpads stores object is D4,
D1, D2And D3, wherein:
Freq(D1)=5;
Freq(D2)=10;
Freq(D3)=12;
Freq(D4)=15.
Due to Freq (D1) minimum, by Freq (D1) and Freq (D5) compare, find Freq (D1)<Freq(D5),
Use D5By D1Replace out from Scratchpads;The most now D4, D5, D2, D3Stay in Scratchpads, wherein
D5At S3In.
Next will be loaded into Scratchpads is that data type candidate stores object D6, check in Scratchpads all
The candidate of allocated data type stores object;Now the data type candidate in Scratchpads stores object is D4,
D5, D2And D3, wherein:
Freq(D5)=20;
Freq(D2)=10;
Freq(D3)=12;
Freq(D4)=15.
Due to Freq (D2) minimum, by Freq (D2) and Freq (D6) compare, find Freq (D6)<Freq(D2),
Do not replace;The most now D4, D5, D2, D3Stay in Scratchpads.
Hereafter due to D2Use complete, then D2Scratchpads page of place is marked as the Scratchpads being not used by
Page;Next will be loaded into Scratchpads is that data type candidate stores object D7, due to be not used by
Scratchpads page, D7It is assigned directly in Scratchpads;Now the data type candidate in Scratchpads store right
As for D4, D5, D7And D3。
This detailed description of the invention uses and is integrated in the Scratchpads on mobile intelligent terminal chip, shows 3D picture and carries out point
Analysis, obtains candidate and stores object, and operationally candidate is stored object and be assigned to Scratchpads, utilizes Scratchpads real
Show 3D picture display optimization.