34#define MAX_REFERENCES 8
105 s->processor_configured = 0;
115 if (
s->command_queue &&
s->fence &&
s->fence_event) {
116 fence_value =
s->fence_value;
117 hr = ID3D12CommandQueue_Signal(
s->command_queue,
s->fence, fence_value);
119 UINT64 completed = ID3D12Fence_GetCompletedValue(
s->fence);
120 if (completed < fence_value) {
121 hr = ID3D12Fence_SetEventOnCompletion(
s->fence, fence_value,
s->fence_event);
129 if (
s->fence_event) {
130 CloseHandle(
s->fence_event);
131 s->fence_event =
NULL;
135 ID3D12Fence_Release(
s->fence);
139 if (
s->command_list) {
140 ID3D12VideoProcessCommandList_Release(
s->command_list);
141 s->command_list =
NULL;
144 if (
s->command_allocator) {
145 ID3D12CommandAllocator_Release(
s->command_allocator);
146 s->command_allocator =
NULL;
149 if (
s->video_processor) {
150 ID3D12VideoProcessor_Release(
s->video_processor);
151 s->video_processor =
NULL;
154 if (
s->video_device) {
155 ID3D12VideoDevice_Release(
s->video_device);
156 s->video_device =
NULL;
159 if (
s->command_queue) {
160 ID3D12CommandQueue_Release(
s->command_queue);
161 s->command_queue =
NULL;
167 for (
int i = 0;
i <
s->queue_count;
i++) {
182 return DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020;
184 return DXGI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020;
186 return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020;
189 return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709;
194 return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020;
196 return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601;
198 return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709;
226 D3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS method_flag;
230 method_flag = D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_BOB;
233 method_flag = D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_CUSTOM;
238 if (
s->supported_deint_flags & D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_CUSTOM) {
239 method_flag = D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_CUSTOM;
241 }
else if (
s->supported_deint_flags & D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_BOB) {
242 method_flag = D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_BOB;
245 method_flag = D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_BOB;
252 if (method_flag != D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_BOB &&
253 !(
s->supported_deint_flags & method_flag)) {
255 method_flag = D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_BOB;
268 D3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS deint_method;
269 D3D12_VIDEO_FIELD_TYPE field_type;
271 s->device = d3d12_hwctx->
device;
274 s->width,
s->height);
276 hr = ID3D12Device_QueryInterface(
s->device, &IID_ID3D12VideoDevice, (
void **)&
s->video_device);
282 D3D12_COMMAND_QUEUE_DESC queue_desc = {
283 .Type = D3D12_COMMAND_LIST_TYPE_VIDEO_PROCESS,
284 .Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL,
285 .Flags = D3D12_COMMAND_QUEUE_FLAG_NONE,
289 hr = ID3D12Device_CreateCommandQueue(
s->device, &queue_desc, &IID_ID3D12CommandQueue, (
void **)&
s->command_queue);
297 field_type = D3D12_VIDEO_FIELD_TYPE_INTERLACED_TOP_FIELD_FIRST;
300 field_type = D3D12_VIDEO_FIELD_TYPE_INTERLACED_BOTTOM_FIELD_FIRST;
305 s->process_support.NodeIndex = 0;
306 s->process_support.InputSample.Format.Format =
s->input_format;
307 s->process_support.InputSample.Format.ColorSpace =
s->input_colorspace;
308 s->process_support.InputSample.Width =
s->width;
309 s->process_support.InputSample.Height =
s->height;
310 s->process_support.InputFrameRate.Numerator =
s->input_framerate.num;
311 s->process_support.InputFrameRate.Denominator =
s->input_framerate.den;
312 s->process_support.InputFieldType = field_type;
313 s->process_support.InputStereoFormat = D3D12_VIDEO_FRAME_STEREO_FORMAT_NONE;
315 s->process_support.OutputFormat.Format =
s->input_format;
316 s->process_support.OutputFormat.ColorSpace =
s->input_colorspace;
317 s->process_support.OutputFrameRate.Numerator =
s->input_framerate.num * (
s->mode + 1);
318 s->process_support.OutputFrameRate.Denominator =
s->input_framerate.den;
319 s->process_support.OutputStereoFormat = D3D12_VIDEO_FRAME_STEREO_FORMAT_NONE;
321 hr = ID3D12VideoDevice_CheckFeatureSupport(
323 D3D12_FEATURE_VIDEO_PROCESS_SUPPORT,
325 sizeof(
s->process_support)
333 if (!(
s->process_support.SupportFlags & D3D12_VIDEO_PROCESS_SUPPORT_FLAG_SUPPORTED)) {
339 s->supported_deint_flags =
s->process_support.DeinterlaceSupport;
343 if (!(
s->supported_deint_flags & (D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_BOB |
344 D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_CUSTOM))) {
352#if CONFIG_D3D12_VIDEO_PROCESS_REFERENCE_INFO
353 D3D12_FEATURE_DATA_VIDEO_PROCESS_REFERENCE_INFO ref_info = {
355 .DeinterlaceMode = deint_method,
356 .Filters = D3D12_VIDEO_PROCESS_FILTER_FLAG_NONE,
357 .FeatureSupport = D3D12_VIDEO_PROCESS_FEATURE_FLAG_NONE,
358 .InputFrameRate = {
s->input_framerate.num,
s->input_framerate.den },
359 .OutputFrameRate = {
s->input_framerate.num * (
s->mode + 1),
s->input_framerate.den },
360 .EnableAutoProcessing = FALSE,
363 hr = ID3D12VideoDevice_CheckFeatureSupport(
365 D3D12_FEATURE_VIDEO_PROCESS_REFERENCE_INFO,
371 s->num_past_frames = ref_info.PastFrames;
372 s->num_future_frames = ref_info.FutureFrames;
374 "Reference frames from hardware: past=%d, future=%d\n",
375 s->num_past_frames,
s->num_future_frames);
378 "Failed to query reference info (HRESULT 0x%lX), using defaults\n", hr);
379 s->num_past_frames = (deint_method == D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_CUSTOM) ? 1 : 0;
380 s->num_future_frames = 0;
384 "Reference info query not available in SDK, using defaults\n");
385 s->num_past_frames = (deint_method == D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_CUSTOM) ? 1 : 0;
386 s->num_future_frames = 0;
390 s->extra_delay_for_timestamps = (
s->mode &&
s->num_future_frames == 0) ? 1 : 0;
392 s->queue_depth =
s->num_past_frames +
s->num_future_frames +
s->extra_delay_for_timestamps + 1;
400 s->current_frame_index =
s->num_past_frames;
403 s->queue_depth,
s->num_past_frames,
s->num_future_frames,
404 s->extra_delay_for_timestamps);
406 D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC processor_output_desc = {
407 .Format =
s->input_format,
408 .ColorSpace =
s->input_colorspace,
409 .AlphaFillMode = D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE_OPAQUE,
410 .AlphaFillModeSourceStreamIndex = 0,
411 .BackgroundColor = { 0.0f, 0.0f, 0.0f, 1.0f },
412 .FrameRate = {
s->input_framerate.num * (
s->mode + 1),
s->input_framerate.den },
413 .EnableStereo = FALSE,
416 D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC processor_input_desc = {
417 .Format =
s->input_format,
418 .ColorSpace =
s->input_colorspace,
419 .SourceAspectRatio = {
s->width,
s->height },
420 .DestinationAspectRatio = {
s->width,
s->height },
421 .FrameRate = {
s->input_framerate.num,
s->input_framerate.den },
422 .StereoFormat = D3D12_VIDEO_FRAME_STEREO_FORMAT_NONE,
423 .FieldType = field_type,
424 .DeinterlaceMode = deint_method,
425 .EnableOrientation = FALSE,
426 .FilterFlags = D3D12_VIDEO_PROCESS_FILTER_FLAG_NONE,
428 .MaxWidth =
s->width,
429 .MaxHeight =
s->height,
430 .MinWidth =
s->width,
431 .MinHeight =
s->height
433 .DestinationSizeRange = {
434 .MaxWidth =
s->width,
435 .MaxHeight =
s->height,
436 .MinWidth =
s->width,
437 .MinHeight =
s->height
439 .EnableAlphaBlending = FALSE,
440 .LumaKey = { .Enable = FALSE, .Lower = 0.0f, .Upper = 1.0f },
441 .NumPastFrames =
s->num_past_frames,
442 .NumFutureFrames =
s->num_future_frames,
443 .EnableAutoProcessing = FALSE,
446 hr = ID3D12VideoDevice_CreateVideoProcessor(
449 &processor_output_desc,
451 &processor_input_desc,
452 &IID_ID3D12VideoProcessor,
453 (
void **)&
s->video_processor
461 hr = ID3D12Device_CreateCommandAllocator(
463 D3D12_COMMAND_LIST_TYPE_VIDEO_PROCESS,
464 &IID_ID3D12CommandAllocator,
465 (
void **)&
s->command_allocator
473 hr = ID3D12Device_CreateCommandList(
476 D3D12_COMMAND_LIST_TYPE_VIDEO_PROCESS,
477 s->command_allocator,
479 &IID_ID3D12VideoProcessCommandList,
480 (
void **)&
s->command_list
488 ID3D12VideoProcessCommandList_Close(
s->command_list);
490 hr = ID3D12Device_CreateFence(
s->device, 0, D3D12_FENCE_FLAG_NONE, &IID_ID3D12Fence, (
void **)&
s->fence);
498 s->fence_event = CreateEvent(
NULL, FALSE, FALSE,
NULL);
499 if (!
s->fence_event) {
504 s->processor_configured = 1;
510 ID3D12Resource *resource,
511 D3D12_RESOURCE_STATES before,
512 D3D12_RESOURCE_STATES after)
514 barriers[(*count)++] = (D3D12_RESOURCE_BARRIER) {
515 .Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION,
516 .Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE,
518 .pResource = resource,
519 .Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,
520 .StateBefore = before,
555 ID3D12Resource *input_resource = in_d3d12_frame->
texture;
556 ID3D12Resource *output_resource = out_d3d12_frame->
texture;
565 int actual_future = 0;
567 if (queue_idx >= 0) {
570 for (
i = 0;
i <
s->num_past_frames && (queue_idx - 1 -
i) >= 0;
i++) {
571 AVFrame *past_frame =
s->frame_queue[queue_idx - 1 -
i];
574 past_textures[actual_past] = past_d3d12->
texture;
575 past_subresources[actual_past] = 0;
582 for (
i = 0;
i <
s->num_future_frames && (queue_idx + 1 +
i) <
s->queue_count;
i++) {
583 AVFrame *future_frame =
s->frame_queue[queue_idx + 1 +
i];
586 future_textures[actual_future] = future_d3d12->
texture;
587 future_subresources[actual_future] = 0;
593 "Reference frames: past=%d/%d, future=%d/%d, queue_idx=%d\n",
594 actual_past,
s->num_past_frames, actual_future,
s->num_future_frames,
600 UINT64 completed = ID3D12Fence_GetCompletedValue(in_d3d12_frame->
sync_ctx.
fence);
601 if (completed < in_d3d12_frame->sync_ctx.fence_value) {
602 hr = ID3D12CommandQueue_Wait(
s->command_queue, in_d3d12_frame->
sync_ctx.
fence,
613 for (
i = 0;
i < actual_past;
i++) {
614 AVFrame *past_frame =
s->frame_queue[queue_idx - 1 -
i];
617 hr = ID3D12CommandQueue_Wait(
s->command_queue, past_d3d12->
sync_ctx.
fence,
627 for (
i = 0;
i < actual_future;
i++) {
628 AVFrame *future_frame =
s->frame_queue[queue_idx + 1 +
i];
631 hr = ID3D12CommandQueue_Wait(
s->command_queue, future_d3d12->
sync_ctx.
fence,
641 hr = ID3D12CommandAllocator_Reset(
s->command_allocator);
648 hr = ID3D12VideoProcessCommandList_Reset(
s->command_list,
s->command_allocator);
657 int num_barriers = 0;
660 D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_VIDEO_PROCESS_READ);
662 D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_VIDEO_PROCESS_WRITE);
664 for (
i = 0;
i < actual_past;
i++)
666 D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_VIDEO_PROCESS_READ);
668 for (
i = 0;
i < actual_future;
i++)
670 D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_VIDEO_PROCESS_READ);
672 ID3D12VideoProcessCommandList_ResourceBarrier(
s->command_list, num_barriers, barriers);
675 D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS input_args = {0};
677 input_args.InputStream[0].pTexture2D = input_resource;
680 input_args.InputStream[0].ReferenceSet.NumPastFrames = actual_past;
681 input_args.InputStream[0].ReferenceSet.ppPastFrames = actual_past > 0 ? past_textures :
NULL;
682 input_args.InputStream[0].ReferenceSet.pPastSubresources = actual_past > 0 ? past_subresources :
NULL;
683 input_args.InputStream[0].ReferenceSet.NumFutureFrames = actual_future;
684 input_args.InputStream[0].ReferenceSet.ppFutureFrames = actual_future > 0 ? future_textures :
NULL;
685 input_args.InputStream[0].ReferenceSet.pFutureSubresources = actual_future > 0 ? future_subresources :
NULL;
687 input_args.Transform.SourceRectangle.right =
s->width;
688 input_args.Transform.SourceRectangle.bottom =
s->height;
689 input_args.Transform.DestinationRectangle.right =
s->width;
690 input_args.Transform.DestinationRectangle.bottom =
s->height;
691 input_args.Transform.Orientation = D3D12_VIDEO_PROCESS_ORIENTATION_DEFAULT;
693 input_args.Flags = D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAG_NONE;
695 input_args.RateInfo.OutputIndex = field;
696 input_args.RateInfo.InputFrameOrField = 0;
698 memset(input_args.FilterLevels, 0,
sizeof(input_args.FilterLevels));
700 input_args.AlphaBlending.Enable = FALSE;
701 input_args.AlphaBlending.Alpha = 1.0f;
704 D3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS output_args = {0};
706 output_args.OutputStream[0].pTexture2D = output_resource;
707 output_args.TargetRectangle.right =
s->width;
708 output_args.TargetRectangle.bottom =
s->height;
710 ID3D12VideoProcessCommandList_ProcessFrames(
719 for (
i = 0;
i < num_barriers;
i++) {
720 FFSWAP(D3D12_RESOURCE_STATES, barriers[
i].Transition.StateBefore, barriers[
i].Transition.StateAfter);
722 ID3D12VideoProcessCommandList_ResourceBarrier(
s->command_list, num_barriers, barriers);
724 hr = ID3D12VideoProcessCommandList_Close(
s->command_list);
731 ID3D12CommandList *cmd_lists[] = { (ID3D12CommandList *)
s->command_list };
732 ID3D12CommandQueue_ExecuteCommandLists(
s->command_queue, 1, cmd_lists);
734 hr = ID3D12CommandQueue_Signal(
s->command_queue,
s->fence,
s->fence_value);
743 ID3D12Fence_AddRef(
s->fence);
753 out->width =
s->width;
754 out->height =
s->height;
759 if (
s->mode && queue_idx >= 0) {
760 AVFrame *next_frame = (queue_idx + 1 <
s->queue_count) ?
761 s->frame_queue[queue_idx + 1] :
NULL;
764 out->pts = 2 * input_frame->
pts;
765 }
else if (
s->eof || !next_frame) {
766 out->pts = 3 * input_frame->
pts -
s->prev_pts;
768 out->pts = input_frame->
pts + next_frame->
pts;
773 out->width,
out->height,
out->pts, field);
797 if (
s->eof &&
s->queue_count > 0) {
800 if (!
s->initial_fill_done) {
805 "EOF flush (short stream): processing all %d buffered frames\n",
810 flush_idx =
s->current_frame_index + 1;
812 "EOF flush: processing frames %d..%d in queue (count=%d)\n",
813 flush_idx,
s->queue_count - 1,
s->queue_count);
816 while (flush_idx < s->queue_count) {
817 input_frame =
s->frame_queue[flush_idx];
819 for (field = 0; field <=
s->mode; field++) {
824 s->prev_pts = input_frame->
pts;
844 if (!
s->processor_configured) {
848 s->width = frames_ctx->
width;
849 s->height = frames_ctx->
height;
850 s->input_format = input_hwctx->
format;
852 if (
s->input_format == DXGI_FORMAT_UNKNOWN) {
855 s->input_format = DXGI_FORMAT_NV12;
858 s->input_format = DXGI_FORMAT_P010;
868 int is_10bit = (
s->input_format == DXGI_FORMAT_P010);
911 if (
s->queue_count <
s->queue_depth) {
914 s->frame_queue[
s->queue_count++] = in;
915 if (
s->queue_count <
s->queue_depth)
922 for (
int i = 0;
i <=
s->current_frame_index;
i++) {
923 input_frame =
s->frame_queue[
i];
926 for (field = 0; field <=
s->mode; field++) {
931 s->prev_pts = input_frame->
pts;
933 s->initial_fill_done = 1;
941 for (
int i = 0;
i + 1 <
s->queue_count;
i++)
942 s->frame_queue[
i] =
s->frame_queue[
i + 1];
943 s->frame_queue[
s->queue_count - 1] = in;
945 input_frame =
s->frame_queue[
s->current_frame_index];
949 for (field = 0; field <=
s->mode; field++) {
955 s->prev_pts = input_frame->
pts;
995 s->processor_configured = 0;
997 outlink->
w = inlink->
w;
998 outlink->
h = inlink->
h;
999 s->width = inlink->
w;
1000 s->height = inlink->
h;
1013 if (!
s->hw_device_ctx) {
1019 if (!
s->hw_frames_ctx_out)
1026 frames_ctx->
width =
s->width;
1027 frames_ctx->
height =
s->height;
1030 if (
ctx->extra_hw_frames > 0)
1037 frames_hwctx->
resource_flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
1038 frames_hwctx->
heap_flags = D3D12_HEAP_FLAG_NONE;
1051 outlink->
w, outlink->
h,
s->mode ?
"field" :
"frame");
1084#define OFFSET(x) offsetof(DeinterlaceD3D12Context, x)
1085#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
1088 {
"method",
"Deinterlacing method",
1091 {
"default",
"Use best available deinterlacing method",
1093 {
"bob",
"Bob deinterlacing (simple field interpolation)",
1095 {
"custom",
"Driver-defined advanced deinterlacing",
1098 {
"mode",
"Specify the interlacing mode",
1100 {
"frame",
"Send one frame for each frame",
1102 {
"field",
"Send one frame for each field",
1105 {
"deint",
"Specify which frames to deinterlace",
1107 {
"all",
"Deinterlace all frames",
1109 {
"interlaced",
"Only deinterlace frames marked as interlaced",
1118 .p.name =
"deinterlace_d3d12",
1121 .p.priv_class = &deinterlace_d3d12_class,
const FFFilter ff_vf_deinterlace_d3d12
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
#define i(width, name, range_min, range_max)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
#define AVERROR_EXTERNAL
Generic error in an external library.
#define AVERROR_EOF
End of file.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
An API-specific header for AV_HWDEVICE_TYPE_D3D12VA.
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
static FilterLink * ff_filter_link(AVFilterLink *link)
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define FFSWAP(type, a, b)
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
@ AV_PIX_FMT_D3D12
Hardware surfaces for Direct3D 12.
AVColorTransferCharacteristic
Color Transfer Characteristic.
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
AVColorSpace
YUV colorspace type.
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
A reference to a data buffer.
uint8_t * data
The data buffer.
Describe the class of an AVClass context structure.
This struct is allocated as AVHWDeviceContext.hwctx.
ID3D12Device * device
Device used for objects creation and access.
D3D12VA frame descriptor for pool allocation.
ID3D12Resource * texture
The texture in which the frame is located.
AVD3D12VASyncContext sync_ctx
The sync context for the texture.
This struct is allocated as AVHWFramesContext.hwctx.
D3D12_RESOURCE_FLAGS resource_flags
Options for working with resources.
D3D12_HEAP_FLAGS heap_flags
Options for working with heaps allocation when creating resources.
DXGI_FORMAT format
DXGI_FORMAT format.
ID3D12Fence * fence
D3D12 fence object.
uint64_t fence_value
The fence value used for sync.
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
enum AVColorSpace colorspace
YUV colorspace type.
enum AVColorTransferCharacteristic color_trc
int64_t duration
Duration of the frame, in the same units as pts.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
This struct describes a set or pool of "hardware" frames (i.e.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int initial_pool_size
Initial size of the frame pool.
int width
The allocated dimensions of the frames in this pool.
Rational number (pair of numerator and denominator).
D3D12_FEATURE_DATA_VIDEO_PROCESS_SUPPORT process_support
DXGI_COLOR_SPACE_TYPE input_colorspace
AVRational input_framerate
ID3D12VideoProcessor * video_processor
ID3D12CommandAllocator * command_allocator
ID3D12CommandQueue * command_queue
D3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS supported_deint_flags
int extra_delay_for_timestamps
AVBufferRef * hw_device_ctx
ID3D12VideoProcessCommandList * command_list
AVFrame * frame_queue[MAX_REFERENCES]
AVBufferRef * hw_frames_ctx_out
ID3D12VideoDevice * video_device
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames.
static AVFormatContext * ctx
static int deint_d3d12_request_frame(AVFilterLink *link)
static int deint_d3d12_filter_frame(AVFilterLink *inlink, AVFrame *in)
static int deint_d3d12_config_output(AVFilterLink *outlink)
static AVRational get_input_framerate(AVFilterContext *ctx, AVFilterLink *inlink, AVFrame *in)
static D3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS get_deint_method(DeinterlaceD3D12Context *s, AVFilterContext *ctx)
DeinterlaceD3D12Method
Deinterlace method enumeration Maps to D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG values.
@ DEINT_D3D12_METHOD_CUSTOM
@ DEINT_D3D12_METHOD_DEFAULT
static const AVOption deinterlace_d3d12_options[]
static void add_resource_barrier(D3D12_RESOURCE_BARRIER *barriers, int *count, ID3D12Resource *resource, D3D12_RESOURCE_STATES before, D3D12_RESOURCE_STATES after)
static av_cold int deint_d3d12_init(AVFilterContext *ctx)
static int deint_d3d12_configure_processor(DeinterlaceD3D12Context *s, AVFilterContext *ctx, AVFrame *in)
static void deint_d3d12_clear_queue(DeinterlaceD3D12Context *s)
static const AVFilterPad deint_d3d12_inputs[]
static DXGI_COLOR_SPACE_TYPE get_dxgi_colorspace(enum AVColorSpace colorspace, enum AVColorTransferCharacteristic trc, int is_10bit)
static av_cold void deint_d3d12_uninit(AVFilterContext *ctx)
static void release_d3d12_resources(DeinterlaceD3D12Context *s)
static const AVFilterPad deint_d3d12_outputs[]
static int deint_d3d12_process_frame(AVFilterContext *ctx, AVFilterLink *outlink, AVFrame *input_frame, int field, int queue_idx)
#define WaitForSingleObject(a, b)