diff --git a/modules/java/generator/src/java/android+CameraBridgeViewBase.java b/modules/java/generator/src/java/android+CameraBridgeViewBase.java index 6c5c3294f..b15ae2bd8 100644 --- a/modules/java/generator/src/java/android+CameraBridgeViewBase.java +++ b/modules/java/generator/src/java/android+CameraBridgeViewBase.java @@ -80,6 +80,14 @@ public abstract class CameraBridgeViewBase extends SurfaceView implements Surfac mMaxHeight = MAX_UNSPECIFIED; styledAttrs.recycle(); } + + /** + * Sets the camera index + * @param camera index + */ + public void setCameraIndex(int cameraIndex) { + this.mCameraIndex = cameraIndex; + } public interface CvCameraViewListener { /** diff --git a/modules/nonfree/src/surf.ocl.cpp b/modules/nonfree/src/surf.ocl.cpp index 6839294a2..698168f0b 100644 --- a/modules/nonfree/src/surf.ocl.cpp +++ b/modules/nonfree/src/surf.ocl.cpp @@ -156,22 +156,12 @@ public: counters.setTo(Scalar::all(0)); integral(img, surf_.sum); - if(support_image2d()) + use_image2d = support_image2d(); + if(use_image2d) { - try - { - bindImgTex(img, imgTex); - bindImgTex(surf_.sum, sumTex); - use_image2d = true; - } - catch (const cv::Exception& e) - { - use_image2d = false; - if(e.code != CL_IMAGE_FORMAT_NOT_SUPPORTED && e.code != -217) - { - throw e; - } - } + bindImgTex(img, imgTex); + bindImgTex(surf_.sum, sumTex); + finish(); } maskSumTex = 0; diff --git a/modules/ocl/include/opencv2/ocl/private/util.hpp b/modules/ocl/include/opencv2/ocl/private/util.hpp index 2463fc279..355e3b50a 100644 --- a/modules/ocl/include/opencv2/ocl/private/util.hpp +++ b/modules/ocl/include/opencv2/ocl/private/util.hpp @@ -127,11 +127,18 @@ namespace cv // the enums are used to query device information enum DEVICE_INFO { - WAVEFRONT_SIZE, - IS_CPU_DEVICE + WAVEFRONT_SIZE, //in AMD speak + IS_CPU_DEVICE //check if the device is CPU }; template _ty queryDeviceInfo(cl_kernel kernel = NULL); + //info should have been pre-allocated + template<> + int CV_EXPORTS queryDeviceInfo(cl_kernel kernel); + template<> + size_t CV_EXPORTS queryDeviceInfo(cl_kernel kernel); + template<> + bool CV_EXPORTS queryDeviceInfo(cl_kernel kernel); //only these three specializations are implemented at the moment template<> diff --git a/modules/ocl/src/opencl/arithm_mul.cl b/modules/ocl/src/opencl/arithm_mul.cl index b2a11d710..f85362943 100644 --- a/modules/ocl/src/opencl/arithm_mul.cl +++ b/modules/ocl/src/opencl/arithm_mul.cl @@ -277,9 +277,15 @@ __kernel void arithm_mul_D6 (__global double *src1, int src1_step, int src1_offs } #endif +#ifdef DOUBLE_SUPPORT +#define SCALAR_TYPE double +#else +#define SCALAR_TYPE float +#endif + __kernel void arithm_muls_D5 (__global float *src1, int src1_step, int src1_offset, __global float *dst, int dst_step, int dst_offset, - int rows, int cols, int dst_step1, float scalar) + int rows, int cols, int dst_step1, SCALAR_TYPE scalar) { int x = get_global_id(0); int y = get_global_id(1); diff --git a/modules/ocl/src/tvl1flow.cpp b/modules/ocl/src/tvl1flow.cpp index 8362672d2..c2e85b6ae 100644 --- a/modules/ocl/src/tvl1flow.cpp +++ b/modules/ocl/src/tvl1flow.cpp @@ -472,4 +472,8 @@ void ocl_tvl1flow::warpBackward(const oclMat &I0, const oclMat &I1, oclMat &I1x, args.push_back( make_pair( sizeof(cl_int), (void*)&u2_offset_y)); openCLExecuteKernel(clCxt, &tvl1flow, kernelName, globalThread, localThread, args, -1, -1); + + releaseTexture(I1_tex); + releaseTexture(I1x_tex); + releaseTexture(I1y_tex); } diff --git a/modules/ts/misc/run.py b/modules/ts/misc/run.py index 435171371..a64127f0d 100755 --- a/modules/ts/misc/run.py +++ b/modules/ts/misc/run.py @@ -288,6 +288,16 @@ class TestSuite(object): if self.adb: # construct name for aapt tool self.aapt = [os.path.join(os.path.dirname(self.adb[0]), ("aapt","aapt.exe")[hostos == 'nt'])] + if not os.path.isfile(self.aapt[0]): + # it's moved in SDK r22 + sdk_dir = os.path.dirname( os.path.dirname(self.adb[0]) ) + aapt_fn = ("aapt", "aapt.exe")[hostos == 'nt'] + for r, ds, fs in os.walk( os.path.join(sdk_dir, 'build-tools') ): + if aapt_fn in fs: + self.aapt = [ os.path.join(r, aapt_fn) ] + break + else: + self.error = "Can't find '%s' tool!" % aapt_fn # fix has_perf_tests param self.has_perf_tests = self.has_perf_tests == "ON"