⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 headerinfo.java

📁 jpeg2000编解码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                str += "   "+chg                    +"      "+rspoc[chg]                    +"     "+cspoc[chg]                    +"     "+lyepoc[chg]                    +"      "+repoc[chg]                    +"     "+cepoc[chg];                switch(ppoc[chg]) {                case ProgressionType.LY_RES_COMP_POS_PROG:                    str += "  LY_RES_COMP_POS_PROG\n";                    break;                case ProgressionType.RES_LY_COMP_POS_PROG:                    str += "  RES_LY_COMP_POS_PROG\n";                    break;                case ProgressionType.RES_POS_COMP_LY_PROG:                    str += "  RES_POS_COMP_LY_PROG\n";                    break;                case ProgressionType.POS_COMP_RES_LY_PROG:                    str += "  POS_COMP_RES_LY_PROG\n";                    break;                case ProgressionType.COMP_POS_RES_LY_PROG:                    str += "  COMP_POS_RES_LY_PROG\n";                    break;                }            }            str += "\n";            return str;        }    }    /** Returns a new instance of POC */    public POC getNewPOC() { return new POC(); }    /** Internal class holding information found in the CRG marker segment */    public class CRG {        public int lcrg;        public int[] xcrg;        public int[] ycrg;        /** Display information found in the CRG marker segment */        public String toString() {            String str = "\n --- CRG ("+lcrg+" bytes) ---\n";            for(int c=0; c<xcrg.length; c++) {                str += " Component "+c+" offset : "+xcrg[c]+","+ycrg[c]+"\n";            }            str += "\n";            return str;        }    }    /** Returns a new instance of CRG */    public CRG getNewCRG() { return new CRG(); }    /** Internal class holding information found in the COM marker segments */    public class COM {        public int lcom;        public int rcom;        public byte[] ccom;        /** Display information found in the COM marker segment */        public String toString() {            String str = "\n --- COM ("+lcom+" bytes) ---\n";            if (rcom==0) {                str += " Registration : General use (binary values)\n";            } else if (rcom==1) {                str += " Registration : General use (IS 8859-15:1999 "+                    "(Latin) values)\n";                str += " Text         : "+(new String(ccom))+"\n";            } else {                str += " Registration : Unknown\n";            }            str += "\n";            return str;        }    }    /** Returns a new instance of COM */    public COM getNewCOM() { ncom++; return new COM(); }    /** Returns the number of found COM marker segments */    public int getNumCOM() { return ncom; }    /** Reference to the SIZ marker segment found in main header */    public SIZ siz;    /** Reference to the SOT marker segments found in tile-part headers. The     * kwy is given by "t"+tileIdx"_tp"+tilepartIndex. */    public Hashtable sot = new Hashtable();    /** Reference to the COD marker segments found in main and first tile-part     * header. The key is either "main" or "t"+tileIdx.*/    public Hashtable cod = new Hashtable();    /** Reference to the COC marker segments found in main and first tile-part     * header. The key is either "main_c"+componentIndex or     * "t"+tileIdx+"_c"+component_index. */    public Hashtable coc = new Hashtable();    /** Reference to the RGN marker segments found in main and first tile-part     * header. The key is either "main_c"+componentIndex or     * "t"+tileIdx+"_c"+component_index. */    public Hashtable rgn = new Hashtable();    /** Reference to the QCD marker segments found in main and first tile-part     * header. The key is either "main" or "t"+tileIdx. */    public Hashtable qcd = new Hashtable();    /** Reference to the QCC marker segments found in main and first tile-part     * header. They key is either "main_c"+componentIndex or     * "t"+tileIdx+"_c"+component_index. */    public Hashtable qcc = new Hashtable();    /** Reference to the POC marker segments found in main and first tile-part     * header. They key is either "main" or "t"+tileIdx. */    public Hashtable poc = new Hashtable();    /** Reference to the CRG marker segment found in main header */    public CRG crg;    /** Reference to the COM marker segments found in main and tile-part     * headers. The key is either "main_"+comIdx or "t"+tileIdx+"_"+comIdx. */    public Hashtable com = new Hashtable();    /** Number of found COM marker segment */    private int ncom = 0;    /** Display information found in the different marker segments of the main     * header */    public String toStringMainHeader() {        int nc = siz.csiz;        // SIZ        String str = ""+siz;        // COD        if(cod.get("main")!=null) {            str += ""+(COD)cod.get("main");        }        // COCs        for(int c=0; c<nc; c++) {            if(coc.get("main_c"+c)!=null) {                str += ""+(COC)coc.get("main_c"+c);            }        }        // QCD        if(qcd.get("main")!=null) {            str += ""+(QCD)qcd.get("main");        }        // QCCs        for(int c=0; c<nc; c++) {            if(qcc.get("main_c"+c)!=null) {                str += ""+(QCC)qcc.get("main_c"+c);            }        }        // RGN        for(int c=0; c<nc; c++) {            if(rgn.get("main_c"+c)!=null) {                str += ""+(RGN)rgn.get("main_c"+c);            }        }        // POC        if(poc.get("main")!=null) {            str += ""+(POC)poc.get("main");        }        // CRG        if(crg!=null) {            str += ""+crg;        }        // COM        for(int i=0; i<ncom; i++) {            if(com.get("main_"+i)!=null) {                str += ""+(COM)com.get("main_"+i);            }        }        return str;    }    /**      * Returns information found in the tile-part headers of a given tile.     *     * @param t index of the tile     *     * @param tp Number of tile-parts     * */    public String toStringTileHeader(int t, int ntp) {        int nc = siz.csiz;        String str = "";        // SOT        for(int i=0; i<ntp; i++) {            str += "Tile-part "+i+", tile "+t+":\n";            str += ""+(SOT)sot.get("t"+t+"_tp"+i);        }        // COD        if(cod.get("t"+t)!=null) {            str += ""+(COD)cod.get("t"+t);        }        // COCs        for(int c=0; c<nc; c++) {            if(coc.get("t"+t+"_c"+c)!=null) {                str += ""+(COC)coc.get("t"+t+"_c"+c);            }        }        // QCD        if(qcd.get("t"+t)!=null) {            str += ""+(QCD)qcd.get("t"+t);        }        // QCCs        for(int c=0; c<nc; c++) {            if(qcc.get("t"+t+"_c"+c)!=null) {                str += ""+(QCC)qcc.get("t"+t+"_c"+c);            }        }        // RGN        for(int c=0; c<nc; c++) {            if(rgn.get("t"+t+"_c"+c)!=null) {                str += ""+(RGN)rgn.get("t"+t+"_c"+c);            }        }        // POC        if(poc.get("t"+t)!=null) {            str += ""+(POC)poc.get("t"+t);        }        return str;    }    /**      * Returns information found in the tile-part headers of a given tile     * exception the SOT marker segment.     *     * @param t index of the tile     *     * @param tp Number of tile-parts     * */    public String toStringThNoSOT(int t, int ntp) {        int nc = siz.csiz;        String str = "";        // COD        if(cod.get("t"+t)!=null) {            str += ""+(COD)cod.get("t"+t);        }        // COCs        for(int c=0; c<nc; c++) {            if(coc.get("t"+t+"_c"+c)!=null) {                str += ""+(COC)coc.get("t"+t+"_c"+c);            }        }        // QCD        if(qcd.get("t"+t)!=null) {            str += ""+(QCD)qcd.get("t"+t);        }        // QCCs        for(int c=0; c<nc; c++) {            if(qcc.get("t"+t+"_c"+c)!=null) {                str += ""+(QCC)qcc.get("t"+t+"_c"+c);            }        }        // RGN        for(int c=0; c<nc; c++) {            if(rgn.get("t"+t+"_c"+c)!=null) {                str += ""+(RGN)rgn.get("t"+t+"_c"+c);            }        }        // POC        if(poc.get("t"+t)!=null) {            str += ""+(POC)poc.get("t"+t);        }        return str;    }    /** Returns a copy of this object */    public HeaderInfo getCopy(int nt) {        HeaderInfo nhi = null;        // SIZ        try {            nhi = (HeaderInfo)clone();        } catch (CloneNotSupportedException e) {            throw new Error("Cannot clone HeaderInfo instance");        }        nhi.siz = siz.getCopy();        // COD        if(cod.get("main")!=null) {            COD ms = (COD)cod.get("main");            nhi.cod.put("main",ms.getCopy());        }        for (int t=0; t<nt; t++) {            if(cod.get("t"+t)!=null) {                COD ms = (COD)cod.get("t"+t);                nhi.cod.put("t"+t,ms.getCopy());            }        }        return nhi;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -