您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ERREXIT2函数代码示例

51自学网 2021-06-01 20:33:11
  C++
这篇教程C++ ERREXIT2函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ERREXIT2函数的典型用法代码示例。如果您正苦于以下问题:C++ ERREXIT2函数的具体用法?C++ ERREXIT2怎么用?C++ ERREXIT2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ERREXIT2函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: start_input_pass

start_input_pass (j_decompress_ptr cinfo){  j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;  d_diff_ptr diff = (d_diff_ptr) losslsd->diff_private;  /* Check that the restart interval is an integer multiple of the number    * of MCU in an MCU-row.   */  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)    ERREXIT2(cinfo, JERR_BAD_RESTART,         (int)cinfo->restart_interval, (int)cinfo->MCUs_per_row);  /* Initialize restart counter */  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;  cinfo->input_iMCU_row = 0;  start_iMCU_row(cinfo);}
开发者ID:AlfiyaZi,项目名称:DCMTK,代码行数:18,


示例2: get_app0

METHODDEF booleanget_app0 (j_decompress_ptr cinfo)/* Process an APP0 marker */{#define JFIF_LEN 14  INT32 length;  UINT8 b[JFIF_LEN];  int buffp;  INPUT_VARS(cinfo);  INPUT_2BYTES(cinfo, length, return FALSE);  length -= 2;  /* See if a JFIF APP0 marker is present */  if (length >= JFIF_LEN) {    for (buffp = 0; buffp < JFIF_LEN; buffp++)      INPUT_BYTE(cinfo, b[buffp], return FALSE);    length -= JFIF_LEN;    if (b[0]==0x4A && b[1]==0x46 && b[2]==0x49 && b[3]==0x46 && b[4]==0) {      /* Found JFIF APP0 marker: check version */      /* Major version must be 1 */      if (b[5] != 1)	ERREXIT2(cinfo, JERR_JFIF_MAJOR, b[5], b[6]);      /* Minor version should be 0..2, but try to process anyway if newer */      if (b[6] > 2)	TRACEMS2(cinfo, 1, JTRC_JFIF_MINOR, b[5], b[6]);      /* Save info */      cinfo->saw_JFIF_marker = TRUE;      cinfo->density_unit = b[7];      cinfo->X_density = (b[8] << 8) + b[9];      cinfo->Y_density = (b[10] << 8) + b[11];      TRACEMS3(cinfo, 1, JTRC_JFIF,	       cinfo->X_density, cinfo->Y_density, cinfo->density_unit);      if (b[12] | b[13])	TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, b[12], b[13]);      if (length != ((INT32) b[12] * (INT32) b[13] * (INT32) 3))	TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) length);    } else {      /* Start of APP0 does not match "JFIF" */      TRACEMS1(cinfo, 1, JTRC_APP0, (int) length + JFIF_LEN);    }  } else {
开发者ID:Jonnyliu,项目名称:Rmtsvc,代码行数:44,


示例3: select_scan_parameters

select_scan_parameters (j_compress_ptr cinfo)/* Set up the scan parameters for the current scan */{  int ci;#ifdef C_MULTISCAN_FILES_SUPPORTED  if (cinfo->scan_info != NULL)  {    /* Prepare for current scan --- the script is already validated */    my_master_ptr master = (my_master_ptr) cinfo->master;    const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number;    cinfo->comps_in_scan = scanptr->comps_in_scan;    for (ci = 0; ci < scanptr->comps_in_scan; ci++)    {      cinfo->cur_comp_info[ci] =        &cinfo->comp_info[scanptr->component_index[ci]];    }    cinfo->Ss = scanptr->Ss;    cinfo->Se = scanptr->Se;    cinfo->Ah = scanptr->Ah;    cinfo->Al = scanptr->Al;  }  else#endif  {    /* Prepare for single sequential-JPEG scan containing all components */    if (cinfo->num_components > MAX_COMPS_IN_SCAN)      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,               MAX_COMPS_IN_SCAN);    cinfo->comps_in_scan = cinfo->num_components;    for (ci = 0; ci < cinfo->num_components; ci++)    {      cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];    }    cinfo->Ss = 0;    cinfo->Se = DCTSIZE2-1;    cinfo->Ah = 0;    cinfo->Al = 0;  }}
开发者ID:neurodebian,项目名称:freesurfer,代码行数:41,


示例4: write_mfx

/*{{{  write_mfx(transform_info_ptr tinfo) {*/METHODDEF DATATYPE *write_mfx(transform_info_ptr tinfo) { struct write_mfx_storage *local_arg=(struct write_mfx_storage *)tinfo->methods->local_storage; /*{{{  Assert that epoch size didn't change & itemsize==1*/ if (tinfo->itemsize!=1) {  ERREXIT(tinfo->emethods, "write_mfx: Only itemsize=1 is supported./n"); } if (local_arg->mfxfile->nr_of_channels_selected!=tinfo->nr_of_channels) {  ERREXIT2(tinfo->emethods, "write_mfx: nr_of_channels was %d, now %d/n", MSGPARM(local_arg->mfxfile->nr_of_channels_selected), MSGPARM(tinfo->nr_of_channels)); } /*}}}  */ multiplexed(tinfo); if (tinfo->data_type==FREQ_DATA) tinfo->nr_of_points=tinfo->nroffreq; if (mfx_write((void *)tinfo->tsdata, tinfo->nr_of_points, local_arg->mfxfile)!=MFX_NOERR) {  ERREXIT1(tinfo->emethods, "write_mfx_init: mfx_write error %s/n", MSGPARM(mfx_errors[mfx_lasterr])); } return tinfo->tsdata;	/* Simply to return something `useful' */}
开发者ID:berndf,项目名称:avg_q,代码行数:22,


示例5: jpeg_calc_trans_dimensions

jpeg_calc_trans_dimensions (j_compress_ptr cinfo){  if (cinfo->min_DCT_h_scaled_size < 1 || cinfo->min_DCT_h_scaled_size > 16      || cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size)    ERREXIT2(cinfo, JERR_BAD_DCTSIZE,	     cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size);  cinfo->block_size = cinfo->min_DCT_h_scaled_size;  switch (cinfo->block_size) {  case 2: cinfo->natural_order = jpeg_natural_order2; break;  case 3: cinfo->natural_order = jpeg_natural_order3; break;  case 4: cinfo->natural_order = jpeg_natural_order4; break;  case 5: cinfo->natural_order = jpeg_natural_order5; break;  case 6: cinfo->natural_order = jpeg_natural_order6; break;  case 7: cinfo->natural_order = jpeg_natural_order7; break;  default: cinfo->natural_order = jpeg_natural_order; break;  }  cinfo->lim_Se = cinfo->block_size < DCTSIZE ?    cinfo->block_size * cinfo->block_size - 1 : DCTSIZE2-1;}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:22,


示例6: initial_setup

initial_setup (j_decompress_ptr cinfo)/* Called once, when first SOS marker is reached */{  int ci;  jpeg_component_info *compptr;  /* Make sure image isn't bigger than I can handle */  if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||      (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);  /* For now, precision must match compiled-in value... */  if (cinfo->data_precision != BITS_IN_JSAMPLE)    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);  /* Check that number of components won't exceed internal array sizes */  if (cinfo->num_components > MAX_COMPONENTS)    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,	     MAX_COMPONENTS);  /* Compute maximum sampling factors; check factor validity */  cinfo->max_h_samp_factor = 1;  cinfo->max_v_samp_factor = 1;  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;       ci++, compptr++) {    if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||	compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)      ERREXIT(cinfo, JERR_BAD_SAMPLING);    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,				   compptr->h_samp_factor);    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,				   compptr->v_samp_factor);  }  /* Derive block_size, natural_order, and lim_Se */  if (cinfo->is_baseline || (cinfo->progressive_mode &&      cinfo->comps_in_scan)) { /* no pseudo SOS marker */    cinfo->block_size = DCTSIZE;    cinfo->natural_order = jpeg_natural_order;    cinfo->lim_Se = DCTSIZE2-1;  } else    switch (cinfo->Se) {    case (1*1-1):      cinfo->block_size = 1;      cinfo->natural_order = jpeg_natural_order; /* not needed */      cinfo->lim_Se = cinfo->Se;      break;    case (2*2-1):      cinfo->block_size = 2;      cinfo->natural_order = jpeg_natural_order2;      cinfo->lim_Se = cinfo->Se;      break;    case (3*3-1):      cinfo->block_size = 3;      cinfo->natural_order = jpeg_natural_order3;      cinfo->lim_Se = cinfo->Se;      break;    case (4*4-1):      cinfo->block_size = 4;      cinfo->natural_order = jpeg_natural_order4;      cinfo->lim_Se = cinfo->Se;      break;    case (5*5-1):      cinfo->block_size = 5;      cinfo->natural_order = jpeg_natural_order5;      cinfo->lim_Se = cinfo->Se;      break;    case (6*6-1):      cinfo->block_size = 6;      cinfo->natural_order = jpeg_natural_order6;      cinfo->lim_Se = cinfo->Se;      break;    case (7*7-1):      cinfo->block_size = 7;      cinfo->natural_order = jpeg_natural_order7;      cinfo->lim_Se = cinfo->Se;      break;    case (8*8-1):      cinfo->block_size = 8;      cinfo->natural_order = jpeg_natural_order;      cinfo->lim_Se = DCTSIZE2-1;      break;    case (9*9-1):      cinfo->block_size = 9;      cinfo->natural_order = jpeg_natural_order;      cinfo->lim_Se = DCTSIZE2-1;      break;    case (10*10-1):      cinfo->block_size = 10;      cinfo->natural_order = jpeg_natural_order;      cinfo->lim_Se = DCTSIZE2-1;      break;    case (11*11-1):      cinfo->block_size = 11;      cinfo->natural_order = jpeg_natural_order;      cinfo->lim_Se = DCTSIZE2-1;      break;    case (12*12-1):      cinfo->block_size = 12;      cinfo->natural_order = jpeg_natural_order;//.........这里部分代码省略.........
开发者ID:151706061,项目名称:ITK,代码行数:101,


示例7: jpeg_copy_critical_parameters

jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,			       j_compress_ptr dstinfo){  JQUANT_TBL ** qtblptr;  jpeg_component_info *incomp, *outcomp;  JQUANT_TBL *c_quant, *slot_quant;  int tblno, ci, coefi;  /* Safety check to ensure start_compress not called yet. */  if (dstinfo->global_state != CSTATE_START)    ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state);  /* Copy fundamental image dimensions */  dstinfo->image_width = srcinfo->image_width;  dstinfo->image_height = srcinfo->image_height;  dstinfo->input_components = srcinfo->num_components;  dstinfo->in_color_space = srcinfo->jpeg_color_space;  /* Initialize all parameters to default values */  jpeg_set_defaults(dstinfo);  /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.   * Fix it to get the right header markers for the image colorspace.   */  jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);  dstinfo->data_precision = srcinfo->data_precision;  dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;  /* Copy the source's quantization tables. */  for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {    if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {      qtblptr = & dstinfo->quant_tbl_ptrs[tblno];      if (*qtblptr == NULL)	*qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);      MEMCOPY((*qtblptr)->quantval,	      srcinfo->quant_tbl_ptrs[tblno]->quantval,	      SIZEOF((*qtblptr)->quantval));      (*qtblptr)->sent_table = FALSE;    }  }  /* Copy the source's per-component info.   * Note we assume jpeg_set_defaults has allocated the dest comp_info array.   */  dstinfo->num_components = srcinfo->num_components;  if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)    ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,	     MAX_COMPONENTS);  for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;       ci < dstinfo->num_components; ci++, incomp++, outcomp++) {    outcomp->component_id = incomp->component_id;    outcomp->h_samp_factor = incomp->h_samp_factor;    outcomp->v_samp_factor = incomp->v_samp_factor;    outcomp->quant_tbl_no = incomp->quant_tbl_no;    /* Make sure saved quantization table for component matches the qtable     * slot.  If not, the input file re-used this qtable slot.     * IJG encoder currently cannot duplicate this.     */    tblno = outcomp->quant_tbl_no;    if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||	srcinfo->quant_tbl_ptrs[tblno] == NULL)      ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);    slot_quant = srcinfo->quant_tbl_ptrs[tblno];    c_quant = incomp->quant_table;    if (c_quant != NULL) {      for (coefi = 0; coefi < DCTSIZE2; coefi++) {	if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])	  ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);      }    }    /* Note: we do not copy the source's Huffman table assignments;     * instead we rely on jpeg_set_colorspace to have made a suitable choice.     */  }}
开发者ID:cjus,项目名称:s34mme,代码行数:70,


