jcparam.c 18 KB

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