* rocDecode: Added several fixes to samples. (#668)

- Fixed the build error with videodecodepicfiles sample.
 - Added error handling of sample app command option combination of memory type OUT_SURFACE_MEM_NOT_MAPPED and MD5 generation.

[ROCm/rocdecode commit: c388518965]
Этот коммит содержится в:
Jeff Jiang
2025-11-04 21:12:56 -05:00
коммит произвёл GitHub
родитель 9f857d54f0
Коммит 8b86f61514
7 изменённых файлов: 28 добавлений и 5 удалений
+5
Просмотреть файл
@@ -10,6 +10,11 @@ Full documentation for rocDecode is available at [https://rocm.docs.amd.com/proj
### Added
* Logging control. Message output from the core components is now controlled by the logging level threshold, which can be set by an environment variable or other methods.
### Resolved issues
* Fixed the build error with videodecodepicfiles sample.
* Added error handling of sample app command option combination of memory type OUT_SURFACE_MEM_NOT_MAPPED and MD5 generation.
## rocDecode 1.4.0 for ROCm 7.1.0
### Added
+1 -1
Просмотреть файл
@@ -364,7 +364,7 @@ int main(int argc, char **argv) {
}
for (int i = 0; i < n_frame_returned; i++) {
pframe = viddec->GetFrame(&pts);
if (b_generate_md5) {
if (b_generate_md5 && pframe) {
md5_generator->UpdateMd5ForFrame(pframe, surf_info);
}
if (dump_output_frames && mem_type != OUT_SURFACE_MEM_NOT_MAPPED) {
+1 -1
Просмотреть файл
@@ -235,7 +235,7 @@ int main(int argc, char **argv) {
}
for (int i = 0; i < n_frame_returned; i++) {
pframe = viddec.GetFrame(&pts);
if (b_generate_md5) {
if (b_generate_md5 && pframe) {
md5_generator->UpdateMd5ForFrame(pframe, surf_info);
}
if (dump_output_frames && mem_type != OUT_SURFACE_MEM_NOT_MAPPED) {
+10 -1
Просмотреть файл
@@ -63,6 +63,7 @@ endif()
find_package(HIP QUIET)
find_package(rocdecode QUIET)
find_package(rocdecode-host 1.0.0 QUIET)
find_package(rocprofiler-register QUIET)
find_package(FFmpeg QUIET)
find_package(Threads REQUIRED)
@@ -85,13 +86,21 @@ if(HIP_FOUND AND FFMPEG_FOUND AND rocdecode_FOUND AND Threads_FOUND AND rocprofi
# sample app exe
list(APPEND SOURCES ${PROJECT_SOURCE_DIR} videodecodepicfiles.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../utils/rocvideodecode/roc_video_dec.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../utils/ffmpegvideodecode/ffmpeg_video_dec.cpp)
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARY_LIST})
if(rocdecode-host_FOUND)
# rocdecode-host
include_directories(${rocdecode-host_INCLUDE_DIR})
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} rocdecode::rocdecode-host)
target_compile_definitions(${PROJECT_NAME} PUBLIC ENABLE_HOST_DECODE=1)
else()
target_compile_definitions(${PROJECT_NAME} PUBLIC ENABLE_HOST_DECODE=0)
endif()
# FFMPEG multi-version support
if(_FFMPEG_AVCODEC_VERSION VERSION_LESS_EQUAL 58.134.100)
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_AVCODEC_GREATER_THAN_58_134=0)
else()
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_AVCODEC_GREATER_THAN_58_134=1)
endif()
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARY_LIST})
else()
message("-- ERROR!: ${PROJECT_NAME} excluded! please install all the dependencies and try again!")
if (NOT HIP_FOUND)
+1 -1
Просмотреть файл
@@ -316,7 +316,7 @@ int main(int argc, char **argv) {
}
for (int i = 0; i < n_frame_returned; i++) {
pframe = viddec->GetFrame(&pts);
if (b_generate_md5) {
if (b_generate_md5 && pframe) {
md5_generator->UpdateMd5ForFrame(pframe, surf_info);
}
if (dump_output_frames && mem_type != OUT_SURFACE_MEM_NOT_MAPPED) {
+5
Просмотреть файл
@@ -87,6 +87,11 @@ public:
} else
hst_ptr = static_cast<uint8_t *> (surf_mem);
if (hst_ptr == nullptr) {
ROCDEC_ERR("Null surface pointer.");
return;
}
// Need to covert interleaved planar to stacked planar, assuming 4:2:0 chroma sampling.
uint8_t *stacked_ptr = new uint8_t [output_image_size];
uint8_t *tmp_hst_ptr = hst_ptr;
+5 -1
Просмотреть файл
@@ -956,7 +956,11 @@ void RocVideoDecoder::SaveFrameToFile(std::string output_file_name, void *surf_m
} else
hst_ptr = static_cast<uint8_t *> (surf_mem);
if (hst_ptr == nullptr) {
ROCDEC_ERR("Null surface pointer.");
return;
}
if (current_output_filename.empty()) {
current_output_filename = output_file_name;
}