From 4d26da545d8df85917b06cd603ffa6e92fd431e5 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Sat, 20 Dec 2008 01:20:40 +0000
Subject: * ReCommit the OpenID patch with a few less dependencies. * Removes
all references to ASP.NET (System.Web.UI,*) * Removes all references to
System.Web.Mobile
---
OpenSim/Framework/OpenJpeg/bio.cs | 138 +++++++++++++
OpenSim/Framework/OpenJpeg/fix.cs | 16 ++
OpenSim/Framework/OpenJpeg/int_.cs | 58 ++++++
OpenSim/Framework/OpenJpeg/j2k.cs | 158 +++++++++++++++
OpenSim/Framework/OpenJpeg/openjpeg.cs | 358 +++++++++++++++++++++++++++++++++
OpenSim/Framework/OpenJpeg/pi.cs | 48 +++++
6 files changed, 776 insertions(+)
create mode 100644 OpenSim/Framework/OpenJpeg/bio.cs
create mode 100644 OpenSim/Framework/OpenJpeg/fix.cs
create mode 100644 OpenSim/Framework/OpenJpeg/int_.cs
create mode 100644 OpenSim/Framework/OpenJpeg/j2k.cs
create mode 100644 OpenSim/Framework/OpenJpeg/openjpeg.cs
create mode 100644 OpenSim/Framework/OpenJpeg/pi.cs
(limited to 'OpenSim/Framework/OpenJpeg')
diff --git a/OpenSim/Framework/OpenJpeg/bio.cs b/OpenSim/Framework/OpenJpeg/bio.cs
new file mode 100644
index 0000000..4f095ad
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/bio.cs
@@ -0,0 +1,138 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.OpenJpeg
+{
+ public static class bio
+ {
+
+ public static opj_bio bio_create()
+ {
+ opj_bio bio = new opj_bio();
+ return bio;
+ }
+
+ public static void bio_destroy(opj_bio bio)
+ {
+ // not needed on C#
+ }
+
+ public static int bio_numbytes(opj_bio bio)
+ {
+ return (bio.bp - bio.start);
+ }
+
+ public static void bio_init_enc(opj_bio bio, sbyte bp, int len)
+ {
+ bio.start = (byte)bp;
+ bio.end = (byte)(bp + (byte)len);
+ bio.bp = (byte)bp;
+ bio.buf = 0;
+ bio.ct = 8;
+ }
+
+ public static void bio_init_dec(opj_bio bio, sbyte bp, int len)
+ {
+ bio.start = (byte)bp;
+ bio.end = (byte)(bp + len);
+ bio.bp = (byte)bp;
+ bio.buf = 0;
+ bio.ct = 0;
+ }
+
+ public static void bio_write(opj_bio bio, int v, int n)
+ {
+ for (int i = n - 1; i >= 0; i--)
+ bio_putbit(bio, (v >> i) & 1);
+ }
+
+ public static int bio_read(opj_bio bio, int n)
+ {
+ int v = 0;
+ for (int i = n - 1; i >= 0; i--)
+ v += bio_getbit(bio) << i;
+
+ return v;
+ }
+
+ public static int bio_flush(opj_bio bio)
+ {
+ bio.ct = 0;
+ if (bio_byteout(bio) != 0)
+ return 1;
+
+ if (bio.ct == 7)
+ {
+ bio.ct = 0;
+ if (bio_byteout(bio) != 0)
+ return 1;
+ }
+ return 0;
+ }
+
+ public static int bio_inalign(opj_bio bio)
+ {
+ bio.ct = 0;
+ if ((bio.buf & 0xff) == 0xff)
+ {
+ if (bio_bytein(bio) != 0)
+ return 1;
+ bio.ct = 0;
+ }
+ return 0;
+ }
+
+ private static int bio_bytein(opj_bio bio)
+ {
+ bio.buf = (bio.buf << 8) & 0xffff;
+ bio.ct = bio.buf == 0xff00 ? 7 : 8;
+ if (bio.bp >= bio.end)
+ return 1;
+ bio.buf |= bio.bp++;
+
+ return 0;
+ }
+
+ private static int bio_byteout(opj_bio bio)
+ {
+ bio.buf = (bio.buf << 8) & 0xffff;
+ bio.ct = bio.buf == 0xff00 ? 7 : 8;
+ if (bio.bp >= bio.end)
+ return 1;
+
+ bio.bp = (byte)(bio.buf >> 8);
+ bio.bp++;
+ return 0;
+ }
+
+ private static void bio_putbit(opj_bio bio, int b)
+ {
+ if (bio.ct == 0)
+ bio_byteout(bio);
+
+ bio.ct--;
+ bio.buf |= (byte)(b << bio.ct);
+
+ }
+
+ private static int bio_getbit(opj_bio bio)
+ {
+ if (bio.ct == 0)
+ bio_bytein(bio);
+ bio.ct--;
+
+ return (int)((bio.buf >> bio.ct) & 1);
+ }
+
+ }
+
+ public struct opj_bio
+ {
+ public byte start;
+ public byte end;
+ public byte bp;
+ public uint buf;
+ public int ct;
+ }
+}
diff --git a/OpenSim/Framework/OpenJpeg/fix.cs b/OpenSim/Framework/OpenJpeg/fix.cs
new file mode 100644
index 0000000..76d3159
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/fix.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.OpenJpeg
+{
+ public static class fix
+ {
+ public static int fix_mul(int a, int b)
+ {
+ long temp = (long)a * (long)b;
+ temp += temp & 4096;
+ return (int)(temp >> 13);
+ }
+ }
+}
diff --git a/OpenSim/Framework/OpenJpeg/int_.cs b/OpenSim/Framework/OpenJpeg/int_.cs
new file mode 100644
index 0000000..dc71728
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/int_.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.OpenJpeg
+{
+ public static class int_
+ {
+ public static int int_min(int a, int b)
+ {
+ return a < b ? a : b;
+ }
+
+ public static int int_max(int a, int b)
+ {
+ return (a > b) ? a : b;
+ }
+
+ public static int int_clamp(int a, int min, int max)
+ {
+ if (a < min)
+ return min;
+ if (a > max)
+ return max;
+
+ return a;
+ }
+
+ public static int int_abs(int a)
+ {
+ return a < 0 ? -a : a;
+ }
+
+ public static int int_ceildiv(int a, int b)
+ {
+ return (a + b - 1) / b;
+ }
+
+ public static int int_ceildivpow2(int a, int b)
+ {
+ return (a + (1 << b) - 1) >> b;
+ }
+
+ public static int int_floordivpow2(int a, int b)
+ {
+ return a >> b;
+ }
+
+ public static int int_floorlog2(int a)
+ {
+ for (int l=0; a > 1; l++)
+ a >>= 1;
+
+ return 1;
+ }
+
+ }
+}
diff --git a/OpenSim/Framework/OpenJpeg/j2k.cs b/OpenSim/Framework/OpenJpeg/j2k.cs
new file mode 100644
index 0000000..f655364
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/j2k.cs
@@ -0,0 +1,158 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.OpenJpeg
+{
+
+ public static class j2k
+ {
+ }
+
+ public enum J2K_STATUS
+ {
+ J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */
+ J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */
+ J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */
+ J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */
+ J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */
+ J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */
+ J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */
+ J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */
+ }
+
+ public enum J2K_T2_MODE
+ {
+ THRESH_CALC = 0, /** Function called in Rate allocation process*/
+ FINAL_PASS = 1 /** Function called in Tier 2 process*/
+ }
+
+ public struct opj_stepsize
+ {
+ public int expn;
+ public int mant;
+ }
+
+ public struct opj_tccp
+ {
+ public int csty;
+ public int numresolutions;
+ public int cblkw;
+ public int cblkh;
+ public int cblksty;
+ public int qmfbid;
+ public int qntsty;
+ ///
+ /// don't forget to initialize 97 elements
+ ///
+ public opj_stepsize[] stepsizes;
+ public int numgbits;
+ public int roishift;
+ ///
+ /// Don't forget to initialize 33 elements
+ ///
+ public int[] prcw;
+
+ }
+
+ public struct opj_tcp
+ {
+ public int first;
+ public int csty;
+ public PROG_ORDER prg;
+ public int numlayers;
+ public int mct;
+ ///
+ /// don't forget to initialize to 100
+ ///
+ public float[] rates;
+ public int numpocs;
+ public int POC;
+ ///
+ /// Don't forget to initialize to 32
+ ///
+ public opj_poc[] pocs;
+ public byte ppt_data;
+ public byte ppt_data_first;
+ public int ppt;
+ public int ppt_store;
+ public int ppt_len;
+ ///
+ /// Don't forget to initialize 100 elements
+ ///
+ public float[] distoratio;
+ public opj_tccp tccps;
+
+ }
+
+ public struct opj_cp
+ {
+ public CINEMA_MODE cinema;
+ public int max_comp_size;
+ public int img_size;
+ public RSIZ_CAPABILITIES rsiz;
+ public sbyte tp_on;
+ public sbyte tp_flag;
+ public int tp_pos;
+ public int distro_alloc;
+ public int fixed_alloc;
+ public int fixed_quality;
+ public int reduce;
+ public int layer;
+ public LIMIT_DECODING limit_decoding;
+ public int tx0;
+ public int ty0;
+ public int tdx;
+ public int tdy;
+ public sbyte? comment;
+ public int tw;
+ public int th;
+ public int? tileno;
+ public byte ppm_data;
+ public byte ppm_data_first;
+ public int ppm;
+ public int ppm_store;
+ public int ppm_previous;
+ public int ppm_len;
+ public opj_tcp tcps;
+ public int matrice;
+ }
+
+ public static class j2kdefines
+ {
+ public const uint J2K_CP_CSTY_PRT = 0x01;
+ public const uint J2K_CP_CSTY_SOP = 0x02;
+ public const uint J2K_CP_CSTY_EPH = 0x04;
+ public const uint J2K_CCP_CSTY_PRT = 0x01;
+ public const uint J2K_CCP_CBLKSTY_LAZY = 0x01;
+ public const uint J2K_CCP_CBLKSTY_RESET = 0x02;
+ public const uint J2K_CCP_CBLKSTY_TERMALL = 0x04;
+ public const uint J2K_CCP_CBLKSTY_VSC = 0x08;
+ public const uint J2K_CCP_CBLKSTY_PTERM =0x10;
+ public const uint J2K_CCP_CBLKSTY_SEGSYM = 0x20;
+ public const uint J2K_CCP_QNTSTY_NOQNT = 0;
+ public const uint J2K_CCP_QNTSTY_SIQNT = 1;
+ public const uint J2K_CCP_QNTSTY_SEQNT = 2;
+
+ public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */
+ public const uint J2K_MS_SOT = 0xff90; /**< SOT marker value */
+ public const uint J2K_MS_SOD = 0xff93; /**< SOD marker value */
+ public const uint J2K_MS_EOC = 0xffd9; /**< EOC marker value */
+ public const uint J2K_MS_SIZ = 0xff51; /**< SIZ marker value */
+ public const uint J2K_MS_COD = 0xff52; /**< COD marker value */
+ public const uint J2K_MS_COC = 0xff53; /**< COC marker value */
+ public const uint J2K_MS_RGN = 0xff5e; /**< RGN marker value */
+ public const uint J2K_MS_QCD = 0xff5c; /**< QCD marker value */
+ public const uint J2K_MS_QCC = 0xff5d; /**< QCC marker value */
+ public const uint J2K_MS_POC = 0xff5f; /**< POC marker value */
+ public const uint J2K_MS_TLM = 0xff55; /**< TLM marker value */
+ public const uint J2K_MS_PLM = 0xff57; /**< PLM marker value */
+ public const uint J2K_MS_PLT = 0xff58; /**< PLT marker value */
+ public const uint J2K_MS_PPM = 0xff60; /**< PPM marker value */
+ public const uint J2K_MS_PPT = 0xff61; /**< PPT marker value */
+ public const uint J2K_MS_SOP = 0xff91; /**< SOP marker value */
+ public const uint J2K_MS_EPH = 0xff92; /**< EPH marker value */
+ public const uint J2K_MS_CRG = 0xff63; /**< CRG marker value */
+ public const uint J2K_MS_COM = 0xff64; /**< COM marker value */
+ }
+}
diff --git a/OpenSim/Framework/OpenJpeg/openjpeg.cs b/OpenSim/Framework/OpenJpeg/openjpeg.cs
new file mode 100644
index 0000000..2d5e4b5
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/openjpeg.cs
@@ -0,0 +1,358 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.OpenJpeg
+{
+ public class openjpeg
+ {
+ public openjpeg()
+ {
+
+
+ }
+ }
+
+ public enum PROG_ORDER
+ {
+ PROG_UNKNOWN = -1,
+ LRCP = 0,
+ RLCP = 1,
+ RPCL = 2,
+ PCRL = 3,
+ CPRL = 4
+ }
+
+ public enum RSIZ_CAPABILITIES
+ {
+ STD_RSIZ = 0,
+ CINEMA2K = 3,
+ CINEMA4K = 4
+ }
+
+ public enum CINEMA_MODE
+ {
+ OFF = 0,
+ CINEMA2K_24 = 1,
+ CINEMA2K_48 = 2,
+ CINEMA4K_24 = 3
+ }
+
+ public enum COLOR_SPACE
+ {
+ CLRSPC_UNKNOWN = -1,
+ CLRSPC_SRGB = 1,
+ CLRSPC_GRAY = 2,
+ CLRSPC_SYCC = 3
+ }
+
+ public enum CODEC_FORMAT
+ {
+ CODEC_UNKNOWN = -1,
+ CODEC_J2K = 0,
+ CODEC_JPT = 1,
+ CODEC_JP2 = 2
+ }
+
+ public enum LIMIT_DECODING
+ {
+ NO_LIMITATION = 0,
+ LIMIT_TO_MAIN_HEADER=1,
+ DECODE_ALL_BUT_PACKETS = 2
+ }
+
+ public struct opj_poc
+ {
+ public int resno0, compno0;
+ public int layno1, resno1, compno1;
+ public int layno0, precno0, precno1;
+ public PROG_ORDER prg1, prg;
+ ///
+ /// Don't forget to initialize with 5 elements
+ ///
+ public sbyte[] progorder;
+ public int tile;
+ public int tx0, tx1, ty0, ty1;
+ public int layS, resS, copmS, prcS;
+ public int layE, resE, compE, prcE;
+ public int txS, txE, tyS, tyE, dx, dy;
+ public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t;
+ }
+
+ public struct opj_cparameters
+ {
+ public bool tile_size_on;
+ public int cp_tx0;
+ public int cp_ty0;
+ public int cp_tdx;
+ public int cp_tdy;
+ public int cp_disto_alloc;
+ public int cp_fixed_alloc;
+ public int cp_fixed_wuality;
+ public int cp_matrice;
+ public sbyte cp_comment;
+ public int csty;
+ public PROG_ORDER prog_order;
+
+ ///
+ /// Don't forget to initialize 32 elements
+ ///
+ public opj_poc[] POC;
+ public int numpocs;
+ public int tcp_numlayers;
+ ///
+ /// Don't forget to intitialize 100 elements
+ ///
+ public float[] tcp_rates;
+ ///
+ /// Don't forget to initialize 100 elements
+ ///
+ public float[] tcp_distoratio;
+ public int numresolution;
+ public int cblockw_init;
+ public int cblockh_init;
+ public int mode;
+ public int irreversible;
+ public int roi_compno;
+ public int roi_shift;
+ public int res_spec;
+
+ ///
+ /// Don't forget to initialize 33 elements
+ ///
+ public int[] prc_init;
+ ///
+ /// Don't forget to initialize 33 elements
+ ///
+ public int[] prch_init;
+
+ public string infile;
+ public string outfile;
+ public int index_on;
+ public string index;
+ public int image_offset_x0;
+ public int image_offset_y0;
+ public int subsampling_dx;
+ public int subsampling_dy;
+ public int decod_format;
+ public int cod_format;
+ public bool jpwl_epc_on;
+ public int jpwl_hprot_MH;
+ ///
+ /// Don't forget to initialize 16 elements
+ ///
+ public int[] jpwl_hprot_TPH_tileno;
+ ///
+ /// Don't forget to initialize 16 elements
+ ///
+ public int[] jpwl_hprot_TPH;
+
+ ///
+ /// Don't forget to initialize 16 elements
+ ///
+ public int[] jpwl_pprot_tileno;
+ public int[] jpwl_pprot_packno;
+ public int[] jpwl_pprot;
+ public int jpwl_sens_size;
+ public int jpwl_sense_addr;
+ public int jpwl_sens_range;
+ public int jpwl_sens_MH;
+
+ ///
+ /// Don't forget to initialize 16 elements
+ ///
+ public int[] jpwl_sens_TPH_tileno;
+
+ ///
+ /// Don't forget to initialize 16 elements
+ ///
+ public int[] jpwl_sens_TPH;
+ public CINEMA_MODE cp_cinema;
+ public int max_comp_size;
+ public sbyte tp_on;
+ public sbyte tp_flag;
+ public sbyte tcp_mct;
+ }
+
+ public struct opj_dparameters
+ {
+ public int cp_reduce;
+ public int cp_layer;
+ public string infile;
+ public string outfile;
+ public int decod_format;
+ public int cod_format;
+ public bool jpwl_correct;
+ public int jpwl_exp_comps;
+ public int jpwl_max_tiles;
+ public LIMIT_DECODING cp_limit_decoding;
+
+ }
+
+ public struct opj_common_fields
+ {
+ public bool is_decompressor;
+ public CODEC_FORMAT codec_format;
+ }
+
+ public struct opj_common_struct
+ {
+ public opj_common_fields flds;
+ }
+
+ public struct opj_cinfo
+ {
+ public opj_common_fields flds;
+ }
+ public struct opj_dinfo
+ {
+ public opj_common_fields flds;
+ }
+
+ public struct opj_cio
+ {
+ public opj_common_struct cinfo;
+ public int openmode;
+ public byte buffer;
+ public int length;
+ public byte start;
+ public byte end;
+ public byte bp;
+ }
+
+ public struct opj_image_comp
+ {
+ public int dx;
+ public int dy;
+ public int w;
+ public int h;
+ public int x0;
+ public int y0;
+ public int prec;
+ public int bpp;
+ public int sgnd;
+ public int resno_decoded;
+ public int factor;
+ public int data;
+ }
+
+ public struct opj_image
+ {
+ public int x0;
+ public int y0;
+ public int x1;
+ public int y1;
+ public int numcomps;
+ public COLOR_SPACE color_space;
+ public opj_image_comp comps;
+ }
+
+ public struct opj_image_comptparm
+ {
+ public int dx;
+ public int dy;
+ public int w;
+ public int h;
+ public int x0;
+ public int y0;
+ public int prec;
+ public int bpp;
+ public int sgnd;
+ }
+
+ public struct opj_packet_info
+ {
+ public int start_pos;
+ public int end_ph_pos;
+ public int end_pos;
+ public double disto;
+ }
+
+ public struct opj_tp_info
+ {
+ public int tp_start_pos;
+ public int tp_end_header;
+ public int tp_end_pos;
+ public int tp_start_pack;
+ public int tp_numpacks;
+ }
+
+ public struct opj_tile_info
+ {
+ public double thresh;
+ public int tileno;
+ public int start_pos;
+ public int end_header;
+ public int end_pos;
+ ///
+ /// Don't forget to initialize 33 elements
+ ///
+ public int[] pw;
+ ///
+ /// Don't forget to initialize 33 elements
+ ///
+ public int[] ph;
+ ///
+ /// Don't forget to initialize 33 elements
+ ///
+ public int[] pdx;
+ ///
+ /// Don't forget to initialize 33 elements
+ ///
+ public int[] pdy;
+
+ public opj_packet_info packet;
+ public int numpix;
+ public double distotile;
+ public int num_tps;
+ public opj_tp_info tp;
+ }
+
+ public struct opj_marker_info_t
+ {
+ public ushort type;
+ public int pos;
+ public int len;
+ }
+
+ public struct opj_codestream_info
+ {
+ public double D_max;
+ public int packno;
+ public int index_write;
+ public int image_w;
+ public int image_h;
+
+ public PROG_ORDER prog;
+
+ public int tile_x;
+ public int tile_y;
+ public int tile_Ox;
+ public int tile_Oy;
+ public int tw;
+ public int numcomps;
+ public int numlayers;
+ public int numdecompos;
+ public int marknum;
+ public opj_marker_info_t marker;
+ public int maxmarknum;
+ public int main_head_start;
+ public int main_head_end;
+ public int codestream_size;
+ public opj_tile_info tile;
+
+ }
+
+
+
+
+
+
+ public static class opj_defines
+ {
+ public const int OPJ_STREAM_READ = 0x0001;
+ public const int OPJ_STREAM_WRITE = 0x0002;
+
+ }
+
+}
diff --git a/OpenSim/Framework/OpenJpeg/pi.cs b/OpenSim/Framework/OpenJpeg/pi.cs
new file mode 100644
index 0000000..f7e211f
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/pi.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.OpenJpeg
+{
+ public static class pi
+ {
+ }
+
+ public struct opj_pi_resolution
+ {
+ public int pdx, pdy;
+ public int pw, ph;
+ }
+
+ public struct opj_pi_comp
+ {
+ public int dx, dy;
+ public int numresolutions;
+ public opj_pi_resolution resolutions;
+ }
+
+ public struct obj_pi_iterator
+ {
+ public sbyte tp_on;
+ public short include;
+ public int step_l;
+ public int step_r;
+ public int step_c;
+ public int step_p;
+ public int compno;
+ public int resno;
+ public int precno;
+ public int layno;
+ public int first;
+ public opj_poc poc;
+ public int numcomps;
+ public opj_pi_comp comps;
+
+ public int tx0, ty0, tx1, ty1;
+ public int x, y, dx, dy;
+ }
+
+
+
+
+}
--
cgit v1.1