POV-Ray : Newsgroups : povray.programming : [PATCH] OpenEXR Support Server Time
22 Dec 2024 21:32:40 EST (-0500)
  [PATCH] OpenEXR Support (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Ruediger Sonderfeld
Subject: [PATCH] OpenEXR Support
Date: 3 Sep 2003 06:05:02
Message: <web.3f55bc894379bea59082a0c50@news.povray.org>
hi,
I'm writing a patch for povray to support the OpenEXR
(http://www.openexr.com/) Fileformat.

At the moment the patch doesn't work 100% correct and their is something
todo

TODO
-search OpenEXR in autoconf at the flags are just added to configure.in
-fix the problem with the file output
-add token and parser support for OpenEXR

but here is the patch so far (it is released under the terms of the GPL2
License http://www.gnu.org/licenses/gpl.html )

povray_openexr.diff
diff -r -u ./file_pov.cpp ../../povray-3.50c/src/file_pov.cpp
--- ./file_pov.cpp 2003-09-02 22:03:42.000000000 +0200
+++ ../../povray-3.50c/src/file_pov.cpp 2003-01-07 02:08:27.000000000 +0100
@@ -91,7 +91,6 @@
   { ".iff",  ".IFF",  "",      ""      }, // POV_File_Image_IFF
   { ".jpg",  ".JPG",  ".jpeg", ".JPEG" }, // POV_File_Image_JPEG
   { ".tif",  ".TIF",  ".tiff", ".TIFF" }, // POV_File_Image_TIFF
-  { ".exr",  ".EXR",  "",      ""      }, // POV_File_Image_OpenEXR
   { POV_IS1, POV_IS2, POV_IS3, POV_IS4 }, // POV_File_Image_System
   { ".pov",  ".POV",  "",      ""      }, // POV_File_Text_POV
   { ".inc",  ".INC",  "",      ""      }, // POV_File_Text_INC
diff -r -u ./file_pov.h ../../povray-3.50c/src/file_pov.h
--- ./file_pov.h 2003-09-02 21:58:42.000000000 +0200
+++ ../../povray-3.50c/src/file_pov.h 2003-01-07 02:08:30.000000000 +0100
@@ -55,20 +55,19 @@
   POV_File_Image_IFF = 6,
   POV_File_Image_JPEG = 7,
   POV_File_Image_TIFF = 8,
-  POV_File_Image_OpenEXR = 9,
-  POV_File_Image_System = 10,
-  POV_File_Text_POV = 11,
-  POV_File_Text_INC = 12,
+  POV_File_Image_System = 9,
+  POV_File_Text_POV = 10,
+  POV_File_Text_INC = 11,
   POV_File_Text_Macro = POV_File_Text_INC,
-  POV_File_Text_INI = 13,
-  POV_File_Text_CSV = 14,
-  POV_File_Text_Stream = 15,
-  POV_File_Text_User = 16,
-  POV_File_Data_DF3 = 17,
-  POV_File_Data_RCA = 18,
-  POV_File_Data_LOG = 19,
-  POV_File_Font_TTF = 20,
-  POV_File_Unknown_Count = 21
+  POV_File_Text_INI = 12,
+  POV_File_Text_CSV = 13,
+  POV_File_Text_Stream = 14,
+  POV_File_Text_User = 15,
+  POV_File_Data_DF3 = 16,
+  POV_File_Data_RCA = 17,
+  POV_File_Data_LOG = 18,
+  POV_File_Font_TTF = 19,
+  POV_File_Unknown_Count = 20
 };

 class pov_io_base
diff -r -u ./frame.h ../../povray-3.50c/src/frame.h
--- ./frame.h 2003-09-03 11:39:28.000000000 +0200
+++ ../../povray-3.50c/src/frame.h 2003-01-07 02:08:30.000000000 +0100
@@ -1203,7 +1203,6 @@
 #define PNG_FILE        0x00000100
 #define JPEG_FILE       0x00000200
 #define TIFF_FILE       0x00000400
-#define OPENEXR_FILE    0x00000800

 #define IMAGE_FILE_MASK 0x000007FF

@@ -1219,10 +1218,10 @@

 /* Image types. */

-#define IMAGE_FILE
IMAGE_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE+OPENEXR_FILE
-#define NORMAL_FILE
NORMAL_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE+OPENEXR_FILE
-#define MATERIAL_FILE
MATERIAL_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE+OPENEXR_FILE
-#define HF_FILE
HF_FTYPE+GIF_FILE+SYS_FILE+POT_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE+OPENEXR_FILE
+#define IMAGE_FILE
IMAGE_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE
+#define NORMAL_FILE
NORMAL_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE
+#define MATERIAL_FILE
MATERIAL_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE
+#define HF_FILE
HF_FTYPE+GIF_FILE+SYS_FILE+POT_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE

 typedef struct Image_Struct IMAGE;

diff -r -u ./histogra.cpp ../../povray-3.50c/src/histogra.cpp
--- ./histogra.cpp 2003-09-02 22:04:29.000000000 +0200
+++ ../../povray-3.50c/src/histogra.cpp 2003-01-07 02:08:27.000000000 +0100
@@ -279,7 +279,6 @@
     case SYS :
     case TARGA :
     case PNG:
-    case OPENEXR:

       OptionsSave = opts.Options;
       OutputQualitySave = opts.OutputQuality;
diff -r -u ./image.cpp ../../povray-3.50c/src/image.cpp
--- ./image.cpp 2003-09-02 22:05:13.000000000 +0200
+++ ../../povray-3.50c/src/image.cpp 2003-01-07 02:08:27.000000000 +0100
@@ -527,7 +527,6 @@
   case TGA_FILE:
   case PNG_FILE:
   case TIFF_FILE:
-         case OPENEXR_FILE:
   case SYS_FILE:
    if(Image->Colour_Map == NULL)
    {
diff -r -u ./Makefile.in ../../povray-3.50c/src/Makefile.in
--- ./Makefile.in 2003-09-03 11:44:03.000000000 +0200
+++ ../../povray-3.50c/src/Makefile.in 2003-01-07 02:23:23.000000000 +0100
@@ -88,12 +88,12 @@
 PACKAGE = @PACKAGE@
 VERSION = @VERSION@
 bin_PROGRAMS = povray
-povray_SOURCES = atmosph.cpp bbox.cpp bcyl.cpp benchmark.cpp bezier.cpp
blob.cpp boxes.cpp bsphere.cpp camera.cpp chi2.cpp colour.cpp colutils.cpp
cones.cpp csg.cpp discs.cpp express.cpp file_pov.cpp fncode.cpp
fnintern.cpp fnpovfpu.cpp fnsyntax.cpp fpmetric.cpp fractal.cpp
function.cpp gif.cpp gifdecod.cpp hcmplx.cpp hfield.cpp histogra.cpp
iff.cpp image.cpp interior.cpp isosurf.cpp jpeg_pov.cpp lathe.cpp
lbuffer.cpp lightgrp.cpp lighting.cpp matrices.cpp media.cpp mesh.cpp
normal.cpp objects.cpp octree.cpp optin.cpp optout.cpp parse.cpp
parsestr.cpp parstxtr.cpp pattern.cpp pgm.cpp photons.cpp pigment.cpp
planes.cpp png_pov.cpp point.cpp poly.cpp polygon.cpp polysolv.cpp
pov_mem.cpp povms.cpp povmscpp.cpp povmsend.cpp povmsrec.cpp povray.cpp
pov_util.cpp ppm.cpp prism.cpp quadrics.cpp quatern.cpp rad_data.cpp
radiosit.cpp ray.cpp render.cpp renderio.cpp sor.cpp spheres.cpp
sphsweep.cpp splines.cpp statspov.cpp super.cpp targa.cpp texture.cpp
tiff_pov.cpp tokenize.cpp torus.cpp triangle.cpp truetype.cpp txttest.cpp
userdisp.cpp userio.cpp vbuffer.cpp vlbuffer.cpp warps.cpp unix.cpp
povxlib.c config.h jversion.h optout.h povxlib.h atmosph.h bbox.h bcyl.h
bezier.h blob.h boxes.h bsphere.h camera.h chi2.h colour.h colutils.h
cones.h csg.h discs.h express.h file_pov.h fncode.h fnintern.h fnpovfpu.h
fnsyntax.h fpmetric.h fractal.h frame.h function.h gifdecod.h gif.h
hcmplx.h hfield.h histogra.h iff.h image.h interior.h isosurf.h jpeg_pov.h
lathe.h lbuffer.h lightgrp.h lighting.h matrices.h media.h mesh.h normal.h
objects.h octree.h optin.h parse.h parsestr.h parstxtr.h pattern.h pgm.h
photons.h pigment.h planes.h png_pov.h point.h polygon.h poly.h polysolv.h
pov_err.h pov_mem.h povmscpp.h povmsend.h povmsgid.h povms.h povmsrec.h
povproto.h povray.h pov_util.h ppm.h prism.h quadrics.h quatern.h
radiosit.h ray.h render.h renderio.h sor.h spheres.h sphsweep.h splines.h
statspov.h super.h targa.h texture.h tiff_pov.h tokenize.h torus.h
triangle.h truetype.h txttest.h userdisp.h userio.h vbuffer.h vector.h
vlbuffer.h warps.h  conf.h openexr_pov.cpp openexr_pov.h
+povray_SOURCES = atmosph.cpp bbox.cpp bcyl.cpp benchmark.cpp bezier.cpp
blob.cpp boxes.cpp bsphere.cpp camera.cpp chi2.cpp colour.cpp colutils.cpp
cones.cpp csg.cpp discs.cpp express.cpp file_pov.cpp fncode.cpp
fnintern.cpp fnpovfpu.cpp fnsyntax.cpp fpmetric.cpp fractal.cpp
function.cpp gif.cpp gifdecod.cpp hcmplx.cpp hfield.cpp histogra.cpp
iff.cpp image.cpp interior.cpp isosurf.cpp jpeg_pov.cpp lathe.cpp
lbuffer.cpp lightgrp.cpp lighting.cpp matrices.cpp media.cpp mesh.cpp
normal.cpp objects.cpp octree.cpp optin.cpp optout.cpp parse.cpp
parsestr.cpp parstxtr.cpp pattern.cpp pgm.cpp photons.cpp pigment.cpp
planes.cpp png_pov.cpp point.cpp poly.cpp polygon.cpp polysolv.cpp
pov_mem.cpp povms.cpp povmscpp.cpp povmsend.cpp povmsrec.cpp povray.cpp
pov_util.cpp ppm.cpp prism.cpp quadrics.cpp quatern.cpp rad_data.cpp
radiosit.cpp ray.cpp render.cpp renderio.cpp sor.cpp spheres.cpp
sphsweep.cpp splines.cpp statspov.cpp super.cpp targa.cpp texture.cpp
tiff_pov.cpp tokenize.cpp torus.cpp triangle.cpp truetype.cpp txttest.cpp
userdisp.cpp userio.cpp vbuffer.cpp vlbuffer.cpp warps.cpp unix.cpp
povxlib.c config.h jversion.h optout.h povxlib.h atmosph.h bbox.h bcyl.h
bezier.h blob.h boxes.h bsphere.h camera.h chi2.h colour.h colutils.h
cones.h csg.h discs.h express.h file_pov.h fncode.h fnintern.h fnpovfpu.h
fnsyntax.h fpmetric.h fractal.h frame.h function.h gifdecod.h gif.h
hcmplx.h hfield.h histogra.h iff.h image.h interior.h isosurf.h jpeg_pov.h
lathe.h lbuffer.h lightgrp.h lighting.h matrices.h media.h mesh.h normal.h
objects.h octree.h optin.h parse.h parsestr.h parstxtr.h pattern.h pgm.h
photons.h pigment.h planes.h png_pov.h point.h polygon.h poly.h polysolv.h
pov_err.h pov_mem.h povmscpp.h povmsend.h povmsgid.h povms.h povmsrec.h
povproto.h povray.h pov_util.h ppm.h prism.h quadrics.h quatern.h
radiosit.h ray.h render.h renderio.h sor.h spheres.h sphsweep.h splines.h
statspov.h super.h targa.h texture.h tiff_pov.h tokenize.h torus.h
triangle.h truetype.h txttest.h userdisp.h userio.h vbuffer.h vector.h
vlbuffer.h warps.h  conf.h
 DEFS = -DPREFIX=\"$(prefix)\" -DPOV_LIB_DIR=\"@datadir@/povray-3.5\"
-DCOMPILER_VER=\".Linux.$(CC)\" -DSYSCONFDIR=\"$(sysconfdir)\"
-DUSE_IO_RESTRICTIONS=\"$(ac_use_io_restrictions)\"
 NOMULTICHAR = `if [ "X$(CC)" = "Xgcc" ]; then echo "-Wno-multichar"; fi `
 LDADD = @X_LIBS@
 CFLAGS = -O3 -mcpu=i586 -march=i586 -finline-functions -ffast-math
-fomit-frame-pointer -funroll-loops -fexpensive-optimizations
-malign-double -foptimize-sibling-calls -minline-all-stringops
-Wno-multichar
-CXXFLAGS = -I/usr/include/OpenEXR $(NOMULTICHAR) -O3 -finline-functions
-ffast-math -fomit-frame-pointer -funroll-loops -fexpensive-optimizations
-malign-double -foptimize-sibling-calls -minline-all-stringops
-Wno-multichar
+CXXFLAGS = $(NOMULTICHAR) -O3 -finline-functions -ffast-math
-fomit-frame-pointer -funroll-loops -fexpensive-optimizations
-malign-double -foptimize-sibling-calls -minline-all-stringops
-Wno-multichar
 LDFLAGS = @X_CFLAGS@
 EXTRA_DIST = xpovicon.xbm xpovmask.xbm xpovicon.xpm
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -102,7 +102,7 @@
 PROGRAMS =  $(bin_PROGRAMS)

 CPPFLAGS = @CPPFLAGS@
-LIBS = @LIBS@ -lIex -lHalf -lIlmImf
+LIBS = @LIBS@
 X_CFLAGS = @X_CFLAGS@
 X_LIBS = @X_LIBS@
 X_EXTRA_LIBS = @X_EXTRA_LIBS@
@@ -120,7 +120,7 @@
 radiosit.o ray.o render.o renderio.o sor.o spheres.o sphsweep.o \
 splines.o statspov.o super.o targa.o texture.o tiff_pov.o tokenize.o \
 torus.o triangle.o truetype.o txttest.o userdisp.o userio.o vbuffer.o \
-vlbuffer.o warps.o unix.o povxlib.o openexr_pov.o
+vlbuffer.o warps.o unix.o povxlib.o
 povray_LDADD = $(LDADD)
 povray_DEPENDENCIES =
 povray_LDFLAGS =
diff -r -u ./optin.cpp ../../povray-3.50c/src/optin.cpp
--- ./optin.cpp 2003-09-02 21:11:20.000000000 +0200
+++ ../../povray-3.50c/src/optin.cpp 2003-01-07 02:08:28.000000000 +0100
@@ -120,7 +120,7 @@
 };

 /* Supported output file types */
-char *Output_File_Types = "sStTcCpPnNdDrRoO";
+char *Output_File_Types = "sStTcCpPnNdDrR";

 /*
    Keyword table for the INI-file parser.
diff -r -u ./optout.cpp ../../povray-3.50c/src/optout.cpp
--- ./optout.cpp 2003-09-02 22:12:56.000000000 +0200
+++ ../../povray-3.50c/src/optout.cpp 2003-01-07 02:08:28.000000000 +0100
@@ -550,7 +550,6 @@
       Banner("  Fx      = write output file in format x\n");
       Banner("            FC  - Compressed Targa with 24 or 32 bpp\n");
       Banner("            FNn - PNG (n bits/color, n = 5 to 16, default is
8)\n");
-      Banner("            FO  - OpenEXR");
 //      Banner("            FJn - JPEG (n compression quality, n = 0 to
100, default is 100)\n");
       Banner("            FP  - PPM\n");
       Banner("            FS  - System specific\n");
@@ -855,7 +854,6 @@
       case 'P': Render_Info("PPM");             break;
       case 'S': Render_Info("(system format)"); break;
       case 'T': Render_Info("Targa");           break;
-      case 'O': Render_Info("OpenEXR");         break;
     }

     if (opts.Options & HF_GRAY_16)
@@ -933,7 +931,6 @@
       case TARGA: type = "TGA"; break;
       case PNG:   type = "PNG"; break;
       case PPM:   type = "PPM"; break;
-      case OPENEXR: type = "OpenEXR"; break;
       case SYS:   type = "(system format)"; break;
       case NONE:                     /* Just to stop warning messages */
       default:    type = "None"; break;
diff -r -u ./optout.h ../../povray-3.50c/src/optout.h
--- ./optout.h 2003-06-02 21:06:36.000000000 +0200
+++ ../../povray-3.50c/src/optout.h 2003-01-07 02:30:05.000000000 +0100
@@ -46,7 +46,7 @@
 #define OFFICIAL_VERSION_NUMBER 350

 #define DISTRIBUTION_MESSAGE_1 "This is an unofficial version compiled by:"
-//#error You must complete the following DISTRIBUTION_MESSAGE macro
+#error You must complete the following DISTRIBUTION_MESSAGE macro
 #define DISTRIBUTION_MESSAGE_2 " FILL IN NAME
HERE........................."
 #define DISTRIBUTION_MESSAGE_3 " The POV-Ray Team(tm) is not responsible
for supporting this version."

diff -r -u ./povmsrec.cpp ../../povray-3.50c/src/povmsrec.cpp
--- ./povmsrec.cpp 2003-09-02 22:09:32.000000000 +0200
+++ ../../povray-3.50c/src/povmsrec.cpp 2003-01-07 02:08:29.000000000 +0100
@@ -410,10 +410,6 @@

       switch(i)
       {
-         case 'O':
-         case 'o':
-    opts.histogram_type = OPENEXR;
-    opts.histogram_file_type = OPENEXR_FILE;
          case 'C':
          case 'c':
             opts.histogram_type = CSV;
@@ -465,7 +461,6 @@

          switch(opts.histogram_type)
          {
-                         case OPENEXR:    def_ext = ".exr"; break;
     case CSV:  def_ext = ".csv"; break;
     case TARGA:  def_ext = ".tga"; break;
     case PNG:  def_ext = ".png"; break;
diff -r -u ./render.h ../../povray-3.50c/src/render.h
--- ./render.h 2003-09-02 22:00:02.000000000 +0200
+++ ../../povray-3.50c/src/render.h 2003-01-07 02:08:31.000000000 +0100
@@ -52,7 +52,6 @@
   PPM,
   TARGA,
   PNG,
-  OPENEXR,
   NONE
 } Histogram_Types;

diff -r -u ./renderio.cpp ../../povray-3.50c/src/renderio.cpp
--- ./renderio.cpp 2003-09-02 23:14:00.000000000 +0200
+++ ../../povray-3.50c/src/renderio.cpp 2003-01-07 02:08:29.000000000 +0100
@@ -62,7 +62,6 @@
 #include "targa.h"
 #include "png_pov.h"
 #include "jpeg_pov.h"
-#include "openexr_pov.h"

 #include <algorithm>

@@ -222,11 +221,6 @@
         opts.Output_File_Type = PNG_FILE;
         def_ext=".png";
         break;
-      case 'o':
-      case 'O':
- opts.Output_File_Type = OPENEXR_FILE;
- def_ext=".exr";
- break;
       case 'd' :
       case 'D' :
         Error ("Dump format no longer supported.");
@@ -547,18 +541,6 @@
    }
   }
  }
