* FFMPEG - Updates

* Readme - Updates

* Sample - Install

* Install Sample Deps

* Samples - Updates

* Sample - Added missing header
This commit is contained in:
Kiriti Gowda
2023-11-06 08:51:47 -08:00
committato da GitHub
parent 213ffc517e
commit d34d85027c
5 ha cambiato i file con 104 aggiunte e 42 eliminazioni
+7 -21
Vedi File
@@ -104,9 +104,8 @@ set(AMDGPU_TARGETS "${DEFAULT_AMDGPU_TARGETS}" CACHE STRING "List of specific ma
find_package(HIP QUIET)
find_package(Libdrm QUIET)
find_package(Libva QUIET)
find_package(FFmpeg QUIET)
if(HIP_FOUND AND FFMPEG_FOUND AND Libva_FOUND AND Libdrm_FOUND)
if(HIP_FOUND AND Libva_FOUND AND Libdrm_FOUND)
# HIP
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} hip::device)
@@ -117,10 +116,6 @@ if(HIP_FOUND AND FFMPEG_FOUND AND Libva_FOUND AND Libdrm_FOUND)
include_directories(${LIBVA_INCLUDE_DIR})
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${LIBVA_LIBRARY})
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${LIBVA_DRM_LIBRARY})
# FFMPEG
include_directories(${AVUTIL_INCLUDE_DIR} ${AVCODEC_INCLUDE_DIR}
${SWSCALE_INCLUDE_DIR} ${AVFORMAT_INCLUDE_DIR})
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${FFMPEG_LIBRARIES})
# local include files
include_directories(api src/rocdecode src/parser src/rocdecode/vaapi)
@@ -129,22 +124,16 @@ if(HIP_FOUND AND FFMPEG_FOUND AND Libva_FOUND AND Libdrm_FOUND)
# rocdecode.so
add_library(${PROJECT_NAME} SHARED ${SOURCES})
if(_FFMPEG_AVCODEC_VERSION VERSION_LESS_EQUAL 58.134.100)
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_AVCODEC_58_134=1)
endif()
if(_FFMPEG_AVCODEC_VERSION VERSION_LESS_EQUAL 58.54.100)
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_AVCODEC_58_54=0)
else()
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_AVCODEC_58_54=1)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17")
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARY_LIST})
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES api/rocdecode.h api/rocparser.h utils/video_demuxer.hpp utils/rocvideodecode/roc_video_dec.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
install(DIRECTORY cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/rocdecode)
install(DIRECTORY utils/rocvideodecode DESTINATION ${CMAKE_INSTALL_DATADIR}/rocdecode/utils)
install(DIRECTORY samples/videoDecode DESTINATION ${CMAKE_INSTALL_DATADIR}/rocdecode/samples)
install(FILES data/videos/AMD_driving_virtual_20-H265.mp4 DESTINATION ${CMAKE_INSTALL_DATADIR}/rocdecode/video)
message("-- ${White}AMD ROCm rocDecode -- CMAKE_CXX_FLAGS:${CMAKE_CXX_FLAGS}${ColourReset}")
message("-- ${White}AMD ROCm rocDecode -- Link Libraries: ${LINK_LIBRARY_LIST}${ColourReset}")
@@ -205,9 +194,9 @@ if(HIP_FOUND AND FFMPEG_FOUND AND Libva_FOUND AND Libdrm_FOUND)
# Set the dependent packages
set(rocDecode_DEBIAN_PACKAGE_LIST
"vainfo, libva-dev, libdrm-dev, ffmpeg, libavcodec-dev, libavformat-dev, libswscale-dev")
"vainfo, libva-dev, libdrm-dev")
set(rocDecode_RPM_PACKAGE_LIST
"libva-devel, libdrm-devel, ffmpeg, libavcodec-devel, libavformat-devel, libswscale-devel")
"libva-devel, libdrm-devel")
# set dependency to ROCm if set to TRUE, default to OFF
set(ROCM_DEP_ROCMCORE OFF CACHE BOOL "Set rocm-core dependency")
if(ROCM_DEP_ROCMCORE)
@@ -259,9 +248,6 @@ else()
if(NOT HIP_FOUND)
message(FATAL_ERROR "-- ERROR!: HIP Not Found! - please install ROCm and HIP!")
endif()
if(NOT FFMPEG_FOUND)
message(FATAL_ERROR "-- ERROR!: FFMPEG Not Found! - please install FFMPEG!")
endif()
if(NOT Libva_FOUND)
message(FATAL_ERROR "-- ERROR!: libva-dev Not Found - please install libva-dev!")
endif()
+30 -7
Vedi File
@@ -1,6 +1,9 @@
# rocDecode
rocDecode is a high performance video decode SDK for AMD hardware
rocDecode is a high performance video decode SDK for AMD hardware. rocDecode API lets developers access the video decoding features available on the GPU.
## Supported Codecs
* H.264 - 8 bit
* H.265 (HEVC) - 8 bit, 10 bit, and 12 bit
## Prerequisites:
@@ -23,11 +26,6 @@ rocDecode is a high performance video decode SDK for AMD hardware
sudo apt install libdrm-dev
```
* [FFMPEG](https://ffmpeg.org/about.html)
```
sudo apt install ffmpeg libavcodec-dev libavformat-dev libswscale-dev
```
* **Note** [rocDecode-setup.py](rocDecode-setup.py) script can be used for installing all the dependencies
## Build instructions:
@@ -41,7 +39,7 @@ Please follow the instructions below to build and install the rocDecode library.
sudo make install
```
* run tests
* run tests - Requires `FFMPEG` install
```
make test
```
@@ -52,9 +50,34 @@ Please follow the instructions below to build and install the rocDecode library.
sudo make test package
```
## Verify Installation
The installer will copy
* Libraries into /opt/rocm/lib
* Header files into /opt/rocm/include/rocdecode
* Samples folder into /opt/rocm/share/rocdecode
* Documents folder into /opt/rocm/share/doc/rocdecode
Build and run sample
```
mkdir rocdecode-sample && cd rocdecode-sample
cmake /opt/rocm/share/rocdecode/samples/videoDecode/
make -j8
./videodecode -i /opt/rocm/share/rocdecode/video/AMD_driving_virtual_20-H265.mp4
```
## Samples:
The tool provides a few samples to decode videos [here](samples/). Please refer to the individual folders to build and run the samples.
### Prerequisites
* [FFMPEG](https://ffmpeg.org/about.html) - required to run sample applications & make test
```
sudo apt install ffmpeg libavcodec-dev libavformat-dev libswscale-dev
```
## Docker:
Docker files to build rocDecode containers are available [here](docker/)
+37 -10
Vedi File
@@ -21,34 +21,61 @@
#
################################################################################
cmake_minimum_required (VERSION 3.0)
cmake_minimum_required (VERSION 3.5)
project(videodecode)
set(CMAKE_CXX_STANDARD 17)
set(ROCM_PATH /opt/rocm CACHE PATH "default ROCm installation path")
# ROCM Path
if(DEFINED ENV{ROCM_PATH})
set(ROCM_PATH $ENV{ROCM_PATH} CACHE PATH "Default ROCm installation path")
elseif(ROCM_PATH)
message("-- INFO:ROCM_PATH Set -- ${ROCM_PATH}")
else()
set(ROCM_PATH /opt/rocm CACHE PATH "Default ROCm installation path")
endif()
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH})
set(CMAKE_CXX_COMPILER ${ROCM_PATH}/llvm/bin/clang++)
set(DEFAULT_AMDGPU_TARGETS "gfx803;gfx900;gfx906;gfx908;gfx90a;gfx940;gfx1030;gfx1031;gfx1032;gfx1100")
set(AMDGPU_TARGETS "${DEFAULT_AMDGPU_TARGETS}" CACHE STRING "List of specific machine types for library to target")
find_package(HIP QUIET)
find_package(FFmpeg QUIET)
message("-- ${CMAKE_CURRENT_SOURCE_DIR}")
if(HIP_FOUND AND FFMPEG_FOUND)
include_directories (${ROCM_PATH}/include/rocdecode)
# find rocDecode
find_library(ROCDECODE_LIBRARY NAMES rocdecode HINTS {ROCM_PATH}/lib)
find_path(ROCDECODE_INCLUDE_DIR NAMES rocdecode.h PATHS /opt/rocm/include/rocdecode {ROCM_PATH}/include/rocdecode)
if(ROCDECODE_LIBRARY AND ROCDECODE_INCLUDE_DIR)
set(ROCDECODE_FOUND TRUE)
message("-- ${White}Using rocDecode -- \n\tLibraries:${ROCDECODE_LIBRARY} \n\tIncludes:${ROCDECODE_INCLUDE_DIR}${ColourReset}")
endif()
if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND)
# HIP
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} hip::device)
# FFMPEG
include_directories(${AVUTIL_INCLUDE_DIR} ${AVCODEC_INCLUDE_DIR}
${SWSCALE_INCLUDE_DIR} ${AVFORMAT_INCLUDE_DIR})
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${FFMPEG_LIBRARIES})
# rocDecode
include_directories (${ROCDECODE_INCLUDE_DIR})
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${ROCDECODE_LIBRARY})
list(APPEND SOURCES ${PROJECT_SOURCE_DIR} videodecode.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../utils/rocvideodecode/roc_video_dec.cpp)
add_executable(${PROJECT_NAME} ${SOURCES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17")
target_link_libraries(${PROJECT_NAME} ${AVUTIL_LIBRARY} ${AVCODEC_LIBRARY} ${AVFORMAT_LIBRARY} hip::device rocdecode)
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)
message(FATAL_ERROR "-- ERROR!: HIP Not Found! - please install ROCm and HIP!")
endif()
if (NOT FFMPEG_FOUND)
message(FATAL_ERROR "-- ERROR!: FFMPEG Not Found! - please insatll FFMPEG!")
message(FATAL_ERROR "-- ERROR!: FFMPEG Not Found! - please install FFMPEG!")
endif()
if (NOT Libva_FOUND)
message(FATAL_ERROR "-- ERROR!: libva-dev Not Found - please install libva-dev!")
if (NOT ROCDECODE_FOUND)
message(FATAL_ERROR "-- ERROR!: rocDecode Not Found! - please install rocDecode!")
endif()
message("-- ERROR!: ${PROJECT_NAME} excluded! please install all the dependencies and try again!")
endif()
+29 -4
Vedi File
@@ -1,11 +1,36 @@
# Video Decode Sample
This sample illustrates the FFMPEG demuxer to get the individual frames which are then decoded on AMD hardware using VAAPI. This sample supports both YUV420 8-bit and 10-bit streams.
This sample illustrates the FFMPEG demuxer to get the individual frames which are then decoded on AMD hardware using VAAPI.
## Build and run the sample:
This sample supports both YUV420 8-bit and 10-bit streams.
## Prerequisites:
* Linux distribution
+ Ubuntu - `20.04` / `22.04`
* [ROCm supported hardware](https://rocm.docs.amd.com/en/latest/release/gpu_os_support.html)
* Install [ROCm 5.5 or later](https://rocmdocs.amd.com/en/latest/deploy/linux/installer/install.html) with `--usecase=graphics,rocm --no-32`
* rocDecode
* CMake `3.5` or later
* [FFMPEG](https://ffmpeg.org/about.html)
```
sudo apt install ffmpeg libavcodec-dev libavformat-dev libswscale-dev
```
## Build
```
mkdir build
cd build
cmake ..
cmake ../
make -j
./videodecode -i <input video file - required> -o <optional; output path to save decoded YUV frames> -d <GPU device ID, 0 for the first device, 1 for the second device, etc>
```
# Run
```
./videodecode -i <input video file [required]>
-o <output path to save decoded YUV frames [optional]>
-d <GPU device ID - 0:device 0 / 1:device 1/ ... [optional - default:0]>
```
+1
Vedi File
@@ -21,6 +21,7 @@ THE SOFTWARE.
*/
#include <iostream>
#include <iomanip>
#include <unistd.h>
#include <vector>
#include <string>