void ParseSNP::parse_cmd_line(int argc, char *argv[]) { CmdLine cmdss("computes local coverage and a derived BOD quality score", ' ', version.c_str()); ValueArg<string> read_filename_arg("q", "mapped_reads", "Mapped read file (sam/bam)", true, "#", "string"); cmdss.add(read_filename_arg); // ValueArg<string> ref_file_arg("r", "ref_file", "Reference file (fasta)", true, "#", "string"); cmdss.add(ref_file_arg); // ValueArg<string> snp_file_arg("s", "snp_file", "VCF file", true, "#", "string"); cmdss.add(snp_file_arg); // ValueArg<int> leng("l", "read_length", "maximum read length", true, -1, "int"); cmdss.add(leng); // ValueArg<string> db_file_arg("d", "db_file", "Sqlite file to write the output", false, "#", "string"); // ValueArg<string> plot_file_arg("p", "plot_file", "Name of the file for the data required for the Python script", false, "#", "string"); // cmdss.xorAdd( db_file_arg, plot_file_arg ); // <- whether Sqlite DB or plain text // ValueArg<string> sample_label_arg("t", "sample_label", "sample label for the database", false, "#", "string"); cmdss.add(sample_label_arg); // MultiArg<string> exclude_contigs_arg("x", "exclude", "exclude contigs from analysis", false, "string"); cmdss.add(exclude_contigs_arg); // MultiSwitchArg verbose_arg("v", "verbose", "print snp-by-snp progress", 0); cmdss.add(verbose_arg); // ValueArg<int> num_test_arg("b", "break_after", "max number of position per chromosome [test mode]", false, 0, "int"); cmdss.add(num_test_arg); try { cmdss.parse(argc, argv); //parse arguments read_filename = read_filename_arg.getValue(); /* output = out.getValue(); if (output[0] == '#') { output = read_filename; output += ".mot"; } */ reffile = ref_file_arg.getValue(); snpfile = snp_file_arg.getValue(); read_length = leng.getValue(); range = 3 * read_length / 2 ; if ( plot_file_arg.isSet() ) plot_file = plot_file_arg.getValue(); //db_file = '#'; else if ( db_file_arg.isSet() ) // plot_file = '#'; plot_file = db_file_arg.getValue(); // if ( sample_label_arg.isSet() ) sample_label = sample_label_arg.getValue(); else sample_label = "[" + db_file_arg.getValue() + "]"; clog << "table base name: " << sample_label << endl; exclude_contigs = exclude_contigs_arg.getValue(); verbose = verbose_arg.getValue(); if (verbose){ num_test = num_test_arg.getValue(); } // db_flag = db_file_arg.isSet(); init(); parseVCF(); } catch (ArgException &e) { StdOutput out; out.failure(cmdss, e); } }
int p11_tool_main (int argc, char *argv[], const p11_tool_command *commands) { const p11_tool_command *fallback = NULL; char *command = NULL; bool want_help = false; bool skip; int in, out; int i; /* * Parse the global options. We rearrange the options as * necessary, in order to pass relevant options through * to the commands, but also have them take effect globally. */ for (in = 1, out = 1; in < argc; in++, out++) { /* The non-option is the command, take it out of the arguments */ if (argv[in][0] != '-') { if (!command) { skip = true; command = argv[in]; } else { skip = false; } /* The global long options */ } else if (argv[in][1] == '-') { skip = false; if (strcmp (argv[in], "--") == 0) { if (!command) { p11_message ("no command specified"); return 2; } else { break; } } else if (strcmp (argv[in], "--verbose") == 0) { verbose_arg (); } else if (strcmp (argv[in], "--quiet") == 0) { quiet_arg (); } else if (strcmp (argv[in], "--help") == 0) { want_help = true; } else if (!command) { p11_message ("unknown global option: %s", argv[in]); return 2; } /* The global short options */ } else { skip = false; for (i = 1; argv[in][i] != '\0'; i++) { switch (argv[in][i]) { case 'h': want_help = true; break; /* Compatibility option */ case 'l': command = "list-modules"; break; case 'v': verbose_arg (); break; case 'q': quiet_arg (); break; default: if (!command) { p11_message ("unknown global option: -%c", (int)argv[in][i]); return 2; } break; } } } /* Skipping this argument? */ if (skip) out--; else argv[out] = argv[in]; } /* Initialize tool's debugging after setting env vars above */ p11_debug_init (); if (command == NULL) { /* As a special favor if someone just typed the command, help them out */ if (argc == 1) { command_usage (commands); return 2; } else if (want_help) { command_usage (commands); return 0; } else { p11_message ("no command specified"); return 2; } } argc = out; /* Look for the command */ for (i = 0; commands[i].name != NULL; i++) { if (strcmp (commands[i].name, P11_TOOL_FALLBACK) == 0) { fallback = commands + i; } else if (strcmp (commands[i].name, command) == 0) { argv[0] = command; return (commands[i].function) (argc, argv); } } /* Got here because no command matched */ if (fallback != NULL) { argv[0] = command; return (fallback->function) (argc, argv); } /* At this point we have no command */ p11_message ("'%s' is not a valid command. See '%s --help'", command, getprogname ()); return 2; }
int OgreKit::setup(int argc, char** argv) { int winsize_x = 800; int winsize_y = 600; m_prefs.wintitle = gkString("OgreKit Demo (Press Escape to exit)[") + m_blend + gkString("]"); gkString cfgfname; // Parse command line try { TCLAP::CmdLine cmdl("Ogrekit", ' ', "n/a"); cmdl.setExceptionHandling(false); //cfg arguments TCLAP::ValueArg<std::string> rendersystem_arg ("r", "rendersystem", "Set rendering system. (gl, d3d9, d3d10, d3d11)", false, "", "string"); //default GL TCLAP::ValueArg<std::string> viewportOrientation_arg ("", "viewportorientation", "Set viewport orientation.", false, m_prefs.viewportOrientation, "string"); TCLAP::ValueArg<std::string> log_arg ("", "log", "Set log file name.", false, m_prefs.log, "string"); TCLAP::ValueArg<bool> verbose_arg ("v", "verbose", "Enable verbose log.", false, m_prefs.verbose, "bool"); TCLAP::ValueArg<int> winsize_x_arg ("", "width", "Set window width.", false, winsize_x, "int"); TCLAP::ValueArg<int> winsize_y_arg ("", "height", "Set window height.", false, winsize_y, "int"); TCLAP::ValueArg<std::string> wintitle_arg ("", "wintitle", "Set window title.", false, m_prefs.wintitle, "string"); TCLAP::ValueArg<bool> fullscreen_arg ("f", "fullscreen", "Enable fullscreen mode.", false, m_prefs.fullscreen, "bool"); TCLAP::ValueArg<std::string> framingType_arg ("", "framingtype", "Set viewport framing type. (extend, crop, letterbox)", false, "", "string"); TCLAP::ValueArg<std::string> resources_arg ("", "resources", "Set resouces.", false, m_prefs.resources, "string"); TCLAP::ValueArg<bool> blendermat_arg ("", "blendmat", "Convert meshes using blender materials.", false, m_prefs.blendermat, "bool"); TCLAP::ValueArg<bool> matblending_arg ("", "matblending", "Enable material pass blending mode.", false, m_prefs.matblending, "bool"); TCLAP::ValueArg<bool> grapInput_arg ("g", "grabinput", "Grap mouse input.", false, m_prefs.grabInput, "bool"); TCLAP::ValueArg<bool> debugFps_arg ("d", "debugfps", "Display debug fps.", false, m_prefs.debugFps, "bool"); TCLAP::ValueArg<bool> vsync_arg ("", "vsync", "enable vertical-sync.", false, m_prefs.vsync, "bool"); TCLAP::ValueArg<int> vsyncrate_arg ("", "vsync-rate", "Set vsync-rate ", 0, m_prefs.vsyncRate, "int"); TCLAP::ValueArg<bool> debugPhysics_arg ("p", "debugphysics", "Display debug physics.", false, m_prefs.debugPhysics, "bool"); TCLAP::ValueArg<bool> debugPhysicsAabb_arg ("a", "debugphysicsaabb", "Display debug physics aabb.", false, m_prefs.debugPhysicsAabb, "bool"); TCLAP::ValueArg<bool> buildStaticGeometry_arg ("", "buildinstances", "Build Static Geometry.", false, m_prefs.buildStaticGeometry, "bool"); TCLAP::ValueArg<bool> useBulletDbvt_arg ("", "frustumculling", "Enable view frustum culling by dbvt.", false, m_prefs.useBulletDbvt, "bool"); TCLAP::ValueArg<bool> showDebugProps_arg ("t", "showdebugprops", "Show debug props.", false, m_prefs.showDebugProps, "bool"); TCLAP::ValueArg<bool> debugSounds_arg ("", "debugsounds", "Debug sounds.", false, m_prefs.debugSounds, "bool"); TCLAP::ValueArg<bool> disableSound_arg ("s", "disablesound", "Disable sounds.", false, m_prefs.disableSound, "bool"); TCLAP::ValueArg<bool> fsaa_arg ("", "fsaa", "Enable fsaa.", false, m_prefs.fsaa, "bool"); TCLAP::ValueArg<int> fsaaSamples_arg ("", "fsaasSamples", "Set fsaa samples.", false, m_prefs.fsaaSamples, "int"); TCLAP::ValueArg<bool> enableshadows_arg ("", "enableshadows", "Enable Shadows.", false, m_prefs.enableshadows, "bool"); TCLAP::ValueArg<int> defaultMipMap_arg ("", "defaultmipmap", "Set default mipMap.", false, m_prefs.defaultMipMap, "int"); TCLAP::ValueArg<std::string> shadowtechnique_arg ("", "shadowtechnique", "Set shadow technique.", false, m_prefs.shadowtechnique, "string"); TCLAP::ValueArg<std::string> colourshadow_arg ("", "colourshadow", "Set shadow colour.", false, "", "string"); TCLAP::ValueArg<float> fardistanceshadow_arg ("", "fardistanceshadow", "Set far distance shadow.", false, m_prefs.fardistanceshadow, "float"); TCLAP::ValueArg<std::string> shaderCachePath_arg ("", "shadercachepath", "RTShaderSystem cache file path.", false, m_prefs.shaderCachePath, "string"); cmdl.add(rendersystem_arg); cmdl.add(viewportOrientation_arg); cmdl.add(log_arg); cmdl.add(verbose_arg); cmdl.add(winsize_x_arg); cmdl.add(winsize_y_arg); cmdl.add(wintitle_arg); cmdl.add(fullscreen_arg); cmdl.add(framingType_arg); cmdl.add(resources_arg); cmdl.add(blendermat_arg); cmdl.add(matblending_arg); cmdl.add(grapInput_arg); cmdl.add(debugFps_arg); cmdl.add(debugPhysics_arg); cmdl.add(vsync_arg); cmdl.add(vsyncrate_arg); cmdl.add(debugPhysicsAabb_arg); cmdl.add(buildStaticGeometry_arg); cmdl.add(useBulletDbvt_arg); cmdl.add(showDebugProps_arg); cmdl.add(debugSounds_arg); cmdl.add(disableSound_arg); cmdl.add(fsaa_arg); cmdl.add(fsaaSamples_arg); cmdl.add(enableshadows_arg); cmdl.add(defaultMipMap_arg); cmdl.add(shadowtechnique_arg); cmdl.add(colourshadow_arg); cmdl.add(fardistanceshadow_arg); cmdl.add(shaderCachePath_arg); //input file arguments TCLAP::ValueArg<std::string> cfgfname_arg("c", "config-file", "Startup configuration file (.cfg) to use.", false, gkDefaultConfig, "string"); TCLAP::UnlabeledValueArg<std::string> bfname_arg("blender-file", "Blender file to launch as game.", false, gkDefaultBlend, "string"); cmdl.add(cfgfname_arg); cmdl.add(bfname_arg); cmdl.parse( argc, argv ); cfgfname = cfgfname_arg.getValue(); m_blend = bfname_arg.getValue(); m_prefs.rendersystem = gkUserDefs::getOgreRenderSystem(rendersystem_arg.getValue()); m_prefs.viewportOrientation = viewportOrientation_arg.getValue(); //m_prefs.sceneManager = sceneManager_arg.getValue(); m_prefs.log = log_arg.getValue(); m_prefs.verbose = verbose_arg.getValue(); m_prefs.winsize = gkVector2(winsize_x_arg.getValue(), winsize_y_arg.getValue()); m_prefs.wintitle = wintitle_arg.getValue(); m_prefs.fullscreen = fullscreen_arg.getValue(); m_prefs.framingType = gkUserDefs::getViewportFramingType(framingType_arg.getValue()); m_prefs.resources = resources_arg.getValue(); m_prefs.blendermat = blendermat_arg.getValue(); m_prefs.matblending = matblending_arg.getValue(); m_prefs.grabInput = grapInput_arg.getValue(); m_prefs.debugFps = debugFps_arg.getValue(); m_prefs.debugPhysics = debugPhysics_arg.getValue(); m_prefs.debugPhysicsAabb = debugPhysicsAabb_arg.getValue(); m_prefs.buildStaticGeometry = buildStaticGeometry_arg.getValue(); m_prefs.useBulletDbvt = useBulletDbvt_arg.getValue(); m_prefs.showDebugProps = showDebugProps_arg.getValue(); m_prefs.debugSounds = debugSounds_arg.getValue(); m_prefs.disableSound = disableSound_arg.getValue(); m_prefs.vsync = vsync_arg.getValue(); m_prefs.vsyncRate = vsyncrate_arg.getValue(); m_prefs.fsaa = fsaa_arg.getValue(); m_prefs.fsaaSamples = fsaaSamples_arg.getValue(); m_prefs.enableshadows = enableshadows_arg.getValue(); m_prefs.defaultMipMap = defaultMipMap_arg.getValue(); m_prefs.shadowtechnique = shadowtechnique_arg.getValue(); m_prefs.fardistanceshadow = fardistanceshadow_arg.getValue(); m_prefs.shaderCachePath = shaderCachePath_arg.getValue(); if (colourshadow_arg.isSet()) m_prefs.colourshadow = Ogre::StringConverter::parseColourValue(colourshadow_arg.getValue()); #ifdef __APPLE__ if (m_blend.find("-psn") != gkString::npos) m_blend = gkDefaultBlend; #endif } catch (TCLAP::ArgException& e) { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; return -1; } catch (TCLAP::ExitException&) { // just return and exit app return -1; } catch (...) { std::cerr << "Unknown exception." << std::endl; return -1; } gkPath path = cfgfname; // overide settings if found if (path.isFile()) m_prefs.load(path.getPath()); return 0; }
int main (int argc, char *argv[]) { /* Program Option parsing */ int num_frames = 1; int threads = 1; bool disable_output = false; bool colourise_quantiser = false; bool colourise_padding = false; bool colourise_unpadded = false; bool quartersize = false; bool verbose = false; std::string input_filename; std::string output_filename; try { TCLAP::CmdLine cmd("VC2 HQ profile Decoder Example\n" "All input files must be vc2 streams\n" "All output files will be yuv422p10le\n", '=', "0.1", true); TCLAP::SwitchArg verbose_arg ("v", "verbose", "verbose mode", cmd, false); TCLAP::ValueArg<int> num_frames_arg ("n", "num-frames", "Number of frames to decode", false, 1, "integer", cmd); TCLAP::ValueArg<int> num_threads_arg ("t", "threads", "Number of threads", false, 1, "integer", cmd); TCLAP::SwitchArg disable_output_args ("d", "disable-output", "disable output", cmd, false); TCLAP::SwitchArg colourise_quantiser_args("q", "colourise-quantiser", "colourise based on quantiser levels", cmd, false); TCLAP::SwitchArg colourise_padding_args ("p", "colourise-padding", "colourise based on padding levels", cmd, false); TCLAP::SwitchArg colourise_unpadded_args ("u", "colourise-unpadded", "colourise based on lack of padding", cmd, false); TCLAP::UnlabeledValueArg<std::string> input_file_arg("input_file", "encoded input file", true, "", "string", cmd); TCLAP::UnlabeledValueArg<std::string> output_file_arg("output_file", "output file (defaults to input file + .yuv)", false, "", "string", cmd); cmd.parse( argc, argv ); num_frames = num_frames_arg.getValue(); threads = num_threads_arg.getValue(); disable_output = disable_output_args.getValue(); colourise_quantiser = colourise_quantiser_args.getValue(); colourise_padding = colourise_padding_args.getValue(); colourise_unpadded = colourise_unpadded_args.getValue(); verbose = verbose_arg.getValue(); input_filename = input_file_arg.getValue(); output_filename = output_file_arg.getValue(); } catch (TCLAP::ArgException &e) { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; return 1; } if (output_filename == "") output_filename = input_filename + ".yuv"; /* Variables for storing input and output buffers */ char *idata; size_t input_length = 0; uint16_t **odata = new uint16_t*[num_frames]; // Output frame pointers uint16_t ***opics = new uint16_t**[num_frames*2]; // Output picture pointers (which may be different for interlaced sequences) for (int i = 0; i < num_frames * 2; i++) { opics[i] = new uint16_t*[3]; } int ostride[3]; int num_frames_decoded_from_sequence = 0; int total_frames_decoded = 0; /* Initialise decoder */ vc2decode_init(); VC2DecoderHandle decoder = vc2decode_create(); /* Configure decoder */ { VC2DecoderParamsUser params; memset((void *)¶ms, 0, sizeof(params)); params.threads = threads; params.colourise_quantiser = colourise_quantiser; params.colourise_padding = colourise_padding; params.colourise_unpadded = colourise_unpadded; /* QuarterSize is only really sensible for HD */ if (quartersize) { params.partial_decode = true; params.partial_decode_width = 1920/2; params.partial_decode_height = 1080/2; params.partial_decode_offset_x = 0; params.partial_decode_offset_y = 540; } { VC2DecoderResult r = vc2decode_set_parameters(decoder, params); if (r != VC2DECODER_OK) { printf("Parameter Error: %d\n", r); return 1; } } } /* Read input data */ { FILE *f = FOPEN(input_filename.c_str(), "rb"); if (!f) { fprintf(stderr, "Could not open: %s\n", input_filename.c_str()); perror("Invalid input file: "); return 1; } int r = fseek(f, 0L, SEEK_END); if (r < 0) { perror("Error seeking in input file"); return 1; } input_length = ftell(f); rewind(f); idata = (char *)malloc(input_length); size_t s = fread(idata, 1, input_length, f); if (s != input_length) { if (ferror(f)) fprintf(stderr, "Error reading file\n"); else fprintf(stderr, "Improper Length on Input File\n"); return 1; } fclose(f); printf("Read %lubytes of input data\n", input_length); } /* Set the output fmt to something invalid to start with */ VC2DecoderOutputFormat fmt; fmt.width = 0; fmt.height = 0; fmt.signal_range = 0; fmt.source_sampling = 0; fmt.frame_rate_numer = 0; fmt.frame_rate_denom = 0; fmt.interlaced = 0; ostride[0] = 0; ostride[1] = 0; ostride[2] = 0; for (int i = 0; i < num_frames; i++) { odata[i] = NULL; } /* Begin the main program loop */ int err = 0; uint64_t time_taken = 0; while (total_frames_decoded < num_frames) { VC2DecoderResult r; /* Reset to the start of the input data */ char *id = idata; char *iend = idata + input_length; /* We are at the start of a sequence, so synchronise */ r = vc2decode_synchronise(decoder, &id, iend - id, true); if (r != VC2DECODER_OK_RECONFIGURED) { fprintf(stderr, "Error synchronising to sequence"); err = 1; break; } /* We have synchronised, so get the output format */ VC2DecoderOutputFormat new_fmt; r = vc2decode_get_output_format(decoder, &new_fmt); if (r != VC2DECODER_OK) { fprintf(stderr, "Output format error: %d\n", r); err = 1; break; } /* Reconfigure output buffers if this format doesn't match the current one */ if (fmt.width != new_fmt.width || fmt.height != new_fmt.height || fmt.interlaced != new_fmt.interlaced) { fmt = new_fmt; for (int i = 0; i < num_frames; i++) { if (odata[i]) free(odata[i]); odata[i] = (uint16_t *)malloc(fmt.width*fmt.height*2*sizeof(uint16_t)); } if (fmt.interlaced) { ostride[0] = fmt.width*2; ostride[1] = fmt.width; ostride[2] = fmt.width; for (int i = 0; i < num_frames; i++) { opics[2*i + 0][0] = odata[i]; opics[2*i + 0][1] = odata[i] + fmt.width*fmt.height; opics[2*i + 0][2] = odata[i] + fmt.width*fmt.height + fmt.width*fmt.height/2; opics[2*i + 1][0] = odata[i] + fmt.width; opics[2*i + 1][1] = odata[i] + fmt.width*fmt.height + fmt.width/2; opics[2*i + 1][2] = odata[i] + fmt.width*fmt.height + fmt.width*fmt.height/2 + fmt.width/2; } } else { ostride[0] = fmt.width; ostride[1] = fmt.width/2; ostride[2] = fmt.width/2; for (int i = 0; i < num_frames; i++) { opics[i][0] = odata[i]; opics[i][1] = odata[i] + fmt.width*fmt.height; opics[i][2] = odata[i] + fmt.width*fmt.height + fmt.width*fmt.height/2; } } } /* Decode Pictures from stream */ int picture = 0; struct timespec start, end; clock_gettime(CLOCK_MONOTONIC, &start); while (total_frames_decoded < num_frames) { r = vc2decode_decode_one_picture(decoder, &id, iend - id, opics[picture], ostride, true); /* If End of Sequence break from loop */ if (r == VC2DECODER_OK_EOS) { break; } /* If a picture has been sucessfully decoded continue */ if (r == VC2DECODER_OK_PICTURE) { if (!fmt.interlaced || (picture%2)) total_frames_decoded++; picture++; if (id == NULL) { fprintf(stderr, "Premature end of stream\n"); break; } continue; } /* If a reconfiguration has been triggered this is an invalid sequence, flag that */ if (r == VC2DECODER_OK_RECONFIGURED) { fprintf(stderr, "Warning: this sequence changes parameters part way through\n"); break; } /* Otherwise we have an error */ if (r < 0) { fprintf(stderr, "Error decoding:\n"); fprintf(stderr, " %s\n", VC2DecoderErrorString[-r]); err=1; break; } fprintf(stderr, "Unknown Return value: %d\n", r); break; } clock_gettime(CLOCK_MONOTONIC, &end); /* We have reached the end of a sequence, or have decoded enough frames */ /*If an error has occurred bail */ if (err) break; /*If no pictures were decoded bail */ if (picture == 0) { fprintf(stderr, "No pictures in sequence!\n"); err = 1; break; } /* Otherwise update the record of how many decoded frames have been recorded */ int num_frames_decoded_from_this_sequence = (fmt.interlaced)?(picture/2):(picture); if (num_frames_decoded_from_this_sequence > num_frames_decoded_from_sequence) num_frames_decoded_from_sequence = num_frames_decoded_from_this_sequence; /* And update the record of time taken to decode */ time_taken += (end.tv_sec*1000000000 + end.tv_nsec) - (start.tv_sec*1000000000 + start.tv_nsec); } /* If there has been no error print the speed */ if (!err) { printf("--------------------------------------------------\n"); printf(" %d frames decoded in %5.3fs\n", total_frames_decoded, time_taken/1000000000.0); printf(" %5.3ffps\n", total_frames_decoded*1000000000.0/time_taken); printf("--------------------------------------------------\n"); } /* If there has been no error get decoder statistics */ if (!err) { VC2DecoderSequenceInfo info; vc2decode_sequence_info(decoder, &info); print_sequence_info(info, verbose); } /* If there is no error and output is enabled write the output to a file This code actually performs an endianess swap and some bit shifting on the output data to put it into the desired format (10-bit data in the high order bits of 16-bit words in network byte order). */ if (!err && !disable_output) { try { FILE *of = FOPEN(output_filename.c_str(), "wb"); for (int i = 0; i < num_frames_decoded_from_sequence; i++) { for (int y = 0; y < fmt.height; y++) { size_t s = fwrite(&odata[i][(y*fmt.width)], 1, fmt.width*sizeof(uint16_t), of); if (s != fmt.width*sizeof(uint16_t)) throw std::runtime_error("Writing Error"); } for (int y = 0; y < fmt.height*2; y++) { size_t s = fwrite(&odata[i][(fmt.height*fmt.width + y*fmt.width/2)], 1, fmt.width/2*sizeof(uint16_t), of); if (s != fmt.width/2*sizeof(uint16_t)) throw std::runtime_error("Writing Error"); } } printf("Wrote out %d frames\n", num_frames_decoded_from_sequence); fclose(of); } catch(...) { fprintf(stderr, "Error writing output\n"); err = 1; } } /* Destroy the decoder */ vc2decode_destroy(decoder); /* Deallocate buffers */ free(idata); for (int i = 0; i < num_frames; i++) if (odata[i]) free(odata[i]); delete[] odata; for (int i = 0; i < num_frames * 2; i++) delete[] opics[i]; delete[] opics; return err; }