- else if((file_type & OPENEXR_FILE) == OPENEXR_FILE)
- {
-         i = POV_NEW(OpenEXR_Image)(filename, w, h, m, l);
-  /*if(i != NULL)
-  {
-    if(i->Valid() == false)
-    {
-      POV_DELETE(i, Image_File_Class);
-      i = NULL;
-    }
-    }*/
- }

  return i;
 }


openexr_pov.h
/****************************************************************************
*                   openexr_pov.h
*
*  This module contains all defines, typedefs, and prototypes for
*  OPENEXR_POV.CPP.
*
*  Copyright 2003 Ruediger Sonderfeld <kin### [at] c-plusplusde>
*---------------------------------------------------------------------------
* this file is released under the terms of the GPL 2 License
* http://www.gnu.org/licenses/gpl.html
*
* $File: //depot/povray/3.5/source/openexr_pov.h $
* $Revision: #1 $
* $Change: 0 $
* $DateTime: 2003/09/03 11:25:17 CEST $
* $Author: Ruediger Sonderfeld $
* $Log$
*
*****************************************************************************/

#ifndef OPENEXR_POV_H
#define OPENEXR_POV_H

#include <OpenEXR/ImfRgbaFile.h>
#include <OpenEXR/ImfArray.h>
#include "frame.h"
#include "povproto.h"

