]> granicus.if.org Git - handbrake/commitdiff
OpenCL: cosmetics, nicer OpenCL binary file names.
authorRodeo <tdskywalker@gmail.com>
Thu, 6 Jun 2013 21:14:34 +0000 (21:14 +0000)
committerRodeo <tdskywalker@gmail.com>
Thu, 6 Jun 2013 21:14:34 +0000 (21:14 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/opencl@5572 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/openclwrapper.c

index 6ea89139c44f302c59789cc6e2f73f914b1cf949..a673226cf5b12159b227f6d312db10ddb91b9015 100644 (file)
@@ -262,24 +262,25 @@ int hb_binary_generated( cl_context context, const char * cl_file_name, FILE **
 \r
     status = 0;\r
     /* dump out each binary into its own separate file. */\r
-    for( i = 0; i < numDevices; i++ )\r
+    for (i = 0; i < numDevices; i++)\r
     {\r
-        char fileName[256] = {0};\r
-        char cl_name[128] = {0};\r
-        if( devices[i] != 0 )\r
+        char fileName[256] = { 0 };\r
+        char  cl_name[128] = { 0 };\r
+        if (devices[i])\r
         {\r
             char deviceName[1024];\r
-            status = clGetDeviceInfo( devices[i],\r
-                                      CL_DEVICE_NAME,\r
-                                      sizeof(deviceName),\r
-                                      deviceName,\r
-                                      NULL );\r
-            str = (char*)strstr( cl_file_name, (char*)".cl" );\r
-            memcpy( cl_name, cl_file_name, str - cl_file_name );\r
+            status = clGetDeviceInfo(devices[i],\r
+                                     CL_DEVICE_NAME,\r
+                                     sizeof(deviceName),\r
+                                     deviceName,\r
+                                     NULL);\r
+\r
+            str = (char*)strstr(cl_file_name, ".cl");\r
+            memcpy(cl_name, cl_file_name, str - cl_file_name);\r
             cl_name[str - cl_file_name] = '\0';\r
-            sprintf( fileName, "./%s-%s.bin", cl_name, deviceName );\r
-            fd = fopen( fileName, "rb" );\r
-            status = (fd != NULL) ? 1 : 0;\r
+            sprintf(fileName, "./%s - %s.bin", cl_name, deviceName);\r
+            fd = fopen(fileName, "rb");\r
+            status = fd != NULL;\r
         }\r
     }\r
 \r
@@ -409,25 +410,25 @@ int hb_generat_bin_from_kernel_source( cl_program program, const char * cl_file_
     }\r
 \r
     /* dump out each binary into its own separate file. */\r
-    for( i = 0; i < numDevices; i++ )\r
+    for (i = 0; i < numDevices; i++)\r
     {\r
         char fileName[256] = {0};\r
-        char cl_name[128] = {0};\r
-        if( binarySizes[i] != 0 )\r
+        char  cl_name[128] = {0};\r
+        if (binarySizes[i])\r
         {\r
             char deviceName[1024];\r
-            status = clGetDeviceInfo( devices[i],\r
-                                      CL_DEVICE_NAME,\r
-                                      sizeof(deviceName),\r
-                                      deviceName,\r
-                                      NULL );\r
-\r
-            str = (char*)strstr( cl_file_name, (char*)".cl" );\r
-            memcpy( cl_name, cl_file_name, str - cl_file_name );\r
+            status = clGetDeviceInfo(devices[i],\r
+                                     CL_DEVICE_NAME,\r
+                                     sizeof(deviceName),\r
+                                     deviceName,\r
+                                     NULL);\r
+\r
+            str = (char*)strstr(cl_file_name, ".cl");\r
+            memcpy(cl_name, cl_file_name, str - cl_file_name);\r
             cl_name[str - cl_file_name] = '\0';\r
-            sprintf( fileName, "./%s-%s.bin", cl_name, deviceName );\r
+            sprintf(fileName, "./%s - %s.bin", cl_name, deviceName);\r
 \r
-            if( !hb_write_binary_to_file( fileName, binaries[i], binarySizes[i] ))\r
+            if (!hb_write_binary_to_file(fileName, binaries[i], binarySizes[i]))\r
             {\r
                 hb_log("OpenCL: hb_generat_bin_from_kernel_source: unable to write kernel, writing to temporary directory instead.");\r
                 return 0;\r
@@ -1032,7 +1033,8 @@ int hb_init_opencl_run_env( int argc, char **argv, const char *build_option )
             return(1);\r
 \r
         /*initialize program, kernel_name, kernel_count*/\r
-        status = hb_compile_kernel_file( "hb-kernels.cl", &gpu_env, 0, build_option );\r
+        status = hb_compile_kernel_file("hb-opencl-kernels.cl",\r
+                                        &gpu_env, 0, build_option);\r
 \r
         if( status == 0 || gpu_env.kernel_count == 0 )\r
         {\r