WO2017096823A1 - 视频转码方法和装置系统 - Google Patents

视频转码方法和装置系统 Download PDF

Info

Publication number
WO2017096823A1
WO2017096823A1 PCT/CN2016/088713 CN2016088713W WO2017096823A1 WO 2017096823 A1 WO2017096823 A1 WO 2017096823A1 CN 2016088713 W CN2016088713 W CN 2016088713W WO 2017096823 A1 WO2017096823 A1 WO 2017096823A1
Authority
WO
WIPO (PCT)
Prior art keywords
decoding
code stream
input code
information
gpu
Prior art date
Application number
PCT/CN2016/088713
Other languages
English (en)
French (fr)
Inventor
吕超
魏伟
白茂生
Original Assignee
乐视控股(北京)有限公司
乐视云计算有限公司
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 乐视控股(北京)有限公司, 乐视云计算有限公司 filed Critical 乐视控股(北京)有限公司
Priority to US15/247,610 priority Critical patent/US20170163990A1/en
Publication of WO2017096823A1 publication Critical patent/WO2017096823A1/zh

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/40Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video transcoding, i.e. partial or full decoding of a coded input stream followed by re-encoding of the decoded output stream

Definitions

  • the invention belongs to the technical field of Internet video processing, and in particular to a video transcoding method, device and system.
  • the present invention provides a video transcoding method, apparatus, and system, which can utilize GPU decoding to save CPU resources, and perform code stream analysis on the decoded stream, thereby improving overall transcoding speed without affecting transcoding quality. , save transcoding CPU resources.
  • the invention also provides a video transcoding device.
  • Decoding the input code stream by using a graphics processor GPU to obtain a decoded input code stream;
  • the method Before using the graphics processor GPU to decode the input code stream, the method includes:
  • the macroblock information required for the encoding includes block type information Information required for encoding such as block mode information, motion vector information, block coding type information, quantization parameters, and macroblock residuals.
  • a decoding module located on the GPU side of the graphics processor, configured to decode the input code stream to obtain a decoded input code stream;
  • the encoding module is located on the CPU side of the central processing unit, and is configured to encode the decoded input code stream according to the target code rate according to the macroblock information required for the encoding.
  • An acquiring module configured to acquire decoding capability information of the GPU when the determining module determines that the GPU supports decoding of the input code stream;
  • the device further includes:
  • An initialization module configured to initialize a decoding parameter of the GPU according to a decoding interface corresponding to the decoding capability information, and allocate a memory space for the input code stream to be decoded, where the memory space is used to save the decoded device
  • the input code stream is described.
  • the analysis module is specifically configured to:
  • the macroblock information required for the encoding includes a block Information required for encoding such as type information, block mode information, motion vector information, block coding type information, quantization parameters, and macroblock residuals.
  • the invention also provides a video transcoding system, comprising: a decoder and an encoder;
  • the decoder is configured to decode an input code stream by using a graphics processor GPU to obtain a decoded input code stream;
  • the encoder is configured to analyze the decoded input code stream by using a central processing unit CPU to obtain macroblock information required for encoding; and use the central processing unit CPU to perform the macroblock information required by the encoding.
  • the decoded input code stream is encoded according to the target code rate.
  • the encoder is further configured to use the CPU to analyze header information of the decoded input code stream to obtain an entropy coding type, and perform entropy decoding on the decoded input code stream, and perform entropy decoding.
  • all the decoded residual information is discarded, and the macroblock information required for the encoding is recorded, wherein the macroblock information required for the encoding includes block type information, block mode information, motion vector information, block coding type information, The information required for encoding such as quantization parameters and macroblock residuals.
  • the present invention also provides a video transcoding device, including: a memory, a processor, wherein
  • the memory is configured to store one or more instructions, wherein the one or more instructions are for execution by the processor;
  • the processor is configured to decode the input code stream by using a graphics processor GPU to obtain a decoded input code stream; and use the central processing unit CPU to analyze the decoded input code stream to obtain macroblock information required for encoding. And decoding, by the central processing unit CPU, the decoded input code stream according to a target code rate according to the macroblock information required for the encoding.
  • the present invention can obtain the following technical effects:
  • the invention proposes a transcoding architecture based on GPU and CPU hybrid, which is mainly applied to transcoding schemes such as H.264 and HEVC.
  • the GPU decoding is used to save CPU resources, and the code stream analysis is performed on the decoding stream, which improves the overall transcoding speed and saves the transcoding CPU resources without affecting the transcoding quality.
  • the transcoding architecture can save 10% of CPU resources, thereby improving the transcoding speed and better meeting the real-time video transcoding requirements under the premise of ensuring the restored video quality.
  • FIG. 2 is a flowchart of a CPU+GPU hybrid transcoding architecture according to an embodiment of the present invention
  • FIG. 3 is a flowchart of completing video decoding on a GPU according to an embodiment of the present invention
  • FIG. 4 is a flowchart of completing code stream analysis on a CPU according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a video transcoding device according to an embodiment of the present invention.
  • the main idea of the present invention is to save CPU resources by using GPU decoding based on the GPU and CPU hybrid transcoding architecture, and perform code stream analysis on the decoded stream, thereby improving the overall transcoding speed and not saving the transcoding quality. Transcode CPU resources.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is an example of a computer readable medium.
  • Computer readable media includes both permanent and non-persistent, removable and non-removable media.
  • Information storage can be implemented by any method or technology.
  • the information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
  • computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
  • first device if a first device is coupled to a second device, the first device can be directly electrically coupled to the second device, or electrically coupled indirectly through other devices or coupling means. Connected to the second device.
  • Video decoding soft decoding
  • CPU Central Processing Unit
  • the invention proposes a new video transcoding system architecture, which is mainly applied to the conversion of various video formats such as H.264 and HEVC.
  • Traditional transcoding schemes are often based on the use of CPU resources.
  • CPU resources are often overloaded, which affects the transcoding speed.
  • the transcoding system architecture described in the embodiment of the present invention is characterized in that the video decoding work in the transcoding process is performed on a graphics processing unit (English: Graphics Processing Unit, GPU), and only the part of the decoding information analysis is placed.
  • the CPU computing resources are effectively alleviated by effectively utilizing GPU decoding, thereby improving the overall transcoding speed.
  • the transcoding scheme can save CPU resources and improve transcoding speed without affecting the quality of transcoding at all.
  • FIG. 1 is a schematic flowchart of a video transcoding method according to an embodiment of the present invention. As shown in FIG. 1, the method includes:
  • the method when the step 101 is specifically implemented, the method includes:
  • the decoded input code stream is saved to the allocated memory space.
  • the driver can query the decoding capability information of the GPU. After receiving the query instruction, the driver sends the decoding capability information of the GPU to the application, for example, the decoding capability information of the GPU includes DXVA_ModeH261_B. , DXVA_ModeH263_B, DXVA_ModeMPEG1_A, DXVA_ModeMPEG2_B, etc.
  • the application continues to query whether the GPU supports the decoding configuration information of the video to be decoded in the working mode corresponding to the decoding capability information, and if , indicating that the query result is that the GPU can support decoding of the video to be decoded. If the decoding capability information of the encoding format of the video to be decoded does not exist in the obtained decoding capability information, or the decoding configuration information of the video to be decoded is not supported by the GPU in this working mode, the query result is that the GPU cannot support the GPU. Decoding of the video to be decoded.
  • the decoding configuration information is only explained by resolution and code rate
  • the encoding format of a video is H261
  • the resolution is 1280 ⁇ 720
  • the code rate is 2000kbps
  • the GPU supports the working mode of DXVA_ModeH261_B
  • the working mode can support up to 1280 ⁇ 720 resolution and 3000kbps code rate.
  • the video player finds DXVA_ModeH261_B in the decoding capability information reported by the driver, it sends DXVA_ModeH261_B, 1280 ⁇ 720 and 2000kbps to the driver to query.
  • the driver will return “support” information.
  • the central processor CPU is used to analyze the decoded input code stream to obtain macroblock information required for encoding
  • step 102 includes, when implemented,:
  • the CPU analyzes the header information of the decoded input code stream to obtain an entropy coding type; performs entropy decoding on the decoded input code stream, and discards all decoding residual information in the process of entropy decoding, and records
  • the macroblock information required for encoding wherein the macroblock information includes: block type information, block mode information, motion vector information, coded block pattern (CBP) information, quantization parameters, and macroblock residuals.
  • the macroblock coding mode includes: block type information, block mode information, and motion vector information.
  • the central processor CPU is used to encode the decoded input code stream according to a target code rate according to the macroblock information required for the encoding.
  • the transcoding architecture mainly has two improvements: 1. Video decoding is performed on the GPU; 2. The analysis and recording of the input decoded video information is completed on the CPU.
  • FIG. 3 is a flowchart of completing video decoding on a GPU according to an embodiment of the present invention.
  • the decoder needs to first initialize the GPU decoding parameter. And allocate memory space for the current frame.
  • the GPU decoding requirements must be met when allocating space: the space must be 32 bytes aligned, and the luminance and color difference spaces must be continuous.
  • the current frame can be decoded by calling the GPU video decoding interface. At this time, the decoding process only occupies GPU resources and does not occupy any CPU resources.
  • the decoded frame is filled into the previously allocated memory space, and thus, the GPU decodes one frame to complete. After that, the decoded frame needs to be output to the downstream, and the next step of the common transcoding architecture continues to be processed.
  • the transcoding architecture needs to add an analysis module for analyzing and storing the decoding parameters in the input code stream for subsequent encoder multiplexing.
  • the analysis module runs on the CPU and is only responsible for code stream analysis, does not do deeper decoding, and does not have large memory operations, which is much faster than decoding.
  • This proposal proposes a transcoding architecture based on GPU and CPU hybrid, which is mainly applied to transcoding schemes such as H.264 and HEVC.
  • the GPU decoding is used to save CPU resources, and the code stream analysis is performed on the decoding stream, which improves the overall transcoding speed and saves the transcoding CPU resources without affecting the transcoding quality.
  • the transcoding architecture can save 10% of CPU resources, thereby improving the transcoding speed and better meeting the real-time video transcoding requirements under the premise of ensuring the restored video quality.
  • the decoding module 51 is located on the GPU side of the graphics processor and is configured to decode the input code stream to obtain a decoded input code stream.
  • the analysis module 52 is located on the CPU side of the central processing unit, and is configured to analyze the decoded input code stream to obtain macroblock information required for encoding;
  • a determining module 53 configured to determine whether the GPU supports decoding of the input code stream
  • the obtaining module 54 is configured to obtain, after the determining module determines that the GPU supports decoding of the input code stream, acquiring decoding capability information of the GPU;
  • the sending module 55 is configured to send the input code stream to the GPU for decoding by using a decoding interface corresponding to the decoding capability information.
  • the device further includes:
  • the initialization module 56 is configured to initialize a decoding parameter of the GPU according to a decoding interface corresponding to the decoding capability information, and allocate a memory space for the input code stream to be decoded, where the memory space is used to save the decoded The input code stream.
  • the analysis module 52 is specifically configured to:
  • the macroblock information required for the encoding includes a block Information required for encoding such as type information, block mode information, motion vector information, block coding type information, quantization parameters, and macroblock residuals.
  • the embodiment of the invention further provides a video transcoding system, comprising: a decoder and an encoder;
  • the decoder is further configured to determine whether the GPU supports decoding of the input code stream, if supported, acquiring decoding capability information of the GPU; and initializing the decoding interface according to a decoding interface corresponding to the decoding capability information a decoding parameter of the GPU, and allocating a memory space for the input code stream to be decoded, the memory space for storing the decoded input code stream; and inputting the input through a decoding interface corresponding to the decoding capability information
  • the code stream is sent to the GPU for decoding;
  • the system in the embodiment of the present invention can perform the method shown in FIG. 1 , and the implementation principles and technical effects thereof are not described again.
  • the memory 61 can be used to store one or more instructions, wherein the one or more instructions are for execution by the processor;
  • the processor 62 is further configured to determine Whether the GPU supports decoding of the input code stream, if supported, acquiring decoding capability information of the GPU; initializing decoding parameters of the GPU according to a decoding interface corresponding to the decoding capability information, and allocating memory space for the input code stream to be decoded Transmitting the input code stream to the GPU for decoding by using a decoding interface corresponding to the decoding capability information; and when the decoding is completed, saving the decoded input code stream to the allocated memory space.
  • the processor 62 is further configured to initialize the decoding parameter of the GPU according to the decoding interface corresponding to the decoding capability information, and allocate the input code stream to be decoded.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本发明公开了一种视频转码方法和装置、系统,其中,利用图形处理器GPU对输入码流进行解码,得到解码后的输入码流;利用中央处理器CPU对解码后的输入码流进行分析,得到编码所需的宏块信息;根据所述编码所需的宏块信息,利用中央处理器CPU对所述解码后的输入码流按照目标码率进行编码。利用GPU解码来节省CPU资源,同时对解码流进行码流分析,在不影响转码质量的同时提高整体转码速度,节省转码CPU资源。

