Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
4976b102
Commit
4976b102
authored
Mar 19, 2020
by
Yaroslav Pogrebnyak
Committed by
Timo Rothenpieler
Mar 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter: add vf_overlay_cuda
Signed-off-by:
Timo Rothenpieler
<
timo@rothenpieler.org
>
parent
77d5ea1c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
530 additions
and
1 deletion
+530
-1
Changelog
Changelog
+1
-0
configure
configure
+2
-0
filters.texi
doc/filters.texi
+32
-0
Makefile
libavfilter/Makefile
+1
-0
allfilters.c
libavfilter/allfilters.c
+1
-0
version.h
libavfilter/version.h
+1
-1
vf_overlay_cuda.c
libavfilter/vf_overlay_cuda.c
+438
-0
vf_overlay_cuda.cu
libavfilter/vf_overlay_cuda.cu
+54
-0
No files found.
Changelog
View file @
4976b102
...
...
@@ -54,6 +54,7 @@ version <next>:
- DERF demuxer
- CRI HCA decoder
- CRI HCA demuxer
- overlay_cuda filter
version 4.2:
...
...
configure
View file @
4976b102
...
...
@@ -3026,6 +3026,8 @@ scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
thumbnail_cuda_filter_deps
=
"ffnvcodec"
thumbnail_cuda_filter_deps_any
=
"cuda_nvcc cuda_llvm"
transpose_npp_filter_deps
=
"ffnvcodec libnpp"
overlay_cuda_filter_deps
=
"ffnvcodec"
overlay_cuda_filter_deps_any
=
"cuda_nvcc cuda_llvm"
amf_deps_any
=
"libdl LoadLibrary"
nvenc_deps
=
"ffnvcodec"
...
...
doc/filters.texi
View file @
4976b102
...
...
@@ -14387,6 +14387,38 @@ testsrc=s=100x100, split=4 [in0][in1][in2][in3];
@end itemize
@anchor{overlay_cuda}
@section overlay_cuda
Overlay one video on top of another.
This is the CUDA cariant of the @ref{overlay} filter.
It only accepts CUDA frames. The underlying input pixel formats have to match.
It takes two inputs and has one output. The first input is the "main"
video on which the second input is overlaid.
It accepts the following parameters:
@table @option
@item x
@item y
Set the x and y coordinates of the overlaid video on the main video.
Default value is "0" for both expressions.
@item eof_action
See @ref{framesync}.
@item shortest
See @ref{framesync}.
@item repeatlast
See @ref{framesync}.
@end table
This filter also supports the @ref{framesync} options.
@section owdenoise
Apply Overcomplete Wavelet denoiser.
...
...
libavfilter/Makefile
View file @
4976b102
...
...
@@ -324,6 +324,7 @@ OBJS-$(CONFIG_OCR_FILTER) += vf_ocr.o
OBJS-$(CONFIG_OCV_FILTER)
+=
vf_libopencv.o
OBJS-$(CONFIG_OSCILLOSCOPE_FILTER)
+=
vf_datascope.o
OBJS-$(CONFIG_OVERLAY_FILTER)
+=
vf_overlay.o
framesync.o
OBJS-$(CONFIG_OVERLAY_CUDA_FILTER)
+=
vf_overlay_cuda.o
framesync.o
vf_overlay_cuda.ptx.o
OBJS-$(CONFIG_OVERLAY_OPENCL_FILTER)
+=
vf_overlay_opencl.o
opencl.o
\
opencl/overlay.o
framesync.o
OBJS-$(CONFIG_OVERLAY_QSV_FILTER)
+=
vf_overlay_qsv.o
framesync.o
...
...
libavfilter/allfilters.c
View file @
4976b102
...
...
@@ -312,6 +312,7 @@ extern AVFilter ff_vf_overlay;
extern
AVFilter
ff_vf_overlay_opencl
;
extern
AVFilter
ff_vf_overlay_qsv
;
extern
AVFilter
ff_vf_overlay_vulkan
;
extern
AVFilter
ff_vf_overlay_cuda
;
extern
AVFilter
ff_vf_owdenoise
;
extern
AVFilter
ff_vf_pad
;
extern
AVFilter
ff_vf_pad_opencl
;
...
...
libavfilter/version.h
View file @
4976b102
...
...
@@ -31,7 +31,7 @@
#define LIBAVFILTER_VERSION_MAJOR 7
#define LIBAVFILTER_VERSION_MINOR 77
#define LIBAVFILTER_VERSION_MICRO 10
0
#define LIBAVFILTER_VERSION_MICRO 10
1
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...
...
libavfilter/vf_overlay_cuda.c
0 → 100644
View file @
4976b102
This diff is collapsed.
Click to expand it.
libavfilter/vf_overlay_cuda.cu
0 → 100644
View file @
4976b102
/*
* Copyright (c) 2020 Yaroslav Pogrebnyak <yyyaroslav@gmail.com>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern "C" {
__global__ void Overlay_Cuda(
int x_position, int y_position,
unsigned char* main, int main_linesize,
unsigned char* overlay, int overlay_linesize,
int overlay_w, int overlay_h,
unsigned char* overlay_alpha, int alpha_linesize,
int alpha_adj_x, int alpha_adj_y)
{
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
if (x >= overlay_w + x_position ||
y >= overlay_h + y_position ||
x < x_position ||
y < y_position ) {
return;
}
int overlay_x = x - x_position;
int overlay_y = y - y_position;
float alpha = 1.0;
if (alpha_linesize) {
alpha = overlay_alpha[alpha_adj_x * overlay_x + alpha_adj_y * overlay_y * alpha_linesize] / 255.0f;
}
main[x + y*main_linesize] = alpha * overlay[overlay_x + overlay_y * overlay_linesize] + (1.0f - alpha) * main[x + y*main_linesize];
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment