remove unused vcpkg ffmpeg code (#8725)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
parent
0143eaf601
commit
72c96f22b6
@ -1,14 +1,14 @@
|
||||
From 7c29a6936e7b7a3a3a0bcc88894f2b739bdae9cf Mon Sep 17 00:00:00 2001
|
||||
From 8fd62e4ecd058b09abf8847be5fbbf0eef44a90f Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Thu, 11 Jul 2024 16:24:27 +0800
|
||||
Date: Tue, 16 Jul 2024 14:58:33 +0800
|
||||
Subject: [PATCH] amf colorspace
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/amfenc.h | 1 +
|
||||
libavcodec/amfenc_h264.c | 45 ++++++++++++++++++++++++++++++++++
|
||||
libavcodec/amfenc_hevc.c | 52 ++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 98 insertions(+)
|
||||
libavcodec/amfenc_h264.c | 39 +++++++++++++++++++++++++++++++++
|
||||
libavcodec/amfenc_hevc.c | 47 ++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 87 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
|
||||
index 31172645f2..493e01603d 100644
|
||||
@ -23,7 +23,7 @@ index 31172645f2..493e01603d 100644
|
||||
#include "libavutil/fifo.h"
|
||||
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index f55dbc80f0..a916b35f9c 100644
|
||||
index f55dbc80f0..5a6b6e164f 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -139,6 +139,9 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
@ -36,7 +36,7 @@ index f55dbc80f0..a916b35f9c 100644
|
||||
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
|
||||
framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
|
||||
@@ -199,11 +202,53 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
@@ -199,11 +202,47 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_ASPECT_RATIO, ratio);
|
||||
}
|
||||
|
||||
@ -44,7 +44,6 @@ index f55dbc80f0..a916b35f9c 100644
|
||||
/// Color Range (Partial/TV/MPEG or Full/PC/JPEG)
|
||||
if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FULL_RANGE_COLOR, 1);
|
||||
+ /// Color Space for Full (JPEG) Range
|
||||
+ switch (avctx->colorspace) {
|
||||
+ case AVCOL_SPC_SMPTE170M:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601;
|
||||
@ -59,7 +58,6 @@ index f55dbc80f0..a916b35f9c 100644
|
||||
+ }
|
||||
+ } else {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FULL_RANGE_COLOR, 0);
|
||||
+ /// Color Space for Limited (MPEG) range
|
||||
+ switch (avctx->colorspace) {
|
||||
+ case AVCOL_SPC_SMPTE170M:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601;
|
||||
@ -73,9 +71,7 @@ index f55dbc80f0..a916b35f9c 100644
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ /// Color Depth
|
||||
+ pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format
|
||||
+ : avctx->pix_fmt;
|
||||
+ pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format : avctx->pix_fmt;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_8;
|
||||
+ if (pix_fmt == AV_PIX_FMT_P010) {
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
@ -83,15 +79,13 @@ index f55dbc80f0..a916b35f9c 100644
|
||||
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_COLOR_BIT_DEPTH, color_depth);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_COLOR_PROFILE, color_profile);
|
||||
+ /// Color Transfer Characteristics (AMF matches ISO/IEC)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ /// Color Primaries (AMF matches ISO/IEC)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
// autodetect rate control method
|
||||
if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_UNKNOWN) {
|
||||
if (ctx->qp_i != -1 || ctx->qp_p != -1 || ctx->qp_b != -1) {
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index 7a40bcad31..e7979d9aeb 100644
|
||||
index 7a40bcad31..0260f43c81 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -106,6 +106,9 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
@ -114,11 +108,10 @@ index 7a40bcad31..e7979d9aeb 100644
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -158,6 +164,52 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
@@ -158,6 +164,47 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ASPECT_RATIO, ratio);
|
||||
}
|
||||
|
||||
+ // Color Metadata
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN;
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE, 1);
|
||||
@ -149,9 +142,7 @@ index 7a40bcad31..e7979d9aeb 100644
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ /// Color Depth
|
||||
+ pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format
|
||||
+ : avctx->pix_fmt;
|
||||
+ pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format : avctx->pix_fmt;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_8;
|
||||
+ if (pix_fmt == AV_PIX_FMT_P010) {
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
@ -161,12 +152,10 @@ index 7a40bcad31..e7979d9aeb 100644
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PROFILE, color_profile);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
+
|
||||
+
|
||||
+
|
||||
// Picture control properties
|
||||
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NUM_GOPS_PER_IDR, ctx->gops_per_idr);
|
||||
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_GOP_SIZE, avctx->gop_size);
|
||||
--
|
||||
2.39.3 (Apple Git-145)
|
||||
2.43.0.windows.1
|
||||
|
||||
|
@ -1,161 +0,0 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License.
|
||||
#
|
||||
#.rst:
|
||||
# FindFFMPEG
|
||||
# --------
|
||||
#
|
||||
# Find the FFPMEG libraries
|
||||
#
|
||||
# Result Variables
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# The following variables will be defined:
|
||||
#
|
||||
# ``FFMPEG_FOUND``
|
||||
# True if FFMPEG found on the local system
|
||||
#
|
||||
# ``FFMPEG_INCLUDE_DIRS``
|
||||
# Location of FFMPEG header files
|
||||
#
|
||||
# ``FFMPEG_LIBRARY_DIRS``
|
||||
# Location of FFMPEG libraries
|
||||
#
|
||||
# ``FFMPEG_LIBRARIES``
|
||||
# List of the FFMPEG libraries found
|
||||
#
|
||||
#
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
include(SelectLibraryConfigurations)
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
if(NOT FFMPEG_FOUND)
|
||||
|
||||
# Compute the installation path relative to this file.
|
||||
get_filename_component(SEARCH_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(SEARCH_PATH "${SEARCH_PATH}" PATH)
|
||||
get_filename_component(SEARCH_PATH "${SEARCH_PATH}" PATH)
|
||||
if(SEARCH_PATH STREQUAL "/")
|
||||
set(SEARCH_PATH "")
|
||||
endif()
|
||||
|
||||
set(FFMPEG_VERSION "@FFMPEG_VERSION@")
|
||||
|
||||
function(append_dependencies out)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 "arg" "DEBUG" "NAMES" "")
|
||||
if(${arg_DEBUG})
|
||||
set(config DEBUG)
|
||||
set(path "${CURRENT_INSTALLED_DIR}/debug/lib/")
|
||||
else()
|
||||
set(config RELEASE)
|
||||
set(path "${CURRENT_INSTALLED_DIR}/lib/")
|
||||
endif()
|
||||
foreach(lib_name ${arg_NAMES})
|
||||
if("${lib_name}" STREQUAL "-pthread")
|
||||
list(APPEND ${out} "-pthread")
|
||||
elseif("${lib_name}" STREQUAL "-pthreads")
|
||||
list(APPEND ${out} "-pthreads")
|
||||
elseif("${lib_name}" STREQUAL "gcc")
|
||||
list(APPEND ${out} "-lgcc")
|
||||
elseif("${lib_name}" STREQUAL "gcc_s")
|
||||
list(APPEND ${out} "-lgcc_s")
|
||||
elseif("${lib_name}" STREQUAL "stdc++")
|
||||
list(APPEND ${out} "-lstdc++")
|
||||
elseif("${lib_name}" STREQUAL "atomic")
|
||||
list(APPEND ${out} "-latomic")
|
||||
else()
|
||||
# first look in ${path} specifically to ensure we find the right release/debug variant
|
||||
find_library(FFMPEG_DEPENDENCY_${lib_name}_${config} NAMES "${lib_name}" PATHS "${path}" NO_DEFAULT_PATH)
|
||||
# if not found there, must be a system dependency, so look elsewhere
|
||||
find_library(FFMPEG_DEPENDENCY_${lib_name}_${config} NAMES "${lib_name}" REQUIRED)
|
||||
list(APPEND ${out} "${FFMPEG_DEPENDENCY_${lib_name}_${config}}")
|
||||
endif()
|
||||
endforeach()
|
||||
set("${out}" "${${out}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
macro(FFMPEG_FIND varname shortname headername)
|
||||
if(NOT FFMPEG_${varname}_INCLUDE_DIRS)
|
||||
find_path(FFMPEG_${varname}_INCLUDE_DIRS NAMES lib${shortname}/${headername} ${headername} PATHS ${SEARCH_PATH}/include NO_DEFAULT_PATH)
|
||||
endif()
|
||||
if(NOT FFMPEG_${varname}_LIBRARY)
|
||||
find_library(FFMPEG_${varname}_LIBRARY_RELEASE NAMES ${shortname} PATHS ${SEARCH_PATH}/lib/ NO_DEFAULT_PATH)
|
||||
find_library(FFMPEG_${varname}_LIBRARY_DEBUG NAMES ${shortname}d ${shortname} PATHS ${SEARCH_PATH}/debug/lib/ NO_DEFAULT_PATH)
|
||||
get_filename_component(FFMPEG_${varname}_LIBRARY_RELEASE_DIR ${FFMPEG_${varname}_LIBRARY_RELEASE} DIRECTORY)
|
||||
get_filename_component(FFMPEG_${varname}_LIBRARY_DEBUG_DIR ${FFMPEG_${varname}_LIBRARY_DEBUG} DIRECTORY)
|
||||
select_library_configurations(FFMPEG_${varname})
|
||||
set(FFMPEG_${varname}_LIBRARY ${FFMPEG_${varname}_LIBRARY} CACHE STRING "")
|
||||
endif()
|
||||
if (FFMPEG_${varname}_LIBRARY AND FFMPEG_${varname}_INCLUDE_DIRS)
|
||||
set(FFMPEG_${varname}_FOUND TRUE BOOL)
|
||||
list(APPEND FFMPEG_INCLUDE_DIRS ${FFMPEG_${varname}_INCLUDE_DIRS})
|
||||
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_${varname}_LIBRARY})
|
||||
list(APPEND FFMPEG_LIBRARY_DIRS ${FFMPEG_${varname}_LIBRARY_RELEASE_DIR} ${FFMPEG_${varname}_LIBRARY_DEBUG_DIR})
|
||||
endif()
|
||||
endmacro(FFMPEG_FIND)
|
||||
|
||||
if(@ENABLE_AVDEVICE@)
|
||||
FFMPEG_FIND(libavdevice avdevice avdevice.h)
|
||||
endif()
|
||||
if(@ENABLE_AVFILTER@)
|
||||
FFMPEG_FIND(libavfilter avfilter avfilter.h)
|
||||
endif()
|
||||
if(@ENABLE_AVFORMAT@)
|
||||
FFMPEG_FIND(libavformat avformat avformat.h)
|
||||
endif()
|
||||
if(@ENABLE_AVCODEC@)
|
||||
FFMPEG_FIND(libavcodec avcodec avcodec.h)
|
||||
endif()
|
||||
if(@ENABLE_POSTPROC@)
|
||||
FFMPEG_FIND(libpostproc postproc postprocess.h)
|
||||
endif()
|
||||
if(@ENABLE_SWRESAMPLE@)
|
||||
FFMPEG_FIND(libswresample swresample swresample.h)
|
||||
endif()
|
||||
if(@ENABLE_SWSCALE@)
|
||||
FFMPEG_FIND(libswscale swscale swscale.h)
|
||||
endif()
|
||||
FFMPEG_FIND(libavutil avutil avutil.h)
|
||||
|
||||
if (FFMPEG_libavutil_FOUND)
|
||||
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES FFMPEG_LIBRARY_DIRS)
|
||||
set(FFMPEG_libavutil_VERSION "@LIBAVUTIL_VERSION@" CACHE STRING "")
|
||||
|
||||
if(FFMPEG_libavcodec_FOUND)
|
||||
set(FFMPEG_libavcodec_VERSION "@LIBAVCODEC_VERSION@" CACHE STRING "")
|
||||
endif()
|
||||
if(FFMPEG_libavdevice_FOUND)
|
||||
set(FFMPEG_libavdevice_VERSION "@LIBAVDEVICE_VERSION@" CACHE STRING "")
|
||||
endif()
|
||||
if(FFMPEG_libavfilter_FOUND)
|
||||
set(FFMPEG_libavfilter_VERSION "@LIBAVFILTER_VERSION@" CACHE STRING "")
|
||||
endif()
|
||||
if(FFMPEG_libavformat_FOUND)
|
||||
set(FFMPEG_libavformat_VERSION "@LIBAVFORMAT_VERSION@" CACHE STRING "")
|
||||
endif()
|
||||
if(FFMPEG_libswresample_FOUND)
|
||||
set(FFMPEG_libswresample_VERSION "@LIBSWRESAMPLE_VERSION@" CACHE STRING "")
|
||||
endif()
|
||||
if(FFMPEG_libswscale_FOUND)
|
||||
set(FFMPEG_libswscale_VERSION "@LIBSWSCALE_VERSION@" CACHE STRING "")
|
||||
endif()
|
||||
|
||||
append_dependencies(FFMPEG_DEPS_LIBRARY_RELEASE NAMES "@FFMPEG_DEPENDENCIES_RELEASE@")
|
||||
append_dependencies(FFMPEG_DEPS_LIBRARY_DEBUG NAMES "@FFMPEG_DEPENDENCIES_DEBUG@" DEBUG)
|
||||
if(FFMPEG_DEPS_LIBRARY_RELEASE OR FFMPEG_DEPS_LIBRARY_DEBUG)
|
||||
select_library_configurations(FFMPEG_DEPS)
|
||||
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_DEPS_LIBRARY})
|
||||
endif()
|
||||
|
||||
set(FFMPEG_LIBRARY ${FFMPEG_LIBRARIES})
|
||||
|
||||
set(FFMPEG_FOUND TRUE CACHE BOOL "")
|
||||
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "")
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "")
|
||||
set(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBRARY_DIRS} CACHE STRING "")
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_LIBRARY_DIRS FFMPEG_INCLUDE_DIRS)
|
||||
|
||||
endif()
|
@ -676,7 +676,5 @@ else()
|
||||
message(FATAL_ERROR "Failed to identify license (${LICENSE_STRING})")
|
||||
endif()
|
||||
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/FindFFMPEG.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/FindFFMPEG.cmake" @ONLY)
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/${LICENSE_FILE}")
|
||||
|
@ -1,6 +0,0 @@
|
||||
To use ffmpeg add the following to your CMake project:
|
||||
|
||||
find_package(FFMPEG REQUIRED)
|
||||
target_include_directories(main PRIVATE ${FFMPEG_INCLUDE_DIRS})
|
||||
target_link_directories(main PRIVATE ${FFMPEG_LIBRARY_DIRS})
|
||||
target_link_libraries(main PRIVATE ${FFMPEG_LIBRARIES})
|
@ -19,9 +19,6 @@
|
||||
}
|
||||
],
|
||||
"default-features": [
|
||||
"avcodec",
|
||||
"avdevice",
|
||||
"avformat"
|
||||
],
|
||||
"features": {
|
||||
"amf": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user