View Single Post
Old 26th January 2006, 09:26   #1538  |  Link
Inc
Squeeze it!
 
Inc's Avatar
 
Join Date: Oct 2003
Location: Germany
Posts: 472
Quote:
Originally Posted by Dimzon
AviFile32 API performs RGB24 conversion
Not at all, it depends on how you set up the decompression in AVIStreamGetFrameOpen().

Here a piece of code

Code:
BITMAPINFOHEADER bih;
    ZeroMemory(&bih, sizeof(BITMAPINFOHEADER));

    bih.biBitCount=24;    //24 bit per pixel
    bih.biClrImportant=0;
    bih.biClrUsed = 0;
    bih.biCompression = BI_RGB;
    bih.biPlanes = 1;
    bih.biSize = 40;
    bih.biXPelsPerMeter = 0;
    bih.biYPelsPerMeter = 0;
    //calculate total size of RGBQUAD scanlines (DWORD aligned)
    bih.biSizeImage = (((bih.biWidth * 3) + 3) & 0xFFFC) * bih.biHeight ;

    PGETFRAME pFrame;

    // Let the Handler decide which Colorspace matches best your display:
    pFrame=AVIStreamGetFrameOpen(pStream, AVIGETFRAMEF_BESTDISPLAYFMT);

    // Or do force the decompressor to use the Cspace as given in the bih above:
    pFrame=AVIStreamGetFrameOpen(pStream, &bih);
So If yot want to keep a YV12 as YV12 to serve it to an encoder, just apply to bih a BITMAPINFOHEADER Structure for RAW YV12 decompression or to whatever Cspace you want the stream decompressed to.

This weekend Ill add to the AvsRedirect/AvsWrapper some calls to avs's streamdetection (cspace etc etc etc).
Btw. In the avs_openscript command I did implement a routine so you can force the outputted Cspace via a simple String ("YV12","YUY2", "RGB24", "RGB32"). So depending on the encoder the user choosed you can force in MeGUI to serve the encoders native Cspace.

Last edited by Inc; 26th January 2006 at 09:47.
Inc is offline   Reply With Quote