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;
    }
  • 相关阅读:
    二分图最大匹配
    Problems about trees
    Hackerrank Going to the Office
    多校题解
    HDU #2966 In case of failure
    K-D Tree
    UOJ #10 pyx的难题
    bzoj 1090 字符串折叠
    uva 1347 旅行
    bzoj 1059 矩阵游戏
  • 原文地址:https://www.cnblogs.com/lakeone/p/5328757.html
Copyright © 2011-2022 走看看