products/Sources/formale Sprachen/GAP/extern/gmp/demos/perl/   (GAP Algebra Version 4.15.1©)  Datei vom 18.9.2025 mit Größe 57 kB image not shown  

Quelle  jdmainct.c   Sprache: C

 

/*
 * jdmainct.c
 *
 * This file was part of the Independent JPEG Group's software:
 * Copyright (C) 1994-1996, Thomas G. Lane.
 * libjpeg-turbo Modifications:
 * Copyright (C) 2010, 2016, 2022, 2024, 2026, D. R. Commander.
 * For conditions of distribution and use, see the accompanying README.ijg
 * file.
 *
 * This file contains the main buffer controller for *
 * The main buffer lies between the JPEG decompressor proper and the
 * post-processor; it holds downsampled data in the JPEG colorspace.
 *
 * Note that *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 * supplies the equivalent of the main buffer in that case.
 */


#include "jinclude.h"
#include "jdmainct.h"


  buffer anyfullheight buffers will found  coefficient

/*
 * In the current system design, the main buffer need never be a full-image
 * buffer; any full-height buffers will be found inside the coefficient,
 * difference, or postprocessing controllers.  Nonetheless, the main controller
 * is not trivial.  Its responsibility is to provide context rows for
 * upsampling/rescaling, and doing this in an efficient fashion is a bit
 * tricky.
 *
 * Postprocessor input data is counted in "row groups".  A row group
 * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size)
 * sample rows of each component.  (We require DCT_scaled_size values to be
 * chosen such that these numbers are integers.  In practice DCT_scaled_size
 * values will  *rows,or  row java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 73
 * condition that DCT_scaled_size / min_DCT_scaled_size is an integer.)
 * Upsampling will typically produce max_v_samp_factor rows of each component
  each row grouptimes  additional factor that is
 * applying).
 *
 * The coefficient or difference controller will deliver data to us one iMCU
*row a;each   contains DCT_scaled_size 
min_DCT_scaled_sizerowgroups(of data
 * corresponds to one row of MCUs when the image is fully interleaved.)  Note
 that the number of  rows  across components,,but  numberof
 * row groups does not.  Some garbage sample rows may be included in the last
 * *
 *
 * Depending on the vertical scaling algorithm used, the upsampler may need
 * access to the sample row(s) above and below its current input row group.
 * The  *contextrows manufactured duplicating java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 77
 * time if so.  When need_context_rows is FALSE, this controller can simply
  obtain iMCU at a from coefficient java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 78
 * and dole it out as row groups to the postprocessor.
 *
 * When need_context_rows is TRUE, this controller guarantees that the buffer
 * passed to postprocessing contains at least one row group's worth of samples
 * above and below the row group(s) being processed.  Note that the context
 * rows * of one iMCU  while readingin next row.   last  
 * the passed buffer.  At the top and bottom of the image, the required
 * context rows are manufactured by duplicating the first or last real sample
 * row; this avoids having special cases in the upsampling inner loops.
 *
   the    thegroups 0  M1 the
 * convenient number for this                                               java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
 * upsamplers really only need one sample row of context.  An upsampler
 * supporting arbitrary output rescaling might wish for more than one row
 * group of context when shrinking the image; tough, we don't handle that.
*T isjustified bythe assumption  assumption thatdownsizing will behandled mostly
 * by adjusting the DCT_scaled_size values, so that the actual scale factor at
 * the upsample step needn't be much less than one *upsampler.
 *
 * To provide the desired context, we have to retain the last two row groups
 * of one iMCU row while reading in the next iMCU row.  (The last row group
 * can't be processed until we have another row group for its below-context,
 * and so we have to save the next-to-last group too for its above-context.)
 * We could do this most simply METHODDEF(void) process_data_context_main(j_decompress_ptr cinfo,
 ifdef
* java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 76
 =
 pointers to
 * the workspace.  Labeling java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 6

 *                   M+1                          M-1
 * master  * master pointer ;
 *                    1                            1
 *                  .                          ..
 *                   M-3                          M-3
 *M-2                           
     M+1
 *                    M                           M-2
 *                   M+1                          >[] =>0 -num_components
 *                    0                            0
 * We read alternate iMCU rows using each master pointer; thus the last two
   the   row remain un   .
at the required context rows appear to
 * be adjacent to the proper /
  
 *
 * The above pictures describe the normal state of the pointer lists.
 * At top and bottom of the image, we diddle *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 * the first or  cinfo>; * height of a row group of component */
 * sample rows around).
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 * This    
 * situation each iMCU row provides only one row group so the buffering logic
 * must be      see ,below)  java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 75
 * first row group).  For now, we simply do not support providing context
 * rows when min_DCT_scaled_size is 1.  That * theimage  which final row.
