⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transupp.c

📁 Sigma SMP8634 Mrua v. 2.8.2.0
💻 C
📖 第 1 页 / 共 4 页
字号:
do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,	   JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,	   jvirt_barray_ptr *src_coef_arrays,	   jvirt_barray_ptr *dst_coef_arrays)/* 90 degree rotation is equivalent to *   1. Transposing the image; *   2. Horizontal mirroring. * These two steps are merged into a single processing routine. */{  JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y;  JDIMENSION x_crop_blocks, y_crop_blocks;  int ci, i, j, offset_x, offset_y;  JBLOCKARRAY src_buffer, dst_buffer;  JCOEFPTR src_ptr, dst_ptr;  jpeg_component_info *compptr;  /* Because of the horizontal mirror step, we can't process partial iMCUs   * at the (output) right edge properly.  They just get transposed and   * not mirrored.   */  MCU_cols = srcinfo->image_height / (dstinfo->max_h_samp_factor * DCTSIZE);  for (ci = 0; ci < dstinfo->num_components; ci++) {    compptr = dstinfo->comp_info + ci;    comp_width = MCU_cols * compptr->h_samp_factor;    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;	 dst_blk_y += compptr->v_samp_factor) {      dst_buffer = (*srcinfo->mem->access_virt_barray)	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,	 (JDIMENSION) compptr->v_samp_factor, TRUE);      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;	     dst_blk_x += compptr->h_samp_factor) {	  if (x_crop_blocks + dst_blk_x < comp_width) {	    /* Block is within the mirrorable area. */	    src_buffer = (*srcinfo->mem->access_virt_barray)	      ((j_common_ptr) srcinfo, src_coef_arrays[ci],	       comp_width - x_crop_blocks - dst_blk_x -	       (JDIMENSION) compptr->h_samp_factor,	       (JDIMENSION) compptr->h_samp_factor, FALSE);	  } else {	    /* Edge blocks are transposed but not mirrored. */	    src_buffer = (*srcinfo->mem->access_virt_barray)	      ((j_common_ptr) srcinfo, src_coef_arrays[ci],	       dst_blk_x + x_crop_blocks,	       (JDIMENSION) compptr->h_samp_factor, FALSE);	  }	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {	    dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];	    if (x_crop_blocks + dst_blk_x < comp_width) {	      /* Block is within the mirrorable area. */	      src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1]		[dst_blk_y + offset_y + y_crop_blocks];	      for (i = 0; i < DCTSIZE; i++) {		for (j = 0; j < DCTSIZE; j++)		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];		i++;		for (j = 0; j < DCTSIZE; j++)		  dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];	      }	    } else {	      /* Edge blocks are transposed but not mirrored. */	      src_ptr = src_buffer[offset_x]		[dst_blk_y + offset_y + y_crop_blocks];	      for (i = 0; i < DCTSIZE; i++)		for (j = 0; j < DCTSIZE; j++)		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];	    }	  }	}      }    }  }}LOCAL(void)do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,	    JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,	    jvirt_barray_ptr *src_coef_arrays,	    jvirt_barray_ptr *dst_coef_arrays)/* 270 degree rotation is equivalent to *   1. Horizontal mirroring; *   2. Transposing the image. * These two steps are merged into a single processing routine. */{  JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y;  JDIMENSION x_crop_blocks, y_crop_blocks;  int ci, i, j, offset_x, offset_y;  JBLOCKARRAY src_buffer, dst_buffer;  JCOEFPTR src_ptr, dst_ptr;  jpeg_component_info *compptr;  /* Because of the horizontal mirror step, we can't process partial iMCUs   * at the (output) bottom edge properly.  They just get transposed and   * not mirrored.   */  MCU_rows = srcinfo->image_width / (dstinfo->max_v_samp_factor * DCTSIZE);  for (ci = 0; ci < dstinfo->num_components; ci++) {    compptr = dstinfo->comp_info + ci;    comp_height = MCU_rows * compptr->v_samp_factor;    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;	 dst_blk_y += compptr->v_samp_factor) {      dst_buffer = (*srcinfo->mem->access_virt_barray)	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,	 (JDIMENSION) compptr->v_samp_factor, TRUE);      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;	     dst_blk_x += compptr->h_samp_factor) {	  src_buffer = (*srcinfo->mem->access_virt_barray)	    ((j_common_ptr) srcinfo, src_coef_arrays[ci],	     dst_blk_x + x_crop_blocks,	     (JDIMENSION) compptr->h_samp_factor, FALSE);	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {	    dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];	    if (y_crop_blocks + dst_blk_y < comp_height) {	      /* Block is within the mirrorable area. */	      src_ptr = src_buffer[offset_x]		[comp_height - y_crop_blocks - dst_blk_y - offset_y - 1];	      for (i = 0; i < DCTSIZE; i++) {		for (j = 0; j < DCTSIZE; j++) {		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];		  j++;		  dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];		}	      }	    } else {	      /* Edge blocks are transposed but not mirrored. */	      src_ptr = src_buffer[offset_x]		[dst_blk_y + offset_y + y_crop_blocks];	      for (i = 0; i < DCTSIZE; i++)		for (j = 0; j < DCTSIZE; j++)		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];	    }	  }	}      }    }  }}LOCAL(void)do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,	    JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,	    jvirt_barray_ptr *src_coef_arrays,	    jvirt_barray_ptr *dst_coef_arrays)/* 180 degree rotation is equivalent to *   1. Vertical mirroring; *   2. Horizontal mirroring. * These two steps are merged into a single processing routine. */{  JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y;  JDIMENSION x_crop_blocks, y_crop_blocks;  int ci, i, j, offset_y;  JBLOCKARRAY src_buffer, dst_buffer;  JBLOCKROW src_row_ptr, dst_row_ptr;  JCOEFPTR src_ptr, dst_ptr;  jpeg_component_info *compptr;  MCU_cols = srcinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);  MCU_rows = srcinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);  for (ci = 0; ci < dstinfo->num_components; ci++) {    compptr = dstinfo->comp_info + ci;    comp_width = MCU_cols * compptr->h_samp_factor;    comp_height = MCU_rows * compptr->v_samp_factor;    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;	 dst_blk_y += compptr->v_samp_factor) {      dst_buffer = (*srcinfo->mem->access_virt_barray)	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,	 (JDIMENSION) compptr->v_samp_factor, TRUE);      if (y_crop_blocks + dst_blk_y < comp_height) {	/* Row is within the vertically mirrorable area. */	src_buffer = (*srcinfo->mem->access_virt_barray)	  ((j_common_ptr) srcinfo, src_coef_arrays[ci],	   comp_height - y_crop_blocks - dst_blk_y -	   (JDIMENSION) compptr->v_samp_factor,	   (JDIMENSION) compptr->v_samp_factor, FALSE);      } else {	/* Bottom-edge rows are only mirrored horizontally. */	src_buffer = (*srcinfo->mem->access_virt_barray)	  ((j_common_ptr) srcinfo, src_coef_arrays[ci],	   dst_blk_y + y_crop_blocks,	   (JDIMENSION) compptr->v_samp_factor, FALSE);      }      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {	dst_row_ptr = dst_buffer[offset_y];	if (y_crop_blocks + dst_blk_y < comp_height) {	  /* Row is within the mirrorable area. */	  src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1];	  for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {	    dst_ptr = dst_row_ptr[dst_blk_x];	    if (x_crop_blocks + dst_blk_x < comp_width) {	      /* Process the blocks that can be mirrored both ways. */	      src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1];	      for (i = 0; i < DCTSIZE; i += 2) {		/* For even row, negate every odd column. */		for (j = 0; j < DCTSIZE; j += 2) {		  *dst_ptr++ = *src_ptr++;		  *dst_ptr++ = - *src_ptr++;		}		/* For odd row, negate every even column. */		for (j = 0; j < DCTSIZE; j += 2) {		  *dst_ptr++ = - *src_ptr++;		  *dst_ptr++ = *src_ptr++;		}	      }	    } else {	      /* Any remaining right-edge blocks are only mirrored vertically. */	      src_ptr = src_row_ptr[x_crop_blocks + dst_blk_x];	      for (i = 0; i < DCTSIZE; i += 2) {		for (j = 0; j < DCTSIZE; j++)		  *dst_ptr++ = *src_ptr++;		for (j = 0; j < DCTSIZE; j++)		  *dst_ptr++ = - *src_ptr++;	      }	    }	  }	} else {	  /* Remaining rows are just mirrored horizontally. */	  src_row_ptr = src_buffer[offset_y];	  for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {	    if (x_crop_blocks + dst_blk_x < comp_width) {	      /* Process the blocks that can be mirrored. */	      dst_ptr = dst_row_ptr[dst_blk_x];	      src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1];	      for (i = 0; i < DCTSIZE2; i += 2) {		*dst_ptr++ = *src_ptr++;		*dst_ptr++ = - *src_ptr++;	      }	    } else {	      /* Any remaining right-edge blocks are only copied. */	      jcopy_block_row(src_row_ptr + dst_blk_x + x_crop_blocks,			      dst_row_ptr + dst_blk_x,			      (JDIMENSION) 1);	    }	  }	}      }    }  }}LOCAL(void)do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,	       JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,	       jvirt_barray_ptr *src_coef_arrays,	       jvirt_barray_ptr *dst_coef_arrays)/* Transverse transpose is equivalent to *   1. 180 degree rotation; *   2. Transposition; * or *   1. Horizontal mirroring; *   2. Transposition; *   3. Horizontal mirroring. * These steps are merged into a single processing routine. */{  JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y;  JDIMENSION x_crop_blocks, y_crop_blocks;  int ci, i, j, offset_x, offset_y;  JBLOCKARRAY src_buffer, dst_buffer;  JCOEFPTR src_ptr, dst_ptr;  jpeg_component_info *compptr;  MCU_cols = srcinfo->image_height / (dstinfo->max_h_samp_factor * DCTSIZE);  MCU_rows = srcinfo->image_width / (dstinfo->max_v_samp_factor * DCTSIZE);  for (ci = 0; ci < dstinfo->num_components; ci++) {    compptr = dstinfo->comp_info + ci;    comp_width = MCU_cols * compptr->h_samp_factor;    comp_height = MCU_rows * compptr->v_samp_factor;    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;	 dst_blk_y += compptr->v_samp_factor) {      dst_buffer = (*srcinfo->mem->access_virt_barray)	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,	 (JDIMENSION) compptr->v_samp_factor, TRUE);      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;	     dst_blk_x += compptr->h_samp_factor) {	  if (x_crop_blocks + dst_blk_x < comp_width) {	    /* Block is within the mirrorable area. */	    src_buffer = (*srcinfo->mem->access_virt_barray)	      ((j_common_ptr) srcinfo, src_coef_arrays[ci],	       comp_width - x_crop_blocks - dst_blk_x -	       (JDIMENSION) compptr->h_samp_factor,	       (JDIMENSION) compptr->h_samp_factor, FALSE);	  } else {	    src_buffer = (*srcinfo->mem->access_virt_barray)	      ((j_common_ptr) srcinfo, src_coef_arrays[ci],	       dst_blk_x + x_crop_blocks,	       (JDIMENSION) compptr->h_samp_factor, FALSE);	  }	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {	    dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];	    if (y_crop_blocks + dst_blk_y < comp_height) {	      if (x_crop_blocks + dst_blk_x < comp_width) {		/* Block is within the mirrorable area. */		src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1]		  [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1];		for (i = 0; i < DCTSIZE; i++) {		  for (j = 0; j < DCTSIZE; j++) {		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];		    j++;		    dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];		  }		  i++;		  for (j = 0; j < DCTSIZE; j++) {		    dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];		    j++;		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];		  }		}	      } else {		/* Right-edge blocks are mirrored in y only */		src_ptr = src_buffer[offset_x]		  [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1];		for (i = 0; i < DCTSIZE; i++) {		  for (j = 0; j < DCTSIZE; j++) {		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];		    j++;		    dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];		  }		}	      }	    } else {	      if (x_crop_blocks + dst_blk_x < comp_width) {		/* Bottom-edge blocks are mirrored in x only */		src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1]		  [dst_blk_y + offset_y + y_crop_blocks];		for (i = 0; i < DCTSIZE; i++) {		  for (j = 0; j < DCTSIZE; j++)		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];		  i++;		  for (j = 0; j < DCTSIZE; j++)		    dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];		}	      } else {		/* At lower right corner, just transpose, no mirroring */		src_ptr = src_buffer[offset_x]		  [dst_blk_y + offset_y + y_crop_blocks];		for (i = 0; i < DCTSIZE; i++)		  for (j = 0; j < DCTSIZE; j++)		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];	      }	    }	  }	}      }    }  }}/* Parse an unsigned integer: subroutine for jtransform_parse_crop_spec. * Returns TRUE if valid integer found, FALSE if not.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -