jcparam.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. /*
  2. * jcparam.c
  3. *
  4. * This file was part of the Independent JPEG Group's software:
  5. * Copyright (C) 1991-1998, Thomas G. Lane.
  6. * Modified 2003-2008 by Guido Vollbeding.
  7. * libjpeg-turbo Modifications:
  8. * Copyright (C) 2009-2011, 2018, D. R. Commander.
  9. * For conditions of distribution and use, see the accompanying README.ijg
  10. * file.
  11. *
  12. * This file contains optional default-setting code for the JPEG compressor.
  13. * Applications do not have to use this file, but those that don't use it
  14. * must know a lot more about the innards of the JPEG code.
  15. */
  16. #define JPEG_INTERNALS
  17. #include "jinclude.h"
  18. #include "jpeglib.h"
  19. #include "jstdhuff.c"
  20. /*
  21. * Quantization table setup routines
  22. */
  23. GLOBAL(void)
  24. jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl,
  25. const unsigned int *basic_table, int scale_factor,
  26. boolean force_baseline)
  27. /* Define a quantization table equal to the basic_table times
  28. * a scale factor (given as a percentage).
  29. * If force_baseline is TRUE, the computed quantization table entries
  30. * are limited to 1..255 for JPEG baseline compatibility.
  31. */
  32. {
  33. JQUANT_TBL **qtblptr;
  34. int i;
  35. long temp;
  36. /* Safety check to ensure start_compress not called yet. */
  37. if (cinfo->global_state != CSTATE_START)
  38. ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  39. if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS)
  40. ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl);
  41. qtblptr = &cinfo->quant_tbl_ptrs[which_tbl];
  42. if (*qtblptr == NULL)
  43. *qtblptr = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  44. for (i = 0; i < DCTSIZE2; i++) {
  45. temp = ((long)basic_table[i] * scale_factor + 50L) / 100L;
  46. /* limit the values to the valid range */
  47. if (temp <= 0L) temp = 1L;
  48. if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
  49. if (force_baseline && temp > 255L)
  50. temp = 255L; /* limit to baseline range if requested */
  51. (*qtblptr)->quantval[i] = (UINT16)temp;
  52. }
  53. /* Initialize sent_table FALSE so table will be written to JPEG file. */
  54. (*qtblptr)->sent_table = FALSE;
  55. }
  56. /* These are the sample quantization tables given in Annex K (Clause K.1) of
  57. * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
  58. * The spec says that the values given produce "good" quality, and
  59. * when divided by 2, "very good" quality.
  60. */
  61. static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = {
  62. 16, 11, 10, 16, 24, 40, 51, 61,
  63. 12, 12, 14, 19, 26, 58, 60, 55,
  64. 14, 13, 16, 24, 40, 57, 69, 56,
  65. 14, 17, 22, 29, 51, 87, 80, 62,
  66. 18, 22, 37, 56, 68, 109, 103, 77,
  67. 24, 35, 55, 64, 81, 104, 113, 92,
  68. 49, 64, 78, 87, 103, 121, 120, 101,
  69. 72, 92, 95, 98, 112, 100, 103, 99
  70. };
  71. static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = {
  72. 17, 18, 24, 47, 99, 99, 99, 99,
  73. 18, 21, 26, 66, 99, 99, 99, 99,
  74. 24, 26, 56, 99, 99, 99, 99, 99,
  75. 47, 66, 99, 99, 99, 99, 99, 99,
  76. 99, 99, 99, 99, 99, 99, 99, 99,
  77. 99, 99, 99, 99, 99, 99, 99, 99,
  78. 99, 99, 99, 99, 99, 99, 99, 99,
  79. 99, 99, 99, 99, 99, 99, 99, 99
  80. };
  81. #if JPEG_LIB_VERSION >= 70
  82. GLOBAL(void)
  83. jpeg_default_qtables(j_compress_ptr cinfo, boolean force_baseline)
  84. /* Set or change the 'quality' (quantization) setting, using default tables
  85. * and straight percentage-scaling quality scales.
  86. * This entry point allows different scalings for luminance and chrominance.
  87. */
  88. {
  89. /* Set up two quantization tables using the specified scaling */
  90. jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
  91. cinfo->q_scale_factor[0], force_baseline);
  92. jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
  93. cinfo->q_scale_factor[1], force_baseline);
  94. }
  95. #endif
  96. GLOBAL(void)
  97. jpeg_set_linear_quality(j_compress_ptr cinfo, int scale_factor,
  98. boolean force_baseline)
  99. /* Set or change the 'quality' (quantization) setting, using default tables
  100. * and a straight percentage-scaling quality scale. In most cases it's better
  101. * to use jpeg_set_quality (below); this entry point is provided for
  102. * applications that insist on a linear percentage scaling.
  103. */
  104. {
  105. /* Set up two quantization tables using the specified scaling */
  106. jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
  107. scale_factor, force_baseline);
  108. jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
  109. scale_factor, force_baseline);
  110. }
  111. GLOBAL(int)
  112. jpeg_quality_scaling(int quality)
  113. /* Convert a user-specified quality rating to a percentage scaling factor
  114. * for an underlying quantization table, using our recommended scaling curve.
  115. * The input 'quality' factor should be 0 (terrible) to 100 (very good).
  116. */
  117. {
  118. /* Safety limit on quality factor. Convert 0 to 1 to avoid zero divide. */
  119. if (quality <= 0) quality = 1;
  120. if (quality > 100) quality = 100;
  121. /* The basic table is used as-is (scaling 100) for a quality of 50.
  122. * Qualities 50..100 are converted to scaling percentage 200 - 2*Q;
  123. * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table
  124. * to make all the table entries 1 (hence, minimum quantization loss).
  125. * Qualities 1..50 are converted to scaling percentage 5000/Q.
  126. */
  127. if (quality < 50)
  128. quality = 5000 / quality;
  129. else
  130. quality = 200 - quality * 2;
  131. return quality;
  132. }
  133. GLOBAL(void)
  134. jpeg_set_quality(j_compress_ptr cinfo, int quality, boolean force_baseline)
  135. /* Set or change the 'quality' (quantization) setting, using default tables.
  136. * This is the standard quality-adjusting entry point for typical user
  137. * interfaces; only those who want detailed control over quantization tables
  138. * would use the preceding three routines directly.
  139. */
  140. {
  141. /* Convert user 0-100 rating to percentage scaling */
  142. quality = jpeg_quality_scaling(quality);
  143. /* Set up standard quality tables */
  144. jpeg_set_linear_quality(cinfo, quality, force_baseline);
  145. }
  146. /*
  147. * Default parameter setup for compression.
  148. *
  149. * Applications that don't choose to use this routine must do their
  150. * own setup of all these parameters. Alternately, you can call this
  151. * to establish defaults and then alter parameters selectively. This
  152. * is the recommended approach since, if we add any new parameters,
  153. * your code will still work (they'll be set to reasonable defaults).
  154. */
  155. GLOBAL(void)
  156. jpeg_set_defaults(j_compress_ptr cinfo)
  157. {
  158. int i;
  159. /* Safety check to ensure start_compress not called yet. */
  160. if (cinfo->global_state != CSTATE_START)
  161. ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  162. /* Allocate comp_info array large enough for maximum component count.
  163. * Array is made permanent in case application wants to compress
  164. * multiple images at same param settings.
  165. */
  166. if (cinfo->comp_info == NULL)
  167. cinfo->comp_info = (jpeg_component_info *)
  168. (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  169. MAX_COMPONENTS * sizeof(jpeg_component_info));
  170. /* Initialize everything not dependent on the color space */
  171. #if JPEG_LIB_VERSION >= 70
  172. cinfo->scale_num = 1; /* 1:1 scaling */
  173. cinfo->scale_denom = 1;
  174. #endif
  175. cinfo->data_precision = BITS_IN_JSAMPLE;
  176. /* Set up two quantization tables using default quality of 75 */
  177. jpeg_set_quality(cinfo, 75, TRUE);
  178. /* Set up two Huffman tables */
  179. std_huff_tables((j_common_ptr)cinfo);
  180. /* Initialize default arithmetic coding conditioning */
  181. for (i = 0; i < NUM_ARITH_TBLS; i++) {
  182. cinfo->arith_dc_L[i] = 0;
  183. cinfo->arith_dc_U[i] = 1;
  184. cinfo->arith_ac_K[i] = 5;
  185. }
  186. /* Default is no multiple-scan output */
  187. cinfo->scan_info = NULL;
  188. cinfo->num_scans = 0;
  189. /* Expect normal source image, not raw downsampled data */
  190. cinfo->raw_data_in = FALSE;
  191. /* Use Huffman coding, not arithmetic coding, by default */
  192. cinfo->arith_code = FALSE;
  193. /* By default, don't do extra passes to optimize entropy coding */
  194. cinfo->optimize_coding = FALSE;
  195. /* The standard Huffman tables are only valid for 8-bit data precision.
  196. * If the precision is higher, force optimization on so that usable
  197. * tables will be computed. This test can be removed if default tables
  198. * are supplied that are valid for the desired precision.
  199. */
  200. if (cinfo->data_precision > 8)
  201. cinfo->optimize_coding = TRUE;
  202. /* By default, use the simpler non-cosited sampling alignment */
  203. cinfo->CCIR601_sampling = FALSE;
  204. #if JPEG_LIB_VERSION >= 70
  205. /* By default, apply fancy downsampling */
  206. cinfo->do_fancy_downsampling = TRUE;
  207. #endif
  208. /* No input smoothing */
  209. cinfo->smoothing_factor = 0;
  210. /* DCT algorithm preference */
  211. cinfo->dct_method = JDCT_DEFAULT;
  212. /* No restart markers */
  213. cinfo->restart_interval = 0;
  214. cinfo->restart_in_rows = 0;
  215. /* Fill in default JFIF marker parameters. Note that whether the marker
  216. * will actually be written is determined by jpeg_set_colorspace.
  217. *
  218. * By default, the library emits JFIF version code 1.01.
  219. * An application that wants to emit JFIF 1.02 extension markers should set
  220. * JFIF_minor_version to 2. We could probably get away with just defaulting
  221. * to 1.02, but there may still be some decoders in use that will complain
  222. * about that; saying 1.01 should minimize compatibility problems.
  223. */
  224. cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */
  225. cinfo->JFIF_minor_version = 1;
  226. cinfo->density_unit = 0; /* Pixel size is unknown by default */
  227. cinfo->X_density = 1; /* Pixel aspect ratio is square by default */
  228. cinfo->Y_density = 1;
  229. /* Choose JPEG colorspace based on input space, set defaults accordingly */
  230. jpeg_default_colorspace(cinfo);
  231. }
  232. /*
  233. * Select an appropriate JPEG colorspace for in_color_space.
  234. */
  235. GLOBAL(void)
  236. jpeg_default_colorspace(j_compress_ptr cinfo)
  237. {
  238. switch (cinfo->in_color_space) {
  239. case JCS_GRAYSCALE:
  240. jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
  241. break;
  242. case JCS_RGB:
  243. case JCS_EXT_RGB:
  244. case JCS_EXT_RGBX:
  245. case JCS_EXT_BGR:
  246. case JCS_EXT_BGRX:
  247. case JCS_EXT_XBGR:
  248. case JCS_EXT_XRGB:
  249. case JCS_EXT_RGBA:
  250. case JCS_EXT_BGRA:
  251. case JCS_EXT_ABGR:
  252. case JCS_EXT_ARGB:
  253. jpeg_set_colorspace(cinfo, JCS_YCbCr);
  254. break;
  255. case JCS_YCbCr:
  256. jpeg_set_colorspace(cinfo, JCS_YCbCr);
  257. break;
  258. case JCS_CMYK:
  259. jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */
  260. break;
  261. case JCS_YCCK:
  262. jpeg_set_colorspace(cinfo, JCS_YCCK);
  263. break;
  264. case JCS_UNKNOWN:
  265. jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
  266. break;
  267. default:
  268. ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  269. }
  270. }
  271. /*
  272. * Set the JPEG colorspace, and choose colorspace-dependent default values.
  273. */
  274. GLOBAL(void)
  275. jpeg_set_colorspace(j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
  276. {
  277. jpeg_component_info *compptr;
  278. int ci;
  279. #define SET_COMP(index, id, hsamp, vsamp, quant, dctbl, actbl) \
  280. (compptr = &cinfo->comp_info[index], \
  281. compptr->component_id = (id), \
  282. compptr->h_samp_factor = (hsamp), \
  283. compptr->v_samp_factor = (vsamp), \
  284. compptr->quant_tbl_no = (quant), \
  285. compptr->dc_tbl_no = (dctbl), \
  286. compptr->ac_tbl_no = (actbl) )
  287. /* Safety check to ensure start_compress not called yet. */
  288. if (cinfo->global_state != CSTATE_START)
  289. ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  290. /* For all colorspaces, we use Q and Huff tables 0 for luminance components,
  291. * tables 1 for chrominance components.
  292. */
  293. cinfo->jpeg_color_space = colorspace;
  294. cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */
  295. cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */
  296. switch (colorspace) {
  297. case JCS_GRAYSCALE:
  298. cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
  299. cinfo->num_components = 1;
  300. /* JFIF specifies component ID 1 */
  301. SET_COMP(0, 1, 1, 1, 0, 0, 0);
  302. break;
  303. case JCS_RGB:
  304. cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
  305. cinfo->num_components = 3;
  306. SET_COMP(0, 0x52 /* 'R' */, 1, 1, 0, 0, 0);
  307. SET_COMP(1, 0x47 /* 'G' */, 1, 1, 0, 0, 0);
  308. SET_COMP(2, 0x42 /* 'B' */, 1, 1, 0, 0, 0);
  309. break;
  310. case JCS_YCbCr:
  311. cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
  312. cinfo->num_components = 3;
  313. /* JFIF specifies component IDs 1,2,3 */
  314. /* We default to 2x2 subsamples of chrominance */
  315. SET_COMP(0, 1, 2, 2, 0, 0, 0);
  316. SET_COMP(1, 2, 1, 1, 1, 1, 1);
  317. SET_COMP(2, 3, 1, 1, 1, 1, 1);
  318. break;
  319. case JCS_CMYK:
  320. cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
  321. cinfo->num_components = 4;
  322. SET_COMP(0, 0x43 /* 'C' */, 1, 1, 0, 0, 0);
  323. SET_COMP(1, 0x4D /* 'M' */, 1, 1, 0, 0, 0);
  324. SET_COMP(2, 0x59 /* 'Y' */, 1, 1, 0, 0, 0);
  325. SET_COMP(3, 0x4B /* 'K' */, 1, 1, 0, 0, 0);
  326. break;
  327. case JCS_YCCK:
  328. cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
  329. cinfo->num_components = 4;
  330. SET_COMP(0, 1, 2, 2, 0, 0, 0);
  331. SET_COMP(1, 2, 1, 1, 1, 1, 1);
  332. SET_COMP(2, 3, 1, 1, 1, 1, 1);
  333. SET_COMP(3, 4, 2, 2, 0, 0, 0);
  334. break;
  335. case JCS_UNKNOWN:
  336. cinfo->num_components = cinfo->input_components;
  337. if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)
  338. ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  339. MAX_COMPONENTS);
  340. for (ci = 0; ci < cinfo->num_components; ci++) {
  341. SET_COMP(ci, ci, 1, 1, 0, 0, 0);
  342. }
  343. break;
  344. default:
  345. ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  346. }
  347. }
  348. #ifdef C_PROGRESSIVE_SUPPORTED
  349. LOCAL(jpeg_scan_info *)
  350. fill_a_scan(jpeg_scan_info *scanptr, int ci, int Ss, int Se, int Ah, int Al)
  351. /* Support routine: generate one scan for specified component */
  352. {
  353. scanptr->comps_in_scan = 1;
  354. scanptr->component_index[0] = ci;
  355. scanptr->Ss = Ss;
  356. scanptr->Se = Se;
  357. scanptr->Ah = Ah;
  358. scanptr->Al = Al;
  359. scanptr++;
  360. return scanptr;
  361. }
  362. LOCAL(jpeg_scan_info *)
  363. fill_scans(jpeg_scan_info *scanptr, int ncomps, int Ss, int Se, int Ah, int Al)
  364. /* Support routine: generate one scan for each component */
  365. {
  366. int ci;
  367. for (ci = 0; ci < ncomps; ci++) {
  368. scanptr->comps_in_scan = 1;
  369. scanptr->component_index[0] = ci;
  370. scanptr->Ss = Ss;
  371. scanptr->Se = Se;
  372. scanptr->Ah = Ah;
  373. scanptr->Al = Al;
  374. scanptr++;
  375. }
  376. return scanptr;
  377. }
  378. LOCAL(jpeg_scan_info *)
  379. fill_dc_scans(jpeg_scan_info *scanptr, int ncomps, int Ah, int Al)
  380. /* Support routine: generate interleaved DC scan if possible, else N scans */
  381. {
  382. int ci;
  383. if (ncomps <= MAX_COMPS_IN_SCAN) {
  384. /* Single interleaved DC scan */
  385. scanptr->comps_in_scan = ncomps;
  386. for (ci = 0; ci < ncomps; ci++)
  387. scanptr->component_index[ci] = ci;
  388. scanptr->Ss = scanptr->Se = 0;
  389. scanptr->Ah = Ah;
  390. scanptr->Al = Al;
  391. scanptr++;
  392. } else {
  393. /* Noninterleaved DC scan for each component */
  394. scanptr = fill_scans(scanptr, ncomps, 0, 0, Ah, Al);
  395. }
  396. return scanptr;
  397. }
  398. /*
  399. * Create a recommended progressive-JPEG script.
  400. * cinfo->num_components and cinfo->jpeg_color_space must be correct.
  401. */
  402. GLOBAL(void)
  403. jpeg_simple_progression(j_compress_ptr cinfo)
  404. {
  405. int ncomps = cinfo->num_components;
  406. int nscans;
  407. jpeg_scan_info *scanptr;
  408. /* Safety check to ensure start_compress not called yet. */
  409. if (cinfo->global_state != CSTATE_START)
  410. ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  411. /* Figure space needed for script. Calculation must match code below! */
  412. if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
  413. /* Custom script for YCbCr color images. */
  414. nscans = 10;
  415. } else {
  416. /* All-purpose script for other color spaces. */
  417. if (ncomps > MAX_COMPS_IN_SCAN)
  418. nscans = 6 * ncomps; /* 2 DC + 4 AC scans per component */
  419. else
  420. nscans = 2 + 4 * ncomps; /* 2 DC scans; 4 AC scans per component */
  421. }
  422. /* Allocate space for script.
  423. * We need to put it in the permanent pool in case the application performs
  424. * multiple compressions without changing the settings. To avoid a memory
  425. * leak if jpeg_simple_progression is called repeatedly for the same JPEG
  426. * object, we try to re-use previously allocated space, and we allocate
  427. * enough space to handle YCbCr even if initially asked for grayscale.
  428. */
  429. if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) {
  430. cinfo->script_space_size = MAX(nscans, 10);
  431. cinfo->script_space = (jpeg_scan_info *)
  432. (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  433. cinfo->script_space_size * sizeof(jpeg_scan_info));
  434. }
  435. scanptr = cinfo->script_space;
  436. cinfo->scan_info = scanptr;
  437. cinfo->num_scans = nscans;
  438. if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
  439. /* Custom script for YCbCr color images. */
  440. /* Initial DC scan */
  441. scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
  442. /* Initial AC scan: get some luma data out in a hurry */
  443. scanptr = fill_a_scan(scanptr, 0, 1, 5, 0, 2);
  444. /* Chroma data is too small to be worth expending many scans on */
  445. scanptr = fill_a_scan(scanptr, 2, 1, 63, 0, 1);
  446. scanptr = fill_a_scan(scanptr, 1, 1, 63, 0, 1);
  447. /* Complete spectral selection for luma AC */
  448. scanptr = fill_a_scan(scanptr, 0, 6, 63, 0, 2);
  449. /* Refine next bit of luma AC */
  450. scanptr = fill_a_scan(scanptr, 0, 1, 63, 2, 1);
  451. /* Finish DC successive approximation */
  452. scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
  453. /* Finish AC successive approximation */
  454. scanptr = fill_a_scan(scanptr, 2, 1, 63, 1, 0);
  455. scanptr = fill_a_scan(scanptr, 1, 1, 63, 1, 0);
  456. /* Luma bottom bit comes last since it's usually largest scan */
  457. scanptr = fill_a_scan(scanptr, 0, 1, 63, 1, 0);
  458. } else {
  459. /* All-purpose script for other color spaces. */
  460. /* Successive approximation first pass */
  461. scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
  462. scanptr = fill_scans(scanptr, ncomps, 1, 5, 0, 2);
  463. scanptr = fill_scans(scanptr, ncomps, 6, 63, 0, 2);
  464. /* Successive approximation second pass */
  465. scanptr = fill_scans(scanptr, ncomps, 1, 63, 2, 1);
  466. /* Successive approximation final pass */
  467. scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
  468. scanptr = fill_scans(scanptr, ncomps, 1, 63, 1, 0);
  469. }
  470. }
  471. #endif /* C_PROGRESSIVE_SUPPORTED */