Background technology
Along with the development of real-time rendering technology, the real-time rendering technology also has been applied in the field of broadcast televisions, and then has produced three-dimensional online packaging system.The three-dimensional packing system is comprised of computing machine, video card and rendering apparatus.Computing machine provides the operation platform of whole three-dimensional packing system, video card provides input, output and the realization video of video pictures, the rapid mixing function between the picture and text, rendering apparatus is the core of whole system, and it is the interactive tool of making and show picture and text template, the operation of control video card and output.
Video card is diversified, rendering apparatus also is that minute number of different types are such as Video Graphics Array (Video Graphics Array by the vision signal of video card collection, VGA), digital visual interface (Digital Video Interface, DVI), HDMI (High Definition Multimedia Interface) (High Definition Multimedia Interface, HDMI), digital serial interface (serial digital interface, SDI) etc., but on the data structure of these vision signals, generally speaking be divided into two kinds: line by line data and interlaced data.In rendering apparatus, has plenty of interlaced data by the vision signal of video card collection, have plenty of line by line data, for data line by line, it is carried out being directly passed to after data are played up video card output is no problem, yet, for interlaced data, it is carried out can being converted into line by line data after data are played up, and then pass to video card output, the parity rows data that rendering result parity rows data and video card output requirement at this moment can occur are not corresponding, and therefore sawtooth and scintillation can appear in the three-dimensional picture of output.
Sawtooth and scintillation appear in the picture for fear of output, and existing rendering apparatus adopts following two kinds of methods that interlaced data is converted to line by line data to carry out data again and play up:
First method:
In internal memory, video card is collected the conversion that every frame data carry out a data structure for interlaced data, the parity rows data are carried out corresponding mathematical operation, become the data that there are not the parity rows feature in delegation or multirow for the strange capable data of corresponding line number or the match of idol row data, also namely interlaced data is converted line by line to data and carry out again data and play up.
Second method:
Adopt special hardware device that interlaced data is converted to line by line data.
Sawtooth and scintillation appear in the picture that above-mentioned two kinds of methods are avoided exporting, yet for first method, its weak point is: on the one hand, data need to take a large amount of cpu resources owing to be converted to interlaced data line by line, therefore so that the real time data of rendering apparatus is played up the performance reduction, and simultaneously the multichannel interlaced data of video card collection is carried out real time data when playing up at rendering apparatus, it is more obvious that the real time data of rendering apparatus is played up the decline of performance; On the other hand, because after interlaced data was converted to line by line data, original video information can be modified, and to revise be to diminish with irreversible, so the quality of vision signal can reduce.For second method, its weak point is: on the one hand, because the process that adopts special hardware to process is several frame data before and after need to obtaining, then joint account, vision signal input-output device becomes the gap that has several frames, therefore, the rendering efficiency of engine has been subject to the restriction of hardware, and the collection of video data and the real-time of output just reduce very much, on the other hand, owing to be limited by special hardware device, so expanding with dirigibility of rendering apparatus reduced.
Summary of the invention
The embodiment of the invention provides a kind of data rendering method and device, be used for to solve prior art and carries out data when playing up for interlaced data, and the real time data of rendering apparatus is played up the problem of the decline of performance.
The technical scheme that the embodiment of the invention provides mainly comprises:
A kind of data rendering method, the method comprises:
Read also every frame data of store video card collection, obtain the data structure information of these frame data;
When the data structure of these frame data is interlaced data, change the data structure of these frame data, the odd-numbered line data of these frame data are combined strange capable data as these frame data, with the even number of lines of these frame data according to the idol row data that combine as these frame data;
According to the needs of video card output these frame data being carried out data plays up, when video card need to be exported strange capable data, read the strange capable data of these frame data of storage and play up, when video card need to be exported idol row data, the idol row data that read these frame data of storage were carried out data and are played up.
A kind of data rendering device, this device comprises:
The frame data read module is used for reading also every frame data of store video card collection, obtains the data structure information of these frame data;
Data structure changes module, be used for when the data structure of these frame data is interlaced data, change the data structure of these frame data, the odd-numbered line data of these frame data are combined strange capable data as these frame data, with the even number of lines of these frame data according to the idol row data that combine as these frame data;
Rendering module, being used for according to the needs that video card is exported these frame data being carried out data plays up, when video card need to be exported strange capable data, reading the strange capable data of these frame data of storage plays up, when video card need to be exported idol row data, the idol row data that read these frame data of storage were carried out data and are played up.
The embodiment of the invention, by respectively the strange capable data of interlaced data and the data of going by chance being merged, and when need are played up the strange capable data of these frame data, reading the strange capable data of these frame data of storage plays up, at need the idol row data of these frame data are carried out data when playing up, the idol row data that read these frame data of storage are carried out data and are played up, owing to interlaced data is not carried out the line by line conversion process of data, therefore, alleviate the resource occupation amount of CPU when when avoiding three-dimensional picture to export by video card, sawtooth and scintillation occurring, improved the efficient of real-time rendering.
Embodiment
The embodiment of the invention provides a kind of data rendering method and device, utilized playing up data when output video card and will very go data and the capable data of idol and separately export this principle, strange capable data and idol row data with interlaced data merge respectively, and when need are played up the strange capable data of these frame data, reading the strange capable data of these frame data of storage plays up, at need the idol row data of these frame data are carried out data when playing up, the idol row data that read these frame data of storage are carried out data and are played up, owing to interlaced data is not carried out the line by line conversion process of data, therefore, alleviate the resource occupation amount of CPU when when avoiding three-dimensional picture to export by video card, sawtooth and scintillation occurring, improved the efficient of real-time rendering.
As shown in Figure 1, the process flow diagram of a kind of data rendering method that it provides for the embodiment of the invention, the method may further comprise the steps:
Step 101: read also every frame data of store video card collection, obtain the data structure information of these frame data.
Data structure refers to the mode of Computer Storage, organising data, and existing data structure comprises: line by line data and interlaced data.
Better, in this step 101, also obtained data width and the elevation information of these frame data.
During implementation, this step 101 can be that rendering apparatus reads every frame data that video card gathers, and reads the information of every frame data, the width of these frame data, height and data structure.In internal memory, create an onesize data block, these frame data are copied in the memory block that creates, snap into moving of internal memory thereby finish from video.
Step 102: whether the coded format of judging these frame data is predefined coded format, and if not, then execution in step 103, if then execution in step 104.
Because it is a variety of that the coded format of the data that video card collects is divided, as: brightness parameter and colourity parameter be pixel format YUV, the RGB (Red Blue Green, RGB) of expression separately.Give again rendering apparatus after the unified data encoding format and carry out data and play up for the compatibility that guarantees data acquisition need to be converted into various data encoding formaies.
Step 103: the coded format of these frame data is converted to predefined coded format, and execution in step 104.
Described predefined coded format is to set according to the form of rendering apparatus support, suppose the opaque parameter of rendering apparatus support RGB (Red Blue Green Alpha, RGBA) coded format then can be converted to the coded format of frame data the RGBA form.
Need to prove that step 102 and step 103 are preferred steps of the embodiment of the invention, the embodiment of the invention is not execution in step 102 and step 103 also.
Step 104: whether the data structure of judging these frame data is interlaced data, if then execution in step 105, if not, then execution in step 107.
To judge according to the data structure information that obtains these frame data in the step 101 in this step 104.
Step 105: change the data structure of these frame data, the odd-numbered line data of these frame data combined strange capable data as these frame data, with the even number of lines of these frame data according to the idol row data that combine as these frame data, and execution in step 106.
The process that the odd-numbered line data of this step 105 merge and even number of lines are according to the process synoptic diagram as shown in Figure 2 that merges, wherein, what the figure on the left side represented among Fig. 2 is the data structure that changes the data structure frame data before of frame data, and delegation's odd-numbered line data and delegation's even number of lines are according to alternately storage; What the figure on the right represented among Fig. 2 is the data structure that has changed the data structure frame data afterwards of frame data, and the odd-numbered line data are stored in the first half of the storage space of these frame data, and even number of lines is according to the latter half that is stored in the storage space of these frame data.
Certainly, in this step 105, the data structure that changes frame data is not limited to the odd-numbered line data are stored in the first half of the storage space of these frame data, even number of lines is according to the following part that is stored in the storage space of these frame data, also just even number of lines is according to the first half that is stored in the storage space of these frame data, and the odd-numbered line data are stored in the latter half of the storage space of these frame data.
If in step 101, obtained data width and the elevation information of these frame data, then in this step 105, change the data structure of these frame data, specifically comprise:
Data width and elevation information according to these frame data that obtain, extract successively each odd-numbered line data and each even number of lines certificate of these frame data, all odd-numbered line data of these frame data of extracting are merged strange capable data as these frame data, with all evens number of lines of these frame data of extracting according to the idol row data that merge as these frame data.
Step 106: the frame data that read the data structure that has changed frame data create texture mapping, and execution in step 108.
Because the video card in the rendering apparatus can only be processed the texture mapping data at present, therefore, the frame data that need to read the data structure that has changed frame data create texture mapping and could be identified by video card.
During implementation, can with according to the change that collects the size of frame data of data structure of frame data create the texture mapping of formed objects at video memory, and then finish the transmission from the internal memory to the video memory, play up and prepare for rendering apparatus carries out data.
At this moment, because the first half of the frame data of the described data structure that has changed frame data is very to go data, the latter half is idol row data, therefore, be converted to after the texture mapping, the first half of this texture mapping is still strange capable data, and the latter half is idol row data still.
Step 107: read line by line data creation texture mapping, and execution in step 108.
For data line by line, also need to create texture mapping, and create the texture texture mapping identical with the size of data of data line by line at video memory, and then finish the transmission from the internal memory to the video memory, play up and prepare for rendering apparatus carries out data.
At this moment, owing to be not that the data structure of the frame data of data changes line by line to the data structure, therefore, be converted into after the texture mapping, the first half of this texture mapping is still the first half of original frame data, and the latter half is the latter half that is still original frame data.
Need to prove that step 106 and step 107 are preferred steps of the embodiment of the invention, video card in the rendering apparatus is not in the time of can only processing the data of texture mapping, also not execution in step 106 and step 107, directly after step 105, the needs of directly exporting according to video card carry out data to these frame data and play up, in the time need to playing up the odd-numbered line data of these frame data, reading the strange capable data of these frame data of storage plays up, need to be to the even number of lines of these frame data according to carrying out data when playing up, the idol row data that read these frame data of storage be carried out data and are played up.
Step 108: according to the needs of video card output these frame data are carried out data and play up, when video card need to be exported strange capable data, read in the described texture mapping and play up corresponding to the data of strange row data part, need to export idol row data at video card, read in the described texture mapping and play up corresponding to the data of idol row data part.
In an embodiment of the present invention, owing to no longer do interlaced data to the line by line conversion of data, so just effectively reduce the pilot process that data are processed, reduced the resource occupation of CPU.And interlaced data is not carried out the line by line conversion of data, like this, just can not reduce the display quality (sawtooth and scintillation can not occur when namely exporting) of original video, the data that also do not need to contrast these several frames in frame data front and back are done calculating, therefore do not need to gather the data of several frames, broadcast frame video that can be real-time can not cause the frame delay that gathers and broadcast, in terms of existing technologies, improved the real-time of playing up.
As shown in Figure 3, the structural representation of a kind of data rendering device that it provides for the embodiment of the invention, this device comprises: frame data read module 11, data structure change module 12 and rendering module 13; Wherein:
Frame data read module 11 is used for reading also every frame data of store video card collection, obtains the data structure information of these frame data.
Data structure changes module 12, be used for when the data structure of these frame data is interlaced data, change the data structure of these frame data, the odd-numbered line data of these frame data are combined strange capable data as these frame data, with the even number of lines of these frame data according to the idol row data that combine as these frame data.
Rendering module 13, being used for according to the needs that video card is exported these frame data being carried out data plays up, when video card need to be exported strange capable data, reading the strange capable data of these frame data of storage plays up, when video card need to be exported idol row data, the idol row data that read these frame data of storage were carried out data and are played up.
Described device also comprises:
Judge module 14 is used for judging whether the coded format of every frame data is predefined coded format.
Coded format transition module 15 is used for when the coded format of every frame data is not predefined coded format, and the coded format of these frame data is converted to predefined coded format.
More excellent, described device also comprises:
Texture mapping creation module 16, the Data Format Transform of frame data that is used for having changed the data structure of frame data is texture mapping;
Described rendering module 13, concrete being used for when video card need to be exported strange capable data, read in the described texture mapping and play up corresponding to the data of strange row data part, need to export idol row data at video card, read in the described texture mapping and play up corresponding to the data of idol row data part.
More excellent, described frame data read module 11 is also for the data width and the elevation information that obtain these frame data;
Described data structure changes module 12, concrete data width and the elevation information that is used for according to these frame data that obtain, extract successively each odd-numbered line data and each even number of lines certificate of these frame data, all odd-numbered line data of these frame data of extracting are combined strange capable data as these frame data, with the even number of lines of these frame data of extracting according to the idol row data that combine as these frame data.
Those skilled in the art should understand that embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt complete hardware implementation example, complete implement software example or in conjunction with the form of the embodiment of software and hardware aspect.And the present invention can adopt the form of the computer program of implementing in one or more computer-usable storage medium (including but not limited to magnetic disk memory and optical memory etc.) that wherein include computer usable program code.
The present invention is that reference is described according to process flow diagram and/or the block scheme of method, device (system) and the computer program of the embodiment of the invention.Should understand can be by the flow process in each flow process in computer program instructions realization flow figure and/or the block scheme and/or square frame and process flow diagram and/or the block scheme and/or the combination of square frame.Can provide these computer program instructions to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data treating apparatus producing a machine, so that the instruction of carrying out by the processor of computing machine or other programmable data treating apparatus produces the device of the function that is used for being implemented in flow process of process flow diagram or a plurality of flow process and/or square frame of block scheme or a plurality of square frame appointments.
These computer program instructions also can be stored in energy vectoring computer or the computer-readable memory of other programmable data treating apparatus with ad hoc fashion work, so that the instruction that is stored in this computer-readable memory produces the manufacture that comprises command device, this command device is implemented in the function of appointment in flow process of process flow diagram or a plurality of flow process and/or square frame of block scheme or a plurality of square frame.
These computer program instructions also can be loaded on computing machine or other programmable data treating apparatus, so that carry out the sequence of operations step producing computer implemented processing at computing machine or other programmable devices, thereby be provided for being implemented in the step of the function of appointment in flow process of process flow diagram or a plurality of flow process and/or square frame of block scheme or a plurality of square frame in the instruction that computing machine or other programmable devices are carried out.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.