Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions | Variables

jp2.c File Reference

#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "imbuf.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_allocimbuf.h"
#include "IMB_filetype.h"
#include "openjpeg.h"

Go to the source code of this file.

Classes

struct  img_folder

Defines

#define JP2_FILEHEADER_SIZE   14
#define UPSAMPLE_8_TO_12(_val)   ((_val<<4) | (_val & ((1<<4)-1)))
#define UPSAMPLE_8_TO_16(_val)   ((_val<<8)+_val)
#define DOWNSAMPLE_FLOAT_TO_8BIT(_val)   (_val)<=0.0f?0: ((_val)>=1.0f?255: (int)(255.0f*(_val)))
#define DOWNSAMPLE_FLOAT_TO_12BIT(_val)   (_val)<=0.0f?0: ((_val)>=1.0f?4095: (int)(4095.0f*(_val)))
#define DOWNSAMPLE_FLOAT_TO_16BIT(_val)   (_val)<=0.0f?0: ((_val)>=1.0f?65535: (int)(65535.0f*(_val)))
#define CINEMA_24_CS   1302083
#define CINEMA_48_CS   651041
#define COMP_24_CS   1041666
#define COMP_48_CS   520833

Typedefs

typedef struct img_folder img_fol_t

Functions

static int check_jp2 (unsigned char *mem)
int imb_is_a_jp2 (unsigned char *buf)
static void error_callback (const char *msg, void *client_data)
static void warning_callback (const char *msg, void *client_data)
static void info_callback (const char *msg, void *client_data)
struct ImBufimb_jp2_decode (unsigned char *mem, size_t size, int flags)
static int initialise_4K_poc (opj_poc_t *POC, int numres)
static void cinema_parameters (opj_cparameters_t *parameters)
static void cinema_setup_encoder (opj_cparameters_t *parameters, opj_image_t *image, img_fol_t *img_fol)
static opj_image_t * ibuftoimage (ImBuf *ibuf, opj_cparameters_t *parameters)
int imb_savejp2 (struct ImBuf *ibuf, const char *name, int flags)

Variables

static char JP2_HEAD [] = {0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A}

Detailed Description

Definition in file jp2.c.


Define Documentation

#define CINEMA_24_CS   1302083

Definition at line 305 of file jp2.c.

Referenced by cinema_setup_encoder().

#define CINEMA_48_CS   651041

Definition at line 306 of file jp2.c.

Referenced by cinema_setup_encoder().

#define COMP_24_CS   1041666

Definition at line 307 of file jp2.c.

Referenced by cinema_setup_encoder().

#define COMP_48_CS   520833

Definition at line 308 of file jp2.c.

Referenced by cinema_setup_encoder().

#define DOWNSAMPLE_FLOAT_TO_12BIT (   _val)    (_val)<=0.0f?0: ((_val)>=1.0f?4095: (int)(4095.0f*(_val)))

Definition at line 291 of file jp2.c.

Referenced by ibuftoimage().

#define DOWNSAMPLE_FLOAT_TO_16BIT (   _val)    (_val)<=0.0f?0: ((_val)>=1.0f?65535: (int)(65535.0f*(_val)))

Definition at line 292 of file jp2.c.

Referenced by ibuftoimage().

#define DOWNSAMPLE_FLOAT_TO_8BIT (   _val)    (_val)<=0.0f?0: ((_val)>=1.0f?255: (int)(255.0f*(_val)))

Definition at line 290 of file jp2.c.

Referenced by ibuftoimage().

#define JP2_FILEHEADER_SIZE   14

Definition at line 41 of file jp2.c.

#define UPSAMPLE_8_TO_12 (   _val)    ((_val<<4) | (_val & ((1<<4)-1)))

Definition at line 287 of file jp2.c.

Referenced by ibuftoimage().

#define UPSAMPLE_8_TO_16 (   _val)    ((_val<<8)+_val)

Definition at line 288 of file jp2.c.

Referenced by ibuftoimage().


Typedef Documentation

typedef struct img_folder img_fol_t

Function Documentation

static int check_jp2 ( unsigned char *  mem) [static]

Definition at line 59 of file jp2.c.

References JP2_HEAD.

Referenced by imb_is_a_jp2(), and imb_jp2_decode().

static void cinema_parameters ( opj_cparameters_t *  parameters) [static]

Definition at line 330 of file jp2.c.

Referenced by ibuftoimage().

static void cinema_setup_encoder ( opj_cparameters_t *  parameters,
opj_image_t *  image,
img_fol_t img_fol 
) [static]

Definition at line 364 of file jp2.c.

References CINEMA_24_CS, CINEMA_48_CS, COMP_24_CS, COMP_48_CS, i, initialise_4K_poc(), and img_folder::rates.

Referenced by ibuftoimage().

static void error_callback ( const char *  msg,
void *  client_data 
) [static]

sample error callback expecting a FILE* client object

Definition at line 73 of file jp2.c.

Referenced by imb_jp2_decode(), and imb_savejp2().

static opj_image_t* ibuftoimage ( ImBuf ibuf,
opj_cparameters_t *  parameters 
) [static]
int imb_is_a_jp2 ( unsigned char *  buf)

Definition at line 64 of file jp2.c.

References check_jp2().

struct ImBuf* imb_jp2_decode ( unsigned char *  mem,
size_t  size,
int  flags 
) [read]
int imb_savejp2 ( struct ImBuf ibuf,
const char *  name,
int  flags 
)

Definition at line 671 of file jp2.c.

References error_callback(), ImBuf::ftype, ibuftoimage(), info_callback(), NULL, and warning_callback().

static void info_callback ( const char *  msg,
void *  client_data 
) [static]

sample debug callback expecting no client object

Definition at line 89 of file jp2.c.

Referenced by imb_jp2_decode(), and imb_savejp2().

static int initialise_4K_poc ( opj_poc_t *  POC,
int  numres 
) [static]

Definition at line 311 of file jp2.c.

Referenced by cinema_setup_encoder().

static void warning_callback ( const char *  msg,
void *  client_data 
) [static]

sample warning callback expecting a FILE* client object

Definition at line 81 of file jp2.c.

Referenced by imb_jp2_decode(), and imb_savejp2().


Variable Documentation

char JP2_HEAD[] = {0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A} [static]

Definition at line 43 of file jp2.c.

Referenced by check_jp2().