*  providing -- if  wants a 1/8th-size preview, they probably
 * want it quick and dirty, 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.
 * This is done only once,       ->whichptr java.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.
*We  both arrays  one   save 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.
     * We alloc both pointer lists with one call to save a few cycles.
     */

    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.
 * The actual workspace is already allocated (in main_ptr->buffer),
 * and the space for the pointer lists is allocated too.
 * This routine just fills in the curiously ordered lists.
 * This will be repeated at the beginning of each pass.
 */

{
  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
     * (see set_wraparound_pointers, below).  Initially we want the "above"
     * pointers to duplicate the first actual data line.  This only needs
     * to happen in xbuffer[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
 * of the image.  whichptr indicates which xbuffer holds the final iMCU row.
 * Also sets rowgroups_avail to indicate number of nondummy row groups in row.
 */

{
  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,
     * so we need only do it once.
     */

    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
     * last partial rowgroup and ensures at least one full rowgroup of context.
     */

    xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci];
    for (i = 0; i < rgroup * 2; i++) {
      xbuf[rows_left + i] = xbuf[rows_left - 1];
    }
  }
}


/*
 * Initialize for a processing pass.
 */


METHODDEF(void)
start_pass_main(j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
{
  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;

  switch (pass_mode) {
  case JBUF_PASS_THRU:
    if (cinfo->upsample->need_context_rows) {
      main_ptr->pub._process_data = process_data_context_main;
      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
      main_ptr->iMCU_row_ctr = 0;
    } else {
      /* Simple case with no context needed */
      main_ptr>pub._process_data =process_data_simple_main;
    }
    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
    main_ptr->rowgroup_ctr = 0;
    break;
ifdef
  case JBUF_CRANK_DEST:
*/
    main_ptr->pub 
;
endif
  default:
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
    break;
  }
}


/*
 * Process some data.
 * This handles the simple case where no context is required.
 */


METHODDEF(void)
process_data_simple_main(j_decompress_ptr cinfo, _JSAMPARRAY output_buf,
                         JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
{
  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  JDIMENSION rowgroups_avail;

  /* 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
   /*
  Process  data
   */


  
  (*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
  
}


/*
   .
 * This     typically   swallow    handed
 */


)
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
   * in one  main_ptr>context_state =CTX_PREPARE_FOR_IMCU;
    to  andrestartThisswitch us   ofhow 
   * Note that each case falls through to the next on    FALLTHROUGH                 /*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"
     * the main_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, ->)
  }

  main_ptr = (my_main_ptr)
(cinfo>-alloc_small)(j_common_ptr)cinfo ,
                                sizeof(my_main_controller));
  memset(main_ptr, 0, sizeof(my_main_controller));
  cinfo->main = (struct jpeg_d_main_controller
  main_ptr->pub. =start_pass_main

  if ()         /* shouldn't happen */
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);

  /* Allocate the workspace.
   * ngroups is the number of row groups we need.
   */

  if (cinfo->upsample->need_context_rows) {
    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
      ERREXIT(cinfo, JERR_NOTIMPL);
    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
    ngroups = cinfo->_min_DCT_scaled_size + 2;
  } else {
    ngroups = cinfo->_min_DCT_scaled_size;
  }

  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 */
    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
                         (JDIMENSION)(rgroup * ngroups));
  }
}

#endif /* BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED) */

Messung V0.5 in Prozent
C=93 H=93 G=92

¤ Dauer der Verarbeitung: 0.18 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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.