360 likes | 663 Views
Avalon Imaging Codec Architecture Overview . Peggi Goodwin Lead Program Manager, Imaging Windows Client Platform Microsoft Corporation. Session Outline. Problems with today’s user experience Extensible Imaging Pipeline: CODEC extensibility Pixel format extensibility
E N D
Avalon Imaging Codec Architecture Overview Peggi Goodwin Lead Program Manager, ImagingWindows Client Platform Microsoft Corporation
Session Outline • Problems with today’s user experience • Extensible Imaging Pipeline: • CODEC extensibility • Pixel format extensibility • Metadata extensibility • From a Development Perspective • Avalon and WinFX
Metadata Can Be Used for Many Purposes File Name CRW_8529.CRW Camera Model Name Canon EOS 10D Shooting Date/Time 12/20/2004 2:59:00 PM Shooting Mode Aperture-Priority AE Tv( Shutter Speed ) 1/1000 Av( Aperture Value ) 5.6 Metering Mode Center-weighted averaging Exposure Compensation 0 ISO Speed 200 Lens 300.0mm Focal Length 420.0mm Image Size 3072x2048 Image Quality RAW Flash Off White Balance Daylight AF Mode One-Shot AF Parameters Contrast Normal Sharpness Normal Color saturation Normal Color tone Normal Color Space sRGB File Size 6311KB Drive Mode Continuous shooting Owner's Name Peggi Goodwin Camera Body No. 1120405343 Last Edit 2004-05-02 14:37:09 Edited By John Smith Type of Edit Rotate 0.7 Crop 0.116,0.166 12.444,8.418 Black Point 4 4 3 White Point 255 253 249 Curves 65,56 128,135 191,199 Color Balance S +6 -2 +5 M +8 0 +2 H 0 0 0 Brightness +2 Contrast +6 Unsharp Mask 50 0.9 2 Custom Function C.Fn:01-1 C.Fn:02-1 C.Fn:03-0 C.Fn:04-0 C.Fn:05-3 C.Fn:06-0 C.Fn:07-4 C.Fn:08-0 C.Fn:09-2 C.Fn:10-0 C.Fn:11-0 C.Fn:12-0 C.Fn:13-1 C.Fn:14-0 C.Fn:15-0 C.Fn:16-1 C.Fn:17-0 Category Events Subcategory Birthdays Year 2002 Month April Keywords Party Family Friends Funny Subject Jackie People Dad Jackie Robin Tyrone Steve Sharing Family Steve Maria
The Solution: Windows CODEC Pipeline • Built-in CODEC support for most popular image formats and metadata schemas • Extensible framework for CODECs, pixel formats, and metadata • Integrated into Windows desktop for consistent user experience
CODEC Extensibility • Platform provides CODECs for common formats • TIFF, JPEG, PNG, BMP, GIF • You provide CODECs for proprietary image formats • Get same platform support as standard image formats • Enable multiple applications to use your image format, while preserving your IP • Integration with graphics acceleration and display pipeline for WinFX applications
Pixel Format Extensibility • Preserve up to 32 bits per channel of image data • Read, write, and print support (with next generation print path) • Rendering support in future • Platform provides common pixel formats • You can develop your own pixel formats • Provide converters to/from standard formats
Metadata Extensibility • Platform supports common metadata schemas • You define specialized metadata for your purposes • Stored in image file • Preservation of unrecognized metadata during editing
Imaging Architecture Executable Software Pixel Format CODECManager Registry Pixel Converter Name Pixel Converter GUID Format GUID Pixel Format Converter Pixel Format Converter Pixel Format Converter Attributes CODEC Name CODEC GUID CODEC Encoder Decoder Codec Codec Platform Component Block Writer Block Reader Provided by CODEC Implementer Applications using images Image Data Block Metadata Block Data in image file ImagingAPIs CODEC Arbitrator Image File
Scope of CODEC Discovery • Global • Register at installation for automatic run-time discovery • Private • Register at run-time, visible to current process only • Application-specified • Software specifies component by GUID or by Vendor • Specified component must be registered
Participating in Automatic Discovery • Image format specified by pattern encoded in image file • GUIDs are recommended for new image formats to avoid pattern collisions • Register at installation • Specify pattern(s) of supported image format(s) in registry entry
CODEC Discovery Platform Component Provided by CODEC Implementer Applications using images Data in image file Install CODEC with driver or software Register CODEC components Application requests imaging operation Read pattern from image file Check registry for CODECs with matching pattern More than one match? Instantiate matching CODEC and perform requested operation No Yes Go to Arbitration
CODEC Arbitration Platform Component Provided by CODEC Implementer Applications using images Data in image file Go to Arbitration Instantiate each decoder that matches pattern Query each decoder for supported operations on this image Score each decoder based on sum of weights Multiple decoders tied for high score? No Select highest scoring decoder Yes Select first in list of decoders tied for highest score
Registering a Decoder for Discovery HKEY_CLASSES_ROOT\CLSID\{CATID_WICBitmapDecoders}\Instance\{Your Decoder CLSID}\CLSID = {Your Decoder CLSID} HKEY_CLASSES_ROOT\CLSID\{CATID_WICBitmapDecoders}\Instance\{Your Decoder CLSID}\Friendly Name = “Your Decoder’s Name” HKEY_CLASSES_ROOT\CLSID\{Your Decoder CLSID}\Patterns\0\Position = 0 HKEY_CLASSES_ROOT\CLSID\{Your Decoder CLSID}\Patterns\0\Length = 3 HKEY_CLASSES_ROOT\CLSID\{Your Decoder CLSID}\Patterns\0\Pattern = FF D8 FF HKEY_CLASSES_ROOT\CLSID\{Your Decoder CLSID}\InProcServer32\(Default) =“drive:\path\yourdll.dll” HKEY_CLASSES_ROOT\CLSID\{Your Decoder CLSID}\InProcServer32\ThreadingModel = “Both”
Registering a Pixel Format Converter for Discovery HKEY_CLASSES_ROOT\CLSID\{CATID_WICFormatConverters}\Instance\{Your Format Converter CLSID}\CLSID={Your Format Converter CLSID} HKEY_CLASSES_ROOT\CLSID\{CATID_WICFormatConverters}\Instance\{Your Format Converter CLSID}\Friendly Name = “Your Format Converter’s Name” HKEY_CLASSES_ROOT\CLSID\{Your Format Converter CLSID}\PixelFormats\ {PixelFormatGuid1} HKEY_CLASSES_ROOT\CLSID\{Your Format Converter CLSID}\PixelFormats\ {PixelFormatGuid2} . . . HKEY_CLASSES_ROOT\CLSID\{Your Format Converter CLSID}\PixelFormats\ {PixelFormatGuidN} HKEY_CLASSES_ROOT\CLSID\{Your Format Converter CLSID}\InProcServer32\(Default) = “drive:\path\yourdll.dll” HKEY_CLASSES_ROOT\CLSID\{Your Format Converter CLSID}\InProcServer32\ThreadingModel = “Both”
Registering a Metadata Reader for Discovery HKEY_CLASSES_ROOT\CLSID\{CATID_WICMetadataReaders}\Instance\{Your Metadata Handler CLSID}\CLSID = {Your Metadata Handler CLSID} HKEY_CLASSES_ROOT\CLSID\{CATID_WICMetadataReaders}\ Instance\{Your Metadata Handler CLSID}\Friendly Name = “Your Metadata Handler’s Name” HKEY_CLASSES_ROOT\CLSID\{Your CLSID}\Containers\{ContainerFormatGUID}\0\Position = 0 HKEY_CLASSES_ROOT\CLSID\{Your CLSID}\Containers\{ContainerFormatGUID}\0\Pattern = 74 58 4D 50 HKEY_CLASSES_ROOT\CLSID\{Your CLSID}\Containers\{ContainerFormatGUID}\0\Mask = FF FF FF FF HKEY_CLASSES_ROOT\CLSID\{Your CLSID}\Containers\{ContainerFormatGUID}\0\DataOffset = 4
Participating in Arbitration • IWICBitmapDecoder.QueryCapability ( IStream *pStream, DWORD *pCapability ); • enum WICBitmapDecoderCapabilities { WICBitmapDecoderCapabilitiesSameEncoder, WICBitmapDecoderCapabilityCanDecodeAllImages, WICBitmapDecoderCapabilityCanDecodeSomeImages, WICBitmapDecoderCapabilityCanDecodeThumbnail, WICBitmapDecoderCapabilityCanEnumerateMetadata }
CODEC Class Hierarchy IUnknown IWIC Imaging Factory IWIC Palette IWIC Bitmap Source IWIC Bitmap Decoder IWIC Bitmap Encoder IWIC Bitmap FrameEncode IWIC Bitmap IWIC Bitmap Scaler IWIC Bitmap Clipper IWIC Bitmap FlipRotator IWIC Format Converter IWIC Bitmap FrameDecode
CODEC Extensibility Interfaces Decoders implement: IWICBitmapDecoder IWICBitmapFrameDecode IWICMetadataBlockReader IWICBitmapSource Pixel Format Converters implement: IWICFormatConverter IWICBitmapSource • Encoders implement: • IWICBitmapEncoder • IWICBitmapFrameEncode • IWICMetadataBlockWriter
Metadata Handler Class Hierarchy IUnknown IWIC MetadataQueryReader IWIC StreamProvider IPersist IPersist Stream IWIC MetadataQueryWriter IWIC PersistStream
Metadata Handler Extensibility Interfaces • Medata Readers implement • IWICMetadataReader • IWICPersistStream • IWICStreamProvider • Metadata Writers implement • IWICMetadataWriter • IWICPersistStream • IWICMetadataReader • Use UnknownMetadataHandler to read/write unrecognized blocks
Imaging as Part of the Developer Platform • Avalon is the next generation platform for Windows client applications and content • Part of WinFX, along with Indigo and WinFS • Consistent programming model for user interface, graphics, media, and documents • Uses Direct3D as its hardware acceleration abstraction • Printing and remoting pipelines being evolved to match rendering model and provide greater fidelity • Releasing as part of Windows codenamed “Longhorn” • Concurrent release for Windows XP SP2 and Windows Server 2003
Summary • Providing CODECs for proprietary image formats gives you platform support while preserving your IP • Preservation of up to 32 bpc of image data supports broader color gamuts and greater dynamic range • You can define new types of metadata and store it in the image file, just like standard metadata
Call to Action • Use the platform provided CODECs for common image formats • Migrate your proprietary image CODECS to the new platform • Write metadata handlers to read, write, and update specialized metadata • Take advantage of support for 32 bpc image data
Community Resources • Community Sites • http://www.microsoft.com/communities/default.mspx • List of Newsgroups • http://communities2.microsoft.com/communities/newsgroups/en-us/default.aspx • Attend a free chat or webcast • http://www.microsoft.com/communities/chats/default.mspx • http://www.microsoft.com/seminar/events/webcasts/default.mspx • Locate a local user group(s) • http://www.microsoft.com/communities/usergroups/default.mspx • Non-Microsoft Community Sites • http://www.microsoft.com/communities/related/default.mspx
Additional Resources • Email: codecs @ microsoft.com • Web Resources • Online Developer Center: http://msdn.microsoft.com/longhorn/ • Community preview builds for Windows XP SP2 and Windows Server 2003 available now • SDK: http://winfx.msdn.microsoft.com/ • Avalon Newsgroup: microsoft.public.windows.developer.winfx.avalon • Related Sessions • Advances in Windows Printing: Overview • Windows Color System Overview • Ask the Experts • Windows Color • Windows Printing • Avalon Imaging