Exemplo n.º 1
0
void htmInterface::makeRange() {

  if(idList_.length() == 0)return;
  uint64 level = 1;
  size_t depth = index_->maxlevel_;
  size_t n =  (depth+2) * 2 - 1;
  level = level << n;

  htmRange r;
  size_t i,j=0;

  // make the first range
  r.lo = idList_(0);
  r.hi = r.lo;

  while ( (r.lo & level) == 0 ) {
    r.lo = r.lo << 2;
    r.hi = (r.hi << 2) + 3;
  }
  range_.append(r);


  for(i= 1; i < idList_.length(); i++ ) {
    r.lo = idList_(i);
    r.hi = r.lo;

    while ( (r.lo & level) == 0 ) {
      r.lo = r.lo << 2;
      r.hi = (r.hi << 2) + 3;
    }


    // handle overlapping ranges: next lo just after previous hi
    if(r.lo <= range_(j).hi + 1) {
      if(r.hi > range_(j).hi) // replace hi with new one if higher
	range_(j).hi = r.hi;
      continue;
    }

    j++;
    range_.append(r);
  }

}
JNIEXPORT jint JNICALL
Java_com_h6ah4i_android_media_opensl_audiofx_OpenSLVisualizer_getCaptureSizeRangeImplNative(JNIEnv *env, jclass clazz,
                                                                                            jintArray range) noexcept
{
    jint_array range_(env, range);

    if (!range_) {
        return OSLMP_RESULT_ERROR;
    }

    size_t values[2] = { 0, 0 };

    int result = oslmp::OpenSLMediaPlayerVisualizer::sGetCaptureSizeRange(&values[0]);

    range_[0] = static_cast<jint>(values[0]);
    range_[1] = static_cast<jint>(values[1]);

    return result;
}