/* We use a full-image sample buffer when doing Huffman optimization, *andalsoforwritingmultiple-scanJPEGfiles.Inallcases,the *full-imagebufferisfilledduringthefirstpass,andthescaling, *predictionanddifferencingstepsarerunduringsubsequentpasses.
*/ #ifdef ENTROPY_OPT_SUPPORTED #define FULL_SAMP_BUFFER_SUPPORTED #else #ifdef C_MULTISCAN_FILES_SUPPORTED #define FULL_SAMP_BUFFER_SUPPORTED #endif #endif
/* Private buffer controller object */
typedefstruct { struct jpeg_c_coef_controller pub; /* public fields */
JDIMENSION iMCU_row_num; /* iMCU row # within image */
JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ int MCU_vert_offset; /* counts MCU rows within iMCU row */ int MCU_rows_per_iMCU_row; /* number of such rows needed */
_JSAMPROW cur_row[MAX_COMPONENTS]; /* row of point-transformed samples */
_JSAMPROW prev_row[MAX_COMPONENTS]; /* previous row of Pt'd samples */
JDIFFARRAY diff_buf[MAX_COMPONENTS]; /* iMCU row of differences */
/* In multi-pass modes, we need a virtual sample array for each component. */
jvirt_sarray_ptr whole_image[MAX_COMPONENTS];
} my_diff_controller;
LOCAL(void)
start_iMCU_row(j_compress_ptr cinfo) /* Reset within-iMCU-row counters for a new row */
{
my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
/* In an interleaved scan, an MCU row is the same as an iMCU row. *Inanoninterleavedscan,aniMCUrowhasv_samp_factorMCUrows. *Butatthebottomoftheimage,processonlywhat'sleft.
*/ if (cinfo->comps_in_scan > 1) {
diff->MCU_rows_per_iMCU_row = 1;
} else { if (diff->iMCU_row_num < (cinfo->total_iMCU_rows-1))
diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; else
diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
}
/* Because it is hitching a ride on the jpeg_forward_dct struct, *start_pass_lossless()willbecalledatthestartoftheinitialpass. *ThisensuresthatitwillbecalledatthestartoftheHuffman *optimizationandoutputpassesaswell.
*/ if (pass_mode == JBUF_CRANK_DEST)
(*cinfo->fdct->start_pass) (cinfo);
diff->iMCU_row_num = 0;
start_iMCU_row(cinfo);
switch (pass_mode) { case JBUF_PASS_THRU: if (diff->whole_image[0] != NULL)
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
diff->pub._compress_data = compress_data; break; #ifdef FULL_SAMP_BUFFER_SUPPORTED case JBUF_SAVE_AND_PASS: if (diff->whole_image[0] == NULL)
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
diff->pub._compress_data = compress_first_pass; break; case JBUF_CRANK_DEST: if (diff->whole_image[0] == NULL)
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
diff->pub._compress_data = compress_output; break; #endif default:
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); break;
}
}
/* Create the difference buffer. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
diff->diff_buf[ci] =
ALLOC_DARRAY(JPOOL_IMAGE,
(JDIMENSION)jround_up((long)compptr->width_in_blocks,
(long)compptr->h_samp_factor),
(JDIMENSION)compptr->v_samp_factor); /* Prefill difference rows with zeros. We do this because only actual *dataisplacedinthebuffersduringprediction/differencing,leaving *anydummydifferencesattherightedgeaszeros,whichwillencode *tothesmallestamountofdata.
*/ for (row = 0; row < compptr->v_samp_factor; row++)
memset(diff->diff_buf[ci][row], 0,
jround_up((long)compptr->width_in_blocks,
(long)compptr->h_samp_factor) * sizeof(JDIFF));
}
/* Create the sample buffer. */ if (need_full_buffer) { #ifdef FULL_SAMP_BUFFER_SUPPORTED /* Allocate a full-image virtual array for each component, */ /* padded to a multiple of samp_factor differences in each direction. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
(JDIMENSION)jround_up((long)compptr->width_in_blocks,
(long)compptr->h_samp_factor),
(JDIMENSION)jround_up((long)compptr->height_in_blocks,
(long)compptr->v_samp_factor),
(JDIMENSION)compptr->v_samp_factor);
} #else
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); #endif
} else
diff->whole_image[0] = NULL; /* flag for no virtual arrays */
}
#endif/* C_LOSSLESS_SUPPORTED */
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.