YUV422/YUV420播放

 

YUV播放器,directX,VS2008 MFC完成  CSDN下载 http://download.csdn.net/detail/xjt1988xjt/2386621#comment

默认是播放yuv420,  Buffer size 为 width*height*1.5, 数据处理为

FORMAT = MAKEFOURCC('Y','V','1','2');
... LPBYTE PtrY
= buffer; LPBYTE PtrU = buffer + width*height; LPBYTE PtrV = buffer + (int)width*height*1.25; for (int i=0; i<height; i++) {   memcpy(lpSurf, PtrY, width);   PtrY += width;   lpSurf += ddsd.1Pitch; } for (int i=0; i<height/2; i++) {   memcpy(lpSurf, PtrV, width/2);   PtrV += width/2;   lpSurf += ddsd.1Pitch/2; } for (int i=0; i<height/2; i++) {   memcpy(lpSurf, PtrU, width/2);   PtrU += width/2;   lpSurf += ddsd.1Pitch/2; }
...

422 处理时, buffer size 为  width*height*2

FORMAT = MAKEFOURCC('U','Y','V','Y');...

LPBYTE PtrY = buffer;

LPBYTE PtrV = buffer + width*height;

LPBYTE PtrY = buffer + (int)width*height*1.5;

for (int i=0; i<height; i++)

{

  memcpy(lpSurf, PtrY, width);

  PtrY += width;

  lpSurf += width;

}

for (int i=0; i<height/2; i++)

{

  memcpy(lpSurf, PtrV, width);

  PtrV += width;

  lpSurf += width;

}

for (int i=0; i<height/2; i++)

{

  memcpy(lpSurf, PtrU, width);

  PtrU += width;

  lpSurf += width;

}...

 

转载于:https://www.cnblogs.com/maxpak/p/4885309.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值