|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultProperty
cz.cuni.jagrlib.Piece
cz.cuni.jagrlib.DefaultBlockQuantizer
cz.cuni.jagrlib.piece.JPEGQuantizer
public class JPEGQuantizer
JPEG-like block quantizer.
Field Summary | |
---|---|
protected static int[][] |
CB50
JPEG recommendation for Cb, Cr channels and 50% quality (annex K.2). |
protected static int |
MAX_QUANT
Upper bound for q-value - in strict Baseline JPEG system (8-bit quantizer). |
static int |
MAX_TABLES
Maximum number of quantization tables. |
protected static int |
OUTSIDE_CB
|
protected static int |
OUTSIDE_Y
|
protected int[][][] |
q
Quantization tables. |
static RegPiece |
reg
Static registration instance for this class. |
static java.lang.String |
STRICT_JPEG
|
protected boolean |
strictBaselineJPEG
Obey strict Baseline JPEG rules (8-bit quantizer)? |
protected static int[][] |
Y50
JPEG recommendation for Y channel and 50% quality (annex K.1). |
Fields inherited from class cz.cuni.jagrlib.DefaultBlockQuantizer |
---|
CATEGORY, TEMPLATE_NAME, tmpD, tmpI, variant |
Fields inherited from class cz.cuni.jagrlib.Piece |
---|
channels, info, pl, plugs, TEMPLATE_TYPE, userBreak |
Fields inherited from interface cz.cuni.jagrlib.iface.Property |
---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
Constructor Summary | |
---|---|
JPEGQuantizer()
|
Method Summary | |
---|---|
int |
dequantize(int[] quant,
double[] coef)
Dequantization = reconstruction (floating-point form). |
protected int |
fiftyPercentCbCr(int x,
int y)
|
protected static int |
fiftyPercentY(int x,
int y)
|
java.lang.Object |
get(java.lang.String key)
Gets the given property. |
boolean |
loadData(byte[] data)
Loads instance parameters from (previously stored) binary data. |
int |
quantize(double[] coef,
int[] quant)
Quantization (floating-point form). |
void |
set(java.lang.String key,
java.lang.Object value)
Sets the given property. |
void |
setBlockSize(int width,
int height)
Sets actual block size. |
void |
setData(int[] qtable)
Sets quantization table for the current variant. |
void |
setQuality(float quality)
Sets actual quality coefficient. |
static int |
setTemplate(Template t,
int ord)
General-purpose registration routine. |
int |
setVariant(int variant)
Set actual quantizer variant (context). |
byte[] |
storeData()
Pack instance parameters into binary format. |
Methods inherited from class cz.cuni.jagrlib.DefaultBlockQuantizer |
---|
dequantize, quantize |
Methods inherited from class cz.cuni.jagrlib.Piece |
---|
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop |
Methods inherited from class cz.cuni.jagrlib.DefaultProperty |
---|
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, stringProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cz.cuni.jagrlib.iface.Property |
---|
commit |
Field Detail |
---|
public static final int MAX_TABLES
protected int[][][] q
protected boolean strictBaselineJPEG
protected static final int MAX_QUANT
protected static final int OUTSIDE_Y
protected static final int[][] Y50
protected static final int OUTSIDE_CB
protected static final int[][] CB50
public static final java.lang.String STRICT_JPEG
public static final RegPiece reg
Constructor Detail |
---|
public JPEGQuantizer()
Method Detail |
---|
protected static final int fiftyPercentY(int x, int y)
protected final int fiftyPercentCbCr(int x, int y)
public int setVariant(int variant)
setVariant
in interface BlockQuantizer
setVariant
in class DefaultBlockQuantizer
variant
- Variant number (from 0
).
setBlockSize(int, int)
,
setQuality(float)
,
setData(int[])
public void setBlockSize(int width, int height)
setBlockSize
in interface BlockQuantizer
setBlockSize
in class DefaultBlockQuantizer
width
- Horizontal block size (1D block size).height
- Vertical block size (1
for 1D).setVariant(int)
,
setQuality(float)
,
setData(int[])
public void setQuality(float quality)
0.0f
to 1.0f
.
setQuality
in interface BlockQuantizer
setQuality
in class DefaultBlockQuantizer
quality
- New quality coefficient.setVariant(int)
,
setBlockSize(int, int)
,
setData(int[])
public void setData(int[] qtable)
setData
in interface BlockQuantizer
setData
in class DefaultBlockQuantizer
qtable
- New quantization table.
Should have the correct size and layout (scanline top-first, left-first).setVariant(int)
,
setQuality(float)
,
setBlockSize(int, int)
public int quantize(double[] coef, int[] quant)
quantize
in interface BlockQuantizer
quantize
in class DefaultBlockQuantizer
coef
- Source data (coefficients). Size = array size.
Should have the correct size and layout (scanline top-first, left-first).quant
- Pre-allocated result array or null
if
it's size needs to be determined.
DefaultBlockQuantizer.quantize(int[],int[])
,
dequantize(int[],double[])
public int dequantize(int[] quant, double[] coef)
dequantize
in interface BlockQuantizer
dequantize
in class DefaultBlockQuantizer
quant
- Source data (quantized coefficients). Size = array size.
Should have the correct size and layout (scanline top-first, left-first).coef
- Pre-allocated coefficient array or null
if
it's size needs to be determined.
DefaultBlockQuantizer.dequantize(int[],int[])
,
quantize(double[],int[])
public byte[] storeData()
storeData
in interface PersistentParamsBinary
storeData
in class DefaultBlockQuantizer
null
.
The array can be shared by all method calls.loadData(byte[])
public boolean loadData(byte[] data)
loadData
in interface PersistentParamsBinary
loadData
in class DefaultBlockQuantizer
data
- Binary data to be interpreted. Can be null
.
true
if successful.storeData()
public void set(java.lang.String key, java.lang.Object value)
set
in interface Property
set
in class DefaultProperty
key
- Key string.value
- The new value.Property.commit()
public java.lang.Object get(java.lang.String key)
get
in interface Property
get
in class DefaultProperty
key
- Key string.
null
.public static int setTemplate(Template t, int ord)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |