gpu_globals.cppGo to the documentation of this file.00001 /* 00002 Copyright (c) 2010, Paul Furgale and Chi Hay Tong 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are 00007 met: 00008 00009 * Redistributions of source code must retain the above copyright notice, 00010 this list of conditions and the following disclaimer. 00011 * Redistributions in binary form must reproduce the above copyright 00012 notice, this list of conditions and the following disclaimer in the 00013 documentation and/or other materials provided with the distribution. 00014 * The names of its contributors may not be used to endorse or promote 00015 products derived from this software without specific prior written 00016 permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00019 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00020 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00021 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 00022 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00023 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00024 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00026 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00027 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 */ 00030 00042 /* 00043 Copyright (c) 2010, Paul Furgale and Chi Hay Tong 00044 All rights reserved. 00045 00046 Redistribution and use in source and binary forms, with or without 00047 modification, are permitted provided that the following conditions are 00048 met: 00049 00050 * Redistributions of source code must retain the above copyright notice, 00051 this list of conditions and the following disclaimer. 00052 * Redistributions in binary form must reproduce the above copyright 00053 notice, this list of conditions and the following disclaimer in the 00054 documentation and/or other materials provided with the distribution. 00055 * The names of its contributors may not be used to endorse or promote 00056 products derived from this software without specific prior written 00057 permission. 00058 00059 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00060 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00061 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00062 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 00063 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00064 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00065 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00066 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00067 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00068 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00069 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00070 */ 00071 00072 00073 00074 /* 00075 Copyright (c) 2010, Paul Furgale and Chi Hay Tong 00076 All rights reserved. 00077 00078 Redistribution and use in source and binary forms, with or without 00079 modification, are permitted provided that the following conditions are 00080 met: 00081 00082 * Redistributions of source code must retain the above copyright notice, 00083 this list of conditions and the following disclaimer. 00084 * Redistributions in binary form must reproduce the above copyright 00085 notice, this list of conditions and the following disclaimer in the 00086 documentation and/or other materials provided with the distribution. 00087 * The names of its contributors may not be used to endorse or promote 00088 products derived from this software without specific prior written 00089 permission. 00090 00091 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00092 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00093 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00094 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 00095 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00096 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00097 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00098 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00099 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00100 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00101 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00102 */ 00103 00104 #include "gpu_globals.h" 00105 #include "GpuSurfOctave.hpp" 00106 #include "assert_macros.hpp" 00107 #include <cuda.h> 00108 00109 namespace asrl { 00110 00111 void init_globals(int imWidth, int imHeight, GpuSurfOctave * octaves, int nOctaves) 00112 { 00113 if(imWidth == get_s_initWidth() && imHeight == get_s_initHeight()) 00114 return; 00115 00116 00117 float hessian_scale[ASRL_SURF_MAX_OCTAVES*ASRL_SURF_MAX_INTERVALS]; 00118 SurfOctaveParameters params[ASRL_SURF_MAX_OCTAVES]; 00119 for(int r = 0; r < nOctaves; r++) 00120 { 00121 params[r] = (SurfOctaveParameters)octaves[r]; 00122 for(int c = 0; c < octaves[r].intervals(); c++) 00123 { 00124 hessian_scale[r*ASRL_SURF_MAX_INTERVALS + c] = octaves[r].scales()[c]; 00125 } 00126 } 00127 00128 cudaError_t err = cudaMemcpyToSymbol( (const char *)get_d_hessian_scale(), hessian_scale, ASRL_SURF_MAX_OCTAVES*ASRL_SURF_MAX_INTERVALS*sizeof(float)); 00129 ASRL_ASSERT_EQ(err,cudaSuccess, "Unable to copy cuda hessian scale parameter array: " << cudaGetErrorString(err)); 00130 00131 err = cudaMemcpyToSymbol((const char *)get_d_octave_params(), params, ASRL_SURF_MAX_OCTAVES*sizeof(SurfOctaveParameters)); 00132 ASRL_ASSERT_EQ(err,cudaSuccess, "Unable to copy cuda hessian parameter array: " << cudaGetErrorString(err)); 00133 00134 int stride = octaves[0].stride(); 00135 err = cudaMemcpyToSymbol((const char *)get_d_hessian_stride(), &stride, sizeof(int)); 00136 ASRL_ASSERT_EQ(err,cudaSuccess, "Unable to copy cuda hessian parameter array: " << cudaGetErrorString(err)); 00137 00138 00139 get_s_initWidth() = imWidth; 00140 get_s_initHeight() = imHeight; 00141 get_s_initialized() = true; 00142 00143 00144 } 00145 00146 } // namespace asrl Generated on Fri Apr 30 20:06:19 2010 for gpusurf by 1.6.2 |