//YV12和I420格式只是U和V的位置不同
//参见:《浅述YUV颜色格式.pdf》
void RotateRightYV12(int _rows,int _cols,unsigned char* _pdata,unsigned char* _new_pdata)
{
 int yv12_size=(_rows*_cols)*3/2;
 int y_size=(yv12_size*2)/3;
 int v_size=yv12_size/6;
 int u_size=yv12_size/6;

 unsigned char* y_data=_pdata;
 unsigned char* v_data=_pdata+y_size;
 unsigned char* u_data=_pdata+y_size+v_size;

 unsigned char* y2_data=_new_pdata;
 unsigned char* v2_data=_new_pdata+y_size;
 unsigned char* u2_data=_new_pdata+y_size+v_size;

 //YVU三个分量单独旋转
 RotateRight(_rows,_cols,y_data,y2_data);
 RotateRight(_rows/2,_cols/2,v_data,v2_data);
 RotateRight(_rows/2,_cols/2,u_data,u2_data);
}

RotateRight函数参见:
http://www.qingfengju.com/article.asp?id=265
 


本文链接地址: YV12/I410图像的旋转算法
https://blog.qingfengju.com/index.asp?id=292

上一篇: 用Win7做虚拟无线AP实现网络共享
下一篇: 在系统中注册新的协议-例:注册Qvod协议

分类:Win32/C++ 查看次数:7960 发布时间:2012/1/2 16:16:01