데이터 압축
[이 페이지인 Video Compression Manager와 연결된 기능은 레거시 기능입니다. 새 코드에서 이 기능을 사용하지 않는 것이 좋습니다.]
다음 예제에서는 AVI 파일에 사용할 이미지 데이터를 압축합니다. 압축기가 VIDCF_CRUNCH 또는 VIDCF_TEMPORAL 플래그를 지원하지 않지만 VIDCF_QUALITY 지원한다고 가정합니다. 이 예제에서는 ICCompressBegin 매크로, ICCompress 함수 및 ICCompressEnd 매크로를 사용합니다.
DWORD dwCkID;
DWORD dwCompFlags;
DWORD dwQuality;
LONG lNumFrames, lFrameNum;
// Assume dwNumFrames is initialized to the total number of frames.
// Assume dwQuality holds the proper quality value (0-10000).
// Assume lpbiOut, lpOut, lpbiIn, and lpIn are initialized properly.
// If OK to start, compress each frame.
if (ICCompressBegin(hIC, lpbiIn, lpbiOut) == ICERR_OK)
{
for ( lFrameNum = 0; lFrameNum < lNumFrames; lFrameNum++)
{
if (ICCompress(hIC, 0, lpbiOut, lpOut, lpbiIn, lpIn,
&dwCkID, &dwCompFlags, lFrameNum,
0, dwQuality, NULL, NULL) == ICERR_OK)
{
// Write compressed data to the AVI file.
// Set lpIn to the next frame in the sequence.
}
else
{
// Handle compressor error.
}
}
ICCompressEnd(hIC); // terminate compression
}
else
{
// Handle the error identifying the unsupported format.
}