// base class for the OpenEXR Managing classes
class OpenEXRImage
{
 public:
  virtual void write(COLOUR *line_data) { Error("write not implemented"); };
  virtual void read(COLOUR *line_data) { Error("read not implemented"); };
  virtual int line() =0;
  virtual int Width() =0;
  virtual int Height() =0;
};

// class for reading OpenEXR images (untestet)
class OpenEXR_Read_Image : public OpenEXRImage, public Imf::RgbaInputFile
{
  Imf::Array2D<Imf::Rgba> pixels;
  int width,height,current_line;
 public:
  OpenEXR_Read_Image(const char *filename,int width,int height,int line);
  void read(COLOUR *line_data);
  int line() { return current_line; }
  int Width() { return width; }
  int Height() { return height; }
};

// class for writing OpenEXR images
class OpenEXR_Write_Image : public OpenEXRImage, public Imf::RgbaOutputFile
{
  Imf::Array2D<Imf::Rgba> pixels;
  int current_line;
  int width;
  int height;
 public:
  OpenEXR_Write_Image(const char *filename,int w,int h,int line);
  void write(COLOUR *line_data);
  int line() { return current_line; }
  int Width() { return width; }
  int Height() { return height; }
};

// image class
class OpenEXR_Image : public Image_File_Class
{
  OpenEXRImage *img;
 public:
  OpenEXR_Image(char *filename,int width,int height,int mode, int line=0);
  ~OpenEXR_Image() { delete img; }

