[go: up one dir, main page]

CN105491387B - A H264 Hardware Encoding System Based on Intel, AMD and Nvidia - Google Patents

A H264 Hardware Encoding System Based on Intel, AMD and Nvidia Download PDF

Info

Publication number
CN105491387B
CN105491387B CN201510887873.3A CN201510887873A CN105491387B CN 105491387 B CN105491387 B CN 105491387B CN 201510887873 A CN201510887873 A CN 201510887873A CN 105491387 B CN105491387 B CN 105491387B
Authority
CN
China
Prior art keywords
encoder
submodule
interface
hardware
encoding
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.)
Expired - Fee Related
Application number
CN201510887873.3A
Other languages
Chinese (zh)
Other versions
CN105491387A (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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201510887873.3A priority Critical patent/CN105491387B/en
Publication of CN105491387A publication Critical patent/CN105491387A/en
Application granted granted Critical
Publication of CN105491387B publication Critical patent/CN105491387B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses a kind of H264 hardware encoding systems based on tri- platform of Intel, AMD and Nvidia, including universal coding module, Intel hardware coder, AMD hardware coder and Nvidia hardware coder, the wherein universal coding module, for creating universal coding interface, judge the hardware coder type that computer system is supported, any one of hardware coder type Selection and call Intel hardware coder, AMD hardware coder or Nvidia hardware coder supported according to computer system carries out H264 Video coding;Intel hardware coder, for carrying out H264 Video coding to the computer system for supporting Intel hardware encoding;AMD hardware coder, for carrying out H264 Video coding to the computer system for supporting AMD hardware encoding;Nvidia hardware coder, for carrying out H264 Video coding to the computer system for supporting Nvidia hardware encoding.The present invention can judge the hardware coder type that computer system is supported, to the offer H264 hardware encoding of a variety of different computer system unawares.

Description

A kind of H264 hardware encoding system based on tri- platform of Intel, AMD and Nvidia
Technical field
The invention belongs to graphics technology fields, flat based on Intel, AMD and Nvidia tri- more particularly, to one kind The H264 hardware encoding system of platform.
Background technique
H.264 it is International Organization for standardization (ISO) and International Telecommunication Union (ITU) proposes jointly after MPEG4 New-generation digital video compression format.It H.264 is ITU-T with the H.26x serial video coding and decoding technology standard for name nominating One of.It H.264 is the MPEG (Motion Picture Expert Group) of the VCEG (Video Coding Experts Group) and ISO/IEC of ITU-T One digital video coding standard of joint video team (JVT:joint video team) exploitation.The standard earliest from The exploitation for being referred to as project H.26L of ITU-T.H.26L this title is although less common, but is used always. It H.264 is ITU-T with H.26x serial one of the standard for name nominating, AVC is the address of mono- side of ISO/IEC MPEG.
Most H264 coding uses the Software Coding of libx264 at present, in this way in the cpu performance ratio of computer In the case where poor, central processing unit (Central Processing Unit, CPU) resource can be seriously consumed, computer is caused The decline of service system performance;It even if some computers have used hardware encoding, but is only that the integrated of Intel platform is supported to show Card or Nvidia platform, can not carry out unified support by this several large platform to Intel, AMD, Nvidia.
Summary of the invention
Aiming at the above defects or improvement requirements of the prior art, the present invention provides one kind based on Intel, AMD and The H264 hardware encoding system of tri- platform of Nvidia, it is noninductive its object is to which the computer platform of different hardware platforms can be directed to The corresponding hardware encoding scheme of the offer known, H264 hardware volume can not be carried out by thus solving part computer system under the prior art The technical issues of code.
To achieve the above object, the present invention provides a kind of H264 hardware based on tri- platform of Intel, AMD and Nvidia Coded system, including universal coding module, Intel hardware coder, AMD hardware coder and Nvidia hardware coder, Wherein:
The universal coding module judges the hardware encoding that computer system is supported for creating universal coding interface Device type, the hardware coder type Selection and call Intel hardware coder supported according to computer system, AMD hardware are compiled Code any one of device or Nvidia hardware coder carry out H264 Video coding;
The Intel hardware coder, for carrying out H264 video volume to the computer system for supporting Intel hardware encoding Code;
The AMD hardware coder, for carrying out H264 Video coding to the computer system for supporting AMD hardware encoding;
The Nvidia hardware coder, for carrying out H264 video to the computer system for supporting Nvidia hardware encoding Coding.
In one embodiment of the present of invention, the universal coding module includes universaling coder interface sub-module and encoder Implementation sub-module, in which:
The universaling coder interface sub-module includes for realizing the definition to encoder interfaces, the encoder interfaces File Open interface, encoder type obtain interface, encoder creates interface, the throttling interface that writes, closing of a file interface, In:
The File Open interface is used to open the file of coding result to be written, or establishes real-time messages transport protocol (Time Messaging Protocol, RTMP) connection or real time streaming transport protocol (Real Time Streaming Protocol, RTSP) connection, the input parameter of the File Open interface includes file path and reading and writing of files parameter;
The encoder type obtains interface for obtaining the encoder type that computer system is supported, so that the volume The hardware coder for the encoder type creation respective type that code device creation interface is supported according to the computer system;
The encoder creation interface is used to obtain the encoder type that interface returns according to the encoder type and create The encoder of respective type, input parameter are encoder type, are exported as respective type encoder, the encoder type is Intel hardware coder perhaps AMD hardware coder or Nvidia hardware coder;
The throttling interface that writes is used to the byte stream after coding be written in the file of above-mentioned coding result to be written, or Person is sent to RTMP server by the connection of RTMP agreement, or is sent to RTSP server by the connection of RTSP agreement;
The closing of a file interface is used to close the file being currently written into after end-of-encode, or closes established The connection of RTMP agreement or the connection of RTSP agreement;
The encoder implementation sub-module is for determining encoder interfaces according to above-mentioned universaling coder interface sub-module Justice creation encoder interfaces judge the hardware coder that computer system is supported using the encoder interfaces of creation, and selection is adjusted H264 volume is carried out with any pair of video in Intel hardware coder, AMD hardware coder or Nvidia hardware coder Code.
In one embodiment of the present of invention, the encoder interfaces further include written document head interface, and the written document head connects Mouth is used for written document head, includes the H264 sequence sets parameter and PPSH264 image set ginseng of video encoder in the file header Number, the H264 sequence sets parameter and PPSH264 image set parameter are used to use in decoder decoding.
In one embodiment of the present of invention, the encoder interfaces further include metadata information setting interface, the member number It is believed that the metadata information that breath setting interface is used to be arranged in file.
In one embodiment of the present of invention, the encoder creation interface includes that encoder opens interface, encoder is closed Interface and image addressable port, in which:
The encoder opens interface and is used to open encoder, and input parameter includes the view wide, to be encoded of video to be encoded The height of frequency and the code rate of coding;
Described image addressable port is used for after above-mentioned encoder opening, and using encoder coded image, inputting parameter is The image and scramble time stamp to be encoded;
The encoder down interface is used for after end-of-encode, closes the encoder of above-mentioned opening.
In one embodiment of the present of invention, the encoder type obtains interface and obtains the coding that computer system is supported Device type specifically:
If returning to CT_QSV264, indicate that computer system supports Intel hardware encoding;
If returning to CT_AMD264, indicate that computer system supports AMD hardware encoding;
If returning to CT_NV264, indicate that computer system supports Nvidia hardware encoding;
If returning to CT_X264, indicate that computer system does not support any hardware encoding.
In one embodiment of the present of invention, described image addressable port specifically include byte streambuf setting up submodule, Submodule, video frame Presentation Time Stamp setting submodule, screen frame decoding time stamp setting is arranged in byte stream buffer size Module, key frame judging submodule and image addressable port discharge submodule, in which:
The byte streambuf setting up submodule is used for the decoded H264 byte streambuf of decoder for establishing,
Submodule is arranged in the byte stream buffer size, for being arranged for the decoded H264 byte stream buffering of decoder Area's size;
Submodule is arranged in the video frame Presentation Time Stamp, shows the time for the decoded video frame of decoder for being arranged Stamp;
The screen frame decoding time stamp setting submodule, for screen frame decoding time stamp to be arranged;
The key frame judging submodule, for judging whether present frame is key frame;
Described image addressable port discharges submodule, for discharging present image addressable port.
In one embodiment of the present of invention, the Intel hardware coder includes Intel hardware coder initialization submodule Block, Intel hardware coder encoding submodule and Intel hardware coder close submodule, in which:
The Intel hardware coder initialization submodule specifically includes SDK for initializing Intel hardware coder Initialization submodule, coding initialization submodule, video memory distribution sub module and Intel parameter acquisition submodule, in which:
The SDK initialization submodule is used to call the MediaSDK of MFXInit initialization Intel official;
The coding initialization submodule is for calling MFXVideoENCODE_Init to initialize encoder;
The video memory distribution sub module is specifically included for distributing the video memory surface for being used to receive image to be encoded;
MFXVideoENCODE_QueryIOSurf is called to obtain the video memory number of surfaces for needing to create;
IDirect3DDeviceManager9 interface is created, for providing video acceleration function;
The OpenDeviceHandle method of IDirect3DDeviceManager9 interface is called, equipment handle is obtained;
By the equipment handle of upper step, the side GetVideoService of IDirect3DDeviceManager9 interface is called Method creates the IDirectXVideoDecoderService of IID_IDirectXVideoDecoderService (interface IID) Interface;
The CreateSurface method that the IDirectXVideoDecoderService interface of creation is walked in calling has been come At the creation on video acceleration surface;
The Intel parameter acquisition submodule be used for initialization encoder success after, obtain H264 sequence sets parameter and H264 image set parameter;
The Intel hardware coder encoding submodule is used to carry out H264 coding to video, specifically includes image coding Submodule and synchronous submodule, in which:
Described image encoding submodule, for calling MFXVideoENCODE_EncodeFrameAsync to NV12 format Image encoded;
The synchronous submodule is for calling MFXVideoCORE_SyncOperation to carry out between CPU and GPU It is synchronous, obtain the data flow that hardware encoding returns;
The Intel hardware coder closes submodule and is used to call MFXVideoENCODE_Close when stopping coding Encoder is closed, carries out the release of resource, and call MFXClose to close Intel MediaSDK.
In one embodiment of the present of invention, the AMD hardware coder include AMD hardware coder initialization submodule, AMD hardware coder encoding submodule and AMD hardware coder close submodule, in which:
The AMD hardware coder initialization submodule specifically includes DLL load for initializing AMD hardware coder Submodule, interface creation submodule, parameter setting submodule and AMD parameter acquisition submodule, in which:
The DLL load submodule is for loading amf-core-windesktop32.dll and amf-component- vce-windesktop32.dll;
The interface creation submodule is for calling AMFCreateContext to create AMFContext interface, and calling AMFCreateComponent creates AMFComponent interface,
The parameter setting submodule is used to call the SetProperty of AMFComponent interface that relevant coding is arranged Parameter, the coding parameter include resolution ratio, code rate and frame per second;And the Init method of AMFComponent interface is called to complete to compile The initialization of code device;
The AMD parameter acquisition submodule is used to call the GetProperty method of AMFComponent interface, obtains The H264 sequence sets parameter and PPSH264 image set parameter of AMF_VIDEO_ENCODER_EXTRADATA enumeration type;
The AMD hardware coder encoding submodule is used to carry out H264 coding to video, specifically includes video surface point Submodule and AMD byte stream acquisition submodule are submitted in sub-module, video surface, in which:
The video surface distribution submodule is used to call the AllocSurface method of AMFContext interface to distribute and uses To receive the video surface of image to be encoded;
The video surface submits submodule for calling the SubmitInput method of AMFComponent interface, will be upper The video surface generated in step is submitted in encoder;
The AMD byte stream acquisition submodule is used to call the QueryOutput method of AMFComponent interface, obtains Byte stream after encoder coding;
The AMD hardware coder closes submodule, for calling AMFComponent interface when stopping coding Terminate method closes encoder, carries out the release of resource.
In one embodiment of the present of invention, the Nvidia hardware coder includes the initial beggar of Nvidia hardware coder Module, Nvidia hardware coder encoding submodule and Nvidia hardware coder close submodule, in which:
The Nvidia hardware coder initialization submodule specifically includes volume for initializing Nvidia hardware coder Code context initialization submodule, Nvidia parameter setting submodule, Nvidia parameter acquisition submodule and the creation of video memory surface Submodule, in which:
For the coding environment initialization submodule for loading nvcuda.dll and nvEncodeAPI.dll, initialization must The environment wanted;And the NvEncodeAPICreateInstance method of nvEncodeAPI module is called to create NV_ENCODE_ API_FUNCTION_LIST structure;And cuCtxCreate_v2 interface is called to create context environmental;
The Nvidia parameter setting submodule is for calling nvEncOpenEncodeSessionEx method creation coding Device session, and call nvEncGetEncodePresetConfig to be configured coder parameters, and call The initialization of nvEncInitializeEncoder completion encoder;
The Nvidia parameter acquisition submodule is NV_ for calling nvEncGetSequenceParams to obtain type The H264 sequence sets parameter and PPSH264 image set parameter of ENC_SEQUENCE_PARAM_PAYLOAD_VER;
The video memory surface creation submodule is for calling nvEncCreateInputBuffer creation to be used to receive wait compile The video memory surface of the image data of code, and call nvEncCreateBitstreamBuffer creation coding output storing data;
The Nvidia hardware coder encoding submodule is used to carry out H264 coding to video, specifically includes filling coding Image submodule, encoding submodule and Nvidia byte stream acquisition submodule, in which:
The filling coded image submodule is for calling nvEncLockInputBuffer to lock above-mentioned video memory surface wound The video memory surface of submodule creation is built, and fills coded image;And call nvEncUnlockInputBuffer to the video memory table Face is unlocked;
The encoding submodule is for calling nvEncEncodePicture to be encoded;
What the Nvidia byte stream acquisition submodule was used to return after calling nvEncLockBitstream to obtain coding Byte stream calls nvEncUnlockBitstream to discharge byte stream after doing corresponding processing;
The Nvidia hardware coder closes submodule, for calling when stopping coding NvEncDestroyEncoder closes encoder, and cuCtxDestroy_v2 is called to discharge current environment context.
H264 hardware encoding system provided by the invention based on tri- platform of Intel, AMD and Nvidia, can judge to count The hardware coder type that calculation machine system is supported, and according to the hardware coder type Selection and call Intel hardware encoding Any pair of video for needing to play in the computer system in device, AMD hardware coder or Nvidia hardware coder H264 coding is carried out, so as to the offer H264 hardware encoding to a variety of different computer system platform unawares.
Detailed description of the invention
Fig. 1 is the knot of the H264 hardware encoding system in the embodiment of the present invention based on tri- platform of Intel, AMD and Nvidia Structure schematic diagram;
Fig. 2 is the structural schematic diagram of universaling coder interface sub-module in the embodiment of the present invention;
Fig. 3 is the structural schematic diagram of Intel hardware coder in the embodiment of the present invention;
Fig. 4 is the structural schematic diagram of AMD hardware coder in the embodiment of the present invention;
Fig. 5 is the structural schematic diagram of Nvidia hardware coder in the embodiment of the present invention;
Fig. 6 is that the uml class diagram of hardware encoding system in the embodiment of the present invention is intended to.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and It is not used in the restriction present invention.As long as in addition, technical characteristic involved in the various embodiments of the present invention described below Not constituting a conflict with each other can be combined with each other.
As shown in Figure 1, the present invention provides a kind of H264 hardware encoding systems based on tri- platform of Intel, AMD and Nvidia System, including universal coding module, Intel hardware coder, AMD hardware coder and Nvidia hardware coder, in which:
The universal coding module judges the hardware encoding that computer system is supported for creating universal coding interface Device type, the hardware coder type Selection and call Intel hardware coder supported according to computer system, AMD hardware are compiled Code any one of device or Nvidia hardware coder carry out H264 Video coding;
Specifically, as shown in Fig. 2, the universal coding module includes that universaling coder interface sub-module and encoder execute Submodule, in which:
The universaling coder interface sub-module includes for realizing the definition to encoder interfaces, the encoder interfaces File Open interface, encoder type obtain interface, encoder creates interface, the throttling interface that writes, closing of a file interface, In:
The File Open interface is used to open the file of coding result to be written, either establish RTMP agreement connection or The connection of RTSP agreement, the input parameter of the File Open interface includes file path and reading and writing of files parameter;The file road Diameter is the file path of local disk, or with RTMP: the RTMP agreement URL of //XXX beginning, or with RTSP: //XXX The RTSP agreement URL of beginning, the reading and writing of files parameter are write-in;
The encoder type obtains interface for obtaining the encoder type that computer system is supported, so that the volume The hardware coder for the encoder type creation respective type that code device creation interface is supported according to the computer system;
The encoder creation interface is used to obtain the encoder type that interface returns according to the encoder type and create The encoder of respective type, input parameter are encoder type, are exported as respective type encoder, the encoder type is Intel hardware coder perhaps AMD hardware coder or Nvidia hardware coder;Wherein the encoder creates interface Interface, encoder down interface and image addressable port are opened including encoder, in which:
The encoder opens interface and is used to open encoder, and input parameter includes the view wide, to be encoded of video to be encoded The height of frequency and the code rate of coding;
Described image addressable port is used for after above-mentioned encoder opening, and using encoder coded image, inputting parameter is The image and scramble time stamp to be encoded;
Wherein described image addressable port specifically includes byte streambuf setting up submodule, byte stream buffer size is set It sets submodule, video frame Presentation Time Stamp setting submodule, screen frame decoding time stamp setting submodule, key frame and judges submodule Block and image addressable port discharge submodule, in which:
The byte streambuf setting up submodule is used for the decoded H264 byte streambuf of decoder for establishing,
Submodule is arranged in the byte stream buffer size, for being arranged for the decoded H264 byte stream buffering of decoder Area's size;
Submodule is arranged in the video frame Presentation Time Stamp, shows the time for the decoded video frame of decoder for being arranged Stamp;
The screen frame decoding time stamp setting submodule, for screen frame decoding time stamp to be arranged;
The key frame judging submodule, for judging whether present frame is key frame;
Described image addressable port discharges submodule, for discharging present image addressable port.
The encoder down interface is used for after end-of-encode, closes the encoder of above-mentioned opening.
The throttling interface that writes is used to the byte stream after coding be written in the file of above-mentioned coding result to be written, or Person is sent to RTMP server by the connection of RTMP agreement, or is sent to RTSP server by the connection of RTSP agreement;
The closing of a file interface is used to close the file being currently written into after end-of-encode, or closes established The connection of RTMP agreement or the connection of RTSP agreement;
Specifically, the encoder type obtains interface and obtains the encoder type that computer system is supported specifically:
If returning to CT_QSV264, indicate that computer system supports Intel hardware encoding;
If returning to CT_AMD264, indicate that computer system supports AMD hardware encoding;
If returning to CT_NV264, indicate that computer system supports Nvidia hardware encoding;
If returning to CT_X264, indicate that computer system does not support any hardware encoding.
Further, the encoder interfaces further include written document head interface, and the written document head interface is used for written document Head includes the H264 sequence sets parameter and PPSH264 image set parameter of video encoder, the H264 sequence in the file header Column collection parameter and PPSH264 image set parameter are used to use in decoder decoding.
Further, the encoder interfaces further include metadata information setting interface, and the metadata information setting connects Metadata information of the mouth for being arranged in file.
The encoder implementation sub-module is for determining encoder interfaces according to above-mentioned universaling coder interface sub-module Justice creation encoder interfaces judge the hardware coder that computer system is supported using the encoder interfaces of creation, and selection is adjusted H264 volume is carried out with any pair of video in Intel hardware coder, AMD hardware coder or Nvidia hardware coder Code, in which:
The Intel hardware coder, for carrying out H264 video volume to the computer system for supporting Intel hardware encoding Code;
Specifically, as shown in figure 3, the Intel hardware coder include Intel hardware coder initialization submodule, Intel hardware coder encoding submodule and Intel hardware coder close submodule, in which:
The Intel hardware coder initialization submodule specifically includes SDK for initializing Intel hardware coder Initialization submodule, coding initialization submodule, video memory distribution sub module and Intel parameter acquisition submodule, in which:
The SDK initialization submodule is used to call the MediaSDK of MFXInit initialization Intel official;
The coding initialization submodule is for calling MFXVideoENCODE_Init to initialize encoder;
The video memory distribution sub module is specifically included for distributing the video memory surface for being used to receive image to be encoded;
MFXVideoENCODE_QueryIOSurf is called to obtain the video memory number of surfaces for needing to create;
IDirect3DDeviceManager9 interface is created, for providing video acceleration function;
The OpenDeviceHandle method of IDirect3DDeviceManager9 interface is called, equipment handle is obtained;
By the equipment handle of upper step, the side GetVideoService of IDirect3DDeviceManager9 interface is called Method creates the IDirectXVideoDecoderService of IID_IDirectXVideoDecoderService (interface IID) Interface;
The CreateSurface method that the IDirectXVideoDecoderService interface of creation is walked in calling has been come At the creation on video acceleration surface;
The Intel parameter acquisition submodule be used for initialization encoder success after, obtain H264 sequence sets parameter and H264 image set parameter;
The Intel hardware coder encoding submodule is used to carry out H264 coding to video, specifically includes image coding Submodule and synchronous submodule, in which:
Described image encoding submodule, for calling MFXVideoENCODE_EncodeFrameAsync to NV12 format Image encoded;
The synchronous submodule is for calling MFXVideoCORE_SyncOperation to carry out between CPU and GPU It is synchronous, obtain the data flow that hardware encoding returns;
The Intel hardware coder closes submodule and is used to call MFXVideoENCODE_Close when stopping coding Encoder is closed, carries out the release of resource, and call MFXClose to close Intel MediaSDK.
The AMD hardware coder, for carrying out H264 Video coding to the computer system for supporting AMD hardware encoding;
Specifically, as shown in figure 4, the AMD hardware coder includes AMD hardware coder initialization submodule, AMD hard Part encoder encoding submodule and AMD hardware coder close submodule, in which:
The AMD hardware coder initialization submodule specifically includes DLL load for initializing AMD hardware coder Submodule, interface creation submodule, parameter setting submodule and AMD parameter acquisition submodule, in which:
The DLL load submodule is for loading amf-core-windesktop32.dll and amf-component- vce-windesktop32.dll;
The interface creation submodule is for calling AMFCreateContext to create AMFContext interface, and calling AMFCreateComponent creates AMFComponent interface,
The parameter setting submodule is used to call the SetProperty of AMFComponent interface that relevant coding is arranged Parameter, the coding parameter include resolution ratio, code rate and frame per second;And the Init method of AMFComponent interface is called to complete to compile The initialization of code device;
The AMD parameter acquisition submodule is used to call the GetProperty method of AMFComponent interface, obtains The H264 sequence sets parameter and PPSH264 image set parameter of AMF_VIDEO_ENCODER_EXTRADATA enumeration type;
The AMD hardware coder encoding submodule is used to carry out H264 coding to video, specifically includes video surface point Submodule and AMD byte stream acquisition submodule are submitted in sub-module, video surface, in which:
The video surface distribution submodule is used to call the AllocSurface method of AMFContext interface to distribute and uses To receive the video surface of image to be encoded;
The video surface submits submodule for calling the SubmitInput method of AMFComponent interface, will be upper The video surface generated in step is submitted in encoder;
The AMD byte stream acquisition submodule is used to call the QueryOutput method of AMFComponent interface, obtains Byte stream after encoder coding;
The AMD hardware coder closes submodule, for calling AMFComponent interface when stopping coding Terminate method closes encoder, carries out the release of resource.
The Nvidia hardware coder, for carrying out H264 video to the computer system for supporting Nvidia hardware encoding Coding.
Specifically, as shown in figure 5, the Nvidia hardware coder includes Nvidia hardware coder initialization submodule Block, Nvidia hardware coder encoding submodule and Nvidia hardware coder close submodule, in which:
The Nvidia hardware coder initialization submodule specifically includes volume for initializing Nvidia hardware coder Code context initialization submodule, Nvidia parameter setting submodule, Nvidia parameter acquisition submodule and the creation of video memory surface Submodule, in which:
For the coding environment initialization submodule for loading nvcuda.dll and nvEncodeAPI.dll, initialization must The environment wanted;And the NvEncodeAPICreateInstance method of nvEncodeAPI module is called to create NV_ENCODE_ API_FUNCTION_LIST structure;And cuCtxCreate_v2 interface is called to create context environmental;
The Nvidia parameter setting submodule is for calling nvEncOpenEncodeSessionEx method creation coding Device session, and call nvEncGetEncodePresetConfig to be configured coder parameters, and call The initialization of nvEncInitializeEncoder completion encoder;
The Nvidia parameter acquisition submodule is NV_ for calling nvEncGetSequenceParams to obtain type The H264 sequence sets parameter and PPSH264 image set parameter of ENC_SEQUENCE_PARAM_PAYLOAD_VER;
The video memory surface creation submodule is for calling nvEncCreateInputBuffer creation to be used to receive wait compile The video memory surface of the image data of code, and call nvEncCreateBitstreamBuffer creation coding output storing data;
The Nvidia hardware coder encoding submodule is used to carry out H264 coding to video, specifically includes filling coding Image submodule, encoding submodule and Nvidia byte stream acquisition submodule, in which:
The filling coded image submodule is for calling nvEncLockInputBuffer to lock above-mentioned video memory surface wound The video memory surface of submodule creation is built, and fills coded image;And call nvEncUnlockInputBuffer to the video memory table Face is unlocked;
The encoding submodule is for calling nvEncEncodePicture to be encoded;
What the Nvidia byte stream acquisition submodule was used to return after calling nvEncLockBitstream to obtain coding Byte stream calls nvEncUnlockBitstream to discharge byte stream after doing corresponding processing;
The Nvidia hardware coder closes submodule, for calling when stopping coding NvEncDestroyEncoder closes encoder, and cuCtxDestroy_v2 is called to discharge current environment context.
Specifically, hardware differences can be shielded by providing unified interface in embodiments of the present invention, by such as UML (Unified Modeling Language) class figure shown in fig. 6 describes the technical program to the hardware encodings of three large platforms encapsulation and right The encapsulation of libx264 software encoder.
It is corresponding with AmdEncoder, NvidiaEncoder, QsvEncoder and X264Encoder, they respectively represent AMD hardware coder, Nvidia hardware coder, Intel hardware coder and x264 software encoder, they inherit From BaseEncoder interface, BaseEncoder interface inheritance is from IMediaEncoder interface, and IMediaEncoder is exactly The final abstract interface that unitizes, method provided by the interface write exactly in figure including (Open, open encoder, Close closes encoder, Encode, coding etc.) specific interface is defined as follows:
1, IMediaFile interface
(1.1)bool Open(char*filepath,bool write)
File is opened, filepath parameter represents file path, it can is the file path of local disk, is also possible to The RTMP agreement URL of RTMP: //XXX beginning, is also possible to RTSP: RTSP agreement URL, write the parameter generation of //XXX beginning Table is to read file or written document, should be that should be true in coding.
(1.2)IMediaEncoder*CreateEncoder(CodecType type)
Encoder is created, parameter type is the type of encoder, and return value is IMediaEncoder interface
(1.3)bool WriteFileHeader()
Written document head includes SPS, PPS information of video encoder in file header, is used for decoder in multimedia file Decoding
(1.4)bool WritePacket(IRawPacket*pkt)
For writing the byte stream after coding, byte stream can both be saved in local disk file by this method, can also be with It is sent to RTMP server with RTMP agreement is crossed, the byte stream that will be write and relevant information are contained in parameter pkt
(1.5)int64_t SizeWritten()
For returning to the byte number write
(1.6)void SetMetaDataInformation(const std::string&key,const std:: string&value)
MetaData (metadata) information for being arranged in file
(1.7)bool Close()
File, the RTMP agreement that the file write can be closed or sent are closed, and closes H264 encoder, is discharged Resource
2, CodecType enumeration type
(2.1)CT_VIDEOBEST
The hardware coder for automatically selecting support is represented, can be used to judge that current system supports which type of hardware to compile Code device
(2.2)CT_X264
Represent libx264 software encoder
(2.3)CT_QSV264
Represent Intel hardware coder
(2.4)CT_AMD264
Code AMD platform hardware encoder
3IMediaEncoder interface
The interface is obtained by the CreateEncoder interface of IMediaFile
(3.1)bool Open(int width,int height,int bitrate)
Encoder is opened, parameter width is the width of video to be encoded, and height is the height of video to be encoded, and bitrate is The code rate of coding
(3.2)bool Close()
Close encoder
(3.3)IRawPacket*Encode(uint8_t*pixels[3],int64_t stamp)
Coded image, parameter pixles are the image to be encoded, and stamp is scramble time stamp, return to IRawPacket and connect Mouthful
(3.4)CodecType GetCodecType()
Obtain the type of encoder
4, IRawPacket interface
The interface is the H264 byte stream interface returned when IMediaEncoder is encoded
(4.1)uint8_t*Buffer()
H264 byte streambuf is decoded for decoder
(4.2)int Size()
H264 byte stream buffer size is decoded for decoder
(4.3)int64_t Pts()
Video frame Presentation Time Stamp is decoded for decoder
(4.4)int64_t Dts()
Screen frame decoding time stamp
(4.5)bool Keyframe()
Judge whether it is key frame
(4.6)Release()
Discharge the interface
5 modules export function
IMediaFile*CreateMediaFile(ContainerFormat cf)
The function is that the DLL in the ylmediaengine module of the technical solution exports function, for creating one IMediaFile interface can create hardware H264 encoder by the IMediaFile interface of the creation.
It is illustrated how below with reference to a specific example hard using above system progress H264 in actual computer system Part coding, such as by the IMediaFile interface, be broadcast live in platform (such as companion is broadcast live in bucket fish TV) and use in a kind of game The interface carries out hardware encoding and the picture after coding is pushed to bucket fish TV server, is broadcast live, specifically, realizes step It is as follows:
(6.1) CreateMediaFile function creation IMediaFile interface is called;
(6.2) it calls the CreateEncoder method of IMediaFile interface to create IMediaEncoder interface, is passed to Parameter be CT_VIDEOBEST;
(6.3) the GetCodecType method of the IMediaEncoder interface in calling in step, obtains current encoder Type.When returning to CT_QSV264, system supports Intel hardware encoding, and system supports AMD hardware to compile when returning to CT_AMD264 Code, system supports Nvidia hardware encoding when returning to CT_NV264, and system does not support any hardware encoding when returning to CT_X264; Such as:
When system video card type are as follows: when Nvidia 740 type of GeForce, support Nvidia hardware encoding;When system is aobvious Card Type are as follows: when Intel (R) HD Graphics, support Intel hardware encoding;When system video card type are as follows: AMD Radeon When HD 7700Series, AMD hardware encoding is supported
(6.4) encoder is initialized
Select resolution ratio for 1920*1080, frame number selects 25FPS, code rate selection 1600, and encoder selects AMD hardware to compile Code.
By the IMediaDecoder interface created in step (6.2), call the Open method of the interface, and by these Parameter is passed in Open method, carries out the initialization of encoder;
(6.5) RTMP server is connected
After initializing encoder success, the Open method of IMediaFile is called, connects RTMP server;
(6.6) H264 information are sent to RTMP server
After connecting the success of RTMP server, the WriteFileHeader method of IMediaFile is called, the head of video is believed The RTMP server sent is ceased, is decoded for player;
(6.7) it is encoded
After above procedure all succeeds, the Encode method of IMediaEncoder can be called, companion's preview window will be broadcast live Picture in mouthful is encoded, and returns to IRawPacket interface;
(6.8) pushing video stream
By the IRawPacket interface returned in upper step, the WritePacket method of IMediaFile is called, will be encoded The RTMP server of pushing video streaming afterwards.
By above step, just realizes using hardware encoding in the embodiment of the present invention, image is pushed to RTMP service The process that device is broadcast live.
As it will be easily appreciated by one skilled in the art that the foregoing is merely illustrative of the preferred embodiments of the present invention, not to The limitation present invention, any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should all include Within protection scope of the present invention.

Claims (10)

1.一种基于Intel、AMD和Nvidia三平台的H264硬件编码系统,其特征在于,包括通用编码模块以及所述通用编码模块创建的硬件编码器,所述硬件编码器包括Intel硬件编码器、AMD硬件编码器以及Nvidia硬件编码器中的任一种,其中:1. a kind of H264 hardware coding system based on Intel, AMD and Nvidia three platforms, it is characterized in that, comprise the hardware coder that general coding module and described general coding module are created, and described hardware coder comprises Intel hardware coder, AMD Hardware encoder and any of Nvidia hardware encoder, where: 所述通用编码模块包括通用编码器接口子模块和编码器执行子模块,所述通用编码器接口子模块用于进行编码器接口的定义;The universal encoding module includes a universal encoder interface submodule and an encoder execution submodule, and the universal encoder interface submodule is used to define an encoder interface; 所述编码器执行子模块用于根据定义创建编码器接口;编码器接口包括编码器类型获取接口和编码器创建接口;The encoder execution submodule is used to create an encoder interface according to the definition; the encoder interface includes an encoder type acquisition interface and an encoder creation interface; 所述编码器类型获取接口用于判断计算机系统所支持的编码器类型,编码器创建接口根据编码器类型获取接口返回的编码器类型创建相应类型的硬件编码器对视频进行H264编码;The encoder type acquisition interface is used to judge the encoder type supported by the computer system, and the encoder creation interface creates a hardware encoder of a corresponding type to perform H264 encoding on the video according to the encoder type returned by the encoder type acquisition interface; 所述Intel硬件编码器,用于对支持Intel硬件编码的计算机系统进行H264视频编码;Described Intel hardware encoder, is used to carry out H264 video encoding to the computer system that supports Intel hardware encoding; 所述AMD硬件编码器,用于对支持AMD硬件编码的计算机系统进行H264视频编码;The AMD hardware encoder is used to perform H264 video encoding on a computer system that supports AMD hardware encoding; 所述Nvidia硬件编码器,用于对支持Nvidia硬件编码的计算机系统进行H264视频编码。The Nvidia hardware encoder is used to perform H264 video encoding on a computer system that supports Nvidia hardware encoding. 2.如权利要求1所述的基于Intel、AMD和Nvidia三平台的H264硬件编码系统,其特征在于,2. the H264 hardware coding system based on three platforms of Intel, AMD and Nvidia as claimed in claim 1, is characterized in that, 所述编码器接口还包括文件打开接口、写字节流接口、文件关闭接口,其中:The encoder interface also includes a file open interface, a write byte stream interface, and a file close interface, wherein: 所述文件打开接口用于打开欲写入编码结果的文件,或者建立RTMP协议连接或者RTSP协议连接,所述文件打开接口的输入参数包括文件路径和读写文件参数;The file opening interface is used to open the file to be written in the encoding result, or establish an RTMP protocol connection or an RTSP protocol connection, and the input parameters of the file opening interface include a file path and a read-write file parameter; 所述写字节流接口用于将编码后的字节流写入上述欲写入编码结果的文件中,或者通过RTMP协议连接发送到RTMP服务器,或者通过RTSP协议连接发送到RTSP服务器;The write byte stream interface is used to write the encoded byte stream into the above-mentioned file to be written in the encoding result, or to be sent to the RTMP server through the RTMP protocol connection, or to the RTSP server through the RTSP protocol connection; 所述文件关闭接口用于在编码结束后关闭正在写入的文件,或者关闭已建立的RTMP协议连接或者RTSP协议连接。The file closing interface is used to close the file being written after encoding, or close the established RTMP protocol connection or RTSP protocol connection. 3.如权利要求2所述的基于Intel、AMD和Nvidia三平台的H264硬件编码系统,其特征在于,所述编码器接口还包括写文件头接口,所述写文件头接口用于写文件头,所述文件头中包括了视频编码器的H264序列集参数和PPSH264图像集参数,所述H264序列集参数和PPSH264图像集参数用于在解码器解码时使用。3. the H264 hardware coding system based on Intel, AMD and Nvidia three platforms as claimed in claim 2, it is characterised in that the encoder interface also comprises a write file header interface, and the write file header interface is used for writing a file header , the file header includes H264 sequence set parameters and PPSH264 image set parameters of the video encoder, and the H264 sequence set parameters and PPSH264 image set parameters are used when the decoder decodes. 4.如权利要求2所述的基于Intel、AMD和Nvidia三平台的H264硬件编码系统,其特征在于,所述编码器接口还包括元数据信息设置接口,所述元数据信息设置接口用于设置文件中的元数据信息。4. the H264 hardware encoding system based on Intel, AMD and Nvidia three platforms as claimed in claim 2, is characterized in that, described encoder interface also comprises metadata information setting interface, and described metadata information setting interface is used for setting Metadata information in the file. 5.如权利要求2至4任一项所述的基于Intel、AMD和Nvidia三平台的H264硬件编码系统,其特征在于,所述编码器创建接口包括编码器打开接口、编码器关闭接口以及图像编码接口,其中:5. the H264 hardware encoding system based on Intel, AMD and Nvidia three platforms as described in any one of claim 2 to 4, it is characterised in that described encoder creation interface comprises encoder open interface, encoder close interface and image Encoding interface, where: 所述编码器打开接口用于打开编码器,输入参数包括待编码视频的宽、待编码视频的高以及编码的码率;The encoder opening interface is used to open the encoder, and the input parameters include the width of the video to be encoded, the height of the video to be encoded and the code rate of encoding; 所述图像编码接口用于在上述编码器打开后,利用编码器编码图像,输入参数为要编码的图像和编码时间戳;The image encoding interface is used to encode an image using the encoder after the encoder is turned on, and the input parameters are the image to be encoded and the encoding timestamp; 所述编码器关闭接口用于在编码结束后,关闭上述打开的编码器。The encoder closing interface is used to close the open encoder after the encoding ends. 6.如权利要求2至4任一项所述的基于Intel、AMD和Nvidia三平台的H264硬件编码系统,其特征在于,所述编码器类型获取接口获取计算机系统所支持的编码器类型具体为:6. the H264 hardware encoding system based on three platforms of Intel, AMD and Nvidia as described in any one of claims 2 to 4, it is characterized in that, the encoder type that described encoder type acquisition interface obtains computer system supports is specially : 若返回CT_QSV264,表示计算机系统支持Intel硬件编码;If it returns CT_QSV264, it means that the computer system supports Intel hardware encoding; 若返回CT_AMD264,表示计算机系统支持AMD硬件编码;If it returns CT_AMD264, it means that the computer system supports AMD hardware encoding; 若返回CT_NV264,表示计算机系统支持Nvidia硬件编码;If it returns CT_NV264, it means that the computer system supports Nvidia hardware encoding; 若返回CT_X264,表示计算机系统不支持任何硬件编码。If CT_X264 is returned, it means that the computer system does not support any hardware encoding. 7.如权利要求5所述的基于Intel、AMD和Nvidia三平台的H264硬件编码系统,其特征在于,所述图像编码接口具体包括字节流缓冲区建立子模块、字节流缓冲区大小设置子模块、视频帧显示时间戳设置子模块、视屏帧解码时间戳设置子模块、关键帧判断子模块以及图像编码接口释放子模块,其中:7. the H264 hardware encoding system based on three platforms of Intel, AMD and Nvidia as claimed in claim 5, is characterized in that, described image encoding interface specifically comprises byte stream buffer to establish submodule, byte stream buffer size setting sub-module, video frame display timestamp setting sub-module, video frame decoding timestamp setting sub-module, key frame judgment sub-module and image coding interface release sub-module, wherein: 所述字节流缓冲区建立子模块,用于建立用于解码器解码的H264字节流缓冲区,The byte stream buffer establishment submodule is used to establish the H264 byte stream buffer used for decoding by the decoder, 所述字节流缓冲区大小设置子模块,用于设置用于解码器解码的H264字节流缓冲区大小;The byte stream buffer size setting submodule is used to set the H264 byte stream buffer size used for decoding by the decoder; 所述视频帧显示时间戳设置子模块,用于设置用于解码器解码的视频帧显示时间戳;The video frame display timestamp setting submodule is used for setting the video frame display timestamp for decoding by the decoder; 所述视屏帧解码时间戳设置子模块,用于设置视屏帧解码时间戳;The video frame decoding time stamp setting submodule is used to set the video frame decoding time stamp; 所述关键帧判断子模块,用于判断当前帧是否为关键帧;The key frame judgment submodule is used to judge whether the current frame is a key frame; 所述图像编码接口释放子模块,用于释放当前图像编码接口。The image coding interface release submodule is used to release the current image coding interface. 8.如权利要求1或2所述的基于Intel、AMD和Nvidia三平台的H264硬件编码系统,其特征在于,所述Intel硬件编码器包括Intel硬件编码器初始化子模块、Intel硬件编码器编码子模块以及Intel硬件编码器关闭子模块,其中:8. the H264 hardware coding system based on three platforms of Intel, AMD and Nvidia as claimed in claim 1 or 2, is characterized in that, described Intel hardware encoder comprises Intel hardware encoder initialization submodule, Intel hardware encoder encoder submodule module as well as the Intel hardware encoder shutdown submodule, where: 所述Intel硬件编码器初始化子模块用于初始化Intel硬件编码器,具体包括SDK初始化子模块、编码初始化子模块、显存分配子模块和Intel参数获取子模块,其中:The Intel hardware encoder initialization submodule is used to initialize the Intel hardware encoder, and specifically includes the SDK initialization submodule, the coding initialization submodule, the display memory allocation submodule and the Intel parameter acquisition submodule, wherein: 所述SDK初始化子模块用于调用MFXInit初始化Intel官方的MediaSDK;The SDK initialization submodule is used to call MFXInit to initialize Intel's official MediaSDK; 所述编码初始化子模块用于调用MFXVideoENCODE_Init来初始化编码器;The encoding initialization submodule is used to call MFXVideoENCODE_Init to initialize the encoder; 所述显存分配子模块,用于分配用来接收待编码的图像的显存表面,具体包括;The video memory allocation sub-module is used for allocating a video memory surface used to receive the image to be encoded, and specifically includes; 调用MFXVideoENCODE_QueryIOSurf来获取需要创建的显存表面数量;Call MFXVideoENCODE_QueryIOSurf to get the number of video memory surfaces that need to be created; 创建IDirect3DDeviceManager9接口,用来提供视频加速功能;Create the IDirect3DDeviceManager9 interface to provide video acceleration; 调用IDirect3DDeviceManager9接口的OpenDeviceHandle方法,获取设备句柄;Call the OpenDeviceHandle method of the IDirect3DDeviceManager9 interface to obtain the device handle; 通过上步的设备句柄,调用IDirect3DDeviceManager9接口的GetVideoService方法,创建IID_IDirectXVideoDecoderService的IDirectXVideoDecoderService接口;Through the device handle of the previous step, call the GetVideoService method of the IDirect3DDeviceManager9 interface to create the IDirectXVideoDecoderService interface of IID_IDirectXVideoDecoderService; 调用上步创建的IDirectXVideoDecoderService接口的CreateSurface方法来完成视频加速表面的创建;Call the CreateSurface method of the IDirectXVideoDecoderService interface created in the previous step to complete the creation of the video acceleration surface; 所述Intel参数获取子模块用于在初始化编码器成功后,获取H264序列集参数和H264图像集参数;The Intel parameter acquisition submodule is used to acquire H264 sequence set parameters and H264 image set parameters after the encoder is initialized successfully; 所述Intel硬件编码器编码子模块用于对视频进行H264编码,具体包括图像编码子模块和同步子模块,其中:The Intel hardware encoder encoding submodule is used to encode the video in H264, and specifically includes an image encoding submodule and a synchronization submodule, wherein: 所述图像编码子模块,用于调用MFXVideoENCODE_EncodeFrameAsync对NV12格式的图像进行编码;Described image coding submodule, for calling MFXVideoENCODE_EncodeFrameAsync to encode the image of NV12 format; 所述同步子模块用于调用MFXVideoCORE_SyncOperation来进行CPU和GPU之间的同步,获取硬件编码返回的数据流;Described synchronization submodule is used for calling MFXVideoCORE_SyncOperation to carry out synchronization between CPU and GPU, and obtains the data stream returned by hardware encoding; 所述Intel硬件编码器关闭子模块用于在停止编码时调用MFXVideoENCODE_Close来关闭编码器,进行资源的释放,并调用MFXClose来关闭Intel MediaSDK。The Intel hardware encoder closing submodule is used to call MFXVideoENCODE_Close to close the encoder when stopping encoding, release resources, and call MFXClose to close Intel MediaSDK. 9.如权利要求1或2所述的基于Intel、AMD和Nvidia三平台的H264硬件编码系统,其特征在于,所述AMD硬件编码器包括AMD硬件编码器初始化子模块、AMD硬件编码器编码子模块以及AMD硬件编码器关闭子模块,其中:9. the H264 hardware encoding system based on Intel, AMD and Nvidia three platforms as claimed in claim 1 or 2, it is characterized in that, described AMD hardware encoder comprises AMD hardware encoder initialization submodule, AMD hardware encoder encoder submodule module as well as the AMD hardware encoder shutdown submodule, where: 所述AMD硬件编码器初始化子模块用于初始化AMD硬件编码器,具体包括DLL加载子模块、接口创建子模块、参数设置子模块以及AMD参数获取子模块,其中:The AMD hardware encoder initialization submodule is used to initialize the AMD hardware encoder, and specifically includes a DLL loading submodule, an interface creation submodule, a parameter setting submodule and an AMD parameter acquisition submodule, wherein: 所述DLL加载子模块用于加载amf-core-windesktop32.dll和amf-component-vce-windesktop32.dll;The DLL loading submodule is used to load amf-core-windesktop32.dll and amf-component-vce-windesktop32.dll; 所述接口创建子模块用于调用AMFCreateContext创建AMFContext接口,以及调用AMFCreateComponent创建AMFComponent接口,The interface creation submodule is used to call AMFCreateContext to create an AMFContext interface, and to call AMFCreateComponent to create an AMFComponent interface, 所述参数设置子模块用于调用AMFComponent接口的SetProperty设置相关的编码参数,所述编码参数包括分辨率,码率和帧率;并调用AMFComponent接口的Init方法完成编码器的初始化;The parameter setting submodule is used to call the SetProperty of the AMFComponent interface to set the relevant coding parameters, and the coding parameters include resolution, code rate and frame rate; and call the Init method of the AMFComponent interface to complete the initialization of the encoder; 所述AMD参数获取子模块用于调用AMFComponent接口的GetProperty方法,获取AMF_VIDEO_ENCODER_EXTRADATA枚举类型的H264序列集参数和PPSH264图像集参数;The AMD parameter acquisition submodule is used to call the GetProperty method of the AMFComponent interface, and obtains the H264 sequence set parameter and the PPSH264 image set parameter of the AMF_VIDEO_ENCODER_EXTRADATA enumeration type; 所述AMD硬件编码器编码子模块用于对视频进行H264编码,具体包括视频表面分配子模块、视频表面提交子模块以及AMD字节流获取子模块,其中:The AMD hardware encoder encoding submodule is used to encode the video in H264, and specifically includes a video surface allocation submodule, a video surface submission submodule, and an AMD byte stream acquisition submodule, wherein: 所述视频表面分配子模块用于调用AMFContext接口的AllocSurface方法分配用来接收待编码的图像的视频表面;The video surface allocation submodule is used to call the AllocSurface method of the AMFContext interface to allocate the video surface for receiving the image to be encoded; 所述视频表面提交子模块用于调用AMFComponent接口的SubmitInput方法,将生成的视频表面提交到编码器中;The video surface submission submodule is used to call the SubmitInput method of the AMFComponent interface, and the generated video surface is submitted to the encoder; 所述AMD字节流获取子模块用于调用AMFComponent接口的QueryOutput方法,获取编码器编码后的字节流;The AMD byte stream acquisition submodule is used to call the QueryOutput method of the AMFComponent interface to obtain the byte stream encoded by the encoder; 所述AMD硬件编码器关闭子模块,用于在停止编码时调用AMFComponent接口的Terminate方法关闭编码器,进行资源的释放。The AMD hardware encoder shutdown sub-module is used to call the Terminate method of the AMFComponent interface to shutdown the encoder and release resources when the encoding is stopped. 10.如权利要求1或2所述的基于Intel、AMD和Nvidia三平台的H264硬件编码系统,其特征在于,所述Nvidia硬件编码器包括Nvidia硬件编码器初始化子模块、Nvidia硬件编码器编码子模块以及Nvidia硬件编码器关闭子模块,其中:10. The H264 hardware encoding system based on three platforms of Intel, AMD and Nvidia as claimed in claim 1 or 2, wherein the Nvidia hardware encoder comprises an Nvidia hardware encoder initialization submodule, an Nvidia hardware encoder encoder submodule. module as well as the Nvidia hardware encoder shutdown submodule, where: 所述Nvidia硬件编码器初始化子模块用于初始化Nvidia硬件编码器,具体包括编码环境初始化子模块、Nvidia参数设置子模块、Nvidia参数获取子模块以及显存表面创建子模块,其中:The Nvidia hardware encoder initialization submodule is used to initialize the Nvidia hardware encoder, and specifically includes a coding environment initialization submodule, an Nvidia parameter setting submodule, an Nvidia parameter acquisition submodule, and a video memory surface creation submodule, wherein: 所述编码环境初始化子模块用于加载nvcuda.dll和nvEncodeAPI.dll,初始化必要的环境;并调用nvEncodeAPI模块的NvEncodeAPICreateInstance方法创建NV_ENCODE_API_FUNCTION_LIST结构;以及调用cuCtxCreate_v2接口创建上下文环境;Described coding environment initialization submodule is used to load nvcuda.dll and nvEncodeAPI.dll, initialize necessary environment; And call NvEncodeAPICreateInstance method of nvEncodeAPI module to create NV_ENCODE_API_FUNCTION_LIST structure; And call cuCtxCreate_v2 interface to create context environment; 所述Nvidia参数设置子模块用于 调用nvEncOpenEncodeSessionEx方法创建编码器会话,并 调用nvEncGetEncodePresetConfig对编码器参数进行设置,以及调用nvEncInitializeEncoder完成编码器的初始化;The Nvidia parameter setting submodule is used to call the nvEncOpenEncodeSessionEx method to create an encoder session, and call nvEncGetEncodePresetConfig to set the encoder parameters, and call nvEncInitializeEncoder to complete the initialization of the encoder; 所述Nvidia参数获取子模块用于调用nvEncGetSequenceParams获取类型为NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER的H264序列集参数和PPSH264图像集参数;The Nvidia parameter obtaining submodule is used to call nvEncGetSequenceParams to obtain H264 sequence set parameters and PPSH264 image set parameters of type NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER; 所述显存表面创建子模块用于调用nvEncCreateInputBuffer创建用来接收待编码的图像数据的显存表面,并调用nvEncCreateBitstreamBuffer创建编码输出存储数据;The video memory surface creation submodule is used to call nvEncCreateInputBuffer to create a video memory surface for receiving the image data to be encoded, and call nvEncCreateBitstreamBuffer to create the encoded output storage data; 所述Nvidia硬件编码器编码子模块用于对视频进行H264编码,具体包括填充编码图像子模块、编码子模块以及Nvidia字节流获取子模块,其中:The Nvidia hardware encoder encoding sub-module is used to perform H264 encoding on the video, and specifically includes a filling and encoding image sub-module, an encoding sub-module and an Nvidia byte stream acquisition sub-module, wherein: 所述填充编码图像子模块用于调用nvEncLockInputBuffer锁定上述显存表面创建子模块创建的显存表面,并填充编码图像;并调用nvEncUnlockInputBuffer对该显存表面进行解锁;Described filling coded image sub-module is used to call nvEncLockInputBuffer to lock the video memory surface created by the above-mentioned video memory surface creation sub-module, and fill the coded image; and call nvEncUnlockInputBuffer to unlock the video memory surface; 所述编码子模块用于调用nvEncEncodePicture进行编码;The encoding submodule is used to call nvEncEncodePicture to encode; 所述Nvidia字节流获取子模块用于调用nvEncLockBitstream获取编码后返回的字节流,做相应的处理后,调用nvEncUnlockBitstream释放字节流;The Nvidia byte stream acquisition submodule is used to call nvEncLockBitstream to obtain the byte stream returned after encoding, and after corresponding processing, call nvEncUnlockBitstream to release the byte stream; 所述Nvidia硬件编码器关闭子模块,用于在停止编码时调用nvEncDestroyEncoder关闭编码器,并调用cuCtxDestroy_v2释放当前环境上下文。The Nvidia hardware encoder shutdown sub-module is used to call nvEncDestroyEncoder to close the encoder when stopping encoding, and call cuCtxDestroy_v2 to release the current environment context.
CN201510887873.3A 2015-12-04 2015-12-04 A H264 Hardware Encoding System Based on Intel, AMD and Nvidia Expired - Fee Related CN105491387B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510887873.3A CN105491387B (en) 2015-12-04 2015-12-04 A H264 Hardware Encoding System Based on Intel, AMD and Nvidia

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510887873.3A CN105491387B (en) 2015-12-04 2015-12-04 A H264 Hardware Encoding System Based on Intel, AMD and Nvidia

Publications (2)

Publication Number Publication Date
CN105491387A CN105491387A (en) 2016-04-13
CN105491387B true CN105491387B (en) 2019-06-21

Family

ID=55678054

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510887873.3A Expired - Fee Related CN105491387B (en) 2015-12-04 2015-12-04 A H264 Hardware Encoding System Based on Intel, AMD and Nvidia

Country Status (1)

Country Link
CN (1) CN105491387B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106231319A (en) * 2016-07-14 2016-12-14 观止云(北京)信息技术有限公司 A kind of method alignd frame by frame based on software and hardware combining
CN110022478A (en) * 2018-01-09 2019-07-16 武汉斗鱼网络科技有限公司 A kind of H265 hardware encoding method and live streaming platform based on Intel SkyLake integrated graphics card
CN110022480B (en) * 2018-01-09 2022-03-25 武汉斗鱼网络科技有限公司 A H265 hardware encoding method and live broadcast platform based on AMD graphics card
CN110022479A (en) * 2018-01-09 2019-07-16 武汉斗鱼网络科技有限公司 A kind of H265 hardware encoding method and live streaming platform based on Nvidia Maxwell2 video card
CN110008102B (en) * 2019-04-10 2020-03-06 苏州浪潮智能科技有限公司 Server performance testing method and system based on intelligent video application
CN110147248B (en) * 2019-04-19 2021-06-29 中国科学院计算技术研究所 Single-precision matrix multiplication optimization method and system accelerated by AMD GPU assembly instructions
CN116074544A (en) * 2022-11-15 2023-05-05 深圳壹秘科技有限公司 Multi-platform live broadcast method, system, equipment and medium
CN116016992A (en) * 2022-12-30 2023-04-25 联想(北京)有限公司 A kind of encoding method and device
CN119342229A (en) * 2024-12-20 2025-01-21 杭州阿启视科技有限公司 Adaptive GPU scheduling method for video encoding and decoding applicable to multiple GPU types
CN119629392A (en) * 2025-02-08 2025-03-14 杭州宇泛智能科技股份有限公司 Audio and video encoding and decoding system and method compatible with heterogeneous chip platforms

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101490992A (en) * 2006-07-14 2009-07-22 高通股份有限公司 Encoder initialization and communications
CN102724049A (en) * 2012-07-02 2012-10-10 上海市共进通信技术有限公司 Method for realizing cross-hardware-platform compatible passive optical network device multicast function
CN103617191A (en) * 2013-11-07 2014-03-05 北京奇虎科技有限公司 Browser and method for rendering same by means of hardware acceleration
CN104049970A (en) * 2014-05-29 2014-09-17 汉柏科技有限公司 Automatic identifying method and system for framework and platform at user mode

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8359573B2 (en) * 2008-09-30 2013-01-22 Rockwell Automation Technologies, Inc. Application builder for industrial automation
CN103686164A (en) * 2012-09-06 2014-03-26 腾讯科技(深圳)有限公司 Method, system and module for self-adaptive hardware coding and decoding
CN104581015A (en) * 2013-10-21 2015-04-29 北京航天长峰科技工业集团有限公司 Video monitoring method for enabling encoders of multiple brands to be compatible
CN104980752B (en) * 2015-06-11 2018-10-02 武汉大千信息技术有限公司 The method and system of multichannel self-adaptive parallel transcoding are realized using CPU and GPU

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101490992A (en) * 2006-07-14 2009-07-22 高通股份有限公司 Encoder initialization and communications
CN102724049A (en) * 2012-07-02 2012-10-10 上海市共进通信技术有限公司 Method for realizing cross-hardware-platform compatible passive optical network device multicast function
CN103617191A (en) * 2013-11-07 2014-03-05 北京奇虎科技有限公司 Browser and method for rendering same by means of hardware acceleration
CN104049970A (en) * 2014-05-29 2014-09-17 汉柏科技有限公司 Automatic identifying method and system for framework and platform at user mode

Also Published As

Publication number Publication date
CN105491387A (en) 2016-04-13

Similar Documents

Publication Publication Date Title
CN105491387B (en) A H264 Hardware Encoding System Based on Intel, AMD and Nvidia
US11805304B2 (en) Method, device, and computer program for generating timed media data
CN113196784B (en) Point cloud coding structure
TWI887437B (en) Media access function for scene descriptions
CN105430408B (en) A kind of H264 hardware decoding system based on tri- platform of Intel, AMD and Nvidia
JP6339012B2 (en) Transmission of reconstructed data in a layered signal quality hierarchy
CN104144349B (en) SPICE coding and decoding videos extended method and system based on H264
CN109155875A (en) Method, apparatus and computer program for encapsulating and parsing timed media data
CN109891893A (en) It is derived in Streaming Media and with signal sending zone and viewport
CN113457160A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN117176715A (en) Point cloud encoding and decoding methods, devices, computer-readable media and electronic equipment
US20240046562A1 (en) Information processing device and method
US10997795B2 (en) Method and apparatus for processing three dimensional object image using point cloud data
CN112188285A (en) Video transcoding method, device, system and storage medium
US20170163990A1 (en) Video transcoding method and system
CN105263021B (en) A kind of HEVC video encoding/decoding methods based on UVD
CN105376585A (en) Method for improving video transmission speed by frame image combination
KR20240155209A (en) Video processing method, device and medium
Adeyemi-Ejeye et al. 4kUHD H264 wireless live video streaming using CUDA
Gudumasu et al. Adaptive Streaming of Visual Volumetric Video-based Coding Media
Kammachi‐Sreedhar et al. Omnidirectional video delivery with decoder instance reduction
WO2023175243A1 (en) A method, an apparatus and a computer program product for video encoding and video decoding
Deneke et al. Integration of dataflow components within a legacy video transcoding framework
Ngo Panorama Video Tiling: Efficient Processing and Encoding of Tiles
Horta Platforms for Handling and Development of Audiovisual Data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190621

CF01 Termination of patent right due to non-payment of annual fee