VC环境下是如何读入*.yuv序列

#include <stdio.h>
#include <malloc.h>

void main()
{
char *Y;
char *Cb;
char *Cr;
int width = 352, height = 288;
FILE *fp;
FILE *fy;
int i;

Y = (char*)malloc(width*height);
Cb = (char*)malloc(width*height/4);
Cr = (char*)malloc(width*height/4);

fp= fopen("input.yuv","rb");

if(fp == NULL)
printf("open input.yuv failed\n");

fy = fopen("output.yuv", "ab+");
if(fy == NULL)
printf("open output.yuv failed\n");

for(i = 0; i<1; i++)
{
//fseek(fp, i*width*height, 0);
if(0 == fread(Y, width*height, 1, fp))
printf("read error\n");
if(0 == fwrite(Y, width*height, 1, fy))
printf("write error\n");

fread(Cb, width*height/4, 1, fp);
fread(Cr, width*height/4, 1, fp);
fwrite(Cb, width*height/4, 1, fy);
fwrite(Cr, width*height/4, 1, fy);
}

fclose(fp);
fclose(fy);
free(Y);
free(Cb);
free(Cr);

}



转载来自http://bbs.chinavideo.org/viewthread.php?tid=989&extra=page%3D1,此文章集合了网友h.264各种问题和回答

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值