  void Write_Line(COLOUR *line_data) { img->write(line_data); }
  int Read_Line(COLOUR *line_data) { img->read(line_data); }

  int Line() { return img->line();; }
  int Width() { return img->Width(); }
  int Height() { return img->Height(); }
};

#endif

openexr_pov.cpp
/*****************************************************************************
*        openexr_pov.cpp
*
*  This module contains the code to read and write the OpenEXR output file
*
*  Copyright 2003 Ruediger Sonderfeld <kin### [at] c-plusplusde>
*---------------------------------------------------------------------------
* this file is released under the terms of the GPL 2 License
* http://www.gnu.org/licenses/gpl.html
*
* $File: //depot/povray/3.5/source/openexr_pov.cpp $
* $Revision: #1 $
* $Change: 0 $
* $DateTime:  $
* $Author: Ruediger Sonderfeld $
* $Log$
*
*****************************************************************************/

#include "openexr_pov.h"

OpenEXR_Write_Image::OpenEXR_Write_Image(const char *filename,int w,int h,
      int line)
  : Imf::RgbaOutputFile(filename,w,h),
    pixels(h,w),width(w),height(h),current_line(line)
{ }

void OpenEXR_Write_Image::write(COLOUR *line_data)
{
  //convert COLOUR to Imf::Rgba
  for(int i=0;i<width;++i) {
    pixels[current_line][i].r=line_data[i][pRED];
    pixels[current_line][i].g=line_data[i][pGREEN];
    pixels[current_line][i].b=line_data[i][pBLUE];
    pixels[current_line][i].a=line_data[i][pTRANSM]; //TODO: Check this!
  }
  // this could be done in the dtor but povray doesn't delete the memory
  // and the dtor isn't called :(
  // Writing to the file
  if(++current_line==height) {
    setFrameBuffer(pixels[0],1,width);
    writePixels(height);
  }
}