示例8: project_init

/*{{{  project_init(transform_info_ptr tinfo)*/METHODDEF voidproject_init(transform_info_ptr tinfo) { struct project_args_struct *project_args=(struct project_args_struct *)tinfo->methods->local_storage; transform_argument *args=tinfo->methods->arguments; transform_info_ptr side_tinfo= &project_args->side_tinfo; array *vectors= &project_args->vectors; growing_buf buf;#define BUFFER_SIZE 80 char buffer[BUFFER_SIZE]; side_tinfo->methods= &project_args->methods; side_tinfo->emethods=tinfo->emethods; select_readasc(side_tinfo); growing_buf_init(&buf); growing_buf_allocate(&buf, 0); if (args[ARGS_FROMEPOCH].is_set) {  snprintf(buffer, BUFFER_SIZE, "-f %ld ", args[ARGS_FROMEPOCH].arg.i);  growing_buf_appendstring(&buf, buffer); } if (args[ARGS_EPOCHS].is_set) {  project_args->epochs=args[ARGS_EPOCHS].arg.i;  if (project_args->epochs<=0) {   ERREXIT(tinfo->emethods, "project_init: The number of epochs must be positive./n");  } } else {  project_args->epochs=1; } snprintf(buffer, BUFFER_SIZE, "-e %d ", project_args->epochs); growing_buf_appendstring(&buf, buffer); growing_buf_appendstring(&buf, args[ARGS_PROJECTFILE].arg.s); if (!buf.can_be_freed || !setup_method(side_tinfo, &buf)) {  ERREXIT(tinfo->emethods, "project_init: Error setting readasc arguments./n"); } project_args->points=(args[ARGS_POINTS].is_set ? args[ARGS_POINTS].arg.i : 1); project_args->nr_of_item=(args[ARGS_NROFITEM].is_set ? args[ARGS_NROFITEM].arg.i : 0); project_args->orthogonalize_vectors_first=args[ARGS_ORTHOGONALIZE].is_set; if (args[ARGS_SUBSPACE].is_set) {  project_args->project_mode=PROJECT_MODE_SSP; } else if (args[ARGS_SUBTRACT_SUBSPACE].is_set) {  project_args->project_mode=PROJECT_MODE_SSPS; } else if (args[ARGS_MULTIPLY].is_set) {  project_args->project_mode=PROJECT_MODE_MULTIPLY; } else {  project_args->project_mode=PROJECT_MODE_SCALAR; } if (args[ARGS_CHANNELNAMES].is_set) {  project_args->channel_list=expand_channel_list(tinfo, args[ARGS_CHANNELNAMES].arg.s);  if (project_args->channel_list==NULL) {   ERREXIT(tinfo->emethods, "project_init: Zero channels were selected by -N!/n");  } } else {  project_args->channel_list=NULL; } (*side_tinfo->methods->transform_init)(side_tinfo); /*{{{  Read first project_file epoch and allocate vectors array accordingly*/ if ((side_tinfo->tsdata=(*side_tinfo->methods->transform)(side_tinfo))==NULL) {  ERREXIT(tinfo->emethods, "project_init: Can't get the first project epoch./n"); } if (project_args->project_mode==PROJECT_MODE_MULTIPLY) {  /* Save channel names and positions for later */  project_args->save_side_tinfo.nr_of_channels=side_tinfo->nr_of_channels;  copy_channelinfo(&project_args->save_side_tinfo, side_tinfo->channelnames, side_tinfo->probepos); } if (project_args->points==0) project_args->points=side_tinfo->nr_of_points; if (project_args->points>side_tinfo->nr_of_points) {  ERREXIT1(tinfo->emethods, "project_init: There are only %d points in the project_file epoch./n", MSGPARM(side_tinfo->nr_of_points)); } if (args[ARGS_AT_XVALUE].is_set) {  project_args->nr_of_point=find_pointnearx(side_tinfo, (DATATYPE)atof(args[ARGS_NROFPOINT].arg.s)); } else { project_args->nr_of_point=gettimeslice(side_tinfo, args[ARGS_NROFPOINT].arg.s); } vectors->nr_of_vectors=project_args->epochs*project_args->points; vectors->nr_of_elements=side_tinfo->nr_of_channels; vectors->element_skip=1; if (array_allocate(vectors)==NULL) {  ERREXIT(tinfo->emethods, "project_init: Error allocating vectors memory/n"); } /*}}}  */ do {  /*{{{  Copy [points] vectors from project_file to vectors array*/  array indata;  int point;  if (vectors->nr_of_elements!=side_tinfo->nr_of_channels) {   ERREXIT(side_tinfo->emethods, "project_init: Varying channel numbers in project file!/n");  }  if (project_args->nr_of_point>=side_tinfo->nr_of_points) {   ERREXIT2(side_tinfo->emethods, "project_init: nr_of_point=%d, nr_of_points=%d/n", MSGPARM(project_args->nr_of_point), MSGPARM(side_tinfo->nr_of_points));  }  if (project_args->nr_of_item>=side_tinfo->itemsize) {   ERREXIT2(side_tinfo->emethods, "project_init: nr_of_item=%d, itemsize=%d/n", MSGPARM(project_args->nr_of_item), MSGPARM(side_tinfo->itemsize));  }  for (point=0; point<project_args->points; point++) {//.........这里部分代码省略.........
开发者ID:berndf,项目名称:avg_q,代码行数:101,


示例9: jpeg_CreateCompress

jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize){  int i;  /* Guard against version mismatches between library and caller. */  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */  if (version != JPEG_LIB_VERSION)    ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);  if (structsize != sizeof(struct jpeg_compress_struct))    ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,             (int) sizeof(struct jpeg_compress_struct), (int) structsize);  /* For debugging purposes, we zero the whole master structure.   * But the application has already set the err pointer, and may have set   * client_data, so we have to save and restore those fields.   * Note: if application hasn't set client_data, tools like Purify may   * complain here.   */  {    struct jpeg_error_mgr * err = cinfo->err;    void * client_data = cinfo->client_data; /* ignore Purify complaint here */    MEMZERO(cinfo, sizeof(struct jpeg_compress_struct));    cinfo->err = err;    cinfo->client_data = client_data;  }  cinfo->is_decompressor = FALSE;  /* Initialize a memory manager instance for this object */  jinit_memory_mgr((j_common_ptr) cinfo);  /* Zero out pointers to permanent structures. */  cinfo->progress = NULL;  cinfo->dest = NULL;  cinfo->comp_info = NULL;  for (i = 0; i < NUM_QUANT_TBLS; i++) {    cinfo->quant_tbl_ptrs[i] = NULL;#if JPEG_LIB_VERSION >= 70    cinfo->q_scale_factor[i] = 100;#endif  }  for (i = 0; i < NUM_HUFF_TBLS; i++) {    cinfo->dc_huff_tbl_ptrs[i] = NULL;    cinfo->ac_huff_tbl_ptrs[i] = NULL;  }#if JPEG_LIB_VERSION >= 80  /* Must do it here for emit_dqt in case jpeg_write_tables is used */  cinfo->block_size = DCTSIZE;  cinfo->natural_order = jpeg_natural_order;  cinfo->lim_Se = DCTSIZE2-1;#endif  cinfo->script_space = NULL;  cinfo->input_gamma = 1.0;     /* in case application forgets */  /* OK, I'm ready */  cinfo->global_state = CSTATE_START;}
开发者ID:jcyfkimi,项目名称:libjpeg-turbo,代码行数:62,


示例10: initial_setup

initial_setup (j_compress_ptr cinfo, boolean transcode_only)/* Do computations that are needed before master selection phase */{  int ci;  jpeg_component_info *compptr;  long samplesperrow;  JDIMENSION jd_samplesperrow;#if JPEG_LIB_VERSION >= 70#if JPEG_LIB_VERSION >= 80  if (!transcode_only)#endif    jpeg_calc_jpeg_dimensions(cinfo);#endif  /* Sanity check on image dimensions */  if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0      || cinfo->num_components <= 0 || cinfo->input_components <= 0)    ERREXIT(cinfo, JERR_EMPTY_IMAGE);  /* Make sure image isn't bigger than I can handle */  if ((long) cinfo->_jpeg_height > (long) JPEG_MAX_DIMENSION ||      (long) cinfo->_jpeg_width > (long) JPEG_MAX_DIMENSION)    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);  /* Width of an input scanline must be representable as JDIMENSION. */  samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components;  jd_samplesperrow = (JDIMENSION) samplesperrow;  if ((long) jd_samplesperrow != samplesperrow)    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);  /* For now, precision must match compiled-in value... */  if (cinfo->data_precision != BITS_IN_JSAMPLE)    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);  /* Check that number of components won't exceed internal array sizes */  if (cinfo->num_components > MAX_COMPONENTS)    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,             MAX_COMPONENTS);  /* Compute maximum sampling factors; check factor validity */  cinfo->max_h_samp_factor = 1;  cinfo->max_v_samp_factor = 1;  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;       ci++, compptr++) {    if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||        compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)      ERREXIT(cinfo, JERR_BAD_SAMPLING);    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,                                   compptr->h_samp_factor);    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,                                   compptr->v_samp_factor);  }  /* Compute dimensions of components */  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;       ci++, compptr++) {    /* Fill in the correct component_index value; don't rely on application */    compptr->component_index = ci;    /* For compression, we never do DCT scaling. */#if JPEG_LIB_VERSION >= 70    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = DCTSIZE;#else    compptr->DCT_scaled_size = DCTSIZE;#endif    /* Size in DCT blocks */    compptr->width_in_blocks = (JDIMENSION)      jdiv_round_up((long) cinfo->_jpeg_width * (long) compptr->h_samp_factor,                    (long) (cinfo->max_h_samp_factor * DCTSIZE));    compptr->height_in_blocks = (JDIMENSION)      jdiv_round_up((long) cinfo->_jpeg_height * (long) compptr->v_samp_factor,                    (long) (cinfo->max_v_samp_factor * DCTSIZE));    /* Size in samples */    compptr->downsampled_width = (JDIMENSION)      jdiv_round_up((long) cinfo->_jpeg_width * (long) compptr->h_samp_factor,                    (long) cinfo->max_h_samp_factor);    compptr->downsampled_height = (JDIMENSION)      jdiv_round_up((long) cinfo->_jpeg_height * (long) compptr->v_samp_factor,                    (long) cinfo->max_v_samp_factor);    /* Mark component needed (this flag isn't actually used for compression) */    compptr->component_needed = TRUE;  }  /* Compute number of fully interleaved MCU rows (number of times that   * main controller will call coefficient controller).   */  cinfo->total_iMCU_rows = (JDIMENSION)    jdiv_round_up((long) cinfo->_jpeg_height,                  (long) (cinfo->max_v_samp_factor*DCTSIZE));}
开发者ID:jcyfkimi,项目名称:libjpeg-turbo,代码行数:90,


示例11: project

/*{{{  project(transform_info_ptr tinfo)*/METHODDEF DATATYPE *project(transform_info_ptr tinfo) { struct project_args_struct *project_args=(struct project_args_struct *)tinfo->methods->local_storage; transform_argument *args=tinfo->methods->arguments; DATATYPE *retvalue=tinfo->tsdata; array indata, scalars, *vectors= &project_args->vectors; int itempart, itemparts=tinfo->itemsize-tinfo->leaveright; if (project_args->project_mode==PROJECT_MODE_MULTIPLY) {  if (!(tinfo->nr_of_channels==vectors->nr_of_vectors      ||(tinfo->nr_of_channels==1 && tinfo->itemsize==vectors->nr_of_vectors))) {   ERREXIT(tinfo->emethods, "project: Number of scalars and maps doesn't match!/n");  } } else { if (vectors->nr_of_elements!=tinfo->nr_of_channels) {  ERREXIT2(tinfo->emethods, "project: %d channels in epoch, but %d channels in project file./n", MSGPARM(tinfo->nr_of_channels), MSGPARM(vectors->nr_of_elements)); } } array_reset(vectors); tinfo_array(tinfo, &indata); array_transpose(&indata);	/* Vectors are maps */ /* Be sure that different output items are adjacent... */ scalars.nr_of_elements=vectors->nr_of_vectors; switch (project_args->project_mode) {  case PROJECT_MODE_SCALAR:   scalars.nr_of_vectors=tinfo->nr_of_points;   scalars.element_skip=itemparts;   break;  case PROJECT_MODE_SSP:  case PROJECT_MODE_SSPS:   scalars.nr_of_vectors=1;   scalars.element_skip=1;   break;  case PROJECT_MODE_MULTIPLY:   scalars=indata;   if (tinfo->nr_of_channels!=vectors->nr_of_vectors) {    /* Ie, one channel and weights in the items: Convert from 1 element to     * itemsize elements */    scalars.element_skip=1;    scalars.nr_of_elements=tinfo->itemsize;    itemparts=1;   }   indata.element_skip=itemparts;   indata.nr_of_elements=vectors->nr_of_elements; /* New number of channels */   indata.nr_of_vectors=scalars.nr_of_vectors; /* New number of points */   if (array_allocate(&indata)==NULL) {    ERREXIT(tinfo->emethods, "project: Can't allocate new indata array/n");   }   break; } if (project_args->project_mode==PROJECT_MODE_MULTIPLY) {  array_transpose(vectors); /* Now the elements are the subspace dimensions */  for (itempart=0; itempart<itemparts; itempart++) {   array_use_item(&indata, itempart);   array_use_item(&scalars, itempart);   do {    /*{{{  Build the signal subspace vector*/    do {     array_write(&indata, array_multiply(vectors, &scalars, MULT_SAMESIZE));    } while (indata.message==ARRAY_CONTINUE);    /*}}}  */   } while (indata.message!=ARRAY_ENDOFSCAN);  }  array_transpose(vectors); } else { if (array_allocate(&scalars)==NULL) {  ERREXIT(tinfo->emethods, "project: Can't allocate scalars array/n"); } for (itempart=0; itempart<itemparts; itempart++) {  array_use_item(&indata, itempart);  if (project_args->project_mode==PROJECT_MODE_SCALAR) {   array_use_item(&scalars, itempart);  }  do {   /*{{{  Calculate the projection scalars*/   do {    /* With all vectors in turn: */    DATATYPE product=0.0;    do {     if (project_args->channel_list!=NULL && !is_in_channellist(vectors->current_element+1, project_args->channel_list)) {      array_advance(vectors);      array_advance(&indata);     } else {      product+=array_scan(&indata)*array_scan(vectors);     }    } while (vectors->message==ARRAY_CONTINUE);    array_write(&scalars, product);    if (scalars.message==ARRAY_CONTINUE) array_previousvector(&indata);   } while (scalars.message==ARRAY_CONTINUE);   /*}}}  */   //.........这里部分代码省略.........
开发者ID:berndf,项目名称:avg_q,代码行数:101,


示例12: per_scan_setup

per_scan_setup (j_decompress_ptr cinfo)/* Do computations that are needed before processing a JPEG scan *//* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */{  int ci, mcublks, tmp;  jpeg_component_info *compptr;    if (cinfo->comps_in_scan == 1) {        /* Noninterleaved (single-component) scan */    compptr = cinfo->cur_comp_info[0];        /* Overall image size in MCUs */    cinfo->MCUs_per_row = compptr->width_in_blocks;    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;        /* For noninterleaved scan, always one block per MCU */    compptr->MCU_width = 1;    compptr->MCU_height = 1;    compptr->MCU_blocks = 1;    compptr->MCU_sample_width = compptr->DCT_scaled_size;    compptr->last_col_width = 1;    /* For noninterleaved scans, it is convenient to define last_row_height     * as the number of block rows present in the last iMCU row.     */    tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);    if (tmp == 0) tmp = compptr->v_samp_factor;    compptr->last_row_height = tmp;        /* Prepare array describing MCU composition */    cinfo->blocks_in_MCU = 1;    cinfo->MCU_membership[0] = 0;      } else {        /* Interleaved (multi-component) scan */    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,	       MAX_COMPS_IN_SCAN);        /* Overall image size in MCUs */    cinfo->MCUs_per_row = (JDIMENSION)      jdiv_round_up((long) cinfo->image_width,		    (long) (cinfo->max_h_samp_factor*DCTSIZE));    cinfo->MCU_rows_in_scan = (JDIMENSION)      jdiv_round_up((long) cinfo->image_height,		    (long) (cinfo->max_v_samp_factor*DCTSIZE));        cinfo->blocks_in_MCU = 0;        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {      compptr = cinfo->cur_comp_info[ci];      /* Sampling factors give # of blocks of component in each MCU */      compptr->MCU_width = compptr->h_samp_factor;      compptr->MCU_height = compptr->v_samp_factor;      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;      compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_scaled_size;      /* Figure number of non-dummy blocks in last MCU column & row */      tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);      if (tmp == 0) tmp = compptr->MCU_width;      compptr->last_col_width = tmp;      tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);      if (tmp == 0) tmp = compptr->MCU_height;      compptr->last_row_height = tmp;      /* Prepare array describing MCU composition */      mcublks = compptr->MCU_blocks;      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)	ERREXIT(cinfo, JERR_BAD_MCU_SIZE);      while (mcublks-- > 0) {	cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;      }    }      }}
开发者ID:jprothwell,项目名称:sc-fix,代码行数:75,


示例13: jpeg_set_colorspace

//.........这里部分代码省略.........   */  cinfo->jpeg_color_space = colorspace;  cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */  cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */    /* Fix the bit width stuff here, by now cinfo->data_precision should be set */  if (2 > cinfo->data_precision || cinfo->data_precision > 16)    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);  if (!cinfo->lossless) {    if (cinfo->data_precision <=8) {      if (cinfo->data_precision !=8) {        WARNMS2(cinfo, JWRN_JPEG_PRECISION_CHANGED, cinfo->data_precision, 8);        cinfo->data_precision = 8;      }    } else if (cinfo->data_precision != 12) {      WARNMS2(cinfo, JWRN_JPEG_PRECISION_CHANGED, cinfo->data_precision, 12);      cinfo->data_precision = 12;    }  }  cinfo->maxjsample = (1 << cinfo->data_precision) - 1;  cinfo->centerjsample = (cinfo->maxjsample + 1)/2;#ifdef HAVE_GETJSAMPLE_MASK  cinfo->maskjsample = cinfo->maxjsample;#endif  /* The standard Huffman tables are only valid for 8-bit data precision.   * If the precision is higher, force optimization on so that usable   * tables will be computed.  This test can be removed if default tables   * are supplied that are valid for the desired precision.   */  if (cinfo->data_precision != 8)    cinfo->optimize_coding = TRUE;  switch (colorspace) {  case JCS_GRAYSCALE:    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */    cinfo->num_components = 1;    /* JFIF specifies component ID 1 */    SET_COMP(0, 1, 1,1, 0, 0,0);    break;  case JCS_RGB:    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */    cinfo->num_components = 3;    SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0);    SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0);    SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0);    break;  case JCS_YCbCr:    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */    cinfo->num_components = 3;    /* JFIF specifies component IDs 1,2,3 */    if (cinfo->lossless) {      SET_COMP(0, 1, 1,1, 0, 0,0);      SET_COMP(1, 2, 1,1, 1, 1,1);      SET_COMP(2, 3, 1,1, 1, 1,1);    } else { /* lossy */      /* We default to 2x2 subsamples of chrominance */      SET_COMP(0, 1, 2,2, 0, 0,0);      SET_COMP(1, 2, 1,1, 1, 1,1);      SET_COMP(2, 3, 1,1, 1, 1,1);    }    break;  case JCS_CMYK:    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */    cinfo->num_components = 4;    SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0);    SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0);    SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0);    SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0);    break;  case JCS_YCCK:    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */    cinfo->num_components = 4;    if (cinfo->lossless) {      SET_COMP(0, 1, 1,1, 0, 0,0);      SET_COMP(1, 2, 1,1, 1, 1,1);      SET_COMP(2, 3, 1,1, 1, 1,1);      SET_COMP(3, 4, 1,1, 0, 0,0);    } else { /* lossy */      SET_COMP(0, 1, 2,2, 0, 0,0);      SET_COMP(1, 2, 1,1, 1, 1,1);      SET_COMP(2, 3, 1,1, 1, 1,1);      SET_COMP(3, 4, 2,2, 0, 0,0);    }    break;  case JCS_UNKNOWN:    cinfo->num_components = cinfo->input_components;    if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,	       MAX_COMPONENTS);    for (ci = 0; ci < cinfo->num_components; ci++) {      SET_COMP(ci, ci, 1,1, 0, 0,0);    }    break;  default:    ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);  }}
开发者ID:msabhijith,项目名称:dgate,代码行数:101,


示例14: read_freiburg

//.........这里部分代码省略.........  do {	/* Files from which only the parameter part exists are rejected */   int div100=local_arg->current_trigger/100, mod100=local_arg->current_trigger%100;   snprintf(newfilename, NEWFILENAME_SIZE, "%s%c%s%02d%c%c%s%02d%02d", args[ARGS_IFILE].arg.s, PATHSEP, last_component, div100, PATHSEP, tolower(expnumber[-1]), expnumber, div100, mod100);   TRACEMS1(tinfo->emethods, 1, "read_freiburg: Constructed filename %s/n", MSGPARM(newfilename));   if((infile=fopen(newfilename,"rb"))==NULL) {    if (local_arg->current_trigger==0) {     ERREXIT1(tinfo->emethods, "read_freiburg: Can't open file %s/n", MSGPARM(newfilename));    } else {     return NULL;    }   }   fseek(infile, 0, SEEK_END);   length_of_data=ftell(infile)-FREIBURG_HEADER_LENGTH;   local_arg->current_trigger++;  } while (length_of_data==0 || --local_arg->fromepoch>0);  snprintf(comment, MAX_COMMENTLEN, "Freiburg-raw %s", last_component);  /*}}}  */ } /*{{{  Read the 64-Byte header*/ fseek(infile, 0, SEEK_SET); fread(header, 1, FREIBURG_HEADER_LENGTH, infile); for (i=0; i<18; i++) {# ifdef LITTLE_ENDIAN  Intel_int16((uint16_t *)&header[i]);# endif  TRACEMS2(tinfo->emethods, 3, "read_freiburg: Header %02d: %d/n", MSGPARM(i), MSGPARM(header[i])); } /*}}}  */ if (local_arg->average_mode) {  if ((length_of_data/sizeof(short))%local_arg->nr_of_channels!=0) {   ERREXIT2(tinfo->emethods, "read_freiburg: length_of_data=%d does not fit with nr_of_channels=%d/n", MSGPARM(length_of_data), MSGPARM(local_arg->nr_of_channels));  }  tinfo->nr_of_points=(length_of_data/sizeof(short))/local_arg->nr_of_channels;  local_arg->sfreq=(args[ARGS_SFREQ].is_set ? args[ARGS_SFREQ].arg.d : 200.0); /* The most likely value */ } else {  local_arg->nr_of_channels=header[14];  /* Note: In a lot of experiments, one point MORE is available in the data   * than specified in the header, but this occurs erratically. We could only   * check for this during decompression, but that's probably too much fuss. */  tinfo->nr_of_points=header[16]/header[15];  local_arg->sfreq=(args[ARGS_SFREQ].is_set ? args[ARGS_SFREQ].arg.d : 1000.0/header[15]); } tinfo->sfreq=local_arg->sfreq; /*{{{  Parse arguments that can be in seconds*/ local_arg->offset=(args[ARGS_OFFSET].is_set ? gettimeslice(tinfo, args[ARGS_OFFSET].arg.s) : 0); /*}}}  */ tinfo->beforetrig= -local_arg->offset; tinfo->aftertrig=tinfo->nr_of_points+local_arg->offset; /*{{{  Configure myarray*/ myarray.element_skip=tinfo->itemsize=1; myarray.nr_of_vectors=tinfo->nr_of_points; myarray.nr_of_elements=tinfo->nr_of_channels=local_arg->nr_of_channels; if (array_allocate(&myarray)==NULL) {  ERREXIT(tinfo->emethods, "read_freiburg: Error allocating data/n"); } tinfo->multiplexed=TRUE; /*}}}  */ fseek(infile, FREIBURG_HEADER_LENGTH, SEEK_SET); if (local_arg->average_mode) {  /*{{{  Read averaged epoch*/  for (point=0; point<tinfo->nr_of_points; point++) {
开发者ID:berndf,项目名称:avg_q,代码行数:67,


示例15: select_scan_parameters

select_scan_parameters (j_compress_ptr cinfo)/* Set up the scan parameters for the current scan */{  int ci;#ifdef C_MULTISCAN_FILES_SUPPORTED  my_master_ptr master = (my_master_ptr) cinfo->master;  if (master->pass_number < master->pass_number_scan_opt_base) {    cinfo->comps_in_scan = 1;    if (cinfo->use_scans_in_trellis) {      cinfo->cur_comp_info[0] = &cinfo->comp_info[master->pass_number/(4*cinfo->trellis_num_loops)];      cinfo->Ss = (master->pass_number%4 < 2) ? 1 : cinfo->trellis_freq_split+1;      cinfo->Se = (master->pass_number%4 < 2) ? cinfo->trellis_freq_split : DCTSIZE2-1;    } else {      cinfo->cur_comp_info[0] = &cinfo->comp_info[master->pass_number/(2*cinfo->trellis_num_loops)];      cinfo->Ss = 1;      cinfo->Se = DCTSIZE2-1;    }  }  else if (cinfo->scan_info != NULL) {    /* Prepare for current scan --- the script is already validated */    const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number;    cinfo->comps_in_scan = scanptr->comps_in_scan;    for (ci = 0; ci < scanptr->comps_in_scan; ci++) {      cinfo->cur_comp_info[ci] =	&cinfo->comp_info[scanptr->component_index[ci]];    }    cinfo->Ss = scanptr->Ss;    cinfo->Se = scanptr->Se;    cinfo->Ah = scanptr->Ah;    cinfo->Al = scanptr->Al;    if (cinfo->optimize_scans) {      /* luma frequency split passes */      if (master->scan_number >= cinfo->num_scans_luma_dc+3*cinfo->Al_max_luma+2 &&          master->scan_number < cinfo->num_scans_luma)        cinfo->Al = master->best_Al_luma;      /* chroma frequency split passes */      if (master->scan_number >= cinfo->num_scans_luma+cinfo->num_scans_chroma_dc+(6*cinfo->Al_max_chroma+4) &&          master->scan_number < cinfo->num_scans)        cinfo->Al = master->best_Al_chroma;    }    /* save value for later retrieval during printout of scans */    master->actual_Al[master->scan_number] = cinfo->Al;  }  else#endif  {    /* Prepare for single sequential-JPEG scan containing all components */    if (cinfo->num_components > MAX_COMPS_IN_SCAN)      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,	       MAX_COMPS_IN_SCAN);    cinfo->comps_in_scan = cinfo->num_components;    for (ci = 0; ci < cinfo->num_components; ci++) {      cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];    }    cinfo->Ss = 0;    cinfo->Se = DCTSIZE2-1;    cinfo->Ah = 0;    cinfo->Al = 0;  }}
开发者ID:Mr1024,项目名称:mozjpeg,代码行数:62,


示例16: read_freiburg_init

//.........这里部分代码省略.........    /* Count the points in the last segment */    {     array myarray;     int length_of_last_segment=0;     myarray.element_skip=tinfo->itemsize=1;     myarray.nr_of_vectors=1;     myarray.nr_of_elements=local_arg->nr_of_channels;     if (array_allocate(&myarray)==NULL) {      ERREXIT(tinfo->emethods, "read_freiburg_init: Error allocating myarray/n");     }     fseek(infile, ((long *)local_arg->segment_table.buffer_start)[local_arg->segment_table.current_length/sizeof(long)-1], SEEK_SET);     //printf("Seeking to %ld/n", ((long *)local_arg->segment_table.buffer_start)[local_arg->segment_table.current_length/sizeof(long)-1]);     tinfo->nr_of_channels=local_arg->nr_of_channels; /* This is used by freiburg_get_segment_init! */     freiburg_get_segment_init(tinfo);     while (freiburg_get_segment(tinfo, &myarray)==0) length_of_last_segment++;     freiburg_get_segment_free(tinfo);     tinfo->points_in_file+=length_of_last_segment;     TRACEMS1(tinfo->emethods, 1, "read_freiburg_init: Last segment has %ld points/n",length_of_last_segment);     array_free(&myarray);    }   }   if (local_arg->channelnames==NULL && local_arg->btfile.text[0]=='/0') {    local_arg->in_channels= &goeppi_channels[0];    TRACEMS(tinfo->emethods, 0, "read_freiburg_init: Assuming Goeppingen style setup!/n");   }   local_arg->continuous_type=SLEEP_BT_TYPE;   TRACEMS(tinfo->emethods, 1, "read_freiburg_init: Opened file in BT format/n");  } else {   if((infile=fopen(args[ARGS_IFILE].arg.s,"rb"))==NULL) {    ERREXIT1(tinfo->emethods, "read_freiburg_init: Can't open file %s/n", MSGPARM(args[ARGS_IFILE].arg.s));   }   if (args[ARGS_REPAIR_OFFSET].is_set) {    fseek(infile, args[ARGS_REPAIR_OFFSET].arg.i, SEEK_SET);   } else {   if (read_struct((char *)&local_arg->btfile, sm_BT_file, infile)==0) {    ERREXIT1(tinfo->emethods, "read_freiburg_init: Header read error in file %s/n", MSGPARM(args[ARGS_IFILE].arg.s));   }#  ifdef LITTLE_ENDIAN   change_byteorder((char *)&local_arg->btfile, sm_BT_file);#  endif   }   local_arg->continuous_type=SLEEP_KL_TYPE;   /* Year and day are swapped in KL format with respect to BT format... */   {short buf=local_arg->btfile.start_year; local_arg->btfile.start_year=local_arg->btfile.start_day; local_arg->btfile.start_day=buf;}   /* Well, sometimes or most of the time, in KL files the sampling interval     * was not set correctly... */   if (!args[ARGS_SFREQ].is_set && local_arg->btfile.sampling_interval_us!=9765 && local_arg->btfile.sampling_interval_us!=9766) {    TRACEMS1(tinfo->emethods, 0, "read_freiburg_init: sampling_interval_us was %d, corrected!/n", MSGPARM(local_arg->btfile.sampling_interval_us));    local_arg->btfile.sampling_interval_us=9766;   }   TRACEMS(tinfo->emethods, 1, "read_freiburg_init: Opened file in KL format/n");  }  if (args[ARGS_REPAIR_CHANNELS].is_set) local_arg->btfile.nr_of_channels=args[ARGS_REPAIR_CHANNELS].arg.i;  tinfo->nr_of_channels=local_arg->btfile.nr_of_channels;  if (tinfo->nr_of_channels<=0 || tinfo->nr_of_channels>MAX_NUMBER_OF_CHANNELS_IN_EP) {   ERREXIT1(tinfo->emethods, "read_freiburg_init: Impossible: %d channels?/n", MSGPARM(tinfo->nr_of_channels));  }  if (local_arg->nr_of_channels==0) {   local_arg->nr_of_channels=tinfo->nr_of_channels;  } else {   if (local_arg->nr_of_channels!=tinfo->nr_of_channels) {    ERREXIT2(tinfo->emethods, "read_freiburg_init: Setup has %d channels, but the file has %d!/n", MSGPARM(local_arg->nr_of_channels), MSGPARM(tinfo->nr_of_channels));   }  }  local_arg->sfreq=(args[ARGS_SFREQ].is_set ? args[ARGS_SFREQ].arg.d : 1.0e6/local_arg->btfile.sampling_interval_us);  tinfo->sfreq=local_arg->sfreq;  if (tinfo->sfreq<=0.0 || tinfo->sfreq>MAX_POSSIBLE_SFREQ) {   ERREXIT1(tinfo->emethods, "read_freiburg_init: Impossible: sfreq=%gHz?/n", MSGPARM(tinfo->sfreq));  }  /*{{{  Parse arguments that can be in seconds*/  tinfo->nr_of_points=gettimeslice(tinfo, args[ARGS_NCHANNELS].arg.s);  if (tinfo->nr_of_points<=0) {   /* Read the whole file as one epoch */   TRACEMS1(tinfo->emethods, 1, "read_freiburg_init: Reading %ld points/n",tinfo->points_in_file);   tinfo->nr_of_points=tinfo->points_in_file;  }  local_arg->offset=(args[ARGS_OFFSET].is_set ? gettimeslice(tinfo, args[ARGS_OFFSET].arg.s) : 0);  local_arg->epochlength=tinfo->nr_of_points;  /*}}}  */  tinfo->beforetrig= -local_arg->offset;  tinfo->aftertrig=tinfo->nr_of_points+local_arg->offset;  /*}}}  */ } else {  local_arg->in_channels= &freiburg_channels[0];  local_arg->current_trigger=0;  if (stat(args[ARGS_IFILE].arg.s, &statbuf)!=0) {   ERREXIT1(tinfo->emethods, "read_freiburg_init: Can't stat file %s/n", MSGPARM(args[ARGS_IFILE].arg.s));  }  local_arg->nr_of_channels=atoi(args[ARGS_NCHANNELS].arg.s);  /* average mode if the name does not belong to a directory */  local_arg->average_mode= !S_ISDIR(statbuf.st_mode);  tinfo->nr_of_channels=MAX_NUMBER_OF_CHANNELS_IN_EP; } freiburg_get_segment_init(tinfo); local_arg->current_point=0; tinfo->methods->init_done=TRUE;}
开发者ID:berndf,项目名称:avg_q,代码行数:101,


示例17: jpeg_CreateDecompress

jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize){  int i;  /* Guard against version mismatches between library and caller. */  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */  if (version != JPEG_LIB_VERSION)    ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);  if (structsize != sizeof(struct jpeg_decompress_struct))    ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,             (int) sizeof(struct jpeg_decompress_struct), (int) structsize);  /* For debugging purposes, we zero the whole master structure.   * But the application has already set the err pointer, and may have set   * client_data, so we have to save and restore those fields.   * Note: if application hasn't set client_data, tools like Purify may   * complain here.   */  {    struct jpeg_error_mgr * err = cinfo->err;    void * client_data = cinfo->client_data; /* ignore Purify complaint here */    MEMZERO(cinfo, sizeof(struct jpeg_decompress_struct));    cinfo->err = err;    cinfo->client_data = client_data;  }  cinfo->is_decompressor = TRUE;  /* Initialize a memory manager instance for this object */  jinit_memory_mgr((j_common_ptr) cinfo);  /* Zero out pointers to permanent structures. */  cinfo->progress = NULL;  cinfo->src = NULL;  for (i = 0; i < NUM_QUANT_TBLS; i++)    cinfo->quant_tbl_ptrs[i] = NULL;  for (i = 0; i < NUM_HUFF_TBLS; i++) {    cinfo->dc_huff_tbl_ptrs[i] = NULL;    cinfo->ac_huff_tbl_ptrs[i] = NULL;  }  /* Initialize marker processor so application can override methods   * for COM, APPn markers before calling jpeg_read_header.   */  cinfo->marker_list = NULL;  jinit_marker_reader(cinfo);  /* And initialize the overall input controller. */  jinit_input_controller(cinfo);  /* OK, I'm ready */  cinfo->global_state = DSTATE_START;  /* The master struct is used to store extension parameters, so we allocate it   * here.   */  LOGI("=========%s:%d", __func__,  __LINE__);  cinfo->master = (struct jpeg_decomp_master *)      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,                                  sizeof(my_decomp_master));  LOGI("=========%s:%d", __func__, __LINE__);  MEMZERO(cinfo->master, sizeof(my_decomp_master));}
开发者ID:siwenhu,项目名称:gitStudy,代码行数:64,


