1 /* 2 * Copyright (C) 2018-2021 Intel Corporation 3 * 4 * SPDX-License-Identifier: MIT 5 * 6 */ 7 8 #include "opencl/source/accelerators/intel_motion_estimation.h" 9 10 namespace NEO { 11 validateVmeArgs(Context * context,cl_accelerator_type_intel typeId,size_t descriptorSize,const void * descriptor)12cl_int VmeAccelerator::validateVmeArgs(Context *context, 13 cl_accelerator_type_intel typeId, 14 size_t descriptorSize, 15 const void *descriptor) { 16 const cl_motion_estimation_desc_intel *descObj = 17 (const cl_motion_estimation_desc_intel *)descriptor; 18 19 DEBUG_BREAK_IF(!context); 20 DEBUG_BREAK_IF(typeId != CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL); 21 22 if ((descriptorSize != sizeof(cl_motion_estimation_desc_intel)) || 23 (descriptor == NULL)) { 24 return CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL; 25 } 26 27 switch (descObj->mb_block_type) { 28 case CL_ME_MB_TYPE_16x16_INTEL: 29 case CL_ME_MB_TYPE_8x8_INTEL: 30 case CL_ME_MB_TYPE_4x4_INTEL: 31 break; 32 default: 33 return CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL; 34 } 35 36 switch (descObj->subpixel_mode) { 37 case CL_ME_SUBPIXEL_MODE_INTEGER_INTEL: 38 case CL_ME_SUBPIXEL_MODE_HPEL_INTEL: 39 case CL_ME_SUBPIXEL_MODE_QPEL_INTEL: 40 break; 41 default: 42 return CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL; 43 } 44 45 switch (descObj->sad_adjust_mode) { 46 case CL_ME_SAD_ADJUST_MODE_NONE_INTEL: 47 case CL_ME_SAD_ADJUST_MODE_HAAR_INTEL: 48 break; 49 default: 50 return CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL; 51 } 52 53 switch (descObj->search_path_type) { 54 case CL_ME_SEARCH_PATH_RADIUS_2_2_INTEL: 55 case CL_ME_SEARCH_PATH_RADIUS_4_4_INTEL: 56 case CL_ME_SEARCH_PATH_RADIUS_16_12_INTEL: 57 break; 58 default: 59 return CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL; 60 } 61 62 return CL_SUCCESS; 63 } 64 } // namespace NEO 65