From eb6ca2c5cc4a23a738b39bc3efa2136892a4ac50 Mon Sep 17 00:00:00 2001 From: Park JeongHwan Date: Thu, 25 Mar 2021 21:59:46 +0900 Subject: [PATCH] * Add presets for NVIDIA Video Codec SDK 11.0.10 (pull #1020) --- .github/workflows/nvcodec.yml | 32 + CHANGELOG.md | 1 + README.md | 2 + cppbuild.sh | 2 +- nvcodec/README.md | 128 + nvcodec/cppbuild.sh | 28 + nvcodec/platform/pom.xml | 115 + nvcodec/pom.xml | 87 + nvcodec/samples/pom.xml | 29 + .../samples/simple/SampleEncodeDecode.java | 52 + nvcodec/samples/simple/pom.xml | 28 + .../org/bytedeco/nvcodec/samples/AppDec.java | 281 ++ .../bytedeco/nvcodec/samples/AppEncCuda.java | 456 +++ .../callback/PfnVideoDecodeCallback.java | 32 + .../callback/PfnVideoDisplayCallback.java | 32 + .../callback/PfnVideoSequenceCallback.java | 32 + .../bytedeco/nvcodec/samples/cuda/CRC.java | 83 + .../nvcodec/samples/decoder/NvDecoder.java | 941 +++++ .../nvcodec/samples/dispose/Disposable.java | 5 + .../samples/encoder/DumpVidMemOutput.java | 126 + .../nvcodec/samples/encoder/NvCUStream.java | 80 + .../nvcodec/samples/encoder/NvEncoder.java | 1239 +++++++ .../samples/encoder/NvEncoderCuda.java | 323 ++ .../samples/encoder/NvEncoderInitParam.java | 753 ++++ .../samples/encoder/NvEncoderInputFrame.java | 74 + .../encoder/NvEncoderOutputInVidMemCuda.java | 345 ++ .../nvcodec/samples/encoder/YuvConverter.java | 87 + .../samples/exceptions/CudaException.java | 7 + .../samples/exceptions/InvalidArgument.java | 7 + .../samples/exceptions/NvCodecException.java | 11 + .../nvcodec/samples/util/AppDecUtils.java | 194 ++ .../nvcodec/samples/util/CudaUtil.java | 11 + .../nvcodec/samples/util/Dimension.java | 31 + .../nvcodec/samples/util/NvCodecUtil.java | 74 + .../nvcodec/samples/util/Rectangle.java | 51 + .../nvcodec/samples/util/VectorEx.java | 13 + nvcodec/samples/src/main/resources/build.bat | 2 + nvcodec/samples/src/main/resources/crc.cu | 114 + nvcodec/samples/src/main/resources/crc.ptx | 148 + .../org/bytedeco/nvcodec/global/nvcuvid.java | 683 ++++ .../bytedeco/nvcodec/global/nvencodeapi.java | 3060 +++++++++++++++++ .../nvcodec/nvcuvid/CCtxAutoLock.java | 24 + .../nvcodec/nvcuvid/CUAUDIOFORMAT.java | 52 + .../nvcodec/nvcuvid/CUVIDAV1PICPARAMS.java | 221 ++ .../nvcodec/nvcuvid/CUVIDAV1SEQHDR.java | 43 + .../nvcodec/nvcuvid/CUVIDDECODECAPS.java | 76 + .../nvcuvid/CUVIDDECODECREATEINFO.java | 99 + .../nvcodec/nvcuvid/CUVIDEOFORMAT.java | 112 + .../nvcodec/nvcuvid/CUVIDEOFORMATEX.java | 46 + .../nvcodec/nvcuvid/CUVIDGETDECODESTATUS.java | 44 + .../nvcodec/nvcuvid/CUVIDH264DPBENTRY.java | 52 + .../nvcodec/nvcuvid/CUVIDH264MVCEXT.java | 57 + .../nvcodec/nvcuvid/CUVIDH264PICPARAMS.java | 91 + .../nvcodec/nvcuvid/CUVIDH264SVCEXT.java | 73 + .../nvcodec/nvcuvid/CUVIDHEVCPICPARAMS.java | 191 + .../nvcodec/nvcuvid/CUVIDJPEGPICPARAMS.java | 40 + .../nvcodec/nvcuvid/CUVIDMPEG2PICPARAMS.java | 59 + .../nvcodec/nvcuvid/CUVIDMPEG4PICPARAMS.java | 69 + .../nvcuvid/CUVIDOPERATINGPOINTINFO.java | 47 + .../nvcodec/nvcuvid/CUVIDPARSERDISPINFO.java | 51 + .../nvcodec/nvcuvid/CUVIDPARSERPARAMS.java | 74 + .../nvcodec/nvcuvid/CUVIDPICPARAMS.java | 82 + .../nvcodec/nvcuvid/CUVIDPROCPARAMS.java | 75 + .../nvcuvid/CUVIDRECONFIGUREDECODERINFO.java | 69 + .../nvcuvid/CUVIDSOURCEDATAPACKET.java | 50 + .../nvcodec/nvcuvid/CUVIDSOURCEPARAMS.java | 59 + .../nvcodec/nvcuvid/CUVIDVC1PICPARAMS.java | 82 + .../nvcodec/nvcuvid/CUVIDVP8PICPARAMS.java | 59 + .../nvcodec/nvcuvid/CUVIDVP9PICPARAMS.java | 111 + .../nvcodec/nvcuvid/CUvideodecoder.java | 23 + .../nvcodec/nvcuvid/CUvideoparser.java | 21 + .../nvcodec/nvcuvid/CUvideosource.java | 30 + .../nvcodec/nvcuvid/PFNVIDDECODECALLBACK.java | 23 + .../nvcuvid/PFNVIDDISPLAYCALLBACK.java | 23 + .../nvcuvid/PFNVIDOPPOINTCALLBACK.java | 23 + .../nvcuvid/PFNVIDSEQUENCECALLBACK.java | 38 + .../nvcodec/nvcuvid/PFNVIDSOURCECALLBACK.java | 25 + .../nvcodec/nvcuvid/_CUcontextlock_st.java | 21 + .../bytedeco/nvcodec/nvencodeapi/GUID.java | 52 + .../nvencodeapi/NVENC_EXTERNAL_ME_HINT.java | 55 + ...EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE.java | 54 + .../NV_ENCODE_API_FUNCTION_LIST.java | 134 + .../nvencodeapi/NV_ENC_CAPS_PARAM.java | 46 + .../nvencodeapi/NV_ENC_CODEC_CONFIG.java | 51 + .../nvencodeapi/NV_ENC_CODEC_PIC_PARAMS.java | 46 + .../nvcodec/nvencodeapi/NV_ENC_CONFIG.java | 67 + .../nvencodeapi/NV_ENC_CONFIG_H264.java | 186 + .../NV_ENC_CONFIG_H264_MEONLY.java | 61 + .../NV_ENC_CONFIG_H264_VUI_PARAMETERS.java | 70 + .../nvencodeapi/NV_ENC_CONFIG_HEVC.java | 147 + .../NV_ENC_CONFIG_HEVC_MEONLY.java | 48 + .../NV_ENC_CREATE_BITSTREAM_BUFFER.java | 57 + .../NV_ENC_CREATE_INPUT_BUFFER.java | 61 + .../nvencodeapi/NV_ENC_CREATE_MV_BUFFER.java | 49 + .../nvencodeapi/NV_ENC_CUSTREAM_PTR.java | 24 + .../nvencodeapi/NV_ENC_ENCODE_OUT_PARAMS.java | 47 + .../nvencodeapi/NV_ENC_EVENT_PARAMS.java | 52 + .../nvencodeapi/NV_ENC_H264_MV_DATA.java | 49 + .../nvencodeapi/NV_ENC_HEVC_MV_DATA.java | 52 + .../nvencodeapi/NV_ENC_INITIALIZE_PARAMS.java | 108 + .../nvcodec/nvencodeapi/NV_ENC_INPUT_PTR.java | 29 + .../NV_ENC_INPUT_RESOURCE_OPENGL_TEX.java | 45 + .../nvencodeapi/NV_ENC_LOCK_BITSTREAM.java | 104 + .../nvencodeapi/NV_ENC_LOCK_INPUT_BUFFER.java | 59 + .../NV_ENC_MAP_INPUT_RESOURCE.java | 59 + .../nvencodeapi/NV_ENC_MEONLY_PARAMS.java | 82 + .../nvcodec/nvencodeapi/NV_ENC_MVECTOR.java | 43 + .../NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.java | 55 + .../nvencodeapi/NV_ENC_OUTPUT_PTR.java | 24 + .../nvencodeapi/NV_ENC_PIC_PARAMS.java | 116 + .../nvencodeapi/NV_ENC_PIC_PARAMS_H264.java | 103 + .../NV_ENC_PIC_PARAMS_H264_EXT.java | 44 + .../nvencodeapi/NV_ENC_PIC_PARAMS_HEVC.java | 98 + .../nvencodeapi/NV_ENC_PIC_PARAMS_MVC.java | 55 + .../nvencodeapi/NV_ENC_PRESET_CONFIG.java | 50 + .../nvcodec/nvencodeapi/NV_ENC_QP.java | 45 + .../nvcodec/nvencodeapi/NV_ENC_RC_PARAMS.java | 131 + .../NV_ENC_RECONFIGURE_PARAMS.java | 67 + .../nvencodeapi/NV_ENC_REGISTERED_PTR.java | 24 + .../nvencodeapi/NV_ENC_REGISTER_RESOURCE.java | 81 + .../nvencodeapi/NV_ENC_SEI_PAYLOAD.java | 46 + .../NV_ENC_SEQUENCE_PARAM_PAYLOAD.java | 60 + .../nvcodec/nvencodeapi/NV_ENC_STAT.java | 79 + .../PNVENCCREATEBITSTREAMBUFFER.java | 25 + .../nvencodeapi/PNVENCCREATEINPUTBUFFER.java | 25 + .../nvencodeapi/PNVENCCREATEMVBUFFER.java | 26 + .../PNVENCDESTROYBITSTREAMBUFFER.java | 25 + .../nvencodeapi/PNVENCDESTROYENCODER.java | 25 + .../nvencodeapi/PNVENCDESTROYINPUTBUFFER.java | 25 + .../nvencodeapi/PNVENCDESTROYMVBUFFER.java | 25 + .../nvencodeapi/PNVENCENCODEPICTURE.java | 25 + .../nvencodeapi/PNVENCGETENCODECAPS.java | 25 + .../nvencodeapi/PNVENCGETENCODEGUIDCOUNT.java | 25 + .../nvencodeapi/PNVENCGETENCODEGUIDS.java | 25 + .../PNVENCGETENCODEPRESETCONFIG.java | 25 + .../PNVENCGETENCODEPRESETCONFIGEX.java | 25 + .../PNVENCGETENCODEPRESETCOUNT.java | 25 + .../PNVENCGETENCODEPRESETGUIDS.java | 25 + .../PNVENCGETENCODEPROFILEGUIDCOUNT.java | 25 + .../PNVENCGETENCODEPROFILEGUIDS.java | 25 + .../nvencodeapi/PNVENCGETENCODESTATS.java | 25 + .../PNVENCGETINPUTFORMATCOUNT.java | 25 + .../nvencodeapi/PNVENCGETINPUTFORMATS.java | 25 + .../nvencodeapi/PNVENCGETLASTERROR.java | 25 + .../nvencodeapi/PNVENCGETSEQUENCEPARAMEX.java | 25 + .../nvencodeapi/PNVENCGETSEQUENCEPARAMS.java | 25 + .../nvencodeapi/PNVENCINITIALIZEENCODER.java | 25 + .../PNVENCINVALIDATEREFFRAMES.java | 25 + .../nvencodeapi/PNVENCLOCKBITSTREAM.java | 25 + .../nvencodeapi/PNVENCLOCKINPUTBUFFER.java | 25 + .../nvencodeapi/PNVENCMAPINPUTRESOURCE.java | 25 + .../nvencodeapi/PNVENCOPENENCODESESSION.java | 31 + .../PNVENCOPENENCODESESSIONEX.java | 25 + .../nvencodeapi/PNVENCRECONFIGUREENCODER.java | 25 + .../nvencodeapi/PNVENCREGISTERASYNCEVENT.java | 25 + .../nvencodeapi/PNVENCREGISTERRESOURCE.java | 25 + .../PNVENCRUNMOTIONESTIMATIONONLY.java | 25 + .../nvencodeapi/PNVENCSETIOCUDASTREAMS.java | 25 + .../nvencodeapi/PNVENCUNLOCKBITSTREAM.java | 25 + .../nvencodeapi/PNVENCUNLOCKINPUTBUFFER.java | 25 + .../nvencodeapi/PNVENCUNMAPINPUTRESOURCE.java | 25 + .../PNVENCUNREGISTERASYNCEVENT.java | 25 + .../nvencodeapi/PNVENCUNREGISTERRESOURCE.java | 25 + .../bytedeco/nvcodec/nvencodeapi/RECT.java | 49 + .../org/bytedeco/nvcodec/presets/nvcuvid.java | 111 + .../bytedeco/nvcodec/presets/nvencodeapi.java | 113 + nvcodec/src/main/java9/module-info.java | 8 + platform/pom.xml | 6 + pom.xml | 3 + tensorrt/pom.xml | 6 + 170 files changed, 16451 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nvcodec.yml create mode 100644 nvcodec/README.md create mode 100644 nvcodec/cppbuild.sh create mode 100644 nvcodec/platform/pom.xml create mode 100644 nvcodec/pom.xml create mode 100644 nvcodec/samples/pom.xml create mode 100644 nvcodec/samples/simple/SampleEncodeDecode.java create mode 100644 nvcodec/samples/simple/pom.xml create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/AppDec.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/AppEncCuda.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoDecodeCallback.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoDisplayCallback.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoSequenceCallback.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/cuda/CRC.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/decoder/NvDecoder.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/dispose/Disposable.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/DumpVidMemOutput.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvCUStream.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoder.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderCuda.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderInitParam.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderInputFrame.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderOutputInVidMemCuda.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/YuvConverter.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/CudaException.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/InvalidArgument.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/NvCodecException.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/AppDecUtils.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/CudaUtil.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/Dimension.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/NvCodecUtil.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/Rectangle.java create mode 100644 nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/VectorEx.java create mode 100644 nvcodec/samples/src/main/resources/build.bat create mode 100644 nvcodec/samples/src/main/resources/crc.cu create mode 100644 nvcodec/samples/src/main/resources/crc.ptx create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/global/nvcuvid.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/global/nvencodeapi.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CCtxAutoLock.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUAUDIOFORMAT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDAV1PICPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDAV1SEQHDR.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDDECODECAPS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDDECODECREATEINFO.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDEOFORMAT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDEOFORMATEX.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDGETDECODESTATUS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264DPBENTRY.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264MVCEXT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264PICPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264SVCEXT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDHEVCPICPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDJPEGPICPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDMPEG2PICPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDMPEG4PICPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDOPERATINGPOINTINFO.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPARSERDISPINFO.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPARSERPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPICPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPROCPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDRECONFIGUREDECODERINFO.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDSOURCEDATAPACKET.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDSOURCEPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVC1PICPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVP8PICPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVP9PICPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideodecoder.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideoparser.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideosource.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDDECODECALLBACK.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDDISPLAYCALLBACK.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDOPPOINTCALLBACK.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDSEQUENCECALLBACK.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDSOURCECALLBACK.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/_CUcontextlock_st.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/GUID.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NVENC_EXTERNAL_ME_HINT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENCODE_API_FUNCTION_LIST.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CAPS_PARAM.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CODEC_CONFIG.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CODEC_PIC_PARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264_MEONLY.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264_VUI_PARAMETERS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_HEVC.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_HEVC_MEONLY.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_BITSTREAM_BUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_INPUT_BUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_MV_BUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CUSTREAM_PTR.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_ENCODE_OUT_PARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_EVENT_PARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_H264_MV_DATA.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_HEVC_MV_DATA.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INITIALIZE_PARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INPUT_PTR.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INPUT_RESOURCE_OPENGL_TEX.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_LOCK_BITSTREAM.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_LOCK_INPUT_BUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MAP_INPUT_RESOURCE.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MEONLY_PARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MVECTOR.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_OUTPUT_PTR.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_H264.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_H264_EXT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_HEVC.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_MVC.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PRESET_CONFIG.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_QP.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_RC_PARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_RECONFIGURE_PARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_REGISTERED_PTR.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_REGISTER_RESOURCE.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_SEI_PAYLOAD.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_SEQUENCE_PARAM_PAYLOAD.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_STAT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEBITSTREAMBUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEINPUTBUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEMVBUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYBITSTREAMBUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYENCODER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYINPUTBUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYMVBUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCENCODEPICTURE.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODECAPS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEGUIDCOUNT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEGUIDS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCONFIG.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCONFIGEX.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCOUNT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETGUIDS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPROFILEGUIDCOUNT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPROFILEGUIDS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODESTATS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETINPUTFORMATCOUNT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETINPUTFORMATS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETLASTERROR.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETSEQUENCEPARAMEX.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETSEQUENCEPARAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCINITIALIZEENCODER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCINVALIDATEREFFRAMES.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCLOCKBITSTREAM.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCLOCKINPUTBUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCMAPINPUTRESOURCE.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCOPENENCODESESSION.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCOPENENCODESESSIONEX.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCRECONFIGUREENCODER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCREGISTERASYNCEVENT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCREGISTERRESOURCE.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCRUNMOTIONESTIMATIONONLY.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCSETIOCUDASTREAMS.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNLOCKBITSTREAM.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNLOCKINPUTBUFFER.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNMAPINPUTRESOURCE.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNREGISTERASYNCEVENT.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNREGISTERRESOURCE.java create mode 100644 nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/RECT.java create mode 100644 nvcodec/src/main/java/org/bytedeco/nvcodec/presets/nvcuvid.java create mode 100644 nvcodec/src/main/java/org/bytedeco/nvcodec/presets/nvencodeapi.java create mode 100644 nvcodec/src/main/java9/module-info.java diff --git a/.github/workflows/nvcodec.yml b/.github/workflows/nvcodec.yml new file mode 100644 index 00000000000..373d00b1580 --- /dev/null +++ b/.github/workflows/nvcodec.yml @@ -0,0 +1,32 @@ +name: nvcodec +on: + push: + paths: + - nvcodec/** + pull_request: + paths: + - nvcodec/** + workflow_dispatch: +env: + CI_DEPLOY_NEED_CUDA: 1 + CI_DEPLOY_MODULE: ${{ github.workflow }} + CI_DEPLOY_PLATFORM: ${{ github.job }} + CI_DEPLOY_SETTINGS: ${{ secrets.CI_DEPLOY_SETTINGS }} + CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} + CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} + STAGING_REPOSITORY: ${{ secrets.STAGING_REPOSITORY }} +jobs: + linux-x86_64: + runs-on: ubuntu-16.04 + container: centos:6 + steps: + - uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions + windows-x86_64: + runs-on: windows-2019 + steps: + - uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions + redeploy: + needs: [linux-x86_64, windows-x86_64] + runs-on: ubuntu-16.04 + steps: + - uses: bytedeco/javacpp-presets/.github/actions/redeploy@actions diff --git a/CHANGELOG.md b/CHANGELOG.md index dbfcb2cd696..6bc33fdcd8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ + * Add presets for NVIDIA Video Codec SDK 11.0.x ([pull #1020](https://github.com/bytedeco/javacpp-presets/pull/1020)) * Map `std::vector` to `RangeVector` in `opencv_core.Mat` for convenience ([issue bytedeco/javacv#1607](https://github.com/bytedeco/javacv/issues/1607)) * Include `genericaliasobject.h`, `context.h`, `tracemalloc.h`, and `datetime.h` for CPython ([issue #1017](https://github.com/bytedeco/javacpp-presets/issues/1017)) * Add samples using LLVM modules to deal with bitcode and object files ([pull #1016](https://github.com/bytedeco/javacpp-presets/pull/1016)) diff --git a/README.md b/README.md index c64a9eee10b..5ad189ce448 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ JavaCPP Presets [![caffe](https://github.com/bytedeco/javacpp-presets/workflows/caffe/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Acaffe) [![openpose](https://github.com/bytedeco/javacpp-presets/workflows/openpose/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Aopenpose) [![cuda](https://github.com/bytedeco/javacpp-presets/workflows/cuda/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Acuda) +[![nvcodec](https://github.com/bytedeco/javacpp-presets/workflows/nvcodec/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Anvcodec) [![opencl](https://github.com/bytedeco/javacpp-presets/workflows/opencl/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Aopencl) [![mxnet](https://github.com/bytedeco/javacpp-presets/workflows/mxnet/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Amxnet) [![tensorflow](https://github.com/bytedeco/javacpp-presets/workflows/tensorflow/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Atensorflow) @@ -200,6 +201,7 @@ Each child module in turn relies by default on the included [`cppbuild.sh` scrip * CUDA 11.2.x https://developer.nvidia.com/cuda-downloads * cuDNN 8.1.x https://developer.nvidia.com/cudnn * NCCL 2.8.x https://developer.nvidia.com/nccl + * NVIDIA Video Codec SDK 11.0.x https://developer.nvidia.com/nvidia-video-codec-sdk * OpenCL 3.0 https://github.com/KhronosGroup/OpenCL-ICD-Loader * MXNet 1.8.0 https://github.com/apache/incubator-mxnet * TensorFlow 1.15.x https://github.com/tensorflow/tensorflow diff --git a/cppbuild.sh b/cppbuild.sh index f5af1ca0e91..f8c51012a12 100755 --- a/cppbuild.sh +++ b/cppbuild.sh @@ -164,7 +164,7 @@ function sedinplace { } if [[ -z ${PROJECTS:-} ]]; then - PROJECTS=(opencv ffmpeg flycapture spinnaker libdc1394 libfreenect libfreenect2 librealsense librealsense2 videoinput artoolkitplus chilitags flandmark arrow hdf5 hyperscan mkl mkl-dnn dnnl openblas arpack-ng cminpack fftw gsl cpython numpy scipy gym llvm libpostal leptonica tesseract caffe openpose cuda opencl mxnet tensorflow tensorrt ale onnx ngraph onnxruntime tvm liquidfun qt skia cpu_features systems) + PROJECTS=(opencv ffmpeg flycapture spinnaker libdc1394 libfreenect libfreenect2 librealsense librealsense2 videoinput artoolkitplus chilitags flandmark arrow hdf5 hyperscan mkl mkl-dnn dnnl openblas arpack-ng cminpack fftw gsl cpython numpy scipy gym llvm libpostal leptonica tesseract caffe openpose cuda nvcodec opencl mxnet tensorflow tensorrt ale onnx ngraph onnxruntime tvm liquidfun qt skia cpu_features systems) fi for PROJECT in ${PROJECTS[@]}; do diff --git a/nvcodec/README.md b/nvcodec/README.md new file mode 100644 index 00000000000..d116b81f57e --- /dev/null +++ b/nvcodec/README.md @@ -0,0 +1,128 @@ +JavaCPP Presets for NVIDIA Video Codec SDK +========================================== + +[![Gitter](https://badges.gitter.im/bytedeco/javacpp.svg)](https://gitter.im/bytedeco/javacpp) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.bytedeco/nvcodec/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.bytedeco/nvcodec) [![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/https/oss.sonatype.org/org.bytedeco/nvcodec.svg)](http://bytedeco.org/builds/) +Build status for all platforms: [![nvcodec](https://github.com/bytedeco/javacpp-presets/workflows/nvcodec/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Anvcodec) Commercial support: [![xscode](https://img.shields.io/badge/Available%20on-xs%3Acode-blue?style=?style=plastic&logo=appveyor&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////////VXz1bAAAAAJ0Uk5T/wDltzBKAAAAlUlEQVR42uzXSwqAMAwE0Mn9L+3Ggtgkk35QwcnSJo9S+yGwM9DCooCbgn4YrJ4CIPUcQF7/XSBbx2TEz4sAZ2q1RAECBAiYBlCtvwN+KiYAlG7UDGj59MViT9hOwEqAhYCtAsUZvL6I6W8c2wcbd+LIWSCHSTeSAAECngN4xxIDSK9f4B9t377Wd7H5Nt7/Xz8eAgwAvesLRjYYPuUAAAAASUVORK5CYII=)](https://xscode.com/bytedeco/javacpp-presets) + + +License Agreements +------------------ +By downloading these archives, you agree to the terms of the license agreements for NVIDIA software included in the archives. + +### NVIDIA Video Codec SDK +To view the license for NVIDIA Video Codec SDK included in these archives, click [here](https://docs.nvidia.com/video-technologies/video-codec-sdk/license/) + + +Introduction +------------ +This directory contains the JavaCPP Presets module for: + + * NVIDIA Video Codec SDK 11.0.10 https://developer.nvidia.com/nvidia-video-codec-sdk + +Please refer to the parent README.md file for more detailed information about the JavaCPP Presets. + + +Documentation +------------- +Java API documentation is available here: + + * http://bytedeco.org/javacpp-presets/nvcodec/apidocs/ + + +Sample Usage +------------ +Here is a simple example ported to Java from C code based on `Samples/AppEncode/AppEncCuda` and `Samples/AppDecode/AppDec` included in `Video_Codec_SDK_11.0.10.zip` available at: + + * https://developer.nvidia.com/nvidia-video-codec-sdk/download + +We can use [Maven 3](http://maven.apache.org/) to download and install automatically all the class files as well as the native binaries. To run this sample code, after creating the `pom.xml` and `SampleEncodeDecode.java` source files below, simply execute on the command line: +```bash + $ mvn compile exec:java +``` +You can find more encoder and decoder samples in the [`samples`](samples) subdirectory. + +### The `pom.xml` build file +```xml + + 4.0.0 + org.bytedeco.nvcodec + sampleencodedecode + 1.5.6-SNAPSHOT + + SampleEncodeDecode + + + + org.bytedeco + nvcodec-platform + 11.0.10-1.5.6-SNAPSHOT + + + + + org.bytedeco + cuda-platform-redist + 11.2-8.1-1.5.6-SNAPSHOT + + + + . + + +``` + +### The `SampleEncodeDecode.java` source file +```java +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.javacpp.IntPointer; +import org.bytedeco.nvcodec.nvcuvid.CUVIDDECODECAPS; + +import static org.bytedeco.cuda.global.cudart.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +public class SampleEncodeDecode { + public static void checkEncodeApiCall(String functionName, int result) { + if (result != NV_ENC_SUCCESS) { + System.err.printf("ERROR: %s returned '%d' \r\n", functionName, result); + System.exit(-1); + } + } + + public static void checkCudaApiCall(String functionName, int result) { + if (result != CUDA_SUCCESS) { + System.err.printf("ERROR: %s returned '%d' \r\n", functionName, result); + System.exit(-1); + } + } + + public static void main(String[] args) { + int targetGpu = 0; // If you use NVIDIA GPU not '0', changing it. + + CUctx_st cuContext = new CUctx_st(); + + checkCudaApiCall("cuInit", cuInit(0)); + checkCudaApiCall("cuCtxCreate", cuCtxCreate(cuContext, 0, targetGpu)); + // Check encoder max supported version + { + IntPointer version = new IntPointer(1); + + checkEncodeApiCall("NvEncodeAPIGetMaxSupportedVersion", NvEncodeAPIGetMaxSupportedVersion(version)); + + System.out.printf("Encoder Max Supported Version\t : %d \r\n", version.get()); + } + + // Query decoder capability 'MPEG-1' codec + { + CUVIDDECODECAPS decodeCaps = new CUVIDDECODECAPS(); + decodeCaps.eCodecType(cudaVideoCodec_HEVC); + decodeCaps.eChromaFormat(cudaVideoChromaFormat_420); + decodeCaps.nBitDepthMinus8(2); // 10 bit + + checkCudaApiCall("cuvidGetDecoderCaps", cuvidGetDecoderCaps(decodeCaps)); + + System.out.printf("Decoder Capability MPEG-1 Codec\t : %s \r\n", (decodeCaps.bIsSupported() != 0)); + } + } +} +``` diff --git a/nvcodec/cppbuild.sh b/nvcodec/cppbuild.sh new file mode 100644 index 00000000000..e083ea6e5d1 --- /dev/null +++ b/nvcodec/cppbuild.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# This file is meant to be included by the parent cppbuild.sh script +if [[ -z "$PLATFORM" ]]; then + pushd .. + bash cppbuild.sh "$@" nvcodec + popd + exit +fi + +case $PLATFORM in + linux-x86_64) + if [[ ! -d "/usr/local/videocodecsdk/" ]]; then + echo "Please install the Video Codec SDK in /usr/local/videocodecsdk/" + exit 1 + fi + ;; + windows-x86_64) + if [[ ! -d "C:/Program Files/NVIDIA GPU Computing Toolkit/VideoCodecSDK/" ]]; then + echo "Please install the Video Codec SDK in C:/Program Files/NVIDIA GPU Computing Toolkit/VideoCodecSDK/" + exit 1 + fi + ;; + *) + echo "Error: Platform \"$PLATFORM\" is not supported" + ;; +esac + +cd ../.. diff --git a/nvcodec/platform/pom.xml b/nvcodec/platform/pom.xml new file mode 100644 index 00000000000..82ed66438cc --- /dev/null +++ b/nvcodec/platform/pom.xml @@ -0,0 +1,115 @@ + + + 4.0.0 + + + org.bytedeco + javacpp-presets + 1.5.6-SNAPSHOT + ../../ + + + org.bytedeco + nvcodec-platform + 11.0.10-${project.parent.version} + JavaCPP Presets Platform for NVIDIA Video Codec SDK + + + nvcodec + + + + + org.bytedeco + cuda-platform + 11.2-8.1-${project.parent.version} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.linux-x86_64} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.windows-x86_64} + + + + + + + maven-jar-plugin + + + default-jar + + + + ${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-windows-x86_64.jar + + + + + + empty-javadoc-jar + + jar + + + javadoc + + + + empty-sources-jar + + jar + + + sources + + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + none + + + add-platform-module-info + package + + add-module-info + + + + + ${project.build.directory}/${project.artifactId}.jar + + module org.bytedeco.${javacpp.moduleId}.platform { + requires static org.bytedeco.${javacpp.moduleId}.linux.x86_64; + requires static org.bytedeco.${javacpp.moduleId}.windows.x86_64; + } + + + + + + + + + + + diff --git a/nvcodec/pom.xml b/nvcodec/pom.xml new file mode 100644 index 00000000000..0d038ac84c4 --- /dev/null +++ b/nvcodec/pom.xml @@ -0,0 +1,87 @@ + + + 4.0.0 + + + org.bytedeco + javacpp-presets + 1.5.6-SNAPSHOT + + + org.bytedeco + nvcodec + 11.0.10-${project.parent.version} + JavaCPP Presets for NVIDIA Video Codec SDK + + + + requires org.bytedeco.cuda.${javacpp.platform.module}; + + + + + + org.bytedeco + cuda + 11.2-8.1-${project.parent.version} + + + org.bytedeco + javacpp + + + + + + + maven-resources-plugin + + + maven-compiler-plugin + + + org.bytedeco + javacpp + + ISO-8859-1 + + + + org.bytedeco + cuda + 11.2-8.1-${project.parent.version} + + + + + javacpp-compiler + process-classes + + build + + + false + + + + + + maven-jar-plugin + + + maven-dependency-plugin + + + maven-source-plugin + + + maven-javadoc-plugin + + ISO-8859-1 + + + + + + diff --git a/nvcodec/samples/pom.xml b/nvcodec/samples/pom.xml new file mode 100644 index 00000000000..8586f7e458b --- /dev/null +++ b/nvcodec/samples/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + org.bytedeco.nvcodec + samplenvcodec + 1.5.6-SNAPSHOT + + 1.7 + 1.7 + + + + org.jcodec + jcodec + 0.2.5 + + + org.bytedeco + nvcodec-platform + 11.0.10-1.5.6-SNAPSHOT + + + + + org.bytedeco + cuda-platform-redist + 11.2-8.1-1.5.6-SNAPSHOT + + + diff --git a/nvcodec/samples/simple/SampleEncodeDecode.java b/nvcodec/samples/simple/SampleEncodeDecode.java new file mode 100644 index 00000000000..f3a1817a7ae --- /dev/null +++ b/nvcodec/samples/simple/SampleEncodeDecode.java @@ -0,0 +1,52 @@ +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.javacpp.IntPointer; +import org.bytedeco.nvcodec.nvcuvid.CUVIDDECODECAPS; + +import static org.bytedeco.cuda.global.cudart.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +public class SampleEncodeDecode { + public static void checkEncodeApiCall(String functionName, int result) { + if (result != NV_ENC_SUCCESS) { + System.err.printf("ERROR: %s returned '%d' \r\n", functionName, result); + System.exit(-1); + } + } + + public static void checkCudaApiCall(String functionName, int result) { + if (result != CUDA_SUCCESS) { + System.err.printf("ERROR: %s returned '%d' \r\n", functionName, result); + System.exit(-1); + } + } + + public static void main(String[] args) { + int targetGpu = 0; // If you use NVIDIA GPU not '0', changing it. + + CUctx_st cuContext = new CUctx_st(); + + checkCudaApiCall("cuInit", cuInit(0)); + checkCudaApiCall("cuCtxCreate", cuCtxCreate(cuContext, 0, targetGpu)); + // Check encoder max supported version + { + IntPointer version = new IntPointer(1); + + checkEncodeApiCall("NvEncodeAPIGetMaxSupportedVersion", NvEncodeAPIGetMaxSupportedVersion(version)); + + System.out.printf("Encoder Max Supported Version\t : %d \r\n", version.get()); + } + + // Query decoder capability 'MPEG-1' codec + { + CUVIDDECODECAPS decodeCaps = new CUVIDDECODECAPS(); + decodeCaps.eCodecType(cudaVideoCodec_HEVC); + decodeCaps.eChromaFormat(cudaVideoChromaFormat_420); + decodeCaps.nBitDepthMinus8(2); // 10 bit + + checkCudaApiCall("cuvidGetDecoderCaps", cuvidGetDecoderCaps(decodeCaps)); + + System.out.printf("Decoder Capability MPEG-1 Codec\t : %s \r\n", (decodeCaps.bIsSupported() != 0)); + } + } +} diff --git a/nvcodec/samples/simple/pom.xml b/nvcodec/samples/simple/pom.xml new file mode 100644 index 00000000000..bb23148d102 --- /dev/null +++ b/nvcodec/samples/simple/pom.xml @@ -0,0 +1,28 @@ + + 4.0.0 + org.bytedeco.nvcodec + sampleencodedecode + 1.5.6-SNAPSHOT + + SampleEncodeDecode + 1.7 + 1.7 + + + + org.bytedeco + nvcodec-platform + 11.0.10-1.5.6-SNAPSHOT + + + + + org.bytedeco + cuda-platform-redist + 11.2-8.1-1.5.6-SNAPSHOT + + + + . + + diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/AppDec.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/AppDec.java new file mode 100644 index 00000000000..29b0f5890d7 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/AppDec.java @@ -0,0 +1,281 @@ +package org.bytedeco.nvcodec.samples; + +import org.bytedeco.nvcodec.samples.decoder.NvDecoder; +import org.bytedeco.nvcodec.samples.encoder.YuvConverter; +import org.bytedeco.nvcodec.samples.exceptions.InvalidArgument; +import org.bytedeco.nvcodec.samples.exceptions.NvCodecException; +import org.bytedeco.nvcodec.samples.util.AppDecUtils; +import org.bytedeco.nvcodec.samples.util.Dimension; +import org.bytedeco.nvcodec.samples.util.Rectangle; +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.javacpp.BytePointer; +import org.bytedeco.javacpp.IntPointer; +import org.bytedeco.nvcodec.global.nvcuvid.*; + +import org.jcodec.common.DemuxerTrack; +import org.jcodec.common.io.NIOUtils; +import org.jcodec.common.model.Packet; +import org.jcodec.containers.mp4.demuxer.MP4Demuxer; + +import java.io.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvencodeapi.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.samples.util.CudaUtil.checkCudaApiCall; +import static org.bytedeco.nvcodec.samples.util.NvCodecUtil.checkInputFile; +import static org.bytedeco.nvcodec.samples.util.NvCodecUtil.convertToNvCodec; +import static java.lang.System.exit; + +public class AppDec { + private static int gpu; + private static boolean outPlanar; + + private static String inputFilePath; + private static String outputFilePath; + + private static Rectangle cropRectangle; + private static Dimension resizeDimension; + + public static void convertSemiPlanarToPlanar(BytePointer hostFramePointer, int width, int height, int bitDepth) { + if (bitDepth == 8) { + // nv12->iyuv + YuvConverter converter8 = new YuvConverter(width, height, 8); + converter8.UVInterleavedToPlanar(hostFramePointer); + } else { + // p016->yuv420p16 + YuvConverter converter16 = new YuvConverter(width, height, 16); + converter16.UVInterleavedToPlanar(hostFramePointer); + } + } + + /** + * @param cuContext - Handle to CUDA context + * @param inFilePath - Path to file to be decoded + * @param outFilePath - Path to output file into which raw frames are stored + * @param outPlanar - Flag to indicate whether output needs to be converted to planar format + * @param cropRectangle - Cropping rectangle coordinates + * @param resizeDimension - Resizing dimensions for output + * @brief Function to decode media file and write raw frames into an output file. + */ + public static void decodeMediaFile(CUctx_st cuContext, String inFilePath, String outFilePath, boolean outPlanar, Rectangle cropRectangle, Dimension resizeDimension) { + try (FileOutputStream outputStream = new FileOutputStream(outFilePath)) { + try (MP4Demuxer demuxer = MP4Demuxer.createMP4Demuxer(NIOUtils.readableChannel(new File(inFilePath)))) { + DemuxerTrack videoTrack = demuxer.getVideoTrack(); + int codec = convertToNvCodec(videoTrack.getMeta().getCodec()); + + NvDecoder nvDecoder = new NvDecoder(cuContext, false, codec, false, false, cropRectangle, resizeDimension, 0, 0, 1000); + + int frame = 0; + int frameReturned; + + BytePointer framePointer; + boolean decodedOutSemiPlanar; + + + Packet packet; + + do { + packet = videoTrack.nextFrame(); + + byte[] packetDataArray; + + if (packet == null) { + packetDataArray = new byte[0]; + } else { + packetDataArray = packet.getData().array(); + } + + BytePointer bytePointer = new BytePointer(packetDataArray); + + frameReturned = nvDecoder.decode(bytePointer, packetDataArray.length, 0, 0); + + if (frame == 0 && frameReturned != 0) { + System.out.println(nvDecoder.getVideoInfo()); + } + + decodedOutSemiPlanar = (nvDecoder.getOutputFormat() == cudaVideoSurfaceFormat_NV12) || (nvDecoder.getOutputFormat() == cudaVideoSurfaceFormat_P016); + + + for (int index = 0; index < frameReturned; index++) { + framePointer = nvDecoder.getFrame(null); + + if (outPlanar && decodedOutSemiPlanar) { + convertSemiPlanarToPlanar(framePointer, nvDecoder.getWidth(), nvDecoder.getHeight(), nvDecoder.getBitDepth()); + } + + byte[] frameData = new byte[nvDecoder.getFrameSize()]; + framePointer.get(frameData); + + outputStream.write(frameData); + } + + frame += frameReturned; + } while (packet != null); + + String[] aszDecodeOutFormat = new String[]{ + "NV12", "P016", "YUV444", "YUV444P16" + }; + + if (outPlanar) { + aszDecodeOutFormat[0] = "iyuv"; + aszDecodeOutFormat[1] = "yuv420p16"; + } + + System.out.println("Total frame decoded: " + frame); + System.out.println("Saved in file " + outFilePath + " in " + aszDecodeOutFormat[nvDecoder.getOutputFormat()] + " format"); + + nvDecoder.dispose(); + } + } catch (NvCodecException | IOException e) { + e.printStackTrace(); + } + } + + public static void showHelpAndExit() throws InvalidArgument { + showHelpAndExit(null); + } + + public static void showHelpAndExit(final String badOption) throws InvalidArgument { + boolean bThrowError = false; + + StringBuilder sb = new StringBuilder(); + if (badOption != null) { + bThrowError = true; + sb.append("Error parsing \"").append(badOption).append("\"").append("\n"); + } + + sb.append("Options:").append("\n") + .append("-i Input file path").append("\n") + .append("-o Output file path").append("\n") + .append("-outplanar Convert output to planar format").append("\n") + .append("-gpu Ordinal of GPU to use").append("\n") + .append("-crop l,t,r,b Crop rectangle in left,top,right,bottom (ignored for case 0)").append("\n") + .append("-resize WxH Resize to dimension W times H (ignored for case 0)").append("\n"); + sb.append("\n"); + + if (bThrowError) { + throw new InvalidArgument(sb.toString()); + } else { + System.out.println(sb.toString()); + AppDecUtils.showDecoderCapability(); + exit(0); + } + } + + public static void parseCommandLine(int argc, String[] argv) throws InvalidArgument { + for (int i = 0; i < argc; i++) { + if (argv[i].equals("-h")) { + showHelpAndExit(); + } + if (argv[i].equals("-i")) { + if (++i == argc) { + showHelpAndExit("-i"); + } + inputFilePath = argv[i]; + continue; + } + if (argv[i].equals("-o")) { + if (++i == argc) { + showHelpAndExit("-o"); + } + outputFilePath = argv[i]; + continue; + } + if (argv[i].equals("-outplanar")) { + outPlanar = true; + continue; + } + if (argv[i].equals("-gpu")) { + if (++i == argc) { + showHelpAndExit("-gpu"); + } + + gpu = Integer.parseInt(argv[i]); + + continue; + } + if (argv[i].equals("-crop")) { + if (++i == argc) { + showHelpAndExit("-crop"); + } + + String[] values = argv[i].split(","); + + if (values.length != 4) { + showHelpAndExit("-crop"); + } + + cropRectangle.setLeft(Integer.parseInt(values[0])); + cropRectangle.setTop(Integer.parseInt(values[1])); + cropRectangle.setRight(Integer.parseInt(values[2])); + cropRectangle.setBottom(Integer.parseInt(values[3])); + + if ((cropRectangle.getRight() - cropRectangle.getLeft()) % 2 == 1 || (cropRectangle.getBottom() - cropRectangle.getTop()) % 2 == 1) { + System.err.println("Cropping rect must have width and height of even numbers"); + exit(1); + } + + continue; + } + if (argv[i].equals("-resize")) { + if (++i == argc) { + showHelpAndExit("-resize"); + } + String[] values = argv[i].split("x"); + + if (values.length != 2) { + showHelpAndExit("-resize"); + } + + resizeDimension.setWidth(Integer.parseInt(values[0])); + resizeDimension.setHeight(Integer.parseInt(values[1])); + + if (resizeDimension.getWidth() % 2 == 1 || resizeDimension.getHeight() % 2 == 1) { + System.err.println("Resizing rect must have width and height of even numbers"); + exit(1); + } + + continue; + } + + showHelpAndExit(argv[i]); + } + } + + public static void main(String[] args) { + inputFilePath = ""; + outputFilePath = ""; + gpu = 0; + cropRectangle = new Rectangle(); + resizeDimension = new Dimension(); + outPlanar = false; + + try { + parseCommandLine(args.length, args); + checkInputFile(inputFilePath); + + if (outputFilePath == null || outputFilePath.isEmpty()) { + outputFilePath = outPlanar ? "out.planar" : "out.native"; + } + + checkCudaApiCall(cuInit(0)); + IntPointer nGpu = new IntPointer(1); + checkCudaApiCall(cuDeviceGetCount(nGpu)); + + if (gpu < 0 || gpu > nGpu.get()) { + System.err.printf("GPU ordinal out of range. Should be within [%d,%d]\n", 0, nGpu.get() - 1); + return; + } + + CUctx_st cuContext = new CUctx_st(); + cuCtxCreate(cuContext, 0, gpu); + + System.out.println("Decode with demuxing."); + decodeMediaFile(cuContext, inputFilePath, outputFilePath, outPlanar, cropRectangle, resizeDimension); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/AppEncCuda.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/AppEncCuda.java new file mode 100644 index 00000000000..666e81632da --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/AppEncCuda.java @@ -0,0 +1,456 @@ +package org.bytedeco.nvcodec.samples; + +import org.bytedeco.nvcodec.samples.cuda.CRC; +import org.bytedeco.nvcodec.samples.encoder.*; +import org.bytedeco.nvcodec.samples.exceptions.InvalidArgument; +import org.bytedeco.nvcodec.samples.exceptions.NvCodecException; +import org.bytedeco.nvcodec.samples.util.NvCodecUtil; +import org.bytedeco.nvcodec.samples.exceptions.CudaException; +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.javacpp.BytePointer; +import org.bytedeco.javacpp.IntPointer; +import org.bytedeco.javacpp.LongPointer; +import org.bytedeco.nvcodec.global.nvencodeapi.*; +import org.bytedeco.nvcodec.nvencodeapi.NV_ENC_CONFIG; +import org.bytedeco.nvcodec.nvencodeapi.NV_ENC_INITIALIZE_PARAMS; +import org.bytedeco.nvcodec.nvencodeapi.NV_ENC_OUTPUT_PTR; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Vector; + +import static org.bytedeco.nvcodec.samples.util.CudaUtil.checkCudaApiCall; +import static java.lang.System.exit; +import static org.bytedeco.cuda.global.cudart.*; +import static org.bytedeco.cuda.global.cudart.cuDeviceGetName; +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +public class AppEncCuda { + public static int iGpu = 0; + public static int width = 0; + public static int height = 0; + public static int cuStreamType = -1; + + public static boolean bOutputInVidMem; + + public static String szInputFilePath = ""; + public static String szOutputFilePath = ""; + + public static NvEncoderInitParam initParam; + public static int eFormat = NV_ENC_BUFFER_FORMAT_IYUV; + + public static void showEncoderCapability() { + StringBuilder sb = new StringBuilder(); + try { + checkCudaApiCall(cuInit(0)); + IntPointer gpuNum = new IntPointer(); + checkCudaApiCall(cuDeviceGetCount(gpuNum)); + + sb.append("Encoder Capability \n\n"); + for (int iGpu = 0; iGpu < gpuNum.get(); iGpu++) { + IntPointer cuDevice = new IntPointer(); + checkCudaApiCall(cuDeviceGet(cuDevice, iGpu)); + BytePointer szDeviceName = new BytePointer(80); + checkCudaApiCall(cuDeviceGetName(szDeviceName, szDeviceName.sizeof(), cuDevice.get())); + CUctx_st cuContext = new CUctx_st(); + checkCudaApiCall(cuCtxCreate(cuContext, 0, cuDevice.get())); + NvEncoderCuda enc = new NvEncoderCuda(cuContext, 1280, 720, NV_ENC_BUFFER_FORMAT_NV12); + + sb.append("GPU ").append(iGpu).append(" - ").append(szDeviceName.getString()).append("\n"); + sb.append("\tH264:\t\t ").append( + enc.getCapabilityValue(NV_ENC_CODEC_H264_GUID(), NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES) != 0 ? "yes" : "no").append("\n") + .append("\tH264_444:\t ") + .append(enc.getCapabilityValue(NV_ENC_CODEC_H264_GUID(), NV_ENC_CAPS_SUPPORT_YUV444_ENCODE) != 0 ? "yes" : "no").append("\n").append( + "\tH264_ME:\t").append(" ").append( + enc.getCapabilityValue(NV_ENC_CODEC_H264_GUID(), + NV_ENC_CAPS_SUPPORT_MEONLY_MODE) != 0 ? "yes" : "no").append("\n").append( + "\tH264_WxH:\t").append(" ").append( + enc.getCapabilityValue(NV_ENC_CODEC_H264_GUID(), + NV_ENC_CAPS_WIDTH_MAX)).append("*").append( + enc.getCapabilityValue(NV_ENC_CODEC_H264_GUID(), NV_ENC_CAPS_HEIGHT_MAX)).append("\n").append( + "\tHEVC:\t\t").append(" ").append( + enc.getCapabilityValue(NV_ENC_CODEC_HEVC_GUID(), + NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES) != 0 ? "yes" : "no").append("\n").append( + "\tHEVC_Main10:\t").append(" ").append( + enc.getCapabilityValue(NV_ENC_CODEC_HEVC_GUID(), + NV_ENC_CAPS_SUPPORT_10BIT_ENCODE) != 0 ? "yes" : "no").append("\n").append( + "\tHEVC_Lossless:\t").append(" ").append( + enc.getCapabilityValue(NV_ENC_CODEC_HEVC_GUID(), + NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE) != 0 ? "yes" : "no").append("\n").append( + "\tHEVC_SAO:\t").append(" ").append( + enc.getCapabilityValue(NV_ENC_CODEC_HEVC_GUID(), + NV_ENC_CAPS_SUPPORT_SAO) != 0 ? "yes" : "no").append("\n").append( + "\tHEVC_444:\t").append(" ").append( + enc.getCapabilityValue(NV_ENC_CODEC_HEVC_GUID(), + NV_ENC_CAPS_SUPPORT_YUV444_ENCODE) != 0 ? "yes" : "no").append("\n").append( + "\tHEVC_ME:\t").append(" ").append( + enc.getCapabilityValue(NV_ENC_CODEC_HEVC_GUID(), + NV_ENC_CAPS_SUPPORT_MEONLY_MODE) != 0 ? "yes" : "no").append("\n").append( + "\tHEVC_WxH:\t").append(" ").append( + enc.getCapabilityValue(NV_ENC_CODEC_HEVC_GUID(), + NV_ENC_CAPS_WIDTH_MAX)).append("*").append( + enc.getCapabilityValue(NV_ENC_CODEC_HEVC_GUID(), NV_ENC_CAPS_HEIGHT_MAX)).append("\n\n"); + + System.out.println(sb.toString()); + + enc.destroyEncoder(); + checkCudaApiCall(cuCtxDestroy(cuContext)); + } + } catch (CudaException e) { + e.printStackTrace(); + } + } + + public static void showHelpAndExit() throws InvalidArgument { + showHelpAndExit(null); + } + + public static void showHelpAndExit(String badOption) throws InvalidArgument { + boolean throwError = false; + StringBuilder sb = new StringBuilder(); + if (badOption != null) { + throwError = true; + + sb.append("Error parsing \"").append(badOption).append("\"").append("\n"); + } + sb.append("Options:").append("\n") + .append("-i Input file path").append("\n") + .append("-o Output file path").append("\n") + .append("-s Input resolution in this form: WxH").append("\n") + .append("-if Input format: iyuv nv12 yuv444 p010 yuv444p16 bgra bgra10 ayuv abgr abgr10").append("\n") + .append("-gpu Ordinal of GPU to use").append("\n") + .append("-outputInVidMem Set this to 1 to enable output in Video Memory").append("\n") + .append("-cuStreamType Use CU stream for pre and post processing when outputInVidMem is set to 1").append("\n") + .append(" CRC of encoded frames will be computed and dumped to file with suffix '_crc.txt' added").append("\n") + .append(" to file specified by -o option ").append("\n") + .append(" 0 : both pre and post processing are on NULL CUDA stream").append("\n") + .append(" 1 : both pre and post processing are on SAME CUDA stream").append("\n") + .append(" 2 : both pre and post processing are on DIFFERENT CUDA stream").append("\n"); + + sb.append(new NvEncoderInitParam("").getHelpMessage()).append("\n"); + + if (throwError) { + throw new InvalidArgument(sb.toString()); + } else { + System.out.println(sb.toString()); + showEncoderCapability(); + + exit(0); + } + } + + public static void parseCommandLine(int argc, String[] argv) throws InvalidArgument { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < argc; i++) { + if (argv[i].equals("-h")) { + showHelpAndExit(); + } + if (argv[i].equals("-i")) { + if (++i == argc) { + showHelpAndExit("-i"); + } + szInputFilePath = argv[i]; + continue; + } + if (argv[i].equals("-o")) { + if (++i == argc) { + showHelpAndExit("-o"); + } + szOutputFilePath = argv[i]; + continue; + } + if (argv[i].equals("-s")) { + if (++i == argc) { + showHelpAndExit("-s"); + } + String[] values = argv[i].split("x"); + + if (values.length != 2) { + showHelpAndExit("-s"); + } + + width = Integer.parseInt(values[0]); + height = Integer.parseInt(values[1]); + continue; + } + String[] vszFileFormatName = { + "iyuv", "nv12", "yv12", "yuv444", "p010", "yuv444p16", "bgra", "bgra10", "ayuv", "abgr", "abgr10" + }; + + int[] aFormat = + { + NV_ENC_BUFFER_FORMAT_IYUV, + NV_ENC_BUFFER_FORMAT_NV12, + NV_ENC_BUFFER_FORMAT_YV12, + NV_ENC_BUFFER_FORMAT_YUV444, + NV_ENC_BUFFER_FORMAT_YUV420_10BIT, + NV_ENC_BUFFER_FORMAT_YUV444_10BIT, + NV_ENC_BUFFER_FORMAT_ARGB, + NV_ENC_BUFFER_FORMAT_ARGB10, + NV_ENC_BUFFER_FORMAT_AYUV, + NV_ENC_BUFFER_FORMAT_ABGR, + NV_ENC_BUFFER_FORMAT_ABGR10, + }; + + if (argv[i].equals("-if")) { + if (++i == argc) { + showHelpAndExit("-if"); + } + String value = argv[i]; + + for (int index = 0; index < vszFileFormatName.length; index++) { + String fileFormat = vszFileFormatName[index]; + if (fileFormat.equals(value)) { + eFormat = aFormat[index]; + break; + } + } + + continue; + } + if (argv[i].equals("-gpu")) { + if (++i == argc) { + showHelpAndExit("-gpu"); + } + iGpu = Integer.parseInt(argv[i]); + continue; + } + if (argv[i].equals("-outputInVidMem")) { + if (++i == argc) { + showHelpAndExit("-outputInVidMem"); + } + bOutputInVidMem = !argv[i].equals("0"); + continue; + } + if (argv[i].equals("-cuStreamType")) { + if (++i == argc) { + showHelpAndExit("-cuStreamType"); + } + cuStreamType = Integer.parseInt(argv[i]); + continue; + } + + // Regard as encoder parameter + if (argv[i].charAt(0) != '-') { + showHelpAndExit(argv[i]); + } + + sb.append(argv[i]).append(" "); + while (i + 1 < argc && argv[i + 1].charAt(0) != '-') { + sb.append(argv[++i]).append(" "); + } + } + + initParam = new NvEncoderInitParam(sb.toString()); + } + + public static void initializeEncoder(NvEncoder pEnc, NvEncoderInitParam encodeCLIOptions, int eFormat) { + NV_ENC_INITIALIZE_PARAMS initializeParams = new NV_ENC_INITIALIZE_PARAMS(); + initializeParams.version(NV_ENC_INITIALIZE_PARAMS_VER); + + NV_ENC_CONFIG encodeConfig = new NV_ENC_CONFIG(); + encodeConfig.version(NV_ENC_CONFIG_VER); + + initializeParams.encodeConfig(encodeConfig); + pEnc.createDefaultEncoderParams(initializeParams, encodeCLIOptions.getEncodeGUID(), encodeCLIOptions.getPresetGUID(), encodeCLIOptions.getTuningInfo()); + + try { + encodeCLIOptions.setInitParams(initializeParams, eFormat); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + pEnc.createEncoder(initializeParams); + } + + public static void encodeCuda(int nWidth, int nHeight, int eFormat, NvEncoderInitParam encodeCLIOptions, CUctx_st cuContext, FileInputStream input, FileOutputStream output) throws IOException { + NvEncoderCuda encoder = new NvEncoderCuda(cuContext, nWidth, nHeight, eFormat); + + initializeEncoder(encoder, encodeCLIOptions, eFormat); + + int nFrameSize = encoder.getFrameSize(); + + byte[] pHostFrame = new byte[nFrameSize]; + + int nFrame = 0; + + while (true) { + // Load the next frame from disk + int nRead = input.read(pHostFrame); + // For receiving encoded packets + Vector> vPacket = new Vector<>(); + if (nRead == nFrameSize) { + final NvEncoderInputFrame encoderInputFrame = encoder.getNextInputFrame(); + NvEncoderCuda.copyToDeviceFrame(cuContext, new BytePointer(pHostFrame), 0, encoderInputFrame.getInputPointer().getPointer(LongPointer.class), + encoderInputFrame.getPitch(), + encoder.getEncodeWidth(), + encoder.getEncodeHeight(), + CU_MEMORYTYPE_HOST, + encoderInputFrame.getBufferFormat(), + encoderInputFrame.getChromaOffsets(), + encoderInputFrame.getNumChromaPlanes()); + + encoder.encodeFrame(vPacket); + } else { + encoder.endEncode(vPacket); + } + nFrame += vPacket.size(); + + for (Vector packet : vPacket) { + // For each encoded packet + byte[] bytes = new byte[packet.size()]; + + for (int index = 0; index < packet.size(); index++) { + bytes[index] = packet.get(index); + } + + output.write(bytes); + } + + if (nRead != nFrameSize) + break; + } + + encoder.dispose(); + + encoder.destroyEncoder(); + + System.out.println("Total frames encoded: " + nFrame); + } + + public static void encodeCudaOpInVidMem(int nWidth, int nHeight, int eFormat, NvEncoderInitParam encodeCLIOptions, CUctx_st cuContext, FileInputStream input, FileOutputStream output, int cuStreamType) throws IOException { + NvEncoderOutputInVidMemCuda encoder = new NvEncoderOutputInVidMemCuda(cuContext, nWidth, nHeight, eFormat); + + initializeEncoder(encoder, encodeCLIOptions, eFormat); + + int nFrameSize = encoder.getFrameSize(); + boolean useCUStream = cuStreamType != -1; + + CRC crc = null; + NvCUStream cuStream = null; + + if (useCUStream) { + // Allocate CUDA streams + cuStream = new NvCUStream((CUctx_st) encoder.getDevice(), cuStreamType, encoder); + + // When CUDA streams are used, the encoded frame's CRC is computed using cuda kernel + crc = new CRC((CUctx_st) encoder.getDevice(), encoder.getOutputBufferSize()); + } + + // For dumping output - encoded frame and CRC, to a file + DumpVidMemOutput dumpVidMemOutput = new DumpVidMemOutput((CUctx_st) encoder.getDevice(), encoder.getOutputBufferSize(), szOutputFilePath, useCUStream); + + byte[] pHostFrame = new byte[nFrameSize]; + int nFrame = 0; + + // Encoding loop + while (true) { + // Load the next frame from disk + int nRead = input.read(pHostFrame); + // For receiving encoded packets + Vector pVideoMemBfr = new Vector<>(); + + if (nRead == nFrameSize) { + final NvEncoderInputFrame encoderInputFrame = encoder.getNextInputFrame(); + NvEncoderCuda.copyToDeviceFrame(cuContext, new BytePointer(pHostFrame), 0, encoderInputFrame.getInputPointer().getPointer(LongPointer.class), + encoderInputFrame.getPitch(), + encoder.getEncodeWidth(), + encoder.getEncodeHeight(), + CU_MEMORYTYPE_HOST, + encoderInputFrame.getBufferFormat(), + encoderInputFrame.getChromaOffsets(), + encoderInputFrame.getNumChromaPlanes(), + false, + useCUStream ? cuStream.getInputStream() : null); + encoder.encodeFrame(pVideoMemBfr); + } else { + encoder.endEncode(pVideoMemBfr); + } + + for (int i = 0; i < pVideoMemBfr.size(); ++i) { + if (useCUStream) { + // Compute CRC of encoded stream + crc.getCRC(pVideoMemBfr.get(i), cuStream.getOutputStream()); + } + + dumpVidMemOutput.dumpOutputToFile(pVideoMemBfr.get(i).getPointer(LongPointer.class), useCUStream ? crc.getCrcVidMem() : new LongPointer(1) {{ + put(0); + }}, output, nFrame); + + nFrame++; + } + + if (nRead != nFrameSize) break; + } + + dumpVidMemOutput.dispose(); + + if (useCUStream) { + crc.dispose(); + cuStream.dispose(); + } + + encoder.dispose(); + + encoder.destroyEncoder(); + + System.out.println("Total frames encoded: " + nFrame); + } + + public static void main(String[] args) { + try { + parseCommandLine(args.length, args); + + NvCodecUtil.checkInputFile(szInputFilePath); + NvCodecUtil.validateResolution(width, height); + + if (szOutputFilePath == null) { + szOutputFilePath = initParam.isCodecH264() ? "out.h264" : "out.hevc"; + } + + try { + checkCudaApiCall(cuInit(0)); + + IntPointer nGpu = new IntPointer(1); + checkCudaApiCall(cuDeviceGetCount(nGpu)); + + if (iGpu < 0 || iGpu >= nGpu.get()) { + System.out.println("GPU ordinal out of range. Should be within [0 ," + (nGpu.get() - 1) + "]"); + return; + } + + IntPointer cuDevice = new IntPointer(1); + checkCudaApiCall(cuDeviceGet(cuDevice, iGpu)); + + BytePointer szDeviceName = new BytePointer(80); + checkCudaApiCall(cuDeviceGetName(szDeviceName, (int) szDeviceName.limit(), cuDevice.get())); + System.out.println("GPU in use: " + szDeviceName.getString()); + + CUctx_st cuContext = new CUctx_st(); + checkCudaApiCall(cuCtxCreate(cuContext, 0, cuDevice.get())); + + // Open input file + FileInputStream input = new FileInputStream(szInputFilePath); + // Open output file + FileOutputStream output = new FileOutputStream(szOutputFilePath); + + // Encode + if (bOutputInVidMem) { + encodeCudaOpInVidMem(width, height, eFormat, initParam, cuContext, input, output, cuStreamType); + } else { + encodeCuda(width, height, eFormat, initParam, cuContext, input, output); + } + + output.close(); + input.close(); + + System.out.println("Bitstream saved in file " + szOutputFilePath); + } catch (IOException e) { + e.printStackTrace(); + } + } catch (CudaException | InvalidArgument e) { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoDecodeCallback.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoDecodeCallback.java new file mode 100644 index 00000000000..0fe3a034642 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoDecodeCallback.java @@ -0,0 +1,32 @@ +package org.bytedeco.nvcodec.samples.callback; + +import org.bytedeco.nvcodec.samples.decoder.NvDecoder; +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.nvcodec.nvcuvid.CUVIDPICPARAMS; +import org.bytedeco.nvcodec.nvcuvid.PFNVIDDECODECALLBACK; + +public class PfnVideoDecodeCallback extends PFNVIDDECODECALLBACK { + private NvDecoder decoder; + private static PfnVideoDecodeCallback instance; + + public static PfnVideoDecodeCallback getInstance() { + if (instance == null) { + instance = new PfnVideoDecodeCallback().retainReference(); + } + + return instance; + } + + public void setDecoder(NvDecoder decoder) { + this.decoder = decoder; + } + + private PfnVideoDecodeCallback() { + super(); + } + + @Override + public int call(Pointer pointer, CUVIDPICPARAMS cuvidpicparams) { + return this.decoder.handlePictureDecode(cuvidpicparams); + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoDisplayCallback.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoDisplayCallback.java new file mode 100644 index 00000000000..31c6265295d --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoDisplayCallback.java @@ -0,0 +1,32 @@ +package org.bytedeco.nvcodec.samples.callback; + +import org.bytedeco.nvcodec.samples.decoder.NvDecoder; +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.nvcodec.nvcuvid.CUVIDPARSERDISPINFO; +import org.bytedeco.nvcodec.nvcuvid.PFNVIDDISPLAYCALLBACK; + +public class PfnVideoDisplayCallback extends PFNVIDDISPLAYCALLBACK { + private NvDecoder decoder; + private static PfnVideoDisplayCallback instance; + + public static PfnVideoDisplayCallback getInstance() { + if (instance == null) { + instance = new PfnVideoDisplayCallback().retainReference(); + } + + return instance; + } + + public void setDecoder(NvDecoder decoder) { + this.decoder = decoder; + } + + private PfnVideoDisplayCallback() { + super(); + } + + @Override + public int call(Pointer pointer, CUVIDPARSERDISPINFO cuvidparserdispinfo) { + return this.decoder.handlePictureDisplay(cuvidparserdispinfo); + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoSequenceCallback.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoSequenceCallback.java new file mode 100644 index 00000000000..691e350b597 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoSequenceCallback.java @@ -0,0 +1,32 @@ +package org.bytedeco.nvcodec.samples.callback; + +import org.bytedeco.nvcodec.samples.decoder.NvDecoder; +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.nvcodec.nvcuvid.CUVIDEOFORMAT; +import org.bytedeco.nvcodec.nvcuvid.PFNVIDSEQUENCECALLBACK; + +public class PfnVideoSequenceCallback extends PFNVIDSEQUENCECALLBACK { + private NvDecoder decoder; + private static PfnVideoSequenceCallback instance; + + public static PfnVideoSequenceCallback getInstance() { + if(instance == null){ + instance = new PfnVideoSequenceCallback().retainReference(); + } + + return instance; + } + + public void setDecoder(NvDecoder decoder) { + this.decoder = decoder; + } + + private PfnVideoSequenceCallback() { + super(); + } + + @Override + public int call(Pointer pointer, CUVIDEOFORMAT cuvideoformat) { + return this.decoder.handleVideoSequence(cuvideoformat); + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/cuda/CRC.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/cuda/CRC.java new file mode 100644 index 00000000000..983a0f62386 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/cuda/CRC.java @@ -0,0 +1,83 @@ +package org.bytedeco.nvcodec.samples.cuda; + +import org.bytedeco.nvcodec.samples.dispose.Disposable; +import org.bytedeco.nvcodec.samples.exceptions.CudaException; +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.cuda.cudart.CUfunc_st; +import org.bytedeco.cuda.cudart.CUmod_st; +import org.bytedeco.cuda.cudart.CUstream_st; +import org.bytedeco.javacpp.*; +import org.bytedeco.nvcodec.nvencodeapi.NV_ENC_OUTPUT_PTR; + +import static org.bytedeco.nvcodec.samples.util.CudaUtil.checkCudaApiCall; +import static org.bytedeco.cuda.global.cudart.*; + +public class CRC implements Disposable { + private CUmod_st module; + private CUctx_st device; + private CUfunc_st cudaFunction; + private LongPointer crcVidMem; + + public CRC(CUctx_st device, int bufferSize) { + this.device = device; + this.crcVidMem = new LongPointer(1); + + this.module = new CUmod_st(); + try { + checkCudaApiCall(cuCtxPushCurrent(this.device)); + + // Allocate video memory buffer to store CRC of encoded frame + checkCudaApiCall(cuMemAlloc(this.crcVidMem, bufferSize)); + + String path = getClass().getClassLoader().getResource("modules/crc.ptx").getPath().substring(1); + checkCudaApiCall(cuModuleLoad(this.module, new BytePointer(path))); + + checkCudaApiCall(cuCtxPopCurrent(null)); + + this.cudaFunction = new CUfunc_st(); + + checkCudaApiCall(cuModuleGetFunction(this.cudaFunction, this.module, "_Z16ComputeCRCKernelPhPj")); + } catch (CudaException e) { + e.printStackTrace(); + } + } + + public LongPointer getCrcVidMem() { + return crcVidMem; + } + + public void getCRC(NV_ENC_OUTPUT_PTR videoMemBfr, CUstream_st outputStream) { + this.computeCRC(videoMemBfr, this.crcVidMem, outputStream); + } + + public void computeCRC(NV_ENC_OUTPUT_PTR buffer, LongPointer crcValue, CUstream_st outputCUStream) { + Pointer[] pointers = new Pointer[]{ + new LongPointer(new long[]{ + buffer.address() + }), + new LongPointer(new long[]{ + crcValue.get() + }) + }; + PointerPointer kernelParameters = new PointerPointer(pointers); + + try { + checkCudaApiCall(cuLaunchKernel(this.cudaFunction, 1, 1, 1, 1, 1, 1, 0, outputCUStream, kernelParameters, null)); + } catch (CudaException e) { + e.printStackTrace(); + } + + kernelParameters.deallocate(); + } + + @Override + public void dispose() { + try { + checkCudaApiCall(cuCtxPushCurrent(this.device)); + checkCudaApiCall(cuMemFree(this.crcVidMem.get())); + checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException e) { + e.printStackTrace(); + } + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/decoder/NvDecoder.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/decoder/NvDecoder.java new file mode 100644 index 00000000000..b55debd682a --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/decoder/NvDecoder.java @@ -0,0 +1,941 @@ +package org.bytedeco.nvcodec.samples.decoder; + + +import org.bytedeco.nvcodec.samples.callback.PfnVideoDecodeCallback; +import org.bytedeco.nvcodec.samples.callback.PfnVideoDisplayCallback; +import org.bytedeco.nvcodec.samples.callback.PfnVideoSequenceCallback; +import org.bytedeco.nvcodec.samples.dispose.Disposable; +import org.bytedeco.nvcodec.samples.exceptions.CudaException; +import org.bytedeco.nvcodec.samples.exceptions.NvCodecException; +import org.bytedeco.nvcodec.samples.util.Dimension; +import org.bytedeco.nvcodec.samples.util.Rectangle; +import org.bytedeco.cuda.cudart.CUDA_MEMCPY2D; +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.cuda.cudart.CUstream_st; +import org.bytedeco.javacpp.*; +import org.bytedeco.nvcodec.global.nvcuvid; +import org.bytedeco.nvcodec.global.nvcuvid.*; +import org.bytedeco.nvcodec.nvcuvid.*; + +import java.util.*; + +import static org.bytedeco.cuda.global.cudart.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; +import static org.bytedeco.nvcodec.samples.util.CudaUtil.*; +import static org.bytedeco.nvcodec.samples.util.NvCodecUtil.*; + +/** + * @brief Base class for decoder interface. + */ +public class NvDecoder extends Pointer implements Disposable { + private CUctx_st cuContext; + + private _CUcontextlock_st ctxLock; + private CUvideoparser parser; + private CUvideodecoder decoder; + private boolean useDeviceFrame; + + //dimension of the output + private int width; + private int lumaHeight; + private int chromaHeight; + private int numChromaPlanes; + + //height of the mapped surface + private int surfaceWidth; + private int surfaceHeight; + + private int codec; + private int chromaFormat; + private int outputFormat; + + private int bitDepthMinus8; + private int bpp; + + private CUVIDEOFORMAT videoFormat; + private Rectangle displayRectangle; + + // stock of frames + private Vector frames; + // timestamps of decoded frames + private Vector timestamps; + + private int decodedFrame; + private int decodedFrameReturned; + + private int decodePicCount; + private int[] picNumInDecodeOrder; + private boolean endDecodeDone; + + private final Object vpFrameLock; + + private int frameAlloc; + + private CUstream_st cuvidStream; + + private boolean deviceFramePitched; + private SizeTPointer deviceFramePitch; + + private Rectangle cropRect; + private Dimension resizeDimension; + + private StringBuilder videoInfo; + + private int maxWidth; + private int maxHeight; + + private boolean reconfigExternal; + private boolean reconfigExtPPChanged; + + private static Map codecNames = new HashMap() { + { + put(cudaVideoCodec_MPEG1, "MPEG-1"); + put(cudaVideoCodec_MPEG2, "MPEG-2"); + put(cudaVideoCodec_MPEG4, "MPEG-4 (ASP)"); + put(cudaVideoCodec_VC1, "VC-1/WMV"); + put(cudaVideoCodec_H264, "AVC/H.264"); + put(cudaVideoCodec_JPEG, "M-JPEG"); + put(cudaVideoCodec_H264_SVC, "H.264/SVC"); + put(cudaVideoCodec_H264_MVC, "H.264/MVC"); + put(cudaVideoCodec_HEVC, "H.265/HEVC"); + put(cudaVideoCodec_VP8, "VP8"); + put(cudaVideoCodec_VP9, "VP9"); + put(cudaVideoCodec_NumCodecs, "Invalid"); + put(cudaVideoCodec_YUV420, "YUV 4:2:0"); + put(cudaVideoCodec_YV12, "YV12 4:2:0"); + put(cudaVideoCodec_NV12, "NV12 4:2:0"); + put(cudaVideoCodec_YUYV, "YUYV 4:2:2"); + put(cudaVideoCodec_UYVY, "UYVY 4:2:2"); + } + }; + + private static Map chromaFormatNames = new HashMap() { + { + put(cudaVideoChromaFormat_Monochrome, "YUV 400 (Monochrome)"); + put(cudaVideoChromaFormat_420, "YUV 420"); + put(cudaVideoChromaFormat_422, "YUV 422"); + put(cudaVideoChromaFormat_444, "YUV 444"); + } + }; + + public static String getVideoCodecString(int codec) { + return codecNames.get(codec); + } + + public static String getVideoChromaFormatString(int chromaFormat) { + return chromaFormatNames.get(chromaFormat); + } + + public static float getChromaHeightFactor(int surfaceFormat) { + float factor = 0.5f; + + switch (surfaceFormat) { + case cudaVideoSurfaceFormat_NV12: + case cudaVideoSurfaceFormat_P016: { + factor = 0.5f; + break; + } + case cudaVideoSurfaceFormat_YUV444: + case cudaVideoSurfaceFormat_YUV444_16Bit: { + factor = 1.0f; + break; + } + } + + return factor; + } + + public static int getChromaPlaneCount(int surfaceFormat) { + int numPlane = 1; + + switch (surfaceFormat) { + case cudaVideoSurfaceFormat_NV12: + case cudaVideoSurfaceFormat_P016: { + numPlane = 1; + break; + } + case cudaVideoSurfaceFormat_YUV444: + case cudaVideoSurfaceFormat_YUV444_16Bit: { + numPlane = 2; + break; + } + } + + return numPlane; + } + + /** + * @brief This function is used to get the current CUDA context. + */ + public CUctx_st getContext() { + return cuContext; + } + + /** + * @brief This function is used to get the current decode width. + */ + public int getWidth() { + return width; + } + + /** + * @brief This function is used to get the current decode height (Luma height). + */ + public int getHeight() { + return this.lumaHeight; + } + + /** + * @brief This function is used to get the current chroma height. + */ + public int getChromaHeight() { + return chromaHeight; + } + + /** + * @brief This function is used to get the number of chroma planes. + */ + public int getNumChromaPlanes() { + return numChromaPlanes; + } + + /** + * @brief This function is used to get the current frame size based on pixel format. + */ + public int getFrameSize() { + return this.width * (this.lumaHeight + this.chromaHeight * this.numChromaPlanes) * this.bpp; + } + + /** + * @brief This function is used to get the pitch of the device buffer holding the decoded frame. + */ + public int getDeviceFramePitch() { + return this.deviceFramePitch != null ? (int) this.deviceFramePitch.get() : this.width * this.bpp; + } + + /** + * @brief This function is used to get the bit depth associated with the pixel format. + */ + public int getBitDepth() { + return this.bitDepthMinus8 + 8; + } + + /** + * @brief This function is used to get the bytes used per pixel. + */ + public int getBPP() { + return this.bpp; + } + + /** + * @brief This function is used to get the YUV chroma format + */ + public int getOutputFormat() { + return outputFormat; + } + + /** + * @brief This function is used to get information about the video stream (codec, display parameters etc) + */ + public CUVIDEOFORMAT getVideoFormat() { + return videoFormat; + } + + /** + * @brief This function is used to get codec string from codec id + */ + public String getCodecString(int codec) { + return getVideoCodecString(codec); + } + + /** + * @brief This function is used to print information about the video stream + */ + public StringBuilder getVideoInfo() { + return videoInfo; + } + + /** + * @brief This function is used to initialize the decoder session. + * Application must call this function to initialize the decoder, before + * starting to decode any frames. + */ + public NvDecoder(CUctx_st cuContext, boolean useDeviceFrame, int codec, boolean lowLatency, boolean deviceFramePitched, Rectangle cropRect, Dimension resizeDimension, int maxWidth, int maxHeight, int clkRate) { + this.vpFrameLock = new Object(); + + this.ctxLock = new _CUcontextlock_st(); + this.parser = new CUvideoparser(); + this.decoder = new CUvideodecoder(); + this.cuvidStream = new CUstream_st(); + + this.frameAlloc = 0; + this.bpp = 1; + this.codec = cudaVideoCodec_NumCodecs; + + this.videoFormat = new CUVIDEOFORMAT(); + + this.displayRectangle = new Rectangle(); + + this.cropRect = cropRect; + this.resizeDimension = resizeDimension; + + this.picNumInDecodeOrder = new int[32]; + + this.cuContext = cuContext; + this.useDeviceFrame = useDeviceFrame; + + this.codec = codec; + + this.deviceFramePitch = new SizeTPointer(1) {{ + put(0); + }}; + + this.deviceFramePitched = deviceFramePitched; + + this.maxWidth = maxWidth; + this.maxHeight = maxHeight; + + this.frames = new Vector(); + this.timestamps = new Vector(); + + this.videoInfo = new StringBuilder(); + + if (cropRect != null) { + this.cropRect = cropRect; + } + + if (resizeDimension != null) { + this.resizeDimension = resizeDimension; + } + + try { + checkNvCodecApiCall(cuvidCtxLockCreate(this.ctxLock, this.cuContext)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + CUVIDPARSERPARAMS parseParameter = new CUVIDPARSERPARAMS(); + + parseParameter.CodecType(this.codec); + parseParameter.ulMaxNumDecodeSurfaces(1); + parseParameter.ulClockRate(clkRate); + parseParameter.pUserData(this); + parseParameter.ulMaxDisplayDelay(lowLatency ? 0 : 1); + + parseParameter.pfnSequenceCallback(PfnVideoSequenceCallback.getInstance()); + + parseParameter.pfnDecodePicture(PfnVideoDecodeCallback.getInstance()); + + parseParameter.pfnDisplayPicture(PfnVideoDisplayCallback.getInstance()); + + PfnVideoSequenceCallback.getInstance().setDecoder(this); + PfnVideoDecodeCallback.getInstance().setDecoder(this); + PfnVideoDisplayCallback.getInstance().setDecoder(this); + try { + checkNvCodecApiCall(cuvidCreateVideoParser(this.parser, parseParameter)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + } + + /** + * @brief This function gets called when a sequence is ready to be decoded. The function also gets called + * when there is format change + */ + public int handleVideoSequence(CUVIDEOFORMAT videoFormat) { + long startTime = System.currentTimeMillis(); + + this.videoInfo.setLength(0); + + this.videoInfo.append("Video Input Information \n") + .append("\t Codec : ") + .append(getVideoCodecString(videoFormat.codec())) + .append("\n") + .append("\t Frame rate : ") + .append(String.format("%d / %d = %f fps \n", videoFormat.frame_rate_numerator(), videoFormat.frame_rate_denominator(), 1.0f * videoFormat.frame_rate_numerator() / videoFormat.frame_rate_denominator())) + .append("\t Sequence : ") + .append(videoFormat.progressive_sequence() == 1 ? "Progressive" : "Interlaced") + .append("\n") + .append("\t Coded size : ") + .append(String.format("[ %d, %d ] \n", videoFormat.coded_width(), videoFormat.coded_height())) + .append("\t Display area : ") + .append(String.format("[%d, %d, %d, %d] \n", videoFormat.display_area_left(), videoFormat.display_area_top(), videoFormat.display_area_right(), videoFormat.display_area_bottom())) + .append("\t Chroma : ") + .append(getVideoChromaFormatString(videoFormat.chroma_format())) + .append("\n") + .append("\t Bit depth : ") + .append(videoFormat.bit_depth_chroma_minus8() + 8) + .append("\n"); + + int decodeSurface = videoFormat.min_num_decode_surfaces(); + CUVIDDECODECAPS decodecaps = new CUVIDDECODECAPS(); + cudaMemset(decodecaps, 0, Pointer.sizeof(CUVIDDECODECAPS.class)); + + decodecaps.eCodecType(videoFormat.codec()); + decodecaps.eChromaFormat(videoFormat.chroma_format()); + decodecaps.nBitDepthMinus8(videoFormat.bit_depth_luma_minus8()); + + try { + checkCudaApiCall(cuCtxPushCurrent(this.cuContext)); + checkNvCodecApiCall(cuvidGetDecoderCaps(decodecaps)); + checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException | NvCodecException e) { + e.printStackTrace(); + } + + if (decodecaps.bIsSupported() == 0) { + System.err.println("Codec not supported on this GPU"); + + return decodeSurface; + } + + if ((videoFormat.coded_width() > decodecaps.nMaxWidth()) || (videoFormat.coded_height() > decodecaps.nMaxHeight())) { + System.err.printf("Resolution : %d x %d \n Max Supported (wxh) : %d x %d \n Resolution not supported on this GPU%n", videoFormat.coded_width(), videoFormat.coded_height(), decodecaps.nMaxWidth(), decodecaps.nMaxHeight()); + + return decodeSurface; + } + + if ((videoFormat.coded_width() >> 4) * (videoFormat.coded_height() >> 4) > decodecaps.nMaxMBCount()) { + System.err.printf("MBCount : %d \n Max Supported mbcnt : %d \n MBCount not supported on this GPU%n", (videoFormat.coded_width() >> 4) * (videoFormat.coded_height() >> 4), decodecaps.nMaxMBCount()); + } + + if (this.width != 0 && this.lumaHeight != 0 && this.chromaHeight != 0) { + // cuvidCreateDecoder() has been called before, and now there's possible config change + return reconfigureDecoder(videoFormat); + } + + this.codec = videoFormat.codec(); + this.chromaFormat = videoFormat.chroma_format(); + this.bitDepthMinus8 = videoFormat.bit_depth_luma_minus8(); + this.bpp = this.bitDepthMinus8 > 0 ? 2 : 1; + + switch (this.chromaFormat) { + case cudaVideoChromaFormat_420: + this.outputFormat = videoFormat.bit_depth_luma_minus8() == 1 ? cudaVideoSurfaceFormat_P016 : cudaVideoSurfaceFormat_NV12; + break; + case cudaVideoChromaFormat_422: + this.outputFormat = cudaVideoSurfaceFormat_NV12; + break; + case cudaVideoChromaFormat_444: + this.outputFormat = videoFormat.bit_depth_luma_minus8() == 1 ? cudaVideoSurfaceFormat_YUV444_16Bit : cudaVideoSurfaceFormat_YUV444; + break; + } + + if ((decodecaps.nOutputFormatMask() & (1 << this.outputFormat)) == 0) { + if ((decodecaps.nOutputFormatMask() & (1 << cudaVideoSurfaceFormat_NV12)) == 1) { + this.outputFormat = cudaVideoSurfaceFormat_NV12; + } else if ((decodecaps.nOutputFormatMask() & (1 << cudaVideoSurfaceFormat_P016)) == 1) { + this.outputFormat = cudaVideoSurfaceFormat_P016; + } else if ((decodecaps.nOutputFormatMask() & (1 << cudaVideoSurfaceFormat_YUV444)) == 1) { + this.outputFormat = cudaVideoSurfaceFormat_YUV444; + } else if ((decodecaps.nOutputFormatMask() & (1 << cudaVideoSurfaceFormat_YUV444_16Bit)) == 1) { + this.outputFormat = cudaVideoSurfaceFormat_YUV444_16Bit; + } else { + System.err.println("No supported output format found"); + } + } + + this.videoFormat = videoFormat; + + CUVIDDECODECREATEINFO videoDecodeCreateInfo = new CUVIDDECODECREATEINFO(); + videoDecodeCreateInfo.CodecType(videoFormat.codec()); + videoDecodeCreateInfo.ChromaFormat(videoFormat.chroma_format()); + videoDecodeCreateInfo.OutputFormat(this.outputFormat); + videoDecodeCreateInfo.bitDepthMinus8(videoFormat.bit_depth_luma_minus8()); + + if (videoFormat.progressive_sequence() == 1) { + videoDecodeCreateInfo.DeinterlaceMode(cudaVideoDeinterlaceMode_Weave); + } else { + videoDecodeCreateInfo.DeinterlaceMode(cudaVideoDeinterlaceMode_Adaptive); + } + + videoDecodeCreateInfo.ulNumOutputSurfaces(2); + + //With PreferCUVID, JPEG is still decoded by CUDA while video is decoded by NVDEC hardware + + videoDecodeCreateInfo.ulCreationFlags(cudaVideoCreate_PreferCUVID); + videoDecodeCreateInfo.ulNumDecodeSurfaces(decodeSurface); + videoDecodeCreateInfo.vidLock(this.ctxLock); + videoDecodeCreateInfo.ulWidth(videoFormat.coded_width()); + videoDecodeCreateInfo.ulHeight(videoFormat.coded_height()); + + if (this.maxWidth < videoFormat.coded_width()) { + this.maxWidth = videoFormat.coded_width(); + } + + if (this.maxHeight < videoFormat.coded_height()) { + this.maxHeight = videoFormat.coded_height(); + } + + videoDecodeCreateInfo.ulMaxWidth(this.maxWidth); + videoDecodeCreateInfo.ulMaxHeight(this.maxHeight); + + if ((this.cropRect.getRight() == 0 || this.cropRect.getBottom() == 0) && (this.resizeDimension.getWidth() == 0 || this.resizeDimension.getHeight() == 0)) { + this.width = videoFormat.display_area_right() - this.videoFormat.display_area_left(); + this.lumaHeight = videoFormat.display_area_bottom() - this.videoFormat.display_area_top(); + + videoDecodeCreateInfo.ulTargetWidth(videoFormat.coded_width()); + videoDecodeCreateInfo.ulTargetHeight(videoFormat.coded_height()); + } else { + if (this.resizeDimension.getWidth() != 0 && this.resizeDimension.getHeight() != 0) { + videoDecodeCreateInfo.display_area_left((short) videoFormat.display_area_left()); + videoDecodeCreateInfo.display_area_top((short) videoFormat.display_area_top()); + videoDecodeCreateInfo.display_area_right((short) videoFormat.display_area_right()); + videoDecodeCreateInfo.display_area_bottom((short) videoFormat.display_area_bottom()); + this.width = this.resizeDimension.getWidth(); + this.lumaHeight = this.resizeDimension.getHeight(); + } + + if (this.cropRect.getRight() != 0 && this.cropRect.getBottom() != 0) { + videoDecodeCreateInfo.display_area_left((short) this.cropRect.getLeft()); + videoDecodeCreateInfo.display_area_top((short) this.cropRect.getTop()); + videoDecodeCreateInfo.display_area_right((short) this.cropRect.getRight()); + videoDecodeCreateInfo.display_area_bottom((short) this.cropRect.getBottom()); + + this.width = this.cropRect.getRight() - this.cropRect.getLeft(); + this.lumaHeight = this.cropRect.getBottom() - this.cropRect.getTop(); + } + + videoDecodeCreateInfo.ulTargetWidth(this.width); + videoDecodeCreateInfo.ulTargetHeight(this.lumaHeight); + } + + this.chromaHeight = (int) (this.lumaHeight * getChromaHeightFactor(this.outputFormat)); + this.numChromaPlanes = getChromaPlaneCount(this.outputFormat); + this.surfaceHeight = (int) videoDecodeCreateInfo.ulTargetHeight(); + this.surfaceWidth = (int) videoDecodeCreateInfo.ulTargetWidth(); + this.displayRectangle.setBottom(videoDecodeCreateInfo.display_area_bottom()); + this.displayRectangle.setTop(videoDecodeCreateInfo.display_area_top()); + this.displayRectangle.setLeft(videoDecodeCreateInfo.display_area_left()); + this.displayRectangle.setRight(videoDecodeCreateInfo.display_area_right()); + + String[] deinterlaceModes = {"Weave", "Bob", "Adaptive"}; + + this.videoInfo.append("Video Decoding Params : \n") + .append(String.format("\t Num Surfaces : %d \n", videoDecodeCreateInfo.ulNumDecodeSurfaces())) + .append(String.format("\t Crop : [%d, %d, %d, %d] \n", videoDecodeCreateInfo.display_area_left(), videoDecodeCreateInfo.display_area_top(), videoDecodeCreateInfo.display_area_right(), videoDecodeCreateInfo.display_area_bottom())) + .append(String.format("\t Resize : %d x %d \n", videoDecodeCreateInfo.ulTargetWidth(), videoDecodeCreateInfo.ulTargetHeight())) + .append(String.format("\t Deinterlace : %s \n", deinterlaceModes[videoDecodeCreateInfo.DeinterlaceMode()])); + + try { + checkCudaApiCall(cuCtxPushCurrent(this.cuContext)); + checkNvCodecApiCall(cuvidCreateDecoder(this.decoder, videoDecodeCreateInfo)); + checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException | NvCodecException e) { + e.printStackTrace(); + } + + System.out.printf("Session Initialization Time: %d ms %n", (System.currentTimeMillis() - startTime)); + + return decodeSurface; + } + + /** + * @brief This function reconfigure decoder if there is a change in sequence params. + */ + public int reconfigureDecoder(CUVIDEOFORMAT videoFormat) { + if (videoFormat.bit_depth_luma_minus8() != this.videoFormat.bit_depth_luma_minus8() || videoFormat.bit_depth_chroma_minus8() != this.videoFormat.bit_depth_chroma_minus8()) { + System.err.println("Reconfigure Not supported for bit depth change"); + } + + if (videoFormat.chroma_format() != this.videoFormat.chroma_format()) { + System.err.println("Reconfigure Not supported for chroma format change"); + } + + boolean decodeResChange = !(videoFormat.coded_width() == this.videoFormat.coded_width() && videoFormat.coded_height() == this.videoFormat.coded_height()); + boolean displayRectChange = !(videoFormat.display_area_bottom() == this.videoFormat.display_area_bottom() && videoFormat.display_area_top() == this.videoFormat.display_area_top() + && videoFormat.display_area_left() == this.videoFormat.display_area_left() && videoFormat.display_area_right() == this.videoFormat.display_area_right()); + int decodeSurface = videoFormat.min_num_decode_surfaces(); + + if ((videoFormat.coded_width() > this.maxWidth) || (videoFormat.coded_height() > this.maxHeight)) { + // For VP9, let driver handle the change if new width/height > maxwidth/maxheight + if ((this.codec != cudaVideoCodec_VP9) || this.reconfigExternal) { + System.err.println("Reconfigure Not supported when width/height > maxwidth/maxheight"); + } + } + + if (!decodeResChange && !this.reconfigExtPPChanged) { + // if the coded_width/coded_height hasn't changed but display resolution has changed, then need to update width/height for + // correct output without cropping. Example : 1920x1080 vs 1920x1088 + if (displayRectChange) { + this.width = videoFormat.display_area_right() - videoFormat.display_area_left(); + this.lumaHeight = videoFormat.display_area_bottom() - videoFormat.display_area_top(); + this.chromaHeight = (int) (this.lumaHeight * getChromaHeightFactor(this.outputFormat)); + this.numChromaPlanes = getChromaPlaneCount(this.outputFormat); + } + + // no need for reconfigureDecoder(). Just return + return 1; + } + + CUVIDRECONFIGUREDECODERINFO reconfigParams = new CUVIDRECONFIGUREDECODERINFO(0); + + this.videoFormat.coded_width(videoFormat.coded_width()); + reconfigParams.ulWidth(this.videoFormat.coded_width()); + + this.videoFormat.coded_height(videoFormat.coded_height()); + reconfigParams.ulHeight(this.videoFormat.coded_height()); + + + // Dont change display rect and get scaled output from decoder. This will help display app to present apps smoothly + reconfigParams.display_area_bottom((short) this.displayRectangle.getBottom()); + reconfigParams.display_area_top((short) this.displayRectangle.getTop()); + reconfigParams.display_area_left((short) this.displayRectangle.getLeft()); + reconfigParams.display_area_right((short) this.displayRectangle.getRight()); + reconfigParams.ulTargetWidth(this.surfaceWidth); + reconfigParams.ulTargetHeight(this.surfaceHeight); + + + // If external reconfigure is called along with resolution change even if post processing params is not changed, + // do full reconfigure params update + if ((this.reconfigExternal && decodeResChange) || this.reconfigExtPPChanged) { + // update display rect and target resolution if requested explicitely + this.reconfigExternal = false; + this.reconfigExtPPChanged = false; + this.videoFormat = videoFormat; + + if (!(this.cropRect.getRight() != 0 && this.cropRect.getBottom() != 0) && !(this.resizeDimension.getWidth() != 0 && this.resizeDimension.getHeight() != 0)) { + this.width = videoFormat.display_area_right() - videoFormat.display_area_left(); + this.lumaHeight = videoFormat.display_area_bottom() - videoFormat.display_area_top(); + reconfigParams.ulTargetWidth(videoFormat.coded_width()); + reconfigParams.ulTargetHeight(videoFormat.coded_height()); + } else { + if (this.resizeDimension.getWidth() != 0 && this.resizeDimension.getHeight() != 0) { + reconfigParams.display_area_left((short) videoFormat.display_area_left()); + reconfigParams.display_area_top((short) videoFormat.display_area_top()); + reconfigParams.display_area_right((short) videoFormat.display_area_right()); + reconfigParams.display_area_bottom((short) videoFormat.display_area_bottom()); + this.width = this.resizeDimension.getWidth(); + this.lumaHeight = this.resizeDimension.getHeight(); + } + + if (this.cropRect.getRight() != 0 && this.cropRect.getBottom() != 0) { + reconfigParams.display_area_left((short) this.cropRect.getLeft()); + reconfigParams.display_area_top((short) this.cropRect.getTop()); + reconfigParams.display_area_right((short) this.cropRect.getRight()); + reconfigParams.display_area_bottom((short) this.cropRect.getBottom()); + this.width = this.cropRect.getRight() - this.cropRect.getLeft(); + this.lumaHeight = this.cropRect.getBottom() - this.cropRect.getTop(); + } + + reconfigParams.ulTargetWidth(this.width); + reconfigParams.ulTargetHeight(this.lumaHeight); + } + + this.chromaHeight = (int) (this.lumaHeight * getChromaHeightFactor(this.outputFormat)); + this.numChromaPlanes = getChromaPlaneCount(this.outputFormat); + this.surfaceHeight = reconfigParams.ulTargetHeight(); + this.surfaceWidth = reconfigParams.ulTargetWidth(); + this.displayRectangle.setBottom(reconfigParams.display_area_bottom()); + this.displayRectangle.setTop(reconfigParams.display_area_top()); + this.displayRectangle.setLeft(reconfigParams.display_area_left()); + this.displayRectangle.setRight(reconfigParams.display_area_right()); + } + + reconfigParams.ulNumDecodeSurfaces(decodeSurface); + + try { + long startTime = System.currentTimeMillis(); + checkCudaApiCall(cuCtxPushCurrent(this.cuContext)); + checkNvCodecApiCall(cuvidReconfigureDecoder(this.decoder, reconfigParams)); + checkCudaApiCall(cuCtxPopCurrent(null)); + System.out.printf("Session Reconfigure Time: %d ms", (System.currentTimeMillis() - startTime)); + } catch (CudaException | NvCodecException e) { + e.printStackTrace(); + } + + return decodeSurface; + } + + /** + * @param cropRect - cropping rectangle coordinates + * @param resizeDimension - width and height of resized output + * @brief This function allow app to set decoder reconfig params + */ + public int setReconfigParams(Rectangle cropRect, Dimension resizeDimension) { + this.reconfigExternal = true; + this.reconfigExtPPChanged = false; + if (cropRect != null) { + if (!((cropRect.getTop() == this.cropRect.getTop()) && (cropRect.getLeft() == this.cropRect.getLeft()) + && (cropRect.getBottom() == this.cropRect.getBottom()) && (cropRect.getRight() == this.cropRect.getRight()))) { + this.reconfigExtPPChanged = true; + this.cropRect = cropRect; + } + } + + if (resizeDimension != null) { + if (!((resizeDimension.getWidth() == this.resizeDimension.getWidth()) && (resizeDimension.getHeight() == this.resizeDimension.getHeight()))) { + this.reconfigExtPPChanged = true; + this.resizeDimension = resizeDimension; + } + } + + + // Clear existing output buffers of different size + + + BytePointer framePointer = null; + + while (!this.frames.isEmpty()) { + framePointer = this.frames.lastElement(); + this.frames.remove(this.frames.size() - 1); + + if (this.useDeviceFrame) { + try { + checkCudaApiCall(cuCtxPushCurrent(this.cuContext)); + checkCudaApiCall(cudaFree(framePointer)); + checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException e) { + e.printStackTrace(); + } + } + } + + return 1; + } + + + /** + * @brief This function gets called when a picture is ready to be decoded. cuvidDecodePicture is called from this function + * to decode the picture + */ + public int handlePictureDecode(CUVIDPICPARAMS picParams) { + if (this.decoder == null || this.decoder.isNull()) { + System.err.println("Decoder not initialized."); + return 0; + } + + this.picNumInDecodeOrder[picParams.CurrPicIdx()] = this.decodePicCount++; + + try { + checkNvCodecApiCall(cuvidDecodePicture(this.decoder, picParams)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + return 1; + } + + /** + * @brief This function gets called after a picture is decoded and available for display. Frames are fetched and stored in + * internal buffer + */ + public int handlePictureDisplay(CUVIDPARSERDISPINFO displayInfo) { + try { + CUVIDPROCPARAMS videoProcessingParameters = new CUVIDPROCPARAMS(); + videoProcessingParameters.progressive_frame(displayInfo.progressive_frame()); + videoProcessingParameters.second_field(displayInfo.repeat_first_field() + 1); + videoProcessingParameters.top_field_first(displayInfo.top_field_first()); + videoProcessingParameters.unpaired_field(displayInfo.repeat_first_field() < 0 ? 1 : 0); + videoProcessingParameters.output_stream(this.cuvidStream); + + LongPointer srcFrame = new LongPointer(1); + IntPointer srcPitch = new IntPointer(1); + + try { + checkNvCodecApiCall(cuvidMapVideoFrame64(this.decoder, displayInfo.picture_index(), srcFrame, srcPitch, videoProcessingParameters)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + CUVIDGETDECODESTATUS decodeStatus = new CUVIDGETDECODESTATUS(); + cudaMemset(decodeStatus, 0, Pointer.sizeof(CUVIDGETDECODESTATUS.class)); + + int result = cuvidGetDecodeStatus(this.decoder, displayInfo.picture_index(), decodeStatus); + + if (result == CUDA_SUCCESS && (decodeStatus.decodeStatus() == cuvidDecodeStatus_Error || decodeStatus.decodeStatus() == cuvidDecodeStatus_Error_Concealed)) { + System.err.printf("Decode Error occurred for picture %d%n", this.picNumInDecodeOrder[displayInfo.picture_index()]); + } + + BytePointer decodedFrame; + + synchronized (this.vpFrameLock) { + if (++this.decodedFrame > this.frames.size()) { + // Not enough frames in stock + this.frameAlloc++; + + BytePointer frame = new BytePointer(); + + if (this.useDeviceFrame) { + checkCudaApiCall(cuCtxPushCurrent(this.cuContext)); + if (this.deviceFramePitched) { + checkCudaApiCall(cuMemAllocPitch(frame.getPointer(LongPointer.class), this.deviceFramePitch, (long) this.width * this.bpp, this.lumaHeight + ((long) this.chromaHeight * this.numChromaPlanes), 16)); + } else { + checkCudaApiCall(cuMemAlloc(frame.getPointer(LongPointer.class), this.getFrameSize())); + } + checkCudaApiCall(cuCtxPopCurrent(null)); + } else { + frame = new BytePointer(getFrameSize()); + } + this.frames.add(frame); + } + decodedFrame = this.frames.get(this.decodedFrame - 1); + } + + checkCudaApiCall(cuCtxPushCurrent(this.cuContext)); + + CUDA_MEMCPY2D memcpy2D = new CUDA_MEMCPY2D(); + memcpy2D.srcXInBytes(0); + memcpy2D.srcMemoryType(CU_MEMORYTYPE_DEVICE); + memcpy2D.srcDevice(srcFrame.get()); + memcpy2D.srcPitch(srcPitch.get()); + memcpy2D.dstMemoryType(this.useDeviceFrame ? CU_MEMORYTYPE_DEVICE : CU_MEMORYTYPE_HOST); + memcpy2D.dstHost(decodedFrame); + memcpy2D.dstDevice(decodedFrame.address()); + memcpy2D.dstPitch(this.deviceFramePitch.get() != 0 ? this.deviceFramePitch.get() : (long) this.width * this.bpp); + memcpy2D.WidthInBytes((long) this.width * this.bpp); + memcpy2D.Height(this.lumaHeight); + checkCudaApiCall(cuMemcpy2DAsync(memcpy2D, this.cuvidStream)); + + memcpy2D.srcDevice(srcFrame.get() + memcpy2D.srcPitch() * this.surfaceHeight); + memcpy2D.dstHost(decodedFrame.getPointer(memcpy2D.dstPitch() * this.lumaHeight)); + memcpy2D.dstDevice(decodedFrame.address()); + memcpy2D.Height(this.chromaHeight); + checkCudaApiCall(cuMemcpy2DAsync(memcpy2D, this.cuvidStream)); + + if (this.numChromaPlanes == 2) { + memcpy2D.srcDevice(srcFrame.get() + memcpy2D.srcPitch() * this.surfaceHeight * 2); + memcpy2D.dstHost(decodedFrame.getPointer(memcpy2D.dstPitch() * this.lumaHeight * 2)); + memcpy2D.dstDevice(memcpy2D.dstHost().address()); + memcpy2D.Height(this.chromaHeight); + + checkCudaApiCall(cuMemcpy2DAsync(memcpy2D, this.cuvidStream)); + } + + checkCudaApiCall(cuStreamSynchronize(this.cuvidStream)); + checkCudaApiCall(cuCtxPopCurrent(null)); + + if (this.timestamps.size() < this.decodedFrame) { + for (int index = this.timestamps.size(); index < this.frames.size(); index++) { + this.timestamps.add(-1L); + } + } + + this.timestamps.setElementAt(displayInfo.timestamp(), this.decodedFrame - 1); + + checkNvCodecApiCall(cuvidUnmapVideoFrame64(this.decoder, srcFrame.get())); + } catch (CudaException | NvCodecException e) { + e.printStackTrace(); + } + + return 1; + } + + /** + * @param data - pointer to the data buffer that is to be decoded + * @param size - size of the data buffer in bytes + * @param flags - CUvideopacketflags for setting decode options + * @param timestamp - presentation timestamp + * @brief This function decodes a frame and returns the number of frames that are available for + * display. All frames that are available for display should be read before making a subsequent decode call. + */ + public int decode(BytePointer data, int size, int flags, long timestamp) { + this.decodedFrame = 0; + this.decodedFrameReturned = 0; + + CUVIDSOURCEDATAPACKET packet = new CUVIDSOURCEDATAPACKET(); + packet.payload(data); + packet.payload_size(size); + packet.flags(flags | CUVID_PKT_TIMESTAMP); + packet.timestamp(timestamp); + + if ((data == null || data.isNull()) || size == 0) { + packet.flags(packet.flags() | CUVID_PKT_ENDOFSTREAM); + } + try { + checkNvCodecApiCall(nvcuvid.cuvidParseVideoData(this.parser, packet)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + return this.decodedFrame; + } + + /** + * @brief This function returns a decoded frame and timestamp. This function should be called in a loop for + * fetching all the frames that are available for display. + */ + public BytePointer getFrame(LongPointer timestamp) { + if (this.decodedFrame > 0) { + synchronized (this.vpFrameLock) { + this.decodedFrame--; + + if (timestamp != null && !timestamp.isNull()) { + timestamp.put(this.timestamps.get(this.decodedFrameReturned)); + } + + return this.frames.get(this.decodedFrameReturned++); + } + } + + return null; + } + + /** + * @brief This function decodes a frame and returns the locked frame buffers + * This makes the buffers available for use by the application without the buffers + * getting overwritten, even if subsequent decode calls are made. The frame buffers + * remain locked, until UnlockFrame() is called + */ + public BytePointer getLockedFrame(LongPointer timestamp) { + long time; + BytePointer frame; + + if (this.decodedFrame > 0) { + synchronized (this.vpFrameLock) { + this.decodedFrame--; + frame = this.frames.get(0); + + this.frames.remove(0); + this.frames.remove(1); + + time = this.timestamps.get(0); + this.timestamps.remove(0); + this.timestamps.remove(1); + + if (timestamp != null && !timestamp.isNull()) { + timestamp.put(time); + } + + return frame; + } + } + + return null; + } + + @Override + public void dispose() { + try { + long startTime = System.currentTimeMillis(); + checkCudaApiCall(cuCtxPushCurrent(this.cuContext)); + checkCudaApiCall(cuCtxPopCurrent(null)); + + if (this.parser != null && !this.parser.isNull()) { + cuvidDestroyVideoParser(this.parser); + } + + if (this.decoder != null && !this.decoder.isNull()) { + cuvidDestroyDecoder(this.decoder); + } + + synchronized (this.vpFrameLock) { + for (BytePointer framePointer : this.frames) { + if (this.useDeviceFrame) { + checkCudaApiCall(cuCtxPushCurrent(this.cuContext)); + cuMemFree(framePointer.address()); + checkCudaApiCall(cuCtxPopCurrent(null)); + } else { + cuMemFreeHost(framePointer); + } + } + } + + cuvidCtxLockDestroy(this.ctxLock); + + System.out.println("Session Deinitialization Time: " + (System.currentTimeMillis() - startTime) + "ms"); + } catch (CudaException e) { + e.printStackTrace(); + } + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/dispose/Disposable.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/dispose/Disposable.java new file mode 100644 index 00000000000..46fe3890061 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/dispose/Disposable.java @@ -0,0 +1,5 @@ +package org.bytedeco.nvcodec.samples.dispose; + +public interface Disposable { + void dispose(); +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/DumpVidMemOutput.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/DumpVidMemOutput.java new file mode 100644 index 00000000000..3c9c6966d97 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/DumpVidMemOutput.java @@ -0,0 +1,126 @@ +package org.bytedeco.nvcodec.samples.encoder; + +import org.bytedeco.nvcodec.samples.exceptions.CudaException; +import org.bytedeco.nvcodec.samples.util.CudaUtil; +import org.bytedeco.nvcodec.samples.dispose.Disposable; +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.javacpp.IntPointer; +import org.bytedeco.javacpp.LongPointer; +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.nvcodec.nvencodeapi.NV_ENC_ENCODE_OUT_PARAMS; + +import java.io.*; + +import static org.bytedeco.cuda.global.cudart.*; + +public class DumpVidMemOutput implements Disposable { + private int bfrSize; + private boolean useCRC; + private String crcFile; + + private CUctx_st device; + + private Pointer hostMemEncOp; + private IntPointer hostMemCRC; + private FileWriter writer; + + public DumpVidMemOutput(CUctx_st device, final int bfrSize, String outputFilePath, boolean useCUStream) { + this.device = device; + this.bfrSize = bfrSize; + this.useCRC = useCUStream; + this.hostMemCRC = new IntPointer(); + this.hostMemEncOp = new Pointer(); + try { + CudaUtil.checkCudaApiCall(cuCtxPushCurrent(this.device)); + + // Allocate host memory buffer to copy encoded output and CRC + CudaUtil.checkCudaApiCall(cuMemAllocHost(this.hostMemEncOp, (this.bfrSize + (useCUStream ? 4 : 0)))); + + CudaUtil.checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException e) { + e.printStackTrace(); + } + + // Open file to dump CRC + if (this.useCRC) { + this.crcFile = outputFilePath + "_crc.txt"; + + try { + this.writer = new FileWriter(this.crcFile); + } catch (IOException e) { + e.printStackTrace(); + } + + this.hostMemCRC = new IntPointer() { + { + address = hostMemEncOp.address() + bfrSize; + } + }; + + } + } + + public void dumpOutputToFile(LongPointer encFrameBfr, LongPointer crcBfr, FileOutputStream outputStream, int frame) { + try { + CudaUtil.checkCudaApiCall(cuCtxPushCurrent(this.device)); + + // Copy encoded frame from video memory buffer to host memory buffer + CudaUtil.checkCudaApiCall(cuMemcpyDtoH(this.hostMemEncOp, encFrameBfr.address(), this.bfrSize)); + + // Copy encoded frame CRC from video memory buffer to host memory buffer + if (this.useCRC) { + CudaUtil.checkCudaApiCall(cuMemcpyDtoH(this.hostMemCRC, crcBfr.get(), 4)); + } + + CudaUtil.checkCudaApiCall(cuCtxPopCurrent(null)); + + // Write encoded bitstream in file + + int offset = Pointer.sizeof(NV_ENC_ENCODE_OUT_PARAMS.class); + int bitstreamSize = new NV_ENC_ENCODE_OUT_PARAMS(this.hostMemEncOp).bitstreamSizeInBytes(); + + Pointer pointer = this.hostMemEncOp.getPointer(offset); + pointer.limit(bitstreamSize + pointer.position()); + + byte[] data = new byte[bitstreamSize]; + pointer.asByteBuffer().get(data); + + try { + outputStream.write(data); + } catch (IOException e) { + e.printStackTrace(); + } + + // Write CRC in file + if (this.useCRC) { + if (frame == 0) { + this.writer.write(String.format("Frame num CRC %n")); + } + this.writer.write(String.format("%5d %s%n", frame, Integer.toHexString(this.hostMemCRC.get()))); + } + } catch (CudaException | IOException e) { + e.printStackTrace(); + } + } + + @Override + public void dispose() { + try { + CudaUtil.checkCudaApiCall(cuCtxPushCurrent(this.device)); + + CudaUtil.checkCudaApiCall(cuMemFreeHost(this.hostMemEncOp)); + + CudaUtil.checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException e) { + e.printStackTrace(); + } + + if (this.useCRC) { + try { + this.writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvCUStream.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvCUStream.java new file mode 100644 index 00000000000..834ee90cce5 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvCUStream.java @@ -0,0 +1,80 @@ +package org.bytedeco.nvcodec.samples.encoder; + +import org.bytedeco.nvcodec.samples.dispose.Disposable; +import org.bytedeco.nvcodec.samples.exceptions.CudaException; +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.cuda.cudart.CUstream_st; +import org.bytedeco.javacpp.PointerPointer; +import org.bytedeco.nvcodec.nvencodeapi.NV_ENC_CUSTREAM_PTR; + +import static org.bytedeco.nvcodec.samples.util.CudaUtil.checkCudaApiCall; +import static org.bytedeco.cuda.global.cudart.*; + +public class NvCUStream implements Disposable { + private CUctx_st device; + private CUstream_st inputStream; + private CUstream_st outputStream; + + public CUstream_st getInputStream() { + return inputStream; + } + + public CUstream_st getOutputStream() { + return outputStream; + } + + public NvCUStream(CUctx_st device, int cuStreamType, NvEncoderOutputInVidMemCuda encoder) { + this.device = device; + + this.inputStream = new CUstream_st(); + this.outputStream = new CUstream_st(); + + try { + checkCudaApiCall(cuCtxPushCurrent(this.device)); + + // Create CUDA streams + if (cuStreamType == 1) { + checkCudaApiCall(cuStreamCreate(this.inputStream, CU_STREAM_DEFAULT)); + + this.outputStream = new CUstream_st(this.inputStream); + } else if (cuStreamType == 2) { + checkCudaApiCall(cuStreamCreate(this.inputStream, CU_STREAM_DEFAULT)); + checkCudaApiCall(cuStreamCreate(this.outputStream, CU_STREAM_DEFAULT)); + } + + checkCudaApiCall(cuCtxPopCurrent(null)); + + PointerPointer pi = new PointerPointer<>(1); + pi.put(this.inputStream); + + PointerPointer po = new PointerPointer<>(1); + po.put(this.outputStream); + + encoder.setIOCudaStreams(new NV_ENC_CUSTREAM_PTR(pi), new NV_ENC_CUSTREAM_PTR(po)); + } catch (CudaException e) { + e.printStackTrace(); + } + } + + @Override + public void dispose() { + try { + checkCudaApiCall(cuCtxPushCurrent(device)); + + if (this.inputStream.address() == this.outputStream.address()) { + if (this.inputStream != null) + checkCudaApiCall(cuStreamDestroy(this.inputStream)); + } else { + if (this.inputStream != null) + checkCudaApiCall(cuStreamDestroy(this.inputStream)); + + if (this.outputStream != null) + checkCudaApiCall(cuStreamDestroy(this.outputStream)); + } + + checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException e) { + e.printStackTrace(); + } + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoder.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoder.java new file mode 100644 index 00000000000..ee6156b1e48 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoder.java @@ -0,0 +1,1239 @@ +package org.bytedeco.nvcodec.samples.encoder; + +import org.bytedeco.nvcodec.samples.dispose.Disposable; +import org.bytedeco.nvcodec.samples.exceptions.NvCodecException; +import org.bytedeco.nvcodec.samples.util.VectorEx; +import org.bytedeco.javacpp.BytePointer; +import org.bytedeco.javacpp.IntPointer; +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.PointerPointer; +import org.bytedeco.nvcodec.nvencodeapi.*; + +import java.util.Vector; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; +import static org.bytedeco.nvcodec.samples.util.NvCodecUtil.*; +import static org.bytedeco.javacpp.Pointer.*; + +public abstract class NvEncoder implements Disposable { + private int width; + private int height; + private int bufferFormat; + private Pointer device; + private int deviceType; + private NV_ENC_INITIALIZE_PARAMS initializeParams; + private NV_ENC_CONFIG encodeConfig; + private boolean encoderInitialized; + private int extraOutputDelay; // To ensure encode and graphics can work in parallel, m_nExtraOutputDelay should be set to at least 1 + private VectorEx bitstreamOutputBuffer; + private VectorEx mvDataOutputBuffer; + private int maxEncodeWidth; + private int maxEncodedHeight; + + protected int toSend; + protected int got; + protected int encoderBuffer; + protected int outputDelay; + + protected boolean motionEstimationOnly; + protected boolean outputInVideoMemory; + protected Pointer encoder; + protected NV_ENCODE_API_FUNCTION_LIST nvEncodeApiFunctionList; + protected VectorEx inputFrames; + protected VectorEx registeredResources; + protected VectorEx referenceFrames; + protected VectorEx registeredResourcesForReference; + protected VectorEx mappedInputBuffers; + protected VectorEx mappedRefBuffers; + protected VectorEx completionEventPointers; + + /** + * @brief This a static function to get chroma offsets for YUV planar formats. + */ + public static void getChromaSubPlaneOffsets(final int bufferFormat, final int pitch, final int height, Vector chromaOffsets) { + chromaOffsets.clear(); + switch (bufferFormat) { + case NV_ENC_BUFFER_FORMAT_NV12: + case NV_ENC_BUFFER_FORMAT_YUV420_10BIT: { + chromaOffsets.add(pitch * height); + break; + } + case NV_ENC_BUFFER_FORMAT_YV12: + case NV_ENC_BUFFER_FORMAT_IYUV: { + chromaOffsets.add(pitch * height); + chromaOffsets.add(chromaOffsets.get(0) + (getChromaPitch(bufferFormat, pitch) * getChromaHeight(bufferFormat, height))); + break; + } + case NV_ENC_BUFFER_FORMAT_YUV444: + case NV_ENC_BUFFER_FORMAT_YUV444_10BIT: { + chromaOffsets.add(pitch * height); + chromaOffsets.add(chromaOffsets.get(0) + (pitch * height)); + break; + } + case NV_ENC_BUFFER_FORMAT_ARGB: + case NV_ENC_BUFFER_FORMAT_ARGB10: + case NV_ENC_BUFFER_FORMAT_AYUV: + case NV_ENC_BUFFER_FORMAT_ABGR: + case NV_ENC_BUFFER_FORMAT_ABGR10: { + break; + } + default: { + System.err.println("Invalid Buffer format"); + break; + } + } + + } + + /** + * @brief This a static function to get the chroma plane pitch for YUV planar formats. + */ + public static int getChromaPitch(final int bufferFormat, final int lumaPitch) { + switch (bufferFormat) { + case NV_ENC_BUFFER_FORMAT_NV12: + case NV_ENC_BUFFER_FORMAT_YUV420_10BIT: + case NV_ENC_BUFFER_FORMAT_YUV444: + case NV_ENC_BUFFER_FORMAT_YUV444_10BIT: { + return lumaPitch; + } + case NV_ENC_BUFFER_FORMAT_YV12: + case NV_ENC_BUFFER_FORMAT_IYUV: { + return (lumaPitch + 1) / 2; + } + case NV_ENC_BUFFER_FORMAT_ARGB: + case NV_ENC_BUFFER_FORMAT_ARGB10: + case NV_ENC_BUFFER_FORMAT_AYUV: + case NV_ENC_BUFFER_FORMAT_ABGR: + case NV_ENC_BUFFER_FORMAT_ABGR10: { + return 0; + } + default: { + System.err.println("Invalid Buffer format"); + return -1; + } + } + } + + /** + * @brief This a static function to get the number of chroma planes for YUV planar formats. + */ + public static int getNumChromaPlanes(final int bufferFormat) { + switch (bufferFormat) { + case NV_ENC_BUFFER_FORMAT_NV12: + case NV_ENC_BUFFER_FORMAT_YUV420_10BIT: { + return 1; + } + case NV_ENC_BUFFER_FORMAT_YV12: + case NV_ENC_BUFFER_FORMAT_IYUV: + case NV_ENC_BUFFER_FORMAT_YUV444: + case NV_ENC_BUFFER_FORMAT_YUV444_10BIT: { + return 2; + } + case NV_ENC_BUFFER_FORMAT_ARGB: + case NV_ENC_BUFFER_FORMAT_ARGB10: + case NV_ENC_BUFFER_FORMAT_AYUV: + case NV_ENC_BUFFER_FORMAT_ABGR: + case NV_ENC_BUFFER_FORMAT_ABGR10: { + return 0; + } + default: { + System.err.println("Invalid Buffer format"); + return -1; + } + } + } + + /** + * @brief This a static function to get the chroma plane width in bytes for YUV planar formats. + */ + public static int getChromaWidthInBytes(final int bufferFormat, final int lumaWidth) { + switch (bufferFormat) { + case NV_ENC_BUFFER_FORMAT_YV12: + case NV_ENC_BUFFER_FORMAT_IYUV: { + return (lumaWidth + 1) / 2; + } + case NV_ENC_BUFFER_FORMAT_NV12: + case NV_ENC_BUFFER_FORMAT_YUV444: { + return lumaWidth; + } + case NV_ENC_BUFFER_FORMAT_YUV420_10BIT: + case NV_ENC_BUFFER_FORMAT_YUV444_10BIT: { + return lumaWidth * 2; + } + case NV_ENC_BUFFER_FORMAT_ARGB: + case NV_ENC_BUFFER_FORMAT_ARGB10: + case NV_ENC_BUFFER_FORMAT_AYUV: + case NV_ENC_BUFFER_FORMAT_ABGR: + case NV_ENC_BUFFER_FORMAT_ABGR10: { + return 0; + } + default: { + System.err.println("Invalid Buffer format"); + return 0; + } + } + } + + /** + * @brief This a static function to get the chroma planes height in bytes for YUV planar formats. + */ + public static int getChromaHeight(final int bufferFormat, final int lumaHeight) { + switch (bufferFormat) { + case NV_ENC_BUFFER_FORMAT_YV12: + case NV_ENC_BUFFER_FORMAT_IYUV: + case NV_ENC_BUFFER_FORMAT_NV12: + case NV_ENC_BUFFER_FORMAT_YUV420_10BIT: { + return (lumaHeight + 1) / 2; + } + case NV_ENC_BUFFER_FORMAT_YUV444: + case NV_ENC_BUFFER_FORMAT_YUV444_10BIT: { + return lumaHeight; + } + case NV_ENC_BUFFER_FORMAT_ARGB: + case NV_ENC_BUFFER_FORMAT_ARGB10: + case NV_ENC_BUFFER_FORMAT_AYUV: + case NV_ENC_BUFFER_FORMAT_ABGR: + case NV_ENC_BUFFER_FORMAT_ABGR10: { + return 0; + } + default: { + System.err.println("Invalid Buffer format"); + return 0; + } + } + } + + /** + * @brief This a static function to get the width in bytes for the frame. + * For YUV planar format this is the width in bytes of the luma plane. + */ + public static int getWidthInBytes(final int bufferFormat, final int width) { + switch (bufferFormat) { + case NV_ENC_BUFFER_FORMAT_NV12: + case NV_ENC_BUFFER_FORMAT_YV12: + case NV_ENC_BUFFER_FORMAT_IYUV: + case NV_ENC_BUFFER_FORMAT_YUV444: { + return width; + } + case NV_ENC_BUFFER_FORMAT_YUV420_10BIT: + case NV_ENC_BUFFER_FORMAT_YUV444_10BIT: { + return width * 2; + } + case NV_ENC_BUFFER_FORMAT_ARGB: + case NV_ENC_BUFFER_FORMAT_ARGB10: + case NV_ENC_BUFFER_FORMAT_AYUV: + case NV_ENC_BUFFER_FORMAT_ABGR: + case NV_ENC_BUFFER_FORMAT_ABGR10: { + return width * 4; + } + default: { + System.err.println("Invalid Buffer format"); + return 0; + } + } + } + + /** + * @brief This function is used to get the current device on which encoder is running. + */ + public Pointer getDevice() { + return this.device; + } + + /** + * @brief This function is used to get the current device type which encoder is running. + */ + public int getDeviceType() { + return deviceType; + } + + /** + * @brief This function is used to get the current encode width. + * The encode width can be modified by Reconfigure() function. + */ + public int getEncodeWidth() { + return this.width; + } + + /** + * @brief This function is used to get the current encode height. + * The encode height can be modified by Reconfigure() function. + */ + public int getEncodeHeight() { + return this.height; + } + + /** + * @brief This is a private function which is used to check if there is any + * buffering done by encoder. + * The encoder generally buffers data to encode B frames or for lookahead + * or pipelining. + */ + private boolean isZeroDelay() { + return this.outputDelay == 0; + } + + /** + * @brief This function is used to check if hardware encoder is properly initialized. + */ + protected boolean isHWEncoderInitialized() { + return (this.encoder != null && !this.encoder.isNull()) && this.encoderInitialized; + } + + /** + * @brief This function returns the number of allocated buffers. + */ + public int getEncoderBufferCount() { + return this.encoderBuffer; + } + + /** + * @brief This function returns maximum width used to open the encoder session. + * All encode input buffers are allocated using maximum dimensions. + */ + protected int getMaxEncodeWidth() { + return this.maxEncodeWidth; + } + + /** + * @brief This function returns maximum height used to open the encoder session. + * All encode input buffers are allocated using maximum dimensions. + */ + protected int getMaxEncodedHeight() { + return maxEncodedHeight; + } + + /** + * @brief This function returns the completion event. + */ + protected Pointer getCompletionEventPointer(int eventIndex) { + return (this.completionEventPointers.size() == this.encoderBuffer) ? this.completionEventPointers.get(eventIndex) : null; + } + + /** + * @brief This function returns the current pixel format. + */ + protected int getPixelFormat() { + return this.bufferFormat; + } + + public NV_ENCODE_API_FUNCTION_LIST getNvEncodeApiFunctionList() { + return nvEncodeApiFunctionList; + } + + public NvEncoder(int deviceType, Pointer devicePointer, int width, int height, int bufferFormat, int outputDelay, boolean motionEstimationOnly) { + this(deviceType, devicePointer, width, height, bufferFormat, outputDelay, motionEstimationOnly, false); + } + + public NvEncoder(int deviceType, Pointer devicePointer, int width, int height, int bufferFormat, int outputDelay, boolean motionEstimationOnly, boolean outputInVideoMemory) { + this.device = devicePointer; + this.deviceType = deviceType; + this.width = width; + this.height = height; + this.maxEncodeWidth = width; + this.maxEncodedHeight = height; + this.bufferFormat = bufferFormat; + this.motionEstimationOnly = motionEstimationOnly; + this.outputInVideoMemory = outputInVideoMemory; + this.extraOutputDelay = outputDelay; + this.encoder = null; + this.encodeConfig = new NV_ENC_CONFIG(); + this.initializeParams = new NV_ENC_INITIALIZE_PARAMS(); + + this.referenceFrames = new VectorEx<>(); + this.inputFrames = new VectorEx<>(); + this.registeredResources = new VectorEx<>(); + this.registeredResourcesForReference = new VectorEx<>(); + this.mappedInputBuffers = new VectorEx<>(); + this.mappedRefBuffers = new VectorEx<>(); + this.completionEventPointers = new VectorEx<>(); + + this.bitstreamOutputBuffer = new VectorEx<>(); + this.mvDataOutputBuffer = new VectorEx<>(); + this.loadNvEncAPI(); + + if (this.nvEncodeApiFunctionList.nvEncOpenEncodeSessionEx() == null || this.nvEncodeApiFunctionList.nvEncOpenEncodeSessionEx().isNull()) { + this.encoderBuffer = 0; + System.err.println("EncodeAPI not found"); + } + + NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS encodeSessionExParams = new NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS(); + encodeSessionExParams.version(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER); + encodeSessionExParams.device(this.device); + encodeSessionExParams.deviceType(this.deviceType); + encodeSessionExParams.apiVersion(NVENCAPI_VERSION); + + + PointerPointer encoderPointer = new PointerPointer(1); + + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncOpenEncodeSessionEx().call(encodeSessionExParams, encoderPointer)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + this.encoder = encoderPointer.get(); + } + + /** + * @brief This is a private function which is used to load the encode api shared library. + */ + private void loadNvEncAPI() { + IntPointer version = new IntPointer(1); + int currentVersion = (NVENCAPI_MAJOR_VERSION << 4) | NVENCAPI_MINOR_VERSION; + + try { + checkNvCodecApiCall(NvEncodeAPIGetMaxSupportedVersion(version)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + if (currentVersion > version.get()) { + System.err.println("Current Driver Version does not support this NvEncodeAPI version, please upgrade driver"); + } + + this.nvEncodeApiFunctionList = new NV_ENCODE_API_FUNCTION_LIST(); + this.nvEncodeApiFunctionList.version(NV_ENCODE_API_FUNCTION_LIST_VER); + + try { + checkNvCodecApiCall(NvEncodeAPICreateInstance(this.nvEncodeApiFunctionList)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + } + + + public void createDefaultEncoderParams(NV_ENC_INITIALIZE_PARAMS initializeParams, GUID codecGuid, GUID presetGuid) { + this.createDefaultEncoderParams(initializeParams, codecGuid, presetGuid, NV_ENC_TUNING_INFO_UNDEFINED); + } + + /** + * @brief This function is used to initialize config parameters based on + * given codec and preset guids. + * The application can call this function to get the default configuration + * for a certain preset. The application can either use these parameters + * directly or override them with application-specific settings before + * using them in CreateEncoder() function. + */ + public void createDefaultEncoderParams(NV_ENC_INITIALIZE_PARAMS initializeParams, GUID codecGuid, GUID presetGuid, int tuningInfo) { + if (this.encoder == null || this.encoder.isNull()) { + System.err.println("Encoder Initialization failed"); + return; + } + NV_ENC_CONFIG configPointer = initializeParams.encodeConfig(); + if ((initializeParams == null || initializeParams.isNull()) || (configPointer == null || configPointer.isNull())) { + System.err.println("initializeParams and initializeParams->encodeConfig can't be NULL"); + } + + memset(configPointer, 0, Pointer.sizeof(NV_ENC_CONFIG.class)); + memset(initializeParams, 0, Pointer.sizeof(NV_ENC_INITIALIZE_PARAMS.class)); + + configPointer.version(NV_ENC_CONFIG_VER); + + initializeParams.encodeConfig(configPointer); + initializeParams.version(NV_ENC_INITIALIZE_PARAMS_VER); + + initializeParams.encodeGUID(codecGuid); + initializeParams.presetGUID(presetGuid); + initializeParams.encodeWidth(this.width); + initializeParams.encodeHeight(this.height); + initializeParams.darWidth(this.width); + initializeParams.darHeight(this.height); + initializeParams.frameRateNum(30); + initializeParams.frameRateDen(1); + initializeParams.enablePTD(1); + initializeParams.reportSliceOffsets(0); + initializeParams.enableSubFrameWrite(0); + initializeParams.maxEncodeWidth(this.width); + initializeParams.maxEncodeHeight(this.height); + initializeParams.enableMEOnlyMode(this.motionEstimationOnly ? 1 : 0); + initializeParams.enableOutputInVidmem(this.outputInVideoMemory ? 1 : 0); + + NV_ENC_PRESET_CONFIG presetConfig = new NV_ENC_PRESET_CONFIG(); + presetConfig.version(NV_ENC_PRESET_CONFIG_VER); + presetConfig.presetCfg(new NV_ENC_CONFIG() {{ + version(NV_ENC_CONFIG_VER); + }}); + + this.nvEncodeApiFunctionList.nvEncGetEncodePresetConfig().call(this.encoder, codecGuid, presetGuid, presetConfig); + + memcpy(configPointer, presetConfig.presetCfg(), Pointer.sizeof(NV_ENC_CONFIG.class)); + + initializeParams.encodeConfig().frameIntervalP(1); + initializeParams.encodeConfig().gopLength(NVENC_INFINITE_GOPLENGTH); + + initializeParams.encodeConfig().rcParams().rateControlMode(NV_ENC_PARAMS_RC_CONSTQP); + + if (!this.motionEstimationOnly) { + initializeParams.tuningInfo(tuningInfo); + + NV_ENC_PRESET_CONFIG presetConfig2 = new NV_ENC_PRESET_CONFIG(); + presetConfig2.version(NV_ENC_PRESET_CONFIG_VER); + presetConfig2.presetCfg(new NV_ENC_CONFIG() {{ + version(NV_ENC_CONFIG_VER); + }}); + + this.nvEncodeApiFunctionList.nvEncGetEncodePresetConfigEx().call(this.encoder, codecGuid, presetGuid, tuningInfo, presetConfig2); + + memcpy(configPointer, presetConfig2.presetCfg(), Pointer.sizeof(NV_ENC_CONFIG.class)); + } else { + this.encodeConfig.version(NV_ENC_CONFIG_VER); + this.encodeConfig.rcParams().rateControlMode(NV_ENC_PARAMS_RC_CONSTQP); + + NV_ENC_QP constQP = new NV_ENC_QP(); + constQP.qpInterP(28); + constQP.qpInterB(31); + constQP.qpIntra(25); + + this.encodeConfig.rcParams().constQP(constQP); + } + + if (initializeParams.encodeGUID().Data1() == NV_ENC_CODEC_H264_GUID().Data1()) { + if (this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV444 || this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT) { + initializeParams.encodeConfig().encodeCodecConfig().h264Config().chromaFormatIDC(3); + } + initializeParams.encodeConfig().encodeCodecConfig().h264Config().idrPeriod(initializeParams.encodeConfig().gopLength()); + } else if (initializeParams.encodeGUID().Data1() == NV_ENC_CODEC_HEVC_GUID().Data1()) { + initializeParams.encodeConfig().encodeCodecConfig().hevcConfig().pixelBitDepthMinus8((this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV420_10BIT || this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT) ? 2 : 0); + + if (bufferFormat == NV_ENC_BUFFER_FORMAT_YUV444 || this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT) { + initializeParams.encodeConfig().encodeCodecConfig().hevcConfig().chromaFormatIDC(3); + } + + initializeParams.encodeConfig().encodeCodecConfig().hevcConfig().idrPeriod(initializeParams.encodeConfig().gopLength()); + } + } + + /** + * @brief This function is used to initialize the encoder session. + * Application must call this function to initialize the encoder, before + * starting to encode any frames. + */ + public void createEncoder(final NV_ENC_INITIALIZE_PARAMS encoderParams) { + if (this.encoder == null || this.encoder.isNull()) { + System.err.println("Encoder Initialization failed"); + } + + if (encoderParams == null || encoderParams.isNull()) { + System.err.println("Invalid NV_ENC_INITIALIZE_PARAMS ptr"); + } + + if (encoderParams.encodeWidth() == 0 || encoderParams.encodeHeight() == 0) { + System.err.println("Invalid encoder width and height"); + } + + if (!compareGUID(encoderParams.encodeGUID(), NV_ENC_CODEC_H264_GUID()) && !compareGUID(encoderParams.encodeGUID(), NV_ENC_CODEC_HEVC_GUID())) { + System.err.println("Invalid codec guid"); + } + + // set other necessary params if not set yet + if (compareGUID(encoderParams.encodeGUID(), NV_ENC_CODEC_H264_GUID())) { + if (this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV420_10BIT || this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT) { + System.err.println("10-bit format isn't supported by H264 encoder"); + } + } + + if (compareGUID(encoderParams.encodeGUID(), NV_ENC_CODEC_HEVC_GUID())) { + boolean yuv10BitFormat = (this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV420_10BIT || this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT); + if (yuv10BitFormat && encoderParams.encodeConfig().encodeCodecConfig().hevcConfig().pixelBitDepthMinus8() != 2) { + System.err.println("Invalid PixelBitdepth"); + } + + if ((this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV444 || this.bufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT) && (encoderParams.encodeConfig().encodeCodecConfig().hevcConfig().chromaFormatIDC() != 3)) { + System.err.println("Invalid ChromaFormatIDC"); + } + } + + memcpy(this.initializeParams, encoderParams, this.initializeParams.sizeof()); + + + this.initializeParams.version(NV_ENC_INITIALIZE_PARAMS_VER); + + if (encoderParams.encodeConfig() != null && !encoderParams.encodeConfig().isNull()) { + memcpy(this.encodeConfig, encoderParams.encodeConfig(), this.encodeConfig.sizeof()); + this.encodeConfig.version(NV_ENC_CONFIG_VER); + } else { + NV_ENC_PRESET_CONFIG presetConfig = new NV_ENC_PRESET_CONFIG(); + presetConfig.version(NV_ENC_PRESET_CONFIG_VER); + presetConfig.presetCfg(new NV_ENC_CONFIG() { + { + version(NV_ENC_CONFIG_VER); + } + }); + + if (!this.motionEstimationOnly) { + this.nvEncodeApiFunctionList.nvEncGetEncodePresetConfigEx().call(this.encoder, encoderParams.encodeGUID(), encoderParams.presetGUID(), encoderParams.tuningInfo(), presetConfig); + memcpy(this.encodeConfig, presetConfig.presetCfg(), this.encodeConfig.sizeof()); + } else { + this.encodeConfig.version(NV_ENC_CONFIG_VER); + this.encodeConfig.rcParams().rateControlMode(NV_ENC_PARAMS_RC_CONSTQP); + this.encodeConfig.rcParams().constQP(new NV_ENC_QP() { + { + qpInterP(28); + qpInterB(31); + qpIntra(25); + } + }); + } + } + + this.initializeParams.encodeConfig(this.encodeConfig); + + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncInitializeEncoder().call(this.encoder, this.initializeParams)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + this.encoderInitialized = true; + this.width = this.initializeParams.encodeWidth(); + this.height = this.initializeParams.encodeHeight(); + this.maxEncodeWidth = this.initializeParams.maxEncodeWidth(); + this.maxEncodedHeight = this.initializeParams.maxEncodeHeight(); + + this.encoderBuffer = this.encodeConfig.frameIntervalP() + this.encodeConfig.rcParams().lookaheadDepth() + this.extraOutputDelay; + this.outputDelay = this.encoderBuffer - 1; + + this.mappedInputBuffers.resize(this.encoderBuffer, null); + + if (!this.outputInVideoMemory) { + this.completionEventPointers.resize(this.encoderBuffer, null); + } + + if (this.motionEstimationOnly) { + this.mappedRefBuffers.resize(this.encoderBuffer, null); + + if (!this.outputInVideoMemory) { + this.initializeMVOutputBuffer(); + } + } else { + if (!this.outputInVideoMemory) { + this.bitstreamOutputBuffer.resize(this.encoderBuffer, null); + this.initializeBitstreamBuffer(); + } + } + + this.allocateInputBuffers(this.encoderBuffer); + } + + + /** + * @brief This function is used to destroy the encoder session. + * Application must call this function to destroy the encoder session and + * clean up any allocated resources. The application must call EndEncode() + * function to get any queued encoded frames before calling DestroyEncoder(). + */ + public void destroyEncoder() { + if (this.encoder != null && !this.encoder.isNull()) { + this.releaseInputBuffers(); + this.destroyHWEncoder(); + } + } + + /** + * @brief This is a private function which is used to destroy HW encoder. + */ + private void destroyHWEncoder() { + if (this.encoder != null && !this.encoder.isNull()) { + if (this.motionEstimationOnly) { + this.destroyMVOutputBuffer(); + } else { + this.destroyBitstreamBuffer(); + } + this.nvEncodeApiFunctionList.nvEncDestroyEncoder().call(this.encoder); + + this.encoder = null; + this.encoderInitialized = false; + } + } + + /** + * @brief This function is used to get the next available input buffer. + * Applications must call this function to obtain a pointer to the next + * input buffer. The application must copy the uncompressed data to the + * input buffer and then call EncodeFrame() function to encode it. + */ + public NvEncoderInputFrame getNextInputFrame() { + int index = this.toSend % this.encoderBuffer; + return this.inputFrames.get(index); + } + + /** + * @brief This function is used to get an available reference frame. + * Application must call this function to get a pointer to reference buffer, + * to be used in the subsequent RunMotionEstimation() function. + */ + public NvEncoderInputFrame getNextReferenceFrame() { + int index = this.toSend % this.encoderBuffer; + return this.referenceFrames.get(index); + } + + /** + * @brief This function is used to map the input buffers to NvEncodeAPI. + */ + protected void mapResources(int index) { + NV_ENC_MAP_INPUT_RESOURCE mapInputResource = new NV_ENC_MAP_INPUT_RESOURCE(); + mapInputResource.version(NV_ENC_MAP_INPUT_RESOURCE_VER); + + mapInputResource.registeredResource(this.registeredResources.get(index)); + + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncMapInputResource().call(this.encoder, mapInputResource)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + this.mappedInputBuffers.set(index, mapInputResource.mappedResource()); + + if (this.motionEstimationOnly) { + mapInputResource.registeredResource(this.registeredResourcesForReference.get(index)); + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncMapInputResource().call(this.encoder, mapInputResource)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + this.mappedRefBuffers.set(index, mapInputResource.mappedResource()); + } + } + + public void encodeFrame(Vector> packet) { + this.encodeFrame(packet, null); + } + + /** + * @brief This function is used to encode a frame. + * Applications must call EncodeFrame() function to encode the uncompressed + * data, which has been copied to an input buffer obtained from the + * GetNextInputFrame() function. + */ + public void encodeFrame(Vector> packet, NV_ENC_PIC_PARAMS picParams) { + packet.clear(); + if (!this.isHWEncoderInitialized()) { + System.err.println("Encoder device not found"); + } + int index = this.toSend % this.encoderBuffer; + + this.mapResources(index); + + int nvStatus = this.doEncode(this.mappedInputBuffers.get(index), this.bitstreamOutputBuffer.get(index), picParams); + if (nvStatus == NV_ENC_SUCCESS || nvStatus == NV_ENC_ERR_NEED_MORE_INPUT) { + this.toSend++; + this.getEncodedPacket(this.bitstreamOutputBuffer, packet, true); + } else { + System.err.println("nvEncEncodePicture API failed"); + } + } + + /** + * @brief This function is used to run motion estimation + * This is used to run motion estimation on a a pair of frames. The + * application must copy the reference frame data to the buffer obtained + * by calling GetNextReferenceFrame(), and copy the input frame data to + * the buffer obtained by calling GetNextInputFrame() before calling the + * RunMotionEstimation() function. + */ + public void runMotionEstimation(Vector mvData) { + if (this.encoder != null && !this.encoder.isNull()) { + final int index = this.toSend % this.encoderBuffer; + + this.mapResources(index); + + int nvStatus = this.doMotionEstimation(this.mappedInputBuffers.get(index), this.mappedRefBuffers.get(index), this.mvDataOutputBuffer.get(index)); + + if (nvStatus == NV_ENC_SUCCESS) { + this.toSend++; + + Vector> packet = new Vector<>(); + + this.getEncodedPacket(this.mvDataOutputBuffer, packet, true); + + if (packet.size() != 1) { + System.err.println("GetEncodedPacket() doesn't return one (and only one) MVData"); + } + + mvData = packet.get(0); + } else { + System.err.println("nvEncEncodePicture API failed"); + } + } else { + System.err.println("Encoder Initialization failed"); + } + } + + /** + * @brief This function is used to get sequence and picture parameter headers. + * Application can call this function after encoder is initialized to get SPS and PPS + * nalus for the current encoder instance. The sequence header data might change when + * application calls Reconfigure() function. + */ + public void getSequenceParams(Vector seqParams) { + byte[] data = new byte[1024]; // Assume maximum spspps data is 1KB or less + BytePointer spsppsData = new BytePointer(data); + + memset(spsppsData, 0, data.length); + + NV_ENC_SEQUENCE_PARAM_PAYLOAD payload = new NV_ENC_SEQUENCE_PARAM_PAYLOAD(); + payload.version(NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER); + IntPointer spsppsSize = new IntPointer(); + + payload.spsppsBuffer(spsppsData); + payload.inBufferSize(spsppsData.sizeof()); + payload.outSPSPPSPayloadSize(spsppsSize); + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncGetSequenceParams().call(this.encoder, payload)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + spsppsData.asBuffer().get(data); + seqParams.clear(); + + for (int index = 0; index < data.length; index++) { + seqParams.add(data[index]); + } + } + + /** + * @brief This function is used to submit the encode commands to the + * NVENC hardware. + */ + protected int doEncode(NV_ENC_INPUT_PTR inputBuffer, NV_ENC_OUTPUT_PTR outputBuffer, NV_ENC_PIC_PARAMS picParams) { + if (picParams == null || picParams.isNull()) { + picParams = new NV_ENC_PIC_PARAMS(); + } + + picParams.version(NV_ENC_PIC_PARAMS_VER); + picParams.pictureStruct(NV_ENC_PIC_STRUCT_FRAME); + picParams.inputBuffer(inputBuffer); + picParams.bufferFmt(this.getPixelFormat()); + picParams.inputWidth(this.getEncodeWidth()); + picParams.inputHeight(this.getEncodeHeight()); + picParams.outputBitstream(outputBuffer); + picParams.completionEvent(this.getCompletionEventPointer(this.toSend % this.encoderBuffer)); + + return this.nvEncodeApiFunctionList.nvEncEncodePicture().call(this.encoder, picParams); + } + + /** + * @brief This function is used to send EOS to HW encoder. + */ + protected void sendEOS() { + NV_ENC_PIC_PARAMS picParams = new NV_ENC_PIC_PARAMS(); + picParams.version(NV_ENC_PIC_PARAMS_VER); + picParams.encodePicFlags(NV_ENC_PIC_FLAG_EOS); + picParams.completionEvent(this.getCompletionEventPointer(this.toSend % this.encoderBuffer)); + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncEncodePicture().call(this.encoder, picParams)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + } + + /** + * @brief This function to flush the encoder queue. + * The encoder might be queuing frames for B picture encoding or lookahead; + * the application must call EndEncode() to get all the queued encoded frames + * from the encoder. The application must call this function before destroying + * an encoder session. + */ + public void endEncode(Vector> packet) { + packet.clear(); + + if (!this.isHWEncoderInitialized()) { + System.err.println("Encoder device not initialized"); + } + + this.sendEOS(); + this.getEncodedPacket(this.bitstreamOutputBuffer, packet, false); + } + + /** + * @brief This is a private function which is used to get the output packets + * from the encoder HW. + * This is called by DoEncode() function. If there is buffering enabled, + * this may return without any output data. + */ + private void getEncodedPacket(Vector outputBuffer, Vector> packet, boolean outputDelay) { + long index = 0; + + int end = outputDelay ? this.toSend - this.outputDelay : this.toSend; + for (; this.got < end; this.got++) { + this.waitForCompletionEvent(this.got % this.encoderBuffer); + NV_ENC_LOCK_BITSTREAM lockBitstreamData = new NV_ENC_LOCK_BITSTREAM(); + lockBitstreamData.version(NV_ENC_LOCK_BITSTREAM_VER); + lockBitstreamData.outputBitstream(outputBuffer.get(this.got % this.encoderBuffer)); + lockBitstreamData.doNotWait(0); + + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncLockBitstream().call(this.encoder, lockBitstreamData)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + Pointer dataPointer = lockBitstreamData.bitstreamBufferPtr(); + if (packet.size() < index + 1) { + packet.add(new Vector()); + } + + Vector packetData = packet.get((int) index); + packetData.clear(); + + dataPointer.limit(lockBitstreamData.bitstreamSizeInBytes()); + byte[] data = new byte[lockBitstreamData.bitstreamSizeInBytes()]; + + dataPointer.asByteBuffer().get(data); + + for (byte value : data) { + packetData.add(value); + } + index++; + + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncUnlockBitstream().call(this.encoder, new NV_ENC_OUTPUT_PTR(lockBitstreamData.outputBitstream()))); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + + NV_ENC_INPUT_PTR inputPointer = this.mappedInputBuffers.get(this.got % this.encoderBuffer); + if (inputPointer != null && !inputPointer.isNull()) { + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncUnmapInputResource().call(this.encoder, inputPointer)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + this.mappedInputBuffers.set(this.got % this.encoderBuffer, null); + } + if (this.motionEstimationOnly) { + NV_ENC_INPUT_PTR refPointer = this.mappedRefBuffers.get(this.got % this.encoderBuffer); + if (refPointer != null && !refPointer.isNull()) { + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncUnmapInputResource().call(this.encoder, refPointer)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + this.mappedRefBuffers.set(this.got % this.encoderBuffer, null); + } + } + } + } + + /** + * @brief This function is used to reconfigure an existing encoder session. + * Application can use this function to dynamically change the bitrate, + * resolution and other QOS parameters. If the application changes the + * resolution, it must set NV_ENC_RECONFIGURE_PARAMS::forceIDR. + */ + public boolean reconfigure(final NV_ENC_RECONFIGURE_PARAMS reconfigureParams) { + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncReconfigureEncoder().call(this.encoder, reconfigureParams)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + memcpy(this.initializeParams, reconfigureParams.reInitEncodeParams(), this.initializeParams.sizeof()); + + + NV_ENC_CONFIG config = reconfigureParams.reInitEncodeParams().encodeConfig(); + if (config != null && !config.isNull()) { + memcpy(this.encodeConfig, config, this.encodeConfig.sizeof()); + } + + this.width = this.initializeParams.encodeWidth(); + this.height = this.initializeParams.encodeHeight(); + this.maxEncodeWidth = this.initializeParams.maxEncodeWidth(); + this.maxEncodedHeight = this.initializeParams.maxEncodeHeight(); + + return true; + } + + protected NV_ENC_REGISTERED_PTR registerResource(Pointer bufferPointer, int resourceType, int width, int height, int pitch, int bufferFormat) { + return this.registerResource(bufferPointer, resourceType, width, height, pitch, bufferFormat, NV_ENC_INPUT_IMAGE); + } + + /** + * @brief This function is used to register CUDA, D3D or OpenGL input or output buffers with NvEncodeAPI. + */ + protected NV_ENC_REGISTERED_PTR registerResource(Pointer bufferPointer, int resourceType, int width, int height, int pitch, int bufferFormat, int bufferUsage) { + NV_ENC_REGISTER_RESOURCE registerResource = new NV_ENC_REGISTER_RESOURCE(); + registerResource.version(NV_ENC_REGISTER_RESOURCE_VER); + registerResource.resourceType(resourceType); + registerResource.resourceToRegister(bufferPointer); + registerResource.width(width); + registerResource.height(height); + registerResource.pitch(pitch); + registerResource.bufferFormat(bufferFormat); + registerResource.bufferUsage(bufferUsage); + + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncRegisterResource().call(this.encoder, registerResource)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + return registerResource.registeredResource(); + } + + /** + * @brief This function is used to register CUDA, D3D or OpenGL input buffers with NvEncodeAPI. + * This is non public function and is called by derived class for allocating + * and registering input buffers. + */ + protected void registerInputResources(Vector inputFrames, int resourceType, int width, int height, int pitch, int bufferFormat, boolean referenceFrame) { + for (int index = 0; index < inputFrames.size(); ++index) { + NV_ENC_REGISTERED_PTR registeredPtr = this.registerResource(inputFrames.get(index), resourceType, width, height, pitch, bufferFormat, NV_ENC_INPUT_IMAGE); + + Vector chromaOffsets = new Vector<>(); + getChromaSubPlaneOffsets(bufferFormat, pitch, height, chromaOffsets); + + NvEncoderInputFrame inputFrame = new NvEncoderInputFrame(); + inputFrame.setInputPointer(inputFrames.get(index)); + inputFrame.setChromaOffsets(new int[]{0, 0}); + + for (int ch = 0; ch < chromaOffsets.size(); ch++) { + inputFrame.getChromaOffsets()[ch] = chromaOffsets.get(ch); + } + inputFrame.setNumChromaPlanes(getNumChromaPlanes(bufferFormat)); + inputFrame.setPitch(pitch); + inputFrame.setChromaPitch(getChromaPitch(bufferFormat, pitch)); + inputFrame.setBufferFormat(bufferFormat); + inputFrame.setResourceType(resourceType); + + if (referenceFrame) { + this.registeredResourcesForReference.add(registeredPtr); + this.referenceFrames.add(inputFrame); + } else { + this.registeredResources.add(registeredPtr); + this.inputFrames.add(inputFrame); + } + } + } + + /** + * @brief This function is used to flush the encoder queue. + */ + private void flushEncoder() { + if (!this.motionEstimationOnly && !this.outputInVideoMemory) { + // Incase of error it is possible for buffers still mapped to encoder. + // flush the encoder queue and then unmapped it if any surface is still mapped + try { + Vector> packet = new Vector<>(); + this.endEncode(packet); + } catch (Exception e) { + + } + } + } + + /** + * @brief This function is used to unregister resources which had been previously registered for encoding + * using RegisterInputResources() function. + */ + protected void unregisterInputResources() { + this.flushEncoder(); + + if (this.motionEstimationOnly) { + for (NV_ENC_INPUT_PTR refPointer : this.mappedRefBuffers) { + if (refPointer != null && !refPointer.isNull()) { + this.nvEncodeApiFunctionList.nvEncUnmapInputResource().call(this.encoder, refPointer); + } + } + } + this.mappedRefBuffers.clear(); + + for (NV_ENC_INPUT_PTR inputPointer : this.mappedInputBuffers) { + if (inputPointer != null && !inputPointer.isNull()) { + this.nvEncodeApiFunctionList.nvEncUnmapInputResource().call(this.encoder, inputPointer); + } + } + this.mappedInputBuffers.clear(); + + for (NV_ENC_REGISTERED_PTR registeredPointer : this.registeredResources) { + if (registeredPointer != null && !registeredPointer.isNull()) { + this.nvEncodeApiFunctionList.nvEncUnregisterResource().call(this.encoder, registeredPointer); + } + } + this.registeredResources.clear(); + + for (NV_ENC_REGISTERED_PTR registeredPointer : this.registeredResourcesForReference) { + if (registeredPointer != null && !registeredPointer.isNull()) { + this.nvEncodeApiFunctionList.nvEncUnregisterResource().call(this.encoder, registeredPointer); + } + } + this.registeredResourcesForReference.clear(); + } + + /** + * @brief This function is used to wait for completion of encode command. + */ + protected void waitForCompletionEvent(int event) { + //not support win32api + } + + /** + * @brief This function is used to query hardware encoder capabilities. + * Applications can call this function to query capabilities like maximum encode + * dimensions, support for lookahead or the ME-only mode etc. + */ + public int getCapabilityValue(GUID guidCodec, int capsToQuery) { + if (this.encoder != null && !this.encoder.isNull()) { + NV_ENC_CAPS_PARAM capsParam = new NV_ENC_CAPS_PARAM(); + capsParam.version(NV_ENC_CAPS_PARAM_VER); + capsParam.capsToQuery(capsToQuery); + + IntPointer value = new IntPointer(); + this.nvEncodeApiFunctionList.nvEncGetEncodeCaps().call(this.encoder, guidCodec, capsParam, value); + + return value.get(); + } + return 0; + } + + /** + * @brief This function is used to get the current frame size based on pixel format. + */ + public int getFrameSize() { + switch (this.getPixelFormat()) { + case NV_ENC_BUFFER_FORMAT_YV12: + case NV_ENC_BUFFER_FORMAT_IYUV: + case NV_ENC_BUFFER_FORMAT_NV12: { + return this.getEncodeWidth() * (this.getEncodeHeight() + (this.getEncodeHeight() + 1) / 2); + } + case NV_ENC_BUFFER_FORMAT_YUV420_10BIT: { + return 2 * this.getEncodeWidth() * (this.getEncodeHeight() + (this.getEncodeHeight() + 1) / 2); + } + case NV_ENC_BUFFER_FORMAT_YUV444: { + return this.getEncodeWidth() * this.getEncodeHeight() * 3; + } + case NV_ENC_BUFFER_FORMAT_YUV444_10BIT: { + return 2 * this.getEncodeWidth() * getEncodeHeight() * 3; + } + case NV_ENC_BUFFER_FORMAT_ARGB: + case NV_ENC_BUFFER_FORMAT_ARGB10: + case NV_ENC_BUFFER_FORMAT_AYUV: + case NV_ENC_BUFFER_FORMAT_ABGR: + case NV_ENC_BUFFER_FORMAT_ABGR10: { + return 4 * this.getEncodeWidth() * this.getEncodeHeight(); + } + default: { + System.err.println("Invalid Buffer format"); + return 0; + } + } + } + + /** + * @brief This function is used to get the current initialization parameters, + * which had been used to configure the encoder session. + * The initialization parameters are modified if the application calls + * Reconfigure() function. + */ + public void getInitializeParams(NV_ENC_INITIALIZE_PARAMS initializeParams) { + NV_ENC_CONFIG encodeConfig = initializeParams.encodeConfig(); + if ((initializeParams == null || initializeParams.isNull()) || (encodeConfig == null || encodeConfig.isNull())) { + System.err.println("Both pInitializeParams and pInitializeParams->encodeConfig can't be NULL"); + } + + initializeParams = this.initializeParams; + initializeParams.encodeConfig(this.encodeConfig); + } + + /** + * @brief This is a private function which is used to initialize the bitstream buffers. + * This is only used in the encoding mode. + */ + private void initializeBitstreamBuffer() { + for (int index = 0; index < this.encoderBuffer; index++) { + NV_ENC_CREATE_BITSTREAM_BUFFER createBitstreamBuffer = new NV_ENC_CREATE_BITSTREAM_BUFFER(); + createBitstreamBuffer.version(NV_ENC_CREATE_BITSTREAM_BUFFER_VER); + + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncCreateBitstreamBuffer().call(this.encoder, createBitstreamBuffer)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + this.bitstreamOutputBuffer.set(index, createBitstreamBuffer.bitstreamBuffer()); + } + } + + /** + * @brief This is a private function which is used to destroy the bitstream buffers. + * This is only used in the encoding mode. + */ + private void destroyBitstreamBuffer() { + for (int index = 0; index < this.bitstreamOutputBuffer.size(); index++) { + NV_ENC_OUTPUT_PTR pointer = this.bitstreamOutputBuffer.get(index); + if (pointer != null && !pointer.isNull()) { + this.nvEncodeApiFunctionList.nvEncDestroyBitstreamBuffer().call(this.encoder, pointer); + } + } + this.bitstreamOutputBuffer.clear(); + } + + /** + * @brief This is a private function which is used to initialize MV output buffers. + * This is only used in ME-only Mode. + */ + private void initializeMVOutputBuffer() { + for (int index = 0; index < this.encoderBuffer; index++) { + NV_ENC_CREATE_MV_BUFFER createMVBuffer = new NV_ENC_CREATE_MV_BUFFER(); + createMVBuffer.version(NV_ENC_CREATE_BITSTREAM_BUFFER_VER); + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncCreateMVBuffer().call(this.encoder, createMVBuffer)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + this.mvDataOutputBuffer.add(createMVBuffer.mvBuffer()); + } + } + + /** + * @brief This is a private function which is used to destroy MV output buffers. + * This is only used in ME-only Mode. + */ + private void destroyMVOutputBuffer() { + for (int index = 0; index < this.mvDataOutputBuffer.size(); index++) { + NV_ENC_OUTPUT_PTR pointer = this.mvDataOutputBuffer.get(index); + if (pointer != null && !pointer.isNull()) { + this.nvEncodeApiFunctionList.nvEncDestroyMVBuffer().call(this.encoder, pointer); + } + } + this.mvDataOutputBuffer.clear(); + } + + /** + * @brief This function is used to submit the encode commands to the + * NVENC hardware for ME only mode. + */ + protected int doMotionEstimation(NV_ENC_INPUT_PTR inputBuffer, NV_ENC_INPUT_PTR inputBufferForReference, NV_ENC_OUTPUT_PTR outputBuffer) { + NV_ENC_MEONLY_PARAMS meParams = new NV_ENC_MEONLY_PARAMS(); + meParams.version(NV_ENC_MEONLY_PARAMS_VER); + meParams.inputBuffer(inputBuffer); + meParams.referenceFrame(inputBufferForReference); + meParams.inputWidth(this.getEncodeWidth()); + meParams.inputHeight(this.getEncodeHeight()); + meParams.mvBuffer(outputBuffer); + meParams.completionEvent(this.getCompletionEventPointer(this.toSend % this.encoderBuffer)); + + return this.nvEncodeApiFunctionList.nvEncRunMotionEstimationOnly().call(this.encoder, meParams); + } + + /** + * @brief This is a pure virtual function which is used to allocate input buffers. + * The derived classes must implement this function. + */ + protected abstract void allocateInputBuffers(int numInputBuffers); + + /** + * @brief This is a pure virtual function which is used to destroy input buffers. + * The derived classes must implement this function. + */ + protected abstract void releaseInputBuffers(); + + @Override + public void dispose() { + this.destroyHWEncoder(); + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderCuda.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderCuda.java new file mode 100644 index 00000000000..35280bad145 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderCuda.java @@ -0,0 +1,323 @@ +package org.bytedeco.nvcodec.samples.encoder; + +import org.bytedeco.nvcodec.samples.util.NvCodecUtil; +import org.bytedeco.nvcodec.samples.exceptions.CudaException; +import org.bytedeco.nvcodec.samples.exceptions.NvCodecException; +import org.bytedeco.cuda.cudart.CUDA_MEMCPY2D; +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.cuda.cudart.CUstream_st; +import org.bytedeco.javacpp.LongPointer; +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.SizeTPointer; +import org.bytedeco.nvcodec.nvencodeapi.NV_ENC_CUSTREAM_PTR; + +import java.util.Vector; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.samples.util.CudaUtil.*; + +public class NvEncoderCuda extends NvEncoder { + private SizeTPointer cudaPitch; + protected CUctx_st cudaContext; + + /** + * @brief This is a static function to copy input data from host memory to device memory. + * This function assumes YUV plane is a single contiguous memory segment. + */ + public static void copyToDeviceFrame(CUctx_st device, Pointer srcFrame, int srcPitch, LongPointer dstFrame, int dstPitch, int width, int height, int srcMemoryType, int pixelFormat, final int[] dstChromaOffsets, int numChromaPlanes) { + copyToDeviceFrame(device, srcFrame, srcPitch, dstFrame, dstPitch, width, height, srcMemoryType, pixelFormat, dstChromaOffsets, numChromaPlanes, false, null); + } + + public static void copyToDeviceFrame(CUctx_st device, Pointer srcFrame, int srcPitch, LongPointer dstFrame, int dstPitch, int width, int height, int srcMemoryType, int pixelFormat, final int[] dstChromaOffsets, int numChromaPlanes, boolean unAlignedDeviceCopy, CUstream_st stream) { + if (srcMemoryType != CU_MEMORYTYPE_HOST && srcMemoryType != CU_MEMORYTYPE_DEVICE) { + System.err.println("Invalid source memory type for copy"); + } + + try { + checkCudaApiCall(cuCtxPushCurrent(device)); + } catch (CudaException e) { + e.printStackTrace(); + } + + srcPitch = srcPitch != 0 ? srcPitch : getWidthInBytes(pixelFormat, width); + + CUDA_MEMCPY2D mem = new CUDA_MEMCPY2D(); + mem.srcXInBytes(0); + mem.srcMemoryType(srcMemoryType); + if (srcMemoryType == CU_MEMORYTYPE_HOST) { + mem.srcHost(srcFrame); + } else { + mem.srcDevice(srcFrame.address()); + } + mem.srcPitch(srcPitch); + mem.dstMemoryType(CU_MEMORYTYPE_DEVICE); + mem.dstDevice(dstFrame.address()); + mem.dstPitch(dstPitch); + mem.WidthInBytes(getWidthInBytes(pixelFormat, width)); + mem.Height(height); + + if (unAlignedDeviceCopy && srcMemoryType == CU_MEMORYTYPE_DEVICE) { + try { + checkCudaApiCall(cuMemcpy2DUnaligned(mem)); + } catch (CudaException e) { + e.printStackTrace(); + } + } else { + try { + checkCudaApiCall(stream == null ? cuMemcpy2D(mem) : cuMemcpy2DAsync(mem, stream)); + } catch (CudaException e) { + e.printStackTrace(); + } + } + + Vector srcChromaOffsets = new Vector<>(); + getChromaSubPlaneOffsets(pixelFormat, srcPitch, height, srcChromaOffsets); + + int chromaHeight = getChromaHeight(pixelFormat, height); + int destChromaPitch = getChromaPitch(pixelFormat, dstPitch); + int srcChromaPitch = getChromaPitch(pixelFormat, srcPitch); + int chromaWidthInBytes = getChromaWidthInBytes(pixelFormat, width); + + for (int index = 0; index < numChromaPlanes; ++index) { + if (chromaHeight != 0) { + if (srcMemoryType == CU_MEMORYTYPE_HOST) { + mem.srcHost(srcFrame.getPointer(srcChromaOffsets.get(index))); + } else { + mem.srcDevice(srcFrame.address() + dstChromaOffsets[index]); + } + + mem.srcPitch(srcChromaPitch); + + mem.dstDevice(dstFrame.address() + dstChromaOffsets[index]); + mem.dstPitch(destChromaPitch); + mem.WidthInBytes(chromaWidthInBytes); + mem.Height(chromaHeight); + + if (unAlignedDeviceCopy && srcMemoryType == CU_MEMORYTYPE_DEVICE) { + try { + checkCudaApiCall(cuMemcpy2DUnaligned(mem)); + } catch (CudaException e) { + e.printStackTrace(); + } + } else { + try { + checkCudaApiCall(stream == null ? cuMemcpy2D(mem) : cuMemcpy2DAsync(mem, stream)); + } catch (CudaException e) { + e.printStackTrace(); + } + } + } + } + + try { + checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException e) { + e.printStackTrace(); + } + } + + public static void copyToDeviceFrame(CUctx_st device, Pointer srcFrame, int srcPitch, LongPointer dstFrame, int dstPitch, int width, int height, int srcMemoryType, int pixelFormat, LongPointer[] dstChromaDevicePointers, int dstChromaPitch, int numChromaPlanes) { + copyToDeviceFrame(device, srcFrame, srcPitch, dstFrame, dstPitch, width, height, srcMemoryType, pixelFormat, dstChromaDevicePointers, dstChromaPitch, numChromaPlanes, false); + } + + public static void copyToDeviceFrame(CUctx_st device, Pointer srcFrame, int srcPitch, LongPointer dstFrame, int dstPitch, int width, int height, int srcMemoryType, int pixelFormat, LongPointer[] dstChromaDevicePointers, int dstChromaPitch, int numChromaPlanes, boolean unAlignedDeviceCopy) { + if (srcMemoryType != CU_MEMORYTYPE_HOST && srcMemoryType != CU_MEMORYTYPE_DEVICE) { + System.err.println("Invalid source memory type for copy"); + } + + try { + checkCudaApiCall(cuCtxPushCurrent(device)); + } catch (CudaException e) { + e.printStackTrace(); + } + + CUDA_MEMCPY2D mem = new CUDA_MEMCPY2D(); + mem.srcXInBytes(0); + mem.srcMemoryType(srcMemoryType); + + if (srcMemoryType == CU_MEMORYTYPE_HOST) { + mem.srcHost(srcFrame); + } else { + mem.srcDevice(srcFrame.address()); + } + mem.srcPitch(srcPitch); + mem.dstMemoryType(CU_MEMORYTYPE_DEVICE); + mem.dstDevice(dstFrame.get()); + mem.dstPitch(dstPitch); + mem.WidthInBytes(getWidthInBytes(pixelFormat, width)); + mem.Height(height); + + if (unAlignedDeviceCopy && srcMemoryType == CU_MEMORYTYPE_DEVICE) { + try { + checkCudaApiCall(cuMemcpy2DUnaligned(mem)); + } catch (CudaException e) { + e.printStackTrace(); + } + } else { + try { + checkCudaApiCall(cuMemcpy2D(mem)); + } catch (CudaException e) { + e.printStackTrace(); + } + } + + Vector srcChromaOffsets = new Vector<>(); + getChromaSubPlaneOffsets(pixelFormat, srcPitch, height, srcChromaOffsets); + int chromaHeight = getChromaHeight(pixelFormat, height); + int srcChromaPitch = getChromaPitch(pixelFormat, srcPitch); + int chromaWidthInBytes = getChromaWidthInBytes(pixelFormat, width); + + for (int index = 0; index < numChromaPlanes; ++index) { + if (chromaHeight != 0) { + if (srcMemoryType == CU_MEMORYTYPE_HOST) { + mem.srcHost(srcFrame.getPointer(srcChromaOffsets.get(index))); + } else { + mem.srcDevice(srcFrame.address() + srcChromaOffsets.get(index)); + } + mem.srcPitch(srcChromaPitch); + mem.dstDevice(dstChromaDevicePointers[index].get()); + mem.dstPitch(dstChromaPitch); + mem.WidthInBytes(chromaWidthInBytes); + mem.Height(chromaHeight); + + if (unAlignedDeviceCopy && srcMemoryType == CU_MEMORYTYPE_DEVICE) { + try { + checkCudaApiCall(cuMemcpy2DUnaligned(mem)); + } catch (CudaException e) { + e.printStackTrace(); + } + } else { + try { + checkCudaApiCall(cuMemcpy2D(mem)); + } catch (CudaException e) { + e.printStackTrace(); + } + } + } + } + + try { + checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException e) { + e.printStackTrace(); + } + } + + public NvEncoderCuda(CUctx_st cudaContext, int width, int height, int bufferFormat) { + this(cudaContext, width, height, bufferFormat, 3, false, false); + + } + + public NvEncoderCuda(CUctx_st cudaContext, int width, int height, int bufferFormat, int extraOutputDelay, boolean motionEstimationOnly, boolean outputInVideoMemory) { + super(NV_ENC_DEVICE_TYPE_CUDA, cudaContext, width, height, bufferFormat, extraOutputDelay, motionEstimationOnly, outputInVideoMemory); + this.cudaPitch = new SizeTPointer(1); + this.cudaContext = cudaContext; + + if (this.encoder == null || this.encoder.isNull()) { + System.err.println("Encoder Initialization failed"); + } + + if (this.cudaContext == null || this.cudaContext.isNull()) { + System.err.println("Invalid Cuda Context"); + } + } + + @Override + protected void allocateInputBuffers(int numInputBuffers) { + if (!this.isHWEncoderInitialized()) { + System.err.println("Encoder intialization failed"); + } + + // for MEOnly mode we need to allocate seperate set of buffers for reference frame + int numCount = this.motionEstimationOnly ? 2 : 1; + + for (int count = 0; count < numCount; count++) { + try { + checkCudaApiCall(cuCtxPushCurrent(this.cudaContext)); + } catch (CudaException e) { + e.printStackTrace(); + } + Vector inputFrames = new Vector<>(); + int pixelFormat = this.getPixelFormat(); + + for (int index = 0; index < numInputBuffers; index++) { + final LongPointer deviceFramePointer = new LongPointer(1); + + int chromaHeight = getNumChromaPlanes(pixelFormat) * getChromaHeight(pixelFormat, this.getMaxEncodedHeight()); + + if (pixelFormat == NV_ENC_BUFFER_FORMAT_YV12 || pixelFormat == NV_ENC_BUFFER_FORMAT_IYUV) { + chromaHeight = getChromaHeight(pixelFormat, getMaxEncodedHeight()); + } + + try { + checkCudaApiCall(cuMemAllocPitch(deviceFramePointer, this.cudaPitch, getWidthInBytes(pixelFormat, getMaxEncodeWidth()), getMaxEncodedHeight() + chromaHeight, 16)); + } catch (CudaException e) { + e.printStackTrace(); + } + + inputFrames.add(new Pointer() {{ + address = deviceFramePointer.get(); + }}); + } + try { + checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException e) { + e.printStackTrace(); + } + + this.registerInputResources(inputFrames, NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR, this.getMaxEncodeWidth(), this.getMaxEncodedHeight(), (int) this.cudaPitch.get(), pixelFormat, count == 1); + } + } + + + public void setIOCudaStreams(NV_ENC_CUSTREAM_PTR inputStream, NV_ENC_CUSTREAM_PTR outputStream) { + try { + NvCodecUtil.checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncSetIOCudaStreams().call(this.encoder, inputStream, outputStream)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + } + + @Override + protected void releaseInputBuffers() { + this.releaseCudaResources(); + } + + private void releaseCudaResources() { + if (this.encoder != null && !this.encoder.isNull()) { + if (this.cudaContext != null && !this.cudaContext.isNull()) { + this.unregisterInputResources(); + + cuCtxPushCurrent(this.cudaContext); + + for (NvEncoderInputFrame inputFrame : this.inputFrames) { + Pointer pointer = inputFrame.getInputPointer(); + if (pointer != null && !pointer.isNull()) { + cudaFree(pointer); + } + } + this.inputFrames.clear(); + + for (NvEncoderInputFrame referenceFrame : this.referenceFrames) { + Pointer pointer = referenceFrame.getInputPointer(); + if (pointer != null && !pointer.isNull()) { + cudaFree(pointer); + } + } + this.referenceFrames.clear(); + + cuCtxPopCurrent(null); + this.cudaContext = null; + } + } + } + + @Override + public void dispose() { + this.releaseCudaResources(); + + super.dispose(); + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderInitParam.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderInitParam.java new file mode 100644 index 00000000000..46d9561beee --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderInitParam.java @@ -0,0 +1,753 @@ +package org.bytedeco.nvcodec.samples.encoder; + +import org.bytedeco.javacpp.FunctionPointer; +import org.bytedeco.nvcodec.nvencodeapi.*; +import org.bytedeco.nvcodec.samples.exceptions.NvCodecException; +import org.bytedeco.nvcodec.samples.util.NvCodecUtil; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +public class NvEncoderInitParam { + public static class InitFunction extends FunctionPointer { + public void call(NV_ENC_INITIALIZE_PARAMS params) { + + } + } + + private int tuningInfo; + + private String param; + private String[] tokens; + + private boolean lowLatency; + + private GUID guidCodec; + private GUID guidPreset; + + private InitFunction initFunction; + + private final String codecNames = "h264 hevc"; + private GUID[] codecs = new GUID[]{ + NV_ENC_CODEC_H264_GUID(), + NV_ENC_CODEC_HEVC_GUID() + }; + + private final String chromaNames = "yuv420 yuv444"; + private Integer[] chromaTypes = new Integer[]{ + 1, 3 + }; + + private final String presetNames = "p1 p2 p3 p4 p5 p6 p7"; + private GUID[] presets = new GUID[]{ + NV_ENC_PRESET_P1_GUID(), + NV_ENC_PRESET_P2_GUID(), + NV_ENC_PRESET_P3_GUID(), + NV_ENC_PRESET_P4_GUID(), + NV_ENC_PRESET_P5_GUID(), + NV_ENC_PRESET_P6_GUID(), + NV_ENC_PRESET_P7_GUID() + }; + + private final String h264ProfileNames = "baseline main high high444"; + private GUID[] h264Profiles = new GUID[]{ + NV_ENC_H264_PROFILE_BASELINE_GUID(), + NV_ENC_H264_PROFILE_MAIN_GUID(), + NV_ENC_H264_PROFILE_HIGH_GUID(), + NV_ENC_H264_PROFILE_HIGH_444_GUID() + }; + + private final String hevcProfileNames = "main main10 frext"; + private GUID[] hevcProfiles = new GUID[]{ + NV_ENC_HEVC_PROFILE_MAIN_GUID(), + NV_ENC_HEVC_PROFILE_MAIN10_GUID(), + NV_ENC_HEVC_PROFILE_FREXT_GUID() + }; + + private final String profileNames = "(default) auto baseline(h264) main(h264) high(h264) high444(h264) stereo(h264) svc_temporal_scalability(h264) progressiv_high(h264) constrained_high(h264) main(hevc) main10(hevc) frext(hevc)"; + private GUID[] profiles = new GUID[]{ + new GUID(), + NV_ENC_CODEC_PROFILE_AUTOSELECT_GUID(), + NV_ENC_H264_PROFILE_BASELINE_GUID(), + NV_ENC_H264_PROFILE_MAIN_GUID(), + NV_ENC_H264_PROFILE_HIGH_GUID(), + NV_ENC_H264_PROFILE_HIGH_444_GUID(), + NV_ENC_H264_PROFILE_STEREO_GUID(), + NV_ENC_H264_PROFILE_PROGRESSIVE_HIGH_GUID(), + NV_ENC_H264_PROFILE_CONSTRAINED_HIGH_GUID(), + NV_ENC_HEVC_PROFILE_MAIN_GUID(), + NV_ENC_HEVC_PROFILE_MAIN10_GUID(), + NV_ENC_HEVC_PROFILE_FREXT_GUID() + }; + + private final String lowLatencyTuningInfoNames = "lowlatency ultralowlatency"; + private final String tuningInfoNames = "hq lowlatency ultralowlatency lossless"; + private Integer[] tuningInfos = new Integer[]{ + NV_ENC_TUNING_INFO_HIGH_QUALITY, + NV_ENC_TUNING_INFO_LOW_LATENCY, + NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY, + NV_ENC_TUNING_INFO_LOSSLESS + }; + + private final String rcModeNames = "constqp vbr cbr"; + private Integer[] rcModes = new Integer[]{ + NV_ENC_PARAMS_RC_CONSTQP, + NV_ENC_PARAMS_RC_VBR, + NV_ENC_PARAMS_RC_CBR + }; + + private final String multiPassNames = "disabled qres fullres"; + private Integer[] multiPassValues = new Integer[]{ + NV_ENC_MULTI_PASS_DISABLED, + NV_ENC_TWO_PASS_QUARTER_RESOLUTION, + NV_ENC_TWO_PASS_FULL_RESOLUTION + }; + + private final String qpMapModeNames = "disabled emphasis_level_map delta_qp_map qp_map"; + private Integer[] qpMapModes = new Integer[]{ + NV_ENC_QP_MAP_DISABLED, + NV_ENC_QP_MAP_EMPHASIS, + NV_ENC_QP_MAP_DELTA, + NV_ENC_QP_MAP + }; + + private T parseString(String optionValue, T[] values, String valueNames) { + String[] optionValueNames = valueNames.split(" "); + + for (int index = 0; index < optionValueNames.length; index++) { + if (optionValueNames[index].equals(optionValue)) { + return values[index]; + } + } + + System.err.println("Invalid value. Can't parse option"); + + return null; + } + + private String convertGUIDToString(GUID[] values, String valueNames, GUID value) { + for (int index = 0; index < values.length; index++) { + if (NvCodecUtil.compareGUID(value, values[index])) { + return valueNames.split(" ")[index]; + } + } + + System.err.println("Invalid value. Can't convert to one of " + valueNames); + + return null; + } + + private String convertValueToString(T[] values, String valueNames, T value) { + for (int index = 0; index < values.length; index++) { + if (value.equals(values[index])) { + return valueNames.split(" ")[index]; + } + } + + System.err.println("Invalid value. Can't convert to one of " + valueNames); + + return null; + } + + private int parseInt(String optionName, String optionValue) { + try { + return Integer.parseInt(optionValue); + } catch (Exception e) { + System.err.println(optionName + " need a value of positive number"); + } + + return -1; + } + + private int parseBitRate(String optionName, String optionValue) { + try { + Double.parseDouble(optionValue); + for (int index = 0; index < optionValue.length(); index++) { + char ch = optionValue.charAt(index); + + if ((ch < 48 || 57 < ch) && ch != 46) { + double r = Double.parseDouble(optionValue.substring(0, index)); + + if (ch != 0 && ch != 'k' && ch != 'm') { + System.err.println(optionName + " units: 1, K, M (lower case also allowed)"); + } + + return (int) ((ch == 'm' ? 1000000 : (ch == 'k' ? 1000 : 1)) * r); + } + } + } catch (Exception e) { + System.err.println(optionName + " units: 1, K, M (lower case also allowed)"); + } + + return -1; + } + + private NV_ENC_QP parseQp(String optionName, String optionValue) { + String[] qps = optionValue.split(","); + NV_ENC_QP qp = null; + try { + if (qps.length == 1) { + int qpValue = Integer.parseInt(qps[0]); + qp = new NV_ENC_QP(); + qp.qpInterP(qpValue); + qp.qpInterB(qpValue); + qp.qpIntra(qpValue); + } else if (qps.length == 3) { + qp = new NV_ENC_QP(); + qp.qpInterP(Integer.parseInt(qps[0])); + qp.qpInterB(Integer.parseInt(qps[1])); + qp.qpIntra(Integer.parseInt(qps[2])); + } else { + System.err.println(optionName + " qp_for_P_B_I or qp_P,qp_B,qp_I (no space is allowed)"); + } + } catch (Exception e) { + qp = null; + } + + return qp; + } + + public GUID getEncodeGUID() { + return this.guidCodec; + } + + public GUID getPresetGUID() { + return this.guidPreset; + } + + public int getTuningInfo() { + return this.tuningInfo; + } + + public boolean isCodecH264() { + return NvCodecUtil.compareGUID(this.getEncodeGUID(), NV_ENC_CODEC_H264_GUID()); + } + + public boolean isCodecHEVC() { + return NvCodecUtil.compareGUID(this.getEncodeGUID(), NV_ENC_CODEC_HEVC_GUID()); + } + + public NvEncoderInitParam(String param) { + this(param, null, false); + } + + public NvEncoderInitParam(String param, InitFunction initFunction, boolean lowLatency) { + this.param = param.toLowerCase(); + this.lowLatency = lowLatency; + this.initFunction = new InitFunction(); + + this.guidCodec = NV_ENC_CODEC_H264_GUID(); + this.guidPreset = NV_ENC_PRESET_P3_GUID(); + this.tuningInfo = NV_ENC_TUNING_INFO_HIGH_QUALITY; + + if (initFunction != null) { + this.initFunction = initFunction; + } + + this.tokens = this.param.split(" "); + + for (int index = 0; index < this.tokens.length; index++) { + String token = this.tokens[index]; + if (index + 1 < this.tokens.length) { + switch (token) { + case "-codec": + this.guidCodec = this.parseString(this.tokens[++index], this.codecs, this.codecNames); + break; + case "-preset": + this.guidPreset = this.parseString(this.tokens[++index], this.presets, this.presetNames); + break; + case "-tuninginfo": + this.tuningInfo = this.parseString(this.tokens[++index], this.tuningInfos, this.tuningInfoNames); + break; + } + } + } + } + + public String getHelpMessage() { + return this.getHelpMessage(false, false, false, false); + } + + public String getHelpMessage(boolean meOnly, boolean unbuffered, boolean hide444, boolean outputInVidMem) { + StringBuilder sb = new StringBuilder(); + + if (outputInVidMem && meOnly) { + sb.append("-codec Codec: ").append("h264\n"); + } else { + sb.append("-codec Codec: ").append(this.codecNames).append("\n"); + } + + sb.append("-preset Preset: ").append(this.presetNames).append("\n") + .append("-profile H264: ").append(this.h264ProfileNames); + + if (outputInVidMem && meOnly) { + sb.append("\n"); + } else { + sb.append("; HEVC: ").append(this.hevcProfileNames).append("\n"); + } + + if (!meOnly) { + if (!this.lowLatency) { + sb.append("-tuninginfo TuningInfo: ").append(this.tuningInfoNames).append("\n"); + } else { + sb.append("-tuninginfo TuningInfo: ").append(this.lowLatencyTuningInfoNames).append("\n"); + } + + sb.append("-multipass Multipass: ").append(this.multiPassNames).append("\n"); + } + + if (!hide444 && !this.lowLatency) { + sb.append("-444 (Only for RGB input) YUV444 encode\n"); + } + + if (!meOnly) { + sb.append("-rc Rate control mode: ").append(this.rcModeNames).append("\n") + .append("-fps Frame rate\n") + .append("-gop Length of GOP (Group of Pictures)\n"); + + if (!unbuffered && !this.lowLatency) { + sb.append("-bf Number of consecutive B-frames\n"); + } + + sb.append("-bitrate Average bit rate, can be in unit of 1, K, M\n") + .append("-maxbitrate Max bit rate, can be in unit of 1, K, M\n") + .append("-vbvbufsize VBV buffer size in bits, can be in unit of 1, K, M\n") + .append("-vbvinit VBV initial delay in bits, can be in unit of 1, K, M\n"); + + if (!this.lowLatency) { + sb.append("-aq Enable spatial AQ and set its stength (range 1-15, 0-auto)\n") + .append("-temporalaq (No value) Enable temporal AQ\n"); + } + + if (!unbuffered && !this.lowLatency) { + sb.append("-lookahead Maximum depth of lookahead (range 0-(31 - number of B frames))\n"); + } + + sb.append("-cq Target constant quality level for VBR mode (range 1-51, 0-auto)\n") + .append("-qmin Min QP value\n") + .append("-qmax Max QP value\n") + .append("-initqp Initial QP value\n"); + + if (!this.lowLatency) { + sb.append("-constqp QP value for constqp rate control mode\n") + .append("Note: QP value can be in the form of qp_of_P_B_I or qp_P,qp_B,qp_I (no space)\n"); + } + + if (unbuffered && !this.lowLatency) { + sb.append("Note: Options -bf and -lookahead are unavailable for this app\n"); + } + } + + return sb.toString(); + } + + public String mainParamToString(final NV_ENC_INITIALIZE_PARAMS pParams) { + StringBuilder sb = new StringBuilder(); + + sb.append("Encoding Parameters:") + .append("\n").append("\tcodec : ").append(this.convertGUIDToString(this.codecs, this.codecNames, pParams.encodeGUID())) + .append("\n").append("\tpreset : ").append(this.convertGUIDToString(this.presets, this.presetNames, pParams.presetGUID())); + + if (pParams.tuningInfo() != 0) { + sb.append("\n").append("\ttuningInfo : ").append(this.convertValueToString(this.tuningInfos, this.tuningInfoNames, pParams.tuningInfo())); + } + + sb.append("\n").append("\tprofile : ").append(this.convertGUIDToString(this.profiles, this.profileNames, pParams.encodeConfig().profileGUID())) + .append("\n").append("\tchroma : ").append(this.convertValueToString(chromaTypes, chromaNames, (NvCodecUtil.compareGUID(pParams.encodeGUID(), NV_ENC_CODEC_H264_GUID())) ? pParams.encodeConfig().encodeCodecConfig().h264Config().chromaFormatIDC() : pParams.encodeConfig().encodeCodecConfig().hevcConfig().chromaFormatIDC())) + .append("\n").append("\tbitdepth : ").append((NvCodecUtil.compareGUID(pParams.encodeGUID(), NV_ENC_CODEC_H264_GUID()) ? 0 : pParams.encodeConfig().encodeCodecConfig().hevcConfig().pixelBitDepthMinus8()) + 8) + .append("\n").append("\trc : ").append(this.convertValueToString(this.rcModes, this.rcModeNames, pParams.encodeConfig().rcParams().rateControlMode())); + + if (pParams.encodeConfig().rcParams().rateControlMode() == NV_ENC_PARAMS_RC_CONSTQP) { + sb.append(" (P,B,I=").append(pParams.encodeConfig().rcParams().constQP().qpInterP()).append(",").append(pParams.encodeConfig().rcParams().constQP().qpInterB()).append(",").append(pParams.encodeConfig().rcParams().constQP().qpIntra()).append(")"); + } + + sb.append("\n").append("\tfps : ").append(pParams.frameRateNum()).append("/").append(pParams.frameRateDen()) + .append("\n").append("\tgop : ").append((pParams.encodeConfig().gopLength() == NVENC_INFINITE_GOPLENGTH ? "INF" : pParams.encodeConfig().gopLength())) + .append("\n").append("\tbf : ").append(pParams.encodeConfig().frameIntervalP() - 1) + .append("\n").append("\tmultipass : ").append(pParams.encodeConfig().rcParams().multiPass()) + .append("\n").append("\tsize : ").append(pParams.encodeWidth()).append("x").append(pParams.encodeHeight()) + .append("\n").append("\tbitrate : ").append(pParams.encodeConfig().rcParams().averageBitRate()) + .append("\n").append("\tmaxbitrate : ").append(pParams.encodeConfig().rcParams().maxBitRate()) + .append("\n").append("\tvbvbufsize : ").append(pParams.encodeConfig().rcParams().vbvBufferSize()) + .append("\n").append("\tvbvinit : ").append(pParams.encodeConfig().rcParams().vbvInitialDelay()) + .append("\n").append("\taq : ").append((pParams.encodeConfig().rcParams().enableAQ() != 0 ? (pParams.encodeConfig().rcParams().aqStrength() != 0 ? pParams.encodeConfig().rcParams().aqStrength() : "auto") : "disabled")) + .append("\n").append("\ttemporalaq : ").append((pParams.encodeConfig().rcParams().enableTemporalAQ() != 0 ? "enabled" : "disabled")) + .append("\n").append("\tlookahead : ").append((pParams.encodeConfig().rcParams().enableLookahead() != 0 ? pParams.encodeConfig().rcParams().lookaheadDepth() : "disabled")) + .append("\n").append("\tcq : ").append(pParams.encodeConfig().rcParams().targetQuality()) + .append("\n").append("\tqmin : P,B,I=").append(pParams.encodeConfig().rcParams().minQP().qpInterP()).append(",").append(pParams.encodeConfig().rcParams().minQP().qpInterB()).append(",").append(pParams.encodeConfig().rcParams().minQP().qpIntra()) + .append("\n").append("\tqmax : P,B,I=").append(pParams.encodeConfig().rcParams().maxQP().qpInterP()).append(",").append(pParams.encodeConfig().rcParams().maxQP().qpInterB()).append(",").append(pParams.encodeConfig().rcParams().maxQP().qpIntra()) + .append("\n").append("\tinitqp : P,B,I=").append(pParams.encodeConfig().rcParams().initialRCQP().qpInterP()).append(",").append(pParams.encodeConfig().rcParams().initialRCQP().qpInterB()).append(",").append(pParams.encodeConfig().rcParams().initialRCQP().qpIntra()); + + return sb.toString(); + } + + public void setInitParams(NV_ENC_INITIALIZE_PARAMS pParams, int eBufferFormat) throws NvCodecException { + NV_ENC_CONFIG config = pParams.encodeConfig(); + for (int i = 0; i < this.tokens.length; i++) { + { + if (this.tokens[i].equals("-codec") && ++i != 0) { + continue; + } + if (this.tokens[i].equals("-preset") && ++i != 0) { + continue; + + } + if (this.tokens[i].equals("-multipass") && ++i != tokens.length) { + Integer multiPass = this.parseString(tokens[i], multiPassValues, multiPassNames); + + if (multiPass != null) { + config.rcParams().multiPass(multiPass); + + continue; + } + } + if (tokens[i].equals("-profile") && ++i != tokens.length) { + GUID profileGUID = null; + + if (this.isCodecH264()) { + profileGUID = this.parseString(tokens[i], h264Profiles, h264ProfileNames); + } else { + profileGUID = this.parseString(tokens[i], hevcProfiles, hevcProfileNames); + } + + if (profileGUID != null) { + config.profileGUID(profileGUID); + continue; + } + } + + if (tokens[i].equals("-rc") && ++i != tokens.length) { + int rateControlMode = this.parseString(tokens[i], rcModes, rcModeNames); + if (rateControlMode != -1) { + config.rcParams().rateControlMode(rateControlMode); + continue; + } + } + if (tokens[i].equals("-fps") && ++i != tokens.length) { + int frameRate = this.parseInt("-fps", tokens[i]); + + if (frameRate != -1) { + pParams.frameRateNum(frameRate); + continue; + } + } + if (tokens[i].equals("-bf") && ++i != tokens.length) { + int frameIntervalP = this.parseInt("-bf", tokens[i]); + + if (frameIntervalP != -1) { + config.frameIntervalP(++frameIntervalP); + + continue; + } + } + if (tokens[i].equals("-bitrate") && ++i != tokens.length) { + int bitRate = this.parseBitRate("-bitrate", tokens[i]); + + if (bitRate != -1) { + config.rcParams().averageBitRate(bitRate); + continue; + } + } + if (tokens[i].equals("-maxbitrate") && ++i != tokens.length) { + int bitRate = this.parseBitRate("-maxbitrate", tokens[i]); + + if (bitRate != -1) { + config.rcParams().maxBitRate(bitRate); + continue; + } + } + if (tokens[i].equals("-vbvbufsize") && ++i != tokens.length) { + int bitRate = this.parseBitRate("-vbvbufsize", tokens[i]); + + if (bitRate != -1) { + config.rcParams().vbvBufferSize(bitRate); + continue; + } + } + if (tokens[i].equals("-vbvinit") && ++i != tokens.length) { + int bitRate = this.parseBitRate("-vbvinit", tokens[i]); + + if (bitRate != -1) { + config.rcParams().vbvInitialDelay(bitRate); + continue; + } + } + if (tokens[i].equals("-cq") && ++i != tokens.length) { + int frameIntervalP = this.parseInt("-cq", tokens[i]); + + if (frameIntervalP != -1) { + config.rcParams().targetQuality((byte) frameIntervalP); + + continue; + } + } + if (tokens[i].equals("-initqp") && ++i != tokens.length) { + NV_ENC_QP qp = this.parseQp("-initqp", tokens[i]); + if (qp != null) { + config.rcParams().initialRCQP(qp); + config.rcParams().enableInitialRCQP(1); + + continue; + } + } + if (tokens[i].equals("-qmin") && ++i != tokens.length) { + NV_ENC_QP qp = this.parseQp("-qmin", tokens[i]); + if (qp != null) { + config.rcParams().minQP(qp); + config.rcParams().enableMinQP(1); + + continue; + } + } + + if (tokens[i].equals("-qmax") && ++i != tokens.length) { + NV_ENC_QP qp = this.parseQp("-qmax", tokens[i]); + if (qp != null) { + config.rcParams().maxQP(qp); + config.rcParams().enableMaxQP(1); + + continue; + } + } + + if (tokens[i].equals("-constqp") && ++i != tokens.length) { + NV_ENC_QP qp = this.parseQp("-constqp", tokens[i]); + if (qp != null) { + config.rcParams().constQP(qp); + + continue; + } + } + + if (tokens[i].equals("-temporalaq") && ++i != tokens.length) { + config.rcParams().enableTemporalAQ(1); + continue; + } + } + + + if (tokens[i].equals("-lookahead") && ++i != tokens.length) { + int lookaheadDepth = this.parseInt("-lookahead", tokens[i]); + + if (lookaheadDepth != -1) { + config.rcParams().lookaheadDepth((short) lookaheadDepth); + config.rcParams().enableLookahead(config.rcParams().lookaheadDepth() > 0 ? 1 : 0); + continue; + } + } + + if (tokens[i].equals("-aq") && ++i != tokens.length) { + int aqStrength = this.parseInt("-aq", tokens[i]); + + if (aqStrength != -1) { + config.rcParams().enableAQ(1); + config.rcParams().aqStrength(aqStrength); + continue; + } + } + + if (tokens[i].equals("-gop") && ++i != tokens.length) { + int gopLength = this.parseInt("-gop", tokens[i]); + + if (gopLength != -1) { + config.gopLength(gopLength); + + if (this.isCodecH264()) { + config.encodeCodecConfig().h264Config().idrPeriod(gopLength); + } else { + config.encodeCodecConfig().hevcConfig().idrPeriod(gopLength); + } + + continue; + } + } + + if (tokens[i].equals("-444")) { + if (this.isCodecH264()) { + config.encodeCodecConfig().h264Config().chromaFormatIDC(3); + } else { + config.encodeCodecConfig().hevcConfig().chromaFormatIDC(3); + } + + continue; + } + + System.err.println("Incorrect parameter: " + tokens[i] + "\nRe-run the application with the -h option to get a list of the supported options."); + + throw new NvCodecException("Incorrect parameter: " + tokens[i] + "\nRe-run the application with the -h option to get a list of the supported options.", 1); + } + + if (this.isCodecHEVC()) { + if (eBufferFormat == NV_ENC_BUFFER_FORMAT_YUV420_10BIT || eBufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT) { + config.encodeCodecConfig().hevcConfig().pixelBitDepthMinus8(2); + } + } + + this.initFunction.call(pParams); + System.out.println(new NvEncoderInitParam("").mainParamToString(pParams)); + System.out.println(new NvEncoderInitParam("").fullParamToString(pParams)); + } + + public String fullParamToString(final NV_ENC_INITIALIZE_PARAMS pInitializeParams) { + StringBuilder sb = new StringBuilder(); + + sb.append("NV_ENC_INITIALIZE_PARAMS:").append("\n") + .append("encodeGUID: ").append(this.convertGUIDToString(this.codecs, this.codecNames, pInitializeParams.encodeGUID())).append("\n") + .append("presetGUID: ").append(this.convertGUIDToString(this.presets, this.presetNames, pInitializeParams.presetGUID())).append("\n"); + + if (pInitializeParams.tuningInfo() != 0) { + sb.append("tuningInfo: ").append(this.convertValueToString(this.tuningInfos, this.tuningInfoNames, pInitializeParams.tuningInfo())).append("\n"); + } + + sb.append("encodeWidth: ").append(pInitializeParams.encodeWidth()).append("\n") + .append("encodeHeight: ").append(pInitializeParams.encodeHeight()).append("\n") + .append("darWidth: ").append(pInitializeParams.darWidth()).append("\n") + .append("darHeight: ").append(pInitializeParams.darHeight()).append("\n") + .append("frameRateNum: ").append(pInitializeParams.frameRateNum()).append("\n") + .append("frameRateDen: ").append(pInitializeParams.frameRateDen()).append("\n") + .append("enableEncodeAsync: ").append(pInitializeParams.enableEncodeAsync()).append("\n") + .append("reportSliceOffsets: ").append(pInitializeParams.reportSliceOffsets()).append("\n") + .append("enableSubFrameWrite: ").append(pInitializeParams.enableSubFrameWrite()).append("\n") + .append("enableExternalMEHints: ").append(pInitializeParams.enableExternalMEHints()).append("\n") + .append("enableMEOnlyMode: ").append(pInitializeParams.enableMEOnlyMode()).append("\n") + .append("enableWeightedPrediction: ").append(pInitializeParams.enableWeightedPrediction()).append("\n") + .append("maxEncodeWidth: ").append(pInitializeParams.maxEncodeWidth()).append("\n") + .append("maxEncodeHeight: ").append(pInitializeParams.maxEncodeHeight()).append("\n") + .append("maxMEHintCountsPerBlock: ").append(pInitializeParams.maxMEHintCountsPerBlock()).append("\n"); + + NV_ENC_CONFIG pConfig = pInitializeParams.encodeConfig(); + + sb.append("NV_ENC_CONFIG:").append("\n") + .append("profile: ").append(this.convertGUIDToString(this.profiles, this.profileNames, pConfig.profileGUID())).append("\n") + .append("gopLength: ").append(pConfig.gopLength()).append("\n") + .append("frameIntervalP: ").append(pConfig.frameIntervalP()).append("\n") + .append("monoChromeEncoding: ").append(pConfig.monoChromeEncoding()).append("\n") + .append("frameFieldMode: ").append(pConfig.frameFieldMode()).append("\n") + .append("mvPrecision: ").append(pConfig.mvPrecision()).append("\n") + .append("NV_ENC_RC_PARAMS:").append("\n") + .append(" rateControlMode: 0x").append(Integer.toHexString(pConfig.rcParams().rateControlMode())).append("\n") + .append(" constQP: ").append(pConfig.rcParams().constQP().qpInterP()).append(", ").append(pConfig.rcParams().constQP().qpInterB()).append(", ").append(pConfig.rcParams().constQP().qpIntra()).append("\n") + .append(" averageBitRate: ").append(pConfig.rcParams().averageBitRate()).append("\n") + .append(" maxBitRate: ").append(pConfig.rcParams().maxBitRate()).append("\n") + .append(" vbvBufferSize: ").append(pConfig.rcParams().vbvBufferSize()).append("\n") + .append(" vbvInitialDelay: ").append(pConfig.rcParams().vbvInitialDelay()).append("\n") + .append(" enableMinQP: ").append(pConfig.rcParams().enableMinQP()).append("\n") + .append(" enableMaxQP: ").append(pConfig.rcParams().enableMaxQP()).append("\n") + .append(" enableInitialRCQP: ").append(pConfig.rcParams().enableInitialRCQP()).append("\n") + .append(" enableAQ: ").append(pConfig.rcParams().enableAQ()).append("\n") + .append(" qpMapMode: ").append(this.convertValueToString(this.qpMapModes, this.qpMapModeNames, pConfig.rcParams().qpMapMode())).append("\n") + .append(" multipass: ").append(this.convertValueToString(this.multiPassValues, this.multiPassNames, pConfig.rcParams().multiPass())).append("\n") + .append(" enableLookahead: ").append(pConfig.rcParams().enableLookahead()).append("\n") + .append(" disableIadapt: ").append(pConfig.rcParams().disableIadapt()).append("\n") + .append(" disableBadapt: ").append(pConfig.rcParams().disableBadapt()).append("\n") + .append(" enableTemporalAQ: ").append(pConfig.rcParams().enableTemporalAQ()).append("\n") + .append(" zeroReorderDelay: ").append(pConfig.rcParams().zeroReorderDelay()).append("\n") + .append(" enableNonRefP: ").append(pConfig.rcParams().enableNonRefP()).append("\n") + .append(" strictGOPTarget: ").append(pConfig.rcParams().strictGOPTarget()).append("\n") + .append(" aqStrength: ").append(pConfig.rcParams().aqStrength()).append("\n") + .append(" minQP: ").append(pConfig.rcParams().minQP().qpInterP()).append(", ").append(pConfig.rcParams().minQP().qpInterB()).append(", ").append(pConfig.rcParams().minQP().qpIntra()).append("\n") + .append(" maxQP: ").append(pConfig.rcParams().maxQP().qpInterP()).append(", ").append(pConfig.rcParams().maxQP().qpInterB()).append(", ").append(pConfig.rcParams().maxQP().qpIntra()).append("\n") + .append(" initialRCQP: ").append(pConfig.rcParams().initialRCQP().qpInterP()).append(", ").append(pConfig.rcParams().initialRCQP().qpInterB()).append(", ").append(pConfig.rcParams().initialRCQP().qpIntra()).append("\n") + .append(" temporallayerIdxMask: ").append(pConfig.rcParams().temporallayerIdxMask()).append("\n") + .append(" temporalLayerQP: ").append(pConfig.rcParams().temporalLayerQP(0)).append(", ").append(pConfig.rcParams().temporalLayerQP(1)).append(", ").append(pConfig.rcParams().temporalLayerQP(2)).append(", ").append(pConfig.rcParams().temporalLayerQP(3)).append(", ").append(pConfig.rcParams().temporalLayerQP(4)).append(", ").append(pConfig.rcParams().temporalLayerQP(5)).append(", ").append(pConfig.rcParams().temporalLayerQP(6)).append(", ").append(pConfig.rcParams().temporalLayerQP(7)).append("\n") + .append(" targetQuality: ").append(pConfig.rcParams().targetQuality()).append("\n") + .append(" lookaheadDepth: ").append(pConfig.rcParams().lookaheadDepth()).append("\n"); + if (NvCodecUtil.compareGUID(pInitializeParams.encodeGUID(), NV_ENC_CODEC_H264_GUID())) { + sb.append("NV_ENC_CODEC_CONFIG (H264):").append("\n") + .append(" enableStereoMVC: ").append(pConfig.encodeCodecConfig().h264Config().enableStereoMVC()).append("\n") + .append(" hierarchicalPFrames: ").append(pConfig.encodeCodecConfig().h264Config().hierarchicalPFrames()).append("\n") + .append(" hierarchicalBFrames: ").append(pConfig.encodeCodecConfig().h264Config().hierarchicalBFrames()).append("\n") + .append(" outputBufferingPeriodSEI: ").append(pConfig.encodeCodecConfig().h264Config().outputBufferingPeriodSEI()).append("\n") + .append(" outputPictureTimingSEI: ").append(pConfig.encodeCodecConfig().h264Config().outputPictureTimingSEI()).append("\n") + .append(" outputAUD: ").append(pConfig.encodeCodecConfig().h264Config().outputAUD()).append("\n") + .append(" disableSPSPPS: ").append(pConfig.encodeCodecConfig().h264Config().disableSPSPPS()).append("\n") + .append(" outputFramePackingSEI: ").append(pConfig.encodeCodecConfig().h264Config().outputFramePackingSEI()).append("\n") + .append(" outputRecoveryPointSEI: ").append(pConfig.encodeCodecConfig().h264Config().outputRecoveryPointSEI()).append("\n") + .append(" enableIntraRefresh: ").append(pConfig.encodeCodecConfig().h264Config().enableIntraRefresh()).append("\n") + .append(" enableConstrainedEncoding: ").append(pConfig.encodeCodecConfig().h264Config().enableConstrainedEncoding()).append("\n") + .append(" repeatSPSPPS: ").append(pConfig.encodeCodecConfig().h264Config().repeatSPSPPS()).append("\n") + .append(" enableVFR: ").append(pConfig.encodeCodecConfig().h264Config().enableVFR()).append("\n") + .append(" enableLTR: ").append(pConfig.encodeCodecConfig().h264Config().enableLTR()).append("\n") + .append(" qpPrimeYZeroTransformBypassFlag: ").append(pConfig.encodeCodecConfig().h264Config().qpPrimeYZeroTransformBypassFlag()).append("\n") + .append(" useConstrainedIntraPred: ").append(pConfig.encodeCodecConfig().h264Config().useConstrainedIntraPred()).append("\n") + .append(" level: ").append(pConfig.encodeCodecConfig().h264Config().level()).append("\n") + .append(" idrPeriod: ").append(pConfig.encodeCodecConfig().h264Config().idrPeriod()).append("\n") + .append(" separateColourPlaneFlag: ").append(pConfig.encodeCodecConfig().h264Config().separateColourPlaneFlag()).append("\n") + .append(" disableDeblockingFilterIDC: ").append(pConfig.encodeCodecConfig().h264Config().disableDeblockingFilterIDC()).append("\n") + .append(" numTemporalLayers: ").append(pConfig.encodeCodecConfig().h264Config().numTemporalLayers()).append("\n") + .append(" spsId: ").append(pConfig.encodeCodecConfig().h264Config().spsId()).append("\n") + .append(" ppsId: ").append(pConfig.encodeCodecConfig().h264Config().ppsId()).append("\n") + .append(" adaptiveTransformMode: ").append(pConfig.encodeCodecConfig().h264Config().adaptiveTransformMode()).append("\n") + .append(" fmoMode: ").append(pConfig.encodeCodecConfig().h264Config().fmoMode()).append("\n") + .append(" bdirectMode: ").append(pConfig.encodeCodecConfig().h264Config().bdirectMode()).append("\n") + .append(" entropyCodingMode: ").append(pConfig.encodeCodecConfig().h264Config().entropyCodingMode()).append("\n") + .append(" stereoMode: ").append(pConfig.encodeCodecConfig().h264Config().stereoMode()).append("\n") + .append(" intraRefreshPeriod: ").append(pConfig.encodeCodecConfig().h264Config().intraRefreshPeriod()).append("\n") + .append(" intraRefreshCnt: ").append(pConfig.encodeCodecConfig().h264Config().intraRefreshCnt()).append("\n") + .append(" maxNumRefFrames: ").append(pConfig.encodeCodecConfig().h264Config().maxNumRefFrames()).append("\n") + .append(" sliceMode: ").append(pConfig.encodeCodecConfig().h264Config().sliceMode()).append("\n") + .append(" sliceModeData: ").append(pConfig.encodeCodecConfig().h264Config().sliceModeData()).append("\n") + .append(" NV_ENC_CONFIG_H264_VUI_PARAMETERS:").append("\n") + .append(" overscanInfoPresentFlag: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().overscanInfoPresentFlag()).append("\n") + .append(" overscanInfo: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().overscanInfo()).append("\n") + .append(" videoSignalTypePresentFlag: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().videoSignalTypePresentFlag()).append("\n") + .append(" videoFormat: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().videoFormat()).append("\n") + .append(" videoFullRangeFlag: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().videoFullRangeFlag()).append("\n") + .append(" colourDescriptionPresentFlag: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().colourDescriptionPresentFlag()).append("\n") + .append(" colourPrimaries: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().colourPrimaries()).append("\n") + .append(" transferCharacteristics: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().transferCharacteristics()).append("\n") + .append(" colourMatrix: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().colourMatrix()).append("\n") + .append(" chromaSampleLocationFlag: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().chromaSampleLocationFlag()).append("\n") + .append(" chromaSampleLocationTop: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().chromaSampleLocationTop()).append("\n") + .append(" chromaSampleLocationBot: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().chromaSampleLocationBot()).append("\n") + .append(" bitstreamRestrictionFlag: ").append(pConfig.encodeCodecConfig().h264Config().h264VUIParameters().bitstreamRestrictionFlag()).append("\n") + .append(" ltrNumFrames: ").append(pConfig.encodeCodecConfig().h264Config().ltrNumFrames()).append("\n") + .append(" ltrTrustMode: ").append(pConfig.encodeCodecConfig().h264Config().ltrTrustMode()).append("\n") + .append(" chromaFormatIDC: ").append(pConfig.encodeCodecConfig().h264Config().chromaFormatIDC()).append("\n") + .append(" maxTemporalLayers: ").append(pConfig.encodeCodecConfig().h264Config().maxTemporalLayers()).append("\n"); + } else if (NvCodecUtil.compareGUID(pInitializeParams.encodeGUID(), NV_ENC_CODEC_HEVC_GUID())) { + sb.append("NV_ENC_CODEC_CONFIG (HEVC):").append("\n") + .append(" level: ").append(pConfig.encodeCodecConfig().hevcConfig().level()).append("\n") + .append(" tier: ").append(pConfig.encodeCodecConfig().hevcConfig().tier()).append("\n") + .append(" minCUSize: ").append(pConfig.encodeCodecConfig().hevcConfig().minCUSize()).append("\n") + .append(" maxCUSize: ").append(pConfig.encodeCodecConfig().hevcConfig().maxCUSize()).append("\n") + .append(" useConstrainedIntraPred: ").append(pConfig.encodeCodecConfig().hevcConfig().useConstrainedIntraPred()).append("\n") + .append(" disableDeblockAcrossSliceBoundary: ").append(pConfig.encodeCodecConfig().hevcConfig().disableDeblockAcrossSliceBoundary()).append("\n") + .append(" outputBufferingPeriodSEI: ").append(pConfig.encodeCodecConfig().hevcConfig().outputBufferingPeriodSEI()).append("\n") + .append(" outputPictureTimingSEI: ").append(pConfig.encodeCodecConfig().hevcConfig().outputPictureTimingSEI()).append("\n") + .append(" outputAUD: ").append(pConfig.encodeCodecConfig().hevcConfig().outputAUD()).append("\n") + .append(" enableLTR: ").append(pConfig.encodeCodecConfig().hevcConfig().enableLTR()).append("\n") + .append(" disableSPSPPS: ").append(pConfig.encodeCodecConfig().hevcConfig().disableSPSPPS()).append("\n") + .append(" repeatSPSPPS: ").append(pConfig.encodeCodecConfig().hevcConfig().repeatSPSPPS()).append("\n") + .append(" enableIntraRefresh: ").append(pConfig.encodeCodecConfig().hevcConfig().enableIntraRefresh()).append("\n") + .append(" chromaFormatIDC: ").append(pConfig.encodeCodecConfig().hevcConfig().chromaFormatIDC()).append("\n") + .append(" pixelBitDepthMinus8: ").append(pConfig.encodeCodecConfig().hevcConfig().pixelBitDepthMinus8()).append("\n") + .append(" idrPeriod: ").append(pConfig.encodeCodecConfig().hevcConfig().idrPeriod()).append("\n") + .append(" intraRefreshPeriod: ").append(pConfig.encodeCodecConfig().hevcConfig().intraRefreshPeriod()).append("\n") + .append(" intraRefreshCnt: ").append(pConfig.encodeCodecConfig().hevcConfig().intraRefreshCnt()).append("\n") + .append(" maxNumRefFramesInDPB: ").append(pConfig.encodeCodecConfig().hevcConfig().maxNumRefFramesInDPB()).append("\n") + .append(" ltrNumFrames: ").append(pConfig.encodeCodecConfig().hevcConfig().ltrNumFrames()).append("\n") + .append(" vpsId: ").append(pConfig.encodeCodecConfig().hevcConfig().vpsId()).append("\n") + .append(" spsId: ").append(pConfig.encodeCodecConfig().hevcConfig().spsId()).append("\n") + .append(" ppsId: ").append(pConfig.encodeCodecConfig().hevcConfig().ppsId()).append("\n") + .append(" sliceMode: ").append(pConfig.encodeCodecConfig().hevcConfig().sliceMode()).append("\n") + .append(" sliceModeData: ").append(pConfig.encodeCodecConfig().hevcConfig().sliceModeData()).append("\n") + .append(" maxTemporalLayersMinus1: ").append(pConfig.encodeCodecConfig().hevcConfig().maxTemporalLayersMinus1()).append("\n") + .append(" NV_ENC_CONFIG_HEVC_VUI_PARAMETERS:").append("\n") + .append(" overscanInfoPresentFlag: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().overscanInfoPresentFlag()).append("\n") + .append(" overscanInfo: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().overscanInfo()).append("\n") + .append(" videoSignalTypePresentFlag: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().videoSignalTypePresentFlag()).append("\n") + .append(" videoFormat: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().videoFormat()).append("\n") + .append(" videoFullRangeFlag: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().videoFullRangeFlag()).append("\n") + .append(" colourDescriptionPresentFlag: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().colourDescriptionPresentFlag()).append("\n") + .append(" colourPrimaries: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().colourPrimaries()).append("\n") + .append(" transferCharacteristics: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().transferCharacteristics()).append("\n") + .append(" colourMatrix: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().colourMatrix()).append("\n") + .append(" chromaSampleLocationFlag: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().chromaSampleLocationFlag()).append("\n") + .append(" chromaSampleLocationTop: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().chromaSampleLocationTop()).append("\n") + .append(" chromaSampleLocationBot: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().chromaSampleLocationBot()).append("\n") + .append(" bitstreamRestrictionFlag: ").append(pConfig.encodeCodecConfig().hevcConfig().hevcVUIParameters().bitstreamRestrictionFlag()).append("\n") + .append(" ltrTrustMode: ").append(pConfig.encodeCodecConfig().hevcConfig().ltrTrustMode()).append("\n"); + } + return sb.toString(); + } +} \ No newline at end of file diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderInputFrame.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderInputFrame.java new file mode 100644 index 00000000000..c2cb3226ce2 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderInputFrame.java @@ -0,0 +1,74 @@ +package org.bytedeco.nvcodec.samples.encoder; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.nvcodec.global.nvencodeapi.*; + +public class NvEncoderInputFrame { + private Pointer inputPointer; + private int[] chromaOffsets; + private int numChromaPlanes; + private int pitch; + private int chromaPitch; + private int bufferFormat; + private int resourceType; + + public NvEncoderInputFrame() { + this.chromaOffsets = new int[2]; + } + + public Pointer getInputPointer() { + return inputPointer; + } + + public void setInputPointer(Pointer inputPointer) { + this.inputPointer = inputPointer; + } + + public int[] getChromaOffsets() { + return chromaOffsets; + } + + public void setChromaOffsets(int[] chromaOffsets) { + this.chromaOffsets = chromaOffsets; + } + + public int getNumChromaPlanes() { + return numChromaPlanes; + } + + public void setNumChromaPlanes(int numChromaPlanes) { + this.numChromaPlanes = numChromaPlanes; + } + + public int getPitch() { + return pitch; + } + + public void setPitch(int pitch) { + this.pitch = pitch; + } + + public int getChromaPitch() { + return chromaPitch; + } + + public void setChromaPitch(int chromaPitch) { + this.chromaPitch = chromaPitch; + } + + public int getBufferFormat() { + return bufferFormat; + } + + public void setBufferFormat(int bufferFormat) { + this.bufferFormat = bufferFormat; + } + + public int getResourceType() { + return resourceType; + } + + public void setResourceType(int resourceType) { + this.resourceType = resourceType; + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderOutputInVidMemCuda.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderOutputInVidMemCuda.java new file mode 100644 index 00000000000..29f090c9365 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/NvEncoderOutputInVidMemCuda.java @@ -0,0 +1,345 @@ +package org.bytedeco.nvcodec.samples.encoder; + +import org.bytedeco.nvcodec.samples.exceptions.CudaException; +import org.bytedeco.nvcodec.samples.exceptions.NvCodecException; +import org.bytedeco.nvcodec.samples.util.VectorEx; +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.javacpp.LongPointer; +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.nvcodec.global.nvencodeapi.*; +import org.bytedeco.nvcodec.nvencodeapi.*; + +import java.util.LinkedList; +import java.util.List; +import java.util.Vector; + +import static org.bytedeco.nvcodec.global.nvencodeapi.NV_ENC_OUTPUT_MOTION_VECTOR; +import static org.bytedeco.nvcodec.samples.util.CudaUtil.checkCudaApiCall; +import static org.bytedeco.nvcodec.samples.util.NvCodecUtil.checkNvCodecApiCall; +import static org.bytedeco.cuda.global.cudart.*; +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +public class NvEncoderOutputInVidMemCuda extends NvEncoderCuda { + private VectorEx mappedOutputBuffers; + private Vector outputBuffers; + private Vector registeredResourcesOutputBuffer; + + public NvEncoderOutputInVidMemCuda(CUctx_st cudaContext, int width, int height, int bufferFormat) { + this(cudaContext, width, height, bufferFormat, false); + } + + public NvEncoderOutputInVidMemCuda(CUctx_st cudaContext, int width, int height, int bufferFormat, boolean motionEstimationOnly) { + super(cudaContext, width, height, bufferFormat, 0, motionEstimationOnly, true); + this.mappedOutputBuffers = new VectorEx<>(); + this.outputBuffers = new Vector<>(); + this.registeredResourcesOutputBuffer = new Vector<>(); + } + + private int alignUp(int s, int a) { + return (s + a - 1) & ~(a - 1); + } + + public int getOutputBufferSize() { + int bufferSize = 0; + if (this.motionEstimationOnly) { + int encodeWidthInMbs = (this.getEncodeWidth() + 15) >> 4; + int encodeHeightInMbs = (this.getEncodeHeight() + 15) >> 4; + bufferSize = encodeWidthInMbs * encodeHeightInMbs + Pointer.sizeof(NV_ENC_H264_MV_DATA.class); + } else { + // 2-times the input size + bufferSize = this.getFrameSize() * 2; + + bufferSize += Pointer.sizeof(NV_ENC_ENCODE_OUT_PARAMS.class); + } + return this.alignUp(bufferSize, 4); + } + + /** + * @brief This function is used to allocate output buffers in video memory for storing + * encode or motion estimation output. + */ + private void allocateOutputBuffers(int numOutputBuffers) { + int size = this.getOutputBufferSize(); + + try { + checkCudaApiCall(cuCtxPushCurrent(this.cudaContext)); + } catch (CudaException e) { + e.printStackTrace(); + } + + for (int index = 0; index < numOutputBuffers; index++) { + final LongPointer deviceFramePointer = new LongPointer(1); + + try { + checkCudaApiCall(cuMemAlloc(deviceFramePointer, size)); + } catch (CudaException e) { + e.printStackTrace(); + } + + this.outputBuffers.add(new NV_ENC_OUTPUT_PTR() { + { + address = deviceFramePointer.get(); + } + }); + } + + try { + checkCudaApiCall(cuCtxPopCurrent(null)); + } catch (CudaException e) { + e.printStackTrace(); + } + + this.registerOutputResources(size); + } + + /** + * @brief This function is used to release output buffers. + */ + private void releaseOutputBuffers() { + if (this.encoder != null && !this.encoder.isNull()) { + this.unregisterOutputResources(); + + for (Pointer pointer : this.outputBuffers) { + cudaFree(pointer); + } + + this.outputBuffers.clear(); + } + } + + /** + * @brief This function is used to register output buffers with NvEncodeAPI. + */ + private void registerOutputResources(int bfrSize) { + int bufferUsage = this.motionEstimationOnly ? NV_ENC_OUTPUT_MOTION_VECTOR : NV_ENC_OUTPUT_BITSTREAM; + + for (NV_ENC_OUTPUT_PTR pointer : this.outputBuffers) { + if (pointer != null && !pointer.isNull()) { + NV_ENC_REGISTERED_PTR registeredPointer = this.registerResource(pointer, NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR, bfrSize, 1, bfrSize, NV_ENC_BUFFER_FORMAT_U8, bufferUsage); + + this.registeredResourcesOutputBuffer.add(registeredPointer); + } + } + } + + /** + * @brief This function is used to unregister output resources which had been previously registered for encoding + * using RegisterOutputResources() function. + */ + private void unregisterOutputResources() { + for (Pointer pointer : this.mappedOutputBuffers) { + if (pointer != null && !pointer.isNull()) { + this.nvEncodeApiFunctionList.nvEncUnmapInputResource().call(this.encoder, (NV_ENC_INPUT_PTR) pointer); + } + } + + this.mappedOutputBuffers.clear(); + + for (NV_ENC_REGISTERED_PTR pointer : this.registeredResourcesOutputBuffer) { + if (pointer != null && !pointer.isNull()) { + this.nvEncodeApiFunctionList.nvEncUnregisterResource().call(this.encoder, pointer); + } + } + + this.registeredResourcesOutputBuffer.clear(); + } + + /** + * @brief This function is used to initialize the encoder session. + * Application must call this function to initialize the encoder, before + * starting to encode or motion estimate any frames. + */ + @Override + public void createEncoder(NV_ENC_INITIALIZE_PARAMS encoderParams) { + super.createEncoder(encoderParams); + + this.allocateOutputBuffers(this.encoderBuffer); + this.mappedOutputBuffers.resize(this.encoderBuffer, null); + } + + /** + * @brief This function is used to map the input and output buffers to NvEncodeAPI. + */ + @Override + protected void mapResources(int index) { + super.mapResources(index); + + //map output surface + NV_ENC_MAP_INPUT_RESOURCE mapInputResourceBitstreamBuffer = new NV_ENC_MAP_INPUT_RESOURCE(); + mapInputResourceBitstreamBuffer.version(NV_ENC_MAP_INPUT_RESOURCE_VER); + mapInputResourceBitstreamBuffer.registeredResource(this.registeredResourcesOutputBuffer.get(index)); + + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncMapInputResource().call(this.encoder, mapInputResourceBitstreamBuffer)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + + this.mappedOutputBuffers.set(index, new NV_ENC_OUTPUT_PTR(mapInputResourceBitstreamBuffer.mappedResource())); + } + + + public void encodeFrame(List outputBuffer) { + this.encodeFrame(outputBuffer, null); + } + + /** + * @brief This function is used to encode a frame. + * Applications must call EncodeFrame() function to encode the uncompressed + * data, which has been copied to an input buffer obtained from the + * GetNextInputFrame() function. + * This function returns video memory buffer pointers containing compressed data + * in pOutputBuffer. If there is buffering enabled, this may return without + * any data in pOutputBuffer. + */ + public void encodeFrame(List outputBuffer, NV_ENC_PIC_PARAMS picParams) { + outputBuffer.clear(); + if (!this.isHWEncoderInitialized()) { + System.err.println("Encoder device not found"); + } + + int index = this.toSend % this.encoderBuffer; + + this.mapResources(index); + + int nvStatus = this.doEncode(this.mappedInputBuffers.get(index), this.mappedOutputBuffers.get(index), picParams); + + if (nvStatus == NV_ENC_SUCCESS || nvStatus == NV_ENC_ERR_NEED_MORE_INPUT) { + this.toSend++; + this.getEncodedPacket(outputBuffer, true); + } else { + System.err.println("nvEncEncodePicture API failed"); + } + } + + /** + * @brief This function to flush the encoder queue. + * The encoder might be queuing frames for B picture encoding or lookahead; + * the application must call EndEncode() to get all the queued encoded frames + * from the encoder. The application must call this function before destroying + * an encoder session. Video memory buffer pointer containing compressed data + * is returned in pOutputBuffer. + */ + public void endEncode(List outputBuffer) { + if (!this.isHWEncoderInitialized()) { + System.err.println("Encoder device not initialized"); + } + this.sendEOS(); + + this.getEncodedPacket(outputBuffer, false); + } + + /** + * @brief This function is used to run motion estimation. + * This is used to run motion estimation on a a pair of frames. The + * application must copy the reference frame data to the buffer obtained + * by calling GetNextReferenceFrame(), and copy the input frame data to + * the buffer obtained by calling GetNextInputFrame() before calling the + * RunMotionEstimation() function. + * This function returns video memory buffer pointers containing + * motion vector data in pOutputBuffer. + */ + public void runMotionEstimation(List outputBuffer) { + outputBuffer.clear(); + + if (this.encoder != null && !this.encoder.isNull()) { + int index = this.toSend % this.encoderBuffer; + + this.mapResources(index); + + int nvStatus = this.doMotionEstimation(this.mappedInputBuffers.get(index), this.mappedRefBuffers.get(index), this.mappedOutputBuffers.get(index)); + + if (nvStatus == NV_ENC_SUCCESS) { + this.toSend++; + this.getEncodedPacket(outputBuffer, true); + } else { + System.err.println("nvEncRunMotionEstimationOnly API failed"); + } + } else { + System.err.println("Encoder Initialization failed"); + } + } + + /** + * @brief This is a private function which is used to get video memory buffer pointer containing compressed data + * or motion estimation output from the encoder HW. + * This is called by EncodeFrame() function. If there is buffering enabled, + * this may return without any output data. + */ + private void getEncodedPacket(List outputBuffer, boolean outputDelay) { + int end = outputDelay ? this.toSend - this.outputDelay : this.toSend; + + for (; this.got < end; this.got++) { + int index = this.got % this.encoderBuffer; + Pointer pointer = this.mappedOutputBuffers.get(index); + + if (pointer != null && !pointer.isNull()) { + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncUnmapInputResource().call(this.encoder, new NV_ENC_INPUT_PTR(pointer))); + } catch (NvCodecException e) { + e.printStackTrace(); + } + this.mappedOutputBuffers.set(index, null); + } + + pointer = this.mappedInputBuffers.get(index); + + if (pointer != null && !pointer.isNull()) { + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncUnmapInputResource().call(this.encoder, (NV_ENC_INPUT_PTR) pointer)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + this.mappedOutputBuffers.set(index, null); + } + + if (this.motionEstimationOnly) { + pointer = this.mappedRefBuffers.get(index); + + if (pointer != null && !pointer.isNull()) { + try { + checkNvCodecApiCall(this.nvEncodeApiFunctionList.nvEncUnmapInputResource().call(this.encoder, (NV_ENC_INPUT_PTR) pointer)); + } catch (NvCodecException e) { + e.printStackTrace(); + } + this.mappedOutputBuffers.set(index, null); + } + } + + outputBuffer.add(this.outputBuffers.get(index)); + } + } + + /** + * @brief This function is used to flush the encoder queue. + */ + private void flushEncoder() { + if (this.encoder != null && !this.encoder.isNull()) { + if (!this.motionEstimationOnly) { + List outputBuffer = new LinkedList<>(); + + this.endEncode(outputBuffer); + } + } + } + + @Override + public void destroyEncoder() { + if (this.encoder != null && !this.encoder.isNull()) { + // Incase of error it is possible for buffers still mapped to encoder. + // flush the encoder queue and then unmapped it if any surface is still mapped + this.flushEncoder(); + this.releaseOutputBuffers(); + + super.destroyEncoder(); + } + } + + @Override + public void dispose() { + this.flushEncoder(); + this.releaseOutputBuffers(); + + super.dispose(); + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/YuvConverter.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/YuvConverter.java new file mode 100644 index 00000000000..3c439b97168 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/encoder/YuvConverter.java @@ -0,0 +1,87 @@ +package org.bytedeco.nvcodec.samples.encoder; + +import org.bytedeco.javacpp.BytePointer; +import org.bytedeco.javacpp.Pointer; + +import static org.bytedeco.javacpp.Pointer.*; + +public class YuvConverter { + private BytePointer quad; + private int width; + private int height; + + private int bitDepth; + private final int byteDepth; + + public YuvConverter(int width, int height, int bitDepth) { + this.width = width; + this.height = height; + this.bitDepth = bitDepth; + this.byteDepth = bitDepth / 8; + + this.quad = new BytePointer((long) width * height / 4 * this.byteDepth); + } + + public void planarToUVInterleaved(Pointer frame) { + this.planarToUVInterleaved(frame, 0); + } + + public void planarToUVInterleaved(Pointer frame, int pitch) { + if (pitch == 0) { + pitch = this.width; + } + + Pointer puv = frame.getPointer((long) pitch * this.height); + + if (pitch == this.width) { + memcpy(this.quad, puv, ((long) this.width * this.height / 4) * this.byteDepth); + } else { + for (int i = 0; i < this.height / 2; i++) { + memcpy(this.quad.getPointer(((long) this.width / 2 * i) * this.byteDepth), puv.getPointer(((long) pitch / 2 * i) * this.byteDepth), (long) this.width / 2 * this.byteDepth); + } + } + + Pointer pv = puv.getPointer(((long) (pitch / 2) * (height / 2) * this.byteDepth)); + + + for (int y = 0; y < this.height / 2; y++) { + for (int x = 0; x < this.width / 2; x++) { + memcpy(pv.getPointer(((long) y * pitch + x * 2) * this.byteDepth), this.quad.getPointer(((long) y * this.width / 2 + x) * this.byteDepth), this.byteDepth); + + memcpy(pv.getPointer(((long) y * pitch + x * 2 + 1) * this.byteDepth), this.quad.getPointer(((long) y * pitch / 2 + x) * this.byteDepth), this.byteDepth); + } + } + + } + + public void UVInterleavedToPlanar(BytePointer frame) { + this.UVInterleavedToPlanar(frame, 0); + } + + public void UVInterleavedToPlanar(BytePointer frame, int pitch) { + if (pitch == 0) { + pitch = this.width; + } + + BytePointer puv = frame.getPointer((long) pitch * height * this.byteDepth); + BytePointer pu = new BytePointer(puv); + BytePointer pv = puv.getPointer((long) pitch * height / 4 * this.byteDepth); + + byte[] tempBuffer = new byte[this.byteDepth]; + + for (int y = 0; y < this.height / 2; y++) { + for (int x = 0; x < this.width / 2; x++) { + memcpy(pu.getPointer(((long) y * pitch / 2 + x) * this.byteDepth), puv.getPointer(((long) y * pitch + x * 2) * this.byteDepth), this.byteDepth); + memcpy(this.quad.getPointer(((long) y * width / 2 + x) * this.byteDepth), puv.getPointer(((long) y * pitch + x * 2 + 1) * this.byteDepth), this.byteDepth); + } + } + + if (pitch == this.width) { + memcpy(pv, this.quad, ((long) this.width * this.height / 4) * this.byteDepth); + } else { + for (int i = 0; i < this.height / 2; i++) { + memcpy(pv.getPointer(((long) pitch / 2 * i) * this.byteDepth), this.quad.getPointer(((long) this.width / 2 * i) * this.byteDepth), (long) this.width / 2 * this.byteDepth); + } + } + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/CudaException.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/CudaException.java new file mode 100644 index 00000000000..34f90f8e067 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/CudaException.java @@ -0,0 +1,7 @@ +package org.bytedeco.nvcodec.samples.exceptions; + +public class CudaException extends Exception { + public CudaException(int result) { + super("CUDA error number : " + result); + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/InvalidArgument.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/InvalidArgument.java new file mode 100644 index 00000000000..803c1d3596e --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/InvalidArgument.java @@ -0,0 +1,7 @@ +package org.bytedeco.nvcodec.samples.exceptions; + +public class InvalidArgument extends Exception { + public InvalidArgument(String message) { + super(message); + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/NvCodecException.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/NvCodecException.java new file mode 100644 index 00000000000..e5f2f273b13 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/exceptions/NvCodecException.java @@ -0,0 +1,11 @@ +package org.bytedeco.nvcodec.samples.exceptions; + +public class NvCodecException extends Exception { + public NvCodecException(int result) { + super("NvCodec error number : " + result); + } + + public NvCodecException(String message, int errorCode) { + super(String.format("%s (error number : %n)", errorCode)); + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/AppDecUtils.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/AppDecUtils.java new file mode 100644 index 00000000000..e3dab6dfaf0 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/AppDecUtils.java @@ -0,0 +1,194 @@ +package org.bytedeco.nvcodec.samples.util; + +import org.bytedeco.nvcodec.samples.exceptions.InvalidArgument; +import org.bytedeco.nvcodec.samples.exceptions.CudaException; +import org.bytedeco.cuda.cudart.CUctx_st; +import org.bytedeco.javacpp.IntPointer; +import org.bytedeco.nvcodec.global.nvcuvid.*; +import org.bytedeco.nvcodec.nvcuvid.CUVIDDECODECAPS; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; +import static org.bytedeco.cuda.global.cudart.*; +import static org.bytedeco.nvcodec.samples.util.CudaUtil.checkCudaApiCall; +import static java.lang.System.exit; + +public class AppDecUtils { + public static void showHelpAndExit(final String badOption, String outputFilePath, boolean verbose, int d3d) throws InvalidArgument { + StringBuilder sb = new StringBuilder(); + boolean bThrowError = false; + + if (badOption != null) { + bThrowError = true; + sb.append("Error parsing \"").append(badOption).append("\"").append("\n"); + } + + System.out.println("Options: \n" + + "-i Input file path\n" + + (outputFilePath != null ? "-o Output file path\n" : "") + + "-gpu Ordinal of GPU to use\n" + + (verbose ? "-v Verbose message\n" : "") + + (d3d != 0 ? "-d3d 9 (default): display with D3D9; 11: display with D3D11\n" : "")); + + if (bThrowError) { + throw new InvalidArgument(sb.toString()); + } else { + System.out.println(sb.toString()); + exit(0); + } + } + + public static void parseCommandLine(int argc, String[] argv, String inputFilePath, String outputFilePath, int gpu, boolean verbose, int d3d) throws InvalidArgument { + int i; + for (i = 1; i < argc; i++) { + if (argv[i].equals("-h")) { + showHelpAndExit(null, outputFilePath, verbose, d3d); + } + if (argv[i].equals("-i")) { + if (++i == argc) { + showHelpAndExit("-i", outputFilePath, verbose, d3d); + } + inputFilePath = argv[i]; + continue; + } + if (argv[i].equals("-o")) { + if (++i == argc || outputFilePath == null) { + showHelpAndExit("-o", outputFilePath, verbose, d3d); + } + outputFilePath = argv[i]; + continue; + } + if (argv[i].equals("-gpu")) { + if (++i == argc) { + showHelpAndExit("-gpu", outputFilePath, verbose, d3d); + } + gpu = Integer.parseInt(argv[i]); + continue; + } + if (argv[i].equals("-v")) { + if (!verbose) { + showHelpAndExit("-v", outputFilePath, verbose, d3d); + } + + verbose = true; + continue; + } + if (argv[i].equals("-d3d")) { + if (++i == argc || d3d == 0) { + showHelpAndExit("-d3d", outputFilePath, verbose, d3d); + } + + d3d = Integer.parseInt(argv[i]); + continue; + } + + showHelpAndExit(argv[i], outputFilePath, verbose, d3d); + } + } + + /** + * @param outputFormatMask - Bit mask to represent supported cudaVideoSurfaceFormat in decoder + * @param outputFormats - Variable into which output string is written + * @brief Function to generate space-separated list of supported video surface formats + */ + public static String getOutputFormatNames(short outputFormatMask, String outputFormats) { + if (outputFormatMask == 0) { + outputFormats = "N/A"; + } else { + if ((outputFormatMask & (1 << cudaVideoSurfaceFormat_NV12)) != 0) { + outputFormats += "NV12 "; + } + + if ((outputFormatMask & (1 << cudaVideoSurfaceFormat_P016)) != 0) { + outputFormats += "P016 "; + } + + if ((outputFormatMask & (1 << cudaVideoSurfaceFormat_YUV444)) != 0) { + outputFormats += "YUV444 "; + } + + if ((outputFormatMask & (1 << cudaVideoSurfaceFormat_YUV444_16Bit)) != 0) { + outputFormats += "YUV444P16 "; + } + } + return outputFormats; + } + + public static void createCudaContext(CUctx_st cuContext, int gpu, int flags) { + IntPointer cuDevice = new IntPointer(1); + try { + checkCudaApiCall(cuDeviceGet(cuDevice, gpu)); + + byte[] szDeviceName = new byte[80]; + + checkCudaApiCall(cuDeviceGetName(szDeviceName, szDeviceName.length, cuDevice.get())); + + System.out.println("GPU in use: " + new String(szDeviceName)); + + checkCudaApiCall(cuCtxCreate(cuContext, flags, cuDevice.get())); + } catch (CudaException e) { + e.printStackTrace(); + } + } + + /** + * @brief Print decoder capabilities on std::cout + */ + public static void showDecoderCapability() { + try { + checkCudaApiCall(cuInit(0)); + + IntPointer gpuCount = new IntPointer(1); + + checkCudaApiCall(cuDeviceGetCount(gpuCount)); + System.out.println("Decoder Capability\n\n"); + + final String[] aszCodecName = { + "JPEG", "MPEG1", "MPEG2", "MPEG4", "H264", "HEVC", "HEVC", "HEVC", "HEVC", "HEVC", "HEVC", "VC1", "VP8", "VP9", "VP9", "VP9" + }; + final String[] aszChromaFormat = { + "4:0:0", "4:2:0", "4:2:2", "4:4:4" + }; + + char[] strOutputFormats = new char[64]; + + int aeCodec[] = {cudaVideoCodec_JPEG, cudaVideoCodec_MPEG1, cudaVideoCodec_MPEG2, cudaVideoCodec_MPEG4, cudaVideoCodec_H264, cudaVideoCodec_HEVC, + cudaVideoCodec_HEVC, cudaVideoCodec_HEVC, cudaVideoCodec_HEVC, cudaVideoCodec_HEVC, cudaVideoCodec_HEVC, cudaVideoCodec_VC1, cudaVideoCodec_VP8, + cudaVideoCodec_VP9, cudaVideoCodec_VP9, cudaVideoCodec_VP9}; + int anBitDepthMinus8[] = {0, 0, 0, 0, 0, 0, 2, 4, 0, 2, 4, 0, 0, 0, 2, 4}; + + int aeChromaFormat[] = {cudaVideoChromaFormat_420, cudaVideoChromaFormat_420, cudaVideoChromaFormat_420, cudaVideoChromaFormat_420, + cudaVideoChromaFormat_420, cudaVideoChromaFormat_420, cudaVideoChromaFormat_420, cudaVideoChromaFormat_420, cudaVideoChromaFormat_444, cudaVideoChromaFormat_444, + cudaVideoChromaFormat_444, cudaVideoChromaFormat_420, cudaVideoChromaFormat_420, cudaVideoChromaFormat_420, cudaVideoChromaFormat_420, cudaVideoChromaFormat_420}; + + for (int gpu = 0; gpu < gpuCount.get(); gpu++) { + + CUctx_st cuContext = new CUctx_st(); + createCudaContext(cuContext, gpu, 0); + + for (int i = 0; i < aeCodec.length; i++) { + CUVIDDECODECAPS decodeCaps = new CUVIDDECODECAPS(); + decodeCaps.eCodecType(aeCodec[i]); + decodeCaps.eChromaFormat(aeChromaFormat[i]); + decodeCaps.nBitDepthMinus8(anBitDepthMinus8[i]); + + cuvidGetDecoderCaps(decodeCaps); + + strOutputFormats[0] = '\0'; + + String outputFormats = getOutputFormatNames(decodeCaps.nOutputFormatMask(), new String(strOutputFormats)); + + // setw() width = maximum_width_of_string + 2 spaces + System.out.printf("Codec %-7s BitDepth %-4d ChromaFormat %-7s Supported %-3d MaxWidth %-7d MaxHeight %-7d MaxMBCount %-10d MinWidth %-5d MinHeight %-5d SurfaceFormat %-11s", + aszCodecName[i], decodeCaps.nBitDepthMinus8() + 8, aszChromaFormat[decodeCaps.eChromaFormat()], decodeCaps.bIsSupported(), decodeCaps.nMaxWidth(), decodeCaps.nMaxHeight(), + decodeCaps.nMaxMBCount(), decodeCaps.nMinWidth(), decodeCaps.nMinHeight(), outputFormats); + } + + System.out.println(); + + checkCudaApiCall(cuCtxDestroy(cuContext)); + } + } catch (CudaException e) { + e.printStackTrace(); + } + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/CudaUtil.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/CudaUtil.java new file mode 100644 index 00000000000..c729b6c8b01 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/CudaUtil.java @@ -0,0 +1,11 @@ +package org.bytedeco.nvcodec.samples.util; + +import org.bytedeco.nvcodec.samples.exceptions.CudaException; + +public class CudaUtil { + public static void checkCudaApiCall(int result) throws CudaException { + if (result != 0) { + throw new CudaException(result); + } + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/Dimension.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/Dimension.java new file mode 100644 index 00000000000..040abc2d2ea --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/Dimension.java @@ -0,0 +1,31 @@ +package org.bytedeco.nvcodec.samples.util; + +public class Dimension { + private int width; + private int height; + + public Dimension() { + this(0, 0); + } + + public Dimension(int width, int height) { + this.width = width; + this.height = height; + } + + public int getWidth() { + return width; + } + + public void setWidth(int width) { + this.width = width; + } + + public int getHeight() { + return height; + } + + public void setHeight(int height) { + this.height = height; + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/NvCodecUtil.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/NvCodecUtil.java new file mode 100644 index 00000000000..e8d15ac2cf5 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/NvCodecUtil.java @@ -0,0 +1,74 @@ +package org.bytedeco.nvcodec.samples.util; + +import org.jcodec.common.Codec; +import org.bytedeco.nvcodec.samples.exceptions.InvalidArgument; +import org.bytedeco.nvcodec.samples.exceptions.NvCodecException; +import org.bytedeco.nvcodec.nvencodeapi.GUID; + +import java.io.FileInputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import static org.bytedeco.cuda.global.cudart.CUDA_SUCCESS; +import static org.bytedeco.nvcodec.global.nvcuvid.*; +import static org.jcodec.common.Codec.*; + +public class NvCodecUtil { + public static void checkNvCodecApiCall(int result) throws NvCodecException { + if (result != CUDA_SUCCESS) { + throw new NvCodecException(result); + } + } + + public static boolean checkInputFile(String inFilePath) { + try (FileInputStream inputFileStream = new FileInputStream(inFilePath)) { + if (0 < inputFileStream.available()) { + return true; + } + } catch (IOException e) { + e.printStackTrace(); + } + + return false; + } + + public static void validateResolution(int width, int height) throws InvalidArgument { + if (width <= 0 || height <= 0) { + StringBuilder sb = new StringBuilder(); + sb.append("Please specify positive non zero resolution as -s WxH. Current resolution is ").append(width).append("x").append(height).append("\n"); + + throw new InvalidArgument(sb.toString()); + } + } + + public final static Map codecs = new HashMap(); + + static { + codecs.put(H264, cudaVideoCodec_H264); + codecs.put(MPEG2, cudaVideoCodec_MPEG2); + codecs.put(MPEG4, cudaVideoCodec_MPEG4); + codecs.put(VC1, cudaVideoCodec_VC1); + codecs.put(JPEG, cudaVideoCodec_JPEG); + codecs.put(VP8, cudaVideoCodec_VP8); + codecs.put(VP9, cudaVideoCodec_VP9); + } + + public static Integer convertToNvCodec(Codec codec) throws NvCodecException { + Integer nvCodec = codecs.get(codec); + + if (nvCodec == null) { + throw new NvCodecException(String.format("%s codec not supported on NvCodec. %n", codec.name()), -1); + } + + return nvCodec; + } + + public static boolean compareGUID(GUID guid1, GUID guid2) { + if (guid1.Data1() == guid2.Data1() && guid1.Data2() == guid2.Data2() && guid1.Data3() == guid2.Data3()) { + return true; + } + + return false; + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/Rectangle.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/Rectangle.java new file mode 100644 index 00000000000..9c8abf06747 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/Rectangle.java @@ -0,0 +1,51 @@ +package org.bytedeco.nvcodec.samples.util; + +public class Rectangle { + private int top; + private int left; + private int right; + private int bottom; + + public Rectangle() { + this(0, 0, 0, 0); + } + + public Rectangle(int top, int left, int right, int bottom) { + this.top = top; + this.left = left; + this.right = right; + this.bottom = bottom; + } + + public int getTop() { + return top; + } + + public void setTop(int top) { + this.top = top; + } + + public int getLeft() { + return left; + } + + public void setLeft(int left) { + this.left = left; + } + + public int getRight() { + return right; + } + + public void setRight(int right) { + this.right = right; + } + + public int getBottom() { + return bottom; + } + + public void setBottom(int bottom) { + this.bottom = bottom; + } +} diff --git a/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/VectorEx.java b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/VectorEx.java new file mode 100644 index 00000000000..18bc730cba9 --- /dev/null +++ b/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/util/VectorEx.java @@ -0,0 +1,13 @@ +package org.bytedeco.nvcodec.samples.util; + +import java.util.Vector; + +public class VectorEx extends Vector { + public void resize(int size, T defaultValue) { + int expendCapacity = size - this.size(); + + for (int index = 0; index < expendCapacity; index++) { + this.add(defaultValue); + } + } +} diff --git a/nvcodec/samples/src/main/resources/build.bat b/nvcodec/samples/src/main/resources/build.bat new file mode 100644 index 00000000000..5c43f8a740a --- /dev/null +++ b/nvcodec/samples/src/main/resources/build.bat @@ -0,0 +1,2 @@ +nvcc -ptx crc.cu +pause \ No newline at end of file diff --git a/nvcodec/samples/src/main/resources/crc.cu b/nvcodec/samples/src/main/resources/crc.cu new file mode 100644 index 00000000000..757e15d4add --- /dev/null +++ b/nvcodec/samples/src/main/resources/crc.cu @@ -0,0 +1,114 @@ +/* +* Copyright 2018-2020 NVIDIA Corporation. All rights reserved. +* +* Please refer to the NVIDIA end user license agreement (EULA) associated +* with this source code for terms and conditions that govern your use of +* this software. Any use, reproduction, disclosure, or distribution of +* this software and related documentation outside the terms of the EULA +* is strictly prohibited. +* +*/ + +/* +* CRC32 lookup table +* Generated by the following routine +* int i, j; +* U032 crc; +* for (i = 0; i < 256; i++) +* { +* crc = i; +* for (j = 0; j < 8; j++) { // 8 reduction +* crc = (crc >> 1) ^ ((crc & 1) ? 0xEDB88320L : 0); +* } +* Crc32Table[i] = crc; +* } + */ +__device__ __constant__ unsigned int Crc32Table[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +typedef struct _NV_ENC_ENCODE_OUT_PARAMS +{ + unsigned int version; /**< [out]: Struct version. */ + unsigned int bitstreamSizeInBytes; /**< [out]: Encoded bitstream size in bytes */ + unsigned int cycleCount; /**< [out]: Cycle count */ + unsigned int firstPassCycleCount; /**< [out]: First pass cycle count */ + unsigned int reserved[60]; /**< [out]: Reserved and must be set to 0 */ +} NV_ENC_ENCODE_OUT_PARAMS; + +__global__ void ComputeCRCKernel(unsigned char* pBuffer, unsigned int *crcValue) +{ + NV_ENC_ENCODE_OUT_PARAMS *outParams = (NV_ENC_ENCODE_OUT_PARAMS *)pBuffer; + unsigned int bitstreamSize = outParams->bitstreamSizeInBytes; + unsigned char *pEncStream = pBuffer + sizeof(NV_ENC_ENCODE_OUT_PARAMS); + unsigned int crc=~0; + for(unsigned int i = 0; i < bitstreamSize; i++) + { + crc = (crc >> 8) ^ Crc32Table[((unsigned char)(crc)) ^ (*pEncStream++)]; + } + + *crcValue = ~crc; +} \ No newline at end of file diff --git a/nvcodec/samples/src/main/resources/crc.ptx b/nvcodec/samples/src/main/resources/crc.ptx new file mode 100644 index 00000000000..44078983f8a --- /dev/null +++ b/nvcodec/samples/src/main/resources/crc.ptx @@ -0,0 +1,148 @@ +// +// Generated by NVIDIA NVVM Compiler +// +// Compiler Build ID: CL-29190527 +// Cuda compilation tools, release 11.1, V11.1.105 +// Based on LLVM 3.4svn +// + +.version 7.1 +.target sm_52 +.address_size 64 + + // .globl _Z16ComputeCRCKernelPhPj +.const .align 4 .b8 Crc32Table[1024] = {0, 0, 0, 0, 150, 48, 7, 119, 44, 97, 14, 238, 186, 81, 9, 153, 25, 196, 109, 7, 143, 244, 106, 112, 53, 165, 99, 233, 163, 149, 100, 158, 50, 136, 219, 14, 164, 184, 220, 121, 30, 233, 213, 224, 136, 217, 210, 151, 43, 76, 182, 9, 189, 124, 177, 126, 7, 45, 184, 231, 145, 29, 191, 144, 100, 16, 183, 29, 242, 32, 176, 106, 72, 113, 185, 243, 222, 65, 190, 132, 125, 212, 218, 26, 235, 228, 221, 109, 81, 181, 212, 244, 199, 133, 211, 131, 86, 152, 108, 19, 192, 168, 107, 100, 122, 249, 98, 253, 236, 201, 101, 138, 79, 92, 1, 20, 217, 108, 6, 99, 99, 61, 15, 250, 245, 13, 8, 141, 200, 32, 110, 59, 94, 16, 105, 76, 228, 65, 96, 213, 114, 113, 103, 162, 209, 228, 3, 60, 71, 212, 4, 75, 253, 133, 13, 210, 107, 181, 10, 165, 250, 168, 181, 53, 108, 152, 178, 66, 214, 201, 187, 219, 64, 249, 188, 172, 227, 108, 216, 50, 117, 92, 223, 69, 207, 13, 214, 220, 89, 61, 209, 171, 172, 48, 217, 38, 58, 0, 222, 81, 128, 81, 215, 200, 22, 97, 208, 191, 181, 244, 180, 33, 35, 196, 179, 86, 153, 149, 186, 207, 15, 165, 189, 184, 158, 184, 2, 40, 8, 136, 5, 95, 178, 217, 12, 198, 36, 233, 11, 177, 135, 124, 111, 47, 17, 76, 104, 88, 171, 29, 97, 193, 61, 45, 102, 182, 144, 65, 220, 118, 6, 113, 219, 1, 188, 32, 210, 152, 42, 16, 213, 239, 137, 133, 177, 113, 31, 181, 182, 6, 165, 228, 191, 159, 51, 212, 184, 232, 162, 201, 7, 120, 52, 249, 0, 15, 142, 168, 9, 150, 24, 152, 14, 225, 187, 13, 106, 127, 45, 61, 109, 8, 151, 108, 100, 145, 1, 92, 99, 230, 244, 81, 107, 107, 98, 97, 108, 28, 216, 48, 101, 133, 78, 0, 98, 242, 237, 149, 6, 108, 123, 165, 1, 27, 193, 244, 8, 130, 87, 196, 15, 245, 198, 217, 176, 101, 80, 233, 183, 18, 234, 184, 190, 139, 124, 136, 185, 252, 223, 29, 221, 98, 73, 45, 218, 21, 243, 124, 211, 140, 101, 76, 212, 251, 88, 97, 178, 77, 206, 81, 181, 58, 116, 0, 188, 163, 226, 48, 187, 212, 65, 165, 223, 74, 215, 149, 216, 61, 109, 196, 209, 164, 251, 244, 214, 211, 106, 233, 105, 67, 252, 217, 110, 52, 70, 136, 103, 173, 208, 184, 96, 218, 115, 45, 4, 68, 229, 29, 3, 51, 95, 76, 10, 170, 201, 124, 13, 221, 60, 113, 5, 80, 170, 65, 2, 39, 16, 16, 11, 190, 134, 32, 12, 201, 37, 181, 104, 87, 179, 133, 111, 32, 9, 212, 102, 185, 159, 228, 97, 206, 14, 249, 222, 94, 152, 201, 217, 41, 34, 152, 208, 176, 180, 168, 215, 199, 23, 61, 179, 89, 129, 13, 180, 46, 59, 92, 189, 183, 173, 108, 186, 192, 32, 131, 184, 237, 182, 179, 191, 154, 12, 226, 182, 3, 154, 210, 177, 116, 57, 71, 213, 234, 175, 119, 210, 157, 21, 38, 219, 4, 131, 22, 220, 115, 18, 11, 99, 227, 132, 59, 100, 148, 62, 106, 109, 13, 168, 90, 106, 122, 11, 207, 14, 228, 157, 255, 9, 147, 39, 174, 0, 10, 177, 158, 7, 125, 68, 147, 15, 240, 210, 163, 8, 135, 104, 242, 1, 30, 254, 194, 6, 105, 93, 87, 98, 247, 203, 103, 101, 128, 113, 54, 108, 25, 231, 6, 107, 110, 118, 27, 212, 254, 224, 43, 211, 137, 90, 122, 218, 16, 204, 74, 221, 103, 111, 223, 185, 249, 249, 239, 190, 142, 67, 190, 183, 23, 213, 142, 176, 96, 232, 163, 214, 214, 126, 147, 209, 161, 196, 194, 216, 56, 82, 242, 223, 79, 241, 103, 187, 209, 103, 87, 188, 166, 221, 6, 181, 63, 75, 54, 178, 72, 218, 43, 13, 216, 76, 27, 10, 175, 246, 74, 3, 54, 96, 122, 4, 65, 195, 239, 96, 223, 85, 223, 103, 168, 239, 142, 110, 49, 121, 190, 105, 70, 140, 179, 97, 203, 26, 131, 102, 188, 160, 210, 111, 37, 54, 226, 104, 82, 149, 119, 12, 204, 3, 71, 11, 187, 185, 22, 2, 34, 47, 38, 5, 85, 190, 59, 186, 197, 40, 11, 189, 178, 146, 90, 180, 43, 4, 106, 179, 92, 167, 255, 215, 194, 49, 207, 208, 181, 139, 158, 217, 44, 29, 174, 222, 91, 176, 194, 100, 155, 38, 242, 99, 236, 156, 163, 106, 117, 10, 147, 109, 2, 169, 6, 9, 156, 63, 54, 14, 235, 133, 103, 7, 114, 19, 87, 0, 5, 130, 74, 191, 149, 20, 122, 184, 226, 174, 43, 177, 123, 56, 27, 182, 12, 155, 142, 210, 146, 13, 190, 213, 229, 183, 239, 220, 124, 33, 223, 219, 11, 212, 210, 211, 134, 66, 226, 212, 241, 248, 179, 221, 104, 110, 131, 218, 31, 205, 22, 190, 129, 91, 38, 185, 246, 225, 119, 176, 111, 119, 71, 183, 24, 230, 90, 8, 136, 112, 106, 15, 255, 202, 59, 6, 102, 92, 11, 1, 17, 255, 158, 101, 143, 105, 174, 98, 248, 211, 255, 107, 97, 69, 207, 108, 22, 120, 226, 10, 160, 238, 210, 13, 215, 84, 131, 4, 78, 194, 179, 3, 57, 97, 38, 103, 167, 247, 22, 96, 208, 77, 71, 105, 73, 219, 119, 110, 62, 74, 106, 209, 174, 220, 90, 214, 217, 102, 11, 223, 64, 240, 59, 216, 55, 83, 174, 188, 169, 197, 158, 187, 222, 127, 207, 178, 71, 233, 255, 181, 48, 28, 242, 189, 189, 138, 194, 186, 202, 48, 147, 179, 83, 166, 163, 180, 36, 5, 54, 208, 186, 147, 6, 215, 205, 41, 87, 222, 84, 191, 103, 217, 35, 46, 122, 102, 179, 184, 74, 97, 196, 2, 27, 104, 93, 148, 43, 111, 42, 55, 190, 11, 180, 161, 142, 12, 195, 27, 223, 5, 90, 141, 239, 2, 45}; + +.visible .entry _Z16ComputeCRCKernelPhPj( + .param .u64 _Z16ComputeCRCKernelPhPj_param_0, + .param .u64 _Z16ComputeCRCKernelPhPj_param_1 +) +{ + .reg .pred %p<7>; + .reg .b32 %r<75>; + .reg .b64 %rd<40>; + + + ld.param.u64 %rd11, [_Z16ComputeCRCKernelPhPj_param_0]; + ld.param.u64 %rd12, [_Z16ComputeCRCKernelPhPj_param_1]; + cvta.to.global.u64 %rd1, %rd11; + ld.global.u32 %r1, [%rd1+4]; + setp.eq.s32 %p1, %r1, 0; + mov.u32 %r74, 0; + @%p1 bra BB0_13; + + add.s64 %rd36, %rd1, 256; + and.b32 %r28, %r1, 3; + mov.u32 %r65, -1; + mov.u32 %r64, 1; + mov.u32 %r71, 0; + setp.eq.s32 %p2, %r28, 0; + @%p2 bra BB0_2; + + setp.eq.s32 %p3, %r28, 1; + @%p3 bra BB0_4; + bra.uni BB0_5; + +BB0_4: + mov.u32 %r64, %r71; + bra.uni BB0_8; + +BB0_2: + mov.u32 %r73, %r71; + bra.uni BB0_9; + +BB0_5: + setp.eq.s32 %p4, %r28, 2; + @%p4 bra BB0_7; + + ld.global.u8 %rd14, [%rd1+256]; + xor.b64 %rd15, %rd14, 255; + shl.b64 %rd16, %rd15, 2; + mov.u64 %rd17, Crc32Table; + add.s64 %rd18, %rd17, %rd16; + ld.const.u32 %r30, [%rd18]; + xor.b32 %r65, %r30, 16777215; + add.s64 %rd36, %rd1, 257; + mov.u32 %r64, 2; + +BB0_7: + ld.global.u8 %r31, [%rd36]; + and.b32 %r32, %r65, 255; + xor.b32 %r33, %r31, %r32; + mul.wide.u32 %rd20, %r33, 4; + mov.u64 %rd21, Crc32Table; + add.s64 %rd22, %rd21, %rd20; + ld.const.u32 %r34, [%rd22]; + shr.u32 %r35, %r65, 8; + xor.b32 %r65, %r34, %r35; + add.s64 %rd36, %rd36, 1; + +BB0_8: + ld.global.u8 %r36, [%rd36]; + and.b32 %r37, %r65, 255; + xor.b32 %r38, %r36, %r37; + mul.wide.u32 %rd23, %r38, 4; + mov.u64 %rd24, Crc32Table; + add.s64 %rd25, %rd24, %rd23; + ld.const.u32 %r39, [%rd25]; + shr.u32 %r40, %r65, 8; + xor.b32 %r65, %r39, %r40; + add.s64 %rd36, %rd36, 1; + add.s32 %r71, %r64, 1; + mov.u32 %r73, %r65; + +BB0_9: + setp.lt.u32 %p5, %r1, 4; + @%p5 bra BB0_12; + + mov.u32 %r73, %r65; + +BB0_11: + ld.global.u8 %r41, [%rd36]; + and.b32 %r42, %r73, 255; + xor.b32 %r43, %r41, %r42; + mul.wide.u32 %rd26, %r43, 4; + mov.u64 %rd27, Crc32Table; + add.s64 %rd28, %rd27, %rd26; + ld.const.u32 %r44, [%rd28]; + shr.u32 %r45, %r73, 8; + xor.b32 %r46, %r44, %r45; + shr.u32 %r47, %r46, 8; + and.b32 %r48, %r46, 255; + ld.global.u8 %r49, [%rd36+1]; + xor.b32 %r50, %r49, %r48; + mul.wide.u32 %rd29, %r50, 4; + add.s64 %rd30, %rd27, %rd29; + ld.const.u32 %r51, [%rd30]; + xor.b32 %r52, %r51, %r47; + shr.u32 %r53, %r52, 8; + and.b32 %r54, %r52, 255; + ld.global.u8 %r55, [%rd36+2]; + xor.b32 %r56, %r55, %r54; + mul.wide.u32 %rd31, %r56, 4; + add.s64 %rd32, %rd27, %rd31; + ld.const.u32 %r57, [%rd32]; + xor.b32 %r58, %r57, %r53; + shr.u32 %r59, %r58, 8; + and.b32 %r60, %r58, 255; + ld.global.u8 %r61, [%rd36+3]; + xor.b32 %r62, %r61, %r60; + mul.wide.u32 %rd33, %r62, 4; + add.s64 %rd34, %rd27, %rd33; + ld.const.u32 %r63, [%rd34]; + xor.b32 %r73, %r63, %r59; + add.s32 %r71, %r71, 4; + setp.lt.u32 %p6, %r71, %r1; + add.s64 %rd36, %rd36, 4; + @%p6 bra BB0_11; + +BB0_12: + not.b32 %r74, %r73; + +BB0_13: + cvta.to.global.u64 %rd35, %rd12; + st.global.u32 [%rd35], %r74; + ret; +} + + diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/global/nvcuvid.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/global/nvcuvid.java new file mode 100644 index 00000000000..175685eb851 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/global/nvcuvid.java @@ -0,0 +1,683 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.global; + +import org.bytedeco.nvcodec.nvcuvid.*; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +public class nvcuvid extends org.bytedeco.nvcodec.presets.nvcuvid { + static { Loader.load(); } + +// Parsed from cuviddec.h + +/* + * This copyright notice applies to this header file only: + * + * Copyright (c) 2010-2020 NVIDIA Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the software, and to permit persons to whom the + * software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/*****************************************************************************************************/ +/** \file cuviddec.h +/** NVDECODE API provides video decoding interface to NVIDIA GPU devices. +/** This file contains constants, structure definitions and function prototypes used for decoding. +/*****************************************************************************************************/ + +// #if !defined(__CUDA_VIDEO_H__) */ +// #define __CUDA_VIDEO_H__ + +// #ifndef __cuda_cuda_h__ +// #include +// #endif // __cuda_cuda_h__ + +// #if defined(_WIN64) || defined(__LP64__) || defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) +// #if (CUDA_VERSION >= 3020) && (!defined(CUDA_FORCE_API_VERSION) || (CUDA_FORCE_API_VERSION >= 3020)) +// #define __CUVID_DEVPTR64 +// #endif +// #endif + +// #if defined(__cplusplus) +// Targeting ../nvcuvid/CUvideodecoder.java + + +// Targeting ../nvcuvid/_CUcontextlock_st.java + + + +/*********************************************************************************/ +/** \enum cudaVideoCodec +/** Video codec enums +/** These enums are used in CUVIDDECODECREATEINFO and CUVIDDECODECAPS structures +/*********************************************************************************/ +/** enum cudaVideoCodec_enum */ +public static final int + /** MPEG1 */ + cudaVideoCodec_MPEG1 = 0, + /** MPEG2 */ + cudaVideoCodec_MPEG2 = 1, + /** MPEG4 */ + cudaVideoCodec_MPEG4 = 2, + /** VC1 */ + cudaVideoCodec_VC1 = 3, + /** H264 */ + cudaVideoCodec_H264 = 4, + /** JPEG */ + cudaVideoCodec_JPEG = 5, + /** H264-SVC */ + cudaVideoCodec_H264_SVC = 6, + /** H264-MVC */ + cudaVideoCodec_H264_MVC = 7, + /** HEVC */ + cudaVideoCodec_HEVC = 8, + /** VP8 */ + cudaVideoCodec_VP8 = 9, + /** VP9 */ + cudaVideoCodec_VP9 = 10, + /** AV1 */ + cudaVideoCodec_AV1 = 11, + /** Max codecs */ + cudaVideoCodec_NumCodecs = 12, + // Uncompressed YUV + /** Y,U,V (4:2:0) */ + cudaVideoCodec_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V')), + /** Y,V,U (4:2:0) */ + cudaVideoCodec_YV12 = (('Y'<<24)|('V'<<16)|('1'<<8)|('2')), + /** Y,UV (4:2:0) */ + cudaVideoCodec_NV12 = (('N'<<24)|('V'<<16)|('1'<<8)|('2')), + /** YUYV/YUY2 (4:2:2) */ + cudaVideoCodec_YUYV = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V')), + /** UYVY (4:2:2) */ + cudaVideoCodec_UYVY = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y')); + +/*********************************************************************************/ +/** \enum cudaVideoSurfaceFormat +/** Video surface format enums used for output format of decoded output +/** These enums are used in CUVIDDECODECREATEINFO structure +/*********************************************************************************/ +/** enum cudaVideoSurfaceFormat_enum */ +public static final int + /** Semi-Planar YUV [Y plane followed by interleaved UV plane] */ + cudaVideoSurfaceFormat_NV12 = 0, + /** 16 bit Semi-Planar YUV [Y plane followed by interleaved UV plane]. + Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */ + cudaVideoSurfaceFormat_P016 = 1, + /** Planar YUV [Y plane followed by U and V planes] */ + cudaVideoSurfaceFormat_YUV444 = 2, + /** 16 bit Planar YUV [Y plane followed by U and V planes]. + Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */ + cudaVideoSurfaceFormat_YUV444_16Bit = 3; + +/******************************************************************************************************************/ +/** \enum cudaVideoDeinterlaceMode +/** Deinterlacing mode enums +/** These enums are used in CUVIDDECODECREATEINFO structure +/** Use cudaVideoDeinterlaceMode_Weave for progressive content and for content that doesn't need deinterlacing +/** cudaVideoDeinterlaceMode_Adaptive needs more video memory than other DImodes +/******************************************************************************************************************/ +/** enum cudaVideoDeinterlaceMode_enum */ +public static final int + /** Weave both fields (no deinterlacing) */ + cudaVideoDeinterlaceMode_Weave = 0, + /** Drop one field */ + cudaVideoDeinterlaceMode_Bob = 1, + /** Adaptive deinterlacing */ + cudaVideoDeinterlaceMode_Adaptive = 2; + +/**************************************************************************************************************/ +/** \enum cudaVideoChromaFormat +/** Chroma format enums +/** These enums are used in CUVIDDECODECREATEINFO and CUVIDDECODECAPS structures +/**************************************************************************************************************/ +/** enum cudaVideoChromaFormat_enum */ +public static final int + /** MonoChrome */ + cudaVideoChromaFormat_Monochrome = 0, + /** YUV 4:2:0 */ + cudaVideoChromaFormat_420 = 1, + /** YUV 4:2:2 */ + cudaVideoChromaFormat_422 = 2, + /** YUV 4:4:4 */ + cudaVideoChromaFormat_444 = 3; + +/*************************************************************************************************************/ +/** \enum cudaVideoCreateFlags +/** Decoder flag enums to select preferred decode path +/** cudaVideoCreate_Default and cudaVideoCreate_PreferCUVID are most optimized, use these whenever possible +/*************************************************************************************************************/ +/** enum cudaVideoCreateFlags_enum */ +public static final int + /** Default operation mode: use dedicated video engines */ + cudaVideoCreate_Default = 0x00, + /** Use CUDA-based decoder (requires valid vidLock object for multi-threading) */ + cudaVideoCreate_PreferCUDA = 0x01, + /** Go through DXVA internally if possible (requires D3D9 interop) */ + cudaVideoCreate_PreferDXVA = 0x02, + /** Use dedicated video engines directly */ + cudaVideoCreate_PreferCUVID = 0x04; + + +/*************************************************************************/ +/** \enum cuvidDecodeStatus +/** Decode status enums +/** These enums are used in CUVIDGETDECODESTATUS structure +/*************************************************************************/ +/** enum cuvidDecodeStatus_enum */ +public static final int + cuvidDecodeStatus_Invalid = 0, // Decode status is not valid + cuvidDecodeStatus_InProgress = 1, // Decode is in progress + cuvidDecodeStatus_Success = 2, // Decode is completed without any errors + // 3 to 7 enums are reserved for future use + cuvidDecodeStatus_Error = 8, // Decode is completed with an error (error is not concealed) + cuvidDecodeStatus_Error_Concealed = 9; // Decode is completed with an error and error is concealed +// Targeting ../nvcuvid/CUVIDDECODECAPS.java + + +// Targeting ../nvcuvid/CUVIDDECODECREATEINFO.java + + +// Targeting ../nvcuvid/CUVIDH264DPBENTRY.java + + +// Targeting ../nvcuvid/CUVIDH264MVCEXT.java + + +// Targeting ../nvcuvid/CUVIDH264SVCEXT.java + + +// Targeting ../nvcuvid/CUVIDH264PICPARAMS.java + + +// Targeting ../nvcuvid/CUVIDMPEG2PICPARAMS.java + + + +// MPEG-4 has VOP types instead of Picture types +public static final int I_VOP = 0; +public static final int P_VOP = 1; +public static final int B_VOP = 2; +public static final int S_VOP = 3; +// Targeting ../nvcuvid/CUVIDMPEG4PICPARAMS.java + + +// Targeting ../nvcuvid/CUVIDVC1PICPARAMS.java + + +// Targeting ../nvcuvid/CUVIDJPEGPICPARAMS.java + + +// Targeting ../nvcuvid/CUVIDHEVCPICPARAMS.java + + +// Targeting ../nvcuvid/CUVIDVP8PICPARAMS.java + + +// Targeting ../nvcuvid/CUVIDVP9PICPARAMS.java + + +// Targeting ../nvcuvid/CUVIDAV1PICPARAMS.java + + +// Targeting ../nvcuvid/CUVIDPICPARAMS.java + + +// Targeting ../nvcuvid/CUVIDPROCPARAMS.java + + +// Targeting ../nvcuvid/CUVIDGETDECODESTATUS.java + + +// Targeting ../nvcuvid/CUVIDRECONFIGUREDECODERINFO.java + + + + +/***********************************************************************************************************/ +/** VIDEO_DECODER +/** +/** In order to minimize decode latencies, there should be always at least 2 pictures in the decode +/** queue at any time, in order to make sure that all decode engines are always busy. +/** +/** Overall data flow: +/** - cuvidGetDecoderCaps(...) +/** - cuvidCreateDecoder(...) +/** - For each picture: +/** + cuvidDecodePicture(N) +/** + cuvidMapVideoFrame(N-4) +/** + do some processing in cuda +/** + cuvidUnmapVideoFrame(N-4) +/** + cuvidDecodePicture(N+1) +/** + cuvidMapVideoFrame(N-3) +/** + ... +/** - cuvidDestroyDecoder(...) +/** +/** NOTE: +/** - When the cuda context is created from a D3D device, the D3D device must also be created +/** with the D3DCREATE_MULTITHREADED flag. +/** - There is a limit to how many pictures can be mapped simultaneously (ulNumOutputSurfaces) +/** - cuvidDecodePicture may block the calling thread if there are too many pictures pending +/** in the decode queue +/***********************************************************************************************************/ + + +/**********************************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidGetDecoderCaps(CUVIDDECODECAPS *pdc) +/** Queries decode capabilities of NVDEC-HW based on CodecType, ChromaFormat and BitDepthMinus8 parameters. +/** 1. Application fills IN parameters CodecType, ChromaFormat and BitDepthMinus8 of CUVIDDECODECAPS structure +/** 2. On calling cuvidGetDecoderCaps, driver fills OUT parameters if the IN parameters are supported +/** If IN parameters passed to the driver are not supported by NVDEC-HW, then all OUT params are set to 0. +/** E.g. on Geforce GTX 960: +/** App fills - eCodecType = cudaVideoCodec_H264; eChromaFormat = cudaVideoChromaFormat_420; nBitDepthMinus8 = 0; +/** Given IN parameters are supported, hence driver fills: bIsSupported = 1; nMinWidth = 48; nMinHeight = 16; +/** nMaxWidth = 4096; nMaxHeight = 4096; nMaxMBCount = 65536; +/** CodedWidth*CodedHeight/256 must be less than or equal to nMaxMBCount +/**********************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidGetDecoderCaps(CUVIDDECODECAPS pdc); + +/*****************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci) +/** Create the decoder object based on pdci. A handle to the created decoder is returned +/*****************************************************************************************************/ +public static native @Cast("CUresult") int cuvidCreateDecoder(@ByPtrPtr CUvideodecoder phDecoder, CUVIDDECODECREATEINFO pdci); + +/*****************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder) +/** Destroy the decoder object +/*****************************************************************************************************/ +public static native @Cast("CUresult") int cuvidDestroyDecoder(CUvideodecoder hDecoder); + +/*****************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams) +/** Decode a single picture (field or frame) +/** Kicks off HW decoding +/*****************************************************************************************************/ +public static native @Cast("CUresult") int cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS pPicParams); + +/************************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidGetDecodeStatus(CUvideodecoder hDecoder, int nPicIdx); +/** Get the decode status for frame corresponding to nPicIdx +/** API is supported for Maxwell and above generation GPUs. +/** API is currently supported for HEVC, H264 and JPEG codecs. +/** API returns CUDA_ERROR_NOT_SUPPORTED error code for unsupported GPU or codec. +/************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidGetDecodeStatus(CUvideodecoder hDecoder, int nPicIdx, CUVIDGETDECODESTATUS pDecodeStatus); + +/*********************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidReconfigureDecoder(CUvideodecoder hDecoder, CUVIDRECONFIGUREDECODERINFO *pDecReconfigParams) +/** Used to reuse single decoder for multiple clips. Currently supports resolution change, resize params, display area +/** params, target area params change for same codec. Must be called during CUVIDPARSERPARAMS::pfnSequenceCallback +/*********************************************************************************************************/ +public static native @Cast("CUresult") int cuvidReconfigureDecoder(CUvideodecoder hDecoder, CUVIDRECONFIGUREDECODERINFO pDecReconfigParams); + + +// #if !defined(__CUVID_DEVPTR64) || defined(__CUVID_INTERNAL) +// #endif + +// #if defined(_WIN64) || defined(__LP64__) || defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) +/****************************************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, unsigned long long *pDevPtr, +/** unsigned int * pPitch, CUVIDPROCPARAMS *pVPP); +/** Post-process and map video frame corresponding to nPicIdx for use in cuda. Returns cuda device pointer and associated +/** pitch of the video frame +/****************************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, @Cast("unsigned long long*") LongPointer pDevPtr, + @Cast("unsigned int*") IntPointer pPitch, CUVIDPROCPARAMS pVPP); +public static native @Cast("CUresult") int cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, @Cast("unsigned long long*") LongBuffer pDevPtr, + @Cast("unsigned int*") IntBuffer pPitch, CUVIDPROCPARAMS pVPP); +public static native @Cast("CUresult") int cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, @Cast("unsigned long long*") long[] pDevPtr, + @Cast("unsigned int*") int[] pPitch, CUVIDPROCPARAMS pVPP); + +/**************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr); +/** Unmap a previously mapped video frame +/**************************************************************************************************/ + +//! +//! +public static native @Cast("CUresult") int cuvidUnmapVideoFrame64(CUvideodecoder hDecoder, @Cast("unsigned long long") long DevPtr); + +// #if defined(__CUVID_DEVPTR64) && !defined(__CUVID_INTERNAL) +// #endif +// #endif + + + +/********************************************************************************************************************/ +/** +/** Context-locking: to facilitate multi-threaded implementations, the following 4 functions +/** provide a simple mutex-style host synchronization. If a non-NULL context is specified +/** in CUVIDDECODECREATEINFO, the codec library will acquire the mutex associated with the given +/** context before making any cuda calls. +/** A multi-threaded application could create a lock associated with a context handle so that +/** multiple threads can safely share the same cuda context: +/** - use cuCtxPopCurrent immediately after context creation in order to create a 'floating' context +/** that can be passed to cuvidCtxLockCreate. +/** - When using a floating context, all cuda calls should only be made within a cuvidCtxLock/cuvidCtxUnlock section. +/** +/** NOTE: This is a safer alternative to cuCtxPushCurrent and cuCtxPopCurrent, and is not related to video +/** decoder in any way (implemented as a critical section associated with cuCtx{Push|Pop}Current calls). +/********************************************************************************************************************/ + +/********************************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx) +/** This API is used to create CtxLock object +/********************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidCtxLockCreate(@ByPtrPtr _CUcontextlock_st pLock, CUctx_st ctx); + +/********************************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck) +/** This API is used to free CtxLock object +/********************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidCtxLockDestroy(_CUcontextlock_st lck); + +/********************************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags) +/** This API is used to acquire ctxlock +/********************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidCtxLock(_CUcontextlock_st lck, @Cast("unsigned int") int reserved_flags); + +/********************************************************************************************************************/ +/** \fn CUresult CUDAAPI cuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags) +/** This API is used to release ctxlock +/********************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidCtxUnlock(_CUcontextlock_st lck, @Cast("unsigned int") int reserved_flags); + +/**********************************************************************************************/ + + +// #if defined(__cplusplus) +// Targeting ../nvcuvid/CCtxAutoLock.java + + +// #endif /* __cplusplus */ + +// #endif // __CUDA_VIDEO_H__ + + + +// Parsed from nvcuvid.h + +/* + * This copyright notice applies to this header file only: + * + * Copyright (c) 2010-2020 NVIDIA Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the software, and to permit persons to whom the + * software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/********************************************************************************************************************/ +/** \file nvcuvid.h +/** NVDECODE API provides video decoding interface to NVIDIA GPU devices. +/** \date 2015-2020 +/** This file contains the interface constants, structure definitions and function prototypes. +/********************************************************************************************************************/ + +// #if !defined(__NVCUVID_H__) */ +// #define __NVCUVID_H__ + +// #include "cuviddec.h" + +// #if defined(__cplusplus) +// Targeting ../nvcuvid/CUvideosource.java + + +// Targeting ../nvcuvid/CUvideoparser.java + + + + +/************************************************************************/ +/** \enum cudaVideoState +/** Video source state enums +/** Used in cuvidSetVideoSourceState and cuvidGetVideoSourceState APIs +/************************************************************************/ +/** enum cudaVideoState */ +public static final int + /** Error state (invalid source) */ + cudaVideoState_Error = -1, + /** Source is stopped (or reached end-of-stream) */ + cudaVideoState_Stopped = 0, + /** Source is running and delivering data */ + cudaVideoState_Started = 1; + +/************************************************************************/ +/** \enum cudaAudioCodec +/** Audio compression enums +/** Used in CUAUDIOFORMAT structure +/************************************************************************/ +/** enum cudaAudioCodec */ +public static final int + /** MPEG-1 Audio */ + cudaAudioCodec_MPEG1 = 0, + /** MPEG-2 Audio */ + cudaAudioCodec_MPEG2 = 1, + /** MPEG-1 Layer III Audio */ + cudaAudioCodec_MP3 = 2, + /** Dolby Digital (AC3) Audio */ + cudaAudioCodec_AC3 = 3, + /** PCM Audio */ + cudaAudioCodec_LPCM = 4, + /** AAC Audio */ + cudaAudioCodec_AAC = 5; +// Targeting ../nvcuvid/CUVIDEOFORMAT.java + + +// Targeting ../nvcuvid/CUVIDOPERATINGPOINTINFO.java + + +// Targeting ../nvcuvid/CUVIDAV1SEQHDR.java + + +// Targeting ../nvcuvid/CUVIDEOFORMATEX.java + + +// Targeting ../nvcuvid/CUAUDIOFORMAT.java + + + + +/***************************************************************/ +/** \enum CUvideopacketflags +/** Data packet flags +/** Used in CUVIDSOURCEDATAPACKET structure +/***************************************************************/ +/** enum CUvideopacketflags */ +public static final int + /** Set when this is the last packet for this stream */ + CUVID_PKT_ENDOFSTREAM = 0x01, + /** Timestamp is valid */ + CUVID_PKT_TIMESTAMP = 0x02, + /** Set when a discontinuity has to be signalled */ + CUVID_PKT_DISCONTINUITY = 0x04, + /** Set when the packet contains exactly one frame or one field */ + CUVID_PKT_ENDOFPICTURE = 0x08, + /** If this flag is set along with CUVID_PKT_ENDOFSTREAM, an additional (dummy) + display callback will be invoked with null value of CUVIDPARSERDISPINFO which + should be interpreted as end of the stream. */ + CUVID_PKT_NOTIFY_EOS = 0x10; +// Targeting ../nvcuvid/CUVIDSOURCEDATAPACKET.java + + +// Targeting ../nvcuvid/PFNVIDSOURCECALLBACK.java + + +// Targeting ../nvcuvid/CUVIDSOURCEPARAMS.java + + + + +/**********************************************/ +/** \ingroup ENUMS +/** \enum CUvideosourceformat_flags +/** CUvideosourceformat_flags +/** Used in cuvidGetSourceVideoFormat API +/**********************************************/ +/** enum CUvideosourceformat_flags */ +public static final int + /** Return extended format structure (CUVIDEOFORMATEX) */ + CUVID_FMT_EXTFORMATINFO = 0x100; + +// #if !defined(__APPLE__) +/***************************************************************************************************************************/ +/** \ingroup FUNCTS +/** \fn CUresult CUDAAPI cuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams) +/** Create CUvideosource object. CUvideosource spawns demultiplexer thread that provides two callbacks: +/** pfnVideoDataHandler() and pfnAudioDataHandler() +/** NVDECODE API is intended for HW accelerated video decoding so CUvideosource doesn't have audio demuxer for all supported +/** containers. It's recommended to clients to use their own or third party demuxer if audio support is needed. +/***************************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidCreateVideoSource(@ByPtrPtr CUvideosource pObj, String pszFileName, CUVIDSOURCEPARAMS pParams); +public static native @Cast("CUresult") int cuvidCreateVideoSource(@ByPtrPtr CUvideosource pObj, @Cast("const char*") BytePointer pszFileName, CUVIDSOURCEPARAMS pParams); + +/***************************************************************************************************************************/ +/** \ingroup FUNCTS +/** \fn CUresult CUDAAPI cuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams) +/** Create video source +/***************************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidCreateVideoSourceW(@ByPtrPtr CUvideosource pObj, @Cast("const wchar_t*") CharPointer pwszFileName, CUVIDSOURCEPARAMS pParams); +public static native @Cast("CUresult") int cuvidCreateVideoSourceW(@ByPtrPtr CUvideosource pObj, @Cast("const wchar_t*") IntPointer pwszFileName, CUVIDSOURCEPARAMS pParams); + +/********************************************************************/ +/** \ingroup FUNCTS +/** \fn CUresult CUDAAPI cuvidDestroyVideoSource(CUvideosource obj) +/** Destroy video source +/********************************************************************/ +public static native @Cast("CUresult") int cuvidDestroyVideoSource(CUvideosource obj); + +/******************************************************************************************/ +/** \ingroup FUNCTS +/** \fn CUresult CUDAAPI cuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state) +/** Set video source state to: +/** cudaVideoState_Started - to signal the source to run and deliver data +/** cudaVideoState_Stopped - to stop the source from delivering the data +/** cudaVideoState_Error - invalid source +/******************************************************************************************/ +public static native @Cast("CUresult") int cuvidSetVideoSourceState(CUvideosource obj, @Cast("cudaVideoState") int state); + +/******************************************************************************************/ +/** \ingroup FUNCTS +/** \fn cudaVideoState CUDAAPI cuvidGetVideoSourceState(CUvideosource obj) +/** Get video source state +/** Returns: +/** cudaVideoState_Started - if Source is running and delivering data +/** cudaVideoState_Stopped - if Source is stopped or reached end-of-stream +/** cudaVideoState_Error - if Source is in error state +/******************************************************************************************/ +public static native @Cast("cudaVideoState") int cuvidGetVideoSourceState(CUvideosource obj); + +/******************************************************************************************************************/ +/** \ingroup FUNCTS +/** \fn CUresult CUDAAPI cuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags) +/** Gets video source format in pvidfmt, flags is set to combination of CUvideosourceformat_flags as per requirement +/******************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT pvidfmt, @Cast("unsigned int") int flags); + +/**************************************************************************************************************************/ +/** \ingroup FUNCTS +/** \fn CUresult CUDAAPI cuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags) +/** Get audio source format +/** NVDECODE API is intended for HW accelerated video decoding so CUvideosource doesn't have audio demuxer for all supported +/** containers. It's recommended to clients to use their own or third party demuxer if audio support is needed. +/**************************************************************************************************************************/ +public static native @Cast("CUresult") int cuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT paudfmt, @Cast("unsigned int") int flags); +// Targeting ../nvcuvid/CUVIDPARSERDISPINFO.java + + +// Targeting ../nvcuvid/PFNVIDSEQUENCECALLBACK.java + + +// Targeting ../nvcuvid/PFNVIDDECODECALLBACK.java + + +// Targeting ../nvcuvid/PFNVIDDISPLAYCALLBACK.java + + +// Targeting ../nvcuvid/PFNVIDOPPOINTCALLBACK.java + + +// Targeting ../nvcuvid/CUVIDPARSERPARAMS.java + + + +/************************************************************************************************/ +/** \ingroup FUNCTS +/** \fn CUresult CUDAAPI cuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams) +/** Create video parser object and initialize +/************************************************************************************************/ +public static native @Cast("CUresult") int cuvidCreateVideoParser(@ByPtrPtr CUvideoparser pObj, CUVIDPARSERPARAMS pParams); + +/************************************************************************************************/ +/** \ingroup FUNCTS +/** \fn CUresult CUDAAPI cuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket) +/** Parse the video data from source data packet in pPacket +/** Extracts parameter sets like SPS, PPS, bitstream etc. from pPacket and +/** calls back pfnDecodePicture with CUVIDPICPARAMS data for kicking of HW decoding +/** calls back pfnSequenceCallback with CUVIDEOFORMAT data for initial sequence header or when +/** the decoder encounters a video format change +/** calls back pfnDisplayPicture with CUVIDPARSERDISPINFO data to display a video frame +/************************************************************************************************/ +public static native @Cast("CUresult") int cuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET pPacket); + +/************************************************************************************************/ +/** \ingroup FUNCTS +/** \fn CUresult CUDAAPI cuvidDestroyVideoParser(CUvideoparser obj) +/** Destroy the video parser +/************************************************************************************************/ +public static native @Cast("CUresult") int cuvidDestroyVideoParser(CUvideoparser obj); + +/**********************************************************************************************/ + +// #if defined(__cplusplus) +// #endif /* __cplusplus */ + +// #endif // __NVCUVID_H__ + + + + +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/global/nvencodeapi.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/global/nvencodeapi.java new file mode 100644 index 00000000000..c18bd86ce53 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/global/nvencodeapi.java @@ -0,0 +1,3060 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.global; + +import org.bytedeco.nvcodec.nvencodeapi.*; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +public class nvencodeapi extends org.bytedeco.nvcodec.presets.nvencodeapi { + static { Loader.load(); } + +// Parsed from nvEncodeAPI.h + +/* + * This copyright notice applies to this header file only: + * + * Copyright (c) 2010-2020 NVIDIA Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the software, and to permit persons to whom the + * software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file nvEncodeAPI.h + * NVIDIA GPUs - beginning with the Kepler generation - contain a hardware-based encoder + * (referred to as NVENC) which provides fully-accelerated hardware-based video encoding. + * NvEncodeAPI provides the interface for NVIDIA video encoder (NVENC). + * \date 2011-2020 + * This file contains the interface constants, structure definitions and function prototypes. + */ + +// #ifndef _NV_ENCODEAPI_H_ +// #define _NV_ENCODEAPI_H_ + +// #include + +// #ifdef _WIN32 +// #include +// #endif + +// #ifdef _MSC_VER +// #ifndef _STDINT +// #endif +// #else +// #include +// #endif + +// #ifdef __cplusplus +// #endif + +/** + * \addtogroup ENCODER_STRUCTURE NvEncodeAPI Data structures + * \{ + */ + +// #ifdef _WIN32 +// #define NVENCAPI __stdcall +// #else +// #define NVENCAPI +// Targeting ../nvencodeapi/GUID.java + + +// Targeting ../nvencodeapi/RECT.java + + +// Targeting ../nvencodeapi/NV_ENC_INPUT_PTR.java + + +// Targeting ../nvencodeapi/NV_ENC_OUTPUT_PTR.java + + +// Targeting ../nvencodeapi/NV_ENC_REGISTERED_PTR.java + + +// Targeting ../nvencodeapi/NV_ENC_CUSTREAM_PTR.java + + + +public static final int NVENCAPI_MAJOR_VERSION = 11; +public static final int NVENCAPI_MINOR_VERSION = 0; + +public static final int NVENCAPI_VERSION = (NVENCAPI_MAJOR_VERSION | (NVENCAPI_MINOR_VERSION << 24)); + +/** + * Macro to generate per-structure version for use with API. + */ +// #define NVENCAPI_STRUCT_VERSION(ver) ((uint32_t)NVENCAPI_VERSION | ((ver)<<16) | (0x7 << 28)) + + +public static final int NVENC_INFINITE_GOPLENGTH = 0xffffffff; + +public static final int NV_MAX_SEQ_HDR_LEN = (512); + +// #ifdef __GNUC__ +// #define NV_ENC_DEPRECATED __attribute__ ((deprecated("WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION"))) +// #elif defined(_MSC_VER) +// #define NV_ENC_DEPRECATED __declspec(deprecated("WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION")) +// #endif + +// ========================================================================================= +// Encode Codec GUIDS supported by the NvEncodeAPI interface. +// ========================================================================================= + +// {6BC82762-4E63-4ca4-AA85-1E50F321F6BF} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_CODEC_H264_GUID(); + +// {790CDC88-4522-4d7b-9425-BDA9975F7603} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_CODEC_HEVC_GUID(); + + + +// ========================================================================================= +// * Encode Profile GUIDS supported by the NvEncodeAPI interface. +// ========================================================================================= + +// {BFD6F8E7-233C-4341-8B3E-4818523803F4} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_CODEC_PROFILE_AUTOSELECT_GUID(); + +// {0727BCAA-78C4-4c83-8C2F-EF3DFF267C6A} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_H264_PROFILE_BASELINE_GUID(); + +// {60B5C1D4-67FE-4790-94D5-C4726D7B6E6D} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_H264_PROFILE_MAIN_GUID(); + +// {E7CBC309-4F7A-4b89-AF2A-D537C92BE310} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_H264_PROFILE_HIGH_GUID(); + +// {7AC663CB-A598-4960-B844-339B261A7D52} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_H264_PROFILE_HIGH_444_GUID(); + +// {40847BF5-33F7-4601-9084-E8FE3C1DB8B7} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_H264_PROFILE_STEREO_GUID(); + +// {B405AFAC-F32B-417B-89C4-9ABEED3E5978} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_H264_PROFILE_PROGRESSIVE_HIGH_GUID(); + +// {AEC1BD87-E85B-48f2-84C3-98BCA6285072} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_H264_PROFILE_CONSTRAINED_HIGH_GUID(); + +// {B514C39A-B55B-40fa-878F-F1253B4DFDEC} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_HEVC_PROFILE_MAIN_GUID(); + +// {fa4d2b6c-3a5b-411a-8018-0a3f5e3c9be5} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_HEVC_PROFILE_MAIN10_GUID(); + +// For HEVC Main 444 8 bit and HEVC Main 444 10 bit profiles only +// {51ec32b5-1b4c-453c-9cbd-b616bd621341} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_HEVC_PROFILE_FREXT_GUID(); + +// ========================================================================================= +// * Preset GUIDS supported by the NvEncodeAPI interface. +// ========================================================================================= +// {B2DFB705-4EBD-4C49-9B5F-24A777D3E587} +@MemberGetter public static native @Const @Deprecated @ByRef GUID NV_ENC_PRESET_DEFAULT_GUID(); + +// {60E4C59F-E846-4484-A56D-CD45BE9FDDF6} +@MemberGetter public static native @Const @Deprecated @ByRef GUID NV_ENC_PRESET_HP_GUID(); + +// {34DBA71D-A77B-4B8F-9C3E-B6D5DA24C012} +@MemberGetter public static native @Const @Deprecated @ByRef GUID NV_ENC_PRESET_HQ_GUID(); + +// {82E3E450-BDBB-4e40-989C-82A90DF9EF32} +@MemberGetter public static native @Const @Deprecated @ByRef GUID NV_ENC_PRESET_BD_GUID(); + +// {49DF21C5-6DFA-4feb-9787-6ACC9EFFB726} +@MemberGetter public static native @Const @Deprecated @ByRef GUID NV_ENC_PRESET_LOW_LATENCY_DEFAULT_GUID(); + +// {C5F733B9-EA97-4cf9-BEC2-BF78A74FD105} +@MemberGetter public static native @Const @Deprecated @ByRef GUID NV_ENC_PRESET_LOW_LATENCY_HQ_GUID(); + +// {67082A44-4BAD-48FA-98EA-93056D150A58} +@MemberGetter public static native @Const @Deprecated @ByRef GUID NV_ENC_PRESET_LOW_LATENCY_HP_GUID(); + +// {D5BFB716-C604-44e7-9BB8-DEA5510FC3AC} +@MemberGetter public static native @Const @Deprecated @ByRef GUID NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID(); + +// {149998E7-2364-411d-82EF-179888093409} +@MemberGetter public static native @Const @Deprecated @ByRef GUID NV_ENC_PRESET_LOSSLESS_HP_GUID(); + +// 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 +// {FC0A8D3E-45F8-4CF8-80C7-298871590EBF} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_PRESET_P1_GUID(); + +// {F581CFB8-88D6-4381-93F0-DF13F9C27DAB} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_PRESET_P2_GUID(); + +// {36850110-3A07-441F-94D5-3670631F91F6} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_PRESET_P3_GUID(); + +// {90A7B826-DF06-4862-B9D2-CD6D73A08681} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_PRESET_P4_GUID(); + +// {21C6E6B4-297A-4CBA-998F-B6CBDE72ADE3} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_PRESET_P5_GUID(); + +// {8E75C279-6299-4AB6-8302-0B215A335CF5} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_PRESET_P6_GUID(); + +// {84848C12-6F71-4C13-931B-53E283F57974} +@MemberGetter public static native @Const @ByRef GUID NV_ENC_PRESET_P7_GUID(); + +/** + * \addtogroup ENCODER_STRUCTURE NvEncodeAPI Data structures + * \{ + */ + +/** + * Input frame encode modes + */ +/** enum _NV_ENC_PARAMS_FRAME_FIELD_MODE */ +public static final int + /** Frame mode */ + NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME = 0x01, + /** Field mode */ + NV_ENC_PARAMS_FRAME_FIELD_MODE_FIELD = 0x02, + /** MB adaptive frame/field */ + NV_ENC_PARAMS_FRAME_FIELD_MODE_MBAFF = 0x03; + +/** + * Rate Control Modes + */ +/** enum _NV_ENC_PARAMS_RC_MODE */ +public static final int + /** Constant QP mode */ + NV_ENC_PARAMS_RC_CONSTQP = 0x0, + /** Variable bitrate mode */ + NV_ENC_PARAMS_RC_VBR = 0x1, + /** Constant bitrate mode */ + NV_ENC_PARAMS_RC_CBR = 0x2, + /** Deprecated, use NV_ENC_PARAMS_RC_CBR + NV_ENC_TWO_PASS_QUARTER_RESOLUTION / NV_ENC_TWO_PASS_FULL_RESOLUTION + + lowDelayKeyFrameScale=1 */ + NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ = 0x8, + /** Deprecated, use NV_ENC_PARAMS_RC_CBR + NV_ENC_TWO_PASS_QUARTER_RESOLUTION / NV_ENC_TWO_PASS_FULL_RESOLUTION */ + NV_ENC_PARAMS_RC_CBR_HQ = 0x10, + /** Deprecated, use NV_ENC_PARAMS_RC_VBR + NV_ENC_TWO_PASS_QUARTER_RESOLUTION / NV_ENC_TWO_PASS_FULL_RESOLUTION */ + NV_ENC_PARAMS_RC_VBR_HQ = 0x20; + +/** + * Multi Pass encoding + */ +/** enum _NV_ENC_MULTI_PASS */ +public static final int + /** Single Pass */ + NV_ENC_MULTI_PASS_DISABLED = 0x0, + /** Two Pass encoding is enabled where first Pass is quarter resolution */ + NV_ENC_TWO_PASS_QUARTER_RESOLUTION = 0x1, + /** Two Pass encoding is enabled where first Pass is full resolution */ + NV_ENC_TWO_PASS_FULL_RESOLUTION = 0x2; + +/** + * Emphasis Levels + */ +/** enum _NV_ENC_EMPHASIS_MAP_LEVEL */ +public static final int + /** Emphasis Map Level 0, for zero Delta QP value */ + NV_ENC_EMPHASIS_MAP_LEVEL_0 = 0x0, + /** Emphasis Map Level 1, for very low Delta QP value */ + NV_ENC_EMPHASIS_MAP_LEVEL_1 = 0x1, + /** Emphasis Map Level 2, for low Delta QP value */ + NV_ENC_EMPHASIS_MAP_LEVEL_2 = 0x2, + /** Emphasis Map Level 3, for medium Delta QP value */ + NV_ENC_EMPHASIS_MAP_LEVEL_3 = 0x3, + /** Emphasis Map Level 4, for high Delta QP value */ + NV_ENC_EMPHASIS_MAP_LEVEL_4 = 0x4, + /** Emphasis Map Level 5, for very high Delta QP value */ + NV_ENC_EMPHASIS_MAP_LEVEL_5 = 0x5; + +/** + * QP MAP MODE + */ +/** enum _NV_ENC_QP_MAP_MODE */ +public static final int + /** Value in NV_ENC_PIC_PARAMS::qpDeltaMap have no effect. */ + NV_ENC_QP_MAP_DISABLED = 0x0, + /** Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as Emphasis level. Currently this is only supported for H264 */ + NV_ENC_QP_MAP_EMPHASIS = 0x1, + /** Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as QP delta map. */ + NV_ENC_QP_MAP_DELTA = 0x2, + /** Currently This is not supported. Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as QP value. */ + NV_ENC_QP_MAP = 0x3; + + +/** + * Input picture structure + */ +/** enum _NV_ENC_PIC_STRUCT */ +public static final int + /** Progressive frame */ + NV_ENC_PIC_STRUCT_FRAME = 0x01, + /** Field encoding top field first */ + NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM = 0x02, + /** Field encoding bottom field first */ + NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP = 0x03; + +/** + * Input picture type + */ +/** enum _NV_ENC_PIC_TYPE */ +public static final int + /** Forward predicted */ + NV_ENC_PIC_TYPE_P = 0x0, + /** Bi-directionally predicted picture */ + NV_ENC_PIC_TYPE_B = 0x01, + /** Intra predicted picture */ + NV_ENC_PIC_TYPE_I = 0x02, + /** IDR picture */ + NV_ENC_PIC_TYPE_IDR = 0x03, + /** Bi-directionally predicted with only Intra MBs */ + NV_ENC_PIC_TYPE_BI = 0x04, + /** Picture is skipped */ + NV_ENC_PIC_TYPE_SKIPPED = 0x05, + /** First picture in intra refresh cycle */ + NV_ENC_PIC_TYPE_INTRA_REFRESH = 0x06, + /** Non reference P picture */ + NV_ENC_PIC_TYPE_NONREF_P = 0x07, + /** Picture type unknown */ + NV_ENC_PIC_TYPE_UNKNOWN = 0xFF; + +/** + * Motion vector precisions + */ +/** enum _NV_ENC_MV_PRECISION */ +public static final int + /** Driver selects Quarter-Pel motion vector precision by default */ + NV_ENC_MV_PRECISION_DEFAULT = 0x0, + /** Full-Pel motion vector precision */ + NV_ENC_MV_PRECISION_FULL_PEL = 0x01, + /** Half-Pel motion vector precision */ + NV_ENC_MV_PRECISION_HALF_PEL = 0x02, + /** Quarter-Pel motion vector precision */ + NV_ENC_MV_PRECISION_QUARTER_PEL = 0x03; + + +/** + * Input buffer formats + */ +/** enum _NV_ENC_BUFFER_FORMAT */ +public static final int + /** Undefined buffer format */ + NV_ENC_BUFFER_FORMAT_UNDEFINED = 0x00000000, + + /** Semi-Planar YUV [Y plane followed by interleaved UV plane] */ + NV_ENC_BUFFER_FORMAT_NV12 = 0x00000001, + /** Planar YUV [Y plane followed by V and U planes] */ + NV_ENC_BUFFER_FORMAT_YV12 = 0x00000010, + /** Planar YUV [Y plane followed by U and V planes] */ + NV_ENC_BUFFER_FORMAT_IYUV = 0x00000100, + /** Planar YUV [Y plane followed by U and V planes] */ + NV_ENC_BUFFER_FORMAT_YUV444 = 0x00001000, + /** 10 bit Semi-Planar YUV [Y plane followed by interleaved UV plane]. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */ + NV_ENC_BUFFER_FORMAT_YUV420_10BIT = 0x00010000, + /** 10 bit Planar YUV444 [Y plane followed by U and V planes]. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */ + NV_ENC_BUFFER_FORMAT_YUV444_10BIT = 0x00100000, + /** 8 bit Packed A8R8G8B8. This is a word-ordered format + where a pixel is represented by a 32-bit word with B + in the lowest 8 bits, G in the next 8 bits, R in the + 8 bits after that and A in the highest 8 bits. */ + NV_ENC_BUFFER_FORMAT_ARGB = 0x01000000, + /** 10 bit Packed A2R10G10B10. This is a word-ordered format + where a pixel is represented by a 32-bit word with B + in the lowest 10 bits, G in the next 10 bits, R in the + 10 bits after that and A in the highest 2 bits. */ + NV_ENC_BUFFER_FORMAT_ARGB10 = 0x02000000, + /** 8 bit Packed A8Y8U8V8. This is a word-ordered format + where a pixel is represented by a 32-bit word with V + in the lowest 8 bits, U in the next 8 bits, Y in the + 8 bits after that and A in the highest 8 bits. */ + NV_ENC_BUFFER_FORMAT_AYUV = 0x04000000, + /** 8 bit Packed A8B8G8R8. This is a word-ordered format + where a pixel is represented by a 32-bit word with R + in the lowest 8 bits, G in the next 8 bits, B in the + 8 bits after that and A in the highest 8 bits. */ + NV_ENC_BUFFER_FORMAT_ABGR = 0x10000000, + /** 10 bit Packed A2B10G10R10. This is a word-ordered format + where a pixel is represented by a 32-bit word with R + in the lowest 10 bits, G in the next 10 bits, B in the + 10 bits after that and A in the highest 2 bits. */ + NV_ENC_BUFFER_FORMAT_ABGR10 = 0x20000000, + /** Buffer format representing one-dimensional buffer. + This format should be used only when registering the + resource as output buffer, which will be used to write + the encoded bit stream or H.264 ME only mode output. */ + NV_ENC_BUFFER_FORMAT_U8 = 0x40000000; + + +/** + * Encoding levels + */ +/** enum _NV_ENC_LEVEL */ +public static final int + NV_ENC_LEVEL_AUTOSELECT = 0, + + NV_ENC_LEVEL_H264_1 = 10, + NV_ENC_LEVEL_H264_1b = 9, + NV_ENC_LEVEL_H264_11 = 11, + NV_ENC_LEVEL_H264_12 = 12, + NV_ENC_LEVEL_H264_13 = 13, + NV_ENC_LEVEL_H264_2 = 20, + NV_ENC_LEVEL_H264_21 = 21, + NV_ENC_LEVEL_H264_22 = 22, + NV_ENC_LEVEL_H264_3 = 30, + NV_ENC_LEVEL_H264_31 = 31, + NV_ENC_LEVEL_H264_32 = 32, + NV_ENC_LEVEL_H264_4 = 40, + NV_ENC_LEVEL_H264_41 = 41, + NV_ENC_LEVEL_H264_42 = 42, + NV_ENC_LEVEL_H264_5 = 50, + NV_ENC_LEVEL_H264_51 = 51, + NV_ENC_LEVEL_H264_52 = 52, + NV_ENC_LEVEL_H264_60 = 60, + NV_ENC_LEVEL_H264_61 = 61, + NV_ENC_LEVEL_H264_62 = 62, + + NV_ENC_LEVEL_HEVC_1 = 30, + NV_ENC_LEVEL_HEVC_2 = 60, + NV_ENC_LEVEL_HEVC_21 = 63, + NV_ENC_LEVEL_HEVC_3 = 90, + NV_ENC_LEVEL_HEVC_31 = 93, + NV_ENC_LEVEL_HEVC_4 = 120, + NV_ENC_LEVEL_HEVC_41 = 123, + NV_ENC_LEVEL_HEVC_5 = 150, + NV_ENC_LEVEL_HEVC_51 = 153, + NV_ENC_LEVEL_HEVC_52 = 156, + NV_ENC_LEVEL_HEVC_6 = 180, + NV_ENC_LEVEL_HEVC_61 = 183, + NV_ENC_LEVEL_HEVC_62 = 186, + + NV_ENC_TIER_HEVC_MAIN = 0, + NV_ENC_TIER_HEVC_HIGH = 1; + +/** + * Error Codes + */ +/** enum _NVENCSTATUS */ +public static final int + /** + * This indicates that API call returned with no errors. + */ + NV_ENC_SUCCESS = 0, + + /** + * This indicates that no encode capable devices were detected. + */ + NV_ENC_ERR_NO_ENCODE_DEVICE = 1, + + /** + * This indicates that devices pass by the client is not supported. + */ + NV_ENC_ERR_UNSUPPORTED_DEVICE = 2, + + /** + * This indicates that the encoder device supplied by the client is not + * valid. + */ + NV_ENC_ERR_INVALID_ENCODERDEVICE = 3, + + /** + * This indicates that device passed to the API call is invalid. + */ + NV_ENC_ERR_INVALID_DEVICE = 4, + + /** + * This indicates that device passed to the API call is no longer available and + * needs to be reinitialized. The clients need to destroy the current encoder + * session by freeing the allocated input output buffers and destroying the device + * and create a new encoding session. + */ + NV_ENC_ERR_DEVICE_NOT_EXIST = 5, + + /** + * This indicates that one or more of the pointers passed to the API call + * is invalid. + */ + NV_ENC_ERR_INVALID_PTR = 6, + + /** + * This indicates that completion event passed in ::NvEncEncodePicture() call + * is invalid. + */ + NV_ENC_ERR_INVALID_EVENT = 7, + + /** + * This indicates that one or more of the parameter passed to the API call + * is invalid. + */ + NV_ENC_ERR_INVALID_PARAM = 8, + + /** + * This indicates that an API call was made in wrong sequence/order. + */ + NV_ENC_ERR_INVALID_CALL = 9, + + /** + * This indicates that the API call failed because it was unable to allocate + * enough memory to perform the requested operation. + */ + NV_ENC_ERR_OUT_OF_MEMORY = 10, + + /** + * This indicates that the encoder has not been initialized with + * ::NvEncInitializeEncoder() or that initialization has failed. + * The client cannot allocate input or output buffers or do any encoding + * related operation before successfully initializing the encoder. + */ + NV_ENC_ERR_ENCODER_NOT_INITIALIZED = 11, + + /** + * This indicates that an unsupported parameter was passed by the client. + */ + NV_ENC_ERR_UNSUPPORTED_PARAM = 12, + + /** + * This indicates that the ::NvEncLockBitstream() failed to lock the output + * buffer. This happens when the client makes a non blocking lock call to + * access the output bitstream by passing NV_ENC_LOCK_BITSTREAM::doNotWait flag. + * This is not a fatal error and client should retry the same operation after + * few milliseconds. + */ + NV_ENC_ERR_LOCK_BUSY = 13, + + /** + * This indicates that the size of the user buffer passed by the client is + * insufficient for the requested operation. + */ + NV_ENC_ERR_NOT_ENOUGH_BUFFER = 14, + + /** + * This indicates that an invalid struct version was used by the client. + */ + NV_ENC_ERR_INVALID_VERSION = 15, + + /** + * This indicates that ::NvEncMapInputResource() API failed to map the client + * provided input resource. + */ + NV_ENC_ERR_MAP_FAILED = 16, + + /** + * This indicates encode driver requires more input buffers to produce an output + * bitstream. If this error is returned from ::NvEncEncodePicture() API, this + * is not a fatal error. If the client is encoding with B frames then, + * ::NvEncEncodePicture() API might be buffering the input frame for re-ordering. + * + * A client operating in synchronous mode cannot call ::NvEncLockBitstream() + * API on the output bitstream buffer if ::NvEncEncodePicture() returned the + * ::NV_ENC_ERR_NEED_MORE_INPUT error code. + * The client must continue providing input frames until encode driver returns + * ::NV_ENC_SUCCESS. After receiving ::NV_ENC_SUCCESS status the client can call + * ::NvEncLockBitstream() API on the output buffers in the same order in which + * it has called ::NvEncEncodePicture(). + */ + NV_ENC_ERR_NEED_MORE_INPUT = 17, + + /** + * This indicates that the HW encoder is busy encoding and is unable to encode + * the input. The client should call ::NvEncEncodePicture() again after few + * milliseconds. + */ + NV_ENC_ERR_ENCODER_BUSY = 18, + + /** + * This indicates that the completion event passed in ::NvEncEncodePicture() + * API has not been registered with encoder driver using ::NvEncRegisterAsyncEvent(). + */ + NV_ENC_ERR_EVENT_NOT_REGISTERD = 19, + + /** + * This indicates that an unknown internal error has occurred. + */ + NV_ENC_ERR_GENERIC = 20, + + /** + * This indicates that the client is attempting to use a feature + * that is not available for the license type for the current system. + */ + NV_ENC_ERR_INCOMPATIBLE_CLIENT_KEY = 21, + + /** + * This indicates that the client is attempting to use a feature + * that is not implemented for the current version. + */ + NV_ENC_ERR_UNIMPLEMENTED = 22, + + /** + * This indicates that the ::NvEncRegisterResource API failed to register the resource. + */ + NV_ENC_ERR_RESOURCE_REGISTER_FAILED = 23, + + /** + * This indicates that the client is attempting to unregister a resource + * that has not been successfully registered. + */ + NV_ENC_ERR_RESOURCE_NOT_REGISTERED = 24, + + /** + * This indicates that the client is attempting to unmap a resource + * that has not been successfully mapped. + */ + NV_ENC_ERR_RESOURCE_NOT_MAPPED = 25; + +/** + * Encode Picture encode flags. + */ +/** enum _NV_ENC_PIC_FLAGS */ +public static final int + /** Encode the current picture as an Intra picture */ + NV_ENC_PIC_FLAG_FORCEINTRA = 0x1, + /** Encode the current picture as an IDR picture. + This flag is only valid when Picture type decision is taken by the Encoder + [_NV_ENC_INITIALIZE_PARAMS::enablePTD == 1]. */ + NV_ENC_PIC_FLAG_FORCEIDR = 0x2, + /** Write the sequence and picture header in encoded bitstream of the current picture */ + NV_ENC_PIC_FLAG_OUTPUT_SPSPPS = 0x4, + /** Indicates end of the input stream */ + NV_ENC_PIC_FLAG_EOS = 0x8; + +/** + * Memory heap to allocate input and output buffers. + */ +/** enum _NV_ENC_MEMORY_HEAP */ +public static final int + /** Memory heap to be decided by the encoder driver based on the usage */ + NV_ENC_MEMORY_HEAP_AUTOSELECT = 0, + /** Memory heap is in local video memory */ + NV_ENC_MEMORY_HEAP_VID = 1, + /** Memory heap is in cached system memory */ + NV_ENC_MEMORY_HEAP_SYSMEM_CACHED = 2, + /** Memory heap is in uncached system memory */ + NV_ENC_MEMORY_HEAP_SYSMEM_UNCACHED = 3; + +/** + * B-frame used as reference modes + */ +/** enum _NV_ENC_BFRAME_REF_MODE */ +public static final int + /** B frame is not used for reference */ + NV_ENC_BFRAME_REF_MODE_DISABLED = 0x0, + /** Each B-frame will be used for reference. currently not supported for H.264 */ + NV_ENC_BFRAME_REF_MODE_EACH = 0x1, + /** Only(Number of B-frame)/2 th B-frame will be used for reference */ + NV_ENC_BFRAME_REF_MODE_MIDDLE = 0x2; + +/** + * H.264 entropy coding modes. + */ +/** enum _NV_ENC_H264_ENTROPY_CODING_MODE */ +public static final int + /** Entropy coding mode is auto selected by the encoder driver */ + NV_ENC_H264_ENTROPY_CODING_MODE_AUTOSELECT = 0x0, + /** Entropy coding mode is CABAC */ + NV_ENC_H264_ENTROPY_CODING_MODE_CABAC = 0x1, + /** Entropy coding mode is CAVLC */ + NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC = 0x2; + +/** + * H.264 specific BDirect modes + */ +/** enum _NV_ENC_H264_BDIRECT_MODE */ +public static final int + /** BDirect mode is auto selected by the encoder driver */ + NV_ENC_H264_BDIRECT_MODE_AUTOSELECT = 0x0, + /** Disable BDirect mode */ + NV_ENC_H264_BDIRECT_MODE_DISABLE = 0x1, + /** Temporal BDirect mode */ + NV_ENC_H264_BDIRECT_MODE_TEMPORAL = 0x2, + /** Spatial BDirect mode */ + NV_ENC_H264_BDIRECT_MODE_SPATIAL = 0x3; + +/** + * H.264 specific FMO usage + */ +/** enum _NV_ENC_H264_FMO_MODE */ +public static final int + /** FMO usage is auto selected by the encoder driver */ + NV_ENC_H264_FMO_AUTOSELECT = 0x0, + /** Enable FMO */ + NV_ENC_H264_FMO_ENABLE = 0x1, + /** Disable FMO */ + NV_ENC_H264_FMO_DISABLE = 0x2; + +/** + * H.264 specific Adaptive Transform modes + */ +/** enum _NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE */ +public static final int + /** Adaptive Transform 8x8 mode is auto selected by the encoder driver*/ + NV_ENC_H264_ADAPTIVE_TRANSFORM_AUTOSELECT = 0x0, + /** Adaptive Transform 8x8 mode disabled */ + NV_ENC_H264_ADAPTIVE_TRANSFORM_DISABLE = 0x1, + /** Adaptive Transform 8x8 mode should be used */ + NV_ENC_H264_ADAPTIVE_TRANSFORM_ENABLE = 0x2; + +/** + * Stereo frame packing modes. + */ +/** enum _NV_ENC_STEREO_PACKING_MODE */ +public static final int + /** No Stereo packing required */ + NV_ENC_STEREO_PACKING_MODE_NONE = 0x0, + /** Checkerboard mode for packing stereo frames */ + NV_ENC_STEREO_PACKING_MODE_CHECKERBOARD = 0x1, + /** Column Interleave mode for packing stereo frames */ + NV_ENC_STEREO_PACKING_MODE_COLINTERLEAVE = 0x2, + /** Row Interleave mode for packing stereo frames */ + NV_ENC_STEREO_PACKING_MODE_ROWINTERLEAVE = 0x3, + /** Side-by-side mode for packing stereo frames */ + NV_ENC_STEREO_PACKING_MODE_SIDEBYSIDE = 0x4, + /** Top-Bottom mode for packing stereo frames */ + NV_ENC_STEREO_PACKING_MODE_TOPBOTTOM = 0x5, + /** Frame Sequential mode for packing stereo frames */ + NV_ENC_STEREO_PACKING_MODE_FRAMESEQ = 0x6; + +/** + * Input Resource type + */ +/** enum _NV_ENC_INPUT_RESOURCE_TYPE */ +public static final int + /** input resource type is a directx9 surface*/ + NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX = 0x0, + /** input resource type is a cuda device pointer surface*/ + NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR = 0x1, + /** input resource type is a cuda array surface. + This array must be a 2D array and the CUDA_ARRAY3D_SURFACE_LDST + flag must have been specified when creating it. */ + NV_ENC_INPUT_RESOURCE_TYPE_CUDAARRAY = 0x2, + /** input resource type is an OpenGL texture */ + NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX = 0x3; + +/** + * Buffer usage + */ +/** enum _NV_ENC_BUFFER_USAGE */ +public static final int + /** Registered surface will be used for input image */ + NV_ENC_INPUT_IMAGE = 0x0, + /** Registered surface will be used for output of H.264 ME only mode. + This buffer usage type is not supported for HEVC ME only mode. */ + NV_ENC_OUTPUT_MOTION_VECTOR = 0x1, + /** Registered surface will be used for output bitstream in encoding */ + NV_ENC_OUTPUT_BITSTREAM = 0x2; + +/** + * Encoder Device type + */ +/** enum _NV_ENC_DEVICE_TYPE */ +public static final int + /** encode device type is a directx9 device */ + NV_ENC_DEVICE_TYPE_DIRECTX = 0x0, + /** encode device type is a cuda device */ + NV_ENC_DEVICE_TYPE_CUDA = 0x1, + /** encode device type is an OpenGL device. + Use of this device type is supported only on Linux */ + NV_ENC_DEVICE_TYPE_OPENGL = 0x2; + +/** + * Number of reference frames + */ +/** enum _NV_ENC_NUM_REF_FRAMES */ +public static final int + /** Number of reference frames is auto selected by the encoder driver */ + NV_ENC_NUM_REF_FRAMES_AUTOSELECT = 0x0, + /** Number of reference frames equal to 1 */ + NV_ENC_NUM_REF_FRAMES_1 = 0x1, + /** Number of reference frames equal to 2 */ + NV_ENC_NUM_REF_FRAMES_2 = 0x2, + /** Number of reference frames equal to 3 */ + NV_ENC_NUM_REF_FRAMES_3 = 0x3, + /** Number of reference frames equal to 4 */ + NV_ENC_NUM_REF_FRAMES_4 = 0x4, + /** Number of reference frames equal to 5 */ + NV_ENC_NUM_REF_FRAMES_5 = 0x5, + /** Number of reference frames equal to 6 */ + NV_ENC_NUM_REF_FRAMES_6 = 0x6, + /** Number of reference frames equal to 7 */ + NV_ENC_NUM_REF_FRAMES_7 = 0x7; + +/** + * Encoder capabilities enumeration. + */ +/** enum _NV_ENC_CAPS */ +public static final int + /** + * Maximum number of B-Frames supported. + */ + NV_ENC_CAPS_NUM_MAX_BFRAMES = 0, + + /** + * Rate control modes supported. + * \n The API return value is a bitmask of the values in NV_ENC_PARAMS_RC_MODE. + */ + NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES = 1, + + /** + * Indicates HW support for field mode encoding. + * \n 0 : Interlaced mode encoding is not supported. + * \n 1 : Interlaced field mode encoding is supported. + * \n 2 : Interlaced frame encoding and field mode encoding are both supported. + */ + NV_ENC_CAPS_SUPPORT_FIELD_ENCODING = 2, + + /** + * Indicates HW support for monochrome mode encoding. + * \n 0 : Monochrome mode not supported. + * \n 1 : Monochrome mode supported. + */ + NV_ENC_CAPS_SUPPORT_MONOCHROME = 3, + + /** + * Indicates HW support for FMO. + * \n 0 : FMO not supported. + * \n 1 : FMO supported. + */ + NV_ENC_CAPS_SUPPORT_FMO = 4, + + /** + * Indicates HW capability for Quarter pel motion estimation. + * \n 0 : Quarter-Pel Motion Estimation not supported. + * \n 1 : Quarter-Pel Motion Estimation supported. + */ + NV_ENC_CAPS_SUPPORT_QPELMV = 5, + + /** + * H.264 specific. Indicates HW support for BDirect modes. + * \n 0 : BDirect mode encoding not supported. + * \n 1 : BDirect mode encoding supported. + */ + NV_ENC_CAPS_SUPPORT_BDIRECT_MODE = 6, + + /** + * H264 specific. Indicates HW support for CABAC entropy coding mode. + * \n 0 : CABAC entropy coding not supported. + * \n 1 : CABAC entropy coding supported. + */ + NV_ENC_CAPS_SUPPORT_CABAC = 7, + + /** + * Indicates HW support for Adaptive Transform. + * \n 0 : Adaptive Transform not supported. + * \n 1 : Adaptive Transform supported. + */ + NV_ENC_CAPS_SUPPORT_ADAPTIVE_TRANSFORM = 8, + + /** + * Indicates HW support for Multi View Coding. + * \n 0 : Multi View Coding not supported. + * \n 1 : Multi View Coding supported. + */ + NV_ENC_CAPS_SUPPORT_STEREO_MVC = 9, + + /** + * Indicates HW support for encoding Temporal layers. + * \n 0 : Encoding Temporal layers not supported. + * \n 1 : Encoding Temporal layers supported. + */ + NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS = 10, + + /** + * Indicates HW support for Hierarchical P frames. + * \n 0 : Hierarchical P frames not supported. + * \n 1 : Hierarchical P frames supported. + */ + NV_ENC_CAPS_SUPPORT_HIERARCHICAL_PFRAMES = 11, + + /** + * Indicates HW support for Hierarchical B frames. + * \n 0 : Hierarchical B frames not supported. + * \n 1 : Hierarchical B frames supported. + */ + NV_ENC_CAPS_SUPPORT_HIERARCHICAL_BFRAMES = 12, + + /** + * Maximum Encoding level supported (See ::NV_ENC_LEVEL for details). + */ + NV_ENC_CAPS_LEVEL_MAX = 13, + + /** + * Minimum Encoding level supported (See ::NV_ENC_LEVEL for details). + */ + NV_ENC_CAPS_LEVEL_MIN = 14, + + /** + * Indicates HW support for separate colour plane encoding. + * \n 0 : Separate colour plane encoding not supported. + * \n 1 : Separate colour plane encoding supported. + */ + NV_ENC_CAPS_SEPARATE_COLOUR_PLANE = 15, + + /** + * Maximum output width supported. + */ + NV_ENC_CAPS_WIDTH_MAX = 16, + + /** + * Maximum output height supported. + */ + NV_ENC_CAPS_HEIGHT_MAX = 17, + + /** + * Indicates Temporal Scalability Support. + * \n 0 : Temporal SVC encoding not supported. + * \n 1 : Temporal SVC encoding supported. + */ + NV_ENC_CAPS_SUPPORT_TEMPORAL_SVC = 18, + + /** + * Indicates Dynamic Encode Resolution Change Support. + * Support added from NvEncodeAPI version 2.0. + * \n 0 : Dynamic Encode Resolution Change not supported. + * \n 1 : Dynamic Encode Resolution Change supported. + */ + NV_ENC_CAPS_SUPPORT_DYN_RES_CHANGE = 19, + + /** + * Indicates Dynamic Encode Bitrate Change Support. + * Support added from NvEncodeAPI version 2.0. + * \n 0 : Dynamic Encode bitrate change not supported. + * \n 1 : Dynamic Encode bitrate change supported. + */ + NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE = 20, + + /** + * Indicates Forcing Constant QP On The Fly Support. + * Support added from NvEncodeAPI version 2.0. + * \n 0 : Forcing constant QP on the fly not supported. + * \n 1 : Forcing constant QP on the fly supported. + */ + NV_ENC_CAPS_SUPPORT_DYN_FORCE_CONSTQP = 21, + + /** + * Indicates Dynamic rate control mode Change Support. + * \n 0 : Dynamic rate control mode change not supported. + * \n 1 : Dynamic rate control mode change supported. + */ + NV_ENC_CAPS_SUPPORT_DYN_RCMODE_CHANGE = 22, + + /** + * Indicates Subframe readback support for slice-based encoding. If this feature is supported, it can be enabled by setting enableSubFrameWrite = 1. + * \n 0 : Subframe readback not supported. + * \n 1 : Subframe readback supported. + */ + NV_ENC_CAPS_SUPPORT_SUBFRAME_READBACK = 23, + + /** + * Indicates Constrained Encoding mode support. + * Support added from NvEncodeAPI version 2.0. + * \n 0 : Constrained encoding mode not supported. + * \n 1 : Constrained encoding mode supported. + * If this mode is supported client can enable this during initialization. + * Client can then force a picture to be coded as constrained picture where + * in-loop filtering is disabled across slice boundaries and prediction vectors for inter + * macroblocks in each slice will be restricted to the slice region. + */ + NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING = 24, + + /** + * Indicates Intra Refresh Mode Support. + * Support added from NvEncodeAPI version 2.0. + * \n 0 : Intra Refresh Mode not supported. + * \n 1 : Intra Refresh Mode supported. + */ + NV_ENC_CAPS_SUPPORT_INTRA_REFRESH = 25, + + /** + * Indicates Custom VBV Buffer Size support. It can be used for capping frame size. + * Support added from NvEncodeAPI version 2.0. + * \n 0 : Custom VBV buffer size specification from client, not supported. + * \n 1 : Custom VBV buffer size specification from client, supported. + */ + NV_ENC_CAPS_SUPPORT_CUSTOM_VBV_BUF_SIZE = 26, + + /** + * Indicates Dynamic Slice Mode Support. + * Support added from NvEncodeAPI version 2.0. + * \n 0 : Dynamic Slice Mode not supported. + * \n 1 : Dynamic Slice Mode supported. + */ + NV_ENC_CAPS_SUPPORT_DYNAMIC_SLICE_MODE = 27, + + /** + * Indicates Reference Picture Invalidation Support. + * Support added from NvEncodeAPI version 2.0. + * \n 0 : Reference Picture Invalidation not supported. + * \n 1 : Reference Picture Invalidation supported. + */ + NV_ENC_CAPS_SUPPORT_REF_PIC_INVALIDATION = 28, + + /** + * Indicates support for Pre-Processing. + * The API return value is a bitmask of the values defined in ::NV_ENC_PREPROC_FLAGS + */ + NV_ENC_CAPS_PREPROC_SUPPORT = 29, + + /** + * Indicates support Async mode. + * \n 0 : Async Encode mode not supported. + * \n 1 : Async Encode mode supported. + */ + NV_ENC_CAPS_ASYNC_ENCODE_SUPPORT = 30, + + /** + * Maximum MBs per frame supported. + */ + NV_ENC_CAPS_MB_NUM_MAX = 31, + + /** + * Maximum aggregate throughput in MBs per sec. + */ + NV_ENC_CAPS_MB_PER_SEC_MAX = 32, + + /** + * Indicates HW support for YUV444 mode encoding. + * \n 0 : YUV444 mode encoding not supported. + * \n 1 : YUV444 mode encoding supported. + */ + NV_ENC_CAPS_SUPPORT_YUV444_ENCODE = 33, + + /** + * Indicates HW support for lossless encoding. + * \n 0 : lossless encoding not supported. + * \n 1 : lossless encoding supported. + */ + NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE = 34, + + /** + * Indicates HW support for Sample Adaptive Offset. + * \n 0 : SAO not supported. + * \n 1 : SAO encoding supported. + */ + NV_ENC_CAPS_SUPPORT_SAO = 35, + + /** + * Indicates HW support for Motion Estimation Only Mode. + * \n 0 : MEOnly Mode not supported. + * \n 1 : MEOnly Mode supported for I and P frames. + * \n 2 : MEOnly Mode supported for I, P and B frames. + */ + NV_ENC_CAPS_SUPPORT_MEONLY_MODE = 36, + + /** + * Indicates HW support for lookahead encoding (enableLookahead=1). + * \n 0 : Lookahead not supported. + * \n 1 : Lookahead supported. + */ + NV_ENC_CAPS_SUPPORT_LOOKAHEAD = 37, + + /** + * Indicates HW support for temporal AQ encoding (enableTemporalAQ=1). + * \n 0 : Temporal AQ not supported. + * \n 1 : Temporal AQ supported. + */ + NV_ENC_CAPS_SUPPORT_TEMPORAL_AQ = 38, + /** + * Indicates HW support for 10 bit encoding. + * \n 0 : 10 bit encoding not supported. + * \n 1 : 10 bit encoding supported. + */ + NV_ENC_CAPS_SUPPORT_10BIT_ENCODE = 39, + /** + * Maximum number of Long Term Reference frames supported + */ + NV_ENC_CAPS_NUM_MAX_LTR_FRAMES = 40, + + /** + * Indicates HW support for Weighted Prediction. + * \n 0 : Weighted Prediction not supported. + * \n 1 : Weighted Prediction supported. + */ + NV_ENC_CAPS_SUPPORT_WEIGHTED_PREDICTION = 41, + + + /** + * On managed (vGPU) platforms (Windows only), this API, in conjunction with other GRID Management APIs, can be used + * to estimate the residual capacity of the hardware encoder on the GPU as a percentage of the total available encoder capacity. + * This API can be called at any time; i.e. during the encode session or before opening the encode session. + * If the available encoder capacity is returned as zero, applications may choose to switch to software encoding + * and continue to call this API (e.g. polling once per second) until capacity becomes available. + * + * On bare metal (non-virtualized GPU) and linux platforms, this API always returns 100. + */ + NV_ENC_CAPS_DYNAMIC_QUERY_ENCODER_CAPACITY = 42, + + /** + * Indicates B as reference support. + * \n 0 : B as reference is not supported. + * \n 1 : each B-Frame as reference is supported. + * \n 2 : only Middle B-frame as reference is supported. + */ + NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE = 43, + + /** + * Indicates HW support for Emphasis Level Map based delta QP computation. + * \n 0 : Emphasis Level Map based delta QP not supported. + * \n 1 : Emphasis Level Map based delta QP is supported. + */ + NV_ENC_CAPS_SUPPORT_EMPHASIS_LEVEL_MAP = 44, + + /** + * Minimum input width supported. + */ + NV_ENC_CAPS_WIDTH_MIN = 45, + + /** + * Minimum input height supported. + */ + NV_ENC_CAPS_HEIGHT_MIN = 46, + + /** + * Indicates HW support for multiple reference frames. + */ + NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES = 47, + + /** + * Indicates HW support for HEVC with alpha encoding. + * \n 0 : HEVC with alpha encoding not supported. + * \n 1 : HEVC with alpha encoding is supported. + */ + NV_ENC_CAPS_SUPPORT_ALPHA_LAYER_ENCODING = 48, + + /** + * Indicates number of Encoding engines present on GPU. + */ + NV_ENC_CAPS_NUM_ENCODER_ENGINES = 49, + + /** + * Reserved - Not to be used by clients. + */ + NV_ENC_CAPS_EXPOSED_COUNT = 50; + +/** + * HEVC CU SIZE + */ +/** enum _NV_ENC_HEVC_CUSIZE */ +public static final int + NV_ENC_HEVC_CUSIZE_AUTOSELECT = 0, + NV_ENC_HEVC_CUSIZE_8x8 = 1, + NV_ENC_HEVC_CUSIZE_16x16 = 2, + NV_ENC_HEVC_CUSIZE_32x32 = 3, + NV_ENC_HEVC_CUSIZE_64x64 = 4; +// Targeting ../nvencodeapi/NV_ENC_CAPS_PARAM.java + + + +/** NV_ENC_CAPS_PARAM struct version. */ +public static native @MemberGetter int NV_ENC_CAPS_PARAM_VER(); +public static final int NV_ENC_CAPS_PARAM_VER = NV_ENC_CAPS_PARAM_VER(); +// Targeting ../nvencodeapi/NV_ENC_ENCODE_OUT_PARAMS.java + + + +/** NV_ENC_ENCODE_OUT_PARAMS struct version. */ +public static native @MemberGetter int NV_ENC_ENCODE_OUT_PARAMS_VER(); +public static final int NV_ENC_ENCODE_OUT_PARAMS_VER = NV_ENC_ENCODE_OUT_PARAMS_VER(); +// Targeting ../nvencodeapi/NV_ENC_CREATE_INPUT_BUFFER.java + + + +/** NV_ENC_CREATE_INPUT_BUFFER struct version. */ +public static native @MemberGetter int NV_ENC_CREATE_INPUT_BUFFER_VER(); +public static final int NV_ENC_CREATE_INPUT_BUFFER_VER = NV_ENC_CREATE_INPUT_BUFFER_VER(); +// Targeting ../nvencodeapi/NV_ENC_CREATE_BITSTREAM_BUFFER.java + + + +/** NV_ENC_CREATE_BITSTREAM_BUFFER struct version. */ +public static native @MemberGetter int NV_ENC_CREATE_BITSTREAM_BUFFER_VER(); +public static final int NV_ENC_CREATE_BITSTREAM_BUFFER_VER = NV_ENC_CREATE_BITSTREAM_BUFFER_VER(); +// Targeting ../nvencodeapi/NV_ENC_MVECTOR.java + + +// Targeting ../nvencodeapi/NV_ENC_H264_MV_DATA.java + + +// Targeting ../nvencodeapi/NV_ENC_HEVC_MV_DATA.java + + +// Targeting ../nvencodeapi/NV_ENC_CREATE_MV_BUFFER.java + + + +/** NV_ENC_CREATE_MV_BUFFER struct version*/ +public static native @MemberGetter int NV_ENC_CREATE_MV_BUFFER_VER(); +public static final int NV_ENC_CREATE_MV_BUFFER_VER = NV_ENC_CREATE_MV_BUFFER_VER(); +// Targeting ../nvencodeapi/NV_ENC_QP.java + + +// Targeting ../nvencodeapi/NV_ENC_RC_PARAMS.java + + + +/** macro for constructing the version field of ::_NV_ENC_RC_PARAMS */ +public static native @MemberGetter int NV_ENC_RC_PARAMS_VER(); +public static final int NV_ENC_RC_PARAMS_VER = NV_ENC_RC_PARAMS_VER(); +// Targeting ../nvencodeapi/NV_ENC_CONFIG_H264_VUI_PARAMETERS.java + + +// Targeting ../nvencodeapi/NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE.java + + +// Targeting ../nvencodeapi/NVENC_EXTERNAL_ME_HINT.java + + +// Targeting ../nvencodeapi/NV_ENC_CONFIG_H264.java + + +// Targeting ../nvencodeapi/NV_ENC_CONFIG_HEVC.java + + +// Targeting ../nvencodeapi/NV_ENC_CONFIG_H264_MEONLY.java + + +// Targeting ../nvencodeapi/NV_ENC_CONFIG_HEVC_MEONLY.java + + +// Targeting ../nvencodeapi/NV_ENC_CODEC_CONFIG.java + + +// Targeting ../nvencodeapi/NV_ENC_CONFIG.java + + + +/** macro for constructing the version field of ::_NV_ENC_CONFIG */ +public static native @MemberGetter int NV_ENC_CONFIG_VER(); +public static final int NV_ENC_CONFIG_VER = NV_ENC_CONFIG_VER(); + +/** + * Tuning information of NVENC encoding (TuningInfo is not applicable to H264 and HEVC MEOnly mode). + */ +/** enum NV_ENC_TUNING_INFO */ +public static final int + /** Undefined tuningInfo. Invalid value for encoding. */ + NV_ENC_TUNING_INFO_UNDEFINED = 0, + /** Tune presets for latency tolerant encoding.*/ + NV_ENC_TUNING_INFO_HIGH_QUALITY = 1, + /** Tune presets for low latency streaming.*/ + NV_ENC_TUNING_INFO_LOW_LATENCY = 2, + /** Tune presets for ultra low latency streaming.*/ + NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY = 3, + /** Tune presets for lossless encoding.*/ + NV_ENC_TUNING_INFO_LOSSLESS = 4, + /** Count number of tuningInfos. Invalid value. */ + NV_ENC_TUNING_INFO_COUNT = 5; +// Targeting ../nvencodeapi/NV_ENC_INITIALIZE_PARAMS.java + + + +/** macro for constructing the version field of ::_NV_ENC_INITIALIZE_PARAMS */ +public static native @MemberGetter int NV_ENC_INITIALIZE_PARAMS_VER(); +public static final int NV_ENC_INITIALIZE_PARAMS_VER = NV_ENC_INITIALIZE_PARAMS_VER(); +// Targeting ../nvencodeapi/NV_ENC_RECONFIGURE_PARAMS.java + + + +/** macro for constructing the version field of ::_NV_ENC_RECONFIGURE_PARAMS */ +public static native @MemberGetter int NV_ENC_RECONFIGURE_PARAMS_VER(); +public static final int NV_ENC_RECONFIGURE_PARAMS_VER = NV_ENC_RECONFIGURE_PARAMS_VER(); +// Targeting ../nvencodeapi/NV_ENC_PRESET_CONFIG.java + + + +/** macro for constructing the version field of ::_NV_ENC_PRESET_CONFIG */ +public static native @MemberGetter int NV_ENC_PRESET_CONFIG_VER(); +public static final int NV_ENC_PRESET_CONFIG_VER = NV_ENC_PRESET_CONFIG_VER(); +// Targeting ../nvencodeapi/NV_ENC_PIC_PARAMS_MVC.java + + + +/** macro for constructing the version field of ::_NV_ENC_PIC_PARAMS_MVC */ +public static native @MemberGetter int NV_ENC_PIC_PARAMS_MVC_VER(); +public static final int NV_ENC_PIC_PARAMS_MVC_VER = NV_ENC_PIC_PARAMS_MVC_VER(); +// Targeting ../nvencodeapi/NV_ENC_PIC_PARAMS_H264_EXT.java + + +// Targeting ../nvencodeapi/NV_ENC_SEI_PAYLOAD.java + + + +// #define NV_ENC_H264_SEI_PAYLOAD NV_ENC_SEI_PAYLOAD +// Targeting ../nvencodeapi/NV_ENC_PIC_PARAMS_H264.java + + +// Targeting ../nvencodeapi/NV_ENC_PIC_PARAMS_HEVC.java + + +// Targeting ../nvencodeapi/NV_ENC_CODEC_PIC_PARAMS.java + + +// Targeting ../nvencodeapi/NV_ENC_PIC_PARAMS.java + + + +/** Macro for constructing the version field of ::_NV_ENC_PIC_PARAMS */ +public static native @MemberGetter int NV_ENC_PIC_PARAMS_VER(); +public static final int NV_ENC_PIC_PARAMS_VER = NV_ENC_PIC_PARAMS_VER(); +// Targeting ../nvencodeapi/NV_ENC_MEONLY_PARAMS.java + + + +/** NV_ENC_MEONLY_PARAMS struct version*/ +public static native @MemberGetter int NV_ENC_MEONLY_PARAMS_VER(); +public static final int NV_ENC_MEONLY_PARAMS_VER = NV_ENC_MEONLY_PARAMS_VER(); +// Targeting ../nvencodeapi/NV_ENC_LOCK_BITSTREAM.java + + + +/** Macro for constructing the version field of ::_NV_ENC_LOCK_BITSTREAM */ +public static native @MemberGetter int NV_ENC_LOCK_BITSTREAM_VER(); +public static final int NV_ENC_LOCK_BITSTREAM_VER = NV_ENC_LOCK_BITSTREAM_VER(); +// Targeting ../nvencodeapi/NV_ENC_LOCK_INPUT_BUFFER.java + + + +/** Macro for constructing the version field of ::_NV_ENC_LOCK_INPUT_BUFFER */ +public static native @MemberGetter int NV_ENC_LOCK_INPUT_BUFFER_VER(); +public static final int NV_ENC_LOCK_INPUT_BUFFER_VER = NV_ENC_LOCK_INPUT_BUFFER_VER(); +// Targeting ../nvencodeapi/NV_ENC_MAP_INPUT_RESOURCE.java + + + +/** Macro for constructing the version field of ::_NV_ENC_MAP_INPUT_RESOURCE */ +public static native @MemberGetter int NV_ENC_MAP_INPUT_RESOURCE_VER(); +public static final int NV_ENC_MAP_INPUT_RESOURCE_VER = NV_ENC_MAP_INPUT_RESOURCE_VER(); +// Targeting ../nvencodeapi/NV_ENC_INPUT_RESOURCE_OPENGL_TEX.java + + +// Targeting ../nvencodeapi/NV_ENC_REGISTER_RESOURCE.java + + + +/** Macro for constructing the version field of ::_NV_ENC_REGISTER_RESOURCE */ +public static native @MemberGetter int NV_ENC_REGISTER_RESOURCE_VER(); +public static final int NV_ENC_REGISTER_RESOURCE_VER = NV_ENC_REGISTER_RESOURCE_VER(); +// Targeting ../nvencodeapi/NV_ENC_STAT.java + + + +/** Macro for constructing the version field of ::_NV_ENC_STAT */ +public static native @MemberGetter int NV_ENC_STAT_VER(); +public static final int NV_ENC_STAT_VER = NV_ENC_STAT_VER(); +// Targeting ../nvencodeapi/NV_ENC_SEQUENCE_PARAM_PAYLOAD.java + + + +/** Macro for constructing the version field of ::_NV_ENC_SEQUENCE_PARAM_PAYLOAD */ +public static native @MemberGetter int NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER(); +public static final int NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER = NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER(); +// Targeting ../nvencodeapi/NV_ENC_EVENT_PARAMS.java + + + +/** Macro for constructing the version field of ::_NV_ENC_EVENT_PARAMS */ +public static native @MemberGetter int NV_ENC_EVENT_PARAMS_VER(); +public static final int NV_ENC_EVENT_PARAMS_VER = NV_ENC_EVENT_PARAMS_VER(); +// Targeting ../nvencodeapi/NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.java + + +/** Macro for constructing the version field of ::_NV_ENC_OPEN_ENCODE_SESSIONEX_PARAMS */ +public static native @MemberGetter int NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER(); +public static final int NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER(); + +/** \} */ /* END ENCODER_STRUCTURE */ + + +/** + * \addtogroup ENCODE_FUNC NvEncodeAPI Functions + * \{ + */ + +// NvEncOpenEncodeSession +/** + * \brief Opens an encoding session. + * + * Deprecated. + * + * @return + * ::NV_ENC_ERR_INVALID_CALL\n + * + */ + + +// NvEncGetEncodeGuidCount +/** + * \brief Retrieves the number of supported encode GUIDs. + * + * The function returns the number of codec GUIDs supported by the NvEncodeAPI + * interface. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeGUIDCount [out] + * Number of supported encode GUIDs. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncGetEncodeGUIDs +/** + * \brief Retrieves an array of supported encoder codec GUIDs. + * + * The function returns an array of codec GUIDs supported by the NvEncodeAPI interface. + * The client must allocate an array where the NvEncodeAPI interface can + * fill the supported GUIDs and pass the pointer in \p *GUIDs parameter. + * The size of the array can be determined by using ::NvEncGetEncodeGUIDCount() API. + * The Nvidia Encoding interface returns the number of codec GUIDs it has actually + * filled in the GUID array in the \p GUIDCount parameter. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param guidArraySize [in] + * Number of GUIDs to retrieved. Should be set to the number retrieved using + * ::NvEncGetEncodeGUIDCount. + * @param GUIDs [out] + * Array of supported Encode GUIDs. + * @param GUIDCount [out] + * Number of supported Encode GUIDs. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncGetEncodeProfileGuidCount +/** + * \brief Retrieves the number of supported profile GUIDs. + * + * The function returns the number of profile GUIDs supported for a given codec. + * The client must first enumerate the codec GUIDs supported by the NvEncodeAPI + * interface. After determining the codec GUID, it can query the NvEncodeAPI + * interface to determine the number of profile GUIDs supported for a particular + * codec GUID. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeGUID [in] + * The codec GUID for which the profile GUIDs are being enumerated. + * @param encodeProfileGUIDCount [out] + * Number of encode profiles supported for the given encodeGUID. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncGetEncodeProfileGUIDs +/** + * \brief Retrieves an array of supported encode profile GUIDs. + * + * The function returns an array of supported profile GUIDs for a particular + * codec GUID. The client must allocate an array where the NvEncodeAPI interface + * can populate the profile GUIDs. The client can determine the array size using + * ::NvEncGetEncodeProfileGUIDCount() API. The client must also validiate that the + * NvEncodeAPI interface supports the GUID the client wants to pass as \p encodeGUID + * parameter. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeGUID [in] + * The encode GUID whose profile GUIDs are being enumerated. + * @param guidArraySize [in] + * Number of GUIDs to be retrieved. Should be set to the number retrieved using + * ::NvEncGetEncodeProfileGUIDCount. + * @param profileGUIDs [out] + * Array of supported Encode Profile GUIDs + * @param GUIDCount [out] + * Number of valid encode profile GUIDs in \p profileGUIDs array. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncGetInputFormatCount +/** + * \brief Retrieve the number of supported Input formats. + * + * The function returns the number of supported input formats. The client must + * query the NvEncodeAPI interface to determine the supported input formats + * before creating the input surfaces. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeGUID [in] + * Encode GUID, corresponding to which the number of supported input formats + * is to be retrieved. + * @param inputFmtCount [out] + * Number of input formats supported for specified Encode GUID. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + */ + + + +// NvEncGetInputFormats +/** + * \brief Retrieves an array of supported Input formats + * + * Returns an array of supported input formats The client must use the input + * format to create input surface using ::NvEncCreateInputBuffer() API. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeGUID [in] + * Encode GUID, corresponding to which the number of supported input formats + * is to be retrieved. + *@param inputFmtArraySize [in] + * Size input format count array passed in \p inputFmts. + *@param inputFmts [out] + * Array of input formats supported for this Encode GUID. + *@param inputFmtCount [out] + * The number of valid input format types returned by the NvEncodeAPI + * interface in \p inputFmts array. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncGetEncodeCaps +/** + * \brief Retrieves the capability value for a specified encoder attribute. + * + * The function returns the capability value for a given encoder attribute. The + * client must validate the encodeGUID using ::NvEncGetEncodeGUIDs() API before + * calling this function. The encoder attribute being queried are enumerated in + * ::NV_ENC_CAPS_PARAM enum. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeGUID [in] + * Encode GUID, corresponding to which the capability attribute is to be retrieved. + * @param capsParam [in] + * Used to specify attribute being queried. Refer ::NV_ENC_CAPS_PARAM for more + * details. + * @param capsVal [out] + * The value corresponding to the capability attribute being queried. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + */ + + + +// NvEncGetEncodePresetCount +/** + * \brief Retrieves the number of supported preset GUIDs. + * + * The function returns the number of preset GUIDs available for a given codec. + * The client must validate the codec GUID using ::NvEncGetEncodeGUIDs() API + * before calling this function. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeGUID [in] + * Encode GUID, corresponding to which the number of supported presets is to + * be retrieved. + * @param encodePresetGUIDCount [out] + * Receives the number of supported preset GUIDs. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncGetEncodePresetGUIDs +/** + * \brief Receives an array of supported encoder preset GUIDs. + * + * The function returns an array of encode preset GUIDs available for a given codec. + * The client can directly use one of the preset GUIDs based upon the use case + * or target device. The preset GUID chosen can be directly used in + * NV_ENC_INITIALIZE_PARAMS::presetGUID parameter to ::NvEncEncodePicture() API. + * Alternately client can also use the preset GUID to retrieve the encoding config + * parameters being used by NvEncodeAPI interface for that given preset, using + * ::NvEncGetEncodePresetConfig() API. It can then modify preset config parameters + * as per its use case and send it to NvEncodeAPI interface as part of + * NV_ENC_INITIALIZE_PARAMS::encodeConfig parameter for NvEncInitializeEncoder() + * API. + * + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeGUID [in] + * Encode GUID, corresponding to which the list of supported presets is to be + * retrieved. + * @param guidArraySize [in] + * Size of array of preset GUIDs passed in \p preset GUIDs + * @param presetGUIDs [out] + * Array of supported Encode preset GUIDs from the NvEncodeAPI interface + * to client. + * @param encodePresetGUIDCount [out] + * Receives the number of preset GUIDs returned by the NvEncodeAPI + * interface. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncGetEncodePresetConfig +/** + * \brief Returns a preset config structure supported for given preset GUID. + * + * The function returns a preset config structure for a given preset GUID. Before + * using this function the client must enumerate the preset GUIDs available for + * a given codec. The preset config structure can be modified by the client depending + * upon its use case and can be then used to initialize the encoder using + * ::NvEncInitializeEncoder() API. The client can use this function only if it + * wants to modify the NvEncodeAPI preset configuration, otherwise it can + * directly use the preset GUID. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeGUID [in] + * Encode GUID, corresponding to which the list of supported presets is to be + * retrieved. + * @param presetGUID [in] + * Preset GUID, corresponding to which the Encoding configurations is to be + * retrieved. + * @param presetConfig [out] + * The requested Preset Encoder Attribute set. Refer ::_NV_ENC_CONFIG for +* more details. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncGetEncodePresetConfigEx +/** + * \brief Returns a preset config structure supported for given preset GUID. + * + * The function returns a preset config structure for a given preset GUID and tuning info. + * NvEncGetEncodePresetConfigEx() API is not applicable to H264 and HEVC meonly mode. + * Before using this function the client must enumerate the preset GUIDs available for + * a given codec. The preset config structure can be modified by the client depending + * upon its use case and can be then used to initialize the encoder using + * ::NvEncInitializeEncoder() API. The client can use this function only if it + * wants to modify the NvEncodeAPI preset configuration, otherwise it can + * directly use the preset GUID. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeGUID [in] + * Encode GUID, corresponding to which the list of supported presets is to be + * retrieved. + * @param presetGUID [in] + * Preset GUID, corresponding to which the Encoding configurations is to be + * retrieved. + * @param tuningInfo [in] + * tuning info, corresponding to which the Encoding configurations is to be + * retrieved. + * @param presetConfig [out] + * The requested Preset Encoder Attribute set. Refer ::_NV_ENC_CONFIG for + * more details. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncInitializeEncoder +/** + * \brief Initialize the encoder. + * + * This API must be used to initialize the encoder. The initialization parameter + * is passed using \p *createEncodeParams The client must send the following + * fields of the _NV_ENC_INITIALIZE_PARAMS structure with a valid value. + * - NV_ENC_INITIALIZE_PARAMS::encodeGUID + * - NV_ENC_INITIALIZE_PARAMS::encodeWidth + * - NV_ENC_INITIALIZE_PARAMS::encodeHeight + * + * The client can pass a preset GUID directly to the NvEncodeAPI interface using + * NV_ENC_INITIALIZE_PARAMS::presetGUID field. If the client doesn't pass + * NV_ENC_INITIALIZE_PARAMS::encodeConfig structure, the codec specific parameters + * will be selected based on the preset GUID. The preset GUID must have been + * validated by the client using ::NvEncGetEncodePresetGUIDs() API. + * If the client passes a custom ::_NV_ENC_CONFIG structure through + * NV_ENC_INITIALIZE_PARAMS::encodeConfig , it will override the codec specific parameters + * based on the preset GUID. It is recommended that even if the client passes a custom config, + * it should also send a preset GUID. In this case, the preset GUID passed by the client + * will not override any of the custom config parameters programmed by the client, + * it is only used as a hint by the NvEncodeAPI interface to determine certain encoder parameters + * which are not exposed to the client. + * + * There are two modes of operation for the encoder namely: + * - Asynchronous mode + * - Synchronous mode + * + * The client can select asynchronous or synchronous mode by setting the \p + * enableEncodeAsync field in ::_NV_ENC_INITIALIZE_PARAMS to 1 or 0 respectively. + *\par Asynchronous mode of operation: + * The Asynchronous mode can be enabled by setting NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync to 1. + * The client operating in asynchronous mode must allocate completion event object + * for each output buffer and pass the completion event object in the + * ::NvEncEncodePicture() API. The client can create another thread and wait on + * the event object to be signaled by NvEncodeAPI interface on completion of the + * encoding process for the output frame. This should unblock the main thread from + * submitting work to the encoder. When the event is signaled the client can call + * NvEncodeAPI interfaces to copy the bitstream data using ::NvEncLockBitstream() + * API. This is the preferred mode of operation. + * + * NOTE: Asynchronous mode is not supported on Linux. + * + *\par Synchronous mode of operation: + * The client can select synchronous mode by setting NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync to 0. + * The client working in synchronous mode can work in a single threaded or multi + * threaded mode. The client need not allocate any event objects. The client can + * only lock the bitstream data after NvEncodeAPI interface has returned + * ::NV_ENC_SUCCESS from encode picture. The NvEncodeAPI interface can return + * ::NV_ENC_ERR_NEED_MORE_INPUT error code from ::NvEncEncodePicture() API. The + * client must not lock the output buffer in such case but should send the next + * frame for encoding. The client must keep on calling ::NvEncEncodePicture() API + * until it returns ::NV_ENC_SUCCESS. \n + * The client must always lock the bitstream data in order in which it has submitted. + * This is true for both asynchronous and synchronous mode. + * + *\par Picture type decision: + * If the client is taking the picture type decision and it must disable the picture + * type decision module in NvEncodeAPI by setting NV_ENC_INITIALIZE_PARAMS::enablePTD + * to 0. In this case the client is required to send the picture in encoding + * order to NvEncodeAPI by doing the re-ordering for B frames. \n + * If the client doesn't want to take the picture type decision it can enable + * picture type decision module in the NvEncodeAPI interface by setting + * NV_ENC_INITIALIZE_PARAMS::enablePTD to 1 and send the input pictures in display + * order. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param createEncodeParams [in] + * Refer ::_NV_ENC_INITIALIZE_PARAMS for details. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncCreateInputBuffer +/** + * \brief Allocates Input buffer. + * + * This function is used to allocate an input buffer. The client must enumerate + * the input buffer format before allocating the input buffer resources. The + * NV_ENC_INPUT_PTR returned by the NvEncodeAPI interface in the + * NV_ENC_CREATE_INPUT_BUFFER::inputBuffer field can be directly used in + * ::NvEncEncodePicture() API. The number of input buffers to be allocated by the + * client must be at least 4 more than the number of B frames being used for encoding. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param createInputBufferParams [in,out] + * Pointer to the ::NV_ENC_CREATE_INPUT_BUFFER structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncDestroyInputBuffer +/** + * \brief Release an input buffers. + * + * This function is used to free an input buffer. If the client has allocated + * any input buffer using ::NvEncCreateInputBuffer() API, it must free those + * input buffers by calling this function. The client must release the input + * buffers before destroying the encoder using ::NvEncDestroyEncoder() API. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param inputBuffer [in] + * Pointer to the input buffer to be released. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncSetIOCudaStreams +/** + * \brief Set input and output CUDA stream for specified encoder attribute. + * + * Encoding may involve CUDA pre-processing on the input and post-processing on encoded output. + * This function is used to set input and output CUDA streams to pipeline the CUDA pre-processing + * and post-processing tasks. Clients should call this function before the call to + * NvEncUnlockInputBuffer(). If this function is not called, the default CUDA stream is used for + * input and output processing. After a successful call to this function, the streams specified + * in that call will replace the previously-used streams. + * This API is supported for NVCUVID interface only. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param inputStream [in] + * Pointer to CUstream which is used to process ::NV_ENC_PIC_PARAMS::inputFrame for encode. + * In case of ME-only mode, inputStream is used to process ::NV_ENC_MEONLY_PARAMS::inputBuffer and + * ::NV_ENC_MEONLY_PARAMS::referenceFrame + * @param outputStream [in] + * Pointer to CUstream which is used to process ::NV_ENC_PIC_PARAMS::outputBuffer for encode. + * In case of ME-only mode, outputStream is used to process ::NV_ENC_MEONLY_PARAMS::mvBuffer + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_GENERIC \n + */ + + + +// NvEncCreateBitstreamBuffer +/** + * \brief Allocates an output bitstream buffer + * + * This function is used to allocate an output bitstream buffer and returns a + * NV_ENC_OUTPUT_PTR to bitstream buffer to the client in the + * NV_ENC_CREATE_BITSTREAM_BUFFER::bitstreamBuffer field. + * The client can only call this function after the encoder session has been + * initialized using ::NvEncInitializeEncoder() API. The minimum number of output + * buffers allocated by the client must be at least 4 more than the number of B + * B frames being used for encoding. The client can only access the output + * bitstream data by locking the \p bitstreamBuffer using the ::NvEncLockBitstream() + * function. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param createBitstreamBufferParams [in,out] + * Pointer ::NV_ENC_CREATE_BITSTREAM_BUFFER for details. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncDestroyBitstreamBuffer +/** + * \brief Release a bitstream buffer. + * + * This function is used to release the output bitstream buffer allocated using + * the ::NvEncCreateBitstreamBuffer() function. The client must release the output + * bitstreamBuffer using this function before destroying the encoder session. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param bitstreamBuffer [in] + * Pointer to the bitstream buffer being released. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncEncodePicture +/** + * \brief Submit an input picture for encoding. + * + * This function is used to submit an input picture buffer for encoding. The + * encoding parameters are passed using \p *encodePicParams which is a pointer + * to the ::_NV_ENC_PIC_PARAMS structure. + * + * If the client has set NV_ENC_INITIALIZE_PARAMS::enablePTD to 0, then it must + * send a valid value for the following fields. + * - NV_ENC_PIC_PARAMS::pictureType + * - NV_ENC_PIC_PARAMS_H264::displayPOCSyntax (H264 only) + * - NV_ENC_PIC_PARAMS_H264::frameNumSyntax(H264 only) + * - NV_ENC_PIC_PARAMS_H264::refPicFlag(H264 only) + * + *\par MVC Encoding: + * For MVC encoding the client must call encode picture API for each view separately + * and must pass valid view id in NV_ENC_PIC_PARAMS_MVC::viewID field. Currently + * NvEncodeAPI only support stereo MVC so client must send viewID as 0 for base + * view and view ID as 1 for dependent view. + * + *\par Asynchronous Encoding + * If the client has enabled asynchronous mode of encoding by setting + * NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync to 1 in the ::NvEncInitializeEncoder() + * API ,then the client must send a valid NV_ENC_PIC_PARAMS::completionEvent. + * Incase of asynchronous mode of operation, client can queue the ::NvEncEncodePicture() + * API commands from the main thread and then queue output buffers to be processed + * to a secondary worker thread. Before the locking the output buffers in the + * secondary thread , the client must wait on NV_ENC_PIC_PARAMS::completionEvent + * it has queued in ::NvEncEncodePicture() API call. The client must always process + * completion event and the output buffer in the same order in which they have been + * submitted for encoding. The NvEncodeAPI interface is responsible for any + * re-ordering required for B frames and will always ensure that encoded bitstream + * data is written in the same order in which output buffer is submitted. + * The NvEncodeAPI interface may return ::NV_ENC_ERR_NEED_MORE_INPUT error code for + * some ::NvEncEncodePicture() API calls but the client must not treat it as a fatal error. + * The NvEncodeAPI interface might not be able to submit an input picture buffer for encoding + * immediately due to re-ordering for B frames. + *
{@code
+  The below example shows how  asynchronous encoding in case of 1 B frames
+  ------------------------------------------------------------------------
+  Suppose the client allocated 4 input buffers(I1,I2..), 4 output buffers(O1,O2..) 
+  and 4 completion events(E1, E2, ...). The NvEncodeAPI interface will need to 
+  keep a copy of the input buffers for re-ordering and it allocates following 
+  internal buffers (NvI1, NvI2...). These internal buffers are managed by NvEncodeAPI
+  and the client is not responsible for the allocating or freeing the memory of 
+  the internal buffers.
+
+  a) The client main thread will queue the following encode frame calls. 
+  Note the picture type is unknown to the client, the decision is being taken by 
+  NvEncodeAPI interface. The client should pass ::_NV_ENC_PIC_PARAMS parameter  
+  consisting of allocated input buffer, output buffer and output events in successive 
+  ::NvEncEncodePicture() API calls along with other required encode picture params.
+  For example:
+  1st EncodePicture parameters - (I1, O1, E1)
+  2nd EncodePicture parameters - (I2, O2, E2)
+  3rd EncodePicture parameters - (I3, O3, E3)
+
+  b) NvEncodeAPI SW will receive the following encode Commands from the client. 
+  The left side shows input from client in the form (Input buffer, Output Buffer, 
+  Output Event). The right hand side shows a possible picture type decision take by
+  the NvEncodeAPI interface.
+  (I1, O1, E1)    ---P1 Frame
+  (I2, O2, E2)    ---B2 Frame
+  (I3, O3, E3)    ---P3 Frame
+
+  c) NvEncodeAPI interface will make a copy of the input buffers to its internal  
+   buffers for re-ordering. These copies are done as part of nvEncEncodePicture  
+   function call from the client and NvEncodeAPI interface is responsible for  
+   synchronization of copy operation with the actual encoding operation.
+   I1 --> NvI1  
+   I2 --> NvI2 
+   I3 --> NvI3
+
+   d) The NvEncodeAPI encodes I1 as P frame and submits I1 to encoder HW and returns ::NV_ENC_SUCCESS.
+   The NvEncodeAPI tries to encode I2 as B frame and fails with ::NV_ENC_ERR_NEED_MORE_INPUT error code.
+   The error is not fatal and it notifies client that I2 is not submitted to encoder immediately.
+   The NvEncodeAPI encodes I3 as P frame and submits I3 for encoding which will be used as  backward 
+   reference frame for I2. The NvEncodeAPI then submits I2 for encoding and returns ::NV_ENC_SUCESS.
+   Both the submission are part of the same ::NvEncEncodePicture() function call.
+
+  e) After returning from ::NvEncEncodePicture() call , the client must queue the output
+   bitstream  processing work to the secondary thread. The output bitstream processing
+   for asynchronous mode consist of first waiting on completion event(E1, E2..)
+   and then locking the output bitstream buffer(O1, O2..) for reading the encoded
+   data. The work queued to the secondary thread by the client is in the following order
+   (I1, O1, E1)
+   (I2, O2, E2)
+   (I3, O3, E3)
+   Note they are in the same order in which client calls ::NvEncEncodePicture() API 
+   in \p step a).
+
+  f) NvEncodeAPI interface  will do the re-ordering such that Encoder HW will receive 
+  the following encode commands:
+  (NvI1, O1, E1)   ---P1 Frame
+  (NvI3, O2, E2)   ---P3 Frame
+  (NvI2, O3, E3)   ---B2 frame
+
+  g) After the encoding operations are completed, the events will be signaled 
+  by NvEncodeAPI interface in the following order :
+  (O1, E1) ---P1 Frame ,output bitstream copied to O1 and event E1 signaled.
+  (O2, E2) ---P3 Frame ,output bitstream copied to O2 and event E2 signaled.
+  (O3, E3) ---B2 Frame ,output bitstream copied to O3 and event E3 signaled.
+
+  h) The client must lock the bitstream data using ::NvEncLockBitstream() API in 
+   the order O1,O2,O3  to read the encoded data, after waiting for the events
+   to be signaled in the same order i.e E1, E2 and E3.The output processing is
+   done in the secondary thread in the following order:
+   Waits on E1, copies encoded bitstream from O1
+   Waits on E2, copies encoded bitstream from O2
+   Waits on E3, copies encoded bitstream from O3
+
+  -Note the client will receive the events signaling and output buffer in the 
+   same order in which they have submitted for encoding.
+  -Note the LockBitstream will have picture type field which will notify the 
+   output picture type to the clients.
+  -Note the input, output buffer and the output completion event are free to be 
+   reused once NvEncodeAPI interfaced has signaled the event and the client has
+   copied the data from the output buffer.
+
+ * }
+ * + *\par Synchronous Encoding + * The client can enable synchronous mode of encoding by setting + * NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync to 0 in ::NvEncInitializeEncoder() API. + * The NvEncodeAPI interface may return ::NV_ENC_ERR_NEED_MORE_INPUT error code for + * some ::NvEncEncodePicture() API calls when NV_ENC_INITIALIZE_PARAMS::enablePTD + * is set to 1, but the client must not treat it as a fatal error. The NvEncodeAPI + * interface might not be able to submit an input picture buffer for encoding + * immediately due to re-ordering for B frames. The NvEncodeAPI interface cannot + * submit the input picture which is decided to be encoded as B frame as it waits + * for backward reference from temporally subsequent frames. This input picture + * is buffered internally and waits for more input picture to arrive. The client + * must not call ::NvEncLockBitstream() API on the output buffers whose + * ::NvEncEncodePicture() API returns ::NV_ENC_ERR_NEED_MORE_INPUT. The client must + * wait for the NvEncodeAPI interface to return ::NV_ENC_SUCCESS before locking the + * output bitstreams to read the encoded bitstream data. The following example + * explains the scenario with synchronous encoding with 2 B frames. + *
{@code
+ The below example shows how  synchronous encoding works in case of 1 B frames
+ -----------------------------------------------------------------------------
+ Suppose the client allocated 4 input buffers(I1,I2..), 4 output buffers(O1,O2..) 
+ and 4 completion events(E1, E2, ...). The NvEncodeAPI interface will need to 
+ keep a copy of the input buffers for re-ordering and it allocates following 
+ internal buffers (NvI1, NvI2...). These internal buffers are managed by NvEncodeAPI
+ and the client is not responsible for the allocating or freeing the memory of 
+ the internal buffers.
+
+ The client calls ::NvEncEncodePicture() API with input buffer I1 and output buffer O1.
+ The NvEncodeAPI decides to encode I1 as P frame and submits it to encoder
+ HW and returns ::NV_ENC_SUCCESS. 
+ The client can now read the encoded data by locking the output O1 by calling
+ NvEncLockBitstream API.
+
+ The client calls ::NvEncEncodePicture() API with input buffer I2 and output buffer O2.
+ The NvEncodeAPI decides to encode I2 as B frame and buffers I2 by copying it
+ to internal buffer and returns ::NV_ENC_ERR_NEED_MORE_INPUT.
+ The error is not fatal and it notifies client that it cannot read the encoded 
+ data by locking the output O2 by calling ::NvEncLockBitstream() API without submitting
+ more work to the NvEncodeAPI interface.
+  
+ The client calls ::NvEncEncodePicture() with input buffer I3 and output buffer O3.
+ The NvEncodeAPI decides to encode I3 as P frame and it first submits I3 for 
+ encoding which will be used as backward reference frame for I2.
+ The NvEncodeAPI then submits I2 for encoding and returns ::NV_ENC_SUCESS. Both
+ the submission are part of the same ::NvEncEncodePicture() function call.
+ The client can now read the encoded data for both the frames by locking the output
+ O2 followed by  O3 ,by calling ::NvEncLockBitstream() API.
+
+ The client must always lock the output in the same order in which it has submitted
+ to receive the encoded bitstream in correct encoding order.
+
+ * }
+ * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodePicParams [in,out] + * Pointer to the ::_NV_ENC_PIC_PARAMS structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_ENCODER_BUSY \n + * ::NV_ENC_ERR_NEED_MORE_INPUT \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncLockBitstream +/** + * \brief Lock output bitstream buffer + * + * This function is used to lock the bitstream buffer to read the encoded data. + * The client can only access the encoded data by calling this function. + * The pointer to client accessible encoded data is returned in the + * NV_ENC_LOCK_BITSTREAM::bitstreamBufferPtr field. The size of the encoded data + * in the output buffer is returned in the NV_ENC_LOCK_BITSTREAM::bitstreamSizeInBytes + * The NvEncodeAPI interface also returns the output picture type and picture structure + * of the encoded frame in NV_ENC_LOCK_BITSTREAM::pictureType and + * NV_ENC_LOCK_BITSTREAM::pictureStruct fields respectively. If the client has + * set NV_ENC_LOCK_BITSTREAM::doNotWait to 1, the function might return + * ::NV_ENC_ERR_LOCK_BUSY if client is operating in synchronous mode. This is not + * a fatal failure if NV_ENC_LOCK_BITSTREAM::doNotWait is set to 1. In the above case the client can + * retry the function after few milliseconds. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param lockBitstreamBufferParams [in,out] + * Pointer to the ::_NV_ENC_LOCK_BITSTREAM structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_LOCK_BUSY \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncUnlockBitstream +/** + * \brief Unlock the output bitstream buffer + * + * This function is used to unlock the output bitstream buffer after the client + * has read the encoded data from output buffer. The client must call this function + * to unlock the output buffer which it has previously locked using ::NvEncLockBitstream() + * function. Using a locked bitstream buffer in ::NvEncEncodePicture() API will cause + * the function to fail. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param bitstreamBuffer [in,out] + * bitstream buffer pointer being unlocked + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvLockInputBuffer +/** + * \brief Locks an input buffer + * + * This function is used to lock the input buffer to load the uncompressed YUV + * pixel data into input buffer memory. The client must pass the NV_ENC_INPUT_PTR + * it had previously allocated using ::NvEncCreateInputBuffer()in the + * NV_ENC_LOCK_INPUT_BUFFER::inputBuffer field. + * The NvEncodeAPI interface returns pointer to client accessible input buffer + * memory in NV_ENC_LOCK_INPUT_BUFFER::bufferDataPtr field. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param lockInputBufferParams [in,out] + * Pointer to the ::_NV_ENC_LOCK_INPUT_BUFFER structure + * + * @return + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_LOCK_BUSY \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvUnlockInputBuffer +/** + * \brief Unlocks the input buffer + * + * This function is used to unlock the input buffer memory previously locked for + * uploading YUV pixel data. The input buffer must be unlocked before being used + * again for encoding, otherwise NvEncodeAPI will fail the ::NvEncEncodePicture() + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param inputBuffer [in] + * Pointer to the input buffer that is being unlocked. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + * + */ + + + +// NvEncGetEncodeStats +/** + * \brief Get encoding statistics. + * + * This function is used to retrieve the encoding statistics. + * This API is not supported when encode device type is CUDA. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encodeStats [in,out] + * Pointer to the ::_NV_ENC_STAT structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncGetSequenceParams +/** + * \brief Get encoded sequence and picture header. + * + * This function can be used to retrieve the sequence and picture header out of + * band. The client must call this function only after the encoder has been + * initialized using ::NvEncInitializeEncoder() function. The client must + * allocate the memory where the NvEncodeAPI interface can copy the bitstream + * header and pass the pointer to the memory in NV_ENC_SEQUENCE_PARAM_PAYLOAD::spsppsBuffer. + * The size of buffer is passed in the field NV_ENC_SEQUENCE_PARAM_PAYLOAD::inBufferSize. + * The NvEncodeAPI interface will copy the bitstream header payload and returns + * the actual size of the bitstream header in the field + * NV_ENC_SEQUENCE_PARAM_PAYLOAD::outSPSPPSPayloadSize. + * The client must call ::NvEncGetSequenceParams() function from the same thread which is + * being used to call ::NvEncEncodePicture() function. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param sequenceParamPayload [in,out] + * Pointer to the ::_NV_ENC_SEQUENCE_PARAM_PAYLOAD structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncGetSequenceParamEx +/** + * \brief Get sequence and picture header. + * + * This function can be used to retrieve the sequence and picture header out of band, even when + * encoder has not been initialized using ::NvEncInitializeEncoder() function. + * The client must allocate the memory where the NvEncodeAPI interface can copy the bitstream + * header and pass the pointer to the memory in NV_ENC_SEQUENCE_PARAM_PAYLOAD::spsppsBuffer. + * The size of buffer is passed in the field NV_ENC_SEQUENCE_PARAM_PAYLOAD::inBufferSize. + * If encoder has not been initialized using ::NvEncInitializeEncoder() function, client must + * send NV_ENC_INITIALIZE_PARAMS as input. The NV_ENC_INITIALIZE_PARAMS passed must be same as the + * one which will be used for initializing encoder using ::NvEncInitializeEncoder() function later. + * If encoder is already initialized using ::NvEncInitializeEncoder() function, the provided + * NV_ENC_INITIALIZE_PARAMS structure is ignored. The NvEncodeAPI interface will copy the bitstream + * header payload and returns the actual size of the bitstream header in the field + * NV_ENC_SEQUENCE_PARAM_PAYLOAD::outSPSPPSPayloadSize. The client must call ::NvEncGetSequenceParamsEx() + * function from the same thread which is being used to call ::NvEncEncodePicture() function. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param encInitParams [in] + * Pointer to the _NV_ENC_INITIALIZE_PARAMS structure. + * @param sequenceParamPayload [in,out] + * Pointer to the ::_NV_ENC_SEQUENCE_PARAM_PAYLOAD structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncRegisterAsyncEvent +/** + * \brief Register event for notification to encoding completion. + * + * This function is used to register the completion event with NvEncodeAPI + * interface. The event is required when the client has configured the encoder to + * work in asynchronous mode. In this mode the client needs to send a completion + * event with every output buffer. The NvEncodeAPI interface will signal the + * completion of the encoding process using this event. Only after the event is + * signaled the client can get the encoded data using ::NvEncLockBitstream() function. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param eventParams [in] + * Pointer to the ::_NV_ENC_EVENT_PARAMS structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncUnregisterAsyncEvent +/** + * \brief Unregister completion event. + * + * This function is used to unregister completion event which has been previously + * registered using ::NvEncRegisterAsyncEvent() function. The client must unregister + * all events before destroying the encoder using ::NvEncDestroyEncoder() function. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param eventParams [in] + * Pointer to the ::_NV_ENC_EVENT_PARAMS structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncMapInputResource +/** + * \brief Map an externally created input resource pointer for encoding. + * + * Maps an externally allocated input resource [using and returns a NV_ENC_INPUT_PTR + * which can be used for encoding in the ::NvEncEncodePicture() function. The + * mapped resource is returned in the field NV_ENC_MAP_INPUT_RESOURCE::outputResourcePtr. + * The NvEncodeAPI interface also returns the buffer format of the mapped resource + * in the field NV_ENC_MAP_INPUT_RESOURCE::outbufferFmt. + * This function provides synchronization guarantee that any graphics work submitted + * on the input buffer is completed before the buffer is used for encoding. This is + * also true for compute (i.e. CUDA) work, provided that the previous workload using + * the input resource was submitted to the default stream. + * The client should not access any input buffer while they are mapped by the encoder. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param mapInputResParams [in,out] + * Pointer to the ::_NV_ENC_MAP_INPUT_RESOURCE structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_RESOURCE_NOT_REGISTERED \n + * ::NV_ENC_ERR_MAP_FAILED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + +// NvEncUnmapInputResource +/** + * \brief UnMaps a NV_ENC_INPUT_PTR which was mapped for encoding + * + * + * UnMaps an input buffer which was previously mapped using ::NvEncMapInputResource() + * API. The mapping created using ::NvEncMapInputResource() should be invalidated + * using this API before the external resource is destroyed by the client. The client + * must unmap the buffer after ::NvEncLockBitstream() API returns successfully for encode + * work submitted using the mapped input buffer. + * + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param mappedInputBuffer [in] + * Pointer to the NV_ENC_INPUT_PTR + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_RESOURCE_NOT_REGISTERED \n + * ::NV_ENC_ERR_RESOURCE_NOT_MAPPED \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncDestroyEncoder +/** + * \brief Destroy Encoding Session + * + * Destroys the encoder session previously created using ::NvEncOpenEncodeSession() + * function. The client must flush the encoder before freeing any resources. In order + * to flush the encoder the client must pass a NULL encode picture packet and either + * wait for the ::NvEncEncodePicture() function to return in synchronous mode or wait + * for the flush event to be signaled by the encoder in asynchronous mode. + * The client must free all the input and output resources created using the + * NvEncodeAPI interface before destroying the encoder. If the client is operating + * in asynchronous mode, it must also unregister the completion events previously + * registered. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncInvalidateRefFrames +/** + * \brief Invalidate reference frames + * + * Invalidates reference frame based on the time stamp provided by the client. + * The encoder marks any reference frames or any frames which have been reconstructed + * using the corrupt frame as invalid for motion estimation and uses older reference + * frames for motion estimation. The encoded forces the current frame to be encoded + * as an intra frame if no reference frames are left after invalidation process. + * This is useful for low latency application for error resiliency. The client + * is recommended to set NV_ENC_CONFIG_H264::maxNumRefFrames to a large value so + * that encoder can keep a backup of older reference frames in the DPB and can use them + * for motion estimation when the newer reference frames have been invalidated. + * This API can be called multiple times. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param invalidRefFrameTimeStamp [in] + * Timestamp of the invalid reference frames which needs to be invalidated. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncOpenEncodeSessionEx +/** + * \brief Opens an encoding session. + * + * Opens an encoding session and returns a pointer to the encoder interface in + * the \p **encoder parameter. The client should start encoding process by calling + * this API first. + * The client must pass a pointer to IDirect3DDevice9 device or CUDA context in the \p *device parameter. + * For the OpenGL interface, \p device must be NULL. An OpenGL context must be current when + * calling all NvEncodeAPI functions. + * If the creation of encoder session fails, the client must call ::NvEncDestroyEncoder API + * before exiting. + * + * @param openSessionExParams [in] + * Pointer to a ::NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS structure. + * @param encoder [out] + * Encode Session pointer to the NvEncodeAPI interface. + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_NO_ENCODE_DEVICE \n + * ::NV_ENC_ERR_UNSUPPORTED_DEVICE \n + * ::NV_ENC_ERR_INVALID_DEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + +// NvEncRegisterResource +/** + * \brief Registers a resource with the Nvidia Video Encoder Interface. + * + * Registers a resource with the Nvidia Video Encoder Interface for book keeping. + * The client is expected to pass the registered resource handle as well, while calling ::NvEncMapInputResource API. + * + * @param encoder [in] + * Pointer to the NVEncodeAPI interface. + * + * @param registerResParams [in] + * Pointer to a ::_NV_ENC_REGISTER_RESOURCE structure + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_RESOURCE_REGISTER_FAILED \n + * ::NV_ENC_ERR_GENERIC \n + * ::NV_ENC_ERR_UNIMPLEMENTED \n + * + */ + + +// NvEncUnregisterResource +/** + * \brief Unregisters a resource previously registered with the Nvidia Video Encoder Interface. + * + * Unregisters a resource previously registered with the Nvidia Video Encoder Interface. + * The client is expected to unregister any resource that it has registered with the + * Nvidia Video Encoder Interface before destroying the resource. + * + * @param encoder [in] + * Pointer to the NVEncodeAPI interface. + * + * @param registeredResource [in] + * The registered resource pointer that was returned in ::NvEncRegisterResource. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_RESOURCE_NOT_REGISTERED \n + * ::NV_ENC_ERR_GENERIC \n + * ::NV_ENC_ERR_UNIMPLEMENTED \n + * + */ + + +// NvEncReconfigureEncoder +/** + * \brief Reconfigure an existing encoding session. + * + * Reconfigure an existing encoding session. + * The client should call this API to change/reconfigure the parameter passed during + * NvEncInitializeEncoder API call. + * Currently Reconfiguration of following are not supported. + * Change in GOP structure. + * Change in sync-Async mode. + * Change in MaxWidth & MaxHeight. + * Change in PTD mode. + * + * Resolution change is possible only if maxEncodeWidth & maxEncodeHeight of NV_ENC_INITIALIZE_PARAMS + * is set while creating encoder session. + * + * @param encoder [in] + * Pointer to the NVEncodeAPI interface. + * + * @param reInitEncodeParams [in] + * Pointer to a ::NV_ENC_RECONFIGURE_PARAMS structure. + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_NO_ENCODE_DEVICE \n + * ::NV_ENC_ERR_UNSUPPORTED_DEVICE \n + * ::NV_ENC_ERR_INVALID_DEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_GENERIC \n + * + */ + + + + +// NvEncCreateMVBuffer +/** + * \brief Allocates output MV buffer for ME only mode. + * + * This function is used to allocate an output MV buffer. The size of the mvBuffer is + * dependent on the frame height and width of the last ::NvEncCreateInputBuffer() call. + * The NV_ENC_OUTPUT_PTR returned by the NvEncodeAPI interface in the + * ::NV_ENC_CREATE_MV_BUFFER::mvBuffer field should be used in + * ::NvEncRunMotionEstimationOnly() API. + * Client must lock ::NV_ENC_CREATE_MV_BUFFER::mvBuffer using ::NvEncLockBitstream() API to get the motion vector data. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param createMVBufferParams [in,out] + * Pointer to the ::NV_ENC_CREATE_MV_BUFFER structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_GENERIC \n + */ + + + +// NvEncDestroyMVBuffer +/** + * \brief Release an output MV buffer for ME only mode. + * + * This function is used to release the output MV buffer allocated using + * the ::NvEncCreateMVBuffer() function. The client must release the output + * mvBuffer using this function before destroying the encoder session. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param mvBuffer [in] + * Pointer to the mvBuffer being released. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + */ + + + +// NvEncRunMotionEstimationOnly +/** + * \brief Submit an input picture and reference frame for motion estimation in ME only mode. + * + * This function is used to submit the input frame and reference frame for motion + * estimation. The ME parameters are passed using *meOnlyParams which is a pointer + * to ::_NV_ENC_MEONLY_PARAMS structure. + * Client must lock ::NV_ENC_CREATE_MV_BUFFER::mvBuffer using ::NvEncLockBitstream() API to get the motion vector data. + * to get motion vector data. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * @param meOnlyParams [in] + * Pointer to the ::_NV_ENC_MEONLY_PARAMS structure. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n + * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n + * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n + * ::NV_ENC_ERR_OUT_OF_MEMORY \n + * ::NV_ENC_ERR_INVALID_PARAM \n + * ::NV_ENC_ERR_INVALID_VERSION \n + * ::NV_ENC_ERR_NEED_MORE_INPUT \n + * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n + * ::NV_ENC_ERR_GENERIC \n + */ + + +// NvEncodeAPIGetMaxSupportedVersion +/** + * \brief Get the largest NvEncodeAPI version supported by the driver. + * + * This function can be used by clients to determine if the driver supports + * the NvEncodeAPI header the application was compiled with. + * + * @param version [out] + * Pointer to the requested value. The 4 least significant bits in the returned + * indicate the minor version and the rest of the bits indicate the major + * version of the largest supported version. + * + * @return + * ::NV_ENC_SUCCESS \n + * ::NV_ENC_ERR_INVALID_PTR \n + */ +public static native @Cast("NVENCSTATUS") int NvEncodeAPIGetMaxSupportedVersion(@Cast("uint32_t*") IntPointer version); +public static native @Cast("NVENCSTATUS") int NvEncodeAPIGetMaxSupportedVersion(@Cast("uint32_t*") IntBuffer version); +public static native @Cast("NVENCSTATUS") int NvEncodeAPIGetMaxSupportedVersion(@Cast("uint32_t*") int[] version); + + +// NvEncGetLastErrorString +/** + * \brief Get the description of the last error reported by the API. + * + * This function returns a null-terminated string that can be used by clients to better understand the reason + * for failure of a previous API call. + * + * @param encoder [in] + * Pointer to the NvEncodeAPI interface. + * + * @return + * Pointer to buffer containing the details of the last error encountered by the API. + */ + +// Targeting ../nvencodeapi/PNVENCOPENENCODESESSION.java + + +// Targeting ../nvencodeapi/PNVENCGETENCODEGUIDCOUNT.java + + +// Targeting ../nvencodeapi/PNVENCGETENCODEGUIDS.java + + +// Targeting ../nvencodeapi/PNVENCGETENCODEPROFILEGUIDCOUNT.java + + +// Targeting ../nvencodeapi/PNVENCGETENCODEPROFILEGUIDS.java + + +// Targeting ../nvencodeapi/PNVENCGETINPUTFORMATCOUNT.java + + +// Targeting ../nvencodeapi/PNVENCGETINPUTFORMATS.java + + +// Targeting ../nvencodeapi/PNVENCGETENCODECAPS.java + + +// Targeting ../nvencodeapi/PNVENCGETENCODEPRESETCOUNT.java + + +// Targeting ../nvencodeapi/PNVENCGETENCODEPRESETGUIDS.java + + +// Targeting ../nvencodeapi/PNVENCGETENCODEPRESETCONFIG.java + + +// Targeting ../nvencodeapi/PNVENCGETENCODEPRESETCONFIGEX.java + + +// Targeting ../nvencodeapi/PNVENCINITIALIZEENCODER.java + + +// Targeting ../nvencodeapi/PNVENCCREATEINPUTBUFFER.java + + +// Targeting ../nvencodeapi/PNVENCDESTROYINPUTBUFFER.java + + +// Targeting ../nvencodeapi/PNVENCCREATEBITSTREAMBUFFER.java + + +// Targeting ../nvencodeapi/PNVENCDESTROYBITSTREAMBUFFER.java + + +// Targeting ../nvencodeapi/PNVENCENCODEPICTURE.java + + +// Targeting ../nvencodeapi/PNVENCLOCKBITSTREAM.java + + +// Targeting ../nvencodeapi/PNVENCUNLOCKBITSTREAM.java + + +// Targeting ../nvencodeapi/PNVENCLOCKINPUTBUFFER.java + + +// Targeting ../nvencodeapi/PNVENCUNLOCKINPUTBUFFER.java + + +// Targeting ../nvencodeapi/PNVENCGETENCODESTATS.java + + +// Targeting ../nvencodeapi/PNVENCGETSEQUENCEPARAMS.java + + +// Targeting ../nvencodeapi/PNVENCREGISTERASYNCEVENT.java + + +// Targeting ../nvencodeapi/PNVENCUNREGISTERASYNCEVENT.java + + +// Targeting ../nvencodeapi/PNVENCMAPINPUTRESOURCE.java + + +// Targeting ../nvencodeapi/PNVENCUNMAPINPUTRESOURCE.java + + +// Targeting ../nvencodeapi/PNVENCDESTROYENCODER.java + + +// Targeting ../nvencodeapi/PNVENCINVALIDATEREFFRAMES.java + + +// Targeting ../nvencodeapi/PNVENCOPENENCODESESSIONEX.java + + +// Targeting ../nvencodeapi/PNVENCREGISTERRESOURCE.java + + +// Targeting ../nvencodeapi/PNVENCUNREGISTERRESOURCE.java + + +// Targeting ../nvencodeapi/PNVENCRECONFIGUREENCODER.java + + +// Targeting ../nvencodeapi/PNVENCCREATEMVBUFFER.java + + +// Targeting ../nvencodeapi/PNVENCDESTROYMVBUFFER.java + + +// Targeting ../nvencodeapi/PNVENCRUNMOTIONESTIMATIONONLY.java + + +// Targeting ../nvencodeapi/PNVENCGETLASTERROR.java + + +// Targeting ../nvencodeapi/PNVENCSETIOCUDASTREAMS.java + + +// Targeting ../nvencodeapi/PNVENCGETSEQUENCEPARAMEX.java + + +// Targeting ../nvencodeapi/NV_ENCODE_API_FUNCTION_LIST.java + + + +/** Macro for constructing the version field of ::_NV_ENCODEAPI_FUNCTION_LIST. */ +public static native @MemberGetter int NV_ENCODE_API_FUNCTION_LIST_VER(); +public static final int NV_ENCODE_API_FUNCTION_LIST_VER = NV_ENCODE_API_FUNCTION_LIST_VER(); + +// NvEncodeAPICreateInstance +/** + * \ingroup ENCODE_FUNC + * Entry Point to the NvEncodeAPI interface. + * + * Creates an instance of the NvEncodeAPI interface, and populates the + * pFunctionList with function pointers to the API routines implemented by the + * NvEncodeAPI interface. + * + * @param functionList [out] + * + * @return + * ::NV_ENC_SUCCESS + * ::NV_ENC_ERR_INVALID_PTR + */ +public static native @Cast("NVENCSTATUS") int NvEncodeAPICreateInstance(NV_ENCODE_API_FUNCTION_LIST functionList); + +// #ifdef __cplusplus +// #endif + + +// #endif + + + +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CCtxAutoLock.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CCtxAutoLock.java new file mode 100644 index 00000000000..639af4e2057 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CCtxAutoLock.java @@ -0,0 +1,24 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +// Auto-lock helper for C++ applications +@NoOffset @Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CCtxAutoLock extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CCtxAutoLock(Pointer p) { super(p); } + + public CCtxAutoLock(_CUcontextlock_st ctx) { super((Pointer)null); allocate(ctx); } + private native void allocate(_CUcontextlock_st ctx); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUAUDIOFORMAT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUAUDIOFORMAT.java new file mode 100644 index 00000000000..e07a68dce7c --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUAUDIOFORMAT.java @@ -0,0 +1,52 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/****************************************************************/ +/** \ingroup STRUCTS +/** \struct CUAUDIOFORMAT +/** Audio formats +/** Used in cuvidGetSourceAudioFormat API +/****************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUAUDIOFORMAT extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUAUDIOFORMAT() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUAUDIOFORMAT(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUAUDIOFORMAT(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUAUDIOFORMAT position(long position) { + return (CUAUDIOFORMAT)super.position(position); + } + @Override public CUAUDIOFORMAT getPointer(long i) { + return new CUAUDIOFORMAT((Pointer)this).position(position + i); + } + + /** OUT: Compression format */ + public native @Cast("cudaAudioCodec") int codec(); public native CUAUDIOFORMAT codec(int setter); + /** OUT: number of audio channels */ + public native @Cast("unsigned int") int channels(); public native CUAUDIOFORMAT channels(int setter); + /** OUT: sampling frequency */ + public native @Cast("unsigned int") int samplespersec(); public native CUAUDIOFORMAT samplespersec(int setter); + /** OUT: For uncompressed, can also be used to determine bits per sample */ + public native @Cast("unsigned int") int bitrate(); public native CUAUDIOFORMAT bitrate(int setter); + /** Reserved for future use */ + public native @Cast("unsigned int") int reserved1(); public native CUAUDIOFORMAT reserved1(int setter); + /** Reserved for future use */ + public native @Cast("unsigned int") int reserved2(); public native CUAUDIOFORMAT reserved2(int setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDAV1PICPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDAV1PICPARAMS.java new file mode 100644 index 00000000000..5ff22057e2e --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDAV1PICPARAMS.java @@ -0,0 +1,221 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/***********************************************************/ +/** \struct CUVIDAV1PICPARAMS +/** AV1 picture parameters +/** This structure is used in CUVIDPICPARAMS structure +/***********************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDAV1PICPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDAV1PICPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDAV1PICPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDAV1PICPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDAV1PICPARAMS position(long position) { + return (CUVIDAV1PICPARAMS)super.position(position); + } + @Override public CUVIDAV1PICPARAMS getPointer(long i) { + return new CUVIDAV1PICPARAMS((Pointer)this).position(position + i); + } + + public native @Cast("unsigned int") int width(); public native CUVIDAV1PICPARAMS width(int setter); // coded width, if superres enabled then it is upscaled width + public native @Cast("unsigned int") int height(); public native CUVIDAV1PICPARAMS height(int setter); // coded height + public native @Cast("unsigned int") int frame_offset(); public native CUVIDAV1PICPARAMS frame_offset(int setter); // defined as order_hint in AV1 specification + public native int decodePicIdx(); public native CUVIDAV1PICPARAMS decodePicIdx(int setter); // decoded output pic index, if film grain enabled, it will keep decoded (without film grain) output + // It can be used as reference frame for future frames + + // sequence header + public native @Cast("unsigned int") @NoOffset int profile(); public native CUVIDAV1PICPARAMS profile(int setter); // 0 = profile0, 1 = profile1, 2 = profile2 + public native @Cast("unsigned int") @NoOffset int use_128x128_superblock(); public native CUVIDAV1PICPARAMS use_128x128_superblock(int setter); // superblock size 0:64x64, 1: 128x128 + public native @Cast("unsigned int") @NoOffset int subsampling_x(); public native CUVIDAV1PICPARAMS subsampling_x(int setter); // (subsampling_x, _y) 1,1 = 420, 1,0 = 422, 0,0 = 444 + public native @Cast("unsigned int") @NoOffset int subsampling_y(); public native CUVIDAV1PICPARAMS subsampling_y(int setter); + public native @Cast("unsigned int") @NoOffset int mono_chrome(); public native CUVIDAV1PICPARAMS mono_chrome(int setter); // for monochrome content, mono_chrome = 1 and (subsampling_x, _y) should be 1,1 + public native @Cast("unsigned int") @NoOffset int bit_depth_minus8(); public native CUVIDAV1PICPARAMS bit_depth_minus8(int setter); // bit depth minus 8 + public native @Cast("unsigned int") @NoOffset int enable_filter_intra(); public native CUVIDAV1PICPARAMS enable_filter_intra(int setter); // tool enable in seq level, 0 : disable 1: frame header control + public native @Cast("unsigned int") @NoOffset int enable_intra_edge_filter(); public native CUVIDAV1PICPARAMS enable_intra_edge_filter(int setter); // intra edge filtering process, 0 : disable 1: enabled + public native @Cast("unsigned int") @NoOffset int enable_interintra_compound(); public native CUVIDAV1PICPARAMS enable_interintra_compound(int setter); // interintra, 0 : not present 1: present + public native @Cast("unsigned int") @NoOffset int enable_masked_compound(); public native CUVIDAV1PICPARAMS enable_masked_compound(int setter); // 1: mode info for inter blocks may contain the syntax element compound_type. + // 0: syntax element compound_type will not be present + public native @Cast("unsigned int") @NoOffset int enable_dual_filter(); public native CUVIDAV1PICPARAMS enable_dual_filter(int setter); // vertical and horiz filter selection, 1: enable and 0: disable + public native @Cast("unsigned int") @NoOffset int enable_order_hint(); public native CUVIDAV1PICPARAMS enable_order_hint(int setter); // order hint, and related tools, 1: enable and 0: disable + public native @Cast("unsigned int") @NoOffset int order_hint_bits_minus1(); public native CUVIDAV1PICPARAMS order_hint_bits_minus1(int setter); // is used to compute OrderHintBits + public native @Cast("unsigned int") @NoOffset int enable_jnt_comp(); public native CUVIDAV1PICPARAMS enable_jnt_comp(int setter); // joint compound modes, 1: enable and 0: disable + public native @Cast("unsigned int") @NoOffset int enable_superres(); public native CUVIDAV1PICPARAMS enable_superres(int setter); // superres in seq level, 0 : disable 1: frame level control + public native @Cast("unsigned int") @NoOffset int enable_cdef(); public native CUVIDAV1PICPARAMS enable_cdef(int setter); // cdef filtering in seq level, 0 : disable 1: frame level control + public native @Cast("unsigned int") @NoOffset int enable_restoration(); public native CUVIDAV1PICPARAMS enable_restoration(int setter); // loop restoration filtering in seq level, 0 : disable 1: frame level control + public native @Cast("unsigned int") @NoOffset int enable_fgs(); public native CUVIDAV1PICPARAMS enable_fgs(int setter); // defined as film_grain_params_present in AV1 specification + public native @Cast("unsigned int") @NoOffset int reserved0_7bits(); public native CUVIDAV1PICPARAMS reserved0_7bits(int setter); // reserved bits; must be set to 0 + + // frame header + public native @Cast("unsigned int") @NoOffset int frame_type(); public native CUVIDAV1PICPARAMS frame_type(int setter); // 0:Key frame, 1:Inter frame, 2:intra only, 3:s-frame + public native @Cast("unsigned int") @NoOffset int show_frame(); public native CUVIDAV1PICPARAMS show_frame(int setter); // show_frame = 1 implies that frame should be immediately output once decoded + public native @Cast("unsigned int") @NoOffset int disable_cdf_update(); public native CUVIDAV1PICPARAMS disable_cdf_update(int setter); // CDF update during symbol decoding, 1: disabled, 0: enabled + public native @Cast("unsigned int") @NoOffset int allow_screen_content_tools(); public native CUVIDAV1PICPARAMS allow_screen_content_tools(int setter); // 1: intra blocks may use palette encoding, 0: palette encoding is never used + public native @Cast("unsigned int") @NoOffset int force_integer_mv(); public native CUVIDAV1PICPARAMS force_integer_mv(int setter); // 1: motion vectors will always be integers, 0: can contain fractional bits + public native @Cast("unsigned int") @NoOffset int coded_denom(); public native CUVIDAV1PICPARAMS coded_denom(int setter); // coded_denom of the superres scale as specified in AV1 specification + public native @Cast("unsigned int") @NoOffset int allow_intrabc(); public native CUVIDAV1PICPARAMS allow_intrabc(int setter); // 1: intra block copy may be used, 0: intra block copy is not allowed + public native @Cast("unsigned int") @NoOffset int allow_high_precision_mv(); public native CUVIDAV1PICPARAMS allow_high_precision_mv(int setter); // 1/8 precision mv enable + public native @Cast("unsigned int") @NoOffset int interp_filter(); public native CUVIDAV1PICPARAMS interp_filter(int setter); // interpolation filter. Refer to section 6.8.9 of the AV1 specification Version 1.0.0 with Errata 1 + public native @Cast("unsigned int") @NoOffset int switchable_motion_mode(); public native CUVIDAV1PICPARAMS switchable_motion_mode(int setter); // defined as is_motion_mode_switchable in AV1 specification + public native @Cast("unsigned int") @NoOffset int use_ref_frame_mvs(); public native CUVIDAV1PICPARAMS use_ref_frame_mvs(int setter); // 1: current frame can use the previous frame mv information, 0: will not use. + public native @Cast("unsigned int") @NoOffset int disable_frame_end_update_cdf(); public native CUVIDAV1PICPARAMS disable_frame_end_update_cdf(int setter); // 1: indicates that the end of frame CDF update is disabled + public native @Cast("unsigned int") @NoOffset int delta_q_present(); public native CUVIDAV1PICPARAMS delta_q_present(int setter); // quantizer index delta values are present in the block level + public native @Cast("unsigned int") @NoOffset int delta_q_res(); public native CUVIDAV1PICPARAMS delta_q_res(int setter); // left shift which should be applied to decoded quantizer index delta values + public native @Cast("unsigned int") @NoOffset int using_qmatrix(); public native CUVIDAV1PICPARAMS using_qmatrix(int setter); // 1: quantizer matrix will be used to compute quantizers + public native @Cast("unsigned int") @NoOffset int coded_lossless(); public native CUVIDAV1PICPARAMS coded_lossless(int setter); // 1: all segments use lossless coding + public native @Cast("unsigned int") @NoOffset int use_superres(); public native CUVIDAV1PICPARAMS use_superres(int setter); // 1: superres enabled for frame + public native @Cast("unsigned int") @NoOffset int tx_mode(); public native CUVIDAV1PICPARAMS tx_mode(int setter); // 0: ONLY4x4,1:LARGEST,2:SELECT + public native @Cast("unsigned int") @NoOffset int reference_mode(); public native CUVIDAV1PICPARAMS reference_mode(int setter); // 0: SINGLE, 1: SELECT + public native @Cast("unsigned int") @NoOffset int allow_warped_motion(); public native CUVIDAV1PICPARAMS allow_warped_motion(int setter); // 1: allow_warped_motion may be present, 0: allow_warped_motion will not be present + public native @Cast("unsigned int") @NoOffset int reduced_tx_set(); public native CUVIDAV1PICPARAMS reduced_tx_set(int setter); // 1: frame is restricted to subset of the full set of transform types, 0: no such restriction + public native @Cast("unsigned int") @NoOffset int skip_mode(); public native CUVIDAV1PICPARAMS skip_mode(int setter); // 1: most of the mode info is skipped, 0: mode info is not skipped + public native @Cast("unsigned int") @NoOffset int reserved1_3bits(); public native CUVIDAV1PICPARAMS reserved1_3bits(int setter); // reserved bits; must be set to 0 + + // tiling info + public native @Cast("unsigned int") @NoOffset int num_tile_cols(); public native CUVIDAV1PICPARAMS num_tile_cols(int setter); // number of tiles across the frame., max is 64 + public native @Cast("unsigned int") @NoOffset int num_tile_rows(); public native CUVIDAV1PICPARAMS num_tile_rows(int setter); // number of tiles down the frame., max is 64 + public native @Cast("unsigned int") @NoOffset int context_update_tile_id(); public native CUVIDAV1PICPARAMS context_update_tile_id(int setter); // specifies which tile to use for the CDF update + public native @Cast("unsigned short") short tile_widths(int i); public native CUVIDAV1PICPARAMS tile_widths(int i, short setter); + @MemberGetter public native @Cast("unsigned short*") ShortPointer tile_widths(); // Width of each column in superblocks + public native @Cast("unsigned short") short tile_heights(int i); public native CUVIDAV1PICPARAMS tile_heights(int i, short setter); + @MemberGetter public native @Cast("unsigned short*") ShortPointer tile_heights(); // height of each row in superblocks + + // CDEF - refer to section 6.10.14 of the AV1 specification Version 1.0.0 with Errata 1 + public native @Cast("unsigned char") @NoOffset byte cdef_damping_minus_3(); public native CUVIDAV1PICPARAMS cdef_damping_minus_3(byte setter); // controls the amount of damping in the deringing filter + public native @Cast("unsigned char") @NoOffset byte cdef_bits(); public native CUVIDAV1PICPARAMS cdef_bits(byte setter); // the number of bits needed to specify which CDEF filter to apply + public native @Cast("unsigned char") @NoOffset byte reserved2_4bits(); public native CUVIDAV1PICPARAMS reserved2_4bits(byte setter); // reserved bits; must be set to 0 + public native @Cast("unsigned char") byte cdef_y_strength(int i); public native CUVIDAV1PICPARAMS cdef_y_strength(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer cdef_y_strength(); // 0-3 bits: y_pri_strength, 4-7 bits y_sec_strength + public native @Cast("unsigned char") byte cdef_uv_strength(int i); public native CUVIDAV1PICPARAMS cdef_uv_strength(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer cdef_uv_strength(); // 0-3 bits: uv_pri_strength, 4-7 bits uv_sec_strength + + // SkipModeFrames + public native @Cast("unsigned char") @NoOffset byte SkipModeFrame0(); public native CUVIDAV1PICPARAMS SkipModeFrame0(byte setter); // specifies the frames to use for compound prediction when skip_mode is equal to 1. + public native @Cast("unsigned char") @NoOffset byte SkipModeFrame1(); public native CUVIDAV1PICPARAMS SkipModeFrame1(byte setter); + + // qp information - refer to section 6.8.11 of the AV1 specification Version 1.0.0 with Errata 1 + public native @Cast("unsigned char") byte base_qindex(); public native CUVIDAV1PICPARAMS base_qindex(byte setter); // indicates the base frame qindex. Defined as base_q_idx in AV1 specification + public native @Cast("char") byte qp_y_dc_delta_q(); public native CUVIDAV1PICPARAMS qp_y_dc_delta_q(byte setter); // indicates the Y DC quantizer relative to base_q_idx. Defined as DeltaQYDc in AV1 specification + public native @Cast("char") byte qp_u_dc_delta_q(); public native CUVIDAV1PICPARAMS qp_u_dc_delta_q(byte setter); // indicates the U DC quantizer relative to base_q_idx. Defined as DeltaQUDc in AV1 specification + public native @Cast("char") byte qp_v_dc_delta_q(); public native CUVIDAV1PICPARAMS qp_v_dc_delta_q(byte setter); // indicates the V DC quantizer relative to base_q_idx. Defined as DeltaQVDc in AV1 specification + public native @Cast("char") byte qp_u_ac_delta_q(); public native CUVIDAV1PICPARAMS qp_u_ac_delta_q(byte setter); // indicates the U AC quantizer relative to base_q_idx. Defined as DeltaQUAc in AV1 specification + public native @Cast("char") byte qp_v_ac_delta_q(); public native CUVIDAV1PICPARAMS qp_v_ac_delta_q(byte setter); // indicates the V AC quantizer relative to base_q_idx. Defined as DeltaQVAc in AV1 specification + public native @Cast("unsigned char") byte qm_y(); public native CUVIDAV1PICPARAMS qm_y(byte setter); // specifies the level in the quantizer matrix that should be used for luma plane decoding + public native @Cast("unsigned char") byte qm_u(); public native CUVIDAV1PICPARAMS qm_u(byte setter); // specifies the level in the quantizer matrix that should be used for chroma U plane decoding + public native @Cast("unsigned char") byte qm_v(); public native CUVIDAV1PICPARAMS qm_v(byte setter); // specifies the level in the quantizer matrix that should be used for chroma V plane decoding + + // segmentation - refer to section 6.8.13 of the AV1 specification Version 1.0.0 with Errata 1 + public native @Cast("unsigned char") @NoOffset byte segmentation_enabled(); public native CUVIDAV1PICPARAMS segmentation_enabled(byte setter); // 1 indicates that this frame makes use of the segmentation tool + public native @Cast("unsigned char") @NoOffset byte segmentation_update_map(); public native CUVIDAV1PICPARAMS segmentation_update_map(byte setter); // 1 indicates that the segmentation map are updated during the decoding of this frame + public native @Cast("unsigned char") @NoOffset byte segmentation_update_data(); public native CUVIDAV1PICPARAMS segmentation_update_data(byte setter); // 1 indicates that new parameters are about to be specified for each segment + public native @Cast("unsigned char") @NoOffset byte segmentation_temporal_update(); public native CUVIDAV1PICPARAMS segmentation_temporal_update(byte setter); // 1 indicates that the updates to the segmentation map are coded relative to the existing segmentation map + public native @Cast("unsigned char") @NoOffset byte reserved3_4bits(); public native CUVIDAV1PICPARAMS reserved3_4bits(byte setter); // reserved bits; must be set to 0 + public native short segmentation_feature_data(int i, int j); public native CUVIDAV1PICPARAMS segmentation_feature_data(int i, int j, short setter); + @MemberGetter public native @Cast("short(* /*[8]*/ )[8]") ShortPointer segmentation_feature_data(); // specifies the feature data for a segment feature + public native @Cast("unsigned char") byte segmentation_feature_mask(int i); public native CUVIDAV1PICPARAMS segmentation_feature_mask(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer segmentation_feature_mask(); // indicates that the corresponding feature is unused or feature value is coded + + // loopfilter - refer to section 6.8.10 of the AV1 specification Version 1.0.0 with Errata 1 + public native @Cast("unsigned char") byte loop_filter_level(int i); public native CUVIDAV1PICPARAMS loop_filter_level(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer loop_filter_level(); // contains loop filter strength values + public native @Cast("unsigned char") byte loop_filter_level_u(); public native CUVIDAV1PICPARAMS loop_filter_level_u(byte setter); // loop filter strength value of U plane + public native @Cast("unsigned char") byte loop_filter_level_v(); public native CUVIDAV1PICPARAMS loop_filter_level_v(byte setter); // loop filter strength value of V plane + public native @Cast("unsigned char") byte loop_filter_sharpness(); public native CUVIDAV1PICPARAMS loop_filter_sharpness(byte setter); // indicates the sharpness level + public native @Cast("char") byte loop_filter_ref_deltas(int i); public native CUVIDAV1PICPARAMS loop_filter_ref_deltas(int i, byte setter); + @MemberGetter public native @Cast("char*") BytePointer loop_filter_ref_deltas(); // contains the adjustment needed for the filter level based on the chosen reference frame + public native @Cast("char") byte loop_filter_mode_deltas(int i); public native CUVIDAV1PICPARAMS loop_filter_mode_deltas(int i, byte setter); + @MemberGetter public native @Cast("char*") BytePointer loop_filter_mode_deltas(); // contains the adjustment needed for the filter level based on the chosen mode + public native @Cast("unsigned char") @NoOffset byte loop_filter_delta_enabled(); public native CUVIDAV1PICPARAMS loop_filter_delta_enabled(byte setter); // indicates that the filter level depends on the mode and reference frame used to predict a block + public native @Cast("unsigned char") @NoOffset byte loop_filter_delta_update(); public native CUVIDAV1PICPARAMS loop_filter_delta_update(byte setter); // indicates that additional syntax elements are present that specify which mode and + // reference frame deltas are to be updated + public native @Cast("unsigned char") @NoOffset byte delta_lf_present(); public native CUVIDAV1PICPARAMS delta_lf_present(byte setter); // specifies whether loop filter delta values are present in the block level + public native @Cast("unsigned char") @NoOffset byte delta_lf_res(); public native CUVIDAV1PICPARAMS delta_lf_res(byte setter); // specifies the left shift to apply to the decoded loop filter values + public native @Cast("unsigned char") @NoOffset byte delta_lf_multi(); public native CUVIDAV1PICPARAMS delta_lf_multi(byte setter); // separate loop filter deltas for Hy,Vy,U,V edges + public native @Cast("unsigned char") @NoOffset byte reserved4_2bits(); public native CUVIDAV1PICPARAMS reserved4_2bits(byte setter); // reserved bits; must be set to 0 + + // restoration - refer to section 6.10.15 of the AV1 specification Version 1.0.0 with Errata 1 + public native @Cast("unsigned char") byte lr_unit_size(int i); public native CUVIDAV1PICPARAMS lr_unit_size(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer lr_unit_size(); // specifies the size of loop restoration units: 0: 32, 1: 64, 2: 128, 3: 256 + public native @Cast("unsigned char") byte lr_type(int i); public native CUVIDAV1PICPARAMS lr_type(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer lr_type(); // used to compute FrameRestorationType + + // reference frames + public native @Cast("unsigned char") byte primary_ref_frame(); public native CUVIDAV1PICPARAMS primary_ref_frame(byte setter); // specifies which reference frame contains the CDF values and other state that should be + // loaded at the start of the frame + public native @Cast("unsigned char") byte ref_frame_map(int i); public native CUVIDAV1PICPARAMS ref_frame_map(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer ref_frame_map(); // frames in dpb that can be used as reference for current or future frames + + public native @Cast("unsigned char") @NoOffset byte temporal_layer_id(); public native CUVIDAV1PICPARAMS temporal_layer_id(byte setter); // temporal layer id + public native @Cast("unsigned char") @NoOffset byte spatial_layer_id(); public native CUVIDAV1PICPARAMS spatial_layer_id(byte setter); // spatial layer id + + public native @Cast("unsigned char") byte reserved5_32bits(int i); public native CUVIDAV1PICPARAMS reserved5_32bits(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer reserved5_32bits(); // reserved bits; must be set to 0 + + // ref frame list + @Name({"ref_frame", ".width"}) public native @Cast("unsigned int") int ref_frame_width(int i); public native CUVIDAV1PICPARAMS ref_frame_width(int i, int setter); + @Name({"ref_frame", ".height"}) public native @Cast("unsigned int") int ref_frame_height(int i); public native CUVIDAV1PICPARAMS ref_frame_height(int i, int setter); + @Name({"ref_frame", ".index"}) public native @Cast("unsigned char") byte ref_frame_index(int i); public native CUVIDAV1PICPARAMS ref_frame_index(int i, byte setter); + @Name({"ref_frame", ".reserved24Bits"}) @MemberGetter public native @Cast("unsigned char*") BytePointer ref_frame_reserved24Bits(int i); // reserved bits; must be set to 0 // frames used as reference frame for current frame. + + // global motion + @Name({"global_motion", ".invalid"}) public native @Cast("unsigned char") @NoOffset byte global_motion_invalid(int i); public native CUVIDAV1PICPARAMS global_motion_invalid(int i, byte setter); + @Name({"global_motion", ".wmtype"}) public native @Cast("unsigned char") @NoOffset byte global_motion_wmtype(int i); public native CUVIDAV1PICPARAMS global_motion_wmtype(int i, byte setter); // defined as GmType in AV1 specification + @Name({"global_motion", ".reserved5Bits"}) public native @Cast("unsigned char") @NoOffset byte global_motion_reserved5Bits(int i); public native CUVIDAV1PICPARAMS global_motion_reserved5Bits(int i, byte setter); // reserved bits; must be set to 0 + @Name({"global_motion", ".reserved24Bits"}) @MemberGetter public native @Cast("char*") BytePointer global_motion_reserved24Bits(int i); // reserved bits; must be set to 0 + @Name({"global_motion", ".wmmat"}) @MemberGetter public native IntPointer global_motion_wmmat(int i); // defined as gm_params[] in AV1 specification // global motion params for reference frames + + // film grain params - refer to section 6.8.20 of the AV1 specification Version 1.0.0 with Errata 1 + public native @Cast("unsigned short") @NoOffset short apply_grain(); public native CUVIDAV1PICPARAMS apply_grain(short setter); + public native @Cast("unsigned short") @NoOffset short overlap_flag(); public native CUVIDAV1PICPARAMS overlap_flag(short setter); + public native @Cast("unsigned short") @NoOffset short scaling_shift_minus8(); public native CUVIDAV1PICPARAMS scaling_shift_minus8(short setter); + public native @Cast("unsigned short") @NoOffset short chroma_scaling_from_luma(); public native CUVIDAV1PICPARAMS chroma_scaling_from_luma(short setter); + public native @Cast("unsigned short") @NoOffset short ar_coeff_lag(); public native CUVIDAV1PICPARAMS ar_coeff_lag(short setter); + public native @Cast("unsigned short") @NoOffset short ar_coeff_shift_minus6(); public native CUVIDAV1PICPARAMS ar_coeff_shift_minus6(short setter); + public native @Cast("unsigned short") @NoOffset short grain_scale_shift(); public native CUVIDAV1PICPARAMS grain_scale_shift(short setter); + public native @Cast("unsigned short") @NoOffset short clip_to_restricted_range(); public native CUVIDAV1PICPARAMS clip_to_restricted_range(short setter); + public native @Cast("unsigned short") @NoOffset short reserved6_4bits(); public native CUVIDAV1PICPARAMS reserved6_4bits(short setter); // reserved bits; must be set to 0 + public native @Cast("unsigned char") byte num_y_points(); public native CUVIDAV1PICPARAMS num_y_points(byte setter); + public native @Cast("unsigned char") byte scaling_points_y(int i, int j); public native CUVIDAV1PICPARAMS scaling_points_y(int i, int j, byte setter); + @MemberGetter public native @Cast("unsigned char(* /*[14]*/ )[2]") BytePointer scaling_points_y(); + public native @Cast("unsigned char") byte num_cb_points(); public native CUVIDAV1PICPARAMS num_cb_points(byte setter); + public native @Cast("unsigned char") byte scaling_points_cb(int i, int j); public native CUVIDAV1PICPARAMS scaling_points_cb(int i, int j, byte setter); + @MemberGetter public native @Cast("unsigned char(* /*[10]*/ )[2]") BytePointer scaling_points_cb(); + public native @Cast("unsigned char") byte num_cr_points(); public native CUVIDAV1PICPARAMS num_cr_points(byte setter); + public native @Cast("unsigned char") byte scaling_points_cr(int i, int j); public native CUVIDAV1PICPARAMS scaling_points_cr(int i, int j, byte setter); + @MemberGetter public native @Cast("unsigned char(* /*[10]*/ )[2]") BytePointer scaling_points_cr(); + public native @Cast("unsigned char") byte reserved7_8bits(); public native CUVIDAV1PICPARAMS reserved7_8bits(byte setter); // reserved bits; must be set to 0 + public native @Cast("unsigned short") short random_seed(); public native CUVIDAV1PICPARAMS random_seed(short setter); + public native short ar_coeffs_y(int i); public native CUVIDAV1PICPARAMS ar_coeffs_y(int i, short setter); + @MemberGetter public native ShortPointer ar_coeffs_y(); + public native short ar_coeffs_cb(int i); public native CUVIDAV1PICPARAMS ar_coeffs_cb(int i, short setter); + @MemberGetter public native ShortPointer ar_coeffs_cb(); + public native short ar_coeffs_cr(int i); public native CUVIDAV1PICPARAMS ar_coeffs_cr(int i, short setter); + @MemberGetter public native ShortPointer ar_coeffs_cr(); + public native @Cast("unsigned char") byte cb_mult(); public native CUVIDAV1PICPARAMS cb_mult(byte setter); + public native @Cast("unsigned char") byte cb_luma_mult(); public native CUVIDAV1PICPARAMS cb_luma_mult(byte setter); + public native short cb_offset(); public native CUVIDAV1PICPARAMS cb_offset(short setter); + public native @Cast("unsigned char") byte cr_mult(); public native CUVIDAV1PICPARAMS cr_mult(byte setter); + public native @Cast("unsigned char") byte cr_luma_mult(); public native CUVIDAV1PICPARAMS cr_luma_mult(byte setter); + public native short cr_offset(); public native CUVIDAV1PICPARAMS cr_offset(short setter); + + public native int reserved(int i); public native CUVIDAV1PICPARAMS reserved(int i, int setter); + @MemberGetter public native IntPointer reserved(); // reserved bits; must be set to 0 +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDAV1SEQHDR.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDAV1SEQHDR.java new file mode 100644 index 00000000000..df6dcc6c745 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDAV1SEQHDR.java @@ -0,0 +1,43 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/****************************************************************/ +/** \ingroup STRUCTS +/** \struct CUVIDAV1SEQHDR +/** AV1 specific sequence header information +/****************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDAV1SEQHDR extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDAV1SEQHDR() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDAV1SEQHDR(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDAV1SEQHDR(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDAV1SEQHDR position(long position) { + return (CUVIDAV1SEQHDR)super.position(position); + } + @Override public CUVIDAV1SEQHDR getPointer(long i) { + return new CUVIDAV1SEQHDR((Pointer)this).position(position + i); + } + + public native @Cast("unsigned int") int max_width(); public native CUVIDAV1SEQHDR max_width(int setter); + public native @Cast("unsigned int") int max_height(); public native CUVIDAV1SEQHDR max_height(int setter); + public native @Cast("unsigned char") byte reserved(int i); public native CUVIDAV1SEQHDR reserved(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer reserved(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDDECODECAPS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDDECODECAPS.java new file mode 100644 index 00000000000..773f9df7dd3 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDDECODECAPS.java @@ -0,0 +1,76 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/**************************************************************************************************************/ +/** \struct CUVIDDECODECAPS; +/** This structure is used in cuvidGetDecoderCaps API +/**************************************************************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDDECODECAPS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDDECODECAPS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDDECODECAPS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDDECODECAPS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDDECODECAPS position(long position) { + return (CUVIDDECODECAPS)super.position(position); + } + @Override public CUVIDDECODECAPS getPointer(long i) { + return new CUVIDDECODECAPS((Pointer)this).position(position + i); + } + + /** IN: cudaVideoCodec_XXX */ + public native @Cast("cudaVideoCodec") int eCodecType(); public native CUVIDDECODECAPS eCodecType(int setter); + /** IN: cudaVideoChromaFormat_XXX */ + public native @Cast("cudaVideoChromaFormat") int eChromaFormat(); public native CUVIDDECODECAPS eChromaFormat(int setter); + /** IN: The Value "BitDepth minus 8" */ + public native @Cast("unsigned int") int nBitDepthMinus8(); public native CUVIDDECODECAPS nBitDepthMinus8(int setter); + /** Reserved for future use - set to zero */ + public native @Cast("unsigned int") int reserved1(int i); public native CUVIDDECODECAPS reserved1(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer reserved1(); + + /** OUT: 1 if codec supported, 0 if not supported */ + public native @Cast("unsigned char") byte bIsSupported(); public native CUVIDDECODECAPS bIsSupported(byte setter); + /** OUT: Number of NVDECs that can support IN params */ + public native @Cast("unsigned char") byte nNumNVDECs(); public native CUVIDDECODECAPS nNumNVDECs(byte setter); + /** OUT: each bit represents corresponding cudaVideoSurfaceFormat enum */ + public native @Cast("unsigned short") short nOutputFormatMask(); public native CUVIDDECODECAPS nOutputFormatMask(short setter); + /** OUT: Max supported coded width in pixels */ + public native @Cast("unsigned int") int nMaxWidth(); public native CUVIDDECODECAPS nMaxWidth(int setter); + /** OUT: Max supported coded height in pixels */ + public native @Cast("unsigned int") int nMaxHeight(); public native CUVIDDECODECAPS nMaxHeight(int setter); + /** OUT: Max supported macroblock count + CodedWidth*CodedHeight/256 must be <= nMaxMBCount */ + public native @Cast("unsigned int") int nMaxMBCount(); public native CUVIDDECODECAPS nMaxMBCount(int setter); + /** OUT: Min supported coded width in pixels */ + public native @Cast("unsigned short") short nMinWidth(); public native CUVIDDECODECAPS nMinWidth(short setter); + /** OUT: Min supported coded height in pixels */ + public native @Cast("unsigned short") short nMinHeight(); public native CUVIDDECODECAPS nMinHeight(short setter); + /** OUT: 1 if Y component histogram output is supported, 0 if not + Note: histogram is computed on original picture data before + any post-processing like scaling, cropping, etc. is applied */ + public native @Cast("unsigned char") byte bIsHistogramSupported(); public native CUVIDDECODECAPS bIsHistogramSupported(byte setter); + /** OUT: histogram counter bit depth */ + public native @Cast("unsigned char") byte nCounterBitDepth(); public native CUVIDDECODECAPS nCounterBitDepth(byte setter); + /** OUT: Max number of histogram bins */ + public native @Cast("unsigned short") short nMaxHistogramBins(); public native CUVIDDECODECAPS nMaxHistogramBins(short setter); + /** Reserved for future use - set to zero */ + public native @Cast("unsigned int") int reserved3(int i); public native CUVIDDECODECAPS reserved3(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer reserved3(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDDECODECREATEINFO.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDDECODECREATEINFO.java new file mode 100644 index 00000000000..c2179766516 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDDECODECREATEINFO.java @@ -0,0 +1,99 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/**************************************************************************************************************/ +/** \struct CUVIDDECODECREATEINFO +/** This structure is used in cuvidCreateDecoder API +/**************************************************************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDDECODECREATEINFO extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDDECODECREATEINFO() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDDECODECREATEINFO(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDDECODECREATEINFO(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDDECODECREATEINFO position(long position) { + return (CUVIDDECODECREATEINFO)super.position(position); + } + @Override public CUVIDDECODECREATEINFO getPointer(long i) { + return new CUVIDDECODECREATEINFO((Pointer)this).position(position + i); + } + + /** IN: Coded sequence width in pixels */ + public native @Cast("unsigned long") long ulWidth(); public native CUVIDDECODECREATEINFO ulWidth(long setter); + /** IN: Coded sequence height in pixels */ + public native @Cast("unsigned long") long ulHeight(); public native CUVIDDECODECREATEINFO ulHeight(long setter); + /** IN: Maximum number of internal decode surfaces */ + public native @Cast("unsigned long") long ulNumDecodeSurfaces(); public native CUVIDDECODECREATEINFO ulNumDecodeSurfaces(long setter); + /** IN: cudaVideoCodec_XXX */ + public native @Cast("cudaVideoCodec") int CodecType(); public native CUVIDDECODECREATEINFO CodecType(int setter); + /** IN: cudaVideoChromaFormat_XXX */ + public native @Cast("cudaVideoChromaFormat") int ChromaFormat(); public native CUVIDDECODECREATEINFO ChromaFormat(int setter); + /** IN: Decoder creation flags (cudaVideoCreateFlags_XXX) */ + public native @Cast("unsigned long") long ulCreationFlags(); public native CUVIDDECODECREATEINFO ulCreationFlags(long setter); + /** IN: The value "BitDepth minus 8" */ + public native @Cast("unsigned long") long bitDepthMinus8(); public native CUVIDDECODECREATEINFO bitDepthMinus8(long setter); + /** IN: Set 1 only if video has all intra frames (default value is 0). This will + optimize video memory for Intra frames only decoding. The support is limited + to specific codecs - H264, HEVC, VP9, the flag will be ignored for codecs which + are not supported. However decoding might fail if the flag is enabled in case + of supported codecs for regular bit streams having P and/or B frames. */ + public native @Cast("unsigned long") long ulIntraDecodeOnly(); public native CUVIDDECODECREATEINFO ulIntraDecodeOnly(long setter); + /** IN: Coded sequence max width in pixels used with reconfigure Decoder */ + public native @Cast("unsigned long") long ulMaxWidth(); public native CUVIDDECODECREATEINFO ulMaxWidth(long setter); + /** IN: Coded sequence max height in pixels used with reconfigure Decoder */ + public native @Cast("unsigned long") long ulMaxHeight(); public native CUVIDDECODECREATEINFO ulMaxHeight(long setter); + /** Reserved for future use - set to zero */ + public native @Cast("unsigned long") long Reserved1(); public native CUVIDDECODECREATEINFO Reserved1(long setter); + /** + * IN: area of the frame that should be displayed + */ + @Name("display_area.left") public native short display_area_left(); public native CUVIDDECODECREATEINFO display_area_left(short setter); + @Name("display_area.top") public native short display_area_top(); public native CUVIDDECODECREATEINFO display_area_top(short setter); + @Name("display_area.right") public native short display_area_right(); public native CUVIDDECODECREATEINFO display_area_right(short setter); + @Name("display_area.bottom") public native short display_area_bottom(); public native CUVIDDECODECREATEINFO display_area_bottom(short setter); + + /** IN: cudaVideoSurfaceFormat_XXX */ + public native @Cast("cudaVideoSurfaceFormat") int OutputFormat(); public native CUVIDDECODECREATEINFO OutputFormat(int setter); + /** IN: cudaVideoDeinterlaceMode_XXX */ + public native @Cast("cudaVideoDeinterlaceMode") int DeinterlaceMode(); public native CUVIDDECODECREATEINFO DeinterlaceMode(int setter); + /** IN: Post-processed output width (Should be aligned to 2) */ + public native @Cast("unsigned long") long ulTargetWidth(); public native CUVIDDECODECREATEINFO ulTargetWidth(long setter); + /** IN: Post-processed output height (Should be aligned to 2) */ + public native @Cast("unsigned long") long ulTargetHeight(); public native CUVIDDECODECREATEINFO ulTargetHeight(long setter); + /** IN: Maximum number of output surfaces simultaneously mapped */ + public native @Cast("unsigned long") long ulNumOutputSurfaces(); public native CUVIDDECODECREATEINFO ulNumOutputSurfaces(long setter); + /** IN: If non-NULL, context lock used for synchronizing ownership of + the cuda context. Needed for cudaVideoCreate_PreferCUDA decode */ + public native _CUcontextlock_st vidLock(); public native CUVIDDECODECREATEINFO vidLock(_CUcontextlock_st setter); + /** + * IN: target rectangle in the output frame (for aspect ratio conversion) + * if a null rectangle is specified, {0,0,ulTargetWidth,ulTargetHeight} will be used + */ + @Name("target_rect.left") public native short target_rect_left(); public native CUVIDDECODECREATEINFO target_rect_left(short setter); + @Name("target_rect.top") public native short target_rect_top(); public native CUVIDDECODECREATEINFO target_rect_top(short setter); + @Name("target_rect.right") public native short target_rect_right(); public native CUVIDDECODECREATEINFO target_rect_right(short setter); + @Name("target_rect.bottom") public native short target_rect_bottom(); public native CUVIDDECODECREATEINFO target_rect_bottom(short setter); + + /** IN: enable histogram output, if supported */ + public native @Cast("unsigned long") long enableHistogram(); public native CUVIDDECODECREATEINFO enableHistogram(long setter); + /** Reserved for future use - set to zero */ + public native @Cast("unsigned long") long Reserved2(int i); public native CUVIDDECODECREATEINFO Reserved2(int i, long setter); + @MemberGetter public native @Cast("unsigned long*") CLongPointer Reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDEOFORMAT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDEOFORMAT.java new file mode 100644 index 00000000000..edcf79c6e65 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDEOFORMAT.java @@ -0,0 +1,112 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/************************************************************************************************/ +/** \ingroup STRUCTS +/** \struct CUVIDEOFORMAT +/** Video format +/** Used in cuvidGetSourceVideoFormat API +/************************************************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDEOFORMAT extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDEOFORMAT() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDEOFORMAT(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDEOFORMAT(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDEOFORMAT position(long position) { + return (CUVIDEOFORMAT)super.position(position); + } + @Override public CUVIDEOFORMAT getPointer(long i) { + return new CUVIDEOFORMAT((Pointer)this).position(position + i); + } + + /** OUT: Compression format */ + public native @Cast("cudaVideoCodec") int codec(); public native CUVIDEOFORMAT codec(int setter); + /** + * OUT: frame rate = numerator / denominator (for example: 30000/1001) + */ + + /** OUT: frame rate denominator (0 = unspecified or variable frame rate) */ + @Name("frame_rate.numerator") public native @Cast("unsigned int") int frame_rate_numerator(); public native CUVIDEOFORMAT frame_rate_numerator(int setter); + @Name("frame_rate.denominator") public native @Cast("unsigned int") int frame_rate_denominator(); public native CUVIDEOFORMAT frame_rate_denominator(int setter); + /** OUT: 0=interlaced, 1=progressive */ + public native @Cast("unsigned char") byte progressive_sequence(); public native CUVIDEOFORMAT progressive_sequence(byte setter); + /** OUT: high bit depth luma. E.g, 2 for 10-bitdepth, 4 for 12-bitdepth */ + public native @Cast("unsigned char") byte bit_depth_luma_minus8(); public native CUVIDEOFORMAT bit_depth_luma_minus8(byte setter); + /** OUT: high bit depth chroma. E.g, 2 for 10-bitdepth, 4 for 12-bitdepth */ + public native @Cast("unsigned char") byte bit_depth_chroma_minus8(); public native CUVIDEOFORMAT bit_depth_chroma_minus8(byte setter); + /** OUT: Minimum number of decode surfaces to be allocated for correct + decoding. The client can send this value in ulNumDecodeSurfaces + (in CUVIDDECODECREATEINFO structure). + This guarantees correct functionality and optimal video memory + usage but not necessarily the best performance, which depends on + the design of the overall application. The optimal number of + decode surfaces (in terms of performance and memory utilization) + should be decided by experimentation for each application, but it + cannot go below min_num_decode_surfaces. + If this value is used for ulNumDecodeSurfaces then it must be + returned to parser during sequence callback. */ + public native @Cast("unsigned char") byte min_num_decode_surfaces(); public native CUVIDEOFORMAT min_num_decode_surfaces(byte setter); + /** OUT: coded frame width in pixels */ + public native @Cast("unsigned int") int coded_width(); public native CUVIDEOFORMAT coded_width(int setter); + /** OUT: coded frame height in pixels */ + public native @Cast("unsigned int") int coded_height(); public native CUVIDEOFORMAT coded_height(int setter); + /** + * area of the frame that should be displayed + * typical example: + * coded_width = 1920, coded_height = 1088 + * display_area = { 0,0,1920,1080 } + */ + /** OUT: left position of display rect */ + @Name("display_area.left") public native int display_area_left(); public native CUVIDEOFORMAT display_area_left(int setter); + /** OUT: top position of display rect */ + @Name("display_area.top") public native int display_area_top(); public native CUVIDEOFORMAT display_area_top(int setter); + /** OUT: right position of display rect */ + @Name("display_area.right") public native int display_area_right(); public native CUVIDEOFORMAT display_area_right(int setter); + /** OUT: bottom position of display rect */ + @Name("display_area.bottom") public native int display_area_bottom(); public native CUVIDEOFORMAT display_area_bottom(int setter); + /** OUT: Chroma format */ + public native @Cast("cudaVideoChromaFormat") int chroma_format(); public native CUVIDEOFORMAT chroma_format(int setter); + /** OUT: video bitrate (bps, 0=unknown) */ + public native @Cast("unsigned int") int bitrate(); public native CUVIDEOFORMAT bitrate(int setter); + /** + * OUT: Display Aspect Ratio = x:y (4:3, 16:9, etc) + */ + @Name("display_aspect_ratio.x") public native int display_aspect_ratio_x(); public native CUVIDEOFORMAT display_aspect_ratio_x(int setter); + @Name("display_aspect_ratio.y") public native int display_aspect_ratio_y(); public native CUVIDEOFORMAT display_aspect_ratio_y(int setter); + /** + * Video Signal Description + * Refer section E.2.1 (VUI parameters semantics) of H264 spec file + */ + /** OUT: 0-Component, 1-PAL, 2-NTSC, 3-SECAM, 4-MAC, 5-Unspecified */ + @Name("video_signal_description.video_format") public native @Cast("unsigned char") @NoOffset byte video_signal_description_video_format(); public native CUVIDEOFORMAT video_signal_description_video_format(byte setter); + /** OUT: indicates the black level and luma and chroma range */ + @Name("video_signal_description.video_full_range_flag") public native @Cast("unsigned char") @NoOffset byte video_signal_description_video_full_range_flag(); public native CUVIDEOFORMAT video_signal_description_video_full_range_flag(byte setter); + /** Reserved bits */ + @Name("video_signal_description.reserved_zero_bits") public native @Cast("unsigned char") @NoOffset byte video_signal_description_reserved_zero_bits(); public native CUVIDEOFORMAT video_signal_description_reserved_zero_bits(byte setter); + /** OUT: chromaticity coordinates of source primaries */ + @Name("video_signal_description.color_primaries") public native @Cast("unsigned char") byte video_signal_description_color_primaries(); public native CUVIDEOFORMAT video_signal_description_color_primaries(byte setter); + /** OUT: opto-electronic transfer characteristic of the source picture */ + @Name("video_signal_description.transfer_characteristics") public native @Cast("unsigned char") byte video_signal_description_transfer_characteristics(); public native CUVIDEOFORMAT video_signal_description_transfer_characteristics(byte setter); + /** OUT: used in deriving luma and chroma signals from RGB primaries */ + @Name("video_signal_description.matrix_coefficients") public native @Cast("unsigned char") byte video_signal_description_matrix_coefficients(); public native CUVIDEOFORMAT video_signal_description_matrix_coefficients(byte setter); + /** OUT: Additional bytes following (CUVIDEOFORMATEX) */ + public native @Cast("unsigned int") int seqhdr_data_length(); public native CUVIDEOFORMAT seqhdr_data_length(int setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDEOFORMATEX.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDEOFORMATEX.java new file mode 100644 index 00000000000..60506581496 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDEOFORMATEX.java @@ -0,0 +1,46 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/****************************************************************/ +/** \ingroup STRUCTS +/** \struct CUVIDEOFORMATEX +/** Video format including raw sequence header information +/** Used in cuvidGetSourceVideoFormat API +/****************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDEOFORMATEX extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDEOFORMATEX() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDEOFORMATEX(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDEOFORMATEX(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDEOFORMATEX position(long position) { + return (CUVIDEOFORMATEX)super.position(position); + } + @Override public CUVIDEOFORMATEX getPointer(long i) { + return new CUVIDEOFORMATEX((Pointer)this).position(position + i); + } + + /** OUT: CUVIDEOFORMAT structure */ + public native @ByRef CUVIDEOFORMAT format(); public native CUVIDEOFORMATEX format(CUVIDEOFORMAT setter); + public native @ByRef CUVIDAV1SEQHDR av1(); public native CUVIDEOFORMATEX av1(CUVIDAV1SEQHDR setter); + /** OUT: Sequence header data */ + public native @Cast("unsigned char") byte raw_seqhdr_data(int i); public native CUVIDEOFORMATEX raw_seqhdr_data(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer raw_seqhdr_data(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDGETDECODESTATUS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDGETDECODESTATUS.java new file mode 100644 index 00000000000..b0ee8e1f5df --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDGETDECODESTATUS.java @@ -0,0 +1,44 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/*********************************************************************************************************/ +/** \struct CUVIDGETDECODESTATUS +/** Struct for reporting decode status. +/** This structure is used in cuvidGetDecodeStatus API. +/*********************************************************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDGETDECODESTATUS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDGETDECODESTATUS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDGETDECODESTATUS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDGETDECODESTATUS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDGETDECODESTATUS position(long position) { + return (CUVIDGETDECODESTATUS)super.position(position); + } + @Override public CUVIDGETDECODESTATUS getPointer(long i) { + return new CUVIDGETDECODESTATUS((Pointer)this).position(position + i); + } + + public native @Cast("cuvidDecodeStatus") int decodeStatus(); public native CUVIDGETDECODESTATUS decodeStatus(int setter); + public native @Cast("unsigned int") int reserved(int i); public native CUVIDGETDECODESTATUS reserved(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer reserved(); + public native Pointer pReserved(int i); public native CUVIDGETDECODESTATUS pReserved(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer pReserved(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264DPBENTRY.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264DPBENTRY.java new file mode 100644 index 00000000000..b902aeba355 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264DPBENTRY.java @@ -0,0 +1,52 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/*********************************************************/ +/** \struct CUVIDH264DPBENTRY +/** H.264 DPB entry +/** This structure is used in CUVIDH264PICPARAMS structure +/*********************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDH264DPBENTRY extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDH264DPBENTRY() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDH264DPBENTRY(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDH264DPBENTRY(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDH264DPBENTRY position(long position) { + return (CUVIDH264DPBENTRY)super.position(position); + } + @Override public CUVIDH264DPBENTRY getPointer(long i) { + return new CUVIDH264DPBENTRY((Pointer)this).position(position + i); + } + + /** picture index of reference frame */ + public native int PicIdx(); public native CUVIDH264DPBENTRY PicIdx(int setter); + /** frame_num(short-term) or LongTermFrameIdx(long-term) */ + public native int FrameIdx(); public native CUVIDH264DPBENTRY FrameIdx(int setter); + /** 0=short term reference, 1=long term reference */ + public native int is_long_term(); public native CUVIDH264DPBENTRY is_long_term(int setter); + /** non-existing reference frame (corresponding PicIdx should be set to -1) */ + public native int not_existing(); public native CUVIDH264DPBENTRY not_existing(int setter); + /** 0=unused, 1=top_field, 2=bottom_field, 3=both_fields */ + public native int used_for_reference(); public native CUVIDH264DPBENTRY used_for_reference(int setter); + /** field order count of top and bottom fields */ + public native int FieldOrderCnt(int i); public native CUVIDH264DPBENTRY FieldOrderCnt(int i, int setter); + @MemberGetter public native IntPointer FieldOrderCnt(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264MVCEXT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264MVCEXT.java new file mode 100644 index 00000000000..df9319edbf9 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264MVCEXT.java @@ -0,0 +1,57 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/************************************************************/ +/** \struct CUVIDH264MVCEXT +/** H.264 MVC picture parameters ext +/** This structure is used in CUVIDH264PICPARAMS structure +/************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDH264MVCEXT extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDH264MVCEXT() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDH264MVCEXT(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDH264MVCEXT(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDH264MVCEXT position(long position) { + return (CUVIDH264MVCEXT)super.position(position); + } + @Override public CUVIDH264MVCEXT getPointer(long i) { + return new CUVIDH264MVCEXT((Pointer)this).position(position + i); + } + + /** Max number of coded views minus 1 in video : Range - 0 to 1023 */ + public native int num_views_minus1(); public native CUVIDH264MVCEXT num_views_minus1(int setter); + /** view identifier */ + public native int view_id(); public native CUVIDH264MVCEXT view_id(int setter); + /** 1 if used for inter-view prediction, 0 if not */ + public native @Cast("unsigned char") byte inter_view_flag(); public native CUVIDH264MVCEXT inter_view_flag(byte setter); + /** number of inter-view ref pics in RefPicList0 */ + public native @Cast("unsigned char") byte num_inter_view_refs_l0(); public native CUVIDH264MVCEXT num_inter_view_refs_l0(byte setter); + /** number of inter-view ref pics in RefPicList1 */ + public native @Cast("unsigned char") byte num_inter_view_refs_l1(); public native CUVIDH264MVCEXT num_inter_view_refs_l1(byte setter); + /** Reserved bits */ + public native @Cast("unsigned char") byte MVCReserved8Bits(); public native CUVIDH264MVCEXT MVCReserved8Bits(byte setter); + /** view id of the i-th view component for inter-view prediction in RefPicList0 */ + public native int InterViewRefsL0(int i); public native CUVIDH264MVCEXT InterViewRefsL0(int i, int setter); + @MemberGetter public native IntPointer InterViewRefsL0(); + /** view id of the i-th view component for inter-view prediction in RefPicList1 */ + public native int InterViewRefsL1(int i); public native CUVIDH264MVCEXT InterViewRefsL1(int i, int setter); + @MemberGetter public native IntPointer InterViewRefsL1(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264PICPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264PICPARAMS.java new file mode 100644 index 00000000000..d278c1a1fc9 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264PICPARAMS.java @@ -0,0 +1,91 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/******************************************************/ +/** \struct CUVIDH264PICPARAMS +/** H.264 picture parameters +/** This structure is used in CUVIDPICPARAMS structure +/******************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDH264PICPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDH264PICPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDH264PICPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDH264PICPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDH264PICPARAMS position(long position) { + return (CUVIDH264PICPARAMS)super.position(position); + } + @Override public CUVIDH264PICPARAMS getPointer(long i) { + return new CUVIDH264PICPARAMS((Pointer)this).position(position + i); + } + + // SPS + public native int log2_max_frame_num_minus4(); public native CUVIDH264PICPARAMS log2_max_frame_num_minus4(int setter); + public native int pic_order_cnt_type(); public native CUVIDH264PICPARAMS pic_order_cnt_type(int setter); + public native int log2_max_pic_order_cnt_lsb_minus4(); public native CUVIDH264PICPARAMS log2_max_pic_order_cnt_lsb_minus4(int setter); + public native int delta_pic_order_always_zero_flag(); public native CUVIDH264PICPARAMS delta_pic_order_always_zero_flag(int setter); + public native int frame_mbs_only_flag(); public native CUVIDH264PICPARAMS frame_mbs_only_flag(int setter); + public native int direct_8x8_inference_flag(); public native CUVIDH264PICPARAMS direct_8x8_inference_flag(int setter); + public native int num_ref_frames(); public native CUVIDH264PICPARAMS num_ref_frames(int setter); // NOTE: shall meet level 4.1 restrictions + public native @Cast("unsigned char") byte residual_colour_transform_flag(); public native CUVIDH264PICPARAMS residual_colour_transform_flag(byte setter); + public native @Cast("unsigned char") byte bit_depth_luma_minus8(); public native CUVIDH264PICPARAMS bit_depth_luma_minus8(byte setter); // Must be 0 (only 8-bit supported) + public native @Cast("unsigned char") byte bit_depth_chroma_minus8(); public native CUVIDH264PICPARAMS bit_depth_chroma_minus8(byte setter); // Must be 0 (only 8-bit supported) + public native @Cast("unsigned char") byte qpprime_y_zero_transform_bypass_flag(); public native CUVIDH264PICPARAMS qpprime_y_zero_transform_bypass_flag(byte setter); + // PPS + public native int entropy_coding_mode_flag(); public native CUVIDH264PICPARAMS entropy_coding_mode_flag(int setter); + public native int pic_order_present_flag(); public native CUVIDH264PICPARAMS pic_order_present_flag(int setter); + public native int num_ref_idx_l0_active_minus1(); public native CUVIDH264PICPARAMS num_ref_idx_l0_active_minus1(int setter); + public native int num_ref_idx_l1_active_minus1(); public native CUVIDH264PICPARAMS num_ref_idx_l1_active_minus1(int setter); + public native int weighted_pred_flag(); public native CUVIDH264PICPARAMS weighted_pred_flag(int setter); + public native int weighted_bipred_idc(); public native CUVIDH264PICPARAMS weighted_bipred_idc(int setter); + public native int pic_init_qp_minus26(); public native CUVIDH264PICPARAMS pic_init_qp_minus26(int setter); + public native int deblocking_filter_control_present_flag(); public native CUVIDH264PICPARAMS deblocking_filter_control_present_flag(int setter); + public native int redundant_pic_cnt_present_flag(); public native CUVIDH264PICPARAMS redundant_pic_cnt_present_flag(int setter); + public native int transform_8x8_mode_flag(); public native CUVIDH264PICPARAMS transform_8x8_mode_flag(int setter); + public native int MbaffFrameFlag(); public native CUVIDH264PICPARAMS MbaffFrameFlag(int setter); + public native int constrained_intra_pred_flag(); public native CUVIDH264PICPARAMS constrained_intra_pred_flag(int setter); + public native int chroma_qp_index_offset(); public native CUVIDH264PICPARAMS chroma_qp_index_offset(int setter); + public native int second_chroma_qp_index_offset(); public native CUVIDH264PICPARAMS second_chroma_qp_index_offset(int setter); + public native int ref_pic_flag(); public native CUVIDH264PICPARAMS ref_pic_flag(int setter); + public native int frame_num(); public native CUVIDH264PICPARAMS frame_num(int setter); + public native int CurrFieldOrderCnt(int i); public native CUVIDH264PICPARAMS CurrFieldOrderCnt(int i, int setter); + @MemberGetter public native IntPointer CurrFieldOrderCnt(); + // DPB + public native @ByRef CUVIDH264DPBENTRY dpb(int i); public native CUVIDH264PICPARAMS dpb(int i, CUVIDH264DPBENTRY setter); + @MemberGetter public native CUVIDH264DPBENTRY dpb(); // List of reference frames within the DPB + // Quantization Matrices (raster-order) + public native @Cast("unsigned char") byte WeightScale4x4(int i, int j); public native CUVIDH264PICPARAMS WeightScale4x4(int i, int j, byte setter); + @MemberGetter public native @Cast("unsigned char(* /*[6]*/ )[16]") BytePointer WeightScale4x4(); + public native @Cast("unsigned char") byte WeightScale8x8(int i, int j); public native CUVIDH264PICPARAMS WeightScale8x8(int i, int j, byte setter); + @MemberGetter public native @Cast("unsigned char(* /*[2]*/ )[64]") BytePointer WeightScale8x8(); + // FMO/ASO + public native @Cast("unsigned char") byte fmo_aso_enable(); public native CUVIDH264PICPARAMS fmo_aso_enable(byte setter); + public native @Cast("unsigned char") byte num_slice_groups_minus1(); public native CUVIDH264PICPARAMS num_slice_groups_minus1(byte setter); + public native @Cast("unsigned char") byte slice_group_map_type(); public native CUVIDH264PICPARAMS slice_group_map_type(byte setter); + public native byte pic_init_qs_minus26(); public native CUVIDH264PICPARAMS pic_init_qs_minus26(byte setter); + public native @Cast("unsigned int") int slice_group_change_rate_minus1(); public native CUVIDH264PICPARAMS slice_group_change_rate_minus1(int setter); + @Name("fmo.slice_group_map_addr") public native @Cast("unsigned long long") long fmo_slice_group_map_addr(); public native CUVIDH264PICPARAMS fmo_slice_group_map_addr(long setter); + @Name("fmo.pMb2SliceGroupMap") public native @Cast("const unsigned char*") BytePointer fmo_pMb2SliceGroupMap(); public native CUVIDH264PICPARAMS fmo_pMb2SliceGroupMap(BytePointer setter); + public native @Cast("unsigned int") int Reserved(int i); public native CUVIDH264PICPARAMS Reserved(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer Reserved(); + // SVC/MVC + public native @ByRef CUVIDH264MVCEXT mvcext(); public native CUVIDH264PICPARAMS mvcext(CUVIDH264MVCEXT setter); + public native @ByRef CUVIDH264SVCEXT svcext(); public native CUVIDH264PICPARAMS svcext(CUVIDH264SVCEXT setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264SVCEXT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264SVCEXT.java new file mode 100644 index 00000000000..7c73490e8bd --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDH264SVCEXT.java @@ -0,0 +1,73 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/*********************************************************/ +/** \struct CUVIDH264SVCEXT +/** H.264 SVC picture parameters ext +/** This structure is used in CUVIDH264PICPARAMS structure +/*********************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDH264SVCEXT extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDH264SVCEXT() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDH264SVCEXT(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDH264SVCEXT(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDH264SVCEXT position(long position) { + return (CUVIDH264SVCEXT)super.position(position); + } + @Override public CUVIDH264SVCEXT getPointer(long i) { + return new CUVIDH264SVCEXT((Pointer)this).position(position + i); + } + + public native @Cast("unsigned char") byte profile_idc(); public native CUVIDH264SVCEXT profile_idc(byte setter); + public native @Cast("unsigned char") byte level_idc(); public native CUVIDH264SVCEXT level_idc(byte setter); + public native @Cast("unsigned char") byte DQId(); public native CUVIDH264SVCEXT DQId(byte setter); + public native @Cast("unsigned char") byte DQIdMax(); public native CUVIDH264SVCEXT DQIdMax(byte setter); + public native @Cast("unsigned char") byte disable_inter_layer_deblocking_filter_idc(); public native CUVIDH264SVCEXT disable_inter_layer_deblocking_filter_idc(byte setter); + public native @Cast("unsigned char") byte ref_layer_chroma_phase_y_plus1(); public native CUVIDH264SVCEXT ref_layer_chroma_phase_y_plus1(byte setter); + public native byte inter_layer_slice_alpha_c0_offset_div2(); public native CUVIDH264SVCEXT inter_layer_slice_alpha_c0_offset_div2(byte setter); + public native byte inter_layer_slice_beta_offset_div2(); public native CUVIDH264SVCEXT inter_layer_slice_beta_offset_div2(byte setter); + + public native @Cast("unsigned short") short DPBEntryValidFlag(); public native CUVIDH264SVCEXT DPBEntryValidFlag(short setter); + public native @Cast("unsigned char") byte inter_layer_deblocking_filter_control_present_flag(); public native CUVIDH264SVCEXT inter_layer_deblocking_filter_control_present_flag(byte setter); + public native @Cast("unsigned char") byte extended_spatial_scalability_idc(); public native CUVIDH264SVCEXT extended_spatial_scalability_idc(byte setter); + public native @Cast("unsigned char") byte adaptive_tcoeff_level_prediction_flag(); public native CUVIDH264SVCEXT adaptive_tcoeff_level_prediction_flag(byte setter); + public native @Cast("unsigned char") byte slice_header_restriction_flag(); public native CUVIDH264SVCEXT slice_header_restriction_flag(byte setter); + public native @Cast("unsigned char") byte chroma_phase_x_plus1_flag(); public native CUVIDH264SVCEXT chroma_phase_x_plus1_flag(byte setter); + public native @Cast("unsigned char") byte chroma_phase_y_plus1(); public native CUVIDH264SVCEXT chroma_phase_y_plus1(byte setter); + + public native @Cast("unsigned char") byte tcoeff_level_prediction_flag(); public native CUVIDH264SVCEXT tcoeff_level_prediction_flag(byte setter); + public native @Cast("unsigned char") byte constrained_intra_resampling_flag(); public native CUVIDH264SVCEXT constrained_intra_resampling_flag(byte setter); + public native @Cast("unsigned char") byte ref_layer_chroma_phase_x_plus1_flag(); public native CUVIDH264SVCEXT ref_layer_chroma_phase_x_plus1_flag(byte setter); + public native @Cast("unsigned char") byte store_ref_base_pic_flag(); public native CUVIDH264SVCEXT store_ref_base_pic_flag(byte setter); + public native @Cast("unsigned char") byte Reserved8BitsA(); public native CUVIDH264SVCEXT Reserved8BitsA(byte setter); + public native @Cast("unsigned char") byte Reserved8BitsB(); public native CUVIDH264SVCEXT Reserved8BitsB(byte setter); + + public native short scaled_ref_layer_left_offset(); public native CUVIDH264SVCEXT scaled_ref_layer_left_offset(short setter); + public native short scaled_ref_layer_top_offset(); public native CUVIDH264SVCEXT scaled_ref_layer_top_offset(short setter); + public native short scaled_ref_layer_right_offset(); public native CUVIDH264SVCEXT scaled_ref_layer_right_offset(short setter); + public native short scaled_ref_layer_bottom_offset(); public native CUVIDH264SVCEXT scaled_ref_layer_bottom_offset(short setter); + public native @Cast("unsigned short") short Reserved16Bits(); public native CUVIDH264SVCEXT Reserved16Bits(short setter); + /** Points to the picparams for the next layer to be decoded. + Linked list ends at the target layer. */ + public native CUVIDPICPARAMS pNextLayer(); public native CUVIDH264SVCEXT pNextLayer(CUVIDPICPARAMS setter); + /** whether to store ref base pic */ + public native int bRefBaseLayer(); public native CUVIDH264SVCEXT bRefBaseLayer(int setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDHEVCPICPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDHEVCPICPARAMS.java new file mode 100644 index 00000000000..028fb43598e --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDHEVCPICPARAMS.java @@ -0,0 +1,191 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + + +/*******************************************************/ +/** \struct CUVIDHEVCPICPARAMS +/** HEVC picture parameters +/** This structure is used in CUVIDPICPARAMS structure +/*******************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDHEVCPICPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDHEVCPICPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDHEVCPICPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDHEVCPICPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDHEVCPICPARAMS position(long position) { + return (CUVIDHEVCPICPARAMS)super.position(position); + } + @Override public CUVIDHEVCPICPARAMS getPointer(long i) { + return new CUVIDHEVCPICPARAMS((Pointer)this).position(position + i); + } + + // sps + public native int pic_width_in_luma_samples(); public native CUVIDHEVCPICPARAMS pic_width_in_luma_samples(int setter); + public native int pic_height_in_luma_samples(); public native CUVIDHEVCPICPARAMS pic_height_in_luma_samples(int setter); + public native @Cast("unsigned char") byte log2_min_luma_coding_block_size_minus3(); public native CUVIDHEVCPICPARAMS log2_min_luma_coding_block_size_minus3(byte setter); + public native @Cast("unsigned char") byte log2_diff_max_min_luma_coding_block_size(); public native CUVIDHEVCPICPARAMS log2_diff_max_min_luma_coding_block_size(byte setter); + public native @Cast("unsigned char") byte log2_min_transform_block_size_minus2(); public native CUVIDHEVCPICPARAMS log2_min_transform_block_size_minus2(byte setter); + public native @Cast("unsigned char") byte log2_diff_max_min_transform_block_size(); public native CUVIDHEVCPICPARAMS log2_diff_max_min_transform_block_size(byte setter); + public native @Cast("unsigned char") byte pcm_enabled_flag(); public native CUVIDHEVCPICPARAMS pcm_enabled_flag(byte setter); + public native @Cast("unsigned char") byte log2_min_pcm_luma_coding_block_size_minus3(); public native CUVIDHEVCPICPARAMS log2_min_pcm_luma_coding_block_size_minus3(byte setter); + public native @Cast("unsigned char") byte log2_diff_max_min_pcm_luma_coding_block_size(); public native CUVIDHEVCPICPARAMS log2_diff_max_min_pcm_luma_coding_block_size(byte setter); + public native @Cast("unsigned char") byte pcm_sample_bit_depth_luma_minus1(); public native CUVIDHEVCPICPARAMS pcm_sample_bit_depth_luma_minus1(byte setter); + + public native @Cast("unsigned char") byte pcm_sample_bit_depth_chroma_minus1(); public native CUVIDHEVCPICPARAMS pcm_sample_bit_depth_chroma_minus1(byte setter); + public native @Cast("unsigned char") byte pcm_loop_filter_disabled_flag(); public native CUVIDHEVCPICPARAMS pcm_loop_filter_disabled_flag(byte setter); + public native @Cast("unsigned char") byte strong_intra_smoothing_enabled_flag(); public native CUVIDHEVCPICPARAMS strong_intra_smoothing_enabled_flag(byte setter); + public native @Cast("unsigned char") byte max_transform_hierarchy_depth_intra(); public native CUVIDHEVCPICPARAMS max_transform_hierarchy_depth_intra(byte setter); + public native @Cast("unsigned char") byte max_transform_hierarchy_depth_inter(); public native CUVIDHEVCPICPARAMS max_transform_hierarchy_depth_inter(byte setter); + public native @Cast("unsigned char") byte amp_enabled_flag(); public native CUVIDHEVCPICPARAMS amp_enabled_flag(byte setter); + public native @Cast("unsigned char") byte separate_colour_plane_flag(); public native CUVIDHEVCPICPARAMS separate_colour_plane_flag(byte setter); + public native @Cast("unsigned char") byte log2_max_pic_order_cnt_lsb_minus4(); public native CUVIDHEVCPICPARAMS log2_max_pic_order_cnt_lsb_minus4(byte setter); + + public native @Cast("unsigned char") byte num_short_term_ref_pic_sets(); public native CUVIDHEVCPICPARAMS num_short_term_ref_pic_sets(byte setter); + public native @Cast("unsigned char") byte long_term_ref_pics_present_flag(); public native CUVIDHEVCPICPARAMS long_term_ref_pics_present_flag(byte setter); + public native @Cast("unsigned char") byte num_long_term_ref_pics_sps(); public native CUVIDHEVCPICPARAMS num_long_term_ref_pics_sps(byte setter); + public native @Cast("unsigned char") byte sps_temporal_mvp_enabled_flag(); public native CUVIDHEVCPICPARAMS sps_temporal_mvp_enabled_flag(byte setter); + public native @Cast("unsigned char") byte sample_adaptive_offset_enabled_flag(); public native CUVIDHEVCPICPARAMS sample_adaptive_offset_enabled_flag(byte setter); + public native @Cast("unsigned char") byte scaling_list_enable_flag(); public native CUVIDHEVCPICPARAMS scaling_list_enable_flag(byte setter); + public native @Cast("unsigned char") byte IrapPicFlag(); public native CUVIDHEVCPICPARAMS IrapPicFlag(byte setter); + public native @Cast("unsigned char") byte IdrPicFlag(); public native CUVIDHEVCPICPARAMS IdrPicFlag(byte setter); + + public native @Cast("unsigned char") byte bit_depth_luma_minus8(); public native CUVIDHEVCPICPARAMS bit_depth_luma_minus8(byte setter); + public native @Cast("unsigned char") byte bit_depth_chroma_minus8(); public native CUVIDHEVCPICPARAMS bit_depth_chroma_minus8(byte setter); + //sps/pps extension fields + public native @Cast("unsigned char") byte log2_max_transform_skip_block_size_minus2(); public native CUVIDHEVCPICPARAMS log2_max_transform_skip_block_size_minus2(byte setter); + public native @Cast("unsigned char") byte log2_sao_offset_scale_luma(); public native CUVIDHEVCPICPARAMS log2_sao_offset_scale_luma(byte setter); + public native @Cast("unsigned char") byte log2_sao_offset_scale_chroma(); public native CUVIDHEVCPICPARAMS log2_sao_offset_scale_chroma(byte setter); + public native @Cast("unsigned char") byte high_precision_offsets_enabled_flag(); public native CUVIDHEVCPICPARAMS high_precision_offsets_enabled_flag(byte setter); + public native @Cast("unsigned char") byte reserved1(int i); public native CUVIDHEVCPICPARAMS reserved1(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer reserved1(); + + // pps + public native @Cast("unsigned char") byte dependent_slice_segments_enabled_flag(); public native CUVIDHEVCPICPARAMS dependent_slice_segments_enabled_flag(byte setter); + public native @Cast("unsigned char") byte slice_segment_header_extension_present_flag(); public native CUVIDHEVCPICPARAMS slice_segment_header_extension_present_flag(byte setter); + public native @Cast("unsigned char") byte sign_data_hiding_enabled_flag(); public native CUVIDHEVCPICPARAMS sign_data_hiding_enabled_flag(byte setter); + public native @Cast("unsigned char") byte cu_qp_delta_enabled_flag(); public native CUVIDHEVCPICPARAMS cu_qp_delta_enabled_flag(byte setter); + public native @Cast("unsigned char") byte diff_cu_qp_delta_depth(); public native CUVIDHEVCPICPARAMS diff_cu_qp_delta_depth(byte setter); + public native byte init_qp_minus26(); public native CUVIDHEVCPICPARAMS init_qp_minus26(byte setter); + public native byte pps_cb_qp_offset(); public native CUVIDHEVCPICPARAMS pps_cb_qp_offset(byte setter); + public native byte pps_cr_qp_offset(); public native CUVIDHEVCPICPARAMS pps_cr_qp_offset(byte setter); + + public native @Cast("unsigned char") byte constrained_intra_pred_flag(); public native CUVIDHEVCPICPARAMS constrained_intra_pred_flag(byte setter); + public native @Cast("unsigned char") byte weighted_pred_flag(); public native CUVIDHEVCPICPARAMS weighted_pred_flag(byte setter); + public native @Cast("unsigned char") byte weighted_bipred_flag(); public native CUVIDHEVCPICPARAMS weighted_bipred_flag(byte setter); + public native @Cast("unsigned char") byte transform_skip_enabled_flag(); public native CUVIDHEVCPICPARAMS transform_skip_enabled_flag(byte setter); + public native @Cast("unsigned char") byte transquant_bypass_enabled_flag(); public native CUVIDHEVCPICPARAMS transquant_bypass_enabled_flag(byte setter); + public native @Cast("unsigned char") byte entropy_coding_sync_enabled_flag(); public native CUVIDHEVCPICPARAMS entropy_coding_sync_enabled_flag(byte setter); + public native @Cast("unsigned char") byte log2_parallel_merge_level_minus2(); public native CUVIDHEVCPICPARAMS log2_parallel_merge_level_minus2(byte setter); + public native @Cast("unsigned char") byte num_extra_slice_header_bits(); public native CUVIDHEVCPICPARAMS num_extra_slice_header_bits(byte setter); + + public native @Cast("unsigned char") byte loop_filter_across_tiles_enabled_flag(); public native CUVIDHEVCPICPARAMS loop_filter_across_tiles_enabled_flag(byte setter); + public native @Cast("unsigned char") byte loop_filter_across_slices_enabled_flag(); public native CUVIDHEVCPICPARAMS loop_filter_across_slices_enabled_flag(byte setter); + public native @Cast("unsigned char") byte output_flag_present_flag(); public native CUVIDHEVCPICPARAMS output_flag_present_flag(byte setter); + public native @Cast("unsigned char") byte num_ref_idx_l0_default_active_minus1(); public native CUVIDHEVCPICPARAMS num_ref_idx_l0_default_active_minus1(byte setter); + public native @Cast("unsigned char") byte num_ref_idx_l1_default_active_minus1(); public native CUVIDHEVCPICPARAMS num_ref_idx_l1_default_active_minus1(byte setter); + public native @Cast("unsigned char") byte lists_modification_present_flag(); public native CUVIDHEVCPICPARAMS lists_modification_present_flag(byte setter); + public native @Cast("unsigned char") byte cabac_init_present_flag(); public native CUVIDHEVCPICPARAMS cabac_init_present_flag(byte setter); + public native @Cast("unsigned char") byte pps_slice_chroma_qp_offsets_present_flag(); public native CUVIDHEVCPICPARAMS pps_slice_chroma_qp_offsets_present_flag(byte setter); + + public native @Cast("unsigned char") byte deblocking_filter_override_enabled_flag(); public native CUVIDHEVCPICPARAMS deblocking_filter_override_enabled_flag(byte setter); + public native @Cast("unsigned char") byte pps_deblocking_filter_disabled_flag(); public native CUVIDHEVCPICPARAMS pps_deblocking_filter_disabled_flag(byte setter); + public native byte pps_beta_offset_div2(); public native CUVIDHEVCPICPARAMS pps_beta_offset_div2(byte setter); + public native byte pps_tc_offset_div2(); public native CUVIDHEVCPICPARAMS pps_tc_offset_div2(byte setter); + public native @Cast("unsigned char") byte tiles_enabled_flag(); public native CUVIDHEVCPICPARAMS tiles_enabled_flag(byte setter); + public native @Cast("unsigned char") byte uniform_spacing_flag(); public native CUVIDHEVCPICPARAMS uniform_spacing_flag(byte setter); + public native @Cast("unsigned char") byte num_tile_columns_minus1(); public native CUVIDHEVCPICPARAMS num_tile_columns_minus1(byte setter); + public native @Cast("unsigned char") byte num_tile_rows_minus1(); public native CUVIDHEVCPICPARAMS num_tile_rows_minus1(byte setter); + + public native @Cast("unsigned short") short column_width_minus1(int i); public native CUVIDHEVCPICPARAMS column_width_minus1(int i, short setter); + @MemberGetter public native @Cast("unsigned short*") ShortPointer column_width_minus1(); + public native @Cast("unsigned short") short row_height_minus1(int i); public native CUVIDHEVCPICPARAMS row_height_minus1(int i, short setter); + @MemberGetter public native @Cast("unsigned short*") ShortPointer row_height_minus1(); + + // sps and pps extension HEVC-main 444 + public native @Cast("unsigned char") byte sps_range_extension_flag(); public native CUVIDHEVCPICPARAMS sps_range_extension_flag(byte setter); + public native @Cast("unsigned char") byte transform_skip_rotation_enabled_flag(); public native CUVIDHEVCPICPARAMS transform_skip_rotation_enabled_flag(byte setter); + public native @Cast("unsigned char") byte transform_skip_context_enabled_flag(); public native CUVIDHEVCPICPARAMS transform_skip_context_enabled_flag(byte setter); + public native @Cast("unsigned char") byte implicit_rdpcm_enabled_flag(); public native CUVIDHEVCPICPARAMS implicit_rdpcm_enabled_flag(byte setter); + + public native @Cast("unsigned char") byte explicit_rdpcm_enabled_flag(); public native CUVIDHEVCPICPARAMS explicit_rdpcm_enabled_flag(byte setter); + public native @Cast("unsigned char") byte extended_precision_processing_flag(); public native CUVIDHEVCPICPARAMS extended_precision_processing_flag(byte setter); + public native @Cast("unsigned char") byte intra_smoothing_disabled_flag(); public native CUVIDHEVCPICPARAMS intra_smoothing_disabled_flag(byte setter); + public native @Cast("unsigned char") byte persistent_rice_adaptation_enabled_flag(); public native CUVIDHEVCPICPARAMS persistent_rice_adaptation_enabled_flag(byte setter); + + public native @Cast("unsigned char") byte cabac_bypass_alignment_enabled_flag(); public native CUVIDHEVCPICPARAMS cabac_bypass_alignment_enabled_flag(byte setter); + public native @Cast("unsigned char") byte pps_range_extension_flag(); public native CUVIDHEVCPICPARAMS pps_range_extension_flag(byte setter); + public native @Cast("unsigned char") byte cross_component_prediction_enabled_flag(); public native CUVIDHEVCPICPARAMS cross_component_prediction_enabled_flag(byte setter); + public native @Cast("unsigned char") byte chroma_qp_offset_list_enabled_flag(); public native CUVIDHEVCPICPARAMS chroma_qp_offset_list_enabled_flag(byte setter); + + public native @Cast("unsigned char") byte diff_cu_chroma_qp_offset_depth(); public native CUVIDHEVCPICPARAMS diff_cu_chroma_qp_offset_depth(byte setter); + public native @Cast("unsigned char") byte chroma_qp_offset_list_len_minus1(); public native CUVIDHEVCPICPARAMS chroma_qp_offset_list_len_minus1(byte setter); + public native byte cb_qp_offset_list(int i); public native CUVIDHEVCPICPARAMS cb_qp_offset_list(int i, byte setter); + @MemberGetter public native BytePointer cb_qp_offset_list(); + + public native byte cr_qp_offset_list(int i); public native CUVIDHEVCPICPARAMS cr_qp_offset_list(int i, byte setter); + @MemberGetter public native BytePointer cr_qp_offset_list(); + public native @Cast("unsigned char") byte reserved2(int i); public native CUVIDHEVCPICPARAMS reserved2(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer reserved2(); + + public native @Cast("unsigned int") int reserved3(int i); public native CUVIDHEVCPICPARAMS reserved3(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer reserved3(); + + // RefPicSets + public native int NumBitsForShortTermRPSInSlice(); public native CUVIDHEVCPICPARAMS NumBitsForShortTermRPSInSlice(int setter); + public native int NumDeltaPocsOfRefRpsIdx(); public native CUVIDHEVCPICPARAMS NumDeltaPocsOfRefRpsIdx(int setter); + public native int NumPocTotalCurr(); public native CUVIDHEVCPICPARAMS NumPocTotalCurr(int setter); + public native int NumPocStCurrBefore(); public native CUVIDHEVCPICPARAMS NumPocStCurrBefore(int setter); + public native int NumPocStCurrAfter(); public native CUVIDHEVCPICPARAMS NumPocStCurrAfter(int setter); + public native int NumPocLtCurr(); public native CUVIDHEVCPICPARAMS NumPocLtCurr(int setter); + public native int CurrPicOrderCntVal(); public native CUVIDHEVCPICPARAMS CurrPicOrderCntVal(int setter); + public native int RefPicIdx(int i); public native CUVIDHEVCPICPARAMS RefPicIdx(int i, int setter); + @MemberGetter public native IntPointer RefPicIdx(); // [refpic] Indices of valid reference pictures (-1 if unused for reference) + public native int PicOrderCntVal(int i); public native CUVIDHEVCPICPARAMS PicOrderCntVal(int i, int setter); + @MemberGetter public native IntPointer PicOrderCntVal(); // [refpic] + public native @Cast("unsigned char") byte IsLongTerm(int i); public native CUVIDHEVCPICPARAMS IsLongTerm(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer IsLongTerm(); // [refpic] 0=not a long-term reference, 1=long-term reference + public native @Cast("unsigned char") byte RefPicSetStCurrBefore(int i); public native CUVIDHEVCPICPARAMS RefPicSetStCurrBefore(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer RefPicSetStCurrBefore(); // [0..NumPocStCurrBefore-1] -> refpic (0..15) + public native @Cast("unsigned char") byte RefPicSetStCurrAfter(int i); public native CUVIDHEVCPICPARAMS RefPicSetStCurrAfter(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer RefPicSetStCurrAfter(); // [0..NumPocStCurrAfter-1] -> refpic (0..15) + public native @Cast("unsigned char") byte RefPicSetLtCurr(int i); public native CUVIDHEVCPICPARAMS RefPicSetLtCurr(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer RefPicSetLtCurr(); // [0..NumPocLtCurr-1] -> refpic (0..15) + public native @Cast("unsigned char") byte RefPicSetInterLayer0(int i); public native CUVIDHEVCPICPARAMS RefPicSetInterLayer0(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer RefPicSetInterLayer0(); + public native @Cast("unsigned char") byte RefPicSetInterLayer1(int i); public native CUVIDHEVCPICPARAMS RefPicSetInterLayer1(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer RefPicSetInterLayer1(); + public native @Cast("unsigned int") int reserved4(int i); public native CUVIDHEVCPICPARAMS reserved4(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer reserved4(); + + // scaling lists (diag order) + public native @Cast("unsigned char") byte ScalingList4x4(int i, int j); public native CUVIDHEVCPICPARAMS ScalingList4x4(int i, int j, byte setter); + @MemberGetter public native @Cast("unsigned char(* /*[6]*/ )[16]") BytePointer ScalingList4x4(); // [matrixId][i] + public native @Cast("unsigned char") byte ScalingList8x8(int i, int j); public native CUVIDHEVCPICPARAMS ScalingList8x8(int i, int j, byte setter); + @MemberGetter public native @Cast("unsigned char(* /*[6]*/ )[64]") BytePointer ScalingList8x8(); // [matrixId][i] + public native @Cast("unsigned char") byte ScalingList16x16(int i, int j); public native CUVIDHEVCPICPARAMS ScalingList16x16(int i, int j, byte setter); + @MemberGetter public native @Cast("unsigned char(* /*[6]*/ )[64]") BytePointer ScalingList16x16(); // [matrixId][i] + public native @Cast("unsigned char") byte ScalingList32x32(int i, int j); public native CUVIDHEVCPICPARAMS ScalingList32x32(int i, int j, byte setter); + @MemberGetter public native @Cast("unsigned char(* /*[2]*/ )[64]") BytePointer ScalingList32x32(); // [matrixId][i] + public native @Cast("unsigned char") byte ScalingListDCCoeff16x16(int i); public native CUVIDHEVCPICPARAMS ScalingListDCCoeff16x16(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer ScalingListDCCoeff16x16(); // [matrixId] + public native @Cast("unsigned char") byte ScalingListDCCoeff32x32(int i); public native CUVIDHEVCPICPARAMS ScalingListDCCoeff32x32(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer ScalingListDCCoeff32x32(); // [matrixId] +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDJPEGPICPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDJPEGPICPARAMS.java new file mode 100644 index 00000000000..a1a54fb78dd --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDJPEGPICPARAMS.java @@ -0,0 +1,40 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/***********************************************************/ +/** \struct CUVIDJPEGPICPARAMS +/** JPEG picture parameters +/** This structure is used in CUVIDPICPARAMS structure +/***********************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDJPEGPICPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDJPEGPICPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDJPEGPICPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDJPEGPICPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDJPEGPICPARAMS position(long position) { + return (CUVIDJPEGPICPARAMS)super.position(position); + } + @Override public CUVIDJPEGPICPARAMS getPointer(long i) { + return new CUVIDJPEGPICPARAMS((Pointer)this).position(position + i); + } + + public native int Reserved(); public native CUVIDJPEGPICPARAMS Reserved(int setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDMPEG2PICPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDMPEG2PICPARAMS.java new file mode 100644 index 00000000000..6d8c3d0d2a7 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDMPEG2PICPARAMS.java @@ -0,0 +1,59 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + + +/********************************************************/ +/** \struct CUVIDMPEG2PICPARAMS +/** MPEG-2 picture parameters +/** This structure is used in CUVIDPICPARAMS structure +/********************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDMPEG2PICPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDMPEG2PICPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDMPEG2PICPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDMPEG2PICPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDMPEG2PICPARAMS position(long position) { + return (CUVIDMPEG2PICPARAMS)super.position(position); + } + @Override public CUVIDMPEG2PICPARAMS getPointer(long i) { + return new CUVIDMPEG2PICPARAMS((Pointer)this).position(position + i); + } + + public native int ForwardRefIdx(); public native CUVIDMPEG2PICPARAMS ForwardRefIdx(int setter); // Picture index of forward reference (P/B-frames) + public native int BackwardRefIdx(); public native CUVIDMPEG2PICPARAMS BackwardRefIdx(int setter); // Picture index of backward reference (B-frames) + public native int picture_coding_type(); public native CUVIDMPEG2PICPARAMS picture_coding_type(int setter); + public native int full_pel_forward_vector(); public native CUVIDMPEG2PICPARAMS full_pel_forward_vector(int setter); + public native int full_pel_backward_vector(); public native CUVIDMPEG2PICPARAMS full_pel_backward_vector(int setter); + public native int f_code(int i, int j); public native CUVIDMPEG2PICPARAMS f_code(int i, int j, int setter); + @MemberGetter public native @Cast("int(* /*[2]*/ )[2]") IntPointer f_code(); + public native int intra_dc_precision(); public native CUVIDMPEG2PICPARAMS intra_dc_precision(int setter); + public native int frame_pred_frame_dct(); public native CUVIDMPEG2PICPARAMS frame_pred_frame_dct(int setter); + public native int concealment_motion_vectors(); public native CUVIDMPEG2PICPARAMS concealment_motion_vectors(int setter); + public native int q_scale_type(); public native CUVIDMPEG2PICPARAMS q_scale_type(int setter); + public native int intra_vlc_format(); public native CUVIDMPEG2PICPARAMS intra_vlc_format(int setter); + public native int alternate_scan(); public native CUVIDMPEG2PICPARAMS alternate_scan(int setter); + public native int top_field_first(); public native CUVIDMPEG2PICPARAMS top_field_first(int setter); + // Quantization matrices (raster order) + public native @Cast("unsigned char") byte QuantMatrixIntra(int i); public native CUVIDMPEG2PICPARAMS QuantMatrixIntra(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer QuantMatrixIntra(); + public native @Cast("unsigned char") byte QuantMatrixInter(int i); public native CUVIDMPEG2PICPARAMS QuantMatrixInter(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer QuantMatrixInter(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDMPEG4PICPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDMPEG4PICPARAMS.java new file mode 100644 index 00000000000..3ae5f1e6cf5 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDMPEG4PICPARAMS.java @@ -0,0 +1,69 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/*******************************************************/ +/** \struct CUVIDMPEG4PICPARAMS +/** MPEG-4 picture parameters +/** This structure is used in CUVIDPICPARAMS structure +/*******************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDMPEG4PICPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDMPEG4PICPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDMPEG4PICPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDMPEG4PICPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDMPEG4PICPARAMS position(long position) { + return (CUVIDMPEG4PICPARAMS)super.position(position); + } + @Override public CUVIDMPEG4PICPARAMS getPointer(long i) { + return new CUVIDMPEG4PICPARAMS((Pointer)this).position(position + i); + } + + public native int ForwardRefIdx(); public native CUVIDMPEG4PICPARAMS ForwardRefIdx(int setter); // Picture index of forward reference (P/B-frames) + public native int BackwardRefIdx(); public native CUVIDMPEG4PICPARAMS BackwardRefIdx(int setter); // Picture index of backward reference (B-frames) + // VOL + public native int video_object_layer_width(); public native CUVIDMPEG4PICPARAMS video_object_layer_width(int setter); + public native int video_object_layer_height(); public native CUVIDMPEG4PICPARAMS video_object_layer_height(int setter); + public native int vop_time_increment_bitcount(); public native CUVIDMPEG4PICPARAMS vop_time_increment_bitcount(int setter); + public native int top_field_first(); public native CUVIDMPEG4PICPARAMS top_field_first(int setter); + public native int resync_marker_disable(); public native CUVIDMPEG4PICPARAMS resync_marker_disable(int setter); + public native int quant_type(); public native CUVIDMPEG4PICPARAMS quant_type(int setter); + public native int quarter_sample(); public native CUVIDMPEG4PICPARAMS quarter_sample(int setter); + public native int short_video_header(); public native CUVIDMPEG4PICPARAMS short_video_header(int setter); + public native int divx_flags(); public native CUVIDMPEG4PICPARAMS divx_flags(int setter); + // VOP + public native int vop_coding_type(); public native CUVIDMPEG4PICPARAMS vop_coding_type(int setter); + public native int vop_coded(); public native CUVIDMPEG4PICPARAMS vop_coded(int setter); + public native int vop_rounding_type(); public native CUVIDMPEG4PICPARAMS vop_rounding_type(int setter); + public native int alternate_vertical_scan_flag(); public native CUVIDMPEG4PICPARAMS alternate_vertical_scan_flag(int setter); + public native int interlaced(); public native CUVIDMPEG4PICPARAMS interlaced(int setter); + public native int vop_fcode_forward(); public native CUVIDMPEG4PICPARAMS vop_fcode_forward(int setter); + public native int vop_fcode_backward(); public native CUVIDMPEG4PICPARAMS vop_fcode_backward(int setter); + public native int trd(int i); public native CUVIDMPEG4PICPARAMS trd(int i, int setter); + @MemberGetter public native IntPointer trd(); + public native int trb(int i); public native CUVIDMPEG4PICPARAMS trb(int i, int setter); + @MemberGetter public native IntPointer trb(); + // Quantization matrices (raster order) + public native @Cast("unsigned char") byte QuantMatrixIntra(int i); public native CUVIDMPEG4PICPARAMS QuantMatrixIntra(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer QuantMatrixIntra(); + public native @Cast("unsigned char") byte QuantMatrixInter(int i); public native CUVIDMPEG4PICPARAMS QuantMatrixInter(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer QuantMatrixInter(); + public native int gmc_enabled(); public native CUVIDMPEG4PICPARAMS gmc_enabled(int setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDOPERATINGPOINTINFO.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDOPERATINGPOINTINFO.java new file mode 100644 index 00000000000..0729aa8e543 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDOPERATINGPOINTINFO.java @@ -0,0 +1,47 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/****************************************************************/ +/** \ingroup STRUCTS +/** \struct CUVIDOPERATINGPOINTINFO +/** Operating point information of scalable bitstream +/****************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDOPERATINGPOINTINFO extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDOPERATINGPOINTINFO() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDOPERATINGPOINTINFO(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDOPERATINGPOINTINFO(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDOPERATINGPOINTINFO position(long position) { + return (CUVIDOPERATINGPOINTINFO)super.position(position); + } + @Override public CUVIDOPERATINGPOINTINFO getPointer(long i) { + return new CUVIDOPERATINGPOINTINFO((Pointer)this).position(position + i); + } + + public native @Cast("cudaVideoCodec") int codec(); public native CUVIDOPERATINGPOINTINFO codec(int setter); + @Name("av1.operating_points_cnt") public native @Cast("unsigned char") byte av1_operating_points_cnt(); public native CUVIDOPERATINGPOINTINFO av1_operating_points_cnt(byte setter); + @Name("av1.reserved24_bits") public native @Cast("unsigned char") byte av1_reserved24_bits(int i); public native CUVIDOPERATINGPOINTINFO av1_reserved24_bits(int i, byte setter); + @Name("av1.reserved24_bits") @MemberGetter public native @Cast("unsigned char*") BytePointer av1_reserved24_bits(); + @Name("av1.operating_points_idc") public native @Cast("unsigned short") short av1_operating_points_idc(int i); public native CUVIDOPERATINGPOINTINFO av1_operating_points_idc(int i, short setter); + @Name("av1.operating_points_idc") @MemberGetter public native @Cast("unsigned short*") ShortPointer av1_operating_points_idc(); + public native @Cast("unsigned char") byte CodecReserved(int i); public native CUVIDOPERATINGPOINTINFO CodecReserved(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer CodecReserved(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPARSERDISPINFO.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPARSERDISPINFO.java new file mode 100644 index 00000000000..71b76f5e4d3 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPARSERDISPINFO.java @@ -0,0 +1,51 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +// #endif +/**********************************************************************************/ +/** \ingroup STRUCTS +/** \struct CUVIDPARSERDISPINFO +/** Used in cuvidParseVideoData API with PFNVIDDISPLAYCALLBACK pfnDisplayPicture +/**********************************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDPARSERDISPINFO extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDPARSERDISPINFO() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDPARSERDISPINFO(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDPARSERDISPINFO(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDPARSERDISPINFO position(long position) { + return (CUVIDPARSERDISPINFO)super.position(position); + } + @Override public CUVIDPARSERDISPINFO getPointer(long i) { + return new CUVIDPARSERDISPINFO((Pointer)this).position(position + i); + } + + /** OUT: Index of the current picture */ + public native int picture_index(); public native CUVIDPARSERDISPINFO picture_index(int setter); + /** OUT: 1 if progressive frame; 0 otherwise */ + public native int progressive_frame(); public native CUVIDPARSERDISPINFO progressive_frame(int setter); + /** OUT: 1 if top field is displayed first; 0 otherwise */ + public native int top_field_first(); public native CUVIDPARSERDISPINFO top_field_first(int setter); + /** OUT: Number of additional fields (1=ivtc, 2=frame doubling, 4=frame tripling, + -1=unpaired field) */ + public native int repeat_first_field(); public native CUVIDPARSERDISPINFO repeat_first_field(int setter); + /** OUT: Presentation time stamp */ + public native @Cast("CUvideotimestamp") long timestamp(); public native CUVIDPARSERDISPINFO timestamp(long setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPARSERPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPARSERPARAMS.java new file mode 100644 index 00000000000..1b5ab7e373b --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPARSERPARAMS.java @@ -0,0 +1,74 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/**************************************/ +/** \ingroup STRUCTS +/** \struct CUVIDPARSERPARAMS +/** Used in cuvidCreateVideoParser API +/**************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDPARSERPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDPARSERPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDPARSERPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDPARSERPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDPARSERPARAMS position(long position) { + return (CUVIDPARSERPARAMS)super.position(position); + } + @Override public CUVIDPARSERPARAMS getPointer(long i) { + return new CUVIDPARSERPARAMS((Pointer)this).position(position + i); + } + + /** IN: cudaVideoCodec_XXX */ + public native @Cast("cudaVideoCodec") int CodecType(); public native CUVIDPARSERPARAMS CodecType(int setter); + /** IN: Max # of decode surfaces (parser will cycle through these) */ + public native @Cast("unsigned int") int ulMaxNumDecodeSurfaces(); public native CUVIDPARSERPARAMS ulMaxNumDecodeSurfaces(int setter); + /** IN: Timestamp units in Hz (0=default=10000000Hz) */ + public native @Cast("unsigned int") int ulClockRate(); public native CUVIDPARSERPARAMS ulClockRate(int setter); + /** IN: % Error threshold (0-100) for calling pfnDecodePicture (100=always + IN: call pfnDecodePicture even if picture bitstream is fully corrupted) */ + public native @Cast("unsigned int") int ulErrorThreshold(); public native CUVIDPARSERPARAMS ulErrorThreshold(int setter); + /** IN: Max display queue delay (improves pipelining of decode with display) + 0=no delay (recommended values: 2..4) */ + public native @Cast("unsigned int") int ulMaxDisplayDelay(); public native CUVIDPARSERPARAMS ulMaxDisplayDelay(int setter); + /** IN: AV1 annexB stream */ + public native @Cast("unsigned int") @NoOffset int bAnnexb(); public native CUVIDPARSERPARAMS bAnnexb(int setter); + /** Reserved for future use - set to zero */ + public native @Cast("unsigned int") @NoOffset int uReserved(); public native CUVIDPARSERPARAMS uReserved(int setter); + /** IN: Reserved for future use - set to 0 */ + public native @Cast("unsigned int") int uReserved1(int i); public native CUVIDPARSERPARAMS uReserved1(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer uReserved1(); + /** IN: User data for callbacks */ + public native Pointer pUserData(); public native CUVIDPARSERPARAMS pUserData(Pointer setter); + /** IN: Called before decoding frames and/or whenever there is a fmt change */ + public native PFNVIDSEQUENCECALLBACK pfnSequenceCallback(); public native CUVIDPARSERPARAMS pfnSequenceCallback(PFNVIDSEQUENCECALLBACK setter); + /** IN: Called when a picture is ready to be decoded (decode order) */ + public native PFNVIDDECODECALLBACK pfnDecodePicture(); public native CUVIDPARSERPARAMS pfnDecodePicture(PFNVIDDECODECALLBACK setter); + /** IN: Called whenever a picture is ready to be displayed (display order) */ + public native PFNVIDDISPLAYCALLBACK pfnDisplayPicture(); public native CUVIDPARSERPARAMS pfnDisplayPicture(PFNVIDDISPLAYCALLBACK setter); + /** IN: Called from AV1 sequence header to get operating point of a AV1 + scalable bitstream */ + public native PFNVIDOPPOINTCALLBACK pfnGetOperatingPoint(); public native CUVIDPARSERPARAMS pfnGetOperatingPoint(PFNVIDOPPOINTCALLBACK setter); + /** Reserved for future use - set to NULL */ + public native Pointer pvReserved2(int i); public native CUVIDPARSERPARAMS pvReserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer pvReserved2(); + /** IN: [Optional] sequence header data from system layer */ + public native CUVIDEOFORMATEX pExtVideoInfo(); public native CUVIDPARSERPARAMS pExtVideoInfo(CUVIDEOFORMATEX setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPICPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPICPARAMS.java new file mode 100644 index 00000000000..c27722fa280 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPICPARAMS.java @@ -0,0 +1,82 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/******************************************************************************************/ +/** \struct CUVIDPICPARAMS +/** Picture parameters for decoding +/** This structure is used in cuvidDecodePicture API +/** IN for cuvidDecodePicture +/******************************************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDPICPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDPICPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDPICPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDPICPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDPICPARAMS position(long position) { + return (CUVIDPICPARAMS)super.position(position); + } + @Override public CUVIDPICPARAMS getPointer(long i) { + return new CUVIDPICPARAMS((Pointer)this).position(position + i); + } + + /** IN: Coded frame size in macroblocks */ + public native int PicWidthInMbs(); public native CUVIDPICPARAMS PicWidthInMbs(int setter); + /** IN: Coded frame height in macroblocks */ + public native int FrameHeightInMbs(); public native CUVIDPICPARAMS FrameHeightInMbs(int setter); + /** IN: Output index of the current picture */ + public native int CurrPicIdx(); public native CUVIDPICPARAMS CurrPicIdx(int setter); + /** IN: 0=frame picture, 1=field picture */ + public native int field_pic_flag(); public native CUVIDPICPARAMS field_pic_flag(int setter); + /** IN: 0=top field, 1=bottom field (ignored if field_pic_flag=0) */ + public native int bottom_field_flag(); public native CUVIDPICPARAMS bottom_field_flag(int setter); + /** IN: Second field of a complementary field pair */ + public native int second_field(); public native CUVIDPICPARAMS second_field(int setter); + // Bitstream data + /** IN: Number of bytes in bitstream data buffer */ + public native @Cast("unsigned int") int nBitstreamDataLen(); public native CUVIDPICPARAMS nBitstreamDataLen(int setter); + /** IN: Ptr to bitstream data for this picture (slice-layer) */ + public native @Cast("const unsigned char*") BytePointer pBitstreamData(); public native CUVIDPICPARAMS pBitstreamData(BytePointer setter); + /** IN: Number of slices in this picture */ + public native @Cast("unsigned int") int nNumSlices(); public native CUVIDPICPARAMS nNumSlices(int setter); + /** IN: nNumSlices entries, contains offset of each slice within + the bitstream data buffer */ + public native @Cast("const unsigned int*") IntPointer pSliceDataOffsets(); public native CUVIDPICPARAMS pSliceDataOffsets(IntPointer setter); + /** IN: This picture is a reference picture */ + public native int ref_pic_flag(); public native CUVIDPICPARAMS ref_pic_flag(int setter); + /** IN: This picture is entirely intra coded */ + public native int intra_pic_flag(); public native CUVIDPICPARAMS intra_pic_flag(int setter); + /** Reserved for future use */ + public native @Cast("unsigned int") int Reserved(int i); public native CUVIDPICPARAMS Reserved(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer Reserved(); + // IN: Codec-specific data + /** Also used for MPEG-1 */ + @Name("CodecSpecific.mpeg2") public native @ByRef CUVIDMPEG2PICPARAMS CodecSpecific_mpeg2(); public native CUVIDPICPARAMS CodecSpecific_mpeg2(CUVIDMPEG2PICPARAMS setter); + @Name("CodecSpecific.h264") public native @ByRef CUVIDH264PICPARAMS CodecSpecific_h264(); public native CUVIDPICPARAMS CodecSpecific_h264(CUVIDH264PICPARAMS setter); + @Name("CodecSpecific.vc1") public native @ByRef CUVIDVC1PICPARAMS CodecSpecific_vc1(); public native CUVIDPICPARAMS CodecSpecific_vc1(CUVIDVC1PICPARAMS setter); + @Name("CodecSpecific.mpeg4") public native @ByRef CUVIDMPEG4PICPARAMS CodecSpecific_mpeg4(); public native CUVIDPICPARAMS CodecSpecific_mpeg4(CUVIDMPEG4PICPARAMS setter); + @Name("CodecSpecific.jpeg") public native @ByRef CUVIDJPEGPICPARAMS CodecSpecific_jpeg(); public native CUVIDPICPARAMS CodecSpecific_jpeg(CUVIDJPEGPICPARAMS setter); + @Name("CodecSpecific.hevc") public native @ByRef CUVIDHEVCPICPARAMS CodecSpecific_hevc(); public native CUVIDPICPARAMS CodecSpecific_hevc(CUVIDHEVCPICPARAMS setter); + @Name("CodecSpecific.vp8") public native @ByRef CUVIDVP8PICPARAMS CodecSpecific_vp8(); public native CUVIDPICPARAMS CodecSpecific_vp8(CUVIDVP8PICPARAMS setter); + @Name("CodecSpecific.vp9") public native @ByRef CUVIDVP9PICPARAMS CodecSpecific_vp9(); public native CUVIDPICPARAMS CodecSpecific_vp9(CUVIDVP9PICPARAMS setter); + @Name("CodecSpecific.av1") public native @ByRef CUVIDAV1PICPARAMS CodecSpecific_av1(); public native CUVIDPICPARAMS CodecSpecific_av1(CUVIDAV1PICPARAMS setter); + @Name("CodecSpecific.CodecReserved") public native @Cast("unsigned int") int CodecSpecific_CodecReserved(int i); public native CUVIDPICPARAMS CodecSpecific_CodecReserved(int i, int setter); + @Name("CodecSpecific.CodecReserved") @MemberGetter public native @Cast("unsigned int*") IntPointer CodecSpecific_CodecReserved(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPROCPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPROCPARAMS.java new file mode 100644 index 00000000000..b1509d2c5b6 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDPROCPARAMS.java @@ -0,0 +1,75 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + + +/******************************************************/ +/** \struct CUVIDPROCPARAMS +/** Picture parameters for postprocessing +/** This structure is used in cuvidMapVideoFrame API +/******************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDPROCPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDPROCPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDPROCPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDPROCPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDPROCPARAMS position(long position) { + return (CUVIDPROCPARAMS)super.position(position); + } + @Override public CUVIDPROCPARAMS getPointer(long i) { + return new CUVIDPROCPARAMS((Pointer)this).position(position + i); + } + + /** IN: Input is progressive (deinterlace_mode will be ignored) */ + public native int progressive_frame(); public native CUVIDPROCPARAMS progressive_frame(int setter); + /** IN: Output the second field (ignored if deinterlace mode is Weave) */ + public native int second_field(); public native CUVIDPROCPARAMS second_field(int setter); + /** IN: Input frame is top field first (1st field is top, 2nd field is bottom) */ + public native int top_field_first(); public native CUVIDPROCPARAMS top_field_first(int setter); + /** IN: Input only contains one field (2nd field is invalid) */ + public native int unpaired_field(); public native CUVIDPROCPARAMS unpaired_field(int setter); + // The fields below are used for raw YUV input + /** Reserved for future use (set to zero) */ + public native @Cast("unsigned int") int reserved_flags(); public native CUVIDPROCPARAMS reserved_flags(int setter); + /** Reserved (set to zero) */ + public native @Cast("unsigned int") int reserved_zero(); public native CUVIDPROCPARAMS reserved_zero(int setter); + /** IN: Input CUdeviceptr for raw YUV extensions */ + public native @Cast("unsigned long long") long raw_input_dptr(); public native CUVIDPROCPARAMS raw_input_dptr(long setter); + /** IN: pitch in bytes of raw YUV input (should be aligned appropriately) */ + public native @Cast("unsigned int") int raw_input_pitch(); public native CUVIDPROCPARAMS raw_input_pitch(int setter); + /** IN: Input YUV format (cudaVideoCodec_enum) */ + public native @Cast("unsigned int") int raw_input_format(); public native CUVIDPROCPARAMS raw_input_format(int setter); + /** IN: Output CUdeviceptr for raw YUV extensions */ + public native @Cast("unsigned long long") long raw_output_dptr(); public native CUVIDPROCPARAMS raw_output_dptr(long setter); + /** IN: pitch in bytes of raw YUV output (should be aligned appropriately) */ + public native @Cast("unsigned int") int raw_output_pitch(); public native CUVIDPROCPARAMS raw_output_pitch(int setter); + /** Reserved for future use (set to zero) */ + public native @Cast("unsigned int") int Reserved1(); public native CUVIDPROCPARAMS Reserved1(int setter); + /** IN: stream object used by cuvidMapVideoFrame */ + public native CUstream_st output_stream(); public native CUVIDPROCPARAMS output_stream(CUstream_st setter); + /** Reserved for future use (set to zero) */ + public native @Cast("unsigned int") int Reserved(int i); public native CUVIDPROCPARAMS Reserved(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer Reserved(); + /** OUT: Output CUdeviceptr for histogram extensions */ + public native @Cast("unsigned long long*") LongPointer histogram_dptr(); public native CUVIDPROCPARAMS histogram_dptr(LongPointer setter); + /** Reserved for future use (set to zero) */ + public native Pointer Reserved2(int i); public native CUVIDPROCPARAMS Reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer Reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDRECONFIGUREDECODERINFO.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDRECONFIGUREDECODERINFO.java new file mode 100644 index 00000000000..d2c9ee1357b --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDRECONFIGUREDECODERINFO.java @@ -0,0 +1,69 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/****************************************************/ +/** \struct CUVIDRECONFIGUREDECODERINFO +/** Struct for decoder reset +/** This structure is used in cuvidReconfigureDecoder() API +/****************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDRECONFIGUREDECODERINFO extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDRECONFIGUREDECODERINFO() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDRECONFIGUREDECODERINFO(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDRECONFIGUREDECODERINFO(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDRECONFIGUREDECODERINFO position(long position) { + return (CUVIDRECONFIGUREDECODERINFO)super.position(position); + } + @Override public CUVIDRECONFIGUREDECODERINFO getPointer(long i) { + return new CUVIDRECONFIGUREDECODERINFO((Pointer)this).position(position + i); + } + + /** IN: Coded sequence width in pixels, MUST be < = ulMaxWidth defined at CUVIDDECODECREATEINFO */ + public native @Cast("unsigned int") int ulWidth(); public native CUVIDRECONFIGUREDECODERINFO ulWidth(int setter); + /** IN: Coded sequence height in pixels, MUST be < = ulMaxHeight defined at CUVIDDECODECREATEINFO */ + public native @Cast("unsigned int") int ulHeight(); public native CUVIDRECONFIGUREDECODERINFO ulHeight(int setter); + /** IN: Post processed output width */ + public native @Cast("unsigned int") int ulTargetWidth(); public native CUVIDRECONFIGUREDECODERINFO ulTargetWidth(int setter); + /** IN: Post Processed output height */ + public native @Cast("unsigned int") int ulTargetHeight(); public native CUVIDRECONFIGUREDECODERINFO ulTargetHeight(int setter); + /** IN: Maximum number of internal decode surfaces */ + public native @Cast("unsigned int") int ulNumDecodeSurfaces(); public native CUVIDRECONFIGUREDECODERINFO ulNumDecodeSurfaces(int setter); + /** Reserved for future use. Set to Zero */ + public native @Cast("unsigned int") int reserved1(int i); public native CUVIDRECONFIGUREDECODERINFO reserved1(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer reserved1(); + /** + * IN: Area of frame to be displayed. Use-case : Source Cropping + */ + @Name("display_area.left") public native short display_area_left(); public native CUVIDRECONFIGUREDECODERINFO display_area_left(short setter); + @Name("display_area.top") public native short display_area_top(); public native CUVIDRECONFIGUREDECODERINFO display_area_top(short setter); + @Name("display_area.right") public native short display_area_right(); public native CUVIDRECONFIGUREDECODERINFO display_area_right(short setter); + @Name("display_area.bottom") public native short display_area_bottom(); public native CUVIDRECONFIGUREDECODERINFO display_area_bottom(short setter); + /** + * IN: Target Rectangle in the OutputFrame. Use-case : Aspect ratio Conversion + */ + @Name("target_rect.left") public native short target_rect_left(); public native CUVIDRECONFIGUREDECODERINFO target_rect_left(short setter); + @Name("target_rect.top") public native short target_rect_top(); public native CUVIDRECONFIGUREDECODERINFO target_rect_top(short setter); + @Name("target_rect.right") public native short target_rect_right(); public native CUVIDRECONFIGUREDECODERINFO target_rect_right(short setter); + @Name("target_rect.bottom") public native short target_rect_bottom(); public native CUVIDRECONFIGUREDECODERINFO target_rect_bottom(short setter); + /** Reserved for future use. Set to Zero */ + public native @Cast("unsigned int") int reserved2(int i); public native CUVIDRECONFIGUREDECODERINFO reserved2(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDSOURCEDATAPACKET.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDSOURCEDATAPACKET.java new file mode 100644 index 00000000000..2ebf88bbeb0 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDSOURCEDATAPACKET.java @@ -0,0 +1,50 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/*****************************************************************************/ +/** \ingroup STRUCTS +/** \struct CUVIDSOURCEDATAPACKET +/** Data Packet +/** Used in cuvidParseVideoData API +/** IN for cuvidParseVideoData +/*****************************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDSOURCEDATAPACKET extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDSOURCEDATAPACKET() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDSOURCEDATAPACKET(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDSOURCEDATAPACKET(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDSOURCEDATAPACKET position(long position) { + return (CUVIDSOURCEDATAPACKET)super.position(position); + } + @Override public CUVIDSOURCEDATAPACKET getPointer(long i) { + return new CUVIDSOURCEDATAPACKET((Pointer)this).position(position + i); + } + + /** IN: Combination of CUVID_PKT_XXX flags */ + public native @Cast("unsigned long") long flags(); public native CUVIDSOURCEDATAPACKET flags(long setter); + /** IN: number of bytes in the payload (may be zero if EOS flag is set) */ + public native @Cast("unsigned long") long payload_size(); public native CUVIDSOURCEDATAPACKET payload_size(long setter); + /** IN: Pointer to packet payload data (may be NULL if EOS flag is set) */ + public native @Cast("const unsigned char*") BytePointer payload(); public native CUVIDSOURCEDATAPACKET payload(BytePointer setter); + /** IN: Presentation time stamp (10MHz clock), only valid if + CUVID_PKT_TIMESTAMP flag is set */ + public native @Cast("CUvideotimestamp") long timestamp(); public native CUVIDSOURCEDATAPACKET timestamp(long setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDSOURCEPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDSOURCEPARAMS.java new file mode 100644 index 00000000000..ec1d48548e0 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDSOURCEPARAMS.java @@ -0,0 +1,59 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/**************************************************************************************************************************/ +/** \ingroup STRUCTS +/** \struct CUVIDSOURCEPARAMS +/** Describes parameters needed in cuvidCreateVideoSource API +/** NVDECODE API is intended for HW accelerated video decoding so CUvideosource doesn't have audio demuxer for all supported +/** containers. It's recommended to clients to use their own or third party demuxer if audio support is needed. +/**************************************************************************************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDSOURCEPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDSOURCEPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDSOURCEPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDSOURCEPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDSOURCEPARAMS position(long position) { + return (CUVIDSOURCEPARAMS)super.position(position); + } + @Override public CUVIDSOURCEPARAMS getPointer(long i) { + return new CUVIDSOURCEPARAMS((Pointer)this).position(position + i); + } + + /** IN: Time stamp units in Hz (0=default=10000000Hz) */ + public native @Cast("unsigned int") int ulClockRate(); public native CUVIDSOURCEPARAMS ulClockRate(int setter); + /** IN: AV1 annexB stream */ + public native @Cast("unsigned int") @NoOffset int bAnnexb(); public native CUVIDSOURCEPARAMS bAnnexb(int setter); + /** Reserved for future use - set to zero */ + public native @Cast("unsigned int") @NoOffset int uReserved(); public native CUVIDSOURCEPARAMS uReserved(int setter); + /** Reserved for future use - set to zero */ + public native @Cast("unsigned int") int uReserved1(int i); public native CUVIDSOURCEPARAMS uReserved1(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer uReserved1(); + /** IN: User private data passed in to the data handlers */ + public native Pointer pUserData(); public native CUVIDSOURCEPARAMS pUserData(Pointer setter); + /** IN: Called to deliver video packets */ + public native PFNVIDSOURCECALLBACK pfnVideoDataHandler(); public native CUVIDSOURCEPARAMS pfnVideoDataHandler(PFNVIDSOURCECALLBACK setter); + /** IN: Called to deliver audio packets. */ + public native PFNVIDSOURCECALLBACK pfnAudioDataHandler(); public native CUVIDSOURCEPARAMS pfnAudioDataHandler(PFNVIDSOURCECALLBACK setter); + /** Reserved for future use - set to NULL */ + public native Pointer pvReserved2(int i); public native CUVIDSOURCEPARAMS pvReserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer pvReserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVC1PICPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVC1PICPARAMS.java new file mode 100644 index 00000000000..61a0c8c8a22 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVC1PICPARAMS.java @@ -0,0 +1,82 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/********************************************************/ +/** \struct CUVIDVC1PICPARAMS +/** VC1 picture parameters +/** This structure is used in CUVIDPICPARAMS structure +/********************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDVC1PICPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDVC1PICPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDVC1PICPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDVC1PICPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDVC1PICPARAMS position(long position) { + return (CUVIDVC1PICPARAMS)super.position(position); + } + @Override public CUVIDVC1PICPARAMS getPointer(long i) { + return new CUVIDVC1PICPARAMS((Pointer)this).position(position + i); + } + + /** Picture index of forward reference (P/B-frames) */ + public native int ForwardRefIdx(); public native CUVIDVC1PICPARAMS ForwardRefIdx(int setter); + /** Picture index of backward reference (B-frames) */ + public native int BackwardRefIdx(); public native CUVIDVC1PICPARAMS BackwardRefIdx(int setter); + /** Actual frame width */ + public native int FrameWidth(); public native CUVIDVC1PICPARAMS FrameWidth(int setter); + /** Actual frame height */ + public native int FrameHeight(); public native CUVIDVC1PICPARAMS FrameHeight(int setter); + // PICTURE + /** Set to 1 for I,BI frames */ + public native int intra_pic_flag(); public native CUVIDVC1PICPARAMS intra_pic_flag(int setter); + /** Set to 1 for I,P frames */ + public native int ref_pic_flag(); public native CUVIDVC1PICPARAMS ref_pic_flag(int setter); + /** Progressive frame */ + public native int progressive_fcm(); public native CUVIDVC1PICPARAMS progressive_fcm(int setter); + // SEQUENCE + public native int profile(); public native CUVIDVC1PICPARAMS profile(int setter); + public native int postprocflag(); public native CUVIDVC1PICPARAMS postprocflag(int setter); + public native int pulldown(); public native CUVIDVC1PICPARAMS pulldown(int setter); + public native int interlace(); public native CUVIDVC1PICPARAMS interlace(int setter); + public native int tfcntrflag(); public native CUVIDVC1PICPARAMS tfcntrflag(int setter); + public native int finterpflag(); public native CUVIDVC1PICPARAMS finterpflag(int setter); + public native int psf(); public native CUVIDVC1PICPARAMS psf(int setter); + public native int multires(); public native CUVIDVC1PICPARAMS multires(int setter); + public native int syncmarker(); public native CUVIDVC1PICPARAMS syncmarker(int setter); + public native int rangered(); public native CUVIDVC1PICPARAMS rangered(int setter); + public native int maxbframes(); public native CUVIDVC1PICPARAMS maxbframes(int setter); + // ENTRYPOINT + public native int panscan_flag(); public native CUVIDVC1PICPARAMS panscan_flag(int setter); + public native int refdist_flag(); public native CUVIDVC1PICPARAMS refdist_flag(int setter); + public native int extended_mv(); public native CUVIDVC1PICPARAMS extended_mv(int setter); + public native int dquant(); public native CUVIDVC1PICPARAMS dquant(int setter); + public native int vstransform(); public native CUVIDVC1PICPARAMS vstransform(int setter); + public native int loopfilter(); public native CUVIDVC1PICPARAMS loopfilter(int setter); + public native int fastuvmc(); public native CUVIDVC1PICPARAMS fastuvmc(int setter); + public native int overlap(); public native CUVIDVC1PICPARAMS overlap(int setter); + public native int quantizer(); public native CUVIDVC1PICPARAMS quantizer(int setter); + public native int extended_dmv(); public native CUVIDVC1PICPARAMS extended_dmv(int setter); + public native int range_mapy_flag(); public native CUVIDVC1PICPARAMS range_mapy_flag(int setter); + public native int range_mapy(); public native CUVIDVC1PICPARAMS range_mapy(int setter); + public native int range_mapuv_flag(); public native CUVIDVC1PICPARAMS range_mapuv_flag(int setter); + public native int range_mapuv(); public native CUVIDVC1PICPARAMS range_mapuv(int setter); + public native int rangeredfrm(); public native CUVIDVC1PICPARAMS rangeredfrm(int setter); // range reduction state +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVP8PICPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVP8PICPARAMS.java new file mode 100644 index 00000000000..269034867a4 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVP8PICPARAMS.java @@ -0,0 +1,59 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + + +/***********************************************************/ +/** \struct CUVIDVP8PICPARAMS +/** VP8 picture parameters +/** This structure is used in CUVIDPICPARAMS structure +/***********************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDVP8PICPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDVP8PICPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDVP8PICPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDVP8PICPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDVP8PICPARAMS position(long position) { + return (CUVIDVP8PICPARAMS)super.position(position); + } + @Override public CUVIDVP8PICPARAMS getPointer(long i) { + return new CUVIDVP8PICPARAMS((Pointer)this).position(position + i); + } + + public native int width(); public native CUVIDVP8PICPARAMS width(int setter); + public native int height(); public native CUVIDVP8PICPARAMS height(int setter); + public native @Cast("unsigned int") int first_partition_size(); public native CUVIDVP8PICPARAMS first_partition_size(int setter); + //Frame Indexes + public native @Cast("unsigned char") byte LastRefIdx(); public native CUVIDVP8PICPARAMS LastRefIdx(byte setter); + public native @Cast("unsigned char") byte GoldenRefIdx(); public native CUVIDVP8PICPARAMS GoldenRefIdx(byte setter); + public native @Cast("unsigned char") byte AltRefIdx(); public native CUVIDVP8PICPARAMS AltRefIdx(byte setter); + /** 0 = KEYFRAME, 1 = INTERFRAME */ + @Name("vp8_frame_tag.frame_type") public native @Cast("unsigned char") @NoOffset byte vp8_frame_tag_frame_type(); public native CUVIDVP8PICPARAMS vp8_frame_tag_frame_type(byte setter); + @Name("vp8_frame_tag.version") public native @Cast("unsigned char") @NoOffset byte vp8_frame_tag_version(); public native CUVIDVP8PICPARAMS vp8_frame_tag_version(byte setter); + @Name("vp8_frame_tag.show_frame") public native @Cast("unsigned char") @NoOffset byte vp8_frame_tag_show_frame(); public native CUVIDVP8PICPARAMS vp8_frame_tag_show_frame(byte setter); + /** Must be 0 if segmentation is not enabled */ + @Name("vp8_frame_tag.update_mb_segmentation_data") public native @Cast("unsigned char") @NoOffset byte vp8_frame_tag_update_mb_segmentation_data(); public native CUVIDVP8PICPARAMS vp8_frame_tag_update_mb_segmentation_data(byte setter); + @Name("vp8_frame_tag.Reserved2Bits") public native @Cast("unsigned char") @NoOffset byte vp8_frame_tag_Reserved2Bits(); public native CUVIDVP8PICPARAMS vp8_frame_tag_Reserved2Bits(byte setter); + public native @Cast("unsigned char") byte wFrameTagFlags(); public native CUVIDVP8PICPARAMS wFrameTagFlags(byte setter); + public native @Cast("unsigned char") byte Reserved1(int i); public native CUVIDVP8PICPARAMS Reserved1(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer Reserved1(); + public native @Cast("unsigned int") int Reserved2(int i); public native CUVIDVP8PICPARAMS Reserved2(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer Reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVP9PICPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVP9PICPARAMS.java new file mode 100644 index 00000000000..4419e8a5e3e --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUVIDVP9PICPARAMS.java @@ -0,0 +1,111 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/***********************************************************/ +/** \struct CUVIDVP9PICPARAMS +/** VP9 picture parameters +/** This structure is used in CUVIDPICPARAMS structure +/***********************************************************/ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUVIDVP9PICPARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public CUVIDVP9PICPARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public CUVIDVP9PICPARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUVIDVP9PICPARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public CUVIDVP9PICPARAMS position(long position) { + return (CUVIDVP9PICPARAMS)super.position(position); + } + @Override public CUVIDVP9PICPARAMS getPointer(long i) { + return new CUVIDVP9PICPARAMS((Pointer)this).position(position + i); + } + + public native @Cast("unsigned int") int width(); public native CUVIDVP9PICPARAMS width(int setter); + public native @Cast("unsigned int") int height(); public native CUVIDVP9PICPARAMS height(int setter); + + //Frame Indices + public native @Cast("unsigned char") byte LastRefIdx(); public native CUVIDVP9PICPARAMS LastRefIdx(byte setter); + public native @Cast("unsigned char") byte GoldenRefIdx(); public native CUVIDVP9PICPARAMS GoldenRefIdx(byte setter); + public native @Cast("unsigned char") byte AltRefIdx(); public native CUVIDVP9PICPARAMS AltRefIdx(byte setter); + public native @Cast("unsigned char") byte colorSpace(); public native CUVIDVP9PICPARAMS colorSpace(byte setter); + + public native @Cast("unsigned short") @NoOffset short profile(); public native CUVIDVP9PICPARAMS profile(short setter); + public native @Cast("unsigned short") @NoOffset short frameContextIdx(); public native CUVIDVP9PICPARAMS frameContextIdx(short setter); + public native @Cast("unsigned short") @NoOffset short frameType(); public native CUVIDVP9PICPARAMS frameType(short setter); + public native @Cast("unsigned short") @NoOffset short showFrame(); public native CUVIDVP9PICPARAMS showFrame(short setter); + public native @Cast("unsigned short") @NoOffset short errorResilient(); public native CUVIDVP9PICPARAMS errorResilient(short setter); + public native @Cast("unsigned short") @NoOffset short frameParallelDecoding(); public native CUVIDVP9PICPARAMS frameParallelDecoding(short setter); + public native @Cast("unsigned short") @NoOffset short subSamplingX(); public native CUVIDVP9PICPARAMS subSamplingX(short setter); + public native @Cast("unsigned short") @NoOffset short subSamplingY(); public native CUVIDVP9PICPARAMS subSamplingY(short setter); + public native @Cast("unsigned short") @NoOffset short intraOnly(); public native CUVIDVP9PICPARAMS intraOnly(short setter); + public native @Cast("unsigned short") @NoOffset short allow_high_precision_mv(); public native CUVIDVP9PICPARAMS allow_high_precision_mv(short setter); + public native @Cast("unsigned short") @NoOffset short refreshEntropyProbs(); public native CUVIDVP9PICPARAMS refreshEntropyProbs(short setter); + public native @Cast("unsigned short") @NoOffset short reserved2Bits(); public native CUVIDVP9PICPARAMS reserved2Bits(short setter); + + public native @Cast("unsigned short") short reserved16Bits(); public native CUVIDVP9PICPARAMS reserved16Bits(short setter); + + public native @Cast("unsigned char") byte refFrameSignBias(int i); public native CUVIDVP9PICPARAMS refFrameSignBias(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer refFrameSignBias(); + + public native @Cast("unsigned char") byte bitDepthMinus8Luma(); public native CUVIDVP9PICPARAMS bitDepthMinus8Luma(byte setter); + public native @Cast("unsigned char") byte bitDepthMinus8Chroma(); public native CUVIDVP9PICPARAMS bitDepthMinus8Chroma(byte setter); + public native @Cast("unsigned char") byte loopFilterLevel(); public native CUVIDVP9PICPARAMS loopFilterLevel(byte setter); + public native @Cast("unsigned char") byte loopFilterSharpness(); public native CUVIDVP9PICPARAMS loopFilterSharpness(byte setter); + + public native @Cast("unsigned char") byte modeRefLfEnabled(); public native CUVIDVP9PICPARAMS modeRefLfEnabled(byte setter); + public native @Cast("unsigned char") byte log2_tile_columns(); public native CUVIDVP9PICPARAMS log2_tile_columns(byte setter); + public native @Cast("unsigned char") byte log2_tile_rows(); public native CUVIDVP9PICPARAMS log2_tile_rows(byte setter); + + public native @Cast("unsigned char") @NoOffset byte segmentEnabled(); public native CUVIDVP9PICPARAMS segmentEnabled(byte setter); + public native @Cast("unsigned char") @NoOffset byte segmentMapUpdate(); public native CUVIDVP9PICPARAMS segmentMapUpdate(byte setter); + public native @Cast("unsigned char") @NoOffset byte segmentMapTemporalUpdate(); public native CUVIDVP9PICPARAMS segmentMapTemporalUpdate(byte setter); + public native @Cast("unsigned char") @NoOffset byte segmentFeatureMode(); public native CUVIDVP9PICPARAMS segmentFeatureMode(byte setter); + public native @Cast("unsigned char") @NoOffset byte reserved4Bits(); public native CUVIDVP9PICPARAMS reserved4Bits(byte setter); + + + public native @Cast("unsigned char") byte segmentFeatureEnable(int i, int j); public native CUVIDVP9PICPARAMS segmentFeatureEnable(int i, int j, byte setter); + @MemberGetter public native @Cast("unsigned char(* /*[8]*/ )[4]") BytePointer segmentFeatureEnable(); + public native short segmentFeatureData(int i, int j); public native CUVIDVP9PICPARAMS segmentFeatureData(int i, int j, short setter); + @MemberGetter public native @Cast("short(* /*[8]*/ )[4]") ShortPointer segmentFeatureData(); + public native @Cast("unsigned char") byte mb_segment_tree_probs(int i); public native CUVIDVP9PICPARAMS mb_segment_tree_probs(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer mb_segment_tree_probs(); + public native @Cast("unsigned char") byte segment_pred_probs(int i); public native CUVIDVP9PICPARAMS segment_pred_probs(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer segment_pred_probs(); + public native @Cast("unsigned char") byte reservedSegment16Bits(int i); public native CUVIDVP9PICPARAMS reservedSegment16Bits(int i, byte setter); + @MemberGetter public native @Cast("unsigned char*") BytePointer reservedSegment16Bits(); + + public native int qpYAc(); public native CUVIDVP9PICPARAMS qpYAc(int setter); + public native int qpYDc(); public native CUVIDVP9PICPARAMS qpYDc(int setter); + public native int qpChDc(); public native CUVIDVP9PICPARAMS qpChDc(int setter); + public native int qpChAc(); public native CUVIDVP9PICPARAMS qpChAc(int setter); + + public native @Cast("unsigned int") int activeRefIdx(int i); public native CUVIDVP9PICPARAMS activeRefIdx(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer activeRefIdx(); + public native @Cast("unsigned int") int resetFrameContext(); public native CUVIDVP9PICPARAMS resetFrameContext(int setter); + public native @Cast("unsigned int") int mcomp_filter_type(); public native CUVIDVP9PICPARAMS mcomp_filter_type(int setter); + public native @Cast("unsigned int") int mbRefLfDelta(int i); public native CUVIDVP9PICPARAMS mbRefLfDelta(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer mbRefLfDelta(); + public native @Cast("unsigned int") int mbModeLfDelta(int i); public native CUVIDVP9PICPARAMS mbModeLfDelta(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer mbModeLfDelta(); + public native @Cast("unsigned int") int frameTagSize(); public native CUVIDVP9PICPARAMS frameTagSize(int setter); + public native @Cast("unsigned int") int offsetToDctParts(); public native CUVIDVP9PICPARAMS offsetToDctParts(int setter); + public native @Cast("unsigned int") int reserved128Bits(int i); public native CUVIDVP9PICPARAMS reserved128Bits(int i, int setter); + @MemberGetter public native @Cast("unsigned int*") IntPointer reserved128Bits(); + +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideodecoder.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideodecoder.java new file mode 100644 index 00000000000..0baa5b9f921 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideodecoder.java @@ -0,0 +1,23 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +// #endif /* __cplusplus */ + +@Namespace @Name("void") @Opaque @Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUvideodecoder extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public CUvideodecoder() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUvideodecoder(Pointer p) { super(p); } +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideoparser.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideoparser.java new file mode 100644 index 00000000000..46d90065720 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideoparser.java @@ -0,0 +1,21 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +@Namespace @Name("void") @Opaque @Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUvideoparser extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public CUvideoparser() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUvideoparser(Pointer p) { super(p); } +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideosource.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideosource.java new file mode 100644 index 00000000000..aef1ff4b968 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/CUvideosource.java @@ -0,0 +1,30 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +// #endif /* __cplusplus */ + + +/***********************************************/ +/** +/** High-level helper APIs for video sources +/** +/***********************************************/ + +@Namespace @Name("void") @Opaque @Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class CUvideosource extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public CUvideosource() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public CUvideosource(Pointer p) { super(p); } +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDDECODECALLBACK.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDDECODECALLBACK.java new file mode 100644 index 00000000000..a0f473e2b1c --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDDECODECALLBACK.java @@ -0,0 +1,23 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +@Convention("CUDAAPI") @Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class PFNVIDDECODECALLBACK extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PFNVIDDECODECALLBACK(Pointer p) { super(p); } + protected PFNVIDDECODECALLBACK() { allocate(); } + private native void allocate(); + public native int call(Pointer arg0, CUVIDPICPARAMS arg1); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDDISPLAYCALLBACK.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDDISPLAYCALLBACK.java new file mode 100644 index 00000000000..0d9bff79c09 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDDISPLAYCALLBACK.java @@ -0,0 +1,23 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +@Convention("CUDAAPI") @Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class PFNVIDDISPLAYCALLBACK extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PFNVIDDISPLAYCALLBACK(Pointer p) { super(p); } + protected PFNVIDDISPLAYCALLBACK() { allocate(); } + private native void allocate(); + public native int call(Pointer arg0, CUVIDPARSERDISPINFO arg1); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDOPPOINTCALLBACK.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDOPPOINTCALLBACK.java new file mode 100644 index 00000000000..36989fe2d0e --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDOPPOINTCALLBACK.java @@ -0,0 +1,23 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +@Convention("CUDAAPI") @Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class PFNVIDOPPOINTCALLBACK extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PFNVIDOPPOINTCALLBACK(Pointer p) { super(p); } + protected PFNVIDOPPOINTCALLBACK() { allocate(); } + private native void allocate(); + public native int call(Pointer arg0, CUVIDOPERATINGPOINTINFO arg1); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDSEQUENCECALLBACK.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDSEQUENCECALLBACK.java new file mode 100644 index 00000000000..6b207ea6300 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDSEQUENCECALLBACK.java @@ -0,0 +1,38 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +/***********************************************************************************************************************/ +/** Parser callbacks +/** The parser will call these synchronously from within cuvidParseVideoData(), whenever there is sequence change or a picture +/** is ready to be decoded and/or displayed. First argument in functions is "void *pUserData" member of structure CUVIDSOURCEPARAMS +/** Return values from these callbacks are interpreted as below. If the callbacks return failure, it will be propagated by +/** cuvidParseVideoData() to the application. +/** Parser picks default operating point as 0 and outputAllLayers flag as 0 if PFNVIDOPPOINTCALLBACK is not set or return value is +/** -1 or invalid operating point. +/** PFNVIDSEQUENCECALLBACK : 0: fail, 1: succeeded, > 1: override dpb size of parser (set by CUVIDPARSERPARAMS::ulMaxNumDecodeSurfaces +/** while creating parser) +/** PFNVIDDECODECALLBACK : 0: fail, >=1: succeeded +/** PFNVIDDISPLAYCALLBACK : 0: fail, >=1: succeeded +/** PFNVIDOPPOINTCALLBACK : <0: fail, >=0: succeeded (bit 0-9: OperatingPoint, bit 10-10: outputAllLayers, bit 11-30: reserved) +/***********************************************************************************************************************/ +@Convention("CUDAAPI") @Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class PFNVIDSEQUENCECALLBACK extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PFNVIDSEQUENCECALLBACK(Pointer p) { super(p); } + protected PFNVIDSEQUENCECALLBACK() { allocate(); } + private native void allocate(); + public native int call(Pointer arg0, CUVIDEOFORMAT arg1); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDSOURCECALLBACK.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDSOURCECALLBACK.java new file mode 100644 index 00000000000..6754554af02 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/PFNVIDSOURCECALLBACK.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + + +// Callback for packet delivery +@Convention("CUDAAPI") @Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class PFNVIDSOURCECALLBACK extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PFNVIDSOURCECALLBACK(Pointer p) { super(p); } + protected PFNVIDSOURCECALLBACK() { allocate(); } + private native void allocate(); + public native int call(Pointer arg0, CUVIDSOURCEDATAPACKET arg1); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/_CUcontextlock_st.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/_CUcontextlock_st.java new file mode 100644 index 00000000000..cfefedebb5a --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvcuvid/_CUcontextlock_st.java @@ -0,0 +1,21 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvcuvid; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; + +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +@Opaque @Properties(inherit = org.bytedeco.nvcodec.presets.nvcuvid.class) +public class _CUcontextlock_st extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public _CUcontextlock_st() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public _CUcontextlock_st(Pointer p) { super(p); } +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/GUID.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/GUID.java new file mode 100644 index 00000000000..53925ec0725 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/GUID.java @@ -0,0 +1,52 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +// ========================================================================================= +// #if !defined(GUID) && !defined(GUID_DEFINED) +/** + * \struct GUID + * Abstracts the GUID structure for non-windows platforms. + */ +// ========================================================================================= +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class GUID extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public GUID() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public GUID(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public GUID(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public GUID position(long position) { + return (GUID)super.position(position); + } + @Override public GUID getPointer(long i) { + return new GUID((Pointer)this).position(position + i); + } + + /** [in]: Specifies the first 8 hexadecimal digits of the GUID. */ + public native @Cast("uint32_t") int Data1(); public native GUID Data1(int setter); + /** [in]: Specifies the first group of 4 hexadecimal digits. */ + public native @Cast("uint16_t") short Data2(); public native GUID Data2(short setter); + /** [in]: Specifies the second group of 4 hexadecimal digits. */ + public native @Cast("uint16_t") short Data3(); public native GUID Data3(short setter); + /** [in]: Array of 8 bytes. The first 2 bytes contain the third group of 4 hexadecimal digits. + The remaining 6 bytes contain the final 12 hexadecimal digits. */ + public native @Cast("uint8_t") byte Data4(int i); public native GUID Data4(int i, byte setter); + @MemberGetter public native @Cast("uint8_t*") BytePointer Data4(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NVENC_EXTERNAL_ME_HINT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NVENC_EXTERNAL_ME_HINT.java new file mode 100644 index 00000000000..8341d546e00 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NVENC_EXTERNAL_ME_HINT.java @@ -0,0 +1,55 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NVENC_EXTERNAL_ME_HINT + * External Motion Vector hint structure. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NVENC_EXTERNAL_ME_HINT extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NVENC_EXTERNAL_ME_HINT() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NVENC_EXTERNAL_ME_HINT(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NVENC_EXTERNAL_ME_HINT(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NVENC_EXTERNAL_ME_HINT position(long position) { + return (NVENC_EXTERNAL_ME_HINT)super.position(position); + } + @Override public NVENC_EXTERNAL_ME_HINT getPointer(long i) { + return new NVENC_EXTERNAL_ME_HINT((Pointer)this).position(position + i); + } + + /** [in]: Specifies the x component of integer pixel MV (relative to current MB) S12.0. */ + public native @Cast("int32_t") @NoOffset int mvx(); public native NVENC_EXTERNAL_ME_HINT mvx(int setter); + /** [in]: Specifies the y component of integer pixel MV (relative to current MB) S10.0 .*/ + public native @Cast("int32_t") @NoOffset int mvy(); public native NVENC_EXTERNAL_ME_HINT mvy(int setter); + /** [in]: Specifies the reference index (31=invalid). Current we support only 1 reference frame per direction for external hints, so \p refidx must be 0. */ + public native @Cast("int32_t") @NoOffset int refidx(); public native NVENC_EXTERNAL_ME_HINT refidx(int setter); + /** [in]: Specifies the direction of motion estimation . 0=L0 1=L1.*/ + public native @Cast("int32_t") @NoOffset int dir(); public native NVENC_EXTERNAL_ME_HINT dir(int setter); + /** [in]: Specifies the block partition type.0=16x16 1=16x8 2=8x16 3=8x8 (blocks in partition must be consecutive).*/ + public native @Cast("int32_t") @NoOffset int partType(); public native NVENC_EXTERNAL_ME_HINT partType(int setter); + /** [in]: Set to 1 for the last MV of (sub) partition */ + public native @Cast("int32_t") @NoOffset int lastofPart(); public native NVENC_EXTERNAL_ME_HINT lastofPart(int setter); + /** [in]: Set to 1 for the last MV of macroblock. */ + public native @Cast("int32_t") @NoOffset int lastOfMB(); public native NVENC_EXTERNAL_ME_HINT lastOfMB(int setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE.java new file mode 100644 index 00000000000..e8a8926051e --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE.java @@ -0,0 +1,54 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE + * External motion vector hint counts per block type. + * H264 supports multiple hint while HEVC supports one hint for each valid candidate. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE position(long position) { + return (NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE)super.position(position); + } + @Override public NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE getPointer(long i) { + return new NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE((Pointer)this).position(position + i); + } + + /** [in]: Supported for H264, HEVC. It Specifies the number of candidates per 16x16 block. */ + public native @Cast("uint32_t") @NoOffset int numCandsPerBlk16x16(); public native NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE numCandsPerBlk16x16(int setter); + /** [in]: Supported for H264 only. Specifies the number of candidates per 16x8 block. */ + public native @Cast("uint32_t") @NoOffset int numCandsPerBlk16x8(); public native NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE numCandsPerBlk16x8(int setter); + /** [in]: Supported for H264 only. Specifies the number of candidates per 8x16 block. */ + public native @Cast("uint32_t") @NoOffset int numCandsPerBlk8x16(); public native NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE numCandsPerBlk8x16(int setter); + /** [in]: Supported for H264, HEVC. Specifies the number of candidates per 8x8 block. */ + public native @Cast("uint32_t") @NoOffset int numCandsPerBlk8x8(); public native NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE numCandsPerBlk8x8(int setter); + /** [in]: Reserved for padding. */ + public native @Cast("uint32_t") @NoOffset int reserved(); public native NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE reserved(int setter); + /** [in]: Reserved for future use. */ + public native @Cast("uint32_t") int reserved1(int i); public native NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENCODE_API_FUNCTION_LIST.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENCODE_API_FUNCTION_LIST.java new file mode 100644 index 00000000000..db39e47e42c --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENCODE_API_FUNCTION_LIST.java @@ -0,0 +1,134 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** \endcond +

+

+/** \} */ /* END ENCODE_FUNC */ + +/** + * \ingroup ENCODER_STRUCTURE + * NV_ENCODE_API_FUNCTION_LIST + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENCODE_API_FUNCTION_LIST extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENCODE_API_FUNCTION_LIST() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENCODE_API_FUNCTION_LIST(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENCODE_API_FUNCTION_LIST(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENCODE_API_FUNCTION_LIST position(long position) { + return (NV_ENCODE_API_FUNCTION_LIST)super.position(position); + } + @Override public NV_ENCODE_API_FUNCTION_LIST getPointer(long i) { + return new NV_ENCODE_API_FUNCTION_LIST((Pointer)this).position(position + i); + } + + /** [in]: Client should pass NV_ENCODE_API_FUNCTION_LIST_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENCODE_API_FUNCTION_LIST version(int setter); + /** [in]: Reserved and should be set to 0. */ + public native @Cast("uint32_t") int reserved(); public native NV_ENCODE_API_FUNCTION_LIST reserved(int setter); + /** [out]: Client should access ::NvEncOpenEncodeSession() API through this pointer. */ + public native PNVENCOPENENCODESESSION nvEncOpenEncodeSession(); public native NV_ENCODE_API_FUNCTION_LIST nvEncOpenEncodeSession(PNVENCOPENENCODESESSION setter); + /** [out]: Client should access ::NvEncGetEncodeGUIDCount() API through this pointer. */ + public native PNVENCGETENCODEGUIDCOUNT nvEncGetEncodeGUIDCount(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetEncodeGUIDCount(PNVENCGETENCODEGUIDCOUNT setter); + /** [out]: Client should access ::NvEncGetEncodeProfileGUIDCount() API through this pointer.*/ + public native PNVENCGETENCODEPRESETCOUNT nvEncGetEncodeProfileGUIDCount(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetEncodeProfileGUIDCount(PNVENCGETENCODEPRESETCOUNT setter); + /** [out]: Client should access ::NvEncGetEncodeProfileGUIDs() API through this pointer. */ + public native PNVENCGETENCODEPRESETGUIDS nvEncGetEncodeProfileGUIDs(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetEncodeProfileGUIDs(PNVENCGETENCODEPRESETGUIDS setter); + /** [out]: Client should access ::NvEncGetEncodeGUIDs() API through this pointer. */ + public native PNVENCGETENCODEGUIDS nvEncGetEncodeGUIDs(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetEncodeGUIDs(PNVENCGETENCODEGUIDS setter); + /** [out]: Client should access ::NvEncGetInputFormatCount() API through this pointer. */ + public native PNVENCGETINPUTFORMATCOUNT nvEncGetInputFormatCount(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetInputFormatCount(PNVENCGETINPUTFORMATCOUNT setter); + /** [out]: Client should access ::NvEncGetInputFormats() API through this pointer. */ + public native PNVENCGETINPUTFORMATS nvEncGetInputFormats(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetInputFormats(PNVENCGETINPUTFORMATS setter); + /** [out]: Client should access ::NvEncGetEncodeCaps() API through this pointer. */ + public native PNVENCGETENCODECAPS nvEncGetEncodeCaps(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetEncodeCaps(PNVENCGETENCODECAPS setter); + /** [out]: Client should access ::NvEncGetEncodePresetCount() API through this pointer. */ + public native PNVENCGETENCODEPRESETCOUNT nvEncGetEncodePresetCount(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetEncodePresetCount(PNVENCGETENCODEPRESETCOUNT setter); + /** [out]: Client should access ::NvEncGetEncodePresetGUIDs() API through this pointer. */ + public native PNVENCGETENCODEPRESETGUIDS nvEncGetEncodePresetGUIDs(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetEncodePresetGUIDs(PNVENCGETENCODEPRESETGUIDS setter); + /** [out]: Client should access ::NvEncGetEncodePresetConfig() API through this pointer. */ + public native PNVENCGETENCODEPRESETCONFIG nvEncGetEncodePresetConfig(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetEncodePresetConfig(PNVENCGETENCODEPRESETCONFIG setter); + /** [out]: Client should access ::NvEncInitializeEncoder() API through this pointer. */ + public native PNVENCINITIALIZEENCODER nvEncInitializeEncoder(); public native NV_ENCODE_API_FUNCTION_LIST nvEncInitializeEncoder(PNVENCINITIALIZEENCODER setter); + /** [out]: Client should access ::NvEncCreateInputBuffer() API through this pointer. */ + public native PNVENCCREATEINPUTBUFFER nvEncCreateInputBuffer(); public native NV_ENCODE_API_FUNCTION_LIST nvEncCreateInputBuffer(PNVENCCREATEINPUTBUFFER setter); + /** [out]: Client should access ::NvEncDestroyInputBuffer() API through this pointer. */ + public native PNVENCDESTROYINPUTBUFFER nvEncDestroyInputBuffer(); public native NV_ENCODE_API_FUNCTION_LIST nvEncDestroyInputBuffer(PNVENCDESTROYINPUTBUFFER setter); + /** [out]: Client should access ::NvEncCreateBitstreamBuffer() API through this pointer. */ + public native PNVENCCREATEBITSTREAMBUFFER nvEncCreateBitstreamBuffer(); public native NV_ENCODE_API_FUNCTION_LIST nvEncCreateBitstreamBuffer(PNVENCCREATEBITSTREAMBUFFER setter); + /** [out]: Client should access ::NvEncDestroyBitstreamBuffer() API through this pointer. */ + public native PNVENCDESTROYBITSTREAMBUFFER nvEncDestroyBitstreamBuffer(); public native NV_ENCODE_API_FUNCTION_LIST nvEncDestroyBitstreamBuffer(PNVENCDESTROYBITSTREAMBUFFER setter); + /** [out]: Client should access ::NvEncEncodePicture() API through this pointer. */ + public native PNVENCENCODEPICTURE nvEncEncodePicture(); public native NV_ENCODE_API_FUNCTION_LIST nvEncEncodePicture(PNVENCENCODEPICTURE setter); + /** [out]: Client should access ::NvEncLockBitstream() API through this pointer. */ + public native PNVENCLOCKBITSTREAM nvEncLockBitstream(); public native NV_ENCODE_API_FUNCTION_LIST nvEncLockBitstream(PNVENCLOCKBITSTREAM setter); + /** [out]: Client should access ::NvEncUnlockBitstream() API through this pointer. */ + public native PNVENCUNLOCKBITSTREAM nvEncUnlockBitstream(); public native NV_ENCODE_API_FUNCTION_LIST nvEncUnlockBitstream(PNVENCUNLOCKBITSTREAM setter); + /** [out]: Client should access ::NvEncLockInputBuffer() API through this pointer. */ + public native PNVENCLOCKINPUTBUFFER nvEncLockInputBuffer(); public native NV_ENCODE_API_FUNCTION_LIST nvEncLockInputBuffer(PNVENCLOCKINPUTBUFFER setter); + /** [out]: Client should access ::NvEncUnlockInputBuffer() API through this pointer. */ + public native PNVENCUNLOCKINPUTBUFFER nvEncUnlockInputBuffer(); public native NV_ENCODE_API_FUNCTION_LIST nvEncUnlockInputBuffer(PNVENCUNLOCKINPUTBUFFER setter); + /** [out]: Client should access ::NvEncGetEncodeStats() API through this pointer. */ + public native PNVENCGETENCODESTATS nvEncGetEncodeStats(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetEncodeStats(PNVENCGETENCODESTATS setter); + /** [out]: Client should access ::NvEncGetSequenceParams() API through this pointer. */ + public native PNVENCGETSEQUENCEPARAMS nvEncGetSequenceParams(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetSequenceParams(PNVENCGETSEQUENCEPARAMS setter); + /** [out]: Client should access ::NvEncRegisterAsyncEvent() API through this pointer. */ + public native PNVENCREGISTERASYNCEVENT nvEncRegisterAsyncEvent(); public native NV_ENCODE_API_FUNCTION_LIST nvEncRegisterAsyncEvent(PNVENCREGISTERASYNCEVENT setter); + /** [out]: Client should access ::NvEncUnregisterAsyncEvent() API through this pointer. */ + public native PNVENCUNREGISTERASYNCEVENT nvEncUnregisterAsyncEvent(); public native NV_ENCODE_API_FUNCTION_LIST nvEncUnregisterAsyncEvent(PNVENCUNREGISTERASYNCEVENT setter); + /** [out]: Client should access ::NvEncMapInputResource() API through this pointer. */ + public native PNVENCMAPINPUTRESOURCE nvEncMapInputResource(); public native NV_ENCODE_API_FUNCTION_LIST nvEncMapInputResource(PNVENCMAPINPUTRESOURCE setter); + /** [out]: Client should access ::NvEncUnmapInputResource() API through this pointer. */ + public native PNVENCUNMAPINPUTRESOURCE nvEncUnmapInputResource(); public native NV_ENCODE_API_FUNCTION_LIST nvEncUnmapInputResource(PNVENCUNMAPINPUTRESOURCE setter); + /** [out]: Client should access ::NvEncDestroyEncoder() API through this pointer. */ + public native PNVENCDESTROYENCODER nvEncDestroyEncoder(); public native NV_ENCODE_API_FUNCTION_LIST nvEncDestroyEncoder(PNVENCDESTROYENCODER setter); + /** [out]: Client should access ::NvEncInvalidateRefFrames() API through this pointer. */ + public native PNVENCINVALIDATEREFFRAMES nvEncInvalidateRefFrames(); public native NV_ENCODE_API_FUNCTION_LIST nvEncInvalidateRefFrames(PNVENCINVALIDATEREFFRAMES setter); + /** [out]: Client should access ::NvEncOpenEncodeSession() API through this pointer. */ + public native PNVENCOPENENCODESESSIONEX nvEncOpenEncodeSessionEx(); public native NV_ENCODE_API_FUNCTION_LIST nvEncOpenEncodeSessionEx(PNVENCOPENENCODESESSIONEX setter); + /** [out]: Client should access ::NvEncRegisterResource() API through this pointer. */ + public native PNVENCREGISTERRESOURCE nvEncRegisterResource(); public native NV_ENCODE_API_FUNCTION_LIST nvEncRegisterResource(PNVENCREGISTERRESOURCE setter); + /** [out]: Client should access ::NvEncUnregisterResource() API through this pointer. */ + public native PNVENCUNREGISTERRESOURCE nvEncUnregisterResource(); public native NV_ENCODE_API_FUNCTION_LIST nvEncUnregisterResource(PNVENCUNREGISTERRESOURCE setter); + /** [out]: Client should access ::NvEncReconfigureEncoder() API through this pointer. */ + public native PNVENCRECONFIGUREENCODER nvEncReconfigureEncoder(); public native NV_ENCODE_API_FUNCTION_LIST nvEncReconfigureEncoder(PNVENCRECONFIGUREENCODER setter); + public native Pointer reserved1(); public native NV_ENCODE_API_FUNCTION_LIST reserved1(Pointer setter); + /** [out]: Client should access ::NvEncCreateMVBuffer API through this pointer. */ + public native PNVENCCREATEMVBUFFER nvEncCreateMVBuffer(); public native NV_ENCODE_API_FUNCTION_LIST nvEncCreateMVBuffer(PNVENCCREATEMVBUFFER setter); + /** [out]: Client should access ::NvEncDestroyMVBuffer API through this pointer. */ + public native PNVENCDESTROYMVBUFFER nvEncDestroyMVBuffer(); public native NV_ENCODE_API_FUNCTION_LIST nvEncDestroyMVBuffer(PNVENCDESTROYMVBUFFER setter); + /** [out]: Client should access ::NvEncRunMotionEstimationOnly API through this pointer. */ + public native PNVENCRUNMOTIONESTIMATIONONLY nvEncRunMotionEstimationOnly(); public native NV_ENCODE_API_FUNCTION_LIST nvEncRunMotionEstimationOnly(PNVENCRUNMOTIONESTIMATIONONLY setter); + /** [out]: Client should access ::nvEncGetLastErrorString API through this pointer. */ + public native PNVENCGETLASTERROR nvEncGetLastErrorString(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetLastErrorString(PNVENCGETLASTERROR setter); + /** [out]: Client should access ::nvEncSetIOCudaStreams API through this pointer. */ + public native PNVENCSETIOCUDASTREAMS nvEncSetIOCudaStreams(); public native NV_ENCODE_API_FUNCTION_LIST nvEncSetIOCudaStreams(PNVENCSETIOCUDASTREAMS setter); + /** [out]: Client should access ::NvEncGetEncodePresetConfigEx() API through this pointer. */ + public native PNVENCGETENCODEPRESETCONFIGEX nvEncGetEncodePresetConfigEx(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetEncodePresetConfigEx(PNVENCGETENCODEPRESETCONFIGEX setter); + /** [out]: Client should access ::NvEncGetSequenceParamEx() API through this pointer. */ + public native PNVENCGETSEQUENCEPARAMEX nvEncGetSequenceParamEx(); public native NV_ENCODE_API_FUNCTION_LIST nvEncGetSequenceParamEx(PNVENCGETSEQUENCEPARAMEX setter); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENCODE_API_FUNCTION_LIST reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CAPS_PARAM.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CAPS_PARAM.java new file mode 100644 index 00000000000..392e9b81adf --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CAPS_PARAM.java @@ -0,0 +1,46 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * Input struct for querying Encoding capabilities. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CAPS_PARAM extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CAPS_PARAM() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CAPS_PARAM(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CAPS_PARAM(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CAPS_PARAM position(long position) { + return (NV_ENC_CAPS_PARAM)super.position(position); + } + @Override public NV_ENC_CAPS_PARAM getPointer(long i) { + return new NV_ENC_CAPS_PARAM((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_CAPS_PARAM_VER */ + public native @Cast("uint32_t") int version(); public native NV_ENC_CAPS_PARAM version(int setter); + /** [in]: Specifies the encode capability to be queried. Client should pass a member for ::NV_ENC_CAPS enum. */ + public native @Cast("NV_ENC_CAPS") int capsToQuery(); public native NV_ENC_CAPS_PARAM capsToQuery(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_CAPS_PARAM reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CODEC_CONFIG.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CODEC_CONFIG.java new file mode 100644 index 00000000000..0f30c67ed63 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CODEC_CONFIG.java @@ -0,0 +1,51 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_CODEC_CONFIG + * Codec-specific encoder configuration parameters to be set during initialization. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CODEC_CONFIG extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CODEC_CONFIG() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CODEC_CONFIG(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CODEC_CONFIG(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CODEC_CONFIG position(long position) { + return (NV_ENC_CODEC_CONFIG)super.position(position); + } + @Override public NV_ENC_CODEC_CONFIG getPointer(long i) { + return new NV_ENC_CODEC_CONFIG((Pointer)this).position(position + i); + } + + /** [in]: Specifies the H.264-specific encoder configuration. */ + public native @ByRef NV_ENC_CONFIG_H264 h264Config(); public native NV_ENC_CODEC_CONFIG h264Config(NV_ENC_CONFIG_H264 setter); + /** [in]: Specifies the HEVC-specific encoder configuration. */ + public native @ByRef NV_ENC_CONFIG_HEVC hevcConfig(); public native NV_ENC_CODEC_CONFIG hevcConfig(NV_ENC_CONFIG_HEVC setter); + /** [in]: Specifies the H.264-specific ME only encoder configuration. */ + public native @ByRef NV_ENC_CONFIG_H264_MEONLY h264MeOnlyConfig(); public native NV_ENC_CODEC_CONFIG h264MeOnlyConfig(NV_ENC_CONFIG_H264_MEONLY setter); + /** [in]: Specifies the HEVC-specific ME only encoder configuration. */ + public native @ByRef NV_ENC_CONFIG_HEVC_MEONLY hevcMeOnlyConfig(); public native NV_ENC_CODEC_CONFIG hevcMeOnlyConfig(NV_ENC_CONFIG_HEVC_MEONLY setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_CODEC_CONFIG reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CODEC_PIC_PARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CODEC_PIC_PARAMS.java new file mode 100644 index 00000000000..0de2e37860d --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CODEC_PIC_PARAMS.java @@ -0,0 +1,46 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * Codec specific per-picture encoding parameters. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CODEC_PIC_PARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CODEC_PIC_PARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CODEC_PIC_PARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CODEC_PIC_PARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CODEC_PIC_PARAMS position(long position) { + return (NV_ENC_CODEC_PIC_PARAMS)super.position(position); + } + @Override public NV_ENC_CODEC_PIC_PARAMS getPointer(long i) { + return new NV_ENC_CODEC_PIC_PARAMS((Pointer)this).position(position + i); + } + + /** [in]: H264 encode picture params. */ + public native @ByRef NV_ENC_PIC_PARAMS_H264 h264PicParams(); public native NV_ENC_CODEC_PIC_PARAMS h264PicParams(NV_ENC_PIC_PARAMS_H264 setter); + /** [in]: HEVC encode picture params. */ + public native @ByRef NV_ENC_PIC_PARAMS_HEVC hevcPicParams(); public native NV_ENC_CODEC_PIC_PARAMS hevcPicParams(NV_ENC_PIC_PARAMS_HEVC setter); + /** [in]: Reserved and must be set to 0. */ + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_CODEC_PIC_PARAMS reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG.java new file mode 100644 index 00000000000..d3ae3826644 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG.java @@ -0,0 +1,67 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NV_ENC_CONFIG + * Encoder configuration parameters to be set during initialization. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CONFIG extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CONFIG() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CONFIG(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CONFIG(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CONFIG position(long position) { + return (NV_ENC_CONFIG)super.position(position); + } + @Override public NV_ENC_CONFIG getPointer(long i) { + return new NV_ENC_CONFIG((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_CONFIG_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_CONFIG version(int setter); + /** [in]: Specifies the codec profile GUID. If client specifies \p NV_ENC_CODEC_PROFILE_AUTOSELECT_GUID the NvEncodeAPI interface will select the appropriate codec profile. */ + public native @ByRef GUID profileGUID(); public native NV_ENC_CONFIG profileGUID(GUID setter); + /** [in]: Specifies the number of pictures in one GOP. Low latency application client can set goplength to NVENC_INFINITE_GOPLENGTH so that keyframes are not inserted automatically. */ + public native @Cast("uint32_t") int gopLength(); public native NV_ENC_CONFIG gopLength(int setter); + /** [in]: Specifies the GOP pattern as follows: \p frameIntervalP = 0: I, 1: IPP, 2: IBP, 3: IBBP If goplength is set to NVENC_INFINITE_GOPLENGTH \p frameIntervalP should be set to 1. */ + public native @Cast("int32_t") int frameIntervalP(); public native NV_ENC_CONFIG frameIntervalP(int setter); + /** [in]: Set this to 1 to enable monochrome encoding for this session. */ + public native @Cast("uint32_t") int monoChromeEncoding(); public native NV_ENC_CONFIG monoChromeEncoding(int setter); + /** [in]: Specifies the frame/field mode. + Check support for field encoding using ::NV_ENC_CAPS_SUPPORT_FIELD_ENCODING caps. + Using a frameFieldMode other than NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME for RGB input is not supported. */ + public native @Cast("NV_ENC_PARAMS_FRAME_FIELD_MODE") int frameFieldMode(); public native NV_ENC_CONFIG frameFieldMode(int setter); + /** [in]: Specifies the desired motion vector prediction precision. */ + public native @Cast("NV_ENC_MV_PRECISION") int mvPrecision(); public native NV_ENC_CONFIG mvPrecision(int setter); + /** [in]: Specifies the rate control parameters for the current encoding session. */ + public native @ByRef NV_ENC_RC_PARAMS rcParams(); public native NV_ENC_CONFIG rcParams(NV_ENC_RC_PARAMS setter); + /** [in]: Specifies the codec specific config parameters through this union. */ + public native @ByRef NV_ENC_CODEC_CONFIG encodeCodecConfig(); public native NV_ENC_CONFIG encodeCodecConfig(NV_ENC_CODEC_CONFIG setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_CONFIG reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_CONFIG reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264.java new file mode 100644 index 00000000000..640d9e7afe7 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264.java @@ -0,0 +1,186 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NV_ENC_CONFIG_H264 + * H264 encoder configuration parameters + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CONFIG_H264 extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CONFIG_H264() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CONFIG_H264(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CONFIG_H264(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CONFIG_H264 position(long position) { + return (NV_ENC_CONFIG_H264)super.position(position); + } + @Override public NV_ENC_CONFIG_H264 getPointer(long i) { + return new NV_ENC_CONFIG_H264((Pointer)this).position(position + i); + } + + /** [in]: Set to 1 to enable SVC temporal*/ + public native @Cast("uint32_t") @NoOffset int enableTemporalSVC(); public native NV_ENC_CONFIG_H264 enableTemporalSVC(int setter); + /** [in]: Set to 1 to enable stereo MVC*/ + public native @Cast("uint32_t") @NoOffset int enableStereoMVC(); public native NV_ENC_CONFIG_H264 enableStereoMVC(int setter); + /** [in]: Set to 1 to enable hierarchical P Frames */ + public native @Cast("uint32_t") @NoOffset int hierarchicalPFrames(); public native NV_ENC_CONFIG_H264 hierarchicalPFrames(int setter); + /** [in]: Set to 1 to enable hierarchical B Frames */ + public native @Cast("uint32_t") @NoOffset int hierarchicalBFrames(); public native NV_ENC_CONFIG_H264 hierarchicalBFrames(int setter); + /** [in]: Set to 1 to write SEI buffering period syntax in the bitstream */ + public native @Cast("uint32_t") @NoOffset int outputBufferingPeriodSEI(); public native NV_ENC_CONFIG_H264 outputBufferingPeriodSEI(int setter); + /** [in]: Set to 1 to write SEI picture timing syntax in the bitstream. When set for following rateControlMode : NV_ENC_PARAMS_RC_CBR, NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ, + NV_ENC_PARAMS_RC_CBR_HQ, filler data is inserted if needed to achieve HRD bitrate */ + public native @Cast("uint32_t") @NoOffset int outputPictureTimingSEI(); public native NV_ENC_CONFIG_H264 outputPictureTimingSEI(int setter); + /** [in]: Set to 1 to write access unit delimiter syntax in bitstream */ + public native @Cast("uint32_t") @NoOffset int outputAUD(); public native NV_ENC_CONFIG_H264 outputAUD(int setter); + /** [in]: Set to 1 to disable writing of Sequence and Picture parameter info in bitstream */ + public native @Cast("uint32_t") @NoOffset int disableSPSPPS(); public native NV_ENC_CONFIG_H264 disableSPSPPS(int setter); + /** [in]: Set to 1 to enable writing of frame packing arrangement SEI messages to bitstream */ + public native @Cast("uint32_t") @NoOffset int outputFramePackingSEI(); public native NV_ENC_CONFIG_H264 outputFramePackingSEI(int setter); + /** [in]: Set to 1 to enable writing of recovery point SEI message */ + public native @Cast("uint32_t") @NoOffset int outputRecoveryPointSEI(); public native NV_ENC_CONFIG_H264 outputRecoveryPointSEI(int setter); + /** [in]: Set to 1 to enable gradual decoder refresh or intra refresh. If the GOP structure uses B frames this will be ignored */ + public native @Cast("uint32_t") @NoOffset int enableIntraRefresh(); public native NV_ENC_CONFIG_H264 enableIntraRefresh(int setter); + /** [in]: Set this to 1 to enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices. + Constrained encoding works only with rectangular slices. + Check support for constrained encoding using ::NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING caps. */ + public native @Cast("uint32_t") @NoOffset int enableConstrainedEncoding(); public native NV_ENC_CONFIG_H264 enableConstrainedEncoding(int setter); + /** [in]: Set to 1 to enable writing of Sequence and Picture parameter for every IDR frame */ + public native @Cast("uint32_t") @NoOffset int repeatSPSPPS(); public native NV_ENC_CONFIG_H264 repeatSPSPPS(int setter); + /** [in]: Setting enableVFR=1 currently only sets the fixed_frame_rate_flag=0 in the VUI but otherwise + has no impact on the encoder behavior. For more details please refer to E.1 VUI syntax of H.264 standard. Note, however, that NVENC does not support VFR encoding and rate control. */ + public native @Cast("uint32_t") @NoOffset int enableVFR(); public native NV_ENC_CONFIG_H264 enableVFR(int setter); + /** [in]: Set to 1 to enable LTR (Long Term Reference) frame support. LTR can be used in two modes: "LTR Trust" mode and "LTR Per Picture" mode. + LTR Trust mode: In this mode, ltrNumFrames pictures after IDR are automatically marked as LTR. This mode is enabled by setting ltrTrustMode = 1. + Use of LTR Trust mode is strongly discouraged as this mode may be deprecated in future. + LTR Per Picture mode: In this mode, client can control whether the current picture should be marked as LTR. Enable this mode by setting + ltrTrustMode = 0 and ltrMarkFrame = 1 for the picture to be marked as LTR. This is the preferred mode + for using LTR. + Note that LTRs are not supported if encoding session is configured with B-frames */ + public native @Cast("uint32_t") @NoOffset int enableLTR(); public native NV_ENC_CONFIG_H264 enableLTR(int setter); + /** [in]: To enable lossless encode set this to 1, set QP to 0 and RC_mode to NV_ENC_PARAMS_RC_CONSTQP and profile to HIGH_444_PREDICTIVE_PROFILE. + Check support for lossless encoding using ::NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE caps. */ + public native @Cast("uint32_t") @NoOffset int qpPrimeYZeroTransformBypassFlag(); public native NV_ENC_CONFIG_H264 qpPrimeYZeroTransformBypassFlag(int setter); + /** [in]: Set 1 to enable constrained intra prediction. */ + public native @Cast("uint32_t") @NoOffset int useConstrainedIntraPred(); public native NV_ENC_CONFIG_H264 useConstrainedIntraPred(int setter); + /** [in]: Set to 1 to enable insertion of filler data in the bitstream. + This flag will take effect only when one of the CBR rate + control modes (NV_ENC_PARAMS_RC_CBR, NV_ENC_PARAMS_RC_CBR_HQ, + NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) is in use and both + NV_ENC_INITIALIZE_PARAMS::frameRateNum and + NV_ENC_INITIALIZE_PARAMS::frameRateDen are set to non-zero + values. Setting this field when + NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is also set + is currently not supported and will make ::NvEncInitializeEncoder() + return an error. */ + public native @Cast("uint32_t") @NoOffset int enableFillerDataInsertion(); public native NV_ENC_CONFIG_H264 enableFillerDataInsertion(int setter); + /** [in]: Set to 1 to disable writing of SVC Prefix NALU preceding each slice in bitstream. + Applicable only when temporal SVC is enabled (NV_ENC_CONFIG_H264::enableTemporalSVC = 1). */ + public native @Cast("uint32_t") @NoOffset int disableSVCPrefixNalu(); public native NV_ENC_CONFIG_H264 disableSVCPrefixNalu(int setter); + /** [in]: Set to 1 to enable writing of Scalability Information SEI message preceding each IDR picture in bitstream + Applicable only when temporal SVC is enabled (NV_ENC_CONFIG_H264::enableTemporalSVC = 1). */ + public native @Cast("uint32_t") @NoOffset int enableScalabilityInfoSEI(); public native NV_ENC_CONFIG_H264 enableScalabilityInfoSEI(int setter); + /** [in]: Reserved bitfields and must be set to 0 */ + public native @Cast("uint32_t") @NoOffset int reservedBitFields(); public native NV_ENC_CONFIG_H264 reservedBitFields(int setter); + /** [in]: Specifies the encoding level. Client is recommended to set this to NV_ENC_LEVEL_AUTOSELECT in order to enable the NvEncodeAPI interface to select the correct level. */ + public native @Cast("uint32_t") int level(); public native NV_ENC_CONFIG_H264 level(int setter); + /** [in]: Specifies the IDR interval. If not set, this is made equal to gopLength in NV_ENC_CONFIG.Low latency application client can set IDR interval to NVENC_INFINITE_GOPLENGTH so that IDR frames are not inserted automatically. */ + public native @Cast("uint32_t") int idrPeriod(); public native NV_ENC_CONFIG_H264 idrPeriod(int setter); + /** [in]: Set to 1 to enable 4:4:4 separate colour planes */ + public native @Cast("uint32_t") int separateColourPlaneFlag(); public native NV_ENC_CONFIG_H264 separateColourPlaneFlag(int setter); + /** [in]: Specifies the deblocking filter mode. Permissible value range: [0,2]. This flag corresponds + to the flag disable_deblocking_filter_idc specified in section 7.4.3 of H.264 specification, + which specifies whether the operation of the deblocking filter shall be disabled across some + block edges of the slice and specifies for which edges the filtering is disabled. See section + 7.4.3 of H.264 specification for more details.*/ + public native @Cast("uint32_t") int disableDeblockingFilterIDC(); public native NV_ENC_CONFIG_H264 disableDeblockingFilterIDC(int setter); + /** [in]: Specifies number of temporal layers to be used for hierarchical coding / temporal SVC. Valid value range is [1,::NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS] */ + public native @Cast("uint32_t") int numTemporalLayers(); public native NV_ENC_CONFIG_H264 numTemporalLayers(int setter); + /** [in]: Specifies the SPS id of the sequence header */ + public native @Cast("uint32_t") int spsId(); public native NV_ENC_CONFIG_H264 spsId(int setter); + /** [in]: Specifies the PPS id of the picture header */ + public native @Cast("uint32_t") int ppsId(); public native NV_ENC_CONFIG_H264 ppsId(int setter); + /** [in]: Specifies the AdaptiveTransform Mode. Check support for AdaptiveTransform mode using ::NV_ENC_CAPS_SUPPORT_ADAPTIVE_TRANSFORM caps. */ + public native @Cast("NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE") int adaptiveTransformMode(); public native NV_ENC_CONFIG_H264 adaptiveTransformMode(int setter); + /** [in]: Specified the FMO Mode. Check support for FMO using ::NV_ENC_CAPS_SUPPORT_FMO caps. */ + public native @Cast("NV_ENC_H264_FMO_MODE") int fmoMode(); public native NV_ENC_CONFIG_H264 fmoMode(int setter); + /** [in]: Specifies the BDirect mode. Check support for BDirect mode using ::NV_ENC_CAPS_SUPPORT_BDIRECT_MODE caps.*/ + public native @Cast("NV_ENC_H264_BDIRECT_MODE") int bdirectMode(); public native NV_ENC_CONFIG_H264 bdirectMode(int setter); + /** [in]: Specifies the entropy coding mode. Check support for CABAC mode using ::NV_ENC_CAPS_SUPPORT_CABAC caps. */ + public native @Cast("NV_ENC_H264_ENTROPY_CODING_MODE") int entropyCodingMode(); public native NV_ENC_CONFIG_H264 entropyCodingMode(int setter); + /** [in]: Specifies the stereo frame packing mode which is to be signaled in frame packing arrangement SEI */ + public native @Cast("NV_ENC_STEREO_PACKING_MODE") int stereoMode(); public native NV_ENC_CONFIG_H264 stereoMode(int setter); + /** [in]: Specifies the interval between successive intra refresh if enableIntrarefresh is set. Requires enableIntraRefresh to be set. + Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */ + public native @Cast("uint32_t") int intraRefreshPeriod(); public native NV_ENC_CONFIG_H264 intraRefreshPeriod(int setter); + /** [in]: Specifies the length of intra refresh in number of frames for periodic intra refresh. This value should be smaller than intraRefreshPeriod */ + public native @Cast("uint32_t") int intraRefreshCnt(); public native NV_ENC_CONFIG_H264 intraRefreshCnt(int setter); + /** [in]: Specifies the DPB size used for encoding. Setting it to 0 will let driver use the default DPB size. + The low latency application which wants to invalidate reference frame as an error resilience tool + is recommended to use a large DPB size so that the encoder can keep old reference frames which can be used if recent + frames are invalidated. */ + public native @Cast("uint32_t") int maxNumRefFrames(); public native NV_ENC_CONFIG_H264 maxNumRefFrames(int setter); + /** [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices + sliceMode = 0 MB based slices, sliceMode = 1 Byte based slices, sliceMode = 2 MB row based slices, sliceMode = 3 numSlices in Picture. + When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting + When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */ + public native @Cast("uint32_t") int sliceMode(); public native NV_ENC_CONFIG_H264 sliceMode(int setter); + /** [in]: Specifies the parameter needed for sliceMode. For: + sliceMode = 0, sliceModeData specifies # of MBs in each slice (except last slice) + sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice) + sliceMode = 2, sliceModeData specifies # of MB rows in each slice (except last slice) + sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ + public native @Cast("uint32_t") int sliceModeData(); public native NV_ENC_CONFIG_H264 sliceModeData(int setter); + /** [in]: Specifies the H264 video usability info parameters */ + public native @ByRef NV_ENC_CONFIG_H264_VUI_PARAMETERS h264VUIParameters(); public native NV_ENC_CONFIG_H264 h264VUIParameters(NV_ENC_CONFIG_H264_VUI_PARAMETERS setter); + /** [in]: Specifies the number of LTR frames. This parameter has different meaning in two LTR modes. + In "LTR Trust" mode (ltrTrustMode = 1), encoder will mark the first ltrNumFrames base layer reference frames within each IDR interval as LTR. + In "LTR Per Picture" mode (ltrTrustMode = 0 and ltrMarkFrame = 1), ltrNumFrames specifies maximum number of LTR frames in DPB. */ + public native @Cast("uint32_t") int ltrNumFrames(); public native NV_ENC_CONFIG_H264 ltrNumFrames(int setter); + /** [in]: Specifies the LTR operating mode. See comments near NV_ENC_CONFIG_H264::enableLTR for description of the two modes. + Set to 1 to use "LTR Trust" mode of LTR operation. Clients are discouraged to use "LTR Trust" mode as this mode may + be deprecated in future releases. + Set to 0 when using "LTR Per Picture" mode of LTR operation. */ + public native @Cast("uint32_t") int ltrTrustMode(); public native NV_ENC_CONFIG_H264 ltrTrustMode(int setter); + /** [in]: Specifies the chroma format. Should be set to 1 for yuv420 input, 3 for yuv444 input. + Check support for YUV444 encoding using ::NV_ENC_CAPS_SUPPORT_YUV444_ENCODE caps.*/ + public native @Cast("uint32_t") int chromaFormatIDC(); public native NV_ENC_CONFIG_H264 chromaFormatIDC(int setter); + /** [in]: Specifies the maximum temporal layer used for temporal SVC / hierarchical coding. + Defaut value of this field is NV_ENC_CAPS::NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS. Note that the value NV_ENC_CONFIG_H264::maxNumRefFrames should + be greater than or equal to (NV_ENC_CONFIG_H264::maxTemporalLayers - 2) * 2, for NV_ENC_CONFIG_H264::maxTemporalLayers >= 2.*/ + public native @Cast("uint32_t") int maxTemporalLayers(); public native NV_ENC_CONFIG_H264 maxTemporalLayers(int setter); + /** [in]: Specifies the B-Frame as reference mode. Check support for useBFramesAsRef mode using ::NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE caps.*/ + public native @Cast("NV_ENC_BFRAME_REF_MODE") int useBFramesAsRef(); public native NV_ENC_CONFIG_H264 useBFramesAsRef(int setter); + /** [in]: Specifies max number of reference frames in reference picture list L0, that can be used by hardware for prediction of a frame. + Check support for numRefL0 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */ + public native @Cast("NV_ENC_NUM_REF_FRAMES") int numRefL0(); public native NV_ENC_CONFIG_H264 numRefL0(int setter); + /** [in]: Specifies max number of reference frames in reference picture list L1, that can be used by hardware for prediction of a frame. + Check support for numRefL1 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */ + public native @Cast("NV_ENC_NUM_REF_FRAMES") int numRefL1(); public native NV_ENC_CONFIG_H264 numRefL1(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_CONFIG_H264 reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_CONFIG_H264 reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264_MEONLY.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264_MEONLY.java new file mode 100644 index 00000000000..fdb9761a489 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264_MEONLY.java @@ -0,0 +1,61 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_CONFIG_H264_MEONLY + * H264 encoder configuration parameters for ME only Mode + * + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CONFIG_H264_MEONLY extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CONFIG_H264_MEONLY() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CONFIG_H264_MEONLY(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CONFIG_H264_MEONLY(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CONFIG_H264_MEONLY position(long position) { + return (NV_ENC_CONFIG_H264_MEONLY)super.position(position); + } + @Override public NV_ENC_CONFIG_H264_MEONLY getPointer(long i) { + return new NV_ENC_CONFIG_H264_MEONLY((Pointer)this).position(position + i); + } + + /** [in]: Disable Motion Estimation on 16x16 blocks*/ + public native @Cast("uint32_t") @NoOffset int disablePartition16x16(); public native NV_ENC_CONFIG_H264_MEONLY disablePartition16x16(int setter); + /** [in]: Disable Motion Estimation on 8x16 blocks*/ + public native @Cast("uint32_t") @NoOffset int disablePartition8x16(); public native NV_ENC_CONFIG_H264_MEONLY disablePartition8x16(int setter); + /** [in]: Disable Motion Estimation on 16x8 blocks*/ + public native @Cast("uint32_t") @NoOffset int disablePartition16x8(); public native NV_ENC_CONFIG_H264_MEONLY disablePartition16x8(int setter); + /** [in]: Disable Motion Estimation on 8x8 blocks*/ + public native @Cast("uint32_t") @NoOffset int disablePartition8x8(); public native NV_ENC_CONFIG_H264_MEONLY disablePartition8x8(int setter); + /** [in]: Disable Intra search during Motion Estimation*/ + public native @Cast("uint32_t") @NoOffset int disableIntraSearch(); public native NV_ENC_CONFIG_H264_MEONLY disableIntraSearch(int setter); + /** [in]: Enable Stereo Mode for Motion Estimation where each view is independently executed*/ + public native @Cast("uint32_t") @NoOffset int bStereoEnable(); public native NV_ENC_CONFIG_H264_MEONLY bStereoEnable(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") @NoOffset int reserved(); public native NV_ENC_CONFIG_H264_MEONLY reserved(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_CONFIG_H264_MEONLY reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_CONFIG_H264_MEONLY reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264_VUI_PARAMETERS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264_VUI_PARAMETERS.java new file mode 100644 index 00000000000..fc87dfb6603 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_H264_VUI_PARAMETERS.java @@ -0,0 +1,70 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + + +/** + * \struct _NV_ENC_CONFIG_H264_VUI_PARAMETERS + * H264 Video Usability Info parameters + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CONFIG_H264_VUI_PARAMETERS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CONFIG_H264_VUI_PARAMETERS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CONFIG_H264_VUI_PARAMETERS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CONFIG_H264_VUI_PARAMETERS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CONFIG_H264_VUI_PARAMETERS position(long position) { + return (NV_ENC_CONFIG_H264_VUI_PARAMETERS)super.position(position); + } + @Override public NV_ENC_CONFIG_H264_VUI_PARAMETERS getPointer(long i) { + return new NV_ENC_CONFIG_H264_VUI_PARAMETERS((Pointer)this).position(position + i); + } + + /** [in]: if set to 1 , it specifies that the overscanInfo is present */ + public native @Cast("uint32_t") int overscanInfoPresentFlag(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS overscanInfoPresentFlag(int setter); + /** [in]: Specifies the overscan info(as defined in Annex E of the ITU-T Specification). */ + public native @Cast("uint32_t") int overscanInfo(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS overscanInfo(int setter); + /** [in]: If set to 1, it specifies that the videoFormat, videoFullRangeFlag and colourDescriptionPresentFlag are present. */ + public native @Cast("uint32_t") int videoSignalTypePresentFlag(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS videoSignalTypePresentFlag(int setter); + /** [in]: Specifies the source video format(as defined in Annex E of the ITU-T Specification).*/ + public native @Cast("uint32_t") int videoFormat(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS videoFormat(int setter); + /** [in]: Specifies the output range of the luma and chroma samples(as defined in Annex E of the ITU-T Specification). */ + public native @Cast("uint32_t") int videoFullRangeFlag(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS videoFullRangeFlag(int setter); + /** [in]: If set to 1, it specifies that the colourPrimaries, transferCharacteristics and colourMatrix are present. */ + public native @Cast("uint32_t") int colourDescriptionPresentFlag(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS colourDescriptionPresentFlag(int setter); + /** [in]: Specifies color primaries for converting to RGB(as defined in Annex E of the ITU-T Specification) */ + public native @Cast("uint32_t") int colourPrimaries(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS colourPrimaries(int setter); + /** [in]: Specifies the opto-electronic transfer characteristics to use (as defined in Annex E of the ITU-T Specification) */ + public native @Cast("uint32_t") int transferCharacteristics(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS transferCharacteristics(int setter); + /** [in]: Specifies the matrix coefficients used in deriving the luma and chroma from the RGB primaries (as defined in Annex E of the ITU-T Specification). */ + public native @Cast("uint32_t") int colourMatrix(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS colourMatrix(int setter); + /** [in]: if set to 1 , it specifies that the chromaSampleLocationTop and chromaSampleLocationBot are present.*/ + public native @Cast("uint32_t") int chromaSampleLocationFlag(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS chromaSampleLocationFlag(int setter); + /** [in]: Specifies the chroma sample location for top field(as defined in Annex E of the ITU-T Specification) */ + public native @Cast("uint32_t") int chromaSampleLocationTop(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS chromaSampleLocationTop(int setter); + /** [in]: Specifies the chroma sample location for bottom field(as defined in Annex E of the ITU-T Specification) */ + public native @Cast("uint32_t") int chromaSampleLocationBot(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS chromaSampleLocationBot(int setter); + /** [in]: if set to 1, it specifies the bitstream restriction parameters are present in the bitstream.*/ + public native @Cast("uint32_t") int bitstreamRestrictionFlag(); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS bitstreamRestrictionFlag(int setter); + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_CONFIG_H264_VUI_PARAMETERS reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_HEVC.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_HEVC.java new file mode 100644 index 00000000000..b74428cc51a --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_HEVC.java @@ -0,0 +1,147 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_CONFIG_HEVC + * HEVC encoder configuration parameters to be set during initialization. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CONFIG_HEVC extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CONFIG_HEVC() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CONFIG_HEVC(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CONFIG_HEVC(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CONFIG_HEVC position(long position) { + return (NV_ENC_CONFIG_HEVC)super.position(position); + } + @Override public NV_ENC_CONFIG_HEVC getPointer(long i) { + return new NV_ENC_CONFIG_HEVC((Pointer)this).position(position + i); + } + + /** [in]: Specifies the level of the encoded bitstream.*/ + public native @Cast("uint32_t") int level(); public native NV_ENC_CONFIG_HEVC level(int setter); + /** [in]: Specifies the level tier of the encoded bitstream.*/ + public native @Cast("uint32_t") int tier(); public native NV_ENC_CONFIG_HEVC tier(int setter); + /** [in]: Specifies the minimum size of luma coding unit.*/ + public native @Cast("NV_ENC_HEVC_CUSIZE") int minCUSize(); public native NV_ENC_CONFIG_HEVC minCUSize(int setter); + /** [in]: Specifies the maximum size of luma coding unit. Currently NVENC SDK only supports maxCUSize equal to NV_ENC_HEVC_CUSIZE_32x32.*/ + public native @Cast("NV_ENC_HEVC_CUSIZE") int maxCUSize(); public native NV_ENC_CONFIG_HEVC maxCUSize(int setter); + /** [in]: Set 1 to enable constrained intra prediction. */ + public native @Cast("uint32_t") @NoOffset int useConstrainedIntraPred(); public native NV_ENC_CONFIG_HEVC useConstrainedIntraPred(int setter); + /** [in]: Set 1 to disable in loop filtering across slice boundary.*/ + public native @Cast("uint32_t") @NoOffset int disableDeblockAcrossSliceBoundary(); public native NV_ENC_CONFIG_HEVC disableDeblockAcrossSliceBoundary(int setter); + /** [in]: Set 1 to write SEI buffering period syntax in the bitstream */ + public native @Cast("uint32_t") @NoOffset int outputBufferingPeriodSEI(); public native NV_ENC_CONFIG_HEVC outputBufferingPeriodSEI(int setter); + /** [in]: Set 1 to write SEI picture timing syntax in the bitstream */ + public native @Cast("uint32_t") @NoOffset int outputPictureTimingSEI(); public native NV_ENC_CONFIG_HEVC outputPictureTimingSEI(int setter); + /** [in]: Set 1 to write Access Unit Delimiter syntax. */ + public native @Cast("uint32_t") @NoOffset int outputAUD(); public native NV_ENC_CONFIG_HEVC outputAUD(int setter); + /** [in]: Set to 1 to enable LTR (Long Term Reference) frame support. LTR can be used in two modes: "LTR Trust" mode and "LTR Per Picture" mode. + LTR Trust mode: In this mode, ltrNumFrames pictures after IDR are automatically marked as LTR. This mode is enabled by setting ltrTrustMode = 1. + Use of LTR Trust mode is strongly discouraged as this mode may be deprecated in future releases. + LTR Per Picture mode: In this mode, client can control whether the current picture should be marked as LTR. Enable this mode by setting + ltrTrustMode = 0 and ltrMarkFrame = 1 for the picture to be marked as LTR. This is the preferred mode + for using LTR. + Note that LTRs are not supported if encoding session is configured with B-frames */ + public native @Cast("uint32_t") @NoOffset int enableLTR(); public native NV_ENC_CONFIG_HEVC enableLTR(int setter); + /** [in]: Set 1 to disable VPS, SPS and PPS signaling in the bitstream. */ + public native @Cast("uint32_t") @NoOffset int disableSPSPPS(); public native NV_ENC_CONFIG_HEVC disableSPSPPS(int setter); + /** [in]: Set 1 to output VPS,SPS and PPS for every IDR frame.*/ + public native @Cast("uint32_t") @NoOffset int repeatSPSPPS(); public native NV_ENC_CONFIG_HEVC repeatSPSPPS(int setter); + /** [in]: Set 1 to enable gradual decoder refresh or intra refresh. If the GOP structure uses B frames this will be ignored */ + public native @Cast("uint32_t") @NoOffset int enableIntraRefresh(); public native NV_ENC_CONFIG_HEVC enableIntraRefresh(int setter); + /** [in]: Specifies the chroma format. Should be set to 1 for yuv420 input, 3 for yuv444 input.*/ + public native @Cast("uint32_t") @NoOffset int chromaFormatIDC(); public native NV_ENC_CONFIG_HEVC chromaFormatIDC(int setter); + /** [in]: Specifies pixel bit depth minus 8. Should be set to 0 for 8 bit input, 2 for 10 bit input.*/ + public native @Cast("uint32_t") @NoOffset int pixelBitDepthMinus8(); public native NV_ENC_CONFIG_HEVC pixelBitDepthMinus8(int setter); + /** [in]: Set to 1 to enable insertion of filler data in the bitstream. + This flag will take effect only when one of the CBR rate + control modes (NV_ENC_PARAMS_RC_CBR, NV_ENC_PARAMS_RC_CBR_HQ, + NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) is in use and both + NV_ENC_INITIALIZE_PARAMS::frameRateNum and + NV_ENC_INITIALIZE_PARAMS::frameRateDen are set to non-zero + values. Setting this field when + NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is also set + is currently not supported and will make ::NvEncInitializeEncoder() + return an error. */ + public native @Cast("uint32_t") @NoOffset int enableFillerDataInsertion(); public native NV_ENC_CONFIG_HEVC enableFillerDataInsertion(int setter); + /** [in]: Set this to 1 to enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices. + Constrained encoding works only with rectangular slices. + Check support for constrained encoding using ::NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING caps. */ + public native @Cast("uint32_t") @NoOffset int enableConstrainedEncoding(); public native NV_ENC_CONFIG_HEVC enableConstrainedEncoding(int setter); + /** [in]: Set this to 1 to enable HEVC encode with alpha layer. */ + public native @Cast("uint32_t") @NoOffset int enableAlphaLayerEncoding(); public native NV_ENC_CONFIG_HEVC enableAlphaLayerEncoding(int setter); + /** [in]: Reserved bitfields.*/ + public native @Cast("uint32_t") @NoOffset int reserved(); public native NV_ENC_CONFIG_HEVC reserved(int setter); + /** [in]: Specifies the IDR interval. If not set, this is made equal to gopLength in NV_ENC_CONFIG. Low latency application client can set IDR interval to NVENC_INFINITE_GOPLENGTH so that IDR frames are not inserted automatically. */ + public native @Cast("uint32_t") int idrPeriod(); public native NV_ENC_CONFIG_HEVC idrPeriod(int setter); + /** [in]: Specifies the interval between successive intra refresh if enableIntrarefresh is set. Requires enableIntraRefresh to be set. + Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */ + public native @Cast("uint32_t") int intraRefreshPeriod(); public native NV_ENC_CONFIG_HEVC intraRefreshPeriod(int setter); + /** [in]: Specifies the length of intra refresh in number of frames for periodic intra refresh. This value should be smaller than intraRefreshPeriod */ + public native @Cast("uint32_t") int intraRefreshCnt(); public native NV_ENC_CONFIG_HEVC intraRefreshCnt(int setter); + /** [in]: Specifies the maximum number of references frames in the DPB.*/ + public native @Cast("uint32_t") int maxNumRefFramesInDPB(); public native NV_ENC_CONFIG_HEVC maxNumRefFramesInDPB(int setter); + /** [in]: This parameter has different meaning in two LTR modes. + In "LTR Trust" mode (ltrTrustMode = 1), encoder will mark the first ltrNumFrames base layer reference frames within each IDR interval as LTR. + In "LTR Per Picture" mode (ltrTrustMode = 0 and ltrMarkFrame = 1), ltrNumFrames specifies maximum number of LTR frames in DPB. */ + public native @Cast("uint32_t") int ltrNumFrames(); public native NV_ENC_CONFIG_HEVC ltrNumFrames(int setter); + /** [in]: Specifies the VPS id of the video parameter set */ + public native @Cast("uint32_t") int vpsId(); public native NV_ENC_CONFIG_HEVC vpsId(int setter); + /** [in]: Specifies the SPS id of the sequence header */ + public native @Cast("uint32_t") int spsId(); public native NV_ENC_CONFIG_HEVC spsId(int setter); + /** [in]: Specifies the PPS id of the picture header */ + public native @Cast("uint32_t") int ppsId(); public native NV_ENC_CONFIG_HEVC ppsId(int setter); + /** [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices + sliceMode = 0 CTU based slices, sliceMode = 1 Byte based slices, sliceMode = 2 CTU row based slices, sliceMode = 3, numSlices in Picture + When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */ + public native @Cast("uint32_t") int sliceMode(); public native NV_ENC_CONFIG_HEVC sliceMode(int setter); + /** [in]: Specifies the parameter needed for sliceMode. For: + sliceMode = 0, sliceModeData specifies # of CTUs in each slice (except last slice) + sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice) + sliceMode = 2, sliceModeData specifies # of CTU rows in each slice (except last slice) + sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ + public native @Cast("uint32_t") int sliceModeData(); public native NV_ENC_CONFIG_HEVC sliceModeData(int setter); + /** [in]: Specifies the max temporal layer used for hierarchical coding. */ + public native @Cast("uint32_t") int maxTemporalLayersMinus1(); public native NV_ENC_CONFIG_HEVC maxTemporalLayersMinus1(int setter); + /** [in]: Specifies the HEVC video usability info parameters */ + public native @ByRef @Cast("NV_ENC_CONFIG_HEVC_VUI_PARAMETERS*") NV_ENC_CONFIG_H264_VUI_PARAMETERS hevcVUIParameters(); public native NV_ENC_CONFIG_HEVC hevcVUIParameters(NV_ENC_CONFIG_H264_VUI_PARAMETERS setter); + /** [in]: Specifies the LTR operating mode. See comments near NV_ENC_CONFIG_HEVC::enableLTR for description of the two modes. + Set to 1 to use "LTR Trust" mode of LTR operation. Clients are discouraged to use "LTR Trust" mode as this mode may + be deprecated in future releases. + Set to 0 when using "LTR Per Picture" mode of LTR operation. */ + public native @Cast("uint32_t") int ltrTrustMode(); public native NV_ENC_CONFIG_HEVC ltrTrustMode(int setter); + /** [in]: Specifies the B-Frame as reference mode. Check support for useBFramesAsRef mode using ::NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE caps.*/ + public native @Cast("NV_ENC_BFRAME_REF_MODE") int useBFramesAsRef(); public native NV_ENC_CONFIG_HEVC useBFramesAsRef(int setter); + /** [in]: Specifies max number of reference frames in reference picture list L0, that can be used by hardware for prediction of a frame. + Check support for numRefL0 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */ + public native @Cast("NV_ENC_NUM_REF_FRAMES") int numRefL0(); public native NV_ENC_CONFIG_HEVC numRefL0(int setter); + /** [in]: Specifies max number of reference frames in reference picture list L1, that can be used by hardware for prediction of a frame. + Check support for numRefL1 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */ + public native @Cast("NV_ENC_NUM_REF_FRAMES") int numRefL1(); public native NV_ENC_CONFIG_HEVC numRefL1(int setter); + /** [in]: Reserved and must be set to 0.*/ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_CONFIG_HEVC reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_CONFIG_HEVC reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_HEVC_MEONLY.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_HEVC_MEONLY.java new file mode 100644 index 00000000000..68b69430859 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CONFIG_HEVC_MEONLY.java @@ -0,0 +1,48 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NV_ENC_CONFIG_HEVC_MEONLY + * HEVC encoder configuration parameters for ME only Mode + * + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CONFIG_HEVC_MEONLY extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CONFIG_HEVC_MEONLY() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CONFIG_HEVC_MEONLY(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CONFIG_HEVC_MEONLY(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CONFIG_HEVC_MEONLY position(long position) { + return (NV_ENC_CONFIG_HEVC_MEONLY)super.position(position); + } + @Override public NV_ENC_CONFIG_HEVC_MEONLY getPointer(long i) { + return new NV_ENC_CONFIG_HEVC_MEONLY((Pointer)this).position(position + i); + } + + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_CONFIG_HEVC_MEONLY reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved1(int i); public native NV_ENC_CONFIG_HEVC_MEONLY reserved1(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved1(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_BITSTREAM_BUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_BITSTREAM_BUFFER.java new file mode 100644 index 00000000000..10c2ccc19b3 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_BITSTREAM_BUFFER.java @@ -0,0 +1,57 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * Creation parameters for output bitstream buffer. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CREATE_BITSTREAM_BUFFER extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CREATE_BITSTREAM_BUFFER() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CREATE_BITSTREAM_BUFFER(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CREATE_BITSTREAM_BUFFER(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CREATE_BITSTREAM_BUFFER position(long position) { + return (NV_ENC_CREATE_BITSTREAM_BUFFER)super.position(position); + } + @Override public NV_ENC_CREATE_BITSTREAM_BUFFER getPointer(long i) { + return new NV_ENC_CREATE_BITSTREAM_BUFFER((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_CREATE_BITSTREAM_BUFFER_VER */ + public native @Cast("uint32_t") int version(); public native NV_ENC_CREATE_BITSTREAM_BUFFER version(int setter); + /** [in]: Deprecated. Do not use */ + public native @Cast("uint32_t") int size(); public native NV_ENC_CREATE_BITSTREAM_BUFFER size(int setter); + /** [in]: Deprecated. Do not use */ + public native @Cast("NV_ENC_MEMORY_HEAP") int memoryHeap(); public native NV_ENC_CREATE_BITSTREAM_BUFFER memoryHeap(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(); public native NV_ENC_CREATE_BITSTREAM_BUFFER reserved(int setter); + /** [out]: Pointer to the output bitstream buffer */ + public native NV_ENC_OUTPUT_PTR bitstreamBuffer(); public native NV_ENC_CREATE_BITSTREAM_BUFFER bitstreamBuffer(NV_ENC_OUTPUT_PTR setter); + /** [out]: Reserved and should not be used */ + public native Pointer bitstreamBufferPtr(); public native NV_ENC_CREATE_BITSTREAM_BUFFER bitstreamBufferPtr(Pointer setter); + /** [in]: Reserved and should be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_CREATE_BITSTREAM_BUFFER reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and should be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_CREATE_BITSTREAM_BUFFER reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_INPUT_BUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_INPUT_BUFFER.java new file mode 100644 index 00000000000..8dd81dfbe0e --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_INPUT_BUFFER.java @@ -0,0 +1,61 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * Creation parameters for input buffer. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CREATE_INPUT_BUFFER extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CREATE_INPUT_BUFFER() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CREATE_INPUT_BUFFER(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CREATE_INPUT_BUFFER(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CREATE_INPUT_BUFFER position(long position) { + return (NV_ENC_CREATE_INPUT_BUFFER)super.position(position); + } + @Override public NV_ENC_CREATE_INPUT_BUFFER getPointer(long i) { + return new NV_ENC_CREATE_INPUT_BUFFER((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_CREATE_INPUT_BUFFER_VER */ + public native @Cast("uint32_t") int version(); public native NV_ENC_CREATE_INPUT_BUFFER version(int setter); + /** [in]: Input frame width */ + public native @Cast("uint32_t") int width(); public native NV_ENC_CREATE_INPUT_BUFFER width(int setter); + /** [in]: Input frame height */ + public native @Cast("uint32_t") int height(); public native NV_ENC_CREATE_INPUT_BUFFER height(int setter); + /** [in]: Deprecated. Do not use */ + public native @Cast("NV_ENC_MEMORY_HEAP") int memoryHeap(); public native NV_ENC_CREATE_INPUT_BUFFER memoryHeap(int setter); + /** [in]: Input buffer format */ + public native @Cast("NV_ENC_BUFFER_FORMAT") int bufferFmt(); public native NV_ENC_CREATE_INPUT_BUFFER bufferFmt(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(); public native NV_ENC_CREATE_INPUT_BUFFER reserved(int setter); + /** [out]: Pointer to input buffer */ + public native NV_ENC_INPUT_PTR inputBuffer(); public native NV_ENC_CREATE_INPUT_BUFFER inputBuffer(NV_ENC_INPUT_PTR setter); + /** [in]: Pointer to existing system memory buffer */ + public native Pointer pSysMemBuffer(); public native NV_ENC_CREATE_INPUT_BUFFER pSysMemBuffer(Pointer setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_CREATE_INPUT_BUFFER reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_CREATE_INPUT_BUFFER reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_MV_BUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_MV_BUFFER.java new file mode 100644 index 00000000000..3e70419a1e1 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CREATE_MV_BUFFER.java @@ -0,0 +1,49 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * Creation parameters for output motion vector buffer for ME only mode. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CREATE_MV_BUFFER extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_CREATE_MV_BUFFER() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_CREATE_MV_BUFFER(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CREATE_MV_BUFFER(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_CREATE_MV_BUFFER position(long position) { + return (NV_ENC_CREATE_MV_BUFFER)super.position(position); + } + @Override public NV_ENC_CREATE_MV_BUFFER getPointer(long i) { + return new NV_ENC_CREATE_MV_BUFFER((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to NV_ENC_CREATE_MV_BUFFER_VER */ + public native @Cast("uint32_t") int version(); public native NV_ENC_CREATE_MV_BUFFER version(int setter); + /** [out]: Pointer to the output motion vector buffer */ + public native NV_ENC_OUTPUT_PTR mvBuffer(); public native NV_ENC_CREATE_MV_BUFFER mvBuffer(NV_ENC_OUTPUT_PTR setter); + /** [in]: Reserved and should be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_CREATE_MV_BUFFER reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and should be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_CREATE_MV_BUFFER reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CUSTREAM_PTR.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CUSTREAM_PTR.java new file mode 100644 index 00000000000..17c27c697ae --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_CUSTREAM_PTR.java @@ -0,0 +1,24 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +/** Pointer to CUstream*/ +@Namespace @Name("void") @Opaque @Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_CUSTREAM_PTR extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public NV_ENC_CUSTREAM_PTR() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_CUSTREAM_PTR(Pointer p) { super(p); } +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_ENCODE_OUT_PARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_ENCODE_OUT_PARAMS.java new file mode 100644 index 00000000000..7561b51540b --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_ENCODE_OUT_PARAMS.java @@ -0,0 +1,47 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * Encoder Output parameters + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_ENCODE_OUT_PARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_ENCODE_OUT_PARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_ENCODE_OUT_PARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_ENCODE_OUT_PARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_ENCODE_OUT_PARAMS position(long position) { + return (NV_ENC_ENCODE_OUT_PARAMS)super.position(position); + } + @Override public NV_ENC_ENCODE_OUT_PARAMS getPointer(long i) { + return new NV_ENC_ENCODE_OUT_PARAMS((Pointer)this).position(position + i); + } + + /** [out]: Struct version. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_ENCODE_OUT_PARAMS version(int setter); + /** [out]: Encoded bitstream size in bytes */ + public native @Cast("uint32_t") int bitstreamSizeInBytes(); public native NV_ENC_ENCODE_OUT_PARAMS bitstreamSizeInBytes(int setter); + /** [out]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_ENCODE_OUT_PARAMS reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_EVENT_PARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_EVENT_PARAMS.java new file mode 100644 index 00000000000..f97d4137db9 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_EVENT_PARAMS.java @@ -0,0 +1,52 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * Event registration/unregistration parameters. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_EVENT_PARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_EVENT_PARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_EVENT_PARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_EVENT_PARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_EVENT_PARAMS position(long position) { + return (NV_ENC_EVENT_PARAMS)super.position(position); + } + @Override public NV_ENC_EVENT_PARAMS getPointer(long i) { + return new NV_ENC_EVENT_PARAMS((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_EVENT_PARAMS_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_EVENT_PARAMS version(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(); public native NV_ENC_EVENT_PARAMS reserved(int setter); + /** [in]: Handle to event to be registered/unregistered with the NvEncodeAPI interface. */ + public native Pointer completionEvent(); public native NV_ENC_EVENT_PARAMS completionEvent(Pointer setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_EVENT_PARAMS reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_EVENT_PARAMS reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_H264_MV_DATA.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_H264_MV_DATA.java new file mode 100644 index 00000000000..43570aa33a1 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_H264_MV_DATA.java @@ -0,0 +1,49 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * Motion vector structure per macroblock for H264 motion estimation. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_H264_MV_DATA extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_H264_MV_DATA() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_H264_MV_DATA(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_H264_MV_DATA(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_H264_MV_DATA position(long position) { + return (NV_ENC_H264_MV_DATA)super.position(position); + } + @Override public NV_ENC_H264_MV_DATA getPointer(long i) { + return new NV_ENC_H264_MV_DATA((Pointer)this).position(position + i); + } + + /** up to 4 vectors for 8x8 partition */ + public native @ByRef NV_ENC_MVECTOR mv(int i); public native NV_ENC_H264_MV_DATA mv(int i, NV_ENC_MVECTOR setter); + @MemberGetter public native NV_ENC_MVECTOR mv(); + /** 0 (I), 1 (P), 2 (IPCM), 3 (B) */ + public native @Cast("uint8_t") byte mbType(); public native NV_ENC_H264_MV_DATA mbType(byte setter); + /** Specifies the block partition type. 0:16x16, 1:8x8, 2:16x8, 3:8x16 */ + public native @Cast("uint8_t") byte partitionType(); public native NV_ENC_H264_MV_DATA partitionType(byte setter); + /** reserved padding for alignment */ + public native @Cast("uint16_t") short reserved(); public native NV_ENC_H264_MV_DATA reserved(short setter); + public native @Cast("uint32_t") int mbCost(); public native NV_ENC_H264_MV_DATA mbCost(int setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_HEVC_MV_DATA.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_HEVC_MV_DATA.java new file mode 100644 index 00000000000..4e7a7753624 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_HEVC_MV_DATA.java @@ -0,0 +1,52 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * Motion vector structure per CU for HEVC motion estimation. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_HEVC_MV_DATA extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_HEVC_MV_DATA() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_HEVC_MV_DATA(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_HEVC_MV_DATA(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_HEVC_MV_DATA position(long position) { + return (NV_ENC_HEVC_MV_DATA)super.position(position); + } + @Override public NV_ENC_HEVC_MV_DATA getPointer(long i) { + return new NV_ENC_HEVC_MV_DATA((Pointer)this).position(position + i); + } + + /** up to 4 vectors within a CU */ + public native @ByRef NV_ENC_MVECTOR mv(int i); public native NV_ENC_HEVC_MV_DATA mv(int i, NV_ENC_MVECTOR setter); + @MemberGetter public native NV_ENC_MVECTOR mv(); + /** 0 (I), 1(P) */ + public native @Cast("uint8_t") byte cuType(); public native NV_ENC_HEVC_MV_DATA cuType(byte setter); + /** 0: 8x8, 1: 16x16, 2: 32x32, 3: 64x64 */ + public native @Cast("uint8_t") byte cuSize(); public native NV_ENC_HEVC_MV_DATA cuSize(byte setter); + /** The CU partition mode + 0 (2Nx2N), 1 (2NxN), 2(Nx2N), 3 (NxN), + 4 (2NxnU), 5 (2NxnD), 6(nLx2N), 7 (nRx2N) */ + public native @Cast("uint8_t") byte partitionMode(); public native NV_ENC_HEVC_MV_DATA partitionMode(byte setter); + /** Marker to separate CUs in the current CTB from CUs in the next CTB */ + public native @Cast("uint8_t") byte lastCUInCTB(); public native NV_ENC_HEVC_MV_DATA lastCUInCTB(byte setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INITIALIZE_PARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INITIALIZE_PARAMS.java new file mode 100644 index 00000000000..050fcee5070 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INITIALIZE_PARAMS.java @@ -0,0 +1,108 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_INITIALIZE_PARAMS + * Encode Session Initialization parameters. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_INITIALIZE_PARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_INITIALIZE_PARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_INITIALIZE_PARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_INITIALIZE_PARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_INITIALIZE_PARAMS position(long position) { + return (NV_ENC_INITIALIZE_PARAMS)super.position(position); + } + @Override public NV_ENC_INITIALIZE_PARAMS getPointer(long i) { + return new NV_ENC_INITIALIZE_PARAMS((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_INITIALIZE_PARAMS_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_INITIALIZE_PARAMS version(int setter); + /** [in]: Specifies the Encode GUID for which the encoder is being created. ::NvEncInitializeEncoder() API will fail if this is not set, or set to unsupported value. */ + public native @ByRef GUID encodeGUID(); public native NV_ENC_INITIALIZE_PARAMS encodeGUID(GUID setter); + /** [in]: Specifies the preset for encoding. If the preset GUID is set then , the preset configuration will be applied before any other parameter. */ + public native @ByRef GUID presetGUID(); public native NV_ENC_INITIALIZE_PARAMS presetGUID(GUID setter); + /** [in]: Specifies the encode width. If not set ::NvEncInitializeEncoder() API will fail. */ + public native @Cast("uint32_t") int encodeWidth(); public native NV_ENC_INITIALIZE_PARAMS encodeWidth(int setter); + /** [in]: Specifies the encode height. If not set ::NvEncInitializeEncoder() API will fail. */ + public native @Cast("uint32_t") int encodeHeight(); public native NV_ENC_INITIALIZE_PARAMS encodeHeight(int setter); + /** [in]: Specifies the display aspect ratio Width. */ + public native @Cast("uint32_t") int darWidth(); public native NV_ENC_INITIALIZE_PARAMS darWidth(int setter); + /** [in]: Specifies the display aspect ratio height. */ + public native @Cast("uint32_t") int darHeight(); public native NV_ENC_INITIALIZE_PARAMS darHeight(int setter); + /** [in]: Specifies the numerator for frame rate used for encoding in frames per second ( Frame rate = frameRateNum / frameRateDen ). */ + public native @Cast("uint32_t") int frameRateNum(); public native NV_ENC_INITIALIZE_PARAMS frameRateNum(int setter); + /** [in]: Specifies the denominator for frame rate used for encoding in frames per second ( Frame rate = frameRateNum / frameRateDen ). */ + public native @Cast("uint32_t") int frameRateDen(); public native NV_ENC_INITIALIZE_PARAMS frameRateDen(int setter); + /** [in]: Set this to 1 to enable asynchronous mode and is expected to use events to get picture completion notification. */ + public native @Cast("uint32_t") int enableEncodeAsync(); public native NV_ENC_INITIALIZE_PARAMS enableEncodeAsync(int setter); + /** [in]: Set this to 1 to enable the Picture Type Decision is be taken by the NvEncodeAPI interface. */ + public native @Cast("uint32_t") int enablePTD(); public native NV_ENC_INITIALIZE_PARAMS enablePTD(int setter); + /** [in]: Set this to 1 to enable reporting slice offsets in ::_NV_ENC_LOCK_BITSTREAM. NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync must be set to 0 to use this feature. Client must set this to 0 if NV_ENC_CONFIG_H264::sliceMode is 1 on Kepler GPUs */ + public native @Cast("uint32_t") @NoOffset int reportSliceOffsets(); public native NV_ENC_INITIALIZE_PARAMS reportSliceOffsets(int setter); + /** [in]: Set this to 1 to write out available bitstream to memory at subframe intervals. + If enableSubFrameWrite = 1, then the hardware encoder returns data as soon as a slice has completed encoding. + This results in better encoding latency, but the downside is that the application has to keep polling via a call to nvEncLockBitstream API continuously to see if any encoded slice data is available. + Use this mode if you feel that the marginal reduction in latency from sub-frame encoding is worth the increase in complexity due to CPU-based polling. */ + public native @Cast("uint32_t") @NoOffset int enableSubFrameWrite(); public native NV_ENC_INITIALIZE_PARAMS enableSubFrameWrite(int setter); + /** [in]: Set to 1 to enable external ME hints for the current frame. For NV_ENC_INITIALIZE_PARAMS::enablePTD=1 with B frames, programming L1 hints is optional for B frames since Client doesn't know internal GOP structure. + NV_ENC_PIC_PARAMS::meHintRefPicDist should preferably be set with enablePTD=1. */ + public native @Cast("uint32_t") @NoOffset int enableExternalMEHints(); public native NV_ENC_INITIALIZE_PARAMS enableExternalMEHints(int setter); + /** [in]: Set to 1 to enable ME Only Mode .*/ + public native @Cast("uint32_t") @NoOffset int enableMEOnlyMode(); public native NV_ENC_INITIALIZE_PARAMS enableMEOnlyMode(int setter); + /** [in]: Set this to 1 to enable weighted prediction. Not supported if encode session is configured for B-Frames (i.e. NV_ENC_CONFIG::frameIntervalP > 1 or preset >=P3 when tuningInfo = ::NV_ENC_TUNING_INFO_HIGH_QUALITY or + tuningInfo = ::NV_ENC_TUNING_INFO_LOSSLESS. This is because preset >=p3 internally enables B frames when tuningInfo = ::NV_ENC_TUNING_INFO_HIGH_QUALITY or ::NV_ENC_TUNING_INFO_LOSSLESS). */ + public native @Cast("uint32_t") @NoOffset int enableWeightedPrediction(); public native NV_ENC_INITIALIZE_PARAMS enableWeightedPrediction(int setter); + /** [in]: Set this to 1 to enable output of NVENC in video memory buffer created by application. This feature is not supported for HEVC ME only mode. */ + public native @Cast("uint32_t") @NoOffset int enableOutputInVidmem(); public native NV_ENC_INITIALIZE_PARAMS enableOutputInVidmem(int setter); + /** [in]: Reserved bitfields and must be set to 0 */ + public native @Cast("uint32_t") @NoOffset int reservedBitFields(); public native NV_ENC_INITIALIZE_PARAMS reservedBitFields(int setter); + /** [in]: Reserved private data buffer size and must be set to 0 */ + public native @Cast("uint32_t") int privDataSize(); public native NV_ENC_INITIALIZE_PARAMS privDataSize(int setter); + /** [in]: Reserved private data buffer and must be set to NULL */ + public native Pointer privData(); public native NV_ENC_INITIALIZE_PARAMS privData(Pointer setter); + /** [in]: Specifies the advanced codec specific structure. If client has sent a valid codec config structure, it will override parameters set by the NV_ENC_INITIALIZE_PARAMS::presetGUID parameter. If set to NULL the NvEncodeAPI interface will use the NV_ENC_INITIALIZE_PARAMS::presetGUID to set the codec specific parameters. + Client can also optionally query the NvEncodeAPI interface to get codec specific parameters for a presetGUID using ::NvEncGetEncodePresetConfig() API. It can then modify (if required) some of the codec config parameters and send down a custom config structure as part of ::_NV_ENC_INITIALIZE_PARAMS. + Even in this case client is recommended to pass the same preset guid it has used in ::NvEncGetEncodePresetConfig() API to query the config structure; as NV_ENC_INITIALIZE_PARAMS::presetGUID. This will not override the custom config structure but will be used to determine other Encoder HW specific parameters not exposed in the API. */ + public native NV_ENC_CONFIG encodeConfig(); public native NV_ENC_INITIALIZE_PARAMS encodeConfig(NV_ENC_CONFIG setter); + /** [in]: Maximum encode width to be used for current Encode session. + Client should allocate output buffers according to this dimension for dynamic resolution change. If set to 0, Encoder will not allow dynamic resolution change. */ + public native @Cast("uint32_t") int maxEncodeWidth(); public native NV_ENC_INITIALIZE_PARAMS maxEncodeWidth(int setter); + /** [in]: Maximum encode height to be allowed for current Encode session. + Client should allocate output buffers according to this dimension for dynamic resolution change. If set to 0, Encode will not allow dynamic resolution change. */ + public native @Cast("uint32_t") int maxEncodeHeight(); public native NV_ENC_INITIALIZE_PARAMS maxEncodeHeight(int setter); + /** [in]: If Client wants to pass external motion vectors in NV_ENC_PIC_PARAMS::meExternalHints buffer it must specify the maximum number of hint candidates per block per direction for the encode session. + The NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[0] is for L0 predictors and NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[1] is for L1 predictors. + This client must also set NV_ENC_INITIALIZE_PARAMS::enableExternalMEHints to 1. */ + public native @ByRef NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE maxMEHintCountsPerBlock(int i); public native NV_ENC_INITIALIZE_PARAMS maxMEHintCountsPerBlock(int i, NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE setter); + @MemberGetter public native NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE maxMEHintCountsPerBlock(); + /** [in]: Tuning Info of NVENC encoding(TuningInfo is not applicable to H264 and HEVC meonly mode). */ + public native @Cast("NV_ENC_TUNING_INFO") int tuningInfo(); public native NV_ENC_INITIALIZE_PARAMS tuningInfo(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_INITIALIZE_PARAMS reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_INITIALIZE_PARAMS reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INPUT_PTR.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INPUT_PTR.java new file mode 100644 index 00000000000..f23b3916146 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INPUT_PTR.java @@ -0,0 +1,29 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +// #endif // _WIN32 + +/** \} */ /* End of GUID and NVENC_RECT structure grouping*/ + +/** NVENCODE API input buffer */ +@Namespace @Name("void") @Opaque @Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_INPUT_PTR extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public NV_ENC_INPUT_PTR() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_INPUT_PTR(Pointer p) { super(p); } +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INPUT_RESOURCE_OPENGL_TEX.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INPUT_RESOURCE_OPENGL_TEX.java new file mode 100644 index 00000000000..027f9c5eeb9 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_INPUT_RESOURCE_OPENGL_TEX.java @@ -0,0 +1,45 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_INPUT_RESOURCE_OPENGL_TEX + * NV_ENC_REGISTER_RESOURCE::resourceToRegister must be a pointer to a variable of this type, + * when NV_ENC_REGISTER_RESOURCE::resourceType is NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_INPUT_RESOURCE_OPENGL_TEX extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_INPUT_RESOURCE_OPENGL_TEX() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_INPUT_RESOURCE_OPENGL_TEX(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_INPUT_RESOURCE_OPENGL_TEX(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_INPUT_RESOURCE_OPENGL_TEX position(long position) { + return (NV_ENC_INPUT_RESOURCE_OPENGL_TEX)super.position(position); + } + @Override public NV_ENC_INPUT_RESOURCE_OPENGL_TEX getPointer(long i) { + return new NV_ENC_INPUT_RESOURCE_OPENGL_TEX((Pointer)this).position(position + i); + } + + /** [in]: The name of the texture to be used. */ + public native @Cast("uint32_t") int texture(); public native NV_ENC_INPUT_RESOURCE_OPENGL_TEX texture(int setter); + /** [in]: Accepted values are GL_TEXTURE_RECTANGLE and GL_TEXTURE_2D. */ + public native @Cast("uint32_t") int target(); public native NV_ENC_INPUT_RESOURCE_OPENGL_TEX target(int setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_LOCK_BITSTREAM.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_LOCK_BITSTREAM.java new file mode 100644 index 00000000000..9b64660483f --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_LOCK_BITSTREAM.java @@ -0,0 +1,104 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NV_ENC_LOCK_BITSTREAM + * Bitstream buffer lock parameters. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_LOCK_BITSTREAM extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_LOCK_BITSTREAM() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_LOCK_BITSTREAM(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_LOCK_BITSTREAM(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_LOCK_BITSTREAM position(long position) { + return (NV_ENC_LOCK_BITSTREAM)super.position(position); + } + @Override public NV_ENC_LOCK_BITSTREAM getPointer(long i) { + return new NV_ENC_LOCK_BITSTREAM((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_LOCK_BITSTREAM_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_LOCK_BITSTREAM version(int setter); + /** [in]: If this flag is set, the NvEncodeAPI interface will return buffer pointer even if operation is not completed. If not set, the call will block until operation completes. */ + public native @Cast("uint32_t") @NoOffset int doNotWait(); public native NV_ENC_LOCK_BITSTREAM doNotWait(int setter); + /** [out]: Flag indicating this frame is marked as LTR frame */ + public native @Cast("uint32_t") @NoOffset int ltrFrame(); public native NV_ENC_LOCK_BITSTREAM ltrFrame(int setter); + /** [in]: If this flag is set then lockBitstream call will add additional intra-inter MB count and average MVX, MVY */ + public native @Cast("uint32_t") @NoOffset int getRCStats(); public native NV_ENC_LOCK_BITSTREAM getRCStats(int setter); + /** [in]: Reserved bit fields and must be set to 0 */ + public native @Cast("uint32_t") @NoOffset int reservedBitFields(); public native NV_ENC_LOCK_BITSTREAM reservedBitFields(int setter); + /** [in]: Pointer to the bitstream buffer being locked. */ + public native Pointer outputBitstream(); public native NV_ENC_LOCK_BITSTREAM outputBitstream(Pointer setter); + /** [in, out]: Array which receives the slice offsets. This is not supported if NV_ENC_CONFIG_H264::sliceMode is 1 on Kepler GPUs. Array size must be equal to size of frame in MBs. */ + public native @Cast("uint32_t*") IntPointer sliceOffsets(); public native NV_ENC_LOCK_BITSTREAM sliceOffsets(IntPointer setter); + /** [out]: Frame no. for which the bitstream is being retrieved. */ + public native @Cast("uint32_t") int frameIdx(); public native NV_ENC_LOCK_BITSTREAM frameIdx(int setter); + /** [out]: The NvEncodeAPI interface status for the locked picture. */ + public native @Cast("uint32_t") int hwEncodeStatus(); public native NV_ENC_LOCK_BITSTREAM hwEncodeStatus(int setter); + /** [out]: Number of slices in the encoded picture. Will be reported only if NV_ENC_INITIALIZE_PARAMS::reportSliceOffsets set to 1. */ + public native @Cast("uint32_t") int numSlices(); public native NV_ENC_LOCK_BITSTREAM numSlices(int setter); + /** [out]: Actual number of bytes generated and copied to the memory pointed by bitstreamBufferPtr. + When HEVC alpha layer encoding is enabled, this field reports the total encoded size in bytes i.e it is the encoded size of the base plus the alpha layer. */ + public native @Cast("uint32_t") int bitstreamSizeInBytes(); public native NV_ENC_LOCK_BITSTREAM bitstreamSizeInBytes(int setter); + /** [out]: Presentation timestamp associated with the encoded output. */ + public native @Cast("uint64_t") int outputTimeStamp(); public native NV_ENC_LOCK_BITSTREAM outputTimeStamp(int setter); + /** [out]: Presentation duration associates with the encoded output. */ + public native @Cast("uint64_t") int outputDuration(); public native NV_ENC_LOCK_BITSTREAM outputDuration(int setter); + /** [out]: Pointer to the generated output bitstream. + For MEOnly mode _NV_ENC_LOCK_BITSTREAM::bitstreamBufferPtr should be typecast to + NV_ENC_H264_MV_DATA/NV_ENC_HEVC_MV_DATA pointer respectively for H264/HEVC */ + public native Pointer bitstreamBufferPtr(); public native NV_ENC_LOCK_BITSTREAM bitstreamBufferPtr(Pointer setter); + /** [out]: Picture type of the encoded picture. */ + public native @Cast("NV_ENC_PIC_TYPE") int pictureType(); public native NV_ENC_LOCK_BITSTREAM pictureType(int setter); + /** [out]: Structure of the generated output picture. */ + public native @Cast("NV_ENC_PIC_STRUCT") int pictureStruct(); public native NV_ENC_LOCK_BITSTREAM pictureStruct(int setter); + /** [out]: Average QP of the frame. */ + public native @Cast("uint32_t") int frameAvgQP(); public native NV_ENC_LOCK_BITSTREAM frameAvgQP(int setter); + /** [out]: Total SATD cost for whole frame. */ + public native @Cast("uint32_t") int frameSatd(); public native NV_ENC_LOCK_BITSTREAM frameSatd(int setter); + /** [out]: Frame index associated with this LTR frame. */ + public native @Cast("uint32_t") int ltrFrameIdx(); public native NV_ENC_LOCK_BITSTREAM ltrFrameIdx(int setter); + /** [out]: Bitmap of LTR frames indices which were used for encoding this frame. Value of 0 if no LTR frames were used. */ + public native @Cast("uint32_t") int ltrFrameBitmap(); public native NV_ENC_LOCK_BITSTREAM ltrFrameBitmap(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_LOCK_BITSTREAM reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); + /** [out]: For H264, Number of Intra MBs in the encoded frame. For HEVC, Number of Intra CTBs in the encoded frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */ + public native @Cast("uint32_t") int intraMBCount(); public native NV_ENC_LOCK_BITSTREAM intraMBCount(int setter); + /** [out]: For H264, Number of Inter MBs in the encoded frame, includes skip MBs. For HEVC, Number of Inter CTBs in the encoded frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */ + public native @Cast("uint32_t") int interMBCount(); public native NV_ENC_LOCK_BITSTREAM interMBCount(int setter); + /** [out]: Average Motion Vector in X direction for the encoded frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */ + public native @Cast("int32_t") int averageMVX(); public native NV_ENC_LOCK_BITSTREAM averageMVX(int setter); + /** [out]: Average Motion Vector in y direction for the encoded frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */ + public native @Cast("int32_t") int averageMVY(); public native NV_ENC_LOCK_BITSTREAM averageMVY(int setter); + /** [out]: Number of bytes generated for the alpha layer in the encoded output. Applicable only when HEVC with alpha encoding is enabled. */ + public native @Cast("uint32_t") int alphaLayerSizeInBytes(); public native NV_ENC_LOCK_BITSTREAM alphaLayerSizeInBytes(int setter); + + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_LOCK_BITSTREAM reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_LOCK_BITSTREAM reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_LOCK_INPUT_BUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_LOCK_INPUT_BUFFER.java new file mode 100644 index 00000000000..b05f335fa4e --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_LOCK_INPUT_BUFFER.java @@ -0,0 +1,59 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NV_ENC_LOCK_INPUT_BUFFER + * Uncompressed Input Buffer lock parameters. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_LOCK_INPUT_BUFFER extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_LOCK_INPUT_BUFFER() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_LOCK_INPUT_BUFFER(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_LOCK_INPUT_BUFFER(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_LOCK_INPUT_BUFFER position(long position) { + return (NV_ENC_LOCK_INPUT_BUFFER)super.position(position); + } + @Override public NV_ENC_LOCK_INPUT_BUFFER getPointer(long i) { + return new NV_ENC_LOCK_INPUT_BUFFER((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_LOCK_INPUT_BUFFER_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_LOCK_INPUT_BUFFER version(int setter); + /** [in]: Set to 1 to make ::NvEncLockInputBuffer() a unblocking call. If the encoding is not completed, driver will return ::NV_ENC_ERR_ENCODER_BUSY error code. */ + public native @Cast("uint32_t") @NoOffset int doNotWait(); public native NV_ENC_LOCK_INPUT_BUFFER doNotWait(int setter); + /** [in]: Reserved bitfields and must be set to 0 */ + public native @Cast("uint32_t") @NoOffset int reservedBitFields(); public native NV_ENC_LOCK_INPUT_BUFFER reservedBitFields(int setter); + /** [in]: Pointer to the input buffer to be locked, client should pass the pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource API. */ + public native NV_ENC_INPUT_PTR inputBuffer(); public native NV_ENC_LOCK_INPUT_BUFFER inputBuffer(NV_ENC_INPUT_PTR setter); + /** [out]: Pointed to the locked input buffer data. Client can only access input buffer using the \p bufferDataPtr. */ + public native Pointer bufferDataPtr(); public native NV_ENC_LOCK_INPUT_BUFFER bufferDataPtr(Pointer setter); + /** [out]: Pitch of the locked input buffer. */ + public native @Cast("uint32_t") int pitch(); public native NV_ENC_LOCK_INPUT_BUFFER pitch(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_LOCK_INPUT_BUFFER reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_LOCK_INPUT_BUFFER reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MAP_INPUT_RESOURCE.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MAP_INPUT_RESOURCE.java new file mode 100644 index 00000000000..b629c3884b2 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MAP_INPUT_RESOURCE.java @@ -0,0 +1,59 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NV_ENC_MAP_INPUT_RESOURCE + * Map an input resource to a Nvidia Encoder Input Buffer + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_MAP_INPUT_RESOURCE extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_MAP_INPUT_RESOURCE() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_MAP_INPUT_RESOURCE(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_MAP_INPUT_RESOURCE(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_MAP_INPUT_RESOURCE position(long position) { + return (NV_ENC_MAP_INPUT_RESOURCE)super.position(position); + } + @Override public NV_ENC_MAP_INPUT_RESOURCE getPointer(long i) { + return new NV_ENC_MAP_INPUT_RESOURCE((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_MAP_INPUT_RESOURCE_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_MAP_INPUT_RESOURCE version(int setter); + /** [in]: Deprecated. Do not use. */ + public native @Cast("uint32_t") int subResourceIndex(); public native NV_ENC_MAP_INPUT_RESOURCE subResourceIndex(int setter); + /** [in]: Deprecated. Do not use. */ + public native Pointer inputResource(); public native NV_ENC_MAP_INPUT_RESOURCE inputResource(Pointer setter); + /** [in]: The Registered resource handle obtained by calling NvEncRegisterInputResource. */ + public native NV_ENC_REGISTERED_PTR registeredResource(); public native NV_ENC_MAP_INPUT_RESOURCE registeredResource(NV_ENC_REGISTERED_PTR setter); + /** [out]: Mapped pointer corresponding to the registeredResource. This pointer must be used in NV_ENC_PIC_PARAMS::inputBuffer parameter in ::NvEncEncodePicture() API. */ + public native NV_ENC_INPUT_PTR mappedResource(); public native NV_ENC_MAP_INPUT_RESOURCE mappedResource(NV_ENC_INPUT_PTR setter); + /** [out]: Buffer format of the outputResource. This buffer format must be used in NV_ENC_PIC_PARAMS::bufferFmt if client using the above mapped resource pointer. */ + public native @Cast("NV_ENC_BUFFER_FORMAT") int mappedBufferFmt(); public native NV_ENC_MAP_INPUT_RESOURCE mappedBufferFmt(int setter); + /** [in]: Reserved and must be set to 0. */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_MAP_INPUT_RESOURCE reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_MAP_INPUT_RESOURCE reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MEONLY_PARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MEONLY_PARAMS.java new file mode 100644 index 00000000000..f0fe49bf401 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MEONLY_PARAMS.java @@ -0,0 +1,82 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NV_ENC_MEONLY_PARAMS + * MEOnly parameters that need to be sent on a per motion estimation basis. + * NV_ENC_MEONLY_PARAMS::meExternalHints is supported for H264 only. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_MEONLY_PARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_MEONLY_PARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_MEONLY_PARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_MEONLY_PARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_MEONLY_PARAMS position(long position) { + return (NV_ENC_MEONLY_PARAMS)super.position(position); + } + @Override public NV_ENC_MEONLY_PARAMS getPointer(long i) { + return new NV_ENC_MEONLY_PARAMS((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to NV_ENC_MEONLY_PARAMS_VER.*/ + public native @Cast("uint32_t") int version(); public native NV_ENC_MEONLY_PARAMS version(int setter); + /** [in]: Specifies the input frame width */ + public native @Cast("uint32_t") int inputWidth(); public native NV_ENC_MEONLY_PARAMS inputWidth(int setter); + /** [in]: Specifies the input frame height */ + public native @Cast("uint32_t") int inputHeight(); public native NV_ENC_MEONLY_PARAMS inputHeight(int setter); + /** [in]: Specifies the input buffer pointer. Client must use a pointer obtained from NvEncCreateInputBuffer() or NvEncMapInputResource() APIs. */ + public native NV_ENC_INPUT_PTR inputBuffer(); public native NV_ENC_MEONLY_PARAMS inputBuffer(NV_ENC_INPUT_PTR setter); + /** [in]: Specifies the reference frame pointer */ + public native NV_ENC_INPUT_PTR referenceFrame(); public native NV_ENC_MEONLY_PARAMS referenceFrame(NV_ENC_INPUT_PTR setter); + /** [in]: Specifies the output buffer pointer. + If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 0, specifies the pointer to motion vector data buffer allocated by NvEncCreateMVBuffer. + Client must lock mvBuffer using ::NvEncLockBitstream() API to get the motion vector data. + If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 1, client should allocate buffer in video memory for storing the motion vector data. The size of this buffer must + be equal to total number of macroblocks multiplied by size of NV_ENC_H264_MV_DATA struct. Client should use a pointer obtained from ::NvEncMapInputResource() API, when mapping this + output buffer and assign it to NV_ENC_MEONLY_PARAMS::mvBuffer. All CUDA operations on this buffer must use the default stream. */ + public native NV_ENC_OUTPUT_PTR mvBuffer(); public native NV_ENC_MEONLY_PARAMS mvBuffer(NV_ENC_OUTPUT_PTR setter); + /** [in]: Specifies the input buffer format. */ + public native @Cast("NV_ENC_BUFFER_FORMAT") int bufferFmt(); public native NV_ENC_MEONLY_PARAMS bufferFmt(int setter); + /** [in]: Specifies an event to be signaled on completion of motion estimation + of this Frame [only if operating in Asynchronous mode]. + Each output buffer should be associated with a distinct event pointer. */ + public native Pointer completionEvent(); public native NV_ENC_MEONLY_PARAMS completionEvent(Pointer setter); + /** [in]: Specifies left or right viewID if NV_ENC_CONFIG_H264_MEONLY::bStereoEnable is set. + viewID can be 0,1 if bStereoEnable is set, 0 otherwise. */ + public native @Cast("uint32_t") int viewID(); public native NV_ENC_MEONLY_PARAMS viewID(int setter); + /** [in]: Specifies the number of hint candidates per block for the current frame. meHintCountsPerBlock[0] is for L0 predictors. + The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder initialization. */ + public native @ByRef NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE meHintCountsPerBlock(int i); public native NV_ENC_MEONLY_PARAMS meHintCountsPerBlock(int i, NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE setter); + @MemberGetter public native NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE meHintCountsPerBlock(); + /** [in]: Specifies the pointer to ME external hints for the current frame. The size of ME hint buffer should be equal to number of macroblocks * the total number of candidates per macroblock. + The total number of candidates per MB per direction = 1*meHintCountsPerBlock[Lx].numCandsPerBlk16x16 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk16x8 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk8x8 + + 4*meHintCountsPerBlock[Lx].numCandsPerBlk8x8. For frames using bidirectional ME , the total number of candidates for single macroblock is sum of total number of candidates per MB for each direction (L0 and L1) */ + public native NVENC_EXTERNAL_ME_HINT meExternalHints(); public native NV_ENC_MEONLY_PARAMS meExternalHints(NVENC_EXTERNAL_ME_HINT setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_MEONLY_PARAMS reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_MEONLY_PARAMS reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MVECTOR.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MVECTOR.java new file mode 100644 index 00000000000..be6e218633a --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_MVECTOR.java @@ -0,0 +1,43 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * Structs needed for ME only mode. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_MVECTOR extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_MVECTOR() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_MVECTOR(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_MVECTOR(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_MVECTOR position(long position) { + return (NV_ENC_MVECTOR)super.position(position); + } + @Override public NV_ENC_MVECTOR getPointer(long i) { + return new NV_ENC_MVECTOR((Pointer)this).position(position + i); + } + + /** the x component of MV in quarter-pel units */ + public native @Cast("int16_t") short mvx(); public native NV_ENC_MVECTOR mvx(short setter); + /** the y component of MV in quarter-pel units */ + public native @Cast("int16_t") short mvy(); public native NV_ENC_MVECTOR mvy(short setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.java new file mode 100644 index 00000000000..f079c41bdde --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.java @@ -0,0 +1,55 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * Encoder Session Creation parameters + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS position(long position) { + return (NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS)super.position(position); + } + @Override public NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS getPointer(long i) { + return new NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS version(int setter); + /** [in]: Specified the device Type */ + public native @Cast("NV_ENC_DEVICE_TYPE") int deviceType(); public native NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS deviceType(int setter); + /** [in]: Pointer to client device. */ + public native Pointer device(); public native NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS device(Pointer setter); + /** [in]: Reserved and must be set to 0. */ + public native Pointer reserved(); public native NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS reserved(Pointer setter); + /** [in]: API version. Should be set to NVENCAPI_VERSION. */ + public native @Cast("uint32_t") int apiVersion(); public native NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS apiVersion(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_OUTPUT_PTR.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_OUTPUT_PTR.java new file mode 100644 index 00000000000..faed59daa76 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_OUTPUT_PTR.java @@ -0,0 +1,24 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +/** NVENCODE API output buffer*/ +@Namespace @Name("void") @Opaque @Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_OUTPUT_PTR extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public NV_ENC_OUTPUT_PTR() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_OUTPUT_PTR(Pointer p) { super(p); } +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS.java new file mode 100644 index 00000000000..03dba57189f --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS.java @@ -0,0 +1,116 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_PIC_PARAMS + * Encoding parameters that need to be sent on a per frame basis. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_PIC_PARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_PIC_PARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_PIC_PARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_PIC_PARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_PIC_PARAMS position(long position) { + return (NV_ENC_PIC_PARAMS)super.position(position); + } + @Override public NV_ENC_PIC_PARAMS getPointer(long i) { + return new NV_ENC_PIC_PARAMS((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_PIC_PARAMS_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_PIC_PARAMS version(int setter); + /** [in]: Specifies the input frame width */ + public native @Cast("uint32_t") int inputWidth(); public native NV_ENC_PIC_PARAMS inputWidth(int setter); + /** [in]: Specifies the input frame height */ + public native @Cast("uint32_t") int inputHeight(); public native NV_ENC_PIC_PARAMS inputHeight(int setter); + /** [in]: Specifies the input buffer pitch. If pitch value is not known, set this to inputWidth. */ + public native @Cast("uint32_t") int inputPitch(); public native NV_ENC_PIC_PARAMS inputPitch(int setter); + /** [in]: Specifies bit-wise OR of encode picture flags. See ::NV_ENC_PIC_FLAGS enum. */ + public native @Cast("uint32_t") int encodePicFlags(); public native NV_ENC_PIC_PARAMS encodePicFlags(int setter); + /** [in]: Specifies the frame index associated with the input frame [optional]. */ + public native @Cast("uint32_t") int frameIdx(); public native NV_ENC_PIC_PARAMS frameIdx(int setter); + /** [in]: Specifies opaque data which is associated with the encoded frame, but not actually encoded in the output bitstream. + This opaque data can be used later to uniquely refer to the corresponding encoded frame. For example, it can be used + for identifying the frame to be invalidated in the reference picture buffer, if lost at the client. */ + public native @Cast("uint64_t") int inputTimeStamp(); public native NV_ENC_PIC_PARAMS inputTimeStamp(int setter); + /** [in]: Specifies duration of the input picture */ + public native @Cast("uint64_t") int inputDuration(); public native NV_ENC_PIC_PARAMS inputDuration(int setter); + /** [in]: Specifies the input buffer pointer. Client must use a pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource() APIs.*/ + public native NV_ENC_INPUT_PTR inputBuffer(); public native NV_ENC_PIC_PARAMS inputBuffer(NV_ENC_INPUT_PTR setter); + /** [in]: Specifies the output buffer pointer. + If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 0, specifies the pointer to output buffer. Client should use a pointer obtained from ::NvEncCreateBitstreamBuffer() API. + If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 1, client should allocate buffer in video memory for NV_ENC_ENCODE_OUT_PARAMS struct and encoded bitstream data. Client + should use a pointer obtained from ::NvEncMapInputResource() API, when mapping this output buffer and assign it to NV_ENC_PIC_PARAMS::outputBitstream. + First 256 bytes of this buffer should be interpreted as NV_ENC_ENCODE_OUT_PARAMS struct followed by encoded bitstream data. Recommended size for output buffer is sum of size of + NV_ENC_ENCODE_OUT_PARAMS struct and twice the input frame size for lower resolution eg. CIF and 1.5 times the input frame size for higher resolutions. If encoded bitstream size is + greater than the allocated buffer size for encoded bitstream, then the output buffer will have encoded bitstream data equal to buffer size. All CUDA operations on this buffer must use + the default stream. */ + public native NV_ENC_OUTPUT_PTR outputBitstream(); public native NV_ENC_PIC_PARAMS outputBitstream(NV_ENC_OUTPUT_PTR setter); + /** [in]: Specifies an event to be signaled on completion of encoding of this Frame [only if operating in Asynchronous mode]. Each output buffer should be associated with a distinct event pointer. */ + public native Pointer completionEvent(); public native NV_ENC_PIC_PARAMS completionEvent(Pointer setter); + /** [in]: Specifies the input buffer format. */ + public native @Cast("NV_ENC_BUFFER_FORMAT") int bufferFmt(); public native NV_ENC_PIC_PARAMS bufferFmt(int setter); + /** [in]: Specifies structure of the input picture. */ + public native @Cast("NV_ENC_PIC_STRUCT") int pictureStruct(); public native NV_ENC_PIC_PARAMS pictureStruct(int setter); + /** [in]: Specifies input picture type. Client required to be set explicitly by the client if the client has not set NV_ENC_INITALIZE_PARAMS::enablePTD to 1 while calling NvInitializeEncoder. */ + public native @Cast("NV_ENC_PIC_TYPE") int pictureType(); public native NV_ENC_PIC_PARAMS pictureType(int setter); + /** [in]: Specifies the codec specific per-picture encoding parameters. */ + public native @ByRef NV_ENC_CODEC_PIC_PARAMS codecPicParams(); public native NV_ENC_PIC_PARAMS codecPicParams(NV_ENC_CODEC_PIC_PARAMS setter); + /** [in]: Specifies the number of hint candidates per block per direction for the current frame. meHintCountsPerBlock[0] is for L0 predictors and meHintCountsPerBlock[1] is for L1 predictors. + The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder initialization. */ + public native @ByRef NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE meHintCountsPerBlock(int i); public native NV_ENC_PIC_PARAMS meHintCountsPerBlock(int i, NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE setter); + @MemberGetter public native NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE meHintCountsPerBlock(); + /** [in]: Specifies the pointer to ME external hints for the current frame. The size of ME hint buffer should be equal to number of macroblocks * the total number of candidates per macroblock. + The total number of candidates per MB per direction = 1*meHintCountsPerBlock[Lx].numCandsPerBlk16x16 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk16x8 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk8x8 + + 4*meHintCountsPerBlock[Lx].numCandsPerBlk8x8. For frames using bidirectional ME , the total number of candidates for single macroblock is sum of total number of candidates per MB for each direction (L0 and L1) */ + public native NVENC_EXTERNAL_ME_HINT meExternalHints(); public native NV_ENC_PIC_PARAMS meExternalHints(NVENC_EXTERNAL_ME_HINT setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_PIC_PARAMS reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_PIC_PARAMS reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); + /** [in]: Specifies the pointer to signed byte array containing value per MB for H264 and per CTB for HEVC in raster scan order for the current picture, which will be interpreted depending on NV_ENC_RC_PARAMS::qpMapMode. + If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_DELTA, qpDeltaMap specifies QP modifier per MB for H264 and per CTB for HEVC. This QP modifier will be applied on top of the QP chosen by rate control. + If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_EMPHASIS, qpDeltaMap specifies Emphasis Level Map per MB for H264. This level value along with QP chosen by rate control is used to + compute the QP modifier, which in turn is applied on top of QP chosen by rate control. + If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_DISABLED, value in qpDeltaMap will be ignored.*/ + public native @Cast("int8_t*") BytePointer qpDeltaMap(); public native NV_ENC_PIC_PARAMS qpDeltaMap(BytePointer setter); + /** [in]: Specifies the size in bytes of qpDeltaMap surface allocated by client and pointed to by NV_ENC_PIC_PARAMS::qpDeltaMap. Surface (array) should be picWidthInMbs * picHeightInMbs for H264 and picWidthInCtbs * picHeightInCtbs for HEVC */ + public native @Cast("uint32_t") int qpDeltaMapSize(); public native NV_ENC_PIC_PARAMS qpDeltaMapSize(int setter); + /** [in]: Reserved bitfields and must be set to 0 */ + public native @Cast("uint32_t") int reservedBitFields(); public native NV_ENC_PIC_PARAMS reservedBitFields(int setter); + /** [in]: Specifies temporal distance for reference picture (NVENC_EXTERNAL_ME_HINT::refidx = 0) used during external ME with NV_ENC_INITALIZE_PARAMS::enablePTD = 1 . meHintRefPicDist[0] is for L0 hints and meHintRefPicDist[1] is for L1 hints. + If not set, will internally infer distance of 1. Ignored for NV_ENC_INITALIZE_PARAMS::enablePTD = 0 */ + public native @Cast("uint16_t") short meHintRefPicDist(int i); public native NV_ENC_PIC_PARAMS meHintRefPicDist(int i, short setter); + @MemberGetter public native @Cast("uint16_t*") ShortPointer meHintRefPicDist(); + /** [in]: Specifies the input alpha buffer pointer. Client must use a pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource() APIs. + Applicable only when encoding hevc with alpha layer is enabled. */ + public native NV_ENC_INPUT_PTR alphaBuffer(); public native NV_ENC_PIC_PARAMS alphaBuffer(NV_ENC_INPUT_PTR setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved3(int i); public native NV_ENC_PIC_PARAMS reserved3(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved3(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved4(int i); public native NV_ENC_PIC_PARAMS reserved4(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved4(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_H264.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_H264.java new file mode 100644 index 00000000000..ff8d197e55c --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_H264.java @@ -0,0 +1,103 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_PIC_PARAMS_H264 + * H264 specific enc pic params. sent on a per frame basis. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_PIC_PARAMS_H264 extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_PIC_PARAMS_H264() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_PIC_PARAMS_H264(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_PIC_PARAMS_H264(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_PIC_PARAMS_H264 position(long position) { + return (NV_ENC_PIC_PARAMS_H264)super.position(position); + } + @Override public NV_ENC_PIC_PARAMS_H264 getPointer(long i) { + return new NV_ENC_PIC_PARAMS_H264((Pointer)this).position(position + i); + } + + /** [in]: Specifies the display POC syntax This is required to be set if client is handling the picture type decision. */ + public native @Cast("uint32_t") int displayPOCSyntax(); public native NV_ENC_PIC_PARAMS_H264 displayPOCSyntax(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved3(); public native NV_ENC_PIC_PARAMS_H264 reserved3(int setter); + /** [in]: Set to 1 for a reference picture. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */ + public native @Cast("uint32_t") int refPicFlag(); public native NV_ENC_PIC_PARAMS_H264 refPicFlag(int setter); + /** [in]: Specifies the colour plane ID associated with the current input. */ + public native @Cast("uint32_t") int colourPlaneId(); public native NV_ENC_PIC_PARAMS_H264 colourPlaneId(int setter); + /** [in]: Forces an intra refresh with duration equal to intraRefreshFrameCnt. + When outputRecoveryPointSEI is set this is value is used for recovery_frame_cnt in recovery point SEI message + forceIntraRefreshWithFrameCnt cannot be used if B frames are used in the GOP structure specified */ + public native @Cast("uint32_t") int forceIntraRefreshWithFrameCnt(); public native NV_ENC_PIC_PARAMS_H264 forceIntraRefreshWithFrameCnt(int setter); + /** [in]: Set to 1 if client wants to encode this frame with each slice completely independent of other slices in the frame. + NV_ENC_INITIALIZE_PARAMS::enableConstrainedEncoding should be set to 1 */ + public native @Cast("uint32_t") @NoOffset int constrainedFrame(); public native NV_ENC_PIC_PARAMS_H264 constrainedFrame(int setter); + /** [in]: Set to 1 if client wants to change the sliceModeData field to specify new sliceSize Parameter + When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting */ + public native @Cast("uint32_t") @NoOffset int sliceModeDataUpdate(); public native NV_ENC_PIC_PARAMS_H264 sliceModeDataUpdate(int setter); + /** [in]: Set to 1 if client wants to mark this frame as LTR */ + public native @Cast("uint32_t") @NoOffset int ltrMarkFrame(); public native NV_ENC_PIC_PARAMS_H264 ltrMarkFrame(int setter); + /** [in]: Set to 1 if client allows encoding this frame using the LTR frames specified in ltrFrameBitmap */ + public native @Cast("uint32_t") @NoOffset int ltrUseFrames(); public native NV_ENC_PIC_PARAMS_H264 ltrUseFrames(int setter); + /** [in]: Reserved bit fields and must be set to 0 */ + public native @Cast("uint32_t") @NoOffset int reservedBitFields(); public native NV_ENC_PIC_PARAMS_H264 reservedBitFields(int setter); + /** [in]: Deprecated. */ + public native @Cast("uint8_t*") BytePointer sliceTypeData(); public native NV_ENC_PIC_PARAMS_H264 sliceTypeData(BytePointer setter); + /** [in]: Deprecated. */ + public native @Cast("uint32_t") int sliceTypeArrayCnt(); public native NV_ENC_PIC_PARAMS_H264 sliceTypeArrayCnt(int setter); + /** [in]: Specifies the number of elements allocated in seiPayloadArray array. */ + public native @Cast("uint32_t") int seiPayloadArrayCnt(); public native NV_ENC_PIC_PARAMS_H264 seiPayloadArrayCnt(int setter); + /** [in]: Array of SEI payloads which will be inserted for this frame. */ + public native NV_ENC_SEI_PAYLOAD seiPayloadArray(); public native NV_ENC_PIC_PARAMS_H264 seiPayloadArray(NV_ENC_SEI_PAYLOAD setter); + /** [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices + sliceMode = 0 MB based slices, sliceMode = 1 Byte based slices, sliceMode = 2 MB row based slices, sliceMode = 3, numSlices in Picture + When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting + When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */ + public native @Cast("uint32_t") int sliceMode(); public native NV_ENC_PIC_PARAMS_H264 sliceMode(int setter); + /** [in]: Specifies the parameter needed for sliceMode. For: + sliceMode = 0, sliceModeData specifies # of MBs in each slice (except last slice) + sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice) + sliceMode = 2, sliceModeData specifies # of MB rows in each slice (except last slice) + sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ + public native @Cast("uint32_t") int sliceModeData(); public native NV_ENC_PIC_PARAMS_H264 sliceModeData(int setter); + /** [in]: Specifies the long term referenceframe index to use for marking this frame as LTR.*/ + public native @Cast("uint32_t") int ltrMarkFrameIdx(); public native NV_ENC_PIC_PARAMS_H264 ltrMarkFrameIdx(int setter); + /** [in]: Specifies the associated bitmap of LTR frame indices to use when encoding this frame. */ + public native @Cast("uint32_t") int ltrUseFrameBitmap(); public native NV_ENC_PIC_PARAMS_H264 ltrUseFrameBitmap(int setter); + /** [in]: Not supported. Reserved for future use and must be set to 0. */ + public native @Cast("uint32_t") int ltrUsageMode(); public native NV_ENC_PIC_PARAMS_H264 ltrUsageMode(int setter); + /** [in]: Specifies the number of slices to be forced to Intra in the current picture. + This option along with forceIntraSliceIdx[] array needs to be used with sliceMode = 3 only */ + public native @Cast("uint32_t") int forceIntraSliceCount(); public native NV_ENC_PIC_PARAMS_H264 forceIntraSliceCount(int setter); + /** [in]: Slice indices to be forced to intra in the current picture. Each slice index should be <= num_slices_in_picture -1. Index starts from 0 for first slice. + The number of entries in this array should be equal to forceIntraSliceCount */ + public native @Cast("uint32_t*") IntPointer forceIntraSliceIdx(); public native NV_ENC_PIC_PARAMS_H264 forceIntraSliceIdx(IntPointer setter); + /** [in]: Specifies the H264 extension config parameters using this config. */ + public native @ByRef NV_ENC_PIC_PARAMS_H264_EXT h264ExtPicParams(); public native NV_ENC_PIC_PARAMS_H264 h264ExtPicParams(NV_ENC_PIC_PARAMS_H264_EXT setter); + /** [in]: Reserved and must be set to 0. */ + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_PIC_PARAMS_H264 reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); + /** [in]: Reserved and must be set to NULL. */ + public native Pointer reserved2(int i); public native NV_ENC_PIC_PARAMS_H264 reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_H264_EXT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_H264_EXT.java new file mode 100644 index 00000000000..abb7482a124 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_H264_EXT.java @@ -0,0 +1,44 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_PIC_PARAMS_H264_EXT extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_PIC_PARAMS_H264_EXT() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_PIC_PARAMS_H264_EXT(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_PIC_PARAMS_H264_EXT(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_PIC_PARAMS_H264_EXT position(long position) { + return (NV_ENC_PIC_PARAMS_H264_EXT)super.position(position); + } + @Override public NV_ENC_PIC_PARAMS_H264_EXT getPointer(long i) { + return new NV_ENC_PIC_PARAMS_H264_EXT((Pointer)this).position(position + i); + } + + /** [in]: Specifies the MVC picture parameters. */ + public native @ByRef NV_ENC_PIC_PARAMS_MVC mvcPicParams(); public native NV_ENC_PIC_PARAMS_H264_EXT mvcPicParams(NV_ENC_PIC_PARAMS_MVC setter); + /** [in]: Reserved and must be set to 0. */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_PIC_PARAMS_H264_EXT reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_HEVC.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_HEVC.java new file mode 100644 index 00000000000..e6d3ef64be4 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_HEVC.java @@ -0,0 +1,98 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_PIC_PARAMS_HEVC + * HEVC specific enc pic params. sent on a per frame basis. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_PIC_PARAMS_HEVC extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_PIC_PARAMS_HEVC() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_PIC_PARAMS_HEVC(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_PIC_PARAMS_HEVC(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_PIC_PARAMS_HEVC position(long position) { + return (NV_ENC_PIC_PARAMS_HEVC)super.position(position); + } + @Override public NV_ENC_PIC_PARAMS_HEVC getPointer(long i) { + return new NV_ENC_PIC_PARAMS_HEVC((Pointer)this).position(position + i); + } + + /** [in]: Specifies the display POC syntax This is required to be set if client is handling the picture type decision. */ + public native @Cast("uint32_t") int displayPOCSyntax(); public native NV_ENC_PIC_PARAMS_HEVC displayPOCSyntax(int setter); + /** [in]: Set to 1 for a reference picture. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */ + public native @Cast("uint32_t") int refPicFlag(); public native NV_ENC_PIC_PARAMS_HEVC refPicFlag(int setter); + /** [in]: Specifies the temporal id of the picture */ + public native @Cast("uint32_t") int temporalId(); public native NV_ENC_PIC_PARAMS_HEVC temporalId(int setter); + /** [in]: Forces an intra refresh with duration equal to intraRefreshFrameCnt. + When outputRecoveryPointSEI is set this is value is used for recovery_frame_cnt in recovery point SEI message + forceIntraRefreshWithFrameCnt cannot be used if B frames are used in the GOP structure specified */ + public native @Cast("uint32_t") int forceIntraRefreshWithFrameCnt(); public native NV_ENC_PIC_PARAMS_HEVC forceIntraRefreshWithFrameCnt(int setter); + /** [in]: Set to 1 if client wants to encode this frame with each slice completely independent of other slices in the frame. + NV_ENC_INITIALIZE_PARAMS::enableConstrainedEncoding should be set to 1 */ + public native @Cast("uint32_t") @NoOffset int constrainedFrame(); public native NV_ENC_PIC_PARAMS_HEVC constrainedFrame(int setter); + /** [in]: Set to 1 if client wants to change the sliceModeData field to specify new sliceSize Parameter + When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting */ + public native @Cast("uint32_t") @NoOffset int sliceModeDataUpdate(); public native NV_ENC_PIC_PARAMS_HEVC sliceModeDataUpdate(int setter); + /** [in]: Set to 1 if client wants to mark this frame as LTR */ + public native @Cast("uint32_t") @NoOffset int ltrMarkFrame(); public native NV_ENC_PIC_PARAMS_HEVC ltrMarkFrame(int setter); + /** [in]: Set to 1 if client allows encoding this frame using the LTR frames specified in ltrFrameBitmap */ + public native @Cast("uint32_t") @NoOffset int ltrUseFrames(); public native NV_ENC_PIC_PARAMS_HEVC ltrUseFrames(int setter); + /** [in]: Reserved bit fields and must be set to 0 */ + public native @Cast("uint32_t") @NoOffset int reservedBitFields(); public native NV_ENC_PIC_PARAMS_HEVC reservedBitFields(int setter); + /** [in]: Array which specifies the slice type used to force intra slice for a particular slice. Currently supported only for NV_ENC_CONFIG_H264::sliceMode == 3. + Client should allocate array of size sliceModeData where sliceModeData is specified in field of ::_NV_ENC_CONFIG_H264 + Array element with index n corresponds to nth slice. To force a particular slice to intra client should set corresponding array element to NV_ENC_SLICE_TYPE_I + all other array elements should be set to NV_ENC_SLICE_TYPE_DEFAULT */ + public native @Cast("uint8_t*") BytePointer sliceTypeData(); public native NV_ENC_PIC_PARAMS_HEVC sliceTypeData(BytePointer setter); + /** [in]: Client should set this to the number of elements allocated in sliceTypeData array. If sliceTypeData is NULL then this should be set to 0 */ + public native @Cast("uint32_t") int sliceTypeArrayCnt(); public native NV_ENC_PIC_PARAMS_HEVC sliceTypeArrayCnt(int setter); + /** [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices + sliceMode = 0 CTU based slices, sliceMode = 1 Byte based slices, sliceMode = 2 CTU row based slices, sliceMode = 3, numSlices in Picture + When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting + When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */ + public native @Cast("uint32_t") int sliceMode(); public native NV_ENC_PIC_PARAMS_HEVC sliceMode(int setter); + /** [in]: Specifies the parameter needed for sliceMode. For: + sliceMode = 0, sliceModeData specifies # of CTUs in each slice (except last slice) + sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice) + sliceMode = 2, sliceModeData specifies # of CTU rows in each slice (except last slice) + sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ + public native @Cast("uint32_t") int sliceModeData(); public native NV_ENC_PIC_PARAMS_HEVC sliceModeData(int setter); + /** [in]: Specifies the long term reference frame index to use for marking this frame as LTR.*/ + public native @Cast("uint32_t") int ltrMarkFrameIdx(); public native NV_ENC_PIC_PARAMS_HEVC ltrMarkFrameIdx(int setter); + /** [in]: Specifies the associated bitmap of LTR frame indices to use when encoding this frame. */ + public native @Cast("uint32_t") int ltrUseFrameBitmap(); public native NV_ENC_PIC_PARAMS_HEVC ltrUseFrameBitmap(int setter); + /** [in]: Not supported. Reserved for future use and must be set to 0. */ + public native @Cast("uint32_t") int ltrUsageMode(); public native NV_ENC_PIC_PARAMS_HEVC ltrUsageMode(int setter); + /** [in]: Specifies the number of elements allocated in seiPayloadArray array. */ + public native @Cast("uint32_t") int seiPayloadArrayCnt(); public native NV_ENC_PIC_PARAMS_HEVC seiPayloadArrayCnt(int setter); + /** [in]: Reserved and must be set to 0. */ + public native @Cast("uint32_t") int reserved(); public native NV_ENC_PIC_PARAMS_HEVC reserved(int setter); + /** [in]: Array of SEI payloads which will be inserted for this frame. */ + public native NV_ENC_SEI_PAYLOAD seiPayloadArray(); public native NV_ENC_PIC_PARAMS_HEVC seiPayloadArray(NV_ENC_SEI_PAYLOAD setter); + /** [in]: Reserved and must be set to 0. */ + public native @Cast("uint32_t") int reserved2(int i); public native NV_ENC_PIC_PARAMS_HEVC reserved2(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved2(); + /** [in]: Reserved and must be set to NULL. */ + public native Pointer reserved3(int i); public native NV_ENC_PIC_PARAMS_HEVC reserved3(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved3(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_MVC.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_MVC.java new file mode 100644 index 00000000000..9e3849e9220 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PIC_PARAMS_MVC.java @@ -0,0 +1,55 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NV_ENC_PIC_PARAMS_MVC + * MVC-specific parameters to be sent on a per-frame basis. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_PIC_PARAMS_MVC extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_PIC_PARAMS_MVC() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_PIC_PARAMS_MVC(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_PIC_PARAMS_MVC(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_PIC_PARAMS_MVC position(long position) { + return (NV_ENC_PIC_PARAMS_MVC)super.position(position); + } + @Override public NV_ENC_PIC_PARAMS_MVC getPointer(long i) { + return new NV_ENC_PIC_PARAMS_MVC((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_PIC_PARAMS_MVC_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_PIC_PARAMS_MVC version(int setter); + /** [in]: Specifies the view ID associated with the current input view. */ + public native @Cast("uint32_t") int viewID(); public native NV_ENC_PIC_PARAMS_MVC viewID(int setter); + /** [in]: Specifies the temporal ID associated with the current input view. */ + public native @Cast("uint32_t") int temporalID(); public native NV_ENC_PIC_PARAMS_MVC temporalID(int setter); + /** [in]: Specifies the priority ID associated with the current input view. Reserved and ignored by the NvEncodeAPI interface. */ + public native @Cast("uint32_t") int priorityID(); public native NV_ENC_PIC_PARAMS_MVC priorityID(int setter); + /** [in]: Reserved and must be set to 0. */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_PIC_PARAMS_MVC reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL. */ + public native Pointer reserved2(int i); public native NV_ENC_PIC_PARAMS_MVC reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PRESET_CONFIG.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PRESET_CONFIG.java new file mode 100644 index 00000000000..1f0da0934c9 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_PRESET_CONFIG.java @@ -0,0 +1,50 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_PRESET_CONFIG + * Encoder preset config + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_PRESET_CONFIG extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_PRESET_CONFIG() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_PRESET_CONFIG(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_PRESET_CONFIG(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_PRESET_CONFIG position(long position) { + return (NV_ENC_PRESET_CONFIG)super.position(position); + } + @Override public NV_ENC_PRESET_CONFIG getPointer(long i) { + return new NV_ENC_PRESET_CONFIG((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_PRESET_CONFIG_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_PRESET_CONFIG version(int setter); + /** [out]: preset config returned by the Nvidia Video Encoder interface. */ + public native @ByRef NV_ENC_CONFIG presetCfg(); public native NV_ENC_PRESET_CONFIG presetCfg(NV_ENC_CONFIG setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_PRESET_CONFIG reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_PRESET_CONFIG reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_QP.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_QP.java new file mode 100644 index 00000000000..0fe99372769 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_QP.java @@ -0,0 +1,45 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * QP value for frames + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_QP extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_QP() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_QP(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_QP(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_QP position(long position) { + return (NV_ENC_QP)super.position(position); + } + @Override public NV_ENC_QP getPointer(long i) { + return new NV_ENC_QP((Pointer)this).position(position + i); + } + + /** [in]: Specifies QP value for P-frame. Even though this field is uint32_t for legacy reasons, the client should treat this as a signed parameter(int32_t) for cases in which negative QP values are to be specified. */ + public native @Cast("uint32_t") int qpInterP(); public native NV_ENC_QP qpInterP(int setter); + /** [in]: Specifies QP value for B-frame. Even though this field is uint32_t for legacy reasons, the client should treat this as a signed parameter(int32_t) for cases in which negative QP values are to be specified. */ + public native @Cast("uint32_t") int qpInterB(); public native NV_ENC_QP qpInterB(int setter); + /** [in]: Specifies QP value for Intra Frame. Even though this field is uint32_t for legacy reasons, the client should treat this as a signed parameter(int32_t) for cases in which negative QP values are to be specified. */ + public native @Cast("uint32_t") int qpIntra(); public native NV_ENC_QP qpIntra(int setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_RC_PARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_RC_PARAMS.java new file mode 100644 index 00000000000..fd5c5dc1ae7 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_RC_PARAMS.java @@ -0,0 +1,131 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * Rate Control Configuration Parameters + */ + @Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_RC_PARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_RC_PARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_RC_PARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_RC_PARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_RC_PARAMS position(long position) { + return (NV_ENC_RC_PARAMS)super.position(position); + } + @Override public NV_ENC_RC_PARAMS getPointer(long i) { + return new NV_ENC_RC_PARAMS((Pointer)this).position(position + i); + } + + public native @Cast("uint32_t") int version(); public native NV_ENC_RC_PARAMS version(int setter); + /** [in]: Specifies the rate control mode. Check support for various rate control modes using ::NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES caps. */ + public native @Cast("NV_ENC_PARAMS_RC_MODE") int rateControlMode(); public native NV_ENC_RC_PARAMS rateControlMode(int setter); + /** [in]: Specifies the initial QP to be used for encoding, these values would be used for all frames if in Constant QP mode. */ + public native @ByRef NV_ENC_QP constQP(); public native NV_ENC_RC_PARAMS constQP(NV_ENC_QP setter); + /** [in]: Specifies the average bitrate(in bits/sec) used for encoding. */ + public native @Cast("uint32_t") int averageBitRate(); public native NV_ENC_RC_PARAMS averageBitRate(int setter); + /** [in]: Specifies the maximum bitrate for the encoded output. This is used for VBR and ignored for CBR mode. */ + public native @Cast("uint32_t") int maxBitRate(); public native NV_ENC_RC_PARAMS maxBitRate(int setter); + /** [in]: Specifies the VBV(HRD) buffer size. in bits. Set 0 to use the default VBV buffer size. */ + public native @Cast("uint32_t") int vbvBufferSize(); public native NV_ENC_RC_PARAMS vbvBufferSize(int setter); + /** [in]: Specifies the VBV(HRD) initial delay in bits. Set 0 to use the default VBV initial delay .*/ + public native @Cast("uint32_t") int vbvInitialDelay(); public native NV_ENC_RC_PARAMS vbvInitialDelay(int setter); + /** [in]: Set this to 1 if minimum QP used for rate control. */ + public native @Cast("uint32_t") @NoOffset int enableMinQP(); public native NV_ENC_RC_PARAMS enableMinQP(int setter); + /** [in]: Set this to 1 if maximum QP used for rate control. */ + public native @Cast("uint32_t") @NoOffset int enableMaxQP(); public native NV_ENC_RC_PARAMS enableMaxQP(int setter); + /** [in]: Set this to 1 if user supplied initial QP is used for rate control. */ + public native @Cast("uint32_t") @NoOffset int enableInitialRCQP(); public native NV_ENC_RC_PARAMS enableInitialRCQP(int setter); + /** [in]: Set this to 1 to enable adaptive quantization (Spatial). */ + public native @Cast("uint32_t") @NoOffset int enableAQ(); public native NV_ENC_RC_PARAMS enableAQ(int setter); + /** [in]: Reserved bitfields and must be set to 0. */ + public native @Cast("uint32_t") @NoOffset int reservedBitField1(); public native NV_ENC_RC_PARAMS reservedBitField1(int setter); + /** [in]: Set this to 1 to enable lookahead with depth (if lookahead is enabled, input frames must remain available to the encoder until encode completion) */ + public native @Cast("uint32_t") @NoOffset int enableLookahead(); public native NV_ENC_RC_PARAMS enableLookahead(int setter); + /** [in]: Set this to 1 to disable adaptive I-frame insertion at scene cuts (only has an effect when lookahead is enabled) */ + public native @Cast("uint32_t") @NoOffset int disableIadapt(); public native NV_ENC_RC_PARAMS disableIadapt(int setter); + /** [in]: Set this to 1 to disable adaptive B-frame decision (only has an effect when lookahead is enabled) */ + public native @Cast("uint32_t") @NoOffset int disableBadapt(); public native NV_ENC_RC_PARAMS disableBadapt(int setter); + /** [in]: Set this to 1 to enable temporal AQ */ + public native @Cast("uint32_t") @NoOffset int enableTemporalAQ(); public native NV_ENC_RC_PARAMS enableTemporalAQ(int setter); + /** [in]: Set this to 1 to indicate zero latency operation (no reordering delay, num_reorder_frames=0) */ + public native @Cast("uint32_t") @NoOffset int zeroReorderDelay(); public native NV_ENC_RC_PARAMS zeroReorderDelay(int setter); + /** [in]: Set this to 1 to enable automatic insertion of non-reference P-frames (no effect if enablePTD=0) */ + public native @Cast("uint32_t") @NoOffset int enableNonRefP(); public native NV_ENC_RC_PARAMS enableNonRefP(int setter); + /** [in]: Set this to 1 to minimize GOP-to-GOP rate fluctuations */ + public native @Cast("uint32_t") @NoOffset int strictGOPTarget(); public native NV_ENC_RC_PARAMS strictGOPTarget(int setter); + /** [in]: When AQ (Spatial) is enabled (i.e. NV_ENC_RC_PARAMS::enableAQ is set), this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive). + If not set, strength is auto selected by driver. */ + public native @Cast("uint32_t") @NoOffset int aqStrength(); public native NV_ENC_RC_PARAMS aqStrength(int setter); + /** [in]: Reserved bitfields and must be set to 0 */ + public native @Cast("uint32_t") @NoOffset int reservedBitFields(); public native NV_ENC_RC_PARAMS reservedBitFields(int setter); + /** [in]: Specifies the minimum QP used for rate control. Client must set NV_ENC_CONFIG::enableMinQP to 1. */ + public native @ByRef NV_ENC_QP minQP(); public native NV_ENC_RC_PARAMS minQP(NV_ENC_QP setter); + /** [in]: Specifies the maximum QP used for rate control. Client must set NV_ENC_CONFIG::enableMaxQP to 1. */ + public native @ByRef NV_ENC_QP maxQP(); public native NV_ENC_RC_PARAMS maxQP(NV_ENC_QP setter); + /** [in]: Specifies the initial QP used for rate control. Client must set NV_ENC_CONFIG::enableInitialRCQP to 1. */ + public native @ByRef NV_ENC_QP initialRCQP(); public native NV_ENC_RC_PARAMS initialRCQP(NV_ENC_QP setter); + /** [in]: Specifies the temporal layers (as a bitmask) whose QPs have changed. Valid max bitmask is [2^NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS - 1]. + Applicable only for constant QP mode (NV_ENC_RC_PARAMS::rateControlMode = NV_ENC_PARAMS_RC_CONSTQP). */ + public native @Cast("uint32_t") int temporallayerIdxMask(); public native NV_ENC_RC_PARAMS temporallayerIdxMask(int setter); + /** [in]: Specifies the temporal layer QPs used for rate control. Temporal layer index is used as the array index. + Applicable only for constant QP mode (NV_ENC_RC_PARAMS::rateControlMode = NV_ENC_PARAMS_RC_CONSTQP). */ + public native @Cast("uint8_t") byte temporalLayerQP(int i); public native NV_ENC_RC_PARAMS temporalLayerQP(int i, byte setter); + @MemberGetter public native @Cast("uint8_t*") BytePointer temporalLayerQP(); + /** [in]: Target CQ (Constant Quality) level for VBR mode (range 0-51 with 0-automatic) */ + public native @Cast("uint8_t") byte targetQuality(); public native NV_ENC_RC_PARAMS targetQuality(byte setter); + /** [in]: Fractional part of target quality (as 8.8 fixed point format) */ + public native @Cast("uint8_t") byte targetQualityLSB(); public native NV_ENC_RC_PARAMS targetQualityLSB(byte setter); + /** [in]: Maximum depth of lookahead with range 0-(31 - number of B frames). + lookaheadDepth is only used if enableLookahead=1.*/ + public native @Cast("uint16_t") short lookaheadDepth(); public native NV_ENC_RC_PARAMS lookaheadDepth(short setter); + /** [in]: Specifies the ratio of I frame bits to P frame bits in case of single frame VBV and CBR rate control mode, + is set to 2 by default for low latency tuning info and 1 by default for ultra low latency tuning info */ + public native @Cast("uint8_t") byte lowDelayKeyFrameScale(); public native NV_ENC_RC_PARAMS lowDelayKeyFrameScale(byte setter); + public native @Cast("uint8_t") byte reserved1(int i); public native NV_ENC_RC_PARAMS reserved1(int i, byte setter); + @MemberGetter public native @Cast("uint8_t*") BytePointer reserved1(); + /** [in]: This flag is used to interpret values in array specified by NV_ENC_PIC_PARAMS::qpDeltaMap. + Set this to NV_ENC_QP_MAP_EMPHASIS to treat values specified by NV_ENC_PIC_PARAMS::qpDeltaMap as Emphasis Level Map. + Emphasis Level can be assigned any value specified in enum NV_ENC_EMPHASIS_MAP_LEVEL. + Emphasis Level Map is used to specify regions to be encoded at varying levels of quality. + The hardware encoder adjusts the quantization within the image as per the provided emphasis map, + by adjusting the quantization parameter (QP) assigned to each macroblock. This adjustment is commonly called “Delta QP”. + The adjustment depends on the absolute QP decided by the rate control algorithm, and is applied after the rate control has decided each macroblock’s QP. + Since the Delta QP overrides rate control, enabling Emphasis Level Map may violate bitrate and VBV buffer size constraints. + Emphasis Level Map is useful in situations where client has a priori knowledge of the image complexity (e.g. via use of NVFBC's Classification feature) and encoding those high-complexity areas at higher quality (lower QP) is important, even at the possible cost of violating bitrate/VBV buffer size constraints + This feature is not supported when AQ( Spatial/Temporal) is enabled. + This feature is only supported for H264 codec currently. + + Set this to NV_ENC_QP_MAP_DELTA to treat values specified by NV_ENC_PIC_PARAMS::qpDeltaMap as QP Delta. This specifies QP modifier to be applied on top of the QP chosen by rate control + + Set this to NV_ENC_QP_MAP_DISABLED to ignore NV_ENC_PIC_PARAMS::qpDeltaMap values. In this case, qpDeltaMap should be set to NULL. + + Other values are reserved for future use.*/ + public native @Cast("NV_ENC_QP_MAP_MODE") int qpMapMode(); public native NV_ENC_RC_PARAMS qpMapMode(int setter); + /** [in]: This flag is used to enable multi-pass encoding for a given ::NV_ENC_PARAMS_RC_MODE. This flag is not valid for H264 and HEVC MEOnly mode */ + public native @Cast("NV_ENC_MULTI_PASS") int multiPass(); public native NV_ENC_RC_PARAMS multiPass(int setter); + /** [in]: Specifies the ratio in which bitrate should be split between base and alpha layer. A value 'x' for this field will split the target bitrate in a ratio of x : 1 between base and alpha layer. + The default split ratio is 15.*/ + public native @Cast("uint32_t") int alphaLayerBitrateRatio(); public native NV_ENC_RC_PARAMS alphaLayerBitrateRatio(int setter); + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_RC_PARAMS reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); + } diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_RECONFIGURE_PARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_RECONFIGURE_PARAMS.java new file mode 100644 index 00000000000..8f2fc2004ce --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_RECONFIGURE_PARAMS.java @@ -0,0 +1,67 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NV_ENC_RECONFIGURE_PARAMS + * Encode Session Reconfigured parameters. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_RECONFIGURE_PARAMS extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_RECONFIGURE_PARAMS() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_RECONFIGURE_PARAMS(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_RECONFIGURE_PARAMS(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_RECONFIGURE_PARAMS position(long position) { + return (NV_ENC_RECONFIGURE_PARAMS)super.position(position); + } + @Override public NV_ENC_RECONFIGURE_PARAMS getPointer(long i) { + return new NV_ENC_RECONFIGURE_PARAMS((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_RECONFIGURE_PARAMS_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_RECONFIGURE_PARAMS version(int setter); + /** [in]: Encoder session re-initialization parameters. + If reInitEncodeParams.encodeConfig is NULL and + reInitEncodeParams.presetGUID is the same as the preset + GUID specified on the call to NvEncInitializeEncoder(), + EncodeAPI will continue to use the existing encode + configuration. + If reInitEncodeParams.encodeConfig is NULL and + reInitEncodeParams.presetGUID is different from the preset + GUID specified on the call to NvEncInitializeEncoder(), + EncodeAPI will try to use the default configuration for + the preset specified by reInitEncodeParams.presetGUID. + In this case, reconfiguration may fail if the new + configuration is incompatible with the existing + configuration (e.g. the new configuration results in + a change in the GOP structure). */ + public native @ByRef NV_ENC_INITIALIZE_PARAMS reInitEncodeParams(); public native NV_ENC_RECONFIGURE_PARAMS reInitEncodeParams(NV_ENC_INITIALIZE_PARAMS setter); + /** [in]: This resets the rate control states and other internal encoder states. This should be used only with an IDR frame. + If NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1, encoder will force the frame type to IDR */ + public native @Cast("uint32_t") @NoOffset int resetEncoder(); public native NV_ENC_RECONFIGURE_PARAMS resetEncoder(int setter); + /** [in]: Encode the current picture as an IDR picture. This flag is only valid when Picture type decision is taken by the Encoder + [_NV_ENC_INITIALIZE_PARAMS::enablePTD == 1]. */ + public native @Cast("uint32_t") @NoOffset int forceIDR(); public native NV_ENC_RECONFIGURE_PARAMS forceIDR(int setter); + public native @Cast("uint32_t") @NoOffset int reserved(); public native NV_ENC_RECONFIGURE_PARAMS reserved(int setter); + +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_REGISTERED_PTR.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_REGISTERED_PTR.java new file mode 100644 index 00000000000..646dcb45653 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_REGISTERED_PTR.java @@ -0,0 +1,24 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +/** A Resource that has been registered with NVENCODE API*/ +@Namespace @Name("void") @Opaque @Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_REGISTERED_PTR extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public NV_ENC_REGISTERED_PTR() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_REGISTERED_PTR(Pointer p) { super(p); } +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_REGISTER_RESOURCE.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_REGISTER_RESOURCE.java new file mode 100644 index 00000000000..e393c920bb2 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_REGISTER_RESOURCE.java @@ -0,0 +1,81 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_REGISTER_RESOURCE + * Register a resource for future use with the Nvidia Video Encoder Interface. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_REGISTER_RESOURCE extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_REGISTER_RESOURCE() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_REGISTER_RESOURCE(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_REGISTER_RESOURCE(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_REGISTER_RESOURCE position(long position) { + return (NV_ENC_REGISTER_RESOURCE)super.position(position); + } + @Override public NV_ENC_REGISTER_RESOURCE getPointer(long i) { + return new NV_ENC_REGISTER_RESOURCE((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_REGISTER_RESOURCE_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_REGISTER_RESOURCE version(int setter); + /** [in]: Specifies the type of resource to be registered. + Supported values are + ::NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX, + ::NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR, + ::NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX */ + public native @Cast("NV_ENC_INPUT_RESOURCE_TYPE") int resourceType(); public native NV_ENC_REGISTER_RESOURCE resourceType(int setter); + /** [in]: Input frame width. */ + public native @Cast("uint32_t") int width(); public native NV_ENC_REGISTER_RESOURCE width(int setter); + /** [in]: Input frame height. */ + public native @Cast("uint32_t") int height(); public native NV_ENC_REGISTER_RESOURCE height(int setter); + /** [in]: Input buffer pitch. + For ::NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX resources, set this to 0. + For ::NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR resources, set this to + the pitch as obtained from cuMemAllocPitch(), or to the width in + bytes (if this resource was created by using cuMemAlloc()). This + value must be a multiple of 4. + For ::NV_ENC_INPUT_RESOURCE_TYPE_CUDAARRAY resources, set this to the + width of the allocation in bytes (i.e. + CUDA_ARRAY3D_DESCRIPTOR::Width * CUDA_ARRAY3D_DESCRIPTOR::NumChannels). + For ::NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX resources, set this to the + texture width multiplied by the number of components in the texture + format. */ + public native @Cast("uint32_t") int pitch(); public native NV_ENC_REGISTER_RESOURCE pitch(int setter); + /** [in]: Subresource Index of the DirectX resource to be registered. Should be set to 0 for other interfaces. */ + public native @Cast("uint32_t") int subResourceIndex(); public native NV_ENC_REGISTER_RESOURCE subResourceIndex(int setter); + /** [in]: Handle to the resource that is being registered. */ + public native Pointer resourceToRegister(); public native NV_ENC_REGISTER_RESOURCE resourceToRegister(Pointer setter); + /** [out]: Registered resource handle. This should be used in future interactions with the Nvidia Video Encoder Interface. */ + public native NV_ENC_REGISTERED_PTR registeredResource(); public native NV_ENC_REGISTER_RESOURCE registeredResource(NV_ENC_REGISTERED_PTR setter); + /** [in]: Buffer format of resource to be registered. */ + public native @Cast("NV_ENC_BUFFER_FORMAT") int bufferFormat(); public native NV_ENC_REGISTER_RESOURCE bufferFormat(int setter); + /** [in]: Usage of resource to be registered. */ + public native @Cast("NV_ENC_BUFFER_USAGE") int bufferUsage(); public native NV_ENC_REGISTER_RESOURCE bufferUsage(int setter); + /** [in]: Reserved and must be set to 0. */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_REGISTER_RESOURCE reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL. */ + public native Pointer reserved2(int i); public native NV_ENC_REGISTER_RESOURCE reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_SEI_PAYLOAD.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_SEI_PAYLOAD.java new file mode 100644 index 00000000000..13118e8d22e --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_SEI_PAYLOAD.java @@ -0,0 +1,46 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_SEI_PAYLOAD + * User SEI message + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_SEI_PAYLOAD extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_SEI_PAYLOAD() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_SEI_PAYLOAD(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_SEI_PAYLOAD(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_SEI_PAYLOAD position(long position) { + return (NV_ENC_SEI_PAYLOAD)super.position(position); + } + @Override public NV_ENC_SEI_PAYLOAD getPointer(long i) { + return new NV_ENC_SEI_PAYLOAD((Pointer)this).position(position + i); + } + + /** [in] SEI payload size in bytes. SEI payload must be byte aligned, as described in Annex D */ + public native @Cast("uint32_t") int payloadSize(); public native NV_ENC_SEI_PAYLOAD payloadSize(int setter); + /** [in] SEI payload types and syntax can be found in Annex D of the H.264 Specification. */ + public native @Cast("uint32_t") int payloadType(); public native NV_ENC_SEI_PAYLOAD payloadType(int setter); + /** [in] pointer to user data */ + public native @Cast("uint8_t*") BytePointer payload(); public native NV_ENC_SEI_PAYLOAD payload(BytePointer setter); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_SEQUENCE_PARAM_PAYLOAD.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_SEQUENCE_PARAM_PAYLOAD.java new file mode 100644 index 00000000000..86fe8f014d4 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_SEQUENCE_PARAM_PAYLOAD.java @@ -0,0 +1,60 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** + * \struct _NV_ENC_SEQUENCE_PARAM_PAYLOAD + * Sequence and picture paramaters payload. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_SEQUENCE_PARAM_PAYLOAD extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_SEQUENCE_PARAM_PAYLOAD() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_SEQUENCE_PARAM_PAYLOAD(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_SEQUENCE_PARAM_PAYLOAD(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_SEQUENCE_PARAM_PAYLOAD position(long position) { + return (NV_ENC_SEQUENCE_PARAM_PAYLOAD)super.position(position); + } + @Override public NV_ENC_SEQUENCE_PARAM_PAYLOAD getPointer(long i) { + return new NV_ENC_SEQUENCE_PARAM_PAYLOAD((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_INITIALIZE_PARAMS_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_SEQUENCE_PARAM_PAYLOAD version(int setter); + /** [in]: Specifies the size of the spsppsBuffer provided by the client */ + public native @Cast("uint32_t") int inBufferSize(); public native NV_ENC_SEQUENCE_PARAM_PAYLOAD inBufferSize(int setter); + /** [in]: Specifies the SPS id to be used in sequence header. Default value is 0. */ + public native @Cast("uint32_t") int spsId(); public native NV_ENC_SEQUENCE_PARAM_PAYLOAD spsId(int setter); + /** [in]: Specifies the PPS id to be used in picture header. Default value is 0. */ + public native @Cast("uint32_t") int ppsId(); public native NV_ENC_SEQUENCE_PARAM_PAYLOAD ppsId(int setter); + /** [in]: Specifies bitstream header pointer of size NV_ENC_SEQUENCE_PARAM_PAYLOAD::inBufferSize. + It is the client's responsibility to manage this memory. */ + public native Pointer spsppsBuffer(); public native NV_ENC_SEQUENCE_PARAM_PAYLOAD spsppsBuffer(Pointer setter); + /** [out]: Size of the sequence and picture header in bytes. */ + public native @Cast("uint32_t*") IntPointer outSPSPPSPayloadSize(); public native NV_ENC_SEQUENCE_PARAM_PAYLOAD outSPSPPSPayloadSize(IntPointer setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(int i); public native NV_ENC_SEQUENCE_PARAM_PAYLOAD reserved(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_SEQUENCE_PARAM_PAYLOAD reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_STAT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_STAT.java new file mode 100644 index 00000000000..af030900a48 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/NV_ENC_STAT.java @@ -0,0 +1,79 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +/** + * \struct _NV_ENC_STAT + * Encode Stats structure. + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class NV_ENC_STAT extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public NV_ENC_STAT() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public NV_ENC_STAT(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public NV_ENC_STAT(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public NV_ENC_STAT position(long position) { + return (NV_ENC_STAT)super.position(position); + } + @Override public NV_ENC_STAT getPointer(long i) { + return new NV_ENC_STAT((Pointer)this).position(position + i); + } + + /** [in]: Struct version. Must be set to ::NV_ENC_STAT_VER. */ + public native @Cast("uint32_t") int version(); public native NV_ENC_STAT version(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved(); public native NV_ENC_STAT reserved(int setter); + /** [out]: Specifies the pointer to output bitstream. */ + public native NV_ENC_OUTPUT_PTR outputBitStream(); public native NV_ENC_STAT outputBitStream(NV_ENC_OUTPUT_PTR setter); + /** [out]: Size of generated bitstream in bytes. */ + public native @Cast("uint32_t") int bitStreamSize(); public native NV_ENC_STAT bitStreamSize(int setter); + /** [out]: Picture type of encoded picture. See ::NV_ENC_PIC_TYPE. */ + public native @Cast("uint32_t") int picType(); public native NV_ENC_STAT picType(int setter); + /** [out]: Offset of last valid bytes of completed bitstream */ + public native @Cast("uint32_t") int lastValidByteOffset(); public native NV_ENC_STAT lastValidByteOffset(int setter); + /** [out]: Offsets of each slice */ + public native @Cast("uint32_t") int sliceOffsets(int i); public native NV_ENC_STAT sliceOffsets(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer sliceOffsets(); + /** [out]: Picture number */ + public native @Cast("uint32_t") int picIdx(); public native NV_ENC_STAT picIdx(int setter); + /** [out]: Average QP of the frame. */ + public native @Cast("uint32_t") int frameAvgQP(); public native NV_ENC_STAT frameAvgQP(int setter); + /** [out]: Flag indicating this frame is marked as LTR frame */ + public native @Cast("uint32_t") @NoOffset int ltrFrame(); public native NV_ENC_STAT ltrFrame(int setter); + /** [in]: Reserved bit fields and must be set to 0 */ + public native @Cast("uint32_t") @NoOffset int reservedBitFields(); public native NV_ENC_STAT reservedBitFields(int setter); + /** [out]: Frame index associated with this LTR frame. */ + public native @Cast("uint32_t") int ltrFrameIdx(); public native NV_ENC_STAT ltrFrameIdx(int setter); + /** [out]: For H264, Number of Intra MBs in the encoded frame. For HEVC, Number of Intra CTBs in the encoded frame. */ + public native @Cast("uint32_t") int intraMBCount(); public native NV_ENC_STAT intraMBCount(int setter); + /** [out]: For H264, Number of Inter MBs in the encoded frame, includes skip MBs. For HEVC, Number of Inter CTBs in the encoded frame. */ + public native @Cast("uint32_t") int interMBCount(); public native NV_ENC_STAT interMBCount(int setter); + /** [out]: Average Motion Vector in X direction for the encoded frame. */ + public native @Cast("int32_t") int averageMVX(); public native NV_ENC_STAT averageMVX(int setter); + /** [out]: Average Motion Vector in y direction for the encoded frame. */ + public native @Cast("int32_t") int averageMVY(); public native NV_ENC_STAT averageMVY(int setter); + /** [in]: Reserved and must be set to 0 */ + public native @Cast("uint32_t") int reserved1(int i); public native NV_ENC_STAT reserved1(int i, int setter); + @MemberGetter public native @Cast("uint32_t*") IntPointer reserved1(); + /** [in]: Reserved and must be set to NULL */ + public native Pointer reserved2(int i); public native NV_ENC_STAT reserved2(int i, Pointer setter); + @MemberGetter public native @Cast("void**") PointerPointer reserved2(); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEBITSTREAMBUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEBITSTREAMBUFFER.java new file mode 100644 index 00000000000..d45550841d9 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEBITSTREAMBUFFER.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCCREATEBITSTREAMBUFFER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCCREATEBITSTREAMBUFFER(Pointer p) { super(p); } + protected PNVENCCREATEBITSTREAMBUFFER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_CREATE_BITSTREAM_BUFFER createBitstreamBufferParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEINPUTBUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEINPUTBUFFER.java new file mode 100644 index 00000000000..239558478bb --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEINPUTBUFFER.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCCREATEINPUTBUFFER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCCREATEINPUTBUFFER(Pointer p) { super(p); } + protected PNVENCCREATEINPUTBUFFER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_CREATE_INPUT_BUFFER createInputBufferParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEMVBUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEMVBUFFER.java new file mode 100644 index 00000000000..3f3f811b043 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCCREATEMVBUFFER.java @@ -0,0 +1,26 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCCREATEMVBUFFER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCCREATEMVBUFFER(Pointer p) { super(p); } + protected PNVENCCREATEMVBUFFER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_CREATE_MV_BUFFER createMVBufferParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYBITSTREAMBUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYBITSTREAMBUFFER.java new file mode 100644 index 00000000000..959a89ee851 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYBITSTREAMBUFFER.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCDESTROYBITSTREAMBUFFER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCDESTROYBITSTREAMBUFFER(Pointer p) { super(p); } + protected PNVENCDESTROYBITSTREAMBUFFER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_OUTPUT_PTR bitstreamBuffer); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYENCODER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYENCODER.java new file mode 100644 index 00000000000..76085ebf9ca --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYENCODER.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCDESTROYENCODER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCDESTROYENCODER(Pointer p) { super(p); } + protected PNVENCDESTROYENCODER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYINPUTBUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYINPUTBUFFER.java new file mode 100644 index 00000000000..6343a2d4753 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYINPUTBUFFER.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCDESTROYINPUTBUFFER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCDESTROYINPUTBUFFER(Pointer p) { super(p); } + protected PNVENCDESTROYINPUTBUFFER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_INPUT_PTR inputBuffer); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYMVBUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYMVBUFFER.java new file mode 100644 index 00000000000..a0e373b2967 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCDESTROYMVBUFFER.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCDESTROYMVBUFFER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCDESTROYMVBUFFER(Pointer p) { super(p); } + protected PNVENCDESTROYMVBUFFER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_OUTPUT_PTR mvBuffer); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCENCODEPICTURE.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCENCODEPICTURE.java new file mode 100644 index 00000000000..f5b6c9d37ae --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCENCODEPICTURE.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCENCODEPICTURE extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCENCODEPICTURE(Pointer p) { super(p); } + protected PNVENCENCODEPICTURE() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_PIC_PARAMS encodePicParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODECAPS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODECAPS.java new file mode 100644 index 00000000000..bdcc374408c --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODECAPS.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETENCODECAPS extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETENCODECAPS(Pointer p) { super(p); } + protected PNVENCGETENCODECAPS() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @ByVal GUID encodeGUID, NV_ENC_CAPS_PARAM capsParam, IntPointer capsVal); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEGUIDCOUNT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEGUIDCOUNT.java new file mode 100644 index 00000000000..b4b9bdb563e --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEGUIDCOUNT.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETENCODEGUIDCOUNT extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETENCODEGUIDCOUNT(Pointer p) { super(p); } + protected PNVENCGETENCODEGUIDCOUNT() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @Cast("uint32_t*") IntPointer encodeGUIDCount); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEGUIDS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEGUIDS.java new file mode 100644 index 00000000000..9b9f22083d8 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEGUIDS.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETENCODEGUIDS extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETENCODEGUIDS(Pointer p) { super(p); } + protected PNVENCGETENCODEGUIDS() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, GUID GUIDs, @Cast("uint32_t") int guidArraySize, @Cast("uint32_t*") IntPointer GUIDCount); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCONFIG.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCONFIG.java new file mode 100644 index 00000000000..657b7b682a7 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCONFIG.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETENCODEPRESETCONFIG extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETENCODEPRESETCONFIG(Pointer p) { super(p); } + protected PNVENCGETENCODEPRESETCONFIG() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @ByVal GUID encodeGUID, @ByVal GUID presetGUID, NV_ENC_PRESET_CONFIG presetConfig); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCONFIGEX.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCONFIGEX.java new file mode 100644 index 00000000000..5940e12bdd5 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCONFIGEX.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETENCODEPRESETCONFIGEX extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETENCODEPRESETCONFIGEX(Pointer p) { super(p); } + protected PNVENCGETENCODEPRESETCONFIGEX() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @ByVal GUID encodeGUID, @ByVal GUID presetGUID, @Cast("NV_ENC_TUNING_INFO") int tuningInfo, NV_ENC_PRESET_CONFIG presetConfig); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCOUNT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCOUNT.java new file mode 100644 index 00000000000..68781d8c543 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETCOUNT.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETENCODEPRESETCOUNT extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETENCODEPRESETCOUNT(Pointer p) { super(p); } + protected PNVENCGETENCODEPRESETCOUNT() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @ByVal GUID encodeGUID, @Cast("uint32_t*") IntPointer encodePresetGUIDCount); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETGUIDS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETGUIDS.java new file mode 100644 index 00000000000..fa21b414128 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPRESETGUIDS.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETENCODEPRESETGUIDS extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETENCODEPRESETGUIDS(Pointer p) { super(p); } + protected PNVENCGETENCODEPRESETGUIDS() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @ByVal GUID encodeGUID, GUID presetGUIDs, @Cast("uint32_t") int guidArraySize, @Cast("uint32_t*") IntPointer encodePresetGUIDCount); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPROFILEGUIDCOUNT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPROFILEGUIDCOUNT.java new file mode 100644 index 00000000000..3402cb9d771 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPROFILEGUIDCOUNT.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETENCODEPROFILEGUIDCOUNT extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETENCODEPROFILEGUIDCOUNT(Pointer p) { super(p); } + protected PNVENCGETENCODEPROFILEGUIDCOUNT() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @ByVal GUID encodeGUID, @Cast("uint32_t*") IntPointer encodeProfileGUIDCount); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPROFILEGUIDS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPROFILEGUIDS.java new file mode 100644 index 00000000000..866b1a278c3 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODEPROFILEGUIDS.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETENCODEPROFILEGUIDS extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETENCODEPROFILEGUIDS(Pointer p) { super(p); } + protected PNVENCGETENCODEPROFILEGUIDS() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @ByVal GUID encodeGUID, GUID profileGUIDs, @Cast("uint32_t") int guidArraySize, @Cast("uint32_t*") IntPointer GUIDCount); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODESTATS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODESTATS.java new file mode 100644 index 00000000000..07e4fc36b0f --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETENCODESTATS.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETENCODESTATS extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETENCODESTATS(Pointer p) { super(p); } + protected PNVENCGETENCODESTATS() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_STAT encodeStats); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETINPUTFORMATCOUNT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETINPUTFORMATCOUNT.java new file mode 100644 index 00000000000..6d6cbb23323 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETINPUTFORMATCOUNT.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETINPUTFORMATCOUNT extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETINPUTFORMATCOUNT(Pointer p) { super(p); } + protected PNVENCGETINPUTFORMATCOUNT() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @ByVal GUID encodeGUID, @Cast("uint32_t*") IntPointer inputFmtCount); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETINPUTFORMATS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETINPUTFORMATS.java new file mode 100644 index 00000000000..b9b7699c021 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETINPUTFORMATS.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETINPUTFORMATS extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETINPUTFORMATS(Pointer p) { super(p); } + protected PNVENCGETINPUTFORMATS() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @ByVal GUID encodeGUID, @Cast("NV_ENC_BUFFER_FORMAT*") IntPointer inputFmts, @Cast("uint32_t") int inputFmtArraySize, @Cast("uint32_t*") IntPointer inputFmtCount); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETLASTERROR.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETLASTERROR.java new file mode 100644 index 00000000000..ab06c353fe0 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETLASTERROR.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETLASTERROR extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETLASTERROR(Pointer p) { super(p); } + protected PNVENCGETLASTERROR() { allocate(); } + private native void allocate(); + public native String call(Pointer encoder); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETSEQUENCEPARAMEX.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETSEQUENCEPARAMEX.java new file mode 100644 index 00000000000..de350ab3952 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETSEQUENCEPARAMEX.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETSEQUENCEPARAMEX extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETSEQUENCEPARAMEX(Pointer p) { super(p); } + protected PNVENCGETSEQUENCEPARAMEX() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_INITIALIZE_PARAMS encInitParams, NV_ENC_SEQUENCE_PARAM_PAYLOAD sequenceParamPayload); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETSEQUENCEPARAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETSEQUENCEPARAMS.java new file mode 100644 index 00000000000..6af25e7cb32 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCGETSEQUENCEPARAMS.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCGETSEQUENCEPARAMS extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCGETSEQUENCEPARAMS(Pointer p) { super(p); } + protected PNVENCGETSEQUENCEPARAMS() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_SEQUENCE_PARAM_PAYLOAD sequenceParamPayload); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCINITIALIZEENCODER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCINITIALIZEENCODER.java new file mode 100644 index 00000000000..c3c587ff972 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCINITIALIZEENCODER.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCINITIALIZEENCODER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCINITIALIZEENCODER(Pointer p) { super(p); } + protected PNVENCINITIALIZEENCODER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_INITIALIZE_PARAMS createEncodeParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCINVALIDATEREFFRAMES.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCINVALIDATEREFFRAMES.java new file mode 100644 index 00000000000..7be05195673 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCINVALIDATEREFFRAMES.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCINVALIDATEREFFRAMES extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCINVALIDATEREFFRAMES(Pointer p) { super(p); } + protected PNVENCINVALIDATEREFFRAMES() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, @Cast("uint64_t") int invalidRefFrameTimeStamp); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCLOCKBITSTREAM.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCLOCKBITSTREAM.java new file mode 100644 index 00000000000..34cce89785b --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCLOCKBITSTREAM.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCLOCKBITSTREAM extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCLOCKBITSTREAM(Pointer p) { super(p); } + protected PNVENCLOCKBITSTREAM() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_LOCK_BITSTREAM lockBitstreamBufferParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCLOCKINPUTBUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCLOCKINPUTBUFFER.java new file mode 100644 index 00000000000..dbd4f57706f --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCLOCKINPUTBUFFER.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCLOCKINPUTBUFFER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCLOCKINPUTBUFFER(Pointer p) { super(p); } + protected PNVENCLOCKINPUTBUFFER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_LOCK_INPUT_BUFFER lockInputBufferParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCMAPINPUTRESOURCE.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCMAPINPUTRESOURCE.java new file mode 100644 index 00000000000..1cbd25c69fe --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCMAPINPUTRESOURCE.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCMAPINPUTRESOURCE extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCMAPINPUTRESOURCE(Pointer p) { super(p); } + protected PNVENCMAPINPUTRESOURCE() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_MAP_INPUT_RESOURCE mapInputResParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCOPENENCODESESSION.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCOPENENCODESESSION.java new file mode 100644 index 00000000000..b7e6a50468a --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCOPENENCODESESSION.java @@ -0,0 +1,31 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + + + +/** \cond API PFN */ +/* + * Defines API function pointers + */ +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCOPENENCODESESSION extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCOPENENCODESESSION(Pointer p) { super(p); } + protected PNVENCOPENENCODESESSION() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer device, @Cast("uint32_t") int deviceType, @Cast("void**") PointerPointer encoder); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCOPENENCODESESSIONEX.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCOPENENCODESESSIONEX.java new file mode 100644 index 00000000000..3107d46b55d --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCOPENENCODESESSIONEX.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCOPENENCODESESSIONEX extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCOPENENCODESESSIONEX(Pointer p) { super(p); } + protected PNVENCOPENENCODESESSIONEX() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS openSessionExParams, @Cast("void**") PointerPointer encoder); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCRECONFIGUREENCODER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCRECONFIGUREENCODER.java new file mode 100644 index 00000000000..530b67a1093 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCRECONFIGUREENCODER.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCRECONFIGUREENCODER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCRECONFIGUREENCODER(Pointer p) { super(p); } + protected PNVENCRECONFIGUREENCODER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_RECONFIGURE_PARAMS reInitEncodeParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCREGISTERASYNCEVENT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCREGISTERASYNCEVENT.java new file mode 100644 index 00000000000..cbb9d7e14f4 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCREGISTERASYNCEVENT.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCREGISTERASYNCEVENT extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCREGISTERASYNCEVENT(Pointer p) { super(p); } + protected PNVENCREGISTERASYNCEVENT() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_EVENT_PARAMS eventParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCREGISTERRESOURCE.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCREGISTERRESOURCE.java new file mode 100644 index 00000000000..f42b5201e0d --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCREGISTERRESOURCE.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCREGISTERRESOURCE extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCREGISTERRESOURCE(Pointer p) { super(p); } + protected PNVENCREGISTERRESOURCE() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_REGISTER_RESOURCE registerResParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCRUNMOTIONESTIMATIONONLY.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCRUNMOTIONESTIMATIONONLY.java new file mode 100644 index 00000000000..9d25205babe --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCRUNMOTIONESTIMATIONONLY.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCRUNMOTIONESTIMATIONONLY extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCRUNMOTIONESTIMATIONONLY(Pointer p) { super(p); } + protected PNVENCRUNMOTIONESTIMATIONONLY() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_MEONLY_PARAMS meOnlyParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCSETIOCUDASTREAMS.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCSETIOCUDASTREAMS.java new file mode 100644 index 00000000000..c8b5eb4dd8e --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCSETIOCUDASTREAMS.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCSETIOCUDASTREAMS extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCSETIOCUDASTREAMS(Pointer p) { super(p); } + protected PNVENCSETIOCUDASTREAMS() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_CUSTREAM_PTR inputStream, NV_ENC_CUSTREAM_PTR outputStream); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNLOCKBITSTREAM.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNLOCKBITSTREAM.java new file mode 100644 index 00000000000..fe8884950cf --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNLOCKBITSTREAM.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCUNLOCKBITSTREAM extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCUNLOCKBITSTREAM(Pointer p) { super(p); } + protected PNVENCUNLOCKBITSTREAM() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_OUTPUT_PTR bitstreamBuffer); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNLOCKINPUTBUFFER.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNLOCKINPUTBUFFER.java new file mode 100644 index 00000000000..e2e63832e7c --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNLOCKINPUTBUFFER.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCUNLOCKINPUTBUFFER extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCUNLOCKINPUTBUFFER(Pointer p) { super(p); } + protected PNVENCUNLOCKINPUTBUFFER() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_INPUT_PTR inputBuffer); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNMAPINPUTRESOURCE.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNMAPINPUTRESOURCE.java new file mode 100644 index 00000000000..bf2d2624480 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNMAPINPUTRESOURCE.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCUNMAPINPUTRESOURCE extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCUNMAPINPUTRESOURCE(Pointer p) { super(p); } + protected PNVENCUNMAPINPUTRESOURCE() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_INPUT_PTR mappedInputBuffer); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNREGISTERASYNCEVENT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNREGISTERASYNCEVENT.java new file mode 100644 index 00000000000..ddddbb23bd4 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNREGISTERASYNCEVENT.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCUNREGISTERASYNCEVENT extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCUNREGISTERASYNCEVENT(Pointer p) { super(p); } + protected PNVENCUNREGISTERASYNCEVENT() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_EVENT_PARAMS eventParams); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNREGISTERRESOURCE.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNREGISTERRESOURCE.java new file mode 100644 index 00000000000..a7bc8f04888 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/PNVENCUNREGISTERRESOURCE.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +@Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class PNVENCUNREGISTERRESOURCE extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public PNVENCUNREGISTERRESOURCE(Pointer p) { super(p); } + protected PNVENCUNREGISTERRESOURCE() { allocate(); } + private native void allocate(); + public native @Cast("NVENCSTATUS") int call(Pointer encoder, NV_ENC_REGISTERED_PTR registeredRes); +} diff --git a/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/RECT.java b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/RECT.java new file mode 100644 index 00000000000..79707df9cd1 --- /dev/null +++ b/nvcodec/src/gen/java/org/bytedeco/nvcodec/nvencodeapi/RECT.java @@ -0,0 +1,49 @@ +// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE + +package org.bytedeco.nvcodec.nvencodeapi; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.bytedeco.javacpp.presets.javacpp.*; +import org.bytedeco.cuda.cudart.*; +import static org.bytedeco.cuda.global.cudart.*; +import org.bytedeco.nvcodec.nvcuvid.*; +import static org.bytedeco.nvcodec.global.nvcuvid.*; + +import static org.bytedeco.nvcodec.global.nvencodeapi.*; + +// #endif // GUID + +/** + * \struct _NVENC_RECT + * Defines a Rectangle. Used in ::NV_ENC_PREPROCESS_FRAME. + */ +@Name("NVENC_RECT") @Properties(inherit = org.bytedeco.nvcodec.presets.nvencodeapi.class) +public class RECT extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public RECT() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public RECT(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public RECT(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public RECT position(long position) { + return (RECT)super.position(position); + } + @Override public RECT getPointer(long i) { + return new RECT((Pointer)this).position(position + i); + } + + /** [in]: X coordinate of the upper left corner of rectangular area to be specified. */ + public native @Cast("uint32_t") int left(); public native RECT left(int setter); + /** [in]: Y coordinate of the upper left corner of the rectangular area to be specified. */ + public native @Cast("uint32_t") int top(); public native RECT top(int setter); + /** [in]: X coordinate of the bottom right corner of the rectangular area to be specified. */ + public native @Cast("uint32_t") int right(); public native RECT right(int setter); + /** [in]: Y coordinate of the bottom right corner of the rectangular area to be specified. */ + public native @Cast("uint32_t") int bottom(); public native RECT bottom(int setter); +} diff --git a/nvcodec/src/main/java/org/bytedeco/nvcodec/presets/nvcuvid.java b/nvcodec/src/main/java/org/bytedeco/nvcodec/presets/nvcuvid.java new file mode 100644 index 00000000000..4d36b740869 --- /dev/null +++ b/nvcodec/src/main/java/org/bytedeco/nvcodec/presets/nvcuvid.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2021 Park JeongHwan + * + * Licensed either under the Apache License, Version 2.0, or (at your option) + * under the terms of the GNU General Public License as published by + * the Free Software Foundation (subject to the "Classpath" exception), + * either version 2, or any later version (collectively, the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/ + * http://www.gnu.org/software/classpath/license.html + * + * or as provided in the LICENSE.txt file that accompanied this code. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.bytedeco.nvcodec.presets; + +import org.bytedeco.javacpp.ClassProperties; +import org.bytedeco.javacpp.LoadEnabled; +import org.bytedeco.javacpp.Loader; +import org.bytedeco.javacpp.annotation.Platform; +import org.bytedeco.javacpp.annotation.Properties; +import org.bytedeco.javacpp.tools.Info; +import org.bytedeco.javacpp.tools.InfoMap; +import org.bytedeco.javacpp.tools.InfoMapper; + +import java.util.List; + +import org.bytedeco.cuda.presets.cudart; + +/** + * + * @author Park JeongHwan + */ +@Properties( + inherit = cudart.class, + value = { + @Platform( + value = {"linux-x86_64", "windows-x86_64"}, + include = {"cuviddec.h", "nvcuvid.h"}, + link = "nvcuvid" + ), + @Platform( + value = "linux-x86_64", + includepath = {"/usr/include/x86_64-linux-gnu/", "/usr/local/videocodecsdk/Interface/"}, + linkpath = {"/usr/lib/x86_64-linux-gnu/", "/usr/local/videocodecsdk/Lib/linux/stubs/x86_64/"} + ), + @Platform( + value = "windows-x86_64", + includepath = "C:/Program Files/NVIDIA GPU Computing Toolkit/VideoCodecSDK/Interface/", + linkpath = "C:/Program Files/NVIDIA GPU Computing Toolkit/VideoCodecSDK/Lib/x64/" + ) + }, + target = "org.bytedeco.nvcodec.nvcuvid", + global = "org.bytedeco.nvcodec.global.nvcuvid" +) +public class nvcuvid implements LoadEnabled, InfoMapper { + @Override + public void init(ClassProperties properties) { + String platform = properties.getProperty("platform"); + List preloads = properties.get("platform.preload"); + List resources = properties.get("platform.preloadresource"); + + if (!Loader.isLoadLibraries()) { + return; + } + int i = 0; + String[] libs = {"cudart"}; + + for (String lib : libs) { + if (platform.startsWith("linux")) { + lib += lib.equals("cudart") ? "@.11.0" : lib.equals("nvrtc") ? "@.11.1" : "@.11"; + } else if (platform.startsWith("windows")) { + lib += lib.equals("cudart") ? "64_110" : lib.equals("nvrtc") ? "64_111_0" : "64_11"; + } else { + continue; + } + if (!preloads.contains(lib)) { + preloads.add(i++, lib); + } + } + if (i > 0) { + resources.add("/org/bytedeco/cuda/"); + } + } + + @Override + public void map(InfoMap infoMap) { + infoMap.put(new Info("cuviddec.h").linePatterns("#define cuvidMapVideoFrame.*", "#define cuvidUnmapVideoFrame.*").skip()) + + .put(new Info("NV_ENC_DEPRECATED").cppText("#define NV_ENC_DEPRECATED deprecated").cppTypes()) + .put(new Info("deprecated").annotations("@Deprecated")) + + .put(new Info("std::size_t").cast().valueTypes("long").pointerTypes("LongPointer", "LongBuffer", "long[]")) + .put(new Info("const char").pointerTypes("String", "@Cast(\"const char*\") BytePointer")) + + .put(new Info("CUvideoctxlock").valueTypes("_CUcontextlock_st").pointerTypes("@ByPtrPtr _CUcontextlock_st")) + .put(new Info("_CUVIDPICPARAMS").valueTypes("CUVIDPICPARAMS")) + + .put(new Info("defined(__CUVID_DEVPTR64)").define(true)) + .put(new Info("defined(__CUVID_DEVPTR64) && !defined(__CUVID_INTERNAL)").define(true)) + .put(new Info("!defined(__CUVID_DEVPTR64) || defined(__CUVID_INTERNAL)").define(false)); + } +} diff --git a/nvcodec/src/main/java/org/bytedeco/nvcodec/presets/nvencodeapi.java b/nvcodec/src/main/java/org/bytedeco/nvcodec/presets/nvencodeapi.java new file mode 100644 index 00000000000..650e991ce00 --- /dev/null +++ b/nvcodec/src/main/java/org/bytedeco/nvcodec/presets/nvencodeapi.java @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2021 Park JeongHwan + * + * Licensed either under the Apache License, Version 2.0, or (at your option) + * under the terms of the GNU General Public License as published by + * the Free Software Foundation (subject to the "Classpath" exception), + * either version 2, or any later version (collectively, the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/ + * http://www.gnu.org/software/classpath/license.html + * + * or as provided in the LICENSE.txt file that accompanied this code. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.bytedeco.nvcodec.presets; + +import org.bytedeco.javacpp.annotation.Platform; +import org.bytedeco.javacpp.annotation.Properties; +import org.bytedeco.javacpp.presets.javacpp; +import org.bytedeco.javacpp.tools.Info; +import org.bytedeco.javacpp.tools.InfoMap; +import org.bytedeco.javacpp.tools.InfoMapper; +import org.bytedeco.nvcodec.presets.*; + +/** + * + * @author Park JeongHwan + */ +@Properties( + inherit = nvcuvid.class, + value = { + @Platform( + value = {"linux-x86_64", "windows-x86_64"}, + include = "nvEncodeAPI.h" + ), + @Platform( + value = "linux-x86_64", + includepath = {"/usr/include/x86_64-linux-gnu/", "/usr/local/videocodecsdk/Interface/"}, + linkpath = {"/usr/lib/x86_64-linux-gnu/", "/usr/local/videocodecsdk/Lib/linux/stubs/x86_64/"}, + link = "nvidia-encode" + ), + @Platform( + value = "windows-x86_64", + includepath = "C:/Program Files/NVIDIA GPU Computing Toolkit/VideoCodecSDK/Interface/", + linkpath = "C:/Program Files/NVIDIA GPU Computing Toolkit/VideoCodecSDK/Lib/x64/", + link = "nvencodeapi" + ) + }, + target = "org.bytedeco.nvcodec.nvencodeapi", + global = "org.bytedeco.nvcodec.global.nvencodeapi" +) + +public class nvencodeapi implements InfoMapper { + @Override + public void map(InfoMap infoMap) { + infoMap.put(new Info("NVENCAPI").cppTypes().annotations()) + + .put(new Info("NvEncInvalidateRefFrames").skip()) + .put(new Info("NvEncRegisterAsyncEvent").skip()) + .put(new Info("NvEncCreateBitstreamBuffer").skip()) + .put(new Info("NvEncOpenEncodeSession").skip()) + .put(new Info("NvEncSetIOCudaStreams").skip()) + .put(new Info("NvEncDestroyMVBuffer").skip()) + .put(new Info("NvEncDestroyBitstreamBuffer").skip()) + .put(new Info("NvEncUnregisterResource").skip()) + .put(new Info("NvEncDestroyEncoder").skip()) + .put(new Info("NvEncDestroyInputBuffer").skip()) + .put(new Info("NvEncGetEncodeProfileGUIDCount").skip()) + .put(new Info("NvEncCreateMVBuffer").skip()) + .put(new Info("NvEncGetSequenceParams").skip()) + .put(new Info("NvEncGetSequenceParamEx").skip()) + .put(new Info("NvEncGetEncodePresetCount").skip()) + .put(new Info("NvEncRunMotionEstimationOnly").skip()) + .put(new Info("NvEncGetEncodeGUIDs").skip()) + .put(new Info("NvEncReconfigureEncoder").skip()) + .put(new Info("NvEncGetInputFormats").skip()) + .put(new Info("NvEncOpenEncodeSessionEx").skip()) + .put(new Info("NvEncUnregisterAsyncEvent").skip()) + .put(new Info("NvEncEncodePicture").skip()) + .put(new Info("NvEncMapInputResource").skip()) + .put(new Info("NvEncGetInputFormatCount").skip()) + .put(new Info("NvEncGetEncodeGUIDCount").skip()) + .put(new Info("NvEncGetEncodeStats").skip()) + .put(new Info("NvEncUnlockBitstream").skip()) + .put(new Info("NvEncGetEncodePresetGUIDs").skip()) + .put(new Info("NvEncGetLastErrorString").skip()) + .put(new Info("NvEncGetEncodeCaps").skip()) + .put(new Info("NvEncGetEncodePresetConfig").skip()) + .put(new Info("NvEncUnmapInputResource").skip()) + .put(new Info("NvEncRegisterResource").skip()) + .put(new Info("NvEncLockBitstream").skip()) + .put(new Info("NvEncCreateInputBuffer").skip()) + .put(new Info("NvEncLockInputBuffer").skip()) + .put(new Info("NvEncUnlockInputBuffer").skip()) + .put(new Info("NvEncInitializeEncoder").skip()) + .put(new Info("NvEncGetEncodeProfileGUIDs").skip()) + .put(new Info("NvEncGetEncodePresetConfigEx").skip()) + + .put(new Info("NV_ENC_H264_SEI_PAYLOAD").cppText("")) + .put(new Info("nvEncodeAPI.h").linePatterns( + " \\* \\\\union _NV_ENC_PIC_PARAMS_H264_EXT", " \\* H264 extension picture parameters", + "#define NV_ENC_PARAMS_RC_VBR_MINQP.*", "#define NV_ENC_PARAMS_RC_CBR2.*", + "#define NV_ENC_BUFFER_FORMAT_NV12_PL.*", "#define NV_ENC_BUFFER_FORMAT_YUV444_PL.*").skip()); + } +} diff --git a/nvcodec/src/main/java9/module-info.java b/nvcodec/src/main/java9/module-info.java new file mode 100644 index 00000000000..340ca2cfa81 --- /dev/null +++ b/nvcodec/src/main/java9/module-info.java @@ -0,0 +1,8 @@ +module org.bytedeco.nvcodec { + requires transitive org.bytedeco.javacpp; + requires transitive org.bytedeco.cuda; + exports org.bytedeco.nvcodec.global; + exports org.bytedeco.nvcodec.presets; + exports org.bytedeco.nvcodec.nvcuvid; + exports org.bytedeco.nvcodec.nvencodeapi; +} \ No newline at end of file diff --git a/platform/pom.xml b/platform/pom.xml index 0da9574d851..aa2617ad2c1 100644 --- a/platform/pom.xml +++ b/platform/pom.xml @@ -50,6 +50,7 @@ ../caffe/platform ../openpose/platform ../cuda/platform + ../nvcodec/platform ../opencl/platform ../mxnet/platform ../tensorflow/platform @@ -248,6 +249,11 @@ cuda-platform 11.2-8.1-${project.version} + + org.bytedeco + nvcodec-platform + 11.0.10-${project.parent.version} + org.bytedeco opencl-platform diff --git a/pom.xml b/pom.xml index dea2794e1a3..d26f487b4b2 100644 --- a/pom.xml +++ b/pom.xml @@ -613,6 +613,7 @@ caffe openpose cuda + nvcodec opencl mxnet tensorflow @@ -1339,6 +1340,7 @@ caffe openpose cuda + nvcodec opencl mxnet tensorflow @@ -1552,6 +1554,7 @@ leptonica tesseract cuda + nvcodec opencl mxnet tensorflow diff --git a/tensorrt/pom.xml b/tensorrt/pom.xml index b10b368a4aa..e493e92f0c4 100644 --- a/tensorrt/pom.xml +++ b/tensorrt/pom.xml @@ -43,6 +43,9 @@ org.bytedeco javacpp + + ISO-8859-1 + org.bytedeco @@ -121,6 +124,9 @@ maven-javadoc-plugin + + ISO-8859-1 +