yuv2rgb函数的各个参数是什么意思?

rachelzhou 2003-08-23 01:44:26
我在网上下载了一个mpeg解码源程序,其中有一个文件yuv2rgb.c用来做yuv到rgb格式的转换,我希望有人能对这个函数的各个参数(就是*puc_y, stride_y, *puc_u, *puc_v, stride_uv, *puc_out, width_y, height_y, _stride_out)解释一下。函数是这样的:

// This be done more efficiently
// ( we spend almost as much time only in here
// as DivX 3.11 spends on all decoding )
void yuv2rgb_24(uint8_t *puc_y, int stride_y,
uint8_t *puc_u, uint8_t *puc_v, int stride_uv,
uint8_t *puc_out, int width_y, int height_y, unsigned int _stride_out)
{

int x, y;
int stride_diff = 6*_stride_out - 3*width_y;

if (height_y < 0) {
/* we are flipping our output upside-down */
height_y = -height_y;
puc_y += (height_y - 1) * stride_y ;
puc_u += (height_y/2 - 1) * stride_uv;
puc_v += (height_y/2 - 1) * stride_uv;
stride_y = -stride_y;
stride_uv = -stride_uv;
}

for (y=0; y<height_y; y+=2)
{
uint8_t* pY=puc_y;
uint8_t* pY1=puc_y+stride_y;
uint8_t* pU=puc_u;
uint8_t* pV=puc_v;
uint8_t* pOut2=puc_out+3*_stride_out;
for (x=0; x<width_y; x+=2)
{
int R, G, B;
int Y;
unsigned int tmp;
R=lut.m_plRV[*pU];
G=lut.m_plGV[*pU];
pU++;
G+=lut.m_plGU[*pV];
B=lut.m_plBU[*pV];
pV++;
#define PUT_COMPONENT(p,v,i) \
tmp=(unsigned int)(v); \
if(tmp < 0x10000) \
p[i]=tmp>>8; \
else \
p[i]=(tmp >> 24) ^ 0xff;
Y=lut.m_plY[*pY];
pY++;
PUT_COMPONENT(puc_out, R+Y, 0);
PUT_COMPONENT(puc_out, G+Y, 1);
PUT_COMPONENT(puc_out, B+Y, 2);
Y=lut.m_plY[*pY];
pY++;
PUT_COMPONENT(puc_out, R+Y, 3);
PUT_COMPONENT(puc_out, G+Y, 4);
PUT_COMPONENT(puc_out, B+Y, 5);
Y=lut.m_plY[*pY1];
pY1++;
PUT_COMPONENT(pOut2, R+Y, 0);
PUT_COMPONENT(pOut2, G+Y, 1);
PUT_COMPONENT(pOut2, B+Y, 2);
Y=lut.m_plY[*pY1];
pY1++;
PUT_COMPONENT(pOut2, R+Y, 3);
PUT_COMPONENT(pOut2, G+Y, 4);
PUT_COMPONENT(pOut2, B+Y, 5);
puc_out+=6;
pOut2+=6;
}

puc_y += 2*stride_y;
puc_u += stride_uv;
puc_v += stride_uv;
puc_out += stride_diff;
}
}
...全文
88 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
wzyak47 2003-08-28
  • 打赏
  • 举报
回复
*puc_y, stride_y,
y分量的首地址,y的行距(指的是地址之间的距离)
*puc_u, *puc_v, stride_uv,
u\v的的首地址,u\v的行距


*puc_out, width_y, height_y, _stride_out
输出的地址,图像的宽和高,输出rgb图像的行距

2,542

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
  • 多媒体/流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