<commit_before>//
// Created by sebastian on 15.11.17.
//

#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <lamure/vt/pre/Preprocessor.h>
#include <lamure/vt/pre/AtlasFile.h>
#include <lamure/vt/ooc/TileProvider.h>
#include <lamure/vt/pre/DeltaECalculator.h>
#include <thread>

using namespace vt::pre;

Bitmap::PIXEL_FORMAT parsePixelFormat(const char *formatStr){
    if(std::strcmp(formatStr, "r") == 0){
        return Bitmap::PIXEL_FORMAT::R8;
    }else if(std::strcmp(formatStr, "rgb") == 0){
        return Bitmap::PIXEL_FORMAT::RGB8;
    }else if(std::strcmp(formatStr, "rgba") == 0){
        return Bitmap::PIXEL_FORMAT::RGBA8;
    }else{
        throw std::runtime_error("Invalid pixel format given.");
    }
}

AtlasFile::LAYOUT parseFileFormat(const char *formatStr){
    if(std::strcmp(formatStr, "raw") == 0){
        return AtlasFile::LAYOUT::RAW;
    }else if(std::strcmp(formatStr, "packed") == 0){
        return AtlasFile::LAYOUT::PACKED;
    }else{
        throw std::runtime_error("Invalid file format given.");
    }
}

const char *printLayout(AtlasFile::LAYOUT layout){
    switch(layout){
        case AtlasFile::LAYOUT::RAW:
            return "raw";
        case AtlasFile::LAYOUT::PACKED:
            return "packed";
    }
}

const char *printPxFormat(Bitmap::PIXEL_FORMAT pxFormat){
    switch(pxFormat){
        case Bitmap::PIXEL_FORMAT::R8:
            return "R8";
        case Bitmap::PIXEL_FORMAT::RGB8:
            return "RGB8";
        case Bitmap::PIXEL_FORMAT::RGBA8:
            return "RGBA8";
    }
}

int process(const int argc, const char **argv){
    if(argc != 11){
        std::cout << "Wrong count of parameters." << std::endl;
        std::cout << "Expected parameters:" << std::endl;
        std::cout << "\t<image file> <image pixel format (r, rgb, rgba)>" << std::endl;
        std::cout << "\t<image width> <image height>" << std::endl;
        std::cout << "\t<tile width> <tile height> <padding>" << std::endl;
        std::cout << "\t<out file (without extension)> <out pixel format (r, rgb, rgba)>" << std::endl;
        std::cout << "\t<max memory usage>" << std::endl;<commit_msg>corrected param count for preprocessing<commit_after>//
// Created by sebastian on 15.11.17.
//

#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <lamure/vt/pre/Preprocessor.h>
#include <lamure/vt/pre/AtlasFile.h>
#include <lamure/vt/ooc/TileProvider.h>
#include <lamure/vt/pre/DeltaECalculator.h>
#include <thread>

using namespace vt::pre;

Bitmap::PIXEL_FORMAT parsePixelFormat(const char *formatStr){
    if(std::strcmp(formatStr, "r") == 0){
        return Bitmap::PIXEL_FORMAT::R8;
    }else if(std::strcmp(formatStr, "rgb") == 0){
        return Bitmap::PIXEL_FORMAT::RGB8;
    }else if(std::strcmp(formatStr, "rgba") == 0){
        return Bitmap::PIXEL_FORMAT::RGBA8;
    }else{
        throw std::runtime_error("Invalid pixel format given.");
    }
}

AtlasFile::LAYOUT parseFileFormat(const char *formatStr){
    if(std::strcmp(formatStr, "raw") == 0){
        return AtlasFile::LAYOUT::RAW;
    }else if(std::strcmp(formatStr, "packed") == 0){
        return AtlasFile::LAYOUT::PACKED;
    }else{
        throw std::runtime_error("Invalid file format given.");
    }
}

const char *printLayout(AtlasFile::LAYOUT layout){
    switch(layout){
        case AtlasFile::LAYOUT::RAW:
            return "raw";
        case AtlasFile::LAYOUT::PACKED:
            return "packed";
    }
}

const char *printPxFormat(Bitmap::PIXEL_FORMAT pxFormat){
    switch(pxFormat){
        case Bitmap::PIXEL_FORMAT::R8:
            return "R8";
        case Bitmap::PIXEL_FORMAT::RGB8:
            return "RGB8";
        case Bitmap::PIXEL_FORMAT::RGBA8:
            return "RGBA8";
    }
}

int process(const int argc, const char **argv){
    if(argc != 10){
        std::cout << "Wrong count of parameters." << std::endl;
        std::cout << "Expected parameters:" << std::endl;
        std::cout << "\t<image file> <image pixel format (r, rgb, rgba)>" << std::endl;
        std::cout << "\t<image width> <image height>" << std::endl;
        std::cout << "\t<tile width> <tile height> <padding>" << std::endl;
        std::cout << "\t<out file (without extension)> <out pixel format (r, rgb, rgba)>" << std::endl;
        std::cout << "\t<max memory usage>" << std::endl;
{'fraction_non_alphanumeric': 0.16826265389876882, 'fraction_numerical': 0.010031919744642043, 'mean_word_length': 3.3565044687189673, 'pattern_counts': {'":': 0, '<': 97, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4986324', 'n_tokens_mistral': 1502, 'n_tokens_neox': 1452, 'n_words': 331}