Sophie

Sophie

distrib > Mageia > 7 > x86_64 > media > nonfree-updates > by-pkgid > b86a85131cc739c1c53d0b55840a4328 > files > 3626

nvidia-cuda-toolkit-devel-10.1.168-1.2.mga7.nonfree.x86_64.rpm

<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
      <meta http-equiv="X-UA-Compatible" content="IE=edge"></meta>
      <meta name="copyright" content="(C) Copyright 2005"></meta>
      <meta name="DC.rights.owner" content="(C) Copyright 2005"></meta>
      <meta name="DC.Type" content="concept"></meta>
      <meta name="DC.Title" content="nvJPEG Library"></meta>
      <meta name="abstract" content="A GPU-accelerated JPEG decoding library."></meta>
      <meta name="description" content="A GPU-accelerated JPEG decoding library."></meta>
      <meta name="DC.Coverage" content="CUDA API References"></meta>
      <meta name="DC.subject" content="nvJPEG, CUDA nvJPEG"></meta>
      <meta name="keywords" content="nvJPEG, CUDA nvJPEG"></meta>
      <meta name="DC.Format" content="XHTML"></meta>
      <meta name="DC.Identifier" content="abstract"></meta>
      <link rel="stylesheet" type="text/css" href="../common/formatting/commonltr.css"></link>
      <link rel="stylesheet" type="text/css" href="../common/formatting/site.css"></link>
      <title>nvJPEG  :: CUDA Toolkit Documentation</title>
      <!--[if lt IE 9]>
      <script src="../common/formatting/html5shiv-printshiv.min.js"></script>
      <![endif]-->
      <script type="text/javascript" charset="utf-8" src="//assets.adobedtm.com/b92787824f2e0e9b68dc2e993f9bd995339fe417/satelliteLib-7ba51e58dc61bcb0e9311aadd02a0108ab24cc6c.js"></script>
      <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.min.js"></script>
      <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.ba-hashchange.min.js"></script>
      <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.scrollintoview.min.js"></script>
      <script type="text/javascript" src="../search/htmlFileList.js"></script>
      <script type="text/javascript" src="../search/htmlFileInfoList.js"></script>
      <script type="text/javascript" src="../search/nwSearchFnt.min.js"></script>
      <script type="text/javascript" src="../search/stemmers/en_stemmer.min.js"></script>
      <script type="text/javascript" src="../search/index-1.js"></script>
      <script type="text/javascript" src="../search/index-2.js"></script>
      <script type="text/javascript" src="../search/index-3.js"></script>
      <link rel="canonical" href="http://docs.nvidia.com/cuda/nvjpeg/index.html"></link>
      <link rel="stylesheet" type="text/css" href="../common/formatting/qwcode.highlight.css"></link>
   </head>
   <body>
      
      <header id="header"><span id="company">NVIDIA</span><span id="site-title">CUDA Toolkit Documentation</span><form id="search" method="get" action="search">
            <input type="text" name="search-text"></input><fieldset id="search-location">
               <legend>Search In:</legend>
               <label><input type="radio" name="search-type" value="site"></input>Entire Site</label>
               <label><input type="radio" name="search-type" value="document"></input>Just This Document</label></fieldset>
            <button type="reset">clear search</button>
            <button id="submit" type="submit">search</button></form>
      </header>
      <div id="site-content">
         <nav id="site-nav">
            <div class="category closed"><a href="../index.html" title="The root of the site.">CUDA Toolkit 
                  
                  
                  v10.1.168</a></div>
            <div class="category"><a href="index.html" title="nvJPEG ">nvJPEG </a></div>
            <ul>
               <li>
                  <div class="section-link"><a href="#introduction">1.&nbsp;Introduction</a></div>
                  <ul>
                     <li>
                        <div class="section-link"><a href="#nvjpeg-decoder-introduction">1.1.&nbsp;nvJPEG Decoder</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="#nvjpeg-encoder-introduction">1.2.&nbsp;nvJPEG Encoder</a></div>
                     </li>
                  </ul>
               </li>
               <li>
                  <div class="section-link"><a href="#title-nvjpeg-decode">2.&nbsp;JPEG Decoding</a></div>
                  <ul>
                     <li>
                        <div class="section-link"><a href="#using-nvjpeg-api">2.1.&nbsp;Using JPEG Decoding</a></div>
                        <ul>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-single-image-decoding">2.1.1.&nbsp;Single Image Decoding</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-decode-by-phases">2.1.2.&nbsp;Decode by Phases</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-batched-image-decoding">2.1.3.&nbsp;Batched Image Decoding</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-batched-single-phase">2.1.4.&nbsp;Single Phase</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-batched-multiple-phases">2.1.5.&nbsp;Multiple Phases</a></div>
                           </li>
                        </ul>
                     </li>
                     <li>
                        <div class="section-link"><a href="#nvjpeg-type-declarations">2.2.&nbsp;nvJPEG Type Declarations</a></div>
                        <ul>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-memory-allocator-interface">2.2.1.&nbsp;nvJPEG Device Memory Allocator Interface</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-host-pinned-memory-allocator-interface">2.2.2.&nbsp;nvJPEG Host Pinned Memory Allocator Interface</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-opaque-lib-handle-struct">2.2.3.&nbsp;nvJPEG Opaque Library Handle Struct</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-opaque-jpeg-decoding-state-handle">2.2.4.&nbsp;nvJPEG Opaque JPEG Decoding State Handle</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-output-pointer-struct">2.2.5.&nbsp;nvJPEG Output Pointer Struct</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-backend">2.2.6.&nbsp;nvJPEG Backend</a></div>
                           </li>
                        </ul>
                     </li>
                     <li>
                        <div class="section-link"><a href="#nvjpeg-api-reference">2.3.&nbsp;nvJPEG API Reference</a></div>
                        <ul>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-helper-api-reference">2.3.1.&nbsp;nvJPEG Helper API Reference</a></div>
                              <ul>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-get-property">2.3.1.1.&nbsp;nvjpegGetProperty()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-create">2.3.1.2.&nbsp;nvjpegCreate()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-create-simple">2.3.1.3.&nbsp;nvjpegCreateSimple()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-create-ex">2.3.1.4.&nbsp;nvjpegCreateEx()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpegDestroy">2.3.1.5.&nbsp;nvjpegDestroy()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-set-device-mem-padding">2.3.1.6.&nbsp;nvjpegSetDeviceMemoryPadding()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-get-device-mem-padding">2.3.1.7.&nbsp;nvjpegGetDeviceMemoryPadding()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-set-pinned-mem-padding">2.3.1.8.&nbsp;nvjpegSetPinnedMemoryPadding()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-get-pinned-mem-padding">2.3.1.9.&nbsp;nvjpegGetPinnedMemoryPadding()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpegJpegStateCreate">2.3.1.10.&nbsp;nvjpegJpegStateCreate()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpegJpegStateDestroy">2.3.1.11.&nbsp;nvjpegJpegStateDestroy()</a></div>
                                 </li>
                              </ul>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-retrieve-image-info-api">2.3.2.&nbsp;Retrieve Encoded Image Information API</a></div>
                              <ul>
                                 <li>
                                    <div class="section-link"><a href="#nvjpegGetImageInfo">2.3.2.1.&nbsp;nvjpegGetImageInfo()</a></div>
                                 </li>
                              </ul>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-decode-api-single-phase">2.3.3.&nbsp;Decode API -- Single Phase</a></div>
                              <ul>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-decode">2.3.3.1.&nbsp;​nvjpegDecode()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-decode-batched-init">2.3.3.2.&nbsp;​nvjpegDecodeBatchedInitialize()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-decode-batched">2.3.3.3.&nbsp;​nvjpegDecodeBatched()</a></div>
                                 </li>
                              </ul>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-decode-multiple-phase-api">2.3.4.&nbsp;Decode API -- Multiple Phases</a></div>
                              <ul>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-decode-phaseone">2.3.4.1.&nbsp;​nvjpegDecodePhaseOne()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-decode-phasetwo">2.3.4.2.&nbsp;​nvjpegDecodePhaseTwo()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-decode-phasethree">2.3.4.3.&nbsp;​nvjpegDecodePhaseThree()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-decode-batched-phaseone">2.3.4.4.&nbsp;​nvjpegDecodeBatchedPhaseOne()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-decode-batched-phasetwo">2.3.4.5.&nbsp;nvjpegDecodeBatchedPhaseTwo()</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#nvjpeg-decode-batched-phasethree">2.3.4.6.&nbsp;
                                          nvjpegDecodeBatchedPhaseThree()</a></div>
                                 </li>
                              </ul>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-api-return-codes">2.3.5.&nbsp;nvjpeg-api-return-codes</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-chroma-subsampling">2.3.6.&nbsp;nvjpeg-chroma-subsampling</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-reference-docs">2.3.7.&nbsp;Reference Documents</a></div>
                           </li>
                        </ul>
                     </li>
                     <li>
                        <div class="section-link"><a href="#nvjpeg-examples">2.4.&nbsp;Examples of nvJPEG</a></div>
                     </li>
                  </ul>
               </li>
               <li>
                  <div class="section-link"><a href="#title-nvjpeg-encode">3.&nbsp;JPEG Encoding</a></div>
                  <ul>
                     <li>
                        <div class="section-link"><a href="#using-encoder">3.1.&nbsp;Using the Encoder</a></div>
                        <ul>
                           <li>
                              <div class="section-link"><a href="#encoding-parameters">3.1.1.&nbsp;Encoding the Parameters</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#encoding-state">3.1.2.&nbsp;Encoding the State</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#encoding-the-image">3.1.3.&nbsp;Encoding the Image</a></div>
                              <ul>
                                 <li>
                                    <div class="section-link"><a href="#using-nvjpegEncodeYUV">3.1.3.1.&nbsp;nvjpegEncodeYUV</a></div>
                                 </li>
                                 <li>
                                    <div class="section-link"><a href="#using-nvjpegEncodeImage">3.1.3.2.&nbsp;nvjpegEncodeImage</a></div>
                                 </li>
                              </ul>
                           </li>
                           <li>
                              <div class="section-link"><a href="#retrieving-compressed-stream">3.1.4.&nbsp;Retrieving the Compressed Stream </a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encode-examples">3.1.5.&nbsp;JPEG Encoding Example</a></div>
                           </li>
                        </ul>
                     </li>
                     <li>
                        <div class="section-link"><a href="#nvjpeg-encoder-type-declarations">3.2.&nbsp;nvJPEG Encoder Type Declarations</a></div>
                        <ul>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-inputformat">3.2.1.&nbsp;nvjpegInputFormat_t</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encoder-state">3.2.2.&nbsp;nvjpegEncoderState_t</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encoder-params">3.2.3.&nbsp;nvjpegEncoderParams_t</a></div>
                           </li>
                        </ul>
                     </li>
                     <li>
                        <div class="section-link"><a href="#nvjpeg-encoder-helper-api-reference">3.3.&nbsp;nvJPEG Encoder Helper API Reference</a></div>
                        <ul>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encoder-state-create">3.3.1.&nbsp;nvjpegEncoderStateCreate()</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encoder-state-destroy">3.3.2.&nbsp;nvjpegEncoderStateDestroy()</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encoder-params-create">3.3.3.&nbsp;nvjpegEncoderParamsCreate()</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encoder-params-destroy">3.3.4.&nbsp;nvjpegEncoderParamsDestroy()</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encoder-params-set-quality">3.3.5.&nbsp;nvjpegEncoderParamsSetQuality()</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encoder-params-set-optimized-huffman">3.3.6.&nbsp;nvjpegEncoderParamsSetOptimizedHuffman()</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encoder-params-set-sampling-factors">3.3.7.&nbsp;nvjpegEncoderParamsSetSamplingFactors()</a></div>
                           </li>
                        </ul>
                     </li>
                     <li>
                        <div class="section-link"><a href="#nvjpeg-encoder-api-reference">3.4.&nbsp;nvJPEG Encoder API Reference</a></div>
                        <ul>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encoder-get-buffer-size">3.4.1.&nbsp;nvjpegEncodeGetBufferSize()</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encode-yuv">3.4.2.&nbsp;nvjpegEncodeYUV()</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encode-image">3.4.3.&nbsp;nvjpegEncodeImage()</a></div>
                           </li>
                           <li>
                              <div class="section-link"><a href="#nvjpeg-encode-retrieve-bitstream">3.4.4.&nbsp;nvjpegEncodeRetrieveBitstream()</a></div>
                           </li>
                        </ul>
                     </li>
                  </ul>
               </li>
            </ul>
         </nav>
         <div id="resize-nav"></div>
         <nav id="search-results">
            <h2>Search Results</h2>
            <ol></ol>
         </nav>
         
         <div id="contents-container">
            <div id="breadcrumbs-container">
               <div id="release-info">nvJPEG 
                  (<a href="../../pdf/nvJPEG.pdf">PDF</a>)
                  -
                   
                  
                  
                  v10.1.168
                  (<a href="https://developer.nvidia.com/cuda-toolkit-archive">older</a>)
                  -
                  Last updated April 24, 2019
                  -
                  <a href="mailto:CUDAIssues@nvidia.com?subject=CUDA Toolkit Documentation Feedback: nvJPEG ">Send Feedback</a></div>
            </div>
            <article id="contents">
               <div class="topic nested0" id="abstract"><a name="abstract" shape="rect">
                     <!-- --></a><h2 class="title topictitle1"><a href="#abstract" name="abstract" shape="rect">nvJPEG Library</a></h2>
                  <div class="body conbody">
                     <p class="shortdesc">A GPU-accelerated JPEG decoding library.</p>
                  </div>
               </div>
               <div class="topic concept nested0" xml:lang="en-us" id="introduction"><a name="introduction" shape="rect">
                     <!-- --></a><h2 class="title topictitle1"><a href="#introduction" name="introduction" shape="rect">1.&nbsp;Introduction</a></h2>
                  <div class="body conbody"></div>
                  <div class="topic concept nested1" xml:lang="en-us" id="nvjpeg-decoder-introduction"><a name="nvjpeg-decoder-introduction" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decoder-introduction" name="nvjpeg-decoder-introduction" shape="rect">1.1.&nbsp;nvJPEG Decoder</a></h3>
                     <div class="body conbody">
                        <p class="p">The nvJPEG 1.0 library provides high-performance, GPU accelerated JPEG decoding
                           			functionality for image formats commonly used in deep learning and hyperscale multimedia
                           			applications. The library offers single and batched JPEG decoding capabilities which
                           			efficiently utilize the available GPU resources for optimum performance; and the flexibility
                           			for users to manage the memory allocation needed for decoding. 
                        </p>
                        <p class="p">The nvJPEG library enables the following functions: use the JPEG image data stream as
                           input; retrieve the width and height of the image from the data stream, and use this
                           retrieved information to manage the GPU memory allocation and the decoding. A dedicated
                           API is provided for retrieving the image information from the raw JPEG image data
                           stream. 
                        </p>
                        <div class="note tip"><span class="tiptitle">Tip:</span> Throughout this document, the terms “CPU” and “Host” are used synonymously. Similarly,
                           the terms “GPU” and “Device” are synonymous.
                        </div>
                        <p class="p">The nvJPEG library supports the following:</p>
                        <p class="p"><strong class="ph b">JPEG options:</strong></p>
                        <ul class="ul">
                           <li dir="ltr" class="li">
                              <p dir="ltr" class="p">Baseline and Progressive JPEG decoding</p>
                           </li>
                           <li dir="ltr" class="li">
                              <p dir="ltr" class="p">8 bits per pixel</p>
                           </li>
                           <li dir="ltr" class="li">
                              <p dir="ltr" class="p">Huffman bitstream decoding</p>
                           </li>
                           <li dir="ltr" class="li">
                              <p dir="ltr" class="p">3 color channels (YCbCr) or 1 color channel (Grayscale)</p>
                           </li>
                           <li dir="ltr" class="li">
                              <p dir="ltr" class="p">8- and 16-bit quantization tables</p>
                           </li>
                           <li dir="ltr" class="li">
                              <p dir="ltr" class="p">The following chroma subsampling for the 3 color channels Y,
                                 Cb, Cr (Y, U, V): 
                              </p><a name="nvjpeg-decoder-introduction__ul_ld2_qxs_d2b" shape="rect">
                                 <!-- --></a><ul class="ul" id="nvjpeg-decoder-introduction__ul_ld2_qxs_d2b">
                                 <li dir="ltr" class="li">
                                    <p dir="ltr" class="p">4:4:4 </p>
                                 </li>
                                 <li dir="ltr" class="li">
                                    <p dir="ltr" class="p">4:2:2 </p>
                                 </li>
                                 <li dir="ltr" class="li">
                                    <p dir="ltr" class="p">4:2:0 </p>
                                 </li>
                                 <li dir="ltr" class="li">
                                    <p dir="ltr" class="p">4:4:0 </p>
                                 </li>
                                 <li dir="ltr" class="li">
                                    <p dir="ltr" class="p">4:1:1 and </p>
                                 </li>
                                 <li dir="ltr" class="li">
                                    <p dir="ltr" class="p">4:1:0</p>
                                 </li>
                              </ul>
                           </li>
                        </ul>
                        <p class="p"><strong class="ph b">Features:</strong></p>
                        <div class="p"><a name="nvjpeg-decoder-introduction__ul_pkt_c1t_d2b" shape="rect">
                              <!-- --></a><ul class="ul" id="nvjpeg-decoder-introduction__ul_pkt_c1t_d2b">
                              <li dir="ltr" class="li">
                                 <p dir="ltr" class="p">Hybrid decoding using both the CPU (i.e., host) and the GPU (i.e.,
                                    device).
                                 </p>
                              </li>
                              <li dir="ltr" class="li">
                                 <p dir="ltr" class="p">Input to the library is in the host memory, and the output is in
                                    the GPU memory.
                                 </p>
                              </li>
                              <li dir="ltr" class="li">
                                 <p dir="ltr" class="p">Single image and batched image decoding. </p>
                              </li>
                              <li dir="ltr" class="li">
                                 <p dir="ltr" class="p">Single phase and multiple phases decoding.</p>
                              </li>
                              <li dir="ltr" class="li">
                                 <p dir="ltr" class="p">Color space conversion.</p>
                              </li>
                              <li dir="ltr" class="li">
                                 <p dir="ltr" class="p">User-provided memory manager for the device allocations.</p>
                              </li>
                           </ul>
                        </div>
                     </div>
                  </div>
                  <div class="topic concept nested1" xml:lang="en-us" id="nvjpeg-encoder-introduction"><a name="nvjpeg-encoder-introduction" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-introduction" name="nvjpeg-encoder-introduction" shape="rect">1.2.&nbsp;nvJPEG Encoder</a></h3>
                     <div class="body conbody">
                        <p class="p">The encoding functions of the nvJPEG library perform GPU-accelerated compression of user's
                           				image data to the JPEG bitstream. User can provide input data in a number of formats and
                           				colorspaces, and control the encoding process with parameters. Encoding functionality will
                           				allocate temporary buffers using user-provided memory allocator. 
                        </p>
                        <p class="p">Before calling the encoding functions the user should perform a few prerequisite steps
                           				using the helper functions described in <a class="xref" href="index.html#nvjpeg-encoder-helper-api-reference" shape="rect">nvJPEG Encoder Helper API Reference</a>. 
                        </p>
                     </div>
                  </div>
               </div>
               <div class="topic concept nested0" xml:lang="en-us" id="title-nvjpeg-decode"><a name="title-nvjpeg-decode" shape="rect">
                     <!-- --></a><h2 class="title topictitle1"><a href="#title-nvjpeg-decode" name="title-nvjpeg-decode" shape="rect">2.&nbsp;JPEG Decoding</a></h2>
                  <div class="body conbody"></div>
                  <div class="topic concept nested1" xml:lang="en-us" id="using-nvjpeg-api"><a name="using-nvjpeg-api" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#using-nvjpeg-api" name="using-nvjpeg-api" shape="rect">2.1.&nbsp;Using JPEG Decoding</a></h3>
                     <div class="body conbody">
                        <p class="p">​The nvJPEG library provides functions for both the decoding of a single image, and batched
                           			decoding of multiple images. 
                        </p>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-single-image-decoding"><a name="nvjpeg-single-image-decoding" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-single-image-decoding" name="nvjpeg-single-image-decoding" shape="rect">2.1.1.&nbsp;Single Image Decoding</a></h3>
                        <div class="body conbody">
                           <p class="p">For single-image decoding you provide the data size and a pointer to the file data, and the
                              			decoded image is placed in the output buffer. 
                           </p>
                           <p class="p">To use the nvJPEG library, start by calling the helper functions for initialization. </p><a name="nvjpeg-single-image-decoding__ul_w1k_qp5_d2b" shape="rect">
                              <!-- --></a><ol class="ol" id="nvjpeg-single-image-decoding__ul_w1k_qp5_d2b">
                              <li class="li">Create nvJPEG library handle with one of the helper functions <samp class="ph codeph">nvjpegCreateSimple()
                                    or nvjpegCreateEx()</samp>. 
                              </li>
                              <li dir="ltr" class="li">
                                 <p class="p">Create JPEG state with the helper function <samp class="ph codeph">nvjpegJpegStateCreate()</samp>. See
                                    						<a class="xref" href="index.html#nvjpeg-type-declarations" shape="rect">nvJPEG Type Declarations</a> and <samp class="ph codeph"><a class="xref" href="index.html#nvjpegJpegStateCreate" shape="rect">nvjpegJpegStateCreate()</a></samp>.
                                 </p>
                                 <p class="p">Below is the list of helper functions available in the nvJPEG library:</p>
                                 <div class="p"><a name="nvjpeg-single-image-decoding__ul_y1k_qp5_d2b" shape="rect">
                                       <!-- --></a><ul class="ul" id="nvjpeg-single-image-decoding__ul_y1k_qp5_d2b">
                                       <li dir="ltr" class="li"><samp class="ph codeph"> nvjpegStatus_t nvjpegGetProperty(libraryPropertyType
                                             								type, int *value); </samp></li>
                                       <li dir="ltr" class="li"><samp class="ph codeph"> [DEPRECATED] nvjpegStatus_t nvjpegCreate(nvjpegBackend_t backend,
                                             nvjpegHandle_t *handle , nvjpeg_dev_allocator allocator); </samp></li>
                                       <li class="li"><samp class="ph codeph">nvjpegStatus_t nvjpegCreateSimple(nvjpegHandle_t *handle); </samp></li>
                                       <li class="li"><samp class="ph codeph">nvjpegStatus_t nvjpegCreateEx(nvjpegBackend_t backend, nvjpegDevAllocator_t
                                             *dev_allocator, nvjpegPinnedAllocator_t *pinned_allocator, unsigned int flags,
                                             nvjpegHandle_t *handle); </samp></li>
                                       <li dir="ltr" class="li"><samp class="ph codeph"> nvjpegStatus_t nvjpegDestroy(nvjpegHandle_t handle);
                                             							</samp></li>
                                       <li dir="ltr" class="li"><samp class="ph codeph"> nvjpegStatus_t nvjpegJpegStateCreate(nvjpegHandle_t
                                             								handle, nvjpegJpegState_t *jpeg_handle); </samp></li>
                                       <li dir="ltr" class="li"><samp class="ph codeph"> nvjpegStatus_t nvjpegJpegStateDestroy(nvjpegJpegState
                                             								handle); </samp></li>
                                       <li class="li">Other helper functions such as <samp class="ph codeph">nvjpegSet*()</samp> and
                                          <samp class="ph codeph">nvjpegGet*()</samp> can be used to configure the library functionality on
                                          per-handle basis. Refer to the <a class="xref" href="index.html#nvjpeg-helper-api-reference" shape="rect">helper API
                                             reference</a> for more details. 
                                       </li>
                                    </ul>
                                 </div>
                              </li>
                              <li dir="ltr" class="li">
                                 <p class="p">Retrieve the width and height information from the JPEG-encoded image by using the
                                    						<samp class="ph codeph">nvjpegGetImageInfo()</samp> function. See also <samp class="ph codeph"><a class="xref" href="index.html#nvjpegGetImageInfo" shape="rect">nvjpegGetImageInfo()</a></samp>. 
                                 </p>
                                 <p class="p">Below is the signature of <samp class="ph codeph">nvjpegGetImageInfo() </samp>function: 
                                 </p>
                                 <div class="p"><pre xml:space="preserve">
