# Error! Jpeg Compression using NPP

**URL:** <https://forums.developer.nvidia.com/t/error-jpeg-compression-using-npp/13977>\
**Category:** CUDA Programming and Performance\
**Created:** [December 24, 2009, 5:45am UTC](https://forums.developer.nvidia.com/t/error-jpeg-compression-using-npp/13977 "2009-12-24T05:45:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avatar3D](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Avatar3D](https://forums.developer.nvidia.com/u/Avatar3D)\
**Post date:** [December 24, 2009, 5:45am UTC](https://forums.developer.nvidia.com/t/error-jpeg-compression-using-npp/13977/1 "2009-12-24T05:45:33Z")

</div>

I am getting error while calling NPP API nppiDCTQuantFwd8x8LS\_JPEG\_8u16s\_C1R.  
The error is NPP\_TEXTURE\_BIND\_ERROR. I couldnt find anything from NPP documents.

I appreciate any help people can give.

---

<div class="post-metadata">

**Author:** ![Frank\_Jargstorff](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Frank\_Jargstorff](https://forums.developer.nvidia.com/u/Frank_Jargstorff)\
**Post date:** [January 4, 2010, 11:19pm UTC](https://forums.developer.nvidia.com/t/error-jpeg-compression-using-npp/13977/2 "2010-01-04T23:19:29Z")

</div>

Hi Avatar3D,

I think your problem may be a consequence of our incomplete documentation of the JPEG functions. Here’s what I think is going wrong. Internally we bind the quantization table to a texture which simplifies accessing this data in the kernel code. This texture bind is the only thing that can cause the error code you’re seeing.

The way the nppi JPEG functions work is, that the quantization table creation methods assume HOST POINTERS. The DCT and iDCT functions do exptect those tables given as DEVICE POINTERS though. It is up to the user to create the tables on the host and then do a cudaMemcpy(…) to move the quantization tables to device memory.

If this is what you’re already doing, I would have to get some code from you that would let me reproduce the issue here, so I can investigate.

–Frank

---

<div class="post-metadata">

**Author:** ![Avatar3D](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Avatar3D](https://forums.developer.nvidia.com/u/Avatar3D)\
**Post date:** [January 7, 2010, 6:38am UTC](https://forums.developer.nvidia.com/t/error-jpeg-compression-using-npp/13977/3 "2010-01-07T06:38:46Z")

</div>

> [@](#):
>
> Hi Avatar3D,
> 
> I think your problem may be a consequence of our incomplete documentation of the JPEG functions. Here’s what I think is going wrong. Internally we bind the quantization table to a texture which simplifies accessing this data in the kernel code. This texture bind is the only thing that can cause the error code you’re seeing.
> 
> The way the nppi JPEG functions work is, that the quantization table creation methods assume HOST POINTERS. The DCT and iDCT functions do exptect those tables given as DEVICE POINTERS though. It is up to the user to create the tables on the host and then do a cudaMemcpy(…) to move the quantization tables to device memory.
> 
> If this is what you’re already doing, I would have to get some code from you that would let me reproduce the issue here, so I can investigate.
> 
> –Frank

Thanks Frank. The API returns NPP\_NO\_ERROR.

But the output doesn’t seems similar to CPU version.

Can you please provide some samples on JPEG compression using NPP ?

---

<div class="post-metadata">

**Author:** ![Frank\_Jargstorff](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Frank\_Jargstorff](https://forums.developer.nvidia.com/u/Frank_Jargstorff)\
**Post date:** [January 13, 2010, 1:11am UTC](https://forums.developer.nvidia.com/t/error-jpeg-compression-using-npp/13977/4 "2010-01-13T01:11:51Z")

</div>

> [@](#):
>
> Thanks Frank. The API returns NPP\_NO\_ERROR.
> 
> But the output doesn’t seems similar to CPU version.
> 
> Can you please provide some samples on JPEG compression using NPP ?

At this point I only have unit test code that is not very instructive. I’d propose we take this off the formum and try to figure out why the primitive doesn’t produce the correct result in your application; my unit tests say that it works correctly (well at least for the cases we’re testing).

---

<div class="post-metadata">

**Author:** ![LeeL](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@LeeL](https://forums.developer.nvidia.com/u/LeeL)\
**Post date:** [January 13, 2010, 11:35pm UTC](https://forums.developer.nvidia.com/t/error-jpeg-compression-using-npp/13977/5 "2010-01-13T23:35:38Z")

</div>

> [@](#):
>
> Can you please provide some samples on JPEG compression using NPP ?

I would find this quite useful as well, although I am more interested in jpeg decompression. [External Media](http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/smile2.gif "Media hosted on another site. Click to open in a new tab.")
