CN107911700B - Virtualization-based hardware decoding method, decoding equipment and storage medium - Google Patents

Virtualization-based hardware decoding method, decoding equipment and storage medium Download PDF

Info

Publication number
CN107911700B
CN107911700B CN201711062609.1A CN201711062609A CN107911700B CN 107911700 B CN107911700 B CN 107911700B CN 201711062609 A CN201711062609 A CN 201711062609A CN 107911700 B CN107911700 B CN 107911700B
Authority
CN
China
Prior art keywords
operating system
decoding
video data
decoded
hardware decoding
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711062609.1A
Other languages
Chinese (zh)
Other versions
CN107911700A (en
Inventor
向再辉
郭炳梁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sangfor Technologies Co Ltd
Original Assignee
Sangfor Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sangfor Technologies Co Ltd filed Critical Sangfor Technologies Co Ltd
Priority to CN201711062609.1A priority Critical patent/CN107911700B/en
Publication of CN107911700A publication Critical patent/CN107911700A/en
Application granted granted Critical
Publication of CN107911700B publication Critical patent/CN107911700B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation

Abstract

The invention discloses a hardware decoding method, decoding equipment and a storage medium based on virtualization. The method comprises the steps of obtaining video data to be decoded in a first operating system, wherein the first operating system is an operating system of a virtual machine, intercepting the video data to be decoded in the first operating system through a preset hook program, sending the video data to be decoded to a second operating system, the second operating system is an operating system of a host, and decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data. According to the invention, the video data to be decoded in the first operating system is forwarded to the second operating system to call the GPU for decoding, so that the problem of overlarge CPU load caused by decoding through the CPU is solved, and the technical problem of overlarge running load of physical equipment when the virtual machine performs video decoding in the prior art is solved.

Description

Virtualization-based hardware decoding method, decoding equipment and storage medium
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a hardware decoding method, a hardware decoding device, and a hardware decoding storage medium based on virtualization.
Background
There are two ways for the current physical machine to implement video decoding, namely software decoding and hardware decoding. The software decoding means that the video client performs video decoding by using a Central Processing Unit (CPU) in a manner of calling a graphic decoding interface; the hardware decoding refers to that the video client calls a video hardware acceleration (DXVA) decoding interface to perform video decoding by using a Graphics Processing Unit (GPU). Obviously, from the viewpoint of reducing the performance burden of the CPU, hardware decoding is a more preferable decoding manner.
However, in the above-mentioned manner of performing video decoding by using a physical machine, when performing video decoding in a virtualized scene, there are two main decoding schemes currently, namely, a graphics card direct connection and a virtual graphics processing unit (vGPU) technology, where the vGPU technology is virtualization for a GPU. The video card direct connection means that a GPU in a physical machine penetrates into a virtual machine for decoding work through a VFIO technology, wherein the VFIO is a set of user state driving framework; the vGPU technology is that a display card in one physical machine is divided into a plurality of virtual display cards under the support of a manufacturer, and penetration is performed through the VFIO technology.
Compared with two video decoding solutions in a virtual scene, the advantage of the video card direct connection is that the video card direct connection can approach the highest performance of a physical video card, but is limited by a Peripheral Component Interconnect (PCI) slot and cost limitation in a physical machine, and a single server can only be inserted with 2 video cards at most, that is, only 2 to 8 users can be supported; the advantage of the vGPU is that it approximates the access performance of a real graphics card and has better compatibility, but the current market environment uses the vGPU at a higher cost, and different vendors or different types of vGPU technology may not be able to support hardware decoding acceleration. Therefore, video decoding is performed in a virtualized scene, and the most common processing method applied in the market at present still uses a virtual graphics card to perform software decoding, that is, calls a CPU to perform decoding, specifically, when multiple paths of high-definition network monitoring videos are played in a virtual machine, since the virtual graphics card needs to be used to perform decoding, the CPU occupancy rate of the virtual machine is high, and the performance and the use experience of the virtual machine are greatly affected, so that the virtual machine has the technical problem of excessive running burden of physical equipment when performing video decoding.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a hardware decoding method, decoding equipment and a storage medium based on virtualization, and aims to solve the technical problem that in the prior art, the running load of physical equipment is overlarge when a virtual machine performs video decoding.
In order to achieve the above object, the present invention provides a virtualization-based hardware decoding method, including the following steps:
acquiring video data to be decoded in a first operating system, wherein the first operating system is an operating system of a virtual machine;
intercepting the video data to be decoded in the first operating system through a preset hook program, and sending the video data to be decoded to a second operating system, wherein the second operating system is an operating system of a host machine, and the virtual machine runs in the host machine;
and decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data.
Preferably, before the video data to be decoded is acquired in the first operating system, the method further comprises:
responding to a hardware decoding instruction input by a user in the first operating system, and finding out the stored attribute information of the display card according to the hardware decoding instruction;
matching the attribute information of the display card with the attribute information of each preset display card in the first operating system;
and when the matching is successful, executing the step of acquiring the video data to be decoded in the first operating system.
Preferably, before the responding to a hardware decoding instruction input by a user in the first operating system and finding the stored attribute information of the display card according to the hardware decoding instruction, the method further includes:
acquiring a preset display card information instruction in the first operating system, and sending the preset display card information instruction to the second operating system to acquire display card attribute information of the host machine;
and feeding back the attribute information of the display card to the first operating system in the second operating system, and storing the attribute information of the display card to the first operating system.
Preferably, the finding, in response to a hardware decoding instruction input by a user in the first operating system, the stored attribute information of the display card according to the hardware decoding instruction specifically includes:
in the first operating system, responding to a hardware decoding instruction input by a user, and extracting a current decoding identifier from the hardware decoding instruction;
judging whether the current decoding identifier is a preset decoding identifier in the first operating system;
and finding the stored attribute information of the display card according to the hardware decoding instruction when the current decoding identifier is the preset decoding identifier in the first operating system.
Preferably, after the video data to be decoded is decoded in the second operating system to obtain corresponding decoded video data, the method further includes:
sending the decoded video data in the second operating system to the first operating system;
and rendering the decoded video data in the first operating system to realize the display of the video.
Preferably, the sending the video data to be decoded to a second operating system specifically includes:
and storing the video data to be decoded in a preset shared memory space, wherein the preset shared memory space is shared by the first operating system and the second operating system.
Preferably, the decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data specifically includes:
and calling a preset hardware decoding API in the second operating system to decode the video data to be decoded so as to obtain corresponding decoded video data.
Preferably, the decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data specifically includes:
creating a corresponding decoder in the second operating system according to a preset decoder configuration;
and decoding the video data to be decoded in the second operating system through the decoder to obtain corresponding decoded video data.
Further, to achieve the above object, the present invention also provides a decoding apparatus comprising: a microphone, a memory, a processor, and a virtualization-based hardware decoding program stored on the memory and executable on the processor, the virtualization-based hardware decoding program configured to implement the steps of the virtualization-based hardware decoding method.
In addition, to achieve the above object, the present invention further provides a storage medium having a virtualization-based hardware decoding program stored thereon, wherein the virtualization-based hardware decoding program implements the steps of the virtualization-based hardware decoding method when executed by a processor.
According to the invention, the video data to be decoded in the first operating system is forwarded to the second operating system to call the GPU for decoding, so that the problem of overlarge CPU load caused by decoding through the CPU is solved, and the technical problem of overlarge running load of physical equipment when the virtual machine performs video decoding in the prior art is solved.
Drawings
FIG. 1 is a schematic diagram of a decoding device in a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of a virtualization-based hardware decoding method according to the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of a virtualization-based hardware decoding method according to the present invention;
FIG. 4 is a flowchart illustrating a third embodiment of a virtualization-based hardware decoding method according to the present invention;
FIG. 5 is a flowchart illustrating a fourth exemplary embodiment of a virtualization-based hardware decoding method according to the present invention;
FIG. 6 is a flowchart illustrating a fifth embodiment of a virtualization-based hardware decoding method according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a decoding device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the decoding apparatus may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), and the optional user interface 1003 may further include a standard wired interface and a wireless interface, and the wired interface for the user interface 1003 may be a USB interface in the present invention. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
The decoding device can be an electronic device such as a personal computer or a server.
Those skilled in the art will appreciate that the architecture shown in fig. 1 does not constitute a limitation of the decoding device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a virtualization-based hardware decoding program.
In the decoding device shown in fig. 1, the network interface 1004 is mainly used for connecting to a background server and performing data communication with the background server; the user interface 1003 is mainly used for connecting peripheral equipment; the decoding apparatus calls, by the processor 1001, a virtualization-based hardware decoding program stored in the memory 1005, and performs the following operations:
acquiring video data to be decoded in a first operating system, wherein the first operating system is an operating system of a virtual machine;
intercepting the video data to be decoded in the first operating system through a preset hook program, and sending the video data to be decoded to a second operating system, wherein the second operating system is an operating system of a host machine, and the virtual machine runs in the host machine;
and decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data.
Further, the processor 1001 may call a virtualization based hardware decoding program stored in the memory 1005, and also perform the following operations:
responding to a hardware decoding instruction input by a user in the first operating system, and finding out the stored attribute information of the display card according to the hardware decoding instruction;
matching the attribute information of the display card with the attribute information of each preset display card in the first operating system;
and when the matching is successful, executing the step of acquiring the video data to be decoded in the first operating system.
Further, the processor 1001 may call a virtualization based hardware decoding program stored in the memory 1005, and also perform the following operations:
acquiring a preset display card information instruction in the first operating system, and sending the preset display card information instruction to the second operating system to acquire display card attribute information of the host machine;
and feeding back the attribute information of the display card to the first operating system in the second operating system, and storing the attribute information of the display card to the first operating system.
Further, the processor 1001 may call a virtualization based hardware decoding program stored in the memory 1005, and also perform the following operations:
in the first operating system, responding to a hardware decoding instruction input by a user, and extracting a current decoding identifier from the hardware decoding instruction;
judging whether the current decoding identifier is a preset decoding identifier in the first operating system;
and finding the stored attribute information of the display card according to the hardware decoding instruction when the current decoding identifier is the preset decoding identifier in the first operating system.
Further, the processor 1001 may call a virtualization based hardware decoding program stored in the memory 1005, and also perform the following operations:
sending the decoded video data in the second operating system to the first operating system;
and rendering the decoded video data in the first operating system to realize the display of the video.
Further, the processor 1001 may call a virtualization based hardware decoding program stored in the memory 1005, and also perform the following operations:
and storing the video data to be decoded in a preset shared memory space, wherein the preset shared memory space is shared by the first operating system and the second operating system.
Further, the processor 1001 may call a virtualization based hardware decoding program stored in the memory 1005, and also perform the following operations:
and calling a preset hardware decoding API in the second operating system to decode the video data to be decoded so as to obtain corresponding decoded video data.
Further, the processor 1001 may call a virtualization based hardware decoding program stored in the memory 1005, and also perform the following operations:
creating a corresponding decoder in the second operating system according to a preset decoder configuration;
and decoding the video data to be decoded in the second operating system through the decoder to obtain corresponding decoded video data.
In the embodiment, the video data to be decoded in the first operating system is forwarded to the second operating system to call the GPU for decoding, so that the problem of overlarge CPU load caused by decoding through the CPU is solved, and the technical problem of overlarge running load of physical equipment when the virtual machine performs video decoding in the prior art is solved.
Based on the hardware structure, the embodiment of the hardware decoding method based on virtualization is provided.
Referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of a virtualization-based hardware decoding method according to the present invention.
In a first embodiment, the virtualization-based hardware decoding method comprises the steps of:
step S10: acquiring video data to be decoded in a first operating system, wherein the first operating system is an operating system of a virtual machine;
it is understood that a physical machine can be virtualized into a plurality of logical computers through virtualization technology, wherein the virtualized logical computers can be referred to as virtual machines, and the physical machines can be referred to as hosts. The Operating System run by the virtual machine may be different from the Operating System run by the host, for example, the virtual machine may run a community enterprise Operating System (centros), that is, a first Operating System, and the host may run a Windows Operating System, that is, a second Operating System.
Step S20: intercepting the video data to be decoded in the first operating system through a preset hook program, and sending the video data to be decoded to a second operating system, wherein the second operating system is an operating system of a host machine, and the virtual machine runs in the host machine;
in the specific implementation, when a video client is opened in a virtual machine to play video, the played video needs to be decoded, in order to improve the decoding efficiency and avoid an excessive CPU operation load caused by decoding by using a CPU, video data to be decoded can be sent to a second operating system from a first operating system, and the second operating system calls a GPU for decoding, so that a decoding mode that the video data are decoded by the GPU in a virtualized scene is realized. For a specific implementation manner, the video data to be decoded in the first operating system may be sent to the second operating system through a preset Hook program, where the Hook program (Hook) is used to monitor a specified message, and when the specified message arrives, before a target processing function corresponding to the message processes the message, the Hook program preferentially processes the specified message, so that the Hook program implements processing on the message in the middle of message delivery, and of course, the Hook program may also end message delivery in the middle. In this embodiment, the preset hook program forwards the video data to be decoded in the transmission to the second operating system through the hook DXVA decoding interface when acquiring the specified video data to be decoded.
Step S30: and decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data.
It can be understood that, after the second operating system acquires the video data to be decoded, since the second operating system is an operating system of the host machine, which is different from the virtual machine, the host machine can directly call the GPU for decoding, and then can call the GPU for decoding the video data to be decoded, thereby implementing the technical scheme of decoding the video data to be decoded through the GPU in the virtualized scene. In addition, because the decoding is carried out through the hardware GPU, the characteristics of the physical equipment are fully utilized, and the utilization rate of the CPU of the virtual machine can be well reduced.
In the embodiment, the video data to be decoded in the first operating system is forwarded to the second operating system to call the GPU for decoding, so that the problem of overlarge CPU load caused by decoding through the CPU is solved, and the technical problem of overlarge running load of physical equipment when the virtual machine performs video decoding in the prior art is solved.
Referring to fig. 3, fig. 3 is a flowchart illustrating a second embodiment of the virtualization-based hardware decoding method according to the present invention, and the second embodiment of the virtualization-based hardware decoding method according to the present invention is proposed based on the embodiment shown in fig. 2.
In the second embodiment, before the step S10, the method further includes:
step S101: responding to a hardware decoding instruction input by a user in the first operating system, and finding out the stored attribute information of the display card according to the hardware decoding instruction;
it can be understood that, during video monitoring, if the video decoding is performed through the steps in the first embodiment of the hardware decoding method based on virtualization, before the video decoding, the physical characteristics of the host may be determined, and whether the performance of the host supports the current video decoding operation may be determined.
In a specific implementation, when a user starts a video monitoring client in a virtual machine, stored attribute information of a graphics card is searched in the virtual machine, where the attribute information of the graphics card is physical attribute information of a GPU, such as frequency, bandwidth, and DXVA hard-decoding capability level of the graphics card, and is used to describe the operation capability of the GPU. The display card attribute information can be acquired before a user starts a video monitoring client to decode video, or when the user starts the video monitoring client, the host is requested to acquire and store the attribute information of the hardware GPU, so that the display card attribute information can be quickly determined during use, and repeated acquisition during each decoding is not needed.
Step S102: matching the attribute information of the display card with the attribute information of each preset display card in the first operating system;
it should be appreciated that because of differences in the physical performance of different GPUs and the decoding capabilities that can be provided, the decoding capabilities of the current GPU will be determined prior to decoding. For example, the attribute information of the graphics card stored in the virtual machine is acquired, and the attribute information of the graphics card is matched with the attribute information of the preset graphics card to determine whether to perform a decoding operation. For example, if the graphics card attribute information of the GPU stored in the virtual machine includes DXVA2_ ModeH264_ E (DXVA2_ ModeH264_ VLD _ NoFGT), i.e. level E, which is a level of decoding acceleration capability of the graphics card, the preset graphics card attribute information is set as DXVA2_ ModeH264_ B (DXVA2_ ModeH264_ MoComp _ FGT), i.e. level B, in consideration of the overall load of the physical machine, and the capability of decoding h.264 is divided into 6 levels from a to F, where a is the lowest and F is the highest. Of course, since the decoding condition is satisfied even if the capability level is higher than level a of level B, the preset graphic card attribute information may include level a and level B. Therefore, the found real display card attribute information of the physical machine, namely the grade E, is matched with the preset display card attribute information, and the matching is unsuccessful, which indicates that the performance of the GPU in the existing physical machine does not meet the preset decoding requirement, and can prompt a user that the decoding fails or prompt the GPU not to support the current operation.
When the matching is successful, step S10 is executed.
In order to obtain and store the display card attribute information in advance, before step S101, the method further includes:
step S1011: acquiring a preset display card information instruction in the first operating system, and sending the preset display card information instruction to the second operating system to acquire display card attribute information of the host machine;
it can be understood that, because the virtual machine does not have a real physical GPU, it is unable to directly call a DXVA interface of the GPU to perform hardware decoding, so when implementing the first embodiment and the second embodiment, a virtual machine agent layer is added in the Virtual Machine (VM), the virtual machine agent layer may be called a VM agent, information communication between the virtual machine and the host machine will use the VM agent as a relay for information interaction, including steps of packaging and forwarding video data to be decoded to the host machine from the virtual machine, and the video data will be sent to the VM agent first, and then forwarded to the host machine from the VM agent. The VM agent simulates attribute information of a GPU (graphics processing Unit) of host hardware in a hooking mode so as to realize operation simulation of a video decoding process.
In a specific implementation, when the virtual machine acquires video data to be decoded, the display card attribute information is acquired first, and when the display card attribute information is not stored in the virtual machine, the virtual machine can request the host machine for the display card attribute information.
Step S1012: and feeding back the attribute information of the display card to the first operating system in the second operating system, and storing the attribute information of the display card to the first operating system.
It should be understood that after the graphics card attribute information is acquired from the host, the graphics card attribute information may be stored locally in the virtual machine, so as to facilitate the judgment of the decoding capability of the physical machine according to the graphics card attribute information in the subsequent operation. The acquired attribute information of the display card can be stored in a VM (virtual machine) agent in the virtual machine.
In the embodiment, the physical attribute information of the GPU is matched with the attribute information required by the decoding operation to judge whether the performance of the physical machine meets the decoding requirement; meanwhile, the virtual machine can request the attribute information of the display card from the host machine and store the fed back attribute information of the display card to the local of the virtual machine, so that the attribute information of the display card can be directly obtained from the local to judge the decoding performance when the decoding operation is carried out, and the decoding efficiency is improved.
Referring to fig. 4, fig. 4 is a flowchart illustrating a third embodiment of the virtualization-based hardware decoding method according to the present invention, and the third embodiment of the virtualization-based hardware decoding method according to the present invention is proposed based on the embodiment shown in fig. 3.
In a third embodiment, the step S101 specifically includes:
step S1011': in the first operating system, responding to a hardware decoding instruction input by a user, and extracting a current decoding identifier from the hardware decoding instruction;
it can be understood that, in order to make the use of the user more flexible, the user can freely select whether to start the decoding mode of the virtual machine for video decoding by the GPU. For example, when a user starts a video monitoring client in a virtual machine, the user may set the option of GPU hardware decoding to an on state, so that the current decoding identifier extracted from the hardware decoding instruction generated by the user operation indicates that GPU hardware decoding is started.
Step S1012': judging whether the current decoding identifier is a preset decoding identifier in the first operating system;
in a specific implementation, if the current decoding identifier is a decoding identifier indicating that the hardware decoding function of the GPU is started, the attribute information of the display card stored in the virtual machine is searched for subsequent operations, and a hardware decoding process is implemented by the GPU.
Step S1013': and finding the stored attribute information of the display card according to the hardware decoding instruction when the current decoding identifier is the preset decoding identifier in the first operating system.
In this embodiment, through the step of determining the preset decoding identifier, the current user may be given the right to start the GPU hardware decoding function, so that the user may perform the decoding operation flexibly.
Referring to fig. 5, fig. 5 is a flowchart illustrating a fourth embodiment of the virtualization-based hardware decoding method according to the present invention, and the fourth embodiment of the virtualization-based hardware decoding method according to the present invention is proposed based on the embodiment shown in fig. 2.
In the fourth embodiment, after the step S30, the method further includes:
step S40: sending the decoded video data in the second operating system to the first operating system;
it is to be understood that after the second operating system completes video decoding, in order to enable a user to directly view the decoded video in the virtual machine, the decoded video data in the second operating system that completes video decoding may be transmitted back to the virtual machine.
Step S50: and rendering the decoded video data in the first operating system to realize the display of the video.
It should be understood that after the virtual machine acquires the decoded video data, the rendering process of the video is performed, so that the user can directly view the video in the video client.
Further, in order to reduce the data transmission amount between the virtual machine and the host in the video decoding process, the video data to be decoded may be stored in a preset shared memory space, where the preset shared memory space is shared by the first operating system and the second operating system.
It can be understood that, by storing the video data to be decoded in the shared memory space, there is no data transmission process when the step of sending the video data to be decoded from the first operating system to the second operating system is actually executed, because the memory location where the video data is stored is shared by the first operating system and the second operating system, the step of sending the video data to the second operating system is substantially converted into sending the data storage location to the second operating system, which can greatly reduce the data transmission amount and improve the video decoding efficiency. Of course, the decoded video data may also be stored in the predetermined shared memory space.
Further, in order to improve the efficiency of video decoding, the decoding the video data to be decoded in the second operating system to obtain the corresponding decoded video data may specifically include calling a preset hardware decoding Application Programming Interface (API) in the second operating system to decode the video data to be decoded to obtain the corresponding decoded video data.
It can be understood that, when the host performs hardware decoding through the GPU, the host may call a preset hardware decoding API to perform decoding operation. The preset hardware decoding API can be a DXVA interface and the like, and the video is decoded by hooking the DXVA interface, so that the performance and efficiency of video decoding can be better improved.
In this embodiment, the decoded video data in the host machine is fed back to the virtual machine, so that the virtual machine can perform video playing operation conveniently.
Referring to fig. 6, fig. 6 is a flowchart illustrating a fifth embodiment of the virtualization-based hardware decoding method according to the present invention, and the fifth embodiment of the virtualization-based hardware decoding method according to the present invention is proposed based on the embodiment shown in fig. 2.
In a fifth embodiment, the step S30 specifically includes:
step S301: creating a corresponding decoder in the second operating system according to a preset decoder configuration;
it can be understood that the specific flow of video decoding is to create a decoder according to a preset decoder configuration for video decoding, and of course, the decoder configuration may also be customized.
Step S302: and decoding the video data to be decoded in the second operating system through the decoder to obtain corresponding decoded video data.
In the specific implementation, the decoder decodes the BeginFrame method, and in the decoding process, cache data of the DXVA decoder can be acquired through GetBuffer to fill the cache, and the cache data is released through ReleaseBuffer. When the data processing is finished, executing decoding, and finishing decoding by the EndFrame, namely finishing decoding the video data to be decoded to generate corresponding decoded video data; and when the data processing is judged to be not finished, executing GetBuffer again to acquire the cache data of the DXVA decoder until the data processing is judged to be finished.
Of course, when decoding is finished, the created decoder is deleted and is re-created when decoding is next time.
In the embodiment, the video decoding is performed through the above steps, so that the efficiency of video decoding can be better improved.
In addition, an embodiment of the present invention further provides a storage medium, where a virtualization-based hardware decoding program is stored on the storage medium, and when executed by a processor, the virtualization-based hardware decoding program implements the following operations:
acquiring video data to be decoded in a first operating system, wherein the first operating system is an operating system of a virtual machine;
intercepting the video data to be decoded in the first operating system through a preset hook program, and sending the video data to be decoded to a second operating system, wherein the second operating system is an operating system of a host machine, and the virtual machine runs in the host machine;
and decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data.
Further, the virtualization-based hardware decoding program when executed by the processor further implements operations comprising:
responding to a hardware decoding instruction input by a user in the first operating system, and finding out the stored attribute information of the display card according to the hardware decoding instruction;
matching the attribute information of the display card with the attribute information of each preset display card in the first operating system;
and when the matching is successful, executing the step of acquiring the video data to be decoded in the first operating system.
Further, the virtualization-based hardware decoding program when executed by the processor further implements operations comprising:
acquiring a preset display card information instruction in the first operating system, and sending the preset display card information instruction to the second operating system to acquire display card attribute information of the host machine;
and feeding back the attribute information of the display card to the first operating system in the second operating system, and storing the attribute information of the display card to the first operating system.
Further, the virtualization-based hardware decoding program when executed by the processor further implements operations comprising:
in the first operating system, responding to a hardware decoding instruction input by a user, and extracting a current decoding identifier from the hardware decoding instruction;
judging whether the current decoding identifier is a preset decoding identifier in the first operating system;
and finding the stored attribute information of the display card according to the hardware decoding instruction when the current decoding identifier is the preset decoding identifier in the first operating system.
Further, the virtualization-based hardware decoding program when executed by the processor further implements operations comprising:
sending the decoded video data in the second operating system to the first operating system;
and rendering the decoded video data in the first operating system to realize the display of the video.
Further, the virtualization-based hardware decoding program when executed by the processor further implements operations comprising:
and storing the video data to be decoded in a preset shared memory space, wherein the preset shared memory space is shared by the first operating system and the second operating system.
Further, the virtualization-based hardware decoding program when executed by the processor further implements operations comprising:
and calling a preset hardware decoding API in the second operating system to decode the video data to be decoded so as to obtain corresponding decoded video data.
Further, the virtualization-based hardware decoding program when executed by the processor further implements operations comprising:
creating a corresponding decoder in the second operating system according to a preset decoder configuration;
and decoding the video data to be decoded in the second operating system through the decoder to obtain corresponding decoded video data.
In the embodiment, the video data to be decoded in the first operating system is forwarded to the second operating system to call the GPU for decoding, so that the problem of overlarge CPU load caused by decoding through the CPU is solved, and the technical problem of overlarge running load of physical equipment when the virtual machine performs video decoding in the prior art is solved.
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments. The use of the words first, second, third, etc. do not denote any order, but rather the words are to be interpreted as names.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a decoding device, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (9)

