public static ForwardWT createInstance(BlkImgDataSrc src, ParameterList pl, EncoderSpecs encSpec)
{
int deflev; // defdec removed
//System.String decompstr;
//System.String wtstr;
//System.String pstr;
//SupportClass.StreamTokenizerSupport stok;
//SupportClass.Tokenizer strtok;
//int prefx, prefy; // Partitioning reference point coordinates
// Check parameters
pl.checkList(OPT_PREFIX, CSJ2K.j2k.util.ParameterList.toNameArray(pinfo));
deflev = ((System.Int32) encSpec.dls.getDefault());
// Code-block partition origin
System.String str = "";
if (pl.getParameter("Wcboff") == null)
{
throw new System.InvalidOperationException("You must specify an argument to the '-Wcboff' " + "option. See usage with the '-u' option");
}
SupportClass.Tokenizer stk = new SupportClass.Tokenizer(pl.getParameter("Wcboff"));
if (stk.Count != 2)
{
throw new System.ArgumentException("'-Wcboff' option needs two" + " arguments. See usage with " + "the '-u' option.");
}
int cb0x = 0;
str = stk.NextToken();
try
{
cb0x = (System.Int32.Parse(str));
}
catch (System.FormatException e)
{
throw new System.ArgumentException("Bad first parameter for the " + "'-Wcboff' option: " + str);
}
if (cb0x < 0 || cb0x > 1)
{
throw new System.ArgumentException("Invalid horizontal " + "code-block partition origin.");
}
int cb0y = 0;
str = stk.NextToken();
try
{
cb0y = (System.Int32.Parse(str));
}
catch (System.FormatException e)
{
throw new System.ArgumentException("Bad second parameter for the " + "'-Wcboff' option: " + str);
}
if (cb0y < 0 || cb0y > 1)
{
throw new System.ArgumentException("Invalid vertical " + "code-block partition origin.");
}
if (cb0x != 0 || cb0y != 0)
{
FacilityManager.getMsgLogger().printmsg(CSJ2K.j2k.util.MsgLogger_Fields.WARNING, "Code-blocks partition origin is " + "different from (0,0). This is defined in JPEG 2000" + " part 2 and may be not supported by all JPEG 2000 " + "decoders.");
}
return new ForwWTFull(src, encSpec, cb0x, cb0y);
}