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
c51b2c79
Commit
c51b2c79
authored
Jan 13, 2016
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow linking to CUDA dynamically instead of dlopen()ing it at runtime
parent
bd49be88
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
configure
configure
+5
-1
nvenc.c
libavcodec/nvenc.c
+13
-0
nvenc.h
libavcodec/nvenc.h
+4
-0
No files found.
configure
View file @
c51b2c79
...
...
@@ -179,6 +179,7 @@ Individual component options:
External library support:
--enable-avisynth enable reading of AviSynth script files [no]
--enable-bzlib enable bzlib [autodetect]
--enable-cuda enable dynamically linked CUDA [no]
--enable-frei0r enable frei0r video filtering
--enable-gnutls enable gnutls [no]
--enable-libbs2b enable bs2b DSP library [no]
...
...
@@ -1238,6 +1239,7 @@ EXAMPLE_LIST="
EXTERNAL_LIBRARY_LIST
=
"
avisynth
bzlib
cuda
frei0r
gnutls
libbs2b
...
...
@@ -4043,6 +4045,7 @@ die_license_disabled gpl libxavs
die_license_disabled gpl libxvid
die_license_disabled gpl x11grab
die_license_disabled nonfree cuda
die_license_disabled nonfree libfaac
die_license_disabled nonfree libfdk_aac
die_license_disabled nonfree nvenc
...
...
@@ -4523,6 +4526,7 @@ done
enabled avisynth
&&
{
check_lib2
"avisynth/avisynth_c.h windows.h"
LoadLibrary
||
check_lib2
"avxsynth/avxsynth_c.h dlfcn.h"
dlopen
-ldl
||
die
"ERROR: LoadLibrary/dlopen not found, or avisynth header not found"
;
}
enabled cuda
&&
check_lib cuda.h cuInit
-lcuda
enabled frei0r
&&
{
check_header frei0r.h
||
die
"ERROR: frei0r.h header not found"
;
}
enabled gnutls
&&
require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
enabled libbs2b
&&
require_pkg_config libbs2b bs2b.h bs2b_open
...
...
@@ -4617,7 +4621,7 @@ if enabled libdc1394; then
fi
if
enabled nvenc
;
then
check_header cuda.h
||
die
"ERROR: cuda.h not found."
;
enabled cuda
||
check_header cuda.h
||
die
"ERROR: cuda.h not found."
;
check_header nvEncodeAPI.h
||
die
"ERROR: nvEncodeAPI.h not found."
;
check_cpp_condition nvEncodeAPI.h
"NVENCAPI_MAJOR_VERSION >= 5"
||
die
"ERROR: NVENC API version 4 or older is not supported"
;
...
...
libavcodec/nvenc.c
View file @
c51b2c79
...
...
@@ -148,6 +148,16 @@ static av_cold int nvenc_load_libraries(AVCodecContext *avctx)
PNVENCODEAPICREATEINSTANCE
nvenc_create_instance
;
NVENCSTATUS
err
;
#if CONFIG_CUDA
nvel
->
cu_init
=
cuInit
;
nvel
->
cu_device_get_count
=
cuDeviceGetCount
;
nvel
->
cu_device_get
=
cuDeviceGet
;
nvel
->
cu_device_get_name
=
cuDeviceGetName
;
nvel
->
cu_device_compute_capability
=
cuDeviceComputeCapability
;
nvel
->
cu_ctx_create
=
cuCtxCreate_v2
;
nvel
->
cu_ctx_pop_current
=
cuCtxPopCurrent_v2
;
nvel
->
cu_ctx_destroy
=
cuCtxDestroy_v2
;
#else
LOAD_LIBRARY
(
nvel
->
cuda
,
CUDA_LIBNAME
);
LOAD_SYMBOL
(
nvel
->
cu_init
,
nvel
->
cuda
,
"cuInit"
);
...
...
@@ -159,6 +169,7 @@ static av_cold int nvenc_load_libraries(AVCodecContext *avctx)
LOAD_SYMBOL
(
nvel
->
cu_ctx_create
,
nvel
->
cuda
,
"cuCtxCreate_v2"
);
LOAD_SYMBOL
(
nvel
->
cu_ctx_pop_current
,
nvel
->
cuda
,
"cuCtxPopCurrent_v2"
);
LOAD_SYMBOL
(
nvel
->
cu_ctx_destroy
,
nvel
->
cuda
,
"cuCtxDestroy_v2"
);
#endif
LOAD_LIBRARY
(
nvel
->
nvenc
,
NVENC_LIBNAME
);
...
...
@@ -859,8 +870,10 @@ av_cold int ff_nvenc_encode_close(AVCodecContext *avctx)
if
(
ctx
->
nvel
.
nvenc
)
dlclose
(
ctx
->
nvel
.
nvenc
);
#if !CONFIG_CUDA
if
(
ctx
->
nvel
.
cuda
)
dlclose
(
ctx
->
nvel
.
cuda
);
#endif
return
0
;
}
...
...
libavcodec/nvenc.h
View file @
c51b2c79
...
...
@@ -22,6 +22,8 @@
#include <cuda.h>
#include <nvEncodeAPI.h>
#include "config.h"
#include "libavutil/fifo.h"
#include "libavutil/opt.h"
...
...
@@ -47,7 +49,9 @@ typedef NVENCSTATUS (NVENCAPI *PNVENCODEAPICREATEINSTANCE)(NV_ENCODE_API_FUNCTIO
typedef
struct
NVENCLibraryContext
{
#if !CONFIG_CUDA
void
*
cuda
;
#endif
void
*
nvenc
;
PCUINIT
cu_init
;
...
...
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