public final class CX extends Object
Represents a context in the arithmetic decoder that selects probability estimates and statistics used during decoding procedures, as defined in ITU-T Rec. T.88 (2000 E), ISO/IEC 14492:2001.
Context State:
cx array: Stores the probability estimate index (0-127) for each context statemps array: Stores the most probable symbol (0 or 1) for each context stateindex: Current context index, selected based on the neighborhood pattern
(template-specific arrangement of previously decoded pixels)Usage: The index is set before each decision to select which context state to use. After decoding, the arithmetic decoder updates the selected context's probability estimate and MPS based on the decoded symbol (see Annex A, T.88).
Reuse:
When arithmetic coding contexts are retained and reused across segments (§7.4.2.2),
a copy() must be created to avoid sharing mutable probability state
between decoders.
| Constructor and Description |
|---|
CX(int size,
int index)
Creates a new context with the specified number of context states.
|
| Modifier and Type | Method and Description |
|---|---|
CX |
copy()
Creates and returns a deep copy of this
CX object. |
void |
setIndex(int index)
Sets the context index used for subsequent decoding decisions.
|
public CX(int size,
int index)
size - the number of context statesindex - the initial context indexpublic void setIndex(int index)
The index value is typically computed from the neighboring pixels in the template (§6.2.5.1 for generic regions, §6.4.7.1 for text regions).
index - the context index (0 to size-1)public CX copy()
CX object.
The new instance will have the same context values, probability estimates,
and current index as this object, but will be a separate instance.
Changes to the copied object will not affect the original, and vice versa.
This is required when reusing arithmetic coding contexts across segments, to avoid sharing mutable probability state between decoders.
CX object with the same internal state as this object.Copyright © 2026 The Apache Software Foundation. All rights reserved.