pub fn check_streaming_output_honesty<E, D>(
enc: E,
dec: D,
img: &TestImage,
) -> ConformanceExpand description
Verify the OutputTiming an encoder’s
begin reports, and
EncodeCapabilities::streaming_output
behind it.
Run it with a configuration that streams as well as the default: a
configuration that reports OutputTiming::AT_FINISH
passes without exercising the streaming path. To verify a lag of L
rows the image must be taller than L + 2 x strip, where strip is the
encoder’s preferred_strip_height
(at most a quarter of the image); a shorter image fails the check rather
than passing it unverified. check_all picks a tall enough image.
- Without
push_rowsthe codec must not declarestreaming_output. beginmay reject the declaration asUnsupportedOperation::RowLevelEncode(this configuration cannot encode from rows); any other error fails the check.- A streaming timing needs
streaming_outputdeclared and a lag below the image height. AT_FINISH:pending_outputstays empty untilfinish.- Streaming with lag
L: between any two points of the encodeLor more rows apart (afterbeginand after each strip but the last), bytes become pending. That catches an understated lag and an encoder that stalls after its first strip. - Draining all pending bytes after every strip, and separately draining
uneven prefixes (one byte, a few, all but one, and once more than is
pending, which clamps), each yield, with
finish’s remainder, exactly the bytes of the same encode left undrained. Those bytes decode to the pixels of the one-shotencode. (Not to a plainpush_rowsencode: an encoder may need the image size before its first row, throughbeginorwith_canvas_size.) - Draining with
take_output, into an empty vector and into a non-empty one, yields the same bytes and leaves nothing pending. - After a streaming
begin, a secondbeginand a one-shotencodeare errors. beginwith a zero width or height is accepted exactly whenencodeof that size succeeds (or declines asRowLevelEncode).- A refused
beginleaves the encoder unchanged: after the first such zero-size refusal,beginwith the real size on the same encoder reports the same timing and streams the same file. - Every run reports the same timing.