From 8bddf8ce4f3dcbb56edb12cee7e93f3a9daa3f96 Mon Sep 17 00:00:00 2001 From: Sascha Haeberling Date: Wed, 14 Aug 2013 11:20:34 -0700 Subject: Copy over libjni_mosaic from Camera. We need to support the SRI pano mode for Carlsbad. Change-Id: Id14e64d8248236e8170c12cfca2cbf2ca952e993 --- jni/feature_stab/db_vlvm/db_utilities_indexing.cpp | 120 +++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 jni/feature_stab/db_vlvm/db_utilities_indexing.cpp (limited to 'jni/feature_stab/db_vlvm/db_utilities_indexing.cpp') diff --git a/jni/feature_stab/db_vlvm/db_utilities_indexing.cpp b/jni/feature_stab/db_vlvm/db_utilities_indexing.cpp new file mode 100644 index 000000000..30ce03aa6 --- /dev/null +++ b/jni/feature_stab/db_vlvm/db_utilities_indexing.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: db_utilities_indexing.cpp,v 1.3 2011/06/17 14:03:31 mbansal Exp $ */ + +#include "db_utilities_indexing.h" +#include "db_utilities.h" + + + +/***************************************************************** +* Lean and mean begins here * +*****************************************************************/ + +void db_Zero(double *d,long nr) +{ + long i; + for(i=0;ipivot) *(d_top--)=temp; + } + *first_equal=d_bottom-dest; + *last_equal=d_top-dest; +} + +double db_LeanQuickSelect(const double *s,long nr_elements,long pos,double *temp) +{ + long first=0; + long last=nr_elements-1; + double pivot; + long first_equal,last_equal; + double *tempA; + double *tempB; + double *tempC; + const double *source; + double *dest; + + tempA=temp; + tempB=temp+nr_elements; + source=s; + dest=tempA; + + for(;last-first>2;) + { + pivot=db_TripleMedian(source[first],source[last],source[(first+last)/2]); + db_LeanPartitionOnPivot(pivot,dest,source,first,last,&first_equal,&last_equal); + + if(first_equal>pos) last=first_equal-1; + else if(last_equal