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

📄 filebitstreamreaderagent.java

📁 jpeg2000算法实现
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
	boolean status=false; // True if decoding rate is reached when        int lastByte = in.getPos()+tilePartLen[t][curTilePart]-1-            tilePartHeadLen[t][curTilePart];	int minlys; // minimum layer start index of each component        int hlen,plen;        String strInfo = "Tile "+getTileIdx()+" (tile-part:"+curTilePart+            "): offset, length, header length\n";;        if(((Boolean)decSpec.pphs.getTileDef(t)).booleanValue()){            pph = true;        }        // Loop on resolution levels        for(int r=ress; r<rese; r++){            if(lys==null) continue;	    minlys = 100000;	    for(int c=comps; c<compe; c++) {		if(lys[c]!=null && r<lys[c].length && lys[c][r]<minlys)		    minlys = lys[c][r];            }            // Loop on layers            for(int l=minlys; l<lye; l++){                // Loop on components                for(int c=comps; c<compe; c++){		    // Check if resolution level is defined for this component		    if(r>mdl[c]) continue;		    if(l<lys[c][r]) continue;		    nPrec = pktDec.getNumPrecinct(c,r);                    // Loop on precints		    for(int p=0; p<nPrec; p++){			start = in.getPos();                        // If packed packet headers are used, there is no need                        // to check that there are bytes enough to read header                        if(pph){                            status =                                 pktDec.readPktHead(l,r,c,p,cbI[c][r],nBytes);                        }                                                // If we are about to read outside of tile-part,                        // skip to next tile-part                          if(start>lastByte &&                            curTilePart < firstPackOff[t].length-1){                            curTilePart++;                            in.seek(firstPackOff[t][curTilePart]);                            lastByte = in.getPos()+                                tilePartLen[t][curTilePart]-1-                                tilePartHeadLen[t][curTilePart];                         }                                                // Read SOP marker segment if necessary                        status = pktDec.readSOPMarker(nBytes,p,c,r);			if(status){                            if(pl.getBooleanParameter("cdstr_info"))                                FacilityManager.getMsgLogger().                                    printmsg(MsgLogger.INFO,strInfo);			    return true;                        }                        if(!pph)                            status =                                 pktDec.readPktHead(l,r,c,p,cbI[c][r],nBytes);			if(status){                            if(pl.getBooleanParameter("cdstr_info"))                                FacilityManager.getMsgLogger().                                    printmsg(MsgLogger.INFO,strInfo);			    return true;                        }			// Store packet head length                        hlen = in.getPos()-start;			pktHL.addElement(new Integer(hlen));                        status = pktDec.readPktBody(l,r,c,p,cbI[c][r],nBytes);                                                plen = in.getPos()-start;                        strInfo+= " Pkt l="+l+",r="+r+",c="+c+": "+start+                            ", "+plen+", "+hlen+"\n";			if(status) {                            if(pl.getBooleanParameter("cdstr_info"))                                FacilityManager.getMsgLogger().                                    printmsg(MsgLogger.INFO,strInfo);			    return true;                        }                    } // End loop on precincts                } // End loop on components            } // End loop on layers        } // End loop on resolution levels         if(pl.getBooleanParameter("cdstr_info"))            FacilityManager.getMsgLogger().printmsg(MsgLogger.INFO,strInfo);	return false; // Decoding rate was not reached    }        /**      * Reads packets of the current tile according to the     * resolution-position-component-layer progressiveness.     *     * @param lys Index of the first layer for each component and resolution     *     * @param lye Index of the last layer     *     * @param ress Index of the first resolution level     *     * @param rese Index of the last resolution level     *     * @param comps Index of the first component     *     * @param compe Index of the last component     *     * @return True if rate has been reached     * */    private boolean readResPosCompLy(int[][] lys,int lye,int ress,int rese,				     int comps,int compe,                                     int curTilePart)         throws IOException{        boolean pph=false;	int t = getTileIdx(); // Current tile index	boolean status=false; // True if decoding rate is reached when        int lastByte = in.getPos()+tilePartLen[t][curTilePart]-1-            tilePartHeadLen[t][curTilePart];	int start;	Coord xys[],xyInc;	int x0,y0,x1,y1,xInc,yInc,x0_rl,y0_rl,xInc_rl,yInc_rl;        int hlen,plen;        String strInfo = "Tile "+getTileIdx()+" (tile-part:"+curTilePart+            "): offset, length, header length\n";;        if(((Boolean)decSpec.pphs.getTileDef(t)).booleanValue()){            pph = true;        }	// Coord[] xys = pktDec.getSotEotArrayMax(c);	xys = pktDec.getSotEotArrayMax(0);	x0 = xys[0].x;	y0 = xys[0].y;	x1 = xys[1].x;	y1 = xys[1].y;		// Coord xyInc = pkDec.getIncArrayMax(c);	xyInc = pktDec.getIncArrayMax(0);	xInc = xyInc.x;	yInc = xyInc.y;	// precinct index	int[][][] precIdx = new int[compe][rese][lye];  	// Loop on resolution levels  	for(int r=ress; r<rese; r++){  	    // Loop on precints	    for(int y=y0; y<y1; y+=yInc)		for(int x=x0; x<x1; x+=xInc){		    // Loop on components		    for(int c=comps; c<compe; c++){			// Check if resolution level is defined for this			// component			if(r>mdl[c]) continue;			xyInc = pktDec.getIncArray(c,r);			xInc_rl = xyInc.x;			yInc_rl = xyInc.y;			xys = pktDec.getSotEotArray(c,r);			x0_rl = xys[0].x;			y0_rl = xys[0].y;						// Test on precinct			if( ( (x==x0) || (x%xInc_rl==0) ) &&			    ( (y==y0) || (y%yInc_rl==0) ) ){			    			    // Loop on layers			    for(int l=lys[c][r]; l<lye; l++){				start = in.getPos();                                // If packed packet headers are used, there                                 // is no need to check that there are bytes                                 // enough to read header				if(pph)                                     status = pktDec.                                        readPktHead(l,r,c,precIdx[c][r][l],                                                    cbI[c][r],nBytes);				// If we are about to read outside of				// tile-part, skip to next tile-part                                if(start>lastByte &&                                    curTilePart < firstPackOff[t].length-1){                                    curTilePart++;				    in.seek(firstPackOff[t][curTilePart]);				    lastByte = in.getPos()+					tilePartLen[t][curTilePart]-1-					tilePartHeadLen[t][curTilePart];  				}                                // Read SOP marker segment if necessary                                status = pktDec.                                    readSOPMarker(nBytes,precIdx[c][r][l],c,r);                                                                if(status){                                    if(pl.getBooleanParameter("cdstr_info"))                                        FacilityManager.getMsgLogger().                                        printmsg(MsgLogger.INFO,strInfo);                                    return true;                                }				if(!pph)                                     status = pktDec.                                        readPktHead(l,r,c,precIdx[c][r][l],                                                    cbI[c][r],nBytes);				if(status) {                                    if(pl.getBooleanParameter("cdstr_info"))                                        FacilityManager.getMsgLogger().                                            printmsg(MsgLogger.INFO,strInfo);				    return true;                                }								// Store packet head length                                hlen = in.getPos()-start;				pktHL.addElement(new Integer(hlen));								status = 				    pktDec.readPktBody(l,r,c,precIdx[c][r][l],                                                       cbI[c][r],nBytes);                                plen = in.getPos()-start;                                strInfo+= " Pkt l="+l+",r="+r+",c="+c+": "+                                    start+", "+plen+", "+hlen+"\n";				if(status){                                    if(pl.getBooleanParameter("cdstr_info"))                                        FacilityManager.getMsgLogger().                                            printmsg(MsgLogger.INFO,strInfo);				    return true;                                }				precIdx[c][r][l]++;			    } // End loop on layers			} // End test on precincts		    } // End loop on components		} // End loop on precincts  	} // End loop on resolution levels         if(pl.getBooleanParameter("cdstr_info"))            FacilityManager.getMsgLogger().printmsg(MsgLogger.INFO,strInfo);	return false; // Decoding rate was not reached    }        /**      * Reads packets of the current tile according to the     * position-component-resolution-layer progressiveness.     *     * @param lys Index of the first layer for each component and resolution     *     * @param lye Index of the last layer     *     * @param ress Index of the first resolution level     *     * @param rese Index of the last resolution level     *     * @param comps Index of the first component     *     * @param compe Index of the last component     *     * @return True if rate has been reached     * */    private boolean readPosCompResLy(int[][] lys,int lye,int ress,int rese,				     int comps,int compe,                                     int curTilePart)         throws IOException{        boolean pph=false;	int t = getTileIdx(); // Current tile index	boolean status=false; // True if decoding rate is reached when        int lastByte = in.getPos()+tilePartLen[t][curTilePart]-1-            tilePartHeadLen[t][curTilePart];	int start;	Coord xys[],xyInc;	int x0,y0,x1,y1,xInc,yInc,x0_rl,y0_rl,xInc_rl,yInc_rl;        int hlen,plen;        String strInfo = "Tile "+getTileIdx()+" (tile-part:"+curTilePart+            "): offset, length, header length\n";;        if(((Boolean)decSpec.pphs.getTileDef(t)).booleanValue()){            pph = true;        }	// Coord[] xys = pktDec.getSotEotArrayMax(c);	xys = pktDec.getSotEotArrayMax(0);	x0 = xys[0].x;	y0 = xys[0].y;	x1 = xys[1].x;	y1 = xys[1].y;		// Coord xyInc = pkDec.getIncArrayMax(c);	xyInc = pktDec.getIncArrayMax(0);	xInc = xyInc.x;	yInc = xyInc.y;	// precinct index	int[][][] precIdx = new int[compe][rese][lye];  	// Loop on precincts	for(int y=y0; y<y1; y+=yInc)	    for(int x=x0; x<x1; x+=xInc){  	    // Loop on components  	    for(int c=comps; c<compe; c++){  		// Loop on resolution levels  		for(int r=ress; r<rese; r++){		    // Check if resolution level is defined for this		    // component		    if(r>mdl[c]) continue;		    xyInc = pktDec.getIncArray(c,r);		    xInc_rl = xyInc.x;		    yInc_rl = xyInc.y;		    xys = pktDec.getSotEotArray(c,r);		    x0_rl = xys[0].x;		    y0_rl = xys[0].y;		    // Test on precinct		    if( ( (x==x0) || (x%xInc_rl==0) ) &&			( (y==y0) || (y%yInc_rl==0) ) ){			// Loop on layers			for(int l=lys[c][r]; l<lye; l++){			    start = in.getPos();                            // If packed packet headers are used, there                             // is no need to check that there are bytes                             // enough to read header                            if(pph)                                status = pktDec.                                    readPktHead(l,r,c,precIdx[c][r][l],                                                cbI[c][r],nBytes);			    // If we are about to read outside of tile-part,			    // skip to next tile-part                            if(start>lastByte &&                                curTilePart < firstPackOff[t].length-1){                                curTilePart++;				in.seek(firstPackOff[t][curTilePart]);

⌨️ 快捷键说明

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