diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/BlockPackedWriter.java b/lucene/core/src/java/org/apache/lucene/util/packed/BlockPackedWriter.java
index 4deb6ec20aa..6c39b87f98c 100644
--- a/lucene/core/src/java/org/apache/lucene/util/packed/BlockPackedWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/util/packed/BlockPackedWriter.java
@@ -29,7 +29,30 @@ import org.apache.lucene.store.DataOutput;
* using as few bits as possible. Memory usage of this class is proportional to
* the block size. Each block has an overhead between 1 and 10 bytes to store
* the minimum value and the number of bits per value of the block.
+ *
+ * Format:
+ *
+ * - <BLock>BlockCount
+ *
- BlockCount: ⌈ ValueCount / BlockSize ⌉
+ *
- Block: <Header, (Ints)>
+ *
- Header: <Token, (MinValue)>
+ *
- Token: a {@link DataOutput#writeByte(byte) byte}, first 7 bits are the
+ * number of bits per value (bitsPerValue). If the 8th bit is 1,
+ * then MinValue (see next) is 0, otherwise MinValue and needs to
+ * be decoded
+ *
- MinValue: a
+ * zigzag-encoded
+ * {@link DataOutput#writeVLong(long) variable-length long} whose value
+ * should be added to every int from the block to restore the original
+ * values
+ *
- Ints: If the number of bits per value is 0, then there is
+ * nothing to decode and all ints are equal to MinValue. Otherwise: BlockSize
+ * {@link PackedInts packed ints} encoded on exactly bitsPerValue
+ * bits per value. They are the subtraction of the original values and
+ * MinValue
+ *
* @see BlockPackedReaderIterator
+ * @see BlockPackedReader
* @lucene.internal
*/
public final class BlockPackedWriter extends AbstractBlockPackedWriter {
diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/MonotonicBlockPackedWriter.java b/lucene/core/src/java/org/apache/lucene/util/packed/MonotonicBlockPackedWriter.java
index 500f9392c71..a56d76fc19d 100644
--- a/lucene/core/src/java/org/apache/lucene/util/packed/MonotonicBlockPackedWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/util/packed/MonotonicBlockPackedWriter.java
@@ -24,10 +24,30 @@ import org.apache.lucene.store.DataOutput;
/**
* A writer for large monotonically increasing sequences of positive longs.
*
- * The sequence is divided into fixed-size blocks and for each block, the
- * average value per ord is computed, followed by the delta from the expected
- * value for every ord, using as few bits as possible. Each block has an
- * overhead between 6 and 14 bytes.
+ * The sequence is divided into fixed-size blocks and for each block, values
+ * are modeled after a linear function f: x → A × x + B. The block
+ * encodes deltas from the expected values computed from this function using as
+ * few bits as possible. Each block has an overhead between 6 and 14 bytes.
+ *
+ * Format:
+ *
+ * - <BLock>BlockCount
+ *
- BlockCount: ⌈ ValueCount / BlockSize ⌉
+ *
- Block: <Header, (Ints)>
+ *
- Header: <B, A, BitsPerValue>
+ *
- B: the B from f: x → A × x + B using a
+ * {@link DataOutput#writeVLong(long) variable-length long}
+ *
- A: the A from f: x → A × x + B encoded using
+ * {@link Float#floatToIntBits(float)} on
+ * {@link DataOutput#writeInt(int) 4 bytes}
+ *
- BitsPerValue: a {@link DataOutput#writeVInt(int) variable-length int}
+ *
- Ints: if BitsPerValue is 0, then there is nothing to read and
+ * all values perfectly match the result of the function. Otherwise, these
+ * are the
+ * zigzag-encoded
+ * {@link PackedInts packed} deltas from the expected value (computed from
+ * the function) using exaclty BitsPerValue bits per value
+ *
* @see MonotonicBlockPackedReader
* @lucene.internal
*/