Main Page | Modules | Class Hierarchy | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

IMJ2Dec Class Reference

Interface to CMJ2Dec. More...

#include <iMJ2Dec.h>

Inheritance diagram for IMJ2Dec:

Inheritance graph
Collaboration diagram for IMJ2Dec:

Collaboration graph

Public Member Functions

 IMJ2Dec (BOOL bInterlaced, const GUID *pOEM_LIC)
 Constructor.
 ~IMJ2Dec ()
 Destructor.
virtual int decode (JPEG2000INFOHEADER2 *jp2, int argc, char **argv, BYTE *in, int in_size, int in_width, int in_height, DWORD in_fcc, int in_bits, BYTE *out, int out_size, int out_ofs, int out_row, int out_width, int out_height, DWORD out_fcc, int out_bits)
 Decode a JPEG2000 codestream.
BOOL IsInterlaced ()
 Determines if the decoding is done interlaced or not.
WORD GetVersion ()
 Determines the version of the library.
BOOL IsLicenseValid ()
 Determines if the license of the library is valid.

Private Attributes

CMJ2Decm_pBind
 Binding pointer to CMJ2Dec.

Detailed Description

Interface to CMJ2Dec.

This class decodes a single frame or field on the current thread.

If bInterlaced is FALSE:
The source frame or field is decoded as-is to the destination frame or field. Then the first line offset, defined by the out_ofs parameter passed to decode(), should be 0.
inline_dotgraph_7

If bInterlaced is TRUE:
The source field is expanded to the destination frame height (WEAVE). Then the first line offset is defined by the out_ofs parameter passed to decode().
inline_dotgraph_8
inline_dotgraph_9

Remarks:
bInterlaced is passed to constructor IMJ2Dec().
Examples:

jp2_decode.cpp, and jp2_decode_skip_level.cpp.


Constructor & Destructor Documentation

IMJ2Dec::IMJ2Dec BOOL  bInterlaced,
const GUID *  pOEM_LIC
 

Constructor.

Parameters:
bInterlaced Interlaced decoding flag (see above).
pOEM_LIC Pointer to the OEM license GUID (&OEM_LIC).

IMJ2Dec::~IMJ2Dec  ) 
 

Destructor.


Member Function Documentation

virtual int IMJ2Dec::decode JPEG2000INFOHEADER2 jp2,
int  argc,
char **  argv,
BYTE *  in,
int  in_size,
int  in_width,
int  in_height,
DWORD  in_fcc,
int  in_bits,
BYTE *  out,
int  out_size,
int  out_ofs,
int  out_row,
int  out_width,
int  out_height,
DWORD  out_fcc,
int  out_bits
[virtual]
 

Decode a JPEG2000 codestream.

Parameters:
[out] jp2 Pointer to a JPEG2000INFOHEADER2 that is updated according to the decoded codestream, can be NULL. Not yet implemented.
argc Reserved for future use, must be 0. An integer specifying how many extra arguments are passed.
argv Reserved for future use, must be NULL. An array of null-terminated strings. The last pointer (argv[argc]) is NULL.
in Pointer to the buffer containing the JPEG2000 codestream to decode.
in_size Size in bytes of the above buffer.
in_width Width in pixels of the JPEG2000 image to decode.
in_height Height in pixels of the JPEG2000 image to decode. If bInterlaced is TRUE in_height should be equal to out_height/2.
in_fcc FOURCC of the JPEG2000 codestream (default=MJ2C, see MJ2C FOURCC and MediaSubType), can be 0 if unknown.
in_bits Input bit depth: 24 (no subsampling), 16 (4:2:2 subsampling), 12 (4:2:0 subsampling) or 8 (luminance only), can be 0 if unknown.
out Pointer to the buffer receiving the decoded image.
out_size Size in bytes of the above buffer.
out_ofs Offset in bytes of first line which receives the decoded image (see above).
out_row Reserved for future use, must be 0. Size in bytes of a row stride.
out_width Output width in pixels (see Note below).
out_height Output height in pixels (see Note below).
out_fcc FOURCC of the output format (see supported Output in Input/Output Formats).
out_bits Bit-depth of the output format (see supported Output in Input/Output Formats).
Returns:
The number of bytes red in the input codestream.
Note:
Parameters in_width and out_width can be different one from each other, parameters in_height and out_height too. There's the case where bInterlaced is TRUE but not only:
out_width > in_width
This case allows to decode the JPEG2000 image in a buffer with a row stride larger than in_width x bytes_per_pixel. This is usefull for instance in a DirectShow decoder or when the output buffer is a DirectDraw surface. In these cases output buffers are commonly right-aligned to values that speed up image blitting.
out_width < in_width AND out_height < in_height
One of the benefits of JPEG2000 is to determine (at decode time) how much resolution to get. This is called level skipping. Each level skipped divides by 2 the width and the height. To skip 1 level pass width/2 as out_width and height/2 as out_height. To skip 2 levels pass width/4 and height/4. To skip 3 levels pass width/8 and height/8 and so on ... The limit is the number of levels used to encode the JPEG2000 image. Note that the case above is still valid (width/n > in_width/n) but height/n must be equal to in_height/n if bInterlaced is FALSE and height/2n must be equal to in_height/n if bInterlaced is TRUE. CMJ2Dec::decode() uses this piece of code to know how many levels to skip:
              if (m_bInterlaced)
                out_height /= 2;
             
              for (int i=0; i < m_levels; i++)
              {
                if (((out_width >= in_width / (2 << i)) && 
                     (out_width < (i ? (in_width / (2 << (i - 1))) : in_width))) && 
                    (out_height == abs(in_height) / (2 << i)))
                {
                   m_skip_levels = i + 1;
                   break;
                }
              }
out_height < 0 AND out_fcc is one of RGB output formats
The function output a flipped image along the y-axis.

Reimplemented in CMJ2DecT, and CMJ2DecMT.

Examples:
jp2_decode.cpp, and jp2_decode_skip_level.cpp.

BOOL IMJ2Dec::IsInterlaced  ) 
 

Determines if the decoding is done interlaced or not.

Returns:
bInterlaced (see above).

WORD IMJ2Dec::GetVersion  ) 
 

Determines the version of the library.

Returns:
The version of MJ2EncDec.lib, current is v2.10 (0x0210).

BOOL IMJ2Dec::IsLicenseValid  ) 
 

Determines if the license of the library is valid.

Returns:
  • TRUE if license is valid.
  • FALSE otherwise, in this case no decoding is performed, decode() always return 0.
Examples:
jp2_decode.cpp, jp2_decode_skip_level.cpp, and jp2_decodeMT.cpp.


Field Documentation

CMJ2Dec* IMJ2Dec::m_pBind [private]
 

Binding pointer to CMJ2Dec.


The documentation for this class was generated from the following file:

   

© Morgan Multimedia 1990-2005