示例18: jpeg_set_colorspace

jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace){  jpeg_component_info * compptr;  int ci;#define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl)  /  (compptr = &cinfo->comp_info[index], /   compptr->component_id = (id), /   compptr->h_samp_factor = (hsamp), /   compptr->v_samp_factor = (vsamp), /   compptr->quant_tbl_no = (quant), /   compptr->dc_tbl_no = (dctbl), /   compptr->ac_tbl_no = (actbl) )    if (cinfo->global_state != CSTATE_START)    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);  cinfo->jpeg_color_space = colorspace;  cinfo->write_JFIF_header = FALSE;   cinfo->write_Adobe_marker = FALSE;   switch (colorspace) {  case JCS_GRAYSCALE:    cinfo->write_JFIF_header = TRUE;     cinfo->num_components = 1;        SET_COMP(0, 1, 1,1, 0, 0,0);    break;  case JCS_RGB:    cinfo->write_Adobe_marker = TRUE;     cinfo->num_components = 3;    SET_COMP(0, 0x52 , 1,1, 0, 0,0);    SET_COMP(1, 0x47 , 1,1, 0, 0,0);    SET_COMP(2, 0x42 , 1,1, 0, 0,0);    break;  case JCS_YCbCr:    cinfo->write_JFIF_header = TRUE;     cinfo->num_components = 3;            SET_COMP(0, 1, 2,2, 0, 0,0);    SET_COMP(1, 2, 1,1, 1, 1,1);    SET_COMP(2, 3, 1,1, 1, 1,1);    break;  case JCS_CMYK:    cinfo->write_Adobe_marker = TRUE;     cinfo->num_components = 4;    SET_COMP(0, 0x43 , 1,1, 0, 0,0);    SET_COMP(1, 0x4D , 1,1, 0, 0,0);    SET_COMP(2, 0x59 , 1,1, 0, 0,0);    SET_COMP(3, 0x4B , 1,1, 0, 0,0);    break;  case JCS_YCCK:    cinfo->write_Adobe_marker = TRUE;     cinfo->num_components = 4;    SET_COMP(0, 1, 2,2, 0, 0,0);    SET_COMP(1, 2, 1,1, 1, 1,1);    SET_COMP(2, 3, 1,1, 1, 1,1);    SET_COMP(3, 4, 2,2, 0, 0,0);    break;  case JCS_UNKNOWN:    cinfo->num_components = cinfo->input_components;    if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,	       MAX_COMPONENTS);    for (ci = 0; ci < cinfo->num_components; ci++) {      SET_COMP(ci, ci, 1,1, 0, 0,0);    }    break;  default:    ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);  }}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:76,


示例19: validate_script

validate_script (j_compress_ptr cinfo)/* Verify that the scan script in cinfo->scan_info[] is valid; also * determine whether it uses progressive JPEG, and set cinfo->progressive_mode. */{  const jpeg_scan_info * scanptr;  int scanno, ncomps, ci, coefi, thisi;  int Ss, Se, Ah, Al;  boolean component_sent[MAX_COMPONENTS];#ifdef C_PROGRESSIVE_SUPPORTED  int * last_bitpos_ptr;  int last_bitpos[MAX_COMPONENTS][DCTSIZE2];  /* -1 until that coefficient has been seen; then last Al for it */#endif  if (cinfo->num_scans <= 0)    ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0);  /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1;   * for progressive JPEG, no scan can have this.   */  scanptr = cinfo->scan_info;  if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2-1) {#ifdef C_PROGRESSIVE_SUPPORTED    cinfo->progressive_mode = TRUE;    last_bitpos_ptr = & last_bitpos[0][0];    for (ci = 0; ci < cinfo->num_components; ci++)      for (coefi = 0; coefi < DCTSIZE2; coefi++)        *last_bitpos_ptr++ = -1;#else    ERREXIT(cinfo, JERR_NOT_COMPILED);#endif  } else {    cinfo->progressive_mode = FALSE;    for (ci = 0; ci < cinfo->num_components; ci++)      component_sent[ci] = FALSE;  }  for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) {    /* Validate component indexes */    ncomps = scanptr->comps_in_scan;    if (ncomps <= 0 || ncomps > MAX_COMPS_IN_SCAN)      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN);    for (ci = 0; ci < ncomps; ci++) {      thisi = scanptr->component_index[ci];      if (thisi < 0 || thisi >= cinfo->num_components)        ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);      /* Components must appear in SOF order within each scan */      if (ci > 0 && thisi <= scanptr->component_index[ci-1])        ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);    }    /* Validate progression parameters */    Ss = scanptr->Ss;    Se = scanptr->Se;    Ah = scanptr->Ah;    Al = scanptr->Al;    if (cinfo->progressive_mode) {#ifdef C_PROGRESSIVE_SUPPORTED      /* The JPEG spec simply gives the ranges 0..13 for Ah and Al, but that       * seems wrong: the upper bound ought to depend on data precision.       * Perhaps they really meant 0..N+1 for N-bit precision.       * Here we allow 0..10 for 8-bit data; Al larger than 10 results in       * out-of-range reconstructed DC values during the first DC scan,       * which might cause problems for some decoders.       */#if BITS_IN_JSAMPLE == 8#define MAX_AH_AL 10#else#define MAX_AH_AL 13#endif      if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||          Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL)        ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);      if (Ss == 0) {        if (Se != 0)            /* DC and AC together not OK */          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);      } else {        if (ncomps != 1)        /* AC scans must be for only one component */          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);      }      for (ci = 0; ci < ncomps; ci++) {        last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0];        if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);        for (coefi = Ss; coefi <= Se; coefi++) {          if (last_bitpos_ptr[coefi] < 0) {            /* first scan of this coefficient */            if (Ah != 0)              ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);          } else {            /* not first scan */            if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1)              ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);          }          last_bitpos_ptr[coefi] = Al;        }      }#endif    } else {      /* For sequential JPEG, all progression parameters must be these: *///.........这里部分代码省略.........
开发者ID:jcyfkimi,项目名称:libjpeg-turbo,代码行数:101,


示例20: jpeg_copy_critical_parameters

jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,			       j_compress_ptr dstinfo){  JQUANT_TBL ** qtblptr;  jpeg_component_info *incomp, *outcomp;  JQUANT_TBL *c_quant, *slot_quant;  int tblno, ci, coefi;  /* Safety check to ensure start_compress not called yet. */  if (dstinfo->global_state != CSTATE_START)    ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state);  /* Copy fundamental image dimensions */  dstinfo->image_width = srcinfo->image_width;  dstinfo->image_height = srcinfo->image_height;  dstinfo->input_components = srcinfo->num_components;  dstinfo->in_color_space = srcinfo->jpeg_color_space;  /* Initialize all parameters to default values */  jpeg_set_defaults(dstinfo);  /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.   * Fix it to get the right header markers for the image colorspace.   */  jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);  dstinfo->data_precision = srcinfo->data_precision;  dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;  /* Copy the source's quantization tables. */  for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {    if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {      qtblptr = & dstinfo->quant_tbl_ptrs[tblno];      if (*qtblptr == NULL)	*qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);      MEMCOPY((*qtblptr)->quantval,	      srcinfo->quant_tbl_ptrs[tblno]->quantval,	      SIZEOF((*qtblptr)->quantval));      (*qtblptr)->sent_table = FALSE;    }  }  /* Copy the source's per-component info.   * Note we assume jpeg_set_defaults has allocated the dest comp_info array.   */  dstinfo->num_components = srcinfo->num_components;  if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)    ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,	     MAX_COMPONENTS);  for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;       ci < dstinfo->num_components; ci++, incomp++, outcomp++) {    outcomp->component_id = incomp->component_id;    outcomp->h_samp_factor = incomp->h_samp_factor;    outcomp->v_samp_factor = incomp->v_samp_factor;    outcomp->quant_tbl_no = incomp->quant_tbl_no;    /* Make sure saved quantization table for component matches the qtable     * slot.  If not, the input file re-used this qtable slot.     * IJG encoder currently cannot duplicate this.     */    tblno = outcomp->quant_tbl_no;    if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||	srcinfo->quant_tbl_ptrs[tblno] == NULL)      ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);    slot_quant = srcinfo->quant_tbl_ptrs[tblno];    c_quant = incomp->quant_table;    if (c_quant != NULL) {      for (coefi = 0; coefi < DCTSIZE2; coefi++) {	if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])	  ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);      }    }    /* Note: we do not copy the source's Huffman table assignments;     * instead we rely on jpeg_set_colorspace to have made a suitable choice.     */  }  /* Also copy JFIF version and resolution information, if available.   * Strictly speaking this isn't "critical" info, but it's nearly   * always appropriate to copy it if available.  In particular,   * if the application chooses to copy JFIF 1.02 extension markers from   * the source file, we need to copy the version to make sure we don't   * emit a file that has 1.02 extensions but a claimed version of 1.01.   * We will *not*, however, copy version info from mislabeled "2.01" files.   */  if (srcinfo->saw_JFIF_marker) {    if (srcinfo->JFIF_major_version == 1) {      dstinfo->JFIF_major_version = srcinfo->JFIF_major_version;      dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version;    }    dstinfo->density_unit = srcinfo->density_unit;    dstinfo->X_density = srcinfo->X_density;    dstinfo->Y_density = srcinfo->Y_density;  }}
开发者ID:svn2github,项目名称:htmldoc,代码行数:87,