nvjpegStatus_t nvjpegGetImageInfo(
  nvjpegHandle_t              handle,
  const unsigned char         *data,
  size_t                      length,
  int                         *nComponents,
  nvjpegChromaSubsampling_t   *subsampling,
  int                         *widths,
  int                         *heights); </pre></div>
                                 <p class="p">For each image to be decoded, pass the JPEG data pointer and data length to the above
                                    					function. The <samp class="ph codeph">nvjpegGetImageInfo()</samp> function is thread safe. 
                                 </p>
                              </li>
                              <li dir="ltr" class="li">
                                 <p class="p">One of the outputs of the above <samp class="ph codeph">nvjpegGetImageInfo()</samp> function is
                                    						<samp class="ph codeph">nvjpegChromaSubsampling_t</samp>. This parameter is an enum type,
                                    					and its enumerator list is composed of the chroma subsampling property retrieved
                                    					from the JPEG image. See <a class="xref" href="index.html#nvjpeg-chroma-subsampling" shape="rect">nvJPEG Chroma
                                       						Subsampling</a>. 
                                 </p>
                              </li>
                              <li dir="ltr" class="li">
                                 <p class="p">Use the <samp class="ph codeph">nvjpegDecode()</samp> function in the nvJPEG library to decode this
                                    					single JPEG image. See the signature of this function below:
                                 </p>
                                 <div class="p"><pre xml:space="preserve">