OpenEXR_Read_Image:: OpenEXR_Read_Image(const char *filename,int w,int h,
     int line)
  : Imf::RgbaInputFile(filename),current_line(line)
{
  Imath::Box2i header=dataWindow();
  int real_width= header.max.x - header.min.x + 1;
  int real_height= header.max.y - header.min.y + 1;
  width=real_width>w ? real_width : w;
  height=real_height>h ? real_height : h;
  pixels.resizeErase(height,width);

  //read pixel data into the pixels array
  setFrameBuffer(pixels[0]-header.min.x-header.min.y*width,1,width);
  readPixels(header.min.y,header.max.y);

  width=w;
  height=h;
}

void OpenEXR_Read_Image::read(COLOUR *line_data)
{
  // convert pixel data
  for(int i=0;i<width;++i) {
    line_data[i][pRED]=pixels[current_line][i].r;
    line_data[i][pGREEN]=pixels[current_line][i].g;
    line_data[i][pBLUE]=pixels[current_line][i].b;
    line_data[i][pTRANSM]=pixels[current_line][i].a; //TODO: Check this!
  }
  ++current_line;
}

OpenEXR_Image::OpenEXR_Image(char *filename,int width,int height,int mode,
        int line)
{
  switch(mode)
  {
  case READ_MODE:
    img=new OpenEXR_Read_Image(filename,width,height,line);
    break;
  case WRITE_MODE:
    img=new OpenEXR_Write_Image(filename,width,height,line);
    break;
  case APPEND_MODE:
    Error("not supported at the moment");
    //img=new OpenEXR_Write_Image();
    break;
  }
}