示例21: prepare_for_pass

METHODDEF voidprepare_for_pass (j_compress_ptr cinfo){  my_master_ptr master = (my_master_ptr) cinfo->master;  int ci;  int npasses;  /* ???? JUST A QUICK CROCK FOR NOW ??? */  /* For now, handle only single interleaved output scan; */  /* we support two passes for Huffman optimization. */  /* Prepare for single scan containing all components */  if (cinfo->num_components > MAX_COMPS_IN_SCAN)    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,	     MAX_COMPS_IN_SCAN);  cinfo->comps_in_scan = cinfo->num_components;  for (ci = 0; ci < cinfo->num_components; ci++) {    cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];  }  per_scan_setup(cinfo);  if (! cinfo->optimize_coding) {    /* Standard single-pass case */    npasses = 1;    master->pub.call_pass_startup = TRUE;    master->pub.is_last_pass = TRUE;    if (! cinfo->raw_data_in) {      (*cinfo->cconvert->start_pass) (cinfo);      (*cinfo->downsample->start_pass) (cinfo);      (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU);    }    (*cinfo->fdct->start_pass) (cinfo);    (*cinfo->entropy->start_pass) (cinfo, FALSE);    (*cinfo->coef->start_pass) (cinfo, JBUF_PASS_THRU);    (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);  } else {    npasses = 2;    switch (master->pass_number) {    case 0:      /* Huffman optimization: run all modules, gather statistics */      master->pub.call_pass_startup = FALSE;      master->pub.is_last_pass = FALSE;      if (! cinfo->raw_data_in) {	(*cinfo->cconvert->start_pass) (cinfo);	(*cinfo->downsample->start_pass) (cinfo);	(*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU);      }      (*cinfo->fdct->start_pass) (cinfo);      (*cinfo->entropy->start_pass) (cinfo, TRUE);      (*cinfo->coef->start_pass) (cinfo, JBUF_SAVE_AND_PASS);      (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);      break;    case 1:      /* Second pass: reread data from coefficient buffer */      master->pub.is_last_pass = TRUE;      (*cinfo->entropy->start_pass) (cinfo, FALSE);      (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);      /* We emit frame/scan headers now */      (*cinfo->marker->write_frame_header) (cinfo);      (*cinfo->marker->write_scan_header) (cinfo);      break;    }  }  /* Set up progress monitor's pass info if present */  if (cinfo->progress != NULL) {    cinfo->progress->completed_passes = master->pass_number;    cinfo->progress->total_passes = npasses;  }  master->pass_number++;}
开发者ID:8l,项目名称:csolve,代码行数:74,


