summaryrefslogtreecommitdiff
path: root/libavfilter/vf_scale_cuda.c
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2021-06-11 23:54:34 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2021-06-22 14:05:44 +0200
commit072788c46e36a21ca9e8f1e3cc19a1944db5b89c (patch)
tree105335f7b8f9ccc16e13000934aee86e8da1fc5d /libavfilter/vf_scale_cuda.c
parentabe150c9de6a096b14b6d623c5be49b19afe92b2 (diff)
avfilter: compress CUDA PTX code if possible
Diffstat (limited to 'libavfilter/vf_scale_cuda.c')
-rw-r--r--libavfilter/vf_scale_cuda.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/libavfilter/vf_scale_cuda.c b/libavfilter/vf_scale_cuda.c
index d97c7df273..c10938e96b 100644
--- a/libavfilter/vf_scale_cuda.c
+++ b/libavfilter/vf_scale_cuda.c
@@ -39,6 +39,7 @@
#include "scale_eval.h"
#include "video.h"
+#include "cuda/load_helper.h"
#include "vf_scale_cuda.h"
static const enum AVPixelFormat supported_formats[] = {
@@ -275,34 +276,41 @@ static av_cold int cudascale_config_props(AVFilterLink *outlink)
int w, h;
int ret;
- char *scaler_ptx;
+ const unsigned char *scaler_ptx;
+ unsigned int scaler_ptx_len;
const char *function_infix = "";
- extern char vf_scale_cuda_ptx[];
- extern char vf_scale_cuda_bicubic_ptx[];
+ extern const unsigned char ff_vf_scale_cuda_ptx_data[];
+ extern const unsigned int ff_vf_scale_cuda_ptx_len;
+ extern const unsigned char ff_vf_scale_cuda_bicubic_ptx_data[];
+ extern const unsigned int ff_vf_scale_cuda_bicubic_ptx_len;
switch(s->interp_algo) {
case INTERP_ALGO_NEAREST:
- scaler_ptx = vf_scale_cuda_ptx;
+ scaler_ptx = ff_vf_scale_cuda_ptx_data;
+ scaler_ptx_len = ff_vf_scale_cuda_ptx_len;
function_infix = "_Nearest";
s->interp_use_linear = 0;
s->interp_as_integer = 1;
break;
case INTERP_ALGO_BILINEAR:
- scaler_ptx = vf_scale_cuda_ptx;
+ scaler_ptx = ff_vf_scale_cuda_ptx_data;
+ scaler_ptx_len = ff_vf_scale_cuda_ptx_len;
function_infix = "_Bilinear";
s->interp_use_linear = 1;
s->interp_as_integer = 1;
break;
case INTERP_ALGO_DEFAULT:
case INTERP_ALGO_BICUBIC:
- scaler_ptx = vf_scale_cuda_bicubic_ptx;
+ scaler_ptx = ff_vf_scale_cuda_bicubic_ptx_data;
+ scaler_ptx_len = ff_vf_scale_cuda_bicubic_ptx_len;
function_infix = "_Bicubic";
s->interp_use_linear = 0;
s->interp_as_integer = 0;
break;
case INTERP_ALGO_LANCZOS:
- scaler_ptx = vf_scale_cuda_bicubic_ptx;
+ scaler_ptx = ff_vf_scale_cuda_bicubic_ptx_data;
+ scaler_ptx_len = ff_vf_scale_cuda_bicubic_ptx_len;
function_infix = "_Lanczos";
s->interp_use_linear = 0;
s->interp_as_integer = 0;
@@ -319,7 +327,7 @@ static av_cold int cudascale_config_props(AVFilterLink *outlink)
if (ret < 0)
goto fail;
- ret = CHECK_CU(cu->cuModuleLoadData(&s->cu_module, scaler_ptx));
+ ret = ff_cuda_load_module(ctx, device_hwctx, &s->cu_module, scaler_ptx, scaler_ptx_len);
if (ret < 0)
goto fail;