Embodiment
Please refer to Fig. 1, the schematic diagram of the SetTop Box 10 that Fig. 1 is the embodiment of the present invention.SetTop Box 10 includes apiecemeal compression unit 100, astorage device 102 and a processing unit 104.Wherein, a main program code in the firmware code thatpiecemeal compression unit 100 is used for SetTop Box 10 to receive is divided into procedure code PC1, PC2, and according to different compression algorithm, respectively procedure code PC1, PC2 are compressed to processing, to produce compressed code CC1,CC2.Storage device 102 is coupled topiecemeal compression unit 100, is used for compressed code CC1, CC2 to be stored in respectively in storage block SB1, the SB2 of storage device 102.Processing unit 104 is coupled tostorage device 102, be used for the compressed code CC1, the CC2 that read and decompress instorage device 102, and procedure code PC1, PC2 after carry out decompressing, to realize quick startermotor top box 10 and to reach the effect (details will in following description) of quick turn-on.
About the data processing method ofpiecemeal compression unit 100, can be summarized as aflow process 20, please continue to refer to following explanation.Fig. 2 is the schematic diagram of theflow process 20 of the embodiment of the presentinvention.Flow process 20 comprises following steps:
Step 200: start.
Step 202: the main program code in the firmware code of Set Top Box is divided into the first procedure code and the second procedure code.
Step 204: according to different compression algorithm, respectively the first procedure code and the second procedure code are compressed to processing, to produce the first compressed code and the second compressed code.
Step 206: the first compressed code is sent to storage device, and is stored in the first storage block of storage device.
Step 208: the second compressed code is sent to storage device, and is stored in the second storage block of storage device.
Step 210: finish.
According toflow process 20, the main program code in the firmware code thatpiecemeal compression unit 100 can receive SetTop Box 10 is divided into procedure code PC1, PC2.Then,piecemeal compression unit 100 compresses and processes to produce compressed code CC1 procedure code PC1 according to one first compression algorithm, and according to one second compression algorithm, procedure code PC2 is compressed and processes to produce compressed code CC2.After compressed code CC1, CC2 are produced,piecemeal compression unit 100 is sent tostorage device 102 by compressed code CC1, compressed code CC1 is stored in to the storage block SB1 of storage device 102.Similarly,piecemeal compression unit 100 is sent tostorage device 102 by compressed code CC2, compressed code CC2 is stored in to the storage block SB2 of storage device 102.Thus, when Set Top Box wish is carried out relevant executive program, the information that can read respectively and decompress in different storage blocks according to the order of carrying out.In brief, according toflow process 20, can see through the data in thepre-configured storage device 102 ofpiecemeal compression unit 100, to coordinate the running of follow-up flow process.
For instance, main program code about boot program in firmware code has comprised procedure code PC1, PC2, and procedure code PC1 system is relevant to system start-up routine, procedure code PC2 system is relevant in screen display and shows (on screen display, OSD) program, that is to say, in boot program, after procedure code PC1 can first be performed, procedure code PC2 just can be performed.Therefore, when SetTop Box 10 is started shooting,processing unit 104 can first read the compressed code CC1 in the storage block SB1 that is stored instorage device 102, and compressed code CC1 is carried out to decompression, to produce a decompression code DCC1 who is relevant to system start-up routine.Then,processing unit 104 is carried out the code DCC1 that decompresses to realize system start-up routine.For example, system start-up routine comprises the running that systems such as carrying out hardware/software initialization, indicated channel setting, indicated channel broadcasting and/or program guide output starts.Meanwhile, inprocessing unit 104 carry out the code DCC1 that decompress during,processing unit 104 can read and the compressed code CC2 of the storage block SB2 that is stored instorage device 102 of decompressing again, to produce, is relevant at one of the screen display routine code DCC2 that decompresses.In other words, atprocessing unit 104, carry out the code DCC1 that decompress and realize in related system start-up routine, also obtained the decompression code DCC2 being relevant at screen display routine simultaneously.Thus, whenprocessing unit 104 is carried out decompression code DCC2, the item that such as indicated channel setting, indicated channel broadcasting or program guide output etc. is relevant to system start-up routine also completes.Processing unit 104 just can be smoothly by the execution code DCC2 that decompresses, to carry out in display unit at screen display routine.
In simple terms, traditional Set Top Box is in when start, conventionally must be by after being stored in main program code (comprising procedure code PC1, PC2) in storage device and all decompressing out, then carry out main program code and operate with the start of be correlated with, thus, need are expended to the tediously long available machine time.In order to improve longer disappearance of conventional set-top box available machine time, the present invention compresses firmware code piecemeal and leaves different storage areas in, and when wish is carried out relevant executive program, according to the order of the carrying out required program information that reads respectively and decompress, thus, the mode of utilizing piecemeal to decompress, Set Top Box is as long as read and the firmware code of the first that decompresses (execution sequence is front) via storage device, can start to carry out boot program, and not need to wait until that whole firmware code all just can start to carry out boot program after decompressed handling.In addition, when carrying out the firmware code of first, can read again and the firmware code of the second portion that decompresses (execution sequence is rear) simultaneously.In this case, compared to traditional mode, the present invention can significantly shorten the time of decompression, and then shorten the available machine time of SetTop Box 10, reach the effect of quick turn-on.
Further, the main program code in firmware code can, when compiling, add for being defined in screen display and show resource, as the attribute instruction of picture resource, word string resource and font resource.Thus,piecemeal compression unit 100 can be according to a duplicate instructions, takes out procedure code, and then main program code is divided into procedure code PC1, PC2 by being relevant in screen display is shown procedure code (procedure code PC2) the independent procedure code of resource.For instance, in compiling, be relevant to picture, word string, when fonts etc. are shown the main program code of resource in screen display, seeing through adds attribute instruction as attribute ((section (" .resource "))) instruction, take being relevant to the resources definition of showing in screen display is resource (" .resource ") attribute, and after main program code has compiled, see through and use duplicate instructions as objcopy-j.resource instruction, can take out being relevant in screen display is shown the procedure code independent procedure code of resource, form procedure code PC2, all the other procedure codes form procedure code PC1, complete by this classification of main program code.Wherein, procedure code PC1 system is relevant to the procedure code that system starts resource.
Should be noted, Fig. 1 is in order to concept of the present invention to be described, this area tool knows that the knowledgeable is when doing according to this different variations and modification conventionally, and is not limited to this.For instance,piecemeal compression unit 100 is built in SetTop Box 10 except interior, also can be arranged at SetTop Box 10 outsides, viewing system demand and determining.Storage device 102 can be a flash memory (Flash Memory), can also be anyly can carry out the memory of repetitive read-write, and be not limited to this.In addition, the algorithm of aforementioned mentioned compression and decompression can be a Lempel Ziv Oberhumer(LZO) algorithm, a Lempel Ziv Markov chain Algorithm(LZMA) algorithm or other any data compression algorithms.The first compression algorithm and the second compression algorithm can also be identical or different algorithms.Compressed code CC1 of the present invention, CC2 in being stored in respectively storage block SB1, the SB2 ofstorage device 102, also can be stored in different storing devices respectively, as long as can, for reading, be not limited to this.These derivative application should be that this area tool is known the known skill of the knowledgeable conventionally.
About the quick turn-on mode of SetTop Box 10, can be summarized as aflow process 30, please continue to refer to following explanation.Fig. 3 is the schematic diagram of theflow process 30 of the embodiment of the presentinvention.Flow process 30 is used for shortening the available machine time of SetTop Box 10, to reach the effect of quick turn-on.Flow process 30 comprises following steps:
Step 300: start.
Step 302: when Set Top Box is started shooting, read and the compressed code of the storage block that is stored in storage device of decompressing, to produce the decompression code that is relevant to system start-up routine.
Step 304: carry out the code that decompresses, to realize system start-up routine.
Step 306: when carry out decompressing code, read and the compressed code of the storage block that is stored in storage device of decompressing, to produce the decompression code being relevant at screen display routine.
Step 308: carry out the code that decompresses, to carry out at screen display routine in display unit.
Step 310: finish.
According toflow process 30, instep 302, whenprocessing unit 104 is started shooting in SetTop Box 10, first read and the compressed code CC1 of the storage block SB1 that is stored instorage device 102 of decompressing, to produce the decompression code DCC1 that is relevant to system start-uproutine.In step 304,processing unit 104 is carried out the code DCC1 that decompresses, and to realize system start-up routine, that is to say,processing unit 104 does not need all main program codes that compressed to decompress, and can carry out system start-up routine.In step 306,processing unit 104 is in carry out decompressing code DCC1 when being relevant to the running of system start-up routine, read and the compressed code CC2 of the storage block SB2 that is stored instorage device 102 of decompressing, to produce the decompression code DCC2 being relevant at screendisplay routine.In step 308,processing unit 104 is carried out and an initialization decompression code DCC2, and a decompression code DCC2 is copied to and is stored in block SB3.The system start-up routines such as indicated channel setting and indicated channel broadcasting due tostep 304, have been completed, therefore display unit can normally show and be relevant to that indicated channel is play and/or the image of program guide institute wish demonstration, as picture, word string, font image and/or menu option etc., to carry out in display unit at screen display routine, make SetTop Box 10 be achieved complete boot program.
On the other hand, preferably, procedure code PC1, PC2 can compress processing according to different compression algorithm respectively.For example, the first algorithm thatpiecemeal compression unit 100 can be lower according to a compression ratio, compresses processing to procedure code PC1, to produce compressed code CC1.Meanwhile, the second algorithm thatpiecemeal compression unit 100 can be higher according to a compression ratio, compresses processing to procedure code PC2, to produce compressed code CC2.That is to say, in the situation that the compression ratio of the first algorithm is less than or equal to the compression ratio of the second algorithm, utilize separately the first algorithm and the second algorithm to compress processing to procedure code PC1 and the second procedure code PC2, to produce compressed code CC1 and compressed code CC2.For instance, the first algorithm can be a LZO algorithm, and the second algorithm can be a LZMA algorithm.In this case, because the compression ratio of LZO algorithm is lower, thus, utilize LZO algorithm to carry out required time of implementation of compression/de-compression shorter, therefore instep 302, can more shorten compressed code CC1 is carried out to the time required while decompressing.
In sum, traditional Set Top Box need decompress to all main program codes that compressed, and to realize system start-up routine and at screen display routine, to make the available machine time of Set Top Box longer, affects user's use.Under comparing, Set Top Box of the present invention by main program code be divided into be relevant to system start-up routine and screen display routine procedure code, and arrange in pairs or groups different algorithm independent compression and decompression, and the decompression code that is relevant to system start-up routine in execution is when realizing system start-up routine, the compressed code being relevant at screen display routine is decompressed, can significantly shorten the available machine time of Set Top Box by this and reach the effect of quick turn-on.
The foregoing is only preferred embodiment of the present invention, all equalizations of doing according to the present patent application the scope of the claims change and modify, and all should belong to covering scope of the present invention.