// copies huffman tables from parsed stream. should require same scans structure public void CopyHuffmanTables(EncoderParams encoderParams, JpegStream jpeg, CudaStream stream) { res = NvJpegNativeMethods.nvjpegEncoderParamsCopyHuffmanTables(_state, encoderParams.Params, jpeg.Stream, stream.Stream); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvjpegEncoderParamsCopyHuffmanTables", res)); if (res != nvjpegStatus.Success) { throw new NvJpegException(res); } }
// starts decoding on host and save decode parameters to the state public void DecodeJpegHost(DecodeParams param, JpegStream stream) { res = NvJpegNativeMethods.nvjpegDecodeJpegHost(_nvJpeg.Handle, _decoder.Decoder, _state, param.Params, stream.Stream); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvjpegDecodeJpegHost", res)); if (res != nvjpegStatus.Success) { throw new NvJpegException(res); } }
// hybrid stage of decoding image, involves device async calls // note that jpeg stream is a parameter here - because we still might need copy // parts of bytestream to device public void DecodeJpegTransferToDevice(JpegStream jpegStream, CudaStream cudaStream) { res = NvJpegNativeMethods.nvjpegDecodeJpegTransferToDevice(_nvJpeg.Handle, _decoder.Decoder, _state, jpegStream.Stream, cudaStream.Stream); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvjpegDecodeJpegTransferToDevice", res)); if (res != nvjpegStatus.Success) { throw new NvJpegException(res); } }
public bool JpegSupported(DecodeParams param, JpegStream stream) { int result = 0; res = NvJpegNativeMethods.nvjpegDecoderJpegSupported(_decoder, stream.Stream, param.Params, ref result); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvjpegDecoderJpegSupported", res)); if (res != nvjpegStatus.Success) { throw new NvJpegException(res); } return(result > 0); }