Hi! Excuse for my English
I need to import the .mov file using the AVID codec. In AVID Composer program in import settings it is possible to customise Colour Levels by installation of options RGB (0-255) or 601 (16-235).
How it is possible to set in a code this option (601)?
I tried to set her when setting session:
long lwidth;
CHECK_FAILED( m_pMt->get_Pixels(&lwidth) );
SInt32 width = lwidth;
number = CFNumberCreate( NULL, kCFNumberSInt32Type, &width );
CFDictionaryAddValue( pixelBufferAttributes, kCVPixelBufferWidthKey, number );
CFRelease( number );
long lheight;
CHECK_FAILED( m_pMt->get_Lines(&lheight) );
SInt32 height = lheight;
number = CFNumberCreate( NULL, kCFNumberSInt32Type, &height );
CFDictionaryAddValue( pixelBufferAttributes, kCVPixelBufferHeightKey, number );
CFRelease( number );
double gamma = 2.199997;
// Always seems to equal 2.5 for RGB colorspaces and 2.199997 for YUV
number = CFNumberCreate( NULL, kCFNumberDoubleType, &gamma );
CFDictionaryAddValue( pixelBufferAttributes, kCVImageBufferGammaLevelKey, number );
CFRelease( number );
CFDictionaryAddValue(pixelBufferAttributes, kCVImageBufferYCbCrMatrixKey, kCVImageBufferYCbCrMatrix_ITU_R_601_4);
CHECK_OSSTATUS( ICMDecompressionSessionCreate(NULL, imageDesc, NULL, pixelBufferAttributes, &trackingCallbackRecord, &m_decompressionSession) );
But it not worked.
-
Sorry to be the one to tell you, but I am afraid there is no way to configure these settings programmatically ( at least I found no way to do it ) as they are AVID codec specific.
You might be able to invoke the same import settings dialog used by AVID Media Composer, though, using the
MovieImportDoUserDialog()
API function.
Edit:
This might be too obvious, but have you tried to simply request YUV data from the decompression session by setting the pixel format type key in your source frame description dictionary to a YUV pixel format?
You can do this by adding the following block to your code:
// request YUV 8 Bit 4:2:2 output from the decompression session SInt32 pixel_format = k2vuyPixelFormat; // this should be '601 (16-235)' by definition number = CFNumberCreate( NULL, kCFNumberSInt32Type, & pixel_format ); CFDictionaryAddValue( pixelBufferAttributes, kCVPixelBufferPixelFormatTypeKey, number ); CFRelease( number );
Vitaliy : could you explain how it do?
0 comments:
Post a Comment