ReactOS  r76032
jdtrans.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Include dependency graph for jdtrans.c:

Go to the source code of this file.

Macros

#define JPEG_INTERNALS
 

Functions

 LOCAL (void)
 
 transdecode_master_selection (j_decompress_ptr cinfo)
 

Macro Definition Documentation

#define JPEG_INTERNALS

Definition at line 14 of file jdtrans.c.

Function Documentation

LOCAL ( void  )

Definition at line 20 of file jdtrans.c.

47 {
48  if (cinfo->global_state == DSTATE_READY) {
49  /* First call: initialize active modules */
51  cinfo->global_state = DSTATE_RDCOEFS;
52  }
53  if (cinfo->global_state == DSTATE_RDCOEFS) {
54  /* Absorb whole file into the coef buffer */
55  for (;;) {
56  int retcode;
57  /* Call progress monitor hook if present */
58  if (cinfo->progress != NULL)
59  (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
60  /* Absorb some more input */
61  retcode = (*cinfo->inputctl->consume_input) (cinfo);
62  if (retcode == JPEG_SUSPENDED)
63  return NULL;
64  if (retcode == JPEG_REACHED_EOI)
65  break;
66  /* Advance progress counter if appropriate */
67  if (cinfo->progress != NULL &&
68  (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
69  if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
70  /* startup underestimated number of scans; ratchet up one scan */
71  cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
72  }
73  }
74  }
75  /* Set state so that jpeg_finish_decompress does the right thing */
76  cinfo->global_state = DSTATE_STOPPING;
77  }
78  /* At this point we should be in state DSTATE_STOPPING if being used
79  * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access
80  * to the coefficients during a full buffered-image-mode decompression.
81  */
82  if ((cinfo->global_state == DSTATE_STOPPING ||
83  cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) {
84  return cinfo->coef->coef_arrays;
85  }
86  /* Oops, improper usage */
87  ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
88  return NULL; /* keep compiler happy */
89 }
transdecode_master_selection(j_decompress_ptr cinfo)
Definition: jdtrans.c:98
#define DSTATE_RDCOEFS
Definition: jpegint.h:39
#define JPEG_REACHED_SOS
Definition: jpeglib.h:1073
#define JPEG_REACHED_EOI
Definition: jpeglib.h:1074
#define DSTATE_BUFIMAGE
Definition: jpegint.h:37
#define JPEG_ROW_COMPLETED
Definition: jpeglib.h:1075
#define DSTATE_STOPPING
Definition: jpegint.h:40
smooth NULL
Definition: ftsmooth.c:557
unsigned long
Definition: typeof.h:99
#define DSTATE_READY
Definition: jpegint.h:32
#define ERREXIT1(cinfo, code, p1)
Definition: jerror.h:212
#define JPEG_SUSPENDED
Definition: jpeglib.h:1042
transdecode_master_selection ( j_decompress_ptr  cinfo)

Definition at line 98 of file jdtrans.c.

Referenced by LOCAL().

99 {
100  /* This is effectively a buffered-image operation. */
101  cinfo->buffered_image = TRUE;
102 
103  /* Compute output image dimensions and related values. */
104  jpeg_core_output_dimensions(cinfo);
105 
106  /* Entropy decoding: either Huffman or arithmetic coding. */
107  if (cinfo->arith_code)
108  jinit_arith_decoder(cinfo);
109  else {
110  jinit_huff_decoder(cinfo);
111  }
112 
113  /* Always get a full-image coefficient buffer. */
115 
116  /* We can now tell the memory manager to allocate virtual arrays. */
117  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
118 
119  /* Initialize input side of decompressor to consume first scan. */
120  (*cinfo->inputctl->start_input_pass) (cinfo);
121 
122  /* Initialize progress monitoring. */
123  if (cinfo->progress != NULL) {
124  int nscans;
125  /* Estimate number of scans to set pass_limit. */
126  if (cinfo->progressive_mode) {
127  /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
128  nscans = 2 + 3 * cinfo->num_components;
129  } else if (cinfo->inputctl->has_multiple_scans) {
130  /* For a nonprogressive multiscan file, estimate 1 scan per component. */
131  nscans = cinfo->num_components;
132  } else {
133  nscans = 1;
134  }
135  cinfo->progress->pass_counter = 0L;
136  cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
137  cinfo->progress->completed_passes = 0;
138  cinfo->progress->total_passes = 1;
139  }
140 }
#define TRUE
Definition: types.h:120
Definition: bidi.c:75
struct jpeg_input_controller * inputctl
Definition: jpeglib.h:682
jinit_d_coef_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
Definition: jdcoefct.c:678
smooth NULL
Definition: ftsmooth.c:557
unsigned long
Definition: typeof.h:99
jinit_arith_decoder(j_decompress_ptr cinfo)
Definition: jdarith.c:764
boolean progressive_mode
Definition: jpeglib.h:587
boolean buffered_image
Definition: jpeglib.h:484
JDIMENSION total_iMCU_rows
Definition: jpeglib.h:633
jinit_huff_decoder(j_decompress_ptr cinfo)
Definition: jdhuff.c:1521