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

« back to all changes in this revision

Viewing changes to source/blender/imbuf/intern/openexr/openexr_api.cpp

  • 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:
451
451
        openexr_header_compression(&header, compress);
452
452
        /* header.lineOrder() = DECREASING_Y; this crashes in windows for file read! */
453
453
        
454
 
        header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.43"));
 
454
        header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.43 and newer"));
455
455
        
456
456
        data->ofile = new OutputFile(filename, header);
457
457
}
842
842
} RGBA;
843
843
 
844
844
 
845
 
#if 0
 
845
/* debug only */
846
846
static void exr_print_filecontents(InputFile *file)
847
847
{
848
848
        const ChannelList &channels = file->header().channels();
853
853
                printf("OpenEXR-load: Found channel %s of type %d\n", i.name(), channel.type);
854
854
        }
855
855
}
856
 
#endif
 
856
 
 
857
/* for non-multilayer, map  R G B A channel names to something that's in this file */
 
858
static const char *exr_rgba_channelname(InputFile *file, const char *chan)
 
859
{
 
860
        const ChannelList &channels = file->header().channels();
 
861
        
 
862
        for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i)
 
863
        {
 
864
                const Channel &channel = i.channel();
 
865
                const char *str= i.name();
 
866
                int len= strlen(str);
 
867
                if(len) {
 
868
                        if(BLI_strcasecmp(chan, str+len-1)==0) {
 
869
                                return str;
 
870
                        }
 
871
                }
 
872
        }
 
873
        return chan;
 
874
}
 
875
 
 
876
 
857
877
 
858
878
static int exr_has_zbuffer(InputFile *file)
859
879
{
896
916
                //printf("OpenEXR-load: image data window %d %d %d %d\n", 
897
917
                //         dw.min.x, dw.min.y, dw.max.x, dw.max.y);
898
918
 
899
 
                // exr_print_filecontents(file);
 
919
                if(0) // debug
 
920
                        exr_print_filecontents(file);
900
921
                
901
922
                is_multi= exr_is_renderresult(file);
902
923
                
935
956
                                        /* but, since we read y-flipped (negative y stride) we move to last scanline */
936
957
                                        first+= 4*(height-1)*width;
937
958
                                        
938
 
                                        frameBuffer.insert ("R", Slice (FLOAT,  (char *) first, xstride, ystride));
939
 
                                        frameBuffer.insert ("G", Slice (FLOAT,  (char *) (first+1), xstride, ystride));
940
 
                                        frameBuffer.insert ("B", Slice (FLOAT,  (char *) (first+2), xstride, ystride));
941
 
                                                                                                                                                        /* 1.0 is fill value */
942
 
                                        frameBuffer.insert ("A", Slice (FLOAT,  (char *) (first+3), xstride, ystride, 1, 1, 1.0f));
 
959
                                        frameBuffer.insert ( exr_rgba_channelname(file, "R"), 
 
960
                                                                                Slice (FLOAT,  (char *) first, xstride, ystride));
 
961
                                        frameBuffer.insert ( exr_rgba_channelname(file, "G"), 
 
962
                                                                                Slice (FLOAT,  (char *) (first+1), xstride, ystride));
 
963
                                        frameBuffer.insert ( exr_rgba_channelname(file, "B"), 
 
964
                                                                                Slice (FLOAT,  (char *) (first+2), xstride, ystride));
 
965
                                                                                                                                                        
 
966
                                        frameBuffer.insert ( exr_rgba_channelname(file, "A"), 
 
967
                                                                                Slice (FLOAT,  (char *) (first+3), xstride, ystride, 1, 1, 1.0f)); /* 1.0 is fill value */
943
968
 
944
969
                                        if(exr_has_zbuffer(file)) 
945
970
                                        {