![]() |
VR-Forces Developer's Guide
|
The EncoderIO class is responsible to initialize CUDA and NVidia encoder then will be responsible to submit the Pixel Buffer Object to the GPU for encoding.
Public Types | |
| enum | DtHwEncoderFormat { UNKNOWN = 0, H264 = 1, H265 = 2 } |
Public Member Functions | |
| DtEncoderIO (DtDe &de) | |
| virtual | ~DtEncoderIO () |
| virtual void | deinitialize () |
| virtual bool | initialize (const osg::ref_ptr< osg::Image > &image, unsigned int frameRate, const std::string &encodingFormat) |
| virtual void | submitPBO (unsigned int pboId, int width, int height, int rowSizeInBytes, unsigned int frameRate, DtEncoderIOCallback *callback) |
| virtual bool | registerGlResourceIfNecessary (unsigned int pboId) |
Protected Member Functions | |
| virtual void | deinitCUDA () |
| virtual bool | initCUDA (const osg::ref_ptr< osg::Image > &image, unsigned int frameRate) |
| virtual void | deinitNVidiaEncoder () |
| virtual bool | initNVidiaEncoder () |
| virtual void | initFinailizeh264 (_NV_ENC_BUFFER_FORMAT bufferFormat, NV_ENC_INITIALIZE_PARAMS &encoderParams) |
| virtual void | initFinailizeh265 (_NV_ENC_BUFFER_FORMAT bufferFormat, NV_ENC_INITIALIZE_PARAMS &encoderParams) |
| virtual void | setTuningInfo (NV_ENC_TUNING_INFO tuningInfo) |
| virtual void | setPresetGUID (GUID preset) |
| virtual void | unmapDeviceBuffer () |
| virtual bool | flipVertically (DtEncodeInputBuffer *inputBuffer, DtRegisteredCudaGlResource *val, int rowSizeInBytes, int imageHeight) |
| virtual bool | registerInputAndOutputResourcesIfNecessary (int width, int height, int rowSizeInBytes) |
| virtual DtHwEncoderFormat | toFormat (const std::string &format) const |
| virtual void | getEncodedPackets () |
| virtual void | doWork () |
| virtual void | WaitForCompletionEvent (int iEvent) |
Protected Attributes | |
| int | myCudaDeviceId |
| int | myHcuDevice |
| CUcontext | myHcuContext |
| std::vector< DtEncodeOutputBuffer > | myOutputBuffer |
| std::vector< DtEncodeInputBuffer > | myInputBuffer |
| void * | myNVEncoder |
| uint64_t | myEncodeIdx |
| CUdeviceptr | myCUDATempDevicePtr |
| unsigned int | myCUDATempDeviceSize |
| uint32_t | myTempStride |
| unsigned int | myFrameRate |
| DtHwEncoderFormat | myEncodingFormat |
| DtDe & | myDe |
| int | myWidth |
| int | myHeight |
| int | myToSendFrames |
| int | myGotFrames |
| std::vector< std::vector < uint8_t > > | myHwEncodedPackets |
| std::unordered_map< unsigned int, DtRegisteredCudaGlResource * > | myRegisteredPbos |
| tbb::concurrent_queue < DtEncoderSubmitPboWork > | myWork |
| std::thread | myWorkerThread |
| bool | myWorkerInitialized = false |
| bool | myWorkerToQuit = false |
| bool | myInputOutputResourcesRegistered = false |
| bool | myUsingAsync |
| std::vector< void * > | myCompletionEvent |
| int | myId |
| NV_ENC_TUNING_INFO | myTuningInfo |
| GUID | myPresetGUID |
Static Protected Attributes | |
| static int | theRunningId |
| static const int | theDebugLevel |
Friends | |
| class | DtEncoderIOGetEncodedPacketsTask |
| makVrv::DtEncoderIO::DtEncoderIO | ( | DtDe & | de | ) |
CTOR.
|
virtual |
DTOR.
|
virtual |
Shutdown all (CUDA / NVIDIA encoder)
|
virtual |
Initialize all (CUDA / NVIDIA encoder)
|
virtual |
Submit Pixel Buffer Object.
register the input pbo with cuda if necessary
|
protectedvirtual |
Shutdown CUDA.
|
protectedvirtual |
Initialize CUDA.
|
protectedvirtual |
Shutdown NVIDIA encoder.
|
protectedvirtual |
Initialize NVIDIA encoder.
|
protectedvirtual |
Finalize the initialization settings for h264.
|
protectedvirtual |
Finalize the initialization settings for h265.
|
protectedvirtual |
Set the encoding tuning information Must be called before initNVidiaEncoder See NV_ENC_TUNING_INFO for info Default NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY.
|
protectedvirtual |
Performance degrades and quality improves as we move from P1 to P7. Presets P3 to P7 for H264 and Presets P2 to P7 for HEVC have B frames enabled by default for HIGH_QUALITY and LOSSLESS tuning info, and will not work with Weighted Prediction enabled. In case Weighted Prediction is required, disable B frames by setting frameIntervalP = 1 Default = NV_ENC_PRESET_P3_GUID.
|
protectedvirtual |
Unmap CUDA buffer.
|
protectedvirtual |
Flip the input to the encoder buffer on the device with CUDA.
|
protectedvirtual |
|
protectedvirtual |
helper
|
protectedvirtual |
Internal function to get the encoded packets.
|
protectedvirtual |
This is done on another thread.
|
protectedvirtual |
This function is used to wait for completion of encode command.
|
friend |
|
protected |
CUDA device ID use for the encoding.
|
protected |
CUDA device handle.
|
protected |
CUDA device context.
|
protected |
|
protected |
|
protected |
encoding pointer
|
protected |
encoding index
|
protected |
Temp buffer on CUDA device.
|
protected |
Temp buffer on CUDA device.
|
protected |
Encoding Data format.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
This is the list of pbos registered with this encoder. It corresponds to a ring buffer of pbos on the client side (the one calling the encoder) that are reading fbo asynchronously.
|
protected |
This is the work queue.
|
protected |
This is the worker thread which processes the work queue.
|
protected |
Whether the worker thread has been initialized.
|
protected |
boolean used to indicate to the worker thread that it must quit and join the main thread
|
protected |
The registered resources.
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
staticprotected |