nvjpegStatus_t nvjpegDecode(
  nvjpegHandle_t          handle,
  nvjpegJpegState_t       jpeg_handle,
  const unsigned char     *data,
  size_t                  length, 
  nvjpegOutputFormat_t    output_format,
  nvjpegImage_t           *destination,
  cudaStream_t            stream);</pre></div>
                                 <p dir="ltr" class="p">In the above <samp class="ph codeph">nvjpegDecode()</samp> function, the parameters
                                    <samp class="ph codeph">nvjpegOutputFormat_t</samp>, <samp class="ph codeph">nvjpegImage_t</samp>, and
                                    <samp class="ph codeph">cudaStream_t</samp> can be used to set the output behavior of the
                                    <samp class="ph codeph">nvjpegDecode() </samp>function. You provide the <samp class="ph codeph">cudaStream_t</samp>
                                    parameter to indicate the stream to which your asynchronous tasks are submitted. 
                                 </p>
                              </li>
                              <li dir="ltr" class="li">
                                 <p class="p"><strong class="ph b">The <samp class="ph codeph">nvjpegOutputFormat_t</samp> parameter:</strong></p>
                                 <p class="p">The <samp class="ph codeph">nvjpegOutputFormat_t</samp> parameter can be set to one of the
                                    						<samp class="ph codeph">output_format</samp> settings below:
                                 </p>
                                 <div class="tablenoborder"><a name="nvjpeg-single-image-decoding__table_rbk_qp5_d2b" shape="rect">
                                       <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-single-image-decoding__table_rbk_qp5_d2b" class="table" frame="border" border="1" rules="all">
                                       <tbody class="tbody">
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="42.016806722689076%" rowspan="1" colspan="1"><strong class="ph b">output_format</strong></td>
                                             <td class="entry" dir="ltr" valign="top" width="57.98319327731092%" rowspan="1" colspan="1"><strong class="ph b">Meaning</strong></td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="42.016806722689076%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_OUTPUT_UNCHANGED</samp></td>
                                             <td class="entry" dir="ltr" valign="top" width="57.98319327731092%" rowspan="1" colspan="1">Return the decoded image planar format.</td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="42.016806722689076%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_OUTPUT_RGB</samp></td>
                                             <td class="entry" dir="ltr" valign="top" width="57.98319327731092%" rowspan="1" colspan="1">Convert to planar RGB.</td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="42.016806722689076%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_OUTPUT_BGR</samp></td>
                                             <td class="entry" dir="ltr" valign="top" width="57.98319327731092%" rowspan="1" colspan="1">Convert to planar BGR.</td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="42.016806722689076%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_OUTPUT_RGBI </samp></td>
                                             <td class="entry" dir="ltr" valign="top" width="57.98319327731092%" rowspan="1" colspan="1">Convert to interleaved RGB.</td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="42.016806722689076%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_OUTPUT_BGRI</samp></td>
                                             <td class="entry" dir="ltr" valign="top" width="57.98319327731092%" rowspan="1" colspan="1">Convert to interleaved BGR.</td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="42.016806722689076%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_OUTPUT_Y</samp></td>
                                             <td class="entry" dir="ltr" valign="top" width="57.98319327731092%" rowspan="1" colspan="1">Return the Y component only.</td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="42.016806722689076%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_OUTPUT_YUV</samp></td>
                                             <td class="entry" dir="ltr" valign="top" width="57.98319327731092%" rowspan="1" colspan="1">Return in the YUV planar format.</td>
                                          </tr>
                                       </tbody>
                                    </table>
                                 </div>
                                 <p class="p">For example, if the output_format is set to <samp class="ph codeph">NVJPEG_OUTPUT_Y</samp> or
                                    						<samp class="ph codeph">NVJPEG_OUTPUT_RGBI</samp>, or <samp class="ph codeph">NVJPEG_OUTPUT_BGRI</samp>
                                    					then the output is written only to channel[0], and the other channels are not
                                    					touched. 
                                 </p>
                                 <p class="p">Alternately, in the case of planar output, the data is written to the corresponding channels of
                                    					the <samp class="ph codeph">nvjpegImage_t</samp> destination structure. 
                                 </p>
                                 <p class="p">Finally, in the case of grayscale JPEG and RGB output, the luminance is used to create the
                                    					grayscale RGB.
                                 </p>
                              </li>
                              <li dir="ltr" class="li">
                                 <p class="p">As mentioned above, an important benefit of the
                                    					<samp class="ph codeph">nvjpegGetImageInfo()</samp>function is the ability to utilize the image
                                    					information retrieved from the the input JPEG image to allocate proper GPU
                                    					memory for your decoding operation. 
                                 </p>
                                 <p class="p">The <samp class="ph codeph"><a class="xref" href="index.html#nvjpegGetImageInfo" shape="rect">nvjpegGetImageInfo()</a></samp>
                                    					function returns the <samp class="ph codeph">widths</samp>, <samp class="ph codeph">heights</samp> and
                                    						<samp class="ph codeph">nComponents</samp> parameters. 
                                 </p>
                                 <div class="p"><pre xml:space="preserve">nvjpegStatus_t nvjpegGetImageInfo(
  nvjpegHandle_t             handle, 
  const unsigned char        *data, 
  size_t                     length,     
  int                        *nComponents, 
  nvjpegChromaSubsampling_t  *subsampling, 
  int                        *widths, 
  int                        *heights); </pre></div>
                                 <p class="p">You can use the retrieved parameters, <samp class="ph codeph">widths</samp>, <samp class="ph codeph">heights</samp>
                                    					and <samp class="ph codeph">nComponents</samp>, to calculate the required size for the output
                                    					buffers, either for a single decoded JPEG, or for every decoded JPEG in a batch. 
                                 </p>
                                 <p class="p">To optimally set the <samp class="ph codeph">destination</samp> parameter for the
                                    						<samp class="ph codeph">nvjpegDecode()</samp> function, use the following guidelines: 
                                 </p>
                                 <div class="tablenoborder"><a name="nvjpeg-single-image-decoding__table_tbk_qp5_d2b" shape="rect">
                                       <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-single-image-decoding__table_tbk_qp5_d2b" class="table" frame="border" border="1" rules="all">
                                       <tbody class="tbody">
                                          <tr class="row">
                                             <td class="entry" valign="top" width="33.850931677018636%" rowspan="1" colspan="1">
                                                <p dir="ltr" class="p"><strong class="ph b">For the </strong><strong class="ph b">output_format:</strong></p>
                                                <p dir="ltr" class="p">NVJPEG_OUTPUT_Y </p>
                                             </td>
                                             <td class="entry" dir="ltr" valign="top" width="35.09316770186335%" rowspan="1" colspan="1"><strong class="ph b">destination.pitch[0] should be at least: </strong>width[0]
                                             </td>
                                             <td class="entry" dir="ltr" valign="top" width="31.055900621118017%" rowspan="1" colspan="1"><strong class="ph b">destination.channel[0] should be at least of size:
                                                   </strong>destination.pitch[0]*height[0]
                                             </td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="33.850931677018636%" rowspan="1" colspan="1"><strong class="ph b">For the </strong><strong class="ph b">output_format</strong></td>
                                             <td class="entry" dir="ltr" valign="top" width="35.09316770186335%" rowspan="1" colspan="1"><strong class="ph b">destination.pitch[c] should be at least:</strong></td>
                                             <td class="entry" dir="ltr" valign="top" width="31.055900621118017%" rowspan="1" colspan="1"><strong class="ph b">destination.channel[c] should be at least of size:</strong></td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="33.850931677018636%" rowspan="1" colspan="1">NVJPEG_OUTPUT_YUV </td>
                                             <td class="entry" dir="ltr" valign="top" width="35.09316770186335%" rowspan="1" colspan="1">width[c] for c = 0, 1, 2</td>
                                             <td class="entry" dir="ltr" valign="top" width="31.055900621118017%" rowspan="1" colspan="1">destination.pitch[c]*height[c] for c = 0, 1, 2</td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="33.850931677018636%" rowspan="1" colspan="1">NVJPEG_OUTPUT_RGB and NVJPEG_OUTPUT_BGR</td>
                                             <td class="entry" dir="ltr" valign="top" width="35.09316770186335%" rowspan="1" colspan="1">width[0] for c = 0, 1, 2</td>
                                             <td class="entry" dir="ltr" valign="top" width="31.055900621118017%" rowspan="1" colspan="1">destination.pitch[0]*height[0] for c = 0, 1, 2</td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="33.850931677018636%" rowspan="1" colspan="1">NVJPEG_OUTPUT_RGBI and NVJPEG_OUTPUT_BGRI</td>
                                             <td class="entry" valign="top" width="35.09316770186335%" rowspan="1" colspan="1">width[0]*3</td>
                                             <td class="entry" dir="ltr" valign="top" width="31.055900621118017%" rowspan="1" colspan="1">destination.pitch[0]*height[0]</td>
                                          </tr>
                                          <tr class="row">
                                             <td class="entry" dir="ltr" valign="top" width="33.850931677018636%" rowspan="1" colspan="1">NVJPEG_OUTPUT_UNCHANGED</td>
                                             <td class="entry" dir="ltr" valign="top" width="35.09316770186335%" rowspan="1" colspan="1">width[c] for c = [ 0, nComponents - 1 ]</td>
                                             <td class="entry" dir="ltr" valign="top" width="31.055900621118017%" rowspan="1" colspan="1">destination.pitch[c]*height[c] for c = [ 0, nComponents -
                                                1]
                                             </td>
                                          </tr>
                                       </tbody>
                                    </table>
                                 </div>
                              </li>
                              <li dir="ltr" class="li">
                                 <p class="p">Ensure that the <samp class="ph codeph">nvjpegImage_t</samp> structure (or structures, in the case of
                                    					batched decode) is filled with the pointers and pitches of allocated buffers.
                                    					The <samp class="ph codeph">nvjpegImage_t</samp> structure that holds the output pointers is
                                    					defined as follows:
                                 </p>
                                 <div class="p"><pre xml:space="preserve">typedef struct
{
    unsigned char * channel[NVJPEG_MAX_COMPONENT]; 
    unsigned int pitch[NVJPEG_MAX_COMPONENT];
} nvjpegImage_t;</pre></div>
                                 <p dir="ltr" class="p">NVJPEG_MAX_COMPONENT is the maximum number of color components the
                                    					nvJPEG library supports in the current release. For generic images, this is the
                                    					maximum number of encoded channels that the library is able to decompress. 
                                 </p>
                              </li>
                              <li class="li">
                                 <p class="p">Finally, when you call the <samp class="ph codeph">nvjpegDecode()</samp> function with the parameters as
                                    					described above, the <samp class="ph codeph">nvjpegDecode()</samp> function fills the output
                                    					buffers with the decoded data.
                                 </p>
                              </li>
                           </ol>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-decode-by-phases"><a name="nvjpeg-decode-by-phases" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-by-phases" name="nvjpeg-decode-by-phases" shape="rect">2.1.2.&nbsp;<strong class="ph b" id="docs-internal-guid-1f19484d-00d7-8d33-84a5-17a946e41d29"><a name="docs-internal-guid-1f19484d-00d7-8d33-84a5-17a946e41d29" shape="rect">
                                    <!-- --></a>Decode by
                                 Phases</strong></a></h3>
                        <div class="body conbody">
                           <p class="p">Alternately, you can decode a single image in multiple phases. This gives you flexibility in
                              			controlling the flow, and optimizing the decoding process.
                           </p>
                           <p class="p">To decode an image in multiple phases, follow these steps:</p><a name="nvjpeg-decode-by-phases__ul_w1k_qp5_d2b" shape="rect">
                              <!-- --></a><ol class="ol" id="nvjpeg-decode-by-phases__ul_w1k_qp5_d2b">
                              <li dir="ltr" class="li">Just as when you are decoding in a single phase, create the JPEG state with
                                 				the helper function <samp class="ph codeph">nvjpegJpegStateCreate()</samp>.
                              </li>
                              <li dir="ltr" class="li">
                                 <div class="p">Next, call the functions in the sequence below (see <a class="xref" href="index.html#nvjpeg-decode-multiple-phase-api" shape="rect">Decode API -- Multiple
                                       						Phases.</a>) <a name="nvjpeg-decode-by-phases__ul_crh_31v_d2b" shape="rect">
                                       <!-- --></a><ul class="ul" id="nvjpeg-decode-by-phases__ul_crh_31v_d2b">
                                       <li class="li"><samp class="ph codeph">nvjpegDecodePhaseOne()</samp></li>
                                       <li class="li"><samp class="ph codeph">nvjpegDecodePhaseTwo()</samp></li>
                                       <li class="li"><samp class="ph codeph">nvjpegDecodePhaseThree()</samp></li>
                                    </ul>
                                 </div>
                              </li>
                              <li dir="ltr" class="li">
                                 <p class="p"> At the conclusion of the third phase, the <samp class="ph codeph">nvjpegDecodePhaseThree()</samp>
                                    					function writes the decoded output at the memory location pointed to by its
                                    						<samp class="ph codeph">*destination</samp> parameter. 
                                 </p>
                              </li>
                           </ol>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-batched-image-decoding"><a name="nvjpeg-batched-image-decoding" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-batched-image-decoding" name="nvjpeg-batched-image-decoding" shape="rect">2.1.3.&nbsp;Batched Image Decoding</a></h3>
                        <div class="body conbody">
                           <p class="p">For the batched image decoding you provide pointers to multiple file data in the memory, and
                              also provide the buffer sizes for each file data. The nvJPEG library will decode these
                              multiple images, and will place the decoded data in the output buffers that you specified in
                              the parameters. 
                           </p>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-batched-single-phase"><a name="nvjpeg-batched-single-phase" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-batched-single-phase" name="nvjpeg-batched-single-phase" shape="rect">2.1.4.&nbsp;Single Phase</a></h3>
                        <div class="body conbody">
                           <p class="p"> For batched image decoding in single phase, follow these steps:</p><a name="nvjpeg-batched-single-phase__ul_ykh_nbv_d2b" shape="rect">
                              <!-- --></a><ol class="ol" id="nvjpeg-batched-single-phase__ul_ykh_nbv_d2b">
                              <li dir="ltr" class="li">
                                 <p dir="ltr" class="p">Call <samp class="ph codeph">nvjpegDecodeBatchedInitialize()</samp> function to
                                    					initialize the batched decoder. Specify the batch size in the
                                    						<samp class="ph codeph">batch_size</samp> parameter. See <samp class="ph codeph"><a class="xref" href="index.html#nvjpeg-decode-batched-init" shape="rect">nvjpegDecodeBatchedInitialize()</a></samp>.
                                 </p>
                              </li>
                              <li dir="ltr" class="li">
                                 <p dir="ltr" class="p">Next, call <samp class="ph codeph">nvjpegDecodeBatched()</samp> for each new batch.
                                    					Make sure to pass the parameters that are correct to the specific batch of
                                    					images. If the size of the batch changes, or if the batch decoding fails, then
                                    					call the <samp class="ph codeph">nvjpegDecodeBatchedInitialize()</samp> function again. 
                                 </p>
                              </li>
                           </ol>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-batched-multiple-phases"><a name="nvjpeg-batched-multiple-phases" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-batched-multiple-phases" name="nvjpeg-batched-multiple-phases" shape="rect">2.1.5.&nbsp;Multiple Phases</a></h3>
                        <div class="body conbody">
                           <p class="p">To decode a batch of images in multiple phases, follow these steps: </p>
                           <div class="note note"><span class="notetitle">Note:</span><p class="p">This is the only case where the JPEG state could be used by multiple threads at the same
                                 				time. 
                              </p>
                           </div><a name="nvjpeg-batched-multiple-phases__ul_nrh_kcv_d2b" shape="rect">
                              <!-- --></a><ol class="ol" id="nvjpeg-batched-multiple-phases__ul_nrh_kcv_d2b">
                              <li class="li">Create the JPEG state with the helper function <samp class="ph codeph">nvjpegJpegStateCreate()</samp>. 
                              </li>
                              <li class="li">Call the <samp class="ph codeph">nvjpegDecodeBatchedInitialize()</samp> function to initialize the
                                 				batched decoder. Specify the batch size in the <samp class="ph codeph">batch_size</samp>
                                 				parameter, and specify the <samp class="ph codeph">max_cpu_threads</samp> parameter to set the
                                 				maximum number of CPU threads that work on single batch.
                              </li>
                              <li class="li">Batched processing is done by calling the functions for the specific phases in
                                 					sequence:<a name="nvjpeg-batched-multiple-phases__ul_y44_ncv_d2b" shape="rect">
                                    <!-- --></a><ul class="ul" id="nvjpeg-batched-multiple-phases__ul_y44_ncv_d2b">
                                    <li class="li">In the first phase, call <samp class="ph codeph">nvjpegDecodePhaseOne()</samp> for each
                                       						image in the batch, according to the index of the image in the batch. Note
                                       						that this could be done using multiple threads. If multiple threads are used
                                       						then the thread index in the range [0, max_cpu_threads-1] should be provided
                                       						to the <samp class="ph codeph">nvjpegDecodeBatchedPhaseOne()</samp> function. Before
                                       						proceeding to the next phase, ensure that the
                                       							<samp class="ph codeph">nvjpegDecodePhaseOne()</samp> calls for every image have
                                       						finished.
                                    </li>
                                    <li class="li">Next, call <samp class="ph codeph">nvjpegDecodePhaseTwo().</samp>.
                                    </li>
                                    <li class="li">Finally, call <samp class="ph codeph">nvjpegDecodePhaseThree().</samp>.
                                    </li>
                                 </ul>
                              </li>
                              <li class="li">If you have another batch of images of the same size to process, then repeat from 3. </li>
                           </ol>
                        </div>
                     </div>
                  </div>
                  <div class="topic concept nested1" xml:lang="en-us" id="nvjpeg-type-declarations"><a name="nvjpeg-type-declarations" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-type-declarations" name="nvjpeg-type-declarations" shape="rect">2.2.&nbsp;nvJPEG Type Declarations</a></h3>
                     <div class="body conbody"></div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-memory-allocator-interface"><a name="nvjpeg-memory-allocator-interface" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-memory-allocator-interface" name="nvjpeg-memory-allocator-interface" shape="rect">2.2.1.&nbsp;nvJPEG Device Memory Allocator Interface</a></h3>
                        <div class="body conbody">
                           <div class="p"><pre xml:space="preserve">typedef int (*tDevMalloc)(void**, size_t); 
typedef int (*tDevFree)(void*); 
typedef struct 
  { 
    tDevMalloc dev_malloc; 
    tDevFree dev_free; 
  } nvjpegDevAllocator_t;</pre></div>
                           <p class="p">Users can tell the library to use their own device memory allocator. The function prototypes
                              			for the memory allocation and memory freeing functions are similar to the
                              				<samp class="ph codeph">cudaMalloc() </samp>and <samp class="ph codeph">cudaFree()</samp> functions. They should
                              			return 0 in case of success, and non-zero otherwise. A pointer to the
                              				<samp class="ph codeph">nvjpegDevAllocator_t</samp> structure, with properly filled fields, should
                              			be provided to the <samp class="ph codeph">nvjpegCreate()</samp> function. NULL is accepted, in which
                              			case the default memory allocation functions <samp class="ph codeph">cudaMalloc()</samp> and
                              				<samp class="ph codeph">cudaFree()</samp> is used. 
                           </p>
                           <p class="p">When the <samp class="ph codeph">nvjpegDevAllocator_t *allocator</samp> parameter in the
                              <samp class="ph codeph">nvjpegCreate()</samp> or <samp class="ph codeph">nvjpegCreateEx()</samp> function is set as a
                              pointer to the above <samp class="ph codeph">nvjpegDevAllocator_t</samp> structure, then this structure is
                              used for allocating and releasing the device memory. The function prototypes for the memory
                              allocation and memory freeing functions are similar to the <samp class="ph codeph">cudaMalloc()</samp> and
                              <samp class="ph codeph">cudaFree()</samp> functions. They should return 0 in case of success, and non-zero
                              otherwise. 
                           </p>
                           <p class="p">However, if the <samp class="ph codeph">nvjpegDevAllocator_t *allocator</samp> parameter in the
                              <samp class="ph codeph">nvjpegCreate()</samp> or <samp class="ph codeph">nvjpegCreateEx()</samp> function is set to
                              NULL, then the default memory allocation functions <samp class="ph codeph">cudaMalloc()</samp> and
                              <samp class="ph codeph">cudaFree()</samp> will be used. When using <samp class="ph codeph">nvjpegCreateSimple()</samp>
                              function to create library handle the default device memory allocator will be used. 
                           </p>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-host-pinned-memory-allocator-interface"><a name="nvjpeg-host-pinned-memory-allocator-interface" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-host-pinned-memory-allocator-interface" name="nvjpeg-host-pinned-memory-allocator-interface" shape="rect">2.2.2.&nbsp;nvJPEG Host Pinned Memory Allocator Interface</a></h3>
                        <div class="body conbody">
                           <div class="p"><pre xml:space="preserve">typedef int (*tPinnedMalloc)(void**, size_t, unsigned int flags);
typedef int (*tPinnedFree)(void*);
typedef struct 
{
tPinnedMalloc pinned_malloc;
tPinnedFree pinned_free;
} nvjpegPinnedAllocator_t;      </pre></div>
                           <p class="p">When the <samp class="ph codeph">nvjpegPinnedAllocator_t *allocator</samp> parameter in the
                              <samp class="ph codeph">nvjpegCreateEx()</samp> function is set as a pointer to the above
                              <samp class="ph codeph">nvjpegPinnedAllocator_t</samp> structure, then this structure will be used for
                              allocating and releasing host pinned memory for copying data to/from device. The function
                              prototypes for the memory allocation and memory freeing functions are similar to the
                              <samp class="ph codeph">cudaHostAlloc()</samp> and <samp class="ph codeph">cudaFreeHost()</samp> functions. They will
                              return 0 in case of success, and non-zero otherwise. 
                           </p>
                           <p class="p">However, if the <samp class="ph codeph">nvjpegPinnedAllocator_t *allocator</samp> parameter in the
                              <samp class="ph codeph">nvjpegCreateEx()</samp> function is set to NULL, then the default memory
                              allocation functions <samp class="ph codeph">cudaHostAlloc()</samp> and <samp class="ph codeph">cudaFreeHost()</samp> will
                              be used. When using <samp class="ph codeph">nvjpegCreate()</samp> or <samp class="ph codeph">nvjpegCreateSimple()</samp>
                              function to create library handle, the default host pinned memory allocator will be used. 
                           </p>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-opaque-lib-handle-struct"><a name="nvjpeg-opaque-lib-handle-struct" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-opaque-lib-handle-struct" name="nvjpeg-opaque-lib-handle-struct" shape="rect">2.2.3.&nbsp;nvJPEG Opaque Library Handle Struct</a></h3>
                        <div class="body conbody">
                           <div class="p"><pre xml:space="preserve">struct nvjpegHandle;
