/* 16*sizeof(int) -> 1 or 2 cachelines */ /* table lookup might be faster! (still to be benchmarked) */ /* static int log2bin_table[16] = { 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4}; */ /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ #define RDIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) #define RSHIFT(a,b) ( (a)>0 ? ((a) + (1<<((b)-1)))>>(b) : ((a) + (1<<((b)-1))-1)>>(b)) #define MLT(i) (((16-(i))<<16) + (i)) static const uint32_t MTab[16] = { MLT( 0), MLT( 1), MLT( 2), MLT( 3), MLT( 4), MLT( 5), MLT( 6), MLT( 7), MLT( 8), MLT( 9), MLT(10), MLT(11), MLT(12), MLT(13), MLT(14), MLT(15) }; #undef MLT /* ************************************************************ * Pts = 2 or 3 * * Warning! *src is the global frame pointer (that is: adress * of pixel 0,0), not the macroblock one. * Conversely, *dst is the macroblock top-left adress. */ static void Predict_16x16_C(const NEW_GMC_DATA * const This, uint8_t *dst, const uint8_t *src,
int main(int argc, char *argv[]) { if (argc <= 1) { return 0; } try { DptInit(); bool compilePathLib = false; bool compileBidirPathLib = false; int maxDervDepth = 6; std::vector<std::string> filenames; for (int i = 1; i < argc; ++i) { if (std::string(argv[i]) == "--compile-pathlib") { compilePathLib = true; } else if (std::string(argv[i]) == "--compile-bidirpathlib") { compileBidirPathLib = true; } else if (std::string(argv[i]) == "--max-derivatives-depth") { maxDervDepth = std::stoi(std::string(argv[++i])); } else { filenames.push_back(std::string(argv[i])); } } if (compilePathLib) { CompilePathFuncLibrary(false, maxDervDepth); } if (compileBidirPathLib) { CompilePathFuncLibrary(true, maxDervDepth); } std::string cwd = getcwd(NULL, 0); for (std::string filename : filenames) { if (filename.rfind('/') != std::string::npos && chdir(filename.substr(0, filename.rfind('/')).c_str()) != 0) { Error("chdir failed"); } if (filename.rfind('/') != std::string::npos) { filename = filename.substr(filename.rfind('/') + 1); } std::unique_ptr<const Scene> scene = ParseScene(filename); std::string integrator = scene->options->integrator; if (integrator == "mc") { std::shared_ptr<const PathFuncLib> library = BuildPathFuncLibrary(scene->options->bidirectional, maxDervDepth); PathTrace(scene.get(), library); } else if (integrator == "mcmc") { std::shared_ptr<const PathFuncLib> library = BuildPathFuncLibrary(scene->options->bidirectional, maxDervDepth); MLT(scene.get(), library); } else { Error("Unknown integrator"); } WriteImage(scene->outputName, GetFilm(scene->camera.get()).get()); if (chdir(cwd.c_str()) != 0) { Error("chdir failed"); } } DptCleanup(); } catch (std::exception &ex) { std::cerr << ex.what() << std::endl; } return 0; }