Commit d81d3fc8 authored by Roman Donchenko's avatar Roman Donchenko Committed by OpenCV Buildbot

Merge pull request #921 from SpecLad:merge-2.4

parents 56121d01 5ac3b8d5
...@@ -80,6 +80,14 @@ public abstract class CameraBridgeViewBase extends SurfaceView implements Surfac ...@@ -80,6 +80,14 @@ public abstract class CameraBridgeViewBase extends SurfaceView implements Surfac
mMaxHeight = MAX_UNSPECIFIED; mMaxHeight = MAX_UNSPECIFIED;
styledAttrs.recycle(); styledAttrs.recycle();
} }
/**
* Sets the camera index
* @param camera index
*/
public void setCameraIndex(int cameraIndex) {
this.mCameraIndex = cameraIndex;
}
public interface CvCameraViewListener { public interface CvCameraViewListener {
/** /**
......
...@@ -156,22 +156,12 @@ public: ...@@ -156,22 +156,12 @@ public:
counters.setTo(Scalar::all(0)); counters.setTo(Scalar::all(0));
integral(img, surf_.sum); integral(img, surf_.sum);
if(support_image2d()) use_image2d = support_image2d();
if(use_image2d)
{ {
try bindImgTex(img, imgTex);
{ bindImgTex(surf_.sum, sumTex);
bindImgTex(img, imgTex); finish();
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;
}
}
} }
maskSumTex = 0; maskSumTex = 0;
......
...@@ -127,11 +127,18 @@ namespace cv ...@@ -127,11 +127,18 @@ namespace cv
// the enums are used to query device information // the enums are used to query device information
enum DEVICE_INFO enum DEVICE_INFO
{ {
WAVEFRONT_SIZE, WAVEFRONT_SIZE, //in AMD speak
IS_CPU_DEVICE IS_CPU_DEVICE //check if the device is CPU
}; };
template<DEVICE_INFO _it, typename _ty> template<DEVICE_INFO _it, typename _ty>
_ty queryDeviceInfo(cl_kernel kernel = NULL); _ty queryDeviceInfo(cl_kernel kernel = NULL);
//info should have been pre-allocated
template<>
int CV_EXPORTS queryDeviceInfo<WAVEFRONT_SIZE, int>(cl_kernel kernel);
template<>
size_t CV_EXPORTS queryDeviceInfo<WAVEFRONT_SIZE, size_t>(cl_kernel kernel);
template<>
bool CV_EXPORTS queryDeviceInfo<IS_CPU_DEVICE, bool>(cl_kernel kernel);
//only these three specializations are implemented at the moment //only these three specializations are implemented at the moment
template<> template<>
......
...@@ -277,9 +277,15 @@ __kernel void arithm_mul_D6 (__global double *src1, int src1_step, int src1_offs ...@@ -277,9 +277,15 @@ __kernel void arithm_mul_D6 (__global double *src1, int src1_step, int src1_offs
} }
#endif #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, __kernel void arithm_muls_D5 (__global float *src1, int src1_step, int src1_offset,
__global float *dst, int dst_step, int dst_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 x = get_global_id(0);
int y = get_global_id(1); int y = get_global_id(1);
......
...@@ -472,4 +472,8 @@ void ocl_tvl1flow::warpBackward(const oclMat &I0, const oclMat &I1, oclMat &I1x, ...@@ -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)); args.push_back( make_pair( sizeof(cl_int), (void*)&u2_offset_y));
openCLExecuteKernel(clCxt, &tvl1flow, kernelName, globalThread, localThread, args, -1, -1); openCLExecuteKernel(clCxt, &tvl1flow, kernelName, globalThread, localThread, args, -1, -1);
releaseTexture(I1_tex);
releaseTexture(I1x_tex);
releaseTexture(I1y_tex);
} }
...@@ -288,6 +288,16 @@ class TestSuite(object): ...@@ -288,6 +288,16 @@ class TestSuite(object):
if self.adb: if self.adb:
# construct name for aapt tool # construct name for aapt tool
self.aapt = [os.path.join(os.path.dirname(self.adb[0]), ("aapt","aapt.exe")[hostos == 'nt'])] 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 # fix has_perf_tests param
self.has_perf_tests = self.has_perf_tests == "ON" self.has_perf_tests = self.has_perf_tests == "ON"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment