Lines Matching +full:- +full:w
1 /*----------------------------------------------------------------------------/
2 / TJpgDec - Tiny JPEG Decompressor R0.03 (C)ChaN, 2021
3 /-----------------------------------------------------------------------------/
12 / personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
15 /-----------------------------------------------------------------------------/
25 /----------------------------------------------------------------------------*/
33 #define HUFF_MASK (HUFF_LEN - 1)
37 /*-----------------------------------------------*/
38 /* Zigzag-order to raster-order conversion table */
39 /*-----------------------------------------------*/
41 static const uint8_t Zig[64] = { /* Zigzag-order to raster-order conversion table */
50 /*-------------------------------------------------*/
53 /*-------------------------------------------------*/
68 /*---------------------------------------------*/
70 /*---------------------------------------------*/
95 /* -512..-257 */
104 /* -256..-1 */
128 /*-----------------------------------------------------------------------*/
130 /*-----------------------------------------------------------------------*/
142 if (jd->sz_pool >= ndata) { in alloc_pool()
143 jd->sz_pool -= ndata; in alloc_pool()
144 rp = (char*)jd->pool; /* Get start of available memory pool */ in alloc_pool()
145 jd->pool = (void*)(rp + ndata); /* Allocate requierd bytes */ in alloc_pool()
154 /*-----------------------------------------------------------------------*/
155 /* Create de-quantization and prescaling tables with a DQT segment */
156 /*-----------------------------------------------------------------------*/
171 ndata -= 65; in create_qt_tbl()
173 if (d & 0xF0) return JDR_FMT1; /* Err: not 8-bit resolution */ in create_qt_tbl()
177 jd->qttbl[i] = pb; /* Register the table */ in create_qt_tbl()
179 zi = Zig[i]; /* Zigzag-order to raster-order conversion */ in create_qt_tbl()
180 …2_t)((uint32_t)*data++ * Ipsf[zi]); /* Apply scale factor of Arai algorithm to the de-quantizers */ in create_qt_tbl()
190 /*-----------------------------------------------------------------------*/
192 /*-----------------------------------------------------------------------*/
208 ndata -= 17; in create_huffman_tbl()
214 jd->huffbits[num][cls] = pb; in create_huffman_tbl()
215 for (np = i = 0; i < 16; i++) { /* Load number of patterns for 1 to 16-bit code */ in create_huffman_tbl()
220 jd->huffcode[num][cls] = ph; in create_huffman_tbl()
222 for (j = i = 0; i < 16; i++) { /* Re-build huffman code word table */ in create_huffman_tbl()
224 while (b--) ph[j++] = hc++; in create_huffman_tbl()
229 ndata -= np; in create_huffman_tbl()
232 jd->huffdata[num][cls] = pd; in create_huffman_tbl()
247 jd->hufflut_ac[num] = tbl_ac; in create_huffman_tbl()
252 jd->hufflut_dc[num] = tbl_dc; in create_huffman_tbl()
256 for (j = pb[b]; j; j--) { in create_huffman_tbl()
257 ti = ph[i] << (HUFF_BIT - 1 - b) & HUFF_MASK; /* Index of input pattern for the code */ in create_huffman_tbl()
260 for (span = 1 << (HUFF_BIT - 1 - b); span; span--, tbl_ac[ti++] = (uint16_t)td) ; in create_huffman_tbl()
263 for (span = 1 << (HUFF_BIT - 1 - b); span; span--, tbl_dc[ti++] = (uint8_t)td) ; in create_huffman_tbl()
267 jd->longofs[num][cls] = i; /* Code table offset for long code */ in create_huffman_tbl()
278 /*-----------------------------------------------------------------------*/
280 /*-----------------------------------------------------------------------*/
288 size_t dc = jd->dctr; in huffext()
289 uint8_t *dp = jd->dptr; in huffext()
294 const uint8_t *hb = jd->huffbits[id][cls]; /* Bit distribution table */ in huffext()
295 const uint16_t *hc = jd->huffcode[id][cls]; /* Code word table */ in huffext()
296 const uint8_t *hd = jd->huffdata[id][cls]; /* Data table */ in huffext()
299 bm = jd->dbit; /* Bit mask to extract */ in huffext()
303 if (!dc) { /* No input data is available, re-fill input buffer */ in huffext()
304 dp = jd->inbuf; /* Top of input buffer */ in huffext()
305 dc = jd->infunc(jd, dp, JD_SZBUF); in huffext()
306 if (!dc) return 0 - (int)JDR_INP; /* Err: read error or wrong stream termination */ in huffext()
310 dc--; /* Decrement number of available bytes */ in huffext()
313 …if (*dp != 0) return 0 - (int)JDR_FMT1; /* Err: unexpected flag is detected (may be collapted data… in huffext()
326 for (nd = *hb++; nd; nd--) { /* Search the code word in this bit length */ in huffext()
328 jd->dbit = bm; jd->dctr = dc; jd->dptr = dp; in huffext()
333 bl--; in huffext()
339 unsigned int nc, bl, wbit = jd->dbit % 32; in huffext()
340 uint32_t w = jd->wreg & ((1UL << wbit) - 1); in huffext() local
344 if (jd->marker) { in huffext()
347 if (!dc) { /* Buffer empty, re-fill input buffer */ in huffext()
348 dp = jd->inbuf; /* Top of input buffer */ in huffext()
349 dc = jd->infunc(jd, dp, JD_SZBUF); in huffext()
350 if (!dc) return 0 - (int)JDR_INP; /* Err: read error or wrong stream termination */ in huffext()
352 d = *dp++; dc--; in huffext()
355 if (d != 0) jd->marker = d; /* Not an escape of 0xFF but a marker */ in huffext()
363 w = w << 8 | d; /* Shift 8 bits in the working register */ in huffext()
366 jd->dctr = dc; jd->dptr = dp; in huffext()
367 jd->wreg = w; in huffext()
371 d = (unsigned int)(w >> (wbit - HUFF_BIT)); /* Short code as table index */ in huffext()
373 d = jd->hufflut_ac[id][d]; /* Table decode */ in huffext()
375 jd->dbit = wbit - (d >> 8); /* Snip the code length */ in huffext()
379 d = jd->hufflut_dc[id][d]; /* Table decode */ in huffext()
381 jd->dbit = wbit - (d >> 4); /* Snip the code length */ in huffext()
387 hb = jd->huffbits[id][cls] + HUFF_BIT; /* Bit distribution table */ in huffext()
388 hc = jd->huffcode[id][cls] + jd->longofs[id][cls]; /* Code word table */ in huffext()
389 hd = jd->huffdata[id][cls] + jd->longofs[id][cls]; /* Data table */ in huffext()
393 hb = jd->huffbits[id][cls]; /* Bit distribution table */ in huffext()
394 hc = jd->huffcode[id][cls]; /* Code word table */ in huffext()
395 hd = jd->huffdata[id][cls]; /* Data table */ in huffext()
401 d = w >> (wbit - bl); in huffext()
404 jd->dbit = wbit - bl; /* Snip the huffman code */ in huffext()
408 } while (--nc); in huffext()
413 return 0 - (int)JDR_FMT1; /* Err: code not found (may be collapted data) */ in huffext()
419 /*-----------------------------------------------------------------------*/
421 /*-----------------------------------------------------------------------*/
428 size_t dc = jd->dctr; in bitext()
429 uint8_t *dp = jd->dptr; in bitext()
433 uint8_t mbit = jd->dbit; in bitext()
438 if (!dc) { /* No input data is available, re-fill input buffer */ in bitext()
439 dp = jd->inbuf; /* Top of input buffer */ in bitext()
440 dc = jd->infunc(jd, dp, JD_SZBUF); in bitext()
441 if (!dc) return 0 - (int)JDR_INP; /* Err: read error or wrong stream termination */ in bitext()
445 dc--; /* Decrement number of available bytes */ in bitext()
448 …if (*dp != 0) return 0 - (int)JDR_FMT1; /* Err: unexpected flag is detected (may be collapted data… in bitext()
460 nbit--; in bitext()
463 jd->dbit = mbit; jd->dctr = dc; jd->dptr = dp; in bitext()
467 unsigned int wbit = jd->dbit % 32; in bitext()
468 uint32_t w = jd->wreg & ((1UL << wbit) - 1); in bitext() local
472 if (jd->marker) { in bitext()
475 if (!dc) { /* Buffer empty, re-fill input buffer */ in bitext()
476 dp = jd->inbuf; /* Top of input buffer */ in bitext()
477 dc = jd->infunc(jd, dp, JD_SZBUF); in bitext()
478 if (!dc) return 0 - (int)JDR_INP; /* Err: read error or wrong stream termination */ in bitext()
480 d = *dp++; dc--; in bitext()
483 if (d != 0) jd->marker = d; /* Not an escape of 0xFF but a marker */ in bitext()
491 w = w << 8 | d; /* Get 8 bits into the working register */ in bitext()
494 jd->wreg = w; jd->dbit = wbit - nbit; in bitext()
495 jd->dctr = dc; jd->dptr = dp; in bitext()
497 return (int)(w >> ((wbit - nbit) % 32)); in bitext()
504 /*-----------------------------------------------------------------------*/
506 /*-----------------------------------------------------------------------*/
514 uint8_t *dp = jd->dptr; in restart()
515 size_t dc = jd->dctr; in restart()
522 if (!dc) { /* No input data is available, re-fill input buffer */ in restart()
523 dp = jd->inbuf; in restart()
524 dc = jd->infunc(jd, dp, JD_SZBUF); in restart()
529 dc--; in restart()
532 jd->dptr = dp; jd->dctr = dc; jd->dbit = 0; in restart()
543 if (jd->marker) { /* Generate a maker if it has been detected */ in restart()
544 marker = 0xFF00 | jd->marker; in restart()
545 jd->marker = 0; in restart()
549 if (!dc) { /* No input data is available, re-fill input buffer */ in restart()
550 dp = jd->inbuf; in restart()
551 dc = jd->infunc(jd, dp, JD_SZBUF); in restart()
555 dc--; in restart()
557 jd->dptr = dp; jd->dctr = dc; in restart()
565 jd->dbit = 0; /* Discard stuff bits */ in restart()
568 jd->dcv[2] = jd->dcv[1] = jd->dcv[0] = 0; /* Reset DC offset */ in restart()
575 /*-----------------------------------------------------------------------*/
576 /* Apply Inverse-DCT in Arai Algorithm (see also aa_idct.png) */
577 /*-----------------------------------------------------------------------*/
580 int32_t* src, /* Input block data (de-quantized and pre-scaled for Arai Algorithm) */ in block_idct()
597 t12 = v0 - v2; in block_idct()
598 t11 = (v1 - v3) * M13 >> 12; in block_idct()
600 t11 -= v3; in block_idct()
602 v3 = t10 - v3; in block_idct()
604 v2 = t12 - t11; in block_idct()
611 t10 = v5 - v4; /* Process the odd elements */ in block_idct()
613 t12 = v6 - v7; in block_idct()
615 v5 = (t11 - v7) * M13 >> 12; in block_idct()
618 v4 = t13 - (t10 * M2 >> 12); in block_idct()
619 v6 = t13 - (t12 * M4 >> 12) - v7; in block_idct()
620 v5 -= v6; in block_idct()
621 v4 -= v5; in block_idct()
623 src[8 * 0] = v0 + v7; /* Write-back transformed values */ in block_idct()
624 src[8 * 7] = v0 - v7; in block_idct()
626 src[8 * 6] = v1 - v6; in block_idct()
628 src[8 * 5] = v2 - v5; in block_idct()
630 src[8 * 4] = v3 - v4; in block_idct()
636 src -= 8; in block_idct()
638 v0 = src[0] + (128L << 8); /* Get even elements (remove DC offset (-128) here) */ in block_idct()
644 t12 = v0 - v2; in block_idct()
645 t11 = (v1 - v3) * M13 >> 12; in block_idct()
647 t11 -= v3; in block_idct()
649 v3 = t10 - v3; in block_idct()
651 v2 = t12 - t11; in block_idct()
658 t10 = v5 - v4; /* Process the odd elements */ in block_idct()
660 t12 = v6 - v7; in block_idct()
662 v5 = (t11 - v7) * M13 >> 12; in block_idct()
665 v4 = t13 - (t10 * M2 >> 12); in block_idct()
666 v6 = t13 - (t12 * M4 >> 12) - v7; in block_idct()
667 v5 -= v6; in block_idct()
668 v4 -= v5; in block_idct()
673 dst[7] = (int16_t)((v0 - v7) >> 8); in block_idct()
675 dst[6] = (int16_t)((v1 - v6) >> 8); in block_idct()
677 dst[5] = (int16_t)((v2 - v5) >> 8); in block_idct()
679 dst[4] = (int16_t)((v3 - v4) >> 8); in block_idct()
682 dst[7] = BYTECLIP((v0 - v7) >> 8); in block_idct()
684 dst[6] = BYTECLIP((v1 - v6) >> 8); in block_idct()
686 dst[5] = BYTECLIP((v2 - v5) >> 8); in block_idct()
688 dst[4] = BYTECLIP((v3 - v4) >> 8); in block_idct()
698 /*-----------------------------------------------------------------------*/
700 /*-----------------------------------------------------------------------*/
706 int32_t *tmp = (int32_t*)jd->workbuf; /* Block working buffer for de-quantize and IDCT */ in mcu_load()
713 nby = jd->msx * jd->msy; /* Number of Y blocks (1, 2 or 4) */ in mcu_load()
714 bp = jd->mcubuf; /* Pointer to the first block of MCU */ in mcu_load()
717 cmp = (blk < nby) ? 0 : blk - nby + 1; /* Component number 0:Y, 1:Cb, 2:Cr */ in mcu_load()
719 if (cmp && jd->ncomp != 3) { /* Clear C blocks if not exist (monochrome image) */ in mcu_load()
727 if (d < 0) return (JRESULT)(0 - d); /* Err: invalid code or input */ in mcu_load()
729 d = jd->dcv[cmp]; /* DC value of previous block */ in mcu_load()
732 if (e < 0) return (JRESULT)(0 - e); /* Err: input */ in mcu_load()
733 bc = 1 << (bc - 1); /* MSB position */ in mcu_load()
734 if (!(e & bc)) e -= (bc << 1) - 1; /* Restore negative value if needed */ in mcu_load()
736 jd->dcv[cmp] = (int16_t)d; /* Save current DC value for next block */ in mcu_load()
738 dqf = jd->qttbl[jd->qtid[cmp]]; /* De-quantizer table ID for this component */ in mcu_load()
739 …tmp[0] = d * dqf[0] >> 8; /* De-quantize, apply scale factor of Arai algorithm and descale 8 bi… in mcu_load()
743 z = 1; /* Top of the AC elements (in zigzag-order) */ in mcu_load()
747 if (d < 0) return (JRESULT)(0 - d); /* Err: invalid code or input error */ in mcu_load()
753 if (d < 0) return (JRESULT)(0 - d); /* Err: input device */ in mcu_load()
754 bc = 1 << (bc - 1); /* MSB position */ in mcu_load()
755 if (!(d & bc)) d -= (bc << 1) - 1; /* Restore negative value if needed */ in mcu_load()
756 i = Zig[z]; /* Get raster-order index */ in mcu_load()
757 …tmp[i] = d * dqf[i] >> 8; /* De-quantize, apply scale factor of Arai algorithm and descale 8 bits… in mcu_load()
762 …if (z == 1 || (JD_USE_SCALE && jd->scale == 3)) { /* If no AC element or scale ratio is 1/8, IDCT … in mcu_load()
784 /*-----------------------------------------------------------------------*/
786 /*-----------------------------------------------------------------------*/
795 …const int CVACC = (sizeof (int) > 2) ? 1024 : 128; /* Adaptive accuracy for both 16-/32-bit system… in mcu_output()
803 mx = jd->msx * 8; my = jd->msy * 8; /* MCU size (pixel) */ in mcu_output()
804 …rx = (img_x + mx <= jd->width) ? mx : jd->width - img_x; /* Output rectangular size (it may be cli… in mcu_output()
805 ry = (img_y + my <= jd->height) ? my : jd->height - img_y; in mcu_output()
807 rx >>= jd->scale; ry >>= jd->scale; in mcu_output()
809 img_x >>= jd->scale; img_y >>= jd->scale; in mcu_output()
811 rect.left = img_x; rect.right = img_x + rx - 1; /* Rectangular area in the frame buffer */ in mcu_output()
812 rect.top = img_y; rect.bottom = img_y + ry - 1; in mcu_output()
815 if (!JD_USE_SCALE || jd->scale != 3) { /* Not for 1/8 scaling */ in mcu_output()
816 pix = (uint8_t*)jd->workbuf; in mcu_output()
820 pc = py = jd->mcubuf; in mcu_output()
829 cb = pc[0] - 128; /* Get Cb/Cr component and remove offset */ in mcu_output()
830 cr = pc[64] - 128; in mcu_output()
832 if (ix == 8) py += 64 - 8; /* Jump to next block if double block heigt */ in mcu_output()
839 *pix++ = /*G*/ BYTECLIP(yy - ((int)(0.344 * CVACC) * cb + (int)(0.714 * CVACC) * cr) / CVACC); in mcu_output()
845 py = jd->mcubuf + iy * 8; in mcu_output()
851 if (ix == 8) py += 64 - 8; /* Jump to next block if double block height */ in mcu_output()
859 if (JD_USE_SCALE && jd->scale) { in mcu_output()
860 unsigned int x, y, r, g, b, s, w, a; in mcu_output() local
864 s = jd->scale * 2; /* Number of shifts for averaging */ in mcu_output()
865 w = 1 << jd->scale; /* Width of square */ in mcu_output()
866 a = (mx - w) * (JD_FORMAT != 2 ? 3 : 1); /* Bytes to skip for next line in the square */ in mcu_output()
867 op = (uint8_t*)jd->workbuf; in mcu_output()
868 for (iy = 0; iy < my; iy += w) { in mcu_output()
869 for (ix = 0; ix < mx; ix += w) { in mcu_output()
870 pix = (uint8_t*)jd->workbuf + (iy * mx + ix) * (JD_FORMAT != 2 ? 3 : 1); in mcu_output()
872 for (y = 0; y < w; y++) { /* Accumulate RGB value in the square */ in mcu_output()
873 for (x = 0; x < w; x++) { in mcu_output()
891 } else { /* For only 1/8 scaling (left-top pixel in each block are the DC value of the block) */ in mcu_output()
894 pix = (uint8_t*)jd->workbuf; in mcu_output()
895 pc = jd->mcubuf + mx * my; in mcu_output()
896 cb = pc[0] - 128; /* Get Cb/Cr component and restore right level */ in mcu_output()
897 cr = pc[64] - 128; in mcu_output()
899 py = jd->mcubuf; in mcu_output()
906 *pix++ = /*G*/ BYTECLIP(yy - ((int)(0.344 * CVACC) * cb + (int)(0.714 * CVACC) * cr) / CVACC); in mcu_output()
916 mx >>= jd->scale; in mcu_output()
921 s = d = (uint8_t*)jd->workbuf; in mcu_output()
930 s += (mx - rx) * (JD_FORMAT != 2 ? 3 : 1); /* Skip truncated pixels */ in mcu_output()
936 uint8_t *s = (uint8_t*)jd->workbuf; in mcu_output()
937 uint16_t w, *d = (uint16_t*)s; in mcu_output() local
941 w = (*s++ & 0xF8) << 8; /* RRRRR----------- */ in mcu_output()
942 w |= (*s++ & 0xFC) << 3; /* -----GGGGGG----- */ in mcu_output()
943 w |= *s++ >> 3; /* -----------BBBBB */ in mcu_output()
944 *d++ = w; in mcu_output()
945 } while (--n); in mcu_output()
949 return outfunc(jd, jd->workbuf, &rect) ? JDR_OK : JDR_INTR; in mcu_output()
955 /*-----------------------------------------------------------------------*/
957 /*-----------------------------------------------------------------------*/
978 jd->pool = pool; /* Work memroy */ in jd_prepare()
979 jd->sz_pool = sz_pool; /* Size of given work memory */ in jd_prepare()
980 jd->infunc = infunc; /* Stream input function */ in jd_prepare()
981 jd->device = dev; /* I/O device identifier */ in jd_prepare()
983 jd->inbuf = seg = alloc_pool(jd, JD_SZBUF); /* Allocate stream input buffer */ in jd_prepare()
988 if (jd->infunc(jd, seg, 1) != 1) return JDR_INP; /* Err: SOI was not detected */ in jd_prepare()
995 if (jd->infunc(jd, seg, 4) != 4) return JDR_INP; in jd_prepare()
999 len -= 2; /* Segent content size */ in jd_prepare()
1005 if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Load segment data */ in jd_prepare()
1007 jd->width = LDB_WORD(&seg[3]); /* Image width in unit of pixel */ in jd_prepare()
1008 jd->height = LDB_WORD(&seg[1]); /* Image height in unit of pixel */ in jd_prepare()
1009 jd->ncomp = seg[5]; /* Number of color components */ in jd_prepare()
1010 …if (jd->ncomp != 3 && jd->ncomp != 1) return JDR_FMT3; /* Err: Supports only Grayscale and Y/Cb/Cr… in jd_prepare()
1013 for (i = 0; i < jd->ncomp; i++) { in jd_prepare()
1019 jd->msx = b >> 4; jd->msy = b & 15; /* Size of MCU [blocks] */ in jd_prepare()
1023 jd->qtid[i] = seg[8 + 3 * i]; /* Get dequantizer table ID for this component */ in jd_prepare()
1024 if (jd->qtid[i] > 3) return JDR_FMT3; /* Err: Invalid ID */ in jd_prepare()
1028 case 0xDD: /* DRI - Define Restart Interval */ in jd_prepare()
1030 if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Load segment data */ in jd_prepare()
1032 jd->nrst = LDB_WORD(seg); /* Get restart interval (MCUs) */ in jd_prepare()
1035 case 0xC4: /* DHT - Define Huffman Tables */ in jd_prepare()
1037 if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Load segment data */ in jd_prepare()
1043 case 0xDB: /* DQT - Define Quaitizer Tables */ in jd_prepare()
1045 if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Load segment data */ in jd_prepare()
1047 rc = create_qt_tbl(jd, seg, len); /* Create de-quantizer tables */ in jd_prepare()
1051 case 0xDA: /* SOS - Start of Scan */ in jd_prepare()
1053 if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Load segment data */ in jd_prepare()
1055 if (!jd->width || !jd->height) return JDR_FMT1; /* Err: Invalid image size */ in jd_prepare()
1056 if (seg[0] != jd->ncomp) return JDR_FMT3; /* Err: Wrong color components */ in jd_prepare()
1059 for (i = 0; i < jd->ncomp; i++) { in jd_prepare()
1063 if (!jd->huffbits[n][0] || !jd->huffbits[n][1]) { /* Check huffman table for this component */ in jd_prepare()
1066 if (!jd->qttbl[jd->qtid[i]]) { /* Check dequantizer table for this component */ in jd_prepare()
1072 n = jd->msy * jd->msx; /* Number of Y blocks in the MCU */ in jd_prepare()
1076 …jd->workbuf = alloc_pool(jd, len); /* and it may occupy a part of following MCU working buffer f… in jd_prepare()
1077 if (!jd->workbuf) return JDR_MEM1; /* Err: not enough memory */ in jd_prepare()
1078 jd->mcubuf = alloc_pool(jd, (n + 2) * 64 * sizeof (jd_yuv_t)); /* Allocate MCU working buffer */ in jd_prepare()
1079 if (!jd->mcubuf) return JDR_MEM1; /* Err: not enough memory */ in jd_prepare()
1083 jd->dctr = jd->infunc(jd, seg + ofs, (size_t)(JD_SZBUF - ofs)); in jd_prepare()
1085 jd->dptr = seg + ofs - (JD_FASTDECODE ? 0 : 1); in jd_prepare()
1106 if (jd->infunc(jd, 0, len) != len) return JDR_INP; in jd_prepare()
1114 /*-----------------------------------------------------------------------*/
1116 /*-----------------------------------------------------------------------*/
1121 uint8_t scale /* Output de-scaling factor (0 to 3) */ in jd_decomp()
1130 jd->scale = scale; in jd_decomp()
1132 mx = jd->msx * 8; my = jd->msy * 8; /* Size of the MCU (pixel) */ in jd_decomp()
1134 jd->dcv[2] = jd->dcv[1] = jd->dcv[0] = 0; /* Initialize DC values */ in jd_decomp()
1138 for (y = 0; y < jd->height; y += my) { /* Vertical loop of MCUs */ in jd_decomp()
1139 for (x = 0; x < jd->width; x += mx) { /* Horizontal loop of MCUs */ in jd_decomp()
1140 if (jd->nrst && rst++ == jd->nrst) { /* Process restart interval if enabled */ in jd_decomp()