OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Classes | Typedefs | Functions
ossimJpegMemSrc12.cpp File Reference
#include "ossimJpegMemSrc12.h"
#include <cstdio>
#include <csetjmp>
#include <jpeg12/jpeglib.h>
#include <jpeg12/jerror.h>

Go to the source code of this file.

Classes

struct  ossimJpegSourceMgr12
 jpeg library includes missing dependent includes. More...
 

Typedefs

typedef ossimJpegSourceMgr12ossimJpegSourceMgrPtr12
 

Functions

void init_source12 (j12_decompress_ptr)
 
boolean fill_input_buffer12 (j12_decompress_ptr cinfo)
 
void skip_input_data12 (j12_decompress_ptr cinfo, long num_bytes)
 
void term_source12 (j12_decompress_ptr)
 
void ossimJpegMemorySrc12 (j12_decompress_ptr cinfo, const ossim_uint8 *buffer, std::size_t bufsize)
 

Typedef Documentation

◆ ossimJpegSourceMgrPtr12

Definition at line 50 of file ossimJpegMemSrc12.cpp.

Function Documentation

◆ fill_input_buffer12()

boolean fill_input_buffer12 ( j12_decompress_ptr  cinfo)

Definition at line 79 of file ossimJpegMemSrc12.cpp.

References ossimJpegSourceMgr12::eoi_buffer, ossimJpegSourceMgr12::pub, and TRUE.

Referenced by ossimJpegMemorySrc12(), and skip_input_data12().

80 {
82 
83  WARNMS(cinfo, JWRN_JPEG_EOF);
84 
85  /* Create a fake EOI marker */
86  src->eoi_buffer[0] = (JOCTET) 0xFF;
87  src->eoi_buffer[1] = (JOCTET) JPEG_EOI;
88  src->pub.next_input_byte = src->eoi_buffer;
89  src->pub.bytes_in_buffer = 2;
90 
91  return TRUE;
92 }
struct jpeg12_source_mgr pub
ossimJpegSourceMgr12 * ossimJpegSourceMgrPtr12
jpeg library includes missing dependent includes.

◆ init_source12()

void init_source12 ( j12_decompress_ptr  )

Definition at line 58 of file ossimJpegMemSrc12.cpp.

Referenced by ossimJpegMemorySrc12().

59 {
60  /* No work, since jpeg_memory_src set up the buffer pointer and count.
61  * Indeed, if we want to read multiple JPEG images from one buffer,
62  * this *must* not do anything to the pointer.
63  */
64 }

◆ ossimJpegMemorySrc12()

void ossimJpegMemorySrc12 ( j12_decompress_ptr  cinfo,
const ossim_uint8 buffer,
std::size_t  bufsize 
)

Definition at line 149 of file ossimJpegMemSrc12.cpp.

References fill_input_buffer12(), init_source12(), ossimJpegSourceMgr12::pub, skip_input_data12(), and term_source12().

152 {
154 
155  /* The source object is made permanent so that a series of JPEG images
156  * can be read from a single buffer by calling jpeg_memory_src
157  * only before the first one.
158  * This makes it unsafe to use this manager and a different source
159  * manager serially with the same JPEG object. Caveat programmer.
160  */
161  if (cinfo->src == NULL)
162  { /* first time for this JPEG object? */
163  cinfo->src = (struct jpeg12_source_mgr *)
164  (*cinfo->mem->alloc_small) ((j12_common_ptr) cinfo, JPOOL_PERMANENT,
165  sizeof(ossimJpegSourceMgr12));
166  }
167 
168  src = (ossimJpegSourceMgrPtr12) cinfo->src;
169  src->pub.init_source = init_source12;
170  src->pub.fill_input_buffer = fill_input_buffer12;
171  src->pub.skip_input_data = skip_input_data12;
172  src->pub.resync_to_restart = jpeg12_resync_to_restart; /* use default method */
173  src->pub.term_source = term_source12;
174 
175  src->pub.next_input_byte = buffer;
176  src->pub.bytes_in_buffer = bufsize;
177 }
void init_source12(j12_decompress_ptr)
boolean fill_input_buffer12(j12_decompress_ptr cinfo)
void term_source12(j12_decompress_ptr)
void skip_input_data12(j12_decompress_ptr cinfo, long num_bytes)
struct jpeg12_source_mgr pub
ossimJpegSourceMgr12 * ossimJpegSourceMgrPtr12
jpeg library includes missing dependent includes.

◆ skip_input_data12()

void skip_input_data12 ( j12_decompress_ptr  cinfo,
long  num_bytes 
)

Definition at line 103 of file ossimJpegMemSrc12.cpp.

References fill_input_buffer12(), if(), and ossimJpegSourceMgr12::pub.

Referenced by ossimJpegMemorySrc12().

104 {
106 
107  if (num_bytes > 0)
108  {
109  while (num_bytes > (long) src->pub.bytes_in_buffer)
110  {
111  num_bytes -= (long) src->pub.bytes_in_buffer;
112  (void) fill_input_buffer12(cinfo);
113  /* note we assume that fill_input_buffer will never return FALSE,
114  * so suspension need not be handled.
115  */
116  }
117  src->pub.next_input_byte += (size_t) num_bytes;
118  src->pub.bytes_in_buffer -= (size_t) num_bytes;
119  }
120 }
boolean fill_input_buffer12(j12_decompress_ptr cinfo)
struct jpeg12_source_mgr pub
ossimJpegSourceMgr12 * ossimJpegSourceMgrPtr12
jpeg library includes missing dependent includes.
if(yy_init)

◆ term_source12()

void term_source12 ( j12_decompress_ptr  )

Definition at line 140 of file ossimJpegMemSrc12.cpp.

Referenced by ossimJpegMemorySrc12().

141 {
142  /* no work necessary here */
143 }