MJ2 codec restructuration. Created libopenjpeg_097 directory and moved libopenjpeg...
[openjpeg.git] / mj2 / libopenjpeg_097 / mqc.h
diff --git a/mj2/libopenjpeg_097/mqc.h b/mj2/libopenjpeg_097/mqc.h
new file mode 100644 (file)
index 0000000..f6d93a6
--- /dev/null
@@ -0,0 +1,127 @@
+/*\r
+ * Copyright (c) 2001-2002, David Janssens\r
+ * Copyright (c) 2002-2003, Yannick Verschueren\r
+ * Copyright (c) 2002-2003,  Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ *    notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ *    notice, this list of conditions and the following disclaimer in the\r
+ *    documentation and/or other materials provided with the distribution.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'\r
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+ * POSSIBILITY OF SUCH DAMAGE.\r
+ */\r
+\r
+#ifndef __MQC_H\r
+#define __MQC_H\r
+\r
+/*\r
+ * Return the number of bytes written/read since initialisation\r
+ */\r
+int mqc_numbytes();\r
+\r
+/*\r
+ * Reset the states of all the context of the coder/decoder\r
+ * (each context is set to a state where 0 and 1 are more or less equiprobable)\r
+ */\r
+void mqc_resetstates();\r
+\r
+/*\r
+ * Set the state of a particular context\r
+ * ctxno: number that identifies the context\r
+ * msb: the MSB of the new state of the context\r
+ * prob: number that identifies the probability of the symbols for the new state of the context\r
+ */\r
+void mqc_setstate(int ctxno, int msb, int prob);\r
+\r
+/*\r
+ * Initialize the encoder\r
+ * bp: pointer to the start of the buffer where the bytes will be written\r
+ */\r
+void mqc_init_enc(unsigned char *bp);\r
+\r
+/*\r
+ * Set the current context used for coding/decoding\r
+ * ctxno: number that identifies the context\r
+ */\r
+void mqc_setcurctx(int ctxno);\r
+\r
+/*\r
+ * Encode a bit\r
+ * d: bit to encode (0 or 1)\r
+ */\r
+void mqc_encode(int d);\r
+\r
+/*\r
+ * Flush the encoder, so that all remaining data is written\r
+ */\r
+void mqc_flush();\r
+\r
+/*\r
+ * BYPASS mode switch\r
+ */\r
+void mqc_bypass_init_enc();\r
+\r
+/*\r
+ * BYPASS mode switch\r
+ */\r
+void mqc_bypass_enc(int d);\r
+\r
+/*\r
+ * BYPASS mode switch\r
+ */\r
+int mqc_bypass_flush_enc();\r
+\r
+/*\r
+ * RESET mode switch\r
+ */\r
+void mqc_reset_enc();\r
+\r
+/*\r
+ * RESTART mode switch (TERMALL)\r
+ */\r
+int mqc_restart_enc();\r
+\r
+/*\r
+ * RESTART mode switch (TERMALL)\r
+ */\r
+void mqc_restart_init_enc();\r
+\r
+/*\r
+ * ERTERM mode switch (PTERM)\r
+ */\r
+void mqc_erterm_enc();\r
+\r
+/*\r
+ * SEGMARK mode switch (SEGSYM)\r
+ */\r
+void mqc_segmark_enc();\r
+\r
+\r
+/*\r
+ * Initialize the decoder\r
+ * bp: pointer to the start of the buffer from which the bytes will be read\r
+ * len: length of the input buffer\r
+ */\r
+void mqc_init_dec(unsigned char *bp, int len);\r
+\r
+/*\r
+ * Decode a bit (returns 0 or 1)\r
+ */\r
+int mqc_decode();\r
+\r
+#endif\r