Beispiel #1
0
        /// <summary> Initialize all members with the given number of tiles and components
        /// and the command-line arguments stored in a ParameterList instance
        ///
        /// </summary>
        /// <param name="nt">Number of tiles
        ///
        /// </param>
        /// <param name="nc">Number of components
        ///
        /// </param>
        /// <param name="imgsrc">The image source (used to get the image size)
        ///
        /// </param>
        /// <param name="pl">The ParameterList instance
        ///
        /// </param>
        public EncoderSpecs(int nt, int nc, BlkImgDataSrc imgsrc, ParameterList pl)
        {
            nTiles = nt;
            nComp  = nc;

            // ROI
            rois = new MaxShiftSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP);

            // Quantization
            pl.checkList(Quantizer.OPT_PREFIX, CSJ2K.j2k.util.ParameterList.toNameArray(Quantizer.ParameterInfo));
            qts  = new QuantTypeSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, pl);
            qsss = new QuantStepSizeSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, pl);
            gbs  = new GuardBitsSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, pl);

            // Wavelet transform
            wfs = new AnWTFilterSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, qts, pl);
            dls = new IntegerSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, pl, "Wlev");

            // Component transformation
            cts = new ForwCompTransfSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE, wfs, pl);

            // Entropy coder
            System.String[] strLcs = new System.String[] { "near_opt", "lazy_good", "lazy" };
            lcs = new StringSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, "Clen_calc", strLcs, pl);
            System.String[] strTerm = new System.String[] { "near_opt", "easy", "predict", "full" };
            tts = new StringSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, "Cterm_type", strTerm, pl);
            System.String[] strBoolean = new System.String[] { "on", "off" };
            sss   = new StringSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, "Cseg_symbol", strBoolean, pl);
            css   = new StringSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, "Ccausal", strBoolean, pl);
            rts   = new StringSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, "Cterminate", strBoolean, pl);
            mqrs  = new StringSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, "CresetMQ", strBoolean, pl);
            bms   = new StringSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, "Cbypass", strBoolean, pl);
            cblks = new CBlkSizeSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, pl);

            // Precinct partition
            pss = new PrecinctSizeSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE_COMP, imgsrc, dls, pl);

            // Codestream
            sops = new StringSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE, "Psop", strBoolean, pl);
            ephs = new StringSpec(nt, nc, ModuleSpec.SPEC_TYPE_TILE, "Peph", strBoolean, pl);
        }
