zoukankan      html  css  js  c++  java
  • 合并两个yuv文件的C++代码

    //将BasketballPass_416x240_50.yuv序列的前50帧和BlowingBubbles_416x240_50.yuv序列的前250帧合并成out.yuv

    //参数配置416 240 50 BasketballPass_416x240_50.yuv 416 240 250 BlowingBubbles_416x240_50.yuv out.yuv

      

    #include <iostream>
    #include <fstream>
    
    using namespace std;
    
    //参数配置416 240 50 BasketballPass_416x240_50.yuv 416 240 250 BlowingBubbles_416x240_50.yuv out.yuv
    
    int main(int argc, char *argv[])
    {
        ifstream fin;
        fin.open(argv[4], std::ifstream::binary);
    
        int width = atoi(argv[1]);
        int height = atoi(argv[2]);
        int frames = atoi(argv[3]);
        int num = width * height * frames * 1.5;
    
        ofstream fout;
        fout.open(argv[9], std::ofstream::binary);
        char* buf = new char[num];
    
        fin.read(buf, num);
        fout.write(buf, num);
    
        fin.close();
        delete []buf;
    
        fin.open(argv[8], std::ifstream::binary);
        width = atoi(argv[5]);
        height = atoi(argv[6]);
        frames = atoi(argv[7]);
    
        num = width * height * frames * 1.5;
    
        buf = new char[num];
    
        fin.read(buf, num);
        fout.write(buf, num);
    
        fin.close();
        delete []buf;
        fout.close();
    
        cout << "Done!" << endl;
    
        getchar();
    
        return 0;
    }
  • 相关阅读:
    宏------进阶

    公司用中会用到的iOS开源库和第三方组件(不断更新...)
    iOS 开发者旅途中的指南针
    国际化
    Block
    git简单使用教程
    XCode自带解析SAX解析
    GDataXMLNode解析XML
    Predicate
  • 原文地址:https://www.cnblogs.com/lakeone/p/5328757.html
Copyright © 2011-2022 走看看