Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoJpegDataCompressor.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25#ifndef SO_LDM_JPEG_COMPRESSOR_H
26#define SO_LDM_JPEG_COMPRESSOR_H
27
28#include <LDM/compressors/SoDataCompressor.h>
29
30struct jpeg_destination_mgr;
31struct jpeg_source_mgr;
32struct jpeg_compress_struct;
33struct jpeg_decompress_struct;
34struct jpeg_error_mgr;
35struct jpeg_ldm_comp_destination_mgr;
36struct jpeg_ldm_decomp_destination_mgr;
37
38class SoLibJpeg;
39
40typedef struct jpeg_compress_struct *j_compress_ptr;
41typedef struct jpeg_decompress_struct * j_decompress_ptr;
42
66{
67 SO_TYPED_CLASS_HEADER();
68
69public:
78
86 virtual size_t compress(void *src, size_t srcLen, const TileInfo &tileInfo);
87
95 virtual size_t uncompress(void *dest, size_t destLen, const TileInfo &tileInfo);
96
103 virtual SbString getCompressionFormatName() const { return SbString("jpeg"); }
104
109 virtual bool isLossless() { return false; }
110
111private:
112 SoLibJpeg *m_jpeg;
113
114 struct jpeg_compress_struct *m_cinfo;
115 struct jpeg_decompress_struct *m_dcinfo;
116
117 size_t allocateNeededSpace(size_t srcLen);
118
119
120 static void initDestination(j_compress_ptr cinfo);
121 static unsigned char emptyOutputBuffer(j_compress_ptr cinfo);
122 static void termDestination(j_compress_ptr cinfo);
123
124 static void initSource(j_decompress_ptr cinfo);
125 static unsigned char fillInputBuffer(j_decompress_ptr cinfo);
126 static void skipInputData(j_decompress_ptr cinfo, long num_bytes);
127 static void resyncToRestart(j_decompress_ptr cinfo, int desired);
128 static void termSource(j_decompress_ptr cinfo);
129
130 void createCompressInfo(jpeg_compress_struct *cinfo, jpeg_error_mgr *jerr,
131 jpeg_ldm_comp_destination_mgr *destMgr);
132 static void createDecompressInfo(jpeg_decompress_struct *cinfo,
133 jpeg_error_mgr *jerr,
134 jpeg_ldm_decomp_destination_mgr *srcMgr);
135
136 size_t compressBatch( void* src, size_t srcLen, const TileInfo& tileInfo );
137 static size_t uncompressBatch( void* dest, const TileInfo& tileInfo, const unsigned char* srcBuffer, size_t srcLen );
138
139 void allocBatchSizeBytes();
140 static void writeBatchSize( unsigned char* buffer, uint64_t batchSize );
141 static uint64_t readBatchSize( const unsigned char* buffer );
142};
143
144#endif
145
146
Class for smart character strings.
Definition SbString.h:202
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Data com...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Jpeg dat...
virtual SbString getCompressionFormatName() const
Returns the name of the compression algorithm used by this class.
virtual bool isLossless()
This compression is lossy.
SoJpegDataCompressor()
Constructor.
virtual size_t compress(void *src, size_t srcLen, const TileInfo &tileInfo)
Compresses the given buffer into the internal buffer.
virtual size_t uncompress(void *dest, size_t destLen, const TileInfo &tileInfo)
Uncompresses data from the internal buffer to the given buffer.
virtual ~SoJpegDataCompressor()
Destructor.
This structure contains the dimension and the type of the tile being processed.