60
60
dumpDpxChannelInfo(DpxChannelInformation* chan) {
61
d_printf(" Signage %ld", (long)ntohl(chan->signage));
62
d_printf(" Ref low data %ld\n", (long)ntohl(chan->ref_low_data));
61
d_printf(" Signage %ld", (intptr_t)ntohl(chan->signage));
62
d_printf(" Ref low data %ld\n", (intptr_t)ntohl(chan->ref_low_data));
63
63
d_printf(" Ref low quantity %f\n", ntohf(chan->ref_low_quantity));
64
d_printf(" Ref high data %ld\n", (long)ntohl(chan->ref_high_data));
64
d_printf(" Ref high data %ld\n", (intptr_t)ntohl(chan->ref_high_data));
65
65
d_printf(" Ref high quantity %f\n", ntohf(chan->ref_high_quantity));
66
66
d_printf(" Designator1: %d,", chan->designator1);
67
67
d_printf(" Bits per pixel %d\n", chan->bits_per_pixel);
68
68
d_printf(" Packing: %d,", ntohs(chan->packing));
69
d_printf(" Data Offset: %ld,", (long)ntohl(chan->data_offset));
69
d_printf(" Data Offset: %ld,", (intptr_t)ntohl(chan->data_offset));
110
110
dumpDpxFileInfo(DpxFileInformation* fileInfo) {
111
111
d_printf("\n--File Information--\n");
112
112
d_printf("Magic: %8.8lX\n", (unsigned long)ntohl(fileInfo->magic_num));
113
d_printf("Image Offset %ld\n", (long)ntohl(fileInfo->offset));
113
d_printf("Image Offset %ld\n", (intptr_t)ntohl(fileInfo->offset));
114
114
d_printf("Version \"%s\"\n", fileInfo->vers);
115
d_printf("File size %ld\n", (long)ntohl(fileInfo->file_size));
116
d_printf("Ditto key %ld\n", (long)ntohl(fileInfo->ditto_key));
117
d_printf("Generic Header size %ld\n", (long)ntohl(fileInfo->gen_hdr_size));
118
d_printf("Industry Header size %ld\n", (long)ntohl(fileInfo->ind_hdr_size));
119
d_printf("User Data size %ld\n", (long)ntohl(fileInfo->user_data_size));
115
d_printf("File size %ld\n", (intptr_t)ntohl(fileInfo->file_size));
116
d_printf("Ditto key %ld\n", (intptr_t)ntohl(fileInfo->ditto_key));
117
d_printf("Generic Header size %ld\n", (intptr_t)ntohl(fileInfo->gen_hdr_size));
118
d_printf("Industry Header size %ld\n", (intptr_t)ntohl(fileInfo->ind_hdr_size));
119
d_printf("User Data size %ld\n", (intptr_t)ntohl(fileInfo->user_data_size));
120
120
d_printf("File name \"%s\"\n", fileInfo->file_name);
121
121
d_printf("Creation date \"%s\"\n", fileInfo->create_date);
122
122
d_printf("Creator \"%s\"\n", fileInfo->creator);
123
123
d_printf("Project \"%s\"\n", fileInfo->project);
124
124
d_printf("Copyright \"%s\"\n", fileInfo->copyright);
125
d_printf("Key %ld\n", (long)ntohl(fileInfo->key));
125
d_printf("Key %ld\n", (intptr_t)ntohl(fileInfo->key));
150
150
d_printf("Image orientation %d,", ntohs(imageInfo->orientation));
151
151
n = ntohs(imageInfo->channels_per_image);
152
152
d_printf("Channels %d\n", n);
153
d_printf("Pixels per line %ld\n", (long)ntohl(imageInfo->pixels_per_line));
154
d_printf("Lines per image %ld\n", (long)ntohl(imageInfo->lines_per_image));
153
d_printf("Pixels per line %ld\n", (intptr_t)ntohl(imageInfo->pixels_per_line));
154
d_printf("Lines per image %ld\n", (intptr_t)ntohl(imageInfo->lines_per_image));
155
155
for (i = 0; i < n; ++i) {
156
156
d_printf(" --Channel %d--\n", i);
157
157
dumpDpxChannelInfo(&imageInfo->channel[i]);
167
167
dumpDpxOriginationInfo(DpxOriginationInformation* originInfo) {
168
168
d_printf("\n--Origination Information--\n");
169
d_printf("X offset %ld\n", (long)ntohl(originInfo->x_offset));
170
d_printf("Y offset %ld\n", (long)ntohl(originInfo->y_offset));
169
d_printf("X offset %ld\n", (intptr_t)ntohl(originInfo->x_offset));
170
d_printf("Y offset %ld\n", (intptr_t)ntohl(originInfo->y_offset));
171
171
d_printf("X centre %f\n", ntohf(originInfo->x_centre));
172
172
d_printf("Y centre %f\n", ntohf(originInfo->y_centre));
173
d_printf("Original X %ld\n", (long)ntohl(originInfo->x_original_size));
174
d_printf("Original Y %ld\n", (long)ntohl(originInfo->y_original_size));
173
d_printf("Original X %ld\n", (intptr_t)ntohl(originInfo->x_original_size));
174
d_printf("Original Y %ld\n", (intptr_t)ntohl(originInfo->y_original_size));
175
175
d_printf("File name \"%s\"\n", originInfo->file_name);
176
176
d_printf("Creation time \"%s\"\n", originInfo->creation_time);
177
177
d_printf("Input device \"%s\"\n", originInfo->input_device);
417
417
/* let's assume dpx files are always network order */
418
418
if (header.fileInfo.magic_num != ntohl(DPX_FILE_MAGIC)) {
419
419
if (verbose) d_printf("Bad magic number %8.8lX in \"%s\".\n",
420
(unsigned long)ntohl(header.fileInfo.magic_num), filename);
420
(uintptr_t)ntohl(header.fileInfo.magic_num), filename);
444
dpx->bitsPerPixel = 10;
445
/* dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel; */
444
/* dpx->bitsPerPixel = 10; */
445
dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel;
446
if (dpx->bitsPerPixel != 10) {
447
if (verbose) d_printf("Don't support depth: %d\n", dpx->bitsPerPixel);
446
452
dpx->imageOffset = ntohl(header.fileInfo.offset);
448
453
dpx->lineBufferLength = pixelsToLongs(dpx->width * dpx->depth);
449
454
dpx->lineBuffer = malloc(dpx->lineBufferLength * 4);
450
455
if (dpx->lineBuffer == 0) {
471
476
dpx->fileYPos = 0;
473
478
logImageGetByteConversionDefaults(&dpx->params);
479
/* The SMPTE define this code:
483
* Note that transfer_characteristics is U8, don't need
484
* check the byte order.
486
switch (header.imageInfo.channel[0].transfer_characteristics) {
488
dpx->params.doLogarithm= 0;
491
dpx->params.doLogarithm= 1;
494
if (verbose) d_printf("Un-supported Transfer Characteristics: %d\n", header.imageInfo.channel[0].transfer_characteristics);
476
501
dpx->getRow = &dpxGetRowBytes;
565
590
initDpxMainHeader(dpx, &header, shortFilename);
591
logImageGetByteConversionDefaults(&dpx->params);
592
/* Need set the file type before write the header!
596
* Note that transfer characteristics is U8, don't need
597
* check the byte order.
599
if (dpx->params.doLogarithm == 0)
600
header.imageInfo.channel[0].transfer_characteristics= 2;
602
header.imageInfo.channel[0].transfer_characteristics= 3;
567
604
if (fwrite(&header, sizeof(header), 1, dpx->file) == 0) {
568
605
if (verbose) d_printf("Couldn't write image header\n");