Post a reply to this message

From: Christoph Hormann
Subject: Re: [PATCH] OpenEXR Support
Date: 3 Sep 2003 07:09:39
Message: <3F55CBF3.EFD4665F@gmx.de>
Ruediger Sonderfeld wrote:
> 
> hi,
> I'm writing a patch for povray to support the OpenEXR
> (http://www.openexr.com/) Fileformat.
> 
> At the moment the patch doesn't work 100% correct and their is something
> todo

Generating high dynamic range output from POV-Ray is not possible
without quite intensive modifications since POV-Ray clips colors soon
after rendering and this prevents usable HDR output.

Next MegaPOV will contain support for the RADIANCE hdr format.

> 
> but here is the patch so far (it is released under the terms of the GPL2
> License http://www.gnu.org/licenses/gpl.html )
> 

Note the GPL is not compatible to the POV-Ray licence.  You can for sure
publish your patch under GPL but no one will be allowed to distribute it
as either complete souce or binary -> it will be quite unusable in
practice.

-- Christoph


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: [PATCH] OpenEXR Support
Date: 3 Sep 2003 08:04:38
Message: <3f55d8d6$1@news.povray.org>
In article <3F55CBF3.EFD4665F@gmx.de> , Christoph Hormann 
<chr### [at] gmxde>  wrote:

> Generating high dynamic range output from POV-Ray is not possible
> without quite intensive modifications since POV-Ray clips colors soon
> after rendering and this prevents usable HDR output.

Which is why anybody who wants to add something like this should wait for
3.5.1 source code, which contains the necessary changes to clip much later.

>> but here is the patch so far (it is released under the terms of the GPL2
>> License http://www.gnu.org/licenses/gpl.html )
>
> Note the GPL is not compatible to the POV-Ray licence.  You can for sure
> publish your patch under GPL but no one will be allowed to distribute it
> as either complete souce or binary -> it will be quite unusable in
> practice.

Indeed, the two licenses are completely incompatible.  Distributing the
source code for one or the other of course does not create any conflicts,
but distributing the source code (or binary) as a whole would surely violate
both licenses.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Ruediger Sonderfeld
Subject: Re: [PATCH] OpenEXR Support
Date: 3 Sep 2003 08:35:01
Message: <web.3f55df1b26683b69357021d60@news.povray.org>
Thorsten Froehlich wrote:
>In article <3F55CBF3.EFD4665F[at]gmx.de> , Christoph Hormann
><chr### [at] gmxde>  wrote:
>> Generating high dynamic range output from POV-Ray is not possible
>> without quite intensive modifications since POV-Ray clips colors soon
>> after rendering and this prevents usable HDR output.

oh, thats bad!

>Which is why anybody who wants to add something like this should wait for
>3.5.1 source code, which contains the necessary changes to clip much later.

ok. I think I will wait and then rewrite my patch

>Indeed, the two licenses are completely incompatible.

ok. I will change the license in the next release.


Post a reply to this message

From: George Pantazopoulos
Subject: Re: [PATCH] OpenEXR Support
Date: 3 Sep 2003 19:43:43
Message: <oprux7lgzgu942mt@news.povray.org>
Ruediger,
	I'm very glad to hear that you are adding OpenEXR support! I suggest you 
use the Modified BSD License for your patch, since that is the license used 
by OpenEXR itself and would then make it compatible with POV-Ray (am I 
right, Christoph or Thorsten?).

George



On Wed,  3 Sep 2003 08:31:23 EDT, Ruediger Sonderfeld <kingruedi@c- 
plusplus.de> wrote:

> Thorsten Froehlich wrote:
>> In article <3F55CBF3.EFD4665F[at]gmx.de> , Christoph Hormann
>> <chr### [at] gmxde>  wrote:
>>> Generating high dynamic range output from POV-Ray is not possible
>>> without quite intensive modifications since POV-Ray clips colors soon
>>> after rendering and this prevents usable HDR output.
>
> oh, thats bad!
>
>> Which is why anybody who wants to add something like this should wait 
>> for
>> 3.5.1 source code, which contains the necessary changes to clip much 
>> later.
>
> ok. I think I will wait and then rewrite my patch
>
>> Indeed, the two licenses are completely incompatible.
>
> ok. I will change the license in the next release.
>
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


Post a reply to this message

From: Ruediger Sonderfeld
Subject: Re: [PATCH] OpenEXR Support
Date: 4 Sep 2003 07:00:02
Message: <web.3f571a3326683b69a3585ac80@news.povray.org>
George Pantazopoulos wrote:
>Ruediger,
> I'm very glad to hear that you are adding OpenEXR support! I suggest you
>use the Modified BSD License for your patch, since that is the license used
>by OpenEXR itself and would then make it compatible with POV-Ray (am I
>right, Christoph or Thorsten?).

I will change the license to a BSD Style License in the next release. At the
moment there is a bug in the OpenEXR Support.

(exrdisplay reports:

Error reading pixel data from image file "coord.exr". Error in
Huffman-encoded data (decoded data are shorter than expected).)

when this is fixed I will release a beta version under BSD Style license.


Post a reply to this message

From: Christoph Hormann
Subject: Re: [PATCH] OpenEXR Support
Date: 4 Sep 2003 07:13:36
Message: <3F571E5F.D66C7EA4@gmx.de>
Thorsten Froehlich wrote:
> 
> > Generating high dynamic range output from POV-Ray is not possible
> > without quite intensive modifications since POV-Ray clips colors soon
> > after rendering and this prevents usable HDR output.
> 
> Which is why anybody who wants to add something like this should wait for
> 3.5.1 source code, which contains the necessary changes to clip much later.

Is this a very recent change or have i missed something before?  I moved
clipping to just before file writing myself for MegaPOV and did not yet
see anything from 3.5.1 conflicting with it.

-- Christoph


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: [PATCH] OpenEXR Support
Date: 4 Sep 2003 08:07:02
Message: <3f572ae6$1@news.povray.org>
In article <3F571E5F.D66C7EA4@gmx.de> , Christoph Hormann 
<chr### [at] gmxde>  wrote:

>> Which is why anybody who wants to add something like this should wait for
>> 3.5.1 source code, which contains the necessary changes to clip much later.
>
> Is this a very recent change or have i missed something before?  I moved
> clipping to just before file writing myself for MegaPOV and did not yet
> see anything from 3.5.1 conflicting with it.

No, has been in there for some time now (half a year?).

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: ABX
Subject: Re: [PATCH] OpenEXR Support
Date: 4 Sep 2003 08:19:12
Message: <lpaelvk0bpuhrhjh7kclg9pgah41t28his@4ax.com>
On Thu, 04 Sep 2003 14:07:00 +0200, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> > > Which is why anybody who wants to add something like this should wait for
> > > 3.5.1 source code, which contains the necessary changes to clip much later.
> >
> > Is this a very recent change or have i missed something before?  I moved
> > clipping to just before file writing myself for MegaPOV and did not yet
> > see anything from 3.5.1 conflicting with it.
>
> No, has been in there for some time now (half a year?).

Then I agree it wasn't sufficient amount of changes. Christoph indeed made it
"really" working for MegaPOV 1.1 and realised it optional with:

  global_settings { clip_colors off }

Quoting our manual "The default value for this switch is on which results in
the same behaviour as POV-Ray 3.5". The difference is visible and important in
case of hdr output or camera_view pigment patches.

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: [PATCH] OpenEXR Support
Date: 4 Sep 2003 16:06:23
Message: <3f579b3f$1@news.povray.org>
In article <lpaelvk0bpuhrhjh7kclg9pgah41t28his@4ax.com> , ABX 
<abx### [at] abxartpl>  wrote:

>> No, has been in there for some time now (half a year?).
>
> Then I agree it wasn't sufficient amount of changes.

The changes were to the way anti-aliasing and clipping take place such that
anti-aliased unclipped values can be processed _internally_ in a clean
manner.  They were never meant to be useful for anything else.  Of course to
get unclipped output to a file, one still needs to apply more changes.  It
is not like this would be a feature in 3.5.1.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.