Базовое видео - доступные форматы пикселя
Q: Что форматы пикселя действительно Удаляет сердцевину Видео, в настоящее время поддерживают, и есть ли API, который может использоваться для получения этой информации программно?
A: Что форматы пикселя действительно Удаляет сердцевину Видео, в настоящее время поддерживают, и есть ли API, который может использоваться для получения этой информации программно?
Базовый Видео Пиксельный Буфер (представленный непрозрачным типом CVPixelBufferRef) буфер изображения, содержащий пиксели в оперативной памяти. Приложения, генерирующие кадры, сжимаясь / распаковка видео или использование Базового Изображения, могут все использовать Базовые Видео Пиксельные Буферы.
Отдельные пиксельные буферы могут быть созданы и управляли использованием APIs такой как CVPixelBufferCreate, CVPixelBufferCreateWithBytes, CVPixelBufferGetWidth, CVPixelBufferGetHeight и т.д. (см. CVPixelBuffer.h). Пул пиксельных буферов может также быть создан для управления рядом CVPixelBuffer объекты, бывшие переработанными, например, во время работы сжатия (см. CVPixelBufferPool.h) и CIImage объекты могут быть созданы из пиксельных буферных методов использования такой как initWithCVImageBuffer:.
Во время этой записи (Mac OS X 10.4.8 w/QuickTime 7.1.3), Базовые Поддержки видео форматы пикселя, показанные в Таблице 1. Обратите внимание на то, что новые форматы пикселя могут добавляться в течение долгого времени:
Формат пикселя | Описание |
|---|---|
k32ARGBPixelFormat | 32 - 8 битов за компонент Alpha, Красных, Зеленых, и Синих |
k24RGBPixelFormat | 24 - 8 битов за компонент Red, Грин, и Синий |
k16BE555PixelFormat | 16 - MSB не использован, сопровождается на 5 битов за компонент Red, Грин и Синим |
k32BGRAPixelFormat | BGRA - 8 битов за компонент Blue, Зеленых, Красных, и Альфа |
k16GrayPixelFormat | b16g - 16-разрядная Шкала полутонов с обратным порядком байтов |
k32AlphaGrayPixelFormat | b32a - 16-разрядный AlphaGray с обратным порядком байтов |
k64ARGBPixelFormat | b64a - 16 битов за компонент, Альфа с обратным порядком байтов, Красная, Зеленая и Синяя |
k48RGBPixelFormat | b48r - Обратный порядок байтов 16 битов за компонент, Красный, Зеленый и Синий |
k422YpCbCr8PixelFormat | 2vuy - Y'CbCr Компонента, 8-разрядный 4:2:2 |
kYUVSPixelFormat | yuvs - Y’CbCr компонента, 8-разрядный 4:2:2 |
k444YpCbCr8CodecType | v308 - Y'CbCr компонента, 8-разрядный 4:4:4 |
k422YpCbCr16CodecType | v216 - Y'CbCr компонента, 10,12,14,16-разрядный 4:2:2 |
k422YpCbCr10CodecType | v210 - Y'CbCr компонента, 10-разрядный 4:2:2 |
k4444YpCbCrA8RPixelFormat | r408 - Y'CbCrA компонента, 8-разрядный 4:4:4:4, представляя формат, полнофункциональную альфу, нуль сместил yuv |
k4444YpCbCrA8PixelFormat | v408 - Y'CbCrA компонента, 8-разрядный 4:4:4:4 |
k444YpCbCr10CodecType | v410 - Y'CbCr компонента, 10-разрядный 4:4:4 |
'r4fl' | r4fl - Y'CbCr компонента 32-разрядная плавающая точка 4:4:4:4, суперчерная поддержка |
Существует два APIs, который может использоваться для динамичного получения всего формата пикселя OSTypes и Описания Формата пикселя, известные Базовому Видео:
Использовать CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes получать массив OSTypes.
CFArrayRef CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes(CFAllocatorRef allocator)
Description:
Returns a CFArrayRef containing a list of all supported pixel format types.
allocator - The allocator used to allocate memory for the array and its storage for values.
Pass kCFAllocatorDefault to specify the default allocator. |
Использовать CVPixelFormatDescriptionCreateWithPixelFormatType получать словарь описания формата пикселя.
CFDictionaryRef CVPixelFormatDescriptionCreateWithPixelFormatType(CFAllocatorRef allocator,
OSType pixelFormat)
Description:
Returns a CFDictionaryRef containing the pixel format description for the passed in pixel format type.
allocator - The allocator to use when creating the description. Pass kCFAllocatorDefault to specify the
default allocator.
pixelFormat - A four-character code that identifies the pixel format description you want to obtain.
Notes:
The returned Core Foundation dictionary contains the pixel format description. See “Pixel Format
Description Keys” for more detailed information regarding the keys relevant to the format description.
Pixel Format Description Dictionary Keys:
kCVPixelFormatName - The name of the pixel format (type CFString).
kCVPixelFormatConstant - The pixel format constant for QuickTime.
kCVPixelFormatCodecType - The codec type (type CFString). For example, '2vuy' or k422YpCbCr8CodecType.
kCVPixelFormatFourCC - The Microsoft FourCC equivalent code for this pixel format (type CFString).
kCVPixelFormatPlanes - The number of image planes associated with this format (type CFNumber).
kCVPixelFormatBlockWidth - The width, in pixels, of the smallest byte-addressable group of pixels
(type CFNumber). Assumed to be 1 if this key is not present.
kCVPixelFormatBlockHeight - The height, in pixels, of the smallest byte-addressable group of pixels
(type CFNumber). Assumed to be 1 if this key is not present.
kCVPixelFormatBitsPerBlock - The number of bits per block (type CFNumber). For simple pixel formats,
this value is the same as the traditional bits-per-pixel value. This key is
mandatory in pixel format descriptions.
kCVPixelFormatBlockHorizontalAlignment - The horizontal alignment requirements of this format
(type CFNumber). Assumed to be 1 if this key is not present.
kCVPixelFormatBlockVerticalAlignment - The vertical alignment requirements of this format (type CFNumber).
Assumed to be 1 if this key is not present.
kCVPixelFormatHorizontalSubsampling - Horizontal subsampling information for this plane
(type CFNumber). Assumed to be 1 if this key is not present.
kCVPixelFormatVerticalSubsampling - Vertical subsampling information for this plane
(type CFNumber). Assumed to be 1 if this key is not present.
kCVPixelFormatOpenGLFormat - The OpenGL format used to describe this image plane (if applicable)
(type CFNumber). See the OpenGL specification for possible values.
kCVPixelFormatOpenGLType - The OpenGL type to describe this image plane (if applicable)
(type CFNumber). See the OpenGL specification for possible values.
kCVPixelFormatOpenGLInternalFormat - The OpenGL internal format for this pixel format (if applicable).
(type CFNumber). See the OpenGL specification for possible values.
kCVPixelFormatCGBitmapInfo - The Core Graphics bitmap information for this pixel format (if applicable).
kCVPixelFormatQDCompatibility - Indicates whether this format is compatible with QuickDraw (type CFBoolean).
kCVPixelFormatCGBitmapContextCompatibility - Indicates whether this format is compatible with Core Graphics
bitmap contexts(type CFBoolean).
kCVPixelFormatCGImageCompatibility - Indicates whether this format is compatible with the CGImage type
(type CFBoolean).
kCVPixelFormatOpenGLCompatibility - Indicates whether this format is compatible with OpenGL (type CFBoolean).
kCVPixelFormatFillExtendedPixelsCallback - Specifies a custom extended pixel fill algorithm (type CFData). |
Перечисление 1 демонстрирует, как получить список поддерживаемых Базовых Видео типов формата пикселя с выводом, произведенным показанный в Перечислении 2.
Перечисление 1 , Получающее формат пикселя, вводит известный Базовому Видео.
{
CFArrayRef pixelFormatDescriptionsArray = NULL;
CFIndex i;
pixelFormatDescriptionsArray =
CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes(kCFAllocatorDefault);
printf("Core Video Supported Pixel Format Types:\n\n");
for (i = 0; i < CFArrayGetCount(pixelFormatDescriptionsArray); i++) {
CFStringRef pixelFormat = NULL;
CFNumberRef pixelFormatFourCC = (CFNumberRef)CFArrayGetValueAtIndex(pixelFormatDescriptionsArray, i);
if (pixelFormatFourCC != NULL) {
UInt32 value;
CFNumberGetValue(pixelFormatFourCC, kCFNumberSInt32Type, &value);
if (value <= 0x28) {
pixelFormat = CFStringCreateWithFormat(kCFAllocatorDefault, NULL,
CFSTR("Core Video Pixel Format Type: %d\n"), value);
} else {
pixelFormat = CFStringCreateWithFormat(kCFAllocatorDefault, NULL,
CFSTR("Core Video Pixel Format Type (FourCC):
%c%c%c%c\n"), (char)(value >> 24), (char)(value >> 16),
(char)(value >> 8), (char)value);
}
CFShow(pixelFormat);
CFRelease(pixelFormat);
}
}
} |
Вывод перечисления 2 производится Перечислением 1.
Core Video Pixel Format Type: 32 Core Video Pixel Format Type: 24 Core Video Pixel Format Type: 16 Core Video Pixel Format Type (FourCC): 2vuy Core Video Pixel Format Type (FourCC): yuvs Core Video Pixel Format Type (FourCC): r408 Core Video Pixel Format Type (FourCC): v408 Core Video Pixel Format Type (FourCC): BGRA Core Video Pixel Format Type (FourCC): b64a Core Video Pixel Format Type (FourCC): b48r Core Video Pixel Format Type (FourCC): b32a Core Video Pixel Format Type (FourCC): b16g Core Video Pixel Format Type (FourCC): v308 Core Video Pixel Format Type (FourCC): v216 Core Video Pixel Format Type (FourCC): v210 Core Video Pixel Format Type (FourCC): v410 Core Video Pixel Format Type (FourCC): r4fl |
Перечисление 3 показывает пример значений словаря Описания Формата пикселя, возвращенных путем вызова CVPixelFormatDescriptionCreateWithPixelFormatType для k32ARGBPixelFormat и Перечисление 4 показывает, что значения Описания Формата пикселя возвратились для k422YpCbCr8PixelFormat.
Описание Формата пикселя перечисления 3 оценивает за k32ARGBPixelFormat.
kCVPixelFormatConstant - 32
kCVPixelFormatBitsPerBlock - 32
kCVPixelFormatQDCompatibility - true
kCVPixelFormatCGBitmapContextCompatibility - true
kCVPixelFormatCGImageCompatibility - true
kCVPixelFormatCGBitmapInfo - kCGImageAlphaFirst | kCGBitmapByteOrder32Big
kCVPixelFormatFillExtendedPixelsCallback - Extended fill procedure for this pixel format
Mac OS X:
kCVPixelFormatOpenGLFormat - GL_BGRA
kCVPixelFormatOpenGLInternalFormat - GL_RGBA8
PPC Based Mac (Big Endian):
kCVPixelFormatOpenGLCompatibility - true
kCVPixelFormatOpenGLType - GL_UNSIGNED_INT_8_8_8_8_REV
Intel Based Mac (Little Endian):
kCVPixelFormatOpenGLType - GL_UNSIGNED_INT_8_8_8_8 |
Описание Формата пикселя перечисления 4 оценивает за k422YpCbCr8PixelFormat.
kCVPixelFormatConstant - k422YpCbCr8PixelFormat
kCVPixelFormatBlockWidth - 2
kCVPixelFormatBitsPerBlock - 32
kCVPixelFormatFillExtendedPixelsCallback - Extended fill procedure for this pixel format
Mac OS X:
kCVPixelFormatOpenGLCompatibility - true
kCVPixelFormatOpenGLFormat - GL_YCBCR_422_APPLE
kCVPixelFormatOpenGLInternalFormat - GL_RGB
PPC Based Mac (Big Endian):
kCVPixelFormatOpenGLType - GL_UNSIGNED_SHORT_8_8_REV_APPLE
Intel Based Mac (Little Endian):
kCVPixelFormatOpenGLType - GL_UNSIGNED_SHORT_8_8_APPLE
Windows (if Direct3D supports the format):
kCVPixelFormatDirect3DCompatibility - true
kCVPixelFormatDirect3DFormat - D3DFMT_UYVY
kCVPixelFormatDirect3DType - D3DFMT_UYVY
kCVPixelFormatDirect3DInternalFormat - D3DFMT_UYVY |
Ссылки
История версии документа
| Дата | Примечания |
|---|---|
| 26.05.2010 | Обновленный ссылочный URLs. |
| 23.01.2007 | Новый документ, обсуждающий, как определить все типы формата пикселя и описания формата, известные Базовому Видео. |