1

原谅我的英语

我需要使用 AVID 编解码器导入 .mov 文件。在导入设置中的 AVID Composer 程序中,可以通过安装选项 RGB (0-255) 或 601 (16-235) 来自定义颜色级别。

如何在代码中设置此选项(601)?

我在设置会话时尝试设置她:

    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) );

但它没有奏效。

4

1 回答 1

1

很抱歉告诉你,但恐怕没有办法以编程方式配置这些设置(至少我发现没办法),因为它们是特定于 AVID 编解码器的。

不过,您可以调用 AVID Media Composer 使用的相同导入设置对话框,使用

MovieImportDoUserDialog()

API函数。

编辑

这可能太明显了,但是您是否尝试通过将源帧描述字典中的像素格式类型键设置为 YUV 像素格式来简单地从解压缩会话中请求 YUV 数据?

您可以通过将以下块添加到您的代码中来做到这一点:

// 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 );
于 2009-07-31T11:49:09.007 回答