IP Library Granted Patent US 12,707,072
Granted Patent B2
US 12,707,072 · App. 18/755,150 · Granted Aug 11, 2026

Encoding and decoding images using differentiable JPEG compression

Inventors: Biplob Debnath (Princeton, NJ); Deep Patel (Franklin Park, NJ); Srimat Chakradhar (Manalapan, NJ); Christoph Reich (Hessen, DE)
Assignee: NEC Corporation
H04N19/33H04N19/124H04N19/176H04N19/186H04N19/625
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,707,072
App. No.
18/755,150
Filed
Jun 26, 2024
Granted
Aug 11, 2026
Kind
B2
Art Unit
2425
USPC
375/240.02
Abstract

Systems and methods are provided for encoding and decoding images using differentiable JPEG compression, including converting images from RGB color space to YCbCr color space to obtain a luminance and chrominance channels, and applying chroma subsampling to the chrominance channels to reduce resolution. The YCbCr image is divided into pixel blocks and a DCT is performed on the pixel blocks to obtain DCT coefficients. DCT coefficients are quantized using a scaled quantization table to reduce precision, and quantized DCT coefficients are encoded using lossless entropy coding, forming a compressed JPEG file decoded by reversing the lossless entropy coding to obtain quantized DCT coefficients, which are dequantized using the scaled quantization table to restore the precision. The dequantized DCT coefficients are converted back to a spatial domain using an IDCT, the chrominance channels are upsampled to original resolution, and the YCbCr image is converted back to the RGB color space.

Claims (52)

1 . A computer-implemented method for encoding and decoding images using differentiable Joint Photographic Experts Group (JPEG) compression, comprising:

converting an image from a Red-Green-Blue (RGB) color space to a Luminance-Chrominance (YCbCr) color space to obtain a luminance channel and chrominance channels, and applying chroma subsampling to the chrominance channels to reduce resolution;

dividing the YCbCr image into pixel blocks and performing a discrete cosine transform (DCT) on each of the pixel blocks to obtain DCT coefficients;

quantizing the DCT coefficients using a scaled quantization table (SQT) to generate quantized DCT coefficients and reduce precision by:

computing SQT values with a differentiable floor function that utilizes a polynomial rounding function to approximate a floor of numerical values for the SQT;

maintaining non-zero gradients of the SQT values by utilizing a differentiable clipping function that computes a soft approximation of the SQT values based on an integer range of the JPEG compression and a scale parameter; and

applying the SQT to DCT patches of the image by rounding a result from dividing DCT coefficients with a corresponding value in the SQT;

encoding the quantized DCT coefficients using lossless entropy coding to generate a compressed JPEG file and decoding the compressed JPEG file by reversing the lossless entropy coding to obtain the quantized DCT coefficients;

dequantizing the quantized DCT coefficients using the scaled quantization table to generate dequantized DCT coefficients to restore the precision;

applying an inverse discrete cosine transform (IDCT) to the dequantized DCT coefficients to convert the dequantized DCT coefficients back to a spatial domain; and

upsampling the chrominance channels to an original resolution, and converting the YCbCr image back to the RGB color space.

2 . The method of claim 1 , wherein converting the RGB image to the YCbCr color space comprises applying a pixel-wise affine transformation.

3 . The method of claim 1 , wherein the chroma subsampling involves anti-aliasing using a 2D convolution followed by downsampling.

4 . The method of claim 1 , wherein a scale factor for the quantization table is computed based on a JPEG quality parameter, and the quantization table is scaled by the scale factor.

5 . The method of claim 1 , wherein the encoding the quantized DCT coefficients using lossless entropy coding comprises arranging the coefficients in a zigzag order, performing run-length encoding, and applying Huffman coding.

6 . The method of claim 1 , wherein the decoding further comprises clipping output pixel values to ensure they remain within a valid range by utilizing a product of the output pixel values and the scale parameter when the pixel values are outside the valid range.

7 . The method of claim 1 , further comprising using a straight-through estimator (STE) technique during the encoding and the decoding to execute accurate gradient propagation for machine learning applications.

8 . A system for encoding and decoding images using a differentiable JPEG approach, comprising:

a processor device; and

a memory storing instructions that, when executed by the processor device, cause the system to:

convert an image from a Red-Green-Blue (RGB) color space to a Luminance-Chrominance (YCbCr) color space to obtain a luminance channel and chrominance channels, and apply chroma subsampling to the chrominance channels to reduce resolution;