Description

视频转码方法和装置系统
交叉引用
本发明引用于2015年12月7日递交的名称为“视频转码方法和装置系统”的第201510890653.6号中国专利发明,其通过引用被全部并入本发明。
技术领域
本发明属于互联网视频处理技术领域,具体地说,涉及一种视频转码方法和装置、系统。
背景技术
目前随着互联网视频和硬件设备的发展,人们制作视频的成本越来越低,对视频的质量要求也日益提高。视频的分辨率越来越大,高清(1080P,1920×1080)甚至超清(4K,3840×2160)日益普遍。对于视频转码行业而言,视频转码的压力也越来越大。在进行大分辨率视频直播,离线转码时,转码服务器往往处于很高的负荷之下。如何在已有的转码服务器上更有效的利用硬件资源来提高转码速度是业内共同的话题。
发明内容
有鉴于此,本发明提供了一种视频转码方法和装置、系统,可以利用GPU解码来节省CPU资源,同时对解码流进行码流分析,在不影响转码质量的同时提高整体转码速度,节省转码CPU资源。本发明还提供了一种视频转码设备。
本发明提供一种视频转码方法,包括:
利用图形处理器GPU对输入码流进行解码,得到解码后的输入码流;
利用中央处理器CPU对解码后的输入码流进行分析,得到编码所需的宏块信息;
根据所述编码所需的宏块信息,利用中央处理器CPU对所述解码后的输入码流按照目标码率进行编码。
其中,利用图形处理器GPU对输入码流进行解码,包括:
确定所述GPU是否支持所述输入码流的解码,若支持,则获取所述GPU的解码能力信息;通过与所述解码能力信息对应的解码接口将所述输入码流发送给所述GPU进行解码。
其中,利用图形处理器GPU对输入码流进行解码之前,包括:
根据与所述解码能力信息对应的解码接口,初始化所述GPU的解码参数,并为所述待解码的输入码流分配内存空间,所述内存空间用于保存解码后的所述输入码流。
其中,利用中央处理器CPU对解码后的输入码流进行分析,得到编码所需的宏块信息,包括:
利用所述CPU分析所述解码后的输入码流的头信息,得到熵编码类型;
对所述解码后的输入码流进行熵解码,在熵解码的过程中,丢弃所有解码残差信息,记录下编码所需的信息,其中,所述编码所需的宏块信息包括块类型信息、分块模式信息、运动矢量信息、块编码类型信息、量化参数和宏块残差等编码所需的信息。
本发明还提供一种视频转码装置,包括:
解码模块,位于图形处理器GPU侧,用于对输入码流进行解码,得到解码后的输入码流;
分析模块,位于中央处理器CPU侧,用于对解码后的输入码流进行分析,得到编码所需的宏块信息;
编码模块,位于中央处理器CPU侧,用于根据所述编码所需的宏块信息,对所述解码后的输入码流按照目标码率进行编码。
其中,所述的装置还包括:
判断模块,用于确定所述GPU是否支持所述输入码流的解码;
获取模块,用于在判断模块确定所述GPU支持所述输入码流的解码,则获取所述GPU的解码能力信息;
发送模块,用于通过与所述解码能力信息对应的解码接口将所述输入码流发送给所述GPU进行解码。
其中,所述的装置还包括:
初始化模块,用于根据与所述解码能力信息对应的解码接口,初始化所述GPU的解码参数,并为所述待解码的输入码流分配内存空间,所述内存空间用于保存解码后的所述输入码流。
其中,所述分析模块具体用于:
利用所述CPU分析所述解码后的输入码流的头信息,得到熵编码类型;
对所述解码后的输入码流进行熵解码,在熵解码的过程中,丢弃所有解码残差信息,记录下编码所需的宏块信息,其中,所述编码所需的宏块信息包括块类型信息、分块模式信息、运动矢量信息、块编码类型信息、量化参数和宏块残差等编码所需的信息。
本发明还提供一种视频转码系统,包括:解码器和编码器;
所述解码器,用于利用图形处理器GPU对输入码流进行解码,得到解码后的输入码流;
所述编码器,用于利用中央处理器CPU对解码后的输入码流进行分析,得到编码所需的宏块信息;根据所述编码所需的宏块信息,利用中央处理器CPU对所述解码后的输入码流按照目标码率进行编码。
其中,所述解码器,还用于确定所述GPU是否支持所述输入码流的解码,若支持,则获取所述GPU的解码能力信息;根据与所述解码能力信息对应的解码接口,初始化所述GPU的解码参数,并为所述待解码的输入码流分配内存空间,所述内存空间用于保存解码后的所述输入码流;通过与所述解码能力信息对应的解码接口将所述输入码流发送给所述GPU进行解码;
所述编码器,还用于利用所述CPU分析所述解码后的输入码流的头信息,得到熵编码类型;对所述解码后的输入码流进行熵解码,在熵解码的过 程中,丢弃所有解码残差信息,记录下编码所需的宏块信息,其中,所述编码所需的宏块信息包括块类型信息、分块模式信息、运动矢量信息、块编码类型信息、量化参数和宏块残差等编码所需的信息。
本发明还提供一种视频转码设备,包括:内存、处理器,其中,
所述内存,用于存储一条或多条指令,其中,所述一条或多条指令以供所述处理器调用执行;
所述处理器,用于利用图形处理器GPU对输入码流进行解码,得到解码后的输入码流;利用中央处理器CPU对解码后的输入码流进行分析,得到编码所需的宏块信息;根据所述编码所需的宏块信息,利用中央处理器CPU对所述解码后的输入码流按照目标码率进行编码。
与现有技术相比,本发明可以获得包括以下技术效果:
本发明提出了一种基于GPU和CPU混合的转码架构,主要应用于H.264,HEVC等转码方案。利用GPU解码来节省CPU资源,同时对解码流进行码流分析,在不影响转码质量的同时提高整体转码速度,节省转码CPU资源。该转码架构相比现有转码架构可以节省10%的CPU资源,从而在确保恢复的视频质量的前提下,提高了转码速度,更好地满足了实时视频转码要求。
附图说明
此处所说明的附图用来提供对本发明的进一步理解,构成本发明的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1是本发明实施例提供的一种视频转码方法的流程示意图;
图2为本发明实施例提出的一种CPU+GPU混合转码架构流程图;
图3为本发明实施例提出的一种GPU上完成视频解码的流程图;
图4本发明实施例提出的一种CPU上完成码流分析流程图;
图5是本发明实施例提供的一种视频转码装置的结构示意图;
图6是本发明实施例提供的一种视频转码设备的结构示意图。
具体实施方式
本发明的主要思想在于,通过基于GPU和CPU混合的转码架构,利用GPU解码来节省CPU资源,同时对解码流进行码流分析,在不影响转码质量的同时提高整体转码速度,节省转码CPU资源。
为使本发明的目的、技术方案和优点更加清楚,以下结合附图及具体实施例,对本发明作进一步地详细说明。在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
如在说明书及权利要求当中使用了某些词汇来指称特定组件。本领域技术人员应可理解,硬件制造商可能会用不同名词来称呼同一个组件。本说明书及权利要求并不以名称的差异来作为区分组件的方式,而是以组件在功能上的差异来作为区分的准则。如在通篇说明书及权利要求当中所提及的“包含”为一开放式用语,故应解释成“包含但不限定于”。“大致”是指在可接收的误差范围内,本领域技术人员能够在一定误差范围内解决所述技术问题,基本 达到所述技术效果。此外,“耦接”一词在此包含任何直接及间接的电性耦接手段。因此,若文中描述一第一装置耦接于一第二装置,则代表所述第一装置可直接电性耦接于所述第二装置,或通过其他装置或耦接手段间接地电性耦接至所述第二装置。说明书后续描述为实施本发明的较佳实施方式,然所述描述乃以说明本发明的一般原则为目的,并非用以限定本发明的范围。本发明的保护范围当视所附权利要求所界定者为准。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的商品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种商品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的商品或者系统中还存在另外的相同要素。
发明人在实现本发明的过程中发现:
由于视频分辨率、码率的不断提高,视频解码的复杂度也在不断的提高,视频解码计算所占用的系统资源相应的也在持续增加。用CPU(Central Processing Unit,中央处理器)进行视频解码(软解码)要占用大量的CPU计算资源,甚至有可能出现CPU计算资源无法满足高分辨率、高码率的需要。
本发明提出了一种新的视频转码系统架构,主要应用于H.264,HEVC等各种视频格式的转换。传统转码方案往往全部计算都基于对CPU资源的使用,在高分辨率高质量的转码过程中,CPU资源往往负荷过大,从而影响转码速度。本发明实施例所述的转码系统架构特点在于将转码过程中的视频解码工作放在图形处理器(英语:Graphics Processing Unit,缩写:GPU)上完成,仅把解码信息分析的部分放在CPU上,通过有效利用GPU解码缓解CPU计算资源,从而提高整体转码速度。该转码方案可以在完全不影响转码质量的情况下,节省CPU资源,提高转码速度。
图1是本发明实施例提供的一种视频转码方法的流程示意图,如图1所示,包括:
101、利用图形处理器GPU对输入码流进行解码,得到解码后的输入码 流;
在一种实施方式中,步骤101具体实现时包括:
首先,确定所述GPU是否支持所述输入码流的解码,若支持,则获取所述GPU的解码能力信息;
根据与所述解码能力信息对应的解码接口,初始化所述GPU的解码参数,并为所述待解码的输入码流分配内存空间;
通过与所述解码能力信息对应的解码接口将所述输入码流发送给所述GPU进行解码;
将解码后的所述输入码流保存到上述分配的内存空间。
其中,上述确定GPU是否支持所述输入码流的解码,当有待解码的视频需要进行解码时,应用程序可以通过系统程序(如windows操作系统)建立与GPU的驱动程序的连接。具体的,应用程序生成DXVA Output(输出)Pin(接口),并使用DXVA Output Pin连接到VMR(Video Mixing Renderer,视频混合渲染器)的IAMVideoAccelerator Input Pin(windows系统提供的用于应用程序连接GPU驱动程序的接口,可以称之为GPU驱动连接接口,属于DXVA接口的一种),生成相应的Filter Graph(滤镜图,就是多个连接在一起,完成特定功能(比如视频播放,视频捕获)的滤镜的组合)。应用程序建立与GPU的驱动程序的连接之后,可以向驱动程序查询GPU的解码能力信息,驱动程序接收到查询指令后,向应用程序发送GPU的解码能力信息,如该GPU的解码能力信息包括DXVA_ModeH261_B、DXVA_ModeH263_B、DXVA_ModeMPEG1_A、DXVA_ModeMPEG2_B等。
当获取的解码能力信息中存在支持待解码的视频的编码格式的解码能力信息时,应用程序继续查询GPU在该解码能力信息对应的工作模式下是否支持待解码的视频的解码配置信息,如果是,则表明查询结果为GPU能够支持待解码视频的解码。如果获取的解码能力信息中不存在支持待解码的视频的编码格式的解码能力信息,或者查询到GPU在此工作模式下不支持待解码视频的解码配置信息,则表明查询结果为GPU不能够支持待解码视频的解码。具体的,应用程序可以从待解码的视频的文件中获取到该视频的编 码格式和解码配置信息,该编码格式可以包括H.261、H.263、H.264、MPEG2等,该解码配置信息可以包括分辨率、码率、缓存帧数、色彩空间格式等信息。具体的,应用程序在驱动程序上报的解码能力信息中查找能够支持待解码视频的编码格式的解码能力信息,如果能够查找到,则进一步将该解码能力信息和待解码视频的解码配置信息发送给GPU驱动程序,以查询GPU在相应的工作模式下是否支持相应的解码配置。
例如(此处解码配置信息仅以分辨率和码率为例说明),某视频的编码格式为H261,分辨率为1280×720,码率2000kbps,并假设GPU支持DXVA_ModeH261_B的工作模式,且在该工作模式下最高可以支持1280×720的分辨率、3000kbps的码率,视频播放器在驱动程序上报的解码能力信息中查找到DXVA_ModeH261_B后,将DXVA_ModeH261_B、1280×720和2000kbps发送给驱动程序,以查询GPU在DXVA_ModeH261_B的工作模式下是否支持1280×720的分辨率和2000kbps的码率,驱动程序会返回“支持”的信息。
102、利用中央处理器CPU对解码后的输入码流进行分析,得到编码所需的宏块信息;
具体地,步骤102在实现时包括:
利用所述CPU分析所述解码后的输入码流的头信息,得到熵编码类型;对所述解码后的输入码流进行熵解码,在熵解码的过程中,丢弃所有解码残差信息,记录下编码所需的宏块信息,其中,宏块信息包括:块类型信息、分块模式信息、运动矢量信息、块编码类型(Coded Block Pattern,简称CBP)信息、量化参数和宏块残差等编码所需的信息;宏块编码模式包括:块类型信息、分块模式信息和运动矢量信息。
103、根据所述编码所需的宏块信息,利用中央处理器CPU对所述解码后的输入码流按照目标码率进行编码。
下面以具体实现方式为例对本发明的技术方案进行详细的描述:
图2为本发明实施例提出的一种CPU+GPU混合转码架构流程图,如图2所示,该转码架构主要有两个部分的改进:1.视频的解码在GPU上完成; 2.输入解码后的视频信息的分析以及记录在CPU上完成。
为了调用GPU进行视频解码,首先要选择使用可以支持GPU视频解码的服务器,例如intel的E3-1285服务器。图3为本发明实施例提出的一种GPU上完成视频解码的流程图,如图3所示,在转码开始运行之后,当输入码流到达解码端,解码器需要首先初始化GPU解码参数,并为当前帧分配内存空间。初始化GPU参数时,需要参考对应GPU解码模块的调用接口要求,选择适当的设备。分配空间时必须满足GPU解码需求:空间必须32字节对齐,亮度与色差空间之间必须连续。如果采用交由GPU设备来分配内存空间的方式,则需要在初始化GPU时做相应设置。完成之后,即可通过调用GPU视频解码的接口为当前帧进行解码。此时解码过程仅占用GPU资源,不占用任何CPU资源。当GPU解码完成后,会将解码帧填充到之前预分配的内存空间中,至此,GPU解码一帧完成。之后需要将解码帧输出到下游,共转码架构的下一步继续处理。
由于解码过程是在GPU上进行,无法存储输入码流的详细解码信息,所以转码架构需要增加一个分析模块,用于分析并存储输入码流中解码参数,以供接下来的编码器复用。该分析模块运行于CPU上,仅负责码流分析,不做更深一层解码,且没有较大内存操作,其速度远远快于解码。
图4为本发明实施例提出的一种CPU上完成码流分析流程图,如图4所示,首先需要分析输入码流的头信息,得到熵编码类型。接下来为了得到更具体的码流信息,需要对码流进行熵解码。在熵解码的过程中,丢弃所有解码残差信息,仅记录下宏块类型,运动矢量,宏块编码比特等信息。这些信息将提供给编码器复用。
本提案提出了一种基于GPU和CPU混合的转码架构,主要应用于H.264,HEVC等转码方案。利用GPU解码来节省CPU资源,同时对解码流进行码流分析,在不影响转码质量的同时提高整体转码速度,节省转码CPU资源。该转码架构相比现有转码架构可以节省10%的CPU资源,从而在确保恢复的视频质量的前提下,提高了转码速度,更好地满足了实时视频转码要求。
图5是本发明实施例提供的一种视频转码装置的结构示意图,如图5所示,包括:
解码模块51,位于图形处理器GPU侧,用于对输入码流进行解码,得到解码后的输入码流;
分析模块52,位于中央处理器CPU侧,用于对解码后的输入码流进行分析,得到编码所需的宏块信息;
编码模块53,位于中央处理器CPU侧,用于根据所述编码所需的宏块信息,对所述解码后的输入码流按照目标码率进行编码。
其中,所述的装置还包括:
判断模块53,用于确定所述GPU是否支持所述输入码流的解码;
获取模块54,用于在判断模块确定所述GPU支持所述输入码流的解码,则获取所述GPU的解码能力信息;
发送模块55,用于通过与所述解码能力信息对应的解码接口将所述输入码流发送给所述GPU进行解码。
所述的装置还包括:
初始化模块56,用于根据与所述解码能力信息对应的解码接口,初始化所述GPU的解码参数,并为所述待解码的输入码流分配内存空间,所述内存空间用于保存解码后的所述输入码流。
其中,所述分析模块52具体用于:
利用所述CPU分析所述解码后的输入码流的头信息,得到熵编码类型;
对所述解码后的输入码流进行熵解码,在熵解码的过程中,丢弃所有解码残差信息,记录下编码所需的宏块信息,其中,所述编码所需的宏块信息包括块类型信息、分块模式信息、运动矢量信息、块编码类型信息、量化参数和宏块残差等编码所需的信息。
图5所示的装置可以执行图1所示的方法,其实现原理和技术效果不再赘述。
本发明实施例还提供一种视频转码系统,其特征在于,包括:解码器和编码器;
所述解码器,用于利用图形处理器GPU对输入码流进行解码,得到解码后的输入码流;
所述编码器,用于利用中央处理器CPU对解码后的输入码流进行分析, 得到编码所需的宏块信息;根据所述编码所需的宏块信息,利用中央处理器CPU对所述解码后的输入码流按照目标码率进行编码。
所述解码器,还用于确定所述GPU是否支持所述输入码流的解码,若支持,则获取所述GPU的解码能力信息;根据与所述解码能力信息对应的解码接口,初始化所述GPU的解码参数,并为所述待解码的输入码流分配内存空间,所述内存空间用于保存解码后的所述输入码流;通过与所述解码能力信息对应的解码接口将所述输入码流发送给所述GPU进行解码;
所述编码器,还用于利用所述CPU分析所述解码后的输入码流的头信息,得到熵编码类型;对所述解码后的输入码流进行熵解码,在熵解码的过程中,丢弃所有解码残差信息,记录下编码所需的宏块信息,其中,所述编码所需的宏块信息包括块类型信息、分块模式信息、运动矢量信息、块编码类型信息、量化参数和宏块残差等编码所需的信息。
本发明实施例所述系统可以执行图1所示的方法,其实现原理和技术效果不再赘述。
上述说明示出并描述了本发明的若干优选实施例,但如前所述,应当理解本发明并非局限于本文所披露的形式,不应看作是对其他实施例的排除,而可用于各种其他组合、修改和环境,并能够在本文所述发明构想范围内,通过上述教导或相关领域的技术或知识进行改动。而本领域人员所进行的改动和变化不脱离本发明的精神和范围,则都应在本发明所附权利要求的保护范围内。
图6是本发明实施例提供的一种视频转码设备的结构示意图,如图6所示,包括:内存61以及处理器62,
其中,所述内存61可以用于存储一条或多条指令,其中,所述一条或多条指令以供所述处理器调用执行;
所述处理器62,可以用于利用图形处理器GPU对输入码流进行解码,得到解码后的输入码流;利用中央处理器CPU对解码后的输入码流进行分析,得到编码所需的宏块信息;根据所述编码所需的宏块信息,利用中央处理器CPU对所述解码后的输入码流按照目标码率进行编码。
具体的,为得到解码后的输入码流,所述处理器62,进一步用于确定 GPU是否支持输入码流的解码,若支持,则获取该GPU的解码能力信息;根据与该解码能力信息对应的解码接口,初始化该GPU的解码参数,并为待解码的输入码流分配内存空间;通过与该解码能力信息对应的解码接口将输入码流发送给该GPU进行解码;当解码完成后,将解码后的输入码流保存到上述分配的内存空间。
具体的,利用图形处理器GPU对输入码流进行解码之前,所述处理器62,进一步用于根据与解码能力信息对应的解码接口,初始化GPU的解码参数,并为待解码的输入码流分配内存空间,该内存空间用于保存解码后的所述输入码流。
具体的,为得到解码后的输入码流,所述处理器62,进一步用于利用CPU分析解码后的输入码流的头信息,得到熵编码类型;对解码后的输入码流进行熵解码,在熵解码的过程中,丢弃所有解码残差信息,记录下编码所需的信息,其中,所述编码所需的宏块信息包括块类型信息、分块模式信息、运动矢量信息、块编码类型信息、量化参数和宏块残差等编码所需的信息。
本设备的技术方案和各模块的功能特征、连接方式,与图1~图4对应实施例所描述的特征和技术方案相对应,不足之处请参见前述图1~图4对应实施例。

