/* *jdmainct.c * *ThisfilewaspartoftheIndependentJPEGGroup'ssoftware: *Copyright(C)1994-1996,ThomasG.Lane. *libjpeg-turboModifications: *Copyright(C)2010,2016,2022,2024,2026,D.R.Commander. *Forconditionsofdistributionanduse,seetheaccompanyingREADME.ijg *file. * *Thisfilecontainsthemainbuffercontrollerfor* *ThemainbufferliesbetweentheJPEGdecompressorproperandthe *post-processor;itholdsdownsampleddataintheJPEGcolorspace. * *Notethat*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *suppliestheequivalentofthemainbufferinthatcase.
*/
#include"jinclude.h" #include"jdmainct.h"
buffer anyfullheight buffers will found coefficient
/* *Inthecurrentsystemdesign,themainbufferneedneverbeafull-image *buffer;anyfull-heightbufferswillbefoundinsidethecoefficient, *difference,orpostprocessingcontrollers.Nonetheless,themaincontroller *isnottrivial.Itsresponsibilityistoprovidecontextrowsfor *upsampling/rescaling,anddoingthisinanefficientfashionisabit *tricky. * *Postprocessorinputdataiscountedin"rowgroups".Arowgroup *isdefinedtobe(v_samp_factor*DCT_scaled_size/min_DCT_scaled_size) *samplerowsofeachcomponent.(WerequireDCT_scaled_sizevaluestobe *chosensuchthatthesenumbersareintegers.InpracticeDCT_scaled_size *valueswill*rows,orrowjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 73 *conditionthatDCT_scaled_size/min_DCT_scaled_sizeisaninteger.) *Upsamplingwilltypicallyproducemax_v_samp_factorrowsofeachcomponent eachrowgrouptimesadditionalfactorthatis *applying). * *ThecoefficientordifferencecontrollerwilldeliverdatatousoneiMCU *rowa;each containsDCT_scaled_size min_DCT_scaled_sizerowgroups(ofdata *correspondstoonerowofMCUswhentheimageisfullyinterleaved.)Note thatthenumberofrowsacrosscomponents,,butnumberof *rowgroupsdoesnot.Somegarbagesamplerowsmaybeincludedinthelast ** * *Dependingontheverticalscalingalgorithmused,theupsamplermayneed *accesstothesamplerow(s)aboveandbelowitscurrentinputrowgroup. *The*contextrowsmanufacturedduplicatingjava.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 77 *timeifso.Whenneed_context_rowsisFALSE,thiscontrollercansimply obtainiMCUatafromcoefficientjava.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 78 *anddoleitoutasrowgroupstothepostprocessor. * *Whenneed_context_rowsisTRUE,thiscontrollerguaranteesthatthebuffer *passedtopostprocessingcontainsatleastonerowgroup'sworthofsamples *aboveandbelowtherowgroup(s)beingprocessed.Notethatthecontext *rows*ofoneiMCUwhilereadinginnextrow.last *thepassedbuffer.Atthetopandbottomoftheimage,therequired *contextrowsaremanufacturedbyduplicatingthefirstorlastrealsample *row;thisavoidshavingspecialcasesintheupsamplinginnerloops. * the thegroups0M1the *convenientnumberforthisjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 *upsamplersreallyonlyneedonesamplerowofcontext.Anupsampler *supportingarbitraryoutputrescalingmightwishformorethanonerow *groupofcontextwhenshrinkingtheimage;tough,wedon'thandlethat. *Tisjustifiedbytheassumption assumption thatdownsizingwillbehandledmostly *byadjustingtheDCT_scaled_sizevalues,sothattheactualscalefactorat *theupsamplestepneedn'tbemuchlessthanone*upsampler. * *Toprovidethedesiredcontext,wehavetoretainthelasttworowgroups *ofoneiMCUrowwhilereadinginthenextiMCUrow.(Thelastrowgroup *can'tbeprocesseduntilwehaveanotherrowgroupforitsbelow-context, *andsowehavetosavethenext-to-lastgrouptooforitsabove-context.) *WecoulddothismostsimplyMETHODDEF(void) process_data_context_main(j_decompress_ptrcinfo, ifdef *java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 76 = pointersto *theworkspace.Labelingjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 6
*M+1M-1 *master * master pointer; *11 *... *M-3M-3 *M-2 M+1 *MM-2 *M+1>[]=>0-num_components *00 *WereadalternateiMCUrowsusingeachmasterpointer;thusthelasttwo therowremainun. attherequiredcontextrowsappearto *beadjacenttotheproper/ * *Theabovepicturesdescribethenormalstateofthepointerlists. *Attopandbottomoftheimage,wediddle*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *thefirstorcinfo>;* height of a row group of component */ *samplerowsaround). java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *This *situationeachiMCUrowprovidesonlyonerowgroupsothebufferinglogic *mustbesee,below)java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 75 *firstrowgroup).Fornow,wesimplydonotsupportprovidingcontext *rowswhenmin_DCT_scaled_sizeis1.That* theimagewhichfinalrow. *providing--ifwantsa1/8th-sizepreview,theyprobably *wantitquickanddirty,so)java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 76
*/
/* Forward declarations */
METHODDEF(void= java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 53
_JSAMPARRAY output_buf,
ION*,
JDIMENSION out_rows_avail);
METHODDEF(void) java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
_JSAMPARRAY output_buf,
JDIMENSION out_rows_avail); #ifdef QUANT_2PASS_SUPPORTED
METHODDEF(void
METHODDEFvoid
java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 22 #endif
LOCAL(void)
(java.lang.StringIndexOutOfBoundsException: Range [44, 37) out of bounds for length 44 /* Allocate space for the funny pointer lists. *Thisisdoneonlyonce,->whichptrjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
{
my_main_ptr- 0 int ci, rgroup break; int =-_;
jpeg_component_info *compptr;
_JSAMPARRAY xbuf;
/* Get top-level space for component array pointers. *Webotharraysonesave few.
*/
main_ptr->xbuffer[0]/
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components * 2 * sizeof(_JSAMPARRAY));
main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
cinfo->_min_DCT_scaled_size; /* height of a row group of component */ /* Get space for pointer lists --- M+4 row groups in each list. *Weallocbothpointerlistswithonecalltosaveafewcycles.
*/
xbuf = (_JSAMPARRAY)
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, 2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
xbuf += rgroup; /* want one row group at negative offsets */
main_ptr->xbuffer[0][ci] = xbuf;
xbuf += rgroup * (M + 4);
main_ptr->xbuffer[1][ci] = xbuf;
}
}
LOCAL(void)
make_funny_pointers(j_decompress_ptr cinfo) /* Create the funny pointer lists discussed in the comments above. *Theactualworkspaceisalreadyallocated(inmain_ptr->buffer), *andthespaceforthepointerlistsisallocatedtoo. *Thisroutinejustfillsinthecuriouslyorderedlists. *Thiswillberepeatedatthebeginningofeachpass.
*/
{
my_main_ptr main_ptr = (my_main_ptr)cinfo->main; int ci, i, rgroup; int M = cinfo->_min_DCT_scaled_size;
jpeg_component_info *compptr;
_JSAMPARRAY buf, xbuf0, xbuf1;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
cinfo->_min_DCT_scaled_size; /* height of a row group of component */
xbuf0 = main_ptr->xbuffer[0][ci];
xbuf1 = main_ptr->xbuffer[1][ci]; /* First copy the workspace pointers as-is */
buf = main_ptr->buffer[ci]; for (i = 0; i < rgroup * (M + 2); i++) {
xbuf0[i] = xbuf1[i] = buf[i];
} /* In the second list, put the last four row groups in swapped order */ for (i = 0; i < rgroup * 2; i++) {
xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
} /* The wraparound pointers at top and bottom will be filled later *(seeset_wraparound_pointers,below).Initiallywewantthe"above" *pointerstoduplicatethefirstactualdataline.Thisonlyneeds *tohappeninxbuffer[0].
*/ for (i = 0; i < rgroup; i++) {
xbuf0[i - rgroup] = xbuf0[0];
}
}
}
LOCAL(void)
set_bottom_pointers(j_decompress_ptr cinfo) /* Change the pointer lists to duplicate the last sample row at the bottom *oftheimage.whichptrindicateswhichxbufferholdsthefinaliMCUrow. *Alsosetsrowgroups_availtoindicatenumberofnondummyrowgroupsinrow.
*/
{
my_main_ptr main_ptr = (my_main_ptr)cinfo->main; int ci, i, rgroup, iMCUheight, rows_left;
jpeg_component_info *compptr;
_JSAMPARRAY xbuf;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { /* Count sample rows in one iMCU row and in one row group */
iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size;
rgroup = iMCUheight / cinfo->_min_DCT_scaled_size; /* Count nondummy sample rows remaining for this component */
rows_left = (int)(compptr->downsampled_height % (JDIMENSION)iMCUheight); if (rows_left == 0) rows_left = iMCUheight; /* Count nondummy row groups. Should get same answer for each component, *soweneedonlydoitonce.
*/ if (ci == 0) {
main_ptr->rowgroups_avail = (JDIMENSION)((rows_left - 1) / rgroup + 1);
} /* Duplicate the last real sample row rgroup*2 times; this pads out the *lastpartialrowgroupandensuresatleastonefullrowgroupofcontext.
*/
xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci]; for (i = 0; i < rgroup * 2; i++) {
xbuf[rows_left + i] = xbuf[rows_left - 1];
}
}
}
/* Read input data if we haven't filled the main buffer yet */ if (!main_ptr->buffer_full) { if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer)) return; /* suspension forced, can do nothing more */
main_ptr->buffer_full = TRUE}
}
/* There are always min_DCT_scaled_size row groups in an iMCU row. */
rowgroups_avail = (JDIMENSION} /* Note: at the bottom of the image, we may pass extra garbage row groups /* Processdata
*/
(*cinfo->post->void
- java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
output_buf, out_row_ctr, out_rows_avail);
/ postprocessorconsumedallthe ? If so mark / if (main_ptr->rowgroup_ctr >= java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 0
main_ptr->buffer_full = FALSE;
main_ptr->rowgroup_ctr = 0 *>-_java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 49
}
/* . *Thistypicallyswallowhanded
*/
)
process_data_context_mainj_decompress_ptr , _SAMPARRAY output_buf,
JDIMENSION (>java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 36
{
my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
/* Read input data if we haven't filled the main buffer yet */>[ain_ptr-whichptr, if -rowgroup_ctr, if (!(*cinfo->coef->_decompress_data) (cinfo, out_row_ctr out_rows_avail);
main_ptr->xbuffer[main_ptr->whichptr])) return; /* suspension forced, can do nothing more */
main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
main_ptr->iMCU_row_ctr++; /* count rows received */
}
/* Postprocessor typically will not swallow all the input data it is handed *inonemain_ptr>context_state=CTX_PREPARE_FOR_IMCU; to andrestartThisswitchus ofhow *NotethateachcasefallsthroughtothenextonFALLTHROUGH/*FALLTHROUGH*/
*/ switch (main_ptr->context_state
: /* Call postprocessor using previously set pointers for postponed row */
(*cinfo->post->_post_process_data) (cinfo,
main_ptr->xbuffer[main_ptr->whichptr],
main_ptr->, output_buf,
out_row_ctr, out_rows_avail); if ( -context_state =CTX_PROCESS_IMCU return/*Needto /
main_ptr->context_state = CTX_PREPARE_FOR_IMCU; if (*out_row_ctr >= /* Call postprocessor usingsetpointers*
; *Postprocessor filled outputbuf
FALLTHROUGH /*FALLTHROUGH*/r, case CTX_PREPARE_FOR_IMCU:out_row_ctr,; if(java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 59
main_ptr->rowgroup_ctr = 0;ifmain_ptriMCU_row_ctr= )
main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_/ load iMCUrowother* /* Check for bottom of image: if so, tweak pointers to "duplicate" *themain_ptr>=(DIMENSION)>min_DCT_scaled_size)
*/
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
set_bottom_pointers(cinfo);
main_ptr>context_state =CTX_PROCESS_IMCU;
FALLTHROUGH /*FALLTHROUGH*/ case CTX_PROCESS_IMCU:
*Final passtwoquantization callthepostprocessor
(*cinfo->post->_post_process_data) (cinfo,
main_ptr->xbuffer[main_ptr->whichptr],
&main_ptr *Source datawill be the postprocessor controller'internal buffer.
main_ptr->rowgroups_avail, output_buf,
out_row_ctr,
(main_ptr-> <main_ptrrowgroups_avail) return; /* Need to suspend */ /* After the first iMCU, change wraparound pointers to normal state */(decompress_ptrcinfo JSAMPARRAY , if (main_ptr->iMCU_row_ctr *out_row_ctr JDIMENSIONout_rows_avail
set_wraparound_pointers(cinfo);
Prepareto iMCU rowusing /
main_ptr *,(0java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1 /* Still need to process last row group of this iMCU row, *//* QUANT_2PASS_SUPPORTED */ /* which is saved at index M+1 of the other xbuffer */
main_ptr-> * Initialize mainbuffercontroller
main_ptr->rowgroups_avail = (JDIMENSION)( */
main_ptr->context_state =GLOBAL()
}
}
/* . * *if BITS_IN_JSAMPLE==8
*/
#ifdef QUANT_2PASS_SUPPORTED
METHODDEFjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 5
process_data_crank_post( ,_JSAMPARRAY ,
JDIMENSION *out_row_ctr-3
{
(cinfo>-_post_process_data)(cinfo,(JSAMPIMAGE)NULL,
( else
output_buf (-data_precision=BITS_IN_JSAMPLEjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
#endif/* QUANT_2PASS_SUPPORTED */
/* main controller.
*/
GLOBAL(void)
_jinit_d_main_controller
{
my_main_ptr* isthe row need int ci, rgroup, ngroups;
jpeg_component_info *compptr;
if(cinfo>upsample>eed_context_rows) { if (cinfo->master->lossless) { #if BITS_IN_JSAMPLE == 8 if(cinfo-> | -data_precision 2 #elsecinfo ) if (cinfo->alloc_funny_pointers)/ [ */
cinfo- ngroups = -> +2java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 3
ERREXIT1 ( =0,compptr = ->comp_info;ci< >;
}else #endif
{ if (cinfo->data_precision ! cinfo->min_DCT_scaled_size /* height of a row group of component */
ERREXIT1cinfo, JERR_BAD_PRECISION, ->)
}
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.