示例22: start_output_rle

start_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo){  rle_dest_ptr dest = (rle_dest_ptr) dinfo;  size_t cmapsize;  int i, ci;#ifdef PROGRESS_REPORT  cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;#endif  /*   * Make sure the image can be stored in RLE format.   *   * - RLE stores image dimensions as *signed* 16 bit integers.  JPEG   *   uses unsigned, so we have to check the width.   *   * - Colorspace is expected to be grayscale or RGB.   *   * - The number of channels (components) is expected to be 1 (grayscale/   *   pseudocolor) or 3 (truecolor/directcolor).   *   (could be 2 or 4 if using an alpha channel, but we aren't)   */  if (cinfo->output_width > 32767 || cinfo->output_height > 32767)    ERREXIT2(cinfo, JERR_RLE_DIMENSIONS, cinfo->output_width,             cinfo->output_height);  if (cinfo->out_color_space != JCS_GRAYSCALE &&      cinfo->out_color_space != JCS_RGB)    ERREXIT(cinfo, JERR_RLE_COLORSPACE);  if (cinfo->output_components != 1 && cinfo->output_components != 3)    ERREXIT1(cinfo, JERR_RLE_TOOMANYCHANNELS, cinfo->num_components);  /* Convert colormap, if any, to RLE format. */  dest->colormap = NULL;  if (cinfo->quantize_colors) {    /* Allocate storage for RLE-style cmap, zero any extra entries */    cmapsize = cinfo->out_color_components * CMAPLENGTH * sizeof(rle_map);    dest->colormap = (rle_map *) (*cinfo->mem->alloc_small)      ((j_common_ptr) cinfo, JPOOL_IMAGE, cmapsize);    MEMZERO(dest->colormap, cmapsize);    /* Save away data in RLE format --- note 8-bit left shift! */    /* Shifting would need adjustment for JSAMPLEs wider than 8 bits. */    for (ci = 0; ci < cinfo->out_color_components; ci++) {      for (i = 0; i < cinfo->actual_number_of_colors; i++) {        dest->colormap[ci * CMAPLENGTH + i] =          GETJSAMPLE(cinfo->colormap[ci][i]) << 8;      }    }  }  /* Set the output buffer to the first row */  dest->pub.buffer = (*cinfo->mem->access_virt_sarray)    ((j_common_ptr) cinfo, dest->image, (JDIMENSION) 0, (JDIMENSION) 1, TRUE);  dest->pub.buffer_height = 1;  dest->pub.put_pixel_rows = rle_put_pixel_rows;#ifdef PROGRESS_REPORT  if (progress != NULL) {    progress->total_extra_passes++;  /* count file writing as separate pass */  }#endif}
开发者ID:jcyfkimi,项目名称:libjpeg-turbo,代码行数:67,


示例23: initial_setup

initial_setup (j_compress_ptr cinfo, boolean transcode_only)/* Do computations that are needed before master selection phase */{  int ci, ssize;  jpeg_component_info *compptr;  long samplesperrow;  JDIMENSION jd_samplesperrow;  if (transcode_only)    jpeg_calc_trans_dimensions(cinfo);  else    jpeg_calc_jpeg_dimensions(cinfo);  /* Sanity check on image dimensions */  if (cinfo->jpeg_height <= 0 || cinfo->jpeg_width <= 0 ||      cinfo->num_components <= 0 || cinfo->input_components <= 0)    ERREXIT(cinfo, JERR_EMPTY_IMAGE);  /* Make sure image isn't bigger than I can handle */  if ((long) cinfo->jpeg_height > (long) JPEG_MAX_DIMENSION ||      (long) cinfo->jpeg_width > (long) JPEG_MAX_DIMENSION)    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);  /* Width of an input scanline must be representable as JDIMENSION. */  samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components;  jd_samplesperrow = (JDIMENSION) samplesperrow;  if ((long) jd_samplesperrow != samplesperrow)    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);  /* For now, precision must match compiled-in value... */  if (cinfo->data_precision != BITS_IN_JSAMPLE)    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);  /* Check that number of components won't exceed internal array sizes */  if (cinfo->num_components > MAX_COMPONENTS)    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,	     MAX_COMPONENTS);  /* Compute maximum sampling factors; check factor validity */  cinfo->max_h_samp_factor = 1;  cinfo->max_v_samp_factor = 1;  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;       ci++, compptr++) {    if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||	compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)      ERREXIT(cinfo, JERR_BAD_SAMPLING);    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,				   compptr->h_samp_factor);    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,				   compptr->v_samp_factor);  }  /* Compute dimensions of components */  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;       ci++, compptr++) {    /* Fill in the correct component_index value; don't rely on application */    compptr->component_index = ci;    /* In selecting the actual DCT scaling for each component, we try to     * scale down the chroma components via DCT scaling rather than downsampling.     * This saves time if the downsampler gets to use 1:1 scaling.     * Note this code adapts subsampling ratios which are powers of 2.     */    ssize = 1;#ifdef DCT_SCALING_SUPPORTED    while (cinfo->min_DCT_h_scaled_size * ssize <=	   (cinfo->do_fancy_downsampling ? DCTSIZE : DCTSIZE / 2) &&	   (cinfo->max_h_samp_factor % (compptr->h_samp_factor * ssize * 2)) == 0) {      ssize = ssize * 2;    }#endif    compptr->DCT_h_scaled_size = cinfo->min_DCT_h_scaled_size * ssize;    ssize = 1;#ifdef DCT_SCALING_SUPPORTED    while (cinfo->min_DCT_v_scaled_size * ssize <=	   (cinfo->do_fancy_downsampling ? DCTSIZE : DCTSIZE / 2) &&	   (cinfo->max_v_samp_factor % (compptr->v_samp_factor * ssize * 2)) == 0) {      ssize = ssize * 2;    }#endif    compptr->DCT_v_scaled_size = cinfo->min_DCT_v_scaled_size * ssize;    /* We don't support DCT ratios larger than 2. */    if (compptr->DCT_h_scaled_size > compptr->DCT_v_scaled_size * 2)	compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size * 2;    else if (compptr->DCT_v_scaled_size > compptr->DCT_h_scaled_size * 2)	compptr->DCT_v_scaled_size = compptr->DCT_h_scaled_size * 2;    /* Size in DCT blocks */    compptr->width_in_blocks = (JDIMENSION)      jdiv_round_up((long) cinfo->jpeg_width * (long) compptr->h_samp_factor,		    (long) (cinfo->max_h_samp_factor * cinfo->block_size));    compptr->height_in_blocks = (JDIMENSION)      jdiv_round_up((long) cinfo->jpeg_height * (long) compptr->v_samp_factor,		    (long) (cinfo->max_v_samp_factor * cinfo->block_size));    /* Size in samples */    compptr->downsampled_width = (JDIMENSION)      jdiv_round_up((long) cinfo->jpeg_width *		    (long) (compptr->h_samp_factor * compptr->DCT_h_scaled_size),		    (long) (cinfo->max_h_samp_factor * cinfo->block_size));    compptr->downsampled_height = (JDIMENSION)//.........这里部分代码省略.........
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:101,


示例24: initial_setup

initial_setup (j_decompress_ptr cinfo)/* Called once, when first SOS marker is reached */{  int ci;  jpeg_component_info *compptr;  if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||      (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);  /* For now, precision must match compiled-in value... */  if (cinfo->data_precision != BITS_IN_JSAMPLE)    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);  /* Check that number of components won't exceed internal array sizes */  if (cinfo->num_components > MAX_COMPONENTS)    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,	     MAX_COMPONENTS);  /* Compute maximum sampling factors; check factor validity */  cinfo->max_h_samp_factor = 1;  cinfo->max_v_samp_factor = 1;  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;       ci++, compptr++) {    if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||	compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)      ERREXIT(cinfo, JERR_BAD_SAMPLING);    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,				   compptr->h_samp_factor);    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,				   compptr->v_samp_factor);  }  /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.   * In the full decompressor, this will be overridden by jdmaster.c;   * but in the transcoder, jdmaster.c is not used, so we must do it here.   */  cinfo->min_DCT_scaled_size = DCTSIZE;  /* Compute dimensions of components */  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;       ci++, compptr++) {    compptr->DCT_scaled_size = DCTSIZE;    /* Size in DCT blocks */    compptr->width_in_blocks = (JDIMENSION)      jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,		    (long) (cinfo->max_h_samp_factor * DCTSIZE));    compptr->height_in_blocks = (JDIMENSION)      jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,		    (long) (cinfo->max_v_samp_factor * DCTSIZE));    /* downsampled_width and downsampled_height will also be overridden by     * jdmaster.c if we are doing full decompression.  The transcoder library     * doesn't use these values, but the calling application might.     */    /* Size in samples */    compptr->downsampled_width = (JDIMENSION)      jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,		    (long) cinfo->max_h_samp_factor);    compptr->downsampled_height = (JDIMENSION)      jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,		    (long) cinfo->max_v_samp_factor);    /* Mark component needed, until color conversion says otherwise */    compptr->component_needed = TRUE;    /* Mark no quantization table yet saved for component */    compptr->quant_table = NULL;  }  /* Compute number of fully interleaved MCU rows. */  cinfo->total_iMCU_rows = (JDIMENSION)    jdiv_round_up((long) cinfo->image_height,		  (long) (cinfo->max_v_samp_factor*DCTSIZE));  /* Decide whether file contains multiple scans */  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)    cinfo->inputctl->has_multiple_scans = TRUE;  else    cinfo->inputctl->has_multiple_scans = FALSE;}
开发者ID:jprothwell,项目名称:sc-fix,代码行数:77,