Beispiel #2
0
		/// <summary> Instantiates a new entropy coder engine, with the specified source of
		/// data, nominal block width and height.
		/// 
		/// <p>If the 'OPT_PRED_TERM' option is given then the MQ termination must
		/// be 'TERM_PRED_ER' or an exception is thrown.</p>
		/// 
		/// </summary>
		/// <param name="src">The source of data
		/// 
		/// </param>
		/// <param name="cbks">Code-block size specifications
		/// 
		/// </param>
		/// <param name="pss">Precinct partition specifications
		/// 
		/// </param>
		/// <param name="bms">By-pass mode specifications
		/// 
		/// </param>
		/// <param name="mqrs">MQ-reset specifications
		/// 
		/// </param>
		/// <param name="rts">Regular termination specifications
		/// 
		/// </param>
		/// <param name="css">Causal stripes specifications
		/// 
		/// </param>
		/// <param name="sss">Error resolution segment symbol use specifications
		/// 
		/// </param>
		/// <param name="lcs">Length computation specifications
		/// 
		/// </param>
		/// <param name="tts">Termination type specifications
		/// 
		/// </param>
		/// <seealso cref="MQCoder">
		/// 
		/// </seealso>
		public StdEntropyCoder(CBlkQuantDataSrcEnc src, CBlkSizeSpec cblks, PrecinctSizeSpec pss, StringSpec bms, StringSpec mqrs, StringSpec rts, StringSpec css, StringSpec sss, StringSpec lcs, StringSpec tts):base(src)
		{
			this.cblks = cblks;
			this.pss = pss;
			this.bms = bms;
			this.mqrs = mqrs;
			this.rts = rts;
			this.css = css;
			this.sss = sss;
			this.lcs = lcs;
			this.tts = tts;
			int maxCBlkWidth, maxCBlkHeight;
			int i; // Counter
			int tsl; // Size for thread structures
			
			// Get the biggest width/height for the code-blocks
			maxCBlkWidth = cblks.MaxCBlkWidth;
			maxCBlkHeight = cblks.MaxCBlkHeight;
			
			// If we do timing create necessary structures
#if DO_TIMING
			time = new long[src.NumComps];
			// If we are timing make sure that 'finalize' gets called.
			//UPGRADE_ISSUE: Method 'java.lang.System.runFinalizersOnExit' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangSystem'"
			// CONVERSION PROBLEM?
            //System_Renamed.runFinalizersOnExit(true);
#endif
		
			tsl = 1;
			finishedTileComponent = null;
			
			// Allocate data structures
			outT = new ByteOutputBuffer[tsl];
			mqT = new MQCoder[tsl];
			boutT = new BitToByteOutput[tsl];
			stateT = new int[tsl][];
			for (int i2 = 0; i2 < tsl; i2++)
			{
				stateT[i2] = new int[(maxCBlkWidth + 2) * ((maxCBlkHeight + 1) / 2 + 2)];
			}
			symbufT = new int[tsl][];
			for (int i3 = 0; i3 < tsl; i3++)
			{
				symbufT[i3] = new int[maxCBlkWidth * (CSJ2K.j2k.entropy.StdEntropyCoderOptions.STRIPE_HEIGHT * 2 + 2)];
			}
			ctxtbufT = new int[tsl][];
			for (int i4 = 0; i4 < tsl; i4++)
			{
				ctxtbufT[i4] = new int[maxCBlkWidth * (CSJ2K.j2k.entropy.StdEntropyCoderOptions.STRIPE_HEIGHT * 2 + 2)];
			}
			distbufT = new double[tsl][];
			for (int i5 = 0; i5 < tsl; i5++)
			{
				distbufT[i5] = new double[32 * CSJ2K.j2k.entropy.StdEntropyCoderOptions.NUM_PASSES];
			}
			ratebufT = new int[tsl][];
			for (int i6 = 0; i6 < tsl; i6++)
			{
				ratebufT[i6] = new int[32 * CSJ2K.j2k.entropy.StdEntropyCoderOptions.NUM_PASSES];
			}
			istermbufT = new bool[tsl][];
			for (int i7 = 0; i7 < tsl; i7++)
			{
				istermbufT[i7] = new bool[32 * CSJ2K.j2k.entropy.StdEntropyCoderOptions.NUM_PASSES];
			}
			srcblkT = new CBlkWTData[tsl];
			for (i = 0; i < tsl; i++)
			{
				outT[i] = new ByteOutputBuffer();
				mqT[i] = new MQCoder(outT[i], NUM_CTXTS, MQ_INIT);
			}
			precinctPartition = new bool[src.NumComps][];
			for (int i8 = 0; i8 < src.NumComps; i8++)
			{
				precinctPartition[i8] = new bool[src.getNumTiles()];
			}
			
			// Create the subband description for each component and each tile
			//Subband sb = null;
			Coord numTiles = null;
			int nc = NumComps;
			numTiles = src.getNumTiles(numTiles);
			initTileComp(getNumTiles(), nc);
			
			for (int c = 0; c < nc; c++)
			{
				for (int tY = 0; tY < numTiles.y; tY++)
				{
					for (int tX = 0; tX < numTiles.x; tX++)
					{
						precinctPartition[c][tIdx] = false;
					}
				}
			}
		}
Beispiel #3
0
 /// <summary> Creates a EntropyCoder object for the appropriate entropy coding
 /// parameters in the parameter list 'pl', and having 'src' as the source
 /// of quantized data.
 ///
 /// </summary>
 /// <param name="src">The source of data to be entropy coded
 ///
 /// </param>
 /// <param name="pl">The parameter list (or options).
 ///
 /// </param>
 /// <param name="cbks">Code-block size specifications
 ///
 /// </param>
 /// <param name="pss">Precinct partition specifications
 ///
 /// </param>
 /// <param name="bms">By-pass mode specifications
 ///
 /// </param>
 /// <param name="mqrs">MQ-reset specifications
 ///
 /// </param>
 /// <param name="rts">Regular termination specifications
 ///
 /// </param>
 /// <param name="css">Causal stripes specifications
 ///
 /// </param>
 /// <param name="sss">Error resolution segment symbol use specifications
 ///
 /// </param>
 /// <param name="lcs">Length computation specifications
 ///
 /// </param>
 /// <param name="tts">Termination type specifications
 ///
 /// </param>
 /// <exception cref="IllegalArgumentException">If an error occurs while parsing
 /// the options in 'pl'
 ///
 /// </exception>
 public static EntropyCoder createInstance(CBlkQuantDataSrcEnc src, ParameterList pl, CBlkSizeSpec cblks, PrecinctSizeSpec pss, StringSpec bms, StringSpec mqrs, StringSpec rts, StringSpec css, StringSpec sss, StringSpec lcs, StringSpec tts)
 {
     // Check parameters
     pl.checkList(OPT_PREFIX, CSJ2K.j2k.util.ParameterList.toNameArray(pinfo));
     return(new StdEntropyCoder(src, cblks, pss, bms, mqrs, rts, css, sss, lcs, tts));
 }