divide the YCbCr image into pixel blocks and performing a discrete cosine transform (DCT) on each of the pixel blocks to obtain DCT coefficients;

quantize the DCT coefficients using a scaled quantization table (SQT) to generate quantized DCT coefficients and reduce precision by:

computing SQT values with a differentiable floor function that utilizes a polynomial rounding function to approximate a floor of numerical values for the SQT;

maintaining non-zero gradients of the SQT values by utilizing a differentiable clipping function that computes a soft approximation of the SQT values based on an integer range of a JPEG compression and a scale parameter; and

applying the SQT to DCT patches of the image by rounding a result from dividing DCT coefficients with a corresponding value in the SQT;

encode the quantized DCT coefficients using lossless entropy coding to generate a compressed JPEG file, and decode the compressed JPEG file by reversing the lossless entropy coding to obtain the quantized DCT coefficients;

dequantize the quantized DCT coefficients using the scaled quantization table to generate dequantized DCT coefficients to restore the precision;

apply an inverse discrete cosine transform (IDCT) to the dequantized DCT coefficients to convert the dequantized DCT coefficients back to a spatial domain; and

upsample the chrominance channels to an original resolution, and converting the YCbCr image back to the RGB color space.

9 . The system of claim 8 , wherein the instructions for converting the RGB image to the YCbCr color space comprise instructions for applying a pixel-wise affine transformation.

10 . The system of claim 8 , wherein the instructions for chroma subsampling include instructions for performing anti-aliasing using a 2D convolution followed by downsampling.

11 . The system of claim 8 , wherein a scale factor for the quantization table is computed based on a JPEG quality parameter, and the instructions for scaling the quantization table include instructions for computing the scale factor based on the JPEG quality parameter.

12 . The system of claim 8 , wherein the instructions for encoding the quantized DCT coefficients using lossless entropy coding include instructions for arranging the coefficients in a zigzag order, performing run-length encoding, and applying Huffman coding.

13 . The system of claim 8 , wherein the instructions for the decoding further include instructions for clipping output pixel values to ensure they remain within a valid range by utilizing a product of the output pixel values and the scale parameter when the pixel values are outside the valid range.

14 . The system of claim 8 , wherein the instructions further include using a straight-through estimator (STE) technique during the encoding and decoding to execute accurate gradient propagation for machine learning applications.

15 . A computer program product for encoding and decoding images using a differentiable JPEG approach, the computer program product comprising a non-transitory computer-readable storage medium having program instructions embodied therewith, the program instructions executable by a hardware processor to cause the hardware processor to:

convert an image from a Red-Green-Blue (RGB) color space to a Luminance-Chrominance (YCbCr) color space to obtain a luminance channel and chrominance channels, and apply chroma subsampling to the chrominance channels to reduce resolution;

divide the YCbCr image into pixel blocks and performing a discrete cosine transform (DCT) on each of the pixel blocks to obtain DCT coefficients;

quantize the DCT coefficients using a scaled quantization table (SQT) to generate quantized DCT coefficients and reduce precision by:

computing SQT values with a differentiable floor function that utilizes a polynomial rounding function to approximate a floor of numerical values for the SQT;

maintaining non-zero gradients of the SQT values by utilizing a differentiable clipping function that computes a soft approximation of the SQT values based on an integer range of a JPEG compression and a scale parameter; and

applying the SQT to DCT patches of the image by rounding a result from dividing DCT coefficients with a corresponding value in the SQT;

encode the quantized DCT coefficients using lossless entropy coding to generate a compressed JPEG file, and decode the compressed JPEG file by reversing the lossless entropy coding to obtain the quantized DCT coefficients;

dequantize the quantized DCT coefficients using the scaled quantization table to generate dequantized DCT coefficients to restore the precision;

apply an inverse discrete cosine transform (IDCT) to the dequantized DCT coefficients to convert the dequantized DCT coefficients back to a spatial domain; and

upsample the chrominance channels to an original resolution, and converting the YCbCr image back to the RGB color space.

16 . The computer program product of claim 15 , wherein the program instructions for converting the RGB image to the YCbCr color space comprise instructions for applying a pixel-wise affine transformation.

17 . The computer program product of claim 15 , wherein the program instructions for chroma sub sampling include instructions for performing anti-aliasing using a 2D convolution followed by downsampling.