示例25: start_pass

//.........这里部分代码省略.........      method = JDCT_ISLOW;	/* jidctint uses islow-style table */      break;    case ((1 << 8) + 2):      method_ptr = jpeg_idct_1x2;      method = JDCT_ISLOW;	/* jidctint uses islow-style table */      break;#endif    case ((DCTSIZE << 8) + DCTSIZE):      switch (cinfo->dct_method) {#ifdef DCT_ISLOW_SUPPORTED      case JDCT_ISLOW:	method_ptr = jpeg_idct_islow;	method = JDCT_ISLOW;	break;#endif#ifdef DCT_IFAST_SUPPORTED      case JDCT_IFAST:	method_ptr = jpeg_idct_ifast;	method = JDCT_IFAST;	break;#endif#ifdef DCT_FLOAT_SUPPORTED      case JDCT_FLOAT:	method_ptr = jpeg_idct_float;	method = JDCT_FLOAT;	break;#endif      default:	ERREXIT(cinfo, JERR_NOT_COMPILED);	break;      }      break;    default:      ERREXIT2(cinfo, JERR_BAD_DCTSIZE,	       compptr->DCT_h_scaled_size, compptr->DCT_v_scaled_size);      break;    }    idct->pub.inverse_DCT[ci] = method_ptr;    /* Create multiplier table from quant table.     * However, we can skip this if the component is uninteresting     * or if we already built the table.  Also, if no quant table     * has yet been saved for the component, we leave the     * multiplier table all-zero; we'll be reading zeroes from the     * coefficient controller's buffer anyway.     */    if (! compptr->component_needed || idct->cur_method[ci] == method)      continue;    qtbl = compptr->quant_table;    if (qtbl == NULL)		/* happens if no data yet for component */      continue;    idct->cur_method[ci] = method;    switch (method) {#ifdef PROVIDE_ISLOW_TABLES    case JDCT_ISLOW:      {	/* For LL&M IDCT method, multipliers are equal to raw quantization	 * coefficients, but are stored as ints to ensure access efficiency.	 */	ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table;	for (i = 0; i < DCTSIZE2; i++) {	  ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i];	}      }      break;#endif#ifdef DCT_IFAST_SUPPORTED
开发者ID:mhernando,项目名称:SDL2_image,代码行数:67,


