encoding.c File Reference
#include "icv.h"
#include "vmath.h"
#include "bu/magic.h"
#include "bu/log.h"
#include "bu/malloc.h"
#include "bn.h"
Include dependency graph for encoding.c:

Go to the source code of this file.


double * uchar2double (unsigned char *data, size_t size)
unsigned char * data2uchar (const icv_image_t *bif)

Detailed Description

Contains encoding conversion supports for various file formats.

Definition in file encoding.c.

Function Documentation

double* uchar2double ( unsigned char *  data,
size_t  size 

converts unsigned char array to double array. This function returns array of double data.

Used to convert data from pix, bw, ppm type images for icv_image struct.

This does not free the char data.

datapointer to the array to be converted.
sizeSize of the array.
double array.

Definition at line 48 of file encoding.c.

References bu_malloc(), data, and ICV_CONV_8BIT.

Here is the call graph for this function:

unsigned char* data2uchar ( const icv_image_t bif)

Converts double data of icv_image to unsigned char data. This function also does gamma correction using the gamma_corr parameter of the image structure.

This is mainly used for saving pix, bw and ppm type images. Gamma correction prevents bad color aliasing.

Definition at line 79 of file encoding.c.

References bn_rand0to1, bn_rand_init, bu_malloc(), icv_image::channels, icv_image::data, icv_image::gamma_corr, icv_image::height, ICV_IMAGE_VAL_PTR, icv_image::width, and ZERO.

Referenced by bw_write(), pix_write(), png_write(), and ppm_write().

Here is the call graph for this function: