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, D. R. Commander.
  9. * For conditions of distribution and use, see the accompanying README file.
  10. *
  11. * This file contains optional default-setting code for the JPEG compressor.
  12. * Applications do not have to use this file, but those that don't use it
  13. * must know a lot more about the innards of the JPEG code.
  14. */
  15. #define JPEG_INTERNALS
  16. #include "jinclude.h"
  17. #include "jpeglib.h"
  18. #include "jstdhuff.c"
  19. /*
  20. * Quantization table setup routines
  21. */
  22. GLOBAL(void)
  23. jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
  24. const unsigned int *basic_table,
  25. int scale_factor, boolean force_baseline)
  26. /* Define a quantization table equal to the basic_table times
  27. * a scale factor (given as a percentage).
  28. * If force_baseline is TRUE, the computed quantization table entries
  29. * are limited to 1..255 for JPEG baseline compatibility.
  30. */
  31. {
  32. JQUANT_TBL ** qtblptr;
  33. int i;
  34. long temp;
  35. /* Safety check to ensure start_compress not called yet. */
  36. if (cinfo->global_state != CSTATE_START)
  37. ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  38. if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS)
  39. ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl);
  40. qtblptr = & cinfo->quant_tbl_ptrs[which_tbl];
  41. if (*qtblptr == NULL)
  42. *qtblptr = jpeg_alloc_quant_table((j_common_ptr) cinfo);
  43. for (i = 0; i < DCTSIZE2; i++) {
  44. temp = ((long) basic_table[i] * scale_factor + 50L) / 100L;
  45. /* limit the values to the valid range */
  46. if (temp <= 0L) temp = 1L;
  47. if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
  48. if (force_baseline && temp > 255L)
  49. temp = 255L; /* limit to baseline range if requested */
  50. (*qtblptr)->quantval[i] = (UINT16) temp;
  51. }
  52. /* Initialize sent_table FALSE so table will be written to JPEG file. */
  53. (*qtblptr)->sent_table = FALSE;
  54. }
  55. /* These are the sample quantization tables given in JPEG spec section K.1.
  56. * The spec says that the values given produce "good" quality, and
  57. * when divided by 2, "very good" quality.
  58. */
  59. static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = {
  60. 16, 11, 10, 16, 24, 40, 51, 61,
  61. 12, 12, 14, 19, 26, 58, 60, 55,
  62. 14, 13, 16, 24, 40, 57, 69, 56,
  63. 14, 17, 22, 29, 51, 87, 80, 62,
  64. 18, 22, 37, 56, 68, 109, 103, 77,
  65. 24, 35, 55, 64, 81, 104, 113, 92,
  66. 49, 64, 78, 87, 103, 121, 120, 101,
  67. 72, 92, 95, 98, 112, 100, 103, 99
  68. };
  69. static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = {
  70. 17, 18, 24, 47, 99, 99, 99, 99,
  71. 18, 21, 26, 66, 99, 99, 99, 99,
  72. 24, 26, 56, 99, 99, 99, 99, 99,
  73. 47, 66, 99, 99, 99, 99, 99, 99,
  74. 99, 99, 99, 99, 99, 99, 99, 99,
  75. 99, 99, 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. };
  79. #if JPEG_LIB_VERSION >= 70
  80. GLOBAL(void)
  81. jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline)
  82. /* Set or change the 'quality' (quantization) setting, using default tables
  83. * and straight percentage-scaling quality scales.
  84. * This entry point allows different scalings for luminance and chrominance.
  85. */
  86. {
  87. /* Set up two quantization tables using the specified scaling */
  88. jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
  89. cinfo->q_scale_factor[0], force_baseline);
  90. jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
  91. cinfo->q_scale_factor[1], force_baseline);
  92. }
  93. #endif
  94. GLOBAL(void)
  95. jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
  96. boolean force_baseline)
  97. /* Set or change the 'quality' (quantization) setting, using default tables
  98. * and a straight percentage-scaling quality scale. In most cases it's better
  99. * to use jpeg_set_quality (below); this entry point is provided for
  100. * applications that insist on a linear percentage scaling.
  101. */
  102. {
  103. /* Set up two quantization tables using the specified scaling */
  104. jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
  105. scale_factor, force_baseline);
  106. jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
  107. scale_factor, force_baseline);
  108. }
  109. GLOBAL(int)
  110. jpeg_quality_scaling (int quality)
  111. /* Convert a user-specified quality rating to a percentage scaling factor
  112. * for an underlying quantization table, using our recommended scaling curve.
  113. * The input 'quality' factor should be 0 (terrible) to 100 (very good).
  114. */
  115. {
  116. /* Safety limit on quality factor. Convert 0 to 1 to avoid zero divide. */
  117. if (quality <= 0) quality = 1;
  118. if (quality > 100) quality = 100;
  119. /* The basic table is used as-is (scaling 100) for a quality of 50.
  120. * Qualities 50..100 are converted to scaling percentage 200 - 2*Q;
  121. * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table
  122. * to make all the table entries 1 (hence, minimum quantization loss).
  123. * Qualities 1..50 are converted to scaling percentage 5000/Q.
  124. */
  125. if (quality < 50)
  126. quality = 5000 / quality;
  127. else
  128. quality = 200 - quality*2;
  129. return quality;
  130. }
  131. GLOBAL(void)
  132. jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
  133. /* Set or change the 'quality' (quantization) setting, using default tables.
  134. * This is the standard quality-adjusting entry point for typical user
  135. * interfaces; only those who want detailed control over quantization tables
  136. * would use the preceding three routines directly.
  137. */
  138. {
  139. /* Convert user 0-100 rating to percentage scaling */
  140. quality = jpeg_quality_scaling(quality);
  141. /* Set up standard quality tables */
  142. jpeg_set_linear_quality(cinfo, quality, force_baseline);
  143. }
  144. /*
  145. * Default parameter setup for compression.
  146. *
  147. * Applications that don't choose to use this routine must do their
  148. * own setup of all these parameters. Alternately, you can call this
  149. * to establish defaults and then alter parameters selectively. This
  150. * is the recommended approach since, if we add any new parameters,
  151. * your code will still work (they'll be set to reasonable defaults).
  152. */
  153. GLOBAL(void)
  154. jpeg_set_defaults (j_compress_ptr cinfo)
  155. {
  156. int i;
  157. /* Safety check to ensure start_compress not called yet. */
  158. if (cinfo->global_state != CSTATE_START)
  159. ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  160. /* Allocate comp_info array large enough for maximum component count.
  161. * Array is made permanent in case application wants to compress
  162. * multiple images at same param settings.
  163. */
  164. if (cinfo->comp_info == NULL)
  165. cinfo->comp_info = (jpeg_component_info *)
  166. (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
  167. MAX_COMPONENTS * sizeof(jpeg_component_info));
  168. /* Initialize everything not dependent on the color space */
  169. #if JPEG_LIB_VERSION >= 70
  170. cinfo->scale_num = 1; /* 1:1 scaling */
  171. cinfo->scale_denom = 1;
  172. #endif
  173. cinfo->data_precision = BITS_IN_JSAMPLE;
  174. /* Set up two quantization tables using default quality of 75 */
  175. jpeg_set_quality(cinfo, 75, TRUE);
  176. /* Set up two Huffman tables */
  177. std_huff_tables((j_common_ptr) cinfo);
  178. /* Initialize default arithmetic coding conditioning */
  179. for (i = 0; i < NUM_ARITH_TBLS; i++) {
  180. cinfo->arith_dc_L[i] = 0;
  181. cinfo->arith_dc_U[i] = 1;
  182. cinfo->arith_ac_K[i] = 5;
  183. }
  184. /* Default is no multiple-scan output */
  185. cinfo->scan_info = NULL;
  186. cinfo->num_scans = 0;
  187. /* Expect normal source image, not raw downsampled data */
  188. cinfo->raw_data_in = FALSE;
  189. /* Use Huffman coding, not arithmetic coding, by default */
  190. cinfo->arith_code = FALSE;
  191. /* By default, don't do extra passes to optimize entropy coding */
  192. cinfo->optimize_coding = FALSE;
  193. /* The standard Huffman tables are only valid for 8-bit data precision.
  194. * If the precision is higher, force optimization on so that usable
  195. * tables will be computed. This test can be removed if default tables
  196. * are supplied that are valid for the desired precision.
  197. */
  198. if (cinfo->data_precision > 8)
  199. cinfo->optimize_coding = TRUE;
  200. /* By default, use the simpler non-cosited sampling alignment */
  201. cinfo->CCIR601_sampling = FALSE;
  202. #if JPEG_LIB_VERSION >= 70
  203. /* By default, apply fancy downsampling */
  204. cinfo->do_fancy_downsampling = TRUE;
  205. #endif
  206. /* No input smoothing */
  207. cinfo->smoothing_factor = 0;
  208. /* DCT algorithm preference */
  209. cinfo->dct_method = JDCT_DEFAULT;
  210. /* No restart markers */
  211. cinfo->restart_interval = 0;
  212. cinfo->restart_in_rows = 0;
  213. /* Fill in default JFIF marker parameters. Note that whether the marker
  214. * will actually be written is determined by jpeg_set_colorspace.
  215. *
  216. * By default, the library emits JFIF version code 1.01.
  217. * An application that wants to emit JFIF 1.02 extension markers should set
  218. * JFIF_minor_version to 2. We could probably get away with just defaulting
  219. * to 1.02, but there may still be some decoders in use that will complain
  220. * about that; saying 1.01 should minimize compatibility problems.
  221. */
  222. cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */
  223. cinfo->JFIF_minor_version = 1;
  224. cinfo->density_unit = 0; /* Pixel size is unknown by default */
  225. cinfo->X_density = 1; /* Pixel aspect ratio is square by default */
  226. cinfo->Y_density = 1;
  227. /* Choose JPEG colorspace based on input space, set defaults accordingly */
  228. jpeg_default_colorspace(cinfo);
  229. }
  230. /*
  231. * Select an appropriate JPEG colorspace for in_color_space.
  232. */
  233. GLOBAL(void)
  234. jpeg_default_colorspace (j_compress_ptr cinfo)
  235. {
  236. switch (cinfo->in_color_space) {
  237. case JCS_GRAYSCALE:
  238. jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
  239. break;
  240. case JCS_RGB:
  241. case JCS_EXT_RGB:
  242. case JCS_EXT_RGBX:
  243. case JCS_EXT_BGR:
  244. case JCS_EXT_BGRX:
  245. case JCS_EXT_XBGR:
  246. case JCS_EXT_XRGB:
  247. case JCS_EXT_RGBA:
  248. case JCS_EXT_BGRA:
  249. case JCS_EXT_ABGR:
  250. case JCS_EXT_ARGB:
  251. jpeg_set_colorspace(cinfo, JCS_YCbCr);
  252. break;
  253. case JCS_YCbCr:
  254. jpeg_set_colorspace(cinfo, JCS_YCbCr);
  255. break;
  256. case JCS_CMYK:
  257. jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */
  258. break;
  259. case JCS_YCCK:
  260. jpeg_set_colorspace(cinfo, JCS_YCCK);
  261. break;
  262. case JCS_UNKNOWN:
  263. jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
  264. break;
  265. default:
  266. ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  267. }
  268. }
  269. /*
  270. * Set the JPEG colorspace, and choose colorspace-dependent default values.
  271. */
  272. GLOBAL(void)
  273. jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
  274. {
  275. jpeg_component_info * compptr;
  276. int ci;
  277. #define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl) \
  278. (compptr = &cinfo->comp_info[index], \
  279. compptr->component_id = (id), \
  280. compptr->h_samp_factor = (hsamp), \
  281. compptr->v_samp_factor = (vsamp), \
  282. compptr->quant_tbl_no = (quant), \
  283. compptr->dc_tbl_no = (dctbl), \
  284. compptr->ac_tbl_no = (actbl) )
  285. /* Safety check to ensure start_compress not called yet. */
  286. if (cinfo->global_state != CSTATE_START)
  287. ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  288. /* For all colorspaces, we use Q and Huff tables 0 for luminance components,
  289. * tables 1 for chrominance components.
  290. */
  291. cinfo->jpeg_color_space = colorspace;
  292. cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */
  293. cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */
  294. switch (colorspace) {
  295. case JCS_GRAYSCALE:
  296. cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
  297. cinfo->num_components = 1;
  298. /* JFIF specifies component ID 1 */
  299. SET_COMP(0, 1, 1,1, 0, 0,0);
  300. break;
  301. case JCS_RGB:
  302. cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
  303. cinfo->num_components = 3;
  304. SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0);
  305. SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0);
  306. SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0);
  307. break;
  308. case JCS_YCbCr:
  309. cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
  310. cinfo->num_components = 3;
  311. /* JFIF specifies component IDs 1,2,3 */
  312. /* We default to 2x2 subsamples of chrominance */
  313. SET_COMP(0, 1, 2,2, 0, 0,0);
  314. SET_COMP(1, 2, 1,1, 1, 1,1);
  315. SET_COMP(2, 3, 1,1, 1, 1,1);
  316. break;
  317. case JCS_CMYK:
  318. cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
  319. cinfo->num_components = 4;
  320. SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0);
  321. SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0);
  322. SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0);
  323. SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0);
  324. break;
  325. case JCS_YCCK:
  326. cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
  327. cinfo->num_components = 4;
  328. SET_COMP(0, 1, 2,2, 0, 0,0);
  329. SET_COMP(1, 2, 1,1, 1, 1,1);
  330. SET_COMP(2, 3, 1,1, 1, 1,1);
  331. SET_COMP(3, 4, 2,2, 0, 0,0);
  332. break;
  333. case JCS_UNKNOWN:
  334. cinfo->num_components = cinfo->input_components;
  335. if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)
  336. ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  337. MAX_COMPONENTS);
  338. for (ci = 0; ci < cinfo->num_components; ci++) {
  339. SET_COMP(ci, ci, 1,1, 0, 0,0);
  340. }
  341. break;
  342. default:
  343. ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  344. }
  345. }
  346. #ifdef C_PROGRESSIVE_SUPPORTED
  347. LOCAL(jpeg_scan_info *)
  348. fill_a_scan (jpeg_scan_info * scanptr, int ci,
  349. int Ss, int Se, int Ah, int Al)
  350. /* Support routine: generate one scan for specified component */
  351. {
  352. scanptr->comps_in_scan = 1;
  353. scanptr->component_index[0] = ci;
  354. scanptr->Ss = Ss;
  355. scanptr->Se = Se;
  356. scanptr->Ah = Ah;
  357. scanptr->Al = Al;
  358. scanptr++;
  359. return scanptr;
  360. }
  361. LOCAL(jpeg_scan_info *)
  362. fill_scans (jpeg_scan_info * scanptr, int ncomps,
  363. 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 */