Claims (10)

  1. 一种视频转码方法,其特征在于,包括:
    利用图形处理器GPU对输入码流进行解码,得到解码后的输入码流;
    利用中央处理器CPU对解码后的输入码流进行分析,得到编码所需的宏块信息;
    根据所述编码所需的宏块信息,利用中央处理器CPU对所述解码后的输入码流按照目标码率进行编码。
  2. 如权利要求1所述的方法,其特征在于,利用图形处理器GPU对输入码流进行解码,包括:
    确定所述GPU是否支持所述输入码流的解码,若支持,则获取所述GPU的解码能力信息;通过与所述解码能力信息对应的解码接口将所述输入码流发送给所述GPU进行解码。
  3. 如权利要求1或2所述的方法,其特征在于,利用图形处理器GPU对输入码流进行解码之前,包括:
    根据与所述解码能力信息对应的解码接口,初始化所述GPU的解码参数,并为所述待解码的输入码流分配内存空间,所述内存空间用于保存解码后的所述输入码流。
  4. 如权利要求3所述的方法,其特征在于,利用中央处理器CPU对解码后的输入码流进行分析,得到编码所需的宏块信息,包括:
    利用所述CPU分析所述解码后的输入码流的头信息,得到熵编码类型;
    对所述解码后的输入码流进行熵解码,在熵解码的过程中,丢弃所有解码残差信息,记录下编码所需的信息,其中,所述编码所需的宏块信息包括块类型信息、分块模式信息、运动矢量信息、块编码类型信息、量化参数和宏块残差等编码所需的信息。
  5. 一种视频转码装置,其特征在于,包括:
    解码模块,位于图形处理器GPU侧,用于对输入码流进行解码,得到解 码后的输入码流;
    分析模块,位于中央处理器CPU侧,用于对解码后的输入码流进行分析,得到编码所需的宏块信息;
    编码模块,位于中央处理器CPU侧,用于根据所述编码所需的宏块信息,对所述解码后的输入码流按照目标码率进行编码。
  6. 如权利要求5所述的装置,其特征在于,还包括:
    判断模块,用于确定所述GPU是否支持所述输入码流的解码;
    获取模块,用于在判断模块确定所述GPU支持所述输入码流的解码,则获取所述GPU的解码能力信息;
    发送模块,用于通过与所述解码能力信息对应的解码接口将所述输入码流发送给所述GPU进行解码。
  7. 如权利要求5或6所述的装置,其特征在于,还包括:
    初始化模块,用于根据与所述解码能力信息对应的解码接口,初始化所述GPU的解码参数,并为所述待解码的输入码流分配内存空间,所述内存空间用于保存解码后的所述输入码流。
  8. 如权利要求7所述的装置,其特征在于,所述分析模块具体用于:
    利用所述CPU分析所述解码后的输入码流的头信息,得到熵编码类型;
    对所述解码后的输入码流进行熵解码,在熵解码的过程中,丢弃所有解码残差信息,记录下编码所需的宏块信息,其中,所述编码所需的宏块信息包括块类型信息、分块模式信息、运动矢量信息、块编码类型信息、量化参数和宏块残差等编码所需的信息。
  9. 一种视频转码系统,其特征在于,包括:解码器和编码器;
    所述解码器,用于利用图形处理器GPU对输入码流进行解码,得到解码后的输入码流;
    所述编码器,用于利用中央处理器CPU对解码后的输入码流进行分析,得到编码所需的宏块信息;根据所述编码所需的宏块信息,利用中央处理器 CPU对所述解码后的输入码流按照目标码率进行编码。
  10. 如权利要求9所述的系统,其特征在于:
    所述解码器,还用于确定所述GPU是否支持所述输入码流的解码,若支持,则获取所述GPU的解码能力信息;根据与所述解码能力信息对应的解码接口,初始化所述GPU的解码参数,并为所述待解码的输入码流分配内存空间,所述内存空间用于保存解码后的所述输入码流;通过与所述解码能力信息对应的解码接口将所述输入码流发送给所述GPU进行解码;
    所述编码器,还用于利用所述CPU分析所述解码后的输入码流的头信息,得到熵编码类型;对所述解码后的输入码流进行熵解码,在熵解码的过程中,丢弃所有解码残差信息,记录下编码所需的宏块信息,其中,所述编码所需的宏块信息包括块类型信息、分块模式信息、运动矢量信息、块编码类型信息、量化参数和宏块残差等编码所需的信息。