typedef struct nvjpegHandle* nvjpegHandle_t;</pre></div>
                           <p class="p">The library handle is used in any consecutive nvJPEG library calls, and should be initialized
                              first. 
                           </p>
                           <p class="p">The library handle is thread safe, and can be used by multiple threads simultaneously. </p>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-opaque-jpeg-decoding-state-handle"><a name="nvjpeg-opaque-jpeg-decoding-state-handle" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-opaque-jpeg-decoding-state-handle" name="nvjpeg-opaque-jpeg-decoding-state-handle" shape="rect">2.2.4.&nbsp;nvJPEG Opaque JPEG Decoding State Handle</a></h3>
                        <div class="body conbody">
                           <div class="p"><pre xml:space="preserve">struct nvjpegJpegState;
typedef struct nvjpegJpegState* nvjpegJpegState_t;</pre></div>
                           <p class="p">The <samp class="ph codeph">nvjpegJpegState</samp> structure stores the temporary JPEG information. It
                              should be initialized before any usage. This JPEG state handle can be reused after being used
                              in another decoding. The same JPEG handle should be used across the decoding phases for the
                              same image or batch. Multiple threads are allowed to share the JPEG state handle only when
                              processing same batch during first phase (<samp class="ph codeph">nvjpegDecodePhaseOne</samp>) . 
                           </p>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-output-pointer-struct"><a name="nvjpeg-output-pointer-struct" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-output-pointer-struct" name="nvjpeg-output-pointer-struct" shape="rect">2.2.5.&nbsp;nvJPEG Output Pointer Struct</a></h3>
                        <div class="body conbody">
                           <div class="p"><pre xml:space="preserve">typedef struct
  {
    unsigned char * channel[NVJPEG_MAX_COMPONENT];
    unsigned int pitch[NVJPEG_MAX_COMPONENT];
  } nvjpegImage_t;</pre></div>
                           <p class="p">The <samp class="ph codeph">nvjpegImage_t </samp>struct holds the pointers to the output buffers, and holds
                              the corresponding strides of those buffers for the image decoding.
                           </p>
                           <p class="p">See <a class="xref" href="index.html#nvjpeg-single-image-decoding" shape="rect">Single Image Decoding</a> on how to set up
                              the <samp class="ph codeph">nvjpegImage_t</samp> struct. 
                           </p>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-backend"><a name="nvjpeg-backend" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-backend" name="nvjpeg-backend" shape="rect">2.2.6.&nbsp;nvJPEG Backend</a></h3>
                        <div class="body conbody">
                           <div class="p"><pre xml:space="preserve">typedef enum {
	NVJPEG_BACKEND_DEFAULT = 0, 
	NVJPEG_BACKEND_HYBRID = 1,
	NVJPEG_BACKEND_GPU_HYBRID = 2
} nvjpegBackend_t; </pre></div>
                           <p class="p">The <samp class="ph codeph">nvjpegBackend_t</samp> enum is used to select either default back-end by
                              			default, or use GPU decoding for baseline JPEG images, or use CPU for Huffman decoding. 
                           </p>
                           <div class="p">
                              <div class="tablenoborder"><a name="nvjpeg-backend__table_ogq_y1x_bgb" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-backend__table_ogq_y1x_bgb" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" valign="top" rowspan="1" colspan="1"><strong class="ph b">Member</strong></td>
                                          <td class="entry" valign="top" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" rowspan="1" colspan="1">NVJPEG_BACKEND_DEFAULT</td>
                                          <td class="entry" valign="top" rowspan="1" colspan="1">Default back-end is selected internally</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" rowspan="1" colspan="1">NVJPEG_BACKEND_HYBRID</td>
                                          <td class="entry" dir="ltr" valign="top" rowspan="1" colspan="1">Uses CPU for Huffman decoding</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" rowspan="1" colspan="1">NVJPEG_BACKEND_GPU_HYBRID</td>
                                          <td class="entry" valign="top" rowspan="1" colspan="1">The function <samp class="ph codeph">nvjpegDecodeBatched</samp> will use GPU decoding for the
                                             								baseline JPEG images with interleaved scan when batch size is greater than 100. For
                                             								other JPEG types it uses CPU. Other nvJPEG decode APIs will continue to use CPU for
                                             								Huffman decode. 
                                          </td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
                  <div class="topic concept nested1" xml:lang="en-us" id="nvjpeg-api-reference"><a name="nvjpeg-api-reference" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-api-reference" name="nvjpeg-api-reference" shape="rect">2.3.&nbsp;nvJPEG API Reference</a></h3>
                     <div class="body conbody">
                        <p class="p">This section describes the nvJPEG API. </p>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-helper-api-reference"><a name="nvjpeg-helper-api-reference" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-helper-api-reference" name="nvjpeg-helper-api-reference" shape="rect">2.3.1.&nbsp;nvJPEG Helper API Reference</a></h3>
                        <div class="body conbody">
                           <p class="p">The nvJPEG helper functions are used for initializing. </p>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-get-property"><a name="nvjpeg-get-property" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-get-property" name="nvjpeg-get-property" shape="rect">2.3.1.1.&nbsp;nvjpegGetProperty()</a></h3>
                           <div class="body conbody">
                              <p class="p">Gets the numeric value for the major or minor version, or the patch level, of the nvJPEG
                                 			library. 
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegGetProperty(
	libraryPropertyType   type, 
	int                   *value);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-get-property__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-get-property__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">libraryPropertyType type</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">One of the supported <samp class="ph codeph">libraryPropertyType</samp> values, that is,
                                             							MAJOR_VERSION, MINOR_VERSION or PATCH_LEVEL.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">int *value</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Output</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The numeric value corresponding to the specific
                                             								<samp class="ph codeph">libraryPropertyType</samp> requested.
                                          </td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-create"><a name="nvjpeg-create" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-create" name="nvjpeg-create" shape="rect">2.3.1.2.&nbsp;nvjpegCreate()</a></h3>
                           <div class="body conbody">
                              <p class="p">Allocates and initializes the library handle. </p>
                              <div class="p" dir="ltr" id="nvjpeg-create__docs-internal-guid-676727d0-7fff-7e38-82db-42dee025468d"><a name="nvjpeg-create__docs-internal-guid-676727d0-7fff-7e38-82db-42dee025468d" shape="rect">
                                    <!-- --></a><div class="note note"><span class="notetitle">Note:</span> This function is deprecated. Use either <samp class="ph codeph">nvjpegCreateSimple()</samp> or
                                    					<samp class="ph codeph">nvjpegCreateEx()</samp> functions to create the library handle.
                                 </div>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegCreate(
	nvjpegBackend_t			backend,
	nvjpegDevAllocator_t 		*allocator,
	nvjpegHandle_t			*handle);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-create__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-create__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegBackend_t backend</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">A backend parameter for the library. This backend will be used for all the
                                             							functions called with this handle. If this is set to DEFAULT then it
                                             							automatically chooses one of the underlying algorithms. 
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegDevAllocator_t *allocator</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Device memory allocator. See <samp class="ph codeph">nvjpegDevAllocator_t </samp>structure
                                             							description. If NULL is provided, then the default CUDA runtime
                                             								<samp class="ph codeph">cudaMalloc() </samp>and <samp class="ph codeph">cudaFree()</samp>
                                             							functions will be used.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t *handle</samp></td>
                                          <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p class="p">The <samp class="ph codeph">nvjpegBackend_t</samp> parameter is an <samp class="ph codeph">enum</samp> type, with the below
                                 			enumerated list values: 
                              </p>
                              <div class="p"><pre xml:space="preserve">
typedef enum {
	NVJPEG_BACKEND_DEFAULT = 0, 
	NVJPEG_BACKEND_HYBRID = 1,
} nvjpegBackend_t; </pre></div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-create-simple"><a name="nvjpeg-create-simple" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-create-simple" name="nvjpeg-create-simple" shape="rect">2.3.1.3.&nbsp;nvjpegCreateSimple()</a></h3>
                           <div class="body conbody">
                              <p class="p">Allocates and initializes the library handle, with default codec implementations selected
                                 			by library and default memory allocators.
                              </p>
                              <p dir="ltr" class="p" id="nvjpeg-create-simple__docs-internal-guid-676727d0-7fff-7e38-82db-42dee025468d"><a name="nvjpeg-create-simple__docs-internal-guid-676727d0-7fff-7e38-82db-42dee025468d" shape="rect">
                                    <!-- --></a></p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegCreateSimple(nvjpegHandle_t *handle);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-create-simple__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-create-simple__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t *handle</samp></td>
                                          <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p class="p"></p>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-create-ex"><a name="nvjpeg-create-ex" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-create-ex" name="nvjpeg-create-ex" shape="rect">2.3.1.4.&nbsp;nvjpegCreateEx()</a></h3>
                           <div class="body conbody">
                              <p dir="ltr" class="p" id="nvjpeg-create-ex__docs-internal-guid-2060f851-7fff-fdbe-5643-5e1376af1004"><a name="nvjpeg-create-ex__docs-internal-guid-2060f851-7fff-fdbe-5643-5e1376af1004" shape="rect">
                                    <!-- --></a>Allocates and
                                 			initializes the library handle using the provided arguments.
                              </p>
                              <p dir="ltr" class="p" id="nvjpeg-create-ex__docs-internal-guid-676727d0-7fff-7e38-82db-42dee025468d"><a name="nvjpeg-create-ex__docs-internal-guid-676727d0-7fff-7e38-82db-42dee025468d" shape="rect">
                                    <!-- --></a></p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegCreateEx(nvjpegBackend_t backend, 
          nvjpegDevAllocator_t *dev_allocator, 
          nvjpegPinnedAllocator_t *pinned_allocator, 
          unsigned int flags,
          nvjpegHandle_t *handle);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-create-ex__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-create-ex__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegBackend_t backend</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input </td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">A backend parameter for the library. This backend will be
                                             							used for all of the functions called with this handle. If this is set to
                                             							“DEFAULT" then it will choose one of underlying algorithms
                                             							automatically. 
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegDevAllocator_t
                                                							*dev_allocator</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Device memory allocator. See <samp class="ph codeph"><a class="xref" href="index.html#nvjpeg-memory-allocator-interface" shape="rect">nvjpegDevAllocator</a>_t</samp> structure description. If
                                             							NULL is provided, then the default CUDA runtime functions
                                             								<samp class="ph codeph">cudaMalloc()</samp> and <samp class="ph codeph">cudaFree()</samp> will
                                             							be used.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegPinnedAllocator_t
                                                							*pinned_allocator</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Pinned host memory allocator. See <samp class="ph codeph"><a class="xref" href="index.html#nvjpeg-host-pinned-memory-allocator-interface" shape="rect">nvjpegPinnedAllocator_t</a></samp>structure description. If NULL is provided, then the default
                                             							CUDA runtime functions <samp class="ph codeph">cudaHostAlloc()</samp> and
                                             								<samp class="ph codeph">cudaFreeHost()</samp> will be used.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t *handle</samp></td>
                                          <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p class="p"></p>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpegDestroy"><a name="nvjpegDestroy" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpegDestroy" name="nvjpegDestroy" shape="rect">2.3.1.5.&nbsp;nvjpegDestroy()</a></h3>
                           <div class="body conbody">
                              <p class="p">Releases the library handle.</p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegDestroy(nvjpegHandle_t handle);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpegDestroy__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpegDestroy__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The library handle to release.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-set-device-mem-padding"><a name="nvjpeg-set-device-mem-padding" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-set-device-mem-padding" name="nvjpeg-set-device-mem-padding" shape="rect">2.3.1.6.&nbsp;nvjpegSetDeviceMemoryPadding()</a></h3>
                           <div class="body conbody">
                              <p dir="ltr" class="p" id="nvjpeg-set-device-mem-padding__docs-internal-guid-8dde49d6-7fff-344a-2e88-36e95e842af8"><a name="nvjpeg-set-device-mem-padding__docs-internal-guid-8dde49d6-7fff-344a-2e88-36e95e842af8" shape="rect">
                                    <!-- --></a>Use the provided
                                 			padding for all device memory allocations with specified library handle. A large number
                                 			will help to amortize the need for device memory reallocations when needed.
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegSetDeviceMemoryPadding(
	size_t padding,
	nvjpegHandle_t handle);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-set-device-mem-padding__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-set-device-mem-padding__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">size_t padding</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Device memory padding to use for all further device memory
                                             							allocations.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t *handle</samp></td>
                                          <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-get-device-mem-padding"><a name="nvjpeg-get-device-mem-padding" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-get-device-mem-padding" name="nvjpeg-get-device-mem-padding" shape="rect">2.3.1.7.&nbsp;nvjpegGetDeviceMemoryPadding()</a></h3>
                           <div class="body conbody">
                              <p dir="ltr" class="p" id="nvjpeg-get-device-mem-padding__docs-internal-guid-1402e43d-7fff-008e-d28c-5b66e027a024"><a name="nvjpeg-get-device-mem-padding__docs-internal-guid-1402e43d-7fff-008e-d28c-5b66e027a024" shape="rect">
                                    <!-- --></a>Retrieve the
                                 			device memory padding that is currently used for the specified library handle.
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegGetDeviceMemoryPadding(
	size_t *padding,
	nvjpegHandle_t handle);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-get-device-mem-padding__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-get-device-mem-padding__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">size_t *padding</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Output</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Device memory padding that is currently used for device memory
                                             							allocations.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t *handle</samp></td>
                                          <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-set-pinned-mem-padding"><a name="nvjpeg-set-pinned-mem-padding" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-set-pinned-mem-padding" name="nvjpeg-set-pinned-mem-padding" shape="rect">2.3.1.8.&nbsp;nvjpegSetPinnedMemoryPadding()</a></h3>
                           <div class="body conbody">
                              <p dir="ltr" class="p" id="nvjpeg-set-pinned-mem-padding__docs-internal-guid-3335cc3f-7fff-2518-f4da-e363e823c042"><a name="nvjpeg-set-pinned-mem-padding__docs-internal-guid-3335cc3f-7fff-2518-f4da-e363e823c042" shape="rect">
                                    <!-- --></a>Use the provided
                                 			padding for all pinned host memory allocations with specified library handle. A large
                                 			number will help to amortize the need for pinned host memory reallocations when
                                 			needed.
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegSetPinnedMemoryPadding(
	size_t padding,
	nvjpegHandle_t handle);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-set-pinned-mem-padding__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-set-pinned-mem-padding__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">size_t padding</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Pinned host memory padding to use for all further pinned host memory
                                             							allocations.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-get-pinned-mem-padding"><a name="nvjpeg-get-pinned-mem-padding" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-get-pinned-mem-padding" name="nvjpeg-get-pinned-mem-padding" shape="rect">2.3.1.9.&nbsp;nvjpegGetPinnedMemoryPadding()</a></h3>
                           <div class="body conbody">
                              <p dir="ltr" class="p" id="nvjpeg-get-pinned-mem-padding__docs-internal-guid-ce0aef02-7fff-10a3-aa77-5eee0839d6f5"><a name="nvjpeg-get-pinned-mem-padding__docs-internal-guid-ce0aef02-7fff-10a3-aa77-5eee0839d6f5" shape="rect">
                                    <!-- --></a>Retrieve the
                                 			pinned host memory padding that is currently used for specified library handle.
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegGetPinnedMemoryPadding(
	size_t *padding,
	nvjpegHandle_t handle);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-get-pinned-mem-padding__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-get-pinned-mem-padding__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">size_t *padding</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Output</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Pinned host memory padding that is currently used for pinned host memory
                                             							allocations.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpegJpegStateCreate"><a name="nvjpegJpegStateCreate" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpegJpegStateCreate" name="nvjpegJpegStateCreate" shape="rect">2.3.1.10.&nbsp;nvjpegJpegStateCreate()</a></h3>
                           <div class="body conbody">
                              <p class="p">Allocates and initializes the internal structure required for the JPEG processing. </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegJpegStateCreate(
	nvjpegHandle_t      handle,
	nvjpegJpegState_t   *jpeg_handle);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpegJpegStateCreate__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpegJpegStateCreate__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.65086887835703%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="21.32701421800948%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.797788309636651%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="26.224328593996837%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.65086887835703%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="21.32701421800948%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.797788309636651%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="26.224328593996837%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.65086887835703%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState_t *jpeg_handle</samp></td>
                                          <td class="entry" valign="top" width="21.32701421800948%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="15.797788309636651%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="26.224328593996837%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpegJpegStateDestroy"><a name="nvjpegJpegStateDestroy" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpegJpegStateDestroy" name="nvjpegJpegStateDestroy" shape="rect">2.3.1.11.&nbsp;nvjpegJpegStateDestroy()</a></h3>
                           <div class="body conbody">
                              <p class="p">Releases the image internal structure. </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegJpegStateDestroy(nvjpegJpegState handle);		</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpegJpegStateDestroy__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpegJpegStateDestroy__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.65086887835703%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="21.32701421800948%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.797788309636651%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="26.224328593996837%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.65086887835703%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="21.32701421800948%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.797788309636651%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="26.224328593996837%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-retrieve-image-info-api"><a name="nvjpeg-retrieve-image-info-api" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-retrieve-image-info-api" name="nvjpeg-retrieve-image-info-api" shape="rect">2.3.2.&nbsp;Retrieve Encoded Image Information API</a></h3>
                        <div class="body conbody">
                           <p class="p">The helper functions for retrieving the encoded image information. </p>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpegGetImageInfo"><a name="nvjpegGetImageInfo" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpegGetImageInfo" name="nvjpegGetImageInfo" shape="rect">2.3.2.1.&nbsp;nvjpegGetImageInfo()</a></h3>
                           <div class="body conbody">
                              <p class="p">Decodes the JPEG header and retrieves the basic information about the image. </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegGetImageInfo(
	nvjpegHandle_t              handle, 
	const unsigned char         *data, 
	size_t                      length, 
	int                         *nComponents, 
	nvjpegChromaSubsampling_t   *subsampling, 
	int                         *widths, 
	int                         *heights); </pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpegGetImageInfo__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpegGetImageInfo__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">const unsigned char *data</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Pointer to the encoded data.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">size_t length</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Size of the encoded data in bytes.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">int *nComponents</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Output</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Chroma subsampling for the 1- or 3- channel encoding.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">int *widths</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Output</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Pointer to the first element of array of size NVJPEG_MAX_COMPONENT, where the width of
                                             							each channel (up to NVJPEG_MAX_COMPONENT) will be saved. If the channel
                                             							is not encoded, then the corresponding value would be zero.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">int *heights</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Output</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Pointer to the first element of array of size NVJPEG_MAX_COMPONENT, where the height of
                                             							each channel (up to NVJPEG_MAX_COMPONENT) will be saved. If the channel
                                             							is not encoded, then the corresponding value would be zero.
                                          </td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-decode-api-single-phase"><a name="nvjpeg-decode-api-single-phase" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-api-single-phase" name="nvjpeg-decode-api-single-phase" shape="rect">2.3.3.&nbsp;Decode API -- Single Phase</a></h3>
                        <div class="body conbody">
                           <p class="p">Functions for decoding single image or batched images in a single phase.
                              
                           </p>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-decode"><a name="nvjpeg-decode" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode" name="nvjpeg-decode" shape="rect">2.3.3.1.&nbsp;​nvjpegDecode()</a></h3>
                           <div class="body conbody">
                              <p class="p">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. 
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegDecode(
	nvjpegHandle_t          handle,
	nvjpegJpegState_t       jpeg_handle,
	const unsigned char     *data,
	size_t                  length, 
	nvjpegOutputFormat_t    output_format,
	nvjpegImage_t           *destination,
	cudaStream_t            stream);	</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-decode__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-decode__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState_t jpeg_handle</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">const unsigned char *data</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Pointer to the encoded data.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">size_t length</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Size of the encoded data in bytes.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegOutputFormat_t output_format</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Format in which the decoded output will be saved.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegImage_t *destination</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host/Device</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">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. See <samp class="ph codeph"><a class="xref" href="index.html#nvjpegGetImageInfo" shape="rect">nvjpegImage_t.</a></samp></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">cudaStream_t stream</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The CUDA stream where all of the GPU work will be submitted.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-decode-batched-init"><a name="nvjpeg-decode-batched-init" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-batched-init" name="nvjpeg-decode-batched-init" shape="rect">2.3.3.2.&nbsp;​nvjpegDecodeBatchedInitialize()</a></h3>
                           <div class="body conbody">
                              <p class="p">This function initializes the batched decoder state. The initialization parameters include the
                                 			batch size, the maximum number of CPU threads, and the specific output format in which
                                 			the decoded image will be saved. This function should be called once, prior to decoding
                                 			the batches of images. Any currently running batched decoding should be finished before
                                 			calling this function. 
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegDecodeBatchedInitialize(
 	nvjpegHandle_t          handle,
 	nvjpegJpegState_t       jpeg_handle,
 	int                     batch_size,
 	int                     max_cpu_threads,
 	nvjpegOutputFormat_t    output_format);	</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-decode-batched-init__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-decode-batched-init__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState_t jpeg_handle</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">int batch_size</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Batch size.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">int max_cpu_threads</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Maximum number of CPU threads that can participate in decoding a batch.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegOutputFormat_t output_format</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Format in which the decoded output will be saved.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-decode-batched"><a name="nvjpeg-decode-batched" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-batched" name="nvjpeg-decode-batched" shape="rect">2.3.3.3.&nbsp;​nvjpegDecodeBatched()</a></h3>
                           <div class="body conbody">
                              <p class="p">Decodes the batch of images, and writes them to the buffers described in the
                                 				<samp class="ph codeph">destination</samp> parameter in a format provided to
                                 				<samp class="ph codeph">nvjpegDecodeBatchedInitialize()</samp> function. This function is
                                 			asynchronous with respect to the host. All GPU tasks for this function will be submitted
                                 			to the provided stream. 
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegDecodeBatched(
 	nvjpegHandle_t             handle,
 	nvjpegJpegState_t          jpeg_handle,
 	const unsigned char *const *data,
 	const size_t               *lengths, 
 	nvjpegImage_t              *destinations,
 	cudaStream_t               stream);	</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-decode-batched__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-decode-batched__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="28.681177976952625%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="12.93213828425096%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="12.804097311139564%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="45.58258642765685%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="28.681177976952625%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="12.93213828425096%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="12.804097311139564%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="45.58258642765685%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="28.681177976952625%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState_t jpeg_handle</samp></td>
                                          <td class="entry" valign="top" width="12.93213828425096%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.804097311139564%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="45.58258642765685%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="28.681177976952625%" rowspan="1" colspan="1"><samp class="ph codeph">const unsigned char *const *data</samp></td>
                                          <td class="entry" valign="top" width="12.93213828425096%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.804097311139564%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="45.58258642765685%" rowspan="1" colspan="1">Pointer to the first element of array of the input data. The size of the array is
                                             							assumed to be batch_size provided to
                                             								<samp class="ph codeph">nvjpegDecodeBatchedInitialize()</samp> batch
                                             							initialization function.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="28.681177976952625%" rowspan="1" colspan="1"><samp class="ph codeph">const size_t *lengths</samp></td>
                                          <td class="entry" valign="top" width="12.93213828425096%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.804097311139564%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="45.58258642765685%" rowspan="1" colspan="1">Pointer to the first element of array of input sizes. Size of array is assumed to be
                                             							batch_size provided to <samp class="ph codeph">nvjpegDecodeBatchedInitialize()</samp>,
                                             							the batch initialization function.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="28.681177976952625%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegImage_t *destinations</samp></td>
                                          <td class="entry" valign="top" width="12.93213828425096%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="12.804097311139564%" rowspan="1" colspan="1">Host/Device</td>
                                          <td class="entry" valign="top" width="45.58258642765685%" rowspan="1" colspan="1">Pointer to the first element of array of output descriptors. The size of array is
                                             							assumed to be batch_size provided to
                                             								<samp class="ph codeph">nvjpegDecodeBatchedInitialize(),</samp> the batch
                                             							initialization function. See also <samp class="ph codeph"><a class="xref" href="index.html#nvjpegGetImageInfo" shape="rect">nvjpegImage_t</a></samp>.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="28.681177976952625%" rowspan="1" colspan="1"><samp class="ph codeph">
                                                								cudaStream_t stream
                                                							</samp></td>
                                          <td class="entry" valign="top" width="12.93213828425096%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.804097311139564%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="45.58258642765685%" rowspan="1" colspan="1">
                                             <p dir="ltr" class="p">The CUDA stream where all the GPU work will be
                                                								submitted.
                                             </p>
                                          </td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-decode-multiple-phase-api"><a name="nvjpeg-decode-multiple-phase-api" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-multiple-phase-api" name="nvjpeg-decode-multiple-phase-api" shape="rect">2.3.4.&nbsp;Decode API -- Multiple Phases</a></h3>
                        <div class="body conbody">
                           <p class="p">The nvJPEG library provides an ability to control the decoding process in phases. In the
                              			simple case of a single-image decode you can split the decoding into phases. For
                              			decoding multiple images, you can overlap the decoding phases of separate images within
                              			a single thread. Finally, for the batched decode you can use multiple threads to split
                              			the host tasks. Synchronization between phases should be handled with CUDA events and
                              			CUDA stream synchronization mechanisms, by the user. 
                           </p>
                           <div class="p">
                              <div class="note note"><span class="notetitle">Note:</span> Note that first phases are synchronous with the respect to the host, while the second and
                                 				third phases are asynchronous--for both single image and batched decode. 
                              </div>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-decode-phaseone"><a name="nvjpeg-decode-phaseone" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-phaseone" name="nvjpeg-decode-phaseone" shape="rect">2.3.4.1.&nbsp;​nvjpegDecodePhaseOne()</a></h3>
                           <div class="body conbody">
                              <p class="p">The first phase of a single-image decode. You provide all the inputs, and the nvJPEG library
                                 			performs any required preprocessing on the host. Any previous calls to
                                 				<samp class="ph codeph">nvjpegDecodePhaseOne()</samp> and <samp class="ph codeph">nvjpegDecodePhaseTwo()</samp>
                                 			with the same <samp class="ph codeph">nvjpeg_handle</samp> parameter should be finished prior to this
                                 			call. 
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegDecodePhaseOne(
	nvjpegHandle_t          handle,
	nvjpegJpegState_t       jpeg_handle,
	const unsigned char     *data,
	size_t                  length,
	nvjpegOutputFormat_t    output_format,
	cudaStream_t            stream);	</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-decode-phaseone__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-decode-phaseone__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState_t jpeg_handle</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">const unsigned char *data</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Pointer to the encoded stream. </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">size_t length</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Size of the encoded stream. </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegOutputFormat_t output_format</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Format in which the decoded image will be saved.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">cudaStream_t stream </samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">
                                             <p dir="ltr" class="p">The CUDA stream where all the GPU work will be
                                                								submitted.
                                             </p>
                                          </td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-decode-phasetwo"><a name="nvjpeg-decode-phasetwo" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-phasetwo" name="nvjpeg-decode-phasetwo" shape="rect">2.3.4.2.&nbsp;​nvjpegDecodePhaseTwo()</a></h3>
                           <div class="body conbody">
                              <p class="p">In this second phase of the decoding process, the GPU (that is, the device) is involved. The
                                 			decoding task is transferred to the device memory. Any required preprocessing is
                                 			performed on the device. Any previous calls to <samp class="ph codeph">nvjpegDecodePhaseTwo()</samp>
                                 			and <samp class="ph codeph">nvjpegDecodePhaseThree()</samp> with the same <samp class="ph codeph">jpeg_handle</samp>
                                 			parameter should be finished prior to this call. 
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegDecodePhaseTwo(
 	nvjpegHandle_t       handle,
 	nvjpegJpegState_t    jpeg_handle,
 	cudaStream_t         stream);	</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-decode-phasetwo__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-decode-phasetwo__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState_t jpeg_handle</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">cudaStream_t stream </samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">
                                             <p dir="ltr" class="p">The CUDA stream where all the GPU work will be
                                                								submitted.
                                             </p>
                                          </td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-decode-phasethree"><a name="nvjpeg-decode-phasethree" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-phasethree" name="nvjpeg-decode-phasethree" shape="rect">2.3.4.3.&nbsp;​nvjpegDecodePhaseThree()</a></h3>
                           <div class="body conbody">
                              <p class="p">In this third phase of the decoding process, the decoded image is written to the output, in the
                                 			specified decoding format. 
                              </p>
                              <div class="p">
                                 <div class="note note"><span class="notetitle">Note:</span> If the same <samp class="ph codeph">jpeg_handle</samp> is shared for decoding multiple images
                                    				simultaneously, then these multiple images should be of the same
                                    					<samp class="ph codeph">output_format</samp>. 
                                 </div>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegDecodePhaseThree(
 	nvjpegHandle_t       handle,
 	nvjpegJpegState_t    jpeg_handle,
 	nvjpegImage_t        *destination,
 	cudaStream_t         stream);	</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-decode-phasethree__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-decode-phasethree__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState_t jpeg_handle</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegImage_t *destination</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host/Device</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Pointer to the structure that describes the output destination. This
                                             							structure should be on host, but the pointers in this structure should
                                             							be pointing to the device memory. See <samp class="ph codeph">nvjpegImage_t</samp>
                                             							description for details.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">cudaStream_t stream </samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">
                                             <p dir="ltr" class="p">The CUDA stream where all the GPU work will be
                                                								submitted.
                                             </p>
                                          </td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-decode-batched-phaseone"><a name="nvjpeg-decode-batched-phaseone" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-batched-phaseone" name="nvjpeg-decode-batched-phaseone" shape="rect">2.3.4.4.&nbsp;​nvjpegDecodeBatchedPhaseOne()</a></h3>
                           <div class="body conbody">
                              <p class="p">This first phase of the batched decoding should be called separately for each image in
                                 			the batch. The batch initialization API, with appropriate batch parameters, should be
                                 			called prior to starting the task with the batch. 
                              </p>
                              <p class="p">If the batch parameters (batch size, number of threads, output format) did not change,
                                 			then there is no need to initialize the batch again before starting the task. 
                              </p>
                              <p class="p">It is possible to use multiple threads to split this first phase of the task. In which
                                 			case, each thread should have a unique index. Provide the index of the image in the
                                 			batch, and use the same JPEG decoding state parameter. 
                              </p>
                              <p class="p">The thread index for the batch should be in the range of <samp class="ph codeph">[0,
                                    				max_cpu_threads-1]</samp>. The image index should be in the range of <samp class="ph codeph">[0,
                                    				batch_size-1]</samp>. Any previous calls to
                                 				<samp class="ph codeph">nvjpegDecodeBatchedPhaseOne()</samp> and
                                 				<samp class="ph codeph">nvjpegDecodeBatchedPhaseTwo() </samp>on a different batch with the same
                                 			JPEG state handle parameter should be completed prior to this call. 
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegDecodeBatchedPhaseOne(
 	nvjpegHandle_t          handle,
 	nvjpegJpegState_t       jpeg_handle,
 	const unsigned char     *data,
 	size_t                  length,
 	int                     image_idx,
 	int                     thread_idx,
 	cudaStream_t            stream);	</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-decode-batched-phaseone__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-decode-batched-phaseone__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState_t jpeg_handle</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">const unsigned char *data</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Pointer to the encoded stream. </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">size_t length </samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">
                                             <p dir="ltr" class="p">Size of the encoded stream.</p>
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">int image_idx</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Image index in the batch. Should be in the range from 0 to
                                             								<samp class="ph codeph">batch_size-1</samp>.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">int thread_idx</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">Thread index that calls this phase. Should be in the range from 0 to
                                             								<samp class="ph codeph">max_cpu_threads-1</samp>.
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="36.642156862745104%" rowspan="1" colspan="1"><samp class="ph codeph">cudaStream_t stream</samp></td>
                                          <td class="entry" valign="top" width="16.29901960784314%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" valign="top" width="12.254901960784313%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" valign="top" width="34.80392156862745%" rowspan="1" colspan="1">The CUDA stream where all the GPU work will be submitted.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-decode-batched-phasetwo"><a name="nvjpeg-decode-batched-phasetwo" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-batched-phasetwo" name="nvjpeg-decode-batched-phasetwo" shape="rect">2.3.4.5.&nbsp;<strong class="ph b" id="docs-internal-guid-22afa100-fff2-adb6-ae15-313aec425dbb"><a name="docs-internal-guid-22afa100-fff2-adb6-ae15-313aec425dbb" shape="rect">
                                       <!-- --></a>nvjpegDecodeBatchedPhaseTwo()</strong></a></h3>
                           <div class="body conbody">
                              <p class="p">This phase should be called once per batch. It should be called only after the
                                 				<samp class="ph codeph">nvjpegDecodeBatchedPhaseOne()</samp> calls for every image in the batch
                                 			have finished. Any prior calls to <samp class="ph codeph">nvjpegDecodeBatchedPhaseTwo()</samp>
                                 				and<samp class="ph codeph"> nvjpegDecodeBatchedPhaseThree()</samp> for other batches with the same
                                 			JPEG state handle parameter should be finished prior this call. 
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p>
                              <div class="p"><pre xml:space="preserve">
