diff --git a/src/rocdecode/roc_decoder.cpp b/src/rocdecode/roc_decoder.cpp index d9df8f1412..e38effb18c 100644 --- a/src/rocdecode/roc_decoder.cpp +++ b/src/rocdecode/roc_decoder.cpp @@ -31,13 +31,13 @@ RocDecoder::RocDecoder(RocDecoderCreateInfo& decoder_create_info): va_video_deco if (hip_interop_[i].hip_mapped_device_mem != nullptr) { hipError_t hip_status = hipFree(hip_interop_[i].hip_mapped_device_mem); if (hip_status != hipSuccess) { - ERR("ERROR: hipFree failed for picture id " + TOSTR(i)); + ERR("hipFree failed for picture idx = " + TOSTR(i)); } } if (hip_interop_[i].hip_ext_mem != nullptr) { hipError_t hip_status = hipDestroyExternalMemory(hip_interop_[i].hip_ext_mem); if (hip_status != hipSuccess) { - ERR("ERROR: hipDestroyExternalMemory failed for picture id " + TOSTR(i)); + ERR("hipDestroyExternalMemory failed for picture idx = " + TOSTR(i)); } } } @@ -47,11 +47,11 @@ RocDecoder::RocDecoder(RocDecoderCreateInfo& decoder_create_info): va_video_deco rocDecStatus rocdec_status = ROCDEC_SUCCESS; rocdec_status = InitHIP(decoder_create_info_.device_id); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to initilize the HIP! with rocDecStatus# " + TOSTR(rocdec_status)); + ERR("Failed to initilize the HIP."); return rocdec_status; } if (decoder_create_info_.num_decode_surfaces < 1) { - ERR("ERROR: invalid number of decode surfaces "); + ERR("Invalid number of decode surfaces."); return ROCDEC_INVALID_PARAMETER; } hip_interop_.resize(decoder_create_info_.num_decode_surfaces); @@ -61,7 +61,7 @@ RocDecoder::RocDecoder(RocDecoderCreateInfo& decoder_create_info): va_video_deco rocdec_status = va_video_decoder_.InitializeDecoder(hip_dev_prop_.gcnArchName); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to initilize the VAAPI Video decoder! with rocDecStatus# " + TOSTR(rocdec_status)); + ERR("Failed to initilize the VAAPI Video decoder."); return rocdec_status; } @@ -72,7 +72,7 @@ rocDecStatus RocDecoder::DecodeFrame(RocdecPicParams *pic_params) { rocDecStatus rocdec_status = ROCDEC_SUCCESS; rocdec_status = va_video_decoder_.SubmitDecode(pic_params); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Decode submission is not successful! with rocDecStatus# " + TOSTR(rocdec_status)); + ERR("Decode submission is not successful."); } return rocdec_status; @@ -82,7 +82,7 @@ rocDecStatus RocDecoder::GetDecodeStatus(int pic_idx, RocdecDecodeStatus* decode rocDecStatus rocdec_status = ROCDEC_SUCCESS; rocdec_status = va_video_decoder_.GetDecodeStatus(pic_idx, decode_status); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to query the decode status! with rocDecStatus# " + TOSTR(rocdec_status)); + ERR("Failed to query the decode status."); } return rocdec_status; } @@ -95,13 +95,13 @@ rocDecStatus RocDecoder::ReconfigureDecoder(RocdecReconfigureDecoderInfo *reconf for (int pic_idx = 0; pic_idx < hip_interop_.size(); pic_idx++) { rocdec_status = ReleaseVideoFrame(pic_idx); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Unmapping the video frame for picture idx " + TOSTR(pic_idx) + " failed during reconfiguration!"); + ERR("Releasing the video frame for picture idx = " + TOSTR(pic_idx) + " failed during reconfiguration."); return rocdec_status; } } rocdec_status = va_video_decoder_.ReconfigureDecoder(reconfig_params); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Reconfiguration of the decoder failed with rocDecStatus# " + TOSTR(rocdec_status)); + ERR("Reconfiguration of the decoder failed."); return rocdec_status; } return rocdec_status; @@ -116,7 +116,7 @@ rocDecStatus RocDecoder::GetVideoFrame(int pic_idx, void *dev_mem_ptr[3], uint32 // wait on current surface to make sure that it is ready for the HIP interop rocdec_status = va_video_decoder_.SyncSurface(pic_idx); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to export surface for picture id = " + TOSTR(pic_idx)); + ERR("Failed to export surface for picture idx = " + TOSTR(pic_idx)); return rocdec_status; } @@ -128,7 +128,7 @@ rocDecStatus RocDecoder::GetVideoFrame(int pic_idx, void *dev_mem_ptr[3], uint32 rocdec_status = va_video_decoder_.ExportSurface(pic_idx, va_drm_prime_surface_desc); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to export surface for picture id" + TOSTR(pic_idx) + " , with rocDecStatus# " + TOSTR(rocdec_status)); + ERR("Failed to export surface for picture idx = " + TOSTR(pic_idx)); return rocdec_status; } @@ -191,7 +191,7 @@ rocDecStatus RocDecoder::ReleaseVideoFrame(int pic_idx) { rocDecStatus RocDecoder::InitHIP(int device_id) { CHECK_HIP(hipGetDeviceCount(&num_devices_)); if (num_devices_ < 1) { - ERR("ERROR: didn't find any GPU!"); + ERR("Didn't find any GPU."); return ROCDEC_DEVICE_INVALID; } CHECK_HIP(hipSetDevice(device_id)); diff --git a/src/rocdecode/vaapi/vaapi_videodecoder.cpp b/src/rocdecode/vaapi/vaapi_videodecoder.cpp index 5073dbf7c1..5a08d17605 100644 --- a/src/rocdecode/vaapi/vaapi_videodecoder.cpp +++ b/src/rocdecode/vaapi/vaapi_videodecoder.cpp @@ -34,26 +34,26 @@ VaapiVideoDecoder::~VaapiVideoDecoder() { rocDecStatus rocdec_status = ROCDEC_SUCCESS; rocdec_status = DestroyDataBuffers(); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: DestroyDataBuffers failed with status " + TOSTR(rocdec_status)); + ERR("DestroyDataBuffers failed"); } VAStatus va_status = VA_STATUS_SUCCESS; va_status = vaDestroySurfaces(va_display_, va_surface_ids_.data(), va_surface_ids_.size()); if (va_status != VA_STATUS_SUCCESS) { - ERR("ERROR: vaDestroySurfaces failed with status " + TOSTR(va_status)); + ERR("vaDestroySurfaces failed"); } if (va_context_id_) va_status = vaDestroyContext(va_display_, va_context_id_); if (va_status != VA_STATUS_SUCCESS) { - ERR("ERROR: vaDestroyContext failed with status " + TOSTR(va_status)); + ERR("vaDestroyContext failed"); } if (va_config_id_) va_status = vaDestroyConfig(va_display_, va_config_id_); if (va_status != VA_STATUS_SUCCESS) { - ERR("ERROR: vaDestroyConfig failed with status " + TOSTR(va_status)); + ERR("vaDestroyConfig failed"); } va_status = vaTerminate(va_display_); if (va_status != VA_STATUS_SUCCESS) { - ERR("ERROR: vaTerminate failed with status " + TOSTR(va_status)); + ERR("vaTerminate failed"); } } } @@ -65,7 +65,7 @@ rocDecStatus VaapiVideoDecoder::InitializeDecoder(std::string gcn_arch_name) { RocDecVcnCodecSpec& vcn_codec_spec = RocDecVcnCodecSpec::GetInstance(); if (!vcn_codec_spec.IsCodecConfigSupported(gcn_arch_name, decoder_create_info_.codec_type, decoder_create_info_.chroma_format, decoder_create_info_.bit_depth_minus_8, decoder_create_info_.output_format)) { - ERR("ERROR: the codec config combination is not supported!"); + ERR("The codec config combination is not supported."); return ROCDEC_NOT_SUPPORTED; } @@ -79,22 +79,22 @@ rocDecStatus VaapiVideoDecoder::InitializeDecoder(std::string gcn_arch_name) { std::string drm_node = "/dev/dri/renderD" + std::to_string(128 + decoder_create_info_.device_id * num_render_cards_per_device); rocdec_status = InitVAAPI(drm_node); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to initilize the VAAPI!" + TOSTR(rocdec_status)); + ERR("Failed to initilize the VAAPI."); return rocdec_status; } rocdec_status = CreateDecoderConfig(); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to create a VAAPI decoder configuration" + TOSTR(rocdec_status)); + ERR("Failed to create a VAAPI decoder configuration."); return rocdec_status; } rocdec_status = CreateSurfaces(); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to create VAAPI surfaces " + TOSTR(rocdec_status)); + ERR("Failed to create VAAPI surfaces."); return rocdec_status; } rocdec_status = CreateContext(); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to create a VAAPI context " + TOSTR(rocdec_status)); + ERR("Failed to create a VAAPI context."); return rocdec_status; } return rocdec_status; @@ -103,12 +103,12 @@ rocDecStatus VaapiVideoDecoder::InitializeDecoder(std::string gcn_arch_name) { rocDecStatus VaapiVideoDecoder::InitVAAPI(std::string drm_node) { drm_fd_ = open(drm_node.c_str(), O_RDWR); if (drm_fd_ < 0) { - ERR("ERROR: failed to open drm node " + drm_node); + ERR("Failed to open drm node." + drm_node); return ROCDEC_NOT_INITIALIZED; } va_display_ = vaGetDisplayDRM(drm_fd_); if (!va_display_) { - ERR("ERROR: failed to create va_display "); + ERR("Failed to create va_display."); return ROCDEC_NOT_INITIALIZED; } vaSetInfoCallback(va_display_, NULL, NULL); @@ -130,7 +130,7 @@ rocDecStatus VaapiVideoDecoder::CreateDecoderConfig() { va_profile_ = VAProfileH264Main; break; default: - ERR("ERROR: the codec type is not supported!"); + ERR("The codec type is not supported."); return ROCDEC_NOT_SUPPORTED; } va_config_attrib_.type = VAConfigAttribRTFormat; @@ -141,7 +141,7 @@ rocDecStatus VaapiVideoDecoder::CreateDecoderConfig() { rocDecStatus VaapiVideoDecoder::CreateSurfaces() { if (decoder_create_info_.num_decode_surfaces < 1) { - ERR("ERROR: invalid number of decode surfaces "); + ERR("Invalid number of decode surfaces."); return ROCDEC_INVALID_PARAMETER; } va_surface_ids_.resize(decoder_create_info_.num_decode_surfaces); @@ -160,7 +160,7 @@ rocDecStatus VaapiVideoDecoder::CreateSurfaces() { surface_format = VA_RT_FORMAT_YUV444; break; default: - ERR("ERROR: the surface type is not supported!"); + ERR("The surface type is not supported"); return ROCDEC_NOT_SUPPORTED; } @@ -236,7 +236,7 @@ rocDecStatus VaapiVideoDecoder::SubmitDecode(RocdecPicParams *pPicParams) { if ((pic_params_size != sizeof(VAPictureParameterBufferHEVC)) || (scaling_list_enabled && (iq_matrix_size != sizeof(VAIQMatrixBufferHEVC))) || (slice_params_size != sizeof(VASliceParameterBufferHEVC))) { - ERR("HEVC data_buffer parameter_size not matching vaapi parameter buffer size!"); + ERR("HEVC data_buffer parameter_size not matching vaapi parameter buffer size."); return ROCDEC_RUNTIME_ERROR; } break; @@ -264,21 +264,21 @@ rocDecStatus VaapiVideoDecoder::SubmitDecode(RocdecPicParams *pPicParams) { slice_params_size = sizeof(RocdecAvcSliceParams); if ((pic_params_size != sizeof(VAPictureParameterBufferH264)) || (iq_matrix_size != sizeof(VAIQMatrixBufferH264)) || (slice_params_size != sizeof(VASliceParameterBufferH264))) { - ERR("AVC data_buffer parameter_size not matching vaapi parameter buffer size!"); + ERR("AVC data_buffer parameter_size not matching vaapi parameter buffer size."); return ROCDEC_RUNTIME_ERROR; } break; } default: { - ERR("ERROR: the codec type is not supported!"); + ERR("The codec type is not supported."); return ROCDEC_NOT_SUPPORTED; } } rocDecStatus rocdec_status = DestroyDataBuffers(); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("Error: Failed to destroy VAAPI buffer"); + ERR("Failed to destroy VAAPI buffer."); return rocdec_status; } CHECK_VAAPI(vaCreateBuffer(va_display_, va_context_id_, VAPictureParameterBufferType, pic_params_size, 1, pic_params_ptr, &pic_params_buf_id_)); @@ -341,7 +341,7 @@ rocDecStatus VaapiVideoDecoder::ReconfigureDecoder(RocdecReconfigureDecoderInfo return ROCDEC_INVALID_PARAMETER; } if (va_display_ == 0) { - ERR("ERROR: VAAPI decoder has not been initialized but reconfiguration of the decoder has been requested!"); + ERR("VAAPI decoder has not been initialized but reconfiguration of the decoder has been requested."); return ROCDEC_NOT_SUPPORTED; } CHECK_VAAPI(vaDestroySurfaces(va_display_, va_surface_ids_.data(), va_surface_ids_.size())); @@ -356,12 +356,12 @@ rocDecStatus VaapiVideoDecoder::ReconfigureDecoder(RocdecReconfigureDecoderInfo rocDecStatus rocdec_status = CreateSurfaces(); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to create VAAPI surfaces during the decoder reconfiguration " + TOSTR(rocdec_status)); + ERR("Failed to create VAAPI surfaces during the decoder reconfiguration."); return rocdec_status; } rocdec_status = CreateContext(); if (rocdec_status != ROCDEC_SUCCESS) { - ERR("ERROR: Failed to create a VAAPI context during the decoder reconfiguration " + TOSTR(rocdec_status)); + ERR("Failed to create a VAAPI context during the decoder reconfiguration."); return rocdec_status; } return rocdec_status; @@ -383,7 +383,7 @@ rocDecStatus VaapiVideoDecoder::SyncSurface(int pic_idx) { if (va_status == 0x26 /*VA_STATUS_ERROR_TIMEDOUT*/) { CHECK_VAAPI(vaQuerySurfaceStatus(va_display_, va_surface_ids_[pic_idx], &surface_status)); } else { - std::cout << "VAAPI failure: vaSyncSurface() failed with error code: " << va_status << "', status: " << vaErrorStr(va_status) << "' at " << __FILE__ << ":" << __LINE__ << std::endl; + std::cout << "vaSyncSurface() failed with error code: 0x" << std::hex << va_status << std::dec << "', status: " << vaErrorStr(va_status) << "' at " << __FILE__ << ":" << __LINE__ << std::endl; return ROCDEC_RUNTIME_ERROR; } } else { diff --git a/src/rocdecode/vaapi/vaapi_videodecoder.h b/src/rocdecode/vaapi/vaapi_videodecoder.h index 5550242c51..e667125a23 100644 --- a/src/rocdecode/vaapi/vaapi_videodecoder.h +++ b/src/rocdecode/vaapi/vaapi_videodecoder.h @@ -37,7 +37,7 @@ THE SOFTWARE. #define CHECK_VAAPI(call) {\ VAStatus va_status = call;\ if (va_status != VA_STATUS_SUCCESS) {\ - std::cout << "VAAPI failure: " << #call << " failed with 'status: " << vaErrorStr(va_status) << "' at " << __FILE__ << ":" << __LINE__ << std::endl;\ + std::cout << "VAAPI failure: " << #call << " failed with status: " << std::hex << "0x" << va_status << std::dec << " = '" << vaErrorStr(va_status) << "' at " << __FILE__ << ":" << __LINE__ << std::endl;\ return ROCDEC_RUNTIME_ERROR;\ }\ } diff --git a/utils/rocvideodecode/roc_video_dec.h b/utils/rocvideodecode/roc_video_dec.h index d92f8c2334..472680bf84 100644 --- a/utils/rocvideodecode/roc_video_dec.h +++ b/utils/rocvideodecode/roc_video_dec.h @@ -98,7 +98,7 @@ private: rocDecStatus error_code = rocDecAPI; \ if( error_code != ROCDEC_SUCCESS) { \ std::ostringstream error_log; \ - error_log << #rocDecAPI << " returned err " << rocDecGetErrorName(error_code) << " at " <<__FILE__ <<":" << __LINE__;\ + error_log << #rocDecAPI << " returned " << rocDecGetErrorName(error_code) << " at " <<__FILE__ <<":" << __LINE__;\ ROCDEC_THROW(error_log.str(), error_code); \ } \ } while (0)