void Compression::LoadRawVideo(std::vector<std::vector<std::vector<unsigned char> > > &video) { if(video.size()){ video.clear(); } std::fstream raw(path,std::ios::binary | std::ios::in); std::fstream raw_end(path,std::ios::binary | std::ios::in | std::ios::ate); total_frame = raw_end.tellg() / (raw_width * raw_height); for(int f = 0;f < raw_end.tellg() / (raw_width * raw_height);++f){ std::vector<std::vector<unsigned char> > image; for(int x = 0;x < raw_width;++x){ std::vector<unsigned char> temp; for(int y = 0;y < raw_height;++y){ unsigned char data; raw.read((char*) &data, sizeof(char)); temp.push_back(data); } image.push_back(temp); } video.push_back(image); } raw.close(); raw_end.close(); }
/*------------------------------------------------------------------------- Call to quit chat. -------------------------------------------------------------------------*/ static void quit(dp_t *myDP, int exit_code) { if (myDP) { dpClose(myDP); dpDestroy(myDP, 0); /* go ahead and hang up */ } raw_end(); printf("pvtest: Exiting with status %d.\n", exit_code); exit(exit_code); }
/* needed for callback. hmm. */ void reset_tty() { raw_end(); }