📄 overview of the j2000 coder-decoder modules.htm
字号:
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Create a packet iterator</FONT>
<FONT color=#0000ff> * img: raw image for which the packets will be listed</FONT>
<FONT color=#0000ff> * cp: coding paremeters</FONT>
<FONT color=#0000ff> * tileno: number that identifies the tile for which to list the packets</FONT>
<FONT color=#0000ff> * return value: returns a packet iterator that points to the first packet of the tile</FONT>
<FONT color=#0000ff> */</FONT>
pi_iterator_t *pi_create(j2k_image_t *img, j2k_cp_t *cp, <FONT color=#2e8b57><B>int</B></FONT> tileno);
<FONT color=#0000ff>/*</FONT><FONT color=#0000ff> </FONT>
<FONT color=#0000ff> * Modify the packet iterator to point to the next packet</FONT>
<FONT color=#0000ff> * pi: packet iterator to modify</FONT>
<FONT color=#0000ff> * return value: returns 0 if pi pointed to the last packet or else returns 1 </FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> pi_next(pi_iterator_t *pi);
</PRE>
<H3>
<LI>The Tag-Tree Coder/Decoder (TGT)</H3>The Tag-Tree coder is used to encode
efficiently arrays of values for which elements that are nearby in the array
have values that are also similar. The TGT module is used by the T2 module for
encoding parameters of code-blocks that are expected not to vary greatly
between adjacent code-blocks. <PRE><FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Create a tag-tree</FONT>
<FONT color=#0000ff> * numleafsh: width of the array of leafs of the tree</FONT>
<FONT color=#0000ff> * numleafsv: height of the array of leafs of the tree</FONT>
<FONT color=#0000ff> */</FONT>
tgt_tree_t *tgt_create(<FONT color=#2e8b57><B>int</B></FONT> numleafsh, <FONT color=#2e8b57><B>int</B></FONT> numleafsv);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Reset a tag-tree (set all leafs to 0)</FONT>
<FONT color=#0000ff> * tree: tag-tree to reset</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> tgt_reset(tgt_tree_t *tree);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Destroy a tag-tree, liberating memory</FONT>
<FONT color=#0000ff> * tree: tag-tree to destroy</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> tgt_destroy(tgt_tree_t *tree);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Set the value of a leaf of a tag-tree</FONT>
<FONT color=#0000ff> * tree: tag-tree to modify</FONT>
<FONT color=#0000ff> * leafno: number that identifies the leaf to modify</FONT>
<FONT color=#0000ff> * value: new value of the leaf</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> tgt_setvalue(tgt_tree_t *tree, <FONT color=#2e8b57><B>int</B></FONT> leafno, <FONT color=#2e8b57><B>int</B></FONT> value);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Encode the value of a leaf of the tag-tree up to a given threshold</FONT>
<FONT color=#0000ff> * leafno: number that identifies the leaf to encode</FONT>
<FONT color=#0000ff> * threshold: threshold to use when encoding value of the leaf</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> tgt_encode(tgt_tree_t *tree, <FONT color=#2e8b57><B>int</B></FONT> leafno, <FONT color=#2e8b57><B>int</B></FONT> threshold);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Decode the value of a leaf of the tag-tree up to a given threshold</FONT>
<FONT color=#0000ff> * leafno: number that identifies the leaf to decode</FONT>
<FONT color=#0000ff> * threshold: threshold to use when decoding value of the leaf</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> tgt_decode(tgt_tree_t *tree, <FONT color=#2e8b57><B>int</B></FONT> leafno, <FONT color=#2e8b57><B>int</B></FONT> threshold);
</PRE>
<H3>
<LI>The Bit Writer/Reader (BIO)</H3>The Bit Input/Output module is used to
write or read individual bits from or to a byte buffer. This module is used by
various other modules. <PRE><FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Return the number of bytes already written/read</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> bio_numbytes();
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Initialize the bit writer</FONT>
<FONT color=#0000ff> * bp: pointer to the start of the buffer where the bytes will be written</FONT>
<FONT color=#0000ff> * len: length of the output buffer</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> bio_init_enc(<FONT color=#2e8b57><B>unsigned</B></FONT> <FONT color=#2e8b57><B>char</B></FONT> *bp, <FONT color=#2e8b57><B>int</B></FONT> len);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Write bits</FONT>
<FONT color=#0000ff> * v: value of the bits</FONT>
<FONT color=#0000ff> * n: number of bits</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> bio_write(<FONT color=#2e8b57><B>int</B></FONT> v, <FONT color=#2e8b57><B>int</B></FONT> n);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Flush the bit-writer, so that all remaining bits are written</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> bio_flush();
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Initialize the bit reader</FONT>
<FONT color=#0000ff> * bp: pointer to the start of the buffer where the bytes will be read</FONT>
<FONT color=#0000ff> * len: length of the input buffer</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> bio_init_dec(<FONT color=#2e8b57><B>unsigned</B></FONT> <FONT color=#2e8b57><B>char</B></FONT> *bp, <FONT color=#2e8b57><B>int</B></FONT> len);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Read bits</FONT>
<FONT color=#0000ff> * n: number of bits</FONT>
<FONT color=#0000ff> * return value: value of bits</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> bio_read(<FONT color=#2e8b57><B>int</B></FONT> n);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Align the bit-reader so that the next bit is read at a byte boundary</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> bio_inalign();
</PRE>
<H3>
<LI>The Byte Writer/Reader (CIO)</H3>The Char IO module is used to read/write
individual bytes from/to a byte buffer. This module is used by various other
modules. <PRE><FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Return the offset of the byte reader/writer</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> cio_tell();
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Set the offset of the byte reader/writer</FONT>
<FONT color=#0000ff> * pos: new offset</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> cio_seek(<FONT color=#2e8b57><B>int</B></FONT> pos);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Initialize the byte reader/writer</FONT>
<FONT color=#0000ff> * bp: start of buffer from which to read/write bytes</FONT>
<FONT color=#0000ff> * len: length of buffer</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> cio_init(<FONT color=#2e8b57><B>unsigned</B></FONT> <FONT color=#2e8b57><B>char</B></FONT> *bp, <FONT color=#2e8b57><B>int</B></FONT> len);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Write bytes</FONT>
<FONT color=#0000ff> * v: value of bytes</FONT>
<FONT color=#0000ff> * n: number of bytes</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>void</B></FONT> cio_write(<FONT color=#2e8b57><B>unsigned</B></FONT> <FONT color=#2e8b57><B>int</B></FONT> v, <FONT color=#2e8b57><B>int</B></FONT> n);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Read bytes</FONT>
<FONT color=#0000ff> * n: number of bytes</FONT>
<FONT color=#0000ff> * return value: value of bytes</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>unsigned</B></FONT> <FONT color=#2e8b57><B>int</B></FONT> cio_read(<FONT color=#2e8b57><B>int</B></FONT> n);
</PRE>
<H3>
<LI>Operations on Integers (INT)</H3>The INT module implements various simple
operations on integers. It is used by various other modules. <PRE><FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Return minimum of two integers</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> int_min(<FONT color=#2e8b57><B>int</B></FONT> a, <FONT color=#2e8b57><B>int</B></FONT> b);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Return maximum of two integers</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> int_max(<FONT color=#2e8b57><B>int</B></FONT> a, <FONT color=#2e8b57><B>int</B></FONT> b);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Return the value of an integer clamped between two values</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> int_clamp(<FONT color=#2e8b57><B>int</B></FONT> a, <FONT color=#2e8b57><B>int</B></FONT> min, <FONT color=#2e8b57><B>int</B></FONT> max);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Return the absolute value of an integer</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> int_abs(<FONT color=#2e8b57><B>int</B></FONT> a);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Return the up-rounded value of a division between two integers </FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> int_ceildiv(<FONT color=#2e8b57><B>int</B></FONT> a, <FONT color=#2e8b57><B>int</B></FONT> b);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Return the up-rounded value of a division of an integer by 2 to the power of another integer </FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> int_ceildivpow2(<FONT color=#2e8b57><B>int</B></FONT> a, <FONT color=#2e8b57><B>int</B></FONT> b);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Return the down-rounded value of a division of an integer by 2 to the power of another integer </FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> int_floordivpow2(<FONT color=#2e8b57><B>int</B></FONT> a, <FONT color=#2e8b57><B>int</B></FONT> b);
<FONT color=#0000ff>/*</FONT>
<FONT color=#0000ff> * Return the down-rounded value of the logarithm in base 2 of an integer</FONT>
<FONT color=#0000ff> */</FONT>
<FONT color=#2e8b57><B>int</B></FONT> int_floorlog2(<FONT color=#2e8b57><B>int</B></FONT> a);
</PRE></LI></OL></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -