Compare commits
10 Commits
f374ec99d6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 8abd47e9f6 | |||
| df339c07fd | |||
| 9061350e82 | |||
| b597fc0098 | |||
| 35b4f163c6 | |||
| 44e92fa3dc | |||
| 69d68e0323 | |||
| 86a28d2a3b | |||
| 972a79dde2 | |||
| 56f8498057 |
+112
-3
@@ -162,14 +162,123 @@ add_executable(bench_flush_frame tests/bench_flush_frame.c)
|
|||||||
target_link_libraries(bench_flush_frame PRIVATE daedalus_decoder)
|
target_link_libraries(bench_flush_frame PRIVATE daedalus_decoder)
|
||||||
target_compile_options(bench_flush_frame PRIVATE -O2)
|
target_compile_options(bench_flush_frame PRIVATE -O2)
|
||||||
|
|
||||||
|
# ---- Tools (not gated by ctest; opt-in via DAEDALUS_BUILD_TOOLS) ----
|
||||||
|
#
|
||||||
|
# daedalus_decode_h264 — option A standalone test harness that
|
||||||
|
# wraps libavcodec + daedalus-decoder and bit-exact-compares their
|
||||||
|
# outputs on real H.264 streams. Identity-passthrough mode in this
|
||||||
|
# first iteration (predicted = AVFrame pixels, coeffs = 0, no
|
||||||
|
# deblock edges); follow-up PRs use the per-MB inspection callback
|
||||||
|
# (marfrit-packages patch 0016) to feed REAL per-MB state.
|
||||||
|
#
|
||||||
|
# Requires libavcodec + libavformat headers + libs. Off by default
|
||||||
|
# so the standard ctest build doesn't pull in FFmpeg as a hard dep.
|
||||||
|
option(DAEDALUS_BUILD_TOOLS "Build daedalus-decoder CLI tools (requires libavcodec)" OFF)
|
||||||
|
if(DAEDALUS_BUILD_TOOLS)
|
||||||
|
# Optional path to a private FFmpeg install carrying the per-MB
|
||||||
|
# inspection callback (marfrit-packages patch 0016). When set,
|
||||||
|
# the CLI links against it instead of the system FFmpeg and the
|
||||||
|
# inspection-callback code path is compiled in.
|
||||||
|
set(DAEDALUS_FFMPEG_PREFIX "" CACHE PATH
|
||||||
|
"Path to a patched FFmpeg install (with 0016 mb-inspect-callback) for daedalus_decode_h264. Empty = use system pkg-config FFmpeg.")
|
||||||
|
|
||||||
|
if(DAEDALUS_FFMPEG_PREFIX)
|
||||||
|
message(STATUS "daedalus_decode_h264: patched FFmpeg at ${DAEDALUS_FFMPEG_PREFIX}")
|
||||||
|
set(FFMPEG_INCLUDE_DIRS ${DAEDALUS_FFMPEG_PREFIX}/include)
|
||||||
|
set(FFMPEG_LIBRARY_DIRS ${DAEDALUS_FFMPEG_PREFIX}/lib)
|
||||||
|
# Patched libavcodec is built static (no shared libs in the private prefix).
|
||||||
|
# System pull-ins are still needed for libav* dependencies.
|
||||||
|
set(FFMPEG_LIBRARIES
|
||||||
|
${DAEDALUS_FFMPEG_PREFIX}/lib/libavformat.a
|
||||||
|
${DAEDALUS_FFMPEG_PREFIX}/lib/libavcodec.a
|
||||||
|
${DAEDALUS_FFMPEG_PREFIX}/lib/libavutil.a
|
||||||
|
${DAEDALUS_FFMPEG_PREFIX}/lib/libswresample.a
|
||||||
|
m z pthread)
|
||||||
|
set(FFMPEG_CFLAGS_OTHER "-DDAEDALUS_HAVE_H264_MB_INSPECT_CB=1")
|
||||||
|
|
||||||
|
# PR-A3+ optional: also point at the patched FFmpeg SOURCE TREE
|
||||||
|
# so the CLI can include libavcodec/h264dec.h directly and
|
||||||
|
# dereference H264Context fields (the side-buffer mb_inspect_coeffs
|
||||||
|
# added in marfrit-packages patch 0017, the cur_pic.f for
|
||||||
|
# pre-deblock pixel access, etc.). When set, the internal-header
|
||||||
|
# include codepath is compiled in.
|
||||||
|
set(DAEDALUS_FFMPEG_SRC "" CACHE PATH
|
||||||
|
"Path to patched FFmpeg source tree (= path to FFmpeg/ checkout where build was run; contains config.h + libavcodec/h264dec.h). Empty = h264dec.h includes are disabled.")
|
||||||
|
if(DAEDALUS_FFMPEG_SRC)
|
||||||
|
message(STATUS "daedalus_decode_h264: FFmpeg source at ${DAEDALUS_FFMPEG_SRC}")
|
||||||
|
# IMPORTANT: source tree FIRST in -I order — its
|
||||||
|
# libavutil/common.h does #include "intmath.h" with HAVE_AV_CONFIG_H,
|
||||||
|
# which resolves to libavutil/intmath.h (in the source tree
|
||||||
|
# only — that header isn't installed since it's arch-dispatched).
|
||||||
|
# The installed-prefix include path's libavutil/common.h is the
|
||||||
|
# same file textually but resolves "intmath.h" against the
|
||||||
|
# install dir where it doesn't exist.
|
||||||
|
set(FFMPEG_INCLUDE_DIRS ${DAEDALUS_FFMPEG_SRC})
|
||||||
|
set(FFMPEG_CFLAGS_OTHER
|
||||||
|
"${FFMPEG_CFLAGS_OTHER} -DDAEDALUS_HAVE_H264_MB_INSPECT_COEFFS=1 -DHAVE_AV_CONFIG_H")
|
||||||
|
# Convert space-separated string to list (CMake idiom for compile flags).
|
||||||
|
separate_arguments(FFMPEG_CFLAGS_OTHER UNIX_COMMAND "${FFMPEG_CFLAGS_OTHER}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
pkg_check_modules(FFMPEG REQUIRED libavcodec libavformat libavutil)
|
||||||
|
message(STATUS "daedalus_decode_h264: system FFmpeg (no inspection callback)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_executable(daedalus_decode_h264 tools/daedalus_decode_h264.c)
|
||||||
|
target_link_libraries(daedalus_decode_h264
|
||||||
|
PRIVATE daedalus_decoder ${FFMPEG_LIBRARIES})
|
||||||
|
target_include_directories(daedalus_decode_h264
|
||||||
|
PRIVATE ${FFMPEG_INCLUDE_DIRS})
|
||||||
|
target_link_directories(daedalus_decode_h264
|
||||||
|
PRIVATE ${FFMPEG_LIBRARY_DIRS})
|
||||||
|
target_compile_options(daedalus_decode_h264
|
||||||
|
PRIVATE -O2 ${FFMPEG_CFLAGS_OTHER})
|
||||||
|
endif()
|
||||||
|
|
||||||
# ---- Install ------------------------------------------------------
|
# ---- Install ------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Library + public header. Stage 2/3 will add a pkg-config file and
|
# Installs:
|
||||||
# CMake config exports once the API stabilises; pre-0.1 the scaffold
|
# - libdaedalus_decoder.a → ${CMAKE_INSTALL_LIBDIR}
|
||||||
# install just gives the static archive a home.
|
# - include/daedalus_decoder.h → ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
# - daedalus-decoder.pc → ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
||||||
|
#
|
||||||
|
# The .pc lets sibling consumers (daedalus-v4l2 daemon, the
|
||||||
|
# daedalus_decode_h264 CLI when built externally) discover the static
|
||||||
|
# archive + headers via pkg-config. daedalus-fourier is declared as a
|
||||||
|
# public `Requires:` because the consumer (which static-links
|
||||||
|
# libdaedalus_decoder.a) also needs daedalus-fourier in its own link
|
||||||
|
# line to resolve the daedalus_ctx_* / daedalus_recipe_* symbols this
|
||||||
|
# archive references.
|
||||||
|
#
|
||||||
|
# Relocatable-prefix scheme mirrors daedalus-fourier's .pc generation:
|
||||||
|
# `prefix` is derived from ${pcfiledir} so `cmake --install --prefix /foo`
|
||||||
|
# produces a .pc that resolves prefix=/foo at lookup time, regardless of
|
||||||
|
# what CMAKE_INSTALL_PREFIX was at configure time.
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
install(TARGETS daedalus_decoder
|
install(TARGETS daedalus_decoder
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
install(FILES include/daedalus_decoder.h
|
install(FILES include/daedalus_decoder.h
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
|
file(RELATIVE_PATH PKGCONFIG_PCDIR_TO_PREFIX
|
||||||
|
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
||||||
|
"${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
|
set(PKGCONFIG_OUT ${CMAKE_CURRENT_BINARY_DIR}/daedalus-decoder.pc)
|
||||||
|
file(WRITE ${PKGCONFIG_OUT}
|
||||||
|
"prefix=\${pcfiledir}/${PKGCONFIG_PCDIR_TO_PREFIX}
|
||||||
|
exec_prefix=\${prefix}
|
||||||
|
libdir=\${prefix}/${CMAKE_INSTALL_LIBDIR}
|
||||||
|
includedir=\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
|
||||||
|
Name: daedalus-decoder
|
||||||
|
Description: Frame-major H.264 decoder on V3D7 via daedalus-fourier primitives
|
||||||
|
Version: ${PROJECT_VERSION}
|
||||||
|
Libs: -L\${libdir} -ldaedalus_decoder
|
||||||
|
Requires: daedalus-fourier
|
||||||
|
Cflags: -I\${includedir}
|
||||||
|
")
|
||||||
|
install(FILES ${PKGCONFIG_OUT}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
||||||
|
)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user