void ExtractKyra::execute() {
	Common::Filename inputpath(_inputPaths[0].path);

	Extractor *extract = 0;
	if (isHoFInstaller) {
		extract = new HoFInstaller(inputpath.getFullPath().c_str());
	} else {
		PAKFile *myfile = new PAKFile;
		if (!myfile->loadFile(inputpath.getFullPath().c_str(), isAmiga)) {
			delete myfile;
			error("Couldn't load file '%s'", inputpath.getFullPath().c_str());
		}

		extract = myfile;
	}

	// Everything has been decided, do the actual extraction
	if (extractAll) {
		extract->outputAllFiles(&_outputPath);
	} else if (extractOne) {
		inputpath.setFullName(singleFilename);
		extract->outputFileAs(singleFilename.c_str(), inputpath.getFullPath().c_str());
	} else {
		extract->drawFileList();
	}

	delete extract;
}
void computeDisplacement(Extractor ex, const SkVector& scale, SkBitmap* dst,
                         const SkBitmap& displ, const SkIPoint& offset,
                         const SkBitmap& src,
                         const SkIRect& bounds) {
    static const SkScalar Inv8bit = SkScalarInvert(255);
    const int srcW = src.width();
    const int srcH = src.height();
    const SkVector scaleForColor = SkVector::Make(scale.fX * Inv8bit, scale.fY * Inv8bit);
    const SkVector scaleAdj = SkVector::Make(SK_ScalarHalf - scale.fX * SK_ScalarHalf,
                                             SK_ScalarHalf - scale.fY * SK_ScalarHalf);
    SkPMColor* dstPtr = dst->getAddr32(0, 0);
    for (int y = bounds.top(); y < bounds.bottom(); ++y) {
        const SkPMColor* displPtr = displ.getAddr32(bounds.left() + offset.fX, y + offset.fY);
        for (int x = bounds.left(); x < bounds.right(); ++x, ++displPtr) {
            SkPMColor c = unpremul_pm(*displPtr);

            SkScalar displX = scaleForColor.fX * ex.getX(c) + scaleAdj.fX;
            SkScalar displY = scaleForColor.fY * ex.getY(c) + scaleAdj.fY;
            // Truncate the displacement values
            const int32_t srcX = Sk32_sat_add(x, SkScalarTruncToInt(displX));
            const int32_t srcY = Sk32_sat_add(y, SkScalarTruncToInt(displY));
            *dstPtr++ = ((srcX < 0) || (srcX >= srcW) || (srcY < 0) || (srcY >= srcH)) ?
                      0 : *(src.getAddr32(srcX, srcY));
        }
    }
}
示例#3
0
 int main( int argc, char** argv )
 {
   if (argc != 5) {
     cout<<"Need 4 arguments:\nembed or extract\nPath to cover image\nPath to destination stego image\nPayload bits to be embedded"<<endl;
     exit(1);
   }
   Detector detector;
   detector.surf_detect(argv[2]);
   
   //initialize variables for embeder and extractor
   Embeder embeder;
   Extractor extractor;
   string wavelet_name = "bior4.4";
   vector<double> dwt_output, flag;
   vector<int> length;
   int rows, cols;
   Mat mat_G, mat_B;
   bool full;
   int J = 1;
   string message = argv[4];
   
   if (strncmp(argv[1],"embed", 2) == 0) {
     //data embeding
     embeder.data_embed(argv[2], J, wavelet_name, dwt_output, flag, length, rows, cols, full, message, argv[3]);
   }
   if (strncmp(argv[1],"extract", 2) == 0) {
     //data extracting
     extractor.data_extract(argv[3], J, wavelet_name, dwt_output, flag, length, rows, cols, message);
   }
   
   return 0;
}
示例#4
0
文件: extracter.cpp 项目: aa755/cfg3d
int main(int argc, char** argv) {
    ros::init(argc, argv, "Extractor");
    Extractor p;

    p.initialize(std::string(argv[1]));
    int i = 0;
    while(i < 1000 && p.compute_object(i)) {
        i++;
    }

    return (0);
}
void check_file(
    Extractor& src, const ar::iso::header& head, const std::string& data)
{
    BOOST_REQUIRE(src.next_entry());

    ::check_header(head, src.header());

    std::string data2;
    io::copy(src, io::back_inserter(data2));

    BOOST_CHECK_EQUAL_COLLECTIONS(
        data.begin(), data.end(), data2.begin(), data2.end()
    );
}
示例#6
0
 // find in which bucket a key is (just basic modulo)
 int get_key(const Key &K) {
   if(BUFFER) return BUFFER[K.index];
   int k = E->extract(K);
   k %= N;
   if(k < 0) k += N;
   return k;
 }
示例#7
0
int
main(int argc,char *argv[])
{
  tokenlist args;
  // extent relative to origin and voxel sizes of new file

  args.Transfer(argc-1,argv+1);
  if (args.size() < 1) {
    extractmask_help();
    exit(0);
  }
  Extractor ee;
  ee.init(args);
  // FIXME check for small (close to 0) voxel sizes
  ee.Go();
  exit(0);
}
示例#8
0
int main( int argc, char** argv)
{
  Extractor*          pcExtractor = NULL;
  ExtractorParameter  cParameter;

  printf( "JSVM %s BitStream Extractor \n\n", _JSVM_VERSION_ );

  RNOKRS( cParameter.init       ( argc, argv ),   -2 );

  for( Int n = 0; n < 1; n++ )
  {
    RNOKR( Extractor::create    ( pcExtractor ),  -3 );

    RNOKR( pcExtractor->init    ( &cParameter ),  -4 );

    RNOKR( pcExtractor->go      (),               -5 );

    RNOKR( pcExtractor->destroy (),               -6 );
  }

  return 0;
}
示例#9
0
void getRectangles(const std::string &filename, std::vector<Flap> &rects) {
  Extractor p;

  // Get planes from point cloud
  std::vector<pcl::PointCloud<Point>::ConstPtr > segments;
  std::vector<pcl::ModelCoefficients::Ptr> coefficients;
  p.initializeFromFilename(filename);
  int i = 0;
  while ((i < 9) && (p.compute_object(i, segments, coefficients))) {
    std::vector<Eigen::Vector3f> corners;
    Flap rect = {segments.at(i), coefficients.at(i), corners};
    // this_flap.segment = segments.at(i);
    // this_flap.normal = coefficients.at(i);
    // this_flap.corners = corners;
    fitPlaneToRect(rect);

    rects.push_back(rect);
    i++;
  }

  std::cout << "num planes found: " << rects.size() << std::endl;
}
示例#10
0
文件: digger.cpp 项目: mapme/poedit
bool SourceDigger::DigFiles(TempDirectory& tmpdir,
                            wxArrayString& outFiles,
                            const wxArrayString& files,
                            Extractor &extract, const wxArrayString& keywords,
                            const wxString& charset)
{
    wxArrayString batchfiles;
    wxArrayString tempfiles;
    size_t i, last = 0;

    while (last < files.GetCount())
    {
        batchfiles.clear();
        for (i = last; i < last + BATCH_SIZE && i < files.size(); i++)
            batchfiles.Add(files[i]);
        last = i;

        wxString tempfile = tmpdir.CreateFileName("extracted.pot");
        if (!ExecuteGettext(
                    extract.GetCommand(batchfiles, keywords, tempfile, charset)))
        {
            return false;
        }

        tempfiles.push_back(tempfile);

        m_progressInfo->UpdateGauge((int)batchfiles.GetCount());

        if (m_progressInfo->Cancelled())
            return false;
    }

    if ( tempfiles.empty() )
        return false; // failed to parse any source files

    wxString outfile = tmpdir.CreateFileName("merged_chunks.pot");
    if ( !ConcatCatalogs(tempfiles, outfile) )
        return false;

    outFiles.push_back(outfile);
    return true;
}
示例#11
0
int main (int argc, char *argv[])
{
    int i,r;
    Extractor *ext;

    if(argc<2){
	cout << "Usage: program <debian packadge> [<debian packadge>]" << endl;
	return 1;
    }

    for(i=1;i<argc;i++){ //multiple inputs
    r=0;
    ext = new Extractor();
    /*
     * this prints to standard out name of debian packadge
     * Note: if it's non-debian packadge, then program will end at first
     * check of content of Ar archive and clean
     */
    cout << argv[1] << endl;
    ext->setSource(argv[i]);
    r = ext->loadUnpackArchive(0);
    if (r!=0){
    	/*
    	 * if error occurs inform user
    	 */
    	cout << "Error in extracting debian type archive!" <<endl;
    	cout << "Purging new files end directories it they are created..." << endl;
    	cout << ext->getParent() << endl;
    	ext->deleteDirectoryRmR(ext->getParent());
    	cout << "Task is done.Exiting." << endl;
	delete(ext);
	return 1;
    }else cout << "Extracted!" << endl;
		/*
		 * if all is ok inform user
		 */

    delete(ext);
    /*
     * before continuing loading another archive environment path must be the initial path
     */
    chdir("../");
    }

    return 0;
}
示例#12
0
 string print() {
   ostringstream S;
   S << "_PAIR(new " << E1->print() << ",new " << E2->print() << "," << A1 << "," << A2 << "," << d1 << "," << d2 << ")";
   return S.str();
 }
