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; }...