Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
403 results
Show changes
Commits on Source (5)
......@@ -2261,6 +2261,16 @@ AS_IF([test "$enable_amf_enhancer" != "no"], [
])
AM_CONDITIONAL([HAVE_AMF_ENHANCER], [test "${have_amf_enhancer}" != "no"])
AC_ARG_ENABLE([amf-frc], AS_HELP_STRING([--disable-amf-frc],
[disable AMD FRC (default auto)]))
have_amf_frc="no"
AS_IF([test "$enable_amf_frc" != "no"], [
AC_CHECK_HEADERS([AMF/core/PropertyStorage.h AMF/components/FRC.h], [
have_amf_frc="yes"
])
])
AM_CONDITIONAL([HAVE_AMF_FRC], [test "${have_amf_frc}" != "no"])
dnl
dnl special access module for Blackmagic SDI cards
dnl
......
......@@ -34,7 +34,7 @@ int vlc_AMFCreateContext(struct vlc_amf_context *c)
c->Context = NULL;
AMFInit_Fn init = (AMFInit_Fn)GetProcAddress(hLib, AMF_INIT_FUNCTION_NAME);
res = init(c->Version, &c->pFactory); // use the highest possible value for that DLL
res = init(AMF_FULL_VERSION, &c->pFactory);
if (unlikely(res != AMF_OK))
goto error;
......
......@@ -229,6 +229,15 @@ video_filter_LTLIBRARIES += libamf_vqenhancer_plugin.la
endif
endif
if HAVE_AMF_FRC
libamf_frc_plugin_la_SOURCES = video_filter/amf_frc.c \
hw/amf/amf_helper.c hw/amf/amf_helper.h
if HAVE_WIN32
libamf_frc_plugin_la_LIBADD = $(LIBCOM) libd3d11_common.la -ld3d11
video_filter_LTLIBRARIES += libamf_frc_plugin.la
endif
endif
# misc
libblend_plugin_la_SOURCES = video_filter/blend.cpp
video_filter_LTLIBRARIES += libblend_plugin.la
......
// SPDX-License-Identifier: LGPL-2.1-or-later
/*****************************************************************************
* amf_frc: Frame Rate doubler video with low frame rate
*****************************************************************************
* Copyright © 2024 Videolabs, VLC authors and VideoLAN
*
* Authors: Steve Lhomme <robux4@videolabs.io>
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_filter.h>
#include <vlc_plugin.h>
#include <vlc_configuration.h>
#define COBJMACROS
#include "../hw/amf/amf_helper.h"
#include <AMF/components/FRC.h>
#include "../video_chroma/d3d11_fmt.h"
#include <assert.h>
static const char *const ppsz_filter_options[] = {
"frc-indicator", NULL
};
static int D3D11CreateAMFFRC(filter_t *);
vlc_module_begin()
set_description(N_("AMD Frame Rate Doubler"))
add_shortcut(N_("amf_frc"))
set_subcategory(SUBCAT_VIDEO_VFILTER)
set_callback_video_filter(D3D11CreateAMFFRC)
add_bool( "frc-indicator", false, N_("Show indicator"), NULL )
vlc_module_end()
struct filter_sys_t
{
struct vlc_amf_context amf;
AMFComponent *amf_frc;
AMFSurface *amfInput;
const d3d_format_t *cfg;
enum AMF_FRC_MODE_TYPE mode;
bool source_rate;
date_t next_output_pts;
};
static picture_t *PictureFromTexture(filter_t *filter, d3d11_device_t *d3d_dev, ID3D11Texture2D *out)
{
struct filter_sys_t *sys = filter->p_sys;
struct d3d11_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx));
if (unlikely(pic_ctx == NULL))
return NULL;
picture_resource_t dummy_res = { .p_sys = NULL };
picture_t *p_dst = picture_NewFromResource(&filter->fmt_out.video, &dummy_res);
if (p_dst == NULL) {
msg_Err(filter, "Failed to map create the temporary picture.");
goto done;
}
p_dst->context = &pic_ctx->s;
D3D11_PictureAttach(p_dst, out, sys->cfg);
if (unlikely(D3D11_AllocateResourceView(vlc_object_logger(filter), d3d_dev->d3ddevice, sys->cfg,
pic_ctx->picsys.texture, 0, pic_ctx->picsys.renderSrc) != VLC_SUCCESS))
goto done;
pic_ctx->s = (picture_context_t) {
d3d11_pic_context_destroy, d3d11_pic_context_copy,
vlc_video_context_Hold(filter->vctx_out),
};
pic_ctx->picsys.sharedHandle = INVALID_HANDLE_VALUE;
return p_dst;
done:
if (p_dst != NULL)
picture_Release(p_dst);
free(pic_ctx);
return NULL;
}
static picture_t * Filter(filter_t *filter, picture_t *p_pic)
{
struct filter_sys_t *sys = filter->p_sys;
picture_sys_d3d11_t *src_sys = ActiveD3D11PictureSys(p_pic);
AMF_RESULT res;
AMFSurface *submitSurface;
AMFPlane *packedStaging = sys->amfInput->pVtbl->GetPlane(sys->amfInput, AMF_PLANE_PACKED);
ID3D11Resource *amfStaging = packedStaging->pVtbl->GetNative(packedStaging);
#ifndef NDEBUG
ID3D11Texture2D *staging = (ID3D11Texture2D *)amfStaging;
D3D11_TEXTURE2D_DESC stagingDesc, inputDesc;
ID3D11Texture2D_GetDesc(staging, &stagingDesc);
ID3D11Texture2D_GetDesc(src_sys->texture[KNOWN_DXGI_INDEX], &inputDesc);
assert(stagingDesc.Width == inputDesc.Width);
assert(stagingDesc.Height == inputDesc.Height);
assert(stagingDesc.Format == inputDesc.Format);
#endif
d3d11_decoder_device_t *dev_sys = GetD3D11OpaqueContext( filter->vctx_in );
#if 0
if (src_sys->slice_index == 0)
sys->amf.Context->pVtbl->CreateSurfaceFromDX11Native(sys->amf.Context, )
#endif
// copy source into staging as it may not be shared and we can't select a slice
d3d11_device_lock( &dev_sys->d3d_dev );
ID3D11DeviceContext_CopySubresourceRegion(dev_sys->d3d_dev.d3dcontext, amfStaging,
0,
0, 0, 0,
src_sys->resource[KNOWN_DXGI_INDEX],
src_sys->slice_index,
NULL);
d3d11_device_unlock( &dev_sys->d3d_dev );
submitSurface = sys->amfInput;
res = sys->amf_frc->pVtbl->SubmitInput(sys->amf_frc, (AMFData*)submitSurface);
if (res == AMF_INPUT_FULL)
{
msg_Dbg(filter, "filter input full, skip this frame");
return p_pic;
}
if (res != AMF_OK)
{
msg_Err(filter, "filter input failed (err=%d)", res);
return p_pic;
}
date_Set( &sys->next_output_pts, p_pic->date );
bool got_output = sys->mode != FRC_x2_PRESENT;
do {
AMFData *amfOutput = NULL;
res = sys->amf_frc->pVtbl->QueryOutput(sys->amf_frc, &amfOutput);
if (res != AMF_OK && res != AMF_REPEAT)
{
msg_Err(filter, "filter gave no output (err=%d)", res);
break;
}
AMFSurface *amfOutputSurface = (AMFSurface*)amfOutput;
AMFPlane *packed = amfOutputSurface->pVtbl->GetPlane(amfOutputSurface, AMF_PLANE_PACKED);
assert(amfOutput->pVtbl->GetMemoryType(amfOutput) == AMF_MEMORY_DX11);
ID3D11Texture2D *out = packed->pVtbl->GetNative(packed);
picture_t *dst = PictureFromTexture(filter, &dev_sys->d3d_dev, out);
amfOutput->pVtbl->Release(amfOutput);
if (dst == NULL)
break;
picture_CopyProperties(dst, p_pic);
if (!got_output)
{
picture_Release(p_pic);
p_pic = dst;
got_output = true;
}
else
{
if (sys->mode == FRC_x2_PRESENT)
{
// teh first frame is the interpolated one with the previous frame
dst->date = date_Get( &sys->next_output_pts );
p_pic->date = date_Decrement( &sys->next_output_pts, 1 );
vlc_picture_chain_AppendChain(p_pic, dst);
}
else
{
// past interpolated then source
vlc_picture_chain_AppendChain(dst, p_pic);
dst->date = date_Decrement( &sys->next_output_pts, 1 );
p_pic = dst;
}
}
} while (res == AMF_REPEAT);
return p_pic;
}
static void D3D11CloseAMFFRC(filter_t *filter)
{
struct filter_sys_t *sys = filter->p_sys;
sys->amfInput->pVtbl->Release(sys->amfInput);
sys->amf_frc->pVtbl->Release(sys->amf_frc);
vlc_video_context_Release(filter->vctx_out);
}
static int D3D11CreateAMFFRC(filter_t *filter)
{
if (!is_d3d11_opaque(filter->fmt_in.video.i_chroma))
return VLC_EGENERIC;
if ( GetD3D11ContextPrivate(filter->vctx_in) == NULL )
return VLC_EGENERIC;
if (!video_format_IsSimilar(&filter->fmt_in.video, &filter->fmt_out.video))
return VLC_EGENERIC;
d3d11_decoder_device_t *dev_sys = GetD3D11OpaqueContext( filter->vctx_in );
if (dev_sys->d3d_dev.adapterDesc.VendorId != GPU_MANUFACTURER_AMD)
{
msg_Err(filter, "AMF filter only supported with AMD GPUs");
return VLC_ENOTSUP;
}
config_ChainParse( filter, "", ppsz_filter_options, filter->p_cfg );
struct filter_sys_t *sys = vlc_obj_calloc(VLC_OBJECT(filter), 1, sizeof(*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
sys->mode = FRC_x2_PRESENT; //FRC_ONLY_INTERPOLATED;
d3d11_video_context_t *vctx_sys = GetD3D11ContextPrivate( filter->vctx_in );
DXGI_FORMAT input_format = vctx_sys->format;
const d3d_format_t *cfg;
for (cfg = DxgiGetRenderFormatList(); cfg->name != NULL; ++cfg)
{
if (cfg->formatTexture == input_format &&
is_d3d11_opaque(cfg->fourcc))
break;
}
assert(cfg != NULL);
AMF_SURFACE_FORMAT amf_fmt = DXGIToAMF(input_format);
if (amf_fmt == AMF_SURFACE_UNKNOWN)
{
msg_Err(filter, "Unsupported DXGI format %s", cfg->name);
return VLC_EGENERIC;
}
int err = vlc_AMFCreateContext(&sys->amf);
if (err != VLC_SUCCESS)
return err;
#if 0
if (sys->amf.Version < AMF_MAKE_FULL_VERSION(1,4,34,0))
{
msg_Dbg(filter, "AMF version %u.%u.%u too old for FRC (1.4.34 needed)",
(unsigned)AMF_GET_MAJOR_VERSION(sys->amf.Version),
(unsigned)AMF_GET_MINOR_VERSION(sys->amf.Version),
(unsigned)AMF_GET_SUBMINOR_VERSION(sys->amf.Version));
goto error;
}
#endif
AMF_RESULT res;
res = sys->amf.Context->pVtbl->InitDX11(sys->amf.Context, dev_sys->d3d_dev.d3ddevice, AMF_DX11_0);
if (res != AMF_OK)
goto error;
res = sys->amf.pFactory->pVtbl->CreateComponent(sys->amf.pFactory, sys->amf.Context, AMFFRC, &sys->amf_frc);
if (res != AMF_OK || sys->amf_frc == NULL)
goto error;
// TODO AMF_STREAM_VIDEO_FRAME_RATE
AMFVariantStruct val;
val.int64Value = FRC_ENGINE_DX11;
val.type = AMF_VARIANT_INT64;
res = sys->amf_frc->pVtbl->SetProperty(sys->amf_frc, AMF_FRC_ENGINE_TYPE, val);
if (unlikely(res != AMF_OK))
{
msg_Err(filter, "Failed to set D3D11 engine type (err=%d)", res);
goto error;
}
val.boolValue = false;
val.type = AMF_VARIANT_BOOL;
res = sys->amf_frc->pVtbl->SetProperty(sys->amf_frc, AMF_FRC_ENABLE_FALLBACK, val);
if (unlikely(res != AMF_OK))
{
msg_Err(filter, "Failed to disable fallback (err=%d)", res);
goto error;
}
val.int64Value = FRC_PROFILE_HIGH;
val.type = AMF_VARIANT_INT64;
res = sys->amf_frc->pVtbl->SetProperty(sys->amf_frc, AMF_FRC_PROFILE, val);
if (unlikely(res != AMF_OK))
{
msg_Err(filter, "Failed to set FRC profile to %" PRId64 " (err=%d)", val.int64Value, res);
goto error;
}
val.int64Value = FRC_MV_SEARCH_NATIVE;
val.type = AMF_VARIANT_INT64;
res = sys->amf_frc->pVtbl->SetProperty(sys->amf_frc, AMF_FRC_MV_SEARCH_MODE, val);
if (unlikely(res != AMF_OK))
{
msg_Err(filter, "Failed to set FRC mv search to %" PRId64 " (err=%d)", val.int64Value, res);
goto error;
}
val.int64Value = sys->mode;
val.type = AMF_VARIANT_INT64;
res = sys->amf_frc->pVtbl->SetProperty(sys->amf_frc, AMF_FRC_MODE, val);
if (unlikely(res != AMF_OK))
{
msg_Err(filter, "Failed to set FRC mode to %" PRId64 " (err=%d)", val.int64Value, res);
goto error;
}
val.boolValue = var_GetBool (filter, "frc-indicator");
val.type = AMF_VARIANT_BOOL;
res = sys->amf_frc->pVtbl->SetProperty(sys->amf_frc, AMF_FRC_INDICATOR, val);
if (res != AMF_OK)
goto error;
res = sys->amf_frc->pVtbl->Init(sys->amf_frc, amf_fmt,
filter->fmt_in.video.i_width,
filter->fmt_in.video.i_height);
if (res != AMF_OK)
goto error;
res = sys->amf.Context->pVtbl->AllocSurface(sys->amf.Context, AMF_MEMORY_DX11,
amf_fmt,
filter->fmt_in.video.i_width,
filter->fmt_in.video.i_height,
&sys->amfInput);
if (res != AMF_OK)
goto error;
sys->cfg = cfg;
static const struct vlc_filter_operations filter_ops =
{
.filter_video = Filter,
.close = D3D11CloseAMFFRC,
};
filter->ops = &filter_ops;
filter->p_sys = sys;
filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
sys->source_rate = filter->fmt_out.video.i_frame_rate_base != 0 &&
filter->fmt_out.video.i_frame_rate != 0;
if (!sys->source_rate)
{
msg_Warn( filter, "Missing frame rate, assuming 25fps source" );
filter->fmt_out.video.i_frame_rate = 25;
filter->fmt_out.video.i_frame_rate_base = 1;
}
filter->fmt_out.video.i_frame_rate = 2 * filter->fmt_out.video.i_frame_rate;
date_Init( &sys->next_output_pts,
filter->fmt_out.video.i_frame_rate, filter->fmt_out.video.i_frame_rate_base );
return VLC_SUCCESS;
error:
if (sys->amfInput)
sys->amfInput->pVtbl->Release(sys->amfInput);
if (sys->amf_frc != NULL)
sys->amf_frc->pVtbl->Release(sys->amf_frc);
vlc_AMFReleaseContext(&sys->amf);
return VLC_EGENERIC;
}
......@@ -823,7 +823,7 @@ static void ChangeFilters(vout_thread_sys_t *vout)
if (likely(e)) {
e->name = name;
e->cfg = cfg;
if (!strcmp(e->name, "postproc"))
if (!strcmp(e->name, "postproc") || !strcmp(e->name, "amf_frc"))
vlc_array_append_or_abort(&array_static, e);
else
vlc_array_append_or_abort(&array_interactive, e);
......@@ -967,14 +967,15 @@ static inline vlc_tick_t GetRenderDelay(vout_thread_sys_t *sys)
return vout_chrono_GetHigh(&sys->chrono.render) + VOUT_MWAIT_TOLERANCE;
}
static bool IsPictureLateToStaticFilter(vout_thread_sys_t *vout, const video_format_t *fmt,
static bool IsPictureLateToStaticFilter(vout_thread_sys_t *vout,
vlc_tick_t time_until_display)
{
vout_thread_sys_t *sys = vout;
const es_format_t *static_es = filter_chain_GetFmtOut(sys->filter.chain_static);
const vlc_tick_t prepare_decoded_duration =
vout_chrono_GetHigh(&sys->chrono.render) +
vout_chrono_GetHigh(&sys->chrono.static_filter);
return IsPictureLateToProcess(vout, fmt, time_until_display, prepare_decoded_duration);
return IsPictureLateToProcess(vout, &static_es->video, time_until_display, prepare_decoded_duration);
}
/* */
......@@ -1025,8 +1026,7 @@ static picture_t *PreparePicture(vout_thread_sys_t *vout, bool reuse_decoded,
}
if (is_late_dropped
&& IsPictureLateToStaticFilter(vout, &decoded->format,
system_pts - system_now))
&& IsPictureLateToStaticFilter(vout, system_pts - system_now))
{
picture_Release(decoded);
vout_statistic_AddLost(&sys->statistic, 1);
......