ffmpeg/tests/api
Soham Kute 9bf999c24f avcodec/tests: add encoder-parser API test for H.261
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>
2026-03-29 23:01:39 +00:00
..
.gitignore tests/api: add .gitignore 2016-06-23 17:57:22 +02:00
api-band-test.c api/api-band-test: Query codec capabilities to decide admissibility 2024-06-12 14:29:30 +02:00
api-dump-stream-meta-test.c tests/api/api-dump-stream-meta-test: Fix leaks 2025-05-05 17:03:39 +02:00
api-enc-parser-test.c avcodec/tests: add encoder-parser API test for H.261 2026-03-29 23:01:39 +00:00
api-flac-test.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
api-h264-slice-test.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
api-h264-test.c api-h264-test: indent output 2025-10-25 11:11:41 +02:00
api-seek-test.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
api-threadmessage-test.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
Makefile avcodec/tests: add encoder-parser API test for H.261 2026-03-29 23:01:39 +00:00