30 #include "AMF/components/FRC.h"
42 #define AMF_FRC_ASSIGN_PROPERTY_INT64_CHECK(avctx, this, name, val) {\
43 AMF_ASSIGN_PROPERTY_INT64(res, this, name, val);\
45 av_log(avctx, AV_LOG_WARNING, "AMFFRC->SetProperty(%ls, %d) failed with error %d\n", name, val, res);\
91 output_pix_fmts = output_pix_fmts_default;
99 AMFComponent *amf_filter =
NULL;
148 #define OFFSET(x) offsetof(AMFFRCFilterContext, x)
149 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
151 {
"engine_type",
"Engine type",
OFFSET(engine_type),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, FRC_ENGINE_DX11, .flags =
FLAGS,
"engine_type" },
157 {
"fallback_mode",
"Fallback behavior in case of low interpolation confidence",
OFFSET(fallback),
AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, .flags =
FLAGS,
"fallback_mode" },
159 {
"blend",
"Blend two frames together", 0,
AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0,
FLAGS,
"fallback_mode" },
161 {
"indicator",
"Show FRC indicator square in the top left corner of the video.",
OFFSET(indicator),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags =
FLAGS },
163 {
"profile",
"Level of hierarchical motion search",
OFFSET(
profile),
AV_OPT_TYPE_INT, { .i64 = FRC_PROFILE_HIGH }, FRC_PROFILE_LOW, FRC_PROFILE_SUPER,
FLAGS,
"profile" },
164 {
"low",
"Less levels of hierarchical motion search. "
165 "Only recommended for extremely low resolutions.", 0,
AV_OPT_TYPE_CONST, { .i64 = FRC_PROFILE_LOW }, 0, 0,
FLAGS,
"profile" },
166 {
"high",
"Recommended for any resolution up to 1440p.", 0,
AV_OPT_TYPE_CONST, { .i64 = FRC_PROFILE_HIGH }, 0, 0,
FLAGS,
"profile" },
167 {
"super",
"More levels of hierarchical motion search. "
168 "Recommended for resolutions 1440p or higher.", 0,
AV_OPT_TYPE_CONST, { .i64 = FRC_PROFILE_SUPER }, 0, 0,
FLAGS,
"profile" },
170 {
"mv_search_mode",
"Performance mode of the motion search",
OFFSET(mv_search_mode),
AV_OPT_TYPE_INT, { .i64 = FRC_MV_SEARCH_NATIVE }, FRC_MV_SEARCH_NATIVE, FRC_MV_SEARCH_PERFORMANCE,
FLAGS,
"mv_search_mode" },
171 {
"native",
"Conduct motion search on the full resolution of source images.", 0,
AV_OPT_TYPE_CONST, { .i64 = FRC_MV_SEARCH_NATIVE }, 0, 0,
FLAGS,
"mv_search_mode" },
172 {
"performance",
"Conduct motion search on the down scaled source images. "
173 "Recommended for APU or low end GPU for better performance.", 0,
AV_OPT_TYPE_CONST, { .i64 = FRC_MV_SEARCH_PERFORMANCE }, 0, 0,
FLAGS,
"mv_search_mode" },
175 {
"use_future_frame",
"Enable dependency on future frame, improves quality for the cost of latency",
OFFSET(use_future_frame),
AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, .flags =
FLAGS },
187 AMFComponent *amf_filter = amf_ctx->
component;
189 AMFSurface *surface_out =
NULL;
190 AMFSurface *surface_in =
NULL;
193 AMF_RESULT res = AMF_FAIL;
194 AMFData *data_out =
NULL;
206 AMF_ASSIGN_PROPERTY_INT64(res, amf_filter, AMF_FRC_MODE, FRC_x2_PRESENT);
209 AMF_ASSIGN_PROPERTY_INT64(res, amf_filter, AMF_FRC_MODE, FRC_OFF);
214 res =
AMF_IFACE_CALL(amf_filter, SubmitInput, (AMFData*)surface_in);
223 if (data_out ==
NULL)
226 AMFGuid guid = IID_AMFSurface();
227 res =
AMF_IFACE_CALL(data_out, QueryInterface, &guid, (
void**)&surface_out);
244 if (!
out->hw_frames_ctx) {
284 .p.priv_class = &frc_amf_class,