# JP2 - JPEG-2000 file format reader/writer

## Classes
struct | opj_jp2
struct | opj_jp2_box
struct | opj_jp2_comps
## Defines
#define | JP2_BPCC 0x62706363
#define | JP2_COLR 0x636f6c72
#define | JP2_DBTL 0x6474626c
#define | JP2_FTYP 0x66747970
#define | JP2_IHDR 0x69686472
#define | JP2_JP 0x6a502020
#define | JP2_JP2 0x6a703220
#define | JP2_JP2C 0x6a703263
#define | JP2_JP2H 0x6a703268
#define | JP2_URL 0x75726c20
#define | JPIP_JPIP 0x6a706970
## Typedefs
typedef struct opj_jp2_box | opj_jp2_box_t
typedef struct opj_jp2_comps | opj_jp2_comps_t
typedef struct opj_jp2 | opj_jp2_t
## Exported functions
opj_jp2_t * | jp2_create_compress (opj_common_ptr cinfo)
opj_jp2_t * | jp2_create_decompress (opj_common_ptr cinfo)
opj_image_t * | jp2_decode (opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info)
void | jp2_destroy_compress (opj_jp2_t *jp2)
void | jp2_destroy_decompress (opj_jp2_t *jp2)
bool | jp2_encode (opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info)
bool | jp2_read_jp2h (opj_jp2_t *jp2, opj_cio_t *cio)
void | jp2_setup_decoder (opj_jp2_t *jp2, opj_dparameters_t *parameters)
void | jp2_setup_encoder (opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image)
void | jp2_write_jp2h (opj_jp2_t *jp2, opj_cio_t *cio)

## Detailed Description

## Define Documentation

#define JP2_BPCC 0x62706363

Bits per component box

#define JP2_COLR 0x636f6c72

Colour specification box

#define JP2_DBTL 0x6474626c

???

#define JP2_FTYP 0x66747970

File type box

#define JP2_IHDR 0x69686472

Image header box

#define JP2_JP 0x6a502020

JPEG 2000 signature box

#define JP2_JP2 0x6a703220

File type fields

#define JP2_JP2C 0x6a703263

Contiguous codestream box

#define JP2_JP2H 0x6a703268

JP2 header box

#define JP2_URL 0x75726c20

URL box

#define JPIP_JPIP 0x6a706970

## Typedef Documentation

typedef struct opj_jp2_box opj_jp2_box_t

JP2 Box

typedef struct opj_jp2_comps opj_jp2_comps_t

JP2 component

typedef struct opj_jp2 opj_jp2_t

JPEG-2000 file format reader/writer

## Function Documentation

opj_jp2_t* jp2_create_compress | ( | opj_common_ptr | cinfo | ) |

Creates a JP2 compression structure

Parameters:

  | cinfo | Codec context info

Returns:
  Returns a handle to a JP2 compressor if successful, returns NULL otherwise

opj_jp2_t* jp2_create_decompress | ( | opj_common_ptr | cinfo | ) |

Creates a JP2 decompression structure

Parameters:

  | cinfo | Codec context info

Returns:
  Returns a handle to a JP2 decompressor if successful, returns NULL otherwise

opj_image_t* jp2_decode | ( | opj_jp2_t * | jp2,
|  | opj_cio_t * | cio,
|  | opj_codestream_info_t * | cstr_info |
| ) |  |  |

Decode an image from a JPEG-2000 file stream

Parameters:

  | jp2 | JP2 decompressor handle
  | cio | Input buffer stream
  | cstr_info | Codestream information structure if required, NULL otherwise

Returns:
  Returns a decoded image if successful, returns NULL otherwise

void jp2_destroy_compress | ( | opj_jp2_t * | jp2 | ) |

Destroy a JP2 compressor handle

Parameters:

  | jp2 | JP2 compressor handle to destroy

void jp2_destroy_decompress | ( | opj_jp2_t * | jp2 | ) |

Destroy a JP2 decompressor handle

Parameters:

  | jp2 | JP2 decompressor handle to destroy

bool jp2_encode | ( | opj_jp2_t * | jp2,
|  | opj_cio_t * | cio,
|  | opj_image_t * | image,
|  | opj_codestream_info_t * | cstr_info |
| ) |  |  |

Encode an image into a JPEG-2000 file stream

Parameters:

  | jp2 | JP2 compressor handle
  | cio | Output buffer stream
  | image | Image to encode
  | cstr_info | Codestream information structure if required, NULL otherwise

Returns:
  Returns true if successful, returns false otherwise

bool jp2_read_jp2h | ( | opj_jp2_t * | jp2,
|  | opj_cio_t * | cio |
| ) |  |  |

Read the JP2H box - JP2 Header box (used in MJ2)

Parameters:

  | jp2 | JP2 handle
  | cio | Input buffer stream

Returns:
  Returns true if successful, returns false otherwise

void jp2_setup_decoder | ( | opj_jp2_t * | jp2,
|  | opj_dparameters_t * | parameters |
| ) |  |  |

Setup the decoder decoding parameters using user parameters. Decoding parameters are returned in jp2->j2k->cp.

Parameters:

  | jp2 | JP2 decompressor handle
  | parameters | decompression parameters

void jp2_setup_encoder | ( | opj_jp2_t * | jp2,
|  | opj_cparameters_t * | parameters,
|  | opj_image_t * | image |
| ) |  |  |

Setup the encoder parameters using the current image and using user parameters. Coding parameters are returned in jp2->j2k->cp.

Parameters:

  | jp2 | JP2 compressor handle
  | parameters | compression parameters
  | image | input filled image

void jp2_write_jp2h | ( | opj_jp2_t * | jp2,
|  | opj_cio_t * | cio |
| ) |  |  |

Write the JP2H box - JP2 Header box (used in MJ2)

Parameters:

  | jp2 | JP2 handle
  | cio | Output buffer stream