Package jj2000.j2k.codestream

Examples of jj2000.j2k.codestream.HeaderInfo$COM


        // Rely on rate allocator to limit amount of data
        File tmpFile = File.createTempFile("jiio-", ".tmp");
        tmpFile.deleteOnExit();

        // Creates CodestreamWriter
        FileCodestreamWriter bwriter =
            new FileCodestreamWriter(tmpFile, Integer.MAX_VALUE);

        // Creates the rate allocator
        float rate = (float)j2kwparam.getEncodingRate();
        PostCompRateAllocator ralloc =
            PostCompRateAllocator.createInstance(ecoder,
                                                 rate,
                                                 bwriter,
                                                 j2kwparam);

        // Instantiates the HeaderEncoder
        HeaderEncoder headenc =
            new HeaderEncoder(imgsrc, imsigned, dwt, imgtiler,
                              j2kwparam, rois,ralloc);

        ralloc.setHeaderEncoder(headenc);

        // Writes header to be able to estimate header overhead
        headenc.encodeMainHeader();

        //Initializes rate allocator, with proper header
        // overhead. This will also encode all the data
        try {
            ralloc.initialize();
        } catch (RuntimeException e) {
            if (WRITE_ABORTED.equals(e.getMessage())) {
                bwriter.close();
                tmpFile.delete();
                processWriteAborted();
                return;
            } else throw e;
        }

        // Write header (final)
        headenc.reset();
        headenc.encodeMainHeader();

        // Insert header into the codestream
        bwriter.commitBitstreamHeader(headenc);

        // Now do the rate-allocation and write result
        ralloc.runAndWrite();

        //Done for data encoding
        bwriter.close();

        // Calculate file length
        int fileLength = bwriter.getLength();

        // Tile-parts and packed packet headers
        int pktspertp = j2kwparam.getPacketPerTilePart();
        int ntiles = imgtiler.getNumTiles();
        if (pktspertp>0 || pphTile || pphMain){
View Full Code Here


                                                 rate,
                                                 bwriter,
                                                 j2kwparam);

        // Instantiates the HeaderEncoder
        HeaderEncoder headenc =
            new HeaderEncoder(imgsrc, imsigned, dwt, imgtiler,
                              j2kwparam, rois,ralloc);

        ralloc.setHeaderEncoder(headenc);

        // Writes header to be able to estimate header overhead
        headenc.encodeMainHeader();

        //Initializes rate allocator, with proper header
        // overhead. This will also encode all the data
        try {
            ralloc.initialize();
        } catch (RuntimeException e) {
            if (WRITE_ABORTED.equals(e.getMessage())) {
                bwriter.close();
                tmpFile.delete();
                processWriteAborted();
                return;
            } else throw e;
        }

        // Write header (final)
        headenc.reset();
        headenc.encodeMainHeader();

        // Insert header into the codestream
        bwriter.commitBitstreamHeader(headenc);

        // Now do the rate-allocation and write result
View Full Code Here

    pl.setProperty("i", inputFileName );
    param = pl.getParameter("i");
   
   
        showStatus("Initializing JJ2000 decoder...");
        dec = new Decoder(pl);
        showStatus("Decoding...");
        dec.run();
        outputFilesPaths = dec.getOutputFilesPaths();
        numComponents = dec.getNumComponents();
  }
View Full Code Here

        {
          sb.append("-" + e.getKey() + " " + e.getValue() + " ");
        }
       
       
        dec = new Encoder(pl);
        showStatus("Encoding... parameters " + sb.toString());
        dec.run();
  }
View Full Code Here

        return bypass;
    }

    /** Sets <code>codeBlockSize</code> */
    public void setCodeBlockSize(String values) {
        codeBlockSize = new CBlkSizeSpec(numTiles,
                                         numComponents,
                                         ModuleSpec.SPEC_TYPE_TILE_COMP,
                                         this,
                                         values);
    }
View Full Code Here

    /** Sets <code>precinctPartition</code> */
    public void setPrecinctPartition(String values) {
        String[] strBoolean = {"true","false"};
        if (imgsrc != null)
            precinctPartition =
                new PrecinctSizeSpec(numTiles,
                                     numComponents,
                                     ModuleSpec.SPEC_TYPE_TILE_COMP,
                                     new RenderedImageSrc(imgsrc, this, null),
                                     decompositionLevel,
                                     this,
                                     values);
        else if (raster != null)
            precinctPartition =
                new PrecinctSizeSpec(numTiles,
                                     numComponents,
                                     ModuleSpec.SPEC_TYPE_TILE_COMP,
                                     new RenderedImageSrc(raster, this, null),
                                     decompositionLevel,
                                     this,
View Full Code Here

    }

    /** Sets <code>progressionType</code> */
    public void setProgressionType(LayersInfo lyrs, String values) {
        String[] strBoolean = {"true","false"};
        progressionType = new ProgressionSpec(numTiles,
                                              numComponents,
                                              lyrs.getTotNumLayers(),
                                              decompositionLevel,
                                              ModuleSpec.SPEC_TYPE_TILE_COMP,
                                              this,
View Full Code Here

        // Creates ROIScaler
        ROIScaler rois = ROIScaler.createInstance(quant, j2kwparam);

        // Creates EntropyCoder
        EntropyCoder ecoder =
      EntropyCoder.createInstance(rois, j2kwparam,
    j2kwparam.getCodeBlockSize(),
    j2kwparam.getPrecinctPartition(),
    j2kwparam.getBypass(),
    j2kwparam.getResetMQ(),
View Full Code Here

        FileCodestreamWriter bwriter =
            new FileCodestreamWriter(tmpFile, Integer.MAX_VALUE);

        // Creates the rate allocator
        float rate = (float)j2kwparam.getEncodingRate();
        PostCompRateAllocator ralloc =
            PostCompRateAllocator.createInstance(ecoder,
                                                 rate,
                                                 bwriter,
                                                 j2kwparam);

        // Instantiates the HeaderEncoder
        HeaderEncoder headenc =
            new HeaderEncoder(imgsrc, imsigned, dwt, imgtiler,
                              j2kwparam, rois,ralloc);

        ralloc.setHeaderEncoder(headenc);

        // Writes header to be able to estimate header overhead
        headenc.encodeMainHeader();

        //Initializes rate allocator, with proper header
        // overhead. This will also encode all the data
        try {
            ralloc.initialize();
        } catch (RuntimeException e) {
            if (WRITE_ABORTED.equals(e.getMessage())) {
                bwriter.close();
                tmpFile.delete();
                processWriteAborted();
                return;
            } else throw e;
        }

        // Write header (final)
        headenc.reset();
        headenc.encodeMainHeader();

        // Insert header into the codestream
        bwriter.commitBitstreamHeader(headenc);

        // Now do the rate-allocation and write result
        ralloc.runAndWrite();

        //Done for data encoding
        bwriter.close();

        // Calculate file length
View Full Code Here

        iis.mark();
        // **** File Format ****
        // If the codestream is wrapped in the jp2 fileformat, Read the
        // file format wrapper
        FileFormatReader ff = new FileFormatReader(in, this);
        ff.readFileFormat();
        iis.reset();
    }
View Full Code Here

TOP

Related Classes of jj2000.j2k.codestream.HeaderInfo$COM

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.