src/chroma/cpp/rgbe.cpp
int RGBE_WritePixels(FILE *fp, float *data, int numpixels) {
    unsigned char rgbe[4];

    while (numpixels-- > 0) {
        float2rgbe(rgbe, data[RGBE_DATA_RED],
                   data[RGBE_DATA_GREEN], data[RGBE_DATA_BLUE]);
        data += RGBE_DATA_SIZE;
        if (fwrite(rgbe, sizeof(rgbe), 1, fp) < 1)
            return rgbe_error(rgbe_write_error, NULL);
    }
    return RGBE_RETURN_SUCCESS;
}
/* simple write routine that does not use run length encoding */
/* These routines can be made faster by allocating a larger buffer and
fread-ing and fwrite-ing the data in larger chunks */
simple write routine that does not use run length encoding
These routines can be made faster by allocating a larger buffer and
fread-ing and fwrite-ing the data in larger chunks
simple write routine that does not use run length encoding These routines can be made faster by allocating a larger buffer and fread - ing and fwrite - ing the data in larger chunks
int RGBE_WritePixels(FILE *fp, float *data, int numpixels) {
    unsigned char rgbe[4];
    while (numpixels-- > 0) {
        float2rgbe(rgbe, data[RGBE_DATA_RED],
                   data[RGBE_DATA_GREEN], data[RGBE_DATA_BLUE]);
        data += RGBE_DATA_SIZE;
        if (fwrite(rgbe, sizeof(rgbe), 1, fp) < 1)
            return rgbe_error(rgbe_write_error, NULL);
    }
    return RGBE_RETURN_SUCCESS;
}
int RGBE_WritePixels ( FILE * fp , float * data , int numpixels ) { unsigned char rgbe [ 4 ] ; while ( numpixels -- > 0 ) { float2rgbe ( rgbe , data [ RGBE_DATA_RED ] , data [ RGBE_DATA_GREEN ] , data [ RGBE_DATA_BLUE ] ) ; data += RGBE_DATA_SIZE ; if ( fwrite ( rgbe , sizeof ( rgbe ) , 1 , fp ) < 1 ) return rgbe_error ( rgbe_write_error , NULL ) ; } return RGBE_RETURN_SUCCESS ; }
simple write routine that does not use run length encoding
These routines can be made faster by allocating a larger buffer and
fread-ing and fwrite-ing the data in larger chunks
simple write routine that does not use run length encoding These routines can be made faster by allocating a larger buffer and fread - ing and fwrite - ing the data in larger chunks