Exemplo n.º 1
0
 public static extern nvjpegStatus nvjpegDecodeBatchedPreAllocate(
     nvjpegHandle handle,
     nvjpegJpegState jpeg_handle,
     int batch_size,
     int width,
     int height,
     nvjpegChromaSubsampling chroma_subsampling,
     nvjpegOutputFormat output_format);
Exemplo n.º 2
0
 public void DecodeBatchedInitialize(int batch_size, int max_cpuhreads, nvjpegOutputFormat output_format)
 {
     res = NvJpegNativeMethods.nvjpegDecodeBatchedInitialize(_nvJpeg.Handle, _state, batch_size, max_cpuhreads, output_format);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvjpegDecodeBatchedInitialize", res));
     if (res != nvjpegStatus.Success)
     {
         throw new NvJpegException(res);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Decodes a single image, and writes the decoded image in the desired format to the output buffers. This function is asynchronous with respect to the host. All GPU tasks for this function will be submitted to the provided stream.
 /// </summary>
 /// <param name="data">the encoded data.</param>
 /// <param name="length">Size of the encoded data in bytes.</param>
 /// <param name="output_format">Format in which the decoded output will be saved.</param>
 /// <param name="destination">Pointer to the structure that describes the output destination. This structure should be on the host (CPU), but the pointers in this structure should be pointing to the device (i.e., GPU) memory.</param>
 /// <param name="stream">The CUDA stream where all of the GPU work will be submitted.</param>
 public void Decode(IntPtr data, SizeT length, nvjpegOutputFormat output_format, ref nvjpegImage destination, CudaStream stream)
 {
     res = NvJpegNativeMethods.nvjpegDecode(_nvJpeg.Handle, _state, data, length, output_format, ref destination, stream.Stream);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvjpegDecode", res));
     if (res != nvjpegStatus.Success)
     {
         throw new NvJpegException(res);
     }
 }
Exemplo n.º 4
0
        ///////////////////////////////////////////////////////////////////////////////////
        // Decode parameters //
        ///////////////////////////////////////////////////////////////////////////////////

        // set output pixel format - same value as in nvjpegDecode()
        public void SetOutputFormat(nvjpegOutputFormat output_format)
        {
            res = NvJpegNativeMethods.nvjpegDecodeParamsSetOutputFormat(_params, output_format);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvjpegDecodeParamsSetOutputFormat", res));
            if (res != nvjpegStatus.Success)
            {
                throw new NvJpegException(res);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Decodes a single image, and writes the decoded image in the desired format to the output buffers. This function is asynchronous with respect to the host. All GPU tasks for this function will be submitted to the provided stream.<para/>
        /// Note: Synchronizes on stream. For async use IntPtr!
        /// </summary>
        /// <param name="data">the encoded data.</param>
        /// <param name="output_format">Format in which the decoded output will be saved.</param>
        /// <param name="destination">Pointer to the structure that describes the output destination. This structure should be on the host (CPU), but the pointers in this structure should be pointing to the device (i.e., GPU) memory.</param>
        /// <param name="stream">The CUDA stream where all of the GPU work will be submitted.</param>
        public void Decode(byte[] data, nvjpegOutputFormat output_format, ref nvjpegImage destination, CudaStream stream)
        {
            GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);

            try
            {
                IntPtr ptr = handle.AddrOfPinnedObject();
                res = NvJpegNativeMethods.nvjpegDecode(_nvJpeg.Handle, _state, ptr, data.Length, output_format, ref destination, stream.Stream);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvjpegDecode", res));
                stream.Synchronize();
            }
            finally
            {
                handle.Free();
            }

            if (res != nvjpegStatus.Success)
            {
                throw new NvJpegException(res);
            }
        }
Exemplo n.º 6
0
 public static extern nvjpegStatus nvjpegDecodeParamsSetOutputFormat(
     nvjpegDecodeParams decode_params,
     nvjpegOutputFormat output_format);
Exemplo n.º 7
0
 public static extern nvjpegStatus nvjpegDecodeBatchedInitialize(
     nvjpegHandle handle,
     nvjpegJpegState jpeg_handle,
     int batch_size,
     int max_cpuhreads,
     nvjpegOutputFormat output_format);
Exemplo n.º 8
0
 public static extern nvjpegStatus nvjpegDecode(nvjpegHandle handle, nvjpegJpegState jpeg_handle, IntPtr data,
                                                SizeT length, nvjpegOutputFormat output_format, ref nvjpegImage destination, CUstream stream);
Exemplo n.º 9
0
 public void DecodeBatchedPreAllocate(int batch_size, int width, int height, nvjpegChromaSubsampling chroma_subsampling, nvjpegOutputFormat output_format)
 {
     res = NvJpegNativeMethods.nvjpegDecodeBatchedPreAllocate(_nvJpeg.Handle, _state, batch_size, width, height, chroma_subsampling, output_format);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvjpegDecodeBatchedPreAllocate", res));
     if (res != nvjpegStatus.Success)
     {
         throw new NvJpegException(res);
     }
 }