Skip to content

Commit f1cca01

Browse files
committed
clarified c.compute_encoded_size signature
1 parent 72165cc commit f1cca01

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/v3/core/v3.0.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,10 +1186,19 @@ of an additional operation:
11861186
encoded representation is a byte string, then ``decoded_regions``
11871187
specifies a list of byte ranges.
11881188

1189-
- ``c.compute_encoded_size(input_size)``, a procedure that determines the byte
1190-
size of the encoded representation given a byte size of the decoded representation.
1189+
- ``c.compute_encoded_size(input_size)``, a procedure that determines the
1190+
size of the encoded representation given a size of the decoded representation.
11911191
This procedure cannot be implemented for codecs that produce variable-sized
1192-
encoded representations, such as compression algorithms.
1192+
encoded representations, such as compression algorithms. Depending on the
1193+
type of the codec, the signature could differ:
1194+
1195+
- ``c.compute_encoded_size(array_size, dtype) -> (array_size, dtpye)``
1196+
for ``array -> array`` codecs, where ``array_size`` is the number of items
1197+
in the array, i.e., the product of the components of the array's shape;
1198+
- ``c.compute_encoded_size(array_size, dtype) -> byte_size``
1199+
for ``array -> bytes`` codecs;
1200+
- ``c.compute_encoded_size(byte_size) -> byte_size``
1201+
for ``bytes -> bytes`` codecs.
11931202

11941203
.. note::
11951204

0 commit comments

Comments
 (0)