summaryrefslogtreecommitdiffstats
path: root/libhb/work.c
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-11-08 21:21:02 +0000
committerRodeo <[email protected]>2013-11-08 21:21:02 +0000
commit43f0bc9d538c86ea75a5cd627a81452e9d76b825 (patch)
treea6bde5c2174543e4ea282ab26b6a2c76829105eb /libhb/work.c
parentd0a2953efbce340e34a971b9481024a51ae52383 (diff)
OpenCL: use the new library loading architecture for all OpenCL code.
An OpenCL SDK is no longer needed to build OpenCL support. Note: as a result, the --enable-opencl configure option is removed. Also, libOpenCL is no longer needed to run the application (it is still necessary to use OpenCL features, of course). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5886 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/work.c')
-rw-r--r--libhb/work.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/libhb/work.c b/libhb/work.c
index b63925359..43dbdeaaa 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -11,6 +11,7 @@
#include "a52dec/a52.h"
#include "libavformat/avformat.h"
#include "openclwrapper.h"
+#include "opencl.h"
#ifdef USE_QSV
#include "qsv_common.h"
@@ -539,13 +540,13 @@ static void do_job(hb_job_t *job)
job->list_work = hb_list_init();
-#ifdef USE_OPENCL
- /* init opencl environment */
- if (job->use_opencl)
- job->use_opencl = !hb_init_opencl_run_env(0, NULL, "-I.");
-#else
- job->use_opencl = 0;
-#endif
+ /* OpenCL */
+ if (job->use_opencl && (hb_ocl_init() || hb_init_opencl_run_env(0, NULL, "-I.")))
+ {
+ hb_log("work: failed to initialize OpenCL environment, using fallback");
+ job->use_opencl = 0;
+ hb_ocl_close();
+ }
hb_log( "starting job" );
@@ -856,9 +857,10 @@ static void do_job(hb_job_t *job)
init.pix_fmt = AV_PIX_FMT_YUV420P;
init.width = title->width;
init.height = title->height;
-#ifdef USE_OPENCL
- init.use_dxva = hb_use_dxva( title );
-#endif
+
+ /* DXVA2 */
+ init.use_dxva = hb_use_dxva(title);
+
init.par_width = job->anamorphic.par_width;
init.par_height = job->anamorphic.par_height;
memcpy(init.crop, title->crop, sizeof(int[4]));
@@ -1615,6 +1617,12 @@ cleanup:
hb_buffer_pool_free();
hb_job_close( &job );
+
+ /* OpenCL: must be closed *after* freeing the buffer pool */
+ if (job->use_opencl)
+ {
+ hb_ocl_close();
+ }
}
static inline void copy_chapter( hb_buffer_t * dst, hb_buffer_t * src )