Summary
vmaf_preallocate_pictures and vmaf_fetch_preallocated_picture are
declared unconditionally in the public header
libvmaf/include/libvmaf/libvmaf.h:341,355,
but defined only inside #ifdef VMAF_PICTURE_POOL in
libvmaf/src/libvmaf.c:363,372.
libvmaf/src/meson.build:675 only adds picture_pool.c to the build
when the user passes -Dc_args=-DVMAF_PICTURE_POOL. Default builds
ship the header symbol without the definition → clients that call
either function link-fail.
Repro
# Default build (no -DVMAF_PICTURE_POOL)
cd libvmaf && meson setup build-default && ninja -C build-default
nm -D build-default/src/libvmaf.so | grep -E 'preallocate|fetch_preallocated'
# → no symbol
# User's translation unit includes <libvmaf/libvmaf.h> and calls
# vmaf_preallocate_pictures(...)
# → linker error: undefined reference to `vmaf_preallocate_pictures'
Fix options
Pick one:
A. Gate the header declarations behind a build-time #define.
Ship a generated libvmaf_config.h that emits
#define VMAF_HAS_PICTURE_POOL 1 when built with the flag. Wrap both
prototypes in #ifdef VMAF_HAS_PICTURE_POOL. Breaks any caller that
today unconditionally references the symbol (they'd find out at compile
time instead of link time — net positive).
B. Compile picture_pool.c unconditionally. Remove the
#ifdef VMAF_PICTURE_POOL meson gate so the code is always linked.
Preserve the runtime behavior (today the fallback check_picture_pool
uses 2× thread count when no explicit preallocation happened — that
logic is also inside the ifdef).
C. Deprecate + remove. If there are no real users of this
pre-allocation API (it's unstable — VmafPicturePool is an internal
type), declare it dead and delete from the header + implementation in
a major bump.
Recommendation
B is the path of least surprise — the surface is already public.
Measure the binary-size cost first; if <5 KiB, just compile it always.
Acceptance
nm -D libvmaf.so | grep preallocate shows the symbol on every
build configuration.
- Header Doxygen does not mention a build flag the user has to set.
- Existing default-build tests still pass.
References
Summary
vmaf_preallocate_picturesandvmaf_fetch_preallocated_picturearedeclared unconditionally in the public header
libvmaf/include/libvmaf/libvmaf.h:341,355,but defined only inside
#ifdef VMAF_PICTURE_POOLinlibvmaf/src/libvmaf.c:363,372.libvmaf/src/meson.build:675only addspicture_pool.cto the buildwhen the user passes
-Dc_args=-DVMAF_PICTURE_POOL. Default buildsship the header symbol without the definition → clients that call
either function link-fail.
Repro
Fix options
Pick one:
A. Gate the header declarations behind a build-time
#define.Ship a generated
libvmaf_config.hthat emits#define VMAF_HAS_PICTURE_POOL 1when built with the flag. Wrap bothprototypes in
#ifdef VMAF_HAS_PICTURE_POOL. Breaks any caller thattoday unconditionally references the symbol (they'd find out at compile
time instead of link time — net positive).
B. Compile
picture_pool.cunconditionally. Remove the#ifdef VMAF_PICTURE_POOLmeson gate so the code is always linked.Preserve the runtime behavior (today the fallback
check_picture_pooluses 2× thread count when no explicit preallocation happened — that
logic is also inside the ifdef).
C. Deprecate + remove. If there are no real users of this
pre-allocation API (it's unstable —
VmafPicturePoolis an internaltype), declare it dead and delete from the header + implementation in
a major bump.
Recommendation
B is the path of least surprise — the surface is already public.
Measure the binary-size cost first; if <5 KiB, just compile it always.
Acceptance
nm -D libvmaf.so | grep preallocateshows the symbol on everybuild configuration.
References
were always available. Docs should not be updated until the fix lands.