PCT/CN2016/088713 2015-12-07 2016-07-05 视频转码方法和装置系统 WO2017096823A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US15/247,610 US20170163990A1 (en) 2015-12-07 2016-08-25 Video transcoding method and system

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510890653.6 2015-12-07
CN201510890653.6A CN105898315A (zh) 2015-12-07 2015-12-07 视频转码方法和装置系统

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/247,610 Continuation US20170163990A1 (en) 2015-12-07 2016-08-25 Video transcoding method and system

Publications (1)

Publication Number Publication Date
WO2017096823A1 true WO2017096823A1 (zh) 2017-06-15

Family

ID=57002853

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/088713 WO2017096823A1 (zh) 2015-12-07 2016-07-05 视频转码方法和装置系统

Country Status (2)

Country Link
CN (1) CN105898315A (zh)
WO (1) WO2017096823A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110475128A (zh) * 2019-08-02 2019-11-19 视联动力信息技术股份有限公司 一种视频转码方法、装置、电子设备和存储介质
CN112788343A (zh) * 2021-02-23 2021-05-11 北京睿芯高通量科技有限公司 一种用于视频处理服务端的软硬件编码协同系统、方法及电子装置

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108289228B (zh) * 2017-01-09 2020-08-28 阿里巴巴集团控股有限公司 一种全景视频转码方法、装置和设备
CN109213593B (zh) * 2017-07-04 2022-05-10 阿里巴巴集团控股有限公司 用于全景视频转码的资源分配方法、装置和设备
CN107920253B (zh) * 2017-10-31 2020-08-18 北京赛思信安技术股份有限公司 一种基于gpu的视频处理方法
CN111246214B (zh) * 2018-11-28 2022-05-06 杭州海康威视数字技术股份有限公司 一种视频解码方法、装置
CN110971903A (zh) * 2019-10-17 2020-04-07 西安万像电子科技有限公司 编码方法、设备及系统
CN111031389B (zh) * 2019-12-11 2022-05-20 Oppo广东移动通信有限公司 视频处理方法、电子装置和存储介质
CN114760495A (zh) * 2022-03-21 2022-07-15 南京芯驰半导体科技有限公司 一种基于视频处理单元的视频硬件解码方法及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102273205A (zh) * 2008-11-04 2011-12-07 先进微装置公司 以gpu加速的软件视频转码器
CN103491379A (zh) * 2013-09-25 2014-01-01 浙江宇视科技有限公司 一种提升智能分析性能的方法和装置
CN103581665A (zh) * 2012-08-02 2014-02-12 英特尔公司 转码视频数据
CN104980752A (zh) * 2015-06-11 2015-10-14 武汉大千信息技术有限公司 利用cpu和gpu实现多路自适应并行转码的方法及系统

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8861591B2 (en) * 2007-05-11 2014-10-14 Advanced Micro Devices, Inc. Software video encoder with GPU acceleration
CN101998117B (zh) * 2009-08-13 2013-01-30 华为技术有限公司 视频转码方法和装置
CN103260021B (zh) * 2012-02-21 2016-08-03 腾讯科技(深圳)有限公司 一种视频解码方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102273205A (zh) * 2008-11-04 2011-12-07 先进微装置公司 以gpu加速的软件视频转码器
CN103581665A (zh) * 2012-08-02 2014-02-12 英特尔公司 转码视频数据
CN103491379A (zh) * 2013-09-25 2014-01-01 浙江宇视科技有限公司 一种提升智能分析性能的方法和装置
CN104980752A (zh) * 2015-06-11 2015-10-14 武汉大千信息技术有限公司 利用cpu和gpu实现多路自适应并行转码的方法及系统

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110475128A (zh) * 2019-08-02 2019-11-19 视联动力信息技术股份有限公司 一种视频转码方法、装置、电子设备和存储介质
CN110475128B (zh) * 2019-08-02 2021-09-28 视联动力信息技术股份有限公司 一种视频转码方法、装置、电子设备和存储介质
CN112788343A (zh) * 2021-02-23 2021-05-11 北京睿芯高通量科技有限公司 一种用于视频处理服务端的软硬件编码协同系统、方法及电子装置

