OpenJPEG: image.c File Reference

OpenJPEG 2.5.0

Functions
image.c File Reference
`#include "opj_includes.h"`

## Functions
opj_image_t * | opj_image_create0 (void)
| Create an empty image. More...
opj_image_t *OPJ_CALLCONV | opj_image_create (OPJ_UINT32 numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc)
| Create an image. More...
void OPJ_CALLCONV | opj_image_destroy (opj_image_t *image)
| Deallocate any resources associated with an image. More...
void | opj_image_comp_header_update (opj_image_t *p_image_header, const struct opj_cp *p_cp)
| Updates the components characteristics of the image from the coding parameters. More...
void | opj_copy_image_header (const opj_image_t *p_image_src, opj_image_t *p_image_dest)
| Copy only header of image and its component header (no data are copied) if dest image have data, they will be freed. More...
opj_image_t *OPJ_CALLCONV | opj_image_tile_create (OPJ_UINT32 numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc)
| Creates an image without allocating memory for the image (used in the new version of the library). More...

## Function Documentation

## ◆ opj_copy_image_header()

void opj_copy_image_header | ( | const opj_image_t * | p_image_src,
|  | opj_image_t * | p_image_dest
| ) |  |

Copy only header of image and its component header (no data are copied) if dest image have data, they will be freed.

Parameters

  p_image_src | the src image
  p_image_dest | the dest image

References opj_image::color_space, opj_image::comps, opj_image_comp::data, opj_image::icc_profile_buf, opj_image::icc_profile_len, opj_image::numcomps, opj_free(), opj_image_data_free(), opj_malloc(), opj_image::x0, opj_image::x1, opj_image::y0, and opj_image::y1.

Referenced by opj_j2k_decode(), opj_j2k_get_tile(), opj_j2k_read_header(), and opj_j2k_start_compress().

## ◆ opj_image_comp_header_update()

void opj_image_comp_header_update | ( | opj_image_t * | p_image_header,
|  | const struct opj_cp * | p_cp
| ) |  |

Updates the components characteristics of the image from the coding parameters.

Parameters

  p_image_header | the image header to update.
  p_cp | the coding parameters from which to update the image.

References opj_image::comps, opj_image_comp::dx, opj_image_comp::dy, opj_image_comp::factor, opj_image_comp::h, opj_image::numcomps, opj_uint_adds(), opj_uint_ceildiv(), opj_uint_ceildivpow2(), opj_uint_max(), opj_uint_min(), opj_cp::tdx, opj_cp::tdy, opj_cp::th, opj_cp::tw, opj_cp::tx0, opj_cp::ty0, opj_image_comp::w, opj_image_comp::x0, opj_image::x0, opj_image::x1, opj_image_comp::y0, opj_image::y0, and opj_image::y1.

Referenced by opj_j2k_read_siz().

## ◆ opj_image_create()

opj_image_t *OPJ_CALLCONV opj_image_create | ( | OPJ_UINT32 | numcmpts,
|  | opj_image_cmptparm_t * | cmptparms,
|  | OPJ_COLOR_SPACE | clrspc
| ) |  |

Create an image.

Parameters

  numcmpts | number of components
  cmptparms | components parameters
  clrspc | image color space

Returns
  returns a new image structure if successful, returns NULL otherwise

References opj_image::color_space, opj_image::comps, opj_image_comp::data, opj_image_comp::dx, opj_image_comptparm::dx, opj_image_comp::dy, opj_image_comptparm::dy, opj_image_comp::h, opj_image_comptparm::h, opj_image::numcomps, opj_calloc(), opj_image_data_alloc(), opj_image_destroy(), opj_image_comp::prec, opj_image_comptparm::prec, opj_image_comp::sgnd, opj_image_comptparm::sgnd, SIZE_MAX, opj_image_comp::w, opj_image_comptparm::w, opj_image_comp::x0, opj_image_comptparm::x0, opj_image_comp::y0, and opj_image_comptparm::y0.

## ◆ opj_image_create0()

opj_image_t * opj_image_create0 | ( | void |  | ) |

Create an empty image.

Returns
  returns an empty image if successful, returns NULL otherwise

References opj_calloc().

Referenced by opj_j2k_decode(), opj_j2k_get_tile(), opj_j2k_read_header(), and opj_j2k_start_compress().

## ◆ opj_image_destroy()

void OPJ_CALLCONV opj_image_destroy | ( | opj_image_t * | image | ) |

Deallocate any resources associated with an image.

Parameters

  image | image to be destroyed

References opj_image::comps, opj_image_comp::data, opj_image::icc_profile_buf, opj_image::numcomps, opj_free(), and opj_image_data_free().

Referenced by j2k_to_pnm(), opj_image_create(), opj_image_tile_create(), opj_j2k_decode(), opj_j2k_destroy(), opj_j2k_get_tile(), opj_j2k_move_data_from_codec_to_output_image(), and opj_j2k_read_header().

## ◆ opj_image_tile_create()

opj_image_t *OPJ_CALLCONV opj_image_tile_create | ( | OPJ_UINT32 | numcmpts,
|  | opj_image_cmptparm_t * | cmptparms,
|  | OPJ_COLOR_SPACE | clrspc
| ) |  |

Creates an image without allocating memory for the image (used in the new version of the library).

Parameters

  numcmpts | the number of components
  cmptparms | the components parameters
  clrspc | the image color space

Returns
  a new image structure if successful, NULL otherwise.

References opj_image::color_space, opj_image::comps, opj_image_comp::data, opj_image_comp::dx, opj_image_comptparm::dx, opj_image_comp::dy, opj_image_comptparm::dy, opj_image_comp::h, opj_image_comptparm::h, opj_image::numcomps, opj_calloc(), opj_image_destroy(), opj_image_comp::prec, opj_image_comptparm::prec, opj_image_comp::sgnd, opj_image_comptparm::sgnd, opj_image_comp::w, opj_image_comptparm::w, opj_image_comp::x0, opj_image_comptparm::x0, opj_image_comp::y0, and opj_image_comptparm::y0.