~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** \file blender/imbuf/intern/cineon/dpxlib.c
 
2
 *  \ingroup imbcineon
 
3
 */
1
4
/*
2
5
 *       Dpx image file format library routines.
3
6
 *
35
38
#include <string.h>                      /* memset */
36
39
#include "cin_debug_stuff.h"
37
40
#include "logmemfile.h"
 
41
#include "BLI_fileops.h"
38
42
 
39
43
static void
40
44
fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) {
41
45
 
 
46
        (void)dpx; /* unused */
 
47
        
42
48
        chan->signage = 0;
43
49
        chan->ref_low_data = htonl(0);
44
50
        chan->ref_low_quantity = htonf(0.0);
136
142
        if (dpx->depth == 1) {
137
143
                fillDpxChannelInfo(dpx, &imageInfo->channel[0], 0);
138
144
 
139
 
        } else if (dpx->depth == 3) {
 
145
        }
 
146
        else if (dpx->depth == 3) {
140
147
                fillDpxChannelInfo(dpx, &imageInfo->channel[0], 50);
141
148
        }
142
149
}
160
167
 
161
168
static void
162
169
fillDpxOriginationInfo(
163
 
        DpxFile* dpx, DpxOriginationInformation* originInfo, DpxFileInformation* fileInfo) {
 
170
        DpxFile* dpx, DpxOriginationInformation* originInfo, DpxFileInformation* fileInfo)
 
171
{
 
172
        /* unused */
 
173
        (void)dpx;
 
174
        (void)originInfo;
 
175
        (void)fileInfo;
164
176
}
165
177
 
166
178
static void
259
271
                        dpx->pixelBuffer[pixelIndex+2] = t & 0x3ff;
260
272
                        pixelIndex += 3;
261
273
                }
262
 
        } else /* if (dpx->depth == 3) */ {
 
274
        }
 
275
        else /* if (dpx->depth == 3) */ {
263
276
                for (longIndex = 0; longIndex < readLongs; ++longIndex) {
264
277
                        unsigned int t = ntohl(dpx->lineBuffer[longIndex]);
265
278
                        t = t >> 2;
275
288
 
276
289
        /* extract required pixels */
277
290
        for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
278
 
                if(dpx->params.doLogarithm)
 
291
                if (dpx->params.doLogarithm)
279
292
                        row[pixelIndex] = dpx->lut10_16[dpx->pixelBuffer[pixelIndex]];
280
293
                else
281
294
                        row[pixelIndex] = dpx->pixelBuffer[pixelIndex] << 6;
318
331
 
319
332
        /* put new pixels into pixelBuffer */
320
333
        for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
321
 
                if(dpx->params.doLogarithm)
 
334
                if (dpx->params.doLogarithm)
322
335
                        dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = dpx->lut16_16[row[pixelIndex]];
323
336
                else
324
337
                        dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = row[pixelIndex] >> 6;
340
353
                        dpx->lineBuffer[longIndex] = htonl(t);
341
354
                        pixelIndex += 3;
342
355
                }
343
 
        } else {
 
356
        }
 
357
        else {
344
358
                for (longIndex = 0; longIndex < writeLongs; ++longIndex) {
345
359
                        unsigned int t = dpx->pixelBuffer[pixelIndex+2] << 2 |
346
360
                                        (dpx->pixelBuffer[pixelIndex+1] << 12) |
391
405
 
392
406
        if (mode == LFREALFILE) {
393
407
                filename = bytestuff;
394
 
                dpx->file = fopen(filename, "rb");
 
408
                dpx->file = BLI_fopen(filename, "rb");
395
409
                if (dpx->file == 0) {   
396
410
                        if (verbose) d_printf("Failed to open file \"%s\".\n", filename);
397
411
                        dpxClose(dpx);
400
414
                dpx->membuffer = 0;
401
415
                dpx->memcursor = 0;
402
416
                dpx->membuffersize = 0;
403
 
        } else if (mode == LFMEMFILE) {
 
417
        }
 
418
        else if (mode == LFMEMFILE) {
404
419
                dpx->membuffer = (unsigned char *)bytestuff;
405
420
                dpx->memcursor = (unsigned char *)bytestuff;
406
421
                dpx->membuffersize = bufsize;
579
594
        dpx->lineBuffer = 0;
580
595
        dpx->pixelBuffer = 0;
581
596
 
582
 
        dpx->file = fopen(filename, "wb");
 
597
        dpx->file = BLI_fopen(filename, "wb");
583
598
        if (dpx->file == 0) {
584
599
                if (verbose) d_printf("Couldn't open file %s\n", filename);
585
600
                dpxClose(dpx);
614
629
        shortFilename = strrchr(filename, '/');
615
630
        if (shortFilename == 0) {
616
631
                shortFilename = filename;
617
 
        } else {
 
632
        }
 
633
        else {
618
634
                ++shortFilename;
619
635
        }
620
636
        initDpxMainHeader(dpx, &header, shortFilename);
677
693
        DpxMainHeader header;
678
694
        FILE* file;
679
695
 
680
 
        file = fopen(filename, "rb");
 
696
        file = BLI_fopen(filename, "rb");
681
697
        if (file == 0) {
682
698
                d_printf("Failed to open file \"%s\".\n", filename);
683
699
                return;