2222#include " VkCodecUtils/VulkanDeviceContext.h"
2323#include " VkCodecUtils/Helpers.h"
2424#include " VkVideoCore/VkVideoCoreProfile.h"
25+ #include " Logger.h"
2526
2627class VulkanVideoCapabilities
2728{
@@ -52,7 +53,7 @@ class VulkanVideoCapabilities
5253 VkResult result = GetVideoCapabilities (vkDevCtx, videoProfile, &videoCapabilities);
5354 assert (result == VK_SUCCESS);
5455 if (result != VK_SUCCESS) {
55- fprintf (stderr, " \n ERROR : Input is not supported. GetVideoCapabilities() result: 0x%x\n " , result);
56+ LOG_ERROR ( " ERROR : Input is not supported. GetVideoCapabilities() result: 0x%x\n " , result);
5657 }
5758 return result;
5859 }
@@ -76,7 +77,7 @@ class VulkanVideoCapabilities
7677 VkResult result = GetVideoCapabilities (vkDevCtx, videoProfile, &videoCapabilities);
7778 assert (result == VK_SUCCESS);
7879 if (result != VK_SUCCESS) {
79- fprintf (stderr, " \n ERROR : Input is not supported. GetVideoCapabilities() result: 0x%x\n " , result);
80+ LOG_ERROR ( " ERROR : Input is not supported. GetVideoCapabilities() result: 0x%x\n " , result);
8081 }
8182 return result;
8283 }
@@ -118,13 +119,13 @@ class VulkanVideoCapabilities
118119 pictureFormat = supportedOutFormats[0 ];
119120
120121 } else {
121- fprintf (stderr, " \n ERROR : Unsupported decode capability flags." );
122+ LOG_ERROR ( " ERROR : Unsupported decode capability flags." );
122123 return VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR;
123124 }
124125
125126 assert (result == VK_SUCCESS);
126127 if (result != VK_SUCCESS) {
127- fprintf (stderr, " \n ERROR : GetVideoFormats() result: 0x%x\n " , result);
128+ LOG_ERROR ( " ERROR : GetVideoFormats() result: 0x%x\n " , result);
128129 }
129130
130131 assert ((referencePicturesFormat != VK_FORMAT_UNDEFINED) && (pictureFormat != VK_FORMAT_UNDEFINED));
@@ -218,46 +219,45 @@ class VulkanVideoCapabilities
218219 return result;
219220 }
220221
221- if (dumpData) {
222- std::cout << " \t\t\t " << ((videoProfile.GetCodecType () == VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR) ? " h264" : " h265" ) << " decode capabilities: " << std::endl;
223222
224- if (pVideoCapabilities->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR) {
225- std::cout << " \t\t\t " << " Use separate reference images" << std::endl;
226- }
223+ LOG_S_ERROR << " \t\t\t " << videoProfile.CodecToName (videoProfile.GetCodecType ()) << " capabilities: " << std::endl;
227224
228- std::cout << " \t\t\t " << " minBitstreamBufferOffsetAlignment: " << pVideoCapabilities->minBitstreamBufferOffsetAlignment << std::endl;
229- std::cout << " \t\t\t " << " minBitstreamBufferSizeAlignment: " << pVideoCapabilities->minBitstreamBufferSizeAlignment << std::endl;
230- std::cout << " \t\t\t " << " pictureAccessGranularity: " << pVideoCapabilities->pictureAccessGranularity .width << " x " << pVideoCapabilities->pictureAccessGranularity .height << std::endl;
231- std::cout << " \t\t\t " << " minCodedExtent: " << pVideoCapabilities->minCodedExtent .width << " x " << pVideoCapabilities->minCodedExtent .height << std::endl;
232- std::cout << " \t\t\t " << " maxCodedExtent: " << pVideoCapabilities->maxCodedExtent .width << " x " << pVideoCapabilities->maxCodedExtent .height << std::endl;
233- std::cout << " \t\t\t " << " maxDpbSlots: " << pVideoCapabilities->maxDpbSlots << std::endl;
234- std::cout << " \t\t\t " << " maxActiveReferencePictures: " << pVideoCapabilities->maxActiveReferencePictures << std::endl;
235-
236- if (videoProfile.GetCodecType () == VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR) {
237- const VkVideoDecodeH264CapabilitiesKHR* pH264DecCapabilities = (VkVideoDecodeH264CapabilitiesKHR*)pVideoDecodeCapabilities->pNext ;
238- std::cout << " \t\t\t " << " maxLevelIdc: " << pH264DecCapabilities->maxLevelIdc << std::endl;
239- std::cout << " \t\t\t " << " fieldOffsetGranularity: " << pH264DecCapabilities->fieldOffsetGranularity .x << " x " << pH264DecCapabilities->fieldOffsetGranularity .y << std::endl;
240-
241- if (strncmp (pVideoCapabilities->stdHeaderVersion .extensionName ,
242- VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME,
243- sizeof (pVideoCapabilities->stdHeaderVersion .extensionName ) - 1U ) ||
244- (pVideoCapabilities->stdHeaderVersion .specVersion != VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION)) {
245- assert (!" Unsupported h.264 STD version" );
246- return VK_ERROR_INCOMPATIBLE_DRIVER;
247- }
248- } else if (videoProfile.GetCodecType () == VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR) {
249- const VkVideoDecodeH265CapabilitiesKHR* pH265DecCapabilities = (VkVideoDecodeH265CapabilitiesKHR*)pVideoDecodeCapabilities->pNext ;
250- std::cout << " \t\t\t " << " maxLevelIdc: " << pH265DecCapabilities->maxLevelIdc << std::endl;
251- if (strncmp (pVideoCapabilities->stdHeaderVersion .extensionName ,
252- VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME,
253- sizeof (pVideoCapabilities->stdHeaderVersion .extensionName ) - 1U ) ||
254- (pVideoCapabilities->stdHeaderVersion .specVersion != VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION)) {
255- assert (!" Unsupported h.265 STD version" );
256- return VK_ERROR_INCOMPATIBLE_DRIVER;
257- }
258- } else {
259- assert (!" Unsupported codec" );
225+ if (pVideoCapabilities->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR) {
226+ LOG_S_DEBUG << " \t\t\t " << " Use separate reference images" << std::endl;
227+ }
228+
229+ LOG_S_DEBUG << " \t\t\t " << " minBitstreamBufferOffsetAlignment: " << pVideoCapabilities->minBitstreamBufferOffsetAlignment << std::endl;
230+ LOG_S_DEBUG << " \t\t\t " << " minBitstreamBufferSizeAlignment: " << pVideoCapabilities->minBitstreamBufferSizeAlignment << std::endl;
231+ LOG_S_DEBUG << " \t\t\t " << " pictureAccessGranularity: " << pVideoCapabilities->pictureAccessGranularity .width << " x " << pVideoCapabilities->pictureAccessGranularity .height << std::endl;
232+ LOG_S_DEBUG << " \t\t\t " << " minCodedExtent: " << pVideoCapabilities->minCodedExtent .width << " x " << pVideoCapabilities->minCodedExtent .height << std::endl;
233+ LOG_S_DEBUG << " \t\t\t " << " maxCodedExtent: " << pVideoCapabilities->maxCodedExtent .width << " x " << pVideoCapabilities->maxCodedExtent .height << std::endl;
234+ LOG_S_DEBUG << " \t\t\t " << " maxDpbSlots: " << pVideoCapabilities->maxDpbSlots << std::endl;
235+ LOG_S_DEBUG << " \t\t\t " << " maxActiveReferencePictures: " << pVideoCapabilities->maxActiveReferencePictures << std::endl;
236+
237+ if (videoProfile.GetCodecType () == VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR) {
238+ const VkVideoDecodeH264CapabilitiesKHR* pH264DecCapabilities = (VkVideoDecodeH264CapabilitiesKHR*)pVideoDecodeCapabilities->pNext ;
239+ LOG_S_DEBUG << " \t\t\t " << " maxLevelIdc: " << pH264DecCapabilities->maxLevelIdc << std::endl;
240+ LOG_S_DEBUG << " \t\t\t " << " fieldOffsetGranularity: " << pH264DecCapabilities->fieldOffsetGranularity .x << " x " << pH264DecCapabilities->fieldOffsetGranularity .y << std::endl;
241+
242+ if (strncmp (pVideoCapabilities->stdHeaderVersion .extensionName ,
243+ VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME,
244+ sizeof (pVideoCapabilities->stdHeaderVersion .extensionName ) - 1U ) ||
245+ (pVideoCapabilities->stdHeaderVersion .specVersion != VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION)) {
246+ assert (!" Unsupported h.264 STD version" );
247+ return VK_ERROR_INCOMPATIBLE_DRIVER;
260248 }
249+ } else if (videoProfile.GetCodecType () == VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR) {
250+ const VkVideoDecodeH265CapabilitiesKHR* pH265DecCapabilities = (VkVideoDecodeH265CapabilitiesKHR*)pVideoDecodeCapabilities->pNext ;
251+ LOG_S_DEBUG << " \t\t\t " << " maxLevelIdc: " << pH265DecCapabilities->maxLevelIdc << std::endl;
252+ if (strncmp (pVideoCapabilities->stdHeaderVersion .extensionName ,
253+ VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME,
254+ sizeof (pVideoCapabilities->stdHeaderVersion .extensionName ) - 1U ) ||
255+ (pVideoCapabilities->stdHeaderVersion .specVersion != VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION)) {
256+ assert (!" Unsupported h.265 STD version" );
257+ return VK_ERROR_INCOMPATIBLE_DRIVER;
258+ }
259+ } else {
260+ assert (!" Unsupported codec" );
261261 }
262262
263263 return result;
@@ -300,11 +300,10 @@ class VulkanVideoCapabilities
300300
301301 result = vkDevCtx->GetPhysicalDeviceVideoFormatPropertiesKHR (vkDevCtx->getPhysicalDevice (), &videoFormatInfo, &supportedFormatCount, pSupportedFormats);
302302 assert (result == VK_SUCCESS);
303- if (dumpData) {
304- std::cout << " \t\t\t " << ((videoProfile.GetCodecType () == VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR) ? " h264" : " h265" ) << " decode formats: " << std::endl;
305- for (uint32_t fmt = 0 ; fmt < supportedFormatCount; fmt++) {
306- std::cout << " \t\t\t " << fmt << " : " << std::hex << pSupportedFormats[fmt].format << std::dec << std::endl;
307- }
303+
304+ LOG_S_DEBUG << " \t\t\t " << ((videoProfile.GetCodecType () == VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR) ? " h264" : " h265" ) << " decode formats: " << std::endl;
305+ for (uint32_t fmt = 0 ; fmt < supportedFormatCount; fmt++) {
306+ LOG_S_DEBUG << " \t\t\t " << fmt << " : " << std::hex << pSupportedFormats[fmt].format << std::dec << std::endl;
308307 }
309308
310309 formatCount = std::min (supportedFormatCount, formatCount);
0 commit comments