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

Function main

samples/rawtextdump.cpp:56–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54};
55
56int main(int ac, char *av[])
57{
58 if (ac < 4)
59 {
60 usage(av[0]);
61 exit(1);
62 }
63 int colstart = atoi(av[2]);
64 int rowstart = atoi(av[3]);
65 int channel = 0;
66 if (ac > 4) channel = atoi(av[4]);
67 int width = 16;
68 if (ac > 5) width = atoi(av[5]);
69 int height = 4;
70 if (ac > 6) height = atoi(av[6]);
71 if (width <1 || height<1)
72 {
73 usage(av[0]);
74 exit(1);
75 }
76
77 LibRaw_bl lr;
78
79 if (lr.open_file(av[1]) != LIBRAW_SUCCESS)
80 {
81 fprintf(stderr, "Unable to open file %s\n", av[1]);
82 exit(1);
83 }
84 if ((lr.imgdata.idata.colors == 1 && channel>0) || (channel >3))
85 {
86 fprintf(stderr, "Incorrect CHANNEL specified: %d\n", channel);
87 exit(1);
88 }
89 if (lr.unpack() != LIBRAW_SUCCESS)
90 {
91 fprintf(stderr, "Unable to unpack raw data from %s\n", av[1]);
92 exit(1);
93 }
94 lr.adjust_blacklevel();
95 printf("%s\t%d-%d-%dx%d\tchannel: %d\n", av[1], colstart, rowstart, width, height, channel);
96
97 printf("%6s", "R\\C");
98 for (int col = colstart; col < colstart + width && col < lr.imgdata.sizes.raw_width; col++)
99 printf("%6u", col);
100 printf("\n");
101
102 if (lr.imgdata.rawdata.raw_image)
103 {
104 for (int row = rowstart; row < rowstart + height && row < lr.imgdata.sizes.raw_height; row++)
105 {
106 unsigned rcolors[48];
107 if (lr.imgdata.idata.colors > 1)
108 for (int c = 0; c < 48; c++)
109 rcolors[c] = lr.COLOR(row, c);
110 else
111 memset(rcolors, 0, sizeof(rcolors));
112 unsigned short *rowdata = &lr.imgdata.rawdata.raw_image[row * lr.imgdata.sizes.raw_pitch / 2];
113 printf("%6u", row);

Callers

nothing calls this directly

Calls 5

subtract_blFunction · 0.85
open_fileMethod · 0.80
unpackMethod · 0.80
adjust_blacklevelMethod · 0.80
usageFunction · 0.70

Tested by

no test coverage detected