Unified · Split
| @@ -56,6 +56,10 @@ · 55 unmodified lines | ||
| 56 | 56 | #include <sys/time.h> |
| 57 | 57 | #include <sys/resource.h> |
| 58 | 58 | #endif |
| 59 | +#if CONFIG_OPENCL | |
| 60 | +#include "libavutil/opencl.h" | |
| 61 | +#endif | |
| 62 | + | |
| 59 | 63 | |
| 60 | 64 | static int init_report(const char *env); |
| 61 | 65 | |
| @@ -955,6 +959,26 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg) · 893 unmodified lines | ||
| 955 | 959 | return 0; |
| 956 | 960 | } |
| 957 | 961 | |
| 962 | +#if CONFIG_OPENCL | |
| 963 | +int opt_opencl(void *optctx, const char *opt, const char *arg) | |
| 964 | +{ | |
| 965 | + char *key, *value; | |
| 966 | + const char *opts = arg; | |
| 967 | + int ret = 0; | |
| 968 | + while (*opts) { | |
| 969 | + ret = av_opt_get_key_value(&opts, "=", ":", 0, &key, &value); | |
| 970 | + if (ret < 0) | |
| 971 | + return ret; | |
| 972 | + ret = av_opencl_set_option(key, value); | |
| 973 | + if (ret < 0) | |
| 974 | + return ret; | |
| 975 | + if (*opts) | |
| 976 | + opts++; | |
| 977 | + } | |
| 978 | + return ret; | |
| 979 | +} | |
| 980 | +#endif | |
| 981 | + | |
| 958 | 982 | void print_error(const char *filename, int err) |
| 959 | 983 | { |
| 960 | 984 | char errbuf[128]; |
| @@ -90,6 +90,10 @@ int opt_cpuflags(void *optctx, const char *opt, const char *arg); · 89 unmodified lines | ||
| 90 | 90 | |
| 91 | 91 | int opt_codec_debug(void *optctx, const char *opt, const char *arg); |
| 92 | 92 | |
| 93 | +#if CONFIG_OPENCL | |
| 94 | +int opt_opencl(void *optctx, const char *opt, const char *arg); | |
| 95 | +#endif | |
| 96 | + | |
| 93 | 97 | /** |
| 94 | 98 | * Limit the execution time. |
| 95 | 99 | */ |
| @@ -19,3 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | { "report" , 0, {(void*)opt_report}, "generate a report" }, |
| 20 | 20 | { "max_alloc" , HAS_ARG, {.func_arg = opt_max_alloc}, "set maximum size of a single allocated block", "bytes" }, |
| 21 | 21 | { "cpuflags" , HAS_ARG | OPT_EXPERT, {.func_arg = opt_cpuflags}, "force specific cpu flags", "flags" }, |
| 22 | + #if CONFIG_OPENCL | |
| 23 | + { "opencl_options", HAS_ARG, {.func_arg = opt_opencl}, "set OpenCL environment options" }, | |
| 24 | + #endif | |