Summary of the invention
The invention provides a kind of high definition decoding middleware system and coding/decoding method of intelligent television, traditional decoding task can not only be competent at, and provide SDK for upper layer application, be beneficial to upper layer application simple, develop fast and flexibly.
The invention provides a kind of high definition decoding middleware system of intelligent television, comprise software application layer, hardware layer and high definition decoding middleware, described high definition decoding middleware is between software application layer and hardware layer, described high definition decoding middleware provides service interface for software application layer and manages and access hardware layer, described high definition decoding middleware comprises decoding driver module and SDK interface module, described decoding driver module is used for the program of hardware controls, and described SDK interface module provides external routine interface.
Correspondingly, present invention also offers a kind of coding/decoding method of high definition decoding middleware system of intelligent television, comprise the following steps: step 1: system initialization, the control inerface of software application layer calls SDK interface, and the function call driving function of SDK carries out initialization, return state information after Initialize installation success; Step 2: transfer of data, first writes data to the buffer stopper in internal memory, then applies for DMA passage; Step 3: after data are judged, data are transferred to video card by DMA; Step 4: video card carries out decompression processing to data, then plays.
Particularly, described system initialization comprises configuration internal register, the firmware of loading required for coding mode, loads coding parameter, runs firmware program.
Particularly, described system initialization step comprises: step 101: reset, carried out the reset of chip by the reset position of the system register CTRL_REG of the structure in control FPGA; Step 102: internal clocking is set, internal clocking is used for timing or counting, and the setting of internal clocking is very necessary on the control circuitry, and it is also the key realizing upper strata cyclic program; Step 103: wait for PLL locking, if the setting in PLL register has been changed, then must have the time delay of at least 20us, to ensure that PLL relocks after changing setting; Step 104: enter non-load host mode, enters non-load host mode Boot pattern and is set to non-load host mode, and under this pattern, DSP can all internal registers of accessing video chip; Step 105: loading firmware; Step 106: enter coprocessor Boot pattern, association's tupe and non-load host mode collaborative work, complete the loading of firmware; Step 107: coding parameter and FIFO threshold value are set; Step 108: check whether firmware loads correctly, remove interrupt flag bit, enable DFTH interrupts; Step 109: judge that whether IRQ pin is effective, continue test if not, otherwise go to step 110; Step 110: second time judges that whether IRQ pin is effective, if effectively, go to step 111; Otherwise go to step 112; Step 111: last byte is read out FIFO; Step 112: read coding FIFO, empty flag bit, go to step 109.
Particularly, described transfer of data comprises the following steps: step 21: application program sends request by DeviceIOControl interface to the IO manager of operating system; Step 22:IO manager according to this request structure IRP, and will pass to corresponding Device Object; Step 23: queue up in the corresponding DMA request queue of device object according to device id and FIFO ID; After step 24:DMA IRP dequeue, process in corresponding DMA thread; Request result is returned application program by step 25:IO manager.
Particularly, the processing procedure of described step 24 comprises: application DMA passage; Prepare Scatter-GatherList; Order dma controller starts DMA transmission; DMA is transmitted, and dma controller produces and interrupts, and driver handles is interrupted, and notifies IO manager successful operation; If do not receive this interruption within a certain period of time, then driver returns overtime failure code to IO management.
Compared with prior art, the high definition decoding middleware system of intelligent television provided by the present invention and coding/decoding method, its high definition decoding middleware comprises decoding driver module and SDK interface module, traditional decoding task can not only be competent at, and carry SDK for upper layer application, be beneficial to upper layer application simple, develop fast and flexibly.By adopting the form of middleware, the video decode driver be closely related with graphic chips being encapsulated, exploitation SDK interface is provided; Make module be easier to transplant, simultaneously for upper layer application provides simple and fast and development interface flexibly, standard operation flow process, for customization program is provided convenience.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making other embodiments all obtained under creative work prerequisite, belong to the scope of protection of the invention.
With reference to figure 1, the invention provides a kind of high definition decoding middleware system of intelligent television, comprise software application layer, hardware layer and high definition decoding middleware, described high definition decoding middleware is between software application layer and hardware layer, described high definition decoding middleware provides service interface for software application layer and manages and access hardware layer, described high definition decoding middleware comprises decoding driver module and SDK interface module, described decoding driver module is used for the program of hardware controls, and described SDK interface module provides external routine interface.
With reference to figure 2, present invention also offers a kind of coding/decoding method of high definition decoding middleware system of intelligent television, comprise the following steps:
S001: system initialization, the control inerface of software application layer calls SDK interface, and the function call driving function of SDK carries out initialization, return state information after Initialize installation success;
S002: transfer of data, first writes data to the buffer stopper in internal memory, then applies for DMA passage;
S003: after data are judged, data are transferred to video card by DMA;
S004: video card carries out decompression processing to data, then plays.
With reference to figure 3, software application layer uses decoding to drive, and is also video drive, and the application program of software application layer is as follows to the operating system of hardware layer, the access of resource, control flow:
Step1: application program sends I/O request, and now application program is in user model.Program one is being divided into user model and kernel mode, and general application is in user model, and system kernel, driving supervisor are in kernel mode; The authority of the two is different;
Step2: operating system I/O manager receives the I/O operation requests of application program, identifies the resource of this application request, then searches corresponding driver, carries out IR interruption;
Step3: decoding drives takes over execution authority from interruption, to access accordingly and controls, then result returned according to the request of application to hardware resource;
This execution result is returned to application program by Step4: operating system I/O manager further, terminates.
With reference to figure 4, decoding driving will work, and must carry out initialization, the work mainly completed has: configuration internal register, the firmware of loading required for coding mode, loading coding parameter, operation firmware program.Concrete steps comprise:
Step 101: reset, carried out the reset of chip by the reset position of the system register CTRL_REG of the structure in control FPGA;
Step 102: internal clocking is set, internal clocking is used for timing or counting, and the setting of internal clocking is very necessary on the control circuitry, and it is also the key realizing upper strata cyclic program;
Step 103: wait for PLL locking, if the setting in PLL register has been changed, then must have the time delay of at least 20us, to ensure that PLL relocks after changing setting;
Step 104: enter non-load host mode, enters non-load host mode Boot pattern and is set to non-load host mode, and under this pattern, DSP can all internal registers of accessing video chip;
Step 105: loading firmware;
Step 106: enter coprocessor Boot pattern, association's tupe and non-load host mode collaborative work, complete the loading of firmware;
Step 107: coding parameter and FIFO threshold value are set;
Step 108: check whether firmware loads correctly, remove interrupt flag bit, enable DFTH interrupts;
Step 109: judge that whether IRQ pin is effective, continue test if not, otherwise go to step 110;
Step 110: second time judges that whether IRQ pin is effective, if effectively, go to step 111; Otherwise go to step 112;
Step 111: last byte is read out FIFO;
Step 112: read coding FIFO, empty flag bit, go to step 109.
Upon initialization, transmission data and order are carried out in decoding driving, for application service.Mainly comprise two kinds, one is common apparatus method; One is DMA method.The former is applicable to most hardware platform, and the latter can utilize the platform possessing DMA passage to provide the transfer of data of high speed more.
With reference to figure 5, application program asks to send request to the I/O manager of operating system by I/O; Manager is asked to device object by IR object; In device object, task is distributed, by request forward to corresponding equipment control function by task distribution function Dispatch; Equipment control function carries out equipment control to hardware resource, finally successively returns execution result again.
With reference to figure 6, particularly, described transfer of data comprises the following steps:
Step 21: application program sends request by DeviceIOControl interface to the IO manager of operating system;
Step 22:IO manager according to this request structure IRP, and will pass to corresponding DeviceObject;
Step 23: queue up in the corresponding DMA request queue of device object according to device id and FIFO ID;
After step 24:DMA IRP dequeue, process in corresponding DMA thread; Request result is returned application program by step 25:IO manager.
Particularly, the processing procedure of described step 24 mainly comprises: application DMA passage; Prepare Scatter-GatherList; Order dma controller starts DMA transmission; DMA is transmitted, and dma controller produces and interrupts, and driver handles is interrupted, and notifies IO manager successful operation; If do not receive this interruption within a certain period of time, then driver returns overtime failure code to IO management.
SDK interface module is an encapsulation to first floor system, for upper layer application provides a simple interface and flow process.Graph Control interface, is generally the control inerface of application program, has carried out the access to first floor system by video SDK; SDK comprises decoding initialization according to the flow process controlled, buffer memory, files loading, decompress(ion), process terminate to reclaim several module.With reference to figure 7, this flow process comprises the following steps:
Step1: initialization.Major function is startup board, loads and enable file, starts DMA decoding thread etc.;
Step2: cache test and distribution.Whether test buffer memory has vacant position, and returns true as having vacant position, otherwise false, and can buffer memory be distributed;
Step3: files loading, reads internal memory by file from disk;
Step4: decompress(ion).Data are carried out decompress(ion) preliminary treatment; Then by the control of video drive to video card, by video card, decompress(ion) is carried out to data;
Step5: decompress(ion) is complete, terminates process, release buffer memory, closing device.
Compared with prior art, the high definition decoding middleware system of intelligent television provided by the present invention and coding/decoding method, its high definition decoding middleware comprises decoding driver module and SDK interface module, traditional decoding task can not only be competent at, and carry SDK for upper layer application, be beneficial to upper layer application simple, develop fast and flexibly.By adopting the form of middleware, the video decode driver be closely related with graphic chips being encapsulated, exploitation SDK interface is provided; Make module be easier to transplant, simultaneously for upper layer application provides simple and fast and development interface flexibly, standard operation flow process, for customization program is provided convenience.In addition, in application communicates with the driving of middleware, common apparatus method is adopted to be easy to transplant on different hardware platforms; Adopt dma mode then greatly to accelerate the transmission speed of data, two kinds of methods respectively get advantage, not only maintain transplantability and also maintain treatment effeciency.
Above to the high definition decoding middleware system of a kind of intelligent television that the embodiment of the present invention provides, be described in detail, apply specific case herein to set forth principle of the present invention and execution mode, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.