yuv数据

    
YUV420数据拷贝:
int picSize = codec_->height * codec_->width; int newSize = picSize * 1.5; //申请内存 unsigned char *buf = new unsigned char[newSize]; int height = p->codec->height; int width = p->codec->width; //写入数据 int a=0,i; for (i=0; i<height; i++) { memcpy(buf+a,pFrame_->data[0] + i * pFrame_->linesize[0], width); a+=width; } for (i=0; i<height/2; i++) { memcpy(buf+a,pFrame_->data[1] + i * pFrame_->linesize[1], width/2); a+=width/2; } for (i=0; i<height/2; i++) { memcpy(buf+a,pFrame_->data[2] + i * pFrame_->linesize[2], width/2); a+=width/2; } //=============== //到这里,buf里面已经是yuv420p的数据了,可以对它做任何的处理拉! //=============== delete [] buf;

 

posted @ 2013-01-17 22:54  azraelly  阅读(636)  评论(0编辑  收藏  举报