1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
diff -Naur ONScripter-EN-2024-07-21-old/tools/conv_shared.cpp ONScripter-EN-2024-07-21/tools/conv_shared.cpp
--- ONScripter-EN-2024-07-21-old/tools/conv_shared.cpp 2024-07-21 15:03:39.000000000 -0400
+++ ONScripter-EN-2024-07-21/tools/conv_shared.cpp 2024-11-03 17:45:05.398446266 -0500
@@ -33,11 +33,7 @@
#include <stdlib.h>
#include <string.h>
-namespace jpeglib { //Mion: added namespace to avoid type conflicts
- extern "C" {
#include <jpeglib.h>
- };
-}
//Mion: for png image file support
namespace libpng {
@@ -60,14 +56,14 @@
#define INPUT_BUFFER_SIZE 4096
typedef struct {
- struct jpeglib::jpeg_source_mgr pub;
+ struct jpeg_source_mgr pub;
unsigned char *buf;
size_t left;
} my_source_mgr;
typedef struct {
- struct jpeglib::jpeg_destination_mgr pub;
+ struct jpeg_destination_mgr pub;
unsigned char *buf;
size_t left;
@@ -127,21 +123,21 @@
}
-void init_source (jpeglib::j_decompress_ptr cinfo)
+void init_source (j_decompress_ptr cinfo)
{
}
-jpeglib::boolean fill_input_buffer (jpeglib::j_decompress_ptr cinfo)
+boolean fill_input_buffer (j_decompress_ptr cinfo)
{
my_source_mgr *src = (my_source_mgr *)cinfo->src;
src->pub.next_input_byte = src->buf;
src->pub.bytes_in_buffer = src->left;
- return jpeglib::TRUE;
+ return TRUE;
}
-void skip_input_data (jpeglib::j_decompress_ptr cinfo, long num_bytes)
+void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
{
my_source_mgr *src = (my_source_mgr *)cinfo->src;
@@ -149,11 +145,11 @@
src->pub.bytes_in_buffer -= (size_t) num_bytes;
}
-void term_source (jpeglib::j_decompress_ptr cinfo)
+void term_source (j_decompress_ptr cinfo)
{
}
-void init_destination (jpeglib::j_compress_ptr cinfo)
+void init_destination (j_compress_ptr cinfo)
{
my_destination_mgr * dest = (my_destination_mgr *) cinfo->dest;
@@ -161,25 +157,23 @@
dest->pub.free_in_buffer = dest->left;
}
-jpeglib::boolean empty_output_buffer (jpeglib::j_compress_ptr cinfo)
+boolean empty_output_buffer (j_compress_ptr cinfo)
{
my_destination_mgr * dest = (my_destination_mgr *) cinfo->dest;
dest->pub.next_output_byte = dest->buf;
dest->pub.free_in_buffer = dest->left;
- return jpeglib::TRUE;
+ return TRUE;
}
-void term_destination (jpeglib::j_compress_ptr cinfo)
+void term_destination (j_compress_ptr cinfo)
{
}
size_t rescaleJPEGWrite( unsigned int width, unsigned int height, int byte_per_pixel, unsigned char **rescaled_buffer,
int quality, bool bmp2jpeg_flag, int num_of_cells )
{
- using namespace jpeglib;
-
jpeg_error_mgr jerr;
struct jpeg_compress_struct cinfo2;
JSAMPROW row_pointer[1];
@@ -221,7 +215,7 @@
jpeg_set_defaults(&cinfo2);
jpeg_set_quality(&cinfo2, quality, TRUE );
- cinfo2.optimize_coding = jpeglib::TRUE;
+ cinfo2.optimize_coding = TRUE;
//jpeg_simple_progression (&cinfo2);
jpeg_start_compress(&cinfo2, TRUE);
@@ -253,8 +247,6 @@
size_t rescaleJPEG( unsigned char *original_buffer, size_t length,
unsigned char **rescaled_buffer, int quality, int num_of_cells=1 )
{
- using namespace jpeglib;
-
struct jpeg_decompress_struct cinfo;
jpeg_error_mgr jerr;
|