1. A virtualization-based hardware decoding method, comprising:
acquiring video data to be decoded in a first operating system, wherein the first operating system is an operating system of a virtual machine;
intercepting the video data to be decoded in the first operating system through a preset hook program, and sending the video data to be decoded to a second operating system, wherein the second operating system is an operating system of a host machine, and the virtual machine runs in the host machine;
decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data;
wherein, before the video data to be decoded is acquired in the first operating system, the method further comprises:
in response to a hardware decoding instruction input by a user in the first operating system, finding stored attribute information of a display card according to the hardware decoding instruction, wherein the attribute information of the display card is physical attribute information of a GPU of a host;
matching the attribute information of the display card with the attribute information of each preset display card in the first operating system;
and when the matching is successful, executing the step of acquiring the video data to be decoded in the first operating system.
2. The virtualization-based hardware decoding method as claimed in claim 1, wherein, in response to a hardware decoding instruction input by a user in the first operating system, before finding the saved attribute information of the graphics card according to the hardware decoding instruction, the method further comprises:
acquiring a preset display card information instruction in the first operating system, and sending the preset display card information instruction to the second operating system to acquire display card attribute information of the host machine;
and feeding back the attribute information of the display card to the first operating system in the second operating system, and storing the attribute information of the display card to the first operating system.
3. The virtualization-based hardware decoding method of claim 1, wherein the finding the stored attribute information of the graphics card according to the hardware decoding instruction in response to the hardware decoding instruction input by the user in the first operating system specifically includes:
in the first operating system, responding to a hardware decoding instruction input by a user, and extracting a current decoding identifier from the hardware decoding instruction;
judging whether the current decoding identifier is a preset decoding identifier in the first operating system;
and finding the stored attribute information of the display card according to the hardware decoding instruction when the current decoding identifier is the preset decoding identifier in the first operating system.
4. The virtualization-based hardware decoding method of any one of claims 1 to 3 wherein, after decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data, the method further comprises:
sending the decoded video data in the second operating system to the first operating system;
and rendering the decoded video data in the first operating system to realize the display of the video.
5. The virtualization-based hardware decoding method according to any one of claims 1 to 3, wherein the sending the video data to be decoded to a second operating system specifically includes:
and storing the video data to be decoded in a preset shared memory space, wherein the preset shared memory space is shared by the first operating system and the second operating system.
6. The virtualization-based hardware decoding method of any one of claims 1 to 3, wherein the decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data specifically comprises:
and calling a preset hardware decoding API in the second operating system to decode the video data to be decoded so as to obtain corresponding decoded video data.
7. The virtualization-based hardware decoding method of any one of claims 1 to 3, wherein the decoding the video data to be decoded in the second operating system to obtain corresponding decoded video data specifically comprises:
creating a corresponding decoder in the second operating system according to a preset decoder configuration;
and decoding the video data to be decoded in the second operating system through the decoder to obtain corresponding decoded video data.
8. A decoding device, characterized in that the decoding device comprises: memory, a processor and a virtualization based hardware decoding program stored on the memory and executable on the processor, the virtualization based hardware decoding program when executed by the processor implementing the steps of the virtualization based hardware decoding method of any of claims 1 to 7.
9. A storage medium, characterized in that the storage medium has stored thereon a virtualization-based hardware decoding program, which when executed by a processor implements the steps of the virtualization-based hardware decoding method according to any one of claims 1 to 7.
CN201711062609.1A 2017-10-31 2017-10-31 Virtualization-based hardware decoding method, decoding equipment and storage medium Active CN107911700B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711062609.1A CN107911700B (en) 2017-10-31 2017-10-31 Virtualization-based hardware decoding method, decoding equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711062609.1A CN107911700B (en) 2017-10-31 2017-10-31 Virtualization-based hardware decoding method, decoding equipment and storage medium

