MCPcopy Create free account
hub / github.com/LibRaw/LibRaw / main

Function main

samples/mem_image_sample.cpp:142–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142int main(int ac, char *av[])
143{
144 int i, ret, output_thumbs = 0;
145#ifdef USE_JPEG
146 int output_jpeg = 0, jpgqual = 90;
147#endif
148 // don't use fixed size buffers in real apps!
149
150 LibRaw RawProcessor;
151
152 if (ac < 2)
153 {
154 printf("mem_image - LibRaw sample, to illustrate work for memory buffers.\n"
155 "Emulates dcraw [-4] [-1] [-e] [-h]\n"
156#ifdef USE_JPEG
157 "Usage: %s [-D] [-j[nn]] [-T] [-v] [-e] raw-files....\n"
158#else
159 "Usage: %s [-D] [-T] [-v] [-e] raw-files....\n"
160#endif
161 "\t-6 - output 16-bit PPM\n"
162 "\t-4 - linear 16-bit data\n"
163 "\t-e - extract thumbnails (same as dcraw -e in separate run)\n"
164#ifdef USE_JPEG
165 "\t-j[qual] - output JPEG with qual quality (e.g. -j90)\n"
166#endif
167 "\t-h - use half_size\n", av[0]);
168 return 0;
169 }
170
171 putenv((char *)"TZ=UTC"); // dcraw compatibility, affects TIFF datestamp field
172
173#define P1 RawProcessor.imgdata.idata
174#define S RawProcessor.imgdata.sizes
175#define C RawProcessor.imgdata.color
176#define T RawProcessor.imgdata.thumbnail
177#define P2 RawProcessor.imgdata.other
178#define OUT RawProcessor.imgdata.params
179
180 for (i = 1; i < ac; i++)
181 {
182 if (av[i][0] == '-')
183 {
184 if (av[i][1] == '6' && av[i][2] == 0)
185 OUT.output_bps = 16;
186 if (av[i][1] == '4' && av[i][2] == 0)
187 {
188 OUT.output_bps = 16;
189 OUT.gamm[0] = OUT.gamm[1] = OUT.no_auto_bright = 1;
190 }
191 if (av[i][1] == 'e' && av[i][2] == 0)
192 output_thumbs++;
193 if (av[i][1] == 'h' && av[i][2] == 0)
194 OUT.half_size = 1;
195#ifdef USE_JPEG
196 if (av[i][1] == 'j')
197 {
198 output_jpeg = 1;
199 if(av[i][2] != 0)

Callers

nothing calls this directly

Calls 11

libraw_strerrorFunction · 0.85
write_jpegFunction · 0.85
write_thumbFunction · 0.85
open_fileMethod · 0.80
unpackMethod · 0.80
unpack_thumbMethod · 0.80
recycleMethod · 0.80
write_ppmFunction · 0.70
dcraw_processMethod · 0.45
dcraw_make_mem_imageMethod · 0.45
dcraw_make_mem_thumbMethod · 0.45

Tested by

no test coverage detected