P4 to Git Change 1161664 by rili@rili_opencl_stg on 2015/06/15 18:01:53

EPR #421679 - remove all source code related to open video

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/Makefile#3 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.cpp#15 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.def#5 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.h#7 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.rc#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecodeTypes.h#6 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVEncode.cpp#37 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVEncode.h#11 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVEncodeTypes.h#16 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.cpp#6 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.def#3 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.h#5 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.rc#3 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.sln#5 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.vcxproj#11 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.vcxproj.filters#3 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo_2008.sln#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo_2008.vcproj#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/atiumdva.cap#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build.bat#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build/Makefile#6 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build/Makefile.ov#18 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build/Makefile.ovd#27 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/buildOV/Makefile#5 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/res/OpenVideo.rc2#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/build/Makefile.api#113 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_common.hpp#17 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#43 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_device.cpp#59 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_open_video.cpp#35 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_open_video_amd.h#20 delete
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.cpp#273 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.hpp#91 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuvirtual.cpp#24 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuvirtual.hpp#12 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#247 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#512 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#145 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#311 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.hpp#91 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#366 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#130 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp#73 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.h#45 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.cpp#92 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.hpp#49 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsavirtual.hpp#28 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#34 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#15 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsavirtual.hpp#20 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#78 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#21 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.hpp#16 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/object.hpp#15 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/video_session.hpp#13 delete
... //depot/stg/opencl/drivers/opencl/runtime/top.hpp#22 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#235 edit
Esse commit está contido em:
foreman
2015-06-15 18:09:54 -04:00
commit db21d4a40c
5 arquivos alterados com 1 adições e 1376 exclusões
+1 -115
Ver Arquivo
@@ -9,8 +9,8 @@
#include "platform/runtime.hpp"
#include "platform/command.hpp"
#include "platform/memory.hpp"
#include "platform/video_session.hpp"
#include "thread/thread.hpp"
#include "platform/commandqueue.hpp"
#include <vector>
#include <utility>
@@ -213,23 +213,6 @@ public:
};
#define AMD_PLATFORM (reinterpret_cast<cl_platform_id>(&amd::PlatformID::Platform))
#if cl_amd_open_video
cl_int clEnqueueVideoDecodeAMD(
VideoSession& session,
cl_video_decode_data_amd* video_data,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
cl_int clEnqueueVideoEncodeAMD(
VideoSession& session,
cl_video_encode_data_amd* video_data,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
#endif // cl_amd_open_video
} // namespace amd
extern "C" {
@@ -285,103 +268,6 @@ clSetCommandQueueProperty(
cl_command_queue_properties *old_properties) CL_API_SUFFIX__VERSION_1_0;
#endif // CL_VERSION_1_1
#if cl_amd_open_video
extern CL_API_ENTRY cl_video_session_amd CL_API_CALL
clCreateVideoSessionAMD(
cl_context context,
cl_device_id device,
cl_video_session_flags_amd flags,
cl_video_config_type_amd config_buffer_type,
cl_uint config_buffer_size,
void* config_buffer,
cl_int* errcode_ret);
extern CL_API_ENTRY cl_int CL_API_CALL
clRetainVideoSessionAMD(
cl_video_session_amd video_session);
extern CL_API_ENTRY cl_int CL_API_CALL
clReleaseVideoSessionAMD(
cl_video_session_amd video_session);
extern CL_API_ENTRY cl_int CL_API_CALL
clGetVideoSessionInfoAMD(
cl_video_session_amd video_session,
cl_video_session_info_amd param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret);
extern CL_API_ENTRY cl_video_session_amd CL_API_CALL
clCreateVideoEncSessionAMD(
cl_context context,
cl_device_id device,
cl_video_session_flags_amd flags,
cl_video_config_type_amd config_buffer_type,
cl_uint config_buffer_size,
void* config_buffer,
cl_int* errcode_ret);
extern CL_API_ENTRY cl_int CL_API_CALL
clDestroyVideoEncSessionAMD(
cl_video_session_amd video_session);
extern CL_API_ENTRY cl_int CL_API_CALL
clGetVideoSessionEncInfoAMD(
cl_video_session_amd video_session,
cl_video_session_enc_info_amd param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret);
extern CL_API_ENTRY cl_int CL_API_CALL
clSendEncodeConfigInfoAMD(
cl_video_session_amd video_session,
size_t numBuffers,
void* pConfigBuffers);
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueRunVideoProgramAMD(
cl_video_session_amd video_session,
void* video_data_struct,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
extern CL_API_ENTRY cl_int CL_API_CALL
clEncodeGetDeviceCapAMD(
cl_device_id device_id,
cl_uint encode_mode,
cl_uint encode_cap_total_size,
cl_uint* num_encode_cap,
void* pEncodeCAP);
#if 1
extern CL_API_ENTRY cl_int CL_API_CALL
clEncodePictureAMD(
cl_video_session_amd video_session,
cl_uint number_of_encode_task_input_buffers,
void* encode_task_input_buffer_list,
void* picture_parameter,
cl_uint* pTaskID);
#endif
extern CL_API_ENTRY cl_int CL_API_CALL
clEncodeQueryTaskDescriptionAMD(
cl_video_session_amd session,
cl_uint num_of_task_description_request,
cl_uint* num_of_task_description_return,
void * task_description_list);
extern CL_API_ENTRY cl_int CL_API_CALL
clEncodeReleaseOutputResourceAMD(
cl_video_session_amd session,
cl_uint task_id);
#endif // cl_amd_open_video
extern CL_API_ENTRY cl_mem CL_API_CALL
clConvertImageAMD(
cl_context context,
-29
Ver Arquivo
@@ -27,10 +27,6 @@
#include <GL/glext.h>
#include "CL/cl_gl.h"
#ifndef WITH_GPU_DEVICE
# undef cl_amd_open_video
#endif // WITH_GPU_DEVICE
/*! \addtogroup API
* @{
*
@@ -510,18 +506,11 @@ clGetExtensionFunctionAddress(const char* func_name)
#ifdef cl_ext_device_fission
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateSubDevicesEXT);
#endif // cl_ext_device_fission
#if cl_amd_open_video
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateVideoSessionAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateVideoEncSessionAMD);
#endif // cl_amd_open_video
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateKeyAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clConvertImageAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateBufferFromImageAMD);
break;
case 'D':
#if cl_amd_open_video
CL_EXTENSION_ENTRYPOINT_CHECK(clDestroyVideoEncSessionAMD);
#endif // cl_amd_open_video
break;
case 'E':
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBeginPerfCounterAMD);
@@ -536,13 +525,6 @@ clGetExtensionFunctionAddress(const char* func_name)
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireDX9MediaSurfacesKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseDX9MediaSurfacesKHR);
#endif //_WIN32
#if cl_amd_open_video
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueRunVideoProgramAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEncodeGetDeviceCapAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEncodePictureAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEncodeQueryTaskDescriptionAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEncodeReleaseOutputResourceAMD);
#endif // cl_amd_open_video
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWaitSignalAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSignalAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueMakeBuffersResidentAMD);
@@ -554,10 +536,6 @@ clGetExtensionFunctionAddress(const char* func_name)
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLTextureInfo);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLContextInfoKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetThreadTraceInfoAMD);
#if cl_amd_open_video
CL_EXTENSION_ENTRYPOINT_CHECK(clGetVideoSessionInfoAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetVideoSessionEncInfoAMD);
#endif // cl_amd_open_video
#ifdef _WIN32
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromD3D10KHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromDX9MediaAdapterKHR);
@@ -609,15 +587,8 @@ clGetExtensionFunctionAddress(const char* func_name)
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainDeviceEXT);
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseDeviceEXT);
#endif // cl_ext_device_fission
#if cl_amd_open_video
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainVideoSessionAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseVideoSessionAMD);
#endif // cl_amd_open_video
break;
case 'S':
#if cl_amd_open_video
CL_EXTENSION_ENTRYPOINT_CHECK(clSendEncodeConfigInfoAMD);
#endif // cl_amd_open_video
CL_EXTENSION_ENTRYPOINT_CHECK(clSetThreadTraceParamAMD);
break;
case 'U':
-41
Ver Arquivo
@@ -568,47 +568,6 @@ RUNTIME_ENTRY(cl_int, clGetDeviceInfo, (
CASE(CL_DEVICE_IMAGE_PITCH_ALIGNMENT, imagePitchAlignment_);
CASE(CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT, imageBaseAddressAlignment_);
#if cl_amd_open_video
CASE(CL_DEVICE_MAX_VIDEO_SESSIONS_AMD, maxVideoSessions_);
CASE(CL_DEVICE_NUM_VIDEO_ATTRIBS_AMD, numVideoAttribs_);
CASE(CL_DEVICE_NUM_VIDEO_ENC_ATTRIBS_AMD, numVideoEncAttribs_);
case CL_DEVICE_VIDEO_ATTRIBS_AMD:
{
size_t valueSize = sizeof(cl_video_attrib_amd)
* as_amd(device)->info().numVideoAttribs_;
if (param_value != NULL && param_value_size < valueSize) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = valueSize;
if (param_value != NULL) {
::memcpy(param_value, as_amd(device)->info().videoAttribs_,
valueSize);
if (param_value_size > valueSize) {
::memset(static_cast<char*>(param_value) + valueSize,
'\0', param_value_size - valueSize);
}
}
return CL_SUCCESS;
}
case CL_DEVICE_VIDEO_ATTRIBS_ENC_AMD:
{
size_t valueSize = sizeof(cl_video_attrib_encode_amd) // has profile & format
* as_amd(device)->info().numVideoEncAttribs_;
if (param_value != NULL && param_value_size < valueSize) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = valueSize;
if (param_value != NULL) {
::memcpy(param_value, as_amd(device)->info().videoEncAttribs_, valueSize);
// Zero out remaining bytes if encode CAP List + profile is < parameter value size.
if (param_value_size > valueSize) {
::memset(static_cast<char*>(param_value) + valueSize,
'\0', param_value_size - valueSize);
}
}
return CL_SUCCESS;
}
#endif //cl_amd_open_video
default:
break;
}
-829
Ver Arquivo
@@ -1,829 +0,0 @@
//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//
#include "cl_common.hpp"
#include "platform/command.hpp"
#include <cstring>
#if cl_amd_open_video
#include "platform/video_session.hpp"
#include "cal.h"
#include "calcl.h"
amd::HostQueue* staticQueue; //@todo fix the interface and remove hardcoded queue
/* Helper function GetCalDecodeProfile()
*/
static bool
GetCalVideoProfile(cl_video_decode_profile_amd clVideoProfile,
CALdecodeProfile& calVideoProfile)
{
switch(clVideoProfile) {
case CL_VIDEO_DECODE_PROFILE_H264_BASELINE_AMD:
calVideoProfile = CAL_VID_H264_BASELINE;
break;
case CL_VIDEO_DECODE_PROFILE_H264_MAIN_AMD:
calVideoProfile = CAL_VID_H264_MAIN;
break;
case CL_VIDEO_DECODE_PROFILE_H264_HIGH_AMD:
calVideoProfile = CAL_VID_H264_HIGH;
break;
case CL_VIDEO_DECODE_PROFILE_VC1_SIMPLE_AMD:
calVideoProfile = CAL_VID_VC1_SIMPLE;
break;
case CL_VIDEO_DECODE_PROFILE_VC1_MAIN_AMD:
calVideoProfile = CAL_VID_VC1_MAIN;
break;
case CL_VIDEO_DECODE_PROFILE_VC1_ADVANCED_AMD:
calVideoProfile = CAL_VID_VC1_ADVANCED;
break;
case CL_VIDEO_DECODE_PROFILE_MPEG2_VLD_AMD:
calVideoProfile = CAL_VID_MPEG2_VLD;
break;
//case CL_VIDEO_DECODE_PROFILE_MPEG2_SIMPLE_AMD:
//case CL_VIDEO_DECODE_PROFILE_MPEG2_MAIN_AMD:
default:
return false;
break;
}
return true;
}
/* Helper function GetCalDecodeProfile()
*/
static bool
GetCalVideoFormat(cl_video_format_amd clVideoFormat,
CALdecodeFormat& calVideoFormat)
{
switch(clVideoFormat) {
case CL_VIDEO_NV12_INTERLEAVED_AMD:
calVideoFormat = CAL_VID_NV12_INTERLEAVED;
break;
case CL_VIDEO_YV12_INTERLEAVED_AMD:
calVideoFormat = CAL_VID_YV12_INTERLEAVED;
break;
default:
return false;
}
return true;
}
/*! \addtogroup API
* @{
*
* \addtogroup cl_amd_open_video
*
* This section provides OpenCL extension functions that allow applications
* to use kernel decoding of video streams using corresponding HW capabilities.
*
* @}
* \addtogroup clQueryVidDecoderCapsAMD
* @{
*/
/*! \brief Creates a video session object.
*
* \param context is a valid OpenCL context on which the image object
* is to be created.
*
* \param device must be a device associated with context. It can either be in
* the list of devices specified when context is created using
* clCreateContext or have the same device type as the device type
* specified when the context is created using clCreateContextFromType
*
* \param flags is a bit-field that is used to specify the video session
* operation mode, available flags are as follows:
* - CL_VIDEO_DECODE_ACCELERATION_AMD - the video session supports HW
* acceleration of video decoding operation.
*
* \param errcode_ret will return CL_SUCCESS if no error occurs;
* or an appropriate error code:
* - CL_INVALID_CONTEXT if \a context is not a valid context;
* - CL_INVALID_DEVICE if \a device is not a valid device;
* - CL_INVALID_VIDEO_SESSION_FLAGS_AMD if flags is NULL or contains invalid
* configuration;
* - CL_INVALID_OPERATION if video decode extension is not supported by
* any device associated with context;
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required
* by the runtime.
*
* \version 1.1r25
*/
RUNTIME_ENTRY_RET(cl_video_session_amd, clCreateVideoSessionAMD, (
cl_context context,
cl_device_id device,
cl_video_session_flags_amd flags,
cl_video_config_type_amd config_buffer_type,
cl_uint config_buffer_size,
void* config_buffer,
cl_int* errcode_ret))
{
*not_null(errcode_ret) = CL_SUCCESS;
if (!is_valid(context)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
LogWarning("invalid parameter \"context\"");
return (cl_video_session_amd) 0;
}
if (!is_valid(device)) {
*not_null(errcode_ret) = CL_INVALID_DEVICE;
LogWarning("invalid parameter \"device\"");
return (cl_video_session_amd) 0;
}
amd::Device* amdDevice = as_amd(device);
if (!amdDevice->info().openVideo_) {
*not_null(errcode_ret) = CL_INVALID_OPERATION;
LogWarning("Device or CAL does not support Open Video extension");
return (cl_video_session_amd) 0;
}
// Create video command queue
cl_video_encode_desc_amd ovSessionProperties;
CALvideoProperties calVideoProperties;
calVideoProperties.size = sizeof(calVideoProperties);
calVideoProperties.flags = static_cast<CALuint>(flags);
switch(config_buffer_type) {
case CL_VIDEO_DECODE_CONFIGURATION_AMD:
{
cl_video_decode_desc_amd* videoDecodeDesc =
static_cast<cl_video_decode_desc_amd*>(config_buffer);
if (!GetCalVideoProfile(videoDecodeDesc->attrib.profile,
calVideoProperties.profile)) {
*not_null(errcode_ret) = CL_INVALID_OPERATION;
LogWarning("Profile is not supported or invalid");
return (cl_video_session_amd) 0;
}
if (!GetCalVideoFormat(videoDecodeDesc->attrib.format,
calVideoProperties.format)) {
*not_null(errcode_ret) = CL_INVALID_OPERATION;
LogWarning("Format is not supported or invalid");
return (cl_video_session_amd) 0;
}
calVideoProperties.width = videoDecodeDesc->image_width;
calVideoProperties.height = videoDecodeDesc->image_height;
calVideoProperties.VideoEngine_name = CAL_CONTEXT_VIDEO;
}
break;
default:
*not_null(errcode_ret) = CL_INVALID_VIDEO_CONFIG_TYPE_AMD;
LogWarning("invalid parameter \"config_buffer_type\"");
return (cl_video_session_amd) 0;
break;
}
ovSessionProperties.calVideoProperties = &calVideoProperties;
amd::HostQueue* queue = new amd::HostQueue(
*as_amd(context), *as_amd(device), 0, &ovSessionProperties);
if (queue == NULL || !queue->create()) {
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
LogWarning("not enough host memory");
return (cl_video_session_amd) 0;
}
staticQueue = queue;
amd::VideoSession* video_session = new amd::VideoSession(
*as_amd(context), *as_amd(device), queue, flags, config_buffer_type,
config_buffer_size, config_buffer);
if (!video_session) {
queue->release();
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
LogWarning("not enough host memory");
return (cl_video_session_amd) 0;
}
return as_cl<amd::VideoSession>(video_session);
}
RUNTIME_EXIT
RUNTIME_ENTRY_RET(cl_video_session_amd, clCreateVideoEncSessionAMD, (
cl_context context,
cl_device_id device,
cl_video_session_flags_amd flags,
cl_video_config_type_amd config_buffer_type,
cl_uint config_buffer_size,
void* config_buffer,
cl_int* errcode_ret))
{
*not_null(errcode_ret) = CL_SUCCESS;
// Make sure the context is valid
if (!is_valid(context)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
LogWarning("invalid parameter \"context\"");
return (cl_video_session_amd) 0;
}
// Make sure the device is valid
if (!is_valid(device)) {
*not_null(errcode_ret) = CL_INVALID_DEVICE;
LogWarning("invalid parameter \"device\"");
return (cl_video_session_amd) 0;
}
// Make sure the device supports Open Video extensions
amd::Device* amdDevice = as_amd(device);
if (!amdDevice->info().openVideo_) {
*not_null(errcode_ret) = CL_INVALID_OPERATION;
LogWarning("Device or CAL does not support Open Video extension");
return (cl_video_session_amd) 0;
}
cl_video_encode_desc_amd *ovSessionProperties = (cl_video_encode_desc_amd *)config_buffer;
// Create video command queue
CALvideoProperties calVideoProperties;
switch(config_buffer_type)
{
case CL_VIDEO_ENCODE_CONFIGURATION_AMD:
calVideoProperties.size = sizeof(calVideoProperties);
calVideoProperties.flags = static_cast<CALuint>(flags);
calVideoProperties.profile = (CALdecodeProfile)ovSessionProperties->attrib.codec_profile;
calVideoProperties.format = (CALdecodeFormat)ovSessionProperties->attrib.format;
calVideoProperties.width = ovSessionProperties->image_width;
calVideoProperties.height = ovSessionProperties->image_height;
calVideoProperties.VideoEngine_name = CAL_CONTEXT_VIDEO_VCE;
ovSessionProperties->calVideoProperties = &calVideoProperties;
break;
default:
*not_null(errcode_ret) = CL_INVALID_VIDEO_CONFIG_TYPE_AMD;
LogWarning("invalid parameter \"config_buffer_type\"");
return (cl_video_session_amd) 0;
break;
}
amd::HostQueue* queue = new amd::HostQueue(
*as_amd(context), *as_amd(device), 0, ovSessionProperties);
if (queue == NULL || !queue->create()) {
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
LogWarning("not enough host memory");
return (cl_video_session_amd) 0;
}
staticQueue = queue;
#if 0 // this doesn't work here due to context value...
CAL_VID_PROFILE_LEVEL encode_profile_level;
encode_profile_level.profile = buffer->attrib.profile;
encode_profile_level.level = buffer->attrib.level;
CALuint frameRate = 0;
CALuint YUVwidth = buffer->image_width;
CALuint YUVhigh = buffer->image_height;
cal::details::extensions_.extEncodeCreateSession_((CALcontext)as_amd(context), 0, CAL_VID_encode_AVC_FULL, encode_profile_level,
CAL_VID_PICTURE_NV12, YUVwidth, YUVhigh, frameRate, CAL_VID_ENCODE_JOB_PRIORITY_LEVEL1);
#endif
amd::VideoSession* video_session = new amd::VideoSession(
*as_amd(context), *as_amd(device), queue, flags, config_buffer_type,
config_buffer_size, config_buffer);
if (!video_session)
{
queue->release();
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
LogWarning("not enough host memory");
return (cl_video_session_amd) 0;
}
return as_cl<amd::VideoSession>(video_session);
}
RUNTIME_EXIT
RUNTIME_ENTRY(cl_int, clDestroyVideoEncSessionAMD,
(cl_video_session_amd video_session))
{
if (!is_valid(video_session)) {
LogWarning("invalid parameter \"video_session\"");
return CL_INVALID_VIDEO_SESSION_AMD;
}
cl_int errcode_ret = CL_SUCCESS;
amd::VideoSession* session = as_amd(video_session);
amd::Command::EventWaitList eventWaitList;
cl_int err = amd::clSetEventWaitList(eventWaitList,
session->context(), 0, NULL);
amd::Command* command = new amd::SetVideoSessionCommand(
session->queue(), eventWaitList,
amd::SetVideoSessionCommand::CloseSession, NULL);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
command->release();
session->queue().finish();
session->release();
return errcode_ret;
}
RUNTIME_EXIT
/*! \brief Increments the video session reference count.
*
* \param video_session is a valid OpenCL Video Session.
*
* \return CL_SUCCESS if the function executes successfully;
* Otherwise an error code is returned:
* - CL_INVALID_VIDEO_SESSION_AMD if video_session is not a valid
* video session;
*
* \version 1.1r25
*/
RUNTIME_ENTRY(cl_int, clRetainVideoSessionAMD,
(cl_video_session_amd video_session))
{
if (!is_valid(video_session)) {
LogWarning("invalid parameter \"video_session\"");
return CL_INVALID_VIDEO_SESSION_AMD;
}
as_amd(video_session)->retain();
return CL_SUCCESS;
}
RUNTIME_EXIT
/*! \brief Decrements the video session reference count.
*
* \param video_session is a valid OpenCL Video Session.
*
* \return CL_SUCCESS if the function executes successfully;
* Otherwise an error code is returned:
* - CL_INVALID_VIDEO_SESSION_AMD if video_session is not a valid
* video session;
*
* \version 1.1r25
*/
RUNTIME_ENTRY(cl_int, clReleaseVideoSessionAMD,
(cl_video_session_amd video_session))
{
if (!is_valid(video_session)) {
LogWarning("invalid parameter \"video_session\"");
return CL_INVALID_VIDEO_SESSION_AMD;
}
as_amd(video_session)->release();
return CL_SUCCESS;
}
RUNTIME_EXIT
/*! \brief Queries the configuration of a specific video session.
*
* \param video_session is a valid OpenCL Video Session.
*
* \param config_buffer_type is an enumeration constant that identifies the type
* of the configuration buffer. It can be one of the following values:
* - CL_VIDEO_DECODE_CONFIGURATION_AMD - The buffer contains decoder configuration,
* according to the cl_video_decode_desc_amd structure definition.
*
* \param config_buffer_size is a pointer to size of config_buffer in bytes.
* The implementation returns the size of the config_buffer in this argument.
*
* \param config_buffer is a pointer to a configuration buffer. The
* implementation writes the configuration query data into this
* buffer. If this pointer is NULL, it is ignored (which enables the
* application to query the required buffer size for this configuration type).
*
* \returns CL_SUCCESS if the video session configuration was set properly;
* Otherwise an appropriate error code is returned:
* - CL_INVALID_VIDEO_SESSION_AMD if video_session is not a valid video session;
* - CL_INVALID_VIDEO_CONFIG_TYPE_AMD if config_buffer_type is NULL or contains a
* configuration type which is not supported by the specific implementation;
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required
* by the runtime.
*
* \version 1.1r25
*/
RUNTIME_ENTRY(cl_int, clGetVideoSessionInfoAMD, (
cl_video_session_amd video_session,
cl_video_session_info_amd param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret))
{
if (!is_valid(video_session)) {
LogWarning("invalid parameter \"video_session\"");
return CL_INVALID_VIDEO_SESSION_AMD;
}
//switch(config_buffer_type) {
//case CL_VIDEO_DECODE_CONFIGURATION_AMD:
// break;
//default:
// return CL_INVALID_VIDEO_CONFIG_TYPE_AMD;
//}
/*
return amd::clGetVideoSessionInfoAMD(*as_amd(video_session),
config_buffer_type, config_buffer_size, config_buffer);
*/
return CL_INVALID_VALUE;
// return CL_SUCCESS;
}
RUNTIME_EXIT
/*! \brief Queries the configuration of a specific video session.
*
* \param video_session is a valid OpenCL Video Session.
*
* \param config_buffer_type is an enumeration constant that identifies the type
* of the configuration buffer. It can be one of the following values:
* - CL_VIDEO_ENCODE_CONFIGURATION_AMD - The buffer contains encoder configuration,
* according to the cl_video_decode_desc_amd structure definition.
*
* \param config_buffer_size is a pointer to size of config_buffer in bytes.
* The implementation returns the size of the config_buffer in this argument.
*
* \param config_buffer is a pointer to a configuration buffer. The
* implementation writes the configuration query data into this
* buffer. If this pointer is NULL, it is ignored (which enables the
* application to query the required buffer size for this configuration type).
*
* \returns CL_SUCCESS if the video session configuration was set properly;
* Otherwise an appropriate error code is returned:
* - CL_INVALID_VIDEO_SESSION_AMD if video_session is not a valid video session;
* - CL_INVALID_VIDEO_CONFIG_TYPE_AMD if config_buffer_type is NULL or contains a
* configuration type which is not supported by the specific implementation;
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required
* by the runtime.
*
* \version 1.1r25
*/
RUNTIME_ENTRY(cl_int, clGetVideoSessionEncInfoAMD, (
cl_video_session_amd video_session,
cl_video_session_enc_info_amd param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret))
{
cl_uint errcode_ret = CL_SUCCESS;
if (!is_valid(video_session)) {
LogWarning("invalid parameter \"video_session\"");
return CL_INVALID_VIDEO_SESSION_AMD;
}
amd::VideoSession& session = *as_amd(video_session);
amd::Command::EventWaitList eventWaitList;
cl_int err = amd::clSetEventWaitList(eventWaitList, session.context(), 0, NULL);
amd::Command* command = NULL;
switch(param_name) {
case CL_CONFIG_TYPE_PICTURE_CONTROL :
command = new amd::SetVideoSessionCommand(
session.queue(), eventWaitList,
amd::SetVideoSessionCommand::ConfigTypePictureControl, param_value);
break;
case CL_CONFIG_TYPE_RATE_CONTROL :
command = new amd::SetVideoSessionCommand(
session.queue(), eventWaitList,
amd::SetVideoSessionCommand::ConfigTypeRateControl, param_value);
break;
case CL_CONFIG_TYPE_MOTION_ESTIMATION :
command = new amd::SetVideoSessionCommand(
session.queue(), eventWaitList,
amd::SetVideoSessionCommand::ConfigTypeMotionEstimation, param_value);
break;
case CL_CONFIG_TYPE_RDO :
command = new amd::SetVideoSessionCommand(
session.queue(), eventWaitList,
amd::SetVideoSessionCommand::ConfigTypeRDO, param_value);
break;
default:
errcode_ret = CL_INVALID_VIDEO_CONFIG_TYPE_AMD;
break;
}
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
command->release();
session.queue().finish();
* param_value_size_ret = sizeof(param_value);
return errcode_ret;
}
RUNTIME_EXIT
RUNTIME_ENTRY(cl_int, clSendEncodeConfigInfoAMD, (
cl_video_session_amd video_session,
size_t numBuffers,
void* pConfigBuffers))
{
cl_uint errcode_ret = CL_SUCCESS;
if (!is_valid(video_session)) {
LogWarning("invalid parameter \"video_session\"");
return CL_INVALID_VIDEO_SESSION_AMD;
}
amd::VideoSession& session = *as_amd(video_session);
amd::Command::EventWaitList eventWaitList;
cl_int err = amd::clSetEventWaitList(eventWaitList, session.context(), 0, NULL);
amd::Command* command = new amd::SetVideoSessionCommand(
session.queue(), eventWaitList,
amd::SetVideoSessionCommand::SendEncodeConfig, pConfigBuffers, numBuffers);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
command->release();
session.queue().finish();
return errcode_ret;
}
RUNTIME_EXIT
/*! \brief Enqueues execution of a decode/encode command on UVD unit of the device
* specified at creation of video session.
*
* \param video_session is a valid OpenCL video session.
*
* \param video_data_structure is a valid pointer to a structure
* containing control and video stream data for decoding/encoding.
*
* \param config_buffer_size is a pointer to size of config_buffer in bytes.
* The implementation returns the size of the config_buffer in this argument.
*
* \param event_wait_list and \param num_events_in_wait_list specify events
* that need to complete before this particular command can be executed.
*
* \param event returns an event object that identifies this particular
* video program execution instance.
*
* \returns CL_SUCCESS if the video program execution was
* successfully passed to the CAL for execution and CAL returned CAL_RESULT_OK.
* Otherwise, it returnes one of the following errors:
*
* - CL_INVALID_VIDEO_SESSION_AMD if the parameter video_session is not
* a valid video session object returned by a call to function
* clCreateVideoSessionAMD;
* - CL_IVALID_VIDEO_DATA_AMD if pointer video_data_struct is NULL, points
* to invalid memory, or any of the pointers/objects provided in the
* video_data_structure is NULL or invalid;
* - CL_INVALID_CONTEXT if context associated with video_session is not
* the same as context associated with event_wait_list;
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and
* num_events_in_wait_list > 0, or event_wait_list is not NULL and
* num_events_in_wait_list is 0, or if event objects in event_wait_list
* are not valid events;
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
* required by the Open CL implementation on the host.
*
* \version 1.1r33
*/
RUNTIME_ENTRY(cl_int, clEnqueueRunVideoProgramAMD, (
cl_video_session_amd video_session,
void* video_data,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event))
{
if (!is_valid(video_session)) {
LogWarning("invalid parameter \"video_session\"");
return CL_INVALID_VIDEO_SESSION_AMD;
}
cl_int errcode = CL_SUCCESS;
amd::VideoSession& session = *as_amd(video_session);
switch(session.type()) {
case CL_VIDEO_DECODE_CONFIGURATION_AMD:
errcode = amd::clEnqueueVideoDecodeAMD(session,
(cl_video_decode_data_amd*) video_data,
num_events_in_wait_list, event_wait_list, event);
break;
case CL_VIDEO_ENCODE_CONFIGURATION_AMD:
errcode = amd::clEnqueueVideoEncodeAMD(session,
(cl_video_encode_data_amd*) video_data,
num_events_in_wait_list, event_wait_list, event);
break;
default:
errcode = CL_INVALID_VIDEO_CONFIG_TYPE_AMD;
}
return errcode;
}
RUNTIME_EXIT
RUNTIME_ENTRY(cl_int, clEncodeGetDeviceCapAMD, (
cl_device_id device_id,
cl_uint encode_mode,
cl_uint encode_cap_total_size,
cl_uint *num_encode_cap,
void *pEncodeCAP))
{
// Make sure the device supports Open Video extensions
amd::Device* device = as_amd(device_id);
if (!device->info().openVideo_) {
return CL_DEVICE_NOT_FOUND;
}
// amd::VideoSession& session = *as_amd(video_session);
amd::Command::EventWaitList eventWaitList;
cl_int err = amd::clSetEventWaitList(eventWaitList, staticQueue->context(), 0, NULL);
amd::Command* command = new amd::SetVideoSessionCommand(
*staticQueue, eventWaitList,
amd::SetVideoSessionCommand::GetDeviceCapVCE, pEncodeCAP, encode_cap_total_size);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
command->release();
staticQueue->finish();
return CL_SUCCESS;
}
RUNTIME_EXIT
#if 1
RUNTIME_ENTRY(cl_int, clEncodePictureAMD, (
cl_video_session_amd video_session,
cl_uint number_of_encode_task_input_buffers,
void* encode_task_input_buffer_list,
void* picture_parameter,
cl_uint* pTaskID))
{
cl_uint errcode_ret = CL_SUCCESS;
if (!is_valid(video_session)) {
LogWarning("invalid parameter \"video_session\"");
return CL_INVALID_VIDEO_SESSION_AMD;
}
return errcode_ret;
}
RUNTIME_EXIT
#endif
RUNTIME_ENTRY(cl_int, clEncodeQueryTaskDescriptionAMD, (
cl_video_session_amd video_session,
cl_uint num_of_task_description_request,
cl_uint* num_of_task_description_return,
void * task_description_list))
{
cl_uint errcode_ret = CL_SUCCESS;
if (!is_valid(video_session)) {
LogWarning("invalid parameter \"video_session\"");
return CL_INVALID_VIDEO_SESSION_AMD;
}
amd::VideoSession& session = *as_amd(video_session);
amd::Command::EventWaitList eventWaitList;
cl_int err = amd::clSetEventWaitList(eventWaitList, session.context(), 0, NULL);
amd::Command* command = new amd::SetVideoSessionCommand(
session.queue(), eventWaitList,
amd::SetVideoSessionCommand::EncodeQueryTaskDescription,
num_of_task_description_request, task_description_list, num_of_task_description_return);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
command->release();
session.queue().finish();
return errcode_ret;
}
RUNTIME_EXIT
RUNTIME_ENTRY(cl_int, clEncodeReleaseOutputResourceAMD, (
cl_video_session_amd video_session,
cl_uint task_id))
{
cl_uint errcode_ret = CL_SUCCESS;
if (!is_valid(video_session)) {
LogWarning("invalid parameter \"video_session\"");
return CL_INVALID_VIDEO_SESSION_AMD;
}
amd::VideoSession& session = *as_amd(video_session);
amd::Command::EventWaitList eventWaitList;
cl_int err = amd::clSetEventWaitList(eventWaitList, session.context(), 0, NULL);
amd::Command* command = new amd::SetVideoSessionCommand(
session.queue(), eventWaitList,
amd::SetVideoSessionCommand::ReleaseOutputResource,
NULL, task_id);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
command->release();
session.queue().finish();
return errcode_ret;
}
RUNTIME_EXIT
namespace amd {
cl_int
clEnqueueVideoDecodeAMD(VideoSession& session,
cl_video_decode_data_amd* data,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event)
{
if ((NULL == data) || (data->video_type.type != CL_VIDEO_DECODE)) {
return CL_INVALID_OPERATION;
}
if (!is_valid(data->output_surface)) {
return CL_INVALID_MEM_OBJECT;
}
amd::Command::EventWaitList eventWaitList;
cl_int errcode = amd::clSetEventWaitList(eventWaitList,
session.context(), num_events_in_wait_list, event_wait_list);
if (errcode != CL_SUCCESS){
return errcode;
}
//! Now create command and enqueue
amd::RunVideoProgramCommand* command =
new amd::RunVideoProgramCommand(session.queue(),
eventWaitList, data, *as_amd(data->output_surface),
CL_COMMAND_VIDEO_DECODE_AMD);
if (command == NULL) {
LogError("Cannot create new RunVideoProgramCommand");
return CL_OUT_OF_HOST_MEMORY;
}
// Make sure we have memory for the command execution
if (!command->validateMemory()) {
delete command;
return CL_MEM_OBJECT_ALLOCATION_FAILURE;
}
command->enqueue();
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
}
cl_int
clEnqueueVideoEncodeAMD(VideoSession& session,
cl_video_encode_data_amd* data,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event)
{
if ((NULL == data) || (data->video_type.type != CL_VIDEO_ENCODE)) {
return CL_INVALID_OPERATION;
}
CAL_VID_BUFFER_DESCRIPTION *bufferList =
reinterpret_cast<CAL_VID_BUFFER_DESCRIPTION *>(data->pictureParam1);
cl_mem memory = static_cast<cl_mem>(bufferList[0].buffer.pPicture);
if (!is_valid(memory)) {
return CL_INVALID_MEM_OBJECT;
}
// Start up the event queue
amd::Command::EventWaitList eventWaitList;
cl_int errcode = amd::clSetEventWaitList(eventWaitList,
session.context(), num_events_in_wait_list, event_wait_list);
if (errcode != CL_SUCCESS){
return errcode;
}
//! Now create command and enqueue
amd::RunVideoProgramCommand* command =
new amd::RunVideoProgramCommand(session.queue(),
eventWaitList, data, *as_amd(memory),
CL_COMMAND_VIDEO_ENCODE_AMD);
if (command == NULL) {
LogError("Cannot create new RunVideoProgramCommand");
return CL_OUT_OF_HOST_MEMORY;
}
// Make sure we have memory for the command execution
if (!command->validateMemory()) {
delete command;
return CL_MEM_OBJECT_ALLOCATION_FAILURE;
}
// Issue the command via the queue system.
command->enqueue();
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
}
} // namespace amd
#endif // cl_amd_video_session
-362
Ver Arquivo
@@ -1,362 +0,0 @@
/* ============================================================
Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use of this material is permitted under the following
conditions:
Redistributions must retain the above copyright notice and all terms of this
license.
In no event shall anyone redistributing or accessing or using this material
commence or participate in any arbitration or legal action relating to this
material against Advanced Micro Devices, Inc. or any copyright holders or
contributors. The foregoing shall survive any expiration or termination of
this license or any agreement or access or use related to this material.
ANY BREACH OF ANY TERM OF THIS LICENSE SHALL RESULT IN THE IMMEDIATE REVOCATION
OF ALL RIGHTS TO REDISTRIBUTE, ACCESS OR USE THIS MATERIAL.
THIS MATERIAL IS PROVIDED BY ADVANCED MICRO DEVICES, INC. AND ANY COPYRIGHT
HOLDERS AND CONTRIBUTORS "AS IS" IN ITS CURRENT CONDITION AND WITHOUT ANY
REPRESENTATIONS, GUARANTEE, OR WARRANTY OF ANY KIND OR IN ANY WAY RELATED TO
SUPPORT, INDEMNITY, ERROR FREE OR UNINTERRUPTED OPERATION, OR THAT IT IS FREE
FROM DEFECTS OR VIRUSES. ALL OBLIGATIONS ARE HEREBY DISCLAIMED - WHETHER
EXPRESS, IMPLIED, OR STATUTORY - INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
ACCURACY, COMPLETENESS, OPERABILITY, QUALITY OF SERVICE, OR NON-INFRINGEMENT.
IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. OR ANY COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, REVENUE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED OR BASED ON ANY THEORY OF LIABILITY
ARISING IN ANY WAY RELATED TO THIS MATERIAL, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE. THE ENTIRE AND AGGREGATE LIABILITY OF ADVANCED MICRO DEVICES,
INC. AND ANY COPYRIGHT HOLDERS AND CONTRIBUTORS SHALL NOT EXCEED TEN DOLLARS
(US $10.00). ANYONE REDISTRIBUTING OR ACCESSING OR USING THIS MATERIAL ACCEPTS
THIS ALLOCATION OF RISK AND AGREES TO RELEASE ADVANCED MICRO DEVICES, INC. AND
ANY COPYRIGHT HOLDERS AND CONTRIBUTORS FROM ANY AND ALL LIABILITIES,
OBLIGATIONS, CLAIMS, OR DEMANDS IN EXCESS OF TEN DOLLARS (US $10.00). THE
FOREGOING ARE ESSENTIAL TERMS OF THIS LICENSE AND, IF ANY OF THESE TERMS ARE
CONSTRUED AS UNENFORCEABLE, FAIL IN ESSENTIAL PURPOSE, OR BECOME VOID OR
DETRIMENTAL TO ADVANCED MICRO DEVICES, INC. OR ANY COPYRIGHT HOLDERS OR
CONTRIBUTORS FOR ANY REASON, THEN ALL RIGHTS TO REDISTRIBUTE, ACCESS OR USE
THIS MATERIAL SHALL TERMINATE IMMEDIATELY. MOREOVER, THE FOREGOING SHALL
SURVIVE ANY EXPIRATION OR TERMINATION OF THIS LICENSE OR ANY AGREEMENT OR
ACCESS OR USE RELATED TO THIS MATERIAL.
NOTICE IS HEREBY PROVIDED, AND BY REDISTRIBUTING OR ACCESSING OR USING THIS
MATERIAL SUCH NOTICE IS ACKNOWLEDGED, THAT THIS MATERIAL MAY BE SUBJECT TO
RESTRICTIONS UNDER THE LAWS AND REGULATIONS OF THE UNITED STATES OR OTHER
COUNTRIES, WHICH INCLUDE BUT ARE NOT LIMITED TO, U.S. EXPORT CONTROL LAWS SUCH
AS THE EXPORT ADMINISTRATION REGULATIONS AND NATIONAL SECURITY CONTROLS AS
DEFINED THEREUNDER, AS WELL AS STATE DEPARTMENT CONTROLS UNDER THE U.S.
MUNITIONS LIST. THIS MATERIAL MAY NOT BE USED, RELEASED, TRANSFERRED, IMPORTED,
EXPORTED AND/OR RE-EXPORTED IN ANY MANNER PROHIBITED UNDER ANY APPLICABLE LAWS,
INCLUDING U.S. EXPORT CONTROL LAWS REGARDING SPECIFICALLY DESIGNATED PERSONS,
COUNTRIES AND NATIONALS OF COUNTRIES SUBJECT TO NATIONAL SECURITY CONTROLS.
MOREOVER, THE FOREGOING SHALL SURVIVE ANY EXPIRATION OR TERMINATION OF ANY
LICENSE OR AGREEMENT OR ACCESS OR USE RELATED TO THIS MATERIAL.
NOTICE REGARDING THE U.S. GOVERNMENT AND DOD AGENCIES: This material is
provided with "RESTRICTED RIGHTS" and/or "LIMITED RIGHTS" as applicable to
computer software and technical data, respectively. Use, duplication,
distribution or disclosure by the U.S. Government and/or DOD agencies is
subject to the full extent of restrictions in all applicable regulations,
including those found at FAR52.227 and DFARS252.227 et seq. and any successor
regulations thereof. Use of this material by the U.S. Government and/or DOD
agencies is acknowledgment of the proprietary rights of any copyright holders
and contributors, including those of Advanced Micro Devices, Inc., as well as
the provisions of FAR52.227-14 through 23 regarding privately developed and/or
commercial computer software.
This license forms the entire agreement regarding the subject matter hereof and
supersedes all proposals and prior discussions and writings between the parties
with respect thereto. This license does not affect any ownership, rights, title,
or interest in, or relating to, this material. No terms of this license can be
modified or waived, and no breach of this license can be excused, unless done
so in a writing signed by all affected parties. Each term of this license is
separately enforceable. If any term of this license is determined to be or
becomes unenforceable or illegal, such term shall be reformed to the minimum
extent necessary in order for this license to remain in effect in accordance
with its terms as modified by such reformation. This license shall be governed
by and construed in accordance with the laws of the State of Texas without
regard to rules on conflicts of law of any state or jurisdiction or the United
Nations Convention on the International Sale of Goods. All disputes arising out
of this license shall be subject to the jurisdiction of the federal and state
courts in Austin, Texas, and all defenses are hereby waived concerning personal
jurisdiction and venue of these courts.
============================================================ */
#ifndef __CL_OPEN_VIDEO_AMD_H
#define __CL_OPEN_VIDEO_AMD_H
/******************************************
* Private AMD extension cl_amd_open_video *
******************************************/
#define cl_amd_open_video 0
#if cl_amd_open_video
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* cl_device_info*/
#define CL_DEVICE_MAX_VIDEO_SESSIONS_AMD 0x10010
#define CL_DEVICE_NUM_VIDEO_ATTRIBS_AMD 0x10011
#define CL_DEVICE_VIDEO_ATTRIBS_AMD 0x10012
#define CL_DEVICE_VIDEO_ATTRIBS_ENC_AMD 0x10014
#define CL_DEVICE_MAX_VIDEO_ENC_SESSIONS_AMD 0x10015
#define CL_DEVICE_NUM_VIDEO_ENC_ATTRIBS_AMD 0x10016
/* cl_video_session_flags_amd */
typedef cl_bitfield cl_video_session_flags_amd;
/* cl_video_config_type_amd enumeration */
//
// Open Encode Porting TBD check if the 0x4101 enum. that will result is OK
//
/* cl_video_config_type_amd enumeration */
typedef enum _cl_video_config_type_amd {
CL_VIDEO_DECODE_CONFIGURATION_AMD = 0x4100,
CL_VIDEO_ENCODE_CONFIGURATION_AMD = 0x4101
} cl_video_config_type_amd;
/* cl_video_session_info_amd enumeration */
typedef enum _cl_video_session_info_amd {
CL_VIDEO_SESSION_CONFIG_SIZE_AMD = 0x10013,
CL_VIDEO_SESSION_CONFIG_TYPE_AMD,
CL_VIDEO_SESSION_CONFIG_BUDDEF_AMD
} cl_video_session_info_amd;
typedef enum _cl_video_session_enc_info_amd {
CL_CONFIG_TYPE_NONE = 0,
CL_CONFIG_TYPE_PICTURE_CONTROL = 1,
CL_CONFIG_TYPE_RATE_CONTROL = 2,
CL_CONFIG_TYPE_MOTION_ESTIMATION = 3,
CL_CONFIG_TYPE_RDO = 4
} cl_video_session_enc_info_amd;
/* cl_amd_open_video typedefs */
typedef struct _cl_video_session_amd* cl_video_session_amd;
//typedef cl_bitfield cl_video_session_flags_amd;
/* cl_video_decode_profile_amd enumeration */
typedef enum _cl_video_decode_profile_amd
{
CL_VIDEO_DECODE_PROFILE_H264_BASELINE_AMD = 1,
CL_VIDEO_DECODE_PROFILE_H264_MAIN_AMD,
CL_VIDEO_DECODE_PROFILE_H264_HIGH_AMD,
CL_VIDEO_DECODE_PROFILE_VC1_SIMPLE_AMD,
CL_VIDEO_DECODE_PROFILE_VC1_MAIN_AMD,
CL_VIDEO_DECODE_PROFILE_VC1_ADVANCED_AMD,
CL_VIDEO_DECODE_PROFILE_MPEG2_VLD_AMD,
} cl_video_decode_profile_amd;
//
// Open Encode ported for encode
//
/* cl_video_encode_profile_amd enumeration */
typedef enum _cl_video_encode_profile_amd
{
CL_VIDEO_ENCODE_PROFILE_H264_BASELINE_AMD = 1,
CL_VIDEO_ENCODE_PROFILE_H264_MAIN_AMD,
CL_VIDEO_ENCODE_PROFILE_H264_HIGH_AMD,
} cl_video_encode_profile_amd;
/* cl_video_format_amd enumeration */
typedef enum _cl_video_format_amd
{
CL_VIDEO_NV12_INTERLEAVED_AMD = 1,
CL_VIDEO_YV12_INTERLEAVED_AMD
} cl_video_format_amd;
/* cl_video_attrib_amd */
typedef struct _cl_video_attrib_amd {
cl_video_decode_profile_amd profile;
cl_video_format_amd format;
} cl_video_attrib_amd;
/* cl_video_decode_desc_amd */
typedef struct _cl_video_decode_desc_amd {
cl_video_attrib_amd attrib;
size_t image_width;
size_t image_height;
} cl_video_decode_desc_amd;
//
// Open Encode ported
//
/* cl_video_attrib_amd */
typedef struct _cl_video_attrib_encode_amd {
cl_video_encode_profile_amd codec_profile;
cl_uint profile;
cl_uint level;
cl_video_format_amd format;
} cl_video_attrib_encode_amd;
/* cl_video_encode_desc_amd */
typedef struct _cl_video_encode_desc_amd {
cl_video_attrib_encode_amd attrib;
size_t image_width;
size_t image_height;
cl_uint priority;
cl_uint encodeMode;
cl_uint frameRateNumerator;
cl_uint frameRateDenominator;
void * calVideoProperties;
} cl_video_encode_desc_amd;
/* cl_video_program_type_amd enumeration*/
typedef enum _cl_video_program_type_amd
{
CL_VIDEO_DECODE = 1,
CL_VIDEO_ENCODE = 2,
} cl_video_program_type_amd;
/* cl_video_program_data_amd */
typedef struct _cl_video_program_data_amd {
cl_uint size;
cl_video_program_type_amd type;
cl_uint flags;
} cl_video_program_data_amd;
/* cl_video_decode_data_amd */
typedef struct _cl_video_decode_data_amd {
cl_video_program_data_amd video_type;
cl_mem output_surface;
void* picture_parameter_1;
void* picture_parameter_2;
cl_uint picture_parameter_2_size;
void* bitstream_data;
cl_uint bitstream_data_size;
void* slice_data_control;
cl_uint slice_data_control_size;
} cl_video_decode_data_amd;
/* cl_video_encode_data_amd */
typedef struct _cl_video_encode_data_amd {
cl_video_program_data_amd video_type;
cl_uint pictureParam1Size;
cl_uint pictureParam2Size;
void* pictureParam1;
void* pictureParam2;
cl_uint uiTaskID;
} cl_video_encode_data_amd;
/* cl_command_type */
#define CL_COMMAND_VIDEO_DECODE_AMD 0x4101
#define CL_COMMAND_VIDEO_ENCODE_AMD 0x4102
#define CL_COMMAND_VIDEO_QUERY_TASK_AMD 0x4103
/* cl_amd_open_video error codes */
#define CL_INVALID_VIDEO_SESSION_FLAGS_AMD -1100
#define CL_INVALID_VIDEO_SESSION_AMD -1101
#define CL_INVALID_VIDEO_CONFIG_TYPE_AMD -1102
#define CL_INVALID_VIDEO_CONFIG_BUFFER_AMD -1103
#define CL_INVALID_VIDEO_DATA_AMD -1104
/* cl_video_session_flags_amd - bitfield */
#define CL_VIDEO_DECODE_ACCELERATION_AMD (1<<0)
// Open Encode ported
#define CL_VIDEO_ENCODE_ACCELERATION_AMD (1<<0)
// /* cl_video_session_info_amd enumeration */
//typedef enum _cl_video_session_info_amd {
// CL_VIDEO_SESSION_CONFIG_SIZE_AMD = 0x10012,
// CL_VIDEO_SESSION_CONFIG_TYPE_AMD,
// CL_VIDEO_SESSION_CONFIG_BUDDEF_AMD
//} cl_video_session_info_amd;
typedef CL_API_ENTRY cl_video_session_amd (CL_API_CALL* clCreateVideoSessionAMD_fn)(
cl_context /* context */,
cl_device_id /* device */,
cl_video_session_flags_amd /* flags */,
cl_video_config_type_amd /* config_buffer_type */,
cl_uint /* config_buffer_size */,
void* /* config_buffer */,
cl_int* /* errcode_ret */);
// Open Encode Changes add Enc CreateSession
typedef CL_API_ENTRY cl_video_session_amd (CL_API_CALL* clCreateVideoEncSessionAMD_fn)(
cl_context /* context */,
cl_device_id /* device */,
cl_video_session_flags_amd /* flags */,
cl_video_config_type_amd /* config_buffer_type */,
cl_uint /* config_buffer_size */,
void* /* config_buffer */,
cl_int* /* errcode_ret */);
typedef CL_API_ENTRY cl_int (CL_API_CALL* clDestroyVideoEncSessionAMD_fn)(
cl_video_session_amd /*video_session*/);
// Open Encode Changes
typedef CL_API_ENTRY cl_int (CL_API_CALL* clRetainVideoSessionAMD_fn)(
cl_video_session_amd /* video_session */);
typedef CL_API_ENTRY cl_int (CL_API_CALL* clReleaseVideoSessionAMD_fn)(
cl_video_session_amd /* video_session*/);
typedef CL_API_ENTRY cl_int (CL_API_CALL* clGetVideoSessionInfoAMD_fn)(
cl_video_session_amd /* video_session */,
cl_video_session_info_amd /* param_name */,
size_t /* param_value_size */,
void* /* param_value */,
size_t* /* param_value_size_ret */);
typedef CL_API_ENTRY cl_int (CL_API_CALL* clGetVideoSessionEncInfoAMD_fn)(
cl_video_session_amd /* video_session */,
cl_video_session_enc_info_amd /* param_name */,
size_t /* param_value_size */,
void* /* param_value */,
size_t* /* param_value_size_ret */);
typedef CL_API_ENTRY cl_int (CL_API_CALL* clSendEncodeConfigInfoAMD_fn) (
cl_video_session_amd /* video_session */,
size_t /* numBuffers */,
void* /* pConfigBuffers */);
typedef CL_API_ENTRY cl_int (CL_API_CALL* clEnqueueRunVideoProgramAMD_fn)(
cl_video_session_amd /* video_session */,
void* /* video_data_struct */,
cl_uint /* num_events_in_wait_list */,
const cl_event* /* event_wait_list */,
cl_event* /* event*/);
typedef CL_API_ENTRY cl_int (CL_API_CALL* clEncodeGetDeviceCapAMD_fn)(
cl_device_id /* device_id */,
cl_uint /* encode_mode */,
cl_uint /* encode_cap_total_size */,
cl_uint* /* num_encode_cap */,
void* /* pEncodeCAP */);
typedef CL_API_ENTRY cl_int (CL_API_CALL* clEncodeQueryTaskDescriptionAMD_fn)(
cl_video_session_amd /* video_session */,
cl_uint /* num_of_task_description_request */,
cl_uint* /* num_of_task_description_return */,
void * /* task_description_list */
);
typedef CL_API_ENTRY cl_int (CL_API_CALL* clEncodeReleaseOutputResourceAMD_fn)(
cl_video_session_amd /* video_session */,
cl_uint /* task_id */
);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*cl_amd_open_video*/
#endif /*!__CL_OPEN_VIDEO_AMD_H*/