---
title: 'JPEG-Assisted QPIE: Hybrid Quantum Image Encoding'
url: https://www.emergentmind.com/topics/jpeg-assisted-qpie-jqpie
type: topic
---

# JPEG-Assisted QPIE: Hybrid Quantum Image Encoding

JPEG-Assisted QPIE (JQPIE) is a hybrid classical–quantum image preparation protocol that leverages JPEG compression principles—most notably, 8×8 block-wise discrete cosine transform (DCT) and quantization—to dramatically reduce quantum resource requirements in quantum pixel information encoding (QPIE). By loading only a chosen subset of quantized (or in a variant, unquantized) DCT coefficients into quantum registers, JQPIE enables the efficient construction of quantum image states with gate counts that are reduced by a large constant factor relative to direct QPIE—while retaining image quality metrics on par with classical JPEG, or exceeding them in its quantization-free variant. The approach generalizes the method to both state-preparation-based (amplitude encoding) QPIE schemes [2602.06201] and gate-based quantum image representations such as GQIR [1701.01537].

## 1. Hybrid Classical–Quantum Workflow

The JQPIE protocol decomposes image preparation into a classical preprocessing stage and a quantum loading and decompression stage:

**A. Classical Preprocessing**
- The input image $I$ of size $H \times W$ is partitioned into $8 \times 8$ pixel blocks $B_j$.
- For each block, the 2D discrete cosine transform (DCT) is applied:
  $$
  C_j(u,v) = \alpha(u)\alpha(v)\sum_{x,y=0}^7 X_j(x,y) \cos\left(\frac{(2x+1)u\pi}{16}\right)\cos\left(\frac{(2y+1)v\pi}{16}\right)
  $$
- Standard JPEG quantization is performed:
  $$
  \hat{C}_j(u,v) = \mathrm{round}\left(\frac{C_j(u,v)}{Q(u,v)}\right)
  $$
  where $Q(u,v)$ is the standard 8×8 quantization matrix.
- A zigzag permutation (standard JPEG order) is applied to the quantized coefficients, and the first $2^r$ coefficients are retained:
  $$
  \hat{Z}_j^{(r)} = [\hat{C}_j(\pi(0)),\,\ldots,\,\hat{C}_j(\pi(2^r-1))]
  $$
  with $\pi(k)$ the zigzag mapping.

**B. Quantum Stage**
- A quantum state preparation (QSP) routine loads the truncated coefficient vectors as amplitudes, employing index and data registers for addressing blocks and coefficients.
- Quantum decompression comprises three steps:
  - Inverse zigzag permutation to restore $(u, v)$ order.
  - Coherent inverse quantization, implemented via block-encoded diagonal unitaries acting jointly on data and a single ancilla.
  - Inverse quantum DCT (QDCT), implemented as a separable unitary on each block's subspace.
- Measurement or amplitude amplification post-selects the image state in the ancilla $|0\rangle$ subspace or amplifies its probability as required. 

A variant, quantization-free JQPIE (QF-JQPIE), omits quantization and corresponding inverse operations, directly encoding and decompressing the leading DCT coefficients.

## 2. Circuit Construction and Quantum State Encoding

**Registers**
- Index register: $h+w-6$ qubits select blocks ($j=0\ldots2^{h+w-6}-1$).
- Data register: 6 qubits address DCT coefficient index $k \in \{0,\ldots,63\}$ within each block.
- Ancilla qubit (JQPIE only): mediates block-encoded quantization during inverse quantization.

**Amplitude Encoding for Truncated Coefficients**
State preparation operator $\mathcal{P}$ exactly loads the $2^{h+w-\ell}$ non-zero amplitudes:
$$
|\phi_1\rangle = \sum_j |j\rangle_{idx} \left(|0\rangle^{\otimes \ell} \otimes \frac{1}{A_j} \sum_{k=0}^{2^r-1} \hat{C}_j(\pi(k))|k\rangle_{data}\right)
$$
where $\ell = 6 - r$ and $A_j$ is a normalization constant.

- The block-encoded unitary for inverse quantization $U_Q$ applies a rescaled diagonal $\tilde{D}$ using $6$-fold uniformly controlled $R_y(\theta_k)$ rotations on the ancilla ($\theta_k=2\,\arccos d_k$, $d_k = Q_k/\lambda$ with $\lambda = \max_k Q_k$).

**QF-JQPIE: Quantization-Free Pathway**
- After DCT, apply zigzag and truncate; no quantization or ancilla required.
- The prepared state:
  $$
  |\phi_1'\rangle = \sum_j |j\rangle \otimes |0\rangle^{\ell} \otimes \frac{1}{K_j} \sum_{k=0}^{2^r-1} C_j(\pi(k)) |k\rangle
  $$
  where $K_j = \sqrt{\sum_{k<2^r}C_j(\pi(k))^2}$.

- Inverse zigzag and only an inverse quantum DCT are required for decompression.

## 3. Resource Analysis and Quantum Gate Complexity

The main quantum resource cost in JQPIE is set by the QSP stage for truncated block representations, scaling as $O(2^{h+w-\ell})$ entangling gates (CX):

| Approach         | CX gates (32×32, r=3) | Circuit depth |
|------------------|----------------------|--------------|
| Direct QPIE      | 1024                 | 1024         |
| JQPIE            | 228                  | 292          |
| QF-JQPIE         | 164                  | 163          |