Also Published As

Publication number Publication date
CN105898315A (zh) 2016-08-24

Similar Documents

Publication Publication Date Title
WO2017096823A1 (zh) 视频转码方法和装置系统
US20230393802A1 (en) Real-time screen sharing
TWI603609B (zh) 簡化視訊隨機存取之限制及單元類型
US20190158704A1 (en) Game engine application direct to video encoder rendering
TWI647946B (zh) 一種圖像編解碼方法及裝置
CN102447906B (zh) 低延时视频解码
CN105163127A (zh) 视频分析方法及装置
JP7448975B2 (ja) インタ予測における大域的運動制約運動ベクトル
WO2017101350A1 (zh) 变分辨率的编码模式预测方法及装置
US8121189B2 (en) Video decoding using created reference pictures
US9888247B2 (en) Video coding using region of interest to omit skipped block information
WO2023226915A1 (zh) 视频传输方法、系统、设备及存储介质
CN114827623A (zh) 用于视频编解码的边界扩展
US20150163486A1 (en) Variable bitrate encoding
KR20210153725A (ko) 글로벌 모션 벡터들의 효율적인 코딩
WO2021057686A1 (zh) 视频解码方法和装置、视频编码方法和装置、存储介质及电子装置
US20140009563A1 (en) Non-video codecs with video conferencing
US20170163990A1 (en) Video transcoding method and system
KR102296987B1 (ko) 기계 학습 모델에 기초한 블록 체인을 이용한 hevc 분산형 복호화 방법, 장치 및 시스템
CN110868610B (zh) 流媒体传输方法、装置、服务器及存储介质
WO2023169424A1 (zh) 编解码方法及电子设备
WO2023169426A1 (zh) 编解码方法及电子设备
JP2023105074A (ja) 運動ベクトルインタ予測のための大域的運動モデル
JP5321895B2 (ja) 情報処理装置および方法
CN112954396B (zh) 视频的播放方法、装置、电子设备及计算机可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16872026

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16872026

Country of ref document: EP

Kind code of ref document: A1