Publications (2)

Publication Number Publication Date
CN107911700A CN107911700A (en) 2018-04-13
CN107911700B true CN107911700B (en) 2020-07-03

Family

ID=61843180

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711062609.1A Active CN107911700B (en) 2017-10-31 2017-10-31 Virtualization-based hardware decoding method, decoding equipment and storage medium

Country Status (1)

Country Link
CN (1) CN107911700B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111381914B (en) * 2018-12-29 2021-07-30 中兴通讯股份有限公司 Method and system for realizing 3D (three-dimensional) capability of cloud desktop virtual machine
CN112905243B (en) * 2019-11-15 2022-05-13 成都鼎桥通信技术有限公司 Method and device for simultaneously operating double systems
CN115002087A (en) * 2022-05-31 2022-09-02 济南浪潮数据技术有限公司 Audio and video data transmission method, system, device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981887A (en) * 2011-09-06 2013-03-20 联想(北京)有限公司 Data processing method and electronic device
CN105791892A (en) * 2016-03-02 2016-07-20 汉柏科技有限公司 Video redirecting method based on desktop cloud, cloud server and video redirecting system
CN106797388A (en) * 2016-12-29 2017-05-31 深圳前海达闼云端智能科技有限公司 Cross-system multi-medium data decoding method, device, electronic equipment and computer program product
CN106888385A (en) * 2017-01-17 2017-06-23 武汉噢易云计算股份有限公司 Video broadcasting method and system of the client under virtualized environment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8281377B1 (en) * 2008-04-15 2012-10-02 Desktone, Inc. Remote access manager for virtual computing services

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981887A (en) * 2011-09-06 2013-03-20 联想(北京)有限公司 Data processing method and electronic device
CN105791892A (en) * 2016-03-02 2016-07-20 汉柏科技有限公司 Video redirecting method based on desktop cloud, cloud server and video redirecting system
CN106797388A (en) * 2016-12-29 2017-05-31 深圳前海达闼云端智能科技有限公司 Cross-system multi-medium data decoding method, device, electronic equipment and computer program product
CN106888385A (en) * 2017-01-17 2017-06-23 武汉噢易云计算股份有限公司 Video broadcasting method and system of the client under virtualized environment

