Class SubBlock
- java.lang.Object
-
- com.twelvemonkeys.imageio.plugins.webp.vp8.SubBlock
-
final class SubBlock extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSubBlock.Plane
-
Field Summary
Fields Modifier and Type Field Description private SubBlockaboveprivate int[][]destprivate int[][]diffprivate booleanhasNoZeroTokenprivate SubBlockleftprivate MacroBlockmacroBlockprivate intmodeprivate SubBlock.Planeplaneprivate int[][]predictprivate int[][]reconSnapshot ofdestas it was immediately after reconstruction, i.e.private int[]tokens
-
Constructor Summary
Constructors Constructor Description SubBlock(MacroBlock macroBlock, SubBlock above, SubBlock left, SubBlock.Plane plane)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int[][]borderSamples(boolean leftOfFrame)Off-frame border samples: 129 to the left of the frame, 127 above it.private intDCTextra(BoolDecoder bc2, int[] p)voiddecodeSubBlock(BoolDecoder bc2, int[][][][] coef_probs, int ilc, int type, boolean withY2)private intdecodeToken(BoolDecoder bc2, int v)voiddequantSubBlock(VP8Frame frame, java.lang.Integer Dc)voiddrawDebug()voiddrawDebugH()voiddrawDebugV()SubBlockgetAbove()java.lang.StringgetDebugString()int[][]getDest()int[][]getDiff()SubBlockgetLeft()MacroBlockgetMacroBlock()int[][]getMacroBlockPredict(int intra_mode)int[][]getMacroBlockReconPredict(int intraMode)AsgetMacroBlockPredict(int), but returning the unfiltered reconstruction.intgetMode()SubBlock.PlanegetPlane()int[][]getPredict()int[][]getPredict(int intra_bmode, boolean left)int[][]getRecon()The unfiltered reconstruction of this sub block, for use as intra prediction context by neighbouring blocks.int[][]getReconAbove()The unfiltered reconstruction, for use as the *above* prediction context.int[][]getReconAboveLeft(boolean aboveRowAvailable)The unfiltered reconstruction, for use as the *above-left* prediction context.int[][]getReconLeft()The unfiltered reconstruction, for use as the *left* prediction context.int[][]getReconPredict(int intraBMode, boolean left)AsgetPredict(int, boolean), but returning the unfiltered reconstruction.(package private) int[]getTokens()booleanhasNoZeroToken()booleanhasRecon()Whether this sub block has been reconstructed.booleanisDest()private static booleanisLeftBorder129(int intraBMode)static intplaneToType(SubBlock.Plane plane, boolean withY2)voidpredict(VP8Frame frame)voidreconstruct()voidsetDest(int[][] dest)voidsetDiff(int[][] diff)voidsetMode(int mode)voidsetPixel(int x, int y, int p)voidsetPredict(int[][] predict)java.lang.StringtoString()
-
-
-
Field Detail
-
above
private final SubBlock above
-
dest
private int[][] dest
-
recon
private int[][] recon
Snapshot ofdestas it was immediately after reconstruction, i.e. *before* the loop filter modified it.RFC 6386 applies the loop filter to the entire frame only after every macroblock has been reconstructed, so intra prediction must always see unfiltered neighbour samples. As this decoder interleaves reconstruction and filtering macroblock by macroblock (to avoid buffering the whole frame), the unfiltered samples have to be retained separately -- the same approach libwebp takes with its saved top/left sample rows.
-
diff
private int[][] diff
-
hasNoZeroToken
private boolean hasNoZeroToken
-
left
private final SubBlock left
-
macroBlock
private final MacroBlock macroBlock
-
mode
private int mode
-
plane
private final SubBlock.Plane plane
-
predict
private int[][] predict
-
tokens
private int[] tokens
-
-
Constructor Detail
-
SubBlock
SubBlock(MacroBlock macroBlock, SubBlock above, SubBlock left, SubBlock.Plane plane)
-
-
Method Detail
-
planeToType
public static int planeToType(SubBlock.Plane plane, boolean withY2)
-
DCTextra
private int DCTextra(BoolDecoder bc2, int[] p) throws java.io.IOException
- Throws:
java.io.IOException
-
decodeSubBlock
public void decodeSubBlock(BoolDecoder bc2, int[][][][] coef_probs, int ilc, int type, boolean withY2) throws java.io.IOException
- Throws:
java.io.IOException
-
decodeToken
private int decodeToken(BoolDecoder bc2, int v) throws java.io.IOException
- Throws:
java.io.IOException
-
dequantSubBlock
public void dequantSubBlock(VP8Frame frame, java.lang.Integer Dc)
-
drawDebug
public void drawDebug()
-
drawDebugH
public void drawDebugH()
-
drawDebugV
public void drawDebugV()
-
getAbove
public SubBlock getAbove()
-
getDebugString
public java.lang.String getDebugString()
-
getDest
public int[][] getDest()
-
getDiff
public int[][] getDiff()
-
getLeft
public SubBlock getLeft()
-
getMacroBlock
public MacroBlock getMacroBlock()
-
getRecon
public int[][] getRecon()
The unfiltered reconstruction of this sub block, for use as intra prediction context by neighbouring blocks. Seerecon.
-
hasRecon
public boolean hasRecon()
Whether this sub block has been reconstructed.
-
getReconAbove
public int[][] getReconAbove()
The unfiltered reconstruction, for use as the *above* prediction context. Outside the frame the above row reads as 127 (RFC 6386, 12.2).
-
getReconLeft
public int[][] getReconLeft()
The unfiltered reconstruction, for use as the *left* prediction context. Outside the frame the left column reads as 129 (RFC 6386, 12.2).
-
getReconAboveLeft
public int[][] getReconAboveLeft(boolean aboveRowAvailable)
The unfiltered reconstruction, for use as the *above-left* prediction context. Outside the frame this reads as 127 when the above row is also outside the frame, and as 129 otherwise -- matching libwebp, which fills the row above the first macroblock row (including its left-hand corner sample) with 127, and the column left of the first macroblock column (including its top corner sample) with 129.- Parameters:
aboveRowAvailable- whether the macroblock row above is inside the frame
-
getMacroBlockReconPredict
public int[][] getMacroBlockReconPredict(int intraMode)
AsgetMacroBlockPredict(int), but returning the unfiltered reconstruction. Use this when reading a *neighbouring* macroblock as prediction context.
-
getReconPredict
public int[][] getReconPredict(int intraBMode, boolean left)AsgetPredict(int, boolean), but returning the unfiltered reconstruction. Use this when reading a *neighbouring* sub block as prediction context.
-
isLeftBorder129
private static boolean isLeftBorder129(int intraBMode)
-
borderSamples
private static int[][] borderSamples(boolean leftOfFrame)
Off-frame border samples: 129 to the left of the frame, 127 above it.
-
getMacroBlockPredict
public int[][] getMacroBlockPredict(int intra_mode)
-
getMode
public int getMode()
-
getPlane
public SubBlock.Plane getPlane()
-
getPredict
public int[][] getPredict()
-
getPredict
public int[][] getPredict(int intra_bmode, boolean left)
-
getTokens
int[] getTokens()
-
hasNoZeroToken
public boolean hasNoZeroToken()
-
isDest
public boolean isDest()
-
predict
public void predict(VP8Frame frame)
-
reconstruct
public void reconstruct()
-
setDest
public void setDest(int[][] dest)
-
setDiff
public void setDiff(int[][] diff)
-
setMode
public void setMode(int mode)
-
setPixel
public void setPixel(int x, int y, int p)
-
setPredict
public void setPredict(int[][] predict)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-