示例#13
0
 int extract(const Key &K) {
   int v1 = E1->extract(K);
   int v2 = E2->extract(K);
   return A1*(v1/d1) + A2*(v2/d2);
 }
示例#14
0
 // Usefull to generate the code that will initialize the submitted solution.
 string print() {
   ostringstream S;
   S << "Bucket(" << N << ", new " << E->print() << "," << alpha << ")";
   return S.str();
 }
示例#15
0
    /*
     * This method is "universal" extractor modified for debian packadges
     */
    int loadUnpackArchive(int deb){
    	Extractor *secondExtractor;
    	int flags,i,code=0;

    	const char *filename;

    	this->ar = archive_read_new();
    	archive_read_support_format_all(this->ar);
    	archive_read_support_compression_all(this->ar);
    	r = archive_read_open_filename(this->ar, this->filename, 10240);
    	if (r != ARCHIVE_OK)
    		return 1;
       	flags = ARCHIVE_EXTRACT_TIME;
    	flags |= ARCHIVE_EXTRACT_PERM;
    	flags |= ARCHIVE_EXTRACT_ACL;
    	flags |= ARCHIVE_EXTRACT_FFLAGS;

    	/*
    	 * with another archive files and folders will be written to root folder
    	 */
    	this->createSetWorkingDir();
    	this->ext = archive_write_disk_new();
    	archive_write_disk_set_options(this->ext, flags);
    	archive_write_disk_set_standard_lookup(this->ext);

    	i=0;
		while (archive_read_next_header(this->ar, &entry) == ARCHIVE_OK) {
			/*
			 * while ar archive has files (its normal to be 3, and first is always debian-binary
			 * second and third must bi control and data
			 * othervise it isn't debian packadge
			 */
			if(deb==0 && i==3) return 1;
			filename = archive_entry_pathname(entry);
			if(deb==0 && i==0 && strcmp("debian-binary",filename)!=0) return -1;
			this->newfilename = this->setFilename(filename,deb);
			if (deb==0 && i>0){
				this->files.push_back(string(this->newfilename));

			}
			if (archive_entry_size(entry) > 0) {
    			r = archive_write_header(this->ext, entry);
    			if (r != ARCHIVE_OK)
    			    return 1;
    			r = this->copy_data();
    			if (r!=0) return r;
			this->deleteNameFilename();
    		}
    		i++;
    	}
    	r = archive_read_close(this->ar);
    	if (r != ARCHIVE_OK)
    		return 1;
    	r = archive_write_finish_entry(ext);
    	archive_write_close(ext);
    	if (deb==0 && this->files.size()>0){
    		/*
    		 * here are two recursve calls to extract other two subarchives
    		 * previously extracted from ar archive.
    		 * Because gouping into folders is needed, environment location
    		 * is changing with createSetWorkingDir() above and with chdir()
    		 * after extraction
    		 */

    		for(vector< string >::iterator iter = this->files.begin();iter<this->files.end();iter++){
    			secondExtractor = new Extractor();
    			secondExtractor->setSource((char *)(*iter).c_str());

			      /*
			       * Checking that control and data exist
			       */
			      if(((*iter).substr(0,(*iter).find('.'))).compare("data")!=0){
				      code=code+3;
			      }else if(((*iter).substr(0,(*iter).find('.'))).compare("control")!=0){
				      code=code+5;
			      }else{
				      code=10; //any number bigger than 5+3
			      }

			      if(iter==this->files.end()-1 && code!=8){ //if third file in ar archive is now check this rule
				      return 1;
			      }

    			r = secondExtractor->loadUnpackArchive(1);
    			delete(secondExtractor);
    			chdir("../");
    			remove_all((*iter).c_str());
			if (r!=0) return 1;

    		}
    	}

    	return 0;
    };
示例#16
0
	BitrateCalculator()
		: Extractor()
		, bits(0.0){

		set_formatter(FORMAT_DEFAULT);
	}