nvjpegStatus_t nvjpegDecodeBatchedPhaseTwo(
	nvjpegHandle_t          handle, 
	nvjpegJpegState_t       jpeg_handle, 
	cudaStream_t            stream);</pre></div>
                              <p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-decode-batched-phasetwo__table_qc3_kqt_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-decode-batched-phasetwo__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState_t jpeg_handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">cudaStream_t stream</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The CUDA stream where all the GPU work will be
                                             							submitted.
                                          </td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p dir="ltr" class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-us" id="nvjpeg-decode-batched-phasethree"><a name="nvjpeg-decode-batched-phasethree" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-decode-batched-phasethree" name="nvjpeg-decode-batched-phasethree" shape="rect">2.3.4.6.&nbsp;<strong class="ph b" id="docs-internal-guid-7dffeecd-ff83-e295-4423-5cb8355b98ab"><a name="docs-internal-guid-7dffeecd-ff83-e295-4423-5cb8355b98ab" shape="rect">
                                       <!-- --></a>
                                    			nvjpegDecodeBatchedPhaseThree()</strong></a></h3>
                           <div class="body conbody">
                              <p class="p">This phase should be called once per batch. It should be called only after the
                                 			<samp class="ph codeph">nvjpegDecodeBatchedPhaseTwo()</samp> call for the same batch has
                                 			finished.
                              </p>
                              <p class="p">Between a call to <samp class="ph codeph">nvjpegDecodeBatchedPhaseTwo()</samp> and a call to this function, no
                                 			calls are allowed to <samp class="ph codeph"> nvjpegDecodeBatchedPhaseTwo()</samp> or <samp class="ph codeph">nvjpegDecodeBatchedPhaseThree()</samp>
                                 			for any other batch with the same JPEG state handle parameter. 
                              </p>
                              <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">
nvjpegStatus_t nvjpegDecodeBatchedPhaseThree(
	nvjpegHandle_t            handle, 
	nvjpegJpegState_t         jpeg_handle, 
	nvjpegImage_t             *destinations, 
	cudaStream_t              stream);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                              <div class="tablenoborder"><a name="nvjpeg-decode-batched-phasethree__table_c1m_1ft_d2b" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-decode-batched-phasethree__table_c1m_1ft_d2b" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="33.51409978308026%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.075921908893712%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="10.84598698481562%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                          <td class="entry" dir="ltr" valign="top" width="40.563991323210416%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="33.51409978308026%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegHandle_t handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.075921908893712%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="10.84598698481562%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="40.563991323210416%" rowspan="1" colspan="1">The library handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="33.51409978308026%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegJpegState_t jpeg_handle</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.075921908893712%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="10.84598698481562%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="40.563991323210416%" rowspan="1" colspan="1">The image state handle.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="33.51409978308026%" rowspan="1" colspan="1"><samp class="ph codeph">nvjpegImage_t *destinations</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.075921908893712%" rowspan="1" colspan="1">Input/Output</td>
                                          <td class="entry" dir="ltr" valign="top" width="10.84598698481562%" rowspan="1" colspan="1">Host/Device</td>
                                          <td class="entry" valign="top" width="40.563991323210416%" rowspan="1" colspan="1">
                                             <p dir="ltr" class="p">Pointer to the first element of the array of output descriptors. The size of the
                                                								array is assumed to be the <samp class="ph codeph">batch_size</samp> parameter
                                                								that was provided to the batch initialization function. See
                                                										<samp class="ph codeph"><a class="xref" href="index.html#nvjpeg-output-pointer-struct" shape="rect">nvjpegImage_t</a></samp> description for details.
                                             </p>
                                          </td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" dir="ltr" valign="top" width="33.51409978308026%" rowspan="1" colspan="1"><samp class="ph codeph">cudaStream_t stream</samp></td>
                                          <td class="entry" dir="ltr" valign="top" width="15.075921908893712%" rowspan="1" colspan="1">Input</td>
                                          <td class="entry" dir="ltr" valign="top" width="10.84598698481562%" rowspan="1" colspan="1">Host</td>
                                          <td class="entry" dir="ltr" valign="top" width="40.563991323210416%" rowspan="1" colspan="1">The CUDA stream to which all the GPU tasks will be
                                             							submitted.
                                          </td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                              <p class="p"><strong class="ph b">Returns:</strong></p>
                              <p dir="ltr" class="p"><samp class="ph codeph">nvjpegStatus_t</samp> - An error code as specified in <a class="xref" href="index.html#nvjpeg-api-return-codes" shape="rect">nvJPEG API Return Codes</a>. 
                              </p>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-api-return-codes"><a name="nvjpeg-api-return-codes" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-api-return-codes" name="nvjpeg-api-return-codes" shape="rect">2.3.5.&nbsp;nvjpeg-api-return-codes</a></h3>
                        <div class="body conbody">
                           <p class="p">The nvJPEG API adheres to the following return codes and their indicators: </p><pre xml:space="preserve">typedef enum
{
 NVJPEG_STATUS_SUCCESS = 0,
 NVJPEG_STATUS_NOT_INITIALIZED = 1,
 NVJPEG_STATUS_INVALID_PARAMETER = 2,
 NVJPEG_STATUS_BAD_JPEG = 3,
 NVJPEG_STATUS_JPEG_NOT_SUPPORTED = 4,
 NVJPEG_STATUS_ALLOCATOR_FAILURE = 5,
 NVJPEG_STATUS_EXECUTION_FAILED = 6,
 NVJPEG_STATUS_ARCH_MISMATCH = 7,
 NVJPEG_STATUS_INTERNAL_ERROR = 8,
} nvjpegStatus_t;	</pre><p dir="ltr" class="p"><strong class="ph b">Description of the returned error codes:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-api-return-codes__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-api-return-codes__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="51.28644939965695%" rowspan="1" colspan="1"><strong class="ph b">Returned Error (Returned Code)</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="48.71355060034305%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="51.28644939965695%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_STATUS_SUCCESS (0)</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="48.71355060034305%" rowspan="1" colspan="1">The API call has finished successfully. Note that many of the calls are
                                          							asynchronous and some of the errors may be seen only after
                                          							synchronization.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="51.28644939965695%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_STATUS_NOT_INITIALIZED (1)</samp></td>
                                       <td class="entry" valign="top" width="48.71355060034305%" rowspan="1" colspan="1">The library handle was not initialized. A call to
                                          								<samp class="ph codeph">nvjpegCreate()</samp> is required to initialize the
                                          							handle.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="51.28644939965695%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_STATUS_INVALID_PARAMETER (2)</samp></td>
                                       <td class="entry" valign="top" width="48.71355060034305%" rowspan="1" colspan="1">Wrong parameter was passed. For example, a null pointer as input data, or an image
                                          							index not in the allowed range.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="51.28644939965695%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_STATUS_BAD_JPEG (3) </samp></td>
                                       <td class="entry" valign="top" width="48.71355060034305%" rowspan="1" colspan="1">Cannot parse the JPEG stream. Check that the encoded JPEG stream and
                                          							its size parameters are correct.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="51.28644939965695%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_STATUS_JPEG_NOT_SUPPORTED (4)</samp></td>
                                       <td class="entry" valign="top" width="48.71355060034305%" rowspan="1" colspan="1">Attempting to decode a JPEG stream that is not supported by the
                                          							nvJPEG library.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="51.28644939965695%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_STATUS_ALLOCATOR_FAILURE (5)</samp></td>
                                       <td class="entry" valign="top" width="48.71355060034305%" rowspan="1" colspan="1">The user-provided allocator functions, for either memory allocation
                                          							or for releasing the memory, returned a non-zero code.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="51.28644939965695%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_STATUS_EXECUTION_FAILED (6)</samp></td>
                                       <td class="entry" valign="top" width="48.71355060034305%" rowspan="1" colspan="1">Error during the execution of the device tasks.</td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="51.28644939965695%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_STATUS_ARCH_MISMATCH (7)</samp></td>
                                       <td class="entry" valign="top" width="48.71355060034305%" rowspan="1" colspan="1">The device capabilities are not enough for the set of input parameters provided (input
                                          							parameters such as backend, encoded stream parameters, output
                                          							format).
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="51.28644939965695%" rowspan="1" colspan="1"><samp class="ph codeph">NVJPEG_STATUS_INTERNAL_ERROR (8)</samp></td>
                                       <td class="entry" valign="top" width="48.71355060034305%" rowspan="1" colspan="1">Error during the execution of the device tasks.</td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-chroma-subsampling"><a name="nvjpeg-chroma-subsampling" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-chroma-subsampling" name="nvjpeg-chroma-subsampling" shape="rect">2.3.6.&nbsp;nvjpeg-chroma-subsampling</a></h3>
                        <div class="body conbody">
                           <p class="p">One of the outputs of the <samp class="ph codeph">nvjpegGetImageInfo()</samp> API is
                              				<samp class="ph codeph">nvjpegChromaSubsampling_t</samp>. This parameter is an
                              				<samp class="ph codeph">enum</samp> type, and its enumerator list comprises of the chroma
                              			subsampling property retrieved from the encoded JPEG image. Below are the chroma
                              			subsampling types the <samp class="ph codeph">nvjpegGetImageInfo()</samp> function currently supports: 
                           </p><pre xml:space="preserve">typedef enum
{
 NVJPEG_CSS_444,
 NVJPEG_CSS_422,
 NVJPEG_CSS_420,
 NVJPEG_CSS_440,
 NVJPEG_CSS_411,
 NVJPEG_CSS_410,
 NVJPEG_CSS_GRAY,
 NVJPEG_CSS_UNKNOWN
} nvjpegChromaSubsampling_t;	</pre></div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-reference-docs"><a name="nvjpeg-reference-docs" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-reference-docs" name="nvjpeg-reference-docs" shape="rect">2.3.7.&nbsp;Reference Documents</a></h3>
                        <div class="body conbody">
                           <p class="p">Refer to the JPEG standard: <a class="xref" href="https://jpeg.org/jpeg/" target="_blank" shape="rect">https://jpeg.org/jpeg/ </a></p>
                        </div>
                     </div>
                  </div>
                  <div class="topic concept nested1" xml:lang="en-us" id="nvjpeg-examples"><a name="nvjpeg-examples" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-examples" name="nvjpeg-examples" shape="rect">Examples of nvJPEG</a></h3>
                     <div class="body conbody">
                        <p class="p">This package contains the library header and a set of libraries—static and shared. Shared
                           			libraries (the <samp class="ph codeph">libnvjpeg.so</samp> and the respective versioned libraries)
                           			have all of the CUDA toolkit dependencies statically linked. However, if you want to
                           			link against the static library (<samp class="ph codeph">libnvjpeg_static.a</samp>) you also need to
                           			link the other dependencies—for example dl, rt and thread libraries. 
                        </p>
                        <p class="p"><strong class="ph b">Example of linking shared library:</strong></p>
                        <p class="p"><samp class="ph codeph">g++ -Icuda-linux64-nvjpeg/include -lnvjpeg -Lcuda-linux64-nvjpeg/lib64
                              				my_example.cpp -o my_example </samp></p>
                        <p class="p"><strong class="ph b">Example of linking static library: </strong></p>
                        <p class="p"><samp class="ph codeph">g++ -Icuda-linux64-nvjpeg/include -lnvjpeg_static -ldl -lrt -pthread
                              				-Lcuda-linux64-nvjpeg/lib64 my_example.cpp -o my_example </samp></p>
                        <p class="p"><strong class="ph b">Example</strong></p>
                        <p class="p">Below example shows how to use the various nvJPEG APIs. </p>
                        <p class="p">Compile with the following command from the <samp class="ph codeph">examples</samp> folder, assuming
                           			CUDA 9.0 is installed at the path <samp class="ph codeph">/usr/local/cuda-9.0</samp>: 
                        </p>
                        <p class="p"><samp class="ph codeph">g++ -O3 -m64 nvjpeg_example.cpp -I../include -lnvjpeg -L../lib64
                              				-I/usr/local/cuda-9.0/include -ldl -lrt -pthread -lcudart
                              				-L/usr/local/cuda-9.0/lib64 -Wl,-rpath=../lib64 -Wl,-rpath=/usr/local/cuda-9.0/lib64
                              				-o nvjpeg_example</samp></p>
                        <p class="p">The below examples show how to decode the JPEG files using either single or batched API,
                           			and write the decoded files as BMP images.
                        </p>
                        <p class="p"><strong class="ph b">To decode a single image:</strong></p>
                        <p class="p"><samp class="ph codeph">./nvjpeg_example -i /tmp/my_image.jpg -fmt rgb -o /tmp</samp></p>
                        <p class="p"><strong class="ph b">To decode multiple images in the folder using the batched API in separate phases:
                              			</strong></p>
                        <p class="p"><samp class="ph codeph">./nvjpeg_example -i /tmp/my_images/ -fmt rgb -b 32 -pipelined -batched -o
                              				/tmp</samp></p>
                        <p class="p"> Run the command <samp class="ph codeph">./nvjpeg_example -h</samp> for the description of the
                           			parameters. 
                        </p>
                     </div>
                  </div>
               </div>
               <div class="topic concept nested0" xml:lang="en-us" id="title-nvjpeg-encode"><a name="title-nvjpeg-encode" shape="rect">
                     <!-- --></a><h2 class="title topictitle1"><a href="#title-nvjpeg-encode" name="title-nvjpeg-encode" shape="rect">3.&nbsp;JPEG Encoding</a></h2>
                  <div class="body conbody">
                     <p class="p"> This section describes the encoding functions of the nvJPEG Library.</p>
                  </div>
                  <div class="topic concept nested1" xml:lang="en-US" id="using-encoder"><a name="using-encoder" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#using-encoder" name="using-encoder" shape="rect">3.1.&nbsp;Using the Encoder</a></h3>
                     <div class="body conbody">
                        <p class="p">The user should perform the below prerequisite steps before calling the nvJPEG encoding
                           				functions. See also <a class="xref" href="index.html#nvjpeg-encoder-helper-api-reference" shape="rect">nvJPEG Encoder Helper API Reference</a>.
                        </p>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-US" id="encoding-parameters"><a name="encoding-parameters" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#encoding-parameters" name="encoding-parameters" shape="rect">3.1.1.&nbsp;Encoding the Parameters</a></h3>
                        <div class="body conbody">
                           <p class="p">The user should create an encoding parameters structure with <samp class="ph codeph"><a class="xref" href="index.html#nvjpeg-encoder-params-create" shape="rect">nvjpegEncoderParamsCreate()</a></samp>
                              				function. The function will be initialized with default parameters. User can use an
                              				appropriate <samp class="ph codeph">nvjpegEncoderParamsSet*()</samp> function to set a specific parameter. 
                           </p>
                           <p class="p">The quality parameter can be set, using <samp class="ph codeph"><a class="xref" href="index.html#nvjpeg-encoder-params-set-quality" shape="rect">nvjpegEncoderParamsSetQuality()</a></samp>
                              				function, to an integer value between 1 and 100, and this quality parameter will be used as
                              				a base for generating the JPEG quantization tables. 
                           </p>
                           <p class="p">The parameters structure should be passed to compression functions. </p>
                           <div class="p">
                              <div class="note note"><span class="notetitle">Note:</span> The encoding parameters structure can be reused to compress multiple images
                                 					simultaneously, but no changes to the parameters should be made during the ongoing
                                 					encoding, or encoding result will be undefined.
                              </div>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-US" id="encoding-state"><a name="encoding-state" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#encoding-state" name="encoding-state" shape="rect">3.1.2.&nbsp;Encoding the State</a></h3>
                        <div class="body conbody">
                           <p class="p">The user should create the encoding state structure using
                              					<samp class="ph codeph"><a class="xref" href="index.html#nvjpeg-encoder-state-create" shape="rect">nvjpegEncoderStateCreate()</a></samp> function. This function will hold intermediate
                              				buffers for the encoding process. This state should be passed to the compression functions. 
                           </p>
                           <div class="p">
                              <div class="note note"><span class="notetitle">Note:</span> The encoding state structure can be reused to encode a series of images, but no
                                 					encoding should be performed on multiple images with the same encoding state at the same
                                 					time - otherwise result of the encodings will be undefined.
                              </div>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-US" id="encoding-the-image"><a name="encoding-the-image" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#encoding-the-image" name="encoding-the-image" shape="rect">3.1.3.&nbsp;Encoding the Image</a></h3>
                        <div class="body conbody">
                           <p class="p">The nvJPEG library provides a few interfaces for compressing the image in different formats
                              				and colorspaces. See below.
                           </p>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-US" id="using-nvjpegEncodeYUV"><a name="using-nvjpegEncodeYUV" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#using-nvjpegEncodeYUV" name="using-nvjpegEncodeYUV" shape="rect">3.1.3.1.&nbsp;nvjpegEncodeYUV</a></h3>
                           <div class="body conbody">
                              <p class="p">Input for this function is an image in YUV colorspace. See <a class="xref" href="index.html#nvjpeg-encode-yuv" shape="rect">nvjpegEncodeYUV()</a>.
                                 				The <samp class="ph codeph">source</samp> argument should be filled with the corresponding YUV planar
                                 				data. The <samp class="ph codeph">chroma_subsampling</samp> argument should have the chroma subsampling of
                                 				the input data. If the chroma subsampling in the encoding parameters is the same as input
                                 				chroma subsampling, then the user's input data will be directly used in the JPEG
                                 				compression. Otherwise chroma will be resampled to match the chroma subsampling of the
                                 				encoding parameters.
                              </p>
                              <p class="p">Input data should be provided with respect to the subsampling factors. That is, the
                                 				chrominance image planes should have sizes aligned to the corresponding subsamplings. For
                                 				example:
                              </p><a name="using-nvjpegEncodeYUV__ul_b1t_wyw_lgb" shape="rect">
                                 <!-- --></a><ul class="ul" id="using-nvjpegEncodeYUV__ul_b1t_wyw_lgb">
                                 <li class="li">Image dimensions: 123x321</li>
                                 <li class="li">Input chroma subsampling is: NVJPEG_CSS_410</li>
                                 <li class="li">Chroma subsampling factor for this chroma subsampling: is 4x2</li>
                                 <li class="li">Given the above, the encoder library expects the user to provide:<a name="using-nvjpegEncodeYUV__ul_c1t_wyw_lgb" shape="rect">
                                       <!-- --></a><ul class="ul" id="using-nvjpegEncodeYUV__ul_c1t_wyw_lgb">
                                       <li class="li">Y plane with size: 123 x 321</li>
                                       <li class="li">Cb and Cr plane with size: 31 x 161</li>
                                    </ul>
                                 </li>
                              </ul>
                           </div>
                        </div>
                        <div class="topic concept nested3" xml:lang="en-US" id="using-nvjpegEncodeImage"><a name="using-nvjpegEncodeImage" shape="rect">
                              <!-- --></a><h3 class="title topictitle2"><a href="#using-nvjpegEncodeImage" name="using-nvjpegEncodeImage" shape="rect">3.1.3.2.&nbsp;nvjpegEncodeImage</a></h3>
                           <div class="body conbody">
                              <p class="p">See <a class="xref" href="index.html#nvjpeg-encode-image" shape="rect">nvjpegEncodeImage()</a>. Input for this function, i.e., how data should be
                                 				provided in the <samp class="ph codeph">source</samp> argument, is determined by the
                                 					<samp class="ph codeph">input_format</samp> argument. For the interleaved formats (ending with <strong class="ph b">I</strong>)
                                 				only the first channel is used. For the non-interleaved formats, all the channels in the
                                 				input format are used. 
                              </p>
                              <p class="p">For example, if the user has interleaved the RGB image of size <samp class="ph codeph">W x H</samp>,
                                 				stored continuously, and the pointer to it is <samp class="ph codeph">pImage</samp>, then
                                 					<samp class="ph codeph">source</samp> should be:
                              </p><a name="using-nvjpegEncodeImage__ul_e5p_g1x_lgb" shape="rect">
                                 <!-- --></a><ul class="ul" id="using-nvjpegEncodeImage__ul_e5p_g1x_lgb">
                                 <li class="li"><samp class="ph codeph">source.channel[0] = pImage</samp></li>
                                 <li class="li"><samp class="ph codeph">source.pitch[0] = W*3</samp></li>
                              </ul>
                              <p class="p">When the same the image is stored in planar format, with image planes pointers stored
                                 				continuously in the array <samp class="ph codeph">pImage[3]</samp>, then <samp class="ph codeph">source</samp> should
                                 				be:
                              </p><a name="using-nvjpegEncodeImage__ul_f5p_g1x_lgb" shape="rect">
                                 <!-- --></a><ul class="ul" id="using-nvjpegEncodeImage__ul_f5p_g1x_lgb">
                                 <li class="li"><samp class="ph codeph">source.channel[0] = pImage[0]</samp></li>
                                 <li class="li"><samp class="ph codeph">source.channel[1] = pImage[1]</samp></li>
                                 <li class="li"><samp class="ph codeph">source.channel[2] = pImage[2]</samp></li>
                              </ul>
                              <p class="p">The <samp class="ph codeph">pitch</samp> values for each channel in the <samp class="ph codeph">source</samp> parameter
                                 				should be set accordingly to the data layout.
                              </p>
                              <p class="p">The nvJPEG library will perform the color transformation to the YCbCr, and will compress
                                 				the result.
                              </p>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-US" id="retrieving-compressed-stream"><a name="retrieving-compressed-stream" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#retrieving-compressed-stream" name="retrieving-compressed-stream" shape="rect">3.1.4.&nbsp;Retrieving the Compressed Stream </a></h3>
                        <div class="body conbody">
                           <p class="p">Often it is not feasible to accurately predict the final compressed data size of the final
                              				JPEG stream for any input data and parameters. The nvJPEG library, while encoding, will
                              				calculate the size of the final stream, allocate temporary buffer in the encoder state and
                              				save the compressed data in the encoding state's buffer. In order to get final compressed
                              				JPEG stream, the user should provide the memory buffer large enough to store this compressed
                              				data. There are two options for how to do this:
                           </p><a name="retrieving-compressed-stream__ol_slv_tbx_lgb" shape="rect">
                              <!-- --></a><ol class="ol" id="retrieving-compressed-stream__ol_slv_tbx_lgb">
                              <li class="li">Use the upper bound on compressed JPEG stream size for the given parameters and image
                                 						dimensions:<a name="retrieving-compressed-stream__ol_tlv_tbx_lgb" shape="rect">
                                    <!-- --></a><ol class="ol" type="a" id="retrieving-compressed-stream__ol_tlv_tbx_lgb">
                                    <li class="li">Use the <samp class="ph codeph"><a class="xref" href="index.html#nvjpeg-encode-retrieve-bitstream" shape="rect">nvjpegEncodeRetrieveBitstream()</a></samp> function to retrieve the
                                       							maximum possible JPEG stream size at any given time.
                                    </li>
                                    <li class="li">Allocate the memory buffer at any given time. </li>
                                    <li class="li">Encode the image using one of the encoding functions.</li>
                                    <li class="li">Retrieve the compressed JPEG stream from the encoder state after successful
                                       							encoding, using the  <samp class="ph codeph">nvjpegEncodeRetrieveBitstream()</samp> and the
                                       							allocated buffer. 
                                    </li>
                                 </ol>
                              </li>
                              <li class="li">Wait for the encoding to complete, and retrieve the exact size of required buffer, as
                                 						below:<a name="retrieving-compressed-stream__ol_ulv_tbx_lgb" shape="rect">
                                    <!-- --></a><ol class="ol" type="a" id="retrieving-compressed-stream__ol_ulv_tbx_lgb">
                                    <li class="li">Encode the image using one of the encoding functions.</li>
                                    <li class="li">Use the <samp class="ph codeph">nvjpegEncodeRetrieveBitstream()</samp> function to retrieve the
                                       							size in bytes of the compressed JPEG stream.
                                    </li>
                                    <li class="li">Allocate the memory buffer of at least this size.</li>
                                    <li class="li">Use the <samp class="ph codeph">nvjpegEncodeRetrieveBitstream()</samp> function to populate your
                                       							buffer with the compressed JPEG stream.
                                    </li>
                                 </ol>
                              </li>
                           </ol>
                           <div class="p">
                              <div class="note note"><span class="notetitle">Note:</span> As the same encoding image state can be reused to compress a series of images, the
                                 						<samp class="ph codeph">nvjpegEncodeRetrieveBitstream()</samp> function will return the result for the
                                 					last compressed image.
                              </div>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-US" id="nvjpeg-encode-examples"><a name="nvjpeg-encode-examples" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encode-examples" name="nvjpeg-encode-examples" shape="rect">3.1.5.&nbsp;JPEG Encoding Example</a></h3>
                        <div class="body conbody">
                           <p class="p">See below the example code, and the block diagram shown in <a class="xref" href="index.html#nvjpeg-encode-examples__fig-nvjpeg-encode-example" shape="rect">Figure 1</a>, for encoding with nvJPEG Encoder.
                           </p>
                           <div class="fig fignone" id="nvjpeg-encode-examples__fig-nvjpeg-encode-example"><a name="nvjpeg-encode-examples__fig-nvjpeg-encode-example" shape="rect">
                                 <!-- --></a><span class="figcap">Figure 1. JPEG Encoding Using nvJPEG Encoder</span><br clear="none"></br><div class="imagecenter"><img class="image imagecenter" width="800" src="graphics/nvjpeg-encoding-flow.png" alt="nvJPEG Encoder Example"></img></div><br clear="none"></br></div><pre xml:space="preserve">nvjpegHandle_t nv_handle;
