jdsample.c revision 4a6b7303643714d495b9d26742d8a156fd120936
12cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane/* 22cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * jdsample.c 32cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * 44a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane * Copyright (C) 1991, 1992, Thomas G. Lane. 52cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * This file is part of the Independent JPEG Group's software. 62cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * For conditions of distribution and use, see the accompanying README file. 72cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * 82cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * This file contains un-subsampling routines. 92cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * These routines are invoked via the unsubsample and 102cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * unsubsample_init/term methods. 112cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane */ 122cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 132cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane#include "jinclude.h" 142cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 152cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 162cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane/* 172cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * Initialize for un-subsampling a scan. 182cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane */ 192cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 202cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. LaneMETHODDEF void 212cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Laneunsubsample_init (decompress_info_ptr cinfo) 222cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane{ 232cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane /* no work for now */ 242cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane} 252cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 262cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 272cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane/* 282cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * Un-subsample pixel values of a single component. 294a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane * This version handles any integral sampling ratios. 304a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane * This is not used for typical JPEG files, so it need not be fast. 312cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane */ 322cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 332cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. LaneMETHODDEF void 344a6b7303643714d495b9d26742d8a156fd120936Thomas G. Laneint_unsubsample (decompress_info_ptr cinfo, int which_component, 354a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane long input_cols, int input_rows, 364a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane long output_cols, int output_rows, 374a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, 384a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane JSAMPARRAY output_data) 392cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane{ 402cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane jpeg_component_info * compptr = cinfo->cur_comp_info[which_component]; 414a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane register JSAMPROW inptr, outptr; 424a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane register JSAMPLE invalue; 434a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane register short h_expand, h; 444a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane short v_expand, v; 452cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane int inrow, outrow; 464a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane register long incol; 472cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 484a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane#ifdef DEBUG /* for debugging pipeline controller */ 492cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane if (input_rows != compptr->v_samp_factor || 502cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane output_rows != cinfo->max_v_samp_factor || 512cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane (input_cols % compptr->h_samp_factor) != 0 || 522cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane (output_cols % cinfo->max_h_samp_factor) != 0 || 532cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane output_cols*compptr->h_samp_factor != input_cols*cinfo->max_h_samp_factor) 542cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane ERREXIT(cinfo->emethods, "Bogus unsubsample parameters"); 554a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane#endif 562cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 572cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; 582cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; 592cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 602cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane outrow = 0; 612cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane for (inrow = 0; inrow < input_rows; inrow++) { 622cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane for (v = 0; v < v_expand; v++) { 632cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane inptr = input_data[inrow]; 642cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane outptr = output_data[outrow++]; 652cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane for (incol = 0; incol < input_cols; incol++) { 662cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane invalue = GETJSAMPLE(*inptr++); 672cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane for (h = 0; h < h_expand; h++) { 682cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane *outptr++ = invalue; 692cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane } 702cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane } 712cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane } 722cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane } 732cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane} 742cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 752cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 762cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane/* 772cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * Un-subsample pixel values of a single component. 784a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane * This version handles the extremely common case of 794a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane * horizontal expansion by 2 and any integral vertical expansion. 804a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane */ 814a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane 824a6b7303643714d495b9d26742d8a156fd120936Thomas G. LaneMETHODDEF void 834a6b7303643714d495b9d26742d8a156fd120936Thomas G. Laneh2_unsubsample (decompress_info_ptr cinfo, int which_component, 844a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane long input_cols, int input_rows, 854a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane long output_cols, int output_rows, 864a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, 874a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane JSAMPARRAY output_data) 884a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane{ 894a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane jpeg_component_info * compptr = cinfo->cur_comp_info[which_component]; 904a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane register JSAMPROW inptr, outptr; 914a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane register JSAMPLE invalue; 924a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane short v_expand, v; 934a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane int inrow, outrow; 944a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane register long incol; 954a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane 964a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane#ifdef DEBUG /* for debugging pipeline controller */ 974a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane if (input_rows != compptr->v_samp_factor || 984a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane output_rows != cinfo->max_v_samp_factor || 994a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane (input_cols % compptr->h_samp_factor) != 0 || 1004a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane (output_cols % cinfo->max_h_samp_factor) != 0 || 1014a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane output_cols*compptr->h_samp_factor != input_cols*cinfo->max_h_samp_factor) 1024a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane ERREXIT(cinfo->emethods, "Bogus unsubsample parameters"); 1034a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane#endif 1044a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane 1054a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; 1064a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane 1074a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane/* The subsampled image width will always be a multiple of DCTSIZE, 1084a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane * so we can unroll the inner loop. 1094a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane */ 1104a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane 1114a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane outrow = 0; 1124a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane for (inrow = 0; inrow < input_rows; inrow++) { 1134a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane for (v = 0; v < v_expand; v++) { 1144a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane inptr = input_data[inrow]; 1154a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane outptr = output_data[outrow++]; 1164a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane#if DCTSIZE == 8 1174a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane for (incol = 0; incol < input_cols; incol += DCTSIZE) { 1184a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane invalue = GETJSAMPLE(*inptr++); 1194a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1204a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1214a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane invalue = GETJSAMPLE(*inptr++); 1224a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1234a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1244a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane invalue = GETJSAMPLE(*inptr++); 1254a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1264a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1274a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane invalue = GETJSAMPLE(*inptr++); 1284a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1294a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1304a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane invalue = GETJSAMPLE(*inptr++); 1314a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1324a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1334a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane invalue = GETJSAMPLE(*inptr++); 1344a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1354a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1364a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane invalue = GETJSAMPLE(*inptr++); 1374a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1384a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1394a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane invalue = GETJSAMPLE(*inptr++); 1404a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1414a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1424a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane } 1434a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane#else /* nonstandard DCTSIZE */ 1444a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane for (incol = 0; incol < input_cols; incol++) { 1454a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane invalue = GETJSAMPLE(*inptr++); 1464a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1474a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane *outptr++ = invalue; 1484a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane } 1494a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane#endif 1504a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane } 1514a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane } 1524a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane} 1534a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane 1544a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane 1554a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane/* 1564a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane * Un-subsample pixel values of a single component. 1572cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * This version handles the special case of a full-size component. 1582cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane */ 1592cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 1602cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. LaneMETHODDEF void 1612cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lanefullsize_unsubsample (decompress_info_ptr cinfo, int which_component, 1622cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane long input_cols, int input_rows, 1632cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane long output_cols, int output_rows, 1642cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, 1652cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane JSAMPARRAY output_data) 1662cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane{ 1674a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane#ifdef DEBUG /* for debugging pipeline controller */ 1684a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane if (input_cols != output_cols || input_rows != output_rows) 1692cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane ERREXIT(cinfo->emethods, "Pipeline controller messed up"); 1704a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane#endif 1712cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 1722cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane jcopy_sample_rows(input_data, 0, output_data, 0, output_rows, output_cols); 1732cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane} 1742cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 1752cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 1762cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 1772cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane/* 1782cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * Clean up after a scan. 1792cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane */ 1802cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 1812cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. LaneMETHODDEF void 1822cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Laneunsubsample_term (decompress_info_ptr cinfo) 1832cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane{ 1842cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane /* no work for now */ 1852cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane} 1862cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 1872cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 1882cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 1892cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane/* 1902cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * The method selection routine for unsubsampling. 1912cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane * Note that we must select a routine for each component. 1922cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane */ 1932cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 1942cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. LaneGLOBAL void 1952cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lanejselunsubsample (decompress_info_ptr cinfo) 1962cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane{ 1972cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane short ci; 1982cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane jpeg_component_info * compptr; 1992cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 2002cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane if (cinfo->CCIR601_sampling) 2012cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane ERREXIT(cinfo->emethods, "CCIR601 subsampling not implemented yet"); 2022cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 2032cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane for (ci = 0; ci < cinfo->comps_in_scan; ci++) { 2042cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane compptr = cinfo->cur_comp_info[ci]; 2052cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane if (compptr->h_samp_factor == cinfo->max_h_samp_factor && 2062cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane compptr->v_samp_factor == cinfo->max_v_samp_factor) 2072cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane cinfo->methods->unsubsample[ci] = fullsize_unsubsample; 2084a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && 2094a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) 2104a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane cinfo->methods->unsubsample[ci] = h2_unsubsample; 2112cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && 2122cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) 2134a6b7303643714d495b9d26742d8a156fd120936Thomas G. Lane cinfo->methods->unsubsample[ci] = int_unsubsample; 2142cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane else 2152cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane ERREXIT(cinfo->emethods, "Fractional subsampling not implemented yet"); 2162cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane } 2172cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane 2182cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane cinfo->methods->unsubsample_init = unsubsample_init; 2192cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane cinfo->methods->unsubsample_term = unsubsample_term; 2202cbeb8abd92d5ad8a1bd415b51b3816213b15f3Thomas G. Lane} 221