18 . The computer program product of claim 15 , wherein a scale factor for the quantization table is computed based on a JPEG quality parameter, and the program instructions for scaling the quantization table include instructions for computing the scale factor based on the JPEG quality parameter.

19 . The computer program product of claim 15 , wherein the program instructions for encoding the quantized DCT coefficients using lossless entropy coding include instructions for arranging the coefficients in a zigzag order, performing run-length encoding, and applying Huffman coding.

20 . The computer program product of claim 15 , wherein the program instructions for decoding further include instructions for clipping output pixel values to ensure they remain within a valid range by utilizing a product of the output pixel values and the scale parameter when the pixel values are outside the valid range.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 24, 2026
From: NEC LABORATORIES AMERICA, INC.
To: NEC CORPORATION
Reel/Frame 075069/0642 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 26, 2024
From: DEBNATH, BIPLOB; PATEL, DEEP; CHAKRADHAR, SRIMAT; REICH, CHRISTOPH
To: NEC LABORATORIES AMERICA, INC.
Reel/Frame 067944/0322 →
Continuity (3)
Provisional Application 63535381 · Aug 30, 2023
Provisional Application 63523508 · Jun 27, 2023
Related Publication 20250008132A1 · Jan 2, 2025
References Cited (40)
US 11638025B2 · Pourreza · 2023 [cited by examiner]
US 11825090B1 · Said · 2023 [cited by examiner]
US 20030091242A1 · Kakarala · 2003 [cited by examiner]
US 20220321879A1 · Chadha · 2022 [cited by examiner]
US 20220335560A1 · Yoo · 2022 [cited by examiner]
US 20230154055A1 · Besenbruch · 2023 [cited by examiner]
Bengio, Y., Léonard, N., & Courville, A. (Aug. 15, 2013). Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432. [cited by applicant]
Choi, J., & Han, B. (Aug. 23, 2020). Task-aware quantization network for jpeg image compression. In Computer Vision—ECCV 2020: 16th European Conference, Glasgow, UK, Proceedings, Part XX 16 (pp. 309-324). Springer Inter… [cited by applicant]
Esser, P., Rombach, R., & Ommer, B. (Jun. 20, 2021). Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (pp. 12873-12883). [cited by applicant]
Goodfellow, I. J., Shlens, J., & Szegedy, C. (Dec. 20, 2014). Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572. [cited by applicant]
Guo, C., Rana, M., Cisse, M., & Van Der Maaten, L. (Oct. 31, 2017). Countering adversarial images using input transformations. arXiv preprint arXiv:1711.00117. [cited by applicant]
Hataya, R., Zdenek, J., Yoshizoe, K., & Nakayama, H. (Aug. 23, 2020). Faster autoaugment: Learning augmentation strategies using backpropagation. In Computer Vision—ECCV 2020: 16th European Conference, Glasgow, UK, Proc… [cited by applicant]
He, K., Zhang, X., Ren, S., & Sun, J. (Jun. 27, 2016). Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 770-778). [cited by applicant]
Hudson, G., Léger, A., Niss, B., Sebestyén, I., & Vaaben, J. (Jul. 1, 2018). JPEG-1 standard 25 years: past, present, and future reasons for a success. Journal of Electronic Imaging, 27(4), 040901-040901. [cited by applicant]
Hussain, A. J., Al-Fayadh, A., & Radi, N. (Jul. 26, 2018). Image compression techniques: A survey in lossless and lossy algorithms. Neurocomputing, 300, 44-69. [cited by applicant]
Jang, E., Gu, S., & Poole, B. (Nov. 3, 2016). Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144. [cited by applicant]
Karras, T., Aittala, M., Hellsten, J., Laine, S., Lehtinen, J., & Aila, T. (Dec. 6, 2020). Training generative adversarial networks with limited data. Advances in neural information processing systems, 33, 12104-12114. [cited by applicant]
Kurakin, A., Goodfellow, I., & Bengio, S. (Nov. 4, 2016). Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236. [cited by applicant]
Kurakin, A., Goodfellow, I. J., & Bengio, S. (Jul. 27, 2018). Adversarial examples in the physical world. In Artificial intelligence safety and security (pp. 99-112). Chapman and Hall/CRC. [cited by applicant]
Luo, X., Talebi, H., Yang, F., Elad, M., & Milanfar, P. (Aug. 3, 2020). The rate-distortion-accuracy tradeoff: Jpeg case study. arXiv preprint arXiv:2008.00605. [cited by applicant]
Papamakarios, G., Nalisnick, E., Rezende, D. J., Mohamed, S., & Lakshminarayanan, B. (Mar. 2021). Normalizing flows for probabilistic modeling and inference. Journal of Machine Learning Research, 22(57), 1-64. [cited by applicant]
Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., . . . & Chintala, S. (Dec. 8, 2019). Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing… [cited by applicant]
Riba, E., Mishkin, D., Ponsa, D., Rublee, E., & Bradski, G. (Jun. 13, 2020). Kornia: an open source differentiable computer vision library for pytorch. In Proceedings of the IEEE/CVF Winter Conference on Applications of… [cited by applicant]
Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., . . . & Fei-Fei, L. (Dec. 2015). Imagenet large scale visual recognition challenge. International journal of computer vision, 115, 211-252. [cited by applicant]
Shi, J., Riba, E., Mishkin, D., Moreno, F., & Nicolaou, A. (Nov. 19, 2020). Differentiable data augmentation with Kornia. arXiv preprint arXiv:2011.09832. [cited by applicant]
Shin, R., & Song, D. (Dec. 4, 2017). Jpeg-resistant adversarial images. In NIPS 2017 workshop on machine learning and computer security (vol. 1, p. 8). [cited by applicant]
Shorten, C., & Khoshgoftaar, T. M. (Dec. 2019). A survey on image data augmentation for deep learning. Journal of big data, 6(1), 1-48. [cited by applicant]
Shu, M., Shen, Y., Lin, M. C., & Goldstein, T. (May 30, 2021). Adversarial differentiable data augmentation for autonomous systems. In 2021 IEEE International Conference on Robotics and Automation (ICRA) (pp. 14069-1407… [cited by applicant]
Strümpler, Y., Yang, R., & Timofte, R. (Aug. 23, 2020). Learning to improve image compression without changing the standard decoder. In European Conference on Computer Vision (pp. 200-216). Cham: Springer International … [cited by applicant]
Theis, L., Shi, W., Cunningham, A., & Huszár, F. (Jul. 21, 2022). Lossy image compression with compressive autoencoders. In International conference on learning representations. [cited by applicant]
Van Den Oord, A., & Vinyals, O. (Dec. 4, 2017). Neural discrete representation learning. Advances in neural information processing systems, 30. [cited by applicant]
Wallace, G. K. (Apr. 1, 1991). The JPEG still picture compression standard. Communications of the ACM, 34(4), 30-44. [cited by applicant]
Wang, Z., Bovik, A. C., Sheikh, H. R., & Simoncelli, E. P. (Apr. 13, 2004). Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing, 13(4), 600-612. [cited by applicant]
Xie, X., Zhou, N., Zhu, W., & Liu, J. (Oct. 23, 2022). Bandwidth-Aware Adaptive Codec for DNN Inference Offloading in IoT. In European Conference on Computer Vision (pp. 88-104). Cham: Springer Nature Switzerland. [cited by applicant]
Xing, Y., Qian, Z., & Chen, Q. (Jun. 19, 2021). Invertible image signal processing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (pp. 6287-6296). [cited by applicant]
Yang, Y., Liang, C., He, H., Cao, X., & Gong, N. Z. (Sep. 13, 2021). Faceguard: Proactive deepfake detection. arXiv preprint arXiv:2109.05673. [cited by applicant]
Zeyde, R., Elad, M., & Protter, M. (Jun. 24, 2012). On single image scale-up using sparse-representations. In Curves and Surfaces: 7th International Conference, Avignon, France, Revised Selected Papers 7 (pp. 711-730). … [cited by applicant]
Zhang, C., Karjauv, A., Benz, P., & Kweon, I. S. (Dec. 30, 2020). Towards robust data hiding against (jpeg) compression: A pseudo-differentiable deep learning approach. arXiv preprint arXiv:2101.00973. [cited by applicant]
Zhao, S., Liu, Z., Lin, J., Zhu, J. Y., & Han, S. (Dec. 6, 2020). Differentiable augmentation for data-efficient gan training. Advances in neural information processing systems, 33, 7559-7570. [cited by applicant]
Zhu, J., Kaplan, R., Johnson, J., & Fei-Fei, L. (Sep. 8, 2018). Hidden: Hiding data with deep networks. In Proceedings of the European conference on computer vision (ECCV) (pp. 657-672). [cited by applicant]