示例26: per_scan_setup

per_scan_setup (j_compress_ptr cinfo)/* Do computations that are needed before processing a JPEG scan *//* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */{  int ci, mcublks, tmp;  jpeg_component_info *compptr;  if (cinfo->comps_in_scan == 1) {    /* Noninterleaved (single-component) scan */    compptr = cinfo->cur_comp_info[0];    /* Overall image size in MCUs */    cinfo->MCUs_per_row = compptr->width_in_blocks;    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;    /* For noninterleaved scan, always one block per MCU */    compptr->MCU_width = 1;    compptr->MCU_height = 1;    compptr->MCU_blocks = 1;    compptr->MCU_sample_width = DCTSIZE;    compptr->last_col_width = 1;    /* For noninterleaved scans, it is convenient to define last_row_height     * as the number of block rows present in the last iMCU row.     */    tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);    if (tmp == 0) tmp = compptr->v_samp_factor;    compptr->last_row_height = tmp;    /* Prepare array describing MCU composition */    cinfo->blocks_in_MCU = 1;    cinfo->MCU_membership[0] = 0;  } else {    /* Interleaved (multi-component) scan */    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,               MAX_COMPS_IN_SCAN);    /* Overall image size in MCUs */    cinfo->MCUs_per_row = (JDIMENSION)      jdiv_round_up((long) cinfo->_jpeg_width,                    (long) (cinfo->max_h_samp_factor*DCTSIZE));    cinfo->MCU_rows_in_scan = (JDIMENSION)      jdiv_round_up((long) cinfo->_jpeg_height,                    (long) (cinfo->max_v_samp_factor*DCTSIZE));    cinfo->blocks_in_MCU = 0;    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {      compptr = cinfo->cur_comp_info[ci];      /* Sampling factors give # of blocks of component in each MCU */      compptr->MCU_width = compptr->h_samp_factor;      compptr->MCU_height = compptr->v_samp_factor;      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;      compptr->MCU_sample_width = compptr->MCU_width * DCTSIZE;      /* Figure number of non-dummy blocks in last MCU column & row */      tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);      if (tmp == 0) tmp = compptr->MCU_width;      compptr->last_col_width = tmp;      tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);      if (tmp == 0) tmp = compptr->MCU_height;      compptr->last_row_height = tmp;      /* Prepare array describing MCU composition */      mcublks = compptr->MCU_blocks;      if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU)        ERREXIT(cinfo, JERR_BAD_MCU_SIZE);      while (mcublks-- > 0) {        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;      }    }  }  /* Convert restart specified in rows to actual MCU count. */  /* Note that count must fit in 16 bits, so we provide limiting. */  if (cinfo->restart_in_rows > 0) {    long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row;    cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L);  }}
开发者ID:jcyfkimi,项目名称:libjpeg-turbo,代码行数:82,


示例27: get_sof

LOCAL booleanget_sof (j_decompress_ptr cinfo)/* Process a SOFn marker */{  INT32 length;  int c, ci;  jpeg_component_info * compptr;  INPUT_VARS(cinfo);  INPUT_2BYTES(cinfo, length, return FALSE);  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);  length -= 8;  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,	   (int) cinfo->image_width, (int) cinfo->image_height,	   cinfo->num_components);  if (cinfo->marker->saw_SOF)    ERREXIT(cinfo, JERR_SOF_DUPLICATE);  /* We don't support files in which the image height is initially specified */  /* as 0 and is later redefined by DNL.  As long as we have to check that,  */  /* might as well have a general sanity check. */  if (cinfo->image_height <= 0 || cinfo->image_width <= 0      || cinfo->num_components <= 0)    ERREXIT(cinfo, JERR_EMPTY_IMAGE);  /* Make sure image isn't bigger than I can handle */  if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||      (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);  /* For now, precision must match compiled-in value... */  if (cinfo->data_precision != BITS_IN_JSAMPLE)    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);  /* Check that number of components won't exceed internal array sizes */  if (cinfo->num_components > MAX_COMPONENTS)    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,	     MAX_COMPONENTS);  if (length != (cinfo->num_components * 3))    ERREXIT(cinfo, JERR_BAD_LENGTH);  if (cinfo->comp_info == NULL)	/* do only once, even if suspend */    cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small)			((j_common_ptr) cinfo, JPOOL_IMAGE,			 cinfo->num_components * SIZEOF(jpeg_component_info));    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;       ci++, compptr++) {    compptr->component_index = ci;    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);    INPUT_BYTE(cinfo, c, return FALSE);    compptr->h_samp_factor = (c >> 4) & 15;    compptr->v_samp_factor = (c     ) & 15;    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,	     compptr->component_id, compptr->h_samp_factor,	     compptr->v_samp_factor, compptr->quant_tbl_no);  }  cinfo->marker->saw_SOF = TRUE;  INPUT_SYNC(cinfo);  return TRUE;}
开发者ID:Jonnyliu,项目名称:Rmtsvc,代码行数:73,


示例28: jpeg_set_colorspace

jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace){  jpeg_component_info * compptr;  int ci;#define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl)  /  (compptr = &cinfo->comp_info[index], /   compptr->component_id = (id), /   compptr->h_samp_factor = (hsamp), /   compptr->v_samp_factor = (vsamp), /   compptr->quant_tbl_no = (quant), /   compptr->dc_tbl_no = (dctbl), /   compptr->ac_tbl_no = (actbl) )  /* Safety check to ensure start_compress not called yet. */  if (cinfo->global_state != CSTATE_START)    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);  /* For all colorspaces, we use Q and Huff tables 0 for luminance components,   * tables 1 for chrominance components.   */  cinfo->jpeg_color_space = colorspace;  cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */  cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */  switch (colorspace) {  case JCS_GRAYSCALE:    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */    cinfo->num_components = 1;    /* JFIF specifies component ID 1 */    SET_COMP(0, 1, 1,1, 0, 0,0);    break;  case JCS_RGB:    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */    cinfo->num_components = 3;    SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0);    SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0);    SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0);    break;  case JCS_YCbCr:    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */    cinfo->num_components = 3;    /* JFIF specifies component IDs 1,2,3 */    /* We default to 2x2 subsamples of chrominance */    SET_COMP(0, 1, 2,2, 0, 0,0);    SET_COMP(1, 2, 1,1, 1, 1,1);    SET_COMP(2, 3, 1,1, 1, 1,1);    break;  case JCS_CMYK:    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */    cinfo->num_components = 4;    SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0);    SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0);    SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0);    SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0);    break;  case JCS_YCCK:    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */    cinfo->num_components = 4;    SET_COMP(0, 1, 2,2, 0, 0,0);    SET_COMP(1, 2, 1,1, 1, 1,1);    SET_COMP(2, 3, 1,1, 1, 1,1);    SET_COMP(3, 4, 2,2, 0, 0,0);    break;  case JCS_UNKNOWN:    cinfo->num_components = cinfo->input_components;    if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,	       MAX_COMPONENTS);    for (ci = 0; ci < cinfo->num_components; ci++) {      SET_COMP(ci, ci, 1,1, 0, 0,0);    }    break;  default:    ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);  }}
开发者ID:wongm168,项目名称:PegDF,代码行数:79,


示例29: jpeg_set_colorspace

//.........这里部分代码省略.........      these component numbers MUST BE UNIQUE!!!       so YCC was changed to YCc.      And it wasn't an easy bug to find, either!!!! rgvb. */    SET_COMP(0, 0x59 /* 'Y' */, 2,2, 0, 0,0);	/* Photo YCC */    SET_COMP(1, 0x43 /* 'C' */, 1,1, 1, 1,1);    SET_COMP(2, 0x63 /* 'c' */, 1,1, 1, 1,1);    break;  case JCS_YCCA:    cinfo->write_JFIF_header = FALSE; /* don't write a JFIF marker. */    cinfo->num_components = 4;    /* NOTE:      these component numbers MUST BE UNIQUE!!!       so YCC was changed to YCc.      And it wasn't an easy bug to find, either!!!! rgvb. */    SET_COMP(0, 0x59 /* 'Y' */, 2,2, 0, 0,0);	/* PhotoYCC-Alpha */    SET_COMP(1, 0x43 /* 'C' */, 1,1, 1, 1,1);    SET_COMP(2, 0x63 /* 'c' */, 1,1, 1, 1,1);    SET_COMP(3, 0x41 /* 'A' */, 2,2, 0, 0,0);    break;  case JCS_YCbCrA:    cinfo->write_JFIF_header = FALSE; /* don't write a JFIF marker. */    cinfo->num_components = 4;    SET_COMP(0, 1, 2,2, 0, 0,0);	/* YCbCr-Alpha */    SET_COMP(1, 2, 1,1, 1, 1,1);    SET_COMP(2, 3, 1,1, 1, 1,1);    SET_COMP(3, 4, 2,2, 0, 0,0);    break;  case JCS_RGBA:    cinfo->write_JFIF_header = FALSE; /* don't write a JFIF marker. */    cinfo->num_components = 4;    SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0);	/* RGB-Alpha Straight through */    SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0);    SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0);    SET_COMP(3, 0x41 /* 'A' */, 1,1, 0, 0,0);    break;  case JCS_YCbCrA_LEGACY:    cinfo->write_JFIF_header = FALSE; /* don't write a JFIF marker. */    cinfo->num_components = 4;    SET_COMP(0, 1, 2,2, 0, 0,0);	/* YCbCr-Alpha */    SET_COMP(1, 2, 1,1, 1, 1,1);    SET_COMP(2, 3, 1,1, 1, 1,1);    SET_COMP(3, 4, 2,2, 0, 0,0);    break;	/* JCS_RGBA_LEGACY should NEVER appear as a JPEG colorspace. It 	   is only valid as an input color on compression and an output	   color on decompression. */  case JCS_RGBA_LEGACY:    ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);    break;#endif  case JCS_RGB:    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */    cinfo->num_components = 3;    SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0);    SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0);    SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0);    break;  case JCS_YCbCr:    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */    cinfo->num_components = 3;    /* JFIF specifies component IDs 1,2,3 */    /* We default to 2x2 subsamples of chrominance */    SET_COMP(0, 1, 2,2, 0, 0,0);    SET_COMP(1, 2, 1,1, 1, 1,1);    SET_COMP(2, 3, 1,1, 1, 1,1);    break;  case JCS_CMYK:    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */    cinfo->num_components = 4;    SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0);    SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0);    SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0);    SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0);    break;  case JCS_YCCK:    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */    cinfo->num_components = 4;    SET_COMP(0, 1, 2,2, 0, 0,0);    SET_COMP(1, 2, 1,1, 1, 1,1);    SET_COMP(2, 3, 1,1, 1, 1,1);    SET_COMP(3, 4, 2,2, 0, 0,0);    break;  case JCS_UNKNOWN:    cinfo->num_components = cinfo->input_components;    if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,	       MAX_COMPONENTS);    for (ci = 0; ci < cinfo->num_components; ci++) {      SET_COMP(ci, ci, 1,1, 0, 0,0);    }    break;  default:    ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);  }}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:101,



注:本文中的ERREXIT2函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ERRINFO函数代码示例
C++ ERREXIT函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。