nvjpegEncoderState_t nv_enc_state;
nvjpegEncoderParams_t nv_enc_params;
cudaStream_t stream;
 
<span xmlns:xslthl="http://xslthl.sf.net" class="xslthl-comment">// initialize nvjpeg structures</span>
nvjpegCreateSimple(&amp;nv_handle);
nvjpegEncoderStateCreate(nv_handle, &amp;nv_enc_state, stream);
nvjpegEncoderParamsCreate(nv_handle, &amp;nv_enc_params, stream);
 
nvjpegImage_t nv_image;
<span xmlns:xslthl="http://xslthl.sf.net" class="xslthl-comment">// Fill nv_image with image data, let’s say 640x480 image in RGB format</span>
 
<span xmlns:xslthl="http://xslthl.sf.net" class="xslthl-comment">// Compress image</span>
nvjpegEncodeImage(nv_handle, nv_enc_state, nv_enc_params,
    &amp;nv_image, NVJPEG_INPUT_RGB, 640, 480, stream);
 
<span xmlns:xslthl="http://xslthl.sf.net" class="xslthl-comment">// get compressed stream size</span>
size_t length;
nvjpegEncodeRetrieveBitstream(nv_handle, nv_enc_state, NULL, &amp;length, stream);
<span xmlns:xslthl="http://xslthl.sf.net" class="xslthl-comment">// get stream itself</span>
cudaStreamSynchronize(stream);
std::vector&lt;<span xmlns:xslthl="http://xslthl.sf.net" class="xslthl-keyword">char</span>&gt; jpeg(length);
nvjpegEncodeRetrieveBitstream(nv_handle, nv_enc_state, jpeg.data(), &amp;length, 0);
 
<span xmlns:xslthl="http://xslthl.sf.net" class="xslthl-comment">// write stream to file</span>
cudaStreamSynchronize(stream);
std::ofstream output_file(“test.jpg”, std::ios::out | std::ios::binary);
output_file.write(jpeg.data(), length);
output_file.close();</pre></div>
                     </div>
                  </div>
                  <div class="topic concept nested1" xml:lang="en-us" id="nvjpeg-encoder-type-declarations"><a name="nvjpeg-encoder-type-declarations" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-type-declarations" name="nvjpeg-encoder-type-declarations" shape="rect">3.2.&nbsp;nvJPEG Encoder Type Declarations</a></h3>
                     <div class="body conbody">
                        <p class="p">This section describes the nvJPEG Encoder Type Declarations.</p>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-inputformat"><a name="nvjpeg-inputformat" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-inputformat" name="nvjpeg-inputformat" shape="rect">nvjpegInputFormat_t</a></h3>
                        <div class="body conbody">
                           <div class="p"><pre xml:space="preserve">typedef enum
{
    NVJPEG_INPUT_RGB         = 3, 
    NVJPEG_INPUT_BGR         = 4, 
    NVJPEG_INPUT_RGBI        = 5, 
    NVJPEG_INPUT_BGRI        = 6 
} nvjpegInputFormat_t;</pre></div>
                           <p class="p">The <samp class="ph codeph">nvjpegInputFormat_t</samp> enum is used to select the color model and pixel
                              			format of the input image. It is used for conversion to YCbCr during encoding.
                           </p>
                           <div class="p">
                              <div class="tablenoborder"><a name="nvjpeg-inputformat__table_ogq_y1x_bgb" shape="rect">
                                    <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-inputformat__table_ogq_y1x_bgb" class="table" frame="border" border="1" rules="all">
                                    <tbody class="tbody">
                                       <tr class="row">
                                          <td class="entry" valign="top" width="33.557046979865774%" rowspan="1" colspan="1"><strong class="ph b">Member</strong></td>
                                          <td class="entry" valign="top" width="66.44295302013423%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="33.557046979865774%" rowspan="1" colspan="1">NVJPEG_INPUT_RGB</td>
                                          <td class="entry" valign="top" width="66.44295302013423%" rowspan="1" colspan="1">Input image is in RGB color model. Pixel format is RGB.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="33.557046979865774%" rowspan="1" colspan="1">NVJPEG_INPUT_BGR</td>
                                          <td class="entry" valign="top" width="66.44295302013423%" rowspan="1" colspan="1">Input image is in RGB color model. Pixel format is BGR.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="33.557046979865774%" rowspan="1" colspan="1">NVJPEG_INPUT_RGBI</td>
                                          <td class="entry" valign="top" width="66.44295302013423%" rowspan="1" colspan="1">Input image is in RGB color model. Pixel format is interleaved RGB.</td>
                                       </tr>
                                       <tr class="row">
                                          <td class="entry" valign="top" width="33.557046979865774%" rowspan="1" colspan="1">NVJPEG_INPUT_BGRI</td>
                                          <td class="entry" valign="top" width="66.44295302013423%" rowspan="1" colspan="1">Input image is in RGB color model. Pixel format is interleaved BGR.</td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encoder-state"><a name="nvjpeg-encoder-state" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-state" name="nvjpeg-encoder-state" shape="rect">3.2.2.&nbsp;nvjpegEncoderState_t</a></h3>
                        <div class="body conbody">
                           <p class="p">The <samp class="ph codeph">nvjpegEncoderState_t</samp> is a structure that stores intermdiate buffers and
                              			variables used for compression. 
                           </p>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encoder-params"><a name="nvjpeg-encoder-params" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-params" name="nvjpeg-encoder-params" shape="rect">3.2.3.&nbsp;nvjpegEncoderParams_t</a></h3>
                        <div class="body conbody">
                           <p class="p">The <samp class="ph codeph">nvjpegEncoderParams_t</samp> is a structure that stores JPEG encode
                              			parameters.
                           </p>
                        </div>
                     </div>
                  </div>
                  <div class="topic concept nested1" xml:lang="en-us" id="nvjpeg-encoder-helper-api-reference"><a name="nvjpeg-encoder-helper-api-reference" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-helper-api-reference" name="nvjpeg-encoder-helper-api-reference" shape="rect">3.3.&nbsp;nvJPEG Encoder Helper API Reference</a></h3>
                     <div class="body conbody">
                        <p class="p">The nvJPEG Encoder helper functions are used for initializing. </p>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encoder-state-create"><a name="nvjpeg-encoder-state-create" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-state-create" name="nvjpeg-encoder-state-create" shape="rect">3.3.1.&nbsp;nvjpegEncoderStateCreate()</a></h3>
                        <div class="body conbody">
                           <p class="p">Creates encoder state that stores intermediate buffers used in compression.</p>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegEncoderStateCreate(
	nvjpegHandle_t handle,
	nvjpegEncoderState_t *encoder_state,
	cudaStream_t stream);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encoder-state-create__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encoder-state-create__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">handle</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Library handle</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_state</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Output</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Pointer to the encoder state structure, where the new state will be
                                          							placed.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">stream</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Inputt</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">CUDA stream where all the required device operations will be placed.</p>
                                       </td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encoder-state-destroy"><a name="nvjpeg-encoder-state-destroy" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-state-destroy" name="nvjpeg-encoder-state-destroy" shape="rect">3.3.2.&nbsp;nvjpegEncoderStateDestroy()</a></h3>
                        <div class="body conbody">
                           <p class="p">Destroys the encoder state.</p>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegEncoderStateDestroy(
	nvjpegEncoderState_t encoder_state);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encoder-state-destroy__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encoder-state-destroy__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_state</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Encoder state structure that will be released.</td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encoder-params-create"><a name="nvjpeg-encoder-params-create" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-params-create" name="nvjpeg-encoder-params-create" shape="rect">3.3.3.&nbsp;nvjpegEncoderParamsCreate()</a></h3>
                        <div class="body conbody">
                           <p class="p">Creates the structure that holds the compression parameters.</p>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegEncoderParamsCreate(
	nvjpegHandle_t handle, 
	nvjpegEncoderParams_t *encoder_params,
	cudaStream_t stream);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encoder-params-create__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encoder-params-create__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">handle</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Library handle</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_params</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Output</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Pointer to the location where the new parameters structure will be placed.</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">stream</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Inputt</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">CUDA stream where all the required device operations will be placed.</p>
                                       </td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encoder-params-destroy"><a name="nvjpeg-encoder-params-destroy" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-params-destroy" name="nvjpeg-encoder-params-destroy" shape="rect">3.3.4.&nbsp;nvjpegEncoderParamsDestroy()</a></h3>
                        <div class="body conbody">
                           <p class="p">Destroys the encoder parameters structure.</p>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegEncoderParamsDestroy(
	nvjpegEncoderParams_t encoder_params);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encoder-params-destroy__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encoder-params-destroy__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_params</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Encoder params structure that will be released.</p>
                                       </td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encoder-params-set-quality"><a name="nvjpeg-encoder-params-set-quality" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-params-set-quality" name="nvjpeg-encoder-params-set-quality" shape="rect">3.3.5.&nbsp;nvjpegEncoderParamsSetQuality()</a></h3>
                        <div class="body conbody">
                           <p class="p">Sets the parameter quality in the encoder parameters structure.</p>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegEncoderParamsSetQuality(
	nvjpegEncoderParams_t encoder_params,
	const int quality,
	cudaStream_t stream);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encoder-params-set-quality__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encoder-params-set-quality__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_params</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Encoder params structure handle.</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">quality</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Integer value of quality between 1 and 100, where 100 is the highest quality.
                                             								Default value is 70.
                                          </p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">stream</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Inputt</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">CUDA stream where all the required device operations will be placed.</p>
                                       </td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encoder-params-set-optimized-huffman"><a name="nvjpeg-encoder-params-set-optimized-huffman" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-params-set-optimized-huffman" name="nvjpeg-encoder-params-set-optimized-huffman" shape="rect">3.3.6.&nbsp;nvjpegEncoderParamsSetOptimizedHuffman()</a></h3>
                        <div class="body conbody">
                           <p class="p">Sets whether or not to use optimized Huffman. Using optimized Huffman produces smaller JPEG
                              			bitstream sizes with the same quality, but with slower performance.
                           </p>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegEncoderParamsSetOptimizedHuffman(
	nvjpegEncoderParams_t encoder_params,
	const int optimized,
	cudaStream_t stream);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encoder-params-set-optimized-huffman__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encoder-params-set-optimized-huffman__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_params</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Encoder params structure handle.</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">optimized</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">If this value is 0 then non-optimized Huffman will be used. Otherwise optimized version
                                          							will be used. Default value is 0.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">stream</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Inputt</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">CUDA stream where all the required device operations will be placed.</p>
                                       </td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encoder-params-set-sampling-factors"><a name="nvjpeg-encoder-params-set-sampling-factors" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-params-set-sampling-factors" name="nvjpeg-encoder-params-set-sampling-factors" shape="rect">3.3.7.&nbsp;nvjpegEncoderParamsSetSamplingFactors()</a></h3>
                        <div class="body conbody">
                           <p class="p">Sets which chroma subsampling will be used for JPEG compression. </p>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegEncoderParamsSetSamplingFactors(
	nvjpegEncoderParams_t encoder_params,
	const nvjpegChromaSubsampling_t chroma_subsampling,
	cudaStream_t stream);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encoder-params-set-sampling-factors__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encoder-params-set-sampling-factors__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_params</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Encoder params structure handle.</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">chroma_subsampling</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Chroma subsampling that will be used for JPEG compression. If the input is in YUV
                                             								color model and <samp class="ph codeph">chroma_subsampling</samp> is different from the
                                             								subsampling factors of source image, then the NVJPEG library will convert
                                             								subsampling to the value of <samp class="ph codeph">chroma_subsampling</samp>.  Default value is
                                             								4:4:4.
                                          </p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">stream</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Inputt</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">CUDA stream where all the required device operations will be placed.</p>
                                       </td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                  </div>
                  <div class="topic concept nested1" xml:lang="en-us" id="nvjpeg-encoder-api-reference"><a name="nvjpeg-encoder-api-reference" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-api-reference" name="nvjpeg-encoder-api-reference" shape="rect">3.4.&nbsp;nvJPEG Encoder API Reference</a></h3>
                     <div class="body conbody">
                        <p class="p">This section describes the nvJPEG Encoder API. </p>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encoder-get-buffer-size"><a name="nvjpeg-encoder-get-buffer-size" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encoder-get-buffer-size" name="nvjpeg-encoder-get-buffer-size" shape="rect">nvjpegEncodeGetBufferSize()</a></h3>
                        <div class="body conbody">
                           <p class="p">Returns the maximum possible buffer size that is needed to store the compressed JPEG stream,
                              			for the given input parameters.
                           </p>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegEncodeGetBufferSize(
	nvjpegHandle_t handle,
	const nvjpegEncoderParams_t encoder_params,
	int image_width,
	int image_height,
	size_t *max_stream_length);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encoder-get-buffer-size__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encoder-get-buffer-size__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">handle</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Library handle</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_params</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Encoder parameters structure handle.</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">image_width</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Input image width.</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1">image_height</td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Input image height.</td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">stream</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Inputt</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">CUDA stream where all the required device operations will be placed.</p>
                                       </td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encode-yuv"><a name="nvjpeg-encode-yuv" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encode-yuv" name="nvjpeg-encode-yuv" shape="rect">3.4.2.&nbsp;nvjpegEncodeYUV()</a></h3>
                        <div class="body conbody">
                           <p class="p">Compresses the image in YUV colorspace to JPEG stream using the provided parameters, and
                              			stores it in the state structure.
                           </p>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegEncodeYUV(
	nvjpegHandle_t handle,
	nvjpegEncoderState_t encoder_state,
	const nvjpegEncoderParams_t encoder_params,
	const nvjpegImage_t *source,
	nvjpegChromaSubsampling_t chroma_subsampling, 
	int image_width,
	int image_height,
	cudaStream_t stream);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encode-yuv__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encode-yuv__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">handle</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Library handle</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_state</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Internal structure that holds the temporary buffers required for the compression
                                          							and also stores the final compressed JPEG stream.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_params</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Encoder parameters structure handle.</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">source</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Pointer to the <samp class="ph codeph">nvjpeg</samp> structure that holds the device pointers
                                          							to the <samp class="ph codeph">Y, U(Cb) and V(Cr)</samp> image planes and the respective
                                          							strides.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">chroma_subsampling</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Chroma subsampling of the input data.</td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">image_width</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Input image width.</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1">image_height</td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Input image height.</td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">stream</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Inputt</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">CUDA stream where all the required device operations will be placed.</p>
                                       </td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encode-image"><a name="nvjpeg-encode-image" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encode-image" name="nvjpeg-encode-image" shape="rect">3.4.3.&nbsp;nvjpegEncodeImage()</a></h3>
                        <div class="body conbody">
                           <p class="p">Compresses the image in the provided format to the JPEG stream using the provided parameters,
                              			and stores it in the state structure.
                           </p>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegEncodeImage(
	nvjpegHandle_t handle,
	nvjpegEncoderState_t encoder_state,
	const nvjpegEncoderParams_t encoder_params,
	const nvjpegImage_t *source,
	nvjpegInputFormat_t input_format, 
	int image_width,
	int image_height,
	cudaStream_t stream);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encode-image__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encode-image__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">handle</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Library handle</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_state</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Internal structure that holds the temporary buffers required for the compression
                                          							and also stores the final compressed JPEG stream.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_params</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Encoder parameters structure handle.</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">source</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Pointer to the <samp class="ph codeph">nvjpeg</samp> structure that holds the device pointers
                                          							to the <samp class="ph codeph">Y, U(Cb) and V(Cr)</samp> image planes and the respective
                                          							strides.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">input_format</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Value of <samp class="ph codeph">nvjpegInputFormat_t</samp> type that describes the input
                                             								data.
                                          </p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">image_width</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Input image width.</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1">image_height</td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Input image height.</td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">stream</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">CUDA stream where all the required device operations will be placed.</p>
                                       </td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                     <div class="topic concept nested2" xml:lang="en-us" id="nvjpeg-encode-retrieve-bitstream"><a name="nvjpeg-encode-retrieve-bitstream" shape="rect">
                           <!-- --></a><h3 class="title topictitle2"><a href="#nvjpeg-encode-retrieve-bitstream" name="nvjpeg-encode-retrieve-bitstream" shape="rect">3.4.4.&nbsp;nvjpegEncodeRetrieveBitstream()</a></h3>
                        <div class="body conbody">
                           <p class="p">Retrieves the compressed stream from the encoder state that was previously used in one of the
                              			encoder functions. 
                           </p>
                           <div class="p"><a name="nvjpeg-encode-retrieve-bitstream__ul_dp5_2mf_kgb" shape="rect">
                                 <!-- --></a><ul class="ul" id="nvjpeg-encode-retrieve-bitstream__ul_dp5_2mf_kgb">
                                 <li class="li">If <samp class="ph codeph">data</samp> parameter is NULL then the encoder will return compressed
                                    					stream size in the <samp class="ph codeph">length</samp> parameter. 
                                 </li>
                                 <li class="li">If <samp class="ph codeph">data</samp> is not NULL then the provided <samp class="ph codeph">length</samp> parameter
                                    					should contain the  <samp class="ph codeph">data</samp> buffer size. 
                                 </li>
                                 <li class="li">If the provided <samp class="ph codeph">length</samp> is less than compressed stream size, then an
                                    					error will be returned. Otherwise the compressed stream will be stored in the
                                    						<samp class="ph codeph">data</samp> buffer and the actual compressed buffer size will be stored in the
                                    						<samp class="ph codeph">length</samp> parameter.
                                 </li>
                              </ul>
                           </div>
                           <p dir="ltr" class="p"><strong class="ph b">Signature:</strong></p><pre xml:space="preserve">nvjpegStatus_t nvjpegEncodeRetrieveBitstream(
	nvjpegHandle_t handle,
	nvjpegEncoderState_t encoder_state,
	unsigned char *data,
	size_t *length,
	cudaStream_t stream);</pre><p dir="ltr" class="p"><strong class="ph b">Parameters:</strong></p>
                           <div class="tablenoborder"><a name="nvjpeg-encode-retrieve-bitstream__table_qc3_kqt_d2b" shape="rect">
                                 <!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="nvjpeg-encode-retrieve-bitstream__table_qc3_kqt_d2b" class="table" frame="border" border="1" rules="all">
                                 <tbody class="tbody">
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><strong class="ph b">Parameter</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1"><strong class="ph b">Input / Output</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1"><strong class="ph b">Memory</strong></td>
                                       <td class="entry" dir="ltr" valign="top" width="34.75609756097561%" rowspan="1" colspan="1"><strong class="ph b">Description</strong></td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">handle</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">Library handle</p>
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">encoder_state</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">The <samp class="ph codeph">encoder_state</samp> that was previously used in one of the encoder
                                          							functions.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" dir="ltr" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">data</samp></td>
                                       <td class="entry" dir="ltr" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" dir="ltr" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Pointer to the buffer in the host memory where the compressed stream will be stored.
                                          							Can be NULL (see description).
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">length</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Input/Output</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">Pointer to the input buffer size. On return the NVJPEG library will store the
                                          							actual compressed stream size in this parameter.
                                       </td>
                                    </tr>
                                    <tr class="row">
                                       <td class="entry" valign="top" width="32.774390243902445%" rowspan="1" colspan="1"><samp class="ph codeph">stream</samp></td>
                                       <td class="entry" valign="top" width="17.225609756097562%" rowspan="1" colspan="1">Inputt</td>
                                       <td class="entry" valign="top" width="15.243902439024392%" rowspan="1" colspan="1">Host</td>
                                       <td class="entry" valign="top" width="34.75609756097561%" rowspan="1" colspan="1">
                                          <p class="p">CUDA stream where all the required device operations will be placed.</p>
                                       </td>
                                    </tr>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                  </div>
               </div>
               <div class="topic concept nested0" id="notices-header"><a name="notices-header" shape="rect">
                     <!-- --></a><h2 class="title topictitle1"><a href="#notices-header" name="notices-header" shape="rect">Notices</a></h2>
                  <div class="topic reference nested1" id="notice"><a name="notice" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#notice" name="notice" shape="rect"></a></h3>
                     <div class="body refbody">
                        <div class="section">
                           <h3 class="title sectiontitle">Notice</h3>
                           <p class="p">ALL NVIDIA DESIGN SPECIFICATIONS, REFERENCE BOARDS, FILES, DRAWINGS, DIAGNOSTICS, LISTS, AND OTHER DOCUMENTS (TOGETHER AND
                              SEPARATELY, "MATERIALS") ARE BEING PROVIDED "AS IS." NVIDIA MAKES NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE
                              WITH RESPECT TO THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS
                              FOR A PARTICULAR PURPOSE. 
                           </p>
                           <p class="p">Information furnished is believed to be accurate and reliable. However, NVIDIA Corporation assumes no responsibility for the
                              consequences of use of such information or for any infringement of patents or other rights of third parties that may result
                              from its use. No license is granted by implication of otherwise under any patent rights of NVIDIA Corporation. Specifications
                              mentioned in this publication are subject to change without notice. This publication supersedes and replaces all other information
                              previously supplied. NVIDIA Corporation products are not authorized as critical components in life support devices or systems
                              without express written approval of NVIDIA Corporation.
                           </p>
                        </div>
                     </div>
                  </div>
                  <div class="topic reference nested1" id="trademarks"><a name="trademarks" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#trademarks" name="trademarks" shape="rect"></a></h3>
                     <div class="body refbody">
                        <div class="section">
                           <h3 class="title sectiontitle">Trademarks</h3>
                           <p class="p">NVIDIA and the NVIDIA logo are trademarks or registered trademarks of NVIDIA Corporation
                              in the U.S. and other countries.  Other company and product names may be trademarks of
                              the respective companies with which they are associated.
                           </p>
                        </div>
                     </div>
                  </div>
                  <div class="topic reference nested1" id="copyright-present"><a name="copyright-present" shape="rect">
                        <!-- --></a><h3 class="title topictitle2"><a href="#copyright-present" name="copyright-present" shape="rect"></a></h3>
                     <div class="body refbody">
                        <div class="section">
                           <h3 class="title sectiontitle">Copyright</h3>
                           <p class="p">© <span class="ph">2019</span> NVIDIA Corporation. All rights
                              reserved.
                           </p>
                           <p class="p">This product includes software developed by the Syncro Soft SRL (http://www.sync.ro/).</p>
                        </div>
                     </div>
                  </div>
               </div>
               
               <hr id="contents-end"></hr>
               
            </article>
         </div>
      </div>
      <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/formatting/common.min.js"></script>
      <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/scripts/google-analytics/google-analytics-write.js"></script>
      <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/scripts/google-analytics/google-analytics-tracker.js"></script>
      <script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript">stLight.options({publisher: "998dc202-a267-4d8e-bce9-14debadb8d92", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script><script type="text/javascript">_satellite.pageBottom();</script></body>
</html>