COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
jdtrans.cpp File Reference
#include "jinclude.h"
#include "jpeglib.h"
Include dependency graph for jdtrans.cpp:

Macros

#define JPEG_INTERNALS
 

Functions

static void transdecode_master_selection (j_decompress_ptr cinfo)
 
jvirt_barray_ptrjpeg_read_coefficients (j_decompress_ptr cinfo)
 

Macro Definition Documentation

#define JPEG_INTERNALS

Function Documentation

static void transdecode_master_selection ( j_decompress_ptr  cinfo)
static
98 {
99  /* This is effectively a buffered-image operation. */
100  cinfo->buffered_image = TRUE;
101 
102  /* Entropy decoding: either Huffman or arithmetic coding. */
103  if (cinfo->arith_code) {
104  ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
105  } else {
106  if (cinfo->progressive_mode) {
107 #ifdef D_PROGRESSIVE_SUPPORTED
108  jinit_phuff_decoder(cinfo);
109 #else
110  ERREXIT(cinfo, JERR_NOT_COMPILED);
111 #endif
112  } else
113  jinit_huff_decoder(cinfo);
114  }
115 
116  /* Always get a full-image coefficient buffer. */
118 
119  /* We can now tell the memory manager to allocate virtual arrays. */
120  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
121 
122  /* Initialize input side of decompressor to consume first scan. */
123  (*cinfo->inputctl->start_input_pass) (cinfo);
124 
125  /* Initialize progress monitoring. */
126  if (cinfo->progress != NULL) {
127  int nscans;
128  /* Estimate number of scans to set pass_limit. */
129  if (cinfo->progressive_mode) {
130  /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
131  nscans = 2 + 3 * cinfo->num_components;
132  } else if (cinfo->inputctl->has_multiple_scans) {
133  /* For a nonprogressive multiscan file, estimate 1 scan per component. */
134  nscans = cinfo->num_components;
135  } else {
136  nscans = 1;
137  }
138  cinfo->progress->pass_counter = 0L;
139  cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
140  cinfo->progress->completed_passes = 0;
141  cinfo->progress->total_passes = 1;
142  }
143 }
boolean has_multiple_scans
Definition: jpegint.h:153
int num_components
Definition: jpeglib.h:427
void jinit_d_coef_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
Definition: jdcoefct.cpp:676
int completed_passes
Definition: jpeglib.h:711
struct jpeg_input_controller * inputctl
Definition: jpeglib.h:628
struct jpeg_progress_mgr * progress
Definition: jpeglib.h:417
long pass_limit
Definition: jpeglib.h:710
#define ERREXIT(cinfo, code)
Definition: jerror.h:205
Definition: jpeglib.h:258
Definition: jerror.h:43
long pass_counter
Definition: jpeglib.h:709
void jinit_huff_decoder(j_decompress_ptr cinfo)
Definition: jdhuff.cpp:635
struct jpeg_memory_mgr * mem
Definition: jpeglib.h:417
Definition: jerror.h:95
boolean arith_code
Definition: jpeglib.h:544
#define TRUE
Definition: jpleph.cpp:68
void jinit_phuff_decoder(j_decompress_ptr cinfo)
Definition: jdphuff.cpp:641
void(* realize_virt_arrays)()
Definition: jpeglib.h:785
int total_passes
Definition: jpeglib.h:712
boolean progressive_mode
Definition: jpeglib.h:543
boolean buffered_image
Definition: jpeglib.h:441
JDIMENSION total_iMCU_rows
Definition: jpeglib.h:585
jvirt_barray_ptr* jpeg_read_coefficients ( j_decompress_ptr  cinfo)
46 {
47  if (cinfo->global_state == DSTATE_READY) {
48  /* First call: initialize active modules */
51  }
52  if (cinfo->global_state == DSTATE_RDCOEFS) {
53  /* Absorb whole file into the coef buffer */
54  for (;;) {
55  int retcode;
56  /* Call progress monitor hook if present */
57  if (cinfo->progress != NULL)
58  (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
59  /* Absorb some more input */
60  retcode = (*cinfo->inputctl->consume_input) (cinfo);
61  if (retcode == JPEG_SUSPENDED)
62  return NULL;
63  if (retcode == JPEG_REACHED_EOI)
64  break;
65  /* Advance progress counter if appropriate */
66  if (cinfo->progress != NULL &&
67  (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
68  if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
69  /* startup underestimated number of scans; ratchet up one scan */
70  cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
71  }
72  }
73  }
74  /* Set state so that jpeg_finish_decompress does the right thing */
76  }
77  /* At this point we should be in state DSTATE_STOPPING if being used
78  * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access
79  * to the coefficients during a full buffered-image-mode decompression.
80  */
81  if ((cinfo->global_state == DSTATE_STOPPING ||
82  cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) {
83  return cinfo->coef->coef_arrays;
84  }
85  /* Oops, improper usage */
86  ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
87  return NULL; /* keep compiler happy */
88 }
void(* progress_monitor)()
Definition: jpeglib.h:707
#define DSTATE_RDCOEFS
Definition: jpegint.h:38
struct jpeg_input_controller * inputctl
Definition: jpeglib.h:628
#define JPEG_REACHED_SOS
Definition: jpeglib.h:1001
#define JPEG_REACHED_EOI
Definition: jpeglib.h:1002
struct jpeg_progress_mgr * progress
Definition: jpeglib.h:417
#define DSTATE_BUFIMAGE
Definition: jpegint.h:36
long pass_limit
Definition: jpeglib.h:710
struct jpeg_d_coef_controller * coef
Definition: jpeglib.h:626
#define JPEG_ROW_COMPLETED
Definition: jpeglib.h:1003
Definition: jpeglib.h:258
Definition: jerror.h:65
jvirt_barray_ptr * coef_arrays
Definition: jpegint.h:173
#define DSTATE_STOPPING
Definition: jpegint.h:39
long pass_counter
Definition: jpeglib.h:709
#define DSTATE_READY
Definition: jpegint.h:31
static void transdecode_master_selection(j_decompress_ptr cinfo)
Definition: jdtrans.cpp:97
#define ERREXIT1(cinfo, code, p1)
Definition: jerror.h:208
#define JPEG_SUSPENDED
Definition: jpeglib.h:970
int global_state
Definition: jpeglib.h:417
boolean buffered_image
Definition: jpeglib.h:441
JDIMENSION total_iMCU_rows
Definition: jpeglib.h:585