Summary of the invention
Technical matters to be solved by this invention provides the method and the device of loading multimedia information in the UI interface, to solve present loading method afoul problem on memory consumption and interface presentation speed.
For solving the problems of the technologies described above,, the invention discloses following technical scheme according to specific embodiment provided by the invention:
The method of loading multimedia information in the UI interface comprises:
Start-up system copies the multimedia messages that compresses in the memory device to internal memory;
When needs UI is current, read and decompress from internal memory, be presented to the UI interface then, present the back and discharge the data that decompress;
From internal memory, delete described packed data when logging off.
Preferably, system does not withdraw from if the UI interface is closed, and then still keeps the multimedia messages of compression in the internal memory.
Preferably, if a plurality of UI interface is arranged, then each interface is in handoff procedure, and internal memory still keeps the compressing multimedia information at corresponding each UI interface.
Preferably, if described UI interface can hide, then when the interface hides, still keep the multimedia messages of compression in the internal memory.
Wherein, described multimedia messages comprises text, picture, audio frequency, video information.
Wherein, described memory device comprises CD, hard disk, flash memory.
The present invention also provides the method for optimizing of loading multimedia information in a kind of UI interface, comprising:
Start-up system when needing for the first time UI to be current, copies the multimedia messages that compresses in the memory device to internal memory;
Whenever needs UI is current, read and decompress from internal memory, be presented to the UI interface then, present the back and discharge the data that decompress;
From internal memory, delete described packed data when logging off.
The device of loading multimedia information in the UI interface comprises:
Control module is used for copying the multimedia messages that memory device compresses to internal memory; After UI presents, the data that decompress are discharged; When system withdraws from, the described packed data of deletion from internal memory;
Loading unit is used for reading described packed data from internal memory, and decompressing when needing UI to be current;
The UI display unit is used for decompressed data is presented to the UI interface.
Wherein, described control module copies the multimedia messages that compresses in the memory device to internal memory when system start-up.
Preferably, described control module copies the multimedia messages that compresses in the memory device to internal memory needing for the first time UI to be current.
According to specific embodiment provided by the invention, the invention discloses following technique effect:
The embodiment of the invention provides the method for loading multimedia information in a kind of UI interface, when system start-up, copy the multimedia messages that compresses in the memory device to internal memory, when needs UI is current, read and decompress from internal memory, be presented to the UI interface then, present the back and discharge the data that decompress, but keep described packed data in the internal memory always, withdraw from up to total system.Preferably, can also copy the multimedia messages that compresses in the memory device to internal memory, thereby avoid not having UI to present and the committed memory space for a long time after the system start-up needing for the first time UI to be current.
Loading method of the present invention can reach a good balance on UI presentation speed and memory consumption, neither can influence presentation speed, can reduce memory consumption as much as possible again.Compare with first kind of mode in the prior art, the present invention is not have decoding compressed data owing to what store in internal memory, and the memory headroom that takies is less, so can not consume very big internal memory; Compare with the second way in the prior art, the present invention reads packed data from internal memory because each UI is now, is presented to the UI interface after the decompression again, than from memory device reading speed piece, so the presentation speed at UI interface can be very fast.The method of the invention combines the advantage of mode one and mode two, has suppressed the shortcoming of mode one and mode two simultaneously again, has solved afoul problem on memory consumption and the interface presentation speed.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
For having presentation speed and the afoul problem of memory consumption in the process that solves UI interface loading multimedia information, the embodiment of the invention provides a kind of new loading method, earlier copy the multimedia messages that compresses in the memory device to internal memory, when needs UI is current, read and decompress from internal memory, be presented to the UI interface then, present the back and discharge the data that decompress, but keep described packed data in the internal memory always, withdraw from up to total system.
With reference to Fig. 1, be the method flow diagram of loading multimedia information in the embodiment of the invention one described UI interface.This method can be applicable to have in the equipment of user interface, as DVD player, media player etc., will be that example describes with the UI interface loading procedure of DVD player below.
Step 101, user's start-up system.Promptly open the switch of DVD player, equipment begins to start.
Step 102, system carries out the associative operation in the start-up course, for example system initialization, load store equipment etc.Described memory device is used to deposit the multimedia file of UI interface display needs, and memory device can be CD, hard disk, various flash memory all kinds of non-volatile memory devices such as (as USB flash disks).
Step 103 copies the multimedia file that compresses in the memory device in the memory file system to.Described multimedia file comprises files such as text, picture, audio frequency, video, is generally the saving storage space, and these files are that the form with compressed file leaves in the memory device.
Step 104 need to judge whether UI to present, and if desired, then continues step 105; Otherwise, forward step 108 to.DVD player is a kind ofly need carry out mutual system with the user, when system need be to user's presentation information, perhaps during system responses user's operational motion, all needs UI to present.
Step 105, UI presents if desired, and then system can load the multimedia file of compression from memory file system, and loading procedure is: read packed data from memory file system, and decode.
Step 106, UI presents, and just can directly show in the UI interface through the data that decompress.
Step 107 after UI presents, discharges the memory headroom that decompressed data takies.In the process that loading data and UI present, the data after the decompression need take certain memory headroom, and for example the picture occupation space is directly proportional with the size and the quantity of picture.After UI presents, just need discharge this part space, because the space of the data occupancy behind the decompress(ion) is bigger.
Step 108 continue to be carried out other associative operations, for example in the operation of DVD player, reads the film data in the DVD CD and plays.
Step 109 judges whether system withdraws from, if withdraw from, then continues step 110, the packed data in the deletion memory file system; Otherwise, return step 104, when being current the continuation, needs UI reads packed data from internal memory.
System withdraws from the operation that total system programs such as being meant shutdown withdraws from fully, and withdrawing from operation expression system no longer needs UI to present, and therefore at this moment the packed data that keeps in the memory file system thoroughly can be deleted.If there is not executive system to withdraw from operation, then being illustrated in also to need UI to present in system's operational process, so UI presents required packed data and also be retained in the memory file system, can read from internal memory fast when needing once more like this.
Step 110 if system withdraws from, is then deleted the packed data in the memory file system.
Step 111 is carried out other and is withdrawed from operation, and operations such as CD are set, eject as the preservation user who carries out before the system closing.
Need to prove that under normal conditions, closing of UI interface represents that promptly total system withdraws from, for example closes player interface, promptly closed whole player system, can delete the packed data that keeps this moment from internal memory.But in some cases, closing of UI interface is not equal to withdrawing from of total system, for example temporarily do not need UI to present and system still in the operation processing procedure time the user, and UI presents required packed data and still is retained in the internal memory.If system design a plurality of UI interfaces, the UI interface difference that under different operating, shows, be that each interface can be changed under user's operation, in this case, system switches to the process at another interface from an interface, previous interface is closed then that an interface is opened, and still can keep previous interface in the internal memory and present required packed data this moment, promptly can keep the packed data at corresponding each UI interface in the internal memory always.
And according to the UI Interface Design, some UI interface is suppressible (being similar to the use interface of QQ), when the UI interface was hidden, expression UI presented end, does not have UI to present in the display window, this moment, total system still was in operation, so packed data still is retained in internal memory.
In sum, above-mentioned loading method can reach a good balance on UI presentation speed and memory consumption, neither can influence presentation speed, can reduce memory consumption as much as possible again.Compare with first kind of mode in the prior art, the present invention is not have decoding compressed data owing to what store in internal memory, and the memory headroom that takies is less, so can not consume very big internal memory; Compare with the second way in the prior art, the present invention reads packed data from internal memory because each UI is now, is presented to the UI interface after the decompression again, than from memory device reading speed piece, so the presentation speed at UI interface can be very fast.The method of the invention combines the advantage of mode one and mode two in the prior art, has suppressed the shortcoming of mode one and mode two simultaneously again, has solved afoul problem on memory consumption and the interface presentation speed well.
In the practical application, in having user interface, needing system or equipment that UI presents, can use above-mentioned loading method and guarantee to reduce when UI presents fast memory consumption.But this method is more suitable for being applied in the limited system or equipment of memory source, equipment such as DVD player, media player for example, because this method can guarantee that UI presents under the situation of effect, save limited memory source as much as possible, improve memory usage, this point is very important to the performance impact of the system or equipment of internal memory resource-constrained.
The present invention also provides another kind of preferred embodiment, with reference to Fig. 2, is the method flow diagram of loading multimedia information in the embodiment of the invention two described UI interfaces.Described embodiment two improves on the basis of embodiment one, and method is as follows:
Step 201, start-up system, loading non-volatile memory device;
Step 202 when needing for the first time UI to be current, copies the multimedia file that compresses in the memory device in the memory file system to;
Step 203, system loads packed data from memory file system, promptly reads packed data from internal memory, and carries out decompression;
Step 204 is presented to the UI interface with the data behind the decompress(ion);
Step 205, the data that decompress in the releasing memory space, packed data still is retained in the memory file system;
Step 206 is when needing UI to be current, repeated execution of steps 203~205 once more;
Step 207, when logging off, the packed data that keeps in the deletion memory file system.
In the flow process shown in Figure 2, owing to be to need UI to be current for the first time, just copy the multimedia messages that compresses in the memory device to internal memory, therefore avoided not having for a long time after the system start-up UI to present and the problem in committed memory space, can reduce memory consumption to greatest extent, save memory source.
Illustrate, suppose on UI, to show that a pixel value is the arrow of 100x100 (that is: wide and height respectively is 100 pixels), the process that realizes is such: file that is decorated with arrow of storage in the non-volatile memory device of system, file is called arrow.jpg, certainly, this is a file that compressed through the jpeg compression algorithm.Originally the picture of a 100x100 of expression needs the space (suppose each pixel represent its RGB information respectively with 3 bytes) of 100x100x3 byte, after the jpeg compression algorithm, perhaps only the space of needs original 1/10th can be stored, and is 10x100x3 byte.After the system start-up, arrow.jpg is copied in the internal memory, this moment, this document still only took 10x100x3 byte.When needs show this arrow plot as the time, with jpeg decompression algorithm or demoder with this algorithm function it is decompressed, be about to it and separate the one piece of data that is pressed into 100x100x3 byte, this segment data has been represented the colouring information of each point of this image, can directly present on UI, this process need takies 100x100x3 byte again.After on UI, showing, can discharge the described 100x100x3 that newly a takies byte.So in the most time of system operation, UI presents the memory headroom that required data only take 10x100x3 byte, simultaneously, when needs it the time, directly read and separate pressure ratio and read faster from non-volatile memory device from Installed System Memory.
Below can be with method one of the prior art and method two and comparison of do of the present invention:
If the degree of depth of each pixel is 32, each program approximately needs the png icon file of 15 every 2k, and the ratio of compression of each icon file is the 10:1 (scope of compression factor: 4:1~30:1).When presenting different UI, all need to use 5 png icon files, the time that loads a png icon file from disk is 100ms, the time that loads a png icon file from internal memory is 5ms (actual disk I and internal memory read and differ 2~4 orders of magnitude), and other times are ignored.
Three kinds of scheme contrasts are as follows:
Method |
The internal memory that maximum takies |
The internal memory that minimum takies |
The UI presentative time |
Art methods 1 |
300k (15 * 2*10) |
300k (15 * 2*10) |
0ms (ignoring the primary load time) |
Art methods 2 |
100k (5 * 2*10) |
0k |
500ms |
The inventive method 3 |
130k (15 * 2+5 open * 2*10) (only compressing 5 gets final product) |
30k (15 * 2) |
25ms |
Table 1
Consider that maximum memory takies situation: as can be seen from Table 1, the method for the invention 3 has reduced to 43% (it is more that actual conditions reduce) of method 1 with taking of internal memory, and the UI presentative time has only postponed 25 milliseconds; Compare with method 2, EMS memory occupation has also only increased by 30%, and the UI presentative time then reduces to original 5%.
At the method for loading multimedia information in the above-mentioned UI interface, the present invention also provides charger embodiment.With reference to Fig. 3, be the apparatus structure block diagram of loading multimedia information in the described UI of the embodiment of the invention interface.Described device is arranged at DVD player, media player etc. to have in the system or equipment of user interface, mainly comprises control module 301, loading unit 302 and UI display unit 303.
Described control module 301 is used for copying the multimedia messages that memory device compresses to internal memory; After UI presents, the data that decompress are discharged; When system withdraws from, the described packed data of deletion from internal memory.Described loading unit 302 is used for reading described packed data from internal memory, and decompressing when needing UI to be current.Described UI display unit 303 is used for decompressed data is presented to the UI interface.Wherein, described control module 301 can copy the multimedia messages that compresses in the memory device to internal memory when system start-up; Preferably, in order to reduce memory consumption to greatest extent, can also need UI to be in the first time and carry out copy function now.
The processing procedure of described charger is: after the system start-up, perhaps needing for the first time UI to be current, control module 301 copies the multimedia messages that compresses in the memory device to internal memory; When needs UI is current, read described packed data by loading unit 302 from internal memory, and carry out decompression, by UI display unit 303 data behind the decompress(ion) are presented to the UI interface then; After UI presented, UI display unit 303 notice control modules 301 were discharged the data that decompress by control module 301 from internal memory; And when system withdrawed from, control module 301 was deleted packed data again from internal memory.
Described charger can reduce memory consumption as much as possible under the situation that guarantees the UI presentation speed, save memory source.
The part that does not describe in detail in the device shown in Figure 3 can be considered for length referring to the relevant portion of Fig. 1, method shown in Figure 2, is not described in detail in this.
More than to the method and the device of loading multimedia information in the UI provided by the present invention interface, be described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, part in specific embodiments and applications all can change.In sum, this description should not be construed as limitation of the present invention.