mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-04-19 00:50:23 +00:00
Add tests/api/api-enc-parser-test.c, a generic encoder+parser round-trip test that takes codec_name, width, and height on the command line (defaults: h261 176 144). Three cases are tested: garbage - a single av_parser_parse2() call on 8 bytes with no Picture Start Code; verifies out_size == 0 so the parser emits no spurious data. bulk - encodes 2 frames, concatenates the raw packets, feeds the whole buffer to a fresh parser in one call, then flushes. Verifies that exactly 2 non-empty frames come out and that the parser found the PSC boundary between them. split - the same buffer fed in two halves (chunk boundary falls inside frame 0). Verifies the parser still emits exactly 2 frames when input arrives incrementally, and that the collected bytes are identical to the bulk output (checked with memcmp). Implementation notes: avcodec_get_supported_config() selects the pixel format; chroma height uses AV_CEIL_RSHIFT with log2_chroma_h from AVPixFmtDescriptor; data[1] and data[2] are checked independently so semi-planar formats work; the encoded buffer is given AV_INPUT_BUFFER_PADDING_SIZE zero bytes at the end; parse_stream() skips the fed chunk if consumed==0 to prevent an infinite loop. Two FATE entries in tests/fate/api.mak: QCIF (176x144) and CIF (352x288), both standard H.261 resolutions. Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
5 lines
250 B
Text
5 lines
250 B
Text
garbage: out_size=0
|
|
bulk[0]: out_size=3261 first=00 01 00 1e last=fe 40 90 20
|
|
bulk[1]: out_size=43 first=00 01 00 8e last=10 00 07 04
|
|
split[0]: out_size=3261 first=00 01 00 1e last=fe 40 90 20
|
|
split[1]: out_size=43 first=00 01 00 8e last=10 00 07 04
|