- JQPIE reduces the QSP gate count to $128$ (12.5% of direct QPIE); end-to-end, the count is $\approx22\%$ of the direct baseline.
- QF-JQPIE achieves $\approx16\%$ of the baseline gate count and even lower depth due to the absence of the block-encoded quantization step.

For large images, the compression factor asymptotes to about a $10\times$ reduction in the leading-order gate count relative to full-amplitude preparation, due to JPEG's energy compaction in the DCT domain and coefficient truncation [2602.06201][1701.01537].

## 4. Image Reconstruction Fidelity and Comparative Evaluation

Image fidelity is assessed by $\Delta$PSNR and $\Delta$SSIM relative to classical JPEG after quantum decompression:

- JQPIE ($r=5$, 32 coeffs/block): 
  - $\gtrsim85\%$ of images have $\Delta$PSNR$\geq -0.5$ dB, $\Delta$SSIM$\geq -0.01$.
  - Mean values: $\Delta$PSNR$\approx-0.05$ dB, $\Delta$SSIM$\approx-0.003$.
- JQPIE ($r=4$, 16 coeffs): 
  - $\sim2\%$ of images meet $\Delta$PSNR threshold.
- QF-JQPIE ($r=5$): 
  - Nearly all images achieve $\Delta$PSNR$>0$ and mean $\Delta$SSIM$=+0.02$ (improved over JPEG due to absence of quantization noise).
- QF-JQPIE ($r=4$): 
  - $\sim25\%$ of images maintain or exceed JPEG SSIM.

Experimental evaluations on standard datasets (USC–SIPI, Kodak), show that both JQPIE and QF-JQPIE maintain high perceptual quality, with QF-JQPIE frequently outperforming classical JPEG by eliminating quantization error [2602.06201].

## 5. Gate-Level Circuits and Operator Sequences

The circuit-level requirements for JQPIE include:

- State preparation: exact amplitude encoding for the selected blockwise coefficient set.
- Block-encoded inverse quantization ($U_Q$): $64$ CX gates plus $64$ $R_y$ rotations per block, implemented via a Möttönen-style multiplexed rotation network.
- Inverse DCT: each $8\times8$ block requires $2\times18=36$ CX gates (separable over $u$ and $v$ indices).
- Total depth: sum of QSP, inverse quantization, and inverse DCT layers.
- In GQIR-based realizations [1701.01537], the leading gate term is $0.1(q/2)2^{2n}$ multi-controlled-NOTs, plus $O(q^2)$ fixed overhead.

These costs advance prior quantum compression methods, achieving dramatic reductions in both multi-qubit circuit width and entangling gate counts for images at and above $128\times128$ pixels, owing to JPEG’s empirically measured quantum compression ratio of $r_J \approx 0.0934$.

## 6. Limitations, Parameter Choices, and Extensions

**Truncation Fidelity**: Fixed per-block coefficient truncation parameter $r$ does not exploit local content variation; block misadaptation can reduce quality for high-frequency regions.

**Probabilistic Step**: JQPIE (quantized path) requires postselection or amplitude amplification on the ancilla $|0\rangle$ subspace due to block-encoded diagonal quantization.

**Scaling Properties**: Asymptotic scaling remains $O(2^{h+w-\ell})$; there is no asymptotic speedup for dense images without further sparsity exploitation.

**Potential Enhancements**:
- Adaptive blockwise $r$ based on local DCT energy distribution.
- Alternative state-preparation transforms: JPEG2000 (wavelets), PCA/SVD, or learned autoencoders.
- Integration with near-optimal sparse-state QSP algorithms to exploit further amplitude sparsity.
- Experimental realization on Noisy Intermediate-Scale Quantum (NISQ) devices, including error mitigation strategies.

A plausible implication is that future methods using adaptive or learned transforms could further reduce gate counts beyond fixed-coefficient truncation.

## 7. Historical and Comparative Context

The JQPIE scheme generalizes early proposals for quantum image preparation by introducing lossy DCT-based compression and quantum decompression, unlike direct GQIR loading or block encoding schemes without amplitude truncation. Preprocessing times for JQPIE are orders of magnitude faster than block-encoding competitors (e.g., 256×256 images: $0.16\,$s for JQPIE vs. up to $5.5$ h for baseline block-encoding), and quantum gate savings are consistently an order of magnitude or better [1701.01537]. JQPIE thus enables feasible quantum state construction for downstream quantum image processing and machine learning algorithms on non-trivial image sizes.

## Summary Table: Key JQPIE and QF-JQPIE Characteristics

| Feature                            | JQPIE                        | QF-JQPIE                    |
|-------------------------------------|------------------------------|-----------------------------|
| Quantization                       | Standard JPEG                | None                        |
| Ancilla requirement                | 1 (for block-encoding)       | None                        |
| Inverse quantization                | Block-encoded unitary        | Not required                |
| Compression factor (typical)        | $\approx$10×                 | $\approx$10×                |
| Typical $\Delta$PSNR vs. JPEG       | $\approx$0 dB                | $+0.5$ dB                   |
| Circuit structure                   | Probabilistic + amplitude amp| Fully unitary               |
| Applicability to high-frequency data| JPEG-matched                 | May underperform without higher $r$ |

JQPIE and its quantization-free variant establish the compatibility of robust classical compression (JPEG) with scalable quantum image encoding, serving as a template for future hybrid classical–quantum data-loading protocols [2602.06201][1701.01537].

Source: https://www.emergentmind.com/topics/jpeg-assisted-qpie-jqpie