Also Published As

Publication number Publication date
CN107911700A (en) 2018-04-13

Similar Documents

Publication Publication Date Title
US10049646B2 (en) Method and system for keyframe detection when executing an application in a cloud based system providing virtualized graphics processing to remote servers
CN107911700B (en) Virtualization-based hardware decoding method, decoding equipment and storage medium
US20170004808A1 (en) Method and system for capturing a frame buffer of a virtual machine in a gpu pass-through environment
EP2767905A1 (en) Terminal apparatus, server, browser of terminal apparatus operating system and method of operating browser
WO2014089793A1 (en) Method, device, and system for video redirection and computer readable medium
US10949226B2 (en) Display method of multi-application based on Android system, and terminal device
JP2015035997A (en) Server and method for providing game
CN113900754A (en) Desktop sharing method and device, computer equipment and storage medium
CN110764805A (en) Method, device, terminal and storage medium for noninductive upgrade of client
JP5411385B1 (en) Server and method for providing game
CN114003225A (en) Window display method and device, computer equipment and storage medium
CN112596852A (en) Graph display method, device and system, electronic equipment and storage medium
CN104836820A (en) Method and system for client interaction, and client terminals
JP5643449B1 (en) Server and method for displaying display screen on terminal device
CN114089896A (en) Rendering image intercepting method and device
CN110968383B (en) Message frame display method and device, terminal and storage medium
CN113434234A (en) Page jump method, device, computer readable storage medium and processor
CN110704157A (en) Application starting method, related device and medium
CN111491210A (en) Data processing method, device and system
CN114253649B (en) Image rendering method, device, equipment and readable storage medium
CN112328198B (en) Control method and device for graphic processor, display method and device for graphic processor, storage medium and electronic device
CN115826898B (en) Cross-screen display method, system, device, equipment and storage medium
CN109905759B (en) List display method, device, equipment and medium applied to Android client
CN112486624B (en) Display method of multiple virtual machine systems and physical machine
CN111013144B (en) Game picture drawing and rendering method and device and mobile terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant