Package jj2000.j2k.codestream

Examples of jj2000.j2k.codestream.HeaderInfo$COM


                metadata.mergeTree(J2KMetadata.nativeMetadataFormatName,
                                   metadata1.getAsTree(J2KMetadata.nativeMetadataFormatName));
            }
        }

        FileFormatWriter ffw =
            new FileFormatWriter(tmpFile, stream,
                                 imgsrc.getImgHeight(),
                                 imgsrc.getImgWidth(), nc, bpc,
                                 fileLength,
                                 colorModel,
                                 sampleModel,
                                 metadata);
        fileLength += ffw.writeFileFormat();
        tmpFile.delete();

        processImageComplete();
    }
View Full Code Here


        // Creates the forward component transform
        ForwCompTransf fctransf = new ForwCompTransf(imgtiler, j2kwparam);

        // Creates ImgDataConverter
        ImgDataConverter converter = new ImgDataConverter(fctransf);

        // Creates ForwardWT (forward wavelet transform)
        ForwardWT dwt = ForwardWT.createInstance(converter, j2kwparam);

        // Creates Quantizer
View Full Code Here

        int trefy = j2kwparam.getTileGridYOffset();
        if (trefx < 0 || trefy < 0 || trefx > refx || trefy > refy)
            throw new IIOException(I18N.getString("J2KImageWriter4"));

        // Instantiate tiler
        Tiler imgtiler = new Tiler(imgsrc,refx,refy,trefx,trefy,tw,th);

        // Creates the forward component transform
        ForwCompTransf fctransf = new ForwCompTransf(imgtiler, j2kwparam);

        // Creates ImgDataConverter
        ImgDataConverter converter = new ImgDataConverter(fctransf);

        // Creates ForwardWT (forward wavelet transform)
        ForwardWT dwt = ForwardWT.createInstance(converter, j2kwparam);

        // Creates Quantizer
        Quantizer quant = Quantizer.createInstance(dwt,j2kwparam);

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

        // Creates EntropyCoder
        EntropyCoder ecoder =
      EntropyCoder.createInstance(rois, j2kwparam,
    j2kwparam.getCodeBlockSize(),
    j2kwparam.getPrecinctPartition(),
    j2kwparam.getBypass(),
    j2kwparam.getResetMQ(),
    j2kwparam.getTerminateOnByte(),
    j2kwparam.getCausalCXInfo(),
    j2kwparam.getCodeSegSymbol(),
    j2kwparam.getMethodForMQLengthCalc(),
    j2kwparam.getMethodForMQTermination());

        // 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){
            CodestreamManipulator cm =
                new CodestreamManipulator(tmpFile, ntiles, pktspertp,
                                          pphMain, pphTile, tempSop,
                                          tempEph);
View Full Code Here

        // Instantiate tiler
        Tiler imgtiler = new Tiler(imgsrc,refx,refy,trefx,trefy,tw,th);

        // Creates the forward component transform
        ForwCompTransf fctransf = new ForwCompTransf(imgtiler, j2kwparam);

        // Creates ImgDataConverter
        ImgDataConverter converter = new ImgDataConverter(fctransf);

        // Creates ForwardWT (forward wavelet transform)
View Full Code Here

    /** Sets <code>componentTransformation</code> */
    // NOTE This requires filters having been set previously.
    public void setComponentTransformation(String values) {
        componentTransformation =
            new ForwCompTransfSpec(numTiles,
                                   numComponents,
                                   ModuleSpec.SPEC_TYPE_TILE,
                                   (AnWTFilterSpec)filters,
                                   this,
                                   values);
View Full Code Here

     * constructor, to which warnings should be sent.
     */
    public J2KMetadata(ImageInputStream iis,
                       J2KImageReader reader) throws IOException {
        this();
        RandomAccessIO in = new IISRandomAccessIO(iis);

        iis.mark();
        // **** File Format ****
        // If the codestream is wrapped in the jp2 fileformat, Read the
        // file format wrapper
View Full Code Here

        // Creates ForwardWT (forward wavelet transform)
        ForwardWT dwt = ForwardWT.createInstance(converter, j2kwparam);

        // Creates Quantizer
        Quantizer quant = Quantizer.createInstance(dwt,j2kwparam);

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

        // Creates EntropyCoder
View Full Code Here

        // Creates Quantizer
        Quantizer quant = Quantizer.createInstance(dwt,j2kwparam);

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

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

        // Tile-parts and packed packet headers
        int pktspertp = j2kwparam.getPacketPerTilePart();
        int ntiles = imgtiler.getNumTiles();
        if (pktspertp>0 || pphTile || pphMain){
            CodestreamManipulator cm =
                new CodestreamManipulator(tmpFile, ntiles, pktspertp,
                                          pphMain, pphTile, tempSop,
                                          tempEph);
            fileLength += cm.doCodestreamManipulation();
        }

        // File Format
        int nc= imgsrc.getNumComps() ;
        int[] bpc = new int[nc];
View Full Code Here

  {
  }
 
  public void decode( String inputFileName, String outputFileName )
  {
    ParameterList defpl;
    String param;
    int i;

    // Get the dfault parameter values
    defpl = new ParameterList();
    for (i=pinfo.length-1; i>=0; i--) {
      if(pinfo[i][3]!=null)
        defpl.put(pinfo[i][0],pinfo[i][3]);
    }

    // Get all parameters from and put them in a parameter list
    pl = new ParameterList(defpl);
    for (i=0; i<pinfo.length; i++) {
      param = getParameter(pinfo[i][0]);
      if (param != null) {
        pl.put(pinfo[i][0],param);
      }
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.