Embodiment
The embodiment of the invention provides display packing, method and the device of image, is used to save cpu resource, improves the efficient of handling image.Below be elaborated.
See also Fig. 1, method for displaying image first embodiment comprises in the embodiment of the invention:
101, receive the I frame;
Digital TV terminal receives the I frame in the cable TV network.
102, generate video sequence;
This step is that the CPU by digital TV terminal finishes, and calls generation module by middleware earlier, generates the video sequence IPPPPPP that meets mpeg standard with reference to the I frame again, comprising:
Generate the P frame with reference to the I frame, the macro block bar quantity of P frame equates with macro block bar quantity with reference to the I frame, it is coded macroblocks that the macro block of composition P frame macro block bar has only first macro block and last macro block, and other macro blocks are empty, and first macro block and last macro block need coded data to have:
Quantize scale (quantiser_scale_code): arbitrarily, (CBP is 0 coded_block_pattern), does not promptly encode, and quantizes inoperative because of the block encoding pattern of all pieces of macro block (Block);
Extension bits (extra_bit_slice): be fixed as 0;
Macroblock address increment (macroblock_address_increment): the address increment of first macro block is 1, the address increment of last macro block deducts 1 machine by the video resolution width divided by the merchant of macro block width and obtains, as: the I frame of one 720 * 576 pixel, width is 720, the width of each macro block is 16,720 ÷ 16-1=44, promptly the address increment of last macro block is 44;
Macro block mode (macroblock_modes): the macro block mode of P frame is to travel forward;
Motion vector (motion_vectors): level all is 0 with vertical motion vector.
So constantly generate the P frame, pass through the combination with the I frame again, just can obtain MPEG video sequence: IPPPPPP, middleware sends to the MPEG hardware decoder with the MPEG video sequence of generation.
103, decoding video sequence;
The MPEG hardware decoder receiver, video sequence of digital TV terminal, with video sequence decoding, display device is normal continuous playing image just.
Present embodiment 102 in, can also generate the video sequence that meets mpeg standard: IPBBPBBPBB, as follows:
Generate the P frame with reference to the I frame, the macro block bar quantity of P frame equates with macro block bar quantity with reference to the I frame, it is coded macroblocks that the macro block of composition P frame macro block bar has only first macro block and last macro block, and other macro blocks are empty, and first macro block and last macro block need coded data to have:
Quantize scale (quantiser_scale_code): arbitrarily,, promptly do not encode, quantize inoperative because of the CBP of all Block of macro block is 0;
Extension bits (extra_bit_slice): be fixed as 0;
Macroblock address increment (macroblock_address_increment): the address increment of first macro block is 1, the address increment of last macro block deducts 1 by the video resolution width divided by the merchant of macro block width and calculates, as: the I frame of one 720 * 576 pixel, width is 720, the width of each macro block is 16,720 ÷ 16-1=44, promptly the address increment of last macro block is 44;
Macro block mode (macroblock_modes): the macro block mode of P frame is to travel forward;
Motion vector (motion_vectors): level all is 0 with vertical motion vector.
Generate the B frame with reference to the I frame, the macro block bar quantity of B frame equates with the macro block bar quantity of reference frame I frame, it is coded macroblocks that the macro block of composition B frame macro block bar has only first macro block and last macro block, and other macro blocks are empty, and first macro block and last macro block need coded data to have:
Quantize scale (quantiser_scale_code): arbitrarily,, promptly do not encode, quantize inoperative because of the CBP of all Block of macro block is 0;
Extension bits (extra_bit_slice): be fixed as 0;
Macroblock address increment (macroblock_address_increment): the address increment of first macro block is 1, the address increment of last macro block deducts 1 by the video resolution width divided by the merchant of macro block width and calculates, as: the I frame of one 720 * 576 pixel, width is 720, the width of each macro block is 16,720 ÷ 16-1=44, promptly the address increment of last macro block is 44;
Macro block mode (macroblock_modes): the macro block mode of B frame is set to travel forward;
Motion vector (motion_vectors): level all is 0 with vertical motion vector.
So constantly generate PBB, pass through the combination with the I frame again, just can obtain MPEG video sequence: IPBBPBBPBB, middleware sends to the MPEG hardware decoder with the MPEG video sequence of generation.
Can also generate MPEG video sequence: IBBPBBPBBP, first with reference to I frame generation P frame and B frame (the same video sequence that generates of method: IPBBPBBPBB), be combined into the BBP frame then, pass through combination again with the I frame, just can obtain MPEG video sequence: IBBPBBPBBP, middleware sends to the MPEG hardware decoder with the MPEG video sequence that generates.
In the present embodiment, receive the I frame image data of cable TV network at digital TV terminal after, earlier this I frame image data is generated a video sequence that meets mpeg standard, re-send to the decoding of MPEG hardware decoder, rather than by the CPU broadcast of decoding, reduced the burden of CPU,, improved decoding efficiency greatly based on the powerful hardware decoding capability of MPEG.
Seeing also Fig. 2, is that method for displaying image second embodiment comprises in the embodiment of the invention below:
201, obtain view data
At first the server of digital TV network front end can obtain view data from each scene, and this view data can be the TV programme that derives from the big net, also can be the view data that derives from the forms such as JPEG, BMP in the network.
202, generate the I frame
After server gets access to view data, can screen,, be issued to network itself being exactly the mpeg frame form and being the I frame format to view data; If view data itself is not the mpeg standard frame format, then view data is transformed the I frame, be issued to network.
203, be issued to network
The I frame that generates is handed down to digital TV terminal by network.
204, receive the I frame
The digital TV terminal of cable TV network receives the I frame in the cable TV network.
205, generate video sequence
This step is that the CPU by digital TV terminal finishes, and calls generation module by middleware, regeneration MPEG video sequence earlier.
Can generate MPEG video sequence: IPPPPPP, as follows:
Generate the P frame with reference to the I frame, the macro block bar quantity of P frame equates with macro block bar quantity with reference to the I frame, it is coded macroblocks that the macro block of composition P frame macro block bar has only first macro block and last macro block, and other macro blocks are empty, and first macro block and last macro block need coded data to have:
Quantize scale (quantiser_scale_code): arbitrarily,, promptly do not encode, quantize inoperative because of the CBP of all Block of macro block is 0;
Extension bits (extra_bit_slice): be fixed as 0;
Macroblock address increment (macroblock_address_increment): the address increment of first macro block is 1, the address increment of last macro block deducts 1 by the video resolution width divided by the merchant of macro block width and calculates, as: the I frame of one 720 * 576 pixel, width is 720, the width of each macro block is 16,720 ÷ 16-1=44, promptly the address increment of last macro block is 44;
Macro block mode (macroblock_modes): the macro block mode of P frame is to travel forward;
Motion vector (motion_vectors): level all is 0 with vertical motion vector.
So constantly generate the P frame, pass through the combination with the I frame again, just can obtain MPEG video sequence: IPPPPPP, middleware sends to the MPEG hardware decoder with the MPEG video sequence of generation.
Can also generate MPEG video sequence: IPBBPBBPBB, as follows:
Generate the P frame with reference to the I frame, the macro block bar quantity of P frame equates with macro block bar quantity with reference to the I frame, it is coded macroblocks that the macro block of composition P frame macro block bar has only first macro block and last macro block, and other macro blocks are empty, and first macro block and last macro block need coded data to have:
Quantize scale (quantiser_scale_code): arbitrarily,, promptly do not encode, quantize inoperative because of the CBP of all Block of macro block is 0;
Extension bits (extra_bit_slice): be fixed as 0;
Macroblock address increment (macroblock_address_increment): the address increment of first macro block is 1, the address increment of last macro block deducts 1 by the video resolution width divided by the merchant of macro block width and calculates, as: the I frame of one 720 * 576 pixel, width is 720, the width of each macro block is 16,720 ÷ 16-1=44, promptly the address increment of last macro block is 44;
Macro block mode (macroblock_modes): the macro block mode of P frame is to travel forward;
Motion vector (motion_vectors): level all is 0 with vertical motion vector.
Generate the B frame with reference to the I frame, the macro block bar quantity of B frame equates with the macro block bar quantity of reference frame I frame, it is coded macroblocks that the macro block of composition B frame macro block bar has only first macro block and last macro block, and other macro blocks are empty, and first macro block and last macro block need coded data to have:
Quantize scale (quantiser_scale_code): arbitrarily,, promptly do not encode, quantize inoperative because of the CBP of all Block of macro block is 0;
Extension bits (extra_bit_slice): be fixed as 0;
Macroblock address increment (macroblock_address_increment): the address increment of first macro block is 1, the address increment of last macro block deducts 1 by the video resolution width divided by the merchant of macro block width and calculates, as: the I frame of one 720 * 576 pixel, width is 720, the width of each macro block is 16,720 ÷ 16-1=44, promptly the address increment of last macro block is 44;
Macro block mode (macroblock_modes): the macro block mode of B frame is set to travel forward;
Motion vector (motion_vectors): level all is 0 with vertical motion vector.
So constantly generate the PBB frame, pass through the combination with the I frame again, just can obtain MPEG video sequence: IPBBPBBPBB, middleware sends to the MPEG hardware decoder with the MPEG video sequence of generation.
Can also generate MPEG video sequence: IBBPBBPBBP, first with reference to I frame generation P frame and B frame (the same video sequence that generates of method: IPBBPBBPBB), be combined into the BBP frame then, pass through combination again with the I frame, just can obtain MPEG video sequence: IBBPBBPBBP, middleware sends to the MPEG hardware decoder with the MPEG video sequence that generates.
206, decoding video sequence
The MPEG hardware decoder receiver, video sequence of digital TV terminal, with video sequence decoding, display device is normal continuous playing image just.
In the method for displaying image of present embodiment, front-end server sends to digital TV terminal with the I frame, generate video sequence by digital TV terminal with reference to the I frame then, sending to the MPEG hardware decoder decodes, rather than decode by CPU, alleviated the burden of CPU,, improved decoding efficiency greatly based on the powerful hardware decoding capability of MPEG.
For better understanding, below we consult Fig. 3 202 steps that generate the I frames are elaborated.Comprise:
301, server gets access to view data, carries out 302;
302, judge that view data that server obtains whether for meeting the mpeg standard frame, if meet the mpeg standard frame, carries out 303; If not meeting the mpeg standard frame, carry out 306;
303, judge that meeting the mpeg standard frame is the I frame, if the I frame carries out 304; If not the I frame, carry out 305;
304, the I frame is handed down to digital TV terminal by network;
305, abandon not being the frame data of I frame;
306, with image data decoding, obtain the RGB component and obtain the RGB data, carry out 307 again;
307, the RBG data conversion is become yuv data, carry out 308 again;
308, yuv data is encoded into the I frame.
Preferably,
Execute 303 judge that view data are the I frame after, judge again whether the pairing size of images of this I frame surpasses predefined size value:
If surpass predefined size value, with this I frame down-sampling, carry out 308 then, be re-encoded as the I frame, carry out 304 again and be issued to cable TV network;
If do not surpass predefined size value, carry out 304 and be issued to cable TV network;
Execute 307 the RBG data conversion become yuv data after, judge again whether the pairing size of images of yuv data surpasses predefined size value,
If surpass predefined size value, with this yuv data down-sampling, carry out 308 then and be encoded into the I frame, carry out 304 again and be issued to cable TV network;
If surpass predefined size value, carry out 308 this yuv data is encoded into the I frame, carry out 304 again and be issued to cable TV network.
In the present embodiment, front-end server obtains the I frame or coded image data is become the I frame from the TV programme code stream of big net, finished the part of the macrooperation amount of method for displaying image of the present invention, significantly reduced the burden of digital TV terminal CPU, and guaranteed that digital TV terminal can generate video sequence with the I frame smoothly and decode.And in the preferred version of present embodiment, size is issued in the cable TV network above behind the view data down-sampling of predefined size value again, has alleviated the load of bandwidth, and can control the size of display image.
Introduce the image display device embodiment in the embodiment of the invention below, see also Fig. 4, the image display device in the embodiment of the invention comprises:
Receiver module 401 is used for receiving the I frame data of network;
Generation module 402 is used for generating P frame and B frame with reference to the I frame that receives, and generates the MPEG video sequence by combination then.
Decoder module 403, the MPEG video sequence that is used for generating sends to the MPEG hardware decoder and decodes.
Preferably, image display device can also comprise a control module:
Control module can be come the time of control of video broadcast by the length of control of video sequence: after receiver module 401 receives the I frames, control module gives the I frame additional value, the I frame that the frame number of the video sequence that this value representation will generate, control module will add value again sends to generation module 402;
Control module can be come the priority order of control chart picture broadcast by the priority order of controlling the I frame that receives: after receiver module 401 receives a plurality of I frames, control module sends to generation module with sorted I frame sequence again with a plurality of I frame orderings that receiver module 401 receives;
Whether control module can will resend the I frame that sent to generation module by control, whether the image that comes controls playing to cross will be play again: after receiver module receives the I frame, control module backs up this I frame, and buffer memory is put in backup, to send to generation module again through the I frame that backs up, if when the demand that repeats to generate the I-frame video sequence that has sent to generation module was arranged, control module accessed the backup of I frame correspondence from buffer memory, send to generation module again.
In the image display device of present embodiment, receiver module receives the I frame data, generate the MPEG video sequence by generation module with reference to the I frame data again, send to the hardware decoder decoding, and decode without CPU, reduce the burden of CPU, made full use of the powerful hardware decoding capability of MPEG hardware decoder, improved decoding efficiency.In the preference of present embodiment, after receiving the I frame, receiver module adds a control module, according to user's demand the I frame is controlled, realized image is shown the time, shows order and the function that repeats to show.
Introduce the image display system embodiment in the embodiment of the invention below, see also Fig. 5, the image display system in the embodiment of the invention comprises:
Server 501 is used for obtaining view data from each scene, and this view data can be the TV programme that derives from the big net, also can be the view data that derives from the forms such as JPEG, BMP in the network.If derive from TV programme in the big net, acquisition module can extract frame data and select the I frame to send to digital TV terminal by network from program stream; If derive from the view data of the forms such as JPEG, BMP in the network, acquisition module can become data conversion the data of I frame form, sends to digital TV terminal 502 by network again.
Digital TV terminal 502 is used for the I frame that reception server 501 sends, and generates the MPEG video sequence with reference to the I frame, video sequence is sent to the MPEG hardware decoder again and decodes.
In the image display system of present embodiment, front-end server sends to digital TV terminal with the I frame, generate video sequence by digital TV terminal with reference to the I frame then, sending to the MPEG hardware decoder decodes, rather than decode by CPU, alleviated the burden of CPU,, improved decoding efficiency greatly based on the powerful hardware sign indicating number ability of separating of MPEG.
Need to prove that in this programme embodiment, the I frame that server generates can be the I frame that only has MPEG-1 information, also can be the I frame that has MPEG-2 information.When generating video sequence, if only have MPEG1 information in the I frame, then the video sequence of Sheng Chenging meets the MPEG1 agreement, if having the information of MPEG2 in the I frame, then the video sequence of Sheng Chenging meets the MPEG2 agreement.In the decoding of MPEG hardware decoder, if the MPEG-1 video sequence, because of Moving Picture Experts Group-1 is upward compatible, promptly the stream of MPEG1 promptly can also can be decoded at the hardware decoder of MPEG-2 in the hardware decoder decoding of MPEG-1; If the MPEG-2 video sequence, can only be in the hardware decoder decoding of MPEG-2.Because in actual applications, what digital TV terminal generally adopted all is the MPEG-2 hardware decoder, so what no matter server issued is the I frame of band MPEG1 information or the I frame of band MPEG2 information, the video sequence that the I frame that the hardware decoder of digital TV terminal can both decoding server issues generates.
One of ordinary skill in the art will appreciate that all or part of step in the whole bag of tricks of the foregoing description is to instruct relevant hardware to finish by program, this program can be stored in the computer-readable recording medium, storage medium can comprise: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), disk or CD etc.
More than method for displaying image provided by the present invention, system and device are described in detail, used specific case herein principle of the present invention and execution mode 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, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.