src/3rdparty/libjpeg/jcprepct.c
changeset 30 5dc02b23752f
parent 0 1918ee327afb
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   171      */
   171      */
   172     if (prep->rows_to_go == 0 &&
   172     if (prep->rows_to_go == 0 &&
   173 	*out_row_group_ctr < out_row_groups_avail) {
   173 	*out_row_group_ctr < out_row_groups_avail) {
   174       for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
   174       for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
   175 	   ci++, compptr++) {
   175 	   ci++, compptr++) {
       
   176 	numrows = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
       
   177 		  cinfo->min_DCT_v_scaled_size;
   176 	expand_bottom_edge(output_buf[ci],
   178 	expand_bottom_edge(output_buf[ci],
   177 			   compptr->width_in_blocks * DCTSIZE,
   179 			   compptr->width_in_blocks * compptr->DCT_h_scaled_size,
   178 			   (int) (*out_row_group_ctr * compptr->v_samp_factor),
   180 			   (int) (*out_row_group_ctr * numrows),
   179 			   (int) (out_row_groups_avail * compptr->v_samp_factor));
   181 			   (int) (out_row_groups_avail * numrows));
   180       }
   182       }
   181       *out_row_group_ctr = out_row_groups_avail;
   183       *out_row_group_ctr = out_row_groups_avail;
   182       break;			/* can exit outer loop without test */
   184       break;			/* can exit outer loop without test */
   183     }
   185     }
   184   }
   186   }
   286      * We make the buffer wide enough to allow the downsampler to edge-expand
   288      * We make the buffer wide enough to allow the downsampler to edge-expand
   287      * horizontally within the buffer, if it so chooses.
   289      * horizontally within the buffer, if it so chooses.
   288      */
   290      */
   289     true_buffer = (*cinfo->mem->alloc_sarray)
   291     true_buffer = (*cinfo->mem->alloc_sarray)
   290       ((j_common_ptr) cinfo, JPOOL_IMAGE,
   292       ((j_common_ptr) cinfo, JPOOL_IMAGE,
   291        (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
   293        (JDIMENSION) (((long) compptr->width_in_blocks *
       
   294 		      cinfo->min_DCT_h_scaled_size *
   292 		      cinfo->max_h_samp_factor) / compptr->h_samp_factor),
   295 		      cinfo->max_h_samp_factor) / compptr->h_samp_factor),
   293        (JDIMENSION) (3 * rgroup_height));
   296        (JDIMENSION) (3 * rgroup_height));
   294     /* Copy true buffer row pointers into the middle of the fake row array */
   297     /* Copy true buffer row pointers into the middle of the fake row array */
   295     MEMCOPY(fake_buffer + rgroup_height, true_buffer,
   298     MEMCOPY(fake_buffer + rgroup_height, true_buffer,
   296 	    3 * rgroup_height * SIZEOF(JSAMPROW));
   299 	    3 * rgroup_height * SIZEOF(JSAMPROW));
   344     prep->pub.pre_process_data = pre_process_data;
   347     prep->pub.pre_process_data = pre_process_data;
   345     for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
   348     for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
   346 	 ci++, compptr++) {
   349 	 ci++, compptr++) {
   347       prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
   350       prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
   348 	((j_common_ptr) cinfo, JPOOL_IMAGE,
   351 	((j_common_ptr) cinfo, JPOOL_IMAGE,
   349 	 (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
   352 	 (JDIMENSION) (((long) compptr->width_in_blocks *
       
   353 			cinfo->min_DCT_h_scaled_size *
   350 			cinfo->max_h_samp_factor) / compptr->h_samp_factor),
   354 			cinfo->max_h_samp_factor) / compptr->h_samp_factor),
   351 	 (JDIMENSION) cinfo->max_v_samp_factor);
   355 	 (JDIMENSION) cinfo->max_v_samp_factor);
   352     }
   356     }
   353   }
   357   }
   354 }
   358 }