j2kheader_manager.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <math.h>`
`#include <assert.h>`
`#include "j2kheader_manager.h"`

## Macros

#define | FCGI_stdout stdout
#define | FCGI_stderr stderr
#define | logstream stderr

## Functions

SIZmarker_param_t | get_SIZmkrdata_from_j2kstream (Byte_t *SIZstream)
CODmarker_param_t | get_CODmkrdata_from_j2kstream (Byte_t *CODstream)
OPJ_BOOL | get_mainheader_from_j2kstream (Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD)
| get main header information from j2k codestream
OPJ_BOOL | modify_SIZmkrstream (SIZmarker_param_t SIZ, int difOfdecomplev, Byte_t *SIZstream)
Byte2_t | modify_CODmkrstream (CODmarker_param_t COD, int numOfdecomp, Byte_t *CODstream)
OPJ_BOOL | modify_mainheader (Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen)
| modify main header in j2k codestream to fit with the new number of decompositions
OPJ_BOOL | modify_COCmkrstream (int numOfdecomp, Byte_t *COCstream, Byte2_t Csiz, Byte2_t *oldLcoc, Byte2_t *newLcoc)
OPJ_BOOL | modify_tileheader (Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen)
| modify tile header in j2k codestream to fit with the tile part length, and new number of decompositions for multi-componet images

## Macro Definition Documentation

## FCGI_stderr

#define FCGI_stderr stderr

## FCGI_stdout

#define FCGI_stdout stdout

## logstream

#define logstream stderr

## Function Documentation

## get_CODmkrdata_from_j2kstream()

CODmarker_param_t get_CODmkrdata_from_j2kstream | ( | Byte_t * | CODstream | ) |

References big2(), FCGI_stderr, CODmarker_param::Lcod, CODmarker_param::numOfdecomp, CODmarker_param::numOflayers, opj_malloc(), CODmarker_param::prog_order, CODmarker_param::Scod, CODmarker_param::XPsiz, and CODmarker_param::YPsiz.

Referenced by get_mainheader_from_j2kstream().

## get_mainheader_from_j2kstream()

OPJ_BOOL get_mainheader_from_j2kstream | ( | Byte_t * | j2kstream,
|  | SIZmarker_param_t * | SIZ,
|  | CODmarker_param_t * | COD )

get main header information from j2k codestream

Parameters

  [in] | j2kstream | j2k codestream
  [out] | SIZ | SIZ marker pointer
  [out] | COD | COD marker pointer

Returns
  if succeeded (true) or failed (false)

References big2(), FCGI_stderr, get_CODmkrdata_from_j2kstream(), get_SIZmkrdata_from_j2kstream(), CODmarker_param::Lcod, SIZmarker_param::Lsiz, OPJ_FALSE, and OPJ_TRUE.

Referenced by get_SIZ_from_jpipstream(), recons_codestream_from_JPPstream(), and recons_codestream_from_JPTstream().

## get_SIZmkrdata_from_j2kstream()

SIZmarker_param_t get_SIZmkrdata_from_j2kstream | ( | Byte_t * | SIZstream | ) |

References big2(), big4(), SIZmarker_param::Csiz, FCGI_stderr, SIZmarker_param::Lsiz, SIZmarker_param::Rsiz, SIZmarker_param::Ssiz, SIZmarker_param::XOsiz, SIZmarker_param::XRsiz, SIZmarker_param::Xsiz, SIZmarker_param::XTnum, SIZmarker_param::XTOsiz, SIZmarker_param::XTsiz, SIZmarker_param::YOsiz, SIZmarker_param::YRsiz, SIZmarker_param::Ysiz, SIZmarker_param::YTnum, SIZmarker_param::YTOsiz, and SIZmarker_param::YTsiz.

Referenced by get_mainheader_from_j2kstream().

## modify_COCmkrstream()

OPJ_BOOL modify_COCmkrstream | ( | int | numOfdecomp,
|  | Byte_t * | COCstream,
|  | Byte2_t | Csiz,
|  | Byte2_t * | oldLcoc,
|  | Byte2_t * | newLcoc )

References big2(), FCGI_stderr, OPJ_FALSE, and OPJ_TRUE.

Referenced by modify_tileheader().

## modify_CODmkrstream()

Byte2_t modify_CODmkrstream | ( | CODmarker_param_t | COD,
|  | int | numOfdecomp,
|  | Byte_t * | CODstream )

References FCGI_stderr, CODmarker_param::Lcod, and CODmarker_param::Scod.

Referenced by modify_mainheader().

## modify_mainheader()

OPJ_BOOL modify_mainheader | ( | Byte_t * | j2kstream,
|  | int | numOfdecomp,
|  | SIZmarker_param_t | SIZ,
|  | CODmarker_param_t | COD,
|  | Byte8_t * | j2klen )

modify main header in j2k codestream to fit with the new number of decompositions

Parameters

  [in] | j2kstream | j2k codestream
  [in] | numOfdecomp | the New number of decompositions
  [in] | SIZ | original SIZ marker information
  [in] | COD | original COD marker information
  [out] | j2klen | pointer to the length of j2k code stream

Returns
  if succeeded (true) or failed (false)

References FCGI_stderr, CODmarker_param::Lcod, SIZmarker_param::Lsiz, modify_CODmkrstream(), modify_SIZmkrstream(), CODmarker_param::numOfdecomp, OPJ_FALSE, and OPJ_TRUE.

Referenced by recons_codestream_from_JPPstream().

## modify_SIZmkrstream()

OPJ_BOOL modify_SIZmkrstream | ( | SIZmarker_param_t | SIZ,
|  | int | difOfdecomplev,
|  | Byte_t * | SIZstream )

References FCGI_stderr, modify_4Bytecode(), OPJ_FALSE, OPJ_TRUE, SIZmarker_param::XOsiz, SIZmarker_param::Xsiz, SIZmarker_param::XTOsiz, SIZmarker_param::XTsiz, SIZmarker_param::YOsiz, SIZmarker_param::Ysiz, SIZmarker_param::YTOsiz, and SIZmarker_param::YTsiz.

Referenced by modify_mainheader().

## modify_tileheader()

OPJ_BOOL modify_tileheader | ( | Byte_t * | j2kstream,
|  | Byte8_t | SOToffset,
|  | int | numOfdecomp,
|  | Byte2_t | Csiz,
|  | Byte8_t * | j2klen )

modify tile header in j2k codestream to fit with the tile part length, and new number of decompositions for multi-componet images

Parameters

  [in] | j2kstream | j2k codestream
  [in] | SOToffset | offset of SOT marker from the beginning of j2kstream
  [in] | numOfdecomp | the New number of decompositions, -1 if the same as original
  [in] | Csiz | number of components
  [out] | j2klen | pointer to the length of j2k code stream

Returns
  if succeeded (true) or failed (false)

References FCGI_stderr, modify_4Bytecode(), modify_COCmkrstream(), OPJ_FALSE, and OPJ_TRUE.

Referenced by recons_codestream_from_JPPstream().