X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fopencl.c;h=9c46cfdc09282ea2cd54179f48bb7c040febb7c9;hb=131f2c2712479a44332866b442526abe97e0c316;hp=ac5eec68c686912e53db1c134dfa5050101ba290;hpb=de33b3e457a656230fc6d544a1889218d77a5b3c;p=ffmpeg diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c index ac5eec68c68..9c46cfdc092 100644 --- a/libavfilter/opencl.c +++ b/libavfilter/opencl.c @@ -225,7 +225,7 @@ int ff_opencl_filter_load_program_from_file(AVFilterContext *avctx, const char *src_const; int err; - file = fopen(filename, "r"); + file = av_fopen_utf8(filename, "r"); if (!file) { av_log(avctx, AV_LOG_ERROR, "Unable to open program " "source file \"%s\".\n", filename); @@ -337,3 +337,26 @@ int ff_opencl_filter_work_size_from_image(AVFilterContext *avctx, return 0; } + +void ff_opencl_print_const_matrix_3x3(AVBPrint *buf, const char *name_str, + double mat[3][3]) +{ + int i, j; + av_bprintf(buf, "__constant float %s[9] = {\n", name_str); + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) + av_bprintf(buf, " %.5ff,", mat[i][j]); + av_bprintf(buf, "\n"); + } + av_bprintf(buf, "};\n"); +} + +cl_ulong ff_opencl_get_event_time(cl_event event) { + cl_ulong time_start; + cl_ulong time_end; + + clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_START, sizeof(time_start), &time_start, NULL); + clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_END, sizeof(time_end), &time_end, NULL); + + return time_end - time_start; +}