Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:iDesmI:Wayland
AMF
AMF-1.4.29.obscpio
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File AMF-1.4.29.obscpio of Package AMF
07070100000000000081A400000000000000000000000163CFF5E7000006D3000000000000000000000000000000000000001700000000AMF-1.4.29/LICENSE.txtNotice Regarding Standards. AMD does not provide a license or sublicense to any Intellectual Property Rights relating to any standards, including but not limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 (collectively, the "Media Technologies"). For clarity, you will pay any royalties due for such third party technologies, which may include the Media Technologies that are owed as a result of AMD providing the Software to you. This software uses libraries from the FFmpeg project under the LGPLv2.1. MIT license Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 07070100000001000081A400000000000000000000000163CFF5E70003A297000000000000000000000000000000000000002800000000AMF-1.4.29/amf/doc/AMF_API_Reference.md### Advanced Micro Devices # Advanced Media Framework API Reference ### Programming Guide --- ### Disclaimer The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale. AMD, the AMD Arrow logo, ATI Radeon™, CrossFireX™, LiquidVR™, TrueAudio™ and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. Windows™, Visual Studio and DirectX are trademark of Microsoft Corp. ### Copyright Notice © 2014-2022 Advanced Micro Devices, Inc. All rights reserved Notice Regarding Standards. AMD does not provide a license or sublicense to any Intellectual Property Rights relating to any standards, including but not limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 (collectively, the “Media Technologies”). For clarity, you will pay any royalties due for such third-party technologies, which may include the Media Technologies that are owed as a result of AMD providing the Software to you. ### MIT license Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # Contents 1. [Introduction](#1-introduction) 2. [Definitions, Acronyms and Abbreviations](#2-definitions-acronyms-and-abbreviations) - [AMF API](#amf-api) - [2.1 Elementary Data Types](#21-elementary-data-types) - [2.2 Core Interfaces and Classes](#22-core-interfaces-and-classes) - [2.2.1 AMF Run-time Initialization](#221-amf-run-time-initialization) - [2.2.2 AMFInterface](#222-amfinterface) - [2.2.3 AMFFactory](#223-amffactory) - [2.2.4 AMFDebug](#224-amfdebug) - [2.2.5 AMFTrace](#225-amftrace) - [2.2.6 AMFRect](#226-amfrect) - [2.2.7 AMFSize](#227-amfsize) - [2.2.8 AMFPoint](#228-amfpoint) - [2.2.9 AMFRate](#229-amfrate) - [2.2.10 AMFRatio](#2210-amfratio) - [2.2.11 AMFColor](#2211-amfcolor) - [2.2.12 AMFGuid](#2212-amfguid) - [2.2.13 Variant](#2213-variant) - [2.2.13.1 AMFVariantStruct](#22131-amfvariantstruct) - [2.2.13.2 AMFVariant](#22132-amfvariant) - [2.2.13.3 AMFVariant::String and AMFVariant::WString](#22133-amfvariantstring-and-amfvariantwstring) - [2.2.14 Property Storage](#2214-property-storage) - [2.2.14.1 AMFPropertyStorage](#22141-amfpropertystorage) - [2.2.14.2 AMFPropertyStorageObserver](#22142-amfpropertystorageobserver) - [2.2.14.3 AMFPropertyStorageEx](#22143-amfpropertystorageex) - [2.2.14.4 AMFPropertyInfo]() - [2.3 Memory Objects](#23-memory-objects) - [2.3.1 AMFData](#231-amfdata) - [2.3.2 Buffers](#232-buffers) - [2.3.2.1 AMFBuffer](#2321-amfbuffer) - [2.3.2.2 AMFBufferObserver](#2322-amfbufferobserver) - [2.3.2.3 AMFAudioBuffer](#2323-amfaudiobuffer) - [2.3.2.4 AMFAudioBufferObserver](#2324-amfaudiobufferobserver) - [2.3.3 Surfaces](#233-surfaces) - [2.3.3.1 AMFSurface](#2331-amfsurface) - [2.3.3.2 AMFSurfaceObserver](#2332-amfsurfaceobserver) - [2.3.3.3 AMFPlane](#2333-amfplane) - [2.4 Device Abstraction](#24-device-abstraction) - [2.4.1 AMFContext](#241-amfcontext) - [2.4.2 AMFContext1](#242-amfcontext1) - [2.5 AMF Compute](#25-amf-compute) - [2.5.1 AMFComputeFactory](#251-amfcomputefactory) - [2.5.2 AMFDeviceCompute](#252-amfdevicecompute) - [2.5.3 AMFPrograms](#253-amfprograms) - [2.5.4 AMFCompute](#254-amfcompute) - [2.5.5 AMFComputeKernel](#255-amfcomputekernel) - [2.5.6 AMFComputeSyncPoint](#256-amfcomputesyncpoint) - [2.6 Components](#26-components) - [2.6.1 AMFComponent](#261-amfcomponent) - [2.6.2 AMFCaps](#262-amfcaps) - [2.6.3 AMFIOCaps](#263-amfiocaps) - [2.6.4 AMFDataAllocatorCB](#264-amfdataallocatorcb) 3. [Using AMF API](#3-using-amf-api) ## 1 Introduction AMF SDK is intended to assist Independent Software Vendors (ISV) in development of multimedia applications using AMD GPU and APU devices when the use of Microsoft Media Foundation Framework is undesireable. AMF is a light-weight, portable multimedia framework that abstracts away most of the platform and API-specific details and allows for easy implementation of multimedia applications using a variety of technologies, such as DirectX 9, DirectX 11, DirectX 11.1, DirectX 12, Vulkan, OpenGL, OpenCL, and facilitates an efficient interop between them. The AMF framework is compatible with most recent Radeon GPUs starting with the Southern Islands family and APUs of the Kabini, Kaveri, Carrizo families and newer. The AMF run-time is included in the Windows AMD driver. ## 2 Definitions, Acronyms and Abbreviations | Term | Definition | Comments | | :--------- | :------------------------------ | :------------------------------------------------ | | Stream SDK | Accelerated Parallel Processing | AMD SDK implementing OpenCL spec | | OCL | OpenCL | AMD SDK implementing OpenCL spec | | MF | Media Foundation | Current video/audio framework in Windows | | MFT | Media Foundation Transform | Main element of Media Foundation (filter) | | MMD | Multi Media Driver | AMD driver for low-level multimedia functionality | | UVD | Unified Video Decoder | Fixed function video decoder hardware | | VCE | Video Compression Engine | Fixed function H.264 video encoder hardware | | AMF | AMD Media Framework | AMD C++ API created to build flexible pipelines | | SI | Southern Islands | GPU family | | WinRT | Windows Runtime | Short name for Windows Store Application API | ## AMF API ### 2.1 Elementary Data Types Elementary data types and AMF types are defined to make code potentially portable to other OSs. Detailed list of Elementary Data types is available in `public/include/core/Platform.h` `typedef __int64 amf_int64;` `typedef __int32 amf_int32;` `typedef __int16 amf_int16;` `typedef __int8 amf_int8;` `typedef unsigned __int64 amf_uint64;` `typedef unsigned __int32 amf_uint32;` `typedef unsigned __int16 amf_uint16;` `typedef unsigned __int8 amf_uint8;` `typedef size_t amf_size;` `typedef void amf_handle;` `typedef double amf_double;` `typedef float amf_float;` `typedef void* amf_void;` `typedef bool amf_bool;` `typedef long amf_long;` `typedef int amf_int;` `typedef unsigned long amf_ulong;` `typedef unsigned int amf_uint;` `typedef amf_int64 amf_pts;` `#define AMF_STD_CALL __stdcall` `#define AMF_CDECL_CALL __cdecl` `#define AMF_FAST_CALL __fastcall` `#define AMF_INLINE inline` `#define AMF_FORCEINLINE __forceinline` ### 2.2 Core Interfaces and Classes ### 2.2.1 AMF Run-time Initialization The `AMFFactory` interface is the entry point for the AMF run-time. It is used to create other AMF objects. The AMF run-time is supplied as part of the Windows driver installation. The AMF run-time DLL should be loaded dynamically using the `LoadLibraryW` Win32 function. The name of the DLL is defined by the `AMF_DLL_NAME` macro. Always pass the `AMF_DLL_NAME` macro to `LoadLibraryW` instead of the actual DLL name to ensure code portability as the name might be defined differently depending on the platform: `HMODULE hAMFDll = LoadLibraryW(AMF_DLL_NAME);` To check the run-time version, acquire a pointer to and call the `AMFQueryVersion` function: `AMFQueryVersion_Fn queryVersion = (AMFQueryVersion_Fn)GetProcAddress(hAMFDll, AMF_QUERY_VERSION_FUNCTION_NAME);` `amf_uint64 version = 0;` `AMF_RESULT res = queryVersion(&version);` Acquire a pointer to and call the initialization routine to obtain a pointer to the [`AMFFactory`](#223-amffactory) interface: `AMFInit_Fn init = (AMFInit_Fn)GetProcAddress(hAMFDll, AMF_INIT_FUNCTION_NAME);` `AMFFactory* pFactory(nullptr);` `AMF_RESULT initRes = init(version, &pFactory);` Include `public/include/core/Factory.h` ### 2.2.2 AMFInterface All new objects and components in AMF are implemented in the form of AMF Interfaces. These interfaces are implemented in the form of abstract C++ classes. Most AMF interfaces will be derived from the `AMFInterface` basic interface. It exposes two reference counting methods and a query interface method. All AMF interfaces except [`AMFFactory`](#223-amffactory), `AMFTrace`, `AMFDebug` and `AMFPrograms` inherit from `AMFInterface`. AMF provides a default implementation for `AMFInterface` with self-destroying behavior. The SDK also provides a smart pointer template class for easy interface manipulations. You should never call `delete` on any of the AMF interfaces. Instead, for reference-counted interfaces derived from AMFInterface, call `Acquire` when a new copy of the pointer pointing to an interface is created and `Release` when a pointer is destroyed. For interfaces to static objects, nothing needs to be done to manage their lifecycle. AMF provides the `AMFInterfacePtr_T` template, which implements a “smart” pointer to an AMF interface. `AMFInterfacePtr_T` automatically increments the reference count of the object on assignment and decrements the reference count when going out of scope. Use of smart pointers is highly recommended and encouraged to avoid memory and resource leaks. Include `public/include/core/Interface.h` --- ### AMFInterface::Acquire `amf_long AMF_STD_CALL Acquire();` Increment the reference count on the object. --- ### AMFInterface::Release `amf_long AMF_STD_CALL Release();` Decrement the reference count on the object. --- ### AMFInterface::QueryInterface `AMF_RESULT AMF_STD_CALL QueryInterface(const AMFGuid& interfaceID, void* ppInterface);` Retrieve a pointer to the specified interface implemented by the object. | Parameter | Description | | :---------------- | :------------------------------------------------------------------ | | interfaceID [in] |The identifier of the interface being requested | | ppInterface [out] |The address of a pointer variable that receives a pointer to the interface. The reference counter is incremented by 1 before being placed in `ppInterface`. Do not call `Acquire()` on `ppInterface` unless the pointer is being copied to another variable. Call `Release()` before the pointer is destroyed.| | **Return Value** |`AMF_OK` if the interface is supported, otherwise `AMF_NO_INTERFACE` | ### 2.2.3 AMFFactory The AMFFactory interface is used to create AMF objects. `AMFFactory` is not derived from [`AMFInterface`](#222-amfinterface) and is not reference-counted. Do not destroy the `AMFFactory` interface. --- ### AMFFactory::CreateContext `AMF_RESULT AMF_STD_CALL CreateContext(amf::AMFContext** ppContext);` Create a device context object. | Parameter | Description | | :-------- | :---------- | | ppContext [out] |The address of a pointer variable that receives a pointer to the [`AMFContext`](#241-amfcontext) interface. The reference counter is incremented by 1 before being placed in `ppInterface`. Do not call `Acquire()` on `ppInterface` unless the pointer is being copied to another variable. Call `Release()` before the pointer is destroyed.| | **Return Value** | `AMF_OK` if the interface is supported, otherwise `AMF_NO_INTERFACE`| --- ### AMFFactory::CreateComponent `AMF_RESULT AMF_STD_CALL CreateComponent(amf::AMFContext* pContext, const wchar_t* id, amf::AMFComponent** ppComponent);` Create an AMF component. | Parameter | Description | | :---------------- | :------------------------------------------------------------------------------------------- | | pContext [in] | A pointer to the [`AMFContext`](#241-amfcontext) interface | | id [in] | The identifier of the component being requested | | ppComponent [out] | The address of a pointer variable that receives a pointer to the interface. The reference counter is incremented by 1 before being placed in `ppInterface`. Do not call `Acquire()` on `ppInterface` unless the pointer is being copied to another variable. Call `Release()` before the pointer is destroyed.| | **Return Value** | `AMF_OK` if the component has been successfully instatiated, otherwise `AMF_NOT_SUPPORTED`| --- ### AMFFactory::SetCacheFolder `AMF_RESULT AMF_STD_CALL SetCacheFolder(const wchar_t* path);` Specify a folder used as a cache for precompiled Compute kernels. | Parameter | Description | | :--------------- | :-------------------------------------------------------------------------------------------- | | path [in] | A pointer to a wide character Unicode string containing the folder path | | **Return Value** | <p> `AMF_OK` on success</p><p> `AMF_NOT_FOUND` when the specified folder does not exist</p> | --- ### AMFFactory::GetCacheFolder `const wchar_t* AMF_STD_CALL GetCacheFolder();` Get the Compute kernel cache path previously set with `SetCacheFolder`. | **Return Value** |A constant pointer to a wide character Unicode string containing the path to the Compute kernel cache folder. The string is internally allocated, do not call `free` or `delete` on this pointer.| | :--------------- | :- | --- ### AMFFactory::GetDebug `AMF_RESULT AMF_STD_CALL GetDebug(amf::AMFDebug** ppDebug);` Get a pointer to the `AMFDebug` interface. The `AMFDebug` interface is not reference counted. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------ | | ppDebug [out] | A pointer to a memory location to receive a pointer to the `AMFDebug` interface | | **Return Value** | `AMF_OK` | --- ### AMFFactory::GetTrace `AMF_RESULT AMF_STD_CALL GetTrace(amf::AMFTrace** ppTrace);` Get a pointer to the `AMFTrace` interface. The `AMFTrace` interface is not reference counted. | Parameter | Description | | :--------------- | :-------------------------------------------------------------------------------- | | ppTrace [out] | A pointer to a memory location to receive a pointer to the `AMFTrace` interface | | **Return Value** | `AMF_OK` | --- ### AMFFactory::GetPrograms `AMF_RESULT AMF_STD_CALL GetPrograms(amf::AMFPrograms** ppPrograms);` Get a pointer to the `AMFPrograms` interface. The `AMFPrograms` interface is not reference counted. | Parameter | Description | | :---------------- | :----------------------------------------------------------------------------------------------------- | | AMFPrograms [out] | A pointer to a memory location to receive a pointer to the [`AMFPrograms`](#253-amfprograms) interface | | **Return Value** | `AMF_OK` | ### 2.2.4 AMFDebug The `AMFDebug` interface provides access to the global debugging and performance measurement capabilities in AMF. --- ### AMFDebug::EnablePerformanceMonitor `void AMF_STD_CALL EnablePerformanceMonitor(bool enable);` Enable or disable the AMF Performance Motinor | Parameter | Description | | :---------- | :---------------------------------------------------------- | | enable [in] | `true` to enable performance monitoring, `false` to disable | --- ### AMFDebug::PerformanceMonitorEnabled `bool AMF_STD_CALL PerformanceMonitorEnabled();` Check whether the AMF Performance Monitor is enabled. | **Return Value** | `true` when AMF Performance Monitor is enabled, `false` otherwise | | :--------------- | :---------------------------------------------------------------- | --- ### AMFDebug::AssertEnable `void AMF_STD_CALL AssertsEnable(bool enable);` Enable or disable asserts in AMF objects | Parameter | Description | | :---------- | :-------------------------------------------- | | enable [in] | `true` to enable asserts, `false` to disable | --- ### AMFDebug::AssertsEnabled `bool AMF_STD_CALL AssertsEnabled();` Check whether asserts in AMF components are enabled. | **Return Value** | `true` when asserts are enabled, `false` otherwise | | :--------------- | :------------------------------------------------- | ### 2.2.5 AMFTrace The `AMFTrace` interface provides configuration facilities for AMF tracing functionality. The object which implements the `AMFTrace` interface is not reference counted. Do not delete the object obtained from [`AMFFactory`](#223-amffactory)`::GetTrace`. Include `public/include/core/Trace.h`. --- ### AMFTrace::Trace ### AMFTrace::TraceW `void AMF _STD _CALL TraceW(const wchar _t* src _path, amf _int32 line, amf _int32 level, const wchar _t* scope,amf _int32 countArgs, const wchar _t* format, ...);` `void AMF _STD _CALL Trace(const wchar _t* src _path, amf _int32 line, amf _int32 level, const wchar _t* scope, const wchar _t* format, va _list* pArglist);` Output a trace to all registered traces. By default, AMF outputs all traces to the debug output. What is being output is controlled by trace level. Trace levels are cumulative – every subsequent level includes all messages of the previous level. Each trace specifies a trace level it is associated with. A global trace level is set using the `SetGlobalLevel` method. AMF will output traces with all levels up to the current level. Trace levels are defined as follows: | Level | Description | | :----------------- | :-------------------------------------------------- | | AMF _TRACE _ERROR | Error message | | AMF _TRACE _WARNING| Warning message | | AMF _TRACE _INFO | Info message | | AMF _TRACE _DEBUG | Debug message | | AMF _TRACE _TEST | Test message | | Parameter | Description | | src _path [in] | Name of the source file | | line [in] | Linme number in the soutrce file | | level [in] | Trace level | | scope [in] | Message scope | | countArgs [in] | Number of arguments after `format` or in `pArgList` | | format [in] | A printf-like format string | | pArgList [in] | A variable parameter list | --- ### AMFTrace::SetGlobalLevel `amf _int32 AMF _STD _CALL SetGlobalLevel(amf _int32 level);` Set global trace level. AMF trace will output all message with the trace level below or equal to the global trace level. The following trace levels are accepted: | Level | Description | | :------------------ | :-------------------------------------------- | | AMF _TRACE _ERROR | Error messages only | | AMF _TRACE _WARNING | Warnings and errors | | AMF _TRACE _INFO | Error, warning and info messages | | AMF _TRACE _DEBUG | Error, warning, info and debug messages | | AMF _TRACE _TEST | Error, warning, info, debug and test messages | | AMF _TRACE _NOLOG | Turn off all messages | | Parameter | Description | | level [in] | Global trace level | | **Return Value** | Previous trace level | --- ### AMFTrace::GetGlobalLevel `amf _int32 AMF _STD _CALL GetGlobalLevel();` Get global trace level. | **Return Value** | Current trace level | | :--------------- | :------------------ | --- ### AMFTrace::SetWriterLevel `amf _int32 AMF _STD _CALL SetWriterLevel(const wchar _t* id, amf _int32 level);` Set trace level for a specific writer. This overrides the global trace level for the writer. | Parameter | Description | | :--------------- | :------------------- | | id [in] | Writer ID | | level [in] | Trace level | | **Return Value** | Previous trace level | --- ### AMFTrace::GetWriterLevel `amf _int32 AMF _STD _CALL GetWriterLevel(const wchar _t* ID);` Get trace level for a specific writer. | Parameter | Description | | :--------------- | :------------------ | | id [in] | Writer ID | | **Return Value** | Current trace level | --- ### AMFTrace::SetWriterLevelForScope `amf _int32 AMF _STD _CALL SetWriterLevelForScope(const wchar _t* id, const wchar _t* scope, amf _int32 level);` Set trace level for a specific writer and scope. This overrides the global trace level for the writer. | Parameter | Description | | :--------------- | :------------------- | | id [in] | Writer ID | | scope [in] | Scope | | level [in] | Trace level | | **Return Value** | Previous trace level | --- ### AMFTrace::GetWriterLevelForScope `amf _int32 AMF _STD _CALL GetWriterLevel(const wchar _t* id, const wchar _t* scope);` Get trace level for a specific writer and scope. | Parameter | Description | | :--------------- | :------------------ | | id [in] | Writer ID | | scope [in] | Scope | | **Return Value** | Current trace level | --- ### AMFTrace::SetPath `AMF _RESULT AMF _STD _CALL SetPath(const wchar _t* path);` Set AMF log file path. | Parameter | Description | | :--------------- | :------------------------------------------------------- | | path [in] | Full path to the AMF log file | | **Return Value** | <p>`AMF _OK` on success</p><p>`AMF _FAIL` on failure</p> | --- ### AMFTrace::GetPath `AMF _RESULT AMF _STD _CALL GetPath(wchar _t* path, amf _size* size);` Set AMF log file path. | Parameter | Description | | :--------------- | :----------------------------------------------------------------------------------- | | path [in] | A pointer to a buffer to receive a full path to the AMF log file | | size [in] | A pointer to the buffer size in bytes. Receives the actual length of the path string | | **Return Value** | <p>`AMF _OK` on success</p><p>`AMF _FAIL` on failure</p> | --- ### AMFTrace::Indent `void AMF _STD _CALL Indent(amf _int32 addIndent);` Add trace indentation. The indentation value is added to the current indentation. Positive values shift output to the right, negative – to the left. | Parameter | Description | | :--------------- | :--------------------------------------------- | | addIndent [in] | Indentation in character positions to be added | --- ### AMFTrace::GetIndentation `amf _int32 AMF _STD _CALL GetIndentation();` Get current indentation. | **Return Value** | Current indentation in character positions | | :--------------- | :----------------------------------------- | --- ### AMFTrace::GetResultText `const wchar _t* AMF _STD _CALL GetResultText(AMF _RESULT res);` Convert AMF _RESULT to text. | Parameter | Description | | :--------------- | :--------------------------------------------- | | addIndent [in] | Indentation in character positions to be added | | **Return Value** | Current indentation in character positions | --- ### AMFTrace::SurfaceGetFormatName `const wchar _t* AMF _STD _CALL SurfaceGetFormatName(const AMF _SURFACE _FORMAT eSurfaceFormat);` Convert surface format to a string. | Parameter | Description | | :-------------------- | :------------------------- | | eSurfaceFormat [in] | Surface format as an enum | | **Return Value** | Surface format as a string | --- ### AMFTrace::GetMemoryTypeName `const wchar _t* const AMF _STD _CALL GetMemoryTypeName(const AMF _MEMORY _TYPE memoryType);` Convert memory type to a string. | Parameter | Description | | :---------------- | :---------------------- | | memoryType [in] | Memory type as an enum | | **Return Value** | Memory type as a string | --- ### AMFTrace::RegisterWriter `void AMF _STD _CALL RegisterWriter(const wchar _t* writerID, AMFTraceWriter* pWriter, bool enable);` Register a custom trace writer. Custom trace writers allow you to extend functionality of AMF trace by allowing to write to other 3rd party logs, such as other applications’ log files. Every writer must implement the `AMFTraceWriter` interface and have a unique writer ID. | Parameter | Description | | :-------------- | :--------------------------------------------- | | writerID [in] | A unique writer ID | | pWriter [in] | Pointer to the `AMFTraceWriter` interface | | enable [in] | Initial state of the writer after registration | --- ### AMFTrace::UnregisterWriter `void AMF _STD _CALL UnregisterWriter(const wchar _t* writerID);` Unregister a previously registered writer. | Parameter | Description | | :-------------- | :----------------- | | writerID [in] | A unique writer ID | --- ### 2.2.6 AMFRect The `AMFRect` structure represents a rectangle defined by coordinates of its top-left and bottom-right corners. --- ### AMFRect::left `amf_int32 left;` The X coordinate of the top-left corner --- ### AMFRect::top `amf_int32 top;` The Y coordinate of the top-left corner --- ### AMFRect::right `amf_int32 right;` The X coordinate of the bottom-right corner --- ### AMFRect::bottom `amf_int32 bottom;` The Y coordinate of the bottom-right corner --- ### AMFRect::Width `amf_int32 Width() const;` Calculate the width of a rectangle --- ### AMFRect::Height `amf_int32 Height() const;` Calculate the height of a rectangle --- ### AMFRect::operator== `bool operator==(const AMFRect& other) const;` Compare two `AMFRect` structures | Parameter | Description | | :--------------- | :--------------------------------------------------------- | | other [in] | A reference to the `AMFRect` structure to be compared with | | **Return Value** | `true` if structures are equal, `false` otherwise | --- ### AMFRect::operator!= `bool operator!=(const AMFRect& other) const;` Compare two `AMFRect` structures | Parameter | Description | | :--------------- | :--------------------------------------------------------- | | other [in] | A reference to the `AMFRect` structure to be compared with | | **Return Value** | `true` if structures are not equal, `false` otherwise | --- ### AMFConstructRect `AMFRect AMFConstructRect(amf_int32 left, amf_int32 top, amf_int32 right, amf_int32 bottom);` The initializer function for `AMFRect`. | Parameter | Description | | :--------------- | :-------------------------------------------------------- | | left [in] | The X coordinate of the top-left corner | | top [in] | The Y coordinate of the top-left corner | | right [in] | The X coordinate of the bottom-right corner | | bottom [in] | The Y coordinate of the bottom-right corner | | **Return Value** | An instance of `AMFRect` initialized with supplied values | ### 2.2.7 AMFSize The `AMFSize` structure represents a size (width and height) of a two-dimensional rectangular area --- ### AMFSize::width `amf_int32 width;` The size of the horizontal dimension of a rectangular area --- ### AMFSize::height `amf_int32 height;` The size of the vertical dimension of a rectangular area --- ### AMFSize::operator== `bool operator==(const AMFSize& other) const;` Compare two `AMFSize` structures | Parameter | Description | | :--------------- | :--------------------------------------------------------- | | other [in] | A reference to the `AMFSize` structure to be compared with | | **Return Value** | `true` if structures are equal, `false` otherwise | --- ### AMFSize::operator!= `bool operator!=(const AMFSize& other) const;` Compare two `AMFSize` structures | Parameter | Description | | :--------------- | :--------------------------------------------------------- | | other [in] | A reference to the `AMFSize` structure to be compared with | | **Return Value** | `true` if structures are not equal, `false` otherwise | --- ### AMFConstructSize `AMFSize AMFConstructSize(amf_int32 width, amf_int32 height);` The initializer function for `AMFRect`. | Parameter | Description | | :--------------- | :-------------------------------------------------------- | | width [in] | The width of the area | | height [in] | The height of the area | | **Return Value** | An instance of `AMFSize` initialized with supplied values | --- ### 2.2.8 AMFPoint The `AMFPoint` structure represents a point in a two-dimensional space --- ### AMFPoint::x `amf_int32 x;` The horizontal coordinate of a point --- ### AMFPoint::y `amf_int32 y;` The vertical coordinate of a point --- ### AMFPoint::operator== `bool operator==(const AMFPoint& other) const;` Compare two `AMFPoint` structures | Parameter | Description | | :--------------- | :---------------------------------------------------------- | | other [in] | A reference to the `AMFPoint` structure to be compared with | | **Return Value** | `true` if structures are equal, `false` otherwise | --- ### AMFPoint::operator!= `bool operator!=(const AMFPoint& other) const;` Compare two `AMFPoint` structures | Parameter | Description | | :--------------- | :---------------------------------------------------------- | | other [in] | A reference to the `AMFPoint` structure to be compared with | | **Return Value** | `true` if structures are not equal, `false` otherwise | --- ### AMFConstructPoint `AMFPoint AMFConstructPoint(amf_int32 x, amf_int32 y);` The initializer function for `AMFPoint`. | Parameter | Description| | :--------------- | :- | | x [in] | The horizontal coordinate of a point | | y [in] | The vertical coordinate of a point | | **Return Value** | An instance of `AMFPoint` initialized with supplied values | --- ### 2.2.9 AMFRate The `AMFRate` structure represents a frame rate in the form of numerator and denominator --- ### AMFRate::num `amf_int32 num;` The numerator --- ### AMFRate::den `amf_int32 den;` The denominator --- ### AMFRate::operator== `bool operator==(const AMFRate& other) const;` Compare two `AMFRate` structures | Parameter | Description | | :--------------- | :--------------------------------------------------------- | | other [in] | A reference to the `AMFRate` structure to be compared with | | **Return Value** | `true` if structures are equal, `false` otherwise | --- ### AMFRate::operator!= `bool operator!=(const AMFRate& other) const;` Compare two `AMFRate` structures | Parameter | Description | | :--------------- | :--------------------------------------------------------- | | other [in] | A reference to the `AMFRate` structure to be compared with | | **Return Value** | `true` if structures are not equal, `false` otherwise | --- ### AMFConstructRate `AMFRate AMFConstructRate(amf_int32 num, amf_int32 den);` The initializer function for `AMFRate`. | Parameter | Description | | :--------------- | :-------------------------------------------------------- | | num [in] | The numerator | | den [in] | The denominator | | **Return Value** | An instance of `AMFRate` initialized with supplied values | ### 2.2.10 AMFRatio The `AMFRatio` structure represents an aspect ratio of a rectangular area in the form of numerator and denominator --- ### AMFRatio::num `amf_int32 num;` The numerator --- ### AMFRatio::den `amf_int32 den;` The denominator --- ### AMFRatio::operator== `bool operator==(const AMFRatio& other) const;` Compare two `AMFRatio` structures | Parameter | Description | | :--------------- | :---------------------------------------------------------- | | other [in] | A reference to the `AMFRatio` structure to be compared with | | **Return Value** | `true` if structures are equal, `false` otherwise | --- ### AMFRate::operator!= `bool operator!=(const AMFRatio& other) const;` Compare two `AMFRatio` structures | Parameter | Description | | :--------------- | :---------------------------------------------------------- | | other [in] | A reference to the `AMFRatio` structure to be compared with | | **Return Value** | `true` if structures are not equal, `false` otherwise | --- ### AMFConstructRatio `AMFRatio AMFConstructRatio(amf_int32 num, amf_int32 den);` The initializer function for `AMFRatio`. | Parameter | Description | | :--------------- | :--------------------------------------------------------- | | num [in] | The numerator | | den [in] | The denominator | | **Return Value** | An instance of `AMFRatio` initialized with supplied values | --- ### 2.2.11 AMFColor The `AMFColor` structure represents a 32-bit ARGB color value --- ### AMFColor::r `amf_int8 r;` The red color component --- ### AMFColor::g `amf_int8 g;` The green color component --- ### AMFColor::b `amf_int8 b;` The blue color component --- ### AMFColor::a `amf_int8 a;` The alpha component --- ### AMFColor::rgba `amf_int32 rgba;` The composite representation (RGBA) of a color. --- ### AMFColor::operator== `bool operator==(const AMFColor& other) const;` Compare two `AMFColor` structures | Parameter | Description | | :--------------- | :---------------------------------------------------------- | | other [in] | A reference to the `AMFColor` structure to be compared with | | **Return Value** | `true` if structures are equal, `false` otherwise | --- ### AMFColor::operator!= `bool operator!=(const AMFColor& other) const;` Compare two `AMFColor` structures | Parameter | Description | | :--------------- | :---------------------------------------------------------- | | other [in] | A reference to the `AMFColor` structure to be compared with | | **Return Value** | `true` if structures are not equal, `false` otherwise | --- ### AMFConstructColor `AMFColor AMFConstructColor(amf_int8 r, amf_int8 g, amf_int8 b, amf_int8 a);` The initializer function for `AMFRatio`. | Parameter | Description | | :--------------- | :--------------------------------------------------------- | | r [in] | The red component | | g [in] | The green component | | b [in] | The blue component | | a [in] | The alpha component | | **Return Value** | An instance of `AMFColor` initialized with supplied values | --- ### 2.2.12 AMFGuid The `AMFGuid` structure represents a 128-bit globally unique identifier (GUID) --- ### AMFGuid::AMFGuid `AMFGuid(amf_uint32 _data1, amf_uint16 _data2, amf_uint16 _data3, amf_uint8 _data41, amf_uint8 _data42, amf_uint8 _data43, amf_uint8 _data44, amf_uint8 _data45, amf_uint8 _data46, amf_uint8 _data47, amf_uint8 _data48);` The object’s constructor. --- ### AMFGuid::operator== `bool operator==(const AMFGuid& other) const;` Compare two `AMFGuid` structures | Parameter | Description | | :--------------- | :--------------------------------------------------------- | | other [in] | A reference to the `AMFGuid` structure to be compared with | | **Return Value** | `true` if structures are equal, `false` otherwise | --- ### AMFGuid::operator!= `bool operator!=(const AMFGuid& other) const;` Compare two `AMFGuid` structures | Parameter | Description | | :--------------- | :--------------------------------------------------------- | | other [in] | A reference to the `AMFGuid` structure to be compared with | | **Return Value** | `true` if structures are not equal, `false` otherwise | --- ### AMFCompareGUIDs `bool AMFCompareGUIDs(const AMFGuid& guid1, const AMFGuid& guid2);` The global GUID comparator function for `AMFGuid`. | Parameter | Description | | :--------------- | :------------------------------------------------------ | | guid1 [in] | The first GUID to compare | | guid2 [in] | The second GUID to compare | | **Return Value** | `true` when both GUIDs are identical, `false` otherwise | --- ### 2.2.13 Variant ### 2.2.13.1 AMFVariantStruct The `AMFVariantStruct` structure implements a universal typeless storage for basic types. The following types are supported (represented by the `AMF_VARIANT_TYPE` enumeration): | Type | Description | | :-------------------- | :----------------------------------------------------------------- | | AMF_VARIANT_EMPTY | An empty variant which does not contain any value | | AMF_VARIANT_BOOL | A Boolean | | AMF_VARIANT_INT64 | A 64-bit signed integer | | AMF_VARIANT_DOUBLE | A double precision floating point | | AMF_VARIANT_RECT | A rectangle represented by `AMFRect` | | AMF_VARIANT_SIZE | A two-dimensional size (width and height) represented by `AMFSize` | | AMF_VARIANT_POINT | A point in a two-dimensional space represented by `AMFPoint` | | AMF_VARIANT_RATE | A frame rate represented by `AMFRate` | | AMF_VARIANT_RATIO | An aspect ratio represented by `AMFRatio` | | AMF_VARIANT_COLOR | An ARGB color represented by `AMFColor` | | AMF_VARIANT_STRING | An ASCII string | | AMF_VARIANT_WSTRING | A wide Unicode (UTF-16LE) string | | AMF_VARIANT_INTERFACE | An interface pointer | The `AMFVariantStruct` structure provides a plain C encapsulation of a typeless variable. For C++ it is advised to use the `AMFVariant` class instead. --- ### Initialization Functions `AMF_RESULT AMF_CDECL_CALL AMFVariantInit(AMFVariantStruct* pVariant);` Initialize a variant. This function initializes a variant structure and sets its type to `AMF_VARIANT_EMPTY`. `AMF_RESULT AMF_CDECL_CALL AMFVariantClear(AMFVariantStruct* pVariant);` Clear the variant by setting its type to `AMF_VARIANT_EMPTY`. If the variant contains a non-null pointer to an interface, the `Release()` method will be called on the interface. | Parameter | Description | | :--------------- | :------------------------------------------- | | _variant [in] | A pointer to an `AMFVariantStruct` structure | | **Return Value** | `AMF_OK` | --- ### AMFVariantGetType `AMF_VARIANT_TYPE AMF_STD_CALL AMFVariantGetType(const AMFVariantStruct* _variant);` `AMF_VARIANT_TYPE& AMF_STD_CALL AMFVariantGetType(AMFVariantStruct* _variant);` Get the type of data stored in a variant. The second version of the function returns the lvalue of the variant type. | Parameter | Description | | :--------------- | :---------------------------------------------------------- | | _variant [in] | A pointer to an `AMFVariantStruct` structure | | **Return Value** | A value/reference to a value of the `AMF_VARIANT_TYPE` type | --- ### Type Cast Functions `amf_bool AMF_STD_CALL AMFVariantGetBool(const AMFVariantStruct* _variant);` `amf_int64 AMF_STD_CALL AMFVariantGetInt64(const AMFVariantStruct* _variant);` `amf_double AMF_STD_CALL AMFVariantGetDouble(const AMFVariantStruct* _variant);` `const char* AMF_STD_CALL AMFVariantGetString(const AMFVariantStruct* _variant);` `const wchar_t* AMF_STD_CALL AMFVariantGetWString(const AMFVariantStruct* _variant);` `const AMFInterface* AMF_STD_CALL AMFVariantGetInterface(const AMFVariantStruct* _variant);` `AMFInterface* AMF_STD_CALL AMFVariantGetInterface(AMFVariantStruct* _variant);` `const AMFRect& AMF_STD_CALL AMFVariantGetRect (const AMFVariantStruct* _variant);` `const AMFSize& AMF_STD_CALL AMFVariantGetSize (const AMFVariantStruct* _variant);` `const AMFPoint& AMF_STD_CALL AMFVariantGetPoint(const AMFVariantStruct* _variant);` `const AMFRate& AMF_STD_CALL AMFVariantGetRate (const AMFVariantStruct* _variant);` `const AMFRatio& AMF_STD_CALL AMFVariantGetRatio(const AMFVariantStruct* _variant);` `const AMFColor& AMF_STD_CALL AMFVariantGetColor(const AMFVariantStruct* _variant);` Cast a variant to a basic type. | Parameter | Description | | :--------------- | :------------------------------------------------- | | _variant [in] | A pointer to an `AMFVariantStruct` structure | | **Return Value** | A value/reference to a value stored in the variant | --- ### Type Assignment Functions `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignBool(AMFVariantStruct* pDest, bool value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignInt64(AMFVariantStruct* pDest, amf_int64 value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignDouble(AMFVariantStruct* pDest, amf_double value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignString(AMFVariantStruct* pDest, const char* value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignWString(AMFVariantStruct* pDest, const wchar_t* value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignInterface(AMFVariantStruct* pDest, AMFInterface* value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRect(AMFVariantStruct* pDest, const AMFRect& value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignSize(AMFVariantStruct* pDest, const AMFSize& value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignPoint(AMFVariantStruct* pDest, const AMFPoint& value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRate(AMFVariantStruct* pDest, const AMFRate& value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRatio(AMFVariantStruct* pDest, const AMFRatio& value);` `AMF_RESULT AMF_CDECL_CALL AMFVariantAssignColor(AMFVariantStruct* pDest, const AMFColor& value);` Assign a value of a specific type to a variant | Parameter | Description | | :--------------- | :------------------------------------------------- | | pDest [in] | A pointer to an `AMFVariantStruct` structure | | Value [in] | A value to be assigned | | **Return Value** | A value/reference to a value stored in the variant | --- ### AMFVariantCompare `AMF_RESULT AMF_CDECL_CALL AMFVariantCompare(const AMFVariantStruct* pFirst, const AMFVariantStruct* pSecond, bool& equal);` Compare two variants for equality. Two variants are equal when and only when their types and their values are equal. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------- | | pFirst [in] | A pointer to the first `AMFVariantStruct` structure to be compared | | pSecond [in] | A pointer to the second `AMFVariantStruct` structure to be compared | | equal [out] | `true` when both variants are equal, `false` otherwise | | **Return Value** | `AMF_OK` on success<br>`AMF_INVALID_POINTER` when either `pFirst` or `pSecond` are `nullptr` | --- ### AMFVariantCopy `AMF_RESULT AMF_CDECL_CALL AMFVariantCopy(AMFVariantStruct* pDest, const AMFVariantStruct* pSrc);` Copy a variant. The destination will be cleared first by calling the `AMFVariantClear` function, then safely overwritten. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------- | | pDest [in] | A pointer to the destination `AMFVariantStruct` structure | | pSrc [in] | A pointer to the source `AMFVariantStruct` structure | | **Return Value** | `AMF_OK` on success<br>`AMF_INVALID_POINTER` when either `pSrc` or `pDest` are `nullptr` | --- ### AMFVariantChangeType `AMF_RESULT AMF_CDECL_CALL AMFVariantChangeType(AMFVariantStruct* pDest, const AMFVariantStruct* pSrc, AMF_VARIANT_TYPE newType);` Copy a variant changing the type of a value stored in a variant and performing the necessary data conversion. The original variant is left unmodified. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pDest [in] | A pointer to the destination `AMFVariantStruct` structure | | pSrc [in] | A pointer to the source `AMFVariantStruct` structure | | newType [in] | A type the source variant shall be converted to | | **Return Value** | <p>`AMF_OK` on success<br>`AMF_INVALID_POINTER` when either `pSrc` or `pDest` are `nullptr`</p><p>`AMF_OUT_OF_MEMORY` when there is not enough free memory to perform the conversion</p> | --- ### 2.2.13.2 AMFVariant The `AMFVariant` class is a C++ wrapper around the `AMFVariantStruct` structure and has the equivalent functionality. It is recommended that `AMFVariant` be used in C++, rather than `AMFVariantStruct`. `AMFVariant` inherits from `AMFVariantStruct`. --- ### Contructors `AMFVariant();` `template<typename T>` `explicit AMFVariant(const AMFInterfacePtr_T<T>& pValue);` `explicit AMFVariant(amf_bool value);` `explicit AMFVariant(amf_int64 value);` `explicit AMFVariant(amf_uint64 value);` `explicit AMFVariant(amf_int32 value);` `explicit AMFVariant(amf_uint32 value);` `explicit AMFVariant(amf_double value);` `explicit AMFVariant(const AMFRect& value);` `explicit AMFVariant(const AMFSize& value);` `explicit AMFVariant(const AMFPoint& value);` `explicit AMFVariant(const AMFRate& value);` `explicit AMFVariant(const AMFRatio& value);` `explicit AMFVariant(const AMFColor& value);` `explicit AMFVariant(const char* value);` `explicit AMFVariant(const wchar_t* value);` `explicit AMFVariant(AMFInterface* pValue);` Create and initialize an instance of `AMFVariant`. | Parameter | Description | | :-------------------- | :------------------------------------------------------------ | | pValue, value [in] | An initial value to be assigned to the instance being created | --- ### Copy Constructors `AMFVariant(const AMFVariant& other);` `explicit AMFVariant(const AMFVariantStruct& other);` `explicit AMFVariant(const AMFVariantStruct* pOther);` Create and initialize an instance of `AMFVariant` with a value of another `AMFVariant` or `AMFVariantStruct`. | Parameter | Description | | :------------------- | :------------------------------------------------------------ | | pOther, other [in] | An initial value to be assigned to the instance being created | --- ### Assignment Operators `AMFVariant& operator=(const AMFVariantStruct& other);` `AMFVariant& operator=(const AMFVariantStruct* pOther);` `AMFVariant& operator=(const AMFVariant& other);` `AMFVariant& operator=(amf_bool value);` `AMFVariant& operator=(amf_int64 value);` `AMFVariant& operator=(amf_uint64 value);` `AMFVariant& operator=(amf_int32 value);` `AMFVariant& operator=(amf_uint32 value);` `AMFVariant& operator=(amf_double value);` `AMFVariant& operator=(const AMFRect& value);` `AMFVariant& operator=(const AMFSize& value);` `AMFVariant& operator=(const AMFPoint& value);` `AMFVariant& operator=(const AMFRate& value);` `AMFVariant& operator=(const AMFRatio& value);` `AMFVariant& operator=(const AMFColor& value);` `AMFVariant& operator=(const char* value);` `AMFVariant& operator=(const wchar_t* value);` `AMFVariant& operator=(AMFInterface* value);` `template<typename T>` `AMFVariant& operator=(const AMFInterfacePtr_T<T>& value);` Assign a value to a variant. | Parameter | Description | | :-------------------------- | :--------------------- | | pOther, other, value [in] | A value to be assigned | --- ### Comparison Operators `bool operator==(const AMFVariantStruct& other) const;` `bool operator==(const AMFVariantStruct* pOther) const;` `bool operator!=(const AMFVariantStruct& other) const;` `bool operator!=(const AMFVariantStruct* pOther) const;` Compare two variants for equality. Two variants are equal when and only when their types and their values are equal. | Parameter | Description | | :------------------- | :----------------------------------------------------------- | | pOther, other [in] | An initial value to be assigned to the instance being created| | **Return Value** | <p>`true` when both variants are equal, `false` otherwise for `operator==`</p><p>`false` when both variants are equal, `true` otherwise for `operator!=`</p>| --- ### AMFVariant::Empty `bool AMFVariant::Empty() const;` Check if the variant has been assigned a value. | **Return Value** | `true` when the variant is empty, `false` otherwise | | :--------------- | :-------------------------------------------------- | --- ### AMFVariant::Clear `void Clear();` Clear the variant by setting its type to `AMF_VARIANT_EMPTY`. If the variant contains a non-null pointer to an interface, the `Release()` method will be called on the interface. --- ### Explicit Type Conversions `amf_bool ToBool() const;` `amf_int64 ToInt64() const;` `amf_uint64 ToUInt64() const;` `amf_int32 ToInt32() const;` `amf_uint32 ToUInt32() const;` `amf_double ToDouble() const;` `amf_float ToFloat() const;` `AMFRect ToRect() const;` `AMFSize ToSize() const;` `AMFPoint ToPoint() const;` `AMFRate ToRate() const;` `AMFRatio ToRatio() const;` `AMFColor ToColor() const;` `AMFInterface* ToInterface() const;` `String ToString() const;` `WString ToWString() const;` Explicitly convert a variant to a simple type. Important Notes: Conversion will always succeed regardless of the variant type, but the result of conversion might be meaningless. `ToInterface` does not call `Acquire` on the interface being returned, leaving it up to the caller. This makes it safe to use with smart pointers. `ToString` and `ToWString` return an instance of a container class of type `AMFVariant::String` and `AMFVariant::WString` respectively. These containers store a copy of the string contained in the variant and can maintain their lifecycle independently of the variant they were obtained from. | **Return Value** | The value of the variant cast to the corresponding type | | :--------------- | :------------------------------------------------------ | --- ### Implicit Casts `operator amf_bool() const;` `operator amf_int64() const;` `operator amf_uint64() const;` `operator amf_int32() const;` `operator amf_uint32() const;` `operator amf_double() const;` `operator amf_float() const;` `operator AMFRect () const;` `operator AMFSize () const;` `operator AMFPoint() const;` `operator AMFRate () const;` `operator AMFRatio() const;` `operator AMFColor() const;` `operator AMFInterface*() const;` Implicitly cast a variant to a simple type. While implicit casts are available for convenience, it is high recommended to use explicit type conversions instead as a safe programming practice. | **Return Value** | The value of the variant cast to the corresponding type | | :--------------- | :------------------------------------------------------ | --- ### AMFVariant::ChangeType `void ChangeType(AMF_VARIANT_TYPE type, const AMFVariant* pSrc = nullptr);` Change type of a variant, optionally copying the value from another variant. | Parameter | Description | | :---------- | :----------------------------------------------------------------------------------------------------------------------- | | pSrc [in] | A pointer to the source `AMFVariant` object. When this parameter is set to `nullptr`, the object’s own type is converted | | type [in] | A type the source variant shall be converted to | --- ### AMFVariant::Attach `void Attach(AMFVariantStruct& variant);` Attach another variant to the `AMFVariant` object, transferring the ownership of the content. The original `AMFVariantStruct` is invalidated and set to `AMF_VARIANT_EMPTY`. | Parameter | Description | | :------------- | :-------------------------------------------------------------------------------------------------------------- | | variant [in] | A reference to an `AMFVariantStruct` structure or an `AMFVariant` object to be attached to the current instance | --- ### AMFVariant::Detach `AMFVariantStruct Detach();` Detach and return the value of the `AMFVariant` object as another variant, transferring the ownership of the content. The original `AMFVariant` object is invalidated and set to `AMF_VARIANT_EMPTY`. | **Return Value** | The value of the variant | | :--------------- | :----------------------- | --- ### 2.2.13.3 AMFVariant::String and AMFVariant::WString The `AMFVariant::String` and `AMFVariant::WString` classes are specialized containers that encapsulate ASCII and wide-character Unicode strings in a manner that makes them safe to pass across DLL and C runtime boundaries as they encapsulate memory allocations and deallocations. --- ### Constructors `String();` `WString();` `String(const char* str);` `WString(const wchar_t* str);` `String(const String& other);` `String(String&& other);` `WString(const WString& other);` `WString(WString&& other);` Construct and initialize a `String/WString` object. | Parameter | Description | | :---------------- | :------------------------------------------------------------ | | str, other [in] | An initial value to be assigned to the instance being created | --- ### Assignment Operators `String& operator=(const String& p_other);` `String& operator=(String&& p_other);` `WString& operator=(const WString& p_other);` `WString& operator=(WString&& p_other);` Assign a value to a `String/WString` object. --- ### Comparison Operators `bool operator==(const String& p_other) const;` `bool operator==(const WString& p_other) const;` `bool operator!=(const String& p_other) const;` `bool operator!=(const WString& p_other) const;` Compare the value to another String/WString object. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | | other [in] | A reference to the object to be compared with | | **Return Value** | <p>`true` when both strings are equal, `false` otherwise for `operator==`</p><p>`false` when both strings are equal, `true` otherwise for `operator!=`</p> | --- ### AMFVariant::String::c_str, ### AMFVariant::WString::c_str `const char* c_str() const` `const wchar_t* c_str() const` Get a temporary pointer to the string’s internal buffer. This buffer should not be saved in any place that might outlive the `String/WString` object itself. | **Return Value** | A pointer to the buffer containing a null-terminated string | | :--------------- | :---------------------------------------------------------- | --- ### AMFVariant::String::size, ### AMFVariant::WString::size `size_t size() const;` Return the size (length) of the string in characters. | **Return Value** | The size of the string in characters | | :--------------- | :----------------------------------- | --- ### 2.2.14 Property Storage ### 2.2.14.1 AMFPropertyStorage Most objects in AMF implement the `AMFPropertyStorage` or `AMFPropertyStorageEx` interfaces. `AMFPropertyStorage` implements a property map with a string as an ID and the `AMFVariantStruct` structure as data. The default implementation is `not thread-safe.` Include `public/include/core/PropertyStorage.h` --- ### AMFPropertyStorage::SetProperty `AMF_RESULT AMF_STD_CALL SetProperty(const wchar_t* name, AMFVariantStruct value);` `template<typename _T> AMF_RESULT AMF_STD_CALL SetProperty(const wchar_t* name, const _T& value);` Set a property on an object | Parameter | Description | | :--------------- | :---------------------------------- | | name [in] | The name of the property to be set | | value [in] | The value of the specified property | | **Return Value** | `AMF_OK` | --- ### AMFPropertyStorage::GetProperty `AMF_RESULT AMF_STD_CALL GetProperty(const wchar_t* name, AMFVariantStruct* pValue) const;` `template<typename _T> AMF_RESULT AMF_STD_CALL GetProperty(const wchar_t* name, _T* pValue) const;` Retrieve a property value from property storage | Parameter | Description | | :--------------- | :--------------------------------------------------------------------- | | name [in] | The name of the property to be set | | value [out] | A pointer to a location to receive the value of the specified property | | **Return Value** | `AMF_OK` or `AMF_NOT_FOUND` when the requested property is not defined | --- ### AMFPropertyStorage::GetPropertyString `template<typename _T> AMF_RESULT AMF_STD_CALL GetPropertyString(const wchar_t* name, _T* pValue) const;` Retrieve the value of a property from property storage as string. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | name [in] | The name of the property to be set | | value [out] | A pointer to a location to receive the value of the specified property. The object receiving the value must have the assignment operator accepting a plain C string defined. | | **Return Value** | `AMF_OK` or `AMF_NOT_FOUND` when the requested property is not defined | --- ### AMFPropertyStorage::GetPropertyWString `template<typename _T> AMF_RESULT AMF_STD_CALL GetPropertyWString(const wchar_t* name, _T* pValue) const;` Retrieve the value of a property from property storage as string. | Parameter | Description| | :--------------- | :- | | name [in] | The name of the property to be set| | value [out] | A pointer to a location to receive the value of the specified property. The object receiving the value must have the assignment operator accepting a plain C wide string defined.| | **Return Value** | `AMF_OK` or `AMF_NOT_FOUND` when the requested property is not defined| --- ### AMFPropertyStorage::HasProperty `bool AMF_STD_CALL HasProperty(const wchar_t* name) const;` Check if a property exists | Parameter | Description | | :--------------- | :------------------------------------------------ | | name [in] | The name of the property to be checked | | **Return Value** | `true` if the property exists, `false` otherwise. | --- ### AMFPropertyStorage::GetPropertyCount `amf_size AMF_STD_CALL GetPropertyCount() const;` Get the number of properties stored in a property storage. A property’s value needs to be explicitly set with `SetProperty()`, `AddTo()` or `CopyTo()` methods to be counted. | **Return Value** | Total number of properties in the property storage. | | :--------------- | :-------------------------------------------------- | --- ### AMFPropertyStorage::GetPropertyAt `AMF_RESULT AMF_STD_CALL GetPropertyAt(amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue) const;` Retrieve the value of a property at a particular location specified by an index | Parameter | Description | | :-------------- | :--------------------------------------------------------------------- | | index [in] | A zero-based index of the property to be retrieved | | name [out] | Property name | | nameSize [in] | The size of the buffer to receive the property name in characters | | pValue [out] | A pointer to a location to receive the value of the specified property | --- ### AMFPropertyStorage::Clear `AMF_RESULT AMF_STD_CALL Clear();` Remove all values from a property storage | **Return Value** | `AMF_OK` | | :--------------- | :------- | --- ### AMFPropertyStorage::AddTo `AMF_RESULT AMF_STD_CALL AddTo(AMFPropertyStorage* pDest, bool overwrite, bool deep) const;` Add all properties of the current object to another object | Parameter |Description| | :--------------- | :- | | pDest [in] | Destination Object| | overwrite [in] | When `true`, the property at `pDest` will be overwritten even when it exits. The original value at `pDest` will be preserved when `overwrite` is set to `false`| | deep [in] | Currently ignored| | **Return Value** | `AMF_OK`| --- ### AMFPropertyStorage::CopyTo `AMF_RESULT AMF_STD_CALL CopyTo(AMFPropertyStorage* pDest, bool deep) const;` Copy all properties of the current object to another object, clearing the destination first | Parameter | Description | | :--------------- | :----------------- | | pDest [in] | Destination Object | | deep [in] | Currently ignored | | **Return Value** | `AMF_OK` | --- ### AMFPropertyStorage::AddObserver `void AMF_STD_CALL AddObserver(AMFPropertyStorageObserver* pObserver);` Add an observer object which will receive notifications when one or more properties change by calling `AMFPropertyStorageObserver::OnPropertyChanged()`. | Parameter | Description | | :--------------- | :----------------------------------------------------------------------------------------- | | pObserver [in] | Pointer to the [`AMFPropertyStorageObserver`](#22142-amfpropertystorageobserver) interface | --- ### AMFPropertyStorage::RemoveObserver `void AMF_STD_CALL RemoveObserver(AMFPropertyStorageObserver* pObserver);` Remove the observer previously added by `AddObserver()` | Parameter | Description | | :--------------- | :----------------------------------------------------------------------------------------- | | pObserver [in] | Pointer to the [`AMFPropertyStorageObserver`](#22142-amfpropertystorageobserver) interface | --- ### 2.2.14.2 AMFPropertyStorageObserver The `AMFPropertyStorageObserver` interface is used as a callback to notify other objects that one of the properties of an object has changed. --- ### AMFPropertyStorageObserver::OnPropertyChanged `void AMF_STD_CALL OnPropertyChanged(const wchar_t* name);` This method is called when a property in the property storage changes | Parameter | Description | | :---------- | :---------------------------------------- | | name [in] | The name of the property that has changed | --- ### 2.2.14.3 AMFPropertyStorageEx The `AMFPropertyStorageEx` interface adds property description and validation features to `AMFPropertyStorage`. `AMFPropertyStorageEx` inherits from [`AMFPropertyStorage`](#22141-amfpropertystorage). The default implementation is `not thread-safe.` `AMFPropertyStorageEx` requires the properties to be declared before they can be used. Calling `SetProperty()` on an undeclared property would result in the `AMF_NOT_FOUND` error being returned. Include `public/include/core/PropertyStorageEx.h` --- ### AMFPropertyStorageEx::GetPropertiesInfoCount `amf_size AMF_STD_CALL GetPropertiesInfoCount() const;` Obtain the number of declared properties that have an associated property descriptor. Unlike `AMFPropertyStorage::GetPropertiesCount()`, which returns the number of properties that have been set to a specific value, GetPropertiesInfoCount returns the number of declared properties regardless of whether their values have been set or not. | **Return Value** | Number of registered properties | | :--------------- | :------------------------------ | --- ### AMFPropertyStorageEx::GetPropertyInfo `AMF_RESULT AMF_STD_CALL GetPropertyInfo(amf_size ind, const AMFPropertyInfo** ppInfo) const;` `AMF_RESULT AMF_STD_CALL GetPropertyInfo(const wchar_t* name, const AMFPropertyInfo** ppInfo) const;` Retrieve a property descriptor for a specific property. A property descriptor contains various information about the property, such as name, type, range and access type. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------------------------------------- | | ind [in] | Property index | | name [in] | Property name | | ppInfo [out] | Pointer to the parameter information class | | **Return Value** | <p>`AMF_OK` – success</p><p>`AMF_NOT_FOUND` – the requested property was not found due to an invalid name or index</p> | --- ### AMFPropertyStorageEx::ValidateProperty `AMF_RESULT AMF_STD_CALL ValidateProperty(const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated) const;` Validate the value of a property. `ValidateProperty()` also converts the type of the supplied value to the declared type of the property when an applicable conversion is available. | Parameter | Description| | :-------------------- | :- | | name [in] | Name of the property| | value [in] | Value of the property| | pOutValidated [out] | Validated value of the property| | **Return Value** | <p>`AMF_OK` when the value is within the range</p><p>`AMF_OUT_OF_RANGE` when the value is out of range</p><p>`AMF_INVALID_POINTER` when name or `pOutValidated` is `nullptr` </p>| --- ### 2.2.14.4 AMFPropertyInfo The `AMFPropertyInfo` structure describes various parameters of a property in property storage, such as name, type, access rights and range. Include `public/include/core/PropertyStorageEx.h` --- ### name `const wchar_t* name;` Contains the name of the property. --- ### desc `const wchar_t* desc;` Contains an optional human-readable description of the property. --- ### type `AMF_VARIANT_TYPE type;` Contains the type of the property. --- ### contentType `AMF_PROPERTY_CONTENT_TYPE contentType;` Reserved for internal use, must be set to `AMF_PROPERTY_CONTENT_DEFAULT`. --- ### minValue `AMFVariantStruct minValue;` Contains the minimum value of the property. --- ### maxValue `AMFVariantStruct maxValue;` Contains the maximum value of the property. --- ### accessType `AMF_PROPERTY_ACCESS_TYPE accessType;` Contains the property’s access type. Access type can have one of the following values: | Value | Description | | :-------------------------------- | :----------------------------------------------------------------------------------------------------------------------- | | AMF_PROPERTY_ACCESS_PRIVATE | Property is not accessible outside of the [`AMFPropertyStorageEx`](#_AMFPropertyStorageEx) object | | AMF_PROPERTY_ACCESS_READ | Property is readable | | AMF_PROPERTY_ACCESS_WRITE | Property is writable | | AMF_PROPERTY_ACCESS_READ_WRITE | A combination of `AMF_PROPERTY_ACCESS_READ` and `AMF_PROPERTY_ACCESS_WRITE` | | AMF_PROPERTY_ACCESS_WRITE_RUNTIME | Property is writable and does not require re-initialization of the component after it has been changed (specialized use) | | AMF_PROPERTY_ACCESS_FULL | All access is allowed, re-initialization is not required | --- ### pEnumDescription `const AMFEnumDescriptionEntry* pEnumDescription;` A pointer to the array of `AMFEnumDescriptionEntry` structures describing an enumeration. The `AMFEnumDescriptionEntry` structure is defined as follows: `struct AMFEnumDescriptionEntry {amf_int value; const wchar_t* name; };` | Field | Description | | :------ | :------------------------------------------------------------------- | | value | An integer value of the enumeration entry | | name | A wide-character string containing the name of the enumeration entry | ### 2.3 Memory Objects ### 2.3.1 AMFData The `AMFData` interface abstracts memory objects located in CPU and GPU memory providing a cross-platform access to them. It serves as a base class for other interfaces used to access specific memory objects. `AMFData` inherits from [`AMFPropertyStorage`](#22141-amfpropertystorage). AMFData objects are generally not thread-safe. Include `public/include/core/Data.h` --- ### AMFData::GetDataType `AMF_DATA_TYPE AMF_STD_CALL GetDataType();` Obtain the type of data in the memory block. Data type is defined by the `AMF_DATA_TYPE` enumeration and can have one of the following values: | Value | Description | | :---------------------- | :------------------------------------------------------------------------------------------------------ | | AMF_DATA_BUFFER | Data is a single-dimensional general purpose buffer in system (host) memory containing any unstructured | | AMF_DATA_SURFACE | Data is a graphical buffer, such as a DX9 surface, a DX11 texture, an OpenGL surface, etc. | | AMF_DATA_AUDIO_BUFFER | Data contains an audio buffer | | AMF_DATA_USER | User data | | **Return Value** | A value of `AMF_DATA_TYPE` representing the type of data | --- ### AMFData::GetMemoryType `AMF_MEMORY_TYPE AMF_STD_CALL GetMemoryType();` Obtain the type of memory the buffer is stored in. Memory type is defined by the `AMF_MEMORY_TYPE` enumeration and can have one of the following values: | Value | Description | | :--------------------------- | :------------------------------------------------------------------------------------ | | AMF_MEMORY_UNKNOWN | Memory type is not set | | AMF_MEMORY_HOST | Buffer is located in host (CPU) memory | | AMF_MEMORY_DX9 | Buffer is a DX9 surface in GPU memory | | AMF_MEMORY_DX11 | Buffer is a DX11 texture in GPU memory | | AMF_MEMORY_OPENCL | Buffer is an OpenCL surface in GPU memory | | AMF_MEMORY_OPENGL | Buffer is an OpenGL surface in GPU memory | | AMF_MEMORY_XV | Buffer is an XV surface in GPU memory (Linux only) | | AMF_MEMORY_GRALLOC | Buffer is a GrAlloc block in GPU memory (Android only) | | AMF_MEMORY_COMPUTE_FOR_DX9 | Buffer is a DX9 DirectCompute block in GPU memory | | AMF_MEMORY_COMPUTE_FOR_DX11 | Buffer is a DX11 DirectCompute block in GPU memory | | **Return Value** | A value of the `AMF_MEMORY_TYPE` type representing the memory type of the memory block | --- ### AMFData::Duplicate `AMF_RESULT AMF_STD_CALL Duplicate(AMF_MEMORY_TYPE type, AMFData** ppData);` Duplicate a memory block to another memory block of a different memory type, copying its content if necessary. | Parameter | Description | | :--------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type` [in] | Memory type to convert to | | ppData` [in] | A location to receive a pointer to the newly created object | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_INVALID_POINTER` when `ppData` is `nullptr` </p><p>`AMF_INVALID_FORMAT` when `type` is invalid</p><p>`AMF_NOT_SUPPORTED` when conversion is not supported on the current platform</p> | --- ### AMFData::Convert `AMF_RESULT AMF_STD_CALL Convert(AMF_MEMORY_TYPE type);` Convert the current `AMFData` object to a different memory type, transferring the content to a new memory location when necessary even if it involves a copy to the host memory and back. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type [in] | Memory type to convert to | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_INVALID_FORMAT` when `type` is invalid</p><p>`AMF_NOT_SUPPORTED` when conversion is not supported on the current platform</p>| --- ### AMFData::Interop `AMF_RESULT AMF_STD_CALL Interop(AMF_MEMORY_TYPE type);` Convert the current `AMFData` object to a different memory type. Unlike `AMFData::Convert`, `AMFData::Interop` will fail when conversion requires content transfer through system memory. | Parameter | Description| | :--------------- | :- | | type [in] | Memory type to convert to| | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_INVALID_FORMAT` when `type` is invalid</p><p>`AMF_NOT_SUPPORTED` when conversion is not supported on the current platform</p>| --- ### AMFData::IsReusable `bool AMF_STD_CALL IsReusable();` Check if the data object is reusable, i.e. created by AMF rather than wrapped around an existing native (DX, OpenGL, OpenCL or other) object. | **Return Value** | `true` when the object is created using AMF, `false` when the object is a native object | | :--------------- | :-------------------------------------------------------------------------------------- | --- ### AMFData::SetPts `void AMF_STD_CALL SetPts(amf_pts pts);` Set a timestamp on a memory object. This is applicable to memory objects containing media samples, such as video frames or audio buffers. Presentation timestamps are used to sync separate elementary streams such as audio and video during presentation and are only required in these types of cases. AMF components don’t pace execution in any way, timestamps and durations are mostly pass-through data. | Parameter | Description | | :-------- | :----------------------------------- | | pts [in] | Timestamp in hundreds of nanoseconds | --- ### AMFData::GetPts `amf_pts AMF_STD_CALL GetPts();` Get a timestamp associated with a memory object. This is applicable to memory objects containing media samples, such as video frames or audio buffers. | **Return Value** | Timestamp in hundreds of nanoseconds | | :--------------- | :----------------------------------- | --- ### AMFData::SetDuration `void AMF_STD_CALL SetDuration(amf_pts duration);` Set duration on a memory object containing a media sample, such as a video frame or an audio buffer. Similarly to AMFData::SetPts(), this information is only required when synchronizing separate elementary streams such as audio and video during presentation. | Parameter | Description | | :------------ | :---------------------------------- | | duration [in] | Duration in hundreds of nanoseconds | --- ### AMFData::GetDuration `amf_pts AMF_STD_CALL GetDuration();` Get duration of a media sample, such as a video frame or an audio buffer, stored in the memory object. | **Return Value** | Duration in hundreds of nanoseconds | | :--------------- | :---------------------------------- | ### 2.3.2 Buffers ### 2.3.2.1 AMFBuffer The `AMFBuffer` interface provides access to an unordered buffer. Buffers can be located in either host (CPU) or GPU memory. The `AMFBuffer` interface inherits from [`AMFData`](#231-amfdata). Include `public/include/core/Buffer.h` --- ### AMFBuffer::SetSize `AMF_RESULT AMF_STD_CALL SetSize(amf_size newSize);` Change the size of the buffer. Changing the size of the buffer does not cause memory reallocation. Setting the size to a value larger than the allocated size would cause `SetSize` to fail. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------ | | newSize` [in] | Size of the buffer in bytes | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_INVALID_ARG` when the new size exceeds the allocated size of the buffer</p> | --- ### AMFBuffer::GetSize `amf_size AMF_STD_CALL GetSize();` Get buffer size. This method returns either the allocated size or the last size successfully set using `AMFBuffer::SetSize`. | **Return Value** | Buffer size in bytes | | :--------------- | :------------------- | --- ### AMFBuffer::GetNative `void* AMF_STD_CALL GetNative();` Get a pointer to the `AMFBuffer` object’s data in host memory, mapping it to host memory when necessary. | **Return Value** | Pointer to data in host memory | | :--------------- | :----------------------------- | --- ### AMFBuffer::AddObserver `void AMF_STD_CALL AddObserver(AMFBufferObserver* pObserver);` Register the observer interface to be notified when the buffer can be used again. | Parameter | Description | | :------------- | :------------------------------------------------------------------------------------------------------ | | pObserver [in] | A pointer to the [`AMFBufferObserver`](#2324-amfaudiobufferobserver) interface to receive notifications | --- ### AMFBuffer::RemoveObserver `void AMF_STD_CALL RemoveObserver(AMFBufferObserver* pObserver);` Unregister an observer previously registered with `AMFBuffer::AddObserver`. | Parameter | Description | | :------------- | :------------------------------------------------------------------------------------------------------------- | | pObserver [in] | A pointer to the [`AMFBufferObserver`](#2324-amfaudiobufferobserver) interface to stop receiving notifications | ### 2.3.2.2 AMFBufferObserver The `AMFBufferObserver` interface is used to notify other components that a buffer becomes free from exclusive usage by the component it was submitted to. When a buffer is submitted to an AMF component as an input resource, the component might require an exclusive access to it for a period of time. When a component releases the buffer, all registered observers receive a notification through the `AMFBufferObserver::OnBufferDataRelease` method, indicating the buffer can be used again. This mechanism is useful when implementing buffer pools that recycle buffers allocated externally. The `AMFBufferObserver` interface must be implemented by objects observing the buffer. --- ### AMFBufferObserver::OnBufferDataRelease `void AMF_STD_CALL OnBufferDataRelease(AMFBuffer* pBuffer);` This method is to be implemented by the observer object. It will be called when the buffer becomes free of exclusive access by another component. | Parameter | Description | | :----------- | :------------------------------------- | | pBuffer [in] | A pointer to the `AMFBuffer` interface | ### 2.3.2.3 AMFAudioBuffer The `AMFAudioBuffer` interface provides access to a buffer containing audio samples. Buffers can be located in either host (CPU) or GPU memory. The `AMFAudioBuffer` interface inherits from [`AMFData`](#231-amfdata). Include `public/include/core/AudioBuffer.h` --- ### AMFAudioBuffer::GetSize `amf_size AMF_STD_CALL GetSize();` Get buffer size. This method returns either the allocated size or the last size successfully set using `AMFBuffer::SetSize`. | **Return Value** | Buffer size in bytes | | :--------------- | :------------------- | --- ### AMFAudioBuffer::GetNative `void* AMF_STD_CALL GetNative();` Get a pointer to the `AMFBuffer` object’s data in host memory, mapping it to host memory when necessary. | **Return Value** | Pointer to data in host memory | | :--------------- | :----------------------------- | --- ### AMFAudioBuffer::GetSampleCount `amf_int32 AMF_STD_CALL GetSampleCount();` Get the number of audio samples in a buffer. | **Return Value** | Total number of samples in the buffer | | :--------------- | :------------------------------------ | --- ### AMFAudioBuffer::GetSampleRate `amf_int32 AMF_STD_CALL GetSampleRate();` Get the sampling rate of an audio buffer. | **Return Value** | Sampling rate in samples per second | | :--------------- | :---------------------------------- | --- ### AMFAudioBuffer::GetSampleSize `amf_int32 AMF_STD_CALL GetSampleSize();` Get the sample size of an audio buffer. | **Return Value** | Sample size in bytes | | :--------------- | :------------------- | --- ### AMFAudioBuffer::GetChannelCount `amf_int32 AMF_STD_CALL GetChannelCount();` Get the number of audio channels stored in a buffer. | **Return Value** | Number of audio channels | | :--------------- | :----------------------- | --- ### AMFAudioBuffer::GetChannelLayout `amf_uint32 AMF_STD_CALL GetChannelLayout();` Get the speaker layout associated with the audio buffer. | **Return Value** | An ffpmpeg `AV_CH_LAYOUT` enumeration value | | :--------------- | :------------------------------------------ | --- ### AMFAudioBuffer::AddObserver `void AMF_STD_CALL AddObserver(AMFAudioBufferObserver* pObserver);` Register the observer interface to be notified when the buffer can be used again. | Parameter | Description | | :------------- | :----------------------------------------------------------------------------------------------------------- | | pObserver [in] | A pointer to the [`AMFAudioBufferObserver`](#2324-amfaudiobufferobserver) interface to receive notifications | --- ### AMFAudioBuffer::RemoveObserver `void AMF_STD_CALL RemoveObserver(AMFAudioBufferObserver* pObserver);` Unregister an observer previously registered with `AMFAudioBuffer::AddObserver`. | Parameter | Description | | :------------- | :------------------------------------------------------------------------------------------------------------------ | | pObserver [in] | A pointer to the [`AMFAudioBufferObserver`](#2324-amfaudiobufferobserver) interface to stop receiving notifications | ### 2.3.2.4 AMFAudioBufferObserver The `AMFAudioBufferObserver` interface is used to notify other components that a buffer becomes free from exclusive usage by the component it was submitted to. When a buffer is submitted to an AMF component as an input resource, the component might require an exclusive access to it for a period of time. When a component releases the buffer, all registered observers receive a notification through the `AMFAudioBufferObserver::OnBufferDataRelease` method, indicating the buffer can be used again. This mechanism is useful when implementing buffer pools that recycle buffers allocated externally. The `AMFAudioBufferObserver` interface must be implemented by objects observing the buffer. --- ### AMFAudioBufferObserver::OnBufferDataRelease `void AMF_STD_CALL OnBufferDataRelease(AMFBuffer* pBuffer);` This method is to be implemented by the observer object. It will be called when the buffer becomes free of exclusive access by another component. | Parameter | Description | | :----------- | :------------------------------------- | | pBuffer [in] | A pointer to the `AMFBuffer` interface | ### 2.3.3 Surfaces ### 2.3.3.1 AMFSurface The `AMFSurface` interface abstracts a memory buffer containing a 2D image (typically a video frame) accessible by the GPU. The structure of the buffer depends on the surface type and format. Memory buffers associated with a surface may be stored in either GPU or host memory and consist of one or more planes accessible through the `AMFPlane` interface. `AMFSurface` inherits from [`AMFData`](#231-amfdata). `AMFSurface` objects are generally not thread-safe. Include `public/include/core/Surface.h` --- ### Surface Formats Surface format defines how pixel data is stored in memory. Surface format is described by the `AMF_SURFACE_FORMAT` enumeration. The following formats are supported in AMF: | Format | Description | | :---------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | AMF_SURFACE_UNKNOWN | Format unknown/undefined | | AMF_SURFACE_NV12 | Y plane of width * height size, packed UV plane of width/2 * height/2 size, 8 bits per component | | AMF_SURFACE_YV12 | Y plane of width * height size, V plane of width/2 * height/2 size, U plane of width/2 * height/2, 8 bits per component | | AMF_SURFACE_BGRA | packed - 8 bits per component | | AMF_SURFACE_ARGB | packed - 8 bits per component | | AMF_SURFACE_RGBA | packed - 8 bits per component | | AMF_SURFACE_GRAY8 | single component - 8 bits | | AMF_SURFACE_YUV420P | Y plane of width * height size, U plane of width/2 * height/2 size, V plane of width/2 * height/2, 8 bits per component | | AMF_SURFACE_U8V8 | double component - 8 bits per component | | AMF_SURFACE_YUY2 | YUY2: Byte 0=8-bit Y'0; Byte 1=8-bit Cb; Byte 2=8-bit Y'1; Byte 3=8-bit Cr | | AMF_SURFACE_P010 | Y plane of width * height, packed UV plane of width/2 * height/2, 10 bits per component (16 allocated, upper 10 bits are used) | | AMF_SURFACE_RGBA_F16 | packed - 16-bit float per component | | AMF_SURFACE_UYVY | packed 4:2:2 the similar to YUY2 but Y and UV swapped: Byte 0=8-bit Cb; Byte 1=8-bit Y'0; Byte 2=8-bit Cr Byte 3=8-bit Y'1; (used the same DX/CL/Vulkan storage as YUY2) | | AMF_SURFACE_R10G10B10A2 | packed 4:4:4 to 4 bytes, 10 bit per RGB component, 2 bits per A | | AMF_SURFACE_Y210 | packed 4:2:2 - Word 0=10-bit Y'0; Word 1=10-bit Cb; Word 2=10-bit Y'1; Word 3=10-bit Cr | | AMF_SURFACE_AYUV | packed 4:4:4 - 8 bit per component YUVA | | AMF_SURFACE_Y410 | packed 4:4:4 - 10 bit per YUV component, 2 bits per A, AVYU | | AMF_SURFACE_Y416 | packed 4:4:4 - 16 bit per component 4 bytes, AVYU | | AMF_SURFACE_GRAY32 | single component - 32 bit | | AMF_SURFACE_P012 | planar 4:2:0 Y width x height + packed UV width/2 x height/2 - 12 bit per component (16 allocated, upper 12 bits are used) | | AMF_SURFACE_P016 | planar 4:2:0 Y width x height + packed UV width/2 x height/2 - 16 bit per component (16 allocated, all bits are used) | ### Frame Types The type of a video frame contained in a surface is defined using the `AMF_FRAME_TYPE` enumeration. The values of this enumeration can be used to describe a specific frame as well as the entire video sequence. The `AMF_FRAME_TYPE` enumeration is defined as follows: | Value | Description | | :-------------------------------------------- | :--------------------------------------------------------------------------------------------------- | | AMF_FRAME_STEREO_FLAG | The surface contains a part of a stereoscopic frame | | AMF_FRAME_LEFT_FLAG | The surface contains the left eye portion of a stereoscopic frame, includes `AMF_FRAME_STEREO_FLAG` | | AMF_FRAME_RIGHT_FLAG | The surface contains the right eye portion of a stereoscopic frame, includes `AMF_FRAME_STEREO_FLAG` | | AMF_FRAME_BOTH_FLAG | The surface contains the entire stereoscopic frame (both eyes) , includes `AMF_FRAME_STEREO_FLAG` | | AMF_FRAME_INTERLEAVED_FLAG | The surface contains an interlaced image | | AMF_FRAME_FIELD_FLAG | The surface contains a single field of an interlaced image | | AMF_FRAME_EVEN_FLAG | The surface contains the even field of an interlaced image | | AMF_FRAME_ODD_FLAG | The surface contains the odd field of an interlaced image | | AMF_FRAME_UNKNOWN | Frame format is unknown | | AMF_FRAME_PROGRESSIVE | The frame is progressive | | AMF_FRAME_INTERLEAVED_EVEN_FIRST | The sequence is interlaced with the even field preceding the odd field | | AMF_FRAME_INTERLEAVED_ODD_FIRST | The sequence is interlaced with the odd field preceding the even field | | AMF_FRAME_FIELD_SINGLE_EVEN | The surface contains a single even field | | AMF_FRAME_FIELD_SINGLE_ODD | The surface contains a single odd field | | AMF_FRAME_STEREO_LEFT | Same as `AMF_FRAME_LEFT_FLAG` | | AMF_FRAME_STEREO_RIGHT | Same as `AMF_FRAME_RIGHT_FLAG` | | AMF_FRAME_STEREO_BOTH | Same as `AMF_FRAME_BOTH_FLAG` | | AMF_FRAME_INTERLEAVED_EVEN_FIRST_STEREO_LEFT | A combination of `AMF_FRAME_INTERLEAVED_EVEN_FIRST and AMF_FRAME_LEFT_FLAG` | | AMF_FRAME_INTERLEAVED_EVEN_FIRST_STEREO_RIGHT | A combination of `AMF_FRAME_INTERLEAVED_EVEN_FIRST and AMF_FRAME_RIGHT_FLAG` | | AMF_FRAME_INTERLEAVED_EVEN_FIRST_STEREO_BOTH | A combination of `AMF_FRAME_INTERLEAVED_EVEN_FIRST and AMF_FRAME_BOTH_FLAG` | | AMF_FRAME_INTERLEAVED_ODD_FIRST_STEREO_LEFT | A combination of `AMF_FRAME_INTERLEAVED_ODD_FIRST and AMF_FRAME_LEFT_FLAG` | | AMF_FRAME_INTERLEAVED_ODD_FIRST_STEREO_RIGHT | A combination of `AMF_FRAME_INTERLEAVED_ODD_FIRST and AMF_FRAME_RIGHT_FLAG` | | AMF_FRAME_INTERLEAVED_ODD_FIRST_STEREO_BOTH | A combination of `AMF_FRAME_INTERLEAVED_ODD_FIRST and AMF_FRAME_BOTH_FLAG` | --- ### AMFSurface::GetFormat() `AMF_SURFACE_FORMAT AMF_STD_CALL GetFormat();` Get the format of the surface. Refer to `Surface Formats` for more information about various surface formats. | **Return Value** | Surface format | | :--------------- | :------------- | --- ### AMFSurface::GetPlanesCount() `amf_size AMF_STD_CALL GetPlanesCount();` Get the number of planes in the surface. The number of planes depends on the surface format. Refer to `Surface Formats` for more information on the surface structure for different formats. | **Return Value** | The number of planes in the surface | | :--------------- | :---------------------------------- | --- ### AMFSurface::GetPlaneAt() `AMFPlane* AMF_STD_CALL GetPlaneAt(amf_size index);` Obtain a pointer to the specific plane by index. This method does not increment the reference count on the [`AMFPlane`](#2333-amfplane) interface returned. | Parameter | Description | | :--------------- | :------------------------------------------------------ | | index` [in] | A 0-based index of the requested plane | | **Return Value** | A pointer to the [`AMFPlane`](#2333-amfplane) interface | --- ### AMFSurface::GetPlane() `AMFPlane* GetPlane(AMF_PLANE_TYPE type);` Obtain a pointer to the specific plane by `Plane_Types`. This method does not increment the reference count on the [`AMFPlane`](#2333-amfplane) interface returned. | Parameter | Description | | :--------------- | :------------------------------------------------------ | | type [in] | The type of the requested plane | | **Return Value** | A pointer to the [`AMFPlane`](#2333-amfplane) interface | --- ### AMFSurface::GetFrameType() `AMF_FRAME_TYPE AMF_STD_CALL GetFrameType();` Get the type of a frame stored in the surface. Refer to the `Frame_Types` section for more information on frame types. | **Return Value** | The type of the frame stored in the surface | | :--------------- | :------------------------------------------ | --- ### AMFSurface::SetFrameType() `void AMF_STD_CALL SetFrameType(AMF_FRAME_TYPE type);` Set the type of the frame stored in the surface. Refer to the `Frame Types` section for more information on frame types. | Parameter | Description | | :-------- | :------------------------------------------ | | type [in] | The type of the frame stored in the surface | --- ### AMFSurface::SetCrop() `AMF_RESULT AMF_STD_CALL SetCrop(amf_int32 x, amf_int32 y, amf_int32 width, amf_int32 height);` Set the cropping region on the surface. Pixels outside of the cropping region will be ignored by all manipulations on the surface. |Parameter|Description| | :- | :- | | x [in] | Horizontal offset | | y [in] | Vertical offset | | width [in] | Crop width | | height [in] | Crop height | | **Return Value** | `AMF_OK` on success, `AMF_INVALID_ARG` otherwise | --- ### AMFSurface::AddObserver `void AMF_STD_CALL AddObserver(AMFSurfaceObserver* pObserver);` Register the observer interface to be notified when the buffer can be used again. | Parameter | Description | | :------------- | :--------------------------------------------------------------------------------------------------- | | pObserver [in] | A pointer to the [`AMFSurfaceObserver`](#2332-amfsurfaceobserver) interface to receive notifications | --- ### AMFSurface::RemoveObserver `void AMF_STD_CALL RemoveObserver(AMFSurfaceObserver* pObserver);` Unregister an observer previously registered with `AMFSurface::AddObserver`. | Parameter | Description | | :------------- | :---------------------------------------------------------------------------------------------------------- | | pObserver [in] | A pointer to the [`AMFSurfaceObserver`](#2332-amfsurfaceobserver) interface to stop receiving notifications | --- ### 2.3.3.2 AMFSurfaceObserver The `AMFSurfaceObserver` interface is used to notify other components that a surface becomes free from exclusive usage by the component it was submitted to. When a surface is submitted to an AMF component as an input resource, the component might require an exclusive access to it for a period of time. When a component releases the surface, all registered observers receive a notification through the `AMFSurfaceObserver::OnSurfaceDataRelease` method, indicating the surface can be used again. This mechanism is useful when implementing surface pools that recycle externally allocated surfaces. The `AMFSurfaceObserver` interface must be implemented by objects observing the surface. --- ### AMFSurfaceObserver::OnSurfaceDataRelease `void AMF_STD_CALL OnSurfaceDataRelease(AMFSurface* pSurface);` This method is to be implemented by the observer object. It will be called when the surface becomes free of exclusive access by another component. | Parameter | Description | | :------------ | :---------------------------------------------------------- | | pSurface [in] | A pointer to the [`AMFSurface`](#2331-amfsurface) interface | --- ### 2.3.3.3 AMFPlane The `AMFPlane` interface provides access to a single plane of a surface. A pointer to the `AMFPlane` interface can be obtained using the `GetPlane` and `GetPlaneAt` methods of the [`AMFSurface`](#2331-amfsurface) interface. Any `AMFSurface` object contains at least one plane. The number of planes in a surface is determined by `Surface Format`. Plane Types Plane types are defined using the `AMF_PLANE_TYPE` enumeration and can be one of the following: | Value | Description | | :--------------- | :-------------------------------------------------------- | | AMF_PLANE_PACKED | All single-plane packed formats, such as BGRA, YUY2, etc. | | AMF_PLANE_Y | The Y plane for all multi-plane formats | | AMF_PLANE_UV | The UV plane for formats with combined UV planes | | AMF_PLANE_U | The U plane | | AMF_PLANE_V | The V plane | --- ### AMFPlane::GetType() `AMF_PLANE_TYPE AMF_STD_CALL GetType();` Get plane type. | **Return Value** | Current plane type | | :--------------- | :----------------- | --- ### AMFPlane::GetNative() `void* AMF_STD_CALL GetNative();` Obtain a native interface to the underlying memory. The **Return Value** of this method depends on how the surface containing the plane was created. For DirectX objects, such as DirectX 9 surfaces and DirectX 11 textures, this method returns a pointer to the underlying native interface (`IDirect3DSurface9` or `ID3D11Texture2D`). For OpenCL and Compute objects `GetNative` returns a handle to the memory buffer containing the plane. For multi-plane surfaces the value returned may or may not be the same for all planes belonging to the same surface, therefore no assumptions should be made about the value returned by `GetNative`. Native objects should be explicitly requested for every plane and cast to the appropriate type. For DirectX objects, when a pointer to a COM interface is returned, `GetNative` does not call `IUnknown::AddRef` on the interface being returned. | **Return Value** | A native accessor to the plane | | :--------------- | :----------------------------- | --- ### AMFPlane::GetPixelSizeInBytes() `amf_int32 AMF_STD_CALL GetPixelSizeInBytes();` Get the size of a pixel in the plane in bytes. The size of a pixel in each plane of a surface depends on the format of the surface. | **Return Value** | The size of a pixel in the plane in bytes | | :--------------- | :---------------------------------------- | --- ### AMFPlane::GetOffsetX() `amf_int32 AMF_STD_CALL GetOffsetX();` Get the horizontal offset of the crop region in the plane. The crop region can be set on a surface using `AMFSurface::SetCrop` method. The crop region would be applied to all planes of the surface according to the format of the surface. Crop regions cannot be applied to individual planes independently. | **Return Value** | The horizontal offset of the crop region in pixels | | :--------------- | :------------------------------------------------- | --- ### AMFPlane::GetOffsetY() `amf_int32 AMF_STD_CALL GetOffsetY();` Get the vertical offset of the crop region in the plane. The crop region can be set on a surface using `AMFSurface::SetCrop` method. The crop region would be applied to all planes of the surface according to the format of the surface. Crop regions cannot be applied to individual planes independently. | **Return Value** | The vertical offset of the crop region in pixels | | :--------------- | :----------------------------------------------- | --- ### AMFPlane::GetWidth() `amf_int32 AMF_STD_CALL GetWidth();` Get the width of the crop region in the plane. The crop region can be set on a surface using `AMFSurface::SetCrop` method. The crop region would be applied to all planes of the surface according to the format of the surface. Crop regions cannot be applied to individual planes independently. When the crop region is not set, the value returned by `GetWidth` is based on the full width of the surface containing the plane and its pixel format. | **Return Value** | The width of the crop region in pixels | | :--------------- | :------------------------------------- | --- ### AMFPlane::GetHeight() `amf_int32 AMF_STD_CALL GetHeight();` Get the height of the crop region in the plane. The crop region can be set on a surface using `AMFSurface::SetCrop` method. The crop region would be applied to all planes of the surface according to the format of the surface. Crop regions cannot be applied to individual planes independently. When the crop region is not set, the value returned by `GetHeight` is based on the full height of the surface containing the plane and its pixel format. | **Return Value** | The height of the crop region in pixels | | :--------------- | :-------------------------------------- | --- ### AMFPlane::GetHPitch() `amf_int32 AMF_STD_CALL GetHPitch();` Get the horizontal pitch of the plane. Horizontal pitch is the amount of memory a single scan line, including any padding, occupies. | **Return Value** | Horizontal pitch of the plane in bytes | | :--------------- | :------------------------------------- | --- ### AMFPlane::GetVPitch() `amf_int32 AMF_STD_CALL GetVPitch();` Get the vertical pitch of the plane. Vertical pitch is the number of scan lines, including any padding, a plane occupies. Vertical pitch is always a multiple of horizontal pitch. | **Return Value** | Vertical pitch of the plane in scan lines | | :--------------- | :---------------------------------------- | --- ### AMFPlane::IsTiled `bool AMF_STD_CALL IsTiled();` Determine whether the physical memory storing the plane is contiguous or tiled. | **Return Value** | `true` when the memory is tiled, `false` when the memory is contiguous | | :--------------- | :--------------------------------------------------------------------- | --- ### 2.4 Device Abstraction ### 2.4.1 AMFContext The `AMFContext` interface serves as an entry point to most AMF functionality, acting as a facility to create and initialize device-specific resources. It also abstracts the underlying platform-specific technologies, providing a consistent API across DirectX9, DirectX11, OpenGL, OpenCL, XV, Android. --- ### Context Initialization `AMF_RESULT AMF_STD_CALL InitDX9(void* pDX9Device);` `AMF_RESULT AMF_STD_CALL InitDX11(void* pDX11Device, AMF_DX_VERSION dxVersionRequired);` `AMF_RESULT AMF_STD_CALL InitOpenCL(void* pCommandQueue);` `AMF_RESULT AMF_STD_CALL InitOpenGL(amf_handle hOpenGLContext, amf_handle hWindow, amf_handle hDC);` The `Init` methods initialize the `AMFContext` object to use a specific technology, such as DirectX, OpenGL, OpenCL, XV, etc. A single context can be initialized once for a particular technology, but it can be initialized to use different technologies at the same time – you can initialize the same context to use DirectX9 and OpenGL at the same time, for example. The parameters passed to `Init` methods depend on the underlying technology. Usually they include a device or device context handle or a pointer to an interface providing access to the device, as well as other values, such as the version of DirectX required, a window handle, etc. | Parameter | Description | | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pDX9Device [in] | A pointer to the `IDirectX9Device` interface. When set to `NULL`, the default device will be used | | pDX11Device [in] | A pointer to the `ID3D11Device` interface. When set to `NULL`, the default device will be used | | pCommandQueue [in] | An OpenCL command queue handle of `cl_command_queue` type, returned by the `clCreateCommandQueue` function. When set to `NULL`, the default command queue will be used | | hOpenGLContext [in] | An OpenGL context handle returned by the `wglCreateContext` function. When set to `NULL`, the default OpenGL context will be created internally | | dxVersionRequired [in] | The minimum DirectX version requested (defaults to DX11.0) | | hWindow [in] | A Win32 handle (`HWND`) of the output window. When set to `NULL`, the desktop window will be used. | | hDC [in] | A Win32 device context (HDC). When set to `NULL`, the default device context will be obtained from the window passed through the `hWindow` parameter | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_DIRECTX_FAILED`, `AMF_OPENCL_FAILED, AMF_GLX_FAILED` on failure</p><p>`AMF_ALREADY_INITIALIZED` when the context re-initialization for the same technology was attempted</p> | --- ### Get Native Device Interfaces `void* AMF_STD_CALL GetDX9Device(AMF_DX_VERSION dxVersionRequired);` `void* AMF_STD_CALL GetDX11Device(AMF_DX_VERSION dxVersionRequired);` `void* AMF_STD_CALL GetOpenCLContext();` `void* AMF_STD_CALL GetOpenCLCommandQueue();` `void* AMF_STD_CALL GetOpenCLDeviceID();` Obtain a native device interface. These methods return the native device used to initialize the context. Their **Return Value**s need to be explicitly cast to the native interface or handle. Note that methods returning a pointer to a COM interface, such as `GetDX9Device` and `GetDX11Device`, do not increment the reference counter on the interface they return. | **Return Value** | Native device interface or handle | | :--------------- | :-------------------------------- | --- ### AMFContext::Terminate() `AMF_RESULT AMF_STD_CALL Terminate();` Terminate the context. The context can be initialized again after it has been terminated. | **Return Value** | `AMF_OK` on success | | :--------------- | :------------------ | ---- ### Device Lock `AMF_RESULT AMFContext::LockDX9();` `AMF_RESULT AMFContext::LockDX11();` `AMF_RESULT AMFContext::LockOpenCL();` `AMF_RESULT AMFContext::LockOpenGL();` Lock the device associated with the context for exclusive use. | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NOT_INITIALIZED` when called on a context which hasn’t been initialized for the specific platform</p>| | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------- | --- ### Device Unlock `AMF_RESULT AMFContext::UnlockDX9();` `AMF_RESULT AMFContext::UnlockDX11();` `AMF_RESULT AMFContext::UnlockOpenCL();` `AMF_RESULT AMFContext::UnlockOpenGL();` Unlock the device associated with the context that was previously locked with a corresponding `Lock` method. | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NOT_INITIALIZED` when called on a context which hasn’t been initialized for the specific platform</p> | | :--------------- | :-------------------------------------------------------------------------------------------------------------------------------------- | --- ### AMFContext::AllocBuffer() `AMF_RESULT AMF_STD_CALL AllocBuffer(AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer);` Allocate a buffer object. The context must be initialized for the technology matching the memory type specified by the `type` parameter. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | | type [in] | Memory type | | size [in] | Buffer size in bytes | | ppBuffer [out] | A pointer to the location to receive a pointer to the [`AMFBuffer`](#2321-amfbuffer) interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext::CreateBufferFromHostNative() `AMF_RESULT AMF_STD_CALL CreateBufferFromHostNative(void* pHostBuffer, amf_size size, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);` Wrap an existing buffer in host (CPU) memory in an [`AMFBuffer`](#2321-amfbuffer) object. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pHostBuffer [in] | A pointer to the buffer in host memory | | size [in] | Buffer size in bytes | | ppBuffer [out] | A pointer to the location to receive a pointer to the [`AMFBuffer`](#2321-amfbuffer) interface | | pObserver [in] | A pointer to an object implementing the [`AMFBufferObserver`](#2322-amfbufferobserver) interface to receive a notification when the corresponding [`AMFBuffer`](#2321-amfbuffer) object is being destroyed | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext::CreateBufferFromOpenCLNative() `AMF_RESULT AMF_STD_CALL CreateBufferFromOpenCLNative(void* pCLBuffer, amf_size size, AMFBuffer** ppBuffer);` Wrap an existing OpenCL buffer in an [`AMFBuffer`](#2321-amfbuffer) object. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | | pHostBuffer [in] | A pointer to the buffer in host memory | | size [in] | Buffer size in bytes | | ppBuffer [out] | A pointer to the location to receive a pointer to the [`AMFBuffer`](#2321-amfbuffer) interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext::AllocSurface() `AMF_RESULT AMF_STD_CALL AllocSurface(AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMFSurface** ppSurface);` Allocate a surface object. The context must be initialized for the technology matching the memory type specified by the `type` parameter. | Parameter | Description | | :-------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type [in] | Memory type | | format [in] | Pixel format | | width [in] | Surface width in pixels | | height [in] | Surface height in scan lines | | ppSurface [out] | A pointer to the location to receive a pointer to the [`AMFSurface`](#2331-amfsurface) interface. This output parameter returns `AMFSurface*` | | | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type, format or surface sizes are invalid</p> | --- ### AMFContext::CreateSurfaceFromDX9Native `AMF_RESULT AMF_STD_CALL CreateSurfaceFromDX9Native(void* pDX9Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);` Wrap an existing native DirectX9 2D surface object in an [`AMFSurface`](#2331-amfsurface) object. The context must be initialized for DirectX9. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pDX9Surface [in] | A pointer to the IDirect3DSurface9 interface | | ppSurface [out] | A pointer to the location to receive a pointer to the [`AMFSurface`](#2331-amfsurface) interface. This output parameter returns `AMFSurface*` | | pObserver [in] | A pointer to an object implementing the [`AMFSurfaceObserver`](#2332-amfsurfaceobserver) interface to receive a notification when the corresponding [`AMFSurface`](#2331-amfsurface) object is being destroyed | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext::CreateSurfaceFromDX11Native `AMF_RESULT AMF_STD_CALL CreateSurfaceFromDX11Native(void* pDX11Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);` Wrap an existing native DirectX11 2D texture object in an [`AMFSurface`](#2331-amfsurface) object. The context must be initialized for DirectX11. | Parameter | Description | | :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pDX11Surface [in] | A pointer to the ID3D11Texture2D interface | | ppSurface [out] | A pointer to the location to receive a pointer to the [`AMFSurface`](#2331-amfsurface) interface. This output parameter returns `AMFSurface*` | | pObserver [in] | A pointer to an object implementing the [`AMFSurfaceObserver`](#2332-amfsurfaceobserver) interface to receive a notification when the corresponding [`AMFSurface`](#2331-amfsurface) object is being destroyed | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext::CreateSurfaceFromHostNative `AMF_RESULT AMF_STD_CALL CreateSurfaceFromHostNative(AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, void* pData, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);` Wrap an existing buffer in host memory in an [`AMFSurface`](#2331-amfsurface) object. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | format [in] | Pixel format | | width [in] | Width in pixels | | height [in] | Height in scan lines | | hPitch [in] | Horizontal pitch in bytes | | vPitch [in] | Vertical pitch in scan lines | | pData` [in] | A pointer to the buffer in host memory | | ppSurface [out] | A pointer to the location to receive a pointer to the [`AMFSurface`](#2331-amfsurface) interface. This output parameter returns `AMFSurface*` | | pObserver [in] | A pointer to an object implementing the [`AMFSurfaceObserver`](#2332-amfsurfaceobserver) interface to receive a notification when the corresponding [`AMFSurface`](#2331-amfsurface) object is being destroyed | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext::CreateSurfaceFromOpenGLNative `AMF_RESULT AMF_STD_CALL CreateSurfaceFromOpenGLNative(AMF_SURFACE_FORMAT format, amf_handle hGLTextureID, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);` Wrap an existing native OpenGL texture in an [`AMFSurface`](#2331-amfsurface) object. The context must be initialized for OpenGL. | Parameter | Description | | :----------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | format [in] | Pixel format | | hGLTextureID [in] | OpenGL texture ID | | ppSurface [out] | A pointer to the location to receive a pointer to the [`AMFSurface`](#2331-amfsurface) interface. This output parameter returns `AMFSurface*` | | pObserver [in] | A pointer to an object implementing the [`AMFSurfaceObserver`](#2332-amfsurfaceobserver) interface to receive a notification when the corresponding [`AMFSurface`](#2331-amfsurface) object is being destroyed | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext::CreateSurfaceFromOpenCLNative `AMF_RESULT AMF_STD_CALL CreateSurfaceFromOpenCLNative(AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, void** pClPlanes, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);` Wrap an existing native OpenCL surface in an [`AMFSurface`](#2331-amfsurface) object. The context must be initialized for OpenCL. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | format [in] | Pixel format | | width [in] | Width in pixels | | height [in] | Height in scan lines | | pCLPlanes [in] | A pointer to an array of OpenCL handles to buffers representing planes. The number of planes is defined by the pixel format | | ppSurface [out] | A pointer to the location to receive a pointer to the [`AMFSurface`](#2331-amfsurface) interface. This output parameter returns `AMFSurface*` | | pObserver [in] | A pointer to an object implementing the [`AMFSurfaceObserver`](#2332-amfsurfaceobserver) interface to receive a notification when the corresponding [`AMFSurface`](#2331-amfsurface) object is being destroyed | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext::CreateSurfaceFromDX12Native `AMF_RESULT AMF_STD_CALL CreateSurfaceFromDX12Native(void* pResourceTexture, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);` Wrap an existing native DirectX12 surface in an [`AMFSurface`](#2331-amfsurface) object. The context must be initialized for DirectX12. | Parameter | Description | | :-------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pResourceTexture [in] | Caller should pass `ID3D12Resource*` | | ppSurface [out] | A pointer to the location to receive a pointer to the [`AMFSurface`](#2331-amfsurface) interface. This output parameter returns `AMFSurface*` | | pObserver [in] | A pointer to an object implementing the [`AMFSurfaceObserver`](#2332-amfsurfaceobserver) interface to receive a notification when the corresponding [`AMFSurface`](#2331-amfsurface) object is being destroyed | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext::AllocAudioBuffer `AMF_RESULT AMF_STD_CALL AllocAudioBuffer(AMF_MEMORY_TYPE type, AMF_AUDIO_FORMAT format, amf_int32 samples, amf_int32 sampleRate, amf_int32 channels, AMFAudioBuffer** ppAudioBuffer);` Allocate an audio buffer object. The context must be initialized for the technology matching the memory type specified by the `type` parameter. | Parameter | Description | | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------ | | type [in] | Memory type | | format [in] | Audio format | | samples [out] | Number of samples count | | sampleRate [out] | Rate of the samples | | channels [out] | Number of channels count | | ppAudioBuffer [out] | `AMFAudioBuffer**`, optional usage | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext::GetOpenCLComputeFactory `AMF_RESULT AMF_STD_CALL GetOpenCLComputeFactory(AMFComputeFactory** ppFactory);` Obtain a pointer to the AMF Compute class factory. The context must be initialized for OpenCL. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------ | | ppFactory [out] | A pointer to the location to receive a pointer to the [`AMFComputeFactory`](#251-amfcomputefactory) interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_INVALID_ARG` when `ppFactory` is `nullptr`</p> | --- ### AMFContext::GetCompute `AMF_RESULT AMF_STD_CALL GetCompute(AMF_MEMORY_TYPE memType, AMFCompute** ppCompute);` Create an AMF Compute object for a specific memory type. The `AMFContext` object must be initialized with a call to one of the `Init` methods for OpenCL, DirectX9 or DirectX11. If it has not been initialized for the technology specified by the `memType` parameter, an implicit initialization will be performed. | Parameter | Description | | :--------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | memType [in] | <p>Memory type. Can be one of the following:</p><p>`AMF_MEMORY_OPENCL` – for OpenCL</p><p>`AMF_MEMORY_COMPUTE_FOR_DX9` – for AMF Compute on DirectX9</p><p>`AMF_MEMORY_COMPUTE_FOR_DX11` – for AMF Compute on DirectX11</p> | | ppFactory [out] | A pointer to the location to receive a pointer to the [`AMFComputeFactory`](#251-amfcomputefactory) interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_INVALID_ARG` when `ppFactory` is `nullptr` or when `memType` is set to a value different from `AMF_MEMORY_OPENCL`, `AMF_MEMORY_COMPUTE_FOR_DX9` or `AMF_MEMORY_COMPUTE_FOR_DX11`</p> | --- ### 2.4.2 AMFContext1 The `AMFContext1` interface adds new functionality to the [`AMFContext`](#242-amfcontext1) interface. `AMFContext1` is derived from [`AMFContext`](#242-amfcontext1) and can be obtained by calling `QueryInterface()` on the instance of the [`AMFContext`](#242-amfcontext1) interface obtained from [`AMFFactory`](#amffactory)`::CreateContext()`. --- ### Context Initialization `AMF_RESULT AMF_STD_CALL InitVulkan(void* pVulkanDevice);` The `Init` methods initialize the `AMFContext1` object to use with a native Vulkan device. | Parameter | Description | | :----------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pVulkanDevice [in] | A pointer to the `AMFVulkanDevice` structure wrapping the native Vulkan device. When `pVulkanDevice` is `NULL`, the default device will be used. | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NOT_SUPPORTED` on failure</p><p>`AMF_ALREADY_INITIALIZED` when the context re-initialization for the same technology was attempted</p> | --- ### Vulkan Compute Queue By default the Vulkan compute queue index used by `AMFContext1::InitVulkan` is `0`. This can be changed by calling `AMFContext::SetProperty` with the property `AMF_CONTEXT_VULKAN_COMPUTE_QUEUE` defined in VulkanAMF.h, prior to calling `AMFContext1::InitVulkan`. The type of this property is amf_int64, and the valid range is `[0, (VkQueueFamilyProperties.queueCount-1)]` Get Native Device Interfaces `void* AMF_STD_CALL GetVulkanDevice();` Obtain a pointer to the native Vulkan device handle wrapper represented by the `AMFVulkanDevice` structure (declared in the `public/include/core/VulkanAMF.h` header). | **Return Value** | A pointer to the `AMFVulkanDevice` structure defined as follows: | | :-------------- | :--------------------------------------------------------------- | | Field | Description | | cbSizeof | Size of the `AMFVulkanDevice` structure | | pNext | Reserved for extensions | | hInstance | Vulkan run-time instance handle | | hPhysicalDevice | Physical Vulkan device handle | | hDevice | Vulkan device handle | --- ### Device Lock `AMF_RESULT LockVulkan();` Lock the Vulkan device associated with the context for exclusive use. | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NOT_INITIALIZED` when called on a context which hasn’t been initialized for the specific platform</p> | | :--------------- | :-------------------------------------------------------------------------------------------------------------------------------------- | ### Device Unlock `AMF_RESULT UnlockVulkan();` Unlock the device associated with the context that was previously locked with the `LockVulkan` method. | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NOT_INITIALIZED` when called on a context which hasn’t been initialized for the specific platform</p> | | :--------------- | :-------------------------------------------------------------------------------------------------------------------------------------- | --- ### AMFContext1::CreateSurfaceFromVulkanNative `AMF_RESULT AMF_STD_CALL CreateSurfaceFromVulkanNative(void* pVulkanImage, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);` Wrap an existing native Vulkan surface in an [`AMFSurface`](#2331-amfsurface) object. The context must be initialized for Vulkan. | Parameter | Description | | :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pVulkanImage [in] | A pointer to the AMFVulkanSurface structure encapsulating the native Vulkan surface | | ppSurface [out] | A pointer to the location to receive a pointer to the [`AMFSurface`](#2331-amfsurface) interface | | pObserver [in] | A pointer to an object implementing the [`AMFSurfaceObserver`](#2332-amfsurfaceobserver) interface to receive a notification when the corresponding [`AMFSurface`](#2331-amfsurface) object is being destroyed | | **Return Value** |<p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext1::GetVulkanDeviceExtensions `AMF_RESULT AMF_STD_CALL GetVulkanDeviceExtensions(amf_size* pCount, const char** ppExtensions);` Obtain the list of supported Vulkan extensions. | Parameter | Description | | :----------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pCount [out] | A pointer to a location receiving the count of supported extensions | | ppExtensions [out] | A pointer to the location to receive a list of supported extension names. When `ppExtensions` is `NULL`, the method would still populate the extensions count pointed at by the `pCount` parameter | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext1::CreateBufferFromVulkanNative `AMF_RESULT AMF_STD_CALL CreateBufferFromVulkanNative(void* pVulkanBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);` Create an [`AMFBuffer`](#2321-amfbuffer) object from a native Vulkan buffer. | Parameter | Description | | :----------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pVulkanBuffer [in] | A pointer to the `AMFVulkanBuffer` structure encapsulating the native Vulkan buffer | | ppBuffer [out] | A pointer to the location to receive a pointer to the [`AMFBuffer`](#2321-amfbuffer) object | | pObserver [in] | A pointer to an object implementing the [`AMFBufferObserver`](#2322-amfbufferobserver) interface to receive a notification when the corresponding [`AMFBuffer`](#2321-amfbuffer) object is being destroyed | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext1::CreateBufferFromDX11Native `AMF_RESULT AMF_STD_CALL CreateBufferFromDX11Native(void* pHostBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);` Create an [`AMFBuffer`](#2321-amfbuffer) object from a native DX11 buffer. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pHostBuffer [in] | A native handle to the DX11 buffer | | ppBuffer [out] | A pointer to the location to receive a pointer to the [`AMFBuffer`](#2321-amfbuffer) object | | pObserver [in] | A pointer to an object implementing the [`AMFBufferObserver`](#2322-amfbufferobserver) interface to receive a notification when the corresponding [`AMFBuffer`](#2321-amfbuffer) object is being destroyed | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFContext1::AllocBufferEx() `AMF_RESULT AMF_STD_CALL AllocBufferEx(AMF_MEMORY_TYPE type, amf_size size, AMF_BUFFER_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFBuffer** ppBuffer);` Allocate a buffer object. The context must be initialized for the technology matching the memory type specified by the `type` parameter. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type [in] | Memory type | | size [in] | Buffer size in bytes | | usage [in] | Buffer usage. Can be a bit-wise OR of the following values: `AMF_BUFFER_USAGE_DEFAULT`, `AMF_BUFFER_USAGE_NONE`, `AMF_BUFFER_USAGE_CONSTANT`, `AMF_BUFFER_USAGE_SHADER_RESOURCE`, `AMF_BUFFER_USAGE_UNORDERED_ACCESS`, `AMF_BUFFER_USAGE_TRANSFER_SRC`, `AMF_BUFFER_USAGE_TRANSFER_DST`| | access [in] | CPU access mode. Can be a bit-wise OR of the following values: `AMF_MEMORY_CPU_DEFAULT`, `AMF_MEMORY_CPU_NONE`, `AMF_MEMORY_CPU_READ`, `AMF_MEMORY_CPU_WRITE`, `AMF_MEMORY_CPU_LOCAL`, `AMF_MEMORY_CPU_PINNED` | | ppBuffer [out] | A pointer to the location to receive a pointer to the [`AMFBuffer`](#2321-amfbuffer) interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | Notes: The `AMF_BUFFER_USAGE` values abstract DX11 and Vulkan buffer usages in a platform-independent way as described below. Follow the respective DX11 and Vulkan documentation for valid combinations of values for each platform: | AMF Value | DX11 Equivalent | Vulkan Equivalent | | :-------------------------------- | :--------------------------- | :------------------------------------------------------------------------------------------------------------- | | AMF_BUFFER_USAGE_DEFAULT | `D3D11_USAGE_STAGING` | `VK_BUFFER_USAGE_TRANSFER_SRC_BIT`, `VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT`, `VK_BUFFER_USAGE_STORAGE_BUFFER_BIT` | | AMF_BUFFER_USAGE_NONE | `0` | `0` | | AMF_BUFFER_USAGE_CONSTANT | `D3D11_BIND_CONSTANT_BUFFER` | `VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT` | | AMF_BUFFER_USAGE_SHADER_RESOURCE | `D3D11_BIND_SHADER_RESOURCE` | `VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT` | | AMF_BUFFER_USAGE_UNORDERED_ACCESS | `D3D11_BIND_UNORDERED_ACCESS`| `VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT`, `VK_BUFFER_USAGE_STORAGE_BUFFER_BIT` | | AMF_BUFFER_USAGE_TRANSFER_SRC | None | `VK_BUFFER_USAGE_TRANSFER_SRC_BIT` | | AMF_BUFFER_USAGE_TRANSFER_DST | None | `VK_BUFFER_USAGE_TRANSFER_DST_BIT` | The `AMF_MEMORY_CPU_ACCESS` values abstract DX11 and Vulkan buffer CPU access modes in a platform-independent way as described below. Follow the respective DX11 and Vulkan documentation for valid combinations of values for each platform: | AMF Value | DX11 Equivalent | Vulkan Equivalent | | :--------------------- | :----------------------- | :-------------------------------------------------------------------------- | | AMF_MEMORY_CPU_DEFAULT | `0` | `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT`, `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`| | AMF_MEMORY_CPU_NONE | `0` | `0` | | AMF_MEMORY_CPU_READ | `D3D11_CPU_ACCESS_READ` | `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` | | AMF_MEMORY_CPU_WRITE | `D3D11_CPU_ACCESS_WRITE` | `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` | | AMF_MEMORY_CPU_LOCAL | None | `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT` | | AMF_MEMORY_CPU_PINNED | None | `VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR` | --- ### AMFContext1::AllocSurfaceEx() `AMF_RESULT AMF_STD_CALL AllocSurfaceEx(AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMF_SURFACE_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFSurface** ppSurface);` Allocate a surface object. The context must be initialized for the technology matching the memory type specified by the `type` parameter. | Parameter | Description | | :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type [in] | Memory type | | format [in] | Pixel format | | width [in] | Surface width in pixels | | height [in] | Surface height in scan lines | | usage [in] | Surface usage. Can be a bit-wise OR of the following values: `AMF_SURFACE_USAGE_DEFAULT`, `AMF_SURFACE_USAGE_NONE`, `AMF_SURFACE_USAGE_SHADER_RESOURCE`, `AMF_SURFACE_USAGE_RENDER_TARGET`, `AMF_SURFACE_USAGE_UNORDERED_ACCESS`, `AMF_SURFACE_USAGE_TRANSFER_SRC`, `AMF_SURFACE_USAGE_TRANSFER_DST` | | access [in] | CPU access mode. Can be a bit-wise OR of the following values: `AMF_MEMORY_CPU_DEFAULT`, `AMF_MEMORY_CPU_NONE`, `AMF_MEMORY_CPU_READ`, `AMF_MEMORY_CPU_WRITE`, `AMF_MEMORY_CPU_LOCAL`, `AMF_MEMORY_CPU_PINNED` | | ppSurface [out] | A pointer to the location to receive a pointer to the [`AMFSurface`](#2331-amfsurface) interface | | | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type, format or surface sizes are invalid</p> | Notes: The `AMF_SURFACE_USAGE` values abstract DX11 and Vulkan buffer usages in a platform-independent way as described below. Follow the respective DX11 and Vulkan documentation for valid combinations of values for each platform: | AMF Value | DX11 Equivalent | Vulkan Equivalent | | :--------------------------------- | :--------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | AMF_SURFACE_USAGE_DEFAULT | `D3D11_USAGE_STAGING` | `VK_IMAGE_USAGE_TRANSFER_SRC_BIT`, `VK_IMAGE_USAGE_TRANSFER_DST_BIT`, `VK_IMAGE_USAGE_SAMPLED_BIT`, `VK_IMAGE_USAGE_STORAGE_BIT`, `VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT` | | AMF_SURFACE_USAGE_NONE | `0` | `0` | | AMF_SURFACE_USAGE_SHADER_RESOURCE | `D3D11_BIND_SHADER_RESOURCE` | `VK_IMAGE_USAGE_SAMPLED_BIT`, `VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT` | | AMF_SURFACE_USAGE_RENDER_TARGET | `D3D11_BIND_RENDER_TARGET` | `VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT` | | AMF_SURFACE_USAGE_UNORDERED_ACCESS | `D3D11_BIND_UNORDERED_ACCESS`| `VK_IMAGE_USAGE_SAMPLED_BIT`, `VK_IMAGE_USAGE_STORAGE_BIT`, `VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT` | | AMF_SURFACE_USAGE_TRANSFER_SRC | None | `VK_IMAGE_USAGE_TRANSFER_SRC_BIT` | | AMF_SURFACE_USAGE_TRANSFER_DST | None | `VK_IMAGE_USAGE_TRANSFER_DST_BIT` | The `AMF_MEMORY_CPU_ACCESS` values abstract DX11 and Vulkan buffer CPU access modes in a platform-independent way as described below. Follow the respective DX11 and Vulkan documentation for valid combinations of values for each platform: | AMF Value | DX11 Equivalent | Vulkan Equivalent | | :--------------------- | :----------------------- | :--------------------------------------------------------------------------- | | AMF_MEMORY_CPU_DEFAULT | `0` | `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT`, `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT` | | AMF_MEMORY_CPU_NONE | `0` | `0` | | AMF_MEMORY_CPU_READ | `D3D11_CPU_ACCESS_READ` | `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` | | AMF_MEMORY_CPU_WRITE | `D3D11_CPU_ACCESS_WRITE` | `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` | | AMF_MEMORY_CPU_LOCAL | None | `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT` | | AMF_MEMORY_CPU_PINNED | None | `VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR` | --- ### 2.5 AMF Compute The AMF Compute API provides an abstraction layer for running OpenCL kernels. In addition to the standard OpenCL implementation AMD devices allow to execute OpenCL kernels in different way, which provides a more efficient interop with DirectX. AMF Compute provides a uniform API to utilize both subsystems. Note that interop with DirectX11 is available only on Windows 8.1 and newer versions of Microsoft Windows. Applications should choose between standard OpenCL and AMF Compute technologies based on performance requirements. AMF Compute is recommended when interop with DirectX is heavily utilized. Most of the AMF Compute functions can be accessed through the [`AMFCompute`](#25-amf-compute) interface. A pointer to the [`AMFCompute`](##254-amfcompute) interface can be obtained by calling [`AMFContext`](#241-amfcontext)`::GetCompute` or the [`AMFDeviceCompute`](#252-amfdevicecompute)`::CreateCompute` or [`AMFDeviceCompute](#252-amfdevicecompute)`::CreateComputeEx` methods. Compute devices can be enumerated using the [`AMFComputeFactory`](#251-amfcomputefactory) interface. To obtain a pointer to the `AMFComputeFactory` interface, call [`AMFContext`](#242-amfcontext1)`::GetOpenCLComputeFactory`. To utilize the standard OpenCL API through AMF Compute, initialize the context with a call to `AMFContext::InitOpenCL` or `AMFContext::InitOpenCLEx.` When the context is initialized with `AMFContext::InitDX9` or `AMFContext::InitDX11`,` AMF Compute will be used. OpenCL kernels can be submitted to and executed in an AMF Compute queue. Kernels need to be registered with AMF before they can be used. Kernel registration is performed using the [`AMFPrograms`](##254-amfcompute) interface, a pointer to which can be obtained by calling [`AMFFactory`](#223-amffactory)`::GetPrograms`. ### 2.5.1 AMFComputeFactory The `AMFComputeFactory` interface allows to enumerate Compute devices available in the system. The `AMFComputeFactory` interface inherits from [`AMFInterface`](#223-amffactory). Include `public/include/core/ComputeFactory.h` --- ### AMFComputeFactory::GetDeviceCount `amf_int32 AMF_STD_CALL GetDeviceCount();` Get the total count of Compute devices available in the system. | **Return Value** | The total number of AMF Compute devices available | | :--------------- | :------------------------------------------------ | --- ### AMFComputeFactory::GetDeviceAt `AMF_RESULT AMF_STD_CALL GetDeviceAt(amf_int32 index, AMFDeviceCompute **ppDevice);` Obtain a pointer to a specific AMF Compute device. | Parameter | Description | | :--------------- | :---------------------------------------------------------------------------------------------------------- | | index [in] | Device zero-based index | | ppDevice [out] | A pointer to the location to receive a pointer to the [`AMFDeviceCompute`](#252-amfdevicecompute) interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_INVALID_ARG` when `ppDevice` is `nullptr`</p> | --- ### 2.5.2 AMFDeviceCompute The `AMFDeviceCompute` interface provides access to the functionality of an AMF Compute device object. The `AMFDeviceCompute` interface inherits from [`AMFPropertyStorage`](#2141-amfpropertystorage). Include `public/include/core/ComputeFactory.h` --- ### AMFDeviceCompute::GetNativePlatform `void* AMF_STD_CALL GetNativePlatform();` Get the native AMF Compute platform descriptor. The **Return Value** of this method should be treated as an opaque handle. | **Return Value** | Native AMF Compute platform descriptor. | | :--------------- | :-------------------------------------- | --- ### AMFDeviceCompute::GetNativeDeviceID `void* AMF_STD_CALL GetNativeDeviceID();` Get the native AMF Compute device ID. The **Return Value** of this method should be treated as an opaque handle. | **Return Value** | Native AMF Compute device ID. | | :--------------- | :---------------------------- | --- ### AMFDeviceCompute::GetNativeContext `void* AMF_STD_CALL GetNativeContext();` Get the native AMF Compute context. The **Return Value** of this method should be treated as an opaque handle. | **Return Value** | Native AMF Compute context. | | :--------------- | :-------------------------- | --- ### AMFDeviceCompute::CreateCompute ### AMFDeviceCompute::CreateComputeEx `AMF_RESULT AMF_STD_CALL CreateCompute(void* reserved, AMFCompute** ppCompute);` `AMF_RESULT AMF_STD_CALL CreateComputeEx(void* pCommandQueue, AMFCompute** ppCompute);` Create an AMF Compute object and obtain the [`AMFCompute`](#254-amfcompute) interface pointer. `CreateCompute` uses the default command queue created by [`AMFContext](#241-amfcontext)`::InitOpenCL()`. `CreateComputeEx` allows to specify a command queue created externally. | Parameter | Description | | :----------------- | :------------------------------------------------------------------------------------------------------------ | | reserved [in] | Reserved. Must be set to `nullptr` | | pCommandQueue [in] | A handle to an OpenCL command queue | | ppCompute [out] | A pointer to a location to receive a pointer to the [`AMFCompute`](#254-amfcompute) interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when `ppCompute` is `nullptr`</p> | ### 2.5.3 AMFPrograms The `AMFPrograms` interface is used to compile and register AMF Compute kernels with AMF. AMF Compute kernels use the same syntax as OpenCL kernels. A pointer to the `AMFPrograms` interface can be obtained by calling the [`AMFFactory`](#223-amffactory)`::GetPrograms` method. The `AMFPrograms` interface is not reference-counted and represents a global object, which maintains a registry of all AMF Compute kernels used by the application. Do not call `delete` on the `AMFPrograms` interface. Include `public/include/core/Compute.h` --- ### AMFPrograms::RegisterKernelSourceFile `AMF_RESULT AMF_STD_CALL RegisterKernelSourceFile(AMF_KERNEL_ID* pKernelID, const wchar_t* trace_name, const char* kernelName, const wchar_t* filepath, const char* options);` Compile an AMF Compute kernel from a source file and register it with AMF Compute. | Parameter | Description | | :--------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pKernelID [out] | A pointer to the location to receive a unique kernel ID assigned by AMF | | trace_name [in] | A unique human-readable string to uniquely identify a specific kernel. Used in performance trace enabled by [`AMFDebug`](#224-amfdebug)`::EnablePerformanceMonitor` | | kernelName [in] | Kernel name in the source file | | filepath [in] | Source file path | | options [in] | Kernel options passed to `clBuildProgram` | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFPrograms::RegisterKernelSource `AMF_RESULT AMF_STD_CALL RegisterKernelSource(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options);` Compile an AMF Compute kernel from source located in a memory buffer and register it with AMF Compute. | Parameter | Description | | :--------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pKernelID [out] | A pointer to the location to receive a unique kernel ID assigned by AMF | | trace_name [in] | A unique human-readable string to uniquely identify a specific kernel. Used in performance trace enabled by [`AMFDebug`](#224-amfdebug)`::EnablePerformanceMonitor` | | kernelName [in] | Kernel name in the source file | | dataSize [in] | The size of the buffer containing the kernel’s source code in bytes | | data [in] | A pointer to the buffer containing the kernel’s source code | | options [in] | Kernel options passed to `clBuildProgram` | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFPrograms::RegisterKernelBinary `AMF_RESULT AMF_STD_CALL RegisterKernelBinary(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options);` Load and register a precompiled kernel located in a memory buffer. | Parameter | Description | | :--------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pKernelID [out] | A pointer to the location to receive a unique kernel ID assigned by AMF | | trace_name [in] | A unique human-readable string to uniquely identify a specific kernel. Used in performance trace enabled by [`AMFDebug`](#224-amfdebug)`::EnablePerformanceMonitor` | | kernelName [in] | Kernel name in the source file | | dataSize [in] | The size of the buffer containing the kernel’s compiled code in bytes | | data [in] | A pointer to the buffer containing the kernel’s compiled code | | options [in] | Kernel options passed to `clBuildProgram` | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### 2.5.4 AMFCompute The `AMFCompute` interface provides access to the functionality of an OpenCL command queue. The `AMFCompute` interface inherits from [`AMFInterface`](#223-amffactory). Include `public/include/core/Compute.h` --- ### AMFCompute::GetMemoryType `AMF_MEMORY_TYPE AMF_STD_CALL GetMemoryType();` Get the type of memory associated with the `AMFCompute` object. Memory type returned depends on how the `AMFCompute` object was initialized. For objects created with [`AMFContext`](#241-amfcontext)`::GetCompute`, the value passed to `GetCompute` will be returned. | **Return Value** | <p>Memory type. Can be one of the following values:</p><p>`AMF_MEMORY_OPENCL` – for OpenCL</p><p>`AMF_MEMORY_COMPUTE_FOR_DX9` – for AMF Compute on DirectX9</p><p>`AMF_MEMORY_COMPUTE_FOR_DX11` – for AMF Compute on DirectX11</p> | | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- ### AMFCompute::GetNativeContext `void* AMF_STD_CALL GetNativeContext();` Return a handle to the native context associated with the AMF Compute command queue. | **Return Value** | Handle to the native context | | :--------------- | :--------------------------- | --- ### AMFCompute::GetNativeDeviceID `void* AMF_STD_CALL GetNativeDeviceID();` Return a handle to the native device ID associated with the AMF Compute command queue. | **Return Value** | Handle to the native device ID | | :--------------- | :----------------------------- | --- ### AMFCompute::GetNativeCommandQueue `void* AMF_STD_CALL GetNativeCommandQueue();` Return a handle to the native command queue associated with the AMF Compute object. | **Return Value** | Handle to the native command queue | | :--------------- | :--------------------------------- | --- ### AMFCompute::GetKernel `AMF_RESULT AMF_STD_CALL GetKernel(AMF_KERNEL_ID kernelID, AMFComputeKernel** kernel);` Load an AMF Compute kernel from the global registry and associate it with the `AMFCompute` object. |Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------- | | kernelID [in] | A unique kernel ID returned by one of the [`AMFPrograms`](#254-amfcompute) methods | | kernel [out] | A pointer to a location to receive a pointer to the [`AMFComputeKernel`](#255-amfcomputekernel) interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFCompute::PutSyncPoint `AMF_RESULT AMF_STD_CALL PutSyncPoint(AMFComputeSyncPoint** ppSyncPoint);` Insert a synchronization point into the AMF Compute queue. A synchronization point allows the CPU to wait for the completion and query the status of a particular operation submitted to an AMF Compute queue. | **Return Value** | A pointer to a location to receive a pointer to the [`AMFComputeSyncPoint`](#256-amfcomputesyncpoint) interface | | :--------------- | :-------------------------------------------------------------------------------------------------------------- | --- ### AMFCompute::FlushQueue `AMF_RESULT AMF_STD_CALL FlushQueue();` Trigger the AMF Compute queue to immediately start executing submitted tasks. Under normal conditions the GPU decides when to start executing tasks submitted to the queue. Submitting a task to the queue does not guarantee that the GPU execute it immediately after submission. Flushing the queue triggers immediate execution of all tasks submitted up to the moment of the call. When GPU profiling is enabled with [`AMFDebug`](#224-amfdebug)`::EnablePerformanceMonitor`, flushing the queue also triggers profiling output messages to be dumped. | **Return Value** | `AMF_OK` | | :--------------- | :------- | --- ### AMFCompute::FinishQueue `AMF_RESULT AMF_STD_CALL FinishQueue();` Trigger the AMF Compute queue to immediately start executing submitted tasks and wait for their completion. | **Return Value** | `AMF_OK` | | :--------------- | :------- | --- ### AMFCompute::FillPlane `AMF_RESULT AMF_STD_CALL FillPlane(AMFPlane* pPlane, const amf_size origin[3], const amf_size region[3], const void* pColor);` Fill a surface plane with a solid color. The `origin` and the `region` parameters represent the 3D coordinates and the size of the area of the plane to be filled. For 2D planes `origin[2]` and `region[2]` must be set to 0. The fill color is a four component RGBA floating-point color value if the image channel data type is not an unnormalized signed and unsigned integer type, is a four-component signed integer value if the image channel data type is an unnormalized signed integer type and is a four component unsigned integer value if the image channel data type is an unormalized unsigned integer type. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------- | | pPlane [in] | A pointer to an [`AMFPlane`](#_AMFPlane) object to be filled | | origin [in] | A triplet specifying the origin of a rectangular area in the plane to be filled | | region [in] | A triplet specifying the size of a rectangular area in the plane to be filled | | pColor [in] | Fill color | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFCompute::FillBuffer `AMF_RESULT AMF_STD_CALL FillBuffer(AMFBuffer* pBuffer, amf_size dstOffset, amf_size dstSize, const void* pSourcePattern, amf_size patternSize);` Fill a buffer object with a repeating pattern. When the destination size specified with the `dstSize` parameter is greater than the pattern size specified with the `patternSize` parameter, the pattern will be repeated. When the destination size is not a multiple of pattern size, the last copy of the pattern at the destination will be truncated. | Parameter | Description | | :------------------ | :-------------------------------------------------------------------------------------------------------------------- | | pBuffer [in] | A pointer to an [`AMFBuffer`](#2321-amfbuffer) object to be filled | | dstOffset [in] | Destination offset in bytes | | dstSize [in] | Destination size in bytes | | pSourcePattern [in] | A pointer to the pattern to fill the buffer with | | patternSize [in] | Pattern size in bytes | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure` </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFCompute::ConvertPlaneToBuffer `AMF_RESULT AMF_STD_CALL ConvertPlaneToBuffer(AMFPlane* pSrcPlane, AMFBuffer** ppDstBuffer);` Create an `AMFBuffer` object and attach a plane to it. Both the buffer and the source plane share the same physical memory. The memory itself is not owned by any of the objects and would get freed only after the last object referencing it is destroyed. | Parameter | Description | | :------------------ | :------------------------------------------------------------------------------------------------------------------- | | pBuffer [in] | A pointer to an [`AMFBuffer`](#2321-amfbuffer) object to be filled | | dstOffset [in] | Destination offset in bytes | | dstSize [in] | Destination size in bytes | | pSourcePattern [in] | A pointer to the pattern to fill the buffer with | | patternSize [in] | Pattern size in bytes | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFCompute::CopyBuffer `AMF_RESULT AMF_STD_CALL CopyBuffer(AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffset);` Copy the content one buffer to another buffer using GPU. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------- | | pSrcBuffer [in] | A pointer to the source [`AMFBuffer`](#2321-amfbuffer) object | | pDstBuffer [in] | A pointer to the destination [`AMFBuffer`](#2321-amfbuffer) object | | srcOffset [in] | Source offset in bytes | | dstOffset [in] | Destination offset in bytes | | size [in] | Size of the data to be copied in bytes | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFCompute::CopyPlane `AMF_RESULT AMF_STD_CALL CopyPlane(AMFPlane *pSrcPlane, const amf_size srcOrigin[3], const amf_size region[3], AMFPlane *pDstPlane, const amf_size dstOrigin[3]);` Copy the content of a plane to another plane. The `srcOrigin, dstOrigin` and the `region` parameters represent the 3D coordinates and the size of the area of the plane to be filled. For 2D planes `srcOrigin[2], dstOrigin[2]` must be set to 0 and `region[2]` must be set to 1. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------- | | pSrcPlane [in] | A pointer to an [`AMFPlane`](#2333-amfplane) object to be copied | | pDstPlane [in] | A pointer to an [`AMFPlane`](#2333-amfplane) object to be copied to | | srcOrigin [in] | A triplet specifying the origin of a rectangular area in the source plane | | dstOrigin [in] | A triplet specifying the origin of a rectangular area in the destination plane | | region [in] | `A triplet specifying the size of a rectangular area in the plane to be filled | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFCompute::CopyBufferToHost `AMF_RESULT AMF_STD_CALL CopyBufferToHost(AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, void* pDest, bool blocking);` Copy the content of a buffer from GPU memory to host (CPU) memory. The destination buffer is not an AMF object and can be allocated using any host memory allocation methods, such as `malloc`, the `new` operator, etc. The application is responsible for freeing this buffer when it is no longer needed. When the `blocking` parameter is set to `false`, the call to `CopyBufferToHost` returns immediately. Set a synchronization point immediately after the call to `CopyBufferToHost` to determine when the copy operation is completed. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pSrcBuffer [in] | A pointer to the source [`AMFBuffer`](#_AMFBuffer_1) object | | pDst [in] | A pointer to the destination buffer` in host memory. | | srcOffset [in] | Source offset in bytes | | size [in] | Size of the data to be copied in bytes | | blocking [in] | When set to `true`, the call will block until the operation is completed. When set to `false`, the call will return immediately and the copy operation will continue in the background | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p> `AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFCompute::CopyBufferFromHost `AMF_RESULT AMF_STD_CALL CopyBufferFromHost(const void* pSource, amf_size size,` `AMFBuffer* pDstBuffer, amf_size dstOffset, bool blocking);` Copy the content of a buffer from host (CPU) memory to GPU memory. When the `blocking` parameter is set to `false`, the call to `CopyBufferToHost` returns immediately. Set a synchronization point immediately after the call to `CopyBufferToHost` to determine when the copy operation is completed. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pSource [in] | A pointer to the source buffer` in host memory. | | pDstBuffer [in] | A pointer to the destination [`AMFBuffer`](#2321-amfbuffer) object | | dstOffset [in] | Source offset in bytes | | size [in] | Size of the data to be copied in bytes | | blocking [in] | When set to `true`, the call will block until the operation is completed. When set to `false`, the call will return immediately and the copy operation will continue in the background | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFCompute::CopyPlaneToHost `AMF_RESULT AMF_STD_CALL CopyPlaneToHost(AMFPlane *pSrcPlane, const amf_size origin[3], const amf_size region[3], void* pDest, amf_size dstPitch, bool blocking);` Copy a 2D surface plane in GPU memory to a buffer in host (CPU) memory. The `origin` and the `region` parameters represent the 3D coordinates and the size of the area of the plane to be filled. For 2D planes `origin[2]` and `region[2]` must be set to 0. The destination buffer is not an AMF object and can be allocated using any host memory allocation methods, such as `malloc`, the `new` operator, etc. The application is responsible for freeing this buffer when it is no longer needed. When the `blocking` parameter is set to `false`, the call to `CopyPlaneToHost` returns immediately. Set a synchronization point immediately after the call to `CopyPlaneToHost` to determine when the copy operation is completed. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pSrcPlane [in] | A pointer to an [`AMFPlane`](#2333-amfplane) object to be copied | | pDest [in] | A pointer to the destination buffer | | origin [in] | A triplet specifying the origin of a rectangular area in the source plane | | region [in] | A triplet specifying the size of a rectangular area in the plane to be copied | | dstPitch [in] | Destination pitch (the size of a single scanline) in bytes | | blocking [in] | When set to `true`, the call will block until the operation is completed. When set to `false`, the call will return immediately and the copy operation will continue in the background | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFCompute::CopyPlaneFromHost `AMF_RESULT AMF_STD_CALL CopyPlaneFromHost(void* pSource, const amf_size origin[3], const amf_size region[3], amf_size srcPitch, AMFPlane *pDstPlane, bool blocking);` Copy a buffer in host (CPU) memory to a 2D surface plane in GPU memory. The `origin` and the `region` parameters represent the 3D coordinates and the size of the area of the plane to be filled. For 2D planes `origin[2]` and `region[2]` must be set to 0. When the `blocking` parameter is set to `false`, the call to `CopyPlaneFromHost` returns immediately. Set a synchronization point immediately after the call to `CopyPlaneFromHost` to determine when the copy operation is completed. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pSource [in] | A pointer to the source buffer in host memory | | pDstPlane [in] | A pointer to an [`AMFPlane`](#2333-amfplane) object to copy to | | origin [in] | A triplet specifying the origin of a rectangular area in the destination plane | | region [in] | A triplet specifying the size of a rectangular area in the plane to be copied | | srcPitch [in] | Source pitch (the size of a single scanline) in bytes | | blocking [in] | When set to `true`, the call will block until the operation is completed. When set to `false`, the call will return immediately and the copy operation will continue in the background | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFCompute::ConvertPlaneToPlane `AMF_RESULT AMF_STD_CALL ConvertPlaneToPlane(AMFPlane* pSrcPlane, AMFPlane** ppDstPlane, AMF_CHANNEL_ORDER order, AMF_CHANNEL_TYPE type);` Copy a plane in GPU memory to another plane of a different format in GPU memory. The order of channels is specified using the `AMF_CHANNEL_ORDER` enumeration defined as follows: |Value|Description| | :- | :- | | AMF_CHANNEL_ORDER_R |Only the Red channel is present| | AMF_CHANNEL_ORDER_RG |Only the Red channel followed by the Green channel are present| | AMF_CHANNEL_ORDER_BGRA |The Blue, Green, Red and Alpha channels are present| | AMF_CHANNEL_ORDER_RGBA |The Red, Green, Blue and Alpha channels are present| | AMF_CHANNEL_ORDER_ARGB |The Alpha, Red, Green and Blue channels are present| The channel type defines the format of pixel data in GPU memory and is defined as follows: | Value |Description| | :------------------------- | :--------------------------------------------- | | AMF_CHANNEL_UNSIGNED_INT8 | Unsigned 8-bit integer per channel | | AMF_CHANNEL_UNSIGNED_INT32 | Unsigned 32-bit integer per channel | | AMF_CHANNEL_UNORM_INT8 | Unsigned normalized 8-bit integer per channel | | AMF_CHANNEL_UNORM_INT16 | Unsigned normalized 16-bit integer per channel | | AMF_CHANNEL_SNORM_INT16 | Signed normalized 16-bit integer per channel | | AMF_CHANNEL_FLOAT | Floating point | | AMF_CHANNEL_FLOAT16 | 16-bit floating point | | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------- | | pSrcPlane [in] | A pointer to the source [`AMFPlane`](#_AMFPlane) object | | pDstPlane [out] | A pointer to a location to receive a pointer to the destination [`AMFPlane`](#2333-amfplane) object | | order` [in] | Channel order | | type [in] | Pixel format | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### 2.5.5 AMFComputeKernel The `AMFComputeKernel` interface facilitates passing parameters to and execution of an AMFCompute kernel. A pointer to the `AMFComputeKernel` interface of a specific kernel can be obtained by calling the [`AMFCompute](#254-amfcompute)`::GetKernel` method. The `AMFComputeKernel` interface inherits from [`AMFInterface`](#223-amffactory). Include `public/include/core/Compute.h` --- ### AMFComputeKernel::GetNative `void* MF_STD_CALL GetNative();` Get a native kernel handle. | **Return Value** | Native kernel handle | | :--------------- | :------------------- | --- ### AMFComputeKernel::GetIDName `const wchar_t* AMF_STD_CALL GetIDName();` Get the Identification Name of a kernel. This name is used to identify a kernel in the AMF Performance Trace log. The pointer returned points to an internally allocated wide-character Unicode string. Do not free this memory when it is no longer needed. Do not save the pointer returned by `GetIDName` in any location that might outlive the `AMFComputeKernel` object itself. | **Return Value** | A pointer to a string identifying the kernel. | | :--------------- | :-------------------------------------------- | --- ### Passing Parameters to a Kernel `AMF_RESULT AMF_STD_CALL SetArgPlaneNative(amf_size index, void* pPlane, AMF_ARGUMENT_ACCESS_TYPE eAccess);` `AMF_RESULT AMF_STD_CALL SetArgBufferNative(amf_size index, void* pBuffer, AMF_ARGUMENT_ACCESS_TYPE eAccess);` `AMF_RESULT AMF_STD_CALL SetArgPlane(amf_size index, AMFPlane* pPlane, AMF_ARGUMENT_ACCESS_TYPE eAccess);` `AMF_RESULT AMF_STD_CALL SetArgBuffer(amf_size index, AMFBuffer* pBuffer, AMF_ARGUMENT_ACCESS_TYPE eAccess);` `AMF_RESULT AMF_STD_CALL SetArgInt32(amf_size index, amf_int32 data);` `AMF_RESULT AMF_STD_CALL SetArgInt64(amf_size index, amf_int64 data);` `AMF_RESULT AMF_STD_CALL SetArgFloat(amf_size index, amf_float data);` `AMF_RESULT AMF_STD_CALL SetArgBlob(amf_size index, amf_size dataSize, const void* pData);` These methods are used to pass parameters to an AMFCompute kernel. Each parameter is identified by a zero-based index. The access rights for the kernel are defined by the `eAccess` parameter and can be one of the following values: | Value | Description | | :---------------------------- | :------------------------------------------------------------------------------------------------------------------- | | AMF_ARGUMENT_ACCESS_READ | Read-only access | | AMF_ARGUMENT_ACCESS_WRITE | Write-only access | | AMF_ARGUMENT_ACCESS_READWRITE | Read and write access | | Parameter | Description | | index [in] | A zero-based parameter index | | pPlane [in] | A handle of a native OpenCL plane or a pointer to an [`AMFPlane`](#2333-amfplane) object | | pBuffer [in] | A handle of a native OpenCL buffer or a pointer to an [`AMFBuffer`](#2321-amfbuffer) object | | data [in] | Data of a primitive type | | pData [in] | A pointer to unstructured data buffer in host memory | | dataSize [in] | The size of the unstructured data buffer passed in pData | | eAccess [in] | Data access mode | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFComputeKernel::GetCompileWorkgroupSize `AMF_RESULT AMF_STD_CALL GetCompileWorkgroupSize(amf_size workgroupSize[3]);` Get compile workgroup size. The `GetCompileWorkgroupSize` method is a wrapper around the `clGetKernelWorkGroupInfo` OpenCL call with `CL_KERNEL_COMPILE_WORK_GROUP_SIZE` passed as parameter. The result is returned as an array of 3 elements (X,Y,Z). When the workgroup size is not specified, the returned value would be (0,0,0). For more information about compile workgroup size please refer to the OpenCL documentation: <https://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clGetKernelWorkGroupInfo.html> | Parameter | Description | | :------------------ | :------------------------------------------------------------------------------------------------------------------- | | workgroupSize [out] | Workgroup size (X,Y,Z) | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### AMFComputeKernel::Enqueue `AMF_RESULT AMF_STD_CALL Enqueue(amf_size dimension, amf_size globalOffset[3], amf_size globalSize[3], amf_size localSize[3]);` Submit a kernel for execution. | Parameter | Description | | :---------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | dimension [in] | The number of dimensions used to specify the global work-items and work-items in the work-group. `dimension` must be greater than zero and less than or equal to three. | | globalOffset [in] | Must currently be a `NULL` value. In a future revision of AMF Compute, `globalOffset` can be used to specify an array of unsigned values that describe the offset used to calculate the global ID of a work-item instead of having the global IDs always start at offset (0, 0,... 0).| | globalSize [in] | Points to an array of unsigned values that describe the number of global work-items in `dimensions` dimensions that will execute the kernel function. | | localSize [in] | `localSize` will be used to determine how to break the global work-items specified by `globalSize` into appropriate work-group instances. If `localSize` is specified, the values specified in `globalSize[0],...globalSize[dimension - 1]` must be evenly divisable by the corresponding values specified in `localSize[0],...localSize[dimension - 1]`.| | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_FAIL` on failure` </p><p>`AMF_INVALID_ARG` when any of the arguments is invalid</p> | --- ### 2.5.6 AMFComputeSyncPoint A synchronization point allows the CPU to wait for the completion and query the status of a particular operation submitted to an AMF Compute queue. It is logically similar to the Win32 Event synchronization object, but is designed to synchronize a CPU with a GPU. A synchronization point object is created when a sync point is added to the AMF Compute queue using the [`AMFDeviceCompute](#252-amfdevicecompute)`::PutSyncPoint` method. The `AMFComputeSyncPoint` interface inherits from [`AMFInterface`](#223-amffactory). Include `public/include/core/Compute.h` --- ### AMFComputeSyncPoint::IsCompleted `bool AMF_STD_CALL IsCompleted();` Determine whether a synchronization point has been reached by the GPU. This method allows the CPU to unintrusively check whether a certain set of GPU operations has been completed. | **Return Value** | `true` when the synchronization point has been reached, `false` otherwise. | | :--------------- | :------------------------------------------------------------------------- | --- ### AMFComputeSyncPoint::Wait `void AMF_STD_CALL Wait();` Block CPU execution until the synchronization point is reached by the GPU. This method allows the CPU to wait for the completion of certain jobs without taking up any CPU cycles. It will not return and put the calling thread to sleep until the GPU reaches the set synchronization point. ### 2.6 Components ### 2.6.1 AMFComponent The `AMFComponent` interface provides access to the functionality of an AMF component. All AMF components implement the `AMFComponent` interface. The main purpose of an AMF component is to process a media stream, usually as part of a pipeline. <p align="center"> <img src="./image/AMF_API_Reference.1.png"> <p align="center"> Figure 1 – A pipeline of AMF components The `AMFComponent` interface inherits from the [`AMFPropertyStorageEx`](#22143-amfpropertystorageex) interface. All AMF components are thread-safe. Standard AMF components are created using the [`AMFFactory](#223-amffactory)`::CreateComponent` method. The use model of AMF components is built around the following flow: <p align="center"> <img src="./image/AMF_API_Reference.2.png"> <p align="center"> Figure 2 — AMF Component Usage Model Both input and output samples are stored in objects implementing the [`AMFData`](#231-amfdata) interface. Input samples are submitted continuously to a component by calling the `SubmitInput` method. The component processes input samples and produces output samples, which are placed in the output queue. Output samples are retrieved from the output queue by continuously calling the `QueryOutput` method. Since AMF components are thread-safe, submission of input samples and retrieval of output samples can be done either from a single thread, or multiple threads. User code should not make any assumptions about any relationship between input and output samples. While for some components the number of output samples is equal to the number of input samples, for other components this is not true. Some components may require more than one input sample to be submitted before any output samples are produced. AMF does not provide a standard implementation of a pipeline as part of the AMF API, leaving it up to applications to implement. However, many AMF samples do include a pipeline implementation, which could be used as a basis for your own implementation. Include `public/include/components/Component.h` --- ### AMFComponent::Init() `AMF_RESULT AMF_STD_CALL Init(AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height);` Initialize a component. This method fully initializes the component and should be called at least once before the component can be used. Components can be initialized multiple times with either the `Init` or the `ReInit` methods. Before a component can be initialized again with the `Init` method, it needs to be terminated by calling the `Terminate` method on the same object. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | | format [in] | Pixel format. Depending on the function of the component, this parameter may contain either the input, or the output format, or both. | | width [in] | Width in pixels | | height [in] | Height in scan lines | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFComponent::ReInit() `AMF_RESULT AMF_STD_CALL ReInit(amf_int32 width, amf_int32 height);` Reinitialize a component for the new resolution. The `ReInit` method performs a minimal reinitialization and typically is much quicker than `Init`. Call `ReInit` for the fast resolution change when resolution is the only parameter that has changed. `ReInit` requires that `Init` is called at least once prior to the call and will fail when this is not so. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | | width [in] | Width in pixels | | height [in] | Height in scan lines | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type or size are invalid</p> | --- ### AMFComponent::Terminate() `AMF_RESULT AMF_STD_CALL Terminate();` Terminate a component. Components need to be terminated before they can be initialized again with a call to the `Init` method. Component objects being reinitialized with the `ReInit` method should not call `Terminate` prior to calling `ReInit`. | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized</p> | | :--------------- | :---------------------------------------------------------------------------------------- | --- ### AMFComponent::SubmitInput() `AMF_RESULT AMF_STD_CALL SubmitInput(AMFData* pData);` Submit a new input sample to the `AMFComponent` object. Depending on the component and how it has been initialized, multiple input samples might be required to produce any output samples. For example, decoders for codecs that perform frame reordering may require several samples to be submitted before decoding of the first frame can be performed. In this case the client code should continuously call `SubmitInput` until the minimum number of input samples required has been submitted. Many components queue input samples and the input queue may have a limited depth. When the input queue is full, `SubmitInput` would return `AMF_INPUT_FULL`. When this condition occurs, further submission of input samples should be suspended until at least one output sample has been retrieved using the `QueryOutput` method. However, when the depth of the input queue of a component is known, for performance reasons it is best to avoid calling `SubmitInput` until it fails with `AMF_INPUT_FULL` and track the number of submitted input samples. Input samples are tracked after being submitted to the component with `SubmitInput` using the [`AMFBufferObserver`](#2322-amfbufferobserver) or [`AMFSurfaceObserver`](#2332-amfsurfaceobserver) interfaces, depending on the type of input sample. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | pData [in] | Input sample | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NEED_MORE_INPUT when` B-frames are used then the encoder may need several inputs before it can produce first output</p><p>`AMF_INPUT_FULL when` the output is not properly drained` </p><p>The rest of the possible returns are various errors.</p> | --- ### AMFComponent::QueryOutput() `AMF_RESULT AMF_STD_CALL QueryOutput(AMFData** ppData);` Retrieve a sample from the output queue. After an input sample has been submitted to an `AMFComponent` object, output samples are placed into the output queue where they can be retrieved from using the `QueryOutput` method. When an output sample becomes available, `QueryOutput` returns `AMF_OK` and places a pointer to the output sample into a location pointed to by the `ppData` parameter, removing the sample from the output queue. If an output sample is not available yet, `QueryOutput` will return `AMF_REPEAT`, indicating that the call needs to be retried after some period of time (note that some components might return `AMF_OK`, but `ppData` would receive a `nullptr` when the data is not available yet). When draining has been initiated (see `AMFComponent::Drain` for more detail) and the last output sample has been retrieved, `QueryOutput` returns `AMF_EOF`. This indicates the end of the drain operation, after which input samples can continue to be submitted. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ppData [out] | A pointer to a location to receive a pointer to the output sample | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when `ppData` is `nullptr`</p><p>`AMF_REPEAT` when the output queue is empty</p><p>`AMF_EOF` when the last sample has been collected after draining the output queue</p> | --- ### AMFComponent::Drain() `AMF_RESULT AMF_STD_CALL Drain();` Drain all submitted input samples. Draining is used to clear the output queue witout loosing any samples that have already been produced by the `AMFComponent` object. Draining forces the object to produce output even when the object would normally require more input before output is produced. `Drain` is typically called at the end of the stream. Client code should stop submitting new input samples to the component after `Drain` has been called and until all available output samples have been retrieved, which is indicated by the `AMF_EOF` being returned by `QueryOutput`. | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized</p> | | :--------------- | :---------------------------------------------------------------------------------------- | --- ### AMFComponent::Flush() `AMF_RESULT AMF_STD_CALL Flush();` Flush the `AMFComponent` object, discarding any samples already submitted or processed. Unlike `Drain`, `Flush` clears the input and the output queues immediately. `Flush` is typically called when the stream is interrupted by the seek operation or resolution change. | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized</p> | | :--------------- | :---------------------------------------------------------------------------------------- | --- ### AMFComponent::GetContext() `AMFContext* AMF_STD_CALL GetContext();` Obtain a pointer to the [`AMFContext`](#241-amfcontext) object the `AMFComponent` object is associated with. `GetContext` does not increment the reference count on the [`AMFContext`](#241-amfcontext) object it returns. | **Return Value** | A pointer to the `AMFContext` object associated with the object | | :--------------- | :-------------------------------------------------------------- | --- ### AMFComponent::SetOutputDataAllocatorCB() `AMF_RESULT AMF_STD_CALL SetOutputDataAllocatorCB(AMFDataAllocatorCB* callback);` Register a callback to provide a custom allocator for output `AMFData` objects (buffers or surfaces). Setting the callback to `nullptr` unregisters the callback. | Parameter | Description | | :--------------- | :---------------------------------------------------------------------------------------------------------------- | | callback [in] | A pointer to a custom allocator object implementing the [`AMFDataAllocatorCB`](#264-amfdataallocatorcb) interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized` </p> | --- ### AMFComponent::GetCaps `AMF_RESULT AMF_STD_CALL GetCaps(AMFCaps** ppCaps);` Get [`AMFComponent`](#261-amfcomponent) object capabilities. The `AMFCaps` interface is an optional interface allowing the application to query component’s capabilities. | Parameter | Description | | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ppCaps [out] | A pointer to a custom allocator object implementing the [`AMFCaps`](#262-amfcaps) interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized</p><p>`AMF_NOT_SUPPORTED` when the object does not implement the `AMFCaps` interface </p> | --- ### 2.6.2 AMFCaps The `AMFCaps` interface allows the application to query the component’s capabilities on the current hardware. Not all components are required to implement the `AMFCaps` interface. Always check the return code when calling `AMFComponent::GetCaps`. `AMFCaps` inherits from [`AMFPropertyStorage`](#2214-property-storage). Include `public/include/components/ComponentCaps.h` --- ### AMFCaps::GetAccelerationType `AMF_ACCELERATION_TYPE AMF_STD_CALL GetAccelerationType() const;` Determine the level of hardware acceleration of the [`AMFComponent`](#261-amfcomponent) object on the current hardware. Acceleration types are defined using the `AMF_ACCELERATION_TYPE` enumeration: | Value | Description | | :---------------------- | :---------------------------------------------------------------------------- | | AMF_ACCEL_NOT_SUPPORTED | The component is not supported on the current hardware | | AMF_ACCEL_HARDWARE | Full hardware acceleration is supported using a fixed function hardware block | | AMF_ACCEL_GPU | Hardware acceleration is supported using programmable hardware (shaders) | | AMF_ACCEL_CPU | Functionality is supported, but not hardware-accelerated | | **Return Value** | Acceleration type | --- ### AMFCaps::GetInputCaps ### AMFCaps::GetOutputCaps `AMF_RESULT AMF_STD_CALL GetInputCaps(AMFIOCaps** ppCaps);` `AMF_RESULT AMF_STD_CALL GetOutputCaps(AMFIOCaps** ppCaps);` Get input and output capabilities of a component. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ppCaps [out] | A pointer to a location to receive a pointer to the `AMFIOCaps` interface | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized</p><p>`AMF_INVALID_ARG` when memory type or size are invalid or `ppBuffer` is `nullptr`</p> | --- ### 2.6.3 AMFIOCaps The `AMFIOCaps` interface provides methods to query capabilities of a component’s input and output. `AMFIOCaps` inherits from [`AMFInterface`](#223-amffactory). Include `public/include/components/ComponentCaps.h` --- ### AMFIOCaps::GetWidthRange ### AMFIOCaps::GetHeightRange `void AMF_STD_CALL GetWidthRange(amf_int32* minValue, amf_int32* maxValue) const;` `void AMF_STD_CALL GetHeightRange(amf_int32* minValue, amf_int32* maxValue) const;` Query the range of supported resolutions. | Parameter | Description | | :--------------- | :----------------------------------------------------------------------------------------- | | minValue [out] | A pointer to a location to receive the minimum value of the range of supported resolutions | | maxValue [out] | A pointer to a location to receive the maximum value of the range of supported resolutions | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized</p> | --- ### AMFIOCaps::GetVertAlign `amf_int32 AMF_STD_CALL GetVertAlign() const` Get vertical alignment of the image. | **Return Value** | Vertical alignment in scanlines | | :--------------- | :------------------------------ | --- ### AMFIOCaps::GetNumOfFormats `amf_int32 AMF_STD_CALL GetNumOfFormats() const;` Get the total number of pixel formats. | **Return Value** | Total number of supported formats | | :--------------- | :-------------------------------- | --- ### AMFIOCaps::GetFormatAt `AMF_RESULT AMF_STD_CALL GetFormatAt(amf_int32 index, AMF_SURFACE_FORMAT* format, amf_bool* native) const;` Query the level of support of each pixel format. The `GetNumOfFormats` method returns the total number of pixel formats supported on either input or output. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | | Index [in] | A zero-based index of the format in the list of supported formats | | format [out] | A pointer to a location to receive the format | | native [out] | A pointer to a location to receive the value indicating whether color space conversion is required for a specific format | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized</p><p>`AMF_INVALID_ARG` when `format` or `native` are `nullptr`.</p> | --- ### AMFIOCaps::GetNumOfMemoryTypes `amf_int32 AMF_STD_CALL GetNumOfMemoryTypes() const;` Get the total number of supported memory types. | **Return Value** | Total number of supported memory types | | :--------------- | :------------------------------------- | --- ### AMFIOCaps::GetMemoryTypeAt `AMF_RESULT AMF_STD_CALL GetMemoryTypeAt(amf_int32 index, AMF_MEMORY_TYPE* memType, amf_bool* native) const;` Query the level of support of each memory type. The `GetNumOfMemoryTypes` method returns the total number of memory types supported on either input or output. | Parameter | Description | | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | | Index [in] | A zero-based index of the format in the list of supported formats | | memType [out] | A pointer to a location to receive the memory type | | native [out] | A pointer to a location to receive the value indicating whether color space conversion is required for a specific format | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized</p><p>`AMF_INVALID_ARG` when `format` or `native` are `nullptr`.</p> | --- ### AMFIOCaps::IsInterlacedSupported `amf_bool AMF_STD_CALL IsInterlacedSupported() const;` Check whether interlaced input or output is supported. | **Return Value** | `true` when interlaced content is supported, `false` otherwise | | :--------------- | :------------------------------------------------------------- | --- ### 2.6.4 AMFDataAllocatorCB The `AMFDataAllocatorCB` interface is used to facilitate interaction between an [`AMFComponent`](#261-amfcomponent) object and a custom memory allocator. `AMFDataAllocatorCB` inherits from `AMFInterface`. Include `public/include/components/Component.h` --- ### AMFDataAllocatorCB::AllocBuffer `AMF_RESULT AMF_STD_CALL AllocBuffer(AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer);` This method is called when the [`AMFComponent`](#261-amfcomponent) object requests allocation of an [`AMFBuffer`](#2321-amfbuffer) object. | Parameter | Description | | :--------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type [in] | Memory type | | size [in] | Buffer size in bytes | | ppBuffer [out] | A pointer to a location to receive a pointer to the newly allocated buffer | | **Return Value** | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized</p><p>`AMF_INVALID_ARG` when memory type or size are invalid or `ppBuffer` is `nullptr`</p> | --- ### AMFDataAllocatorCB::AllocSurface `AMF_RESULT AMF_STD_CALL AllocSurface(AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, AMFSurface** ppSurface);` This method is called when the [`AMFComponent`](#261-amfcomponent) object requests allocation of an [`AMFSurface`](#2331-amfsurface) object. | Parameter | Description | | :--------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type [in] | Memory type | | format [in] | Pixel format | | width [in] | Surface width in pixels | | height [in] | Surface height in scan lines | | hPitch [in] | Horizontal pitch in bytes | | vPitch [in] | Vertical pitch is scanlines | | ppSurface [out] | A pointer to the location to receive a pointer to the [`AMFSurface`](#2331-amfsurface) interface | | | <p>`AMF_OK` on success</p><p>`AMF_NO_DEVICE` when the context hasn’t been initialized </p><p>`AMF_INVALID_ARG` when memory type, format or surface sizes are invalid</p> | --- ## 3 Using AMF API A typical application workflow includes the following steps: 1. Initialize AMF runtime, obtain a pointer to the [`AMFFactory`](#223-amffactory) interface. 2. Create a native DirectX, OpenGL or OpenCL device using the appropriate DirectX, OpenGL or OpenCL API 3. Create an AMF context from the native device using the `AMFFactory::CreateContext` method. 4. Create the necessary AMF components using the `AMFFactory::CreateComponent` method and build an application-specific pipeline. 5. Initialize every component by calling the [`AMFComponent`](#261-amfcomponent)`::Init` method on each of the component object. 6. The pipeline receives samples from an external source (such as, for instance, a Webcam or a source file) and submits samples to the first component using the `AMFComponent::SubmitInput` method. 7. The pipeline retrieves output samples from the first component using the `AMFComponent::QueryOutput` method and submits them to the next component in the pipeline by passing them as a parameter to the `AMFComponent::SubmitInput` method of the next component object in the pipeline. This process is repeated for each component in the pipeline. Currently the AMF runtime includes the following components: 1. Video Decoder supporting all codecs supported by the underlying hardware 2. Video Encoder supporting the h.264 AVC, h.265 HEVC, AV1 and SVC codec 3. Video Converter performing color space conversions 4. PreAnalysis calculating content activity metrics and video property flags 5. PreProcessing filtering input video to achieve better coding efficiency Please refer to the appropriate documentation for the information on specific components. 07070100000002000081A400000000000000000000000163CFF5E700003379000000000000000000000000000000000000002E00000000AMF-1.4.29/amf/doc/AMF_Display_Capture_API.md#### Advanced Micro Devices # Advanced Media Framework – Display Capture #### Programming Guide --- ### Disclaimer The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale. AMD, the AMD Arrow logo, ATI Radeon™, CrossFireX™, LiquidVR™, TrueAudio™ and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. Windows™, Visual Studio and DirectX are trademark of Microsoft Corp. --- ### Copyright Notice © 2022 Advanced Micro Devices, Inc. All rights reserved Notice Regarding Standards. AMD does not provide a license or sublicense to any Intellectual Property Rights relating to any standards, including but not limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 (collectively, the “Media Technologies”). For clarity, you will pay any royalties due for such third party technologies, which may include the Media Technologies that are owed as a result of AMD providing the Software to you. ### MIT license Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- ### Contents 1. [Introduction](#1-introduction) 2. [Display Capture Programming Model](#2-display-capture-programming-model) - [2.1 Creating the Display Capture Component](#21-creating-the-display-capture-component) - [2.2 Initializing the Display Capture Component](#22-initializing-the-display-capture-component) - [2.3 Querying for Output](#23-querying-for-output) - [2.4 Shutting Down Display Capture](#24-shutting-down-display-capture) - [2.5 Capture modes](#25-capture-modes) ## 1 Introduction The AMD Advanced Media Framework (AMF) includes functionality for display capture to facilitate various streaming solutions in remote display, network game streaming and other applications. The display capture function is designed to work in conjunction with other AMF components, such as H.264, H.265 and AV1 encoders and color space converter. AMF currently offers two components to perform display capture. One legacy component is using the Microsoft DXGI Desktop Duplication API (DD), while the new component utilizes an AMD’s proprietary API to perform screen capture. The new display capture API is not available in legacy drivers, however it provides a more efficient way to perform display capture with lower latency and lower impact on the CPU and GPU performance. It is therefore recommended to use the new API for solutions where compatibility with legacy drivers is not required. Functionally both methods are equivalent and implement the same API. The legacy DD component is available in the source code form as a sample. Note: The Display Capture API requires root or super user privileges when running on Linux systems. --- ## 2 Display Capture Programming Model AMF provides a standard component implementing the `AMFComponent` interface to perform display capture. For more information about the `AMFComponent` interface please refer to Section 2.6.1 of the AMF API Reference. The Display Capture component is a source and does not take any input. ### 2.1 Creating the Display Capture Component To create an instance of the Display Capture component, call the `AMFFactory::CreateComponent()` method passing `AMFDisplayCapture` as parameter. Include the `public/include/components/DisplayCapture.h` header. The open source legacy Display Capture component based on the Microsoft DXGI Desktop Duplication API is included in the AMF samples in form of source code. It can be created by calling the `AMFCreateComponentDisplayCapture` function defined in `public/src/components/DisplayCapture/DisplayCaptureImpl.cpp`. Refer to the public DVR sample for details. ### 2.2 Initializing the Display Capture Component The Display Capture component is initialized by calling the `AMFComponent::Init` method. Prior to calling `AMFComponent::Init` a number of properties must be set on the component object using the `AMFPropertyStorage::SetProperty` method: | Name | Type | | :------------------------------- | :-------- | | AMF_DISPLAYCAPTURE_MONITOR_INDEX | amf_int64 | | AMF_DISPLAYCAPTURE_FRAMERATE | AMFRate | <p align="center"> Table 1. Properties of the SetProperty method </p> --- **Name:** `AMF_DISPLAYCAPTURE_MONITOR_INDEX` **Values:** `IDXGIFactory::EnumAdapters` for Windows, index on `libdrm` display enumeration on Linux **Default Value:** `0` **Description:** A monitor index to capture, determined by calling `IDXGIFactory::EnumAdapters`, 0 specifies the default monitor. --- **Name:** `AMF_DISPLAYCAPTURE_FRAMERATE` **Values:** Desired capture output framerate for `FRAMERATE` mode **Default Value:** `(0,1)` **Description:** Frame rate to perform the capture at. Setting the numerator to 0 causes the capture to be performed at the rate defined by either the application’s flip frequency (for full-screen applications) or by DWM (for windows applications). --- You can implement custom control of timestamps on each captured frame by providing a custom implementation of the `AMFCurrentTime` interface defined in `public/include/core/CurrentTime.h` and assigning it to the `AMF_DISPLAYCAPTURE_CURRENT_TIME_INTERFACE` property. By default, when the `AMF_DISPLAYCAPTURE_CURRENT_TIME_INTERFACE` property is not set, timestamps are assigned the value returned by `amf_high_precision_clock()` function at the time when a frame is captured. Once the properties are set, call the `AMFComponent::Init` method. Pass `AMF_SURFACE_UNKNOWN` for `format` and zeros for `width` and `height`. Once successfully initialized, the Display Capture component can be queried for output. Upon initialization, the following properties can be read using the `AMFPropertyStorage::GetProperty` method: | Name | Type | | :---------------------------- | :---------------- | | AMF_DISPLAYCAPTURE_FORMAT | amf_int64 | | AMF_DISPLAYCAPTURE_RESOLUTION | AMFSize | | AMF_DISPLAYCAPTURE_ROTATION | AMF_ROTATION_ENUM | <p align="center"> Table 2. Properties of GetProperty method </p> --- **Name:** `AMF_DISPLAYCAPTURE_FORMAT` **Values:** `AMF_SURFACE_FORMAT` **Default Value:** `N/A` **Description:** Capture format (`AMF_SURFACE_FORMAT`). --- **Name:** `AMF_DISPLAYCAPTURE_RESOLUTION` **Values:** A valid size. **Default Value:** `N/A` or `(0,0)` **Description:** Captured image resolution; An output parameter representing actual screen/display size. --- **Name:** `AMF_DISPLAYCAPTURE_ROTATION` **Values:** `AMF_ROTATION_ENUM`: `AMF_ROTATION_NONE`, `AMF_ROTATION_90`, `AMF_ROTATION_180`, `AMF_ROTATION_270` **Default Value:** `AMF_ROTATION_NONE` **Description:** Rotation of monitor being captured, `AMF_ROTATION_NONE` by default. --- ### 2.3 Querying for Output The output of the Display Capture component can be obtained by calling the `AMFComponent::QueryOutput` method in a loop. The loop needs to run fast enough to sustain the frame rate set during initialization using the `AMF_DISPLAYCAPTURE_FRAMERATE` property. When a frame is available, `AMFComponent::QueryOutput` places a pointer to the `AMFSurface` object at the location pointed to by the `ppData` parameter. When no new frame is available yet, `ppData` is set to `NULL` and `AMFComponent::QueryOutput` returns `AMF_REPEAT`. As with any other AMF component, it is recommended to run the polling loop in a separate thread. Whenever `AMFComponent::QueryOutput` returns `AMF_REPEAT`, the polling thread should be put to sleep for at least 1 ms to avoid high CPU utilization. The `AMFSurface` object containing a captured frame that was obtained from `AMFComponent::QueryOutput` can be used as input for the next component in the pipeline. The capture contained in the returned `AMFSurface` can also be modified with the following properties: `AMF_DISPLAYCAPTURE_DUPLICATEOUTPUT`, of type `amf_bool`, false by default. If set, the frame returned in the `AMFSurface` object will be a copy the last captured output. `AMF_DISPLAYCAPTURE_ENABLE_DIRTY_RECTS`, of type `amf_bool`, false by default. If set, dirty rectangles indicating changed areas in frame since last output are attached to the returned `AMFSurface` as the property `AMF_DISPLAYCAPTURE_DIRTY_RECTS` (See Section 2.5). `AMF_DISPLAYCAPTURE_DRAW_DIRTY_RECTS`, of type `amf_bool`, false by default. If set, the captured output in the `AMFSurface` will have the dirty rectangles drawn in red. For debugging purposes only. ### 2.4 Shutting Down Display Capture To stop display capture, call `AMFComponent::Drain`. You can exit the polling loop and terminate the polling thread once `AMFComponent::QueryOutput` returns `AMF_EOF`. Call `AMFComponent::Terminate` and release the pointer to the Display Capture component. ### 2.5 Capture modes Application can select three capture modes by setting `AMF_DISPLAYCAPTURE_MODE` into one of three modes: | Name | Type | | :------------------------------------------ | :--------------------------- | | AMF_DISPLAYCAPTURE_MODE_KEEP_FRAMERATE | AMF_DISPLAYCAPTURE_MODE_ENUM | | AMF_DISPLAYCAPTURE_MODE_WAIT_FOR_PRESENT | AMF_DISPLAYCAPTURE_MODE_ENUM | | AMF_DISPLAYCAPTURE_MODE_GET_CURRENT_SURFACE | AMF_DISPLAYCAPTURE_MODE_ENUM | <p align="center"> Table 3. AMF Capture modes </p> --- **Name:** `AMF_DISPLAYCAPTURE_MODE_KEEP_FRAMERATE` **Value:** `0` **Description:** Component will keep requested framerate, repeating frame if new present didn’t happen --- **Name:** `AMF_DISPLAYCAPTURE_MODE_WAIT_FOR_PRESENT` **Value:** `1` **Description:** Component returns captured frame with presentation rate: DWM or full screen app. --- **Name:** `AMF_DISPLAYCAPTURE_MODE_GET_CURRENT_SURFACE` **Value:** `2` **Description:** Component returns current frame immediately. --- If available, the output surface will have the following properties: | Name | Type | | :-------------------------------------- | :----------- | | AMF_DISPLAYCAPTURE_FRAME_INDEX | amf_int64 | | AMF_DISPLAYCAPTURE_FRAME_FLIP_TIMESTAMP | amf_int64 | | AMF_DISPLAYCAPTURE_DIRTY_RECTS | AMFBufferPtr | <p align="center"> Table 4. Output surface properties </p> --- **Name:** `AMF_DISPLAYCAPTURE_FRAME_INDEX` **Values:** <=`0` **Default Value:** `0` **Description:** Index of present call for the current captured frame starting from beginning of capture. --- **Name:** `AMF_DISPLAYCAPTURE_FRAME_FLIP_TIMESTAMP` **Values:** <=`0` **Default Value:** `0` **Description:** Flip timestamp of the presented frame acquired by `QueryPerformanceCounter()`. --- **Name:** `AMF_DISPLAYCAPTURE_DIRTY_RECTS` **Values:** `AMFBufferPtr` **Default Value:** `N/A` **Description:** Array of `AMFRect` objects indicating changed areas on the captured surface since the last capture. The structure of `AMFRect` can be found in `public/include/core/Platform.h`. ---07070100000003000081A400000000000000000000000163CFF5E7000021FE000000000000000000000000000000000000002800000000AMF-1.4.29/amf/doc/AMF_HQ_Scaler_API.md#### Advanced Micro Devices # Advanced Media Framework – HQ Scaler #### Programming Guide --- ### Disclaimer The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale. AMD, the AMD Arrow logo, ATI Radeon™, CrossFireX™, LiquidVR™, TrueAudio™ and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. Windows™, Visual Studio and DirectX are trademark of Microsoft Corp. ### Copyright Notice © 2021-2022 Advanced Micro Devices, Inc. All rights reserved Notice Regarding Standards. AMD does not provide a license or sublicense to any Intellectual Property Rights relating to any standards, including but not limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 (collectively, the “Media Technologies”). For clarity, you will pay any royalties due for such third party technologies, which may include the Media Technologies that are owed as a result of AMD providing the Software to you. ### MIT license Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ### Contents 1. [Introduction](#1-introduction) 2. [AMF Video HQ Scaler Component](#2-amf-video-hq-scaler-component) - [2.1 Component Initialization](#21-component-initialization) - [2.2 Configuring the HQ Scaler](#22-configuring-the-hq-scaler) - [2.3 Submitting Input and Retrieving Output](#23-submitting-input-and-retrieving-output) - [2.4 Terminating the HQ Scaler Component](#24-terminating-the-hq-scaler-component) ## 1 Introduction AMF HQ Scaler is a technique for achieving high-end video upscaling results from lower resolution video inputs. This document provides a complete description of the AMD Advanced Media Framework (AMF) Video HQ Scaler Component. This component performs the following functions: - HQ Scaling - Sharpening ## 2 AMF Video HQ Scaler Component Video HQ scaler accepts input frames stored in `AMFSurface` objects wrapping DirectX 11/12 textures, Vulkan surfaces, OpenCL surfaces. The output is placed in `AMFSurface` objects wrapping DirectX 11/12 textures, OpenCL surfaces, Vulkan surfaces, depending on the component configuration. Include `public/include/components/HQScaler.h` ### 2.1 Component Initialization The AMF Video HQ Scaler component should be initialized using the following sequence: 1. Create an AMF Context and initialize it for one of the following: 1. DirectX 11 2. DirectX 12 3. Vulkan 4. OpenCL 2. Configure the HQ Scaler component by setting the necessary properties using the `AMFPropertyStorage::SetProperty` method on the HQ Scaler object. 3. Call the `VideoHQScaler::Init` method of the video HQ Scaler object. ### 2.2 Configuring the HQ Scaler The HQ scaler supports the following input and output formats: 1. BRGA 1. NV12 1. RGBA 1. R10G10B10A2 1. RGBA_F16 1. P010 The output format must be same as the input and the format conversion is not supported. The parameters of the output stream are set using the following properties: | Name (prefix "AMF_HQ_SCALER_") | Type | | :----------------------------- | :---- | |ENGINE_TYPE |AMF_MEMORY_TYPE| |OUTPUT_SIZE |AMFSize | |KEEP_ASPECT_RATIO |Bool | |FILL |Bool | |FILL_COLOR |AMFColor | |ALGORITHM |amf_int64 | |FROM_SRGB |Bool | |SHARPNESS |Float | <p align="center"> Table 1. AMF HQ Scaler properties of the output stream </p> --- **Name:** `AMF_HQ_SCALER_ENGINE_TYPE` **Values:** `DX11`, `DX12`, `Vulkan`, `OpenCL` **Default Value:** `DX11` **Description:** Specifies the memory type of output surfaces (surfaces are allocated internally by the HQ Scaler component). --- **Name:** `AMF_HQ_SCALER_OUTPUT_SIZE` **Values:** A valid size **Default Value:** `N\A` **Description:** Output image resolution specified as `AMFSize`. Scaling will be performed when this property is set. --- **Name:** `AMF_HQ_SCALER_KEEP_ASPECT_RATIO` **Values:** `true`, `false` **Default Value:** `false` **Description:** Force the scaler to keep the aspect ratio of the input image when the output size specified by the `AMF_HQ_SCALER_OUTPUT_SIZE` property has a different aspect ratio. --- **Name:** `AMF_HQ_SCALER_FILL` **Values:** `true`, `false` **Default Value:** `false` **Description:** Specifies whether the output image outside the region of interest, which does not fill the entire output surface should be filled with a solid color. The fill color is specified using the `AMF_HQ_SCALER_FILL_COLOR` property. --- **Name:** `AMF_HQ_SCALER_FILL_COLOR` **Values:** `(0,0,0)`...`(255,255,255)` **Default Value:** `(0,0,0,255)` **Description:** Fill color specified as `AMFColor` to fill the area outside the output rectangle. Applicable only when the `AMF_HQ_SCALER_FILL` property is set to `true`. --- **Name:** `AMF_HQ_SCALER_ALGORITHM` **Values:** `AMF_HQ_SCALER_ALGORITHM_ENUM`, `AMF_HQ_SCALER_ALGORITHM_BILINEAR`, `AMF_HQ_SCALER_ALGORITHM_BICUBIC`, `AMF_HQ_SCALER_ALGORITHM_POINT`, `AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_0` (based on FSR 1.0), `AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1` **Default Value:** `AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_0` **Description:** Specifies scaling method. --- **Name:** `AMF_HQ_SCALER_FROM_SRGB` **Values:** `true`, `false` **Default Value:** `true` **Description:** Convert color space from linear to SRGB. --- **Name:** `AMF_HQ_SCALER_SHARPNESS` **Values:** Float in the range of `[0.0, 2.0]` **Default Value:** `0.5` **Description:** Control VideoSR scaler sharpening. --- ### 2.3 Submitting Input and Retrieving Output Once the HQ Scaler component is successfully initialized, you may start submitting input samples to it. Input samples must be submitted as `AMFSurface` objects. At the same time poll for output by calling `AMFComponent::QueryOutput` on the HQ Scaler object. Polling for output samples can be done either from the same thread or from another thread. Suspend submission of input samples briefly when `AMFComponent::SubmitInput` returns `AMF_INPUT_FULL`. Continue to poll for output samples and process them as they become available. ### 2.4 Terminating the HQ Scaler Component To terminate the HQ Scaler component, call the `Terminate` method, or simply destroy the object. Ensure that the context used to create the HQ Scaler component still exists during termination. 07070100000004000081A400000000000000000000000163CFF5E7000043F1000000000000000000000000000000000000002E00000000AMF-1.4.29/amf/doc/AMF_Video_Converter_API.md#### Advanced Micro Devices # Advanced Media Framework – Video Converter #### Programming Guide --- ### Disclaimer The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale. AMD, the AMD Arrow logo, ATI Radeon™, CrossFireX™, LiquidVR™, TrueAudio™ and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. Windows™, Visual Studio and DirectX are trademark of Microsoft Corp. --- ### Copyright Notice © 2014-2022 Advanced Micro Devices, Inc. All rights reserved Notice Regarding Standards. AMD does not provide a license or sublicense to any Intellectual Property Rights relating to any standards, including but not limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 (collectively, the “Media Technologies”). For clarity, you will pay any royalties due for such third party technologies, which may include the Media Technologies that are owed as a result of AMD providing the Software to you. ### MIT license Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- ### Contents 1. [Introduction](#1-introduction) 2. [AMF Video Converter Component](#2-amf-video-converter-component) - [2.1 Component Initialization](#21-component-initialization) - [2.2 Configuring the Converter](#22-configuring-the-converter) - [2.3 Submitting Input and Retrieving Output](#23-submitting-input-and-retrieving-output) - [2.4 Terminating the Converter Component](#24-terminating-the-converter-component) 3. [Sample Applications](#3-sample-applications) ## 1 Introduction This document provides a complete description of the AMD Advanced Media Framework (AMF) Video Converter Component. This component performs the following functions: - Color space conversion - Color format conversion - Gamma correction - Scaling ## 2 AMF Video Converter Component The Video Converter accepts input frames stored in `AMFSurface` objects wrapping DirectX 9 surfaces, DirectX 11 textures, OpenGL or OpenCL surfaces. The output is placed in `AMFSurface` objects wrapping DirectX 9 surfaces, DirectX 11 textures, OpenGL or OpenCL surfaces, depending on the component configuration. Include `public/include/components/VideoConverter.h` ### 2.1 Component Initialization The AMF Video Converter component should be initialized using the following sequence: 1. Create an AMF Context and initialize it for one of the following: 1. DirectX 11.1 2. DirectX 9 3. OpenGL 4. OpenCL 2. Configure the Converter component by setting the necessary properties using the `AMFPropertyStorage::SetProperty` method on the converter object. 3. Call the `AMFComponent::Init` method of the converter object. ### 2.2 Configuring the Converter The `format`, `width` and `height` parameters of the `AMFComponent::Init` method describe the input stream. Parameters of the output stream are set using the following properties: | Name (prefix "AMF_VIDEO_CONVERTER_") | Type | | ------------------------------------ | :-------------- | | OUTPUT_FORMAT | amf_int64 | | MEMORY_TYPE | AMF_MEMORY_TYPE | | OUTPUT_SIZE | AMFSize | | OUTPUT_RECT | AMFRect | | KEEP_ASPECT_RATIO | amf_bool | | FILL | amf_bool | | FILL_COLOR | amf_bool | | SCALE | amf_int64 | | FORCE_OUTPUT_SURFACE_SIZE | amf_bool | | COLOR_PROFILE | amf_int64 | <p align="center"> Table 1. AMF Video Converter parameters which configure input and output </p> --- **Name:** `AMF_VIDEO_CONVERTER_OUTPUT_FORMAT` **Values:** `AMF_SURFACE_UNKNOWN`, `AMF_SURFACE_NV12`, `AMF_SURFACE_BGRA`, `AMF_SURFACE_YUV420P` (progressive only) **Default Value:** `AMF_SURFACE_UNKNOWN` **Description:** Specifies the output color format/space. --- **Name:** `AMF_VIDEO_CONVERTER_MEMORY_TYPE` **Values:** `AMF_MEMORY_DX11`, `AMF_MEMORY_DX9`, `AMF_MEMORY_UNKNOWN` (retain the same memory type as input (no interop)) **Default Value:** `AMF_MEMORY_UNKNOWN` **Description:** Specifies the memory type of output surfaces (surfaces are allocated internally by the Converter component). --- **Name:** `AMF_VIDEO_CONVERTER_OUTPUT_SIZE` **Values:** Width in pixels. default means no scaling. **Default Value:** `0,0` **Description:** Output image resolution specified as `AMFSize.` Scaling will be performed when this property is set. --- **Name:** `AMF_VIDEO_CONVERTER_OUTPUT_RECT` **Values:** Rectangle in pixels **Default Value:** `0, 0, 0, 0`, default means no rect **Description:** Specifies the target rectangle in the output surface to scale the image into as `AMFRect`. --- **Name:** `AMF_VIDEO_CONVERTER_KEEP_ASPECT_RATIO` **Values:** `true`, `false` **Default Value:** `false` **Description:** Force the scaler to keep the aspect ratio of the input image when the output size specified by the `AMF_VIDEO_CONVERTER_OUTPUT_SIZE` property has a different aspect ratio. --- **Name:** `AMF_VIDEO_CONVERTER_FILL` **Values:** `true`, `false` **Default Value:** `false` **Description:** Specifies whether the output image outside the region of interest, which does not fill the entire output surface should be filled with a solid color. The fill color is specified using the `AMF_VIDEO_CONVERTER_FILL_COLOR` property. --- **Name:** `AMF_VIDEO_CONVERTER_FILL_COLOR` **Values:** `true`, `false` **Default Value:** `false` **Description:** Fill color specified as `AMFColor` to fill the area outside the output rectangle. Applicable only when the `AMF_VIDEO_CONVERTER_FILL` property is set to `true`. --- **Name:** `AMF_VIDEO_CONVERTER_SCALE` **Values:** `AMF_VIDEO_CONVERTER_SCALE_ENUM`: `AMF_VIDEO_CONVERTER_SCALE_INVALID`, `AMF_VIDEO_CONVERTER_SCALE_BILINEAR`, `AMF_VIDEO_CONVERTER_SCALE_BICUBIC` **Default Value:** `AMF_VIDEO_CONVERTER_SCALE_BILINEAR` **Description:** Specifies scaling method. --- **Name:** `AMF_VIDEO_CONVERTER_FORCE_OUTPUT_SURFACE_SIZE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Instructs the Converter component to use the dimensions of the output surface as output size instead of the size specified by the `AMF_VIDEO_CONVERTER_OUTPUT_SIZE` property when a custom allocator is set through the `AMFComponent::SetOutputDataAllocatorCB` callback. --- **Name:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE` **Values:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM`: - `AMF_VIDEO_CONVERTER_COLOR_PROFILE_601` – for ITU-R BT.601 (SDTV), `16`...`235` color range - `AMF_VIDEO_CONVERTER_COLOR_PROFILE_709` – for ITU-R BT.709 (HDTV) , `16`...`235` color range - `AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020` – for ITU-R BT.2020 (UHDTV) , `16`...`235` color range - `AMF_VIDEO_CONVERTER_COLOR_PROFILE_JPEG` – for the full `0`...`255` color range - `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601` – for ITU-R BT.601 (SDTV), `0`...`255` full color range - `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709` – for ITU-R BT.709 (HDTV) , `0`...`255` full color range - `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020` – for ITU-R BT.2020 (UHDTV) , `0`...`255` full color range **Default Value:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN` **Description:** Sets the color profile for color space conversion. --- The `COLOR_PROFILE` parameter can fully describe a surface in SDR use case. For HDR use case the `TRANSFER_CHARACTERISTIC`, `COLOR_PRIMARIES` and `NOMINAL_RANGE` parameters describe the surface. | Name (prefix "AMF_VIDEO_CONVERTER_") | Type | | :----------------------------------- | :----------- | | INPUT_TRANSFER_CHARACTERISTIC | amf_int64 | | INPUT_COLOR_PRIMARIES | amf_int64 | | INPUT_COLOR_RANGE | amf_int64 | | INPUT_HDR_METADATA | AMFBufferPtr | | OUTPUT_TRANSFER_CHARACTERISTIC | amf_int64 | | OUTPUT_COLOR_PRIMARIES | amf_int64 | | OUTPUT_COLOR_RANGE | amf_int64 | | OUTPUT_HDR_METADATA | AMFBufferPtr | | USE_DECODER_HDR_METADATA | amf_bool | <p align="center"> Table 2. AMF Video Converter parameters which configure input and output </p> --- **Name:** `AMF_VIDEO_CONVERTER_INPUT_TRANSFER_CHARACTERISTIC` **Values:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM`: `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT709`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNSPECIFIED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_RESERVED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA22`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA28`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE170M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE240M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LINEAR`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG_SQRT`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_4`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT1361_ECG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_1`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_10`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_12`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE2084`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE428`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_ARIB_STD_B67` **Default Value:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED` **Description:** Characteristic transfer function of the input surface used to perform the mapping between linear light components (tristimulus values) and a nonlinear RGB signal. Used (alongside `COLOR_PRIMARIES` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- **Name:** `AMF_VIDEO_CONVERTER_INPUT_COLOR_PRIMARIES` **Values:** `AMF_COLOR_PRIMARIES_ENUM`: `AMF_COLOR_PRIMARIES_UNDEFINED`, `AMF_COLOR_PRIMARIES_BT709`, `AMF_COLOR_PRIMARIES_UNSPECIFIED`, `AMF_COLOR_PRIMARIES_RESERVED`, `AMF_COLOR_PRIMARIES_BT470M`, `AMF_COLOR_PRIMARIES_BT470BG`, `AMF_COLOR_PRIMARIES_SMPTE170M`, `AMF_COLOR_PRIMARIES_SMPTE240M`, `AMF_COLOR_PRIMARIES_FILM`, `AMF_COLOR_PRIMARIES_BT2020`, `AMF_COLOR_PRIMARIES_SMPTE428`, `AMF_COLOR_PRIMARIES_SMPTE431`, `AMF_COLOR_PRIMARIES_SMPTE432`, `AMF_COLOR_PRIMARIES_JEDEC_P22`, `AMF_COLOR_PRIMARIES_CCCS` **Default Value:** `AMF_COLOR_PRIMARIES_UNDEFINED` **Description:** Color space primaries for the input surface which are the maximum red, green, and blue value permitted within the color space. Used (alongside `TRANSFER_CHARACTERISTIC` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- **Name:** `AMF_VIDEO_CONVERTER_INPUT_COLOR_RANGE` **Values:** `AMF_COLOR_RANGE_ENUM`: `AMF_COLOR_RANGE_UNDEFINED`, `AMF_COLOR_RANGE_STUDIO`, `AMF_COLOR_RANGE_FULL` **Default Value:** `AMF_COLOR_RANGE_UNDEFINED` **Description:** Input color range. --- **Name:** `AMF_VIDEO_CONVERTER_INPUT_HDR_METADATA` **Values:** `AMFBuffer` **Default Value:** `NULL` **Description:** `AMFBuffer` containing `AMFHDRMetadata`. --- **Name:** `AMF_VIDEO_CONVERTER_OUTPUT_TRANSFER_CHARACTERISTIC` **Values:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM`:`AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT709`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNSPECIFIED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_RESERVED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA22`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA28`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE170M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE240M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LINEAR`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG_SQRT`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_4`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT1361_ECG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_1`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_10`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_12`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE2084`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE428`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_ARIB_STD_B67` **Default Value:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED` **Description:** Characteristic transfer function of the input surface used to perform the mapping between linear light components (tristimulus values) and a nonlinear RGB signal. Used (alongside `COLOR_PRIMARIES` and `NOMINAL_RANGE parameters`) to describe surface in HDR use case. --- **Name:** `AMF_VIDEO_CONVERTER_OUTPUT_COLOR_PRIMARIES` **Values:** `AMF_COLOR_PRIMARIES_ENUM`: `AMF_COLOR_PRIMARIES_UNDEFINED`, `AMF_COLOR_PRIMARIES_BT709`, `AMF_COLOR_PRIMARIES_UNSPECIFIED`, `AMF_COLOR_PRIMARIES_RESERVED`, `AMF_COLOR_PRIMARIES_BT470M`, `AMF_COLOR_PRIMARIES_BT470BG`, `AMF_COLOR_PRIMARIES_SMPTE170M`, `AMF_COLOR_PRIMARIES_SMPTE240M`, `AMF_COLOR_PRIMARIES_FILM`, `AMF_COLOR_PRIMARIES_BT2020`, `AMF_COLOR_PRIMARIES_SMPTE428`, `AMF_COLOR_PRIMARIES_SMPTE431`, `AMF_COLOR_PRIMARIES_SMPTE432`, `AMF_COLOR_PRIMARIES_JEDEC_P22`, `AMF_COLOR_PRIMARIES_CCCS` **Default Value:** `AMF_COLOR_PRIMARIES_UNDEFINED` **Description:** Color space primaries for the input surface which are the maximum red, green, and blue value permitted within the color space. Used (alongside `TRANSFER_CHARACTERISTIC` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- **Name:** `AMF_VIDEO_CONVERTER_OUTPUT_COLOR_RANGE` **Values:** `AMF_COLOR_RANGE_ENUM`: `AMF_COLOR_RANGE_UNDEFINED`, `AMF_COLOR_RANGE_STUDIO`, `AMF_COLOR_RANGE_FULL` **Default Value:** `AMF_COLOR_RANGE_UNDEFINED` **Description:** Output color range. --- **Name:** `AMF_VIDEO_CONVERTER_OUTPUT_HDR_METADATA` **Values:** `AMFBuffer` **Default Value:** `NULL` **Description:** `AMFBuffer` containing `AMFHDRMetadata`. --- **Name:** `AMF_VIDEO_CONVERTER_USE_DECODER_HDR_METADATA` **Values:** `true`, `false` **Default Value:** `true` **Description:** Enables use of decoder / surface input color properties above. --- ### 2.3 Submitting Input and Retrieving Output Once the Converter component is successfully initialized, you may start submitting input samples to it. Input samples must be submitted as `AMFBuffer` objects. At the same time poll for output by calling `AMFComponent::QueryOutput` on the Converter object. Polling for output samples can be done either from the same thread or from another thread. Suspend submission of input samples briefly when `AMFComponent::SubmitInput` returns `AMF_INPUT_FULL`. Continue to poll for output samples and process them as they become available. ### 2.4 Terminating the Converter Component To terminate the Converter component, call the `Terminate` method, or simply destroy the object. Ensure that the context used to create the Converter component still exists during termination. ## 3 Sample Applications A sample application demonstrating the use of the Converter component in AMF is available as part of the AMF SDK in `public/samples/CPPSample/SimpleConverter`. The sample fills `100` frames in a `1920x1080` BGRA surface with an alternating color, submits it as input to the Converter object configured to scale it down to `1280x720` NV12 surface and writes the output to a file. To run the sample, execute the `SimpleConverter.exe` command at the command prompt. 07070100000005000081A400000000000000000000000163CFF5E700003351000000000000000000000000000000000000002B00000000AMF-1.4.29/amf/doc/AMF_Video_Decode_API.md#### Advanced Micro Devices # Advanced Media Framework – Video Decoder #### Programming Guide --- ### Disclaimer The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale. AMD, the AMD Arrow logo, ATI Radeon™, CrossFireX™, LiquidVR™, TrueAudio™ and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. Windows™, Visual Studio and DirectX are trademark of Microsoft Corp. --- ### Copyright Notice © 2014-2022 Advanced Micro Devices, Inc. All rights reserved Notice Regarding Standards. AMD does not provide a license or sublicense to any Intellectual Property Rights relating to any standards, including but not limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 (collectively, the “Media Technologies”). For clarity, you will pay any royalties due for such third party technologies, which may include the Media Technologies that are owed as a result of AMD providing the Software to you. ### MIT license Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- ### Contents 1. [Introduction](#1-introduction) 2. [AMF Video Decoder Component](#2-amf-video-decoder-component) - [2.1 Component Initialization](#21-component-initialization) - [2.2 Configuring the Decoder](#22-configuring-the-decoder) - [2.3 Submitting Input and Retrieving Output](#23-submitting-input-and-retrieving-output) - [2.4 Terminating the Decoder Component](#24-terminating-the-decoder-component) 3. [Sample Applications](#3-sample-applications) ## 1 Introduction This document provides a complete description of the AMD Advanced Media Framework (AMF) Video Decoder Component. This component exposes the AMD Video Decoder, which provides hardware accelerated video decoding functionality for the following codecs: - MPEG2 - MPEG4 - WMV3 - VC1 - H.264 (including SVC and MVC) - Motion JPEG - H.265 (HEVC) - VP9 - AV1 ## 2 AMF Video Decoder Component Video Decoder accepts elementary streams of the above codecs as input and produces output in a sequence of DirectX 9 surfaces, DirectX 11.1 textures, Vulkan surfaces or textures, or DirectX 12 surfaces or textures. The AMF Video Decoder component does not deal with multimedia container formats or demultiplexing of video, audio and other streams. The application using AMF Video Decoder must deal with these tasks on its own. Include `public/include/components/VideoDecoderUVD.h`. ### 2.1 Component Initialization The AMF Video Decoder Component should be initialized using the following sequence: 1. Create an AMF Context and initialize it for one of the following: 1. DirectX 12 2. DirectX 11.1 3. DirectX 9 4. Vulkan 5. OpenGL 6. OpenCL 2. Determine the codec and create an instance of the AMF Video Decoder object using the `AMFFactory::CreateComponent` method passing the above `AMFContext` interface as parameter. Use the following component IDs depending on the codec selected: | Component ID | Description | | :---------------------------- | :------------------------------------------------------------ | | AMFVideoDecoderUVD_MPEG2 | MPEG-2 | | AMFVideoDecoderUVD_MPEG4 | MPEG-4 including MPEG-4 part 2 | | AMFVideoDecoderUVD_WMV3 | WMV3 | | AMFVideoDecoderUVD_VC1 | VC1 | | AMFVideoDecoderUVD_H264_AVC | h.264 AVC | | AMFVideoDecoderUVD_H264_MVC | h.264 MVC (multi-stream) | | AMFVideoDecoderUVD_H264_SVC | h.264 SVC (scalable video codec) | | AMFVideoDecoderUVD_MJPEG | Motion JPEG | | AMFVideoDecoderHW_H265_HEVC | h.265/HEVC (8-bit 4:2:0 sampling) | | AMFVideoDecoderHW_H265_MAIN10 | h.265/HEVC with Main 10 profile (8- or 10-bit 4:2:0 sampling) | | AMFVideoDecoderHW_VP9 | VP9 – (8-bit 4:2:0 sampling) | | AMFVideoDecoderHW_VP9_10BIT | VP9 – (10-bit 4:2:0 sampling) | | AMFVideoDecoderHW_AV1 | AV1 | <p align="center"> Table 1. AMF components IDs depending on codec selection </p> 3. Configure the decoder component by setting the necessary properties using the `AMFPropertyStorage::SetProperty` method on the decoder object. 4. Call the `AMFComponent::Init` method of the decoder object. The `format` parameter must be set to `AMF_SURFACE_NV12` for all codecs. The Motion JPEG codec supports the `AMF_SURFACE_YUY2` format in addition to `AMF_SURFACE_NV12`. ### 2.2 Configuring the Decoder AMF Decoder can be configured using the following properties that need to be set before initialization: | Name | Type | | :------------------------------------------- | :----------- | | AMF_VIDEO_DECODER_SURFACE_COPY | amf_bool | | AMF_VIDEO_DECODER_EXTRADATA | AMFBufferPtr | | AMF_VIDEO_DECODER_FRAME_RATE | amf_double | | AMF_TIMESTAMP_MODE | amf_int64 | | AMF_VIDEO_DECODER_ADAPTIVE_RESOLUTION_CHANGE | amf_bool | | AMF_VIDEO_DECODER_REORDER_MODE | amf_int64 | | AMF_VIDEO_DECODER_DPB_SIZE | amf_int64 | <p align="center"> Table 2. AMF Video Converter parameters which configure input and output </p> --- **Name:** `AMF_VIDEO_DECODER_SURFACE_COPY` **Values:** `true`, `false` **Default Value:** `false` **Description:** Output samples are copied to newly allocated `AMFSurface` objects. This reduces decoder performance, but avoids the `AMF_DECODER_NO_FREE_SURFACES` error. Enable when the rest of the pipeline is significantly slower than the rate of submission of input samples. --- **Name:** `AMF_VIDEO_DECODER_EXTRADATA` **Values:** `AMFBufferPtr` **Default Value:** `NULL` **Description:** Set SPS/PPS on the output stream. The property contains a pointer to an `AMFBuffer` object containing the data. --- **Name:** `AMF_VIDEO_DECODER_FRAME_RATE` **Values:** `0` to `DBL_MAX ` **Default Value:** `0.0` **Description:** The frame rate in FPS. --- **Name:** `AMF_TIMESTAMP_MODE` **Values:** `AMF_TIMESTAMP_MODE_ENUM`: `AMF_TS_PRESENTATION`, `AMF_TS_SORT`, `AMF_TS_DECODE` **Default Value:** `AMF_TS_PRESENTATION` **Description:** - `AMF_TS_PRESENTATION` – timestamps are generated based on the set frame rate (default). Use of this mode is necessary when decoding elementary streams with no timestamps on input frames. This is the most reliable option. - `AMF_TS_SORT` – timestamps are transferred from input samples to output samples and then sorted to ensure that timestamps on output frames appear in ascending order. - `AMF_TS_DECODE` – timestamps are transferred from input samples to output samples. No sorting is performed. --- **Name:** `AMF_VIDEO_DECODER_ADAPTIVE_RESOLUTION_CHANGE` **Values:** `true`, `false` **Default Value:** `false` **Description:** When set to `false` (default) output surfaces will be reallocated on re-initialization when input resolution changes. When set to `true`, output surfaces will be reused if the new resolution is lower. --- **Name:** `AMF_VIDEO_DECODER_REORDER_MODE` **Values:** `AMF_VIDEO_DECODER_MODE_ENUM`: `AMF_VIDEO_DECODER_MODE_REGULAR`, `AMF_VIDEO_DECODER_MODE_COMPLIANT`, `AMF_VIDEO_DECODER_MODE_LOW_LATENCY` **Default Value:** `AMF_VIDEO_DECODER_MODE_REGULAR` **Description:** Determines frame reordering policy, which defines the decoder latency, i.e. the number of frames to be submitted before output becomes available: - `AMF_VIDEO_DECODER_MODE_REGULAR` – number of reference frames+1. - `AMF_VIDEO_DECODER_MODE_COMPLIANT` – based on the profile, up to `16` frames. - `AMF_VIDEO_DECODER_MODE_LOW_LATENCY` – low latency mode, output becomes available immediately. The decoder expects a stream with no frame reordering. B- and P-frames are allowed as long as they do not cause frame reordering. --- **Name:** `AMF_VIDEO_DECODER_DPB_SIZE` **Values:** `0` ... `32` **Default Value:** `1` **Description:** The minimum required number of surfaces for frame reordering. --- The following read-only properties can be read to obtain information about the current stream, as well as decoder capabilities: | Name | Type | | :----------------------------------- | :-------- | | AMF_VIDEO_DECODER_ALLOC_SIZE | AMFSize | | AMF_VIDEO_DECODER_CURRENT_SIZE | AMFSize | | AMF_VIDEO_DECODER_CAP_NUM_OF_STREAMS | amf_int64 | <p align="center"> Table 2. AMF Video Converter read-only properties </p> --- **Name:** `AMF_VIDEO_DECODER_ALLOC_SIZE` **Values:** `(0, 0)` ... `(2147483647, 2147483647)` **Default Value:** `(1920,1088)` **Description:** Allocated output surface size. --- **Name:** `AMF_VIDEO_DECODER_CURRENT_SIZE` **Values:** `(0, 0)` ... `(2147483647, 2147483647)` **Default Value:** `(0,0)` **Description:** Current resolution. --- **Name:** `AMF_VIDEO_DECODER_CAP_NUM_OF_STREAMS` **Values:** `MAX_STREAM_NUMBER` **Default Value:** `16` **Description:** Retrieved through the `AMFCaps` interface, the maximum number of streams the decoder can support simultaneously. This property is deprecated. --- ### 2.3 Submitting Input and Retrieving Output Once the Decoder component is successfully initialized, you may start submitting input samples to it. Input samples must be submitted as `AMFBuffer` objects. At the same time poll for output by calling `AMFComponent::QueryOutput` on the Decoder object. Polling for output samples can be done either from the same thread or from another thread. Suspend submission of input samples when `AMFComponent::SubmitInput` returns `AMF_INPUT_FULL` or `AMF_DECODER_NO_FREE_SURFACES`. Continue to poll for output samples and process them as they become available. ### 2.4 Terminating the Decoder Component To terminate the Decoder component, call the `Terminate` method, or simply destroy the object. Ensure that the context used to create the Decoder component still exists during termination. ## 3 Sample Applications A sample application demonstrating the use of the Decoder component in AMF is available as part of the AMF SDK in `public/samples/CPPSample/SimpleDecoder`. The sample takes a file with an h.264, an h.265 or an .ivf elementary stream and decodes it to a file containing uncompressed raw frames. To run the sample, execute the `SimpleDecoder.exe <input file name>` command at the command prompt. Note that the output file can be large, ensure there’s sufficient disk space available. 07070100000006000081A400000000000000000000000163CFF5E70000FE95000000000000000000000000000000000000002B00000000AMF-1.4.29/amf/doc/AMF_Video_Encode_API.md#### Advanced Micro Devices # Advanced Media Framework – h.264 Video Encoder #### Programming Guide --- ### Disclaimer The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale. AMD, the AMD Arrow logo, ATI Radeon™, CrossFireX™, LiquidVR™, TrueAudio™ and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. Windows™, Visual Studio and DirectX are trademark of Microsoft Corp. --- ### Copyright Notice © 2022 Advanced Micro Devices, Inc. All rights reserved Notice Regarding Standards. AMD does not provide a license or sublicense to any Intellectual Property Rights relating to any standards, including but not limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 (collectively, the “Media Technologies”). For clarity, you will pay any royalties due for such third party technologies, which may include the Media Technologies that are owed as a result of AMD providing the Software to you. ### MIT license Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- ### Contents 1. [Introduction](#1-introduction) - [1.1 Scope](#11-scope) - [1.2 Pre-defined Encoder Usages](#12-pre-defined-encoder-usages) 2. [AMF Video Encoder VCE-AVC Component](#2-amf-video-encoder-vce-avc-component) - [2.1 Input Submission and Output Retrieval](#21-input-submission-and-output-retrieval) - [2.2 Encode Parameters](#22-encode-parameters) - [2.2.1 Static Properties](#221-static-properties) - [2.2.2 Dynamic Properties](#222-dynamic-properties) - [2.2.3 Frame Per-Submission Properties](#223-frame-per-submission-properties) - [2.2.4 SVC Properties](#224-svc-properties) - [2.2.5 ROI Feature](#225-roi-feature) - [2.2.6 Encoder Statistics Feedback](#226-encoder-statistics-feedback) - [2.2.7 Picture Transfer Mode](#227-picture-transfer-mode) - [2.2.8 LTR Properties](#228-ltr-properties) 3. [Sample Applications](#3-sample-applications) - [3.1 List of Parameters](#31-list-of-parameters) - [3.2 Command line example](#32-command-line-example) - [3.2.1 Transcoding application (TranscodingHW.exe)](#321-transcoding-application-transcodinghwexe) - [3.2.2 D3D application (VCEEncoderD3D.exe)](#322d3d-application-vceencoderd3dexe) 4. [Annex A: Encoding & frame parameters description](#4-annex-a-encoding--frame-parameters-description) - [Table A-1. Encoder configuration parameters](#table-a---1-encoder-configuration-parameters) - [Table A-2. Input frame and encoded data parameters](#table-a---2-input-frame-and-encoded-data-parameters) - [Table A-3. Default values of parameters](#table-a---3-default-values-of-parameters) - [Table A-4. Encoder statistics feedback](#table-a---4-encoder-statistics-feedback) - [Table A-5. Encoder PSNR/SSIM feedback](#table-a---5-encoder-psnr-/-ssim-feedback) ## 1 Introduction ### 1.1 Scope This document provides a complete description of the AMD Advanced Media Framework (AMF) Video Encoder Component. This component exposes the AMD Video Compression Engine, which provides hardware accelerated H.264 video encoding functionality. Figure 1 provides a system overview of the AMF Video Encoder Component. <p align="center"> <img src="AMF_Video_Encode_API.png"> <p align="center"> Figure 1 — System overview of the AMF Video Encode SDK The AMF Video Encoder Component compresses RAW uncompressed video to an H.264 elementary bitstream. The component does not provide a mechanism to handle audio compression, or stream multiplexing. The component provides four different sets of pre-defined usages, which provide a convenient way for developers to configure the encoder to match the intended application use case. Advanced developers can also adjust encoding parameters to tailor the behavior to their specific application requirements. ### 1.2 Pre-defined Encoder Usages The following table provides a brief overview of the encoding usage modes that have been defined: |Usage Mode | Intended use-cases |Comments | | :---------------- | :---------------------------------- | :------------------------------------------------------------------------------------------------------------------------------- | | Transcoding | Transcoding, video editing | Favor compression efficiency and throughput over latency. | | Ultra-low latency | Video game streaming | Optimize for extremely low latency use cases (e.g. cap the number of bits per frame), to enable high-interactivity applications. | | Low Latency | Video collaboration, remote desktop | Optimize for low latency scenarios but allow occasional bitrate overshoots to preserve quality. | | Webcam | Video conferencing | Optimize for a low-latency video conferencing scenario. | | HQ | High quality mode | Optimize for best subjective video quality with possible loss of performance. | | HQLL | High quality low latency mode | Optimize for good quality with low latency. | <p align="center"> Table 1. Encoding usage modes </p> Note: User can override the default settings for these pre-defined usages in Table A-3. Default values of parameters. ## 2 AMF Video Encoder VCE-AVC Component The AMF Video Encoder VCE-AVC component provides hardware accelerated AVC/SVC encoding using AMD’s VCE. To instantiate the AMF Video Encoder component, call the `AMFFactory::CreateComponent` method passing `AMFVideoEncoderVCE_AVC` or `AMFVideoEncoderVCE_SVC` component IDs defined in the `public/include/components/VideoEncoderVCE.h` header. ## 2.1 Input Submission and Output Retrieval The AMF Video Encoder component accepts `AMFSurface` objects as input and produces `AMFBuffer` objects for output. In the Transcoding mode the encoder needs to accept at least 3 input frames before any output is produced. In low latency modes output becomes available as soon as the first submitted frame is encoded. ### 2.2 Encode Parameters Annex A provides the detailed description of encoding parameters (i.e., encoder properties) exposed by the Video Encoder VCE-AVC component for the following four usages: - Transcoding mode, - Ultra-low latency mode, - Low Latency mode, - Webcam mode, - HQ mode, and - HQLL mode. All properties are accessed using the `AMFPropertyStorage` interface of the Encoder object. #### 2.2.1 Static Properties Static properties (e.g., profile, level, usage) must be defined before the Init() function is called, and will apply until the end of the encoding session. #### 2.2.2 Dynamic Properties All dynamic properties have default values. Several properties can be changed subsequently and these changes will be flushed to encoder only before the next Submit() call. ### 2.2.3 Frame Per-Submission Properties Per submission properties are applied on a per frame basis. They can be set optionally to force a certain behavior (e.g., force frame type to IDR) by updating the properties of the `AMFSurface` object that is passed through the `AMFComponent::Submit()` call. ### 2.2.4 SVC Properties Scalable Video Coding (SVC) is enabled by setting `AMF_VIDEO_ENCODER_NUM_TEMPORAL_ENHANCMENT_LAYERS` to a value that is greater than `1`. `AMF_VIDEO_ENCODER_NUM_TEMPORAL_ENHANCMENT_LAYER` is a dynamic property and can be changed at any time during an encoding session. To ensure proper support on Radeon RX 5000 Series or newer GPUs and Ryzen 2000 U/H series or newer APUs, `AMF_VIDEO_ENCODER_MAX_NUM_TEMPORAL_LAYERS` needs to be set before initializing the encoder to a value that is not smaller than the number of temporal enhancement layers. As an example, the maximum number of temporal layers shall be set to 4 if the number of temporal enhancement layers will be changed from 3 to 4 in an encoding session. The maximum number of temporal layers supported by the encoder can be queried from the encoder capabilities before initializing the encoder. To define SVC parameters per layer, the following format must be used: `TL<Temporal_Layer_Number>.QL<Quality_Layer_Number>.<Parameter_name>` As an example with two temporal layers, to configure “Target bitrate” for the base/first temporal layer and first quality layer, the following parameter should be used: `TL0.QL0.TargetBitrate` To configure “Target bitrate” for the second temporal layer and first quality layer, the following parameter should be used: `TL1.QL0.TargetBitrate` When setting per layer parameters, the equivalent non-SVC layer parameters should not be set for the encoder otherwise the per layer configuration will be overwritten. Remark: quality layers are not supported on VCE 1.0. “QL0” must be used for quality layers. ### 2.2.5 ROI Feature Region of importance (ROI) feature provides a way to specify the relative importance of the macroblocks in the video frame. Encoder will further adjust the bits allocation among code blocks based on the importance, on top of the base rate control decisions. More important blocks will be encoded with relatively better quality. The ROI map can be attached to the input frame on a per frame basis. Currently, the ROI map can only use system memory. The ROI map includes the importance values of each macro block, ranging from 0 to 10, stored in 32bit unsinged format. Refer to SimpleROI sample application for further implementation details. ### 2.2.6 Encoder Statistics Feedback If an application sets the `AMF_VIDEO_ENCODER_STATISTICS_FEEDBACK` flag on for an input picture, the encoder will feedback to the application statistics for this specific picture. After the encoding ends, the application can retrieve by name the specific statistic(s) it is interested in. The supported encoder statistics are listed in Table A-4. This feature is supported by Radeon RX 5000 Series or newer GPUs as well as Ryzen 2000 U/H series or newer APUs. ### 2.2.7 Picture Transfer Mode If an application enables `AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE` for a specific input picture, it can dump out the reconstructed picture after encoding and/or it can inject a picture to be used as the reference picture during the encoding. It is worth noting that reference picture injection is a feature that is intended for advanced algorithm testing and exploration. It needs to be used with care since the internal DPB in the current encoding session will be overridden by the injected reference picture(s). The reader can refer to `SimpleFrameInjection` sample application for further implementation details. This feature is supported by Radeon RX 5000 Series or newer GPUs as well as Ryzen 2000 U/H series or newer APUs. #### 2.2.8 LTR Properties LTR (Long Term Reference) is to manually select a reference frame which can be far away to encode current frame. Normally, the encoder selects last frame as reference or a frame at lower layer in the SVC case. In AV1, maximum of `16` reference frames are supported according to the spec. These `16` reference frames are shared by SVC and LTR. To use LTR, you need to set these properties as Static Properties: `AMF_VIDEO_ENCODER_MAX_LTR_FRAMES`, Max number of LTR frames. `AMF_VIDEO_ENCODER_LTR_MODE` default = `AMF_VIDEO_ENCODER_LTR_MODE_RESET_UNUSED`; remove/keep unused LTRs (not specified in property `AMF_VIDEO_ENCODER_FORCE_LTR_REFERENCE_BITFIELD`) The `LTR_MODE` has two options: ```cpp enum AMF_VIDEO_ENCODER_LTR_MODE_ENUM { AMF_VIDEO_ENCODER_LTR_MODE_RESET_UNUSED = 0, AMF_VIDEO_ENCODER_LTR_MODE_KEEP_UNUSED }; ``` Reset_unused: encoder will discard all other LTR frames stored once a LTR frame is used as reference. Keep_unused: encoder will not change other LTR frames stored once any LTR frame is used as reference. When we enable auto LTR mode in PA, this mode will be automatically selected internally and `AMF_VIDEO_ENCODER_MAX_LTR_FRAMES` will be set to `4` no matter what users set. For details of “auto LTR mode”, please refer to AMF_Video_PreAnalysis_API document. There are two Frame Per-Submission Properties need be set to use LTR: `AMF_VIDEO_ENCODER_MARK_CURRENT_WITH_LTR_INDEX`, Mark current frame with LTR index. `-1` means don’t save current frame into LTR slots. `0~N` means save current frame into a LTR slot with index of `0~N`. Here N should be `<= AMF_VIDEO_ENCODER_MAX_LTR_FRAMES-1`. When we use SVC encoding, only next base frame can be stored as LTR frame (i.e. only temporal layer number = `0` frames are allowed to be saved into LTR slot.) `AMF_VIDEO_ENCODER_FORCE_LTR_REFERENCE_BITFIELD`, force LTR bit-field. This is a bit-field mask that indicate which LTR slot can be used as reference for current frame. `0b1` means only slot 0 can be used as reference. `0b10` means only slot 1 can be used as reference. `0b100` means only slot 2 can be used as reference... `0b0` means no LTR frame will be used as reference for current frame hence current frame will select short term reference frame (usually last frame) as reference. When there are multiple bits are enabled, for example: `0b1111` (`=decimal 15`), that means LTR slots 0,1,2 and 3 are all allowed to be selected as reference. In this case, the closest LTR frame to current frame will be selected. When we encode a key frame or switch frame, all save LTR slots will be cleared. Referring to a LTR frame not exiting in LTR slot will generate an Intra only frame. ## 3 Sample Applications The AMF Encoder Sample application show how to setup and use the AMF Video Encoder VCE-AVC Component to encode video frames that are loaded from disk or rendered by the DirectX 3D engine. ### 3.1 List of Parameters Sample applications support almost all visible encoder parameters (except `PictureStructure`, `EndOfSequence`, `EndOfStream`) and few additional parameters. Additional parameters of `TranscodeHW` application: | Name | Type | | :---------- | :----- | | CODEC | string | | OUTPUT | string | | INPUT | string | | WIDTH | int | | HEIGHT | int | | ADAPTERID | int | | ENGINE | string | | FRAMES | int | | THREADCOUNT | int | | PREVIEWMODE | bool | <p align="center"> Table 2. Additional miscellaneous parameters of TranscodeHW application </p> --- **Name:** `CODEC` **Values:** `AVC` or `H264`, `HEVC` or `H265`, `AV1` **Default Values:** `AVC` **Description:** Specify codec type. --- **Name:** `OUTPUT` **Values:** File name, relative or absolute path **Default Value:** `NULL` **Description:** Output HEVC file for encoded data. --- **Name:** `INPUT` **Values:** File name, relative or absolute path **Default Value:** `NULL` **Description:** Input file with frames (AVC or HEVC). --- **Name:** `WIDTH` **Values:** Frame width **Default Value:** `0` **Description:** Frame width. --- **Name:** `HEIGHT` **Values:** Frame height **Default Value:** `0` **Description:** Frame height. --- **Name:** `AdapterID` **Values:** Number **Default Value:** `0` **Description:** Index of GPU adapter. --- **Name:** `ENGINE` **Values:** `DX9`, `DX11`, `Vulkan` **Default Value:** `DX11` **Description:** Specify Engine type. --- **Name:** `FRAMES` **Values:** Number of frames to be encoded **Default Values:** `100` **Description:** Number of frames to render. --- **Name:** `THREADCOUNT` **Values:** Number **Default Values:** `1` **Description:** Number of session run ip parallel. --- **Name:** `PREVIEWMODE` **Values:** `true`, `false` **Default Values:** `false` **Description:** Preview Mode . --- Additional parameters of `VCEEncoderD3D` application: | Name | Category | | :----------------- | :------- | | CODEC | string | | OUTPUT | string | | RENDER | string | | WIDTH | int | | HEIGHT | int | | FRAMES | int | | ADAPTERID | int | | WINDOWMODE | bool | | FULLSCREEN | bool | | QueryInstanceCount | bool | | UseInstance | int | | FRAMERATE | int | <p align="center"> Table 3. Miscellaneous parameters of VCEEncoderD3D application </p> --- **Name:** `CODEC` **Values:** `AVC` or `H264`, `HEVC` or `H265`, `AV1` **Default Value:** `AVC` **Description:** Codec name --- **Name:** `OUTPUT` **Values:** File name, relative or absolute path **Default Value:** `NULL` **Description:** Output H.264 file for encoded data. --- **Name:** `RENDER` **Values:** `DX9`, `DX9Ex`, `DX11`, `OpenGL`, `OpenCL`, `Host`, `OpenCLDX9`, `OpenCLDX11`, `OpenGLDX9`, `OpenGLDX11`, `OpenCLOpenGLDX9`, `OpenCLOpenGLDX11`, `HostDX9`, `HostDX11`, `DX11DX9`, `Vulkan` **Default Value:** `DX11` **Description:** Specifies render type. --- **Name:** `WIDTH` **Values:** Frame width **Default Value:** `1280` **Description:** Frame width. --- **Name:** `HEIGHT` **Values:** Frame height **Default Value:** `720` **Description:** Frame height --- **Name:** `FRAMES` **Values:** Number of frames to be encoded **Default Value:** `100` **Description:** Number of frames to render. --- **Name:** `ADAPTERID` **Values:** Number **Default Value:** `0` **Description:** Index of GPU adapter. --- **Name:** `WINDOWMODE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Shows rendering window for D3D sample application. --- **Name:** `FULLSCREEN` **Values:** `true`, `false` **Default Value:** `false` **Description:** Full screen. --- **Name:** `QueryInstanceCount` **Values:** `true`, `false` **Default Value:** `false` **Description:** If the flag is set, the number of independent VCE instances will be quried and printed. --- **Name:** `UseInstance` **Values:** `0`... `number of instances - 1` **Default Value:** Depends on usage **Description:** If there are more than one VCE Instances, you can force which instance to use. Valid range is `[0.. (number of instances - 1)]`. --- **Name:** `FRAMERATE` **Values:** Render frame rate **Default Value:** `0` **Description:** Render frame rate. --- ### 3.2 Command line example #### 3.2.1 Transcoding application (TranscodingHW.exe) `TranscodeHW.exe -input input.h264 -output out.h265 –codec HEVC -width 1280 -height 720` This command transcodes H264 elementary stream to H.264 video. Encoder is created with “Transcoding” usage. #### 3.2.2 D3D application (VCEEncoderD3D.exe) `VCEEncoderD3D.exe -output VideoSample_1024x768.h264 -width 1024 -height 768 -frames 400` This command encodes `400` frames through D3D renderer and creates an output file with the encoded data. Encoder is created with “Transcoding” usage. Initial configuration sets bitrate to a value of 500kbits/sec. ## 4 Annex A: Encoding & frame parameters description ### Table A-1. Encoder configuration parameters | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :--------------------------------- | :-------- | | USAGE | amf_int64 | | INSTANCE_INDEX | amf_int64 | | PROFILE | amf_int64 | | PROFILE_LEVEL | amf_int64 | | MAX_LTR_FRAMES | amf_int64 | | LTR_MODE | amf_int64 | | LOWLATENCY_MODE | amf_bool | | FRAMESIZE | AMFSize | | ASPECT_RATIO | AMFRatio | | MAX_CONSECUTIVE_BPICTURES | amf_int64 | | ADAPTIVE_MINIGOP | amf_bool | | PRE_ANALYSIS_ENABLE | amf_bool | | COLOR_BIT_DEPTH | amf_int64 | | MAX_NUM_TEMPORAL_LAYERS | amf_int64 | <p align="center"> Table 4. Encoder initialization parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_USAGE` **Values:** `AMF_VIDEO_ENCODER_USAGE_ENUM`: `AMF_VIDEO_ENCODER_USAGE_TRANSCONDING`, `AMF_VIDEO_ENCODER_USAGE_TRANSCODING`, `AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY`, `AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY`, `AMF_VIDEO_ENCODER_USAGE_WEBCAM`, `AMF_VIDEO_ENCODER_USAGE_HIGH_QUALITY`, `AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY` **Default Value:** `N/A` **Description:** Selects the AMF usage (see Section 1.2). --- **Name:** `AMF_VIDEO_ENCODER_INSTANCE_INDEX` **Values:** `0`, `1` **Default Value:** `N\A` **Description:** Selects the encoder engine used for encoding. --- **Name:** `AMF_VIDEO_ENCODER_PROFILE` **Values:** `AMF_VIDEO_ENCODER_PROFILE_ENUM`: `AMF_VIDEO_ENCODER_PROFILE_BASELINE`, `AMF_VIDEO_ENCODER_PROFILE_MAIN`, `AMF_VIDEO_ENCODER_PROFILE_HIGH` **Default Value associated with usages:** - Transcoding: `AMF_VIDEO_ENCODER_PROFILE_MAIN` - Ultra low latency: `AMF_VIDEO_ENCODER_PROFILE_MAIN` - Low latency: `AMF_VIDEO_ENCODER_PROFILE_MAIN` - Webcam: `AMF_VIDEO_ENCODER_PROFILE_MAIN` - HQ: `AMF_VIDEO_ENCODER_PROFILE_HIGH` - HQLL: `AMF_VIDEO_ENCODER_PROFILE_HIGH` **Description:** Selects the H.264 profile. --- **Name:** `AMF_VIDEO_ENCODER_PROFILE_LEVEL` **Values:** `AMF_VIDEO_ENCODER_H264_LEVEL_ENUM`: `AMF_H264_LEVEL__1`,`AMF_H264_LEVEL__1_1`, `AMF_H264_LEVEL__1_2`, `AMF_H264_LEVEL__1_3`, `AMF_H264_LEVEL__2`, `AMF_H264_LEVEL__2_1`, `AMF_H264_LEVEL__2_2`, `AMF_H264_LEVEL__3`, `AMF_H264_LEVEL__3_1`, `AMF_H264_LEVEL__3_2`, `AMF_H264_LEVEL__4`, `AMF_H264_LEVEL__4_1`, `AMF_H264_LEVEL__4_2`, `AMF_H264_LEVEL__5`, `AMF_H264_LEVEL__5_1`, `AMF_H264_LEVEL__5_2`, `AMF_H264_LEVEL__6`, `AMF_H264_LEVEL__6_1`, `AMF_H264_LEVEL__6_2` **Default Value:** `AMF_H264_LEVEL__4_2` **Description:** Selects the H.264 profile level. --- **Name:** `AMF_VIDEO_ENCODER_MAX_LTR_FRAMES` **Values:** `0` … `2` **Default Value:** `0` **Description:** The number of long-term references controlled by the user. Remarks: - When == `0`, the encoder may or may not use LTRs during encoding. - When > `0`, the user has control over all LTR. - With user control of LTR, B-pictures and Intra-refresh features are not supported. - The actual maximum number of LTRs allowed depends on H.264 Annex A Table A-1 Level limits, which defines dependencies between the H.264 Level number, encoding resolution, and DPB size. The DPB size limit impacts the maximum number of LTR allowed. --- **Name:** `AMF_VIDEO_ENCODER_LTR_MODE` **Values:** `0`(reset unused) , `1` (keep unused) **Default Value:** `0` **Description:** Removes/keeps unused LTRs not specified inside the LTR reference bitfield. --- **Name:** `AMF_VIDEO_ENCODER_LOWLATENCY_MODE` **Values:** `true` (on), `false` (off) **Default Value associated with usages:** - Transcoding: `false` - Ultra low latency: `true` - Low latency: `false` - Webcam: `false` - HQ: `false` - HQLL: `true` **Description:** Enables low latency mode in the encoder and switches POC mode to `2`. --- **Name:** `AMF_VIDEO_ENCODER_FRAMESIZE` **Values:** Width: `64` – `4096` Height: `64` – `4096` **Default Value:** `(0,0)` **Description:** Frame width and height in pixels, maximum values are hardware-specific, should be queried through AMFCaps. --- **Name:** `AMF_VIDEO_ENCODER_ASPECT_RATIO` **Values:** `(1, 1)` ... `(INT_MAX, INT_MAX)` **Default Value:** `(1,1)` **Description:** Pixel aspect ratio. --- **Name:** `AMF_VIDEO_ENCODER_MAX_CONSECUTIVE_BPICTURES` **Values:** `0`...`3` **Default Value:** `0` **Description:** Maximum number of consecutive B Pictures, suggestion set to `3` if `AMF_VIDEO_ENCODER_B_PIC_PATTERN` is not `0`. --- **Name:** `AMF_VIDEO_ENCODER_ADAPTIVE_MINIGOP` **Values:** `true`, `false` **Default Value:** `false` **Description:** Disable/Enable Adaptive MiniGOP, can enable with PA enabled. --- **Name:** `AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Some encoder properties require this property been set. Enables the pre-analysis module. Refer to *AMF Video PreAnalysis API* reference for more details. --- **Name:** `AMF_VIDEO_ENCODER_COLOR_BIT_DEPTH` **Values:** `AMF_COLOR_BIT_DEPTH_ENUM`: `AMF_COLOR_BIT_DEPTH_UNDEFINED`, `AMF_COLOR_BIT_DEPTH_8`, `AMF_COLOR_BIT_DEPTH_10` **Default Value:** `8` **Description:** Sets the number of bits in each pixel’s color component in the encoder’s compressed output bitstream. --- **Name:** `AMF_VIDEO_ENCODER_MAX_NUM_TEMPORAL_LAYERS` **Values:** `1` … `Maximum number of temporal layers supported` **Default Value:** `1` **Description:** Sets the maximum number of temporal layers. It shall not be exceeded by the number of temporal enhancement layers. The maximum number of temporal layers supported is determined by the corresponding encoder capability. This property is not supported on GPUs prior to Radeon RX 5000 Series or APUs prior to Ryzen 2000 U/H series. --- | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :--------------------------------- | :-------- | | INPUT_COLOR_PROFILE | amf_int64 | | INPUT_TRANSFER_CHARACTERISTIC | amf_int64 | | INPUT_COLOR_PRIMARIES | amf_int64 | | OUTPUT_COLOR_PROFILE | amf_int64 | | OUTPUT_TRANSFER_CHARACTERISTIC | amf_int64 | | OUTPUT_COLOR_PRIMARIES | amf_int64 | <p align="center"> Table 5. Encoder color conversion parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_INPUT_COLOR_PROFILE` **Values:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM`: `AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_601`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_709`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_JPEG`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020` **Default Value:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN` **Description:** Color profile of the input surface. - SDR - Setting this parameter (COLOR_PROFILE) can fully describe a surface for SDR use case. - HDR – For HDR use case the `TRANSFER_CHARACTERISTIC`, `COLOR_PRIMARIES`, and `NOMINAL_RANGE` parameters describe the surface. --- **Name:** `AMF_VIDEO_ENCODER_INPUT_TRANSFER_CHARACTERISTIC` **Values:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM`: `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT709`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNSPECIFIED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_RESERVED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA22`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA28`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE170M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE240M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LINEAR`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG_SQRT`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_4`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT1361_ECG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_1`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_10`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_12`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE2084`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE428`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_ARIB_STD_B67` **Default Value:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED` **Description:** Characteristic transfer function of the input surface used to perform the mapping between linear light components (tristimulus values) and a nonlinear RGB signal. Used (alongside `COLOR_PRIMARIES` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- **Name:** `AMF_VIDEO_ENCODER_INPUT_COLOR_PRIMARIES` **Values:** `AMF_COLOR_PRIMARIES_ENUM`: `AMF_COLOR_PRIMARIES_UNDEFINED`, `AMF_COLOR_PRIMARIES_BT709`, `AMF_COLOR_PRIMARIES_UNSPECIFIED`, `AMF_COLOR_PRIMARIES_RESERVED`, `AMF_COLOR_PRIMARIES_BT470M`, `AMF_COLOR_PRIMARIES_BT470BG`, `AMF_COLOR_PRIMARIES_SMPTE170M`, `AMF_COLOR_PRIMARIES_SMPTE240M`, `AMF_COLOR_PRIMARIES_FILM`, `AMF_COLOR_PRIMARIES_BT2020`, `AMF_COLOR_PRIMARIES_SMPTE428`, `AMF_COLOR_PRIMARIES_SMPTE431`, `AMF_COLOR_PRIMARIES_SMPTE432`, `AMF_COLOR_PRIMARIES_JEDEC_P22`, `AMF_COLOR_PRIMARIES_CCCS` **Default Value:** `AMF_COLOR_PRIMARIES_UNDEFINED` **Description:** Color space primaries for the input surface which are the maximum red, green, and blue value permitted within the color space. Used (alongside `TRANSFER_CHARACTERISTIC` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- **Name:** `AMF_VIDEO_ENCODER_OUTPUT_COLOR_PROFILE` **Values:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM`: `AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_601`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_709`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_JPEG`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020` **Default Value:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN` **Description:** Color profile of the compressed output stream. - SDR - Setting this parameter (`COLOR_PROFILE`) can fully describe a surface for SDR use case. - HDR – For HDR use case the `TRANSFER_CHARACTERISTIC`, `COLOR_PRIMARIES`, and `NOMINAL_RANGE` parameters describe the surface. Determines the optional VUI parameter `matrix_coefficients`. --- **Name:** `AMF_VIDEO_ENCODER_OUTPUT_TRANSFER_CHARACTERISTIC` **Values:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM`: `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT709`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNSPECIFIED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_RESERVED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA22`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA28`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE170M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE240M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LINEAR`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG_SQRT`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_4`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT1361_ECG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_1`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_10`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_12`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE2084`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE428`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_ARIB_STD_B67` **Default Value:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED` **Description:** Characteristic transfer function of the compressed output stream used to perform the mapping between linear light components (tristimulus values) and a nonlinear RGB signal. Used (alongside `COLOR_PRIMARIES` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- **Name:** `AMF_VIDEO_ENCODER_OUTPUT_COLOR_PRIMARIES` **Values:** `AMF_COLOR_PRIMARIES_ENUM`: `AMF_COLOR_PRIMARIES_UNDEFINED`, `AMF_COLOR_PRIMARIES_BT709`, `AMF_COLOR_PRIMARIES_UNSPECIFIED`, `AMF_COLOR_PRIMARIES_RESERVED`, `AMF_COLOR_PRIMARIES_BT470M`, `AMF_COLOR_PRIMARIES_BT470BG`, `AMF_COLOR_PRIMARIES_SMPTE170M`, `AMF_COLOR_PRIMARIES_SMPTE240M`, `AMF_COLOR_PRIMARIES_FILM`, `AMF_COLOR_PRIMARIES_BT2020`, `AMF_COLOR_PRIMARIES_SMPTE428`, `AMF_COLOR_PRIMARIES_SMPTE431`, `AMF_COLOR_PRIMARIES_SMPTE432`, `AMF_COLOR_PRIMARIES_JEDEC_P22`, `AMF_COLOR_PRIMARIES_CCCS` **Default Value:** `AMF_COLOR_PRIMARIES_UNDEFINED` **Description:** Color space primaries for the compressed output surface which are the maximum red, green, and blue value permitted within the color space. Used (alongside `TRANSFER_CHARACTERISTIC` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :--------------------------------- | :-------- | | TARGET_BITRATE | amf_int64 | | PEAK_BITRATE | amf_int64 | | RATE_CONTROL_METHOD | amf_int64 | | RATE_CONTROL_SKIP_FRAME_ENABLE | amf_bool | | MIN_QP | amf_int64 | | MAX_QP | amf_int64 | | QP_I | amf_int64 | | QP_P | amf_int64 | | QP_B | amf_int64 | | QVBR_QUALITY_LEVEL | amf_int64 | | FRAMERATE | AMFRate | | VBV_BUFFER_SIZE | amf_int64 | | INITIAL_VBV_BUFFER_FULLNESS | amf_int64 | | ENFORCE_HRD | amf_bool | | MAX_AU_SIZE | amf_int64 | | B_PIC_DELTA_QP | amf_int64 | | REF_B_PIC_DELTA_QP | amf_int64 | | PREENCODE_ENABLE | amf_int64 | | FILLER_DATA_ENABLE | amf_bool | <p align="center"> Table 6. Encoder rate-control parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_TARGET_BITRATE` **Values:** `10 000` - `100 000 000` bit/s **Default Value:** `20` mbit/s **Description:** Sets the target bitrate. --- **Name:** `AMF_VIDEO_ENCODER_PEAK_BITRATE` **Values:** `10 000` - `100 000 000` bit/s **Default Value:** `30` mbit/s **Description:** Sets the peak bitrate. --- **Name:** `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD` **Values:** `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_ENUM`: `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_UNKNOWN`, `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CONSTANT_QP`, `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CBR`, `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR`, `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR`, `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_QUALITY_VBR`, `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_HIGH_QUALITY_VBR`, `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_HIGH_QUALITY_CBR` **Default Value associated with usages:** - Transcoding: `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PCVBR` - Ultra low latency: `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_LCVBR` - Low latency: `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PCVBR` - Webcam: `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PCVBR` - HQ: `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_QVBR`/ `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PCVBR` - HQLL: `AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CBR` **Description:** Selects the rate control method: - CQP – Constrained QP, - CBR - Constant Bitrate, - VBR - Peak Constrained VBR, - VBR_LAT - Latency Constrained VBR, - QVBR – Quality VBR - HQVBR – High Quality VBR - HQCBR – High Quality CBR Remarks: - When SVC encoding is enabled, some rate-control parameters can be configured differently for a particular SVC-layer. An SVC-layer is denoted by an index pair `[SVC-Temporal Layer index][SVC-Quality Layer index]`. E.g. The bitrate may be configured differently for SVC-layers `[0][0]` and `[1][0]`. - We restrict all SVC layers to have the same Rate Control method. Some RC parameters are not enabled with SVC encoding (e.g. all parameters related to B-pictures). - QVBR, HQVBR and HQCBR are only supported if PreAnalysis is enabled. - QVBR, HQVBR and HQCBR target improving subjective quality with the possible loss of objective quality (PSNR or VMAF). --- **Name:** `AMF_VIDEO_ENCODER_RATE_CONTROL_SKIP_FRAME_ENABLE` **Values:** `true` (`on`), `false` (`off`) **Default Value:** Depends on `USAGE` **Description:** Enables skip frame for rate control. --- **Name:** `AMF_VIDEO_ENCODER_MIN_QP` **Values:** `0` – `51` **Default Value:** `0` **Description:** Sets the minimum QP. --- **Name:** `AMF_VIDEO_ENCODER_MAX_QP` **Values:** `0` – `51` **Default Value:** `51` **Description:** Sets the maximum QP. --- **Name:** `AMF_VIDEO_ENCODER_QP_I` **Values:** `0` – `51` **Default Value:** `22` **Description:** Sets the constant QP for I-pictures. Remarks: Only available for CQP rate control method. --- **Name:** `AMF_VIDEO_ENCODER_QP_P` **Values:** `0` – `51` **Default Value:** `22` **Description:** Sets the constant QP for P-pictures. Remarks: Only available for CQP rate control method. --- **Name:** `AMF_VIDEO_ENCODER_QP_B` **Values:** `0` – `51` **Default Value:** `22` **Description:** Sets the constant QP for B-pictures. Remarks: Only available for CQP rate control method. --- **Name:** `AMF_VIDEO_ENCODER_QVBR_QUALITY_LEVEL` **Values:** `1` – `51` **Default Value:** `23` **Description:** Sets the quality level for QVBR rate control method. Remarks: Only available for QVBR rate control method. --- **Name:** `AMF_VIDEO_ENCODER_FRAMERATE` **Values:** `1*FrameRateDen` … `120* FrameRateDen` **Default Value:** `30` fps **Description:** Frame rate numerator. --- **Name:** `AMF_VIDEO_ENCODER_VBV_BUFFER_SIZE` **Values:** `1000` – `100 000 000` **Default Value associated with usages:** - Transcoding: `20` mbits - Ultra low latency: `735` kbits - Low latency: `4` mbits - Webcam: `2` mbits - HQ: `40` mbits - HQLL: `10` mbits **Description:** Sets the VBV buffer size in bits. --- **Name:** `AMF_VIDEO_ENCODER_INITIAL_VBV_BUFFER_FULLNESS` **Values:** `0` - `64` **Default Value:** `64` **Description:** Sets the initial VBV buffer fullness. --- **Name:** `AMF_VIDEO_ENCODER_ENFORCE_HRD` **Values:** `true`, `false` (`On`, `Off`) **Default Value associated with usages:** - Transcoding: `false` - Ultra low latency: `true` - Low latency: `false` - Webcam: `false` - HQ: `false` - HQLL: `false` **Description:** - Disables/enables constraints on QP variation within a picture to meet HRD requirement(s) - Enables/disables VBAQ - VBAQ stands for *Variance Based Adaptive Quantization*. - The basic idea of VBAQ: Human visual system is typically less sensitive to artifacts in highly textured area. In VBAQ mode, we use pixel variance to indicate the complexity of spatial texture. This allows us to allocate more bits to smoother areas. Enabling such feature leads to improvements in subjective visual quality with some content.Note: Cannot use when RATE_CONTROL_METHOD is CQP. --- **Name:** `AMF_VIDEO_ENCODER_MAX_AU_SIZE` **Values:** `0` - `100 000 000` bits **Default Value:** `0` **Description:** Maximum AU size in bits. --- **Name:** `AMF_VIDEO_ENCODER_B_PIC_DELTA_QP` **Values:** `-10` ... `10` **Default Value associated with usages:** - Transcoding: `4` - Ultra low latency: `0` - Low latency: `4` - Webcam: `4` - HQ: `4` - HQLL: `4` **Description:** Selects the delta QP of non-reference B pictures with respect to I pictures. This feature is not supported by VCE 1.0. `BPicturesDeltaQP`, `ReferenceBPicturesDeltaQP`, `IntraRefreshNumMBsPerSlot`, `BPicturesPattern` and `BReferenceEnable` parameters are available only when: - `MaxOfReferenceFrames` is greater than `1` - `NumOfLTR` is `0` (LTR is not used) --- **Name:** `AMF_VIDEO_ENCODER_REF_B_PIC_DELTA_QP` **Values:** `-10` ... `10` **Default Value associated with usages:** - Transcoding: `2` - Ultra low latency: `0` - Low latency: `2` - Webcam: `2` - HQ: `2` - HQLL: `2` **Description:** Selects delta QP of reference B pictures with respect to I pictures. This feature is not supported by VCE 1.0. `BPicturesDeltaQP`, `ReferenceBPicturesDeltaQP`, `IntraRefreshNumMBsPerSlot`, `BPicturesPattern` and `BReferenceEnable` parameters are available only when: - `MaxOfReferenceFrames` is greater than `1` - `NumOfLTR` is `0` (LTR is not used) --- **Name:** `AMF_VIDEO_ENCODER_PREENCODE_ENABLE` **Values:** `AMF_VIDEO_ENCODER_PREENCODE_DISABLED`, `AMF_VIDEO_ENCODER_PREENCODE_ENABLED` **Default Value associated with usages:** - Transcoding: `AMF_VIDEO_ENCODER_PREENCODE_DISABLED` - Ultra low latency: `AMF_VIDEO_ENCODER_PREENCODE_DISABLED` - Low latency: `AMF_VIDEO_ENCODER_PREENCODE_DISABLED` - Webcam: `AMF_VIDEO_ENCODER_PREENCODE_DISABLED` - HQ: `AMF_VIDEO_ENCODER_PREENCODE_ENABLED` - HQLL: `AMF_VIDEO_ENCODER_PREENCODE_DISABLED` **Description:** Enables or disables rate control pre-analysis. --- **Name:** `AMF_VIDEO_ENCODER_FILLER_DATA_ENABLE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Enables/disables filler data to maintain constant bit rate. --- | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :--------------------------------- | :-------- | | HEADER_INSERTION_SPACING | amf_int64 | | IDR_PERIOD | amf_int64 | | DE_BLOCKING_FILTER | amf_bool | | INTRA_REFRESH_NUM_MBS_PER_SLOT | amf_int64 | | SLICES_PER_FRAME | amf_int64 | | B_PIC_PATTERN | amf_bool | | B_REFERENCE_ENABLE | amf_int64 | | CABAC_ENABLE | amf_int64 | | MAX_NUM_REFRAMES | amf_int64 | | HIGH_MOTION_QUALITY_BOOST_ENABLE | amf_bool | <p align="center"> Table 7. Encoder picture-control parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEADER_INSERTION_SPACING` **Values:** `0` … `1000` **Default Value:** `0` **Description:** Sets the headers insertion spacing. --- **Name:** `AMF_VIDEO_ENCODER_IDR_PERIOD` **Values:** `0` … `1000` **Default Value associated with usages:** - Transcoding: `30` - Ultra low latency: `300` - Low latency: `300` - Webcam: `30` - HQ: `300` - HQLL: `120` **Description:** Sets IDR period. IDRPeriod = `0` turns IDR off. To get SPS/PPS for every IDR, header insertion spacing has to be the same as IDR period. --- **Name:** `AMF_VIDEO_ENCODER_DE_BLOCKING_FILTER` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `true` **Description:** Enable/disable the de-blocking filter. --- **Name:** `AMF_VIDEO_ENCODER_INTRA_REFRESH_NUM_MBS_PER_SLOT` **Values:** `0` - #MBs per frame **Default Value associated with usages:** - Transcoding: `0` - Ultra low latency: `255` - Low latency: `255` - Webcam: `0` - HQ: `0` - HQLL: `0` **Description:** Sets the number of slices per frame. `BPicturesDeltaQP`, `ReferenceBPicturesDeltaQP`, `IntraRefreshNumMBsPerSlot`, `BPicturesPattern` and `BReferenceEnable` parameters are available only when: - `MaxOfReferenceFrames` is greater than `1` - `NumOfLTR` is `0` (LTR is not used) --- **Name:** `AMF_VIDEO_ENCODER_SLICES_PER_FRAME` **Values:** `1` - #MBs per frame **Default Value:** `1` **Description:** Sets the number of slices per frame. --- **Name:** `AMF_VIDEO_ENCODER_B_PIC_PATTERN` **Values:** `0`, `1`, `2`, `3` **Default Value associated with usages:** - Transcoding: `3` - Ultra low latency: `0` - Low latency: `0` - Webcam: `0` - HQ: `3` - HQLL: `0` **Description:** Sets the number of consecutive B-pictures in a GOP. BPicturesPattern = `0` indicates that B-pictures are not used. This feature is not supported by VCE 1.0. `BPicturesDeltaQP`, `ReferenceBPicturesDeltaQP`, `IntraRefreshNumMBsPerSlot`, `BPicturesPattern` and `BReferenceEnable` parameters are available only when: - `MaxOfReferenceFrames` is greater than `1` - `NumOfLTR` is `0` (LTR is not used) --- **Name:** `AMF_VIDEO_ENCODER_B_REFERENCE_ENABLE` **Values:** `true` (`on`), `false` (`off`) **Default Value associated with usages:** - Transcoding: `true` - Ultra low latency: `false` - Low latency: `true` - Webcam: `true` - HQ: `true` - HQLL: `true` **Description:** Enables or disables using B-pictures as references. This feature is not supported by VCE 1.0. `BPicturesDeltaQP`, `ReferenceBPicturesDeltaQP`, `IntraRefreshNumMBsPerSlot`, `BPicturesPattern` and `BReferenceEnable` parameters are available only when: - `MaxOfReferenceFrames` is greater than `1` - `NumOfLTR` is `0` (LTR is not used) --- **Name:** `AMF_VIDEO_ENCODER_CABAC_ENABLE` **Values:** `AMF_VIDEO_ENCODER_CODING_ENUM`: `AMF_VIDEO_ENCODER_UNDEFINED`, `AMF_VIDEO_ENCODER_CABAC`, `AMF_VIDEO_ENCODER_CALV` **Default Value:** `AMF_VIDEO_ENCODER_UNDEFINED` **Description:** Encoder coding method, when Undefined is selected, the behavior is profile-specific: CALV for Baseline, CABAC for Main and High. --- **Name:** `AMF_VIDEO_ENCODER_MAX_NUM_REFRAMES` **Values:** `0`...`16` **Default Value:** `4` **Description:** Maximum number of reference frames. --- **Name:** `AMF_VIDEO_ENCODER_HIGH_MOTION_QUALITY_BOOST_ENABLE` **Values:** `true`, `false` **Default Value associated with usages:** - Transcoding: `false` - Ultra low latency: `false` - Low latency: `false` - Webcam: `false` - HQ: `true` - HQLL: `true` **Description:** Enable High motion quality boost mode. It pre-analysis the motion of the video and use the information for better encoding. --- | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :--------------------------------- | :-------- | | SCANTYPE | amf_int64 | | QUALITY_PRESET | amf_int64 | | FULL_RANGE_COLOR | amf_bool | | MAX_INSTANCES | amf_int64 | | MULTI_INSTANCE_MODE | amf_bool | | CURRENT_QUEUE | amf_int64 | | PICTURE_TRANSFER_MODE | amf_int64 | | QUERY_TIMEOUT | amf_int64 | | PSNR_FEEDBACK | amf_bool | | SSIM_FEEDBACK | amf_bool | | BLOCK_QP_FEEDBACK | amf_bool | <p align="center"> Table 8. Encoder miscellaneous parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_SCANTYPE` **Values:** `AMF_VIDEO_ENCODER_SCANTYPE_ENUM`: `AMF_VIDEO_ENCODER_SCANTYPE_PROGRESSIVE`, `AMF_VIDEO_ENCODER_SCANTYPE_INTERLACED` **Default Value:** `AMF_VIDEO_ENCODER_SCANTYPE_PROGRESSIVE` **Description:** Selects progressive or interlaced scan. --- **Name:** `AMF_VIDEO_ENCODER_QUALITY_PRESET` **Values:** `AMF_VIDEO_ENCODER_QUALITY_PRESET_ENUM`: `AMF_VIDEO_ENCODER_QUALITY_PRESET_BALANCED`, `AMF_VIDEO_ENCODER_QUALITY_PRESET_SPEED`, `AMF_VIDEO_ENCODER_QUALITY_PRESET_QUALITY` **Default Value associated with usages:** - Transcoding: `AMF_VIDEO_ENCODER_QUALITY_PRESET_BALANCED` - Ultra low latency: `AMF_VIDEO_ENCODER_QUALITY_PRESET_SPEED` - Low latency: `AMF_VIDEO_ENCODER_QUALITY_PRESET_SPEED` - Webcam: `AMF_VIDEO_ENCODER_QUALITY_PRESET_SPEED` - HQ: `AMF_VIDEO_ENCODER_QUALITY_PRESET_QUALITY` - HQLL: `AMF_VIDEO_ENCODER_QUALITY_PRESET_QUALITY` **Description:** Selects the quality preset. --- **Name:** `AMF_VIDEO_ENCODER_FULL_RANGE_COLOR` **Values:** `true`, `false` **Default Value:** `false` **Description:** True indicates that the YUV range is `0`...`255`. --- **Name:** `AMF_VIDEO_ENCODER_MAX_INSTANCES` **Values:** `1`, `2` **Default Value:** `1` **Description:** Hardware-dependent, only some hardware supports 2 instances. --- **Name:** `AMF_VIDEO_ENCODER_MULTI_INSTANCE_MODE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Enables or disables multi-instance mode. --- **Name:** `AMF_VIDEO_ENCODER_CURRENT_QUEUE` **Values:** `0`, `1` **Default Value:** `0` **Description:** Selects the encoder instance frames are being submitted to. --- **Name:** `AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE` **Values:** `AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_ENUM`: `AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_ON`, `AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_OFF` **Default Value:** `AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_OFF` **Description:** The application can turn on this flag for a specific input picture to allow dumping the reconstructed picture and/or injecting a reference picture. --- **Name:** `AMF_VIDEO_ENCODER_QUERY_TIMEOUT` **Values:** `ENCODER_TIMEOUT` **Default Value associated with usages:** - Transcoding: `0` (no wait) - Ultra low latency: `0` (no wait) - Low latency: `0` (no wait) - Webcam: `0` (no wait) - HQ: `50` - HQLL: `50` **Description:** Timeout for QueryOutput call in ms. --- **Name:** `AMF_VIDEO_ENCODER_PSNR_FEEDBACK` **Values:** `true`, `false` **Default Value:** `false` **Description:** Signal encoder to calculate PSNR score. --- **Name:** `AMF_VIDEO_ENCODER_SSIM_FEEDBACK` **Values:** `true`, `false` **Default Value:** `false` **Description:** Signal encoder to calculate SSIM score. --- **Name:** `AMF_VIDEO_ENCODER_BLOCK_QP_FEEDBACK` **Values:** `true`, `false` **Default Value:** `false` **Description:** Signal encoder to collect and feedback block level QP values. --- | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :--------------------------------- | :------- | | MOTION_HALF_PIXEL | amf_bool | | MOTION_QUARTERPIXEL | amf_bool | <p align="center"> Table 9. Encoder miscellaneous parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_MOTION_HALF_PIXEL` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `true` **Description:** Turns on/off half-pixel motion estimation. --- **Name:** `AMF_VIDEO_ENCODER_MOTION_QUARTERPIXEL` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** Turns on/off quarter-pixel motion estimation. --- | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :--------------------------------- | :-------- | | NUM_TEMPORAL_ENHANCMENT_LAYERS | amf_int64 | <p align="center"> Table 10. Encoder SVC parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_NUM_TEMPORAL_ENHANCMENT_LAYERS` **Values:** `1` … `Maximum number of temporal layers supported` **Default Value:** `1` **Description:** Sets the number of temporal enhancement layers. SVC with temporal scalability is enabled when the number of layers is greater than `1`. The maximum number of temporal layers supported is determined by the corresponding encoder capability. Remarks: - Actual modification of the number of temporal enhancement layers will be delayed until the start of the next temporal GOP. - B-pictures and Intra-refresh features are not supported with SVC. `NumOfTemporalEnhancmentLayers` shall not exceed `MaxNumOfTemporalLayers`. SVC is supported in all usages on Radeon RX 5000 Series or newer GPUs and Ryzen 2000 U/H series or newer APUs. It is only supported in Webcam usage on products prior to the aforementioned. --- | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :------------------------------------- | :--- | | TL<TL_Num>.QL<QL_Num>.<Parameter_name> | | <p align="center"> Table 11. Encoder SVC per-layer parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_TL<TL_Num>.QL<QL_Num>.<Parameter_name>` **Values:** Parameter-specific values **Default Value:** `N\A` **Description:** Configures rate-control parameter per SVC layer. - TL_Num — temporal layer number - QL_Num — quality layer number - Parameter_name — rate-control parameter name (see below) Rate-control parameters supported - TargetBitrate - PeakBitrate - VBVBufferSize - FrameRate - MinQP - MaxQP - QPI - QPP - FillerDataEnable - RateControlSkipFrameEnable - EnforceHRD - MaxAUSize (Refer to rate-control parameters section of this table for more details) Remarks: Quality layers are not supported on VCE 1.0. “QL0” must be used for quality layers. --- ### Table A-2. Input frame and encoded data parameters | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :--------------------------------- | :----------------- | | INSERT_SPS | amf_bool | | INSERT_PPS | amf_bool | | INSERT_AUD | amf_bool | | PICTURE_STRUCTURE | amf_int64 | | FORCE_PICTURE_TYPE | amf_int64 | | END_OF_SEQUENCE | amf_bool | | END_OF_STREAM | amf_bool | | MARK_CURRENT_WITH_LTR_INDEX | amf_int64 | | FORCE_LTR_REFERENCE_BITFIELD | amf_int64 | | ROI_DATA | AMF_SURFACE_GRAY32 | | STATISTICS_FEEDBACK | amf_bool | | REFERENCE_PICTURE | AMFInterfacePtr | <p align="center"> Table 12. Frame per-submission parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_INSERT_SPS` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** Inserts SPS. --- **Name:** `AMF_VIDEO_ENCODER_INSERT_PPS` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** Inserts PPS. --- **Name:** `AMF_VIDEO_ENCODER_INSERT_AUD` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** Inserts AUD. --- **Name:** `AMF_VIDEO_ENCODER_PICTURE_STRUCTURE` **Values:** `AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_ENUM`: `AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_NONE`, `AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_FRAME`, `AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_TOP_FIELD`, `AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_BOTTOM_FIELD` **Default Value:** `AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_FRAME` **Description:** Picture structure. --- **Name:** `AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE` **Values:** `AMF_VIDEO_ENCODER_PICTURE_TYPE_ENUM`: `AMF_VIDEO_ENCODER_PICTURE_TYPE_NONE`, `AMF_VIDEO_ENCODER_PICTURE_TYPE_SKIP`, `AMF_VIDEO_ENCODER_PICTURE_TYPE_IDR`, `AMF_VIDEO_ENCODER_PICTURE_TYPE_I`, `AMF_VIDEO_ENCODER_PICTURE_TYPE_P`, `AMF_VIDEO_ENCODER_PICTURE_TYPE_B` **Default Value:** `AMF_VIDEO_ENCODER_PICTURE_TYPE_NONE` **Description:** Forces the picture type (to use this feature, set `AMF_VIDEO_ENCODER_IDR_PERIOD` to `0`). `B` feature is not supported by VCE 1.0. --- **Name:** `AMF_VIDEO_ENCODER_END_OF_SEQUENCE` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** End of sequence. --- **Name:** `AMF_VIDEO_ENCODER_END_OF_STREAM` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** End of stream. --- **Name:** `AMF_VIDEO_ENCODER_MARK_CURRENT_WITH_LTR_INDEX` **Values:** `-1` … `MaxOfLTRFrames -1` **Default Value:** `N/A` **Description:** If != `-1`, the current picture is coded as a long-term reference with the given index. Remarks: - When the user controls N LTRs (using the corresponding Create parameter), then the LTR Index the user can assign to a reference picture varies from `0` to `N-1`. By default, the encoder will “use up” available LTR Indices (i.e. assign them to references) even if the user does not request them to be used. - When LTR is used with SVC encoding, only base temporal layer pictures can be coded as LTR. In this case, the request to mark the current picture as LTR would be delayed to the next base temporal layer picture if the current picture is in an enhancement layer. If the user submits multiple requests to mark current as LTR between base temporal layer pictures, then only the last request is applied. --- **Name:** `AMF_VIDEO_ENCODER_FORCE_LTR_REFERENCE_BITFIELD` **Values:** Bitfield `MaxOfLTRFrames` (max possible 16 bits) **Default Value:** `0` **Description:** Force LTR Reference allowed bitfield. If == `0`, the current picture should predict from the default reference. If != `0`, the current picture should predict from one of the LTRs allowed by the bitfield (bit# = LTR Index#). Remarks: - E.g. if `Bit#0` = `1`, then the existing LTR with LTR Index = `0` may be used for reference. The bitfield may allow more than one LTR for reference, in which case the encoder is free to choose which one to use. This bitfield also disallows existing LTRs not enabled by it from current/future reference. - E.g. if `Bit#1` = `0`, and there is an existing reference with LTR Index = `1`, then this LTR Index will not be used for reference until it is replaced with a newer reference with the same LTR Index. --- **Name:** `AMF_VIDEO_ENCODER_ROI_DATA` **Values:** Video surface **Default Value:** `N\A` **Description:** Important value for each macro block ranges from `0` to `10`, stored in 32bit unsigned format. --- **Name:** `AMF_VIDEO_ENCODER_STATISTICS_FEEDBACK` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** Instruct encoder to collect and feedback statistics. --- **Name:** `AMF_VIDEO_ENCODER_REFERENCE_PICTURE` **Values:** `AMFSurface` **Default Value:** `N\A` **Description:** Injected reference picture. Valid with `AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE` turned on. --- | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :--------------------------------- | :--------- | | OUTPUT_DATA_TYPE | amf_int64 | | OUTPUT_MARKED_LTR_INDEX | amf_int64 | | OUTPUT_REFERENCED_LTR_INDEX_BITFIELD | amf_int64 | | OUTPUT_TEMPORAL_LAYER | amf_int64 | | RECONSTRUCTED_PICTURE | AMFSurface | <p align="center"> Table 13. Encoded data parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE` **Values:** `AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_ENUM`: `AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_IDR`, `AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_I`, `AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_P`, `AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_B` **Default Value:** `N/A` **Description:** Type of encoded data. `B` feature is not supported by VCE 1.0. --- **Name:** `AMF_VIDEO_ENCODER_OUTPUT_MARKED_LTR_INDEX` **Values:** `-1` … `MaxOfLTRFrames -1` **Default Value:** `-1` **Description:** Marked as LTR Index. If != `-1`, then this picture was coded as a long-term reference with this LTR Index. --- **Name:** `AMF_VIDEO_ENCODER_OUTPUT_REFERENCED_LTR_INDEX_BITFIELD` **Values:** Bitfield `MaxOfLTRFrames` (max possible 16 bits) **Default Value:** `0` **Description:** Referenced LTR Index bitfield. If != `0`, this picture was coded to reference long-term references. The enabled bits identify the LTR Indices of the referenced pictures (e.g. if `Bit#0` = `1`, then LTR Index 0 was used as a reference when coding this picture). --- **Name:** `AMF_VIDEO_ENCODER_OUTPUT_TEMPORAL_LAYER` **Values:** `0` … `Maximum number of temporal layers supported - 1` **Default Value:** `N\A` **Description:** Temporal layer of the encoded picture. --- **Name:** `AMF_VIDEO_ENCODER_RECONSTRUCTED_PICTURE` **Values:** `AMFSurface` **Default Value:** `N\A` **Description:** Reconstructed picture. Valid with `AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE` turned on. --- ### Table A-4. Encoder statistics feedback | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :---------------------------------- | :-------- | | STATISTIC_FRAME_QP | amf_int64 | | STATISTIC_AVERAGE_QP | amf_int64 | | STATISTIC_MAX_QP | amf_int64 | | STATISTIC_MIN_QP | amf_int64 | | STATISTIC_PIX_NUM_INTRA | amf_int64 | | STATISTIC_PIX_NUM_INTER | amf_int64 | | STATISTIC_PIX_NUM_SKIP | amf_int64 | | STATISTIC_BITCOUNT_RESIDUAL | amf_int64 | | STATISTIC_BITCOUNT_MOTION | amf_int64 | | STATISTIC_BITCOUNT_INTER | amf_int64 | | STATISTIC_BITCOUNT_INTRA | amf_int64 | | STATISTIC_BITCOUNT_ALL_MINUS_HEADER | amf_int64 | | STATISTIC_MV_X | amf_int64 | | STATISTIC_MV_Y | amf_int64 | | STATISTIC_RD_COST_FINAL | amf_int64 | | STATISTIC_RD_COST_INTRA | amf_int64 | | STATISTIC_RD_COST_INTER | amf_int64 | | STATISTIC_SATD_FINAL | amf_int64 | | STATISTIC_SATD_INTRA | amf_int64 | | STATISTIC_SATD_INTER | amf_int64 | <p align="center"> Table 14. Encoder statistics feedback </p> --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_FRAME_QP` **Description:** QP of the first encoded macroblocks in a picture. --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_AVERAGE_QP` **Description:** Average QP of all encoded macroblocks in a picture. --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_MAX_QP` **Description:** Max QP among all encoded macroblocks in a picture --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_MIN_QP` **Description:** Min QP among all encoded macroblocks in a picture --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_PIX_NUM_INTRA` **Description:** Number of intra-coded pixels --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_PIX_NUM_INTER` **Description:** Number of inter-coded pixels --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_PIX_NUM_SKIP` **Description:** Number of skip-coded pixels --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_RESIDUAL` **Description:** Frame level bit count of residual data --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_MOTION` **Description:** Frame level bit count of motion vectors --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_INTER` **Description:** Frame level bit count of inter macroblocks --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_INTRA` **Description:** Frame level bit count of intra macroblocks --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_ALL_MINUS_HEADER` **Description:** Frame level bit count of the bitstream excluding header --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_MV_X` **Description:** Accumulated absolute values of MVX --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_MV_Y` **Description:** Accumulated absolute values of MVY --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_RD_COST_FINAL` **Description:** Frame level final RD cost --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_RD_COST_INTRA` **Description:** Frame level RD cost for intra mode --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_RD_COST_INTER` **Description:** Frame level RD cost for inter mode --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_SATD_FINAL` **Description:** Frame level final SATD --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_SATD_INTRA` **Description:** Frame level SATD for intra mode --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_SATD_INTER` **Description:** Frame level SATD for inter mode --- ### Table A-5. Encoder PSNR/SSIM feedback | Name (prefix "AMF_VIDEO_ENCODER_") | Type | | :--------------------------------- | :----- | | STATISTIC_PSNR_Y | double | | STATISTIC_PSNR_U | double | | STATISTIC_PSNR_V | double | | STATISTIC_PSNR_ALL | double | | STATISTIC_SSIM_Y | double | | STATISTIC_SSIM_U | double | | STATISTIC_SSIM_V | double | | STATISTIC_SSIM_ALL | double | <p align="center"> Table 15. Encoder PSNR/SSIM feedback </p> --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_PSNR_Y` **Description:** PSNR Y --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_PSNR_U` **Description:** PSNY U --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_PSNR_V` **Description:** PSNR V --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_PSNR_ALL` **Description:** PSNR YUV --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_SSIM_Y` **Description:** SSIM Y --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_SSIM_U` **Description:** SSIM U --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_SSIM_V` **Description:** SSIM V --- **Name:** `AMF_VIDEO_ENCODER_STATISTIC_SSIM_ALL` **Description:** SSIM YUV --- 07070100000007000081A400000000000000000000000163CFF5E70000E0C1000000000000000000000000000000000000003000000000AMF-1.4.29/amf/doc/AMF_Video_Encode_HEVC_API.md#### Advanced Micro Devices # Advanced Media Framework – HEVC Video Encoder #### Programming Guide --- ### Disclaimer The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale. AMD, the AMD Arrow logo, ATI Radeon™, CrossFireX™, LiquidVR™, TrueAudio™ and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. Windows™, Visual Studio and DirectX are trademark of Microsoft Corp. --- ### Copyright Notice © 2022 Advanced Micro Devices, Inc. All rights reserved Notice Regarding Standards. AMD does not provide a license or sublicense to any Intellectual Property Rights relating to any standards, including but not limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 (collectively, the “Media Technologies”). For clarity, you will pay any royalties due for such third party technologies, which may include the Media Technologies that are owed as a result of AMD providing the Software to you. ### MIT license Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- ### Contents 1. [Introduction](#1-introduction) - [1.1 Scope](#11-scope) - [1.2 Pre-defined Encoder Usages](#12-pre-defined-encoder-usages) 2. [AMF Video Encoder UVD/VCN-HEVC Component](#2-amf-video-encoder-uvdvcn-hevc-component) - [2.1 Input Submission and Output Retrieval](#21-input-submission-and-output-retrieval) - [2.2 Encode Parameters](#22-encode-parameters) - [2.2.1 Static Properties](#221-static-properties) - [2.2.2 Dynamic Properties](#222-dynamic-properties) - [2.2.3 Frame Per-Submission Properties](#223-frame-per-submission-properties) - [2.2.4 ROI Feature](#224-roi-feature) - [2.2.5 Encoder Statistics Feedback](#225-encoder-statistics-feedback) - [2.2.6 Picture Transfer Mode](#226-picture-transfer-mode) - [2.2.7 SVC Properties](#227-svc-properties) - [2.2.8 LTR Properties](#228-ltr-properties) 3. [Sample Applications](#3-sample-applications) - [3.1 List of Parameters](#31-list-of-parameters) - [3.2 Command line example](#32-command-line-example) - [3.2.1 Transcoding application (TranscodeHW.exe)](#321-transcoding-application-transcodehwexe) - [3.2.2 D3D application (VCEEncoderD3D.exe)](#322-d3d-application-vceencoderd3dexe) 4. [Annex A: Encoding & Frame Parameters Description](#4-annex-a-encoding--frame-parameters-description) - [Table A-1. Encoder parameters](#table-a-1-encoder-parameters) - [Table A-2. Input frame and encoded data parameters](#table-a-2-input-frame-and-encoded-data-parameters) - [Table A-3. Encoder statistics feedback](#table-a-3-encoder-statistics-feedback) - [Table A-4. Encoder PSNR/SSIM feedback](#table-a-4-encoder-psnrssim-feedback) ## 1 Introduction ### 1.1 Scope This document provides a complete description of the AMD Advanced Media Framework (AMF) Video Encoder Component. This component exposes the AMD Video Compression Engine, which provides hardware accelerated HEVC video encoding functionality. Figure 1 provides a system overview of the AMF Video Encoder Component. <p align="center"> <img src="AMF_Video_Encode_API.png"> <p align="center"> Figure 1 — System overview of the AMF Video Encode SDK The AMF Video Encoder Component compresses RAW uncompressed video to an HEVC elementary bitstream. The component does not provide a mechanism to handle audio compression, or stream multiplexing. The component provides four different sets of pre-defined usages, which provide a convenient way for developers to configure the encoder to match the intended application use case. Advanced developers can also adjust encoding parameters to tailor the behavior to their specific application requirements. HEVC encoding is currently supported on Windows only. ### 1.2 Pre-defined Encoder Usages The following table provides a brief overview of the encoding usage modes that have been defined: | Usage Mode | Intended use-cases | Comments | | :---------------- | :---------------------------------- | :------------------------------------------------------------------------------------------------------------------------------- | | Transcoding | Transcoding, video editing | Favor compression efficiency and throughput over latency. | | Ultra-low latency | Video game streaming | Optimize for extremely low latency use cases (e.g. cap the number of bits per frame), to enable high-interactivity applications. | | Low Latency | Video collaboration, remote desktop | Optimize for low latency scenarios, but allow occasional bitrate overshoots to preserve quality. | | Webcam | Video conferencing | Optimize for a low-latency video conferencing scenario. | | HQ | High quality mode | Optimize for best subjective video quality with possible loss of performance. | | HQLL | High quality low latency mode | Optimize for good quality with low latency. | <p align="center"> Table 1. Encoding usage modes </p> ## 2 AMF Video Encoder UVD/VCN-HEVC Component The AMF Video Encoder HEVC component provides hardware accelerated HEVC encoding using AMD’s IP. To instantiate the AMF Video Encoder component, call the `AMFFactory::CreateComponent` method passing `AMFVideoEncoderHW_HEVC` component IDs defined in the `/include/components/VideoEncoderHEVC.h` header. ### 2.1 Input Submission and Output Retrieval The AMF Video Encoder component accepts `AMFSurface` objects as input and produces `AMFBuffer` objects for output. ### 2.2 Encode Parameters Annex A provides the detailed description of encoding parameters (i.e., encoder properties) exposed by the Video Encoder HEVC component for the following four usages: - Transcoding mode, - Ultra-low latency mode, - Low Latency mode, - Webcam mode, - HQ mode, and - HQLL mode. All properties are accessed using the `AMFPropertyStorage` interface of the Encoder object. #### 2.2.1 Static Properties Static properties (e.g., profile, tier, level, usage) must be defined before the `Init()` function is called, and will apply until the end of the encoding session. #### 2.2.2 Dynamic Properties All dynamic properties have default values. Several properties can be changed subsequently and these changes will be flushed to encoder only before the next `Submit()` call. #### 2.2.3 Frame Per-Submission Properties Per submission properties are applied on a per frame basis. They can be set optionally to force a certain behavior (e.g., force frame type to IDR) by updating the properties of the AMFSurface object that is passed through the `AMFComponent::Submit()` call. #### 2.2.4 ROI Feature Region of importance (ROI) feature provides a way to specify the relative importance of the macroblocks in the video frame. Encoder will further adjust the bits allocation among code blocks based on the importance, on top of the base rate control decisions. More important blocks will be encoded with relatively better quality. The ROI map can be attached to the input frame on a per frame basis. Currently, the ROI map can only use system memory. The ROI map includes the importance values of each 64x64 CTB, ranging from 0 to 10, stored in 32bit unsinged format. Refer to SimpleROI sample application for further implementation details. #### 2.2.5 Encoder Statistics Feedback If an application sets the `AMF_VIDEO_ENCODER_HEVC_STATISTICS_FEEDBACK` flag on for an input picture, the encoder will feedback to the application statistics for this specific picture. After the encoding ends, the application can retrieve by name the specific statistic(s) it is interested in. The supported encoder statistics are listed in Table A-3. This feature is supported by Radeon RX 5000 Series or newer GPUs as well as Ryzen 2000 U/H series or newer APUs. #### 2.2.6 Picture Transfer Mode If an application enables `AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE` for a specific input picture, it can dump out the reconstructed picture after encoding and/or it can inject a picture to be used as the reference picture during the encoding. It is worth noting that reference picture injection is a feature that is intended for advanced algorithm testing and exploration. It needs to be used with care since the internal DPB in the current encoding session will be overridden by the injected reference picture(s). The reader can refer to SimpleFrameInjection sample application for further implementation details. This feature is supported by Radeon RX 5000 Series or newer GPUs as well as Ryzen 2000 U/H series or newer APUs. #### 2.2.7 SVC Properties Scalable Video Coding (SVC) is enabled by setting `AMF_VIDEO_ENCODER_HEVC_NUM_TEMPORAL_LAYERS` to a value that is greater than `1`. `AMF_VIDEO_ENCODER_HEVC_NUM_TEMPORAL_LAYERS` is a dynamic property and can be changed at any time during an encoding session. To ensure proper support, `AMF_VIDEO_ENCODER_HEVC_MAX_NUM_TEMPORAL_LAYERS` needs to be set before initializing the encoder to a value that is not smaller than the number of temporal layers. As an example, the maximum number of temporal layers shall be set to `4` if the number of temporal layers will be changed from `3` to `4` in an encoding session. The maximum number of temporal layers supported by the encoder can be queried from the encoder capabilities before initializing the encoder. To define SVC parameters per layer, the following format must be used: `TL<Temporal_Layer_Number>.QL<Quality_Layer_Number>.<Parameter_name>` As an example with two temporal layers, to configure “Target bitrate” for the base/first temporal layer and first quality layer, the following parameter should be used: `TL0.QL0.HevcTargetBitrate` To configure “Target bitrate” for the second temporal layer and first quality layer, the following parameter should be used: `TL1.QL0.HevcTargetBitrate` When setting per layer parameters, the equivalent non-SVC layer parameters should not be set for the encoder otherwise the per layer configuration will be overwritten. Remark: quality layers are not supported. “QL0” must be used for quality layers. This feature is supported by Radeon RX 5000 Series or newer GPUs as well as Ryzen 2000 U/H series or newer APUs. #### 2.2.8 LTR Properties LTR (Long Term Reference) is to manually select a reference frame which can be far away to encode current frame. Normally, the encoder selects last frame as reference or a frame at lower layer in the SVC case. In HEVC, maximum of `16` reference frames are supported according to the spec. These `16` reference frames are shared by SVC and LTR. To use LTR, you need to set these properties as Static Properties: `AMF_VIDEO_ENCODER_HEVC_MAX_LTR_FRAMES`, Max number of LTR frames. `AMF_VIDEO_ENCODER_HEVC_LTR_MODE` default = `AMF_VIDEO_ENCODER_HEVC_LTR_MODE_RESET_UNUSED`; remove/keep unused LTRs (not specified in property `AMF_VIDEO_ENCODER_HEVC_FORCE_LTR_REFERENCE_BITFIELD`) The `LTR_MODE` has two options: ```cpp enum AMF_VIDEO_ENCODER_HEVC_LTR_MODE_ENUM { AMF_VIDEO_ENCODER_HEVC_LTR_MODE_RESET_UNUSED = 0, AMF_VIDEO_ENCODER_HEVC_LTR_MODE_KEEP_UNUSED }; ``` Reset_unused: encoder will discard all other LTR frames stored once a LTR frame is used as reference. Keep_unused: encoder will not change other LTR frames stored once any LTR frame is used as reference. When we enable auto LTR mode in PA, this mode will be automatically selected internally and `AMF_VIDEO_ENCODER_HEVC_MAX_LTR_FRAMES` will be set to `4` no matter what users set. For details of “auto LTR mode”, please refer to AMF_Video_PreAnalysis_API document. There are two Frame Per-Submission Properties need be set to use LTR: `AMF_VIDEO_ENCODER_HEVC_MARK_CURRENT_WITH_LTR_INDEX`, Mark current frame with LTR index. `-1` means don’t save current frame into LTR slots. `0~N` means save current frame into a LTR slot with index of `0~N`. Here N should be `<= AMF_VIDEO_ENCODER_HEVC_MAX_LTR_FRAMES-1`. When we use SVC encoding, only next base frame can be stored as LTR frame (i.e. only temporal layer number = `0` frames are allowed to be saved into LTR slot.) `AMF_VIDEO_ENCODER_HEVC_FORCE_LTR_REFERENCE_BITFIELD`, force LTR bit-field. This is a bit-field mask that indicate which LTR slot can be used as reference for current frame. `0b1` means only slot 0 can be used as reference. `0b10` means only slot 1 can be used as reference. `0b100` means only slot 2 can be used as reference... `0b0` means no LTR frame will be used as reference for current frame hence current frame will select short term reference frame (usually last frame) as reference. When there are multiple bits are enabled, for example: `0b1111` (`=decimal 15`), that means LTR slots 0,1,2 and 3 are all allowed to be selected as reference. In this case, the closest LTR frame to current frame will be selected. When we encode a key frame or switch frame, all save LTR slots will be cleared. Referring to a LTR frame not exiting in LTR slot will generate an Intra only frame. ## 3 Sample Applications The AMF Encoder Sample application show how to setup and use the AMF Video Encoder HEVC Component to encode video frames that are loaded from disk or rendered by the DirectX 3D engine. ### 3.1 List of Parameters Sample applications support almost all visible encoder parameters (except PictureStructure, EndOfSequence, EndOfStream) and few additional parameters. Additional parameters of `TranscodeHW` application: | Name | Type | | :---------- | :----- | | CODEC | string | | OUTPUT | string | | INPUT | string | | WIDTH | int | | HEIGHT | int | | ADAPTERID | int | | ENGINE | string | | FRAMES | int | | THREADCOUNT | int | | PREVIEWMODE | bool | <p align="center"> Table 2. Additional miscellaneous parameters of TranscodeHW application </p> --- **Name:** `CODEC` **Values:** `AVC` or `H264`, `HEVC` or `H265`, `AV1` **Default Value:** `AVC` **Description:** Specify codec type. --- **Name:** `OUTPUT` **Values:** File name, relative or absolute path **Default Value** `NULL` **Description:** Output HEVC file for encoded data. --- **Name:** `INPUT` **Values:** File name, relative or absolute path **Default Value:** `NULL` **Description:** Input file with frames (AVC or HEVC). --- **Name:** `WIDTH` **Values:** Frame width **Default Value:** `0` **Description:** Frame width. --- **Name:** `HEIGHT` **Values:** Frame height **Default Value:** `0` **Description:** Frame height. --- **Name:** `AdapterID` **Values:** Number **Default Value:** `0` **Description:** Index of GPU adapter. --- **Name:** `ENGINE` **Values:** `DX9`, `DX11`, `Vulkan` **Default Value:** `DX11` **Description:** Specify Engine type. --- **Name:** `FRAMES` **Values:** Number of frames to be encoded **Default Value:** `100` **Description:** Number of frames to render. --- **Name:** `THREADCOUNT` **Values:** Number **Default Value:** `1` **Description:** Number of session run ip parallel. --- **Name:** `PREVIEWMODE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Preview Mode . --- Additional parameters of `VCEEncoderD3D` application: | Name | Category | | :----------------- | :------- | | CODEC | string | | OUTPUT | string | | RENDER | string | | WIDTH | int | | HEIGHT | int | | FRAMES | int | | ADAPTERID | int | | WINDOWMODE | bool | | FULLSCREEN | bool | | QueryInstanceCount | bool | | UseInstance | int | | FRAMERATE | int | <p align="center"> Table 3. Miscellaneous parameters of VCEEncoderD3D application </p> --- **Name:** `CODEC` **Values:** `AVC` or `H264`, `HEVC` or `H265`, `AV1` **Default Value:** `AVC` **Description:** Codec name. --- **Name:** `OUTPUT` **Values:** File name, relative or absolute path **Default Value:** `NULL` **Description:** Output `HEVC` file for encoded data. --- **Name:** `RENDER` **Values:** `DX9`, `DX9Ex`, `DX11`, `OpenGL`, `OpenCL`, `Host`, `OpenCLDX9`, `OpenCLDX11`, `OpenGLDX9`, `OpenGLDX11`, `OpenCLOpenGLDX9`, `OpenCLOpenGLDX11`, `HostDX9`, `HostDX11`, `DX11DX9`, `Vulkan` **Default Value:** `DX9` **Description:** Specifies render type. --- **Name:** `WIDTH` **Values:** Frame width **Default Value:** `1280` **Description:** Frame width. --- **Name:** `HEIGHT` **Values:** Frame height **Default Value:** `720` **Description:** Frame height. --- **Name:** `FRAMES` **Values:** Number of frames to be encoded **Default Value:** `100` **Description:** Number of frames to be encoded. --- **Name:** `ADAPTERID` **Values:** Number **Default Value:** `0` **Description:** Index of GPU adapter. --- **Name:** `WINDOWMODE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Shows rendering window for D3D sample application. --- **Name:** `FULLSCREEN` **Values:** `true`, `false` **Default Value:** `false` **Description:** Enables full screen. --- **Name:** `QueryInstanceCount` **Values:** `true`, `false` **Default Value:** `false` **Description:** If the flag is set, the number of independent VCE instances will be quried and printed. --- **Name:** `UseInstance` **Values:** `0`... `number of instances - 1` **Default Value:** Depends on usage **Description:** If there are more than one VCE Instances, you can force which instance to use. --- **Name:** `FRAMERATE` **Values:** Render frame rate **Default Value:** `0` **Description:** Render frame rate. --- ### 3.2 Command line example #### 3.2.1 Transcoding application (TranscodeHW.exe) `TranscodeHW.exe -input input.h264 -output out.h265 –codec HEVC -width 1280 -height 720 -HevcUsage transcoding -HevcRateControlMethod cbr -HevcTargetBitrate 100000` This command transcodes H264 elementary stream to H.265 video. Encoder is created with “Transcoding” usage. #### 3.2.2 D3D application (VCEEncoderD3D.exe) `VCEEncoderD3D.exe -output VideoSample_1024x768.h265 –codec HEVC -width 1024 -height 768 -HevcUsage transcoding -HevcRateControlMethod cbr -HevcTargetBitrate 500000 -frames 400` This command encodes `400` frames through D3D renderer and creates an output file with the encoded data. Encoder is created with “Transcoding” usage. Initial configuration sets bitrate to a value of `500` kbits/sec. ## 4 Annex A: Encoding & frame parameters description ### Table A-1. Encoder parameters | Name (Prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :-------------------------------------- | :-------- | | USAGE | amf_int64 | | INSTANCE_INDEX | amf_int64 | | PROFILE | amf_int64 | | TIER | amf_int64 | | PROFILE_LEVEL | amf_int64 | | MAX_LTR_FRAMES | amf_int64 | | LTR_MODE | amf_int64 | | MAX_NUM_REFRAMES | amf_int64 | | LOWLATENCY_MODE | amf_bool | | PRE_ANALYSIS_ENABLE | amf_bool | | MAX_NUM_TEMPORAL_LAYERS | amf_int64 | <p align="center"> Table 4. Encoder static parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEVC_USAGE` **Values:** `AMF_VIDEO_ENCODER_HEVC_USAGE_ENUM`: `AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING`, `AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING`, `AMF_VIDEO_ENCODER_HEVC_USAGE_ULTRA_LOW_LATENCY`, `AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY`, `AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM`, `AMF_VIDEO_ENCODER_HEVC_USAGE_HIGH_QUALITY`, `AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY` **Default Value:** `N/A` **Description:** Selects the AMF usage (see Section 1.2). --- **Name:** `AMF_VIDEO_ENCODER_HEVC_INSTANCE_INDEX` **Values:** `0`, `1` **Default Value:** `0` **Description:** Selects the encoder engine used for encoding. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_PROFILE` **Values:** `AMF_VIDEO_ENCODER_HEVC_PROFILE_ENUM`: `AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN`, `AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN_10` **Default Value:** `AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN` **Description:** Selects the HEVC profile. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_TIER` **Values:** `AMF_VIDEO_ENCODER_HEVC_TIER_ENUM`: `AMF_VIDEO_ENCODER_HEVC_TIER_MAIN`, `AMF_VIDEO_ENCODER_HEVC_TIER_HIGH` **Default Value:** `AMF_VIDEO_ENCODER_HEVC_TIER_MAIN` **Description:** Selects the HEVC tier. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_PROFILE_LEVEL` **Values:** `AMF_VIDEO_ENCODER_LEVEL_ENUM`: `AMF_LEVEL_1`, `AMF_LEVEL_2`, `AMF_LEVEL_2_1`, `AMF_LEVEL_3`, `AMF_LEVEL_3_1`, `AMF_LEVEL_4`, `AMF_LEVEL_4_1`, `AMF_LEVEL_5`, `AMF_LEVEL_5_1`, `AMF_LEVEL_5_2`, `AMF_LEVEL_6`, `AMF_LEVEL_6_1`, `AMF_LEVEL_6_2` **Default Value:** `AMF_LEVEL_6_2` **Description:** Selects the HEVC Profile Level. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MAX_LTR_FRAMES` **Values:** `0` … `16` **Default Value:** `0` **Description:** The number of long-term references controlled by the user. Remarks: - When == `0`, the encoder may or may not use LTRs during encoding. - When > `0`, the user has control over all LTR. - With user control of LTR, Intra-refresh features are not supported. - The actual maximum number of LTRs allowed depends on H.265 (HEVC) Annex A Table Level limits, which defines dependencies between the H.265 Level number, encoding resolution, and DPB size. The DPB size limit impacts the maximum number of LTR allowed. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_LTR_MODE` **Values:** `AMF_VIDEO_ENCODER_HEVC_LTR_MODE_ENUM`: `AMF_VIDEO_ENCODER_HEVC_LTR_MODE_RESET_UNUSED`, `AMF_VIDEO_ENCODER_HEVC_LTR_MODE_KEEP_UNUSED` **Default Value:** `AMF_VIDEO_ENCODER_HEVC_LTR_MODE_RESET_UNUSED` **Description:** Remove/keep unused LTRs not specified inside the LTR reference bitfield. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MAX_NUM_REFRAMES` **Values:** `0` … `16` **Default Value:** `1` **Description:** Maximum number of reference frames. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_LOWLATENCY_MODE` **Values:** `true` (`on`), `false` (`off`) **Default Value associated with usages:** - Transcoding: `false` - Ultra low latency: `true` - Low latency: `false` - Webcam: `false` - HQ: `false` - HQLL: `true` **Description:** Enables low latency mode in the encoder --- **Name:** `AMF_VIDEO_ENCODER_HEVC_PRE_ANALYSIS_ENABLE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Enables the pre-analysis module. Some features require this to be enabled. Refer to AMF Video PreAnalysis API reference for more details. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MAX_NUM_TEMPORAL_LAYERS` **Values:** `1` … `Maximum number of temporal layers supported` **Default Value:** `1` **Description:** Sets the maximum number of temporal layers. It shall not be exceeded by the number of temporal layers. The maximum number of temporal layers supported is determined by the corresponding encoder capability. --- | Name (Prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :- | :------- | | FRAMESIZE | AMFSize | | ASPECT_RATIO | AMFRatio | <p align="center"> Table 5. Encoder resolution parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEVC_FRAMESIZE` **Values:** Width: `192` – `4096` Height: `128` – `2176` **Default Value:** Width: `0` Height: `0` **Description:** Frame width/Height in pixels, maximum value is hardware-specific, should be queried through `AMFCaps` --- **Name:** `AMF_VIDEO_ENCODER_HEVC_ASPECT_RATIO` **Values:** `(1,1)`...`(INT_MAX,INT_MAX)` **Default Value:** `(1,1)` **Description:** Pixel aspect ratio --- | Name (Prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :- | :-------- | | TARGET_BITRATE | amf_int64 | | PEAK_BITRATE | amf_int64 | | RATE_CONTROL_METHOD | amf_int64 | | QVBR_QUALITY_LEVEL | amf_int64 | | RATE_CONTROL_SKIP_FRAME_ENABLE | amf_bool | | MIN_QP_I | amf_int64 | | MAX_QP_I | amf_int64 | | MIN_QP_P | amf_int64 | | MAX_QP_P | amf_int64 | | QP_I | amf_int64 | | QP_P | amf_int64 | | FRAMERATE | AMFRate | | VBV_BUFFER_SIZE | amf_int64 | | INITIAL_VBV_BUFFER_FULLNESS | amf_int64 | | ENFORCE_HRD | amf_bool | | PREENCODE_ENABLE | amf_bool | | ENABLE_VBAQ | amf_bool | | FILLER_DATA_ENABLE | amf_bool | | HIGH_MOTION_QUALITY_BOOST_ENABLE | amf_bool | <p align="center"> Table 6. Encoder rate-control parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEVC_TARGET_BITRATE` **Values:** `>0` **Default Value:** `20` mbps **Description:** Sets the target bitrate, bit/s based on use case. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_PEAK_BITRATE` **Values:** `>= TargetBitrate` **Default Value:** - Transcoding: `30` mbps - Ultra low latency: `20` mbps - Low latency: `20` mbps - Webcam: `20` mbps - HQ: `80` mbps - HQLL: `30` mbps **Description:** Sets the peak bitrate. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD` **Values:** `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_ENUM`: `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_UNKNOWN`, `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP`, `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR`, `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR`, `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CBR`, `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_QUALITY_VBR`, `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_HIGH_QUALITY_VBR`, `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_HIGH_QUALITY_CBR` **Default Value associated with usages:** - Transcoding: `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR` - Ultra low latency: `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR` - Low latency: `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR` - Webcam: `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR` - HQ: `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR` - HQLL: `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR` **Description:** Selects the rate control method: - CQP – Constrained QP, - VBR_LAT - Latency Constrained VBR - VBR - Peak Constrained VBR, - CBR - Constant Bitrate - QVBR – Quality VBR - HQVBR – High Quality VBR - HQCBR – High Quality CBR Remarks: - When SVC encoding is enabled, some rate-control parameters can be configured differently for a particular SVC-layer. An SVC-layer is denoted by an index pair `[SVC-Temporal Layer index][SVC-Quality Layer index]`. E.g. The bitrate may be configured differently for SVC-layers `[0][0]` and `[1][0]`. - We restrict all SVC layers to have the same Rate Control method. - QVBR, HQVBR and HQCBR are only supported if PreAnalysis is enabled. - QVBR, HQVBR and HQCBR target improving subjective quality with the possible loss of objective quality (PSNR or VMAF). --- **Name:** `AMF_VIDEO_ENCODER_HEVC_QVBR_QUALITY_LEVEL` **Values:** `1` – `51` **Default Value:** `23` **Description:** Sets the quality level for QVBR rate control method. Remarks: Only available for QVBR rate control method. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_SKIP_FRAME_ENABLE` **Values:** `true`, `false` **Default Value associated with usages:** - Transcoding: `false` - Ultra low latency: `true` - Low latency: `true` - Webcam: `true` - HQ: `false` - HQLL: `false` **Description:** Enables skip frame for rate control --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MIN_QP_I` **Values:** `0` – `51` **Default Value:** `0` **Description:** Sets the minimum QP for I frame --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MAX_QP_I` **Values:** `0` – `51` **Default Value:** `51` **Description:** Sets the maximum QP for I frame --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MIN_QP_P` **Values:** `0` – `51` **Default Value:** `0` **Description:** Sets the minimum QP for P frame. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MAX_QP_P` **Values:** `0` – `51` **Default Value:** `51` **Description:** Sets the maximum QP for P frame. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_QP_I` **Values:** `0` – `51` **Default Value:** `26` **Description:** Sets the constant QP for I-pictures.Remarks: Only available for CQP rate control method. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_QP_P` **Values:** `0` – `51` **Default Value:** `26` **Description:** Sets the constant QP for P-pictures. Remarks: Only available for CQP rate control method. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_FRAMERATE` **Values:** `1*FrameRateDen` … `60* FrameRateDen` **Default Value:** `30` fps **Description:** Frame rate numerator/denominator. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_VBV_BUFFER_SIZE` **Values:** `>0` **Default Value associated with usages:** - Transcoding: `20` mbits - Ultra low latency: `735` kbits - Low latency: `4` mbits - Webcam: `2` mbits - HQ: `40` mbits - HQLL: `10` mbits **Description:** Sets the VBV buffer size in bits based on use case. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_INITIAL_VBV_BUFFER_FULLNESS` **Values:** `0` - `64` **Default Value:** `64` **Description:** Sets the initial VBV buffer fullness. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_ENFORCE_HRD` **Values:** `true`, `false` **Default Value associated with usages:** - Transcoding: `false` - Ultra low latency: `true` - Low latency: `false` - Webcam: `false` - HQ: `false` - HQLL: `false` **Description:** Disables/enables constraints on QP variation within a picture to meet HRD requirement(s). --- **Name:** `AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE` **Values:** `true`, `false` **Default Value associated with usages:** - Transcoding: `false` - Ultra low latency: `false` - Low latency: `false` - Webcam: `false` - HQ: `true` - HQLL: `false` **Description:** Pre-analysis assisted rate control --- **Name:** `AMF_VIDEO_ENCODER_HEVC_ENABLE_VBAQ` **Values:** `true`, `false` **Default Value associated with usages:** - Transcoding: `false` - Ultra low latency: `false` - Low latency: `false` - Webcam: `false` - HQ: `true` - HQLL: `true` **Description:** By default, disable VBAQ.Note: Cannot use when RATE_CONTROL_METHOD is CQP. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_FILLER_DATA_ENABLE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Enable filler data for CBR usage. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_HIGH_MOTION_QUALITY_BOOST_ENABLE` **Values:** `true`, `false` **Default Value associated with usages:** - Transcoding: `false` - Ultra low latency: `false` - Low latency: `false` - Webcam: `false` - HQ: `true` - HQLL: `true` **Description:** Enable high motion quality boost mode to pre-analyze the motion of the video and use this information to improve encoding. --- | Name (Prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :-------------------------------------- | :-------- | | MAX_AU_SIZE | amf_int64 | | HEADER_INSERTION_MODE | amf_int64 | | GOP_SIZE | amf_int64 | | NUM_GOPS_PER_IDR | amf_int64 | | DE_BLOCKING_FILTER_DISABLE | amf_bool | | SLICES_PER_FRAME | amf_int64 | | INTRA_REFRESH_NUM_CTBS_PER_SLOT | amf_int64 | <p align="center"> Table 7. Encoder picture-control parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MAX_AU_SIZE` **Values:** `0` – `100 000 000` bits **Default Value:** `0` **Description:** Maximum AU size in bits. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE` **Values:** `AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_ENUM`: `AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_NONE` `AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_GOP_ALIGNED`, `AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_IDR_ALIGNED` **Default Value:** `AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_NONE` **Description:** Sets the headers insertion mode. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_GOP_SIZE` **Values:** `0` ... `1000` **Default Value associated with usages:** - Transcoding: `30` - Ultra low latency: `300` - Low latency: `300` - Webcam: `30` - HQ: `30` - HQLL: `30` **Description:** The period to insert IDR/CRA in fixed size mode. `0` means only insert the first IDR/CRA (infinite GOP size). --- **Name:** `AMF_VIDEO_ENCODER_HEVC_NUM_GOPS_PER_IDR` **Values:** `1` – `65535` **Default Value:** `1` **Description:** Determines the frequency to insert IDR as start of a GOP. `0` means no IDR will be inserted except for the first picture in the sequence. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_DE_BLOCKING_FILTER_DISABLE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Disable/enable the de-blocking filter. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_SLICES_PER_FRAME` **Values:** `1` - #CTBs per frame **Default Value:** `1` **Description:** Sets the number of slices per frame. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_INTRA_REFRESH_NUM_CTBS_PER_SLOT` **Values:** `0` - #CTBs per frame **Default Value:** `0` **Description:** Sets the number of intra-refresh 64x64 coding-tree-blocks per slot. --- | Name (Prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :-------------------------------------- | :-------- | | QUALITY_PRESET | amf_int64 | | PICTURE_TRANSFER_MODE | amf_int64 | | QUERY_TIMEOUT | amf_int64 | <p align="center"> Table 8. Encoder miscellaneous parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET` **Values:** `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_ENUM`: `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_BALANCED`, `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_QUALITY`, `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_SPEED` **Default Value associated with usages:** - Transcoding: `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_BALANCED` - Ultra low latency: `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_SPEED` - Low latency: `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_SPEED` - Webcam: `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_QUALITY` - HQ: `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_QUALITY` - HQLL: `AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_QUALITY` **Description:** Selects the quality preset. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE` **Values:** `AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_ENUM`: `AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_ON`, `AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_OFF` **Default Value:** `AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_OFF` **Description:** The application can turn on this flag for a specific input picture to allow dumping the reconstructed picture and/or injecting a reference picture. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_QUERY_TIMEOUT` **Values:** Timeout for QueryOutput call in ms **Default Value associated with usages:** - Transcoding: `0` (no wait) - Ultra low latency: `0` (no wait) - Low latency: `0` (no wait) - Webcam: `0` (no wait) - HQ: `50` - HQLL: `50` **Description:** Timeout for QueryOutput call in ms. --- | Name (Prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :-------------------------------------- | :------- | | MOTION_HALF_PIXEL | amf_bool | | MOTION_QUARTERPIXEL | amf_bool | <p align="center"> Table 9. Encoder motion estimation parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MOTION_HALF_PIXEL` **Values:** `true`, `false` **Default Value:** `true` **Description:** Turns on/off half-pixel motion estimation. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MOTION_QUARTERPIXEL` **Values:** `true`, `false` **Default Value:** `true` **Description:** Turns on/off quarter-pixel motion estimation. --- | Name (Prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :-------------------------------------- | :-------- | | COLOR_BIT_DEPTH | amf_int64 | | INPUT_COLOR_PROFILE | amf_int64 | | INPUT_TRANSFER_CHARACTERISTIC | amf_int64 | | INPUT_COLOR_PRIMARIES | amf_int64 | | OUTPUT_COLOR_PROFILE | amf_int64 | | OUTPUT_TRANSFER_CHARACTERISTIC | amf_int64 | | OUTPUT_COLOR_PRIMARIES | amf_int64 | <p align="center"> Table 10. Encoder color conversion parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEVC_COLOR_BIT_DEPTH` **Values:** `AMF_COLOR_BIT_DEPTH_ENUM`: `AMF_COLOR_BIT_DEPTH_UNDEFINED`, `AMF_COLOR_BIT_DEPTH_8`, `AMF_COLOR_BIT_DEPTH_10` **Default Value:** `AMF_COLOR_BIT_DEPTH_8` **Description:** Sets the number of bits in each pixel’s color component in the encoder’s compressed output bitstream. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_INPUT_COLOR_PROFILE` **Values:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM`: `AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_601`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_709`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_JPEG`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020` **Default Value:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN` **Description:** Color profile of the input surface. SDR - Setting this parameter (`COLOR_PROFILE`) can fully describe a surface for SDR use case. HDR – For HDR use case the `TRANSFER_CHARACTERISTIC`, `COLOR_PRIMARIES`, and `NOMINAL_RANGE` parameters describe the surface. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_INPUT_TRANSFER_CHARACTERISTIC` **Values:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM`: `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT709`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_RESERVED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA22`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA28`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE170M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE240M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LINEAR`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG_SQRT`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_4`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT1361_ECG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_1`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_10`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_12`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE2084`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE428`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_ARIB_STD_B67` **Default Value:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED` **Description:** Characteristic transfer function of the input surface used to perform the mapping between linear light components (tristimulus values) and a nonlinear RGB signal.Used (alongside `COLOR_PRIMARIES` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_INPUT_COLOR_PRIMARIES` **Values:** `AMF_COLOR_PRIMARIES_ENUM`: `AMF_COLOR_PRIMARIES_UNDEFINED`, `AMF_COLOR_PRIMARIES_BT709`, `AMF_COLOR_PRIMARIES_UNSPECIFIED`, `AMF_COLOR_PRIMARIES_RESERVED`, `AMF_COLOR_PRIMARIES_BT470M`, `AMF_COLOR_PRIMARIES_BT470BG`, `AMF_COLOR_PRIMARIES_SMPTE170M`, `AMF_COLOR_PRIMARIES_SMPTE240M`, `AMF_COLOR_PRIMARIES_FILM`, `AMF_COLOR_PRIMARIES_BT2020`, `AMF_COLOR_PRIMARIES_SMPTE428`, `AMF_COLOR_PRIMARIES_SMPTE431`, `AMF_COLOR_PRIMARIES_SMPTE432`, `AMF_COLOR_PRIMARIES_JEDEC_P22` **Default Value:** `AMF_COLOR_PRIMARIES_UNDEFINED` **Description:** Color space primaries for the input surface which are the maximum red, green, and blue value permitted within the color space. Used (alongside `TRANSFER_CHARACTERISTIC` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PROFILE` **Values:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM`: `AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_601`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_709`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_JPEG`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709`, `AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020` **Default Value:** `AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN` **Description:** Color profile of the compressed output stream. SDR - Setting this parameter (`COLOR_PROFILE`) can fully describe a surface for SDR use case. HDR – For HDR use case the `TRANSFER_CHARACTERISTIC`, `COLOR_PRIMARIES`, and `NOMINAL_RANGE` parameters describe the surface. Determines the optional VUI parameter `matrix_coefficients`. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_OUTPUT_TRANSFER_CHARACTERISTIC` **Values:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM`: `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT709`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_RESERVED`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA22`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA28`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE170M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE240M`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LINEAR`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG_SQRT`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_4`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT1361_ECG`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_1`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_10`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_12`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE2084`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE428`, `AMF_COLOR_TRANSFER_CHARACTERISTIC_ARIB_STD_B67` **Default Value:** `AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED` **Description:** Characteristic transfer function of the compressed output stream used to perform the mapping between linear light components (tristimulus values) and a nonlinear RGB signal. Used (alongside `COLOR_PRIMARIES` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PRIMARIES` **Values:** `AMF_COLOR_PRIMARIES_ENUM`: `AMF_COLOR_PRIMARIES_UNDEFINED`, `AMF_COLOR_PRIMARIES_BT709`, `AMF_COLOR_PRIMARIES_UNSPECIFIED`, `AMF_COLOR_PRIMARIES_RESERVED`, `AMF_COLOR_PRIMARIES_BT470M`, `AMF_COLOR_PRIMARIES_BT470BG`, `AMF_COLOR_PRIMARIES_SMPTE170M`, `AMF_COLOR_PRIMARIES_SMPTE240M`, `AMF_COLOR_PRIMARIES_FILM`, `AMF_COLOR_PRIMARIES_BT2020`, `AMF_COLOR_PRIMARIES_SMPTE428`, `AMF_COLOR_PRIMARIES_SMPTE431`, `AMF_COLOR_PRIMARIES_SMPTE432`, `AMF_COLOR_PRIMARIES_JEDEC_P22` **Default Value:** `AMF_COLOR_PRIMARIES_UNDEFINED` **Description:** Color space primaries for the compressed output surface which are the maximum red, green, and blue value permitted within the color space. Used (alongside `TRANSFER_CHARACTERISTIC` and `NOMINAL_RANGE` parameters) to describe surface in HDR use case. --- | Name (Prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :-------------------------------------- | :-------- | | NUM_TEMPORAL_LAYERS | amf_int64 | <p align="center"> Table 11. Encoder SVC parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEVC_NUM_TEMPORAL_LAYERS` **Values:** `1` … `Maximum number of temporal layers supported` **Default Value:** `1` **Description:** Sets the number of temporal layers. SVC with temporal scalability is enabled when the number of layers is greater than `1`. The maximum number of temporal layers supported is determined by the corresponding encoder capability. Remarks: Actual modification of the number of temporal layers will be delayed until the start of the next temporal GOP. Intra-refresh feature is not supported with SVC. --- | Name (Prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :-------------------------------------- | :--- | | TL<TL_Num>.QL<QL_Num>.<Parameter_name> | | <p align="center"> Table 12. Encoder SVC per-layer parameters </p> --- **Name:** `TL<TL_Num>.QL<QL_Num>.<Parameter_name>` **Values:** Parameter-specific values **Default Value:** `N\A` **Description:** Configures rate-control parameter per SVC layer. - TL_Num — temporal layer number - QL_Num — quality layer number - Parameter_name — rate-control parameter name (see below) Rate-control parameters supported: - HevcTargetBitrate - HevcPeakBitrate - HevcVBVBufferSize - HevcFrameRate - HevcMinQP_I - HevcMinQP_P - HevcMinQP_I - HevcMinQP_P - HevcQP_I - HevcQP_P - HevcFillerDataEnable - HevcRateControlSkipFrameEnable - HevcEnforceHRD - HevcMaxAUSize(Refer to rate-control parameters section of this table for details) Remarks: Quality layers are not supported. “QL0” must be used for quality layers. --- ### Table A-2. Input frame and encoded data parameters | Name (prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :-------------------------------------- | :----------------- | | INSERT_HEADER | amf_bool | | INSERT_AUD | amf_bool | | FORCE_PICTURE_TYPE | amf_int64 | | END_OF_SEQUENCE | amf_bool | | MARK_CURRENT_WITH_LTR_INDEX | amf_int64 | | FORCE_LTR_REFERENCE_BITFIELD | amf_int64 | | ROI_DATA | AMF_SURFACE_GRAY32 | | STATISTICS_FEEDBACK | amf_bool | | PSNR_FEEDBACK | amf_bool | | SSIM_FEEDBACK | amf_bool | | BLOCK_QP_FEEDBACK | amf_bool | | REFERENCE_PICTURE | AMFInterfacePtr | <p align="center"> Table 13. Frame per-submission parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEVC_INSERT_HEADER` **Values:** `true`, `false` **Default Value:** `false` **Description:** Inserts SPS, PPS and VPS. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_INSERT_AUD` **Values:** `true`, `false` **Default Value:** `false` **Description:** Inserts AUD. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE` **Values:** `AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_ENUM`: `AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_NONE`, `AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_IDR`, `AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_I`, `AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_P` **Default Value:** `AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_NONE` **Description:** Forces the picture type. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_END_OF_SEQUENCE` **Values:** `true`, `false` **Default Value:** `false` **Description:** End of sequence. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_MARK_CURRENT_WITH_LTR_INDEX` **Values:** `-1` … `MaxOfLTRFrames - 1` **Default Value:** `N/A` **Description:** If != `-1`, the current picture is coded as a long-term reference with the given index. Remarks: - When the user controls N LTRs (using the corresponding Create parameter), then the LTR Index the user can assign to a reference picture varies from `0` to `N-1`. By default, the encoder will “use up” available LTR Indices (i.e. assign them to references) even if the user does not request them to be used. - When LTR is used with SVC encoding, only base temporal layer pictures can be coded as LTR. In this case, the request to mark the current picture as LTR would be delayed to the next base temporal layer picture if the current picture is in an enhancement layer. If the user submits multiple requests to mark current as LTR between base temporal layer pictures, then only the last request is applied. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_FORCE_LTR_REFERENCE_BITFIELD` **Values:** Bitfield `MaxOfLTRFrames` (max possible 16 bits) **Default Value:** `0` **Description:** Force LTR Reference allowed bitfield. If == `0`, the current picture should predict from the default reference. If != `0`, the current picture should predict from one of the LTRs allowed by the bitfield (bit# = LTR Index#). Remarks: - E.g. if Bit#0 = `1`, then the existing LTR with LTR Index = `0` may be used for reference. The bitfield may allow more than one LTR for reference, in which case the encoder is free to choose which one to use. This bitfield also disallows existing LTRs not enabled by it from current/future reference. - E.g. if Bit#1 = `0`, and there is an existing reference with LTR Index = `1`, then this LTR Index will not be used for reference until it is replaced with a newer reference with the same LTR Index. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_ROI_DATA` **Values:** Video surface in `AMF_SURFACE_GRAY32` format **Default Value:** `N\A` **Description:** Important value for each 64x64 block ranges from `0` to `10`, stored in 32bit unsigned format. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_STATISTICS_FEEDBACK` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** Instruct encoder to collect and feedback statistics. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_PSNR_FEEDBACK` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** Signal encoder to calculate PSNR score. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_SSIM_FEEDBACK` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** Signal encoder to calculate SSIM score. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_BLOCK_QP_FEEDBACK` **Values:** `true` (`on`), `false` (`off`) **Default Value:** `false` **Description:** Instruct encoder to collect and feedback block level QP values. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_REFERENCE_PICTURE` **Values:** `AMFSurface` **Default Value:** `N/A` **Description:** Injected reference picture. Valid with PICTURE_TRANSFER_MODE turned on. --- | Name (prefix “AMF_VIDEO_ENCODER_HEVC_”) | Type | | :-------------------------------------- | :--------- | | OUTPUT_DATA_TYPE | amf_int64 | | OUTPUT_MARKED_LTR_INDEX | amf_int64 | | OUTPUT_REFERENCED_LTR_INDEX_BITFIELD | amf_int64 | | OUTPUT_TEMPORAL_LAYER | amf_int64 | | RECONSTRUCTED_PICTURE | AMFSurface | <p align="center"> Table 14. Encoded data parameters </p> --- **Name:** `AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE` **Values:** `AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_ENUM`: `AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_I`, `AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_P` **Default Value:** `N/A` **Description:** Type of encoded data. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_OUTPUT_MARKED_LTR_INDEX` **Values:** `-1` … `MaxOfLTRFrames -1` **Default Value:** `-1` **Description:** Marked as LTR Index. If != `-1`, then this picture was coded as a long-term reference with this LTR Index. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_OUTPUT_REFERENCED_LTR_INDEX_BITFIELD` **Values:** Bitfield `MaxOfLTRFrames` (max possible 16 bits) **Default Value:** `0` **Description:** Referenced LTR Index bitfield. If != `0`, this picture was coded to reference long-term references. The enabled bits identify the LTR Indices of the referenced pictures (e.g. if Bit #0 = `1`, then LTR Index 0 was used as a reference when coding this picture). --- **Name:** `AMF_VIDEO_ENCODER_HEVC_OUTPUT_TEMPORAL_LAYER` **Values:** `0` … `Maximum number of temporal layers supported - 1` **Default Value:** `N\A` **Description:** Temporal layer of the encoded picture. --- **Name:** `AMF_VIDEO_ENCODER_HEVC_RECONSTRUCTED_PICTURE` **Values:** `AMFSurface` **Default Value:** `N\A` **Description:** Reconstructed picture. Valid with `PICTURE_TRANSFER_MODE` turned on. --- ### Table A-3. Encoder statistics feedback | Statistic Name | Description | | :---------------------------------- | :------------------------------------------------------ | | STATISTIC_FRAME_QP | QP of the first encoded CTB in a picture | | STATISTIC_AVERAGE_QP | Average QP of all encoded CTBs in a picture | | STATISTIC_MAX_QP | Max QP among all encoded CTBs in a picture | | STATISTIC_MIN_QP | Min QP among all encoded CTBs in a picture | | STATISTIC_PIX_NUM_INTRA | Number of intra-coded pixels | | STATISTIC_PIX_NUM_INTER | Number of inter-coded pixels | | STATISTIC_PIX_NUM_SKIP | Number of skip-coded pixels | | STATISTIC_BITCOUNT_RESIDUAL | Frame level bit count of residual data | | STATISTIC_BITCOUNT_MOTION | Frame level bit count of motion vectors | | STATISTIC_BITCOUNT_INTER | Frame level bit count of inter CTBs | | STATISTIC_BITCOUNT_INTRA | Frame level bit count of intra CTBs | | STATISTIC_BITCOUNT_ALL_MINUS_HEADER | Frame level bit count of the bitstream excluding header | | STATISTIC_MV_X | Accumulated absolute values of MVX for full encoding | | STATISTIC_MV_Y | Accumulated absolute values of MVY for full encoding | | STATISTIC_RD_COST_FINAL | Frame level final RD cost | | STATISTIC_RD_COST_INTRA | Frame level RD cost for intra mode | | STATISTIC_RD_COST_INTER | Frame level RD cost for inter mode | | STATISTIC_SATD_FINAL | Frame level final SATD | | STATISTIC_SATD_INTRA | Frame level SATD for intra mode | | STATISTIC_SATD_INTER | Frame level SATD for inter mode | <p align="center"> Table 15. Encoder statistics feedback </p> ### Table A-4. Encoder PSNR/SSIM feedback | Statistic Name | Description | | :----------------- | :---------- | | STATISTIC_PSNR_Y | PSNR Y | | STATISTIC_PSNR_U | PSNY U | | STATISTIC_PSNR_V | PSNR V | | STATISTIC_PSNR_ALL | PSNR YUV | | STATISTIC_SSIM_Y | SSIM Y | | STATISTIC_SSIM_U | SSIM U | | STATISTIC_SSIM_V | SSIM V | | STATISTIC_SSIM_ALL | SSIM YUV | <p align="center"> Table 16. Encoder statistics feedback </p>07070100000008000081A400000000000000000000000163CFF5E700004C62000000000000000000000000000000000000003000000000AMF-1.4.29/amf/doc/AMF_Video_PreAnalysis_API.md#### Advanced Micro Devices # Advanced Media Framework – Pre-Analysis Component #### Programming Guide --- ### Disclaimer The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale. AMD, the AMD Arrow logo, ATI Radeon™, CrossFireX™, LiquidVR™, TrueAudio™ and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. Windows™, Visual Studio and DirectX are trademark of Microsoft Corp. --- ### Copyright Notice © 2013-2022 Advanced Micro Devices, Inc. All rights reserved Notice Regarding Standards. AMD does not provide a license or sublicense to any Intellectual Property Rights relating to any standards, including but not limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 (collectively, the “Media Technologies”). For clarity, you will pay any royalties due for such third-party technologies, which may include the Media Technologies that are owed as a result of AMD providing the Software to you. ### MIT license Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- ### Contents - [Advanced Media Framework – Pre-Analysis Component](#advanced-media-framework--pre-analysis-component) - [Programming Guide](#programming-guide) - [Disclaimer](#disclaimer) - [Copyright Notice](#copyright-notice) - [MIT license](#mit-license) - [Contents](#contents) - [1 Introduction](#1-introduction) - [1.1 Scope](#11-scope) - [1.2 Overview](#12-overview) - [1.3 Supported Hardware](#13-supported-hardware) - [1.4 Disclaimer](#14-disclaimer) - [2 AMF PA - Encoder Mode](#2-amf-pa---encoder-mode) - [2.1 Input / Output Format](#21-input--output-format) - [2.2 Properties](#22-properties) - [2.3 Sample Application](#23-sample-application) - [3 AMF PA - Standalone Mode](#3-amf-pa---standalone-mode) - [3.1 Input / Output Format](#31-input--output-format) - [3.2 Properties](#32-properties) - [3.3 Sample Application](#33-sample-application) - [4 Annex A: Glossary of Acronyms](#4-annex-a-glossary-of-acronyms) ## 1 Introduction ### 1.1 Scope This document describes the Pre-Analysis (PA) component of the AMD Advanced Media Framework (AMF). Full documentation on AMF can be found at https://gpuopen.com/gaming-product/advanced-media-framework/. ### 1.2 Overview The AMF PA component accepts raw input images in NV12 format. It calculates a metric for content activity of different blocks across every image, as well as video property flags such as scene change and static scene flags. In the current release, spatial complexity is used as a measure of activity inside each block. These results can be leveraged during an encode session targeting improved perceptual quality of the encoder’s reconstructed video signal, or it can be used to report information back to any other application for leverage in a way the SDK user may see fit. The AMF PA component does not alter the input images in any way; pixels within images will be inspected but no pixel value will be changed. <p align="center"> <img src="./image/highlevelPAblockdiagram.png" /> </p> <p align="center"> Figure 1 high level PA block diagram </p> The AMF PA component aims at being codec-agnostic. Content adaptive encoding using PA may also help to expand the HW encoder’s capabilities. The analysis results will be used by AMD HW encoder(s) to potentially improve the overall encoding quality. Perceptual quality improvement impacts the distribution of bits among different video units, and hence it may sometimes lead to drops in quality when measured in objective metrics such as PSNR. The AMF PA component can be used in one of two modes: encoder mode or standalone mode. In the encoder mode, the AMF PA component is instantiated as part of the AMF HW encoder pipeline. It analyzes the encoder input data before encoding. In the standalone mode, the AMF PA component is instantiated as a separate AMF component. It takes in raw video images and outputs a set of video statistics, which can be passed to third party encoder(s) or any other application(s). ### 1.3 Supported Hardware The AMF PA feature is supported by Radeon RX 5000 Series or newer GPUs as well as Ryzen 2000 U/H series or newer APUs. ### 1.4 Disclaimer The current AMF PA component is in its beta release. Existing features may get optimized over time, and new features may also be added in future releases. --- ## 2 AMF PA - Encoder Mode The AMF PA component is instantiated within the AMF Encoder component as part of the encoder’s pipeline. The encoder’s input is first pre-analyzed by PA. During encoding, when either `AMF_PA_PAQ_MODE` or `AMF_PA_TAQ_MODE` is enabled, adaptive quantization is applied based on the results generated by PA. The encoder also makes various encoding decisions based on PA results. For example, depending on whether the PA scene change detection flag is triggered or not, the encoder may force an intra encoded frame and apply a new frame QP at the new scene. The encoder may also insert a skip frame based on whether the PA static scene detection flag is triggered or not. `AMF_PA_PAQ_MODE` and `AMF_PA_TAQ_MODE` cannot work with VBAQ (`AMF_VIDEO_ENCODER_ENABLE_VBAQ`) features. When `AMF_PA_PAQ_MODE` or `AMF_PA_TAQ_MODE` is enabled, VBAQ settings are ignored. `AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE` and `AMF_PA_TAQ_MODE` both requires multiple frames lookahead. These two features take effect only when `AMF_PA_LOOKAHEAD_BUFFER_DEPTH` is set to 11,21 or 41. ### 2.1 Input / Output Format The input / output is handled by the AMF Encoder component. No special setting is needed for AMF PA. ### 2.2 Properties Table 1 shows the available parameters in AMF PA encoder mode. The list underneath provides the detailed description of these parameters. --- | Name (prefix "AMF_PA_") | Type | | :--------------------------------- | :--------------------------------------------- | | ENGINE_TYPE | AMF_MEMORY_TYPE | | ACTIVITY_TYPE | AMF_PA_ACTIVITY_TYPE_ENUM | | SCENE_CHANGE_DETECTION_ENABLE | bool | | SCENE_CHANGE_DETECTION_SENSITIVITY | AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_ENUM | | STATIC_SCENE_DETECTION_ENABLE | bool | | STATIC_SCENE_DETECTION_SENSITIVITY | AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_ENUM | | INITIAL_QP_AFTER_SCENE_CHANGE | amf_uint64 | | MAX_QP_BEFORE_FORCE_SKIP | amf_uint64 | | CAQ_STRENGTH | AMF_PA_CAQ_STRENGTH_ENUM | | FRAME_SAD_ENABLE | bool | | LTR_ENABLE | bool | | LOOKAHEAD_BUFFER_DEPTH | amf_uint64 | | PAQ_MODE | AMF_PA_PAQ_MODE_ENUM | | TAQ_MODE | AMF_PA_TAQ_MODE_ENUM | | HIGH_MOTION_QUALITY_BOOST_MODE | AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_ENUM | <p align="center"> Table 1. AMF PA properties in encoder mode </p> --- **Name:** `ENGINE_TYPE` **Values:** `AMF_MEMORY_DX11`, `AMF_MEMORY_OPENCL` **Default Value:** `AMF_MEMORY_OPENCL` **Description:** Determines what type of kernel PA uses. --- **Name:** `ACTIVITY_TYPE` **Values:** `AMF_PA_ACTIVITY_Y`, `AMF_PA_ACTIVITY_YUV` **Default Value:** `AMF_PA_ACTIVITY_Y` **Description:** Determines whether activity analysis is performed on the Luma component only (Y) or on both Luma and Chroma (YUV). --- **Name:** `SCENE_CHANGE_DETECTION_ENABLE` **Values:** `true`, `false` **Default Value:** `true` **Description:** Enables scene change detection. --- **Name:** `SCENE_CHANGE_DETECTION_SENSITIVITY` **Values:** `AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_LOW`, `AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_MEDIUM`, `AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_HIGH` **Default Value:** `AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_MEDIUM` **Description:** Sensitivity of scene change detection. The higher the sensitivity, the more restrictive it is to detect a scene change.This parameter takes effect only when AMF_PA_LOOKAHEAH_BUFFER_DEPTH is set to 0. --- **Name:** `STATIC_SCENE_DETECTION_ENABLE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Enables static scene detection. A frame in a static scene will be encoded as a skip frame if the reference frame quality is acceptable. Refer to AMF_PA_MAX_QP_BEFORE_FORCE_SKIP for details. --- **Name:** `STATIC_SCENE_DETECTION_SENSITIVITY` **Values:** `AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_LOW`, `AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_MEDIUM`, `AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_HIGH` **Default Value:** `AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_HIGH` **Description:** Sensitivity of static scene detection. The higher the sensitivity, the more restrictive it is to detect a static scene. --- **Name:** `INITIAL_QP_AFTER_SCENE_CHANGE` **Values:** `0 - 51` **Default Value:** `0` **Description:** The QP value that is used immediately after a scene change. When this parameter value equals 0, PA will automatically calculate a QP value for the new scene. --- **Name:** `MAX_QP_BEFORE_FORCE_SKIP` **Values:** `0 - 51` **Default Value:** `35` **Description:** To maintain acceptable encoding quality, a static frame is allowed to be encoded as a skip frame only when the average QP value across the blocks of the previously-encoded frame is less than or equal to this value/threshold. --- **Name:** `CAQ_STRENGTH` **Values:** `AMF_PA_CAQ_STRENGTH_LOW`, `AMF_PA_CAQ_STRENGTH_MEDIUM`, `AMF_PA_CAQ_STRENGTH_HIGH` **Default Value:** `AMF_PA_CAQ_STRENGTH_MEDIUM` **Description:** Content Adaptive Quantization strength. Stronger CAQ strength means larger variation in block level QP assignment. --- **Name:** `FRAME_SAD_ENABLE` **Values:** `true`, `false` **Default Value:** `true` **Description:** Enables Frame SAD algorithm. --- **Name:** `LTR_ENABLE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Enables automatic long term reference frame management. Last frame of a scene will be saved as LTR frame and used as reference when a similar frame occurs again. --- **Name:** `LOOKAHEAD_BUFFER_DEPTH` **Values:** `0 - MAX_LOOKAHEAD_DEPTH` **Default Value:** `0` **Description:** Sets the PA lookahead buffer size. The longer the buffer depth, the better the quality and the longer the latency. --- **Name:** `PAQ_MODE` **Values:** `AMF_PA_PAQ_MODE_NONE`, `AMF_PA_PAQ_MODE_CAQ` **Default Value:** `AMF_PA_PAQ_MODE_NONE` **Description:** Sets the perceptual adaptive quantization mode. --- **Name:** `PAQ_MODE` **Values:** `AMF_PA_TAQ_MODE_NONE`, `AMF_PA_TAQ_MODE_1`, `AMF_PA_TAQ_MODE_2` **Default Value:** `AMF_PA_TAQ_MODE_NONE` **Description:** Sets the temporal adaptive quantization mode. MODE_1 is suitable for non-gaming applications whereas MODE_2 is suitable for gaming applications. --- **Name:** `HIGH_MOTION_QUALITY_BOOST_MODE` **Values:** `AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_NONE`, `AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_AUTO` **Default Value:** `AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_NONE` **Description:** Sets the PA high motion quality boost mode to help the encoder in motion search. --- ### 2.3 Sample Application The TranscodeHW sample application in the SDK package illustrates how to setup and run AMF PA component in its encoder mode. It calculates the activity maps of the transcoder input and guides the succeeding encoding process. To enable the PA process in the encoder pipeline, use the command line parameter `-EnablePreAnalysis true`. Below is an example cmd line enabling PA: `TranscodeHW.exe -input input.mp4 -output output.mp4 -width 1920 -height 1080 -usage transcoding -qualitypreset quality -targetBitrate 5000000 -frames 1000 -engine dx11 -EnablePreAnalysis true` ## 3 AMF PA - Standalone Mode The standalone AMF PA component analyzes incoming video frames and produces an activity map for each video frame. Users also have the options to turn on the scene change detection and static scene detection features, in which cases AMF PA will return the scene change detection and/or static scene detection flags for the input frame. ### 3.1 Input / Output Format The standalone AMF PA component accepts `AMF_SURFACE_R32` surfaces as input and produces activity maps also stored in `AMF_SURFACE_R32` surfaces. The resulting activity maps consist of one activity value (32-bit unsigned) for each 16x16 pixel block. The resulting activity map and scene change/static scene flags will be attached to the video frame structure. ### 3.2 Properties Table 2 shows the available parameters in AMF PA standalone mode. The list underneath provides the detailed description of these parameters. | Name (prefix "AMF_PA_") | Type | | :--------------------------------- | :--------------------------------------------- | | ENGINE_TYPE | AMF_MEMORY_TYPE | | ACTIVITY_TYPE | AMF_PA_ACTIVITY_TYPE_ENUM | | SCENE_CHANGE_DETECTION_ENABLE | bool | | SCENE_CHANGE_DETECTION_SENSITIVITY | AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_ENUM | | STATIC_SCENE_DETECTION_ENABLE | bool | | ACTIVITY_MAP | AMFSurface* | | SCENE_CHANGE_DETECT | bool | | STATIC_SCENE_DETECT | bool | <p align="center"> Table 2. AMF PA properties in standalone mode </p> --- **Name:** `ENGINE_TYPE` **Values:** `AMF_MEMORY_DX11`, `AMF_MEMORY_OPENCL` **Default Value:** `AMF_MEMORY_OPENCL` **Description:** Determines what type of kernel PA uses. --- **Name:** `ACTIVITY_TYPE` **Values:** `AMF_PA_ACTIVITY_Y`, `AMF_PA_ACTIVITY_YUV` **Default Value:** `AMF_PA_ACTIVITY_Y` **Description:** Determines whether activity analysis is performed on the Luma component only (Y) or on both Luma and Chroma (YUV). --- **Name:** `SCENE_CHANGE_DETECTION_ENABLE` **Values:** `true`, `false` **Default Value:** `true` **Description:** Enables scene change detection. --- **Name:** `SCENE_CHANGE_DETECTION_SENSITIVITY` **Values:** `AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_LOW`, `AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_MEDIUM`, `AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_HIGH` **Default Value:** `AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_HIGH` **Description:** Sensitivity of scene change detection. The higher the sensitivity, the more restrictive it is to detect a scene change. --- **Name:** `STATIC_SCENE_DETECTION_ENABLE` **Values:** `true`, `false` **Default Value:** `false` **Description:** Enables static scene detection. A frame in a static scene will be encoded as a skip frame if the reference frame quality is acceptable. Refer to AMF_PA_MAX_QP_BEFORE_FORCE_SKIP for details. --- **Name:** `STATIC_SCENE_DETECTION_SENSITIVITY` **Values:** `AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_LOW`, `AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_MEDIUM`, `AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_HIGH` **Default Value:** `AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_MEDIUM` **Description:** Sensitivity of static scene detection. The higher the sensitivity, the more restrictive it is to detect a static scene. --- **Name:** `ACTIVITY_MAP` **Values:** `int32` **Default Value:** `N/A` **Description:** Activity map calculated for the input image where each value corresponds to one block. Properties set by PA on output buffer interface. --- **Name:** `SCENE_CHANGE_DETECT` **Values:** `true`, `false` **Default Value:** `N/A` **Description:** Scene change detection result. When this flag is true, it means the PA has identified the frame as a scene change. Properties set by PA on output buffer interface. --- **Name:** `STATIC_SCENE_DETECTION_SENSITIVITY` **Values:** `true`, `false` **Default Value:** `N/A` **Description:** Static scene detection result. When this flag is true, it means the PA has identified the frame as a static scene. Properties set by PA on output buffer interface. --- ### 3.3 Sample Application The SimplePA sample application in the AMF SDK package illustrates how to setup and run AMF PA component in standalone mode. It calculates the activity maps of machine-generated video surfaces and dumps it into a binary file. ## 4 Annex A: Glossary of Acronyms | Acronym | Definition | | ------- | :--------------------------------| | AMF | Advanced Media Framework | | PA | Pre-Analysis | | CAQ | Content Adaptive Quantization | | PAQ | Perceptual Adaptive Quantization | | TAQ | Temporal Adaptive Quantization | | SAD | Sum of absolute difference | | LTR | Long Term Reference |07070100000009000081A400000000000000000000000163CFF5E700001E9F000000000000000000000000000000000000003200000000AMF-1.4.29/amf/doc/AMF_Video_PreProcessing_API.md#### Advanced Micro Devices # Advanced Media Framework – Pre-Processing Component #### Programming Guide --- ### Disclaimer The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale. AMD, the AMD Arrow logo, ATI Radeon™, CrossFireX™, LiquidVR™, TrueAudio™ and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. Windows™, Visual Studio and DirectX are trademark of Microsoft Corp. --- ### Copyright Notice © 2013-2022 Advanced Micro Devices, Inc. All rights reserved Notice Regarding Standards. AMD does not provide a license or sublicense to any Intellectual Property Rights relating to any standards, including but not limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 (collectively, the “Media Technologies”). For clarity, you will pay any royalties due for such third-party technologies, which may include the Media Technologies that are owed as a result of AMD providing the Software to you. ### MIT license Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ### Contents 1. [Introduction](#1-introduction) - [1.1 Scope](#11-scope) - [1.2 Overview](#12-overview) - [1.3 Supported Hardware](#13-supported-hardware) - [1.4 Disclaimer](#14-disclaimer) 2. [AMF Pre-Processing](#2-amf-pre-processing) - [2.1 Input / Output Format](#21-input--output-format) - [2.2 Properties](#22-properties) - [2.3 Sample Application](#23-sample-application) 3. [Annex A: Glossary of Acronyms](#4-annex-a-glossary-of-acronyms) ## 1 Introduction ### 1.1 Scope This document describes the Pre-Processing component of the AMD Advanced Media Framework (AMF). Full documentation on AMF can be found at <https://gpuopen.com/gaming-product/advanced-media-framework/>. ### 1.2 Overview The AMF Pre-Processing component is intended to run before the HW encoder aiming at improving its coding efficiency. The AMF Pre-Processing component is instantiated as a separate AMF component. It takes in raw NV12 video surfaces and outputs the processed NV12 video images, which can be passed to a downstream component (Pre-Analysis or encoder). ### 1.3 Supported Hardware The AMF Pre-Processing component is supported by Radeon RX 5000 Series or newer GPUs as well as Ryzen 2000 U/H series or newer APUs. ### 1.4 Disclaimer The current AMF Pre-Processing component is in its beta release. Existing features may get optimized over time, and new features may also be added in future releases. ## 2 AMF Pre-Processing In the current release, the Pre-Processing component includes a JND based edge-adaptive denoising filter that helps the encoder to achieve better coding efficiency. This filter aims at removing bit-expensive high frequency details that are deemed not important for the human visual system. There are two controls for this filter: strength and sensitivity. “Strength” controls the filtering strength (how much picture details will be removed), while “sensitivity” controls the edge detection sensitivity (what regions will be filtered, as regions detected as edges will not be filtered). The AMF Pre-processing component runs on DX11 and OpenCL kernels. Since the Pre-Processing filter in the AMF Pre-Processing component currently accepts the NV12 format, the AMF Converter can be used to convert images to the compatible NV12 format before being submitted into to the Pre-Processing component. ### 2.1 Input / Output Format The AMF Pre-Processing component accepts the NV12 format as input and outputs the processed images in NV12 format as well. ### 2.2 Properties Table 1 provides the detailed description of the available parameters for AMF Pre-Processing. | Name | Type | | :--------------------------------- | :-------------- | | AMF_PP_ENGINE_TYPE | AMF_MEMORY_TYPE | | AMF_PP_ADAPTIVE_FILTER_STRENGTH | amf_int64 | | AMF_PP_ADAPTIVE_FILTER_SENSITIVITY | amf_int64 | <p align="center"> Table 2. AMF PA properties in standalone mode </p> --- **Name:** `AMF_PP_ENGINE_TYPE` **Values:** `AMF_MEMORY_HOST`, `AMF_MEMORY_DX11`, `AMF_MEMORY_OPENCL` **Default Value:** `AMF_MEMORY_OPENCL` **Description:** Determines what type of kernels the pre-processor uses. --- **Name:** `AMF_PP_ADAPTIVE_FILTER_STRENGTH` **Values:** `0` - `10` **Default Value:** `4` **Description:** Strength of the pre-processing filter. The higher the strength, the stronger the filtering. --- **Name:** `AMF_PP_ADAPTIVE_FILTER_SENSITIVITY` **Values:** `0` - `10` **Default Value:** `6` **Description:** Sensitivity to edges. The higher the value, the more likely edges will be detected, and hence the less likely filtering will occur. --- ### 2.3 Sample Application The TranscodeHW sample application in the SDK package can be used to illustrate how to enable the AMF Pre-Processing filter. When the Pre-Processing filter is enabled using `-EnablePreEncoderFilter true` TranscodeHW will filter the decoded raw images before submitting them to the encoder. Below is an example cmd line enabling the Pre-Processing filter: `TranscodeHW.exe -input input.mp4 -output output.mp4 -width 1920 -height 1080 -usage transcoding -qualitypreset quality -targetBitrate 5000000 -frames 1000 -engine dx11 -EnablePreEncodeFilter true -PPEngineType opencl -PPAdaptiveFilterStrength 4 -PPAdaptiveFilterSensitivity 6` ## 4 Annex A: Glossary of Acronyms | Acronym | Definition | | ------- | :----------------------- | | AMF | Advanced Media Framework | | PP | Pre-Processing | | PA | Pre-Analysis | 0707010000000A000081A400000000000000000000000163CFF5E7000014BC000000000000000000000000000000000000001D00000000AMF-1.4.29/amf/doc/README.md# Advanced Media Framework (AMF) SDK AMF is a light-weight, portable multimedia framework that abstracts away most of the platform and API-specific details and allows for easy implementation of multimedia applications using a variety of technologies, such as DirectX 11, OpenGL, and OpenCL and facilitates an efficient interop between them. <div> <a href="https://github.com/GPUOpen-LibrariesAndSDKs/AMF/releases/latest/"><img src="http://gpuopen-librariesandsdks.github.io/media/latest-release-button.svg" alt="Latest release" title="Latest release"></a> </div> ### Prerequisites * Windows * Windows® 7 (SP1 with the [Platform Update](https://msdn.microsoft.com/en-us/library/windows/desktop/jj863687.aspx)) (AMF v1.4.18.0 and older) * Windows® 8.1 (AMF v1.4.0.0 and older) * Windows® 10, or Windows® 11 * Windows Subsystem for Linux (DX12 Decoder and Converter Only) * Visual Studio® 2019 * Linux * RHEL 8.4 / 7.9 * CentOS 8.4 / 7.9 * Ubuntu 22.04 / 20.04.2 * SLED/SLES 15 SP3 * Driver and AMF component installation instructions are available on the [Wiki page](https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki). * The following table contains the driver versions in which the Linux pro driver started including the AMF runtime, otherwise, the AMF runtime is optional and has to be installed separately. * All supported distros include the AMF runtime starting driver version 20.40. | OS | AMF included starting version: | | ------------- |:-------------: | | SLE 15 | 18.40 | | Ubuntu 20.04.0 | 20.20 | | \**All supported distros* | 20.40 | * AMF SDK is backward compatible with all previous driver versions. * Version 1.4.29: AMD Radeon Software Adrenalin Edition 23.1.2 (22.40.01.34) or newer. Added Smart Access Video for AVC / HEVC / AV1. New options for VQEnhancer and AV1 encoder components. Switched to Markdown based API docs which enable easier open source developer contributions. * Version 1.4.28: AMD Radeon Software Adrenalin Edition 22.12.1 (22.40.00.24) or newer. Added AV1 encoding support and 12-bit AV1 decoding. New VQEnhancer component. New AVC / HEVC encoder rate control methods. * Version 1.4.26: AMD Radeon Software Adrenalin Edition 22.7.1 (22.20.15.01) or newer. Added new PAQ, TAQ, and high motion quality boost modes for PreAnalysis. New HQScaler sharpness, low latency decoder and temporal SVC encoder options. * Version 1.4.24: AMD Radeon Software Adrenalin Edition 22.3.1 (21.50.02.01) or newer. Added new AMD Direct Capture mode, new HQScaler feature(Bilinear/Bicubic/FSR), new Vulkan HEVC encoder on Navi family, improvements on H264 Vulkan encoding. * Version 1.4.23: AMD Radeon Software Adrenalin Edition 21.12.1 (21.40.11.03) or newer. Added new Auto LTR encoder mode, additional encoder usage presets and encoder statistics/feedback. * Version 1.4.21: AMD Radeon Software Adrenalin Edition 21.10.1 (21.30.25.01) or newer. Added PSNR/SSIM score feedback, new QVBR rate control mode and LTR mode for encoders, added HDR support for HEVC encoder and color converter, new EncoderLatency sample app. * Version 1.4.18: AMD Radeon Software Adrenalin Edition 20.11.2 or newer. Added Pre-Encode filter within Pre-Processing component in 1.4.18. * Version 1.4.9 or later requires Vulkan SDK for some samples: https://vulkan.lunarg.com/ and AMD Radeon Software Adrenalin Edition 18.8.1 (18.30.01.01) or newer. This version supports Linux (see amd.com for driver support) * Version 1.4.4 or later requires OCL_SDK_Light: https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK/releases. Previous versions of AMF require the AMD APP SDK (Version 3.0 or later), Windows 10 SDK (Version 10586). This version requires AMD Radeon Software Crimson Edition 17.7.2 (17.30.1041) or newer * Version 1.4: AMD Radeon Software Crimson Edition 17.1.1 (16.50.2611) or newer * Version 1.3: AMD Radeon Software Crimson Edition 16.7.3 (16.30.2311) or newer The AMF framework is compatible with most recent Radeon GPUs starting with the Southern Islands family and APUs of the Kabini, Kaveri, Carrizo families and newer. ### Getting Started * Visual Studio solutions can be found in the `amf\public\samples` directory. * Additional documentation can be found in the `amf\doc` directory. * To build samples on Linux use 'makefile' in `amf\public\samples` ### Third-Party Software * FFmpeg is distributed under the terms of the LGPLv2.1. ### Attribution * AMD, the AMD Arrow logo, Radeon, and combinations thereof are either registered trademarks or trademarks of Advanced Micro Devices, Inc. in the United States and/or other countries. * Microsoft, DirectX, Visual Studio, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. * OpenGL and the oval logo are trademarks or registered trademarks of Silicon Graphics, Inc. in the United States and/or other countries worldwide. * OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos. * Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc. 0707010000000B000041ED00000000000000000000000163CFF5E700000000000000000000000000000000000000000000002900000000AMF-1.4.29/amf/public/include/components0707010000000C000081A400000000000000000000000163CFF5E7000010ED000000000000000000000000000000000000003F00000000AMF-1.4.29/amf/public/include/components/Ambisonic2SRenderer.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // interface declaration; Ambisonic to Stereo Renderer //------------------------------------------------------------------------------------------------- #ifndef AMF_Ambisonic2SRenderer_h #define AMF_Ambisonic2SRenderer_h #pragma once #include "public/include/components/Component.h" #define AMFAmbisonic2SRendererHW L"AMFAmbisonic2SRenderer" enum AMF_AMBISONIC2SRENDERER_MODE_ENUM { AMF_AMBISONIC2SRENDERER_MODE_SIMPLE = 0, AMF_AMBISONIC2SRENDERER_MODE_HRTF_AMD0 = 1, AMF_AMBISONIC2SRENDERER_MODE_HRTF_MIT1 = 2, }; // static properties #define AMF_AMBISONIC2SRENDERER_IN_AUDIO_SAMPLE_RATE L"InSampleRate" // amf_int64 (default = 0) #define AMF_AMBISONIC2SRENDERER_IN_AUDIO_CHANNELS L"InChannels" // amf_int64 (only = 4) #define AMF_AMBISONIC2SRENDERER_IN_AUDIO_SAMPLE_FORMAT L"InSampleFormat" // amf_int64(AMF_AUDIO_FORMAT) (default = AMFAF_FLTP) #define AMF_AMBISONIC2SRENDERER_OUT_AUDIO_CHANNELS L"OutChannels" // amf_int64 (only = 2 - stereo) #define AMF_AMBISONIC2SRENDERER_OUT_AUDIO_SAMPLE_FORMAT L"OutSampleFormat" // amf_int64(AMF_AUDIO_FORMAT) (only = AMFAF_FLTP) #define AMF_AMBISONIC2SRENDERER_OUT_AUDIO_CHANNEL_LAYOUT L"OutChannelLayout" // amf_int64 (only = 3 - defalut stereo L R) #define AMF_AMBISONIC2SRENDERER_MODE L"StereoMode" //TODO: AMF_AMBISONIC2SRENDERER_MODE_ENUM(default=AMF_AMBISONIC2SRENDERER_MODE_HRTF) // dynamic properties #define AMF_AMBISONIC2SRENDERER_W L"w" //amf_int64 (default=0) #define AMF_AMBISONIC2SRENDERER_X L"x" //amf_int64 (default=1) #define AMF_AMBISONIC2SRENDERER_Y L"y" //amf_int64 (default=2) #define AMF_AMBISONIC2SRENDERER_Z L"z" //amf_int64 (default=3) #define AMF_AMBISONIC2SRENDERER_THETA L"Theta" //double (default=0.0) #define AMF_AMBISONIC2SRENDERER_PHI L"Phi" //double (default=0.0) #define AMF_AMBISONIC2SRENDERER_RHO L"Rho" //double (default=0.0) extern "C" { AMF_RESULT AMF_CDECL_CALL AMFCreateComponentAmbisonic(amf::AMFContext* pContext, void* reserved, amf::AMFComponent** ppComponent); } #endif //#ifndef AMF_Ambisonic2SRenderer_h 0707010000000D000081A400000000000000000000000163CFF5E700001219000000000000000000000000000000000000003800000000AMF-1.4.29/amf/public/include/components/AudioCapture.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // Audio session interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_AudioCapture_h #define AMF_AudioCapture_h #pragma once #include "Component.h" // Set to capture from either a microphone or desktop #define AUDIOCAPTURE_SOURCE L"AudioCaptureSource" // amf_bool true for microphone, false for desktop; // In the case of capturing a microphone, the AUDIOCAPTURE_DEVICE_ACTIVE property // can be set to -1 so that the active input devices are looked up. If the initialization // is successful then the AUDIOCAPTURE_DEVICE_NAME and AUDIOCAPTURE_DEVICE_COUNT // properties will be set. #define AUDIOCAPTURE_DEVICE_ACTIVE L"AudioCaptureDeviceActive" // amf_int64 #define AUDIOCAPTURE_DEVICE_COUNT L"AudioCaptureDeviceCount" // amf_int64 #define AUDIOCAPTURE_DEVICE_NAME L"AudioCaptureDeviceName" // String // Codec used for audio capture #define AUDIOCAPTURE_CODEC L"AudioCaptureCodec" // amf_int64, AV_CODEC_ID_PCM_F32LE // Sample rate used for audio capture #define AUDIOCAPTURE_SAMPLERATE L"AudioCaptureSampleRate" // amf_int64, 44100 in samples // Sample count used for audio capture #define AUDIOCAPTURE_SAMPLES L"AudioCaptureSampleCount" // amf_int64, 1024 // Bitrate used for audio capture #define AUDIOCAPTURE_BITRATE L"AudioCaptureBitRate" // amf_int64, in bits // Channel count used for audio capture #define AUDIOCAPTURE_CHANNELS L"AudioCaptureChannelCount" // amf_int64, 2 // Channel layout used for audio capture #define AUDIOCAPTURE_CHANNEL_LAYOUT L"AudioCaptureChannelLayout" // amf_int64, AMF_AUDIO_CHANNEL_LAYOUT // Format used for audio capture #define AUDIOCAPTURE_FORMAT L"AudioCaptureFormat" // amf_int64, AMFAF_U8 // Block alignment #define AUDIOCAPTURE_BLOCKALIGN L"AudioCaptureBlockAlign" // amf_int64, bytes // Audio frame size #define AUDIOCAPTURE_FRAMESIZE L"AudioCaptureFrameSize" // amf_int64, bytes // Audio low latency state #define AUDIOCAPTURE_LOWLATENCY L"AudioCaptureLowLatency" // amf_int64; // Optional interface that provides current time #define AUDIOCAPTURE_CURRENT_TIME_INTERFACE L"CurrentTimeInterface" // interface to current time object extern "C" { // Component that allows the recording of inputs such as microphones or the audio that is being // rendered. The direction that is captured is controlled by the AUDIOCAPTURE_CAPTURE property // AMF_RESULT AMF_CDECL_CALL AMFCreateComponentAudioCapture(amf::AMFContext* pContext, amf::AMFComponent** ppComponent); } #endif // #ifndef AMF_AudioCapture_h 0707010000000E000081A400000000000000000000000163CFF5E700002857000000000000000000000000000000000000003300000000AMF-1.4.29/amf/public/include/components/Capture.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // Capture interface declaration //------------------------------------------------------------------------------------------------- #ifndef __Capture_h__ #define __Capture_h__ #pragma once #include "../../../public/include/components/Component.h" typedef enum AMF_CAPTURE_DEVICE_TYPE_ENUM { AMF_CAPTURE_DEVICE_UNKNOWN = 0, AMF_CAPTURE_DEVICE_MEDIAFOUNDATION = 1, AMF_CAPTURE_DEVICE_WASAPI = 2, AMF_CAPTURE_DEVICE_SDI = 3, AMF_CAPTURE_DEVICE_SCREEN_DUPLICATION = 4, } AMF_CAPTURE_DEVICE_TYPE_ENUM; // device properties #define AMF_CAPTURE_DEVICE_TYPE L"DeviceType" // amf_int64( AMF_CAPTURE_DEVICE_TYPE_ENUM ) #define AMF_CAPTURE_DEVICE_NAME L"DeviceName" // wchar_t* : name of the device #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- // AMFCaptureDevice interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFCaptureDevice : public AMFComponentEx { public: AMF_DECLARE_IID (0x5bfd1b17, 0x9f2a, 0x43c4, 0x9c, 0xdd, 0x2c, 0x3, 0x88, 0x43, 0xb5, 0xf3) virtual AMF_RESULT AMF_STD_CALL Start() = 0; virtual AMF_RESULT AMF_STD_CALL Stop() = 0; // TODO add callback interface for disconnected / lost / changed device notification }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFCaptureDevice> AMFCaptureDevicePtr; //---------------------------------------------------------------------------------------------- #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFCaptureDevice, 0x5bfd1b17, 0x9f2a, 0x43c4, 0x9c, 0xdd, 0x2c, 0x3, 0x88, 0x43, 0xb5, 0xf3) typedef struct AMFCaptureDeviceVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFCaptureDevice* pThis); amf_long (AMF_STD_CALL *Release)(AMFCaptureDevice* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFCaptureDevice* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFCaptureDevice* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFCaptureDevice* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFCaptureDevice* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFCaptureDevice* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFCaptureDevice* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFCaptureDevice* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFCaptureDevice* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFCaptureDevice* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFCaptureDevice* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFCaptureDevice* pThis, AMFPropertyStorageObserver* pObserver); // AMFPropertyStorageEx interface amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFCaptureDevice* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFCaptureDevice* pThis, amf_size index, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFCaptureDevice* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFCaptureDevice* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated); // AMFComponent interface AMF_RESULT (AMF_STD_CALL *Init)(AMFCaptureDevice* pThis, AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height); AMF_RESULT (AMF_STD_CALL *ReInit)(AMFCaptureDevice* pThis, amf_int32 width,amf_int32 height); AMF_RESULT (AMF_STD_CALL *Terminate)(AMFCaptureDevice* pThis); AMF_RESULT (AMF_STD_CALL *Drain)(AMFCaptureDevice* pThis); AMF_RESULT (AMF_STD_CALL *Flush)(AMFCaptureDevice* pThis); AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFCaptureDevice* pThis, AMFData* pData); AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFCaptureDevice* pThis, AMFData** ppData); AMFContext* (AMF_STD_CALL *GetContext)(AMFCaptureDevice* pThis); AMF_RESULT (AMF_STD_CALL *SetOutputDataAllocatorCB)(AMFCaptureDevice* pThis, AMFDataAllocatorCB* callback); AMF_RESULT (AMF_STD_CALL *GetCaps)(AMFCaptureDevice* pThis, AMFCaps** ppCaps); AMF_RESULT (AMF_STD_CALL *Optimize)(AMFCaptureDevice* pThis, AMFComponentOptimizationCallback* pCallback); // AMFComponentEx interface amf_int32 (AMF_STD_CALL *GetInputCount)(AMFCaptureDevice* pThis); amf_int32 (AMF_STD_CALL *GetOutputCount)(AMFCaptureDevice* pThis); AMF_RESULT (AMF_STD_CALL *GetInput)(AMFCaptureDevice* pThis, amf_int32 index, AMFInput** ppInput); AMF_RESULT (AMF_STD_CALL *GetOutput)(AMFCaptureDevice* pThis, amf_int32 index, AMFOutput** ppOutput); // AMFCaptureDevice interface AMF_RESULT (AMF_STD_CALL *Start)(AMFCaptureDevice* pThis); AMF_RESULT (AMF_STD_CALL *Stop)(AMFCaptureDevice* pThis); } AMFCaptureVtbl; struct AMFCapture { const AMFCaptureVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFCaptureManager interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFCaptureManager : public AMFInterface { public: AMF_DECLARE_IID ( 0xf64d2f0d, 0xad16, 0x4ce7, 0x80, 0x5f, 0xa1, 0xe7, 0x3b, 0x0, 0xf4, 0x28) virtual AMF_RESULT AMF_STD_CALL Update() = 0; virtual amf_int32 AMF_STD_CALL GetDeviceCount() = 0; virtual AMF_RESULT AMF_STD_CALL GetDevice(amf_int32 index,AMFCaptureDevice **pDevice) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFCaptureManager> AMFCaptureManagerPtr; //---------------------------------------------------------------------------------------------- #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFCaptureManager, 0xf64d2f0d, 0xad16, 0x4ce7, 0x80, 0x5f, 0xa1, 0xe7, 0x3b, 0x0, 0xf4, 0x28) typedef struct AMFCaptureManagerVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFCaptureManager* pThis); amf_long (AMF_STD_CALL *Release)(AMFCaptureManager* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFCaptureManager* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFCaptureManager interface AMF_RESULT (AMF_STD_CALL *Update)((AMFCaptureManager* pThis); amf_int32 (AMF_STD_CALL *GetDeviceCount)(AMFCaptureManager* pThis); AMF_RESULT (AMF_STD_CALL *GetDevice)(AMFCaptureManager* pThis, amf_int32 index,AMFCaptureDevice **pDevice); } AMFCaptureManagerVtbl; struct AMFCaptureManager { const AMFCaptureManagerVtbl *pVtbl; }; #endif // #if defined(__cplusplus) #if defined(__cplusplus) } // namespace #endif extern "C" { AMF_RESULT AMF_CDECL_CALL AMFCreateCaptureManager(amf::AMFContext* pContext, amf::AMFCaptureManager** ppManager); } #endif // __Capture_h__0707010000000F000081A400000000000000000000000163CFF5E700001349000000000000000000000000000000000000003500000000AMF-1.4.29/amf/public/include/components/ChromaKey.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** *************************************************************************************************** * @file ChromaKey.h * @brief AMFChromaKey interface declaration *************************************************************************************************** */ #ifndef __AMFChromaKey_h__ #define __AMFChromaKey_h__ #pragma once #include "public/include/components/Component.h" #define AMFChromaKey L"AMFChromaKey" // static properties #define AMF_CHROMAKEY_COLOR L"ChromaKeyColor" // amf_uint64 (default=0x992A1E), YUV Green key Color #define AMF_CHROMAKEY_COLOR_EX L"ChromaKeyColorEX" // amf_uint64 (default=0), YUV Green key Color, secondary #define AMF_CHROMAKEY_RANGE_MIN L"ChromaKeyRangeMin" // amf_uint64 (default=20) color tolerance low, 0~255 #define AMF_CHROMAKEY_RANGE_MAX L"ChromaKeyRangeMax" // amf_uint64 (default=22) color tolerance high, 0~255 #define AMF_CHROMAKEY_RANGE_EXT L"ChromaKeyRangeExt" // amf_uint64 (default=40) color tolerance extended, 0~255 #define AMF_CHROMAKEY_SPILL_MODE L"ChromaKeySpillMode" // amf_uint64 (default=0) spill suppression mode #define AMF_CHROMAKEY_RANGE_SPILL L"ChromaKeyRangeSpill" // amf_uint64 (default=5) spill suppression threshold #define AMF_CHROMAKEY_LUMA_LOW L"ChromaKeyLumaLow" // amf_uint64 (default=16) minimum luma value for processing #define AMF_CHROMAKEY_INPUT_COUNT L"InputCount" // amf_uint64 (default=2) number of inputs #define AMF_CHROMAKEY_COLOR_POS L"KeyColorPos" // amf_uint64 (default=0) key color position from the surface #define AMF_CHROMAKEY_OUT_FORMAT L"ChromaKeyOutFormat" // amf_uint64 (default=RGBA) output format #define AMF_CHROMAKEY_MEMORY_TYPE L"ChromaKeyMemoryType" // amf_uint64 (default=DX11) mmeory type #define AMF_CHROMAKEY_COLOR_ADJ L"ChromaKeyColorAdj" // amf_uint64 (default=0) endble color adjustment #define AMF_CHROMAKEY_COLOR_ADJ_THRE L"ChromaKeyColorAdjThre" // amf_uint64 (default=0) color adjustment threshold #define AMF_CHROMAKEY_COLOR_ADJ_THRE2 L"ChromaKeyColorAdjThre2" // amf_uint64 (default=0) color adjustment threshold #define AMF_CHROMAKEY_BYPASS L"ChromaKeyBypass" // amf_uint64 (default=0) disable chromakey #define AMF_CHROMAKEY_EDGE L"ChromaKeyEdge" // amf_uint64 (default=0) endble edge detection #define AMF_CHROMAKEY_BOKEH L"ChromaKeyBokeh" // amf_uint64 (default=0) endble background bokeh #define AMF_CHROMAKEY_BOKEH_RADIUS L"ChromaKeyBokehRadius" // amf_uint64 (default=7) background bokeh radius #define AMF_CHROMAKEY_DEBUG L"ChromaKeyDebug" // amf_uint64 (default=0) endble debug mode #define AMF_CHROMAKEY_POSX L"ChromaKeyPosX" // amf_uint64 (default=0) positionX #define AMF_CHROMAKEY_POSY L"ChromaKeyPosY" // amf_uint64 (default=0) positionY extern "C" { AMF_RESULT AMF_CDECL_CALL AMFCreateComponentChromaKey(amf::AMFContext* pContext, amf::AMFComponentEx** ppComponent); } #endif //#ifndef __AMFChromaKey_h__ 07070100000010000081A400000000000000000000000163CFF5E700001C6C000000000000000000000000000000000000003600000000AMF-1.4.29/amf/public/include/components/ColorSpace.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // Color Spacedeclaration //------------------------------------------------------------------------------------------------- #ifndef AMF_ColorSpace_h #define AMF_ColorSpace_h #pragma once // YUV <--> RGB conversion matrix with range typedef enum AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM { AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN =-1, AMF_VIDEO_CONVERTER_COLOR_PROFILE_601 = 0, // studio range AMF_VIDEO_CONVERTER_COLOR_PROFILE_709 = 1, // studio range AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020 = 2, // studio range AMF_VIDEO_CONVERTER_COLOR_PROFILE_JPEG = 3, // full range 601 // AMF_VIDEO_CONVERTER_COLOR_PROFILE_G22_BT709 = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709, // AMF_VIDEO_CONVERTER_COLOR_PROFILE_G10_SCRGB = 4, // AMF_VIDEO_CONVERTER_COLOR_PROFILE_G10_BT709 = 5, // AMF_VIDEO_CONVERTER_COLOR_PROFILE_G10_BT2020 = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020, // AMF_VIDEO_CONVERTER_COLOR_PROFILE_G2084_BT2020 = 6, AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601 = AMF_VIDEO_CONVERTER_COLOR_PROFILE_JPEG, // full range AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709 = 7, // full range AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020 = 8, // full range AMF_VIDEO_CONVERTER_COLOR_PROFILE_COUNT } AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM; typedef enum AMF_COLOR_PRIMARIES_ENUM // as in VUI color_primaries AVC and HEVC { AMF_COLOR_PRIMARIES_UNDEFINED = 0, AMF_COLOR_PRIMARIES_BT709 = 1, AMF_COLOR_PRIMARIES_UNSPECIFIED = 2, AMF_COLOR_PRIMARIES_RESERVED = 3, AMF_COLOR_PRIMARIES_BT470M = 4, AMF_COLOR_PRIMARIES_BT470BG = 5, AMF_COLOR_PRIMARIES_SMPTE170M = 6, AMF_COLOR_PRIMARIES_SMPTE240M = 7, AMF_COLOR_PRIMARIES_FILM = 8, AMF_COLOR_PRIMARIES_BT2020 = 9, AMF_COLOR_PRIMARIES_SMPTE428 = 10, AMF_COLOR_PRIMARIES_SMPTE431 = 11, AMF_COLOR_PRIMARIES_SMPTE432 = 12, AMF_COLOR_PRIMARIES_JEDEC_P22 = 22, AMF_COLOR_PRIMARIES_CCCS = 1000, // Common Composition Color Space or scRGB } AMF_COLOR_PRIMARIES_ENUM; typedef enum AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM // as in VUI transfer_characteristic AVC and HEVC { AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED = 0, AMF_COLOR_TRANSFER_CHARACTERISTIC_BT709 = 1, //BT709 AMF_COLOR_TRANSFER_CHARACTERISTIC_UNSPECIFIED = 2, AMF_COLOR_TRANSFER_CHARACTERISTIC_RESERVED = 3, AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA22 = 4, //BT470_M AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA28 = 5, //BT470 AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE170M = 6, //BT601 AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE240M = 7, //SMPTE 240M AMF_COLOR_TRANSFER_CHARACTERISTIC_LINEAR = 8, AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG = 9, //LOG10 AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG_SQRT = 10,//LOG10 SQRT AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_4 = 11, AMF_COLOR_TRANSFER_CHARACTERISTIC_BT1361_ECG = 12, AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_1 = 13, AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_10 = 14, //BT709 AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_12 = 15, //BT709 AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE2084 = 16, //PQ AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE428 = 17, AMF_COLOR_TRANSFER_CHARACTERISTIC_ARIB_STD_B67 = 18, //HLG } AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM; typedef enum AMF_COLOR_BIT_DEPTH_ENUM { AMF_COLOR_BIT_DEPTH_UNDEFINED = 0, AMF_COLOR_BIT_DEPTH_8 = 8, AMF_COLOR_BIT_DEPTH_10 = 10, } AMF_COLOR_BIT_DEPTH_ENUM; typedef struct AMFHDRMetadata { amf_uint16 redPrimary[2]; // normalized to 50000 amf_uint16 greenPrimary[2]; // normalized to 50000 amf_uint16 bluePrimary[2]; // normalized to 50000 amf_uint16 whitePoint[2]; // normalized to 50000 amf_uint32 maxMasteringLuminance; // normalized to 10000 amf_uint32 minMasteringLuminance; // normalized to 10000 amf_uint16 maxContentLightLevel; // nit value amf_uint16 maxFrameAverageLightLevel; // nit value } AMFHDRMetadata; typedef enum AMF_COLOR_RANGE_ENUM { AMF_COLOR_RANGE_UNDEFINED = 0, AMF_COLOR_RANGE_STUDIO = 1, AMF_COLOR_RANGE_FULL = 2, } AMF_COLOR_RANGE_ENUM; // these properties can be set on input or outout surface // IDs are the same as in decoder properties // can be used to dynamically pass color data between components: // Decoder, Capture, Encoder. Presenter etc. #define AMF_VIDEO_COLOR_TRANSFER_CHARACTERISTIC L"ColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 Section 7.2 See ColorSpace.h for enum #define AMF_VIDEO_COLOR_PRIMARIES L"ColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 Section 7.1 See ColorSpace.h for enum #define AMF_VIDEO_COLOR_RANGE L"ColorRange" // amf_int64(AMF_COLOR_RANGE_ENUM) default = AMF_COLOR_RANGE_UNDEFINED #define AMF_VIDEO_COLOR_HDR_METADATA L"HdrMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL #endif //#ifndef AMF_ColorSpace_h 07070100000011000081A400000000000000000000000163CFF5E700006331000000000000000000000000000000000000003500000000AMF-1.4.29/amf/public/include/components/Component.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** *************************************************************************************************** * @file Component.h * @brief AMFComponent interface declaration *************************************************************************************************** */ #ifndef AMF_Component_h #define AMF_Component_h #pragma once #include "../core/Data.h" #include "../core/PropertyStorageEx.h" #include "../core/Surface.h" #include "../core/Context.h" #include "ComponentCaps.h" #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- // AMFDataAllocatorCB interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFDataAllocatorCB : public AMFInterface { public: AMF_DECLARE_IID(0x4bf46198, 0x8b7b, 0x49d0, 0xaa, 0x72, 0x48, 0xd4, 0x7, 0xce, 0x24, 0xc5 ) virtual AMF_RESULT AMF_STD_CALL AllocBuffer(AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer) = 0; virtual AMF_RESULT AMF_STD_CALL AllocSurface(AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, AMFSurface** ppSurface) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFDataAllocatorCB> AMFDataAllocatorCBPtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFDataAllocatorCB, 0x4bf46198, 0x8b7b, 0x49d0, 0xaa, 0x72, 0x48, 0xd4, 0x7, 0xce, 0x24, 0xc5 ) typedef struct AMFDataAllocatorCB AMFDataAllocatorCB; typedef struct AMFDataAllocatorCBVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFDataAllocatorCB* pThis); amf_long (AMF_STD_CALL *Release)(AMFDataAllocatorCB* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFDataAllocatorCB* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFDataAllocatorCB interface AMF_RESULT (AMF_STD_CALL *AllocBuffer)(AMFDataAllocatorCB* pThis, AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer); AMF_RESULT (AMF_STD_CALL *AllocSurface)(AMFDataAllocatorCB* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, AMFSurface** ppSurface); } AMFDataAllocatorCBVtbl; struct AMFDataAllocatorCB { const AMFDataAllocatorCBVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFComponentOptimizationCallback { public: virtual AMF_RESULT AMF_STD_CALL OnComponentOptimizationProgress(amf_uint percent) = 0; }; #else // #if defined(__cplusplus) typedef struct AMFComponentOptimizationCallback AMFComponentOptimizationCallback; typedef struct AMFComponentOptimizationCallbackVtbl { // AMFDataAllocatorCB interface AMF_RESULT (AMF_STD_CALL *OnComponentOptimizationProgress)(AMFComponentOptimizationCallback* pThis, amf_uint percent); } AMFComponentOptimizationCallbackVtbl; struct AMFComponentOptimizationCallback { const AMFComponentOptimizationCallbackVtbl *pVtbl; }; #endif //#if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFComponent interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFComponent : public AMFPropertyStorageEx { public: AMF_DECLARE_IID(0x8b51e5e4, 0x455d, 0x4034, 0xa7, 0x46, 0xde, 0x1b, 0xed, 0xc3, 0xc4, 0x6) virtual AMF_RESULT AMF_STD_CALL Init(AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height) = 0; virtual AMF_RESULT AMF_STD_CALL ReInit(amf_int32 width,amf_int32 height) = 0; virtual AMF_RESULT AMF_STD_CALL Terminate() = 0; virtual AMF_RESULT AMF_STD_CALL Drain() = 0; virtual AMF_RESULT AMF_STD_CALL Flush() = 0; virtual AMF_RESULT AMF_STD_CALL SubmitInput(AMFData* pData) = 0; virtual AMF_RESULT AMF_STD_CALL QueryOutput(AMFData** ppData) = 0; virtual AMFContext* AMF_STD_CALL GetContext() = 0; virtual AMF_RESULT AMF_STD_CALL SetOutputDataAllocatorCB(AMFDataAllocatorCB* callback) = 0; virtual AMF_RESULT AMF_STD_CALL GetCaps(AMFCaps** ppCaps) = 0; virtual AMF_RESULT AMF_STD_CALL Optimize(AMFComponentOptimizationCallback* pCallback) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFComponent> AMFComponentPtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFComponent, 0x8b51e5e4, 0x455d, 0x4034, 0xa7, 0x46, 0xde, 0x1b, 0xed, 0xc3, 0xc4, 0x6) typedef struct AMFComponent AMFComponent; typedef struct AMFComponentVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFComponent* pThis); amf_long (AMF_STD_CALL *Release)(AMFComponent* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComponent* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFComponent* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFComponent* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFComponent* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFComponent* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFComponent* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFComponent* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFComponent* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFComponent* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFComponent* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFComponent* pThis, AMFPropertyStorageObserver* pObserver); // AMFPropertyStorageEx interface amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFComponent* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFComponent* pThis, amf_size index, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFComponent* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFComponent* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated); // AMFComponent interface AMF_RESULT (AMF_STD_CALL *Init)(AMFComponent* pThis, AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height); AMF_RESULT (AMF_STD_CALL *ReInit)(AMFComponent* pThis, amf_int32 width,amf_int32 height); AMF_RESULT (AMF_STD_CALL *Terminate)(AMFComponent* pThis); AMF_RESULT (AMF_STD_CALL *Drain)(AMFComponent* pThis); AMF_RESULT (AMF_STD_CALL *Flush)(AMFComponent* pThis); AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFComponent* pThis, AMFData* pData); AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFComponent* pThis, AMFData** ppData); AMFContext* (AMF_STD_CALL *GetContext)(AMFComponent* pThis); AMF_RESULT (AMF_STD_CALL *SetOutputDataAllocatorCB)(AMFComponent* pThis, AMFDataAllocatorCB* callback); AMF_RESULT (AMF_STD_CALL *GetCaps)(AMFComponent* pThis, AMFCaps** ppCaps); AMF_RESULT (AMF_STD_CALL *Optimize)(AMFComponent* pThis, AMFComponentOptimizationCallback* pCallback); } AMFComponentVtbl; struct AMFComponent { const AMFComponentVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFInput interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFInput : public AMFPropertyStorageEx { public: AMF_DECLARE_IID(0x1181eee7, 0x95f2, 0x434a, 0x9b, 0x96, 0xea, 0x55, 0xa, 0xa7, 0x84, 0x89) virtual AMF_RESULT AMF_STD_CALL SubmitInput(AMFData* pData) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFInput> AMFInputPtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFInput, 0x1181eee7, 0x95f2, 0x434a, 0x9b, 0x96, 0xea, 0x55, 0xa, 0xa7, 0x84, 0x89) typedef struct AMFInput AMFInput; typedef struct AMFInputVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFInput* pThis); amf_long (AMF_STD_CALL *Release)(AMFInput* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFInput* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFInput* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFInput* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFInput* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFInput* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFInput* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFInput* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFInput* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFInput* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFInput* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFInput* pThis, AMFPropertyStorageObserver* pObserver); // AMFPropertyStorageEx interface amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFInput* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFInput* pThis, amf_size index, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFInput* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFInput* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated); // AMFInput interface AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFInput* pThis, AMFData* pData); } AMFInputVtbl; struct AMFInput { const AMFInputVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFOutput interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFOutput : public AMFPropertyStorageEx { public: AMF_DECLARE_IID(0x86a8a037, 0x912c, 0x4698, 0xb0, 0x46, 0x7, 0x5a, 0x1f, 0xac, 0x6b, 0x97) virtual AMF_RESULT AMF_STD_CALL QueryOutput(AMFData** ppData) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFOutput> AMFOutputPtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFOutput, 0x86a8a037, 0x912c, 0x4698, 0xb0, 0x46, 0x7, 0x5a, 0x1f, 0xac, 0x6b, 0x97) typedef struct AMFOutput AMFOutput; typedef struct AMFOutputVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFOutput* pThis); amf_long (AMF_STD_CALL *Release)(AMFOutput* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFOutput* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFOutput* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFOutput* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFOutput* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFOutput* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFOutput* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFOutput* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFOutput* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFOutput* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFOutput* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFOutput* pThis, AMFPropertyStorageObserver* pObserver); // AMFPropertyStorageEx interface amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFOutput* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFOutput* pThis, amf_size index, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFOutput* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFOutput* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated); // AMFOutput interface AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFOutput* pThis, AMFData** ppData); } AMFOutputVtbl; struct AMFOutput { const AMFOutputVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFComponent interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFComponentEx : public AMFComponent { public: AMF_DECLARE_IID(0xfda792af, 0x8712, 0x44df, 0x8e, 0xa0, 0xdf, 0xfa, 0xad, 0x2c, 0x80, 0x93) virtual amf_int32 AMF_STD_CALL GetInputCount() = 0; virtual amf_int32 AMF_STD_CALL GetOutputCount() = 0; virtual AMF_RESULT AMF_STD_CALL GetInput(amf_int32 index, AMFInput** ppInput) = 0; virtual AMF_RESULT AMF_STD_CALL GetOutput(amf_int32 index, AMFOutput** ppOutput) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFComponentEx> AMFComponentExPtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFComponentEx, 0xfda792af, 0x8712, 0x44df, 0x8e, 0xa0, 0xdf, 0xfa, 0xad, 0x2c, 0x80, 0x93) typedef struct AMFComponentEx AMFComponentEx; typedef struct AMFComponentExVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFComponentEx* pThis); amf_long (AMF_STD_CALL *Release)(AMFComponentEx* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComponentEx* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFComponentEx* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFComponentEx* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFComponentEx* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFComponentEx* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFComponentEx* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFComponentEx* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFComponentEx* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFComponentEx* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFComponentEx* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFComponentEx* pThis, AMFPropertyStorageObserver* pObserver); // AMFPropertyStorageEx interface amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFComponentEx* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFComponentEx* pThis, amf_size index, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFComponentEx* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFComponentEx* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated); // AMFComponent interface AMF_RESULT (AMF_STD_CALL *Init)(AMFComponentEx* pThis, AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height); AMF_RESULT (AMF_STD_CALL *ReInit)(AMFComponentEx* pThis, amf_int32 width,amf_int32 height); AMF_RESULT (AMF_STD_CALL *Terminate)(AMFComponentEx* pThis); AMF_RESULT (AMF_STD_CALL *Drain)(AMFComponentEx* pThis); AMF_RESULT (AMF_STD_CALL *Flush)(AMFComponentEx* pThis); AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFComponentEx* pThis, AMFData* pData); AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFComponentEx* pThis, AMFData** ppData); AMFContext* (AMF_STD_CALL *GetContext)(AMFComponentEx* pThis); AMF_RESULT (AMF_STD_CALL *SetOutputDataAllocatorCB)(AMFComponentEx* pThis, AMFDataAllocatorCB* callback); AMF_RESULT (AMF_STD_CALL *GetCaps)(AMFComponentEx* pThis, AMFCaps** ppCaps); AMF_RESULT (AMF_STD_CALL *Optimize)(AMFComponentEx* pThis, AMFComponentOptimizationCallback* pCallback); // AMFComponentEx interface amf_int32 (AMF_STD_CALL *GetInputCount)(AMFComponentEx* pThis); amf_int32 (AMF_STD_CALL *GetOutputCount)(AMFComponentEx* pThis); AMF_RESULT (AMF_STD_CALL *GetInput)(AMFComponentEx* pThis, amf_int32 index, AMFInput** ppInput); AMF_RESULT (AMF_STD_CALL *GetOutput)(AMFComponentEx* pThis, amf_int32 index, AMFOutput** ppOutput); } AMFComponentExVtbl; struct AMFComponentEx { const AMFComponentExVtbl *pVtbl; }; #endif // #if defined(__cplusplus) #if defined(__cplusplus) } // namespace #endif typedef enum AMF_STREAM_TYPE_ENUM { AMF_STREAM_UNKNOWN = 0, AMF_STREAM_VIDEO = 1, AMF_STREAM_AUDIO = 2, AMF_STREAM_DATA = 3, } AMF_STREAM_TYPE_ENUM; typedef enum AMF_STREAM_CODEC_ID_ENUM // matched codecs from VideoDecoxcderUVD.h { AMF_STREAM_CODEC_ID_UNKNOWN = 0, AMF_STREAM_CODEC_ID_MPEG2 = 1, // AMFVideoDecoderUVD_MPEG2 AMF_STREAM_CODEC_ID_MPEG4 = 2, // AMFVideoDecoderUVD_MPEG4 AMF_STREAM_CODEC_ID_WMV3 = 3, // AMFVideoDecoderUVD_WMV3 AMF_STREAM_CODEC_ID_VC1 = 4, // AMFVideoDecoderUVD_VC1 AMF_STREAM_CODEC_ID_H264_AVC = 5, // AMFVideoDecoderUVD_H264_AVC AMF_STREAM_CODEC_ID_H264_MVC = 6, // AMFVideoDecoderUVD_H264_MVC AMF_STREAM_CODEC_ID_H264_SVC = 7, // AMFVideoDecoderUVD_H264_SVC AMF_STREAM_CODEC_ID_MJPEG = 8, // AMFVideoDecoderUVD_MJPEG AMF_STREAM_CODEC_ID_H265_HEVC = 9, // AMFVideoDecoderHW_H265_HEVC AMF_STREAM_CODEC_ID_H265_MAIN10 = 10, // AMFVideoDecoderHW_H265_MAIN10 AMF_STREAM_CODEC_ID_VP9 = 11, // AMFVideoDecoderHW_VP9 AMF_STREAM_CODEC_ID_VP9_10BIT = 12, // AMFVideoDecoderHW_VP9_10BIT AMF_STREAM_CODEC_ID_AV1 = 13, // AMFVideoDecoderHW_AV1 AMF_STREAM_CODEC_ID_AV1_12BIT = 14, // AMFVideoDecoderHW_AV1_12BIT } AMF_STREAM_CODEC_ID_ENUM; // common stream properties #define AMF_STREAM_TYPE L"StreamType" // amf_int64( AMF_STREAM_TYPE_ENUM ) #define AMF_STREAM_ENABLED L"Enabled" // bool( default = false ) #define AMF_STREAM_CODEC_ID L"CodecID" // amf_int64(Video: AMF_STREAM_CODEC_ID_ENUM, Audio: AVCodecID) (default = 0 - uncompressed) #define AMF_STREAM_BIT_RATE L"BitRate" // amf_int64 (default = codec->bit_rate) #define AMF_STREAM_EXTRA_DATA L"ExtraData" // interface to AMFBuffer - as is from FFMPEG // video stream properties #define AMF_STREAM_VIDEO_MEMORY_TYPE L"VideoMemoryType" // amf_int64(AMF_MEMORY_TYPE); default = AMF_MEMORY_DX11 #define AMF_STREAM_VIDEO_FORMAT L"VideoFormat" // amf_int64(AMF_SURFACE_FORMAT); default = AMF_SURFACE_NV12 (used if AMF_STREAM_CODEC_ID == 0) #define AMF_STREAM_VIDEO_FRAME_RATE L"VideoFrameRate" // AMFRate; default = (30,1) - video frame rate #define AMF_STREAM_VIDEO_FRAME_SIZE L"VideoFrameSize" // AMFSize; default = (1920,1080) - video frame rate #define AMF_STREAM_VIDEO_SURFACE_POOL L"VideoSurfacePool" // amf_int64; default = 5, number of allocated output surfaces //TODO support interlaced frames // audio stream properties #define AMF_STREAM_AUDIO_FORMAT L"AudioFormat" // amf_int64(AMF_AUDIO_FORMAT); default = AMFAF_S16 #define AMF_STREAM_AUDIO_SAMPLE_RATE L"AudioSampleRate" // amf_int64; default = 48000 #define AMF_STREAM_AUDIO_CHANNELS L"AudioChannels" // amf_int64; default = 2 #define AMF_STREAM_AUDIO_CHANNEL_LAYOUT L"AudioChannelLayout" // amf_int64 (default = codec->channel_layout) #define AMF_STREAM_AUDIO_BLOCK_ALIGN L"AudioBlockAlign" // amf_int64 (default = codec->block_align) #define AMF_STREAM_AUDIO_FRAME_SIZE L"AudioFrameSize" // amf_int64 (default = codec->frame_size) #endif //#ifndef AMF_Component_h 07070100000012000081A400000000000000000000000163CFF5E7000020E4000000000000000000000000000000000000003900000000AMF-1.4.29/amf/public/include/components/ComponentCaps.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_ComponentCaps_h #define AMF_ComponentCaps_h #pragma once #include "../core/Interface.h" #include "../core/PropertyStorage.h" #include "../core/Surface.h" #if defined(__cplusplus) namespace amf { #endif typedef enum AMF_ACCELERATION_TYPE { AMF_ACCEL_NOT_SUPPORTED = -1, AMF_ACCEL_HARDWARE, AMF_ACCEL_GPU, AMF_ACCEL_SOFTWARE } AMF_ACCELERATION_TYPE; //---------------------------------------------------------------------------------------------- // AMFIOCaps interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFIOCaps : public AMFInterface { public: // Get supported resolution ranges in pixels/lines: virtual void AMF_STD_CALL GetWidthRange(amf_int32* minWidth, amf_int32* maxWidth) const = 0; virtual void AMF_STD_CALL GetHeightRange(amf_int32* minHeight, amf_int32* maxHeight) const = 0; // Get memory alignment in lines: Vertical aligmnent should be multiples of this number virtual amf_int32 AMF_STD_CALL GetVertAlign() const = 0; // Enumerate supported surface pixel formats virtual amf_int32 AMF_STD_CALL GetNumOfFormats() const = 0; virtual AMF_RESULT AMF_STD_CALL GetFormatAt(amf_int32 index, AMF_SURFACE_FORMAT* format, amf_bool* native) const = 0; // Enumerate supported memory types virtual amf_int32 AMF_STD_CALL GetNumOfMemoryTypes() const = 0; virtual AMF_RESULT AMF_STD_CALL GetMemoryTypeAt(amf_int32 index, AMF_MEMORY_TYPE* memType, amf_bool* native) const = 0; virtual amf_bool AMF_STD_CALL IsInterlacedSupported() const = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFIOCaps> AMFIOCapsPtr; #else // #if defined(__cplusplus) typedef struct AMFIOCaps AMFIOCaps; typedef struct AMFIOCapsVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFIOCaps* pThis); amf_long (AMF_STD_CALL *Release)(AMFIOCaps* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFIOCaps* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFIOCaps interface // Get supported resolution ranges in pixels/lines: void (AMF_STD_CALL *GetWidthRange)(AMFIOCaps* pThis, amf_int32* minWidth, amf_int32* maxWidth); void (AMF_STD_CALL *GetHeightRange)(AMFIOCaps* pThis, amf_int32* minHeight, amf_int32* maxHeight); // Get memory alignment in lines: Vertical aligmnent should be multiples of this number amf_int32 (AMF_STD_CALL *GetVertAlign)(AMFIOCaps* pThis); // Enumerate supported surface pixel formats amf_int32 (AMF_STD_CALL *GetNumOfFormats)(AMFIOCaps* pThis); AMF_RESULT (AMF_STD_CALL *GetFormatAt)(AMFIOCaps* pThis, amf_int32 index, AMF_SURFACE_FORMAT* format, amf_bool* native); // Enumerate supported memory types amf_int32 (AMF_STD_CALL *GetNumOfMemoryTypes)(AMFIOCaps* pThis); AMF_RESULT (AMF_STD_CALL *GetMemoryTypeAt)(AMFIOCaps* pThis, amf_int32 index, AMF_MEMORY_TYPE* memType, amf_bool* native); amf_bool (AMF_STD_CALL *IsInterlacedSupported)(AMFIOCaps* pThis); } AMFIOCapsVtbl; struct AMFIOCaps { const AMFIOCapsVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFCaps interface - base interface for every h/w module supported by Capability Manager //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFCaps : public AMFPropertyStorage { public: virtual AMF_ACCELERATION_TYPE AMF_STD_CALL GetAccelerationType() const = 0; virtual AMF_RESULT AMF_STD_CALL GetInputCaps(AMFIOCaps** input) = 0; virtual AMF_RESULT AMF_STD_CALL GetOutputCaps(AMFIOCaps** output) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFCaps> AMFCapsPtr; #else // #if defined(__cplusplus) typedef struct AMFCaps AMFCaps; typedef struct AMFCapsVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFCaps* pThis); amf_long (AMF_STD_CALL *Release)(AMFCaps* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFCaps* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFCaps* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFCaps* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFCaps* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFCaps* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFCaps* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFCaps* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFCaps* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFCaps* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFCaps* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFCaps* pThis, AMFPropertyStorageObserver* pObserver); // AMFCaps interface AMF_ACCELERATION_TYPE (AMF_STD_CALL *GetAccelerationType)(AMFCaps* pThis); AMF_RESULT (AMF_STD_CALL *GetInputCaps)(AMFCaps* pThis, AMFIOCaps** input); AMF_RESULT (AMF_STD_CALL *GetOutputCaps)(AMFCaps* pThis, AMFIOCaps** output); } AMFCapsVtbl; struct AMFCaps { const AMFCapsVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) } #endif #endif //#ifndef AMF_ComponentCaps_h 07070100000013000081A400000000000000000000000163CFF5E7000009B6000000000000000000000000000000000000003900000000AMF-1.4.29/amf/public/include/components/CursorCapture.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // Cursor capture interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_CursorCapture_h #define AMF_CursorCapture_h #pragma once namespace amf { class AMFCursorCapture : public AMFInterface { public: AMF_DECLARE_IID(0x166efa1a, 0x19b8, 0x42f2, 0x86, 0x0f, 0x56, 0x69, 0xca, 0x7a, 0x85, 0x4c) virtual AMF_RESULT AMF_STD_CALL AcquireCursor(amf::AMFSurface** pSurface) = 0; virtual AMF_RESULT AMF_STD_CALL Reset() = 0; }; typedef AMFInterfacePtr_T<AMFCursorCapture> AMFCursorCapturePtr; } #endif // #ifndef AMF_CursorCapture_h 07070100000014000081A400000000000000000000000163CFF5E70000154D000000000000000000000000000000000000003A00000000AMF-1.4.29/amf/public/include/components/DisplayCapture.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // Desktop duplication interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_DisplayCapture_h #define AMF_DisplayCapture_h #pragma once #include "Component.h" extern "C" { // To create capture component with Desktop Duplication API use this function AMF_RESULT AMF_CDECL_CALL AMFCreateComponentDisplayCapture(amf::AMFContext* pContext, void* reserved, amf::AMFComponent** ppComponent); } // To create AMD Direct Capture component use this component ID with AMFFactory::CreateComponent() #define AMFDisplayCapture L"AMFDisplayCapture" // Static properties // typedef enum AMF_DISPLAYCAPTURE_MODE_ENUM { AMF_DISPLAYCAPTURE_MODE_KEEP_FRAMERATE = 0, // capture component maintains the frame rate and returns current visible surface AMF_DISPLAYCAPTURE_MODE_WAIT_FOR_PRESENT = 1, // capture component waits for flip (present) event AMF_DISPLAYCAPTURE_MODE_GET_CURRENT_SURFACE = 2, // returns current visible surface immediately } AMF_DISPLAYCAPTURE_MODE_ENUM; #define AMF_DISPLAYCAPTURE_MONITOR_INDEX L"MonitorIndex" // amf_int64, default = 0, Index of the display monitor; is determined by using EnumAdapters() in DXGI. #define AMF_DISPLAYCAPTURE_MODE L"CaptureMode" // amf_int64(AMF_DISPLAYCAPTURE_MODE_ENUM), default = AMF_DISPLAYCAPTURE_MODE_FRAMERATE, controls wait logic #define AMF_DISPLAYCAPTURE_FRAMERATE L"FrameRate" // AMFRate, default = (0, 1) Capture framerate, if 0 - capture rate will be driven by flip event from fullscreen app or DWM #define AMF_DISPLAYCAPTURE_CURRENT_TIME_INTERFACE L"CurrentTimeInterface" // AMFInterface(AMFCurrentTime) Optional interface object for providing timestamps. #define AMF_DISPLAYCAPTURE_FORMAT L"CurrentFormat" // amf_int64(AMF_SURFACE_FORMAT) Capture format - read-only #define AMF_DISPLAYCAPTURE_RESOLUTION L"Resolution" // AMFSize - screen resolution - read-only #define AMF_DISPLAYCAPTURE_DUPLICATEOUTPUT L"DuplicateOutput" // amf_bool, default = false, output AMF surface is a copy of captured #define AMF_DISPLAYCAPTURE_DESKTOP_RECT L"DesktopRect" // AMFRect - rect of the capture desktop - read-only #define AMF_DISPLAYCAPTURE_ENABLE_DIRTY_RECTS L"EnableDirtyRects" // amf_bool, default = false, enable dirty rectangles attached to output as AMF_DISPLAYCAPTURE_DIRTY_RECTS #define AMF_DISPLAYCAPTURE_DRAW_DIRTY_RECTS L"DrawDirtyRects" // amf_bool, default = false, copies capture output and draws dirty rectangles with red - for debugging only #define AMF_DISPLAYCAPTURE_ROTATION L"Rotation" // amf_int64(AMF_ROTATION_ENUM); default = AMF_ROTATION_NONE, monitor rotation state // Properties that can be set on output AMFSurface #define AMF_DISPLAYCAPTURE_DIRTY_RECTS L"DirtyRects" // AMFInterface*(AMFBuffer*) - array of AMFRect(s) #define AMF_DISPLAYCAPTURE_FRAME_INDEX L"FrameIndex" // amf_int64; default = 0, index of presented frame since capture started #define AMF_DISPLAYCAPTURE_FRAME_FLIP_TIMESTAMP L"FlipTimesamp" // amf_int64; default = 0, flip timestmap of presented frame // see Surface.h //#define AMF_SURFACE_ROTATION L"Rotation" // amf_int64(AMF_ROTATION_ENUM); default = AMF_ROTATION_NONE, can be set on surfaces - the same value as AMF_DISPLAYCAPTURE_ROTATION #endif // #ifndef AMF_DisplayCapture_h 07070100000015000081A400000000000000000000000163CFF5E700000E02000000000000000000000000000000000000004000000000AMF-1.4.29/amf/public/include/components/FFMPEGAudioConverter.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // AMFFAudioConverterFFMPEG interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_AudioConverterFFMPEG_h #define AMF_AudioConverterFFMPEG_h #pragma once #define FFMPEG_AUDIO_CONVERTER L"AudioConverterFFMPEG" #define AUDIO_CONVERTER_IN_AUDIO_BIT_RATE L"In_BitRate" // amf_int64 (default = 128000) #define AUDIO_CONVERTER_IN_AUDIO_SAMPLE_RATE L"In_SampleRate" // amf_int64 (default = 0) #define AUDIO_CONVERTER_IN_AUDIO_CHANNELS L"In_Channels" // amf_int64 (default = 2) #define AUDIO_CONVERTER_IN_AUDIO_SAMPLE_FORMAT L"In_SampleFormat" // amf_int64 (default = AMFAF_UNKNOWN) (AMF_AUDIO_FORMAT) #define AUDIO_CONVERTER_IN_AUDIO_CHANNEL_LAYOUT L"In_ChannelLayout" // amf_int64 (default = 0) #define AUDIO_CONVERTER_IN_AUDIO_BLOCK_ALIGN L"In_BlockAlign" // amf_int64 (default = 0) #define AUDIO_CONVERTER_OUT_AUDIO_BIT_RATE L"Out_BitRate" // amf_int64 (default = 128000) #define AUDIO_CONVERTER_OUT_AUDIO_SAMPLE_RATE L"Out_SampleRate" // amf_int64 (default = 0) #define AUDIO_CONVERTER_OUT_AUDIO_CHANNELS L"Out_Channels" // amf_int64 (default = 2) #define AUDIO_CONVERTER_OUT_AUDIO_SAMPLE_FORMAT L"Out_SampleFormat" // amf_int64 (default = AMFAF_UNKNOWN) (AMF_AUDIO_FORMAT) #define AUDIO_CONVERTER_OUT_AUDIO_CHANNEL_LAYOUT L"Out_ChannelLayout" // amf_int64 (default = 0) #define AUDIO_CONVERTER_OUT_AUDIO_BLOCK_ALIGN L"Out_BlockAlign" // amf_int64 (default = 0) #endif //#ifndef AMF_AudioConverterFFMPEG_h 07070100000016000081A400000000000000000000000163CFF5E700001106000000000000000000000000000000000000003E00000000AMF-1.4.29/amf/public/include/components/FFMPEGAudioDecoder.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // AudioDecoderFFMPEG interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_AudioDecoderFFMPEG_h #define AMF_AudioDecoderFFMPEG_h #pragma once #define FFMPEG_AUDIO_DECODER L"AudioDecoderFFMPEG" #define AUDIO_DECODER_ENABLE_DEBUGGING L"EnableDebug" // bool (default = false) - trace some debug information if set to true #define AUDIO_DECODER_ENABLE_DECODING L"EnableDecoding" // bool (default = true) - if false, component will not decode anything #define AUDIO_DECODER_IN_AUDIO_CODEC_ID L"In_CodecID" // amf_int64 (default = AV_CODEC_ID_NONE) - FFMPEG codec ID #define AUDIO_DECODER_IN_AUDIO_BIT_RATE L"In_BitRate" // amf_int64 (default = 128000) #define AUDIO_DECODER_IN_AUDIO_EXTRA_DATA L"In_ExtraData" // interface to AMFBuffer #define AUDIO_DECODER_IN_AUDIO_SAMPLE_RATE L"In_SampleRate" // amf_int64 (default = 0) #define AUDIO_DECODER_IN_AUDIO_CHANNELS L"In_Channels" // amf_int64 (default = 2) #define AUDIO_DECODER_IN_AUDIO_SAMPLE_FORMAT L"In_SampleFormat" // amf_int64 (default = AMFAF_UNKNOWN) (AMF_AUDIO_FORMAT) #define AUDIO_DECODER_IN_AUDIO_CHANNEL_LAYOUT L"In_ChannelLayout" // amf_int64 (default = 0) #define AUDIO_DECODER_IN_AUDIO_BLOCK_ALIGN L"In_BlockAlign" // amf_int64 (default = 0) #define AUDIO_DECODER_IN_AUDIO_FRAME_SIZE L"In_FrameSize" // amf_int64 (default = 0) #define AUDIO_DECODER_IN_AUDIO_SEEK_POSITION L"In_SeekPosition" // amf_int64 (default = 0) #define AUDIO_DECODER_OUT_AUDIO_BIT_RATE L"Out_BitRate" // amf_int64 (default = 128000) #define AUDIO_DECODER_OUT_AUDIO_SAMPLE_RATE L"Out_SampleRate" // amf_int64 (default = 0) #define AUDIO_DECODER_OUT_AUDIO_CHANNELS L"Out_Channels" // amf_int64 (default = 2) #define AUDIO_DECODER_OUT_AUDIO_SAMPLE_FORMAT L"Out_SampleFormat" // amf_int64 (default = AMFAF_UNKNOWN) (AMF_AUDIO_FORMAT) #define AUDIO_DECODER_OUT_AUDIO_CHANNEL_LAYOUT L"Out_ChannelLayout" // amf_int64 (default = 0) #define AUDIO_DECODER_OUT_AUDIO_BLOCK_ALIGN L"Out_BlockAlign" // amf_int64 (default = 0) #endif //#ifndef AMF_AudioDecoderFFMPEG_h 07070100000017000081A400000000000000000000000163CFF5E700001023000000000000000000000000000000000000003E00000000AMF-1.4.29/amf/public/include/components/FFMPEGAudioEncoder.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // AudioEncoderFFMPEG interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_AudioEncoderFFMPEG_h #define AMF_AudioEncoderFFMPEG_h #pragma once #define FFMPEG_AUDIO_ENCODER L"AudioEncoderFFMPEG" #define AUDIO_ENCODER_ENABLE_DEBUGGING L"EnableDebug" // bool (default = false) - trace some debug information if set to true #define AUDIO_ENCODER_ENABLE_ENCODING L"EnableEncoding" // bool (default = true) - if false, component will not encode anything #define AUDIO_ENCODER_AUDIO_CODEC_ID L"CodecID" // amf_int64 (default = AV_CODEC_ID_NONE) - FFMPEG codec ID #define AUDIO_ENCODER_IN_AUDIO_SAMPLE_RATE L"In_SampleRate" // amf_int64 (default = 44100) #define AUDIO_ENCODER_IN_AUDIO_CHANNELS L"In_Channels" // amf_int64 (default = 2) #define AUDIO_ENCODER_IN_AUDIO_SAMPLE_FORMAT L"In_SampleFormat" // amf_int64 (default = AMFAF_S16) (AMF_AUDIO_FORMAT) #define AUDIO_ENCODER_IN_AUDIO_CHANNEL_LAYOUT L"In_ChannelLayout" // amf_int64 (default = 3) #define AUDIO_ENCODER_IN_AUDIO_BLOCK_ALIGN L"In_BlockAlign" // amf_int64 (default = 0) #define AUDIO_ENCODER_OUT_AUDIO_BIT_RATE L"Out_BitRate" // amf_int64 (default = 128000) #define AUDIO_ENCODER_OUT_AUDIO_EXTRA_DATA L"Out_ExtraData" // interface to AMFBuffer #define AUDIO_ENCODER_OUT_AUDIO_SAMPLE_RATE L"Out_SampleRate" // amf_int64 (default = 44100) #define AUDIO_ENCODER_OUT_AUDIO_CHANNELS L"Out_Channels" // amf_int64 (default = 2) #define AUDIO_ENCODER_OUT_AUDIO_SAMPLE_FORMAT L"Out_SampleFormat" // amf_int64 (default = AMFAF_S16) (AMF_AUDIO_FORMAT) #define AUDIO_ENCODER_OUT_AUDIO_CHANNEL_LAYOUT L"Out_ChannelLayout" // amf_int64 (default = 0) #define AUDIO_ENCODER_OUT_AUDIO_BLOCK_ALIGN L"Out_BlockAlign" // amf_int64 (default = 0) #define AUDIO_ENCODER_OUT_AUDIO_FRAME_SIZE L"Out_FrameSize" // amf_int64 (default = 0) #endif //#ifndef AMF_AudioEncoderFFMPEG_h 07070100000018000081A400000000000000000000000163CFF5E700000946000000000000000000000000000000000000003C00000000AMF-1.4.29/amf/public/include/components/FFMPEGComponents.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // FFMPEG components definitions //------------------------------------------------------------------------------------------------- #ifndef AMF_ComponentsFFMPEG_h #define AMF_ComponentsFFMPEG_h #pragma once #if defined(_WIN32) #if defined(_M_AMD64) #define FFMPEG_DLL_NAME L"amf-component-ffmpeg64.dll" #else #define FFMPEG_DLL_NAME L"amf-component-ffmpeg32.dll" #endif #elif defined(__linux) #define FFMPEG_DLL_NAME L"amf-component-ffmpeg.so" #endif #endif //#ifndef AMF_ComponentsFFMPEG_h 07070100000019000081A400000000000000000000000163CFF5E700000E2F000000000000000000000000000000000000003D00000000AMF-1.4.29/amf/public/include/components/FFMPEGFileDemuxer.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // DemuxerFFMPEG interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_FileDemuxerFFMPEG_h #define AMF_FileDemuxerFFMPEG_h #pragma once #define FFMPEG_DEMUXER L"DemuxerFFMPEG" // component properties #define FFMPEG_DEMUXER_PATH L"Path" // string - the file to open #define FFMPEG_DEMUXER_URL L"Url" // string - the stream url to open #define FFMPEG_DEMUXER_START_FRAME L"StartFrame" // amf_int64 (default = 0) #define FFMPEG_DEMUXER_FRAME_COUNT L"FramesNumber" // amf_int64 (default = 0) #define FFMPEG_DEMUXER_DURATION L"Duration" // amf_int64 (default = 0) #define FFMPEG_DEMUXER_CHECK_MVC L"CheckMVC" // bool (default = true) //#define FFMPEG_DEMUXER_SYNC_AV L"SyncAV" // bool (default = false) #define FFMPEG_DEMUXER_INDIVIDUAL_STREAM_MODE L"StreamMode" // bool (default = true) #define FFMPEG_DEMUXER_LISTEN L"Listen" // bool (default = false) // for common, video and audio properties see Component.h // video stream properties #define FFMPEG_DEMUXER_VIDEO_PIXEL_ASPECT_RATIO L"PixelAspectRatio" // double (default = calculated) #define FFMPEG_DEMUXER_VIDEO_CODEC L"FFmpegCodec" // enum (from source) // buffer properties #define FFMPEG_DEMUXER_BUFFER_TYPE L"BufferType" // amf_int64 ( AMF_STREAM_TYPE_ENUM ) #define FFMPEG_DEMUXER_BUFFER_STREAM_INDEX L"BufferStreamIndexType" // amf_int64 ( stream index ) #endif //#ifndef AMF_FileDemuxerFFMPEG_h 0707010000001A000081A400000000000000000000000163CFF5E700000B84000000000000000000000000000000000000003B00000000AMF-1.4.29/amf/public/include/components/FFMPEGFileMuxer.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // MuxerFFMPEG interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_FileMuxerFFMPEG_h #define AMF_FileMuxerFFMPEG_h #pragma once #define FFMPEG_MUXER L"MuxerFFMPEG" // component properties #define FFMPEG_MUXER_PATH L"Path" // string - the file to open #define FFMPEG_MUXER_URL L"Url" // string - the stream url to open #define FFMPEG_MUXER_LISTEN L"Listen" // bool (default = false) #define FFMPEG_MUXER_ENABLE_VIDEO L"EnableVideo" // bool (default = true) #define FFMPEG_MUXER_ENABLE_AUDIO L"EnableAudio" // bool (default = false) #define FFMPEG_MUXER_CURRENT_TIME_INTERFACE L"CurrentTimeInterface" #define FFMPEG_MUXER_VIDEO_ROTATION L"VideoRotation" // amf_int64 (0, 90, 180, 270, default = 0) #define FFMPEG_MUXER_USAGE_IS_TRIM L"UsageIsTrim" // bool (default = false) #endif //#ifndef AMF_FileMuxerFFMPEG_h 0707010000001B000081A400000000000000000000000163CFF5E700000BDC000000000000000000000000000000000000003E00000000AMF-1.4.29/amf/public/include/components/FFMPEGVideoDecoder.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // VideoDecoderFFMPEG interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_VideoDecoderFFMPEG_h #define AMF_VideoDecoderFFMPEG_h #pragma once #define FFMPEG_VIDEO_DECODER L"VideoDecoderFFMPEG" #define VIDEO_DECODER_ENABLE_DECODING L"EnableDecoding" // bool (default = true) - if false, component will not decode anything #define VIDEO_DECODER_CODEC_ID L"CodecID" // amf_int64 (AMF_STREAM_CODEC_ID_ENUM) codec ID #define VIDEO_DECODER_EXTRA_DATA L"ExtraData" // interface to AMFBuffer #define VIDEO_DECODER_RESOLUTION L"Resolution" // AMFSize #define VIDEO_DECODER_BITRATE L"BitRate" // amf_int64 (default = 0) #define VIDEO_DECODER_FRAMERATE L"FrameRate" // AMFRate #define VIDEO_DECODER_SEEK_POSITION L"SeekPosition" // amf_int64 (default = 0) #define VIDEO_DECODER_COLOR_TRANSFER_CHARACTERISTIC L"ColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2 #endif //#ifndef AMF_VideoDecoderFFMPEG_h 0707010000001C000081A400000000000000000000000163CFF5E700000E74000000000000000000000000000000000000003400000000AMF-1.4.29/amf/public/include/components/HQScaler.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMFHQScaler_h #define AMFHQScaler_h #pragma once #define AMFHQScaler L"AMFHQScaler" // various types of algorithms supported by the high-quality scaler enum AMF_HQ_SCALER_ALGORITHM_ENUM { AMF_HQ_SCALER_ALGORITHM_BILINEAR = 0, AMF_HQ_SCALER_ALGORITHM_BICUBIC = 1, AMF_HQ_SCALER_ALGORITHM_FSR = 2, // deprecated AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_0 = 2, AMF_HQ_SCALER_ALGORITHM_POINT = 3, AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1 = 4, }; // PA object properties #define AMF_HQ_SCALER_ALGORITHM L"HQScalerAlgorithm" // amf_int64(AMF_HQ_SCALER_ALGORITHM_ENUM) (Bi-linear, Bi-cubic, RCAS, Auto)" - determines which scaling algorithm will be used // auto will chose best option between algorithms available #define AMF_HQ_SCALER_ENGINE_TYPE L"HQScalerEngineType" // AMF_MEMORY_TYPE (DX11, DX12, OPENCL, VULKAN default : DX11)" - determines how the object is initialized and what kernels to use #define AMF_HQ_SCALER_OUTPUT_SIZE L"HQSOutputSize" // AMFSize - output scaling width/hieight #define AMF_HQ_SCALER_KEEP_ASPECT_RATIO L"KeepAspectRatio" // bool (default=false) Keep aspect ratio if scaling. #define AMF_HQ_SCALER_FILL L"Fill" // bool (default=false) fill area out of ROI. #define AMF_HQ_SCALER_FILL_COLOR L"FillColor" // AMFColor #define AMF_HQ_SCALER_FROM_SRGB L"FromSRGB" // bool (default=true) Convert to SRGB. #define AMF_HQ_SCALER_SHARPNESS L"HQScalerSharpness" // Float in the range of [0.0, 2.0] #define AMF_HQ_SCALER_FRAME_RATE L"HQScalerFrameRate" // Frame rate (off, 15, 30, 60) #endif //#ifndef AMFHQScaler_h 0707010000001D000081A400000000000000000000000163CFF5E700000E60000000000000000000000000000000000000003700000000AMF-1.4.29/amf/public/include/components/MediaSource.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_MediaSource_h #define AMF_MediaSource_h #pragma once #include "public/include/core/Interface.h" namespace amf { enum AMF_SEEK_TYPE { AMF_SEEK_PREV = 0, // nearest packet before pts AMF_SEEK_NEXT = 1, // nearest packet after pts AMF_SEEK_PREV_KEYFRAME = 2, // nearest keyframe packet before pts AMF_SEEK_NEXT_KEYFRAME = 3, // nearest keyframe packet after pts }; //---------------------------------------------------------------------------------------------- // media source interface. //---------------------------------------------------------------------------------------------- class AMFMediaSource : public AMFInterface { public: AMF_DECLARE_IID(0xb367695a, 0xdbd0, 0x4430, 0x95, 0x3b, 0xbc, 0x7d, 0xbd, 0x2a, 0xa7, 0x66) // interface virtual AMF_RESULT AMF_STD_CALL Seek(amf_pts pos, AMF_SEEK_TYPE seekType, amf_int32 whichStream) = 0; virtual amf_pts AMF_STD_CALL GetPosition() = 0; virtual amf_pts AMF_STD_CALL GetDuration() = 0; virtual void AMF_STD_CALL SetMinPosition(amf_pts pts) = 0; virtual amf_pts AMF_STD_CALL GetMinPosition() = 0; virtual void AMF_STD_CALL SetMaxPosition(amf_pts pts) = 0; virtual amf_pts AMF_STD_CALL GetMaxPosition() = 0; virtual amf_uint64 AMF_STD_CALL GetFrameFromPts(amf_pts pts) = 0; virtual amf_pts AMF_STD_CALL GetPtsFromFrame(amf_uint64 frame) = 0; virtual bool AMF_STD_CALL SupportFramesAccess() = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFMediaSource> AMFMediaSourcePtr; } //namespace amf #endif //#ifndef AMF_MediaSource_h 0707010000001E000081A400000000000000000000000163CFF5E700001D67000000000000000000000000000000000000003700000000AMF-1.4.29/amf/public/include/components/PreAnalysis.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMFPreAnalysis_h #define AMFPreAnalysis_h #pragma once #define AMFPreAnalysis L"AMFPreAnalysis" enum AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_ENUM { AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_LOW = 0, AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_MEDIUM = 1, AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_HIGH = 2 }; enum AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_ENUM { AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_LOW = 0, AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_MEDIUM = 1, AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_HIGH = 2 }; enum AMF_PA_ACTIVITY_TYPE_ENUM { AMF_PA_ACTIVITY_Y = 0, AMF_PA_ACTIVITY_YUV = 1 }; enum AMF_PA_CAQ_STRENGTH_ENUM { AMF_PA_CAQ_STRENGTH_LOW = 0, AMF_PA_CAQ_STRENGTH_MEDIUM = 1, AMF_PA_CAQ_STRENGTH_HIGH = 2 }; // Perceptual adaptive quantization mode enum AMF_PA_PAQ_MODE_ENUM { AMF_PA_PAQ_MODE_NONE = 0, AMF_PA_PAQ_MODE_CAQ = 1 }; // Temporal adaptive quantization mode enum AMF_PA_TAQ_MODE_ENUM { AMF_PA_TAQ_MODE_NONE = 0, AMF_PA_TAQ_MODE_1 = 1, AMF_PA_TAQ_MODE_2 = 2 }; enum AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_ENUM { AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_NONE = 0, //default AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_AUTO = 1 }; // PA object properties #define AMF_PA_ENGINE_TYPE L"PAEngineType" // AMF_MEMORY_TYPE (Host, DX11, OpenCL, Vulkan, Auto default : UNKNOWN (Auto))" - determines how the object is initialized and what kernels to use // by default it is Auto (DX11, OpenCL and Vulkan are currently available) #define AMF_PA_SCENE_CHANGE_DETECTION_ENABLE L"PASceneChangeDetectionEnable" // bool (default : True) - Enable Scene Change Detection GPU algorithm #define AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY L"PASceneChangeDetectionSensitivity" // AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_ENUM (default : Medium) - Scene Change Detection Sensitivity #define AMF_PA_STATIC_SCENE_DETECTION_ENABLE L"PAStaticSceneDetectionEnable" // bool (default : False) - Enable Skip Detection GPU algorithm #define AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY L"PAStaticSceneDetectionSensitivity" // AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_ENUM (default : High) - Allowable absolute difference between pixels (sample counts) #define AMF_PA_FRAME_SAD_ENABLE L"PAFrameSadEnable" // bool (default : True) - Enable Frame SAD algorithm #define AMF_PA_ACTIVITY_TYPE L"PAActivityType" // AMF_PA_ACTIVITY_TYPE_ENUM (default : Calculate on Y) - Block activity calculation mode #define AMF_PA_LTR_ENABLE L"PALongTermReferenceEnable" // bool (default : False) - Enable Automatic Long Term Reference frame management #define AMF_PA_LOOKAHEAD_BUFFER_DEPTH L"PALookAheadBufferDepth" // amf_uint64 (default : 0) Values: [0, MAX_LOOKAHEAD_DEPTH] - PA lookahead buffer size #define AMF_PA_PAQ_MODE L"PAPerceptualAQMode" // AMF_PA_PAQ_MODE_ENUM (default : AMF_PA_PAQ_MODE_NONE) - Perceptual AQ mode #define AMF_PA_TAQ_MODE L"PATemporalAQMode" // AMF_PA_TAQ_MODE_ENUM (default: AMF_PA_TAQ_MODE_NONE) - Temporal AQ mode #define AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE L"PAHighMotionQualityBoostMode" // AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_ENUM (default: None) - High motion quality boost mode /////////////////////////////////////////// // the following properties are available // only through the Encoder - trying to // access/set them when PA is standalone // will fail #define AMF_PA_INITIAL_QP_AFTER_SCENE_CHANGE L"PAInitialQPAfterSceneChange" // amf_uint64 (default : 0) Values: [0, 51] - Base QP to be used immediately after scene change. If this value is not set, PA will choose a proper QP value #define AMF_PA_MAX_QP_BEFORE_FORCE_SKIP L"PAMaxQPBeforeForceSkip" // amf_uint64 (default : 35) Values: [0, 51] - When a static scene is detected, a skip frame is inserted only if the previous encoded frame average QP <= this value #define AMF_PA_CAQ_STRENGTH L"PACAQStrength" // AMF_PA_CAQ_STRENGTH_ENUM (default : Medium) - Content Adaptive Quantization (CAQ) strength ////////////////////////////////////////////////// // properties set by PA on output buffer interface #define AMF_PA_ACTIVITY_MAP L"PAActivityMap" // AMFInterface* -> AMFSurface*; Values: int32 - When PA is standalone, there will be a 2D Activity map generated for each frame #define AMF_PA_SCENE_CHANGE_DETECT L"PASceneChangeDetect" // bool - True/False - available if AMF_PA_SCENE_CHANGE_DETECTION_ENABLE was set to True #define AMF_PA_STATIC_SCENE_DETECT L"PAStaticSceneDetect" // bool - True/False - available if AMF_PA_STATIC_SCENE_DETECTION_ENABLE was set to True #endif //#ifndef AMFPreAnalysis_h 0707010000001F000081A400000000000000000000000163CFF5E700000E98000000000000000000000000000000000000003900000000AMF-1.4.29/amf/public/include/components/PreProcessing.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMFPreProcessing_h #define AMFPreProcessing_h #pragma once #define AMFPreProcessing L"AMFPreProcessing" // Pre-processing object properties #define AMF_PP_ENGINE_TYPE L"PPEngineType" // AMF_MEMORY_TYPE (Host, DX11, OPENCL, Auto default : OPENCL) - determines how the object is initialized and what kernels to use // by default it is OpenCL (Host, DX11 and OpenCL are currently available) // add a property that will determine the output format // by default we output in the same format as input // but in some cases we might need to change the output // format to be different than input #define AMF_PP_OUTPUT_MEMORY_TYPE L"PPOutputFormat" // AMF_MEMORY_TYPE (Host, DX11, OPENCL default : Unknown) - determines format of frame going out #define AMF_PP_ADAPTIVE_FILTER_STRENGTH L"PPAdaptiveFilterStrength" // int (default : 4) - strength: 0 - 10: the higher the value, the stronger the filtering #define AMF_PP_ADAPTIVE_FILTER_SENSITIVITY L"PPAdaptiveFilterSensitivity" // int (default : 4) - sensitivity: 0 - 10: the lower the value, the more sensitive to edge (preserve more details) // Encoder parameters used for adaptive filtering #define AMF_PP_TARGET_BITRATE L"PPTargetBitrate" // int64 (default: 2000000) - target bit rate #define AMF_PP_FRAME_RATE L"PPFrameRate" // AMFRate (default: 30, 1) - frame rate #define AMF_PP_ADAPTIVE_FILTER_ENABLE L"PPAdaptiveFilterEnable" // bool (default: false) - turn on/off adaptive filtering #endif //#ifndef AMFPreProcessing_h 07070100000020000081A400000000000000000000000163CFF5E700000B4F000000000000000000000000000000000000003B00000000AMF-1.4.29/amf/public/include/components/SupportedCodecs.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // An interface available on some components to provide information on supported input and output codecs //------------------------------------------------------------------------------------------------- #ifndef AMF_SupportedCodecs_h #define AMF_SupportedCodecs_h #pragma once #include "public/include/core/Interface.h" //properties on the returned AMFPropertyStorage #define SUPPORTEDCODEC_ID L"CodecId" //amf_int64 #define SUPPORTEDCODEC_SAMPLERATE L"SampleRate" //amf_int32 namespace amf { class AMFSupportedCodecs : public AMFInterface { public: AMF_DECLARE_IID(0xc1003a83, 0x7934, 0x408a, 0x95, 0x5b, 0xc4, 0xdd, 0x85, 0x9d, 0xf5, 0x61) //call with increasing values until it returns AMF_OUT_OF_RANGE virtual AMF_RESULT AMF_STD_CALL GetInputCodecAt(amf_size index, AMFPropertyStorage** codec) const = 0; virtual AMF_RESULT AMF_STD_CALL GetOutputCodecAt(amf_size index, AMFPropertyStorage** codec) const = 0; }; typedef AMFInterfacePtr_T<AMFSupportedCodecs> AMFSupportedCodecsPtr; } #endif07070100000021000081A400000000000000000000000163CFF5E700000A49000000000000000000000000000000000000003600000000AMF-1.4.29/amf/public/include/components/VQEnhancer.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMFVQEnhancer_h #define AMFVQEnhancer_h #pragma once #define VE_FCR_DEFAULT_ATTENUATION 0.1 #define AMFVQEnhancer L"AMFVQEnhancer" #define AMF_VIDEO_ENHANCER_ENGINE_TYPE L"AMF_VIDEI_ENHANCER_ENGINE_TYPE" // AMF_MEMORY_TYPE (DX11, DX12, OPENCL, VULKAN default : DX11)" - determines how the object is initialized and what kernels to use #define AMF_VIDEO_ENHANCER_OUTPUT_SIZE L"AMF_VIDEO_ENHANCER_OUTPUT_SIZE" // AMFSize #define AMF_VE_FCR_ATTENUATION L"AMF_VE_FCR_ATTENUATION" // Float in the range of [0.02, 0.4], default : 0.1 #define AMF_VE_FCR_RADIUS L"AMF_VE_FCR_RADIUS" // int in the range of [1, 4] #define AMF_VE_FCR_SPLIT_VIEW L"AMF_VE_FCR_SPLIT_VIEW" // FCR View split window #endif //#ifndef AMFVQEnhancer_h 07070100000022000081A400000000000000000000000163CFF5E700000B2F000000000000000000000000000000000000003800000000AMF-1.4.29/amf/public/include/components/VideoCapture.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // ZCamLive interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_VideoCapture_h #define AMF_VideoCapture_h #pragma once #define VIDEOCAP_DEVICE_COUNT L"VideoCapDeviceCount" // amf_int64, (default=2), number of video capture devices #define VIDEOCAP_DEVICE_NAME L"VideoCapDeviceName" // WString, (default=""), name of the video capture device #define VIDEOCAP_DEVICE_ACTIVE L"VideoCapDeviceActive" // WString, (default=""), name of the selected video capture device #define VIDEOCAP_CODEC L"CodecID" // WString (default = "AMFVideoDecoderUVD_H264_AVC"), UVD codec ID #define VIDEOCAP_FRAMESIZE L"FrameSize" // AMFSize, (default=AMFConstructSize(1920, 1080)), frame size in pixels extern "C" { AMF_RESULT AMF_CDECL_CALL AMFCreateComponentVideoCapture(amf::AMFContext* pContext, amf::AMFComponentEx** ppComponent); } #endif // AMF_VideoCapture_h07070100000023000081A400000000000000000000000163CFF5E700002214000000000000000000000000000000000000003A00000000AMF-1.4.29/amf/public/include/components/VideoConverter.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // AMFFVideoConverter interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_VideoConverter_h #define AMF_VideoConverter_h #pragma once #include "Component.h" #include "ColorSpace.h" #define AMFVideoConverter L"AMFVideoConverter" enum AMF_VIDEO_CONVERTER_SCALE_ENUM { AMF_VIDEO_CONVERTER_SCALE_INVALID = -1, AMF_VIDEO_CONVERTER_SCALE_BILINEAR = 0, AMF_VIDEO_CONVERTER_SCALE_BICUBIC = 1 }; enum AMF_VIDEO_CONVERTER_TONEMAPPING_ENUM { AMF_VIDEO_CONVERTER_TONEMAPPING_COPY = 0, AMF_VIDEO_CONVERTER_TONEMAPPING_AMD = 1, AMF_VIDEO_CONVERTER_TONEMAPPING_LINEAR = 2, AMF_VIDEO_CONVERTER_TONEMAPPING_GAMMA = 3, AMF_VIDEO_CONVERTER_TONEMAPPING_REINHARD = 4, AMF_VIDEO_CONVERTER_TONEMAPPING_2390 = 5, }; #define AMF_VIDEO_CONVERTER_OUTPUT_FORMAT L"OutputFormat" // Values : AMF_SURFACE_NV12 or AMF_SURFACE_BGRA or AMF_SURFACE_YUV420P #define AMF_VIDEO_CONVERTER_MEMORY_TYPE L"MemoryType" // Values : AMF_MEMORY_DX11 or AMF_MEMORY_DX9 or AMF_MEMORY_UNKNOWN (get from input type) #define AMF_VIDEO_CONVERTER_COMPUTE_DEVICE L"ComputeDevice" // Values : AMF_MEMORY_COMPUTE_FOR_DX9 enumeration #define AMF_VIDEO_CONVERTER_OUTPUT_SIZE L"OutputSize" // AMFSize (default=0,0) width in pixels. default means no scaling #define AMF_VIDEO_CONVERTER_OUTPUT_RECT L"OutputRect" // AMFRect (default=0, 0, 0, 0) rectangle in pixels. default means no rect #define AMF_VIDEO_CONVERTER_SCALE L"ScaleType" // amf_int64(AMF_VIDEO_CONVERTER_SCALE_ENUM); default = AMF_VIDEO_CONVERTER_SCALE_BILINEAR #define AMF_VIDEO_CONVERTER_FORCE_OUTPUT_SURFACE_SIZE L"ForceOutputSurfaceSize" // bool (default=false) Force output size from output surface #define AMF_VIDEO_CONVERTER_KEEP_ASPECT_RATIO L"KeepAspectRatio" // bool (default=false) Keep aspect ratio if scaling. #define AMF_VIDEO_CONVERTER_FILL L"Fill" // bool (default=false) fill area out of ROI. #define AMF_VIDEO_CONVERTER_FILL_COLOR L"FillColor" // AMFColor //------------------------------------------------------------------------------------------------- // SDR color conversion //------------------------------------------------------------------------------------------------- #define AMF_VIDEO_CONVERTER_COLOR_PROFILE L"ColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO #define AMF_VIDEO_CONVERTER_LINEAR_RGB L"LinearRGB" // bool (default=false) Convert to/from linear RGB instead of sRGB using AMF_VIDEO_DECODER_COLOR_TRANSFER_CHARACTERISTIC or by default AMF_VIDEO_CONVERTER_TRANSFER_CHARACTERISTIC //------------------------------------------------------------------------------------------------- // HDR color conversion //------------------------------------------------------------------------------------------------- // AMF_VIDEO_CONVERTER_COLOR_PROFILE is used to define color space conversion // HDR data - can be set on converter or respectively on input and output surfaces (output surface via custom allocator) // if present, HDR_METADATA primary color overwrites COLOR_PRIMARIES // these properties can be set on converter component to configure input and output // these properties overwrite properties set on surface - see below #define AMF_VIDEO_CONVERTER_INPUT_TRANSFER_CHARACTERISTIC L"InputTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2 See ColorSpace.h for enum #define AMF_VIDEO_CONVERTER_INPUT_COLOR_PRIMARIES L"InputColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 7.1 See ColorSpace.h for enum #define AMF_VIDEO_CONVERTER_INPUT_COLOR_RANGE L"InputColorRange" // amf_int64(AMF_COLOR_RANGE_ENUM) default = AMF_COLOR_RANGE_UNDEFINED #define AMF_VIDEO_CONVERTER_INPUT_HDR_METADATA L"InputHdrMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL #define AMF_VIDEO_CONVERTER_INPUT_TONEMAPPING L"InputTonemapping" // amf_int64(AMF_VIDEO_CONVERTER_TONEMAPPING_ENUM) default = AMF_VIDEO_CONVERTER_TONEMAPPING_LINEAR #define AMF_VIDEO_CONVERTER_OUTPUT_TRANSFER_CHARACTERISTIC L"OutputTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2 See ColorSpace.h for enum #define AMF_VIDEO_CONVERTER_OUTPUT_COLOR_PRIMARIES L"OutputColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 7.1 See ColorSpace.h for enum #define AMF_VIDEO_CONVERTER_OUTPUT_COLOR_RANGE L"OutputColorRange" // amf_int64(AMF_COLOR_RANGE_ENUM) default = AMF_COLOR_RANGE_UNDEFINED #define AMF_VIDEO_CONVERTER_OUTPUT_HDR_METADATA L"OutputHdrMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL #define AMF_VIDEO_CONVERTER_OUTPUT_TONEMAPPING L"OutputTonemapping" // amf_int64(AMF_VIDEO_CONVERTER_TONEMAPPING_ENUM) default = AMF_VIDEO_CONVERTER_TONEMAPPING_AMD // these properties can be set on input or outout surface See ColorSpace.h // the same as decoder properties set on input surface - see below //#define AMF_VIDEO_COLOR_TRANSFER_CHARACTERISTIC L"ColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2 See ColorSpace.h for enum //#define AMF_VIDEO_COLOR_PRIMARIES L"ColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 7.1 See ColorSpace.h for enum //#define AMF_VIDEO_COLOR_RANGE L"ColorRange" // amf_int64(AMF_COLOR_RANGE_ENUM) default = AMF_COLOR_RANGE_UNDEFINED //#define AMF_VIDEO_COLOR_HDR_METADATA L"HdrMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL // If decoder properties can be set on input see VideoDecoder.h // AMF_VIDEO_DECODER_COLOR_TRANSFER_CHARACTERISTIC // AMF_VIDEO_DECODER_COLOR_PRIMARIES // AMF_VIDEO_DECODER_COLOR_RANGE // AMF_VIDEO_DECODER_HDR_METADATA #define AMF_VIDEO_CONVERTER_USE_DECODER_HDR_METADATA L"UseDecoderHDRMetadata" // bool (default=true) enables use of decoder / surface input color properties above #endif //#ifndef AMF_VideoConverter_h 07070100000024000081A400000000000000000000000163CFF5E70000239E000000000000000000000000000000000000003B00000000AMF-1.4.29/amf/public/include/components/VideoDecoderUVD.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // VideoDecoderUVD interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_VideoDecoderUVD_h #define AMF_VideoDecoderUVD_h #pragma once #include "Component.h" #include "ColorSpace.h" #define AMFVideoDecoderUVD_MPEG2 L"AMFVideoDecoderUVD_MPEG2" #define AMFVideoDecoderUVD_MPEG4 L"AMFVideoDecoderUVD_MPEG4" #define AMFVideoDecoderUVD_WMV3 L"AMFVideoDecoderUVD_WMV3" #define AMFVideoDecoderUVD_VC1 L"AMFVideoDecoderUVD_VC1" #define AMFVideoDecoderUVD_H264_AVC L"AMFVideoDecoderUVD_H264_AVC" #define AMFVideoDecoderUVD_H264_MVC L"AMFVideoDecoderUVD_H264_MVC" #define AMFVideoDecoderUVD_H264_SVC L"AMFVideoDecoderUVD_H264_SVC" #define AMFVideoDecoderUVD_MJPEG L"AMFVideoDecoderUVD_MJPEG" #define AMFVideoDecoderHW_H265_HEVC L"AMFVideoDecoderHW_H265_HEVC" #define AMFVideoDecoderHW_H265_MAIN10 L"AMFVideoDecoderHW_H265_MAIN10" #define AMFVideoDecoderHW_VP9 L"AMFVideoDecoderHW_VP9" #define AMFVideoDecoderHW_VP9_10BIT L"AMFVideoDecoderHW_VP9_10BIT" #define AMFVideoDecoderHW_AV1 L"AMFVideoDecoderHW_AV1" #define AMFVideoDecoderHW_AV1_12BIT L"AMFVideoDecoderHW_AV1_12BIT" enum AMF_VIDEO_DECODER_MODE_ENUM { AMF_VIDEO_DECODER_MODE_REGULAR = 0, // DPB delay is based on number of reference frames + 1 (from SPS) AMF_VIDEO_DECODER_MODE_COMPLIANT, // DPB delay is based on profile - up to 16 AMF_VIDEO_DECODER_MODE_LOW_LATENCY, // DPB delay is 0. Expect stream with no reordering in P-Frames or B-Frames. B-frames can be present as long as they do not introduce any frame re-ordering }; enum AMF_TIMESTAMP_MODE_ENUM { AMF_TS_PRESENTATION = 0, // default. decoder will preserve timestamps from input to output AMF_TS_SORT, // decoder will resort PTS list AMF_TS_DECODE // timestamps reflect decode order - decoder will reuse them }; #define AMF_VIDEO_DECODER_SURFACE_COPY L"SurfaceCopy" // amf_bool; default = false; return output surfaces as a copy #define AMF_VIDEO_DECODER_EXTRADATA L"ExtraData" // AMFInterface* -> AMFBuffer* - AVCC - size length + SPS/PPS; or as Annex B. Optional if stream is Annex B #define AMF_VIDEO_DECODER_FRAME_RATE L"FrameRate" // amf_double; default = 0.0, optional property to restore duration in the output if needed #define AMF_TIMESTAMP_MODE L"TimestampMode" // amf_int64(AMF_TIMESTAMP_MODE_ENUM) - default AMF_TS_PRESENTATION - how input timestamps are treated // dynamic/adaptive resolution change #define AMF_VIDEO_DECODER_ADAPTIVE_RESOLUTION_CHANGE L"AdaptiveResolutionChange" // amf_bool; default = false; reuse allocated surfaces if new resolution is smaller #define AMF_VIDEO_DECODER_ALLOC_SIZE L"AllocSize" // AMFSize; default (1920,1088); size of allocated surface if AdaptiveResolutionChange is true #define AMF_VIDEO_DECODER_CURRENT_SIZE L"CurrentSize" // AMFSize; default = (0,0); current size of the video // reference frame management #define AMF_VIDEO_DECODER_REORDER_MODE L"ReorderMode" // amf_int64(AMF_VIDEO_DECODER_MODE_ENUM); default = AMF_VIDEO_DECODER_MODE_REGULAR; defines number of surfaces in DPB list. #define AMF_VIDEO_DECODER_SURFACE_POOL_SIZE L"SurfacePoolSize" // amf_int64; number of surfaces in the decode pool = DPB list size + number of surfaces for presentation #define AMF_VIDEO_DECODER_DPB_SIZE L"DPBSize" // amf_int64; minimum number of surfaces for reordering #define AMF_VIDEO_DECODER_DEFAULT_SURFACES_FOR_TRANSIT 5 // if AMF_VIDEO_DECODER_SURFACE_POOL_SIZE is 0 , AMF_VIDEO_DECODER_SURFACE_POOL_SIZE=AMF_VIDEO_DECODER_DEFAULT_SURFACES_FOR_TRANSIT+AMF_VIDEO_DECODER_DPB_SIZE // Decoder capabilities - exposed in AMFCaps interface #define AMF_VIDEO_DECODER_CAP_NUM_OF_STREAMS L"NumOfStreams" // amf_int64; maximum number of decode streams supported // metadata information: can be set on output surface // Properties could be set on surface based on HDR SEI or VUI header #define AMF_VIDEO_DECODER_COLOR_TRANSFER_CHARACTERISTIC L"ColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2 #define AMF_VIDEO_DECODER_COLOR_PRIMARIES L"ColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 7.1 #define AMF_VIDEO_DECODER_HDR_METADATA L"HdrMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL /////// AMF_VIDEO_DECODER_FULL_RANGE_COLOR deprecated, use AMF_VIDEO_DECODER_COLOR_RANGE #define AMF_VIDEO_DECODER_FULL_RANGE_COLOR L"FullRangeColor" // bool; default = false; false = studio range, true = full range /////// #define AMF_VIDEO_DECODER_COLOR_RANGE L"ColorRange" // amf_int64(AMF_COLOR_RANGE_ENUM) default = AMF_COLOR_RANGE_UNDEFINED // can be set on output surface if YUV outout or on component to overwrite VUI #define AMF_VIDEO_DECODER_COLOR_PROFILE L"ColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO // properties to be set on decoder if internal converter is used #define AMF_VIDEO_DECODER_OUTPUT_TRANSFER_CHARACTERISTIC L"OutColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2 See VideoDecoderUVD.h for enum #define AMF_VIDEO_DECODER_OUTPUT_COLOR_PRIMARIES L"OutputColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 7.1 See ColorSpace.h for enum #define AMF_VIDEO_DECODER_OUTPUT_HDR_METADATA L"OutHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL #define AMF_VIDEO_DECODER_LOW_LATENCY L"LowLatencyDecode" // amf_bool; default = false; true = low latency decode, false = regular decode #if defined(__ANDROID__) #define AMF_VIDEO_DECODER_NATIVEWINDOW L"AndroidNativeWindow" // amf_int64; default = 0; pointer to native window #endif //__ANDROID__ #if defined(__APPLE__) #define AMF_VIDEO_DECODER_NATIVEWINDOW L"AppleNativeWindow" // amf_int64; default = 0; pointer to native window #endif //__APPLE__ #define AMF_VIDEO_DECODER_ENABLE_SMART_ACCESS_VIDEO L"EnableDecoderSmartAccessVideo" // amf_bool; default = false; true = enables smart access video feature #define AMF_VIDEO_DECODER_SKIP_TRANSFER_SMART_ACCESS_VIDEO L"SkipTransferSmartAccessVideo" // amf_bool; default = false; true = keeps output on GPU where it ran #endif //#ifndef AMF_VideoDecoderUVD_h 07070100000025000081A400000000000000000000000163CFF5E7000060BA000000000000000000000000000000000000003B00000000AMF-1.4.29/amf/public/include/components/VideoEncoderAV1.h// // Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // VideoEncoderHW_AV1 interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_VideoEncoderAV1_h #define AMF_VideoEncoderAV1_h #pragma once #include "Component.h" #include "ColorSpace.h" #include "PreAnalysis.h" #define AMFVideoEncoder_AV1 L"AMFVideoEncoderHW_AV1" enum AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_ENUM { AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_NONE = 0, // No encoding latency requirement. Encoder will balance encoding time and power consumption. AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_POWER_SAVING_REAL_TIME = 1, // Try the best to finish encoding a frame within 1/framerate sec. This mode may cause more power consumption AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_REAL_TIME = 2, // Try the best to finish encoding a frame within 1/(2 x framerate) sec. This mode will cause more power consumption than POWER_SAVING_REAL_TIME AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_LOWEST_LATENCY = 3 // Encoding as fast as possible. This mode causes highest power consumption. }; enum AMF_VIDEO_ENCODER_AV1_USAGE_ENUM { AMF_VIDEO_ENCODER_AV1_USAGE_TRANSCODING = 0, AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY = 1 }; enum AMF_VIDEO_ENCODER_AV1_PROFILE_ENUM { AMF_VIDEO_ENCODER_AV1_PROFILE_MAIN = 1 }; enum AMF_VIDEO_ENCODER_AV1_LEVEL_ENUM { AMF_VIDEO_ENCODER_AV1_LEVEL_2_0 = 0, AMF_VIDEO_ENCODER_AV1_LEVEL_2_1 = 1, AMF_VIDEO_ENCODER_AV1_LEVEL_2_2 = 2, AMF_VIDEO_ENCODER_AV1_LEVEL_2_3 = 3, AMF_VIDEO_ENCODER_AV1_LEVEL_3_0 = 4, AMF_VIDEO_ENCODER_AV1_LEVEL_3_1 = 5, AMF_VIDEO_ENCODER_AV1_LEVEL_3_2 = 6, AMF_VIDEO_ENCODER_AV1_LEVEL_3_3 = 7, AMF_VIDEO_ENCODER_AV1_LEVEL_4_0 = 8, AMF_VIDEO_ENCODER_AV1_LEVEL_4_1 = 9, AMF_VIDEO_ENCODER_AV1_LEVEL_4_2 = 10, AMF_VIDEO_ENCODER_AV1_LEVEL_4_3 = 11, AMF_VIDEO_ENCODER_AV1_LEVEL_5_0 = 12, AMF_VIDEO_ENCODER_AV1_LEVEL_5_1 = 13, AMF_VIDEO_ENCODER_AV1_LEVEL_5_2 = 14, AMF_VIDEO_ENCODER_AV1_LEVEL_5_3 = 15, AMF_VIDEO_ENCODER_AV1_LEVEL_6_0 = 16, AMF_VIDEO_ENCODER_AV1_LEVEL_6_1 = 17, AMF_VIDEO_ENCODER_AV1_LEVEL_6_2 = 18, AMF_VIDEO_ENCODER_AV1_LEVEL_6_3 = 19, AMF_VIDEO_ENCODER_AV1_LEVEL_7_0 = 20, AMF_VIDEO_ENCODER_AV1_LEVEL_7_1 = 21, AMF_VIDEO_ENCODER_AV1_LEVEL_7_2 = 22, AMF_VIDEO_ENCODER_AV1_LEVEL_7_3 = 23 }; enum AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_ENUM { AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_UNKNOWN = -1, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP = 0, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR = 1, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR = 2, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CBR = 3, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_QUALITY_VBR = 4, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_HIGH_QUALITY_VBR = 5, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_HIGH_QUALITY_CBR = 6 }; enum AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM { AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_64X16_ONLY = 1, AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_64X16_1080P_CODED_1082 = 2, AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_NO_RESTRICTIONS = 3 }; enum AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_ENUM { AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_NONE = 0, AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_KEY = 1, AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_INTRA_ONLY = 2, AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_SWITCH = 3, AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_SHOW_EXISTING = 4 }; enum AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_ENUM { AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_KEY = 0, AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_INTRA_ONLY = 1, AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_INTER = 2, AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_SWITCH = 3, AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_SHOW_EXISTING = 4 }; enum AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_ENUM { AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_HIGH_QUALITY = 0, AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_QUALITY = 30, AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_BALANCED = 70, AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_SPEED = 100 }; enum AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_ENUM { AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_NONE = 0, AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_GOP_ALIGNED = 1, AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_KEY_FRAME_ALIGNED = 2 }; enum AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE_ENUM { AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE_NONE = 0, AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE_FIXED_INTERVAL = 1 }; enum AMF_VIDEO_ENCODER_AV1_CDEF_MODE_ENUM { AMF_VIDEO_ENCODER_AV1_CDEF_DISABLE = 0, AMF_VIDEO_ENCODER_AV1_CDEF_ENABLE_DEFAULT = 1 }; enum AMF_VIDEO_ENCODER_AV1_CDF_FRAME_END_UPDATE_MODE_ENUM { AMF_VIDEO_ENCODER_AV1_CDF_FRAME_END_UPDATE_MODE_DISABLE = 0, AMF_VIDEO_ENCODER_AV1_CDF_FRAME_END_UPDATE_MODE_ENABLE_DEFAULT = 1 }; enum AMF_VIDEO_ENCODER_AV1_AQ_MODE_ENUM { AMF_VIDEO_ENCODER_AV1_AQ_MODE_NONE = 0, AMF_VIDEO_ENCODER_AV1_AQ_MODE_CAQ = 1 // Content adaptive quantization mode }; enum AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE_ENUM { AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE__DISABLED = 0, AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE__GOP_ALIGNED = 1, AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE__CONTINUOUS = 2 }; enum AMF_VIDEO_ENCODER_AV1_LTR_MODE_ENUM { AMF_VIDEO_ENCODER_AV1_LTR_MODE_RESET_UNUSED = 0, AMF_VIDEO_ENCODER_AV1_LTR_MODE_KEEP_UNUSED = 1 }; // *** Static properties - can be set only before Init() *** // Encoder Engine Settings #define AMF_VIDEO_ENCODER_AV1_ENCODER_INSTANCE_INDEX L"Av1EncoderInstanceIndex" // amf_int64; default = 0; selected HW instance idx. The number of instances is queried by using AMF_VIDEO_ENCODER_AV1_CAP_NUM_OF_HW_INSTANCES #define AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE L"Av1EncodingLatencyMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_ENUM); default = depends on USAGE; The encoding latency mode. #define AMF_VIDEO_ENCODER_AV1_QUERY_TIMEOUT L"Av1QueryTimeout" // amf_int64; default = 0 (no wait); timeout for QueryOutput call in ms. // Usage Settings #define AMF_VIDEO_ENCODER_AV1_USAGE L"Av1Usage" // amf_int64(AMF_VIDEO_ENCODER_AV1_USAGE_ENUM); default = N/A; Encoder usage. fully configures parameter set. // Session Configuration #define AMF_VIDEO_ENCODER_AV1_FRAMESIZE L"Av1FrameSize" // AMFSize; default = 0,0; Frame size #define AMF_VIDEO_ENCODER_AV1_COLOR_BIT_DEPTH L"Av1ColorBitDepth" // amf_int64(AMF_COLOR_BIT_DEPTH_ENUM); default = AMF_COLOR_BIT_DEPTH_8 #define AMF_VIDEO_ENCODER_AV1_PROFILE L"Av1Profile" // amf_int64(AMF_VIDEO_ENCODER_AV1_PROFILE_ENUM) ; default = depends on USAGE; the codec profile of the coded bitstream #define AMF_VIDEO_ENCODER_AV1_LEVEL L"Av1Level" // amf_int64 (AMF_VIDEO_ENCODER_AV1_LEVEL_ENUM); default = depends on USAGE; the codec level of the coded bitstream #define AMF_VIDEO_ENCODER_AV1_TILES_PER_FRAME L"Av1NumTilesPerFrame" // amf_int64; default = 1; Number of tiles Per Frame. This is treated as suggestion. The actual number of tiles might be different due to compliance or encoder limitation. #define AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET L"Av1QualityPreset" // amf_int64(AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_ENUM); default = depends on USAGE; Quality Preset // Codec Configuration #define AMF_VIDEO_ENCODER_AV1_SCREEN_CONTENT_TOOLS L"Av1ScreenContentTools" // bool; default = depends on USAGE; If true, allow enabling screen content tools by AMF_VIDEO_ENCODER_AV1_PALETTE_MODE and AMF_VIDEO_ENCODER_AV1_FORCE_INTEGER_MV; if false, all screen content tools are disabled. #define AMF_VIDEO_ENCODER_AV1_ORDER_HINT L"Av1OrderHint" // bool; default = depends on USAGE; If true, code order hint; if false, don't code order hint #define AMF_VIDEO_ENCODER_AV1_FRAME_ID L"Av1FrameId" // bool; default = depends on USAGE; If true, code frame id; if false, don't code frame id #define AMF_VIDEO_ENCODER_AV1_TILE_GROUP_OBU L"Av1TileGroupObu" // bool; default = depends on USAGE; If true, code FrameHeaderObu + TileGroupObu and each TileGroupObu contains one tile; if false, code FrameObu. #define AMF_VIDEO_ENCODER_AV1_CDEF_MODE L"Av1CdefMode" // amd_int64(AMF_VIDEO_ENCODER_AV1_CDEF_MODE_ENUM); default = depends on USAGE; Cdef mode #define AMF_VIDEO_ENCODER_AV1_ERROR_RESILIENT_MODE L"Av1ErrorResilientMode" // bool; default = depends on USAGE; If true, enable error resilient mode; if false, disable error resilient mode // Rate Control and Quality Enhancement #define AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD L"Av1RateControlMethod" // amf_int64(AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_ENUM); default = depends on USAGE; Rate Control Method #define AMF_VIDEO_ENCODER_AV1_QVBR_QUALITY_LEVEL L"Av1QvbrQualityLevel" // amf_int64; default = 23; QVBR quality level; range = 1-51 #define AMF_VIDEO_ENCODER_AV1_INITIAL_VBV_BUFFER_FULLNESS L"Av1InitialVBVBufferFullness" // amf_int64; default = depends on USAGE; Initial VBV Buffer Fullness 0=0% 64=100% // Alignment Mode Configuration #define AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE L"Av1AlignmentMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM); default = AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_64X16_ONLY; Alignment Mode. #define AMF_VIDEO_ENCODER_AV1_PRE_ANALYSIS_ENABLE L"Av1EnablePreAnalysis" // bool; default = depends on USAGE; If true, enables the pre-analysis module. Refer to AMF Video PreAnalysis API reference for more details. If false, disable the pre-analysis module. #define AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_PREENCODE L"Av1RateControlPreEncode" // bool; default = depends on USAGE; If true, enables pre-encode assist in rate control; if false, disables pre-encode assist in rate control. #define AMF_VIDEO_ENCODER_AV1_HIGH_MOTION_QUALITY_BOOST L"Av1HighMotionQualityBoost" // bool; default = depends on USAGE; If true, enable high motion quality boost mode; if false, disable high motion quality boost mode. #define AMF_VIDEO_ENCODER_AV1_AQ_MODE L"Av1AQMode" // amd_int64(AMF_VIDEO_ENCODER_AV1_AQ_MODE_ENUM); default = depends on USAGE; AQ mode // Picture Management Configuration #define AMF_VIDEO_ENCODER_AV1_MAX_NUM_TEMPORAL_LAYERS L"Av1MaxNumOfTemporalLayers" // amf_int64; default = depends on USAGE; Max number of temporal layers might be enabled. The maximum value can be queried from AMF_VIDEO_ENCODER_AV1_CAP_MAX_NUM_TEMPORAL_LAYERS #define AMF_VIDEO_ENCODER_AV1_MAX_LTR_FRAMES L"Av1MaxNumLTRFrames" // amf_int64; default = depends on USAGE; Max number of LTR frames. The maximum value can be queried from AMF_VIDEO_ENCODER_AV1_CAP_MAX_NUM_LTR_FRAMES #define AMF_VIDEO_ENCODER_AV1_LTR_MODE L"Av1LTRMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_LTR_MODE_ENUM); default = AMF_VIDEO_ENCODER_AV1_LTR_MODE_RESET_UNUSED; remove/keep unused LTRs (not specified in property AMF_VIDEO_ENCODER_AV1_FORCE_LTR_REFERENCE_BITFIELD) #define AMF_VIDEO_ENCODER_AV1_MAX_NUM_REFRAMES L"Av1MaxNumRefFrames" // amf_int64; default = 1; Maximum number of reference frames // color conversion #define AMF_VIDEO_ENCODER_AV1_INPUT_HDR_METADATA L"Av1InHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL // Miscellaneous #define AMF_VIDEO_ENCODER_AV1_EXTRA_DATA L"Av1ExtraData" // AMFInterface* - > AMFBuffer*; buffer to retrieve coded sequence header // *** Dynamic properties - can be set anytime *** // Codec Configuration #define AMF_VIDEO_ENCODER_AV1_PALETTE_MODE L"Av1PaletteMode" // bool; default = depends on USAGE; If true, enable palette mode; if false, disable palette mode. Valid only when AMF_VIDEO_ENCODER_AV1_SCREEN_CONTENT_TOOLS is true. #define AMF_VIDEO_ENCODER_AV1_FORCE_INTEGER_MV L"Av1ForceIntegerMv" // bool; default = depends on USAGE; If true, enable force integer MV; if false, disable force integer MV. Valid only when AMF_VIDEO_ENCODER_AV1_SCREEN_CONTENT_TOOLS is true. #define AMF_VIDEO_ENCODER_AV1_CDF_UPDATE L"Av1CdfUpdate" // bool; default = depends on USAGE; If true, enable CDF update; if false, disable CDF update. #define AMF_VIDEO_ENCODER_AV1_CDF_FRAME_END_UPDATE_MODE L"Av1CdfFrameEndUpdateMode" // amd_int64(AMF_VIDEO_ENCODER_AV1_CDF_FRAME_END_UPDATE_MODE_ENUM); default = depends on USAGE; CDF frame end update mode // Rate Control and Quality Enhancement #define AMF_VIDEO_ENCODER_AV1_VBV_BUFFER_SIZE L"Av1VBVBufferSize" // amf_int64; default = depends on USAGE; VBV Buffer Size in bits #define AMF_VIDEO_ENCODER_AV1_FRAMERATE L"Av1FrameRate" // AMFRate; default = depends on usage; Frame Rate #define AMF_VIDEO_ENCODER_AV1_ENFORCE_HRD L"Av1EnforceHRD" // bool; default = depends on USAGE; If true, enforce HRD; if false, HRD is not enforced. #define AMF_VIDEO_ENCODER_AV1_FILLER_DATA L"Av1FillerData" // bool; default = depends on USAGE; If true, code filler data when needed; if false, don't code filler data. #define AMF_VIDEO_ENCODER_AV1_TARGET_BITRATE L"Av1TargetBitrate" // amf_int64; default = depends on USAGE; Target bit rate in bits #define AMF_VIDEO_ENCODER_AV1_PEAK_BITRATE L"Av1PeakBitrate" // amf_int64; default = depends on USAGE; Peak bit rate in bits #define AMF_VIDEO_ENCODER_AV1_MAX_COMPRESSED_FRAME_SIZE L"Av1MaxCompressedFrameSize" // amf_int64; default = 0; Max compressed frame Size in bits. 0 - no limit #define AMF_VIDEO_ENCODER_AV1_MIN_Q_INDEX_INTRA L"Av1MinQIndex_Intra" // amf_int64; default = depends on USAGE; Min QIndex for intra frames; range = 0-255 #define AMF_VIDEO_ENCODER_AV1_MAX_Q_INDEX_INTRA L"Av1MaxQIndex_Intra" // amf_int64; default = depends on USAGE; Max QIndex for intra frames; range = 0-255 #define AMF_VIDEO_ENCODER_AV1_MIN_Q_INDEX_INTER L"Av1MinQIndex_Inter" // amf_int64; default = depends on USAGE; Min QIndex for inter frames; range = 0-255 #define AMF_VIDEO_ENCODER_AV1_MAX_Q_INDEX_INTER L"Av1MaxQIndex_Inter" // amf_int64; default = depends on USAGE; Max QIndex for inter frames; range = 0-255 #define AMF_VIDEO_ENCODER_AV1_Q_INDEX_INTRA L"Av1QIndex_Intra" // amf_int64; default = depends on USAGE; intra-frame QIndex; range = 0-255 #define AMF_VIDEO_ENCODER_AV1_Q_INDEX_INTER L"Av1QIndex_Inter" // amf_int64; default = depends on USAGE; inter-frame QIndex; range = 0-255 #define AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_SKIP_FRAME L"Av1RateControlSkipFrameEnable" // bool; default = depends on USAGE; If true, rate control may code skip frame when needed; if false, rate control will not code skip frame. // Picture Management Configuration #define AMF_VIDEO_ENCODER_AV1_GOP_SIZE L"Av1GOPSize" // amf_int64; default = depends on USAGE; GOP Size (distance between automatically inserted key frames). If 0, key frame will be inserted at first frame only. Note that GOP may be interrupted by AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE. #define AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE L"Av1HeaderInsertionMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_ENUM); default = depends on USAGE; sequence header insertion mode #define AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE L"Av1SwitchFrameInsertionMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE_ENUM); default = depends on USAGE; switch frame insertin mode #define AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INTERVAL L"Av1SwitchFrameInterval" // amf_int64; default = depends on USAGE; the interval between two inserted switch frames. Valid only when AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE is AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE_FIXED_INTERVAL. #define AMF_VIDEO_ENCODER_AV1_NUM_TEMPORAL_LAYERS L"Av1NumTemporalLayers" // amf_int64; default = depends on USAGE; Number of temporal layers. Can be changed at any time but the change is only applied when encoding next base layer frame. #define AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE L"Av1IntraRefreshMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE_ENUM); default AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE__DISABLED #define AMF_VIDEO_ENCODER_AV1_INTRAREFRESH_STRIPES L"Av1IntraRefreshNumOfStripes" // amf_int64; default = N/A; Valid only when intra refresh is enabled. // color conversion #define AMF_VIDEO_ENCODER_AV1_INPUT_COLOR_PROFILE L"Av1InputColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size #define AMF_VIDEO_ENCODER_AV1_INPUT_TRANSFER_CHARACTERISTIC L"Av1InputColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 section 7.2 See VideoDecoderUVD.h for enum #define AMF_VIDEO_ENCODER_AV1_INPUT_COLOR_PRIMARIES L"Av1InputColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 section 7.1 See ColorSpace.h for enum #define AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PROFILE L"Av1OutputColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size #define AMF_VIDEO_ENCODER_AV1_OUTPUT_TRANSFER_CHARACTERISTIC L"Av1OutputColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 ?7.2 See VideoDecoderUVD.h for enum #define AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PRIMARIES L"Av1OutputColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 section 7.1 See ColorSpace.h for enum // Frame encode parameters #define AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE L"Av1ForceFrameType" // amf_int64(AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_ENUM); default = AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_NONE; generate particular frame type #define AMF_VIDEO_ENCODER_AV1_FORCE_INSERT_SEQUENCE_HEADER L"Av1ForceInsertSequenceHeader" // bool; default = false; If true, force insert sequence header with current frame; #define AMF_VIDEO_ENCODER_AV1_MARK_CURRENT_WITH_LTR_INDEX L"Av1MarkCurrentWithLTRIndex" // amf_int64; default = N/A; Mark current frame with LTR index #define AMF_VIDEO_ENCODER_AV1_FORCE_LTR_REFERENCE_BITFIELD L"Av1ForceLTRReferenceBitfield" // amf_int64; default = 0; force LTR bit-field #define AMF_VIDEO_ENCODER_AV1_ROI_DATA L"Av1ROIData" // 2D AMFSurface, surface format: AMF_SURFACE_GRAY32 // Encode output parameters #define AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE L"Av1OutputFrameType" // amf_int64(AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_ENUM); default = N/A #define AMF_VIDEO_ENCODER_AV1_OUTPUT_MARKED_LTR_INDEX L"Av1MarkedLTRIndex" // amf_int64; default = N/A; Marked LTR index #define AMF_VIDEO_ENCODER_AV1_OUTPUT_REFERENCED_LTR_INDEX_BITFIELD L"Av1ReferencedLTRIndexBitfield" // amf_int64; default = N/A; referenced LTR bit-field // AV1 Encoder capabilities - exposed in AMFCaps interface #define AMF_VIDEO_ENCODER_AV1_CAP_NUM_OF_HW_INSTANCES L"Av1CapNumOfHwInstances" // amf_int64; default = N/A; number of HW encoder instances #define AMF_VIDEO_ENCODER_AV1_CAP_MAX_THROUGHPUT L"Av1CapMaxThroughput" // amf_int64; default = N/A; MAX throughput for AV1 encoder in MB (16 x 16 pixel) #define AMF_VIDEO_ENCODER_AV1_CAP_REQUESTED_THROUGHPUT L"Av1CapRequestedThroughput" // amf_int64; default = N/A; Currently total requested throughput for AV1 encode in MB (16 x 16 pixel) #define AMF_VIDEO_ENCODER_AV1_CAP_COLOR_CONVERSION L"Av1CapColorConversion" // amf_int64(AMF_ACCELERATION_TYPE); default = N/A; type of supported color conversion. default AMF_ACCEL_GPU #define AMF_VIDEO_ENCODER_AV1_CAP_PRE_ANALYSIS L"Av1PreAnalysis" // amf_bool - pre analysis module is available for AV1 UVE encoder, n/a for the other encoders #define AMF_VIDEO_ENCODER_AV1_CAP_MAX_BITRATE L"Av1MaxBitrate" // amf_int64; default = N/A; Maximum bit rate in bits #define AMF_VIDEO_ENCODER_AV1_CAP_MAX_PROFILE L"Av1MaxProfile" // amf_int64(AMF_VIDEO_ENCODER_AV1_PROFILE_ENUM); default = N/A; max value of code profile #define AMF_VIDEO_ENCODER_AV1_CAP_MAX_LEVEL L"Av1MaxLevel" // amf_int64(AMF_VIDEO_ENCODER_AV1_LEVEL_ENUM); default = N/A; max value of codec level #define AMF_VIDEO_ENCODER_AV1_CAP_MAX_NUM_TEMPORAL_LAYERS L"Av1CapMaxNumTemporalLayers" // amf_int64; default = N/A; The cap of maximum number of temporal layers #define AMF_VIDEO_ENCODER_AV1_CAP_MAX_NUM_LTR_FRAMES L"Av1CapMaxNumLTRFrames" // amf_int64; default = N/A; The cap of maximum number of LTR frames. This value is calculated based on current value of AMF_VIDEO_ENCODER_AV1_MAX_NUM_TEMPORAL_LAYERS. #define AMF_VIDEO_ENCODER_AV1_ENABLE_SMART_ACCESS_VIDEO L"Av1EnableEncoderSmartAccessVideo" // amf_bool; default = false; true = enables smart access video feature #endif //#ifndef AMF_VideoEncoderAV1_h 07070100000026000081A400000000000000000000000163CFF5E70000686A000000000000000000000000000000000000003C00000000AMF-1.4.29/amf/public/include/components/VideoEncoderHEVC.h// // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // VideoEncoderHW_HEVC interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_VideoEncoderHEVC_h #define AMF_VideoEncoderHEVC_h #pragma once #include "Component.h" #include "ColorSpace.h" #include "PreAnalysis.h" #define AMFVideoEncoder_HEVC L"AMFVideoEncoderHW_HEVC" enum AMF_VIDEO_ENCODER_HEVC_USAGE_ENUM { AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING = 0, // kept for backwards compatability AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING = 0, // fixed typo AMF_VIDEO_ENCODER_HEVC_USAGE_ULTRA_LOW_LATENCY, AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY, AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM, AMF_VIDEO_ENCODER_HEVC_USAGE_HIGH_QUALITY, AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY }; enum AMF_VIDEO_ENCODER_HEVC_PROFILE_ENUM { AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN = 1, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN_10 = 2 }; enum AMF_VIDEO_ENCODER_HEVC_TIER_ENUM { AMF_VIDEO_ENCODER_HEVC_TIER_MAIN = 0, AMF_VIDEO_ENCODER_HEVC_TIER_HIGH = 1 }; enum AMF_VIDEO_ENCODER_LEVEL_ENUM { AMF_LEVEL_1 = 30, AMF_LEVEL_2 = 60, AMF_LEVEL_2_1 = 63, AMF_LEVEL_3 = 90, AMF_LEVEL_3_1 = 93, AMF_LEVEL_4 = 120, AMF_LEVEL_4_1 = 123, AMF_LEVEL_5 = 150, AMF_LEVEL_5_1 = 153, AMF_LEVEL_5_2 = 156, AMF_LEVEL_6 = 180, AMF_LEVEL_6_1 = 183, AMF_LEVEL_6_2 = 186 }; enum AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_ENUM { AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_UNKNOWN = -1, AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP = 0, AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR, AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR, AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CBR, AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_QUALITY_VBR, AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_HIGH_QUALITY_VBR, AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_HIGH_QUALITY_CBR }; enum AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_ENUM { AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_NONE = 0, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_SKIP, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_IDR, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_I, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_P }; enum AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_ENUM { AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_IDR, AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_I, AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_P }; enum AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_ENUM { AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_QUALITY = 0, AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_BALANCED = 5, AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_SPEED = 10 }; enum AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_ENUM { AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_NONE = 0, AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_GOP_ALIGNED, AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_IDR_ALIGNED }; enum AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_ENUM { AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_OFF = 0, AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_ON }; enum AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE { AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE_STUDIO = 0, AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE_FULL = 1 }; enum AMF_VIDEO_ENCODER_HEVC_LTR_MODE_ENUM { AMF_VIDEO_ENCODER_HEVC_LTR_MODE_RESET_UNUSED = 0, AMF_VIDEO_ENCODER_HEVC_LTR_MODE_KEEP_UNUSED }; // Static properties - can be set before Init() #define AMF_VIDEO_ENCODER_HEVC_INSTANCE_INDEX L"HevcEncoderInstance" // amf_int64; selected instance idx #define AMF_VIDEO_ENCODER_HEVC_FRAMESIZE L"HevcFrameSize" // AMFSize; default = 0,0; Frame size #define AMF_VIDEO_ENCODER_HEVC_USAGE L"HevcUsage" // amf_int64(AMF_VIDEO_ENCODER_HEVC_USAGE_ENUM); default = N/A; Encoder usage type. fully configures parameter set. #define AMF_VIDEO_ENCODER_HEVC_PROFILE L"HevcProfile" // amf_int64(AMF_VIDEO_ENCODER_HEVC_PROFILE_ENUM) ; default = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN; #define AMF_VIDEO_ENCODER_HEVC_TIER L"HevcTier" // amf_int64(AMF_VIDEO_ENCODER_HEVC_TIER_ENUM) ; default = AMF_VIDEO_ENCODER_HEVC_TIER_MAIN; #define AMF_VIDEO_ENCODER_HEVC_PROFILE_LEVEL L"HevcProfileLevel" // amf_int64 (AMF_VIDEO_ENCODER_LEVEL_ENUM, default depends on HW capabilities); #define AMF_VIDEO_ENCODER_HEVC_MAX_LTR_FRAMES L"HevcMaxOfLTRFrames" // amf_int64; default = 0; Max number of LTR frames #define AMF_VIDEO_ENCODER_HEVC_LTR_MODE L"HevcLTRMode" // amf_int64(AMF_VIDEO_ENCODER_HEVC_LTR_MODE_ENUM); default = AMF_VIDEO_ENCODER_HEVC_LTR_MODE_RESET_UNUSED; remove/keep unused LTRs (not specified in property AMF_VIDEO_ENCODER_HEVC_FORCE_LTR_REFERENCE_BITFIELD) #define AMF_VIDEO_ENCODER_HEVC_MAX_NUM_REFRAMES L"HevcMaxNumRefFrames" // amf_int64; default = 1; Maximum number of reference frames #define AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET L"HevcQualityPreset" // amf_int64(AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_ENUM); default = depends on USAGE; Quality Preset #define AMF_VIDEO_ENCODER_HEVC_EXTRADATA L"HevcExtraData" // AMFInterface* - > AMFBuffer*; SPS/PPS buffer - read-only #define AMF_VIDEO_ENCODER_HEVC_ASPECT_RATIO L"HevcAspectRatio" // AMFRatio; default = 1, 1 #define AMF_VIDEO_ENCODER_HEVC_LOWLATENCY_MODE L"LowLatencyInternal" // bool; default = false, enables low latency mode #define AMF_VIDEO_ENCODER_HEVC_PRE_ANALYSIS_ENABLE L"HevcEnablePreAnalysis" // bool; default = false; enables the pre-analysis module. Currently only works in AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR mode. Refer to AMF Video PreAnalysis API reference for more details. #define AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE L"HevcNominalRange" // amf_int64(AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE); default = amf_int64(AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE_STUDIO); property is bool but amf_int64 also works for backward compatibility. #define AMF_VIDEO_ENCODER_HEVC_MAX_NUM_TEMPORAL_LAYERS L"HevcMaxNumOfTemporalLayers" // amf_int64; default = 1; Max number of temporal layers. // Picture control properties #define AMF_VIDEO_ENCODER_HEVC_NUM_GOPS_PER_IDR L"HevcGOPSPerIDR" // amf_int64; default = 1; The frequency to insert IDR as start of a GOP. 0 means no IDR will be inserted. #define AMF_VIDEO_ENCODER_HEVC_GOP_SIZE L"HevcGOPSize" // amf_int64; default = 60; GOP Size, in frames #define AMF_VIDEO_ENCODER_HEVC_DE_BLOCKING_FILTER_DISABLE L"HevcDeBlockingFilter" // bool; default = depends on USAGE; De-blocking Filter #define AMF_VIDEO_ENCODER_HEVC_SLICES_PER_FRAME L"HevcSlicesPerFrame" // amf_int64; default = 1; Number of slices Per Frame #define AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE L"HevcHeaderInsertionMode" // amf_int64(AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_ENUM); default = NONE #define AMF_VIDEO_ENCODER_HEVC_INTRA_REFRESH_NUM_CTBS_PER_SLOT L"HevcIntraRefreshCTBsNumberPerSlot" // amf_int64; default = depends on USAGE; Intra Refresh CTBs Number Per Slot in 64x64 CTB // Rate control properties #define AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD L"HevcRateControlMethod" // amf_int64(AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_ENUM); default = depends on USAGE; Rate Control Method #define AMF_VIDEO_ENCODER_HEVC_QVBR_QUALITY_LEVEL L"HevcQvbrQualityLevel" // amf_int64; default = 23; QVBR quality level; range = 1-51 #define AMF_VIDEO_ENCODER_HEVC_VBV_BUFFER_SIZE L"HevcVBVBufferSize" // amf_int64; default = depends on USAGE; VBV Buffer Size in bits #define AMF_VIDEO_ENCODER_HEVC_INITIAL_VBV_BUFFER_FULLNESS L"HevcInitialVBVBufferFullness" // amf_int64; default = 64; Initial VBV Buffer Fullness 0=0% 64=100% #define AMF_VIDEO_ENCODER_HEVC_ENABLE_VBAQ L"HevcEnableVBAQ" // // bool; default = depends on USAGE; Enable auto VBAQ #define AMF_VIDEO_ENCODER_HEVC_HIGH_MOTION_QUALITY_BOOST_ENABLE L"HevcHighMotionQualityBoostEnable"// bool; default = depends on USAGE; Enable High motion quality boost mode #define AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE L"HevcRateControlPreAnalysisEnable" // bool; default = depends on USAGE; enables pre-encode assisted rate control #define AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_PREANALYSIS_ENABLE L"HevcRateControlPreAnalysisEnable" // bool; default = depends on USAGE; enables pre-encode assisted rate control. Deprecated, please use AMF_VIDEO_ENCODER_PREENCODE_ENABLE instead. #ifdef _MSC_VER #ifndef __clang__ #pragma deprecated("AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_PREANALYSIS_ENABLE") #endif #endif // Motion estimation #define AMF_VIDEO_ENCODER_HEVC_MOTION_HALF_PIXEL L"HevcHalfPixel" // bool; default= true; Half Pixel #define AMF_VIDEO_ENCODER_HEVC_MOTION_QUARTERPIXEL L"HevcQuarterPixel" // bool; default= true; Quarter Pixel // color conversion #define AMF_VIDEO_ENCODER_HEVC_COLOR_BIT_DEPTH L"HevcColorBitDepth" // amf_int64(AMF_COLOR_BIT_DEPTH_ENUM); default = AMF_COLOR_BIT_DEPTH_8 #define AMF_VIDEO_ENCODER_HEVC_INPUT_COLOR_PROFILE L"HevcInColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size #define AMF_VIDEO_ENCODER_HEVC_INPUT_TRANSFER_CHARACTERISTIC L"HevcInColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 section 7.2 See VideoDecoderUVD.h for enum #define AMF_VIDEO_ENCODER_HEVC_INPUT_COLOR_PRIMARIES L"HevcInColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 section 7.1 See ColorSpace.h for enum #define AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PROFILE L"HevcOutColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size #define AMF_VIDEO_ENCODER_HEVC_OUTPUT_TRANSFER_CHARACTERISTIC L"HevcOutColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 ?7.2 See VideoDecoderUVD.h for enum #define AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PRIMARIES L"HevcOutColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 section 7.1 See ColorSpace.h for enum // Dynamic properties - can be set at any time // Rate control properties #define AMF_VIDEO_ENCODER_HEVC_FRAMERATE L"HevcFrameRate" // AMFRate; default = depends on usage; Frame Rate #define AMF_VIDEO_ENCODER_HEVC_ENFORCE_HRD L"HevcEnforceHRD" // bool; default = depends on USAGE; Enforce HRD #define AMF_VIDEO_ENCODER_HEVC_FILLER_DATA_ENABLE L"HevcFillerDataEnable" // bool; default = depends on USAGE; Enforce HRD #define AMF_VIDEO_ENCODER_HEVC_TARGET_BITRATE L"HevcTargetBitrate" // amf_int64; default = depends on USAGE; Target bit rate in bits #define AMF_VIDEO_ENCODER_HEVC_PEAK_BITRATE L"HevcPeakBitrate" // amf_int64; default = depends on USAGE; Peak bit rate in bits #define AMF_VIDEO_ENCODER_HEVC_MAX_AU_SIZE L"HevcMaxAUSize" // amf_int64; default = 60; Max AU Size in bits #define AMF_VIDEO_ENCODER_HEVC_MIN_QP_I L"HevcMinQP_I" // amf_int64; default = depends on USAGE; Min QP; range = #define AMF_VIDEO_ENCODER_HEVC_MAX_QP_I L"HevcMaxQP_I" // amf_int64; default = depends on USAGE; Max QP; range = #define AMF_VIDEO_ENCODER_HEVC_MIN_QP_P L"HevcMinQP_P" // amf_int64; default = depends on USAGE; Min QP; range = #define AMF_VIDEO_ENCODER_HEVC_MAX_QP_P L"HevcMaxQP_P" // amf_int64; default = depends on USAGE; Max QP; range = #define AMF_VIDEO_ENCODER_HEVC_QP_I L"HevcQP_I" // amf_int64; default = 26; P-frame QP; range = 0-51 #define AMF_VIDEO_ENCODER_HEVC_QP_P L"HevcQP_P" // amf_int64; default = 26; P-frame QP; range = 0-51 #define AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_SKIP_FRAME_ENABLE L"HevcRateControlSkipFrameEnable" // bool; default = depends on USAGE; Rate Control Based Frame Skip // color conversion #define AMF_VIDEO_ENCODER_HEVC_INPUT_HDR_METADATA L"HevcInHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL //#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_HDR_METADATA L"HevcOutHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL // SVC #define AMF_VIDEO_ENCODER_HEVC_NUM_TEMPORAL_LAYERS L"HevcNumOfTemporalLayers" // amf_int64; default = 1; Number of temporal layers. Can be changed at any time but the change is only applied when encoding next base layer frame. // DPB management #define AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE L"HevcPicTransferMode" // amf_int64(AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_ENUM); default = AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_OFF - whether to exchange reference/reconstructed pic between encoder and application // misc #define AMF_VIDEO_ENCODER_HEVC_QUERY_TIMEOUT L"HevcQueryTimeout" // amf_int64; default = 0 (no wait); timeout for QueryOutput call in ms. // Per-submittion properties - can be set on input surface interface #define AMF_VIDEO_ENCODER_HEVC_END_OF_SEQUENCE L"HevcEndOfSequence" // bool; default = false; generate end of sequence #define AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE L"HevcForcePictureType" // amf_int64(AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_ENUM); default = AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_NONE; generate particular picture type #define AMF_VIDEO_ENCODER_HEVC_INSERT_AUD L"HevcInsertAUD" // bool; default = false; insert AUD #define AMF_VIDEO_ENCODER_HEVC_INSERT_HEADER L"HevcInsertHeader" // bool; default = false; insert header(SPS, PPS, VPS) #define AMF_VIDEO_ENCODER_HEVC_MARK_CURRENT_WITH_LTR_INDEX L"HevcMarkCurrentWithLTRIndex" // amf_int64; default = N/A; Mark current frame with LTR index #define AMF_VIDEO_ENCODER_HEVC_FORCE_LTR_REFERENCE_BITFIELD L"HevcForceLTRReferenceBitfield"// amf_int64; default = 0; force LTR bit-field #define AMF_VIDEO_ENCODER_HEVC_ROI_DATA L"HevcROIData" // 2D AMFSurface, surface format: AMF_SURFACE_GRAY32 #define AMF_VIDEO_ENCODER_HEVC_REFERENCE_PICTURE L"HevcReferencePicture" // AMFInterface(AMFSurface); surface used for frame injection #define AMF_VIDEO_ENCODER_HEVC_PSNR_FEEDBACK L"HevcPSNRFeedback" // amf_bool; default = false; Signal encoder to calculate PSNR score #define AMF_VIDEO_ENCODER_HEVC_SSIM_FEEDBACK L"HevcSSIMFeedback" // amf_bool; default = false; Signal encoder to calculate SSIM score #define AMF_VIDEO_ENCODER_HEVC_STATISTICS_FEEDBACK L"HevcStatisticsFeedback" // amf_bool; default = false; Signal encoder to collect and feedback encoder statistics #define AMF_VIDEO_ENCODER_HEVC_BLOCK_QP_FEEDBACK L"HevcBlockQpFeedback" // amf_bool; default = false; Signal encoder to collect and feedback block level QP values // Properties set by encoder on output buffer interface #define AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE L"HevcOutputDataType" // amf_int64(AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_ENUM); default = N/A #define AMF_VIDEO_ENCODER_HEVC_OUTPUT_MARKED_LTR_INDEX L"HevcMarkedLTRIndex" // amf_int64; default = -1; Marked LTR index #define AMF_VIDEO_ENCODER_HEVC_OUTPUT_REFERENCED_LTR_INDEX_BITFIELD L"HevcReferencedLTRIndexBitfield"// amf_int64; default = 0; referenced LTR bit-field #define AMF_VIDEO_ENCODER_HEVC_OUTPUT_TEMPORAL_LAYER L"HevcOutputTemporalLayer" // amf_int64; Temporal layer #define AMF_VIDEO_ENCODER_HEVC_RECONSTRUCTED_PICTURE L"HevcReconstructedPicture" // AMFInterface(AMFSurface); returns reconstructed picture as an AMFSurface attached to the output buffer as property AMF_VIDEO_ENCODER_RECONSTRUCTED_PICTURE of AMFInterface type #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PSNR_Y L"PSNRY" // double; PSNR Y #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PSNR_U L"PSNRU" // double; PSNR U #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PSNR_V L"PSNRV" // double; PSNR V #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PSNR_ALL L"PSNRALL" // double; PSNR All #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SSIM_Y L"SSIMY" // double; SSIM Y #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SSIM_U L"SSIMU" // double; SSIM U #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SSIM_V L"SSIMV" // double; SSIM V #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SSIM_ALL L"SSIMALL" // double; SSIM ALL // Encoder statistics feedback #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_FRAME_QP L"HevcStatisticsFeedbackFrameQP" // amf_int64; Rate control base frame/initial QP #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_AVERAGE_QP L"HevcStatisticsFeedbackAvgQP" // amf_int64; Average QP of all encoded CTBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped CTBs. #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_MAX_QP L"HevcStatisticsFeedbackMaxQP" // amf_int64; Max QP among all encoded CTBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped CTBs. #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_MIN_QP L"HevcStatisticsFeedbackMinQP" // amf_int64; Min QP among all encoded CTBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped CTBs. #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PIX_NUM_INTRA L"HevcStatisticsFeedbackPixNumIntra" // amf_int64; Number of the intra encoded pixels #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PIX_NUM_INTER L"HevcStatisticsFeedbackPixNumInter" // amf_int64; Number of the inter encoded pixels #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PIX_NUM_SKIP L"HevcStatisticsFeedbackPixNumSkip" // amf_int64; Number of the skip mode pixels #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_BITCOUNT_RESIDUAL L"HevcStatisticsFeedbackBitcountResidual" // amf_int64; The bit count that corresponds to residual data #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_BITCOUNT_MOTION L"HevcStatisticsFeedbackBitcountMotion" // amf_int64; The bit count that corresponds to motion vectors #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_BITCOUNT_INTER L"HevcStatisticsFeedbackBitcountInter" // amf_int64; The bit count that are assigned to inter CTBs #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_BITCOUNT_INTRA L"HevcStatisticsFeedbackBitcountIntra" // amf_int64; The bit count that are assigned to intra CTBs #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_BITCOUNT_ALL_MINUS_HEADER L"HevcStatisticsFeedbackBitcountAllMinusHeader" // amf_int64; The bit count of the bitstream excluding header #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_MV_X L"HevcStatisticsFeedbackMvX" // amf_int64; Accumulated absolute values of horizontal MV's #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_MV_Y L"HevcStatisticsFeedbackMvY" // amf_int64; Accumulated absolute values of vertical MV's #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_RD_COST_FINAL L"HevcStatisticsFeedbackRdCostFinal" // amf_int64; Frame level final RD cost for full encoding #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_RD_COST_INTRA L"HevcStatisticsFeedbackRdCostIntra" // amf_int64; Frame level intra RD cost for full encoding #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_RD_COST_INTER L"HevcStatisticsFeedbackRdCostInter" // amf_int64; Frame level inter RD cost for full encoding #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SAD_FINAL L"HevcStatisticsFeedbackSadFinal" // amf_int64; Frame level final SAD for full encoding #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SAD_INTRA L"HevcStatisticsFeedbackSadIntra" // amf_int64; Frame level intra SAD for full encoding #define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SAD_INTER L"HevcStatisticsFeedbackSadInter" // amf_int64; Frame level inter SAD for full encoding // Encoder block level feedback #define AMF_VIDEO_ENCODER_HEVC_BLOCK_QP_MAP L"HevcBlockQpMap" // AMFInterface(AMFSurface); AMFSurface of format AMF_SURFACE_GRAY32 containing block level QP values // HEVC Encoder capabilities - exposed in AMFCaps interface #define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_BITRATE L"HevcMaxBitrate" // amf_int64; Maximum bit rate in bits #define AMF_VIDEO_ENCODER_HEVC_CAP_NUM_OF_STREAMS L"HevcNumOfStreams" // amf_int64; maximum number of encode streams supported #define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_PROFILE L"HevcMaxProfile" // amf_int64(AMF_VIDEO_ENCODER_HEVC_PROFILE_ENUM) #define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_TIER L"HevcMaxTier" // amf_int64(AMF_VIDEO_ENCODER_HEVC_TIER_ENUM) maximum profile tier #define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_LEVEL L"HevcMaxLevel" // amf_int64 maximum profile level #define AMF_VIDEO_ENCODER_HEVC_CAP_MIN_REFERENCE_FRAMES L"HevcMinReferenceFrames" // amf_int64 minimum number of reference frames #define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_REFERENCE_FRAMES L"HevcMaxReferenceFrames" // amf_int64 maximum number of reference frames #define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_TEMPORAL_LAYERS L"HevcMaxTemporalLayers" // amf_int64 maximum number of temporal layers #define AMF_VIDEO_ENCODER_HEVC_CAP_NUM_OF_HW_INSTANCES L"HevcNumOfHwInstances" // amf_int64 number of HW encoder instances #define AMF_VIDEO_ENCODER_HEVC_CAP_COLOR_CONVERSION L"HevcColorConversion" // amf_int64(AMF_ACCELERATION_TYPE) - type of supported color conversion. default AMF_ACCEL_GPU #define AMF_VIDEO_ENCODER_HEVC_CAP_PRE_ANALYSIS L"HevcPreAnalysis" // amf_bool - pre analysis module is available for HEVC UVE encoder, n/a for the other encoders #define AMF_VIDEO_ENCODER_HEVC_CAP_ROI L"HevcROIMap" // amf_bool - ROI map support is available for HEVC UVE encoder, n/a for the other encoders #define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_THROUGHPUT L"HevcMaxThroughput" // amf_int64 - MAX throughput for HEVC encoder in MB (16 x 16 pixel) #define AMF_VIDEO_ENCODER_HEVC_CAP_REQUESTED_THROUGHPUT L"HevcRequestedThroughput" // amf_int64 - Currently total requested throughput for HEVC encode in MB (16 x 16 pixel) #define AMF_VIDEO_ENCODER_CAPS_HEVC_QUERY_TIMEOUT_SUPPORT L"HevcQueryTimeoutSupport" // amf_bool - Timeout supported for QueryOutout call // properties set on AMFComponent to control component creation #define AMF_VIDEO_ENCODER_HEVC_MEMORY_TYPE L"HevcEncoderMemoryType" // amf_int64(AMF_MEMORY_TYPE) , default is AMF_MEMORY_UNKNOWN, Values : AMF_MEMORY_DX11, AMF_MEMORY_DX9, AMF_MEMORY_UNKNOWN (auto) #define AMF_VIDEO_ENCODER_HEVC_ENABLE_SMART_ACCESS_VIDEO L"HevcEnableEncoderSmartAccessVideo" // amf_bool; default = false; true = enables smart access video feature #endif //#ifndef AMF_VideoEncoderHEVC_h 07070100000027000081A400000000000000000000000163CFF5E7000070FB000000000000000000000000000000000000003B00000000AMF-1.4.29/amf/public/include/components/VideoEncoderVCE.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // AMFVideoEncoderHW_AVC interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_VideoEncoderVCE_h #define AMF_VideoEncoderVCE_h #pragma once #include "Component.h" #include "ColorSpace.h" #include "PreAnalysis.h" #define AMFVideoEncoderVCE_AVC L"AMFVideoEncoderVCE_AVC" #define AMFVideoEncoderVCE_SVC L"AMFVideoEncoderVCE_SVC" enum AMF_VIDEO_ENCODER_USAGE_ENUM { AMF_VIDEO_ENCODER_USAGE_TRANSCONDING = 0, // kept for backwards compatability AMF_VIDEO_ENCODER_USAGE_TRANSCODING = 0, // fixed typo AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY, AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY, AMF_VIDEO_ENCODER_USAGE_WEBCAM, AMF_VIDEO_ENCODER_USAGE_HIGH_QUALITY, AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY }; enum AMF_VIDEO_ENCODER_PROFILE_ENUM { AMF_VIDEO_ENCODER_PROFILE_UNKNOWN = 0, AMF_VIDEO_ENCODER_PROFILE_BASELINE = 66, AMF_VIDEO_ENCODER_PROFILE_MAIN = 77, AMF_VIDEO_ENCODER_PROFILE_HIGH = 100, AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_BASELINE = 256, AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH = 257 }; enum AMF_VIDEO_ENCODER_H264_LEVEL_ENUM { AMF_H264_LEVEL__1 = 10, AMF_H264_LEVEL__1_1 = 11, AMF_H264_LEVEL__1_2 = 12, AMF_H264_LEVEL__1_3 = 13, AMF_H264_LEVEL__2 = 20, AMF_H264_LEVEL__2_1 = 21, AMF_H264_LEVEL__2_2 = 22, AMF_H264_LEVEL__3 = 30, AMF_H264_LEVEL__3_1 = 31, AMF_H264_LEVEL__3_2 = 32, AMF_H264_LEVEL__4 = 40, AMF_H264_LEVEL__4_1 = 41, AMF_H264_LEVEL__4_2 = 42, AMF_H264_LEVEL__5 = 50, AMF_H264_LEVEL__5_1 = 51, AMF_H264_LEVEL__5_2 = 52, AMF_H264_LEVEL__6 = 60, AMF_H264_LEVEL__6_1 = 61, AMF_H264_LEVEL__6_2 = 62 }; enum AMF_VIDEO_ENCODER_SCANTYPE_ENUM { AMF_VIDEO_ENCODER_SCANTYPE_PROGRESSIVE = 0, AMF_VIDEO_ENCODER_SCANTYPE_INTERLACED }; enum AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_ENUM { AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_UNKNOWN = -1, AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CONSTANT_QP = 0, AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CBR, AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR, AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR, AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_QUALITY_VBR, AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_HIGH_QUALITY_VBR, AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_HIGH_QUALITY_CBR }; enum AMF_VIDEO_ENCODER_QUALITY_PRESET_ENUM { AMF_VIDEO_ENCODER_QUALITY_PRESET_BALANCED = 0, AMF_VIDEO_ENCODER_QUALITY_PRESET_SPEED, AMF_VIDEO_ENCODER_QUALITY_PRESET_QUALITY }; enum AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_ENUM { AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_NONE = 0, AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_FRAME, AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_TOP_FIELD, AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_BOTTOM_FIELD }; enum AMF_VIDEO_ENCODER_PICTURE_TYPE_ENUM { AMF_VIDEO_ENCODER_PICTURE_TYPE_NONE = 0, AMF_VIDEO_ENCODER_PICTURE_TYPE_SKIP, AMF_VIDEO_ENCODER_PICTURE_TYPE_IDR, AMF_VIDEO_ENCODER_PICTURE_TYPE_I, AMF_VIDEO_ENCODER_PICTURE_TYPE_P, AMF_VIDEO_ENCODER_PICTURE_TYPE_B }; enum AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_ENUM { AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_IDR, AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_I, AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_P, AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_B }; enum AMF_VIDEO_ENCODER_PREENCODE_MODE_ENUM { AMF_VIDEO_ENCODER_PREENCODE_DISABLED = 0, AMF_VIDEO_ENCODER_PREENCODE_ENABLED = 1, }; enum AMF_VIDEO_ENCODER_CODING_ENUM { AMF_VIDEO_ENCODER_UNDEFINED = 0, // BASELINE = CALV; MAIN, HIGH = CABAC AMF_VIDEO_ENCODER_CABAC, AMF_VIDEO_ENCODER_CALV, }; enum AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_ENUM { AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_OFF = 0, AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_ON }; enum AMF_VIDEO_ENCODER_LTR_MODE_ENUM { AMF_VIDEO_ENCODER_LTR_MODE_RESET_UNUSED = 0, AMF_VIDEO_ENCODER_LTR_MODE_KEEP_UNUSED }; // Static properties - can be set before Init() #define AMF_VIDEO_ENCODER_INSTANCE_INDEX L"EncoderInstance" // amf_int64; selected HW instance idx #define AMF_VIDEO_ENCODER_FRAMESIZE L"FrameSize" // AMFSize; default = 0,0; Frame size #define AMF_VIDEO_ENCODER_EXTRADATA L"ExtraData" // AMFInterface* - > AMFBuffer*; SPS/PPS buffer in Annex B format - read-only #define AMF_VIDEO_ENCODER_USAGE L"Usage" // amf_int64(AMF_VIDEO_ENCODER_USAGE_ENUM); default = N/A; Encoder usage type. fully configures parameter set. #define AMF_VIDEO_ENCODER_PROFILE L"Profile" // amf_int64(AMF_VIDEO_ENCODER_PROFILE_ENUM) ; default = AMF_VIDEO_ENCODER_PROFILE_MAIN; H264 profile #define AMF_VIDEO_ENCODER_PROFILE_LEVEL L"ProfileLevel" // amf_int64(AMF_VIDEO_ENCODER_H264_LEVEL_ENUM); default = AMF_H264_LEVEL__4_2; H264 level #define AMF_VIDEO_ENCODER_MAX_LTR_FRAMES L"MaxOfLTRFrames" // amf_int64; default = 0; Max number of LTR frames #define AMF_VIDEO_ENCODER_LTR_MODE L"LTRMode" // amf_int64(AMF_VIDEO_ENCODER_LTR_MODE_ENUM); default = AMF_VIDEO_ENCODER_LTR_MODE_RESET_UNUSED; remove/keep unused LTRs (not specified in property AMF_VIDEO_ENCODER_FORCE_LTR_REFERENCE_BITFIELD) #define AMF_VIDEO_ENCODER_SCANTYPE L"ScanType" // amf_int64(AMF_VIDEO_ENCODER_SCANTYPE_ENUM); default = AMF_VIDEO_ENCODER_SCANTYPE_PROGRESSIVE; indicates input stream type #define AMF_VIDEO_ENCODER_MAX_NUM_REFRAMES L"MaxNumRefFrames" // amf_int64; Maximum number of reference frames #define AMF_VIDEO_ENCODER_MAX_CONSECUTIVE_BPICTURES L"MaxConsecutiveBPictures" // amf_int64; Maximum number of consecutive B Pictures #define AMF_VIDEO_ENCODER_ADAPTIVE_MINIGOP L"AdaptiveMiniGOP" // bool; default = false; Disable/Enable Adaptive MiniGOP #define AMF_VIDEO_ENCODER_ASPECT_RATIO L"AspectRatio" // AMFRatio; default = 1, 1 #define AMF_VIDEO_ENCODER_FULL_RANGE_COLOR L"FullRangeColor" // bool; default = false; inidicates that YUV input is (0,255) #define AMF_VIDEO_ENCODER_LOWLATENCY_MODE L"LowLatencyInternal" // bool; default = false, enables low latency mode and POC mode 2 in the encoder #define AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE L"EnablePreAnalysis" // bool; default = false; enables the pre-analysis module. Currently only works in AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR mode. Refer to AMF Video PreAnalysis API reference for more details. #define AMF_VIDEO_ENCODER_PREENCODE_ENABLE L"RateControlPreanalysisEnable" // amf_int64(AMF_VIDEO_ENCODER_PREENCODE_MODE_ENUM); default = AMF_VIDEO_ENCODER_PREENCODE_DISABLED; enables pre-encode assisted rate control #define AMF_VIDEO_ENCODER_RATE_CONTROL_PREANALYSIS_ENABLE L"RateControlPreanalysisEnable" // amf_int64(AMF_VIDEO_ENCODER_PREENCODE_MODE_ENUM); default = AMF_VIDEO_ENCODER_PREENCODE_DISABLED; enables pre-encode assisted rate control. Deprecated, please use AMF_VIDEO_ENCODER_PREENCODE_ENABLE instead. #define AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD L"RateControlMethod" // amf_int64(AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_ENUM); default = depends on USAGE; Rate Control Method #define AMF_VIDEO_ENCODER_QVBR_QUALITY_LEVEL L"QvbrQualityLevel" // amf_int64; default = 23; QVBR quality level; range = 1-51 #define AMF_VIDEO_ENCODER_MAX_NUM_TEMPORAL_LAYERS L"MaxNumOfTemporalLayers" // amf_int64; default = 1; Max number of temporal layers. #if !defined(__GNUC__) && !defined(__clang__) #pragma deprecated("AMF_VIDEO_ENCODER_RATE_CONTROL_PREANALYSIS_ENABLE") #endif // Quality preset property #define AMF_VIDEO_ENCODER_QUALITY_PRESET L"QualityPreset" // amf_int64(AMF_VIDEO_ENCODER_QUALITY_PRESET_ENUM); default = depends on USAGE; Quality Preset // color conversion #define AMF_VIDEO_ENCODER_COLOR_BIT_DEPTH L"ColorBitDepth" // amf_int64(AMF_COLOR_BIT_DEPTH_ENUM); default = AMF_COLOR_BIT_DEPTH_8 #define AMF_VIDEO_ENCODER_INPUT_COLOR_PROFILE L"InColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size #define AMF_VIDEO_ENCODER_INPUT_TRANSFER_CHARACTERISTIC L"InColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 ?7.2 See VideoDecoderUVD.h for enum #define AMF_VIDEO_ENCODER_INPUT_COLOR_PRIMARIES L"InColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 Section 7.1 See ColorSpace.h for enum #define AMF_VIDEO_ENCODER_INPUT_HDR_METADATA L"InHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL #define AMF_VIDEO_ENCODER_OUTPUT_COLOR_PROFILE L"OutColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size #define AMF_VIDEO_ENCODER_OUTPUT_TRANSFER_CHARACTERISTIC L"OutColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 Section 7.2 See VideoDecoderUVD.h for enum #define AMF_VIDEO_ENCODER_OUTPUT_COLOR_PRIMARIES L"OutColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 Section 7.1 See ColorSpace.h for enum #define AMF_VIDEO_ENCODER_OUTPUT_HDR_METADATA L"OutHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL // Dynamic properties - can be set at any time // Rate control properties #define AMF_VIDEO_ENCODER_FRAMERATE L"FrameRate" // AMFRate; default = depends on usage; Frame Rate #define AMF_VIDEO_ENCODER_B_PIC_DELTA_QP L"BPicturesDeltaQP" // amf_int64; default = depends on USAGE; B-picture Delta #define AMF_VIDEO_ENCODER_REF_B_PIC_DELTA_QP L"ReferenceBPicturesDeltaQP"// amf_int64; default = depends on USAGE; Reference B-picture Delta #define AMF_VIDEO_ENCODER_ENFORCE_HRD L"EnforceHRD" // bool; default = depends on USAGE; Enforce HRD #define AMF_VIDEO_ENCODER_FILLER_DATA_ENABLE L"FillerDataEnable" // bool; default = false; Filler Data Enable #define AMF_VIDEO_ENCODER_ENABLE_VBAQ L"EnableVBAQ" // bool; default = depends on USAGE; Enable VBAQ #define AMF_VIDEO_ENCODER_HIGH_MOTION_QUALITY_BOOST_ENABLE L"HighMotionQualityBoostEnable"// bool; default = depends on USAGE; Enable High motion quality boost mode #define AMF_VIDEO_ENCODER_VBV_BUFFER_SIZE L"VBVBufferSize" // amf_int64; default = depends on USAGE; VBV Buffer Size in bits #define AMF_VIDEO_ENCODER_INITIAL_VBV_BUFFER_FULLNESS L"InitialVBVBufferFullness" // amf_int64; default = 64; Initial VBV Buffer Fullness 0=0% 64=100% #define AMF_VIDEO_ENCODER_MAX_AU_SIZE L"MaxAUSize" // amf_int64; default = 0; Max AU Size in bits #define AMF_VIDEO_ENCODER_MIN_QP L"MinQP" // amf_int64; default = depends on USAGE; Min QP; range = 0-51 #define AMF_VIDEO_ENCODER_MAX_QP L"MaxQP" // amf_int64; default = depends on USAGE; Max QP; range = 0-51 #define AMF_VIDEO_ENCODER_QP_I L"QPI" // amf_int64; default = 22; I-frame QP; range = 0-51 #define AMF_VIDEO_ENCODER_QP_P L"QPP" // amf_int64; default = 22; P-frame QP; range = 0-51 #define AMF_VIDEO_ENCODER_QP_B L"QPB" // amf_int64; default = 22; B-frame QP; range = 0-51 #define AMF_VIDEO_ENCODER_TARGET_BITRATE L"TargetBitrate" // amf_int64; default = depends on USAGE; Target bit rate in bits #define AMF_VIDEO_ENCODER_PEAK_BITRATE L"PeakBitrate" // amf_int64; default = depends on USAGE; Peak bit rate in bits #define AMF_VIDEO_ENCODER_RATE_CONTROL_SKIP_FRAME_ENABLE L"RateControlSkipFrameEnable" // bool; default = depends on USAGE; Rate Control Based Frame Skip // Picture control properties #define AMF_VIDEO_ENCODER_HEADER_INSERTION_SPACING L"HeaderInsertionSpacing" // amf_int64; default = depends on USAGE; Header Insertion Spacing; range 0-1000 #define AMF_VIDEO_ENCODER_B_PIC_PATTERN L"BPicturesPattern" // amf_int64; default = 3; B-picture Pattern (number of B-Frames) #define AMF_VIDEO_ENCODER_DE_BLOCKING_FILTER L"DeBlockingFilter" // bool; default = depends on USAGE; De-blocking Filter #define AMF_VIDEO_ENCODER_B_REFERENCE_ENABLE L"BReferenceEnable" // bool; default = true; Enable Refrence to B-frames #define AMF_VIDEO_ENCODER_IDR_PERIOD L"IDRPeriod" // amf_int64; default = depends on USAGE; IDR Period in frames #define AMF_VIDEO_ENCODER_INTRA_REFRESH_NUM_MBS_PER_SLOT L"IntraRefreshMBsNumberPerSlot" // amf_int64; default = depends on USAGE; Intra Refresh MBs Number Per Slot in Macroblocks #define AMF_VIDEO_ENCODER_SLICES_PER_FRAME L"SlicesPerFrame" // amf_int64; default = 1; Number of slices Per Frame #define AMF_VIDEO_ENCODER_CABAC_ENABLE L"CABACEnable" // amf_int64(AMF_VIDEO_ENCODER_CODING_ENUM) default = AMF_VIDEO_ENCODER_UNDEFINED // Motion estimation #define AMF_VIDEO_ENCODER_MOTION_HALF_PIXEL L"HalfPixel" // bool; default= true; Half Pixel #define AMF_VIDEO_ENCODER_MOTION_QUARTERPIXEL L"QuarterPixel" // bool; default= true; Quarter Pixel // SVC #define AMF_VIDEO_ENCODER_NUM_TEMPORAL_ENHANCMENT_LAYERS L"NumOfTemporalEnhancmentLayers" // amf_int64; default = 1; range = 1-MaxTemporalLayers; Number of temporal Layers (SVC) // DPB management #define AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE L"PicTransferMode" // amf_int64(AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_ENUM); default = AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_OFF - whether to exchange reference/reconstructed pic between encoder and application // misc #define AMF_VIDEO_ENCODER_QUERY_TIMEOUT L"QueryTimeout" // amf_int64; default = 0 (no wait); timeout for QueryOutput call in ms. // Per-submittion properties - can be set on input surface interface #define AMF_VIDEO_ENCODER_END_OF_SEQUENCE L"EndOfSequence" // bool; default = false; generate end of sequence #define AMF_VIDEO_ENCODER_END_OF_STREAM L"EndOfStream" // bool; default = false; generate end of stream #define AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE L"ForcePictureType" // amf_int64(AMF_VIDEO_ENCODER_PICTURE_TYPE_ENUM); default = AMF_VIDEO_ENCODER_PICTURE_TYPE_NONE; generate particular picture type #define AMF_VIDEO_ENCODER_INSERT_AUD L"InsertAUD" // bool; default = false; insert AUD #define AMF_VIDEO_ENCODER_INSERT_SPS L"InsertSPS" // bool; default = false; insert SPS #define AMF_VIDEO_ENCODER_INSERT_PPS L"InsertPPS" // bool; default = false; insert PPS #define AMF_VIDEO_ENCODER_PICTURE_STRUCTURE L"PictureStructure" // amf_int64(AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_ENUM); default = AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_FRAME; indicate picture type #define AMF_VIDEO_ENCODER_MARK_CURRENT_WITH_LTR_INDEX L"MarkCurrentWithLTRIndex" // //amf_int64; default = N/A; Mark current frame with LTR index #define AMF_VIDEO_ENCODER_FORCE_LTR_REFERENCE_BITFIELD L"ForceLTRReferenceBitfield"// amf_int64; default = 0; force LTR bit-field #define AMF_VIDEO_ENCODER_ROI_DATA L"ROIData" // 2D AMFSurface, surface format: AMF_SURFACE_GRAY32 #define AMF_VIDEO_ENCODER_REFERENCE_PICTURE L"ReferencePicture" // AMFInterface(AMFSurface); surface used for frame injection #define AMF_VIDEO_ENCODER_PSNR_FEEDBACK L"PSNRFeedback" // amf_bool; default = false; Signal encoder to calculate PSNR score #define AMF_VIDEO_ENCODER_SSIM_FEEDBACK L"SSIMFeedback" // amf_bool; default = false; Signal encoder to calculate SSIM score #define AMF_VIDEO_ENCODER_STATISTICS_FEEDBACK L"StatisticsFeedback" // amf_bool; default = false; Signal encoder to collect and feedback statistics #define AMF_VIDEO_ENCODER_BLOCK_QP_FEEDBACK L"BlockQpFeedback" // amf_bool; default = false; Signal encoder to collect and feedback block level QP values // properties set by encoder on output buffer interface #define AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE L"OutputDataType" // amf_int64(AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_ENUM); default = N/A #define AMF_VIDEO_ENCODER_OUTPUT_MARKED_LTR_INDEX L"MarkedLTRIndex" //amf_int64; default = -1; Marked LTR index #define AMF_VIDEO_ENCODER_OUTPUT_REFERENCED_LTR_INDEX_BITFIELD L"ReferencedLTRIndexBitfield" // amf_int64; default = 0; referenced LTR bit-field #define AMF_VIDEO_ENCODER_OUTPUT_TEMPORAL_LAYER L"OutputTemporalLayer" // amf_int64; Temporal layer #define AMF_VIDEO_ENCODER_PRESENTATION_TIME_STAMP L"PresentationTimeStamp" // amf_int64; Presentation time stamp (PTS) #define AMF_VIDEO_ENCODER_RECONSTRUCTED_PICTURE L"ReconstructedPicture" // AMFInterface(AMFSurface); returns reconstructed picture as an AMFSurface attached to the output buffer as property AMF_VIDEO_ENCODER_RECONSTRUCTED_PICTURE of AMFInterface type #define AMF_VIDEO_ENCODER_STATISTIC_PSNR_Y L"PSNRY" // double; PSNR Y #define AMF_VIDEO_ENCODER_STATISTIC_PSNR_U L"PSNRU" // double; PSNR U #define AMF_VIDEO_ENCODER_STATISTIC_PSNR_V L"PSNRV" // double; PSNR V #define AMF_VIDEO_ENCODER_STATISTIC_PSNR_ALL L"PSNRALL" // double; PSNR All #define AMF_VIDEO_ENCODER_STATISTIC_SSIM_Y L"SSIMY" // double; SSIM Y #define AMF_VIDEO_ENCODER_STATISTIC_SSIM_U L"SSIMU" // double; SSIM U #define AMF_VIDEO_ENCODER_STATISTIC_SSIM_V L"SSIMV" // double; SSIM V #define AMF_VIDEO_ENCODER_STATISTIC_SSIM_ALL L"SSIMALL" // double; SSIM ALL // Encoder statistics feedback #define AMF_VIDEO_ENCODER_STATISTIC_FRAME_QP L"StatisticsFeedbackFrameQP" // amf_int64; Rate control base frame/initial QP #define AMF_VIDEO_ENCODER_STATISTIC_AVERAGE_QP L"StatisticsFeedbackAvgQP" // amf_int64; Average calculated QP of all encoded MBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped MBs. #define AMF_VIDEO_ENCODER_STATISTIC_MAX_QP L"StatisticsFeedbackMaxQP" // amf_int64; Max calculated QP among all encoded MBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped MBs. #define AMF_VIDEO_ENCODER_STATISTIC_MIN_QP L"StatisticsFeedbackMinQP" // amf_int64; Min calculated QP among all encoded MBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped MBs. #define AMF_VIDEO_ENCODER_STATISTIC_PIX_NUM_INTRA L"StatisticsFeedbackPixNumIntra" // amf_int64; Number of the intra encoded pixels #define AMF_VIDEO_ENCODER_STATISTIC_PIX_NUM_INTER L"StatisticsFeedbackPixNumInter" // amf_int64; Number of the inter encoded pixels #define AMF_VIDEO_ENCODER_STATISTIC_PIX_NUM_SKIP L"StatisticsFeedbackPixNumSkip" // amf_int64; Number of the skip mode pixels #define AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_RESIDUAL L"StatisticsFeedbackBitcountResidual" // amf_int64; The bit count that corresponds to residual data #define AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_MOTION L"StatisticsFeedbackBitcountMotion" // amf_int64; The bit count that corresponds to motion vectors #define AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_INTER L"StatisticsFeedbackBitcountInter" // amf_int64; The bit count that are assigned to inter MBs #define AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_INTRA L"StatisticsFeedbackBitcountIntra" // amf_int64; The bit count that are assigned to intra MBs #define AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_ALL_MINUS_HEADER L"StatisticsFeedbackBitcountAllMinusHeader" // amf_int64; The bit count of the bitstream excluding header #define AMF_VIDEO_ENCODER_STATISTIC_MV_X L"StatisticsFeedbackMvX" // amf_int64; Accumulated absolute values of horizontal MV's #define AMF_VIDEO_ENCODER_STATISTIC_MV_Y L"StatisticsFeedbackMvY" // amf_int64; Accumulated absolute values of vertical MV's #define AMF_VIDEO_ENCODER_STATISTIC_RD_COST_FINAL L"StatisticsFeedbackRdCostFinal" // amf_int64; Frame level final RD cost for full encoding #define AMF_VIDEO_ENCODER_STATISTIC_RD_COST_INTRA L"StatisticsFeedbackRdCostIntra" // amf_int64; Frame level intra RD cost for full encoding #define AMF_VIDEO_ENCODER_STATISTIC_RD_COST_INTER L"StatisticsFeedbackRdCostInter" // amf_int64; Frame level inter RD cost for full encoding #define AMF_VIDEO_ENCODER_STATISTIC_SATD_FINAL L"StatisticsFeedbackSatdFinal" // amf_int64; Frame level final SATD for full encoding #define AMF_VIDEO_ENCODER_STATISTIC_SATD_INTRA L"StatisticsFeedbackSatdIntra" // amf_int64; Frame level intra SATD for full encoding #define AMF_VIDEO_ENCODER_STATISTIC_SATD_INTER L"StatisticsFeedbackSatdInter" // amf_int64; Frame level inter SATD for full encoding // Encoder block level feedback #define AMF_VIDEO_ENCODER_BLOCK_QP_MAP L"BlockQpMap" // AMFInterface(AMFSurface); AMFSurface of format AMF_SURFACE_GRAY32 containing block level QP values #define AMF_VIDEO_ENCODER_HDCP_COUNTER L"HDCPCounter" // const void* // Properties for multi-instance cloud gaming #define AMF_VIDEO_ENCODER_MAX_INSTANCES L"EncoderMaxInstances" // deprecated. amf_int64; default = 1; max number of encoder instances #define AMF_VIDEO_ENCODER_MULTI_INSTANCE_MODE L"MultiInstanceMode" // deprecated. bool; default = false; #define AMF_VIDEO_ENCODER_CURRENT_QUEUE L"MultiInstanceCurrentQueue"// deprecated. amf_int64; default = 0; // VCE Encoder capabilities - exposed in AMFCaps interface #define AMF_VIDEO_ENCODER_CAP_MAX_BITRATE L"MaxBitrate" // amf_int64; Maximum bit rate in bits #define AMF_VIDEO_ENCODER_CAP_NUM_OF_STREAMS L"NumOfStreams" // amf_int64; maximum number of encode streams supported #define AMF_VIDEO_ENCODER_CAP_MAX_PROFILE L"MaxProfile" // AMF_VIDEO_ENCODER_PROFILE_ENUM #define AMF_VIDEO_ENCODER_CAP_MAX_LEVEL L"MaxLevel" // amf_int64 maximum profile level #define AMF_VIDEO_ENCODER_CAP_BFRAMES L"BFrames" // bool is B-Frames supported #define AMF_VIDEO_ENCODER_CAP_MIN_REFERENCE_FRAMES L"MinReferenceFrames" // amf_int64 minimum number of reference frames #define AMF_VIDEO_ENCODER_CAP_MAX_REFERENCE_FRAMES L"MaxReferenceFrames" // amf_int64 maximum number of reference frames #define AMF_VIDEO_ENCODER_CAP_MAX_TEMPORAL_LAYERS L"MaxTemporalLayers" // amf_int64 maximum number of temporal layers #define AMF_VIDEO_ENCODER_CAP_FIXED_SLICE_MODE L"FixedSliceMode" // bool is fixed slice mode supported #define AMF_VIDEO_ENCODER_CAP_NUM_OF_HW_INSTANCES L"NumOfHwInstances" // amf_int64 number of HW encoder instances #define AMF_VIDEO_ENCODER_CAP_COLOR_CONVERSION L"ColorConversion" // amf_int64(AMF_ACCELERATION_TYPE) - type of supported color conversion. default AMF_ACCEL_GPU #define AMF_VIDEO_ENCODER_CAP_PRE_ANALYSIS L"PreAnalysis" // amf_bool - pre analysis module is available for H264 UVE encoder, n/a for the other encoders #define AMF_VIDEO_ENCODER_CAP_ROI L"ROIMap" // amf_bool - ROI map support is available for H264 UVE encoder, n/a for the other encoders #define AMF_VIDEO_ENCODER_CAP_MAX_THROUGHPUT L"MaxThroughput" // amf_int64 - MAX throughput for H264 encoder in MB (16 x 16 pixel) #define AMF_VIDEO_ENCODER_CAP_REQUESTED_THROUGHPUT L"RequestedThroughput" // amf_int64 - Currently total requested throughput for H264 encoder in MB (16 x 16 pixel) #define AMF_VIDEO_ENCODER_CAPS_QUERY_TIMEOUT_SUPPORT L"QueryTimeoutSupport" // amf_bool - Timeout supported for QueryOutout call // properties set on AMFComponent to control component creation #define AMF_VIDEO_ENCODER_MEMORY_TYPE L"EncoderMemoryType" // amf_int64(AMF_MEMORY_TYPE) , default is AMF_MEMORY_UNKNOWN, Values : AMF_MEMORY_DX11, AMF_MEMORY_DX9, AMF_MEMORY_VULKAN or AMF_MEMORY_UNKNOWN (auto) #define AMF_VIDEO_ENCODER_ENABLE_SMART_ACCESS_VIDEO L"EnableEncoderSmartAccessVideo" // amf_bool; default = false; true = enables smart access video feature #endif //#ifndef AMF_VideoEncoderVCE_h 07070100000028000081A400000000000000000000000163CFF5E700001BAA000000000000000000000000000000000000003700000000AMF-1.4.29/amf/public/include/components/VideoStitch.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** *************************************************************************************************** * @file VideoStitch.h * @brief AMFVideoStitch interface declaration *************************************************************************************************** */ #ifndef AMF_VideoStitch_h #define AMF_VideoStitch_h #pragma once #include "public/include/components/Component.h" #define AMFVideoStitch L"AMFVideoStitch" //Component name // static properties #define AMF_VIDEO_STITCH_OUTPUT_FORMAT L"OutputFormat" // Values, AMF_SURFACE_BGRA or AMF_SURFACE_RGBA #define AMF_VIDEO_STITCH_MEMORY_TYPE L"MemoryType" // Values, only AMF_MEMORY_DX11 is supported for now. #define AMF_VIDEO_STITCH_OUTPUT_SIZE L"OutputSize" // AMFSize, (width, height) in pixels. default= (0,0), will be the same size as input. #define AMF_VIDEO_STITCH_INPUTCOUNT L"InputCount" // amf_uint64, number of camera inputs. // individual camera direction and location #define AMF_VIDEO_CAMERA_ANGLE_PITCH L"CameraPitch" // double, in radians, default = 0, camera pitch orientation #define AMF_VIDEO_CAMERA_ANGLE_YAW L"CameraYaw" // double, in radians, default = 0, camera yaw orientation #define AMF_VIDEO_CAMERA_ANGLE_ROLL L"CameraRoll" // double, in radians, default = 0, camera roll orientation #define AMF_VIDEO_CAMERA_OFFSET_X L"CameraOffsetX" // double, in pixels, default = 0, X offset of camera center of the lens from the center of the rig. #define AMF_VIDEO_CAMERA_OFFSET_Y L"CameraOffsetY" // double, in pixels, default = 0, Y offset of camera center of the lens from the center of the rig. #define AMF_VIDEO_CAMERA_OFFSET_Z L"CameraOffsetZ" // double, in pixels, default = 0, Z offset of camera center of the lens from the center of the rig. #define AMF_VIDEO_CAMERA_HFOV L"CameraHFOV" // double, in radians, default = PI, - horizontal field of view #define AMF_VIDEO_CAMERA_SCALE L"CameraScale" // double, default = 1, scale coeff // lens correction parameters #define AMF_VIDEO_STITCH_LENS_CORR_K1 L"LensK1" // double, default = 0. #define AMF_VIDEO_STITCH_LENS_CORR_K2 L"LensK2" // double, default = 0. #define AMF_VIDEO_STITCH_LENS_CORR_K3 L"LensK3" // double, default = 0. #define AMF_VIDEO_STITCH_LENS_CORR_OFFX L"LensOffX" // double, default = 0. #define AMF_VIDEO_STITCH_LENS_CORR_OFFY L"LensOffY" // double, default = 0. #define AMF_VIDEO_STITCH_CROP L"Crop" //AMFRect, in pixels default = (0,0,0,0). #define AMF_VIDEO_STITCH_LENS_MODE L"LensMode" // Values, AMF_VIDEO_STITCH_LENS_CORR_MODE_ENUM, (default = AMF_VIDEO_STITCH_LENS_CORR_MODE_RADIAL) #define AMF_VIDEO_STITCH_OUTPUT_MODE L"OutputMode" // AMF_VIDEO_STITCH_OUTPUT_MODE_ENUM (default=AMF_VIDEO_STITCH_OUTPUT_MODE_PREVIEW) #define AMF_VIDEO_STITCH_COMBINED_SOURCE L"CombinedSource" // bool, (default=false) video sources are combined in one stream #define AMF_VIDEO_STITCH_COMPUTE_DEVICE L"ComputeDevice" // amf_int64(AMF_MEMORY_TYPE) Values, AMF_MEMORY_DX11, AMF_MEMORY_COMPUTE_FOR_DX11, AMF_MEMORY_OPENCL //for debug #define AMF_VIDEO_STITCH_WIRE_RENDER L"Wire" // bool (default=false) reder wireframe //view angle #define AMF_VIDEO_STITCH_VIEW_ROTATE_X L"AngleX" // double, in radians, default = 0 - delta from current position / automatilcally reset to 0 inside SetProperty() call #define AMF_VIDEO_STITCH_VIEW_ROTATE_Y L"AngleY" // double, in radians, default = 0 - delta from current position / automatilcally reset to 0 inside SetProperty() call #define AMF_VIDEO_STITCH_VIEW_ROTATE_Z L"AngleZ" // double, in radians, default = 0 - delta from current position / automatilcally reset to 0 inside SetProperty() call #define AMF_VIDEO_STITCH_COLOR_BALANCE L"ColorBalance" // bool (default=true) enables color balance //lens mode enum AMF_VIDEO_STITCH_LENS_ENUM { AMF_VIDEO_STITCH_LENS_RECTILINEAR = 0, //rect linear lens AMF_VIDEO_STITCH_LENS_FISHEYE_FULLFRAME = 1, //fisheye full frame AMF_VIDEO_STITCH_LENS_FISHEYE_CIRCULAR = 2, //fisheye, circular }; //Output Mode enum AMF_VIDEO_STITCH_OUTPUT_MODE_ENUM { AMF_VIDEO_STITCH_OUTPUT_MODE_PREVIEW = 0, //preview mode AMF_VIDEO_STITCH_OUTPUT_MODE_EQUIRECTANGULAR = 1, //equirectangular mode AMF_VIDEO_STITCH_OUTPUT_MODE_CUBEMAP = 2, //cubemap mode AMF_VIDEO_STITCH_OUTPUT_MODE_LAST = AMF_VIDEO_STITCH_OUTPUT_MODE_CUBEMAP, }; //audio mode enum AMF_VIDEO_STITCH_AUDIO_MODE_ENUM { AMF_VIDEO_STITCH_AUDIO_MODE_NONE = 0, //no audio AMF_VIDEO_STITCH_AUDIO_MODE_VIDEO = 1, //using audio from video stream AMF_VIDEO_STITCH_AUDIO_MODE_FILE = 2, //using audio from file AMF_VIDEO_STITCH_AUDIO_MODE_CAPTURE = 3, //using audio from capture device AMF_VIDEO_STITCH_AUDIO_MODE_INVALID = -1, //invalid }; #if defined(_M_AMD64) #define STITCH_DLL_NAME L"amf-stitch-64.dll" #else #define STITCH_DLL_NAME L"amf-stitch-32.dll" #endif #endif //#ifndef AMF_VideoStitch_h 07070100000029000081A400000000000000000000000163CFF5E7000012C3000000000000000000000000000000000000003A00000000AMF-1.4.29/amf/public/include/components/ZCamLiveStream.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------------------------- // ZCamLive interface declaration //------------------------------------------------------------------------------------------------- #ifndef AMF_ZCamLiveStream_h #define AMF_ZCamLiveStream_h #pragma once #define ZCAMLIVE_STREAMCOUNT L"StreamCount" // amf_int64 (default = 4), number of streams #define ZCAMLIVE_VIDEO_FRAMESIZE L"FrameSize" // AMFSize (default = AMFConstructSize(2704, 1520)), frame size #define ZCAMLIVE_VIDEO_FRAMERATE L"FrameRate" // AMFRate (default = 30.0), video frame rate #define ZCAMLIVE_VIDEO_BIT_RATE L"BitRate" // amf_int64 (default = 3000000), video bitrate #define ZCAMLIVE_STREAM_ACTIVE_CAMERA L"ActiveCamera" // amf_int64 (default = -1, all the cameras), the index of the camera to capture #define ZCAMLIVE_STREAM_FRAMECOUNT L"FrameCount" // amf_int64 (default = 0), number of frames captured #define ZCAMLIVE_CODEC_ID L"CodecID" // WString (default = "AMFVideoDecoderUVD_H264_AVC"), UVD codec ID #define ZCAMLIVE_VIDEO_MODE L"VideoMode" // Enum (default = 0, 2K7P30), ZCam mode #define ZCAMLIVE_AUDIO_MODE L"AudioMode" // Enum (default = 0, Silent) - Audio mode #define ZCAMLIVE_LOWLATENCY L"LowLatency" // amf_int64 (default = 1, LowLatency), low latency flag #define ZCAMLIVE_IP_0 L"ZCamIP_00" // WString, IP address of the #1 stream, default "10.98.32.1" #define ZCAMLIVE_IP_1 L"ZCamIP_01" // WString, IP address of the #2 stream, default "10.98.32.2" #define ZCAMLIVE_IP_2 L"ZCamIP_02" // WString, IP address of the #3 stream, default "10.98.32.3" #define ZCAMLIVE_IP_3 L"ZCamIP_03" // WString, IP address of the #4 stream, default "10.98.32.4" //Camera live capture Mode enum CAMLIVE_MODE_ENUM { CAMLIVE_MODE_ZCAM_1080P24 = 0, //1920x1080, 24FPS CAMLIVE_MODE_ZCAM_1080P30, //1920x1080, 30FPS CAMLIVE_MODE_ZCAM_1080P60, //1920x1080, 60FPS CAMLIVE_MODE_ZCAM_2K7P24, //2704x1520, 24FPS CAMLIVE_MODE_ZCAM_2K7P30, //2704x1520, 24FPS CAMLIVE_MODE_ZCAM_2K7P60, //2704x1520, 24FPS CAMLIVE_MODE_ZCAM_2544P24, //3392x2544, 24FPS CAMLIVE_MODE_ZCAM_2544P30, //3392x2544, 24FPS CAMLIVE_MODE_ZCAM_2544P60, //3392x2544, 24FPS CAMLIVE_MODE_THETAS, //Ricoh TheataS CAMLIVE_MODE_THETAV, //Ricoh TheataV CAMLIVE_MODE_INVALID = -1, }; enum CAM_AUDIO_MODE_ENUM { CAM_AUDIO_MODE_NONE = 0, //None CAM_AUDIO_MODE_SILENT, //Silent audio CAM_AUDIO_MODE_CAMERA //Capture from camera, not supported yet }; extern "C" { AMF_RESULT AMF_CDECL_CALL AMFCreateComponentZCamLiveStream(amf::AMFContext* pContext, amf::AMFComponentEx** ppComponent); } #endif // AMF_ZCamLiveStream_h0707010000002A000041ED00000000000000000000000163CFF5E700000000000000000000000000000000000000000000002300000000AMF-1.4.29/amf/public/include/core0707010000002B000081A400000000000000000000000163CFF5E700002D86000000000000000000000000000000000000003100000000AMF-1.4.29/amf/public/include/core/AudioBuffer.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_AudioBuffer_h #define AMF_AudioBuffer_h #pragma once #include "Data.h" #if defined(_MSC_VER) #pragma warning( push ) #pragma warning(disable : 4263) #pragma warning(disable : 4264) #endif #if defined(__cplusplus) namespace amf { #endif typedef enum AMF_AUDIO_FORMAT { AMFAF_UNKNOWN =-1, AMFAF_U8 = 0, // amf_uint8 AMFAF_S16 = 1, // amf_int16 AMFAF_S32 = 2, // amf_int32 AMFAF_FLT = 3, // amf_float AMFAF_DBL = 4, // amf_double AMFAF_U8P = 5, // amf_uint8 AMFAF_S16P = 6, // amf_int16 AMFAF_S32P = 7, // amf_int32 AMFAF_FLTP = 8, // amf_float AMFAF_DBLP = 9, // amf_double AMFAF_FIRST = AMFAF_U8, AMFAF_LAST = AMFAF_DBLP, } AMF_AUDIO_FORMAT; typedef enum AMF_AUDIO_CHANNEL_LAYOUT { AMFACL_SPEAKER_FRONT_LEFT = 0x1, AMFACL_SPEAKER_FRONT_RIGHT = 0x2, AMFACL_SPEAKER_FRONT_CENTER = 0x4, AMFACL_SPEAKER_LOW_FREQUENCY = 0x8, AMFACL_SPEAKER_BACK_LEFT = 0x10, AMFACL_SPEAKER_BACK_RIGHT = 0x20, AMFACL_SPEAKER_FRONT_LEFT_OF_CENTER = 0x40, AMFACL_SPEAKER_FRONT_RIGHT_OF_CENTER = 0x80, AMFACL_SPEAKER_BACK_CENTER = 0x100, AMFACL_SPEAKER_SIDE_LEFT = 0x200, AMFACL_SPEAKER_SIDE_RIGHT = 0x400, AMFACL_SPEAKER_TOP_CENTER = 0x800, AMFACL_SPEAKER_TOP_FRONT_LEFT = 0x1000, AMFACL_SPEAKER_TOP_FRONT_CENTER = 0x2000, AMFACL_SPEAKER_TOP_FRONT_RIGHT = 0x4000, AMFACL_SPEAKER_TOP_BACK_LEFT = 0x8000, AMFACL_SPEAKER_TOP_BACK_CENTER = 0x10000, AMFACL_SPEAKER_TOP_BACK_RIGHT = 0x20000 } AMF_AUDIO_CHANNEL_LAYOUT; // get the most common layout for a given number of speakers inline int GetDefaultChannelLayout(int channels) { switch (channels) { case 1: return (AMFACL_SPEAKER_FRONT_CENTER); case 2: return (AMFACL_SPEAKER_FRONT_LEFT | AMFACL_SPEAKER_FRONT_RIGHT); case 4: return (AMFACL_SPEAKER_FRONT_LEFT | AMFACL_SPEAKER_FRONT_RIGHT | AMFACL_SPEAKER_BACK_LEFT | AMFACL_SPEAKER_BACK_RIGHT); case 6: return (AMFACL_SPEAKER_FRONT_LEFT | AMFACL_SPEAKER_FRONT_RIGHT | AMFACL_SPEAKER_FRONT_CENTER | AMFACL_SPEAKER_LOW_FREQUENCY | AMFACL_SPEAKER_BACK_LEFT | AMFACL_SPEAKER_BACK_RIGHT); case 8: return (AMFACL_SPEAKER_FRONT_LEFT | AMFACL_SPEAKER_FRONT_RIGHT | AMFACL_SPEAKER_FRONT_CENTER | AMFACL_SPEAKER_LOW_FREQUENCY | AMFACL_SPEAKER_BACK_LEFT | AMFACL_SPEAKER_BACK_RIGHT | AMFACL_SPEAKER_FRONT_LEFT_OF_CENTER | AMFACL_SPEAKER_FRONT_RIGHT_OF_CENTER); } return AMFACL_SPEAKER_FRONT_LEFT | AMFACL_SPEAKER_FRONT_RIGHT; } //---------------------------------------------------------------------------------------------- // AMFAudioBufferObserver interface - callback //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMFAudioBuffer; class AMF_NO_VTABLE AMFAudioBufferObserver { public: virtual void AMF_STD_CALL OnBufferDataRelease(AMFAudioBuffer* pBuffer) = 0; }; #else // #if defined(__cplusplus) typedef struct AMFAudioBuffer AMFAudioBuffer; typedef struct AMFAudioBufferObserver AMFAudioBufferObserver; typedef struct AMFAudioBufferObserverVtbl { void (AMF_STD_CALL *OnBufferDataRelease)(AMFAudioBufferObserver* pThis, AMFAudioBuffer* pBuffer); } AMFAudioBufferObserverVtbl; struct AMFAudioBufferObserver { const AMFAudioBufferObserverVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AudioBuffer interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFAudioBuffer : public AMFData { public: AMF_DECLARE_IID(0x2212ff8, 0x6107, 0x430b, 0xb6, 0x3c, 0xc7, 0xe5, 0x40, 0xe5, 0xf8, 0xeb) virtual amf_int32 AMF_STD_CALL GetSampleCount() = 0; virtual amf_int32 AMF_STD_CALL GetSampleRate() = 0; virtual amf_int32 AMF_STD_CALL GetChannelCount() = 0; virtual AMF_AUDIO_FORMAT AMF_STD_CALL GetSampleFormat() = 0; virtual amf_int32 AMF_STD_CALL GetSampleSize() = 0; virtual amf_uint32 AMF_STD_CALL GetChannelLayout() = 0; virtual void* AMF_STD_CALL GetNative() = 0; virtual amf_size AMF_STD_CALL GetSize() = 0; // Observer management #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Woverloaded-virtual" #endif virtual void AMF_STD_CALL AddObserver(AMFAudioBufferObserver* pObserver) = 0; virtual void AMF_STD_CALL RemoveObserver(AMFAudioBufferObserver* pObserver) = 0; #ifdef __clang__ #pragma clang diagnostic pop #endif }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFAudioBuffer> AMFAudioBufferPtr; //---------------------------------------------------------------------------------------------- #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFAudioBuffer, 0x2212ff8, 0x6107, 0x430b, 0xb6, 0x3c, 0xc7, 0xe5, 0x40, 0xe5, 0xf8, 0xeb) typedef struct AMFAudioBufferVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFAudioBuffer* pThis); amf_long (AMF_STD_CALL *Release)(AMFAudioBuffer* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFAudioBuffer* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFAudioBuffer* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFAudioBuffer* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFAudioBuffer* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFAudioBuffer* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFAudioBuffer* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFAudioBuffer* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFAudioBuffer* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFAudioBuffer* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFAudioBuffer* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFAudioBuffer* pThis, AMFPropertyStorageObserver* pObserver); // AMFData interface AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFAudioBuffer* pThis); AMF_RESULT (AMF_STD_CALL *Duplicate)(AMFAudioBuffer* pThis, AMF_MEMORY_TYPE type, AMFData** ppData); AMF_RESULT (AMF_STD_CALL *Convert)(AMFAudioBuffer* pThis, AMF_MEMORY_TYPE type); // optimal interop if possilble. Copy through host memory if needed AMF_RESULT (AMF_STD_CALL *Interop)(AMFAudioBuffer* pThis, AMF_MEMORY_TYPE type); // only optimal interop if possilble. No copy through host memory for GPU objects AMF_DATA_TYPE (AMF_STD_CALL *GetDataType)(AMFAudioBuffer* pThis); amf_bool (AMF_STD_CALL *IsReusable)(AMFAudioBuffer* pThis); void (AMF_STD_CALL *SetPts)(AMFAudioBuffer* pThis, amf_pts pts); amf_pts (AMF_STD_CALL *GetPts)(AMFAudioBuffer* pThis); void (AMF_STD_CALL *SetDuration)(AMFAudioBuffer* pThis, amf_pts duration); amf_pts (AMF_STD_CALL *GetDuration)(AMFAudioBuffer* pThis); // AMFAudioBuffer interface amf_int32 (AMF_STD_CALL *GetSampleCount)(AMFAudioBuffer* pThis); amf_int32 (AMF_STD_CALL *GetSampleRate)(AMFAudioBuffer* pThis); amf_int32 (AMF_STD_CALL *GetChannelCount)(AMFAudioBuffer* pThis); AMF_AUDIO_FORMAT (AMF_STD_CALL *GetSampleFormat)(AMFAudioBuffer* pThis); amf_int32 (AMF_STD_CALL *GetSampleSize)(AMFAudioBuffer* pThis); amf_uint32 (AMF_STD_CALL *GetChannelLayout)(AMFAudioBuffer* pThis); void* (AMF_STD_CALL *GetNative)(AMFAudioBuffer* pThis); amf_size (AMF_STD_CALL *GetSize)(AMFAudioBuffer* pThis); // Observer management void (AMF_STD_CALL *AddObserver_AudioBuffer)(AMFAudioBuffer* pThis, AMFAudioBufferObserver* pObserver); void (AMF_STD_CALL *RemoveObserver_AudioBuffer)(AMFAudioBuffer* pThis, AMFAudioBufferObserver* pObserver); } AMFAudioBufferVtbl; struct AMFAudioBuffer { const AMFAudioBufferVtbl *pVtbl; }; #endif // #if defined(__cplusplus) #if defined(__cplusplus) } // namespace #endif #if defined(_MSC_VER) #pragma warning( pop ) #endif #endif //#ifndef AMF_AudioBuffer_h 0707010000002C000081A400000000000000000000000163CFF5E70000258F000000000000000000000000000000000000002C00000000AMF-1.4.29/amf/public/include/core/Buffer.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Buffer_h #define AMF_Buffer_h #pragma once #include "Data.h" #if defined(_MSC_VER) #pragma warning( push ) #pragma warning(disable : 4263) #pragma warning(disable : 4264) #endif #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- // AMF_BUFFER_USAGE translates to D3D11_BIND_FLAG or VkBufferUsageFlagBits // bit mask //---------------------------------------------------------------------------------------------- typedef enum AMF_BUFFER_USAGE_BITS { // D3D11 D3D12 Vulkan AMF_BUFFER_USAGE_DEFAULT = 0x80000000, // D3D11_USAGE_STAGING, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT AMF_BUFFER_USAGE_NONE = 0x00000000, // 0 , D3D12_RESOURCE_FLAG_NONE, 0 AMF_BUFFER_USAGE_CONSTANT = 0x00000001, // D3D11_BIND_CONSTANT_BUFFER, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT AMF_BUFFER_USAGE_SHADER_RESOURCE = 0x00000002, // D3D11_BIND_SHADER_RESOURCE, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT AMF_BUFFER_USAGE_UNORDERED_ACCESS = 0x00000004, // D3D11_BIND_UNORDERED_ACCESS, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT AMF_BUFFER_USAGE_TRANSFER_SRC = 0x00000008, // VK_BUFFER_USAGE_TRANSFER_SRC_BIT AMF_BUFFER_USAGE_TRANSFER_DST = 0x00000010, // VK_BUFFER_USAGE_TRANSFER_DST_BIT } AMF_BUFFER_USAGE_BITS; typedef amf_flags AMF_BUFFER_USAGE; //---------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------- // AMFBufferObserver interface - callback //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMFBuffer; class AMF_NO_VTABLE AMFBufferObserver { public: virtual void AMF_STD_CALL OnBufferDataRelease(AMFBuffer* pBuffer) = 0; }; #else // #if defined(__cplusplus) typedef struct AMFBuffer AMFBuffer; typedef struct AMFBufferObserver AMFBufferObserver; typedef struct AMFBufferObserverVtbl { void (AMF_STD_CALL *OnBufferDataRelease)(AMFBufferObserver* pThis, AMFBuffer* pBuffer); } AMFBufferObserverVtbl; struct AMFBufferObserver { const AMFBufferObserverVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFBuffer interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFBuffer : public AMFData { public: AMF_DECLARE_IID(0xb04b7248, 0xb6f0, 0x4321, 0xb6, 0x91, 0xba, 0xa4, 0x74, 0xf, 0x9f, 0xcb) virtual AMF_RESULT AMF_STD_CALL SetSize(amf_size newSize) = 0; virtual amf_size AMF_STD_CALL GetSize() = 0; virtual void* AMF_STD_CALL GetNative() = 0; // Observer management #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Woverloaded-virtual" #endif virtual void AMF_STD_CALL AddObserver(AMFBufferObserver* pObserver) = 0; virtual void AMF_STD_CALL RemoveObserver(AMFBufferObserver* pObserver) = 0; #ifdef __clang__ #pragma clang diagnostic pop #endif }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFBuffer> AMFBufferPtr; //---------------------------------------------------------------------------------------------- #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFBuffer, 0xb04b7248, 0xb6f0, 0x4321, 0xb6, 0x91, 0xba, 0xa4, 0x74, 0xf, 0x9f, 0xcb) typedef struct AMFBufferVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFBuffer* pThis); amf_long (AMF_STD_CALL *Release)(AMFBuffer* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFBuffer* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFBuffer* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFBuffer* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFBuffer* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFBuffer* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFBuffer* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFBuffer* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFBuffer* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFBuffer* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFBuffer* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFBuffer* pThis, AMFPropertyStorageObserver* pObserver); // AMFData interface AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFBuffer* pThis); AMF_RESULT (AMF_STD_CALL *Duplicate)(AMFBuffer* pThis, AMF_MEMORY_TYPE type, AMFData** ppData); AMF_RESULT (AMF_STD_CALL *Convert)(AMFBuffer* pThis, AMF_MEMORY_TYPE type); // optimal interop if possilble. Copy through host memory if needed AMF_RESULT (AMF_STD_CALL *Interop)(AMFBuffer* pThis, AMF_MEMORY_TYPE type); // only optimal interop if possilble. No copy through host memory for GPU objects AMF_DATA_TYPE (AMF_STD_CALL *GetDataType)(AMFBuffer* pThis); amf_bool (AMF_STD_CALL *IsReusable)(AMFBuffer* pThis); void (AMF_STD_CALL *SetPts)(AMFBuffer* pThis, amf_pts pts); amf_pts (AMF_STD_CALL *GetPts)(AMFBuffer* pThis); void (AMF_STD_CALL *SetDuration)(AMFBuffer* pThis, amf_pts duration); amf_pts (AMF_STD_CALL *GetDuration)(AMFBuffer* pThis); // AMFBuffer interface AMF_RESULT (AMF_STD_CALL *SetSize)(AMFBuffer* pThis, amf_size newSize); amf_size (AMF_STD_CALL *GetSize)(AMFBuffer* pThis); void* (AMF_STD_CALL *GetNative)(AMFBuffer* pThis); // Observer management void (AMF_STD_CALL *AddObserver_Buffer)(AMFBuffer* pThis, AMFBufferObserver* pObserver); void (AMF_STD_CALL *RemoveObserver_Buffer)(AMFBuffer* pThis, AMFBufferObserver* pObserver); } AMFBufferVtbl; struct AMFBuffer { const AMFBufferVtbl *pVtbl; }; #endif // #if defined(__cplusplus) #if defined(__cplusplus) } // namespace #endif #if defined(_MSC_VER) #pragma warning( pop ) #endif #endif //#ifndef AMF_Buffer_h 0707010000002D000081A400000000000000000000000163CFF5E70000488F000000000000000000000000000000000000002D00000000AMF-1.4.29/amf/public/include/core/Compute.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** *************************************************************************************************** * @file Compute.h * @brief AMFCompute interface declaration *************************************************************************************************** */ #ifndef AMF_Compute_h #define AMF_Compute_h #pragma once #include "Buffer.h" #include "Surface.h" #if defined(__cplusplus) namespace amf { #endif typedef amf_uint64 AMF_KERNEL_ID; //---------------------------------------------------------------------------------------------- // enumerations for plane conversion //---------------------------------------------------------------------------------------------- typedef enum AMF_CHANNEL_ORDER { AMF_CHANNEL_ORDER_INVALID = 0, AMF_CHANNEL_ORDER_R = 1, AMF_CHANNEL_ORDER_RG = 2, AMF_CHANNEL_ORDER_BGRA = 3, AMF_CHANNEL_ORDER_RGBA = 4, AMF_CHANNEL_ORDER_ARGB = 5, AMF_CHANNEL_ORDER_YUY2 = 6, } AMF_CHANNEL_ORDER; //---------------------------------------------------------------------------------------------- typedef enum AMF_CHANNEL_TYPE { AMF_CHANNEL_INVALID = 0, AMF_CHANNEL_UNSIGNED_INT8 = 1, AMF_CHANNEL_UNSIGNED_INT32 = 2, AMF_CHANNEL_UNORM_INT8 = 3, AMF_CHANNEL_UNORM_INT16 = 4, AMF_CHANNEL_SNORM_INT16 = 5, AMF_CHANNEL_FLOAT = 6, AMF_CHANNEL_FLOAT16 = 7, AMF_CHANNEL_UNSIGNED_INT16 = 8, AMF_CHANNEL_UNORM_INT_101010 = 9, } AMF_CHANNEL_TYPE; //---------------------------------------------------------------------------------------------- #define AMF_STRUCTURED_BUFFER_FORMAT L"StructuredBufferFormat" // amf_int64(AMF_CHANNEL_TYPE), default - AMF_CHANNEL_UNSIGNED_INT32; to be set on AMFBuffer objects #if defined(_WIN32) AMF_WEAK GUID AMFStructuredBufferFormatGUID = { 0x90c5d674, 0xe90, 0x4181, {0xbd, 0xef, 0x26, 0x13, 0xc1, 0xdf, 0xa3, 0xbd} }; // UINT(DXGI_FORMAT), default - DXGI_FORMAT_R32_UINT; to be set on ID3D11Buffer or ID3D11Texture2D objects when used natively #endif //---------------------------------------------------------------------------------------------- // enumeration argument type //---------------------------------------------------------------------------------------------- typedef enum AMF_ARGUMENT_ACCESS_TYPE { AMF_ARGUMENT_ACCESS_READ = 0, AMF_ARGUMENT_ACCESS_WRITE = 1, AMF_ARGUMENT_ACCESS_READWRITE = 2, AMF_ARGUMENT_ACCESS_READWRITE_MASK = 0xFFFF, //Sampler parameters AMF_ARGUMENT_SAMPLER_LINEAR = 0x10000000, AMF_ARGUMENT_SAMPLER_NORM_COORD = 0x20000000, AMF_ARGUMENT_SAMPLER_POINT = 0x40000000, AMF_ARGUMENT_SAMPLER_MASK = 0xFFFF0000, } AMF_ARGUMENT_ACCESS_TYPE; //---------------------------------------------------------------------------------------------- // AMFComputeKernel interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFComputeKernel : public AMFInterface { public: AMF_DECLARE_IID(0x94815701, 0x6c84, 0x4ba6, 0xa9, 0xfe, 0xe9, 0xad, 0x40, 0xf8, 0x8, 0x8) virtual void* AMF_STD_CALL GetNative() = 0; virtual const wchar_t* AMF_STD_CALL GetIDName() = 0; virtual AMF_RESULT AMF_STD_CALL SetArgPlaneNative(amf_size index, void* pPlane, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0; virtual AMF_RESULT AMF_STD_CALL SetArgBufferNative(amf_size index, void* pBuffer, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0; virtual AMF_RESULT AMF_STD_CALL SetArgPlane(amf_size index, AMFPlane* pPlane, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0; virtual AMF_RESULT AMF_STD_CALL SetArgBuffer(amf_size index, AMFBuffer* pBuffer, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0; virtual AMF_RESULT AMF_STD_CALL SetArgInt32(amf_size index, amf_int32 data) = 0; virtual AMF_RESULT AMF_STD_CALL SetArgInt64(amf_size index, amf_int64 data) = 0; virtual AMF_RESULT AMF_STD_CALL SetArgFloat(amf_size index, amf_float data) = 0; virtual AMF_RESULT AMF_STD_CALL SetArgBlob(amf_size index, amf_size dataSize, const void* pData) = 0; virtual AMF_RESULT AMF_STD_CALL GetCompileWorkgroupSize(amf_size workgroupSize[3]) = 0; virtual AMF_RESULT AMF_STD_CALL Enqueue(amf_size dimension, amf_size globalOffset[3], amf_size globalSize[3], amf_size localSize[3]) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFComputeKernel> AMFComputeKernelPtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFComputeKernel, 0x94815701, 0x6c84, 0x4ba6, 0xa9, 0xfe, 0xe9, 0xad, 0x40, 0xf8, 0x8, 0x8) typedef struct AMFComputeKernel AMFComputeKernel; typedef struct AMFComputeKernelVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFComputeKernel* pThis); amf_long (AMF_STD_CALL *Release)(AMFComputeKernel* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComputeKernel* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFComputeKernel interface } AMFComputeKernelVtbl; struct AMFComputeKernel { const AMFComputeKernelVtbl *pVtbl; }; #endif //#if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFComputeSyncPoint interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFComputeSyncPoint : public AMFInterface { public: AMF_DECLARE_IID(0x66f33fe6, 0xaae, 0x4e65, 0xba, 0x3, 0xea, 0x8b, 0xa3, 0x60, 0x11, 0x2) virtual amf_bool AMF_STD_CALL IsCompleted() = 0; virtual void AMF_STD_CALL Wait() = 0; }; typedef AMFInterfacePtr_T<AMFComputeSyncPoint> AMFComputeSyncPointPtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFComputeSyncPoint, 0x66f33fe6, 0xaae, 0x4e65, 0xba, 0x3, 0xea, 0x8b, 0xa3, 0x60, 0x11, 0x2) typedef struct AMFComputeSyncPoint AMFComputeSyncPoint; typedef struct AMFComputeSyncPointVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFComputeSyncPoint* pThis); amf_long (AMF_STD_CALL *Release)(AMFComputeSyncPoint* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComputeSyncPoint* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFComputeSyncPoint interface amf_bool (AMF_STD_CALL *IsCompleted)(AMFComputeSyncPoint* pThis); void (AMF_STD_CALL *Wait)(AMFComputeSyncPoint* pThis); } AMFComputeSyncPointVtbl; struct AMFComputeSyncPoint { const AMFComputeSyncPointVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFCompute interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFCompute : public AMFInterface { public: AMF_DECLARE_IID(0x3846233a, 0x3f43, 0x443f, 0x8a, 0x45, 0x75, 0x22, 0x11, 0xa9, 0xfb, 0xd5) virtual AMF_MEMORY_TYPE AMF_STD_CALL GetMemoryType() = 0; virtual void* AMF_STD_CALL GetNativeContext() = 0; virtual void* AMF_STD_CALL GetNativeDeviceID() = 0; virtual void* AMF_STD_CALL GetNativeCommandQueue() = 0; virtual AMF_RESULT AMF_STD_CALL GetKernel(AMF_KERNEL_ID kernelID, AMFComputeKernel** kernel) = 0; virtual AMF_RESULT AMF_STD_CALL PutSyncPoint(AMFComputeSyncPoint** ppSyncPoint) = 0; virtual AMF_RESULT AMF_STD_CALL FinishQueue() = 0; virtual AMF_RESULT AMF_STD_CALL FlushQueue() = 0; virtual AMF_RESULT AMF_STD_CALL FillPlane(AMFPlane *pPlane, const amf_size origin[3], const amf_size region[3], const void* pColor) = 0; virtual AMF_RESULT AMF_STD_CALL FillBuffer(AMFBuffer* pBuffer, amf_size dstOffset, amf_size dstSize, const void* pSourcePattern, amf_size patternSize) = 0; virtual AMF_RESULT AMF_STD_CALL ConvertPlaneToBuffer(AMFPlane *pSrcPlane, AMFBuffer** ppDstBuffer) = 0; virtual AMF_RESULT AMF_STD_CALL CopyBuffer(AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffset) = 0; virtual AMF_RESULT AMF_STD_CALL CopyPlane(AMFPlane *pSrcPlane, const amf_size srcOrigin[3], const amf_size region[3], AMFPlane *pDstPlane, const amf_size dstOrigin[3]) = 0; virtual AMF_RESULT AMF_STD_CALL CopyBufferToHost(AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, void* pDest, amf_bool blocking) = 0; virtual AMF_RESULT AMF_STD_CALL CopyBufferFromHost(const void* pSource, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffsetInBytes, amf_bool blocking) = 0; virtual AMF_RESULT AMF_STD_CALL CopyPlaneToHost(AMFPlane *pSrcPlane, const amf_size origin[3], const amf_size region[3], void* pDest, amf_size dstPitch, amf_bool blocking) = 0; virtual AMF_RESULT AMF_STD_CALL CopyPlaneFromHost(void* pSource, const amf_size origin[3], const amf_size region[3], amf_size srcPitch, AMFPlane *pDstPlane, amf_bool blocking) = 0; virtual AMF_RESULT AMF_STD_CALL ConvertPlaneToPlane(AMFPlane* pSrcPlane, AMFPlane** ppDstPlane, AMF_CHANNEL_ORDER order, AMF_CHANNEL_TYPE type) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFCompute> AMFComputePtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFCompute, 0x3846233a, 0x3f43, 0x443f, 0x8a, 0x45, 0x75, 0x22, 0x11, 0xa9, 0xfb, 0xd5) typedef struct AMFCompute AMFCompute; typedef struct AMFComputeVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFCompute* pThis); amf_long (AMF_STD_CALL *Release)(AMFCompute* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFCompute* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFCompute interface AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFCompute* pThis); void* (AMF_STD_CALL *GetNativeContext)(AMFCompute* pThis); void* (AMF_STD_CALL *GetNativeDeviceID)(AMFCompute* pThis); void* (AMF_STD_CALL *GetNativeCommandQueue)(AMFCompute* pThis); AMF_RESULT (AMF_STD_CALL *GetKernel)(AMFCompute* pThis, AMF_KERNEL_ID kernelID, AMFComputeKernel** kernel); AMF_RESULT (AMF_STD_CALL *PutSyncPoint)(AMFCompute* pThis, AMFComputeSyncPoint** ppSyncPoint); AMF_RESULT (AMF_STD_CALL *FinishQueue)(AMFCompute* pThis); AMF_RESULT (AMF_STD_CALL *FlushQueue)(AMFCompute* pThis); AMF_RESULT (AMF_STD_CALL *FillPlane)(AMFCompute* pThis, AMFPlane *pPlane, const amf_size origin[3], const amf_size region[3], const void* pColor); AMF_RESULT (AMF_STD_CALL *FillBuffer)(AMFCompute* pThis, AMFBuffer* pBuffer, amf_size dstOffset, amf_size dstSize, const void* pSourcePattern, amf_size patternSize); AMF_RESULT (AMF_STD_CALL *ConvertPlaneToBuffer)(AMFCompute* pThis, AMFPlane *pSrcPlane, AMFBuffer** ppDstBuffer); AMF_RESULT (AMF_STD_CALL *CopyBuffer)(AMFCompute* pThis, AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffset); AMF_RESULT (AMF_STD_CALL *CopyPlane)(AMFCompute* pThis, AMFPlane *pSrcPlane, const amf_size srcOrigin[3], const amf_size region[3], AMFPlane *pDstPlane, const amf_size dstOrigin[3]); AMF_RESULT (AMF_STD_CALL *CopyBufferToHost)(AMFCompute* pThis, AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, void* pDest, amf_bool blocking); AMF_RESULT (AMF_STD_CALL *CopyBufferFromHost)(AMFCompute* pThis, const void* pSource, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffsetInBytes, amf_bool blocking); AMF_RESULT (AMF_STD_CALL *CopyPlaneToHost)(AMFCompute* pThis, AMFPlane *pSrcPlane, const amf_size origin[3], const amf_size region[3], void* pDest, amf_size dstPitch, amf_bool blocking); AMF_RESULT (AMF_STD_CALL *CopyPlaneFromHost)(AMFCompute* pThis, void* pSource, const amf_size origin[3], const amf_size region[3], amf_size srcPitch, AMFPlane *pDstPlane, amf_bool blocking); AMF_RESULT (AMF_STD_CALL *ConvertPlaneToPlane)(AMFCompute* pThis, AMFPlane* pSrcPlane, AMFPlane** ppDstPlane, AMF_CHANNEL_ORDER order, AMF_CHANNEL_TYPE type); } AMFComputeVtbl; struct AMFCompute { const AMFComputeVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFPrograms interface - singleton //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFPrograms { public: virtual AMF_RESULT AMF_STD_CALL RegisterKernelSourceFile(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, const wchar_t* filepath, const char* options) = 0; virtual AMF_RESULT AMF_STD_CALL RegisterKernelSource(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0; virtual AMF_RESULT AMF_STD_CALL RegisterKernelBinary(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0; virtual AMF_RESULT AMF_STD_CALL RegisterKernelSource1(AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0; virtual AMF_RESULT AMF_STD_CALL RegisterKernelBinary1(AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0; }; #else // #if defined(__cplusplus) typedef struct AMFPrograms AMFPrograms; typedef struct AMFProgramsVtbl { AMF_RESULT (AMF_STD_CALL *RegisterKernelSourceFile)(AMFPrograms* pThis, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, const wchar_t* filepath, const char* options); AMF_RESULT (AMF_STD_CALL *RegisterKernelSource)(AMFPrograms* pThis, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options); AMF_RESULT (AMF_STD_CALL *RegisterKernelBinary)(AMFPrograms* pThis, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options); AMF_RESULT (AMF_STD_CALL *RegisterKernelSource1)(AMFPrograms* pThis, AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options); AMF_RESULT (AMF_STD_CALL *RegisterKernelBinary1)(AMFPrograms* pThis, AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options); } AMFProgramsVtbl; struct AMFPrograms { const AMFProgramsVtbl *pVtbl; }; #endif // #if defined(__cplusplus) #if defined(__cplusplus) } // namespace amf #endif #endif // AMF_Compute_h 0707010000002E000081A400000000000000000000000163CFF5E700001FD3000000000000000000000000000000000000003400000000AMF-1.4.29/amf/public/include/core/ComputeFactory.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_ComputeFactory_h #define AMF_ComputeFactory_h #pragma once #include "Compute.h" #if defined(__cplusplus) namespace amf { #endif // compute device audio capabilities accessed via GetProperties() from AMFComputeDevice #define AMF_DEVICE_NAME L"DeviceName" // char*, string, device name #define AMF_DRIVER_VERSION_NAME L"DriverVersion" // char*, string, driver version #define AMF_AUDIO_CONVOLUTION_MAX_STREAMS L"ConvolutionMaxStreams" // amf_int64, maximum number of audio streams supported in realtime #define AMF_AUDIO_CONVOLUTION_LENGTH L"ConvolutionLength" // amf_int64, length of convolution in samples #define AMF_AUDIO_CONVOLUTION_BUFFER_SIZE L"ConvolutionBufferSize" // amf_int64, buffer size in samples #define AMF_AUDIO_CONVOLUTION_SAMPLE_RATE L"ConvolutionSampleRate" // amf_int64, sample rate #if defined(__cplusplus) class AMF_NO_VTABLE AMFComputeDevice : public AMFPropertyStorage { public: AMF_DECLARE_IID(0xb79d7cf6, 0x2c5c, 0x4deb, 0xb8, 0x96, 0xa2, 0x9e, 0xbe, 0xa6, 0xe3, 0x97) virtual void* AMF_STD_CALL GetNativePlatform() = 0; virtual void* AMF_STD_CALL GetNativeDeviceID() = 0; virtual void* AMF_STD_CALL GetNativeContext() = 0; virtual AMF_RESULT AMF_STD_CALL CreateCompute(void *reserved, AMFCompute **ppCompute) = 0; virtual AMF_RESULT AMF_STD_CALL CreateComputeEx(void* pCommandQueue, AMFCompute **ppCompute) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFComputeDevice> AMFComputeDevicePtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFComputeDevice, 0xb79d7cf6, 0x2c5c, 0x4deb, 0xb8, 0x96, 0xa2, 0x9e, 0xbe, 0xa6, 0xe3, 0x97) typedef struct AMFComputeDevice AMFComputeDevice; typedef struct AMFComputeDeviceVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFComputeDevice* pThis); amf_long (AMF_STD_CALL *Release)(AMFComputeDevice* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComputeDevice* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFComputeDevice* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFComputeDevice* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFComputeDevice* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFComputeDevice* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFComputeDevice* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFComputeDevice* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFComputeDevice* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFComputeDevice* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFComputeDevice* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFComputeDevice* pThis, AMFPropertyStorageObserver* pObserver); // AMFComputeDevice interface void* (AMF_STD_CALL *GetNativePlatform)(AMFComputeDevice* pThis); void* (AMF_STD_CALL *GetNativeDeviceID)(AMFComputeDevice* pThis); void* (AMF_STD_CALL *GetNativeContext)(AMFComputeDevice* pThis); AMF_RESULT (AMF_STD_CALL *CreateCompute)(AMFComputeDevice* pThis, void *reserved, AMFCompute **ppCompute); AMF_RESULT (AMF_STD_CALL *CreateComputeEx)(AMFComputeDevice* pThis, void* pCommandQueue, AMFCompute **ppCompute); } AMFComputeDeviceVtbl; struct AMFComputeDevice { const AMFComputeDeviceVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFComputeFactory : public AMFInterface { public: AMF_DECLARE_IID(0xe3c24bd7, 0x2d83, 0x416c, 0x8c, 0x4e, 0xfd, 0x13, 0xca, 0x86, 0xf4, 0xd0) virtual amf_int32 AMF_STD_CALL GetDeviceCount() = 0; virtual AMF_RESULT AMF_STD_CALL GetDeviceAt(amf_int32 index, AMFComputeDevice **ppDevice) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFComputeFactory> AMFComputeFactoryPtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFComputeFactory, 0xe3c24bd7, 0x2d83, 0x416c, 0x8c, 0x4e, 0xfd, 0x13, 0xca, 0x86, 0xf4, 0xd0) typedef struct AMFComputeFactory AMFComputeFactory; typedef struct AMFComputeFactoryVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFComputeFactory* pThis); amf_long (AMF_STD_CALL *Release)(AMFComputeFactory* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComputeFactory* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFComputeFactory interface amf_int32 (AMF_STD_CALL *GetDeviceCount)(AMFComputeFactory* pThis); AMF_RESULT (AMF_STD_CALL *GetDeviceAt)(AMFComputeFactory* pThis, amf_int32 index, AMFComputeDevice **ppDevice); } AMFComputeFactoryVtbl; struct AMFComputeFactory { const AMFComputeFactoryVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) } // namespace amf #endif #endif // AMF_ComputeFactory_h 0707010000002F000081A400000000000000000000000163CFF5E70000AD21000000000000000000000000000000000000002D00000000AMF-1.4.29/amf/public/include/core/Context.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Context_h #define AMF_Context_h #pragma once #include "Buffer.h" #include "AudioBuffer.h" #include "Surface.h" #include "Compute.h" #include "ComputeFactory.h" #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- // AMFContext interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFContext : public AMFPropertyStorage { public: AMF_DECLARE_IID(0xa76a13f0, 0xd80e, 0x4fcc, 0xb5, 0x8, 0x65, 0xd0, 0xb5, 0x2e, 0xd9, 0xee) // Cleanup virtual AMF_RESULT AMF_STD_CALL Terminate() = 0; // DX9 virtual AMF_RESULT AMF_STD_CALL InitDX9(void* pDX9Device) = 0; virtual void* AMF_STD_CALL GetDX9Device(AMF_DX_VERSION dxVersionRequired = AMF_DX9) = 0; virtual AMF_RESULT AMF_STD_CALL LockDX9() = 0; virtual AMF_RESULT AMF_STD_CALL UnlockDX9() = 0; class AMFDX9Locker; // DX11 virtual AMF_RESULT AMF_STD_CALL InitDX11(void* pDX11Device, AMF_DX_VERSION dxVersionRequired = AMF_DX11_0) = 0; virtual void* AMF_STD_CALL GetDX11Device(AMF_DX_VERSION dxVersionRequired = AMF_DX11_0) = 0; virtual AMF_RESULT AMF_STD_CALL LockDX11() = 0; virtual AMF_RESULT AMF_STD_CALL UnlockDX11() = 0; class AMFDX11Locker; // OpenCL virtual AMF_RESULT AMF_STD_CALL InitOpenCL(void* pCommandQueue = NULL) = 0; virtual void* AMF_STD_CALL GetOpenCLContext() = 0; virtual void* AMF_STD_CALL GetOpenCLCommandQueue() = 0; virtual void* AMF_STD_CALL GetOpenCLDeviceID() = 0; virtual AMF_RESULT AMF_STD_CALL GetOpenCLComputeFactory(AMFComputeFactory **ppFactory) = 0; // advanced compute - multiple queries virtual AMF_RESULT AMF_STD_CALL InitOpenCLEx(AMFComputeDevice *pDevice) = 0; virtual AMF_RESULT AMF_STD_CALL LockOpenCL() = 0; virtual AMF_RESULT AMF_STD_CALL UnlockOpenCL() = 0; class AMFOpenCLLocker; // OpenGL virtual AMF_RESULT AMF_STD_CALL InitOpenGL(amf_handle hOpenGLContext, amf_handle hWindow, amf_handle hDC) = 0; virtual amf_handle AMF_STD_CALL GetOpenGLContext() = 0; virtual amf_handle AMF_STD_CALL GetOpenGLDrawable() = 0; virtual AMF_RESULT AMF_STD_CALL LockOpenGL() = 0; virtual AMF_RESULT AMF_STD_CALL UnlockOpenGL() = 0; class AMFOpenGLLocker; // XV - Linux virtual AMF_RESULT AMF_STD_CALL InitXV(void* pXVDevice) = 0; virtual void* AMF_STD_CALL GetXVDevice() = 0; virtual AMF_RESULT AMF_STD_CALL LockXV() = 0; virtual AMF_RESULT AMF_STD_CALL UnlockXV() = 0; class AMFXVLocker; // Gralloc - Android virtual AMF_RESULT AMF_STD_CALL InitGralloc(void* pGrallocDevice) = 0; virtual void* AMF_STD_CALL GetGrallocDevice() = 0; virtual AMF_RESULT AMF_STD_CALL LockGralloc() = 0; virtual AMF_RESULT AMF_STD_CALL UnlockGralloc() = 0; class AMFGrallocLocker; // Allocation virtual AMF_RESULT AMF_STD_CALL AllocBuffer(AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer) = 0; virtual AMF_RESULT AMF_STD_CALL AllocSurface(AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMFSurface** ppSurface) = 0; virtual AMF_RESULT AMF_STD_CALL AllocAudioBuffer(AMF_MEMORY_TYPE type, AMF_AUDIO_FORMAT format, amf_int32 samples, amf_int32 sampleRate, amf_int32 channels, AMFAudioBuffer** ppAudioBuffer) = 0; // Wrap existing objects virtual AMF_RESULT AMF_STD_CALL CreateBufferFromHostNative(void* pHostBuffer, amf_size size, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromHostNative(AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, void* pData, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromDX9Native(void* pDX9Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromDX11Native(void* pDX11Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromOpenGLNative(AMF_SURFACE_FORMAT format, amf_handle hGLTextureID, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromGrallocNative(amf_handle hGrallocSurface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromOpenCLNative(AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, void** pClPlanes, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL CreateBufferFromOpenCLNative(void* pCLBuffer, amf_size size, AMFBuffer** ppBuffer) = 0; // Access to AMFCompute interface - AMF_MEMORY_OPENCL, AMF_MEMORY_COMPUTE_FOR_DX9, AMF_MEMORY_COMPUTE_FOR_DX11 are currently supported virtual AMF_RESULT AMF_STD_CALL GetCompute(AMF_MEMORY_TYPE eMemType, AMFCompute** ppCompute) = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFContext> AMFContextPtr; //---------------------------------------------------------------------------------------------- // AMFContext1 interface //---------------------------------------------------------------------------------------------- class AMF_NO_VTABLE AMFContext1 : public AMFContext { public: AMF_DECLARE_IID(0xd9e9f868, 0x6220, 0x44c6, 0xa2, 0x2f, 0x7c, 0xd6, 0xda, 0xc6, 0x86, 0x46) virtual AMF_RESULT AMF_STD_CALL CreateBufferFromDX11Native(void* pHostBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL AllocBufferEx(AMF_MEMORY_TYPE type, amf_size size, AMF_BUFFER_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFBuffer** ppBuffer) = 0; virtual AMF_RESULT AMF_STD_CALL AllocSurfaceEx(AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMF_SURFACE_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFSurface** ppSurface) = 0; // Vulkan - Windows, Linux virtual AMF_RESULT AMF_STD_CALL InitVulkan(void* pVulkanDevice) = 0; virtual void* AMF_STD_CALL GetVulkanDevice() = 0; virtual AMF_RESULT AMF_STD_CALL LockVulkan() = 0; virtual AMF_RESULT AMF_STD_CALL UnlockVulkan() = 0; virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromVulkanNative(void* pVulkanImage, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL CreateBufferFromVulkanNative(void* pVulkanBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL GetVulkanDeviceExtensions(amf_size *pCount, const char **ppExtensions) = 0; class AMFVulkanLocker; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFContext1> AMFContext1Ptr; class AMF_NO_VTABLE AMFContext2 : public AMFContext1 { public: AMF_DECLARE_IID(0x726241d3, 0xbd46, 0x4e90, 0x99, 0x68, 0x93, 0xe0, 0x7e, 0xa2, 0x98, 0x4d) // DX12 virtual AMF_RESULT AMF_STD_CALL InitDX12(void* pDX11Device, AMF_DX_VERSION dxVersionRequired = AMF_DX12) = 0; virtual void* AMF_STD_CALL GetDX12Device(AMF_DX_VERSION dxVersionRequired = AMF_DX12) = 0; virtual AMF_RESULT AMF_STD_CALL LockDX12() = 0; virtual AMF_RESULT AMF_STD_CALL UnlockDX12() = 0; virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromDX12Native(void* pResourceTexture, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0; virtual AMF_RESULT AMF_STD_CALL CreateBufferFromDX12Native(void* pResourceBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver) = 0; class AMFDX12Locker; }; typedef AMFInterfacePtr_T<AMFContext2> AMFContext2Ptr; #else typedef struct AMFContext AMFContext; AMF_DECLARE_IID(AMFContext, 0xa76a13f0, 0xd80e, 0x4fcc, 0xb5, 0x8, 0x65, 0xd0, 0xb5, 0x2e, 0xd9, 0xee) typedef struct AMFContextVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFContext* pThis); amf_long (AMF_STD_CALL *Release)(AMFContext* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFContext* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFInterface AMFPropertyStorage AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFContext* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFContext* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFContext* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFContext* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFContext* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFContext* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFContext* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFContext* pThis, AMFPropertyStorageObserver* pObserver); // AMFContext interface // Cleanup AMF_RESULT (AMF_STD_CALL *Terminate)(AMFContext* pThis); // DX9 AMF_RESULT (AMF_STD_CALL *InitDX9)(AMFContext* pThis, void* pDX9Device); void* (AMF_STD_CALL *GetDX9Device)(AMFContext* pThis, AMF_DX_VERSION dxVersionRequired); AMF_RESULT (AMF_STD_CALL *LockDX9)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *UnlockDX9)(AMFContext* pThis); // DX11 AMF_RESULT (AMF_STD_CALL *InitDX11)(AMFContext* pThis, void* pDX11Device, AMF_DX_VERSION dxVersionRequired); void* (AMF_STD_CALL *GetDX11Device)(AMFContext* pThis, AMF_DX_VERSION dxVersionRequired); AMF_RESULT (AMF_STD_CALL *LockDX11)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *UnlockDX11)(AMFContext* pThis); // OpenCL AMF_RESULT (AMF_STD_CALL *InitOpenCL)(AMFContext* pThis, void* pCommandQueue); void* (AMF_STD_CALL *GetOpenCLContext)(AMFContext* pThis); void* (AMF_STD_CALL *GetOpenCLCommandQueue)(AMFContext* pThis); void* (AMF_STD_CALL *GetOpenCLDeviceID)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *GetOpenCLComputeFactory)(AMFContext* pThis, AMFComputeFactory **ppFactory); // advanced compute - multiple queries AMF_RESULT (AMF_STD_CALL *InitOpenCLEx)(AMFContext* pThis, AMFComputeDevice *pDevice); AMF_RESULT (AMF_STD_CALL *LockOpenCL)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *UnlockOpenCL)(AMFContext* pThis); // OpenGL AMF_RESULT (AMF_STD_CALL *InitOpenGL)(AMFContext* pThis, amf_handle hOpenGLContext, amf_handle hWindow, amf_handle hDC); amf_handle (AMF_STD_CALL *GetOpenGLContext)(AMFContext* pThis); amf_handle (AMF_STD_CALL *GetOpenGLDrawable)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *LockOpenGL)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *UnlockOpenGL)(AMFContext* pThis); // XV - Linux AMF_RESULT (AMF_STD_CALL *InitXV)(AMFContext* pThis, void* pXVDevice); void* (AMF_STD_CALL *GetXVDevice)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *LockXV)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *UnlockXV)(AMFContext* pThis); // Gralloc - Android AMF_RESULT (AMF_STD_CALL *InitGralloc)(AMFContext* pThis, void* pGrallocDevice); void* (AMF_STD_CALL *GetGrallocDevice)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *LockGralloc)(AMFContext* pThis); AMF_RESULT (AMF_STD_CALL *UnlockGralloc)(AMFContext* pThis); // Allocation AMF_RESULT (AMF_STD_CALL *AllocBuffer)(AMFContext* pThis, AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer); AMF_RESULT (AMF_STD_CALL *AllocSurface)(AMFContext* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMFSurface** ppSurface); AMF_RESULT (AMF_STD_CALL *AllocAudioBuffer)(AMFContext* pThis, AMF_MEMORY_TYPE type, AMF_AUDIO_FORMAT format, amf_int32 samples, amf_int32 sampleRate, amf_int32 channels, AMFAudioBuffer** ppAudioBuffer); // Wrap existing objects AMF_RESULT (AMF_STD_CALL *CreateBufferFromHostNative)(AMFContext* pThis, void* pHostBuffer, amf_size size, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromHostNative)(AMFContext* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, void* pData, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX9Native)(AMFContext* pThis, void* pDX9Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX11Native)(AMFContext* pThis, void* pDX11Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenGLNative)(AMFContext* pThis, AMF_SURFACE_FORMAT format, amf_handle hGLTextureID, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromGrallocNative)(AMFContext* pThis, amf_handle hGrallocSurface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenCLNative)(AMFContext* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, void** pClPlanes, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateBufferFromOpenCLNative)(AMFContext* pThis, void* pCLBuffer, amf_size size, AMFBuffer** ppBuffer); // Access to AMFCompute interface - AMF_MEMORY_OPENCL, AMF_MEMORY_COMPUTE_FOR_DX9, AMF_MEMORY_COMPUTE_FOR_DX11 are currently supported AMF_RESULT (AMF_STD_CALL *GetCompute)(AMFContext* pThis, AMF_MEMORY_TYPE eMemType, AMFCompute** ppCompute); } AMFContextVtbl; struct AMFContext { const AMFContextVtbl *pVtbl; }; typedef struct AMFContext1 AMFContext1; AMF_DECLARE_IID(AMFContext1, 0xd9e9f868, 0x6220, 0x44c6, 0xa2, 0x2f, 0x7c, 0xd6, 0xda, 0xc6, 0x86, 0x46) typedef struct AMFContext1Vtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFContext1* pThis); amf_long (AMF_STD_CALL *Release)(AMFContext1* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFContext1* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFInterface AMFPropertyStorage AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFContext1* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFContext1* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFContext1* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFContext1* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFContext1* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFContext1* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFContext1* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFContext1* pThis, AMFPropertyStorageObserver* pObserver); // AMFContext interface // Cleanup AMF_RESULT (AMF_STD_CALL *Terminate)(AMFContext1* pThis); // DX9 AMF_RESULT (AMF_STD_CALL *InitDX9)(AMFContext1* pThis, void* pDX9Device); void* (AMF_STD_CALL *GetDX9Device)(AMFContext1* pThis, AMF_DX_VERSION dxVersionRequired); AMF_RESULT (AMF_STD_CALL *LockDX9)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *UnlockDX9)(AMFContext1* pThis); // DX11 AMF_RESULT (AMF_STD_CALL *InitDX11)(AMFContext1* pThis, void* pDX11Device, AMF_DX_VERSION dxVersionRequired); void* (AMF_STD_CALL *GetDX11Device)(AMFContext1* pThis, AMF_DX_VERSION dxVersionRequired); AMF_RESULT (AMF_STD_CALL *LockDX11)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *UnlockDX11)(AMFContext1* pThis); // OpenCL AMF_RESULT (AMF_STD_CALL *InitOpenCL)(AMFContext1* pThis, void* pCommandQueue); void* (AMF_STD_CALL *GetOpenCLContext)(AMFContext1* pThis); void* (AMF_STD_CALL *GetOpenCLCommandQueue)(AMFContext1* pThis); void* (AMF_STD_CALL *GetOpenCLDeviceID)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *GetOpenCLComputeFactory)(AMFContext1* pThis, AMFComputeFactory **ppFactory); // advanced compute - multiple queries AMF_RESULT (AMF_STD_CALL *InitOpenCLEx)(AMFContext1* pThis, AMFComputeDevice *pDevice); AMF_RESULT (AMF_STD_CALL *LockOpenCL)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *UnlockOpenCL)(AMFContext1* pThis); // OpenGL AMF_RESULT (AMF_STD_CALL *InitOpenGL)(AMFContext1* pThis, amf_handle hOpenGLContext, amf_handle hWindow, amf_handle hDC); amf_handle (AMF_STD_CALL *GetOpenGLContext)(AMFContext1* pThis); amf_handle (AMF_STD_CALL *GetOpenGLDrawable)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *LockOpenGL)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *UnlockOpenGL)(AMFContext1* pThis); // XV - Linux AMF_RESULT (AMF_STD_CALL *InitXV)(AMFContext1* pThis, void* pXVDevice); void* (AMF_STD_CALL *GetXVDevice)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *LockXV)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *UnlockXV)(AMFContext1* pThis); // Gralloc - Android AMF_RESULT (AMF_STD_CALL *InitGralloc)(AMFContext1* pThis, void* pGrallocDevice); void* (AMF_STD_CALL *GetGrallocDevice)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *LockGralloc)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *UnlockGralloc)(AMFContext1* pThis); // Allocation AMF_RESULT (AMF_STD_CALL *AllocBuffer)(AMFContext1* pThis, AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer); AMF_RESULT (AMF_STD_CALL *AllocSurface)(AMFContext1* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMFSurface** ppSurface); AMF_RESULT (AMF_STD_CALL *AllocAudioBuffer)(AMFContext1* pThis, AMF_MEMORY_TYPE type, AMF_AUDIO_FORMAT format, amf_int32 samples, amf_int32 sampleRate, amf_int32 channels, AMFAudioBuffer** ppAudioBuffer); // Wrap existing objects AMF_RESULT (AMF_STD_CALL *CreateBufferFromHostNative)(AMFContext1* pThis, void* pHostBuffer, amf_size size, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromHostNative)(AMFContext1* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, void* pData, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX9Native)(AMFContext1* pThis, void* pDX9Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX11Native)(AMFContext1* pThis, void* pDX11Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenGLNative)(AMFContext1* pThis, AMF_SURFACE_FORMAT format, amf_handle hGLTextureID, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromGrallocNative)(AMFContext1* pThis, amf_handle hGrallocSurface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenCLNative)(AMFContext1* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, void** pClPlanes, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateBufferFromOpenCLNative)(AMFContext1* pThis, void* pCLBuffer, amf_size size, AMFBuffer** ppBuffer); // Access to AMFCompute interface - AMF_MEMORY_OPENCL, AMF_MEMORY_COMPUTE_FOR_DX9, AMF_MEMORY_COMPUTE_FOR_DX11 are currently supported AMF_RESULT (AMF_STD_CALL *GetCompute)(AMFContext1* pThis, AMF_MEMORY_TYPE eMemType, AMFCompute** ppCompute); // AMFContext1 interface AMF_RESULT (AMF_STD_CALL *CreateBufferFromDX11Native)(AMFContext1* pThis, void* pHostBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver); AMF_RESULT (AMF_STD_CALL *AllocBufferEx)(AMFContext1* pThis, AMF_MEMORY_TYPE type, amf_size size, AMF_BUFFER_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFBuffer** ppBuffer); AMF_RESULT (AMF_STD_CALL *AllocSurfaceEx)(AMFContext1* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMF_SURFACE_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFSurface** ppSurface); // Vulkan - Windows, Linux AMF_RESULT (AMF_STD_CALL *InitVulkan)(AMFContext1* pThis, void* pVulkanDevice); void* (AMF_STD_CALL *GetVulkanDevice)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *LockVulkan)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *UnlockVulkan)(AMFContext1* pThis); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromVulkanNative)(AMFContext1* pThis, void* pVulkanImage, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateBufferFromVulkanNative)(AMFContext1* pThis, void* pVulkanBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver); AMF_RESULT (AMF_STD_CALL *GetVulkanDeviceExtensions)(AMFContext1* pThis, amf_size *pCount, const char **ppExtensions); } AMFContext1Vtbl; struct AMFContext1 { const AMFContext1Vtbl *pVtbl; }; typedef struct AMFContext2 AMFContext2; AMF_DECLARE_IID(AMFContext2, 0xd9e9f868, 0x6220, 0x44c6, 0xa2, 0x2f, 0x7c, 0xd6, 0xda, 0xc6, 0x86, 0x46) typedef struct AMFContext2Vtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFContext2* pThis); amf_long (AMF_STD_CALL *Release)(AMFContext2* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFContext2* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFInterface AMFPropertyStorage AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFContext2* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFContext2* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFContext2* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFContext2* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFContext2* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFContext2* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFContext2* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFContext2* pThis, AMFPropertyStorageObserver* pObserver); // AMFContext interface // Cleanup AMF_RESULT (AMF_STD_CALL *Terminate)(AMFContext2* pThis); // DX9 AMF_RESULT (AMF_STD_CALL *InitDX9)(AMFContext2* pThis, void* pDX9Device); void* (AMF_STD_CALL *GetDX9Device)(AMFContext2* pThis, AMF_DX_VERSION dxVersionRequired); AMF_RESULT (AMF_STD_CALL *LockDX9)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *UnlockDX9)(AMFContext2* pThis); // DX11 AMF_RESULT (AMF_STD_CALL *InitDX11)(AMFContext2* pThis, void* pDX11Device, AMF_DX_VERSION dxVersionRequired); void* (AMF_STD_CALL *GetDX11Device)(AMFContext2* pThis, AMF_DX_VERSION dxVersionRequired); AMF_RESULT (AMF_STD_CALL *LockDX11)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *UnlockDX11)(AMFContext2* pThis); // OpenCL AMF_RESULT (AMF_STD_CALL *InitOpenCL)(AMFContext2* pThis, void* pCommandQueue); void* (AMF_STD_CALL *GetOpenCLContext)(AMFContext2* pThis); void* (AMF_STD_CALL *GetOpenCLCommandQueue)(AMFContext2* pThis); void* (AMF_STD_CALL *GetOpenCLDeviceID)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *GetOpenCLComputeFactory)(AMFContext2* pThis, AMFComputeFactory **ppFactory); // advanced compute - multiple queries AMF_RESULT (AMF_STD_CALL *InitOpenCLEx)(AMFContext2* pThis, AMFComputeDevice *pDevice); AMF_RESULT (AMF_STD_CALL *LockOpenCL)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *UnlockOpenCL)(AMFContext2* pThis); // OpenGL AMF_RESULT (AMF_STD_CALL *InitOpenGL)(AMFContext2* pThis, amf_handle hOpenGLContext, amf_handle hWindow, amf_handle hDC); amf_handle (AMF_STD_CALL *GetOpenGLContext)(AMFContext2* pThis); amf_handle (AMF_STD_CALL *GetOpenGLDrawable)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *LockOpenGL)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *UnlockOpenGL)(AMFContext2* pThis); // XV - Linux AMF_RESULT (AMF_STD_CALL *InitXV)(AMFContext2* pThis, void* pXVDevice); void* (AMF_STD_CALL *GetXVDevice)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *LockXV)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *UnlockXV)(AMFContext2* pThis); // Gralloc - Android AMF_RESULT (AMF_STD_CALL *InitGralloc)(AMFContext2* pThis, void* pGrallocDevice); void* (AMF_STD_CALL *GetGrallocDevice)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *LockGralloc)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *UnlockGralloc)(AMFContext2* pThis); // Allocation AMF_RESULT (AMF_STD_CALL *AllocBuffer)(AMFContext2* pThis, AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer); AMF_RESULT (AMF_STD_CALL *AllocSurface)(AMFContext2* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMFSurface** ppSurface); AMF_RESULT (AMF_STD_CALL *AllocAudioBuffer)(AMFContext2* pThis, AMF_MEMORY_TYPE type, AMF_AUDIO_FORMAT format, amf_int32 samples, amf_int32 sampleRate, amf_int32 channels, AMFAudioBuffer** ppAudioBuffer); // Wrap existing objects AMF_RESULT (AMF_STD_CALL *CreateBufferFromHostNative)(AMFContext2* pThis, void* pHostBuffer, amf_size size, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromHostNative)(AMFContext2* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, void* pData,AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX9Native)(AMFContext2* pThis, void* pDX9Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX11Native)(AMFContext2* pThis, void* pDX11Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenGLNative)(AMFContext2* pThis, AMF_SURFACE_FORMAT format, amf_handle hGLTextureID, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromGrallocNative)(AMFContext2* pThis, amf_handle hGrallocSurface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenCLNative)(AMFContext2* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, void** pClPlanes, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateBufferFromOpenCLNative)(AMFContext2* pThis, void* pCLBuffer, amf_size size, AMFBuffer** ppBuffer); // Access to AMFCompute interface - AMF_MEMORY_OPENCL, AMF_MEMORY_COMPUTE_FOR_DX9, AMF_MEMORY_COMPUTE_FOR_DX11 are currently supported AMF_RESULT (AMF_STD_CALL *GetCompute)(AMFContext2* pThis, AMF_MEMORY_TYPE eMemType, AMFCompute** ppCompute); // AMFContext1 interface AMF_RESULT (AMF_STD_CALL *CreateBufferFromDX11Native)(AMFContext2* pThis, void* pHostBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver); AMF_RESULT (AMF_STD_CALL *AllocBufferEx)(AMFContext2* pThis, AMF_MEMORY_TYPE type, amf_size size, AMF_BUFFER_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFBuffer** ppBuffer); AMF_RESULT (AMF_STD_CALL *AllocSurfaceEx)(AMFContext2* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMF_SURFACE_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFSurface** ppSurface); // Vulkan - Windows, Linux AMF_RESULT (AMF_STD_CALL *InitVulkan)(AMFContext2* pThis, void* pVulkanDevice); void* (AMF_STD_CALL *GetVulkanDevice)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *LockVulkan)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *UnlockVulkan)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromVulkanNative)(AMFContext2* pThis, void* pVulkanImage, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateBufferFromVulkanNative)(AMFContext2* pThis, void* pVulkanBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver); AMF_RESULT (AMF_STD_CALL *GetVulkanDeviceExtensions)(AMFContext2* pThis, amf_size *pCount, const char **ppExtensions); // AMFContext2 interface AMF_RESULT (AMF_STD_CALL *InitDX12)(AMFContext2* pThis, void* pDX11Device, AMF_DX_VERSION dxVersionRequired); void* (AMF_STD_CALL *GetDX12Device)(AMFContext2* pThis, AMF_DX_VERSION dxVersionRequired); AMF_RESULT (AMF_STD_CALL *LockDX12)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *UnlockDX12)(AMFContext2* pThis); AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX12Native)(AMFContext2* pThis, void* pResourceTexture, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver); AMF_RESULT (AMF_STD_CALL *CreateBufferFromDX12Native)(AMFContext2* pThis, void* pResourceBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver); } AMFContext2Vtbl; struct AMFContext2 { const AMFContext2Vtbl *pVtbl; }; #endif #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // Lockers //---------------------------------------------------------------------------------------------- class AMFContext::AMFDX9Locker { public: AMFDX9Locker() : m_Context(NULL) {} AMFDX9Locker(AMFContext* resources) : m_Context(NULL) { Lock(resources); } ~AMFDX9Locker() { if(m_Context != NULL) { m_Context->UnlockDX9(); } } void Lock(AMFContext* resources) { if(m_Context != NULL) { m_Context->UnlockDX9(); } m_Context = resources; if(m_Context != NULL) { m_Context->LockDX9(); } } protected: AMFContext* m_Context; private: AMFDX9Locker(const AMFDX9Locker&); AMFDX9Locker& operator=(const AMFDX9Locker&); }; //---------------------------------------------------------------------------------------------- class AMFContext::AMFDX11Locker { public: AMFDX11Locker() : m_Context(NULL) {} AMFDX11Locker(AMFContext* resources) : m_Context(NULL) { Lock(resources); } ~AMFDX11Locker() { if(m_Context != NULL) { m_Context->UnlockDX11(); } } void Lock(AMFContext* resources) { if(m_Context != NULL) { m_Context->UnlockDX11(); } m_Context = resources; if(m_Context != NULL) { m_Context->LockDX11(); } } protected: AMFContext* m_Context; private: AMFDX11Locker(const AMFDX11Locker&); AMFDX11Locker& operator=(const AMFDX11Locker&); }; //---------------------------------------------------------------------------------------------- class AMFContext::AMFOpenCLLocker { public: AMFOpenCLLocker() : m_Context(NULL) {} AMFOpenCLLocker(AMFContext* resources) : m_Context(NULL) { Lock(resources); } ~AMFOpenCLLocker() { if(m_Context != NULL) { m_Context->UnlockOpenCL(); } } void Lock(AMFContext* resources) { if(m_Context != NULL) { m_Context->UnlockOpenCL(); } m_Context = resources; if(m_Context != NULL) { m_Context->LockOpenCL(); } } protected: AMFContext* m_Context; private: AMFOpenCLLocker(const AMFOpenCLLocker&); AMFOpenCLLocker& operator=(const AMFOpenCLLocker&); }; //---------------------------------------------------------------------------------------------- class AMFContext::AMFOpenGLLocker { public: AMFOpenGLLocker(AMFContext* pContext) : m_pContext(pContext), m_GLLocked(false) { if(m_pContext != NULL) { if(m_pContext->LockOpenGL() == AMF_OK) { m_GLLocked = true; } } } ~AMFOpenGLLocker() { if(m_GLLocked) { m_pContext->UnlockOpenGL(); } } private: AMFContext* m_pContext; amf_bool m_GLLocked; ///< AMFOpenGLLocker can be called when OpenGL is not initialized yet ///< in this case don't call UnlockOpenGL AMFOpenGLLocker(const AMFOpenGLLocker&); AMFOpenGLLocker& operator=(const AMFOpenGLLocker&); }; //---------------------------------------------------------------------------------------------- class AMFContext::AMFXVLocker { public: AMFXVLocker() : m_pContext(NULL) {} AMFXVLocker(AMFContext* pContext) : m_pContext(NULL) { Lock(pContext); } ~AMFXVLocker() { if(m_pContext != NULL) { m_pContext->UnlockXV(); } } void Lock(AMFContext* pContext) { if((pContext != NULL) && (pContext->GetXVDevice() != NULL)) { m_pContext = pContext; m_pContext->LockXV(); } } protected: AMFContext* m_pContext; private: AMFXVLocker(const AMFXVLocker&); AMFXVLocker& operator=(const AMFXVLocker&); }; //---------------------------------------------------------------------------------------------- class AMFContext::AMFGrallocLocker { public: AMFGrallocLocker() : m_pContext(NULL) {} AMFGrallocLocker(AMFContext* pContext) : m_pContext(NULL) { Lock(pContext); } ~AMFGrallocLocker() { if(m_pContext != NULL) { m_pContext->UnlockGralloc(); } } void Lock(AMFContext* pContext) { if((pContext != NULL) && (pContext->GetGrallocDevice() != NULL)) { m_pContext = pContext; m_pContext->LockGralloc(); } } protected: AMFContext* m_pContext; private: AMFGrallocLocker(const AMFGrallocLocker&); AMFGrallocLocker& operator=(const AMFGrallocLocker&); }; //---------------------------------------------------------------------------------------------- class AMFContext1::AMFVulkanLocker { public: AMFVulkanLocker() : m_pContext(NULL) {} AMFVulkanLocker(AMFContext1* pContext) : m_pContext(NULL) { Lock(pContext); } ~AMFVulkanLocker() { if(m_pContext != NULL) { m_pContext->UnlockVulkan(); } } void Lock(AMFContext1* pContext) { if((pContext != NULL) && (pContext->GetVulkanDevice() != NULL)) { m_pContext = pContext; m_pContext->LockVulkan(); } } protected: AMFContext1* m_pContext; private: AMFVulkanLocker(const AMFVulkanLocker&); AMFVulkanLocker& operator=(const AMFVulkanLocker&); }; //---------------------------------------------------------------------------------------------- class AMFContext2::AMFDX12Locker { public: AMFDX12Locker() : m_Context(NULL) {} AMFDX12Locker(AMFContext2* resources) : m_Context(NULL) { Lock(resources); } ~AMFDX12Locker() { if (m_Context != NULL) { m_Context->UnlockDX12(); } } void Lock(AMFContext2* resources) { if (m_Context != NULL) { m_Context->UnlockDX12(); } m_Context = resources; if (m_Context != NULL) { m_Context->LockDX12(); } } protected: AMFContext2* m_Context; private: AMFDX12Locker(const AMFDX12Locker&); AMFDX12Locker& operator=(const AMFDX12Locker&); }; //---------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------- #endif #if defined(__cplusplus) } #endif enum AMF_CONTEXT_DEVICETYPE_ENUM { AMF_CONTEXT_DEVICE_TYPE_GPU = 0, AMF_CONTEXT_DEVICE_TYPE_CPU }; #define AMF_CONTEXT_DEVICE_TYPE L"AMF_Context_DeviceType" //Value type: amf_int64; Values : AMF_CONTEXT_DEVICE_TYPE_GPU for GPU (default) , AMF_CONTEXT_DEVICE_TYPE_CPU for CPU. #endif //#ifndef AMF_Context_h 07070100000030000081A400000000000000000000000163CFF5E700000874000000000000000000000000000000000000003100000000AMF-1.4.29/amf/public/include/core/CurrentTime.h// // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_CurrentTime_h #define AMF_CurrentTime_h #include "Platform.h" #include "Interface.h" namespace amf { // Current time interface class. This interface object can be passed // as a property to components requiring synchronized timing. The // implementation is: // - first call to Get() starts time and returns 0 // - subsequent calls to Get() returns values relative to 0 // - Reset() puts time back at 0 at next Get() call // class AMF_NO_VTABLE AMFCurrentTime : public AMFInterface { public: virtual amf_pts AMF_STD_CALL Get() = 0; virtual void AMF_STD_CALL Reset() = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFCurrentTime> AMFCurrentTimePtr; //----------------------------------------------------------------------------------------------} } #endif // AMF_CurrentTime_h 07070100000031000081A400000000000000000000000163CFF5E700000C34000000000000000000000000000000000000002E00000000AMF-1.4.29/amf/public/include/core/D3D12AMF.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef __D3D12AMF_h__ #define __D3D12AMF_h__ #pragma once #include "Platform.h" #if defined(_WIN32)||(defined(__linux) && defined(AMF_WSL)) // syncronization properties set via SetPrivateData() AMF_WEAK GUID AMFResourceStateGUID = { 0x452da9bf, 0x4ad7, 0x47a5, { 0xa6, 0x9b, 0x96, 0xd3, 0x23, 0x76, 0xf2, 0xf3 } }; // Current resource state value (D3D12_RESOURCE_STATES ), sizeof(UINT), set on ID3D12Resource AMF_WEAK GUID AMFFenceGUID = { 0x910a7928, 0x57bd, 0x4b04, { 0x91, 0xa3, 0xe7, 0xb8, 0x04, 0x12, 0xcd, 0xa5 } }; // IUnknown (ID3D12Fence), set on ID3D12Resource syncronization fence for this resource AMF_WEAK GUID AMFFenceValueGUID = { 0x62a693d3, 0xbb4a, 0x46c9, { 0xa5, 0x04, 0x9a, 0x8e, 0x97, 0xbf, 0xf0, 0x56 } }; // The last value to wait on the fence from AMFFenceGUID; sizeof(UINT64), set on ID3D12Fence AMF_WEAK GUID AMFFenceD3D11GUID = { 0xdffdf6e0, 0x85e0, 0x4645, { 0x9d, 0x7, 0xe6, 0x4a, 0x19, 0x6b, 0xc9, 0xbf } }; // IUnknown (ID3D11Fence) OpenSharedFence for interop AMF_WEAK GUID AMFFenceValueD3D11GUID = { 0x86581b71, 0x699f, 0x484b, { 0xb8, 0x75, 0x24, 0xda, 0x49, 0x8a, 0x74, 0xcf } }; // last value to wait on in d3d11 AMF_WEAK GUID AMFSharedHandleFenceGUID = { 0xca60dcc8, 0x76d1, 0x4088, 0xad, 0xd, 0x97, 0x71, 0xe7, 0xb0, 0x92, 0x49 }; // ID3D12Fence shared handle for D3D11 interop #endif #endif // __D3D12AMF_h__07070100000032000081A400000000000000000000000163CFF5E700002473000000000000000000000000000000000000002A00000000AMF-1.4.29/amf/public/include/core/Data.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Data_h #define AMF_Data_h #pragma once #include "PropertyStorage.h" #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- typedef enum AMF_DATA_TYPE { AMF_DATA_BUFFER = 0, AMF_DATA_SURFACE = 1, AMF_DATA_AUDIO_BUFFER = 2, AMF_DATA_USER = 1000, // all extensions will be AMF_DATA_USER+i } AMF_DATA_TYPE; //---------------------------------------------------------------------------------------------- typedef enum AMF_MEMORY_TYPE { AMF_MEMORY_UNKNOWN = 0, AMF_MEMORY_HOST = 1, AMF_MEMORY_DX9 = 2, AMF_MEMORY_DX11 = 3, AMF_MEMORY_OPENCL = 4, AMF_MEMORY_OPENGL = 5, AMF_MEMORY_XV = 6, AMF_MEMORY_GRALLOC = 7, AMF_MEMORY_COMPUTE_FOR_DX9 = 8, // deprecated, the same as AMF_MEMORY_OPENCL AMF_MEMORY_COMPUTE_FOR_DX11 = 9, // deprecated, the same as AMF_MEMORY_OPENCL AMF_MEMORY_VULKAN = 10, AMF_MEMORY_DX12 = 11, } AMF_MEMORY_TYPE; //---------------------------------------------------------------------------------------------- typedef enum AMF_DX_VERSION { AMF_DX9 = 90, AMF_DX9_EX = 91, AMF_DX11_0 = 110, AMF_DX11_1 = 111, AMF_DX12 = 120, } AMF_DX_VERSION; //---------------------------------------------------------------------------------------------- // AMF_MEMORY_CPU_ACCESS translates to D3D11_CPU_ACCESS_FLAG or VkImageUsageFlags // bit mask //---------------------------------------------------------------------------------------------- typedef enum AMF_MEMORY_CPU_ACCESS_BITS { // D3D11 D3D12 Vulkan AMF_MEMORY_CPU_DEFAULT = 0x80000000, // 0 , D3D12_HEAP_TYPE_DEFAULT , VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT AMF_MEMORY_CPU_NONE = 0x00000000, // 0 , D3D12_HEAP_TYPE_DEFAULT , AMF_MEMORY_CPU_READ = 0x00000001, // D3D11_CPU_ACCESS_READ , D3D12_HEAP_TYPE_READBACK, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT AMF_MEMORY_CPU_WRITE = 0x00000002, // D3D11_CPU_ACCESS_WRITE, D3D12_HEAP_TYPE_UPLOAD , VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT AMF_MEMORY_CPU_LOCAL = 0x00000004, // , D3D12_HEAP_TYPE_DEFAULT , VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT AMF_MEMORY_CPU_PINNED = 0x00000008, // , , VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR } AMF_MEMORY_CPU_ACCESS_BITS; typedef amf_flags AMF_MEMORY_CPU_ACCESS; //---------------------------------------------------------------------------------------------- // AMFData interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFData : public AMFPropertyStorage { public: AMF_DECLARE_IID(0xa1159bf6, 0x9104, 0x4107, 0x8e, 0xaa, 0xc5, 0x3d, 0x5d, 0xba, 0xc5, 0x11) virtual AMF_MEMORY_TYPE AMF_STD_CALL GetMemoryType() = 0; virtual AMF_RESULT AMF_STD_CALL Duplicate(AMF_MEMORY_TYPE type, AMFData** ppData) = 0; virtual AMF_RESULT AMF_STD_CALL Convert(AMF_MEMORY_TYPE type) = 0; // optimal interop if possilble. Copy through host memory if needed virtual AMF_RESULT AMF_STD_CALL Interop(AMF_MEMORY_TYPE type) = 0; // only optimal interop if possilble. No copy through host memory for GPU objects virtual AMF_DATA_TYPE AMF_STD_CALL GetDataType() = 0; virtual amf_bool AMF_STD_CALL IsReusable() = 0; virtual void AMF_STD_CALL SetPts(amf_pts pts) = 0; virtual amf_pts AMF_STD_CALL GetPts() = 0; virtual void AMF_STD_CALL SetDuration(amf_pts duration) = 0; virtual amf_pts AMF_STD_CALL GetDuration() = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFData> AMFDataPtr; //---------------------------------------------------------------------------------------------- #else // #if defined(__cplusplus) typedef struct AMFData AMFData; AMF_DECLARE_IID(AMFData, 0xa1159bf6, 0x9104, 0x4107, 0x8e, 0xaa, 0xc5, 0x3d, 0x5d, 0xba, 0xc5, 0x11) typedef struct AMFDataVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFData* pThis); amf_long (AMF_STD_CALL *Release)(AMFData* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFData* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFData* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFData* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFData* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFData* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFData* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFData* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFData* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFData* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFData* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFData* pThis, AMFPropertyStorageObserver* pObserver); // AMFData interface AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFData* pThis); AMF_RESULT (AMF_STD_CALL *Duplicate)(AMFData* pThis, AMF_MEMORY_TYPE type, AMFData** ppData); AMF_RESULT (AMF_STD_CALL *Convert)(AMFData* pThis, AMF_MEMORY_TYPE type); // optimal interop if possilble. Copy through host memory if needed AMF_RESULT (AMF_STD_CALL *Interop)(AMFData* pThis, AMF_MEMORY_TYPE type); // only optimal interop if possilble. No copy through host memory for GPU objects AMF_DATA_TYPE (AMF_STD_CALL *GetDataType)(AMFData* pThis); amf_bool (AMF_STD_CALL *IsReusable)(AMFData* pThis); void (AMF_STD_CALL *SetPts)(AMFData* pThis, amf_pts pts); amf_pts (AMF_STD_CALL *GetPts)(AMFData* pThis); void (AMF_STD_CALL *SetDuration)(AMFData* pThis, amf_pts duration); amf_pts (AMF_STD_CALL *GetDuration)(AMFData* pThis); } AMFDataVtbl; struct AMFData { const AMFDataVtbl *pVtbl; }; #endif // #if defined(__cplusplus) #if defined(__cplusplus) } // namespace #endif #endif //#ifndef AMF_Data_h 07070100000033000081A400000000000000000000000163CFF5E700000CF5000000000000000000000000000000000000002B00000000AMF-1.4.29/amf/public/include/core/Debug.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Debug_h #define AMF_Debug_h #pragma once #include "Platform.h" #include "Result.h" #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- // AMFDebug interface - singleton //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFDebug { public: virtual void AMF_STD_CALL EnablePerformanceMonitor(amf_bool enable) = 0; virtual amf_bool AMF_STD_CALL PerformanceMonitorEnabled() = 0; virtual void AMF_STD_CALL AssertsEnable(amf_bool enable) = 0; virtual amf_bool AMF_STD_CALL AssertsEnabled() = 0; }; #else // #if defined(__cplusplus) typedef struct AMFDebug AMFDebug; typedef struct AMFDebugVtbl { // AMFDebug interface void (AMF_STD_CALL *EnablePerformanceMonitor)(AMFDebug* pThis, amf_bool enable); amf_bool (AMF_STD_CALL *PerformanceMonitorEnabled)(AMFDebug* pThis); void (AMF_STD_CALL *AssertsEnable)(AMFDebug* pThis, amf_bool enable); amf_bool (AMF_STD_CALL *AssertsEnabled)(AMFDebug* pThis); } AMFDebugVtbl; struct AMFDebug { const AMFDebugVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) } #endif #endif // AMF_Debug_h 07070100000034000081A400000000000000000000000163CFF5E70000153B000000000000000000000000000000000000002A00000000AMF-1.4.29/amf/public/include/core/Dump.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Dump_h #define AMF_Dump_h #pragma once #include "Platform.h" #include "Result.h" #include "Interface.h" #if defined(__cplusplus) namespace amf { #endif #if defined(__cplusplus) class AMF_NO_VTABLE AMFDump : public AMFInterface { public: AMF_DECLARE_IID(0x75366ad4, 0x504c, 0x430b, 0xbb, 0xe2, 0xad, 0x21, 0x82, 0x8, 0xf, 0x72); virtual const wchar_t* AMF_STD_CALL GetDumpBasePath() const = 0; // Get application dump base path virtual AMF_RESULT AMF_STD_CALL SetDumpBasePath(const wchar_t* path) = 0; // Set application dump base path // Enable/disable input and/or output stream dumps virtual bool AMF_STD_CALL IsInputDumpEnabled() const = 0; virtual AMF_RESULT AMF_STD_CALL EnableInputDump(bool enabled) = 0; virtual const wchar_t* AMF_STD_CALL GetInputDumpFullName() const = 0; // Get full name of dump file // Enable/disable input and/or output stream dumps virtual bool AMF_STD_CALL IsOutputDumpEnabled() const = 0; virtual AMF_RESULT AMF_STD_CALL EnableOutputDump(bool enabled) = 0; virtual const wchar_t* AMF_STD_CALL GetOutputDumpFullName() const = 0; // Get full name of dump file // When enabled, each new application session will create a subfolder with a time stamp in the base path tree (disabled by default) virtual bool AMF_STD_CALL IsPerSessionDumpEnabled() const = 0; virtual void AMF_STD_CALL EnablePerSessionDump(bool enabled) = 0; }; typedef AMFInterfacePtr_T<AMFDump> AMFDumpPtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFDump, 0x75366ad4, 0x504c, 0x430b, 0xbb, 0xe2, 0xad, 0x21, 0x82, 0x8, 0xf, 0x72); typedef struct AMFDump AMFDump; typedef struct AMFDumpVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFDump* pThis); amf_long (AMF_STD_CALL *Release)(AMFDump* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFDump* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFDump interface const wchar_t* (AMF_STD_CALL *GetDumpBasePath)(AMFDump* pThis) const; // Get application dump base path AMF_RESULT (AMF_STD_CALL *SetDumpBasePath)(AMFDump* pThis, const wchar_t* path); // Set application dump base path // Enable/disable input and/or output stream dumps bool (AMF_STD_CALL *IsInputDumpEnabled)(AMFDump* pThis) const; AMF_RESULT (AMF_STD_CALL *EnableInputDump)(AMFDump* pThis, bool enabled); const wchar_t* (AMF_STD_CALL *GetInputDumpFullName)(AMFDump* pThis) const; // Get full name of dump file // Enable/disable input and/or output stream dumps bool (AMF_STD_CALL *IsOutputDumpEnabled)(AMFDump* pThis) const; AMF_RESULT (AMF_STD_CALL *EnableOutputDump)(AMFDump* pThis, bool enabled); const wchar_t* (AMF_STD_CALL *GetOutputDumpFullName)(AMFDump* pThis) const; // Get full name of dump file // When enabled, each new application session will create a subfolder with a time stamp in the base path tree (disabled by default) bool (AMF_STD_CALL *IsPerSessionDumpEnabled)(AMFDump* pThis) const; void (AMF_STD_CALL *EnablePerSessionDump)(AMFDump* pThis, bool enabled); } AMFDumpVtbl; struct AMFDump { const AMFDumpVtbl *pVtbl; }; #endif // #if defined(__cplusplus) #if defined(__cplusplus) } // namespace #endif #endif //AMF_Dump_h 07070100000035000081A400000000000000000000000163CFF5E700001644000000000000000000000000000000000000002D00000000AMF-1.4.29/amf/public/include/core/Factory.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Factory_h #define AMF_Factory_h #pragma once #include "Platform.h" #include "Version.h" #include "Result.h" #include "Context.h" #include "Debug.h" #include "Trace.h" #include "Compute.h" #include "../components/Component.h" #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- // AMFFactory interface - singleton //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFFactory { public: virtual AMF_RESULT AMF_STD_CALL CreateContext(AMFContext** ppContext) = 0; virtual AMF_RESULT AMF_STD_CALL CreateComponent(AMFContext* pContext, const wchar_t* id, AMFComponent** ppComponent) = 0; virtual AMF_RESULT AMF_STD_CALL SetCacheFolder(const wchar_t* path) = 0; virtual const wchar_t* AMF_STD_CALL GetCacheFolder() = 0; virtual AMF_RESULT AMF_STD_CALL GetDebug(AMFDebug** ppDebug) = 0; virtual AMF_RESULT AMF_STD_CALL GetTrace(AMFTrace** ppTrace) = 0; virtual AMF_RESULT AMF_STD_CALL GetPrograms(AMFPrograms** ppPrograms) = 0; }; #else typedef struct AMFFactory AMFFactory; typedef struct AMFFactoryVtbl { AMF_RESULT (AMF_STD_CALL *CreateContext)(AMFFactory* pThis, AMFContext** ppContext); AMF_RESULT (AMF_STD_CALL *CreateComponent)(AMFFactory* pThis, AMFContext* pContext, const wchar_t* id, AMFComponent** ppComponent); AMF_RESULT (AMF_STD_CALL *SetCacheFolder)(AMFFactory* pThis, const wchar_t* path); const wchar_t* (AMF_STD_CALL *GetCacheFolder)(AMFFactory* pThis); AMF_RESULT (AMF_STD_CALL *GetDebug)(AMFFactory* pThis, AMFDebug** ppDebug); AMF_RESULT (AMF_STD_CALL *GetTrace)(AMFFactory* pThis, AMFTrace** ppTrace); AMF_RESULT (AMF_STD_CALL *GetPrograms)(AMFFactory* pThis, AMFPrograms** ppPrograms); } AMFFactoryVtbl; struct AMFFactory { const AMFFactoryVtbl *pVtbl; }; #endif #if defined(__cplusplus) } #endif //---------------------------------------------------------------------------------------------- // DLL entry points //---------------------------------------------------------------------------------------------- #define AMF_INIT_FUNCTION_NAME "AMFInit" #define AMF_QUERY_VERSION_FUNCTION_NAME "AMFQueryVersion" #if defined(__cplusplus) extern "C" { typedef AMF_RESULT (AMF_CDECL_CALL *AMFInit_Fn)(amf_uint64 version, amf::AMFFactory **ppFactory); typedef AMF_RESULT (AMF_CDECL_CALL *AMFQueryVersion_Fn)(amf_uint64 *pVersion); } #else typedef AMF_RESULT (AMF_CDECL_CALL *AMFInit_Fn)(amf_uint64 version, AMFFactory **ppFactory); typedef AMF_RESULT (AMF_CDECL_CALL *AMFQueryVersion_Fn)(amf_uint64 *pVersion); #endif #if defined(_WIN32) #if defined(_M_AMD64) #define AMF_DLL_NAME L"amfrt64.dll" #define AMF_DLL_NAMEA "amfrt64.dll" #else #define AMF_DLL_NAME L"amfrt32.dll" #define AMF_DLL_NAMEA "amfrt32.dll" #endif #elif defined(__ANDROID__) && !defined(AMF_ANDROID_ENCODER) #define AMF_DLL_NAME L"libamf.so" #define AMF_DLL_NAMEA "libamf.so" #elif defined(__APPLE__) #define AMF_DLL_NAME L"libamfrt.framework/libamfrt" #define AMF_DLL_NAMEA "libamfrt.framework/libamfrt" #elif defined(__linux__) #if defined(__x86_64__) || defined(__aarch64__) #define AMF_DLL_NAME L"libamfrt64.so.1" #define AMF_DLL_NAMEA "libamfrt64.so.1" #else #define AMF_DLL_NAME L"libamfrt32.so.1" #define AMF_DLL_NAMEA "libamfrt32.so.1" #endif #endif //---------------------------------------------------------------------------------------------- #endif // AMF_Factory_h 07070100000036000081A400000000000000000000000163CFF5E70000209F000000000000000000000000000000000000002F00000000AMF-1.4.29/amf/public/include/core/Interface.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Interface_h #define AMF_Interface_h #pragma once #include "Result.h" #if defined(__cplusplus) namespace amf { #endif #if defined(__cplusplus) #define AMF_DECLARE_IID(_data1, _data2, _data3, _data41, _data42, _data43, _data44, _data45, _data46, _data47, _data48) \ static AMF_INLINE const amf::AMFGuid IID() \ { \ amf::AMFGuid uid = {_data1, _data2, _data3, _data41, _data42, _data43, _data44, _data45, _data46, _data47, _data48}; \ return uid; \ } #else #define AMF_DECLARE_IID(name, _data1, _data2, _data3, _data41, _data42, _data43, _data44, _data45, _data46, _data47, _data48) \ AMF_INLINE static const AMFGuid IID_##name(void) \ { \ AMFGuid uid = {_data1, _data2, _data3, _data41, _data42, _data43, _data44, _data45, _data46, _data47, _data48}; \ return uid; \ } #endif //------------------------------------------------------------------------ // AMFInterface interface - base class for all AMF interfaces //------------------------------------------------------------------------ #if defined(__cplusplus) class AMF_NO_VTABLE AMFInterface { public: AMF_DECLARE_IID(0x9d872f34, 0x90dc, 0x4b93, 0xb6, 0xb2, 0x6c, 0xa3, 0x7c, 0x85, 0x25, 0xdb) virtual amf_long AMF_STD_CALL Acquire() = 0; virtual amf_long AMF_STD_CALL Release() = 0; virtual AMF_RESULT AMF_STD_CALL QueryInterface(const AMFGuid& interfaceID, void** ppInterface) = 0; }; #else AMF_DECLARE_IID(AMFInterface, 0x9d872f34, 0x90dc, 0x4b93, 0xb6, 0xb2, 0x6c, 0xa3, 0x7c, 0x85, 0x25, 0xdb) typedef struct AMFInterface AMFInterface; typedef struct AMFInterfaceVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFInterface* pThis); amf_long (AMF_STD_CALL *Release)(AMFInterface* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFInterface* pThis, const struct AMFGuid *interfaceID, void** ppInterface); } AMFInterfaceVtbl; struct AMFInterface { const AMFInterfaceVtbl *pVtbl; }; #endif //------------------------------------------------------------------------ // template for AMF smart pointer //------------------------------------------------------------------------ #if defined(__cplusplus) template<class _Interf> class AMFInterfacePtr_T { private: _Interf* m_pInterf; void InternalAcquire() { if(m_pInterf != NULL) { m_pInterf->Acquire(); } } void InternalRelease() { if(m_pInterf != NULL) { m_pInterf->Release(); } } public: AMFInterfacePtr_T() : m_pInterf(NULL) {} AMFInterfacePtr_T(const AMFInterfacePtr_T<_Interf>& p) : m_pInterf(p.m_pInterf) { InternalAcquire(); } AMFInterfacePtr_T(_Interf* pInterface) : m_pInterf(pInterface) { InternalAcquire(); } template<class _OtherInterf> explicit AMFInterfacePtr_T(const AMFInterfacePtr_T<_OtherInterf>& cp) : m_pInterf(NULL) { void* pInterf = NULL; if((cp == NULL) || (cp->QueryInterface(_Interf::IID(), &pInterf) != AMF_OK)) { pInterf = NULL; } m_pInterf = static_cast<_Interf*>(pInterf); } template<class _OtherInterf> explicit AMFInterfacePtr_T(_OtherInterf* cp) : m_pInterf(NULL) { void* pInterf = NULL; if((cp == NULL) || (cp->QueryInterface(_Interf::IID(), &pInterf) != AMF_OK)) { pInterf = NULL; } m_pInterf = static_cast<_Interf*>(pInterf); } ~AMFInterfacePtr_T() { InternalRelease(); } AMFInterfacePtr_T& operator=(_Interf* pInterface) { if(m_pInterf != pInterface) { _Interf* pOldInterface = m_pInterf; m_pInterf = pInterface; InternalAcquire(); if(pOldInterface != NULL) { pOldInterface->Release(); } } return *this; } AMFInterfacePtr_T& operator=(const AMFInterfacePtr_T<_Interf>& cp) { return operator=(cp.m_pInterf); } void Attach(_Interf* pInterface) { InternalRelease(); m_pInterf = pInterface; } _Interf* Detach() { _Interf* const pOld = m_pInterf; m_pInterf = NULL; return pOld; } void Release() { InternalRelease(); m_pInterf = NULL; } operator _Interf*() const { return m_pInterf; } _Interf& operator*() const { return *m_pInterf; } // Returns the address of the interface pointer contained in this // class. This is required for initializing from C-style factory function to // avoid getting an incorrect ref count at the beginning. _Interf** operator&() { InternalRelease(); m_pInterf = 0; return &m_pInterf; } _Interf* operator->() const { return m_pInterf; } bool operator==(const AMFInterfacePtr_T<_Interf>& p) { return (m_pInterf == p.m_pInterf); } bool operator==(_Interf* p) { return (m_pInterf == p); } bool operator!=(const AMFInterfacePtr_T<_Interf>& p) { return !(operator==(p)); } bool operator!=(_Interf* p) { return !(operator==(p)); } _Interf* GetPtr() { return m_pInterf; } const _Interf* GetPtr() const { return m_pInterf; } }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFInterface> AMFInterfacePtr; //---------------------------------------------------------------------------------------------- #endif #if defined(__cplusplus) } #endif #endif //#ifndef AMF_Interface_h 07070100000037000081A400000000000000000000000163CFF5E70000148C000000000000000000000000000000000000002B00000000AMF-1.4.29/amf/public/include/core/Plane.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Plane_h #define AMF_Plane_h #pragma once #include "Interface.h" #if defined(__cplusplus) namespace amf { #endif //--------------------------------------------------------------------------------------------- typedef enum AMF_PLANE_TYPE { AMF_PLANE_UNKNOWN = 0, AMF_PLANE_PACKED = 1, // for all packed formats: BGRA, YUY2, etc AMF_PLANE_Y = 2, AMF_PLANE_UV = 3, AMF_PLANE_U = 4, AMF_PLANE_V = 5, } AMF_PLANE_TYPE; //--------------------------------------------------------------------------------------------- // AMFPlane interface //--------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFPlane : public AMFInterface { public: AMF_DECLARE_IID(0xbede1aa6, 0xd8fa, 0x4625, 0x94, 0x65, 0x6c, 0x82, 0xc4, 0x37, 0x71, 0x2e) virtual AMF_PLANE_TYPE AMF_STD_CALL GetType() = 0; virtual void* AMF_STD_CALL GetNative() = 0; virtual amf_int32 AMF_STD_CALL GetPixelSizeInBytes() = 0; virtual amf_int32 AMF_STD_CALL GetOffsetX() = 0; virtual amf_int32 AMF_STD_CALL GetOffsetY() = 0; virtual amf_int32 AMF_STD_CALL GetWidth() = 0; virtual amf_int32 AMF_STD_CALL GetHeight() = 0; virtual amf_int32 AMF_STD_CALL GetHPitch() = 0; virtual amf_int32 AMF_STD_CALL GetVPitch() = 0; virtual bool AMF_STD_CALL IsTiled() = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFPlane> AMFPlanePtr; //---------------------------------------------------------------------------------------------- #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFPlane, 0xbede1aa6, 0xd8fa, 0x4625, 0x94, 0x65, 0x6c, 0x82, 0xc4, 0x37, 0x71, 0x2e) typedef struct AMFPlane AMFPlane; typedef struct AMFPlaneVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFPlane* pThis); amf_long (AMF_STD_CALL *Release)(AMFPlane* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFPlane* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPlane interface AMF_PLANE_TYPE (AMF_STD_CALL *GetType)(AMFPlane* pThis); void* (AMF_STD_CALL *GetNative)(AMFPlane* pThis); amf_int32 (AMF_STD_CALL *GetPixelSizeInBytes)(AMFPlane* pThis); amf_int32 (AMF_STD_CALL *GetOffsetX)(AMFPlane* pThis); amf_int32 (AMF_STD_CALL *GetOffsetY)(AMFPlane* pThis); amf_int32 (AMF_STD_CALL *GetWidth)(AMFPlane* pThis); amf_int32 (AMF_STD_CALL *GetHeight)(AMFPlane* pThis); amf_int32 (AMF_STD_CALL *GetHPitch)(AMFPlane* pThis); amf_int32 (AMF_STD_CALL *GetVPitch)(AMFPlane* pThis); amf_bool (AMF_STD_CALL *IsTiled)(AMFPlane* pThis); } AMFPlaneVtbl; struct AMFPlane { const AMFPlaneVtbl *pVtbl; }; #endif // #if defined(__cplusplus) #if defined(__cplusplus) } // namespace amf #endif #endif //#ifndef AMF_Plane_h 07070100000038000081A400000000000000000000000163CFF5E700003C45000000000000000000000000000000000000002E00000000AMF-1.4.29/amf/public/include/core/Platform.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Platform_h #define AMF_Platform_h #pragma once //---------------------------------------------------------------------------------------------- // export declaration //---------------------------------------------------------------------------------------------- #if defined(_WIN32) #if defined(AMF_CORE_STATIC) #define AMF_CORE_LINK #else #if defined(AMF_CORE_EXPORTS) #define AMF_CORE_LINK __declspec(dllexport) #else #define AMF_CORE_LINK __declspec(dllimport) #endif #endif #elif defined(__linux) #if defined(AMF_CORE_EXPORTS) #define AMF_CORE_LINK __attribute__((visibility("default"))) #else #define AMF_CORE_LINK #endif #else #define AMF_CORE_LINK #endif // #ifdef _WIN32 #define AMF_MACRO_STRING2(x) #x #define AMF_MACRO_STRING(x) AMF_MACRO_STRING2(x) #define AMF_TODO(_todo) (__FILE__ "(" AMF_MACRO_STRING(__LINE__) "): TODO: "_todo) #if defined(__GNUC__) || defined(__clang__) #define AMF_ALIGN(n) __attribute__((aligned(n))) #elif defined(_MSC_VER) || defined(__INTEL_COMPILER) #define AMF_ALIGN(n) __declspec(align(n)) #else #define AMF_ALIGN(n) // #error Need to define AMF_ALIGN #endif #ifndef _WIN32 typedef signed int HRESULT; #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) #define FAILED(hr) (((HRESULT)(hr)) < 0) #endif #include <stdio.h> #include <stdint.h> #include <string.h> #if defined(_WIN32) #ifndef NOMINMAX #define NOMINMAX #endif #define AMF_STD_CALL __stdcall #define AMF_CDECL_CALL __cdecl #define AMF_FAST_CALL __fastcall #if defined(__GNUC__) || defined(__clang__) #define AMF_INLINE inline #define AMF_FORCEINLINE inline #else #define AMF_INLINE __inline #define AMF_FORCEINLINE __forceinline #endif #define AMF_NO_VTABLE __declspec(novtable) #define AMFPRId64 "I64d" #define LPRId64 L"I64d" #define AMFPRIud64 "Iu64d" #define LPRIud64 L"Iu64d" #define AMFPRIx64 "I64x" #define LPRIx64 L"I64x" #else // !WIN32 - Linux and Mac #define AMF_STD_CALL #define AMF_CDECL_CALL #define AMF_FAST_CALL #if defined(__GNUC__) || defined(__clang__) #define AMF_INLINE inline #define AMF_FORCEINLINE inline #else #define AMF_INLINE __inline__ #define AMF_FORCEINLINE __inline__ #endif #define AMF_NO_VTABLE #if !defined(AMFPRId64) #define AMFPRId64 "lld" #define LPRId64 L"lld" #define AMFPRIud64 "ulld" #define LPRIud64 L"ulld" #define AMFPRIx64 "llx" #define LPRIx64 L"llx" #endif #endif // WIN32 #if defined(_WIN32) #define AMF_WEAK __declspec( selectany ) #elif defined (__GNUC__) || defined (__GCC__) || defined(__clang__)//GCC or CLANG #define AMF_WEAK __attribute__((weak)) #endif #define amf_countof(x) (sizeof(x) / sizeof(x[0])) //------------------------------------------------------------------------------------------------- // basic data types //------------------------------------------------------------------------------------------------- typedef int64_t amf_int64; typedef int32_t amf_int32; typedef int16_t amf_int16; typedef int8_t amf_int8; typedef uint64_t amf_uint64; typedef uint32_t amf_uint32; typedef uint16_t amf_uint16; typedef uint8_t amf_uint8; typedef size_t amf_size; typedef void* amf_handle; typedef double amf_double; typedef float amf_float; typedef void amf_void; #if defined(__cplusplus) typedef bool amf_bool; #else typedef amf_uint8 amf_bool; #define true 1 #define false 0 #endif typedef long amf_long; typedef int amf_int; typedef unsigned long amf_ulong; typedef unsigned int amf_uint; typedef amf_int64 amf_pts; // in 100 nanosecs typedef amf_uint32 amf_flags; #define AMF_SECOND 10000000L // 1 second in 100 nanoseconds #define AMF_MILLISECOND (AMF_SECOND / 1000) #define AMF_MICROSECOND (AMF_MILLISECOND / 1000) #define AMF_MIN(a, b) ((a) < (b) ? (a) : (b)) #define AMF_MAX(a, b) ((a) > (b) ? (a) : (b)) #define AMF_CLAMP(x, a, b) (AMF_MIN(AMF_MAX(x, a), b)) #define AMF_BITS_PER_BYTE 8 #if defined(_WIN32) #define PATH_SEPARATOR_WSTR L"\\" #define PATH_SEPARATOR_WCHAR L'\\' #elif defined(__linux) || defined(__APPLE__) // Linux & Apple #define PATH_SEPARATOR_WSTR L"/" #define PATH_SEPARATOR_WCHAR L'/' #endif typedef struct AMFRect { amf_int32 left; amf_int32 top; amf_int32 right; amf_int32 bottom; #if defined(__cplusplus) bool operator==(const AMFRect& other) const { return left == other.left && top == other.top && right == other.right && bottom == other.bottom; } AMF_INLINE bool operator!=(const AMFRect& other) const { return !operator==(other); } amf_int32 Width() const { return right - left; } amf_int32 Height() const { return bottom - top; } #endif } AMFRect; static AMF_INLINE struct AMFRect AMFConstructRect(amf_int32 left, amf_int32 top, amf_int32 right, amf_int32 bottom) { struct AMFRect object = {left, top, right, bottom}; return object; } typedef struct AMFSize { amf_int32 width; amf_int32 height; #if defined(__cplusplus) bool operator==(const AMFSize& other) const { return width == other.width && height == other.height; } AMF_INLINE bool operator!=(const AMFSize& other) const { return !operator==(other); } #endif } AMFSize; static AMF_INLINE struct AMFSize AMFConstructSize(amf_int32 width, amf_int32 height) { struct AMFSize object = {width, height}; return object; } typedef struct AMFPoint { amf_int32 x; amf_int32 y; #if defined(__cplusplus) bool operator==(const AMFPoint& other) const { return x == other.x && y == other.y; } AMF_INLINE bool operator!=(const AMFPoint& other) const { return !operator==(other); } #endif } AMFPoint; static AMF_INLINE struct AMFPoint AMFConstructPoint(amf_int32 x, amf_int32 y) { struct AMFPoint object = { x, y }; return object; } typedef struct AMFFloatPoint2D { amf_float x; amf_float y; #if defined(__cplusplus) bool operator==(const AMFFloatPoint2D& other) const { return x == other.x && y == other.y; } AMF_INLINE bool operator!=(const AMFFloatPoint2D& other) const { return !operator==(other); } #endif } AMFFloatPoint2D; static AMF_INLINE struct AMFFloatPoint2D AMFConstructFloatPoint2D(amf_float x, amf_float y) { struct AMFFloatPoint2D object = {x, y}; return object; } typedef struct AMFFloatSize { amf_float width; amf_float height; #if defined(__cplusplus) bool operator==(const AMFFloatSize& other) const { return width == other.width && height == other.height; } AMF_INLINE bool operator!=(const AMFFloatSize& other) const { return !operator==(other); } #endif } AMFFloatSize; static AMF_INLINE struct AMFFloatSize AMFConstructFloatSize(amf_float w, amf_float h) { struct AMFFloatSize object = { w, h }; return object; } typedef struct AMFFloatPoint3D { amf_float x; amf_float y; amf_float z; #if defined(__cplusplus) bool operator==(const AMFFloatPoint3D& other) const { return x == other.x && y == other.y && z == other.z; } AMF_INLINE bool operator!=(const AMFFloatPoint3D& other) const { return !operator==(other); } #endif } AMFFloatPoint3D; static AMF_INLINE struct AMFFloatPoint3D AMFConstructFloatPoint3D(amf_float x, amf_float y, amf_float z) { struct AMFFloatPoint3D object = { x, y, z }; return object; } typedef struct AMFFloatVector4D { amf_float x; amf_float y; amf_float z; amf_float w; #if defined(__cplusplus) bool operator==(const AMFFloatVector4D& other) const { return x == other.x && y == other.y && z == other.z && w == other.w; } AMF_INLINE bool operator!=(const AMFFloatVector4D& other) const { return !operator==(other); } #endif } AMFFloatVector4D; static AMF_INLINE struct AMFFloatVector4D AMFConstructFloatVector4D(amf_float x, amf_float y, amf_float z, amf_float w) { struct AMFFloatVector4D object = { x, y, z, w }; return object; } typedef struct AMFRate { amf_uint32 num; amf_uint32 den; #if defined(__cplusplus) bool operator==(const AMFRate& other) const { return num == other.num && den == other.den; } AMF_INLINE bool operator!=(const AMFRate& other) const { return !operator==(other); } #endif } AMFRate; static AMF_INLINE struct AMFRate AMFConstructRate(amf_uint32 num, amf_uint32 den) { struct AMFRate object = {num, den}; return object; } typedef struct AMFRatio { amf_uint32 num; amf_uint32 den; #if defined(__cplusplus) bool operator==(const AMFRatio& other) const { return num == other.num && den == other.den; } AMF_INLINE bool operator!=(const AMFRatio& other) const { return !operator==(other); } #endif } AMFRatio; static AMF_INLINE struct AMFRatio AMFConstructRatio(amf_uint32 num, amf_uint32 den) { struct AMFRatio object = {num, den}; return object; } #pragma pack(push, 1) #if defined(_MSC_VER) #pragma warning( push ) #pragma warning(disable : 4200) #pragma warning(disable : 4201) #endif typedef struct AMFColor { union { struct { amf_uint8 r; amf_uint8 g; amf_uint8 b; amf_uint8 a; }; amf_uint32 rgba; }; #if defined(__cplusplus) bool operator==(const AMFColor& other) const { return r == other.r && g == other.g && b == other.b && a == other.a; } AMF_INLINE bool operator!=(const AMFColor& other) const { return !operator==(other); } #endif } AMFColor; #if defined(_MSC_VER) #pragma warning( pop ) #endif #pragma pack(pop) static AMF_INLINE struct AMFColor AMFConstructColor(amf_uint8 r, amf_uint8 g, amf_uint8 b, amf_uint8 a) { struct AMFColor object; object.r = r; object.g = g; object.b = b; object.a = a; return object; } #if defined(_WIN32) #include <combaseapi.h> #if defined(__cplusplus) extern "C" { #endif // allocator static AMF_INLINE void* AMF_CDECL_CALL amf_variant_alloc(amf_size count) { return CoTaskMemAlloc(count); } static AMF_INLINE void AMF_CDECL_CALL amf_variant_free(void* ptr) { CoTaskMemFree(ptr); } #if defined(__cplusplus) } #endif #else // defined(_WIN32) #include <stdlib.h> #if defined(__cplusplus) extern "C" { #endif // allocator static AMF_INLINE void* AMF_CDECL_CALL amf_variant_alloc(amf_size count) { return malloc(count); } static AMF_INLINE void AMF_CDECL_CALL amf_variant_free(void* ptr) { free(ptr); } #if defined(__cplusplus) } #endif #endif // defined(_WIN32) #if defined(__cplusplus) namespace amf { #endif typedef struct AMFGuid { amf_uint32 data1; amf_uint16 data2; amf_uint16 data3; amf_uint8 data41; amf_uint8 data42; amf_uint8 data43; amf_uint8 data44; amf_uint8 data45; amf_uint8 data46; amf_uint8 data47; amf_uint8 data48; #if defined(__cplusplus) AMFGuid(amf_uint32 _data1, amf_uint16 _data2, amf_uint16 _data3, amf_uint8 _data41, amf_uint8 _data42, amf_uint8 _data43, amf_uint8 _data44, amf_uint8 _data45, amf_uint8 _data46, amf_uint8 _data47, amf_uint8 _data48) : data1 (_data1), data2 (_data2), data3 (_data3), data41(_data41), data42(_data42), data43(_data43), data44(_data44), data45(_data45), data46(_data46), data47(_data47), data48(_data48) {} bool operator==(const AMFGuid& other) const { return data1 == other.data1 && data2 == other.data2 && data3 == other.data3 && data41 == other.data41 && data42 == other.data42 && data43 == other.data43 && data44 == other.data44 && data45 == other.data45 && data46 == other.data46 && data47 == other.data47 && data48 == other.data48; } AMF_INLINE bool operator!=(const AMFGuid& other) const { return !operator==(other); } #endif } AMFGuid; #if defined(__cplusplus) static AMF_INLINE bool AMFCompareGUIDs(const AMFGuid& guid1, const AMFGuid& guid2) { return guid1 == guid2; } #else static AMF_INLINE amf_bool AMFCompareGUIDs(const struct AMFGuid guid1, const struct AMFGuid guid2) { return memcmp(&guid1, &guid2, sizeof(guid1)) == 0; } #endif #if defined(__cplusplus) } #endif #if defined(__APPLE__) //#include <MacTypes.h> #define media_status_t int #define ANativeWindow void #define JNIEnv void #define jobject int #define JavaVM void #endif #endif //#ifndef AMF_Platform_h 07070100000039000081A400000000000000000000000163CFF5E7000032B5000000000000000000000000000000000000003500000000AMF-1.4.29/amf/public/include/core/PropertyStorage.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_PropertyStorage_h #define AMF_PropertyStorage_h #pragma once #include "Variant.h" #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- // AMFPropertyStorageObserver interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFPropertyStorageObserver { public: virtual void AMF_STD_CALL OnPropertyChanged(const wchar_t* name) = 0; }; #else //#if defined(__cplusplus) typedef struct AMFPropertyStorageObserver AMFPropertyStorageObserver; typedef struct AMFPropertyStorageObserverVtbl { void (AMF_STD_CALL *OnPropertyChanged)(AMFPropertyStorageObserver *pThis, const wchar_t* name); } AMFPropertyStorageObserverVtbl; struct AMFPropertyStorageObserver { const AMFPropertyStorageObserverVtbl *pVtbl; }; #endif // #if defined(__cplusplus) #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFPropertyStorage interface //---------------------------------------------------------------------------------------------- class AMF_NO_VTABLE AMFPropertyStorage : public AMFInterface { public: AMF_DECLARE_IID(0xc7cec05b, 0xcfb9, 0x48af, 0xac, 0xe3, 0xf6, 0x8d, 0xf8, 0x39, 0x5f, 0xe3) virtual AMF_RESULT AMF_STD_CALL SetProperty(const wchar_t* name, AMFVariantStruct value) = 0; virtual AMF_RESULT AMF_STD_CALL GetProperty(const wchar_t* name, AMFVariantStruct* pValue) const = 0; virtual amf_bool AMF_STD_CALL HasProperty(const wchar_t* name) const = 0; virtual amf_size AMF_STD_CALL GetPropertyCount() const = 0; virtual AMF_RESULT AMF_STD_CALL GetPropertyAt(amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue) const = 0; virtual AMF_RESULT AMF_STD_CALL Clear() = 0; virtual AMF_RESULT AMF_STD_CALL AddTo(AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep) const= 0; virtual AMF_RESULT AMF_STD_CALL CopyTo(AMFPropertyStorage* pDest, amf_bool deep) const = 0; virtual void AMF_STD_CALL AddObserver(AMFPropertyStorageObserver* pObserver) = 0; virtual void AMF_STD_CALL RemoveObserver(AMFPropertyStorageObserver* pObserver) = 0; template<typename _T> AMF_RESULT AMF_STD_CALL SetProperty(const wchar_t* name, const _T& value); template<typename _T> AMF_RESULT AMF_STD_CALL GetProperty(const wchar_t* name, _T* pValue) const; template<typename _T> AMF_RESULT AMF_STD_CALL GetPropertyString(const wchar_t* name, _T* pValue) const; template<typename _T> AMF_RESULT AMF_STD_CALL GetPropertyWString(const wchar_t* name, _T* pValue) const; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFPropertyStorage> AMFPropertyStoragePtr; //---------------------------------------------------------------------------------------------- #else // #if defined(__cplusplus) typedef struct AMFPropertyStorage AMFPropertyStorage; AMF_DECLARE_IID(AMFPropertyStorage, 0xc7cec05b, 0xcfb9, 0x48af, 0xac, 0xe3, 0xf6, 0x8d, 0xf8, 0x39, 0x5f, 0xe3) typedef struct AMFPropertyStorageVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFPropertyStorage* pThis); amf_long (AMF_STD_CALL *Release)(AMFPropertyStorage* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFPropertyStorage* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFPropertyStorage* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFPropertyStorage* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFPropertyStorage* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFPropertyStorage* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFPropertyStorage* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFPropertyStorage* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFPropertyStorage* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFPropertyStorage* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFPropertyStorage* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFPropertyStorage* pThis, AMFPropertyStorageObserver* pObserver); } AMFPropertyStorageVtbl; struct AMFPropertyStorage { const AMFPropertyStorageVtbl *pVtbl; }; #define AMF_ASSIGN_PROPERTY_DATA(res, varType, pThis, name, val ) \ { \ AMFVariantStruct var = {0}; \ AMFVariantAssign##varType(&var, val); \ res = pThis->pVtbl->SetProperty(pThis, name, var ); \ } #define AMF_QUERY_INTERFACE(res, from, InterfaceTypeTo, to) \ { \ AMFGuid guid_##InterfaceTypeTo = IID_##InterfaceTypeTo(); \ res = from->pVtbl->QueryInterface(from, &guid_##InterfaceTypeTo, (void**)&to); \ } #define AMF_ASSIGN_PROPERTY_INTERFACE(res, pThis, name, val) \ { \ AMFInterface *amf_interface; \ AMFVariantStruct var; \ res = AMFVariantInit(&var); \ if (res == AMF_OK) \ { \ AMF_QUERY_INTERFACE(res, val, AMFInterface, amf_interface)\ if (res == AMF_OK) \ { \ res = AMFVariantAssignInterface(&var, amf_interface); \ amf_interface->pVtbl->Release(amf_interface); \ if (res == AMF_OK) \ { \ res = pThis->pVtbl->SetProperty(pThis, name, var); \ } \ } \ AMFVariantClear(&var); \ } \ } #define AMF_GET_PROPERTY_INTERFACE(res, pThis, name, TargetType, val) \ { \ AMFVariantStruct var; \ res = AMFVariantInit(&var); \ if (res != AMF_OK) \ { \ res = pThis->pVtbl->GetProperty(pThis, name, &var); \ if (res == AMF_OK) \ { \ if (var.type == AMF_VARIANT_INTERFACE && AMFVariantInterface(&var)) \ { \ AMF_QUERY_INTERFACE(res, AMFVariantInterface(&var), TargetType, val); \ } \ else \ { \ res = AMF_INVALID_DATA_TYPE; \ } \ } \ } \ AMFVariantClear(&var); \ } #define AMF_ASSIGN_PROPERTY_TYPE(res, varType, dataType , pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, varType, pThis, name, (dataType)val) #define AMF_ASSIGN_PROPERTY_INT64(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_TYPE(res, Int64, amf_int64, pThis, name, val) #define AMF_ASSIGN_PROPERTY_DOUBLE(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_TYPE(res, Double, amf_double, pThis, name, val) #define AMF_ASSIGN_PROPERTY_BOOL(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_TYPE(res, Bool, amf_bool, pThis, name, val) #define AMF_ASSIGN_PROPERTY_RECT(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Rect, pThis, name, &val) #define AMF_ASSIGN_PROPERTY_SIZE(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Size, pThis, name, &val) #define AMF_ASSIGN_PROPERTY_POINT(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Point, pThis, name, &val) #define AMF_ASSIGN_PROPERTY_RATE(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Rate, pThis, name, &val) #define AMF_ASSIGN_PROPERTY_RATIO(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Ratio, pThis, name, &val) #define AMF_ASSIGN_PROPERTY_COLOR(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Color, pThis, name, &val) #endif // #if defined(__cplusplus) #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // template methods implementations //---------------------------------------------------------------------------------------------- template<typename _T> inline AMF_RESULT AMF_STD_CALL AMFPropertyStorage::SetProperty(const wchar_t* name, const _T& value) { AMF_RESULT err = SetProperty(name, static_cast<const AMFVariantStruct&>(AMFVariant(value))); return err; } //---------------------------------------------------------------------------------------------- template<typename _T> inline AMF_RESULT AMF_STD_CALL AMFPropertyStorage::GetProperty(const wchar_t* name, _T* pValue) const { AMFVariant var; AMF_RESULT err = GetProperty(name, static_cast<AMFVariantStruct*>(&var)); if(err == AMF_OK) { *pValue = static_cast<_T>(var); } return err; } //---------------------------------------------------------------------------------------------- template<typename _T> inline AMF_RESULT AMF_STD_CALL AMFPropertyStorage::GetPropertyString(const wchar_t* name, _T* pValue) const { AMFVariant var; AMF_RESULT err = GetProperty(name, static_cast<AMFVariantStruct*>(&var)); if(err == AMF_OK) { *pValue = var.ToString().c_str(); } return err; } //---------------------------------------------------------------------------------------------- template<typename _T> inline AMF_RESULT AMF_STD_CALL AMFPropertyStorage::GetPropertyWString(const wchar_t* name, _T* pValue) const { AMFVariant var; AMF_RESULT err = GetProperty(name, static_cast<AMFVariantStruct*>(&var)); if(err == AMF_OK) { *pValue = var.ToWString().c_str(); } return err; } //---------------------------------------------------------------------------------------------- template<> inline AMF_RESULT AMF_STD_CALL AMFPropertyStorage::GetProperty(const wchar_t* name, AMFInterface** ppValue) const { AMFVariant var; AMF_RESULT err = GetProperty(name, static_cast<AMFVariantStruct*>(&var)); if(err == AMF_OK) { *ppValue = static_cast<AMFInterface*>(var); } if(*ppValue) { (*ppValue)->Acquire(); } return err; } #endif // #if defined(__cplusplus) #if defined(__cplusplus) } //namespace amf #endif #endif // #ifndef AMF_PropertyStorage_h 0707010000003A000081A400000000000000000000000163CFF5E700002809000000000000000000000000000000000000003700000000AMF-1.4.29/amf/public/include/core/PropertyStorageEx.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_PropertyStorageEx_h #define AMF_PropertyStorageEx_h #pragma once #include "PropertyStorage.h" #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- typedef enum AMF_PROPERTY_CONTENT_ENUM { AMF_PROPERTY_CONTENT_DEFAULT = 0, AMF_PROPERTY_CONTENT_XML, // m_eType is AMF_VARIANT_STRING AMF_PROPERTY_CONTENT_FILE_OPEN_PATH, // m_eType AMF_VARIANT_WSTRING AMF_PROPERTY_CONTENT_FILE_SAVE_PATH, // m_eType AMF_VARIANT_WSTRING AMF_PROPERTY_CONTENT_INTEGER_ARRAY, // m_eType AMF_VARIANT_INTERFACE AMF_PROPERTY_CONTENT_FLOAT_ARRAY // m_eType AMF_VARIANT_INTERFACE } AMF_PROPERTY_CONTENT_ENUM; //---------------------------------------------------------------------------------------------- typedef enum AMF_PROPERTY_ACCESS_TYPE { AMF_PROPERTY_ACCESS_PRIVATE = 0, AMF_PROPERTY_ACCESS_READ = 0x1, AMF_PROPERTY_ACCESS_WRITE = 0x2, AMF_PROPERTY_ACCESS_READ_WRITE = (AMF_PROPERTY_ACCESS_READ | AMF_PROPERTY_ACCESS_WRITE), AMF_PROPERTY_ACCESS_WRITE_RUNTIME = 0x4, AMF_PROPERTY_ACCESS_FULL = 0xFF, AMF_PROPERTY_ACCESS_NON_PERSISTANT = 0x4000, AMF_PROPERTY_ACCESS_NON_PERSISTANT_READ = (AMF_PROPERTY_ACCESS_NON_PERSISTANT | AMF_PROPERTY_ACCESS_READ), AMF_PROPERTY_ACCESS_NON_PERSISTANT_READ_WRITE = (AMF_PROPERTY_ACCESS_NON_PERSISTANT | AMF_PROPERTY_ACCESS_READ_WRITE), AMF_PROPERTY_ACCESS_NON_PERSISTANT_FULL = (AMF_PROPERTY_ACCESS_NON_PERSISTANT | AMF_PROPERTY_ACCESS_FULL), AMF_PROPERTY_ACCESS_INVALID = 0x8000 } AMF_PROPERTY_ACCESS_TYPE; //---------------------------------------------------------------------------------------------- typedef struct AMFEnumDescriptionEntry { amf_int value; const wchar_t* name; } AMFEnumDescriptionEntry; //---------------------------------------------------------------------------------------------- typedef amf_uint32 AMF_PROPERTY_CONTENT_TYPE; typedef struct AMFPropertyInfo { const wchar_t* name; const wchar_t* desc; AMF_VARIANT_TYPE type; AMF_PROPERTY_CONTENT_TYPE contentType; AMFVariantStruct defaultValue; AMFVariantStruct minValue; AMFVariantStruct maxValue; AMF_PROPERTY_ACCESS_TYPE accessType; const AMFEnumDescriptionEntry* pEnumDescription; #if defined(__cplusplus) AMFPropertyInfo() : name(NULL), desc(NULL), type(), contentType(), defaultValue(), minValue(), maxValue(), accessType(AMF_PROPERTY_ACCESS_FULL), pEnumDescription(NULL) {} AMFPropertyInfo(const AMFPropertyInfo& propery) : name(propery.name), desc(propery.desc), type(propery.type), contentType(propery.contentType), defaultValue(propery.defaultValue), minValue(propery.minValue), maxValue(propery.maxValue), accessType(propery.accessType), pEnumDescription(propery.pEnumDescription) {} virtual ~AMFPropertyInfo(){} amf_bool AMF_STD_CALL AllowedRead() const { return (accessType & AMF_PROPERTY_ACCESS_READ) != 0; } amf_bool AMF_STD_CALL AllowedWrite() const { return (accessType & AMF_PROPERTY_ACCESS_WRITE) != 0; } amf_bool AMF_STD_CALL AllowedChangeInRuntime() const { return (accessType & AMF_PROPERTY_ACCESS_WRITE_RUNTIME) != 0; } AMFPropertyInfo& operator=(const AMFPropertyInfo& propery) { name = propery.name; desc = propery.desc; type = propery.type; contentType = propery.contentType; defaultValue = propery.defaultValue; minValue = propery.minValue; maxValue = propery.maxValue; accessType = propery.accessType; pEnumDescription = propery.pEnumDescription; return *this; } #endif // #if defined(__cplusplus) } AMFPropertyInfo; //---------------------------------------------------------------------------------------------- // AMFPropertyStorageEx interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFPropertyStorageEx : public AMFPropertyStorage { public: AMF_DECLARE_IID(0x16b8958d, 0xe943, 0x4a33, 0xa3, 0x5a, 0x88, 0x5a, 0xd8, 0x28, 0xf2, 0x67) virtual amf_size AMF_STD_CALL GetPropertiesInfoCount() const = 0; virtual AMF_RESULT AMF_STD_CALL GetPropertyInfo(amf_size index, const AMFPropertyInfo** ppInfo) const = 0; virtual AMF_RESULT AMF_STD_CALL GetPropertyInfo(const wchar_t* name, const AMFPropertyInfo** ppInfo) const = 0; virtual AMF_RESULT AMF_STD_CALL ValidateProperty(const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated) const = 0; }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFPropertyStorageEx> AMFPropertyStorageExPtr; #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFPropertyStorageEx, 0x16b8958d, 0xe943, 0x4a33, 0xa3, 0x5a, 0x88, 0x5a, 0xd8, 0x28, 0xf2, 0x67) typedef struct AMFPropertyStorageEx AMFPropertyStorageEx; typedef struct AMFPropertyStorageExVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFPropertyStorageEx* pThis); amf_long (AMF_STD_CALL *Release)(AMFPropertyStorageEx* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFPropertyStorageEx* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFPropertyStorageEx* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFPropertyStorageEx* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFPropertyStorageEx* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFPropertyStorageEx* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFPropertyStorageEx* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFPropertyStorageEx* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFPropertyStorageEx* pThis, AMFPropertyStorageObserver* pObserver); // AMFPropertyStorageEx interface amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFPropertyStorageEx* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFPropertyStorageEx* pThis, amf_size index, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFPropertyStorageEx* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo); AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated); } AMFPropertyStorageExVtbl; struct AMFPropertyStorageEx { const AMFPropertyStorageExVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) } //namespace amf #endif #endif //#ifndef AMF_PropertyStorageEx_h 0707010000003B000081A400000000000000000000000163CFF5E7000015CB000000000000000000000000000000000000002C00000000AMF-1.4.29/amf/public/include/core/Result.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Result_h #define AMF_Result_h #pragma once #include "Platform.h" //---------------------------------------------------------------------------------------------- // result codes //---------------------------------------------------------------------------------------------- typedef enum AMF_RESULT { AMF_OK = 0, AMF_FAIL , // common errors AMF_UNEXPECTED , AMF_ACCESS_DENIED , AMF_INVALID_ARG , AMF_OUT_OF_RANGE , AMF_OUT_OF_MEMORY , AMF_INVALID_POINTER , AMF_NO_INTERFACE , AMF_NOT_IMPLEMENTED , AMF_NOT_SUPPORTED , AMF_NOT_FOUND , AMF_ALREADY_INITIALIZED , AMF_NOT_INITIALIZED , AMF_INVALID_FORMAT ,// invalid data format AMF_WRONG_STATE , AMF_FILE_NOT_OPEN ,// cannot open file // device common codes AMF_NO_DEVICE , // device directx AMF_DIRECTX_FAILED , // device opencl AMF_OPENCL_FAILED , // device opengl AMF_GLX_FAILED ,//failed to use GLX // device XV AMF_XV_FAILED , //failed to use Xv extension // device alsa AMF_ALSA_FAILED ,//failed to use ALSA // component common codes //result codes AMF_EOF , AMF_REPEAT , AMF_INPUT_FULL ,//returned by AMFComponent::SubmitInput if input queue is full AMF_RESOLUTION_CHANGED ,//resolution changed client needs to Drain/Terminate/Init AMF_RESOLUTION_UPDATED ,//resolution changed in adaptive mode. New ROI will be set on output on newly decoded frames //error codes AMF_INVALID_DATA_TYPE ,//invalid data type AMF_INVALID_RESOLUTION ,//invalid resolution (width or height) AMF_CODEC_NOT_SUPPORTED ,//codec not supported AMF_SURFACE_FORMAT_NOT_SUPPORTED ,//surface format not supported AMF_SURFACE_MUST_BE_SHARED ,//surface should be shared (DX11: (MiscFlags & D3D11_RESOURCE_MISC_SHARED) == 0, DX9: No shared handle found) // component video decoder AMF_DECODER_NOT_PRESENT ,//failed to create the decoder AMF_DECODER_SURFACE_ALLOCATION_FAILED ,//failed to create the surface for decoding AMF_DECODER_NO_FREE_SURFACES , // component video encoder AMF_ENCODER_NOT_PRESENT ,//failed to create the encoder // component video processor // component video conveter // component dem AMF_DEM_ERROR , AMF_DEM_PROPERTY_READONLY , AMF_DEM_REMOTE_DISPLAY_CREATE_FAILED , AMF_DEM_START_ENCODING_FAILED , AMF_DEM_QUERY_OUTPUT_FAILED , // component TAN AMF_TAN_CLIPPING_WAS_REQUIRED , // Resulting data was truncated to meet output type's value limits. AMF_TAN_UNSUPPORTED_VERSION , // Not supported version requested, solely for TANCreateContext(). AMF_NEED_MORE_INPUT ,//returned by AMFComponent::SubmitInput did not produce a buffer because more input submissions are required. } AMF_RESULT; #endif //#ifndef AMF_Result_h 0707010000003C000081A400000000000000000000000163CFF5E7000042E4000000000000000000000000000000000000002D00000000AMF-1.4.29/amf/public/include/core/Surface.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Surface_h #define AMF_Surface_h #pragma once #include "Data.h" #include "Plane.h" #if defined(_MSC_VER) #pragma warning( push ) #pragma warning(disable : 4263) #pragma warning(disable : 4264) #endif #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- typedef enum AMF_SURFACE_FORMAT { AMF_SURFACE_UNKNOWN = 0, AMF_SURFACE_NV12, ///< 1 - planar 4:2:0 Y width x height + packed UV width/2 x height/2 - 8 bit per component AMF_SURFACE_YV12, ///< 2 - planar 4:2:0 Y width x height + V width/2 x height/2 + U width/2 x height/2 - 8 bit per component AMF_SURFACE_BGRA, ///< 3 - packed 4:4:4 - 8 bit per component AMF_SURFACE_ARGB, ///< 4 - packed 4:4:4 - 8 bit per component AMF_SURFACE_RGBA, ///< 5 - packed 4:4:4 - 8 bit per component AMF_SURFACE_GRAY8, ///< 6 - single component - 8 bit AMF_SURFACE_YUV420P, ///< 7 - planar 4:2:0 Y width x height + U width/2 x height/2 + V width/2 x height/2 - 8 bit per component AMF_SURFACE_U8V8, ///< 8 - packed double component - 8 bit per component AMF_SURFACE_YUY2, ///< 9 - packed 4:2:2 Byte 0=8-bit Y'0; Byte 1=8-bit Cb; Byte 2=8-bit Y'1; Byte 3=8-bit Cr AMF_SURFACE_P010, ///< 10 - planar 4:2:0 Y width x height + packed UV width/2 x height/2 - 10 bit per component (16 allocated, upper 10 bits are used) AMF_SURFACE_RGBA_F16, ///< 11 - packed 4:4:4 - 16 bit per component float AMF_SURFACE_UYVY, ///< 12 - packed 4:2:2 the similar to YUY2 but Y and UV swapped: Byte 0=8-bit Cb; Byte 1=8-bit Y'0; Byte 2=8-bit Cr Byte 3=8-bit Y'1; (used the same DX/CL/Vulkan storage as YUY2) AMF_SURFACE_R10G10B10A2, ///< 13 - packed 4:4:4 to 4 bytes, 10 bit per RGB component, 2 bits per A AMF_SURFACE_Y210, ///< 14 - packed 4:2:2 - Word 0=10-bit Y'0; Word 1=10-bit Cb; Word 2=10-bit Y'1; Word 3=10-bit Cr AMF_SURFACE_AYUV, ///< 15 - packed 4:4:4 - 8 bit per component YUVA AMF_SURFACE_Y410, ///< 16 - packed 4:4:4 - 10 bit per YUV component, 2 bits per A, AVYU AMF_SURFACE_Y416, ///< 16 - packed 4:4:4 - 16 bit per component 4 bytes, AVYU AMF_SURFACE_GRAY32, ///< 17 - single component - 32 bit AMF_SURFACE_P012, ///< 18 - planar 4:2:0 Y width x height + packed UV width/2 x height/2 - 12 bit per component (16 allocated, upper 12 bits are used) AMF_SURFACE_P016, ///< 19 - planar 4:2:0 Y width x height + packed UV width/2 x height/2 - 16 bit per component (16 allocated, all bits are used) AMF_SURFACE_FIRST = AMF_SURFACE_NV12, AMF_SURFACE_LAST = AMF_SURFACE_P016 } AMF_SURFACE_FORMAT; //---------------------------------------------------------------------------------------------- // AMF_SURFACE_USAGE translates to D3D11_BIND_FLAG or VkImageUsageFlags // bit mask //---------------------------------------------------------------------------------------------- typedef enum AMF_SURFACE_USAGE_BITS { // D3D11 D3D12 Vulkan AMF_SURFACE_USAGE_DEFAULT = 0x80000000, // will apply default D3D12_RESOURCE_FLAG_NONE VK_IMAGE_USAGE_TRANSFER_SRC_BIT| VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT AMF_SURFACE_USAGE_NONE = 0x00000000, // 0, D3D12_RESOURCE_FLAG_NONE, 0 AMF_SURFACE_USAGE_SHADER_RESOURCE = 0x00000001, // D3D11_BIND_SHADER_RESOURCE, D3D12_RESOURCE_FLAG_NONE VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT AMF_SURFACE_USAGE_RENDER_TARGET = 0x00000002, // D3D11_BIND_RENDER_TARGET, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT AMF_SURFACE_USAGE_UNORDERED_ACCESS = 0x00000004, // D3D11_BIND_UNORDERED_ACCESS, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT AMF_SURFACE_USAGE_TRANSFER_SRC = 0x00000008, // D3D12_RESOURCE_FLAG_NONE VK_IMAGE_USAGE_TRANSFER_SRC_BIT AMF_SURFACE_USAGE_TRANSFER_DST = 0x00000010, // D3D12_RESOURCE_FLAG_NONE VK_IMAGE_USAGE_TRANSFER_DST_BIT AMF_SURFACE_USAGE_LINEAR = 0x00000020 } AMF_SURFACE_USAGE_BITS; typedef amf_flags AMF_SURFACE_USAGE; //---------------------------------------------------------------------------------------------- #if defined(_WIN32) AMF_WEAK GUID AMFFormatGUID = { 0x8cd592d0, 0x8063, 0x4af8, {0xa7, 0xd0, 0x32, 0x5b, 0xc5, 0xf7, 0x48, 0xab}}; // UINT(AMF_SURFACE_FORMAT), default - AMF_SURFACE_UNKNOWN; to be set on ID3D11Texture2D objects when used natively (i.e. force UYVY on DXGI_FORMAT_YUY2 texture) #endif //---------------------------------------------------------------------------------------------- // frame type //---------------------------------------------------------------------------------------------- typedef enum AMF_FRAME_TYPE { // flags AMF_FRAME_STEREO_FLAG = 0x10000000, AMF_FRAME_LEFT_FLAG = AMF_FRAME_STEREO_FLAG | 0x20000000, AMF_FRAME_RIGHT_FLAG = AMF_FRAME_STEREO_FLAG | 0x40000000, AMF_FRAME_BOTH_FLAG = AMF_FRAME_LEFT_FLAG | AMF_FRAME_RIGHT_FLAG, AMF_FRAME_INTERLEAVED_FLAG = 0x01000000, AMF_FRAME_FIELD_FLAG = 0x02000000, AMF_FRAME_EVEN_FLAG = 0x04000000, AMF_FRAME_ODD_FLAG = 0x08000000, // values AMF_FRAME_UNKNOWN =-1, AMF_FRAME_PROGRESSIVE = 0, AMF_FRAME_INTERLEAVED_EVEN_FIRST = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_EVEN_FLAG, AMF_FRAME_INTERLEAVED_ODD_FIRST = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_ODD_FLAG, AMF_FRAME_FIELD_SINGLE_EVEN = AMF_FRAME_FIELD_FLAG | AMF_FRAME_EVEN_FLAG, AMF_FRAME_FIELD_SINGLE_ODD = AMF_FRAME_FIELD_FLAG | AMF_FRAME_ODD_FLAG, AMF_FRAME_STEREO_LEFT = AMF_FRAME_LEFT_FLAG, AMF_FRAME_STEREO_RIGHT = AMF_FRAME_RIGHT_FLAG, AMF_FRAME_STEREO_BOTH = AMF_FRAME_BOTH_FLAG, AMF_FRAME_INTERLEAVED_EVEN_FIRST_STEREO_LEFT = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_EVEN_FLAG | AMF_FRAME_LEFT_FLAG, AMF_FRAME_INTERLEAVED_EVEN_FIRST_STEREO_RIGHT = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_EVEN_FLAG | AMF_FRAME_RIGHT_FLAG, AMF_FRAME_INTERLEAVED_EVEN_FIRST_STEREO_BOTH = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_EVEN_FLAG | AMF_FRAME_BOTH_FLAG, AMF_FRAME_INTERLEAVED_ODD_FIRST_STEREO_LEFT = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_ODD_FLAG | AMF_FRAME_LEFT_FLAG, AMF_FRAME_INTERLEAVED_ODD_FIRST_STEREO_RIGHT = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_ODD_FLAG | AMF_FRAME_RIGHT_FLAG, AMF_FRAME_INTERLEAVED_ODD_FIRST_STEREO_BOTH = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_ODD_FLAG | AMF_FRAME_BOTH_FLAG, } AMF_FRAME_TYPE; typedef enum AMF_ROTATION_ENUM { AMF_ROTATION_NONE = 0, AMF_ROTATION_90 = 1, AMF_ROTATION_180 = 2, AMF_ROTATION_270 = 3, } AMF_ROTATION_ENUM; #define AMF_SURFACE_ROTATION L"Rotation" // amf_int64(AMF_ROTATION_ENUM); default = AMF_ROTATION_NONE, can be set on surfaces //---------------------------------------------------------------------------------------------- // AMFSurfaceObserver interface - callback; is called before internal release resources. //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMFSurface; class AMF_NO_VTABLE AMFSurfaceObserver { public: virtual void AMF_STD_CALL OnSurfaceDataRelease(AMFSurface* pSurface) = 0; }; #else // #if defined(__cplusplus) typedef struct AMFSurface AMFSurface; typedef struct AMFSurfaceObserver AMFSurfaceObserver; typedef struct AMFSurfaceObserverVtbl { void (AMF_STD_CALL *OnSurfaceDataRelease)(AMFSurfaceObserver* pThis, AMFSurface* pSurface); } AMFSurfaceObserverVtbl; struct AMFSurfaceObserver { const AMFSurfaceObserverVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFSurface interface //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFSurface : public AMFData { public: AMF_DECLARE_IID(0x3075dbe3, 0x8718, 0x4cfa, 0x86, 0xfb, 0x21, 0x14, 0xc0, 0xa5, 0xa4, 0x51) virtual AMF_SURFACE_FORMAT AMF_STD_CALL GetFormat() = 0; // do not store planes outside. should be used together with Surface virtual amf_size AMF_STD_CALL GetPlanesCount() = 0; virtual AMFPlane* AMF_STD_CALL GetPlaneAt(amf_size index) = 0; virtual AMFPlane* AMF_STD_CALL GetPlane(AMF_PLANE_TYPE type) = 0; virtual AMF_FRAME_TYPE AMF_STD_CALL GetFrameType() = 0; virtual void AMF_STD_CALL SetFrameType(AMF_FRAME_TYPE type) = 0; virtual AMF_RESULT AMF_STD_CALL SetCrop(amf_int32 x,amf_int32 y, amf_int32 width, amf_int32 height) = 0; virtual AMF_RESULT AMF_STD_CALL CopySurfaceRegion(AMFSurface* pDest, amf_int32 dstX, amf_int32 dstY, amf_int32 srcX, amf_int32 srcY, amf_int32 width, amf_int32 height) = 0; // Observer management #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Woverloaded-virtual" #endif virtual void AMF_STD_CALL AddObserver(AMFSurfaceObserver* pObserver) = 0; virtual void AMF_STD_CALL RemoveObserver(AMFSurfaceObserver* pObserver) = 0; #ifdef __clang__ #pragma clang diagnostic pop #endif }; //---------------------------------------------------------------------------------------------- // smart pointer //---------------------------------------------------------------------------------------------- typedef AMFInterfacePtr_T<AMFSurface> AMFSurfacePtr; //---------------------------------------------------------------------------------------------- #else // #if defined(__cplusplus) AMF_DECLARE_IID(AMFSurface, 0x3075dbe3, 0x8718, 0x4cfa, 0x86, 0xfb, 0x21, 0x14, 0xc0, 0xa5, 0xa4, 0x51) typedef struct AMFSurfaceVtbl { // AMFInterface interface amf_long (AMF_STD_CALL *Acquire)(AMFSurface* pThis); amf_long (AMF_STD_CALL *Release)(AMFSurface* pThis); enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFSurface* pThis, const struct AMFGuid *interfaceID, void** ppInterface); // AMFPropertyStorage interface AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFSurface* pThis, const wchar_t* name, AMFVariantStruct value); AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFSurface* pThis, const wchar_t* name, AMFVariantStruct* pValue); amf_bool (AMF_STD_CALL *HasProperty)(AMFSurface* pThis, const wchar_t* name); amf_size (AMF_STD_CALL *GetPropertyCount)(AMFSurface* pThis); AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFSurface* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue); AMF_RESULT (AMF_STD_CALL *Clear)(AMFSurface* pThis); AMF_RESULT (AMF_STD_CALL *AddTo)(AMFSurface* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep); AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFSurface* pThis, AMFPropertyStorage* pDest, amf_bool deep); void (AMF_STD_CALL *AddObserver)(AMFSurface* pThis, AMFPropertyStorageObserver* pObserver); void (AMF_STD_CALL *RemoveObserver)(AMFSurface* pThis, AMFPropertyStorageObserver* pObserver); // AMFData interface AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFSurface* pThis); AMF_RESULT (AMF_STD_CALL *Duplicate)(AMFSurface* pThis, AMF_MEMORY_TYPE type, AMFData** ppData); AMF_RESULT (AMF_STD_CALL *Convert)(AMFSurface* pThis, AMF_MEMORY_TYPE type); // optimal interop if possilble. Copy through host memory if needed AMF_RESULT (AMF_STD_CALL *Interop)(AMFSurface* pThis, AMF_MEMORY_TYPE type); // only optimal interop if possilble. No copy through host memory for GPU objects AMF_DATA_TYPE (AMF_STD_CALL *GetDataType)(AMFSurface* pThis); amf_bool (AMF_STD_CALL *IsReusable)(AMFSurface* pThis); void (AMF_STD_CALL *SetPts)(AMFSurface* pThis, amf_pts pts); amf_pts (AMF_STD_CALL *GetPts)(AMFSurface* pThis); void (AMF_STD_CALL *SetDuration)(AMFSurface* pThis, amf_pts duration); amf_pts (AMF_STD_CALL *GetDuration)(AMFSurface* pThis); // AMFSurface interface AMF_SURFACE_FORMAT (AMF_STD_CALL *GetFormat)(AMFSurface* pThis); // do not store planes outside. should be used together with Surface amf_size (AMF_STD_CALL *GetPlanesCount)(AMFSurface* pThis); AMFPlane* (AMF_STD_CALL *GetPlaneAt)(AMFSurface* pThis, amf_size index); AMFPlane* (AMF_STD_CALL *GetPlane)(AMFSurface* pThis, AMF_PLANE_TYPE type); AMF_FRAME_TYPE (AMF_STD_CALL *GetFrameType)(AMFSurface* pThis); void (AMF_STD_CALL *SetFrameType)(AMFSurface* pThis, AMF_FRAME_TYPE type); AMF_RESULT (AMF_STD_CALL *SetCrop)(AMFSurface* pThis, amf_int32 x,amf_int32 y, amf_int32 width, amf_int32 height); AMF_RESULT (AMF_STD_CALL *CopySurfaceRegion)(AMFSurface* pThis, AMFSurface* pDest, amf_int32 dstX, amf_int32 dstY, amf_int32 srcX, amf_int32 srcY, amf_int32 width, amf_int32 height); // Observer management void (AMF_STD_CALL *AddObserver_Surface)(AMFSurface* pThis, AMFSurfaceObserver* pObserver); void (AMF_STD_CALL *RemoveObserver_Surface)(AMFSurface* pThis, AMFSurfaceObserver* pObserver); } AMFSurfaceVtbl; struct AMFSurface { const AMFSurfaceVtbl *pVtbl; }; #endif // #if defined(__cplusplus) #if defined(__cplusplus) } #endif #if defined(_MSC_VER) #pragma warning( pop ) #endif #endif //#ifndef AMF_Surface_h 0707010000003D000081A400000000000000000000000163CFF5E70000266B000000000000000000000000000000000000002B00000000AMF-1.4.29/amf/public/include/core/Trace.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Trace_h #define AMF_Trace_h #pragma once #include "Platform.h" #include "Result.h" #include "Surface.h" #include "AudioBuffer.h" #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- // trace levels //---------------------------------------------------------------------------------------------- #define AMF_TRACE_ERROR 0 #define AMF_TRACE_WARNING 1 #define AMF_TRACE_INFO 2 // default in sdk #define AMF_TRACE_DEBUG 3 #define AMF_TRACE_TRACE 4 #define AMF_TRACE_TEST 5 #define AMF_TRACE_NOLOG 100 //---------------------------------------------------------------------------------------------- // available trace writers //---------------------------------------------------------------------------------------------- #define AMF_TRACE_WRITER_CONSOLE L"Console" #define AMF_TRACE_WRITER_DEBUG_OUTPUT L"DebugOutput" #define AMF_TRACE_WRITER_FILE L"File" //---------------------------------------------------------------------------------------------- // AMFTraceWriter interface - callback //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFTraceWriter { public: virtual void AMF_CDECL_CALL Write(const wchar_t* scope, const wchar_t* message) = 0; virtual void AMF_CDECL_CALL Flush() = 0; }; #else // #if defined(__cplusplus) typedef struct AMFTraceWriter AMFTraceWriter; typedef struct AMFTraceWriterVtbl { // AMFTraceWriter interface void (AMF_CDECL_CALL *Write)(AMFTraceWriter* pThis, const wchar_t* scope, const wchar_t* message); void (AMF_CDECL_CALL *Flush)(AMFTraceWriter* pThis); } AMFTraceWriterVtbl; struct AMFTraceWriter { const AMFTraceWriterVtbl *pVtbl; }; #endif // #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMFTrace interface - singleton //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) class AMF_NO_VTABLE AMFTrace { public: virtual void AMF_STD_CALL TraceW(const wchar_t* src_path, amf_int32 line, amf_int32 level, const wchar_t* scope,amf_int32 countArgs, const wchar_t* format, ...) = 0; virtual void AMF_STD_CALL Trace(const wchar_t* src_path, amf_int32 line, amf_int32 level, const wchar_t* scope, const wchar_t* message, va_list* pArglist) = 0; virtual amf_int32 AMF_STD_CALL SetGlobalLevel(amf_int32 level) = 0; virtual amf_int32 AMF_STD_CALL GetGlobalLevel() = 0; virtual amf_bool AMF_STD_CALL EnableWriter(const wchar_t* writerID, bool enable) = 0; virtual amf_bool AMF_STD_CALL WriterEnabled(const wchar_t* writerID) = 0; virtual AMF_RESULT AMF_STD_CALL TraceEnableAsync(amf_bool enable) = 0; virtual AMF_RESULT AMF_STD_CALL TraceFlush() = 0; virtual AMF_RESULT AMF_STD_CALL SetPath(const wchar_t* path) = 0; virtual AMF_RESULT AMF_STD_CALL GetPath(wchar_t* path, amf_size* pSize) = 0; virtual amf_int32 AMF_STD_CALL SetWriterLevel(const wchar_t* writerID, amf_int32 level) = 0; virtual amf_int32 AMF_STD_CALL GetWriterLevel(const wchar_t* writerID) = 0; virtual amf_int32 AMF_STD_CALL SetWriterLevelForScope(const wchar_t* writerID, const wchar_t* scope, amf_int32 level) = 0; virtual amf_int32 AMF_STD_CALL GetWriterLevelForScope(const wchar_t* writerID, const wchar_t* scope) = 0; virtual amf_int32 AMF_STD_CALL GetIndentation() = 0; virtual void AMF_STD_CALL Indent(amf_int32 addIndent) = 0; virtual void AMF_STD_CALL RegisterWriter(const wchar_t* writerID, AMFTraceWriter* pWriter, amf_bool enable) = 0; virtual void AMF_STD_CALL UnregisterWriter(const wchar_t* writerID) = 0; virtual const wchar_t* AMF_STD_CALL GetResultText(AMF_RESULT res) = 0; virtual const wchar_t* AMF_STD_CALL SurfaceGetFormatName(const AMF_SURFACE_FORMAT eSurfaceFormat) = 0; virtual AMF_SURFACE_FORMAT AMF_STD_CALL SurfaceGetFormatByName(const wchar_t* name) = 0; virtual const wchar_t* AMF_STD_CALL GetMemoryTypeName(const AMF_MEMORY_TYPE memoryType) = 0; virtual AMF_MEMORY_TYPE AMF_STD_CALL GetMemoryTypeByName(const wchar_t* name) = 0; virtual const wchar_t* AMF_STD_CALL GetSampleFormatName(const AMF_AUDIO_FORMAT eFormat) = 0; virtual AMF_AUDIO_FORMAT AMF_STD_CALL GetSampleFormatByName(const wchar_t* name) = 0; }; #else // #if defined(__cplusplus) typedef struct AMFTrace AMFTrace; typedef struct AMFTraceVtbl { // AMFTrace interface void (AMF_STD_CALL *TraceW)(AMFTrace* pThis, const wchar_t* src_path, amf_int32 line, amf_int32 level, const wchar_t* scope,amf_int32 countArgs, const wchar_t* format, ...); void (AMF_STD_CALL *Trace)(AMFTrace* pThis, const wchar_t* src_path, amf_int32 line, amf_int32 level, const wchar_t* scope, const wchar_t* message, va_list* pArglist); amf_int32 (AMF_STD_CALL *SetGlobalLevel)(AMFTrace* pThis, amf_int32 level); amf_int32 (AMF_STD_CALL *GetGlobalLevel)(AMFTrace* pThis); amf_bool (AMF_STD_CALL *EnableWriter)(AMFTrace* pThis, const wchar_t* writerID, amf_bool enable); amf_bool (AMF_STD_CALL *WriterEnabled)(AMFTrace* pThis, const wchar_t* writerID); AMF_RESULT (AMF_STD_CALL *TraceEnableAsync)(AMFTrace* pThis, amf_bool enable); AMF_RESULT (AMF_STD_CALL *TraceFlush)(AMFTrace* pThis); AMF_RESULT (AMF_STD_CALL *SetPath)(AMFTrace* pThis, const wchar_t* path); AMF_RESULT (AMF_STD_CALL *GetPath)(AMFTrace* pThis, wchar_t* path, amf_size* pSize); amf_int32 (AMF_STD_CALL *SetWriterLevel)(AMFTrace* pThis, const wchar_t* writerID, amf_int32 level); amf_int32 (AMF_STD_CALL *GetWriterLevel)(AMFTrace* pThis, const wchar_t* writerID); amf_int32 (AMF_STD_CALL *SetWriterLevelForScope)(AMFTrace* pThis, const wchar_t* writerID, const wchar_t* scope, amf_int32 level); amf_int32 (AMF_STD_CALL *GetWriterLevelForScope)(AMFTrace* pThis, const wchar_t* writerID, const wchar_t* scope); amf_int32 (AMF_STD_CALL *GetIndentation)(AMFTrace* pThis); void (AMF_STD_CALL *Indent)(AMFTrace* pThis, amf_int32 addIndent); void (AMF_STD_CALL *RegisterWriter)(AMFTrace* pThis, const wchar_t* writerID, AMFTraceWriter* pWriter, amf_bool enable); void (AMF_STD_CALL *UnregisterWriter)(AMFTrace* pThis, const wchar_t* writerID); const wchar_t* (AMF_STD_CALL *GetResultText)(AMFTrace* pThis, AMF_RESULT res); const wchar_t* (AMF_STD_CALL *SurfaceGetFormatName)(AMFTrace* pThis, const AMF_SURFACE_FORMAT eSurfaceFormat); AMF_SURFACE_FORMAT (AMF_STD_CALL *SurfaceGetFormatByName)(AMFTrace* pThis, const wchar_t* name); const wchar_t* (AMF_STD_CALL *GetMemoryTypeName)(AMFTrace* pThis, const AMF_MEMORY_TYPE memoryType); AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryTypeByName)(AMFTrace* pThis, const wchar_t* name); const wchar_t* (AMF_STD_CALL *GetSampleFormatName)(AMFTrace* pThis, const AMF_AUDIO_FORMAT eFormat); AMF_AUDIO_FORMAT (AMF_STD_CALL *GetSampleFormatByName)(AMFTrace* pThis, const wchar_t* name); } AMFTraceVtbl; struct AMFTrace { const AMFTraceVtbl *pVtbl; }; #endif #if defined(__cplusplus) } #endif #endif // AMF_Trace_h 0707010000003E000081A400000000000000000000000163CFF5E7000163B0000000000000000000000000000000000000002D00000000AMF-1.4.29/amf/public/include/core/Variant.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef AMF_Variant_h #define AMF_Variant_h #pragma once #if defined(_MSC_VER) #pragma warning(disable: 4996) #endif #include "Interface.h" #include <locale.h> #include <wchar.h> #include <string.h> #if defined(__cplusplus) namespace amf { #endif //---------------------------------------------------------------------------------------------- // variant types //---------------------------------------------------------------------------------------------- typedef enum AMF_VARIANT_TYPE { AMF_VARIANT_EMPTY = 0, AMF_VARIANT_BOOL = 1, AMF_VARIANT_INT64 = 2, AMF_VARIANT_DOUBLE = 3, AMF_VARIANT_RECT = 4, AMF_VARIANT_SIZE = 5, AMF_VARIANT_POINT = 6, AMF_VARIANT_RATE = 7, AMF_VARIANT_RATIO = 8, AMF_VARIANT_COLOR = 9, AMF_VARIANT_STRING = 10, // value is char* AMF_VARIANT_WSTRING = 11, // value is wchar_t* AMF_VARIANT_INTERFACE = 12, // value is AMFInterface* AMF_VARIANT_FLOAT = 13, AMF_VARIANT_FLOAT_SIZE = 14, AMF_VARIANT_FLOAT_POINT2D = 15, AMF_VARIANT_FLOAT_POINT3D = 16, AMF_VARIANT_FLOAT_VECTOR4D = 17 } AMF_VARIANT_TYPE; //---------------------------------------------------------------------------------------------- // variant struct //---------------------------------------------------------------------------------------------- typedef struct AMFVariantStruct { AMF_VARIANT_TYPE type; union { amf_bool boolValue; amf_int64 int64Value; amf_double doubleValue; char* stringValue; wchar_t* wstringValue; AMFInterface* pInterface; struct AMFRect rectValue; struct AMFSize sizeValue; struct AMFPoint pointValue; struct AMFRate rateValue; struct AMFRatio ratioValue; struct AMFColor colorValue; amf_float floatValue; struct AMFFloatSize floatSizeValue; struct AMFFloatPoint2D floatPoint2DValue; struct AMFFloatPoint3D floatPoint3DValue; struct AMFFloatVector4D floatVector4DValue; }; } AMFVariantStruct; //---------------------------------------------------------------------------------------------- // variant accessors //---------------------------------------------------------------------------------------------- static AMF_INLINE AMF_VARIANT_TYPE AMF_STD_CALL AMFVariantGetType(const AMFVariantStruct* _variant) { return (_variant)->type; } #if defined(__cplusplus) static AMF_INLINE AMF_VARIANT_TYPE& AMF_STD_CALL AMFVariantGetType(AMFVariantStruct* _variant) { return (_variant)->type; } #endif static AMF_INLINE amf_bool AMF_STD_CALL AMFVariantGetBool(const AMFVariantStruct* _variant) { return (_variant)->boolValue; } static AMF_INLINE amf_int64 AMF_STD_CALL AMFVariantGetInt64(const AMFVariantStruct* _variant) { return (_variant)->int64Value; } static AMF_INLINE amf_double AMF_STD_CALL AMFVariantGetDouble(const AMFVariantStruct* _variant) { return (_variant)->doubleValue; } static AMF_INLINE amf_float AMF_STD_CALL AMFVariantGetFloat(const AMFVariantStruct* _variant) { return (_variant)->floatValue; } static AMF_INLINE const char* AMF_STD_CALL AMFVariantGetString(const AMFVariantStruct* _variant) { return (_variant)->stringValue; } static AMF_INLINE const wchar_t* AMF_STD_CALL AMFVariantGetWString(const AMFVariantStruct* _variant) { return (_variant)->wstringValue; } #if defined(__cplusplus) static AMF_INLINE const AMFInterface* AMF_STD_CALL AMFVariantGetInterface(const AMFVariantStruct* _variant) { return (_variant)->pInterface; } #endif static AMF_INLINE AMFInterface* AMF_STD_CALL AMFVariantGetInterface(AMFVariantStruct* _variant) { return (_variant)->pInterface; } #if defined(__cplusplus) static AMF_INLINE const AMFRect & AMF_STD_CALL AMFVariantGetRect (const AMFVariantStruct* _variant) { return (_variant)->rectValue; } static AMF_INLINE const AMFSize & AMF_STD_CALL AMFVariantGetSize (const AMFVariantStruct* _variant) { return (_variant)->sizeValue; } static AMF_INLINE const AMFPoint& AMF_STD_CALL AMFVariantGetPoint(const AMFVariantStruct* _variant) { return (_variant)->pointValue; } static AMF_INLINE const AMFFloatSize& AMF_STD_CALL AMFVariantGetFloatSize(const AMFVariantStruct* _variant) { return (_variant)->floatSizeValue; } static AMF_INLINE const AMFFloatPoint2D& AMF_STD_CALL AMFVariantGetFloatPoint2D(const AMFVariantStruct* _variant) { return (_variant)->floatPoint2DValue; } static AMF_INLINE const AMFFloatPoint3D& AMF_STD_CALL AMFVariantGetFloatPoint3D(const AMFVariantStruct* _variant) { return (_variant)->floatPoint3DValue; } static AMF_INLINE const AMFFloatVector4D& AMF_STD_CALL AMFVariantGetFloatVector4D(const AMFVariantStruct* _variant) { return (_variant)->floatVector4DValue; } static AMF_INLINE const AMFRate & AMF_STD_CALL AMFVariantGetRate (const AMFVariantStruct* _variant) { return (_variant)->rateValue; } static AMF_INLINE const AMFRatio& AMF_STD_CALL AMFVariantGetRatio(const AMFVariantStruct* _variant) { return (_variant)->ratioValue; } static AMF_INLINE const AMFColor& AMF_STD_CALL AMFVariantGetColor(const AMFVariantStruct* _variant) { return (_variant)->colorValue; } #else // #if defined(__cplusplus) static AMF_INLINE const AMFRect AMF_STD_CALL AMFVariantGetRect (const AMFVariantStruct* _variant) { return (_variant)->rectValue; } static AMF_INLINE const AMFSize AMF_STD_CALL AMFVariantGetSize (const AMFVariantStruct* _variant) { return (_variant)->sizeValue; } static AMF_INLINE const AMFPoint AMF_STD_CALL AMFVariantGetPoint(const AMFVariantStruct* _variant) { return (_variant)->pointValue; } static AMF_INLINE const AMFFloatSize AMF_STD_CALL AMFVariantGetFloatSize(const AMFVariantStruct* _variant) { return (_variant)->floatSizeValue; } static AMF_INLINE const AMFFloatPoint2D AMF_STD_CALL AMFVariantGetFloatPoint2D(const AMFVariantStruct* _variant) { return (_variant)->floatPoint2DValue; } static AMF_INLINE const AMFFloatPoint3D AMF_STD_CALL AMFVariantGetFloatPoint3D(const AMFVariantStruct* _variant) { return (_variant)->floatPoint3DValue; } static AMF_INLINE const AMFFloatVector4D AMF_STD_CALL AMFVariantGetFloatVector4D(const AMFVariantStruct* _variant) { return (_variant)->floatVector4DValue; } static AMF_INLINE const AMFRate AMF_STD_CALL AMFVariantGetRate (const AMFVariantStruct* _variant) { return (_variant)->rateValue; } static AMF_INLINE const AMFRatio AMF_STD_CALL AMFVariantGetRatio(const AMFVariantStruct* _variant) { return (_variant)->ratioValue; } static AMF_INLINE const AMFColor AMF_STD_CALL AMFVariantGetColor(const AMFVariantStruct* _variant) { return (_variant)->colorValue; } #endif // #if defined(__cplusplus) #define AMFVariantEmpty(_variant) 0 #define AMFVariantBool(_variant) (_variant)->boolValue #define AMFVariantInt64(_variant) (_variant)->int64Value #define AMFVariantDouble(_variant) (_variant)->doubleValue #define AMFVariantFloat(_variant) (_variant)->floatValue #define AMFVariantRect(_variant) (_variant)->rectValue #define AMFVariantSize(_variant) (_variant)->sizeValue #define AMFVariantPoint(_variant) (_variant)->pointValue #define AMFVariantFloatSize(_variant) (_variant)->floatSizeValue #define AMFVariantFloatPoint2D(_variant) (_variant)->floatPoint2DValue #define AMFVariantFloatPoint3D(_variant) (_variant)->floatPoint3DValue #define AMFVariantFloatVector4D(_variant) (_variant)->floatVector4DValue #define AMFVariantRate(_variant) (_variant)->rateValue #define AMFVariantRatio(_variant) (_variant)->ratioValue #define AMFVariantColor(_variant) (_variant)->colorValue #define AMFVariantString(_variant) (_variant)->stringValue #define AMFVariantWString(_variant) (_variant)->wstringValue #define AMFVariantInterface(_variant) (_variant)->pInterface //---------------------------------------------------------------------------------------------- // variant hleper functions //---------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantInit(AMFVariantStruct* pVariant); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantClear(AMFVariantStruct* pVariant); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantCompare(const AMFVariantStruct* pFirst, const AMFVariantStruct* pSecond, amf_bool* equal); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantCopy(AMFVariantStruct* pDest, const AMFVariantStruct* pSrc); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignBool(AMFVariantStruct* pDest, amf_bool value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignInt64(AMFVariantStruct* pDest, amf_int64 value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignDouble(AMFVariantStruct* pDest, amf_double value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloat(AMFVariantStruct* pDest, amf_float value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignString(AMFVariantStruct* pDest, const char* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignWString(AMFVariantStruct* pDest, const wchar_t* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignInterface(AMFVariantStruct* pDest, AMFInterface* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRect(AMFVariantStruct* pDest, const AMFRect* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignSize(AMFVariantStruct* pDest, const AMFSize* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignPoint(AMFVariantStruct* pDest, const AMFPoint* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatSize(AMFVariantStruct* pDest, const AMFFloatSize* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatPoint2D(AMFVariantStruct* pDest, const AMFFloatPoint2D* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatPoint3D(AMFVariantStruct* pDest, const AMFFloatPoint3D* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatVector4D(AMFVariantStruct* pDest, const AMFFloatVector4D* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRate(AMFVariantStruct* pDest, const AMFRate* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRatio(AMFVariantStruct* pDest, const AMFRatio* value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignColor(AMFVariantStruct* pDest, const AMFColor* value); #if defined(__cplusplus) static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRect(AMFVariantStruct* pDest, const AMFRect& value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignSize(AMFVariantStruct* pDest, const AMFSize& value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignPoint(AMFVariantStruct* pDest, const AMFPoint& value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatSize(AMFVariantStruct* pDest, const AMFFloatSize& value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatPoint2D(AMFVariantStruct* pDest, const AMFFloatPoint2D& value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatPoint3D(AMFVariantStruct* pDest, const AMFFloatPoint3D& value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatVector4D(AMFVariantStruct* pDest, const AMFFloatVector4D& value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRate(AMFVariantStruct* pDest, const AMFRate& value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRatio(AMFVariantStruct* pDest, const AMFRatio& value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignColor(AMFVariantStruct* pDest, const AMFColor& value); static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantChangeType(AMFVariantStruct* pDest, const AMFVariantStruct* pSrc, AMF_VARIANT_TYPE newType); #endif static AMF_INLINE char* AMF_CDECL_CALL AMFVariantDuplicateString(const char* from); static AMF_INLINE void AMF_CDECL_CALL AMFVariantFreeString(char* from); static AMF_INLINE wchar_t* AMF_CDECL_CALL AMFVariantDuplicateWString(const wchar_t* from); static AMF_INLINE void AMF_CDECL_CALL AMFVariantFreeWString(wchar_t* from); #if defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMF_INLINE Variant helper class //---------------------------------------------------------------------------------------------- class AMFVariant : public AMFVariantStruct { public: class String; class WString; public: AMFVariant() { AMFVariantInit(this); } explicit AMFVariant(const AMFVariantStruct& other) { AMFVariantInit(this); AMFVariantCopy(this, const_cast<AMFVariantStruct*>(&other)); } explicit AMFVariant(const AMFVariantStruct* pOther); template<typename T> explicit AMFVariant(const AMFInterfacePtr_T<T>& pValue); AMFVariant(const AMFVariant& other) { AMFVariantInit(this); AMFVariantCopy(this, const_cast<AMFVariantStruct*>(static_cast<const AMFVariantStruct*>(&other))); } explicit AMF_INLINE AMFVariant(amf_bool value) { AMFVariantInit(this); AMFVariantAssignBool(this, value); } explicit AMF_INLINE AMFVariant(amf_int64 value) { AMFVariantInit(this); AMFVariantAssignInt64(this, value); } explicit AMF_INLINE AMFVariant(amf_uint64 value) { AMFVariantInit(this); AMFVariantAssignInt64(this, (amf_int64)value); } explicit AMF_INLINE AMFVariant(amf_int32 value) { AMFVariantInit(this); AMFVariantAssignInt64(this, value); } explicit AMF_INLINE AMFVariant(amf_uint32 value) { AMFVariantInit(this); AMFVariantAssignInt64(this, value); } explicit AMF_INLINE AMFVariant(amf_double value) { AMFVariantInit(this); AMFVariantAssignDouble(this, value); } explicit AMF_INLINE AMFVariant(amf_float value) { AMFVariantInit(this); AMFVariantAssignFloat(this, value); } explicit AMF_INLINE AMFVariant(const AMFRect & value) { AMFVariantInit(this); AMFVariantAssignRect(this, &value); } explicit AMF_INLINE AMFVariant(const AMFSize & value) { AMFVariantInit(this); AMFVariantAssignSize(this, &value); } explicit AMF_INLINE AMFVariant(const AMFPoint& value) { AMFVariantInit(this); AMFVariantAssignPoint(this, &value); } explicit AMF_INLINE AMFVariant(const AMFFloatSize& value) { AMFVariantInit(this); AMFVariantAssignFloatSize(this, &value); } explicit AMF_INLINE AMFVariant(const AMFFloatPoint2D& value) { AMFVariantInit(this); AMFVariantAssignFloatPoint2D(this, &value); } explicit AMF_INLINE AMFVariant(const AMFFloatPoint3D& value) { AMFVariantInit(this); AMFVariantAssignFloatPoint3D(this, &value); } explicit AMF_INLINE AMFVariant(const AMFFloatVector4D& value) { AMFVariantInit(this); AMFVariantAssignFloatVector4D(this, &value); } explicit AMF_INLINE AMFVariant(const AMFRate & value) { AMFVariantInit(this); AMFVariantAssignRate(this, &value); } explicit AMF_INLINE AMFVariant(const AMFRatio& value) { AMFVariantInit(this); AMFVariantAssignRatio(this, &value); } explicit AMF_INLINE AMFVariant(const AMFColor& value) { AMFVariantInit(this); AMFVariantAssignColor(this, &value); } explicit AMF_INLINE AMFVariant(const char* value) { AMFVariantInit(this); AMFVariantAssignString(this, value); } explicit AMF_INLINE AMFVariant(const wchar_t* value) { AMFVariantInit(this); AMFVariantAssignWString(this, value); } explicit AMF_INLINE AMFVariant(AMFInterface* pValue) { AMFVariantInit(this); AMFVariantAssignInterface(this, pValue); } ~AMFVariant() { AMFVariantClear(this); } AMFVariant& operator=(const AMFVariantStruct& other); AMFVariant& operator=(const AMFVariantStruct* pOther); AMFVariant& operator=(const AMFVariant& other); AMFVariant& operator=(amf_bool value) { AMFVariantAssignBool(this, value); return *this;} AMFVariant& operator=(amf_int64 value) { AMFVariantAssignInt64(this, value); return *this;} AMFVariant& operator=(amf_uint64 value) { AMFVariantAssignInt64(this, (amf_int64)value); return *this;} AMFVariant& operator=(amf_int32 value) { AMFVariantAssignInt64(this, value); return *this;} AMFVariant& operator=(amf_uint32 value) { AMFVariantAssignInt64(this, value); return *this;} AMFVariant& operator=(amf_double value) { AMFVariantAssignDouble(this, value); return *this;} AMFVariant& operator=(amf_float value) { AMFVariantAssignFloat(this, value); return *this; } AMFVariant& operator=(const AMFRect & value) { AMFVariantAssignRect(this, &value); return *this;} AMFVariant& operator=(const AMFSize & value) { AMFVariantAssignSize(this, &value); return *this;} AMFVariant& operator=(const AMFPoint& value) { AMFVariantAssignPoint(this, &value); return *this;} AMFVariant& operator=(const AMFFloatSize& value) { AMFVariantAssignFloatSize(this, &value); return *this; } AMFVariant& operator=(const AMFFloatPoint2D& value) { AMFVariantAssignFloatPoint2D(this, &value); return *this; } AMFVariant& operator=(const AMFFloatPoint3D& value) { AMFVariantAssignFloatPoint3D(this, &value); return *this; } AMFVariant& operator=(const AMFFloatVector4D& value) { AMFVariantAssignFloatVector4D(this, &value); return *this; } AMFVariant& operator=(const AMFRate & value) { AMFVariantAssignRate(this, &value); return *this;} AMFVariant& operator=(const AMFRatio& value) { AMFVariantAssignRatio(this, &value); return *this;} AMFVariant& operator=(const AMFColor& value) { AMFVariantAssignColor(this, &value); return *this;} AMFVariant& operator=(const char* value) { AMFVariantAssignString(this, value); return *this;} AMFVariant& operator=(const wchar_t* value) { AMFVariantAssignWString(this, value); return *this;} AMFVariant& operator=(AMFInterface* value) { AMFVariantAssignInterface(this, value); return *this;} template<typename T> AMFVariant& operator=(const AMFInterfacePtr_T<T>& value); operator amf_bool() const { return ToBool(); } operator amf_int64() const { return ToInt64(); } operator amf_uint64() const { return ToUInt64(); } operator amf_int32() const { return ToInt32(); } operator amf_uint32() const { return ToUInt32(); } operator amf_double() const { return ToDouble(); } operator amf_float() const { return ToFloat(); } operator AMFRect () const { return ToRect (); } operator AMFSize () const { return ToSize (); } operator AMFPoint() const { return ToPoint(); } operator AMFFloatSize() const { return ToFloatSize(); } operator AMFFloatPoint2D() const { return ToFloatPoint2D(); } operator AMFFloatPoint3D() const { return ToFloatPoint3D(); } operator AMFFloatVector4D() const { return ToFloatVector4D(); } operator AMFRate () const { return ToRate (); } operator AMFRatio() const { return ToRatio(); } operator AMFColor() const { return ToColor(); } operator AMFInterface*() const { return ToInterface(); } AMF_INLINE amf_bool ToBool() const { return Empty() ? false : GetValue<amf_bool, AMF_VARIANT_BOOL>(AMFVariantGetBool); } AMF_INLINE amf_int64 ToInt64() const { return Empty() ? 0 : GetValue<amf_int64, AMF_VARIANT_INT64>(AMFVariantGetInt64); } AMF_INLINE amf_uint64 ToUInt64() const { return Empty() ? 0 : GetValue<amf_uint64, AMF_VARIANT_INT64>(AMFVariantGetInt64); } AMF_INLINE amf_int32 ToInt32() const { return Empty() ? 0 : GetValue<amf_int32, AMF_VARIANT_INT64>(AMFVariantGetInt64); } AMF_INLINE amf_uint32 ToUInt32() const { return Empty() ? 0 : GetValue<amf_uint32, AMF_VARIANT_INT64>(AMFVariantGetInt64); } AMF_INLINE amf_double ToDouble() const { return Empty() ? 0 : GetValue<amf_double, AMF_VARIANT_DOUBLE>(AMFVariantGetDouble); } AMF_INLINE amf_float ToFloat() const { return Empty() ? 0 : GetValue<amf_float, AMF_VARIANT_FLOAT>(AMFVariantGetFloat); } AMF_INLINE AMFRect ToRect () const { return Empty() ? AMFRect() : GetValue<AMFRect, AMF_VARIANT_RECT>(AMFVariantGetRect); } AMF_INLINE AMFSize ToSize () const { return Empty() ? AMFSize() : GetValue<AMFSize, AMF_VARIANT_SIZE>(AMFVariantGetSize); } AMF_INLINE AMFPoint ToPoint() const { return Empty() ? AMFPoint() : GetValue<AMFPoint, AMF_VARIANT_POINT>(AMFVariantGetPoint); } AMF_INLINE AMFFloatSize ToFloatSize() const { return Empty() ? AMFFloatSize() : GetValue<AMFFloatSize, AMF_VARIANT_FLOAT_SIZE>(AMFVariantGetFloatSize); } AMF_INLINE AMFFloatPoint2D ToFloatPoint2D() const { return Empty() ? AMFFloatPoint2D() : GetValue<AMFFloatPoint2D, AMF_VARIANT_FLOAT_POINT2D>(AMFVariantGetFloatPoint2D); } AMF_INLINE AMFFloatPoint3D ToFloatPoint3D() const { return Empty() ? AMFFloatPoint3D() : GetValue<AMFFloatPoint3D, AMF_VARIANT_FLOAT_POINT3D>(AMFVariantGetFloatPoint3D); } AMF_INLINE AMFFloatVector4D ToFloatVector4D() const { return Empty() ? AMFFloatVector4D() : GetValue<AMFFloatVector4D, AMF_VARIANT_FLOAT_VECTOR4D>(AMFVariantGetFloatVector4D); } AMF_INLINE AMFRate ToRate () const { return Empty() ? AMFRate() : GetValue<AMFRate, AMF_VARIANT_RATE>(AMFVariantGetRate); } AMF_INLINE AMFRatio ToRatio() const { return Empty() ? AMFRatio() : GetValue<AMFRatio, AMF_VARIANT_RATIO>(AMFVariantGetRatio); } AMF_INLINE AMFColor ToColor() const { return Empty() ? AMFColor() : GetValue<AMFColor, AMF_VARIANT_COLOR>(AMFVariantGetColor); } AMF_INLINE AMFInterface* ToInterface() const { return AMFVariantGetType(this) == AMF_VARIANT_INTERFACE ? this->pInterface : NULL; } AMF_INLINE String ToString() const; AMF_INLINE WString ToWString() const; bool operator==(const AMFVariantStruct& other) const; bool operator==(const AMFVariantStruct* pOther) const; bool operator!=(const AMFVariantStruct& other) const; bool operator!=(const AMFVariantStruct* pOther) const; void Clear() { AMFVariantClear(this); } void Attach(AMFVariantStruct& variant); AMFVariantStruct Detach(); AMFVariantStruct& GetVariant(); void ChangeType(AMF_VARIANT_TYPE type, const AMFVariant* pSrc = NULL); bool Empty() const; private: template<class ReturnType, AMF_VARIANT_TYPE variantType, typename Getter> ReturnType GetValue(Getter getter) const; }; //---------------------------------------------------------------------------------------------- // helper String class //---------------------------------------------------------------------------------------------- class AMFVariant::String { friend class AMFVariant; private: void Free() { if (m_Str != NULL) { AMFVariantFreeString(m_Str); m_Str = NULL; } } public: String() :m_Str(NULL){} String(const char* str) : m_Str(NULL) { m_Str = AMFVariantDuplicateString(str); } String(const String& p_other) : m_Str(NULL) { operator=(p_other); } #if (__cplusplus == 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X) || (_MSC_VER >= 1600) #pragma warning (push) #pragma warning (disable : 26439) //This kind of function may not throw. Declare it 'noexcept'. String(String&& p_other) : m_Str(NULL) { operator=(p_other); } #endif ~String() { Free(); } char& operator[](size_t index) { if (index >= size()) { resize(index); } return m_Str[index]; } String& operator=(const String& p_other) { Free(); m_Str = AMFVariantDuplicateString(p_other.m_Str); return *this; } #if (__cplusplus == 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X) || (_MSC_VER >= 1600) String& operator=(String&& p_other) { Free(); m_Str = p_other.m_Str; p_other.m_Str = NULL; // Transfer the ownership return *this; } #endif bool operator==(const String& p_other) const { if (m_Str == NULL && p_other.m_Str == NULL) { return true; } else if ((m_Str == NULL && p_other.m_Str != NULL) || (m_Str != NULL && p_other.m_Str == NULL)) { return false; } return strcmp(c_str(), p_other.c_str()) == 0; } const char* c_str() const { return m_Str; } size_t size() const { if(m_Str == NULL) { return 0; } return (size_t)strlen(m_Str); } AMF_INLINE size_t length() const { return size(); } void resize(size_t sizeAlloc) { if(sizeAlloc == 0) { Free(); return; } char* str = (char*)amf_variant_alloc(sizeof(char)*(sizeAlloc + 1)); if(m_Str != NULL) { size_t copySize = sizeAlloc; if(copySize > size()) { copySize = size(); } memcpy(str, m_Str, copySize * sizeof(char)); Free(); str[sizeAlloc] = 0; } m_Str = str; } private: char* m_Str; }; //---------------------------------------------------------------------------------------------- // helper WString class //---------------------------------------------------------------------------------------------- class AMFVariant::WString { friend class AMFVariant; private: void Free() { if (m_Str != NULL) { AMFVariantFreeWString(m_Str); m_Str = NULL; } } public: WString() :m_Str(NULL){} WString(const wchar_t* str) : m_Str(NULL) { m_Str = AMFVariantDuplicateWString(str); } WString(const WString& p_other) : m_Str(NULL) { operator=(p_other); } #if (__cplusplus == 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X) || (_MSC_VER >= 1600) WString(WString&& p_other) : m_Str(NULL) { operator=(p_other); } #endif ~WString() { Free(); } WString& operator=(const WString& p_other) { Free(); m_Str = AMFVariantDuplicateWString(p_other.m_Str); return *this; } #if (__cplusplus == 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X) || (_MSC_VER >= 1600) WString& operator=(WString&& p_other) { Free(); m_Str = p_other.m_Str; p_other.m_Str = NULL; // Transfer the ownership return *this; } #pragma warning (pop) #endif wchar_t& operator[](size_t index) { if (index >= size()) { resize(index); } return m_Str[index]; } bool operator==(const WString& p_other) const { if (m_Str == NULL && p_other.m_Str == NULL) { return true; } else if ((m_Str == NULL && p_other.m_Str != NULL) || (m_Str != NULL && p_other.m_Str == NULL)) { return false; } return wcscmp(c_str(), p_other.c_str()) == 0; } const wchar_t* c_str() const { return m_Str; } size_t size() const { if(m_Str == NULL) { return 0; } return (size_t)wcslen(m_Str); } AMF_INLINE size_t length() const { return size(); } void resize(size_t sizeAlloc) { if(sizeAlloc == 0) { Free(); return; } wchar_t* str = (wchar_t*)amf_variant_alloc(sizeof(wchar_t)*(sizeAlloc + 1)); if(m_Str != NULL) { size_t copySize = sizeAlloc; if(copySize > size()) { copySize = size(); } memcpy(str, m_Str, copySize * sizeof(wchar_t)); Free(); str[sizeAlloc] = 0; } m_Str = str; } private: wchar_t* m_Str; }; //------------------------------------------------------------------------------------------------- AMFVariant::String AMFVariant::ToString() const { String temp = GetValue<String, AMF_VARIANT_STRING>(AMFVariantGetString); return String(temp.c_str()); } //------------------------------------------------------------------------------------------------- AMFVariant::WString AMFVariant::ToWString() const { WString temp = GetValue<WString, AMF_VARIANT_WSTRING>(AMFVariantGetWString); return WString(temp.c_str()); } #endif // defined(__cplusplus) //---------------------------------------------------------------------------------------------- // AMF_INLINE implementation of helper functions //---------------------------------------------------------------------------------------------- #define AMF_VARIANT_RETURN_IF_INVALID_POINTER(p) \ { \ if(p == NULL) \ { \ return AMF_INVALID_POINTER; \ } \ } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantInit(AMFVariantStruct* pVariant) { AMF_VARIANT_RETURN_IF_INVALID_POINTER(pVariant); pVariant->type = AMF_VARIANT_EMPTY; return AMF_OK; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantClear(AMFVariantStruct* pVariant) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pVariant); switch(AMFVariantGetType(pVariant)) { case AMF_VARIANT_STRING: amf_variant_free(AMFVariantString(pVariant)); pVariant->type = AMF_VARIANT_EMPTY; break; case AMF_VARIANT_WSTRING: amf_variant_free(AMFVariantWString(pVariant)); pVariant->type = AMF_VARIANT_EMPTY; break; case AMF_VARIANT_INTERFACE: if(AMFVariantInterface(pVariant) != NULL) { #if defined(__cplusplus) AMFVariantInterface(pVariant)->Release(); #else AMFVariantInterface(pVariant)->pVtbl->Release(AMFVariantInterface(pVariant)); #endif AMFVariantInterface(pVariant) = NULL; } pVariant->type = AMF_VARIANT_EMPTY; break; default: pVariant->type = AMF_VARIANT_EMPTY; break; } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantCompare(const AMFVariantStruct* pFirst, const AMFVariantStruct* pSecond, amf_bool* bEqual) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pFirst); AMF_VARIANT_RETURN_IF_INVALID_POINTER(pSecond); if(pFirst == pSecond) { *bEqual = true; } else if(AMFVariantGetType(pFirst) != AMFVariantGetType(pSecond)) { *bEqual = false; } else { switch(AMFVariantGetType(pFirst)) { case AMF_VARIANT_EMPTY: *bEqual = true; break; case AMF_VARIANT_BOOL: *bEqual = AMFVariantGetBool(pFirst) == AMFVariantBool(pSecond); break; case AMF_VARIANT_INT64: *bEqual = AMFVariantGetInt64(pFirst) == AMFVariantInt64(pSecond); break; case AMF_VARIANT_DOUBLE: *bEqual = AMFVariantGetDouble(pFirst) == AMFVariantDouble(pSecond); break; case AMF_VARIANT_FLOAT: *bEqual = AMFVariantGetFloat(pFirst) == AMFVariantFloat(pSecond); break; case AMF_VARIANT_RECT: #if defined(__cplusplus) *bEqual = AMFVariantGetRect(pFirst) == AMFVariantGetRect(pSecond); #else *bEqual = memcmp(&pFirst->rectValue, &pSecond->rectValue, sizeof(AMFRect)) == 0; #endif break; case AMF_VARIANT_SIZE: #if defined(__cplusplus) *bEqual = AMFVariantGetSize(pFirst) == AMFVariantGetSize(pSecond); #else *bEqual = memcmp(&pFirst->sizeValue, &pSecond->sizeValue, sizeof(AMFSize)) == 0; #endif break; case AMF_VARIANT_POINT: #if defined(__cplusplus) *bEqual = AMFVariantGetPoint(pFirst) == AMFVariantGetPoint(pSecond); #else *bEqual = memcmp(&pFirst->pointValue, &pSecond->pointValue, sizeof(AMFPoint)) == 0; #endif break; case AMF_VARIANT_FLOAT_SIZE: #if defined(__cplusplus) *bEqual = AMFVariantGetFloatSize(pFirst) == AMFVariantGetFloatSize(pSecond); #else *bEqual = memcmp(&pFirst->floatSizeValue, &pSecond->floatSizeValue, sizeof(AMFFloatPoint2D)) == 0; #endif break; case AMF_VARIANT_FLOAT_POINT2D: #if defined(__cplusplus) *bEqual = AMFVariantGetFloatPoint2D(pFirst) == AMFVariantGetFloatPoint2D(pSecond); #else *bEqual = memcmp(&pFirst->floatPoint2DValue, &pSecond->floatPoint2DValue, sizeof(AMFFloatPoint2D)) == 0; #endif break; case AMF_VARIANT_FLOAT_POINT3D: #if defined(__cplusplus) *bEqual = AMFVariantGetFloatPoint3D(pFirst) == AMFVariantGetFloatPoint3D(pSecond); #else *bEqual = memcmp(&pFirst->floatPoint3DValue, &pSecond->floatPoint3DValue, sizeof(AMFFloatPoint3D)) == 0; #endif break; case AMF_VARIANT_FLOAT_VECTOR4D: #if defined(__cplusplus) *bEqual = AMFVariantGetFloatVector4D(pFirst) == AMFVariantGetFloatVector4D(pSecond); #else *bEqual = memcmp(&pFirst->floatVector4DValue, &pSecond->floatVector4DValue, sizeof(AMFFloatPoint3D)) == 0; #endif break; case AMF_VARIANT_RATE: #if defined(__cplusplus) *bEqual = AMFVariantGetRate(pFirst) == AMFVariantGetRate(pSecond); #else *bEqual = memcmp(&pFirst->rateValue, &pSecond->rateValue, sizeof(AMFRate)) == 0; #endif break; case AMF_VARIANT_RATIO: #if defined(__cplusplus) *bEqual = AMFVariantGetRatio(pFirst) == AMFVariantGetRatio(pSecond); #else *bEqual = memcmp(&pFirst->ratioValue, &pSecond->ratioValue, sizeof(AMFRatio)) == 0; #endif break; case AMF_VARIANT_COLOR: #if defined(__cplusplus) *bEqual = AMFVariantGetColor(pFirst) == AMFVariantGetColor(pSecond); #else *bEqual = memcmp(&pFirst->colorValue, &pSecond->colorValue, sizeof(AMFColor)) == 0; #endif break; case AMF_VARIANT_STRING: *bEqual = strcmp(AMFVariantString(pFirst), AMFVariantString(pSecond)) == 0; break; case AMF_VARIANT_WSTRING: *bEqual = wcscmp(AMFVariantWString(pFirst), AMFVariantWString(pSecond)) == 0; break; case AMF_VARIANT_INTERFACE: *bEqual = AMFVariantInterface(pFirst) == AMFVariantInterface(pSecond); break; default: errRet = AMF_INVALID_ARG; break; } } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantCopy(AMFVariantStruct* pDest, const AMFVariantStruct* pSrc) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); AMF_VARIANT_RETURN_IF_INVALID_POINTER(pSrc); if(pDest != pSrc) { switch(AMFVariantGetType(pSrc)) { case AMF_VARIANT_EMPTY: errRet = AMFVariantInit(pDest); break; case AMF_VARIANT_BOOL: errRet = AMFVariantAssignBool(pDest, AMFVariantBool(pSrc)); break; case AMF_VARIANT_INT64: errRet = AMFVariantAssignInt64(pDest, AMFVariantInt64(pSrc)); break; case AMF_VARIANT_DOUBLE: errRet = AMFVariantAssignDouble(pDest, AMFVariantDouble(pSrc)); break; case AMF_VARIANT_FLOAT: errRet = AMFVariantAssignFloat(pDest, AMFVariantFloat(pSrc)); break; case AMF_VARIANT_RECT: errRet = AMFVariantAssignRect(pDest, &pSrc->rectValue); break; case AMF_VARIANT_SIZE: errRet = AMFVariantAssignSize(pDest, &pSrc->sizeValue); break; case AMF_VARIANT_POINT: errRet = AMFVariantAssignPoint(pDest, &pSrc->pointValue); break; case AMF_VARIANT_FLOAT_SIZE: errRet = AMFVariantAssignFloatSize(pDest, &pSrc->floatSizeValue); break; case AMF_VARIANT_FLOAT_POINT2D: errRet = AMFVariantAssignFloatPoint2D(pDest, &pSrc->floatPoint2DValue); break; case AMF_VARIANT_FLOAT_POINT3D: errRet = AMFVariantAssignFloatPoint3D(pDest, &pSrc->floatPoint3DValue); break; case AMF_VARIANT_FLOAT_VECTOR4D: errRet = AMFVariantAssignFloatVector4D(pDest, &pSrc->floatVector4DValue); break; case AMF_VARIANT_RATE: errRet = AMFVariantAssignRate(pDest, &pSrc->rateValue); break; case AMF_VARIANT_RATIO: errRet = AMFVariantAssignRatio(pDest, &pSrc->ratioValue); break; case AMF_VARIANT_COLOR: errRet = AMFVariantAssignColor(pDest, &pSrc->colorValue); break; case AMF_VARIANT_STRING: errRet = AMFVariantAssignString(pDest, AMFVariantString(pSrc)); break; case AMF_VARIANT_WSTRING: errRet = AMFVariantAssignWString(pDest, AMFVariantWString(pSrc)); break; case AMF_VARIANT_INTERFACE: errRet = AMFVariantAssignInterface(pDest, AMFVariantInterface(pSrc)); break; default: errRet = AMF_INVALID_ARG; break; } } return errRet; } #define AMFVariantTypeEmpty AMF_VARIANT_EMPTY #define AMFVariantTypeBool AMF_VARIANT_BOOL #define AMFVariantTypeInt64 AMF_VARIANT_INT64 #define AMFVariantTypeDouble AMF_VARIANT_DOUBLE #define AMFVariantTypeFloat AMF_VARIANT_FLOAT #define AMFVariantTypeRect AMF_VARIANT_RECT #define AMFVariantTypeSize AMF_VARIANT_SIZE #define AMFVariantTypePoint AMF_VARIANT_POINT #define AMFVariantTypeFloatPoint2D AMF_VARIANT_FLOAT_POINT2D #define AMFVariantTypeFloatPoint3D AMF_VARIANT_FLOAT_POINT3D #define AMFVariantTypeFloatVector4D AMF_VARIANT_FLOAT_VECTOR4D #define AMFVariantTypeRate AMF_VARIANT_RATE #define AMFVariantTypeRatio AMF_VARIANT_RATIO #define AMFVariantTypeColor AMF_VARIANT_COLOR #define AMFVariantTypeString AMF_VARIANT_STRING #define AMFVariantTypeWString AMF_VARIANT_WSTRING #define AMFVariantTypeInterface AMF_VARIANT_INTERFACE #if defined(__cplusplus) static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignString(AMFVariantStruct* pDest, const AMFVariant::String& value) { return AMFVariantAssignString(pDest, value.c_str()); } static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignWString(AMFVariantStruct* pDest, const AMFVariant::WString& value) { return AMFVariantAssignWString(pDest, value.c_str()); } static AMF_INLINE amf_bool AMFConvertEmptyToBool(void*, AMF_RESULT& res) { res = AMF_OK; return false; } static AMF_INLINE amf_int64 AMFConvertEmptyToInt64(void*, AMF_RESULT& res) {res = AMF_OK; return 0; } static AMF_INLINE amf_double AMFConvertEmptyToDouble(void*, AMF_RESULT& res) {res = AMF_OK; return 0; } static AMF_INLINE amf_float AMFConvertEmptyToFloat(void*, AMF_RESULT& res) { res = AMF_OK; return 0; } static AMF_INLINE AMFVariant::String AMFConvertEmptyToString(void*, AMF_RESULT& res) {res = AMF_OK; return ""; } static AMF_INLINE AMFVariant::WString AMFConvertEmptyToWString(void*, AMF_RESULT& res) {res = AMF_OK; return L""; } static AMF_INLINE amf_int64 AMFConvertBoolToInt64(bool value, AMF_RESULT& res){res = AMF_OK; return value ? 1 : 0;} static AMF_INLINE amf_double AMFConvertBoolToDouble(bool value, AMF_RESULT& res){res = AMF_OK; return value ? 1.0 : 0.0;} static AMF_INLINE amf_float AMFConvertBoolToFloat(bool value, AMF_RESULT& res) { res = AMF_OK; return value ? 1.0f : 0.0f; } static AMF_INLINE AMFVariant::String AMFConvertBoolToString(bool value, AMF_RESULT& res){res = AMF_OK; return value ? "true" : "false";} static AMF_INLINE AMFVariant::WString AMFConvertBoolToWString(bool value, AMF_RESULT& res){res = AMF_OK; return value ? L"true" : L"false";} static AMF_INLINE bool AMFConvertInt64ToBool(amf_int64 value, AMF_RESULT& res){res = AMF_OK;return value != 0;} static AMF_INLINE amf_double AMFConvertInt64ToDouble(amf_int64 value, AMF_RESULT& res){res = AMF_OK;return (amf_double)value;} static AMF_INLINE amf_float AMFConvertInt64ToFloat(amf_int64 value, AMF_RESULT& res) { res = AMF_OK; return (amf_float)value; } static AMF_INLINE AMFVariant::String AMFConvertInt64ToString(amf_int64 value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%" AMFPRId64, (long long)value); return buff; } static AMF_INLINE AMFVariant::WString AMFConvertInt64ToWString(amf_int64 value, AMF_RESULT& res) { res = AMF_OK; wchar_t buff[0xFF]; swprintf(buff, 0xFF, L"%" LPRId64, (long long)value); return buff; } static AMF_INLINE bool AMFConvertDoubleToBool(amf_double value, AMF_RESULT& res){res = AMF_OK;return value != 0;} static AMF_INLINE bool AMFConvertFloatToBool(amf_float value, AMF_RESULT& res) { res = AMF_OK; return value != 0; } static AMF_INLINE amf_int64 AMFConvertDoubleToInt64(amf_double value, AMF_RESULT& res){res = AMF_OK;return amf_int64(value);} static AMF_INLINE amf_int64 AMFConvertFloatToInt64(amf_float value, AMF_RESULT& res) { res = AMF_OK; return amf_int64(value); } static AMF_INLINE AMFVariant::String AMFConvertDoubleToString(amf_double value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%lf", value); return buff; } static AMF_INLINE AMFVariant::String AMFConvertFloatToString(amf_float value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%f", value); return buff; } static AMF_INLINE AMFVariant::WString AMFConvertDoubleToWString(amf_double value, AMF_RESULT& res) { res = AMF_OK; wchar_t buff[0xFF]; swprintf(buff, 0xFF, L"%lf", value); return buff; } static AMF_INLINE AMFVariant::WString AMFConvertFloatToWString(amf_float value, AMF_RESULT& res) { res = AMF_OK; wchar_t buff[0xFF]; swprintf(buff, 0xFF, L"%f", value); return buff; } static AMF_INLINE bool AMFConvertStringToBool(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; AMFVariant::String tmp = value; if(( tmp == "true") || ( tmp == "True") || ( tmp == "TRUE") || ( tmp == "1") ) { return true; } else { if(( tmp == "false") || ( tmp == "False") || ( tmp == "FALSE") || ( tmp == "0") ) { return false; } } res = AMF_INVALID_ARG; return false; } static AMF_INLINE amf_int64 AMFConvertStringToInt64(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; long long tmp = 0; int readElements = 0; if(value.size() > 2 && ( value.c_str()[0] == '0') && ( value.c_str()[1] == 'x') ) { readElements = sscanf(value.c_str(), "0x%" AMFPRIx64, &tmp); } else if(value.size() > 0) { readElements = sscanf(value.c_str(), "%" AMFPRId64, &tmp); } if(readElements) { return tmp; } res = AMF_INVALID_ARG; return 0; } static AMF_INLINE amf_double AMFConvertStringToDouble(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; amf_double tmp = 0; int readElements = 0; if(value.size() > 0) { readElements = sscanf(value.c_str(), "%lf", &tmp); } if(readElements) { return tmp; } res = AMF_INVALID_ARG; return 0; } static AMF_INLINE amf_float AMFConvertStringToFloat(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; amf_float tmp = 0; int readElements = 0; if (value.size() > 0) { readElements = sscanf(value.c_str(), "%f", &tmp); } if (readElements) { return tmp; } res = AMF_INVALID_ARG; return 0; } static AMF_INLINE AMFVariant::WString AMFConvertStringToWString(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; // return amf_from_utf8_to_unicode(value); AMFVariant::WString result; if(0 == value.size()) { return result; } const char* pUtf8Buff = value.c_str(); #if defined(_WIN32) _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); int UnicodeBuffSize = ::MultiByteToWideChar(CP_UTF8, 0, pUtf8Buff, -1, NULL, 0); if(0 == UnicodeBuffSize) { return result; } UnicodeBuffSize += 8; // get some extra space result.resize(UnicodeBuffSize); UnicodeBuffSize = ::MultiByteToWideChar(CP_UTF8, 0, pUtf8Buff, -1, (LPWSTR)result.c_str(), UnicodeBuffSize); UnicodeBuffSize--; #elif defined(__ANDROID__) // on android mbstowcs cannot be used to define length char* old_locale = setlocale(LC_CTYPE, "en_US.UTF8"); mbstate_t mbs; mbrlen(NULL, 0, &mbs); int len = value.size(); const char* pt = pUtf8Buff; int UnicodeBuffSize = 0; while(len > 0) { size_t length = mbrlen (pt, len, &mbs); //MM TODO Android always return 1 if((length == 0) || (length > len)) { break; } UnicodeBuffSize++; len -= length; pt += length; } UnicodeBuffSize += 8; // get some extra space result.resize(UnicodeBuffSize); mbrlen (NULL, 0, &mbs); len = value.size(); pt = pUtf8Buff; UnicodeBuffSize = 0; while(len > 0) { size_t length = mbrlen (pt, len, &mbs); if((length == 0) || (length > len)) { break; } mbrtowc(&((wchar_t*)(result.c_str()))[UnicodeBuffSize], pt, length, &mbs); //MM TODO Android always return 1 char UnicodeBuffSize++; len -= length; pt += length; } setlocale(LC_CTYPE, old_locale); #else char* old_locale = setlocale(LC_CTYPE, "en_US.UTF8"); size_t UnicodeBuffSize = mbstowcs(NULL, pUtf8Buff, 0); if(0 == UnicodeBuffSize) { return result; } UnicodeBuffSize += 8; // get some extra space result.resize(UnicodeBuffSize); UnicodeBuffSize = mbstowcs((wchar_t*)result.c_str(), pUtf8Buff, UnicodeBuffSize + 1); setlocale(LC_CTYPE, old_locale); #endif result.resize(UnicodeBuffSize); return result; } static AMF_INLINE AMFVariant::String AMFConvertWStringToString(const AMFVariant::WString& value, AMF_RESULT& res) { res = AMF_OK; // return amf_from_unicode_to_utf8(value); AMFVariant::String result; if(0 == value.size()) { return result; } const wchar_t* pwBuff = value.c_str(); #if defined(_WIN32) _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); int Utf8BuffSize = ::WideCharToMultiByte(CP_UTF8, 0, pwBuff, -1, NULL, 0, NULL, NULL); if(0 == Utf8BuffSize) { return result; } Utf8BuffSize += 8; // get some extra space result.resize(Utf8BuffSize); Utf8BuffSize = ::WideCharToMultiByte(CP_UTF8, 0, pwBuff, -1, (LPSTR)result.c_str(), Utf8BuffSize, NULL, NULL); Utf8BuffSize--; #elif defined(__ANDROID__) char* old_locale = setlocale(LC_CTYPE, "en_US.UTF8"); int Utf8BuffSize = value.length(); if(0 == Utf8BuffSize) { return result; } Utf8BuffSize += 8; // get some extra space result.resize(Utf8BuffSize); mbstate_t mbs; mbrlen(NULL, 0, &mbs); Utf8BuffSize = 0; for( int i = 0; i < value.length(); i++) { //MM TODO Android - not implemented //int written = wcrtomb(&result[Utf8BuffSize], pwBuff[i], &mbs); ((char*)(result.c_str()))[Utf8BuffSize] = (char)(pwBuff[i]); int written = 1; // temp replacement Utf8BuffSize += written; } setlocale(LC_CTYPE, old_locale); #else char* old_locale = setlocale(LC_CTYPE, "en_US.UTF8"); size_t Utf8BuffSize = wcstombs(NULL, pwBuff, 0); if(0 == Utf8BuffSize) { return result; } Utf8BuffSize += 8; // get some extra space result.resize(Utf8BuffSize); Utf8BuffSize = wcstombs((char*)result.c_str(), pwBuff, Utf8BuffSize + 1); setlocale(LC_CTYPE, old_locale); #endif result.resize(Utf8BuffSize); return result; } static AMF_INLINE bool AMFConvertWStringToBool(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToBool(AMFConvertWStringToString(value, res), res); } static AMF_INLINE amf_int64 AMFConvertWStringToInt64(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToInt64(AMFConvertWStringToString(value, res), res); } static AMF_INLINE amf_double AMFConvertWStringToDouble(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToDouble(AMFConvertWStringToString(value, res), res); } static AMF_INLINE amf_float AMFConvertWStringToFloat(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToFloat(AMFConvertWStringToString(value, res), res); } static AMF_INLINE AMFVariant::String AMF_STD_CALL AMFConvertRectToString(const AMFRect& value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%d,%d,%d,%d", value.left, value.top, value.right, value.bottom); return buff; } static AMF_INLINE AMFVariant::String AMF_STD_CALL AMFConvertSizeToString(const AMFSize& value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%d,%d", value.width, value.height); return buff; } static AMF_INLINE AMFVariant::String AMF_STD_CALL AMFConvertPointToString(const AMFPoint& value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%d,%d", value.x, value.y); return buff; } static AMF_INLINE AMFVariant::String AMF_STD_CALL AMFConvertFloatSizeToString(const AMFFloatSize& value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%f,%f", value.width, value.height); return buff; } static AMF_INLINE AMFVariant::String AMF_STD_CALL AMFConvertFloatPoint2DToString(const AMFFloatPoint2D& value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%f,%f", value.x, value.y); return buff; } static AMF_INLINE AMFVariant::String AMF_STD_CALL AMFConvertFloatPoint3DToString(const AMFFloatPoint3D& value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%f,%f,%f", value.x, value.y, value.z); return buff; } static AMF_INLINE AMFVariant::String AMF_STD_CALL AMFConvertFloatVector4DToString(const AMFFloatVector4D& value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%f,%f,%f,%f", value.x, value.y, value.z, value.w); return buff; } static AMF_INLINE AMFVariant::String AMF_STD_CALL AMFConvertRateToString(const AMFRate& value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%u,%u", value.num, value.den); return buff; } static AMF_INLINE AMFVariant::String AMF_STD_CALL AMFConvertRatioToString(const AMFRatio& value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%u,%u", value.num, value.den); return buff; } static AMF_INLINE AMFVariant::String AMF_STD_CALL AMFConvertColorToString(const AMFColor& value, AMF_RESULT& res) { res = AMF_OK; char buff[0xFF]; sprintf(buff, "%u,%u,%u,%u", value.r, value.g, value.b, value.a); return buff; } static AMF_INLINE AMFRect AMF_STD_CALL AMFConvertStringToRect(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; AMFRect tmp = {}; int readElements = 0; if(value.size() > 0) { readElements = sscanf(value.c_str(), "%d,%d,%d,%d", &tmp.left, &tmp.top, &tmp.right, &tmp.bottom); } if(readElements) { return tmp; } res = AMF_INVALID_ARG; return tmp; } static AMF_INLINE AMFSize AMF_STD_CALL AMFConvertStringToSize(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; AMFSize tmp = {}; int readElements = 0; if(value.size() > 0) { if(strchr(value.c_str(), ',') != nullptr) { readElements = sscanf(value.c_str(), "%d,%d", &tmp.width, &tmp.height); } else if (strchr(value.c_str(), 'x') != nullptr) { readElements = sscanf(value.c_str(), "%dx%d", &tmp.width, &tmp.height); } } if(readElements) { return tmp; } res = AMF_INVALID_ARG; return tmp; } static AMF_INLINE AMFPoint AMF_STD_CALL AMFConvertStringToPoint(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; AMFPoint tmp = {}; int readElements = 0; if(value.size() > 0) { readElements = sscanf(value.c_str(), "%d,%d", &tmp.x, &tmp.y); } if(readElements) { return tmp; } res = AMF_INVALID_ARG; return tmp; } static AMF_INLINE AMFFloatSize AMF_STD_CALL AMFConvertStringToFloatSize(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; AMFFloatSize tmp = {}; int readElements = 0; if (value.size() > 0) { readElements = sscanf(value.c_str(), "%f,%f", &tmp.width, &tmp.height); } if (readElements) { return tmp; } res = AMF_INVALID_ARG; return tmp; } static AMF_INLINE AMFFloatPoint2D AMF_STD_CALL AMFConvertStringToFloatPoint2D(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; AMFFloatPoint2D tmp = {}; int readElements = 0; if (value.size() > 0) { readElements = sscanf(value.c_str(), "%f,%f", &tmp.x, &tmp.y); } if (readElements) { return tmp; } res = AMF_INVALID_ARG; return tmp; } static AMF_INLINE AMFFloatPoint3D AMF_STD_CALL AMFConvertStringToFloatPoint3D(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; AMFFloatPoint3D tmp = {}; int readElements = 0; if (value.size() > 0) { readElements = sscanf(value.c_str(), "%f,%f,%f", &tmp.x, &tmp.y, &tmp.z); } if (readElements) { return tmp; } res = AMF_INVALID_ARG; return tmp; } static AMF_INLINE AMFFloatVector4D AMF_STD_CALL AMFConvertStringToFloatVector4D(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; AMFFloatVector4D tmp = {}; int readElements = 0; if (value.size() > 0) { readElements = sscanf(value.c_str(), "%f,%f,%f,%f", &tmp.x, &tmp.y, &tmp.z, &tmp.w); } if (readElements) { return tmp; } res = AMF_INVALID_ARG; return tmp; } static AMF_INLINE AMFRate AMF_STD_CALL AMFConvertStringToRate(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; AMFRate tmp = {}; int readElements = 0; if(value.size() > 0) { readElements = sscanf(value.c_str(), "%u,%u", &tmp.num, &tmp.den); } if(readElements) { return tmp; } res = AMF_INVALID_ARG; return tmp; } static AMF_INLINE AMFRatio AMF_STD_CALL AMFConvertStringToRatio(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; AMFRatio tmp = {}; int readElements = 0; if(value.size() > 0) { readElements = sscanf(value.c_str(), "%u,%u", &tmp.num, &tmp.den); } if(readElements) { return tmp; } res = AMF_INVALID_ARG; return tmp; } static AMF_INLINE AMFColor AMF_STD_CALL AMFConvertStringToColor(const AMFVariant::String& value, AMF_RESULT& res) { res = AMF_OK; int readElements = 0; amf_uint32 r = 0; amf_uint32 g = 0; amf_uint32 b = 0; amf_uint32 a = 0; if(value.size() > 0) { readElements = sscanf(value.c_str(), "%u,%u,%u,%u", &r, &g, &b, &a); } if(readElements) { return AMFConstructColor((amf_uint8)r, (amf_uint8)g, (amf_uint8)b, (amf_uint8)a); } res = AMF_INVALID_ARG; return AMFConstructColor(0, 0, 0, 255); } /////////////////////// static AMF_INLINE AMFVariant::WString AMF_STD_CALL AMFConvertRectToWString(const AMFRect& value, AMF_RESULT& res) { return AMFConvertStringToWString(AMFConvertRectToString(value, res), res); } static AMF_INLINE AMFVariant::WString AMF_STD_CALL AMFConvertSizeToWString(const AMFSize& value, AMF_RESULT& res) { return AMFConvertStringToWString(AMFConvertSizeToString(value, res), res); } static AMF_INLINE AMFVariant::WString AMF_STD_CALL AMFConvertPointToWString(const AMFPoint& value, AMF_RESULT& res) { return AMFConvertStringToWString(AMFConvertPointToString(value, res), res); } static AMF_INLINE AMFVariant::WString AMF_STD_CALL AMFConvertFloatSizeToWString(const AMFFloatSize& value, AMF_RESULT& res) { return AMFConvertStringToWString(AMFConvertFloatSizeToString(value, res), res); } static AMF_INLINE AMFVariant::WString AMF_STD_CALL AMFConvertFloatPoint2DToWString(const AMFFloatPoint2D& value, AMF_RESULT& res) { return AMFConvertStringToWString(AMFConvertFloatPoint2DToString(value, res), res); } static AMF_INLINE AMFVariant::WString AMF_STD_CALL AMFConvertFloatPoint3DToWString(const AMFFloatPoint3D& value, AMF_RESULT& res) { return AMFConvertStringToWString(AMFConvertFloatPoint3DToString(value, res), res); } static AMF_INLINE AMFVariant::WString AMF_STD_CALL AMFConvertFloatVector4DToWString(const AMFFloatVector4D& value, AMF_RESULT& res) { return AMFConvertStringToWString(AMFConvertFloatVector4DToString(value, res), res); } static AMF_INLINE AMFVariant::WString AMF_STD_CALL AMFConvertRateToWString(const AMFRate& value, AMF_RESULT& res) { return AMFConvertStringToWString(AMFConvertRateToString(value, res), res); } static AMF_INLINE AMFVariant::WString AMF_STD_CALL AMFConvertRatioToWString(const AMFRatio& value, AMF_RESULT& res) { return AMFConvertStringToWString(AMFConvertRatioToString(value, res), res); } static AMF_INLINE AMFVariant::WString AMF_STD_CALL AMFConvertColorToWString(const AMFColor& value, AMF_RESULT& res) { return AMFConvertStringToWString(AMFConvertColorToString(value, res), res); } static AMF_INLINE AMFRect AMF_STD_CALL AMFConvertWStringToRect(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToRect(AMFConvertWStringToString(value, res), res); } static AMF_INLINE AMFSize AMF_STD_CALL AMFConvertWStringToSize(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToSize(AMFConvertWStringToString(value, res), res); } static AMF_INLINE AMFPoint AMF_STD_CALL AMFConvertWStringToPoint(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToPoint(AMFConvertWStringToString(value, res), res); } static AMF_INLINE AMFFloatSize AMF_STD_CALL AMFConvertWStringToFloatSize(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToFloatSize(AMFConvertWStringToString(value, res), res); } static AMF_INLINE AMFFloatPoint2D AMF_STD_CALL AMFConvertWStringToFloatPoint2D(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToFloatPoint2D(AMFConvertWStringToString(value, res), res); } static AMF_INLINE AMFFloatPoint3D AMF_STD_CALL AMFConvertWStringToFloatPoint3D(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToFloatPoint3D(AMFConvertWStringToString(value, res), res); } static AMF_INLINE AMFFloatVector4D AMF_STD_CALL AMFConvertWStringToFloatVector4D(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToFloatVector4D(AMFConvertWStringToString(value, res), res); } static AMF_INLINE AMFRate AMF_STD_CALL AMFConvertWStringToRate(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToRate(AMFConvertWStringToString(value, res), res); } static AMF_INLINE AMFRatio AMF_STD_CALL AMFConvertWStringToRatio(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToRatio(AMFConvertWStringToString(value, res), res); } static AMF_INLINE AMFColor AMF_STD_CALL AMFConvertWStringToColor(const AMFVariant::WString& value, AMF_RESULT& res) { return AMFConvertStringToColor(AMFConvertWStringToString(value, res), res); } //------------------------------------------------------------------------------------------------- #define AMFConvertTool(srcType, dstType)\ if(AMFVariantGetType(pSrc) == AMFVariantType##srcType && newType == AMFVariantType##dstType)\ {\ AMF_RESULT res = AMF_OK;\ AMFVariantAssign##dstType(pDest, AMFConvert##srcType##To##dstType(AMFVariant##srcType(pSrc), res));\ return res;\ }\ //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantChangeType(AMFVariantStruct* pDest, const AMFVariantStruct* pSrc, AMF_VARIANT_TYPE newType) { AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); if(pSrc == 0) { pSrc = pDest; } if(AMFVariantGetType(pSrc) == newType) { if(pDest == pSrc) { return AMF_OK; } return AMFVariantCopy(pDest, pSrc); } AMFVariantClear(pDest); AMFConvertTool(Empty, Bool); AMFConvertTool(Empty, Int64); AMFConvertTool(Empty, Double); AMFConvertTool(Empty, Float); AMFConvertTool(Empty, String); AMFConvertTool(Empty, WString); AMFConvertTool(Bool, Int64); AMFConvertTool(Bool, Double); AMFConvertTool(Bool, Float); AMFConvertTool(Bool, String); AMFConvertTool(Bool, WString); AMFConvertTool(Int64, Bool); AMFConvertTool(Int64, Double); AMFConvertTool(Int64, Float); AMFConvertTool(Int64, String); AMFConvertTool(Int64, WString); AMFConvertTool(Double, Bool); AMFConvertTool(Double, Int64); AMFConvertTool(Double, String); AMFConvertTool(Double, String); AMFConvertTool(Float, Bool); AMFConvertTool(Float, Int64); AMFConvertTool(Float, String); AMFConvertTool(Float, String); AMFConvertTool(String, Bool); AMFConvertTool(String, Int64); AMFConvertTool(String, Double); AMFConvertTool(String, Float); AMFConvertTool(String, WString); AMFConvertTool(WString, Bool); AMFConvertTool(WString, Int64); AMFConvertTool(WString, Double); AMFConvertTool(WString, Float); AMFConvertTool(WString, String); AMFConvertTool(String, Rect); AMFConvertTool(String, Size); AMFConvertTool(String, Point); AMFConvertTool(String, Rate); AMFConvertTool(String, Ratio); AMFConvertTool(String, Color); AMFConvertTool(Rect , String); AMFConvertTool(Size , String); AMFConvertTool(Point, String); AMFConvertTool(Rate , String); AMFConvertTool(Ratio, String); AMFConvertTool(Color, String); AMFConvertTool(WString, Rect); AMFConvertTool(WString, Size); AMFConvertTool(WString, Point); AMFConvertTool(WString, Rate); AMFConvertTool(WString, Ratio); AMFConvertTool(WString, Color); AMFConvertTool(Rect , WString); AMFConvertTool(Size , WString); AMFConvertTool(Point, WString); AMFConvertTool(Rate , WString); AMFConvertTool(Ratio, WString); AMFConvertTool(Color, WString); return AMF_INVALID_ARG; } #endif // #if defined(__cplusplus) //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignBool(AMFVariantStruct* pDest, amf_bool value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { pDest->type = AMF_VARIANT_BOOL; AMFVariantBool(pDest) = value; } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignInt64(AMFVariantStruct* pDest, amf_int64 value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { pDest->type = AMF_VARIANT_INT64; AMFVariantInt64(pDest) = value; } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignDouble(AMFVariantStruct* pDest, amf_double value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { pDest->type = AMF_VARIANT_DOUBLE; AMFVariantDouble(pDest) = value; } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloat(AMFVariantStruct* pDest, amf_float value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if (errRet == AMF_OK) { pDest->type = AMF_VARIANT_FLOAT; AMFVariantFloat(pDest) = value; } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignString(AMFVariantStruct* pDest, const char* pValue) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); AMF_VARIANT_RETURN_IF_INVALID_POINTER(pValue); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { const size_t size = (strlen(pValue) + 1); pDest->type = AMF_VARIANT_STRING; AMFVariantString(pDest) = (char*)amf_variant_alloc(size * sizeof(char)); if(AMFVariantString(pDest)) { memcpy(AMFVariantString(pDest), pValue, size * sizeof(char)); } else { errRet = AMF_OUT_OF_MEMORY; } } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignWString(AMFVariantStruct* pDest, const wchar_t* pValue) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); AMF_VARIANT_RETURN_IF_INVALID_POINTER(pValue); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { const size_t size = (wcslen(pValue) + 1); pDest->type = AMF_VARIANT_WSTRING; AMFVariantWString(pDest) = (wchar_t*)amf_variant_alloc(size * sizeof(wchar_t)); if(AMFVariantWString(pDest)) { memcpy(AMFVariantWString(pDest), pValue, size * sizeof(wchar_t)); } else { errRet = AMF_OUT_OF_MEMORY; } } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignInterface(AMFVariantStruct* pDest, AMFInterface* pValue) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); //AMF_VARIANT_RETURN_IF_INVALID_POINTER(pValue);//can be NULL errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { pDest->type = AMF_VARIANT_INTERFACE; AMFVariantInterface(pDest) = pValue; if(AMFVariantInterface(pDest)) { #if defined(__cplusplus) AMFVariantInterface(pDest)->Acquire(); #else AMFVariantInterface(pDest)->pVtbl->Acquire(AMFVariantInterface(pDest)); #endif } } return errRet; } //------------------------------------------------------------------------------------------------- #if defined(__cplusplus) static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRect(AMFVariantStruct* pDest, const AMFRect& value) { return AMFVariantAssignRect(pDest, &value); } #endif //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRect (AMFVariantStruct* pDest, const AMFRect* value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { pDest->type = AMF_VARIANT_RECT; AMFVariantRect(pDest) = *value; } return errRet; } //------------------------------------------------------------------------------------------------- #if defined(__cplusplus) static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignSize (AMFVariantStruct* pDest, const AMFSize& value) { return AMFVariantAssignSize (pDest, &value); } #endif //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignSize (AMFVariantStruct* pDest, const AMFSize* value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { pDest->type = AMF_VARIANT_SIZE; AMFVariantSize(pDest) = *value; } return errRet; } //------------------------------------------------------------------------------------------------- #if defined(__cplusplus) static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignPoint(AMFVariantStruct* pDest, const AMFPoint& value) { return AMFVariantAssignPoint(pDest, &value); } static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatSize(AMFVariantStruct* pDest, const AMFFloatSize& value) { return AMFVariantAssignFloatSize(pDest, &value); } static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatPoint2D(AMFVariantStruct* pDest, const AMFFloatPoint2D& value) { return AMFVariantAssignFloatPoint2D(pDest, &value); } static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatPoint3D(AMFVariantStruct* pDest, const AMFFloatPoint3D& value) { return AMFVariantAssignFloatPoint3D(pDest, &value); } static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatVector4D(AMFVariantStruct* pDest, const AMFFloatVector4D& value) { return AMFVariantAssignFloatVector4D(pDest, &value); } #endif //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignPoint(AMFVariantStruct* pDest, const AMFPoint* value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { pDest->type = AMF_VARIANT_POINT; AMFVariantPoint(pDest) = *value; } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatSize(AMFVariantStruct* pDest, const AMFFloatSize* value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if (errRet == AMF_OK) { pDest->type = AMF_VARIANT_FLOAT_SIZE; AMFVariantFloatSize(pDest) = *value; } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatPoint2D(AMFVariantStruct* pDest, const AMFFloatPoint2D* value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if (errRet == AMF_OK) { pDest->type = AMF_VARIANT_FLOAT_POINT2D; AMFVariantFloatPoint2D(pDest) = *value; } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatPoint3D(AMFVariantStruct* pDest, const AMFFloatPoint3D* value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if (errRet == AMF_OK) { pDest->type = AMF_VARIANT_FLOAT_POINT3D; AMFVariantFloatPoint3D(pDest) = *value; } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignFloatVector4D(AMFVariantStruct* pDest, const AMFFloatVector4D* value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if (errRet == AMF_OK) { pDest->type = AMF_VARIANT_FLOAT_VECTOR4D; AMFVariantFloatVector4D(pDest) = *value; } return errRet; } //------------------------------------------------------------------------------------------------- #if defined(__cplusplus) static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRate (AMFVariantStruct* pDest, const AMFRate& value) { return AMFVariantAssignRate (pDest, &value); } #endif //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRate (AMFVariantStruct* pDest, const AMFRate* value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { pDest->type = AMF_VARIANT_RATE; AMFVariantRate(pDest) = *value; } return errRet; } //------------------------------------------------------------------------------------------------- #if defined(__cplusplus) static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRatio(AMFVariantStruct* pDest, const AMFRatio& value) { return AMFVariantAssignRatio(pDest, &value); } #endif //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignRatio(AMFVariantStruct* pDest, const AMFRatio* value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { pDest->type = AMF_VARIANT_RATIO; AMFVariantRatio(pDest) = *value; } return errRet; } //------------------------------------------------------------------------------------------------- #if defined(__cplusplus) static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignColor(AMFVariantStruct* pDest, const AMFColor& value) { return AMFVariantAssignColor(pDest, &value); } #endif //------------------------------------------------------------------------------------------------- static AMF_INLINE AMF_RESULT AMF_CDECL_CALL AMFVariantAssignColor(AMFVariantStruct* pDest, const AMFColor* value) { AMF_RESULT errRet = AMF_OK; AMF_VARIANT_RETURN_IF_INVALID_POINTER(pDest); errRet = AMFVariantInit(pDest); if(errRet == AMF_OK) { pDest->type = AMF_VARIANT_COLOR; AMFVariantColor(pDest) = *value; } return errRet; } //------------------------------------------------------------------------------------------------- static AMF_INLINE char* AMF_CDECL_CALL AMFVariantDuplicateString(const char* from) { char* ret = 0; if(from) { ret = (char*)amf_variant_alloc(sizeof(char)*(strlen(from) + 1)); if(ret) { strcpy(ret, from); } } return ret; } //------------------------------------------------------------------------------------------------- static AMF_INLINE void AMF_CDECL_CALL AMFVariantFreeString(char* from) { amf_variant_free(from); } //------------------------------------------------------------------------------------------------- static AMF_INLINE wchar_t* AMF_CDECL_CALL AMFVariantDuplicateWString(const wchar_t* from) { wchar_t* ret = 0; if(from) { ret = (wchar_t*)amf_variant_alloc(sizeof(wchar_t)*(wcslen(from) + 1)); if(ret) { wcscpy(ret, from); } } return ret; } //------------------------------------------------------------------------------------------------- static AMF_INLINE void AMF_CDECL_CALL AMFVariantFreeWString(wchar_t* from) { amf_variant_free(from); } //---------------------------------------------------------------------------------------------- // AMF_INLINE implementation of AMFVariant class //---------------------------------------------------------------------------------------------- #if defined(__cplusplus) AMF_INLINE AMFVariant::AMFVariant(const AMFVariantStruct* pOther) { AMFVariantInit(this); if(pOther != NULL) { AMFVariantCopy(this, const_cast<AMFVariantStruct*>(pOther)); } } //------------------------------------------------------------------------------------------------- template<typename T> AMFVariant::AMFVariant(const AMFInterfacePtr_T<T>& pValue) { AMFVariantInit(this); AMFVariantAssignInterface(this, pValue); } //------------------------------------------------------------------------------------------------- template<class ReturnType, AMF_VARIANT_TYPE variantType, typename Getter> ReturnType AMFVariant::GetValue(Getter getter) const { ReturnType str = ReturnType(); if(AMFVariantGetType(this) == variantType) { str = static_cast<ReturnType>(getter(this)); } else { AMFVariant varDest; varDest.ChangeType(variantType, this); if(varDest.type != AMF_VARIANT_EMPTY) { str = static_cast<ReturnType>(getter(&varDest)); } } return str; } //------------------------------------------------------------------------------------------------- AMF_INLINE AMFVariant& AMFVariant::operator=(const AMFVariantStruct& other) { AMFVariantClear(this); AMFVariantCopy(this, const_cast<AMFVariantStruct*>(&other)); return *this; } //------------------------------------------------------------------------------------------------- AMF_INLINE AMFVariant& AMFVariant::operator=(const AMFVariantStruct* pOther) { if(pOther != NULL) { AMFVariantClear(this); AMFVariantCopy(this, const_cast<AMFVariantStruct*>(pOther)); } return *this; } //------------------------------------------------------------------------------------------------- AMF_INLINE AMFVariant& AMFVariant::operator=(const AMFVariant& other) { AMFVariantClear(this); AMFVariantCopy(this, const_cast<AMFVariantStruct*>(static_cast<const AMFVariantStruct*>(&other))); return *this; } //------------------------------------------------------------------------------------------------- template<typename T> AMFVariant& AMFVariant::operator=(const AMFInterfacePtr_T<T>& value) { AMFVariantClear(this); AMFVariantAssignInterface(this, value); return *this; } //------------------------------------------------------------------------------------------------- AMF_INLINE bool AMFVariant::operator==(const AMFVariantStruct& other) const { return *this == &other; } //------------------------------------------------------------------------------------------------- AMF_INLINE bool AMFVariant::operator==(const AMFVariantStruct* pOther) const { //TODO: double check amf_bool ret = false; if(pOther == NULL) { ret = false; } else { AMFVariantCompare(this, pOther, &ret); } return ret; } //------------------------------------------------------------------------------------------------- AMF_INLINE bool AMFVariant::operator!=(const AMFVariantStruct& other) const { return !(*this == &other); } //------------------------------------------------------------------------------------------------- AMF_INLINE bool AMFVariant::operator!=(const AMFVariantStruct* pOther) const { return !(*this == pOther); } //------------------------------------------------------------------------------------------------- AMF_INLINE void AMFVariant::Attach(AMFVariantStruct& variant) { Clear(); memcpy(this, &variant, sizeof(variant)); AMFVariantGetType(&variant) = AMF_VARIANT_EMPTY; } //------------------------------------------------------------------------------------------------- AMF_INLINE AMFVariantStruct AMFVariant::Detach() { AMFVariantStruct varResult = *this; AMFVariantGetType(this) = AMF_VARIANT_EMPTY; return varResult; } //------------------------------------------------------------------------------------------------- AMF_INLINE AMFVariantStruct& AMFVariant::GetVariant() { return *static_cast<AMFVariantStruct*>(this); } //------------------------------------------------------------------------------------------------- AMF_INLINE void AMFVariant::ChangeType(AMF_VARIANT_TYPE newType, const AMFVariant* pSrc) { AMFVariantChangeType(this, pSrc, newType); } //------------------------------------------------------------------------------------------------- AMF_INLINE bool AMFVariant::Empty() const { return type == AMF_VARIANT_EMPTY; } //------------------------------------------------------------------------------------------------- #endif // #if defined(__cplusplus) #if defined(__cplusplus) } //namespace amf #endif #endif //#ifndef AMF_Variant_h 0707010000003F000081A400000000000000000000000163CFF5E700000B3F000000000000000000000000000000000000002D00000000AMF-1.4.29/amf/public/include/core/Version.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** *************************************************************************************************** * @file Version.h * @brief Version declaration *************************************************************************************************** */ #ifndef AMF_Version_h #define AMF_Version_h #pragma once #include "Platform.h" #define AMF_MAKE_FULL_VERSION(VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE, VERSION_BUILD_NUM) ( ((amf_uint64)(VERSION_MAJOR) << 48ull) | ((amf_uint64)(VERSION_MINOR) << 32ull) | ((amf_uint64)(VERSION_RELEASE) << 16ull) | (amf_uint64)(VERSION_BUILD_NUM)) #define AMF_GET_MAJOR_VERSION(x) ((x >> 48ull) & 0xFFFF) #define AMF_GET_MINOR_VERSION(x) ((x >> 32ull) & 0xFFFF) #define AMF_GET_SUBMINOR_VERSION(x) ((x >> 16ull) & 0xFFFF) #define AMF_GET_BUILD_VERSION(x) ((x >> 0ull) & 0xFFFF) #define AMF_VERSION_MAJOR 1 #define AMF_VERSION_MINOR 4 #define AMF_VERSION_RELEASE 29 #define AMF_VERSION_BUILD_NUM 0 #define AMF_FULL_VERSION AMF_MAKE_FULL_VERSION(AMF_VERSION_MAJOR, AMF_VERSION_MINOR, AMF_VERSION_RELEASE, AMF_VERSION_BUILD_NUM) #endif //#ifndef AMF_Version_h 07070100000040000081A400000000000000000000000163CFF5E700001435000000000000000000000000000000000000002F00000000AMF-1.4.29/amf/public/include/core/VulkanAMF.h// // Notice Regarding Standards. AMD does not provide a license or sublicense to // any Intellectual Property Rights relating to any standards, including but not // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4; // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3 // (collectively, the "Media Technologies"). For clarity, you will pay any // royalties due for such third party technologies, which may include the Media // Technologies that are owed as a result of AMD providing the Software to you. // // MIT license // // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef __VulkanAMF_h__ #define __VulkanAMF_h__ #pragma once #include "Platform.h" #include "vulkan/vulkan.h" #if defined(__cplusplus) namespace amf { #endif typedef struct AMFVulkanDevice { amf_size cbSizeof; // sizeof(AMFVulkanDevice) void* pNext; // reserved for extensions VkInstance hInstance; VkPhysicalDevice hPhysicalDevice; VkDevice hDevice; } AMFVulkanDevice; typedef struct AMFVulkanSync { amf_size cbSizeof; // sizeof(AMFVulkanSync) void* pNext; // reserved for extensions VkSemaphore hSemaphore; // VkSemaphore; can be nullptr bool bSubmitted; // if true - wait for hSemaphore. re-submit hSemaphore if not synced by other ways and set to true VkFence hFence; // To sync on CPU; can be nullptr. Submitted in vkQueueSubmit. If waited for hFence, null it, do not delete or reset. } AMFVulkanSync; typedef struct AMFVulkanBuffer { amf_size cbSizeof; // sizeof(AMFVulkanBuffer) void* pNext; // reserved for extensions VkBuffer hBuffer; VkDeviceMemory hMemory; amf_int64 iSize; amf_int64 iAllocatedSize; // for reuse amf_uint32 eAccessFlags; // VkAccessFlagBits amf_uint32 eUsage; // AMF_BUFFER_USAGE amf_uint32 eAccess; // AMF_MEMORY_CPU_ACCESS AMFVulkanSync Sync; } AMFVulkanBuffer; typedef struct AMFVulkanSurface { amf_size cbSizeof; // sizeof(AMFVulkanSurface) void* pNext; // reserved for extensions // surface properties VkImage hImage; // vulkan native image for which the surface is created VkDeviceMemory hMemory; // memory for hImage, can be nullptr amf_int64 iSize; // memory size amf_uint32 eFormat; // VkFormat amf_int32 iWidth; // image width amf_int32 iHeight; // image height amf_uint32 eCurrentLayout; // VkImageLayout amf_uint32 eUsage; // AMF_SURFACE_USAGE amf_uint32 eAccess; // AMF_MEMORY_CPU_ACCESS AMFVulkanSync Sync; // To sync on GPU } AMFVulkanSurface; typedef struct AMFVulkanView { amf_size cbSizeof; // sizeof(AMFVulkanView) void* pNext; // reserved for extensions // surface properties AMFVulkanSurface *pSurface; VkImageView hView; amf_int32 iPlaneWidth; amf_int32 iPlaneHeight; amf_int32 iPlaneWidthPitch; amf_int32 iPlaneHeightPitch; } AMFVulkanView; #define AMF_CONTEXT_VULKAN_COMPUTE_QUEUE L"VulkanComputeQueue" // amf_int64; default=0; Compute queue index in range [0, (VkQueueFamilyProperties.queueCount-1)] of the compute queue family. #if defined(__cplusplus) } // namespace amf #endif #endif // __VulkanAMF_h__ 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!1950 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor