~ubuntu-branches/ubuntu/maverick/blender/maverick

« back to all changes in this revision

Viewing changes to source/blender/imbuf/intern/cineon/dpxlib.c

  • Committer: Bazaar Package Importer
  • Author(s): Khashayar Naderehvandi, Khashayar Naderehvandi, Alessio Treglia
  • Date: 2009-01-22 16:53:59 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090122165359-v0996tn7fbit64ni
Tags: 2.48a+dfsg-1ubuntu1
[ Khashayar Naderehvandi ]
* Merge from debian experimental (LP: #320045), Ubuntu remaining changes:
  - Add patch correcting header file locations.
  - Add libvorbis-dev and libgsm1-dev to Build-Depends.
  - Use avcodec_decode_audio2() in source/blender/src/hddaudio.c

[ Alessio Treglia ]
* Add missing previous changelog entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
static void
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));
70
70
}
71
71
 
72
72
static void
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));
126
126
}
127
127
 
128
128
static void
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]);
166
166
static void
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);
199
199
#endif
200
200
}
201
201
 
202
 
static int verbose = 1;
 
202
static int verbose = 0;
203
203
void
204
204
dpxSetVerbose(int verbosity) {
205
205
        verbose = verbosity;
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);
421
421
                dpxClose(dpx);
422
422
                return 0;
423
423
        }
441
441
                default: break;
442
442
                }
443
443
        }
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);
 
448
                dpxClose(dpx);
 
449
                return 0;
 
450
        }
 
451
 
446
452
        dpx->imageOffset = ntohl(header.fileInfo.offset);
447
 
 
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;
472
477
 
473
478
        logImageGetByteConversionDefaults(&dpx->params);
 
479
        /* The SMPTE define this code:
 
480
         *  2 - Linear
 
481
         *  3 - Logarithmic
 
482
         *
 
483
         * Note that transfer_characteristics is U8, don't need
 
484
         * check the byte order.
 
485
         */
 
486
        switch (header.imageInfo.channel[0].transfer_characteristics) {
 
487
                case 2:
 
488
                        dpx->params.doLogarithm= 0;
 
489
                        break;
 
490
                case 3:
 
491
                        dpx->params.doLogarithm= 1;
 
492
                        break;
 
493
                default:
 
494
                        if (verbose) d_printf("Un-supported Transfer Characteristics: %d\n", header.imageInfo.channel[0].transfer_characteristics);
 
495
                        dpxClose(dpx);
 
496
                        return 0;
 
497
                        break;
 
498
        }
474
499
        setupLut(dpx);
475
500
 
476
501
        dpx->getRow = &dpxGetRowBytes;
563
588
                ++shortFilename;
564
589
        }
565
590
        initDpxMainHeader(dpx, &header, shortFilename);
 
591
        logImageGetByteConversionDefaults(&dpx->params);
 
592
        /* Need set the file type before write the header!
 
593
         *  2 - Linear
 
594
         *  3 - Logarithmic
 
595
         *
 
596
         * Note that transfer characteristics is U8, don't need
 
597
         * check the byte order.
 
598
         */
 
599
        if (dpx->params.doLogarithm == 0)
 
600
                header.imageInfo.channel[0].transfer_characteristics= 2;
 
601
        else
 
602
                header.imageInfo.channel[0].transfer_characteristics= 3;
566
603
 
567
604
        if (fwrite(&header, sizeof(header), 1, dpx->file) == 0) {
568
605
                if (verbose) d_printf("Couldn't write image header\n");
570
607
                return 0;
571
608
        }
572
609
        dpx->fileYPos = 0;
573
 
 
574
 
        logImageGetByteConversionDefaults(&dpx->params);
575
610
        setupLut(dpx);
576
611
 
577
612
        dpx->getRow = 0;