Beispiel #1
0
void light_run_processor(Pixel_t * pixels, const SortPlan_t * plan) {
	const int length = plan->run_length, threshold = get_threshold(plan->context_ptr);
	Pixel_t * cursor = pixels;
	while(length > (cursor - pixels)) {
		Pixel_t * start = cursor + get_first_non_light(cursor, plan->sort_val_fn, length - (cursor - pixels), threshold);
		Pixel_t * end = start + get_first_light(start, plan->sort_val_fn, length - (start - pixels), threshold);
		sort_run(start, end - start, plan->compare_fn);
		cursor = end;
	}
}
Beispiel #2
0
void dark_run_processor(pixel_t * pixels, const sort_plan_t * plan_ptr)
{
    const int length = plan_ptr->run_length, threshold = plan_ptr->context_ptr->threshold;
    pixel_t * cursor = pixels;
    while(length > (cursor - pixels)) {
        pixel_t * start = cursor + get_first_non_dark(cursor, plan_ptr->sort_val_fn, length - (cursor - pixels), threshold);
        pixel_t * end = start + get_first_dark(start, plan_ptr->sort_val_fn, length - (start - pixels), threshold);
        sort_run(start, end - start, plan_ptr->compare_fn);
        cursor = end;
    }
}
Beispiel #3
0
void sort_file( indri::file::File& out, indri::file::File& in, size_t memory, int totalDocuments ) {
  UINT64 length = in.size();
  size_t rounded = (memory / 12) * 12;
    
  UINT64 total = 0;
  std::vector<std::string> temporaries;

  while( length > total ) {
    UINT64 chunk = lemur_compat::min<UINT64>( rounded, length - total );
    indri::file::File tempIn;
    indri::file::File tempOut;
    std::string nameIn;
    std::string nameOut;
  
    tempIn.openTemporary( nameIn );
    tempOut.openTemporary( nameOut );

    // make a sorted run
    copy_region( tempIn, in, total, chunk );
    sort_run( tempOut, tempIn, memory );
    
    tempIn.close();
    tempOut.close();
    lemur_compat::remove( nameIn.c_str() );
    temporaries.push_back( nameOut );
    
    total += chunk;
  }

  in.close();
  merge_sorted_runs( out, temporaries, totalDocuments );
  
  for( size_t i=0; i<temporaries.size(); i++ ) {
    lemur_compat::remove( temporaries[i].c_str() );
  }
}
Beispiel #4
0
void default_run_processor(Pixel_t * pixels, const SortPlan_t * plan) {
	sort_run(pixels, plan->run_length, plan->compare_fn);
}