Samples - Docs Updated (#204)

[ROCm/rocdecode commit: 2298d93990]
This commit is contained in:
Kiriti Gowda
2024-01-26 05:19:24 -08:00
committed by GitHub
vanhempi 919dcafc80
commit f517b2ab2d
7 muutettua tiedostoa jossa 162 lisäystä ja 128 poistoa
@@ -1,18 +1,31 @@
# rocDecode Test Scripts
## Pre-requisites to run python script
* Python3
* ```python3 -m pip install pandas```
* ```python3 -m pip install tabulate```
* Install [rocDecode](../../README.md#build-and-install-instructions)
## Script to run rocDecode
* [FFMPEG](https://ffmpeg.org/about.html)
```
python3 run_rocDecode_tests.py --help
* On `Ubuntu`
```shell
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev
```
* On `RHEL`/`SLES` - install ffmpeg development packages manually or use [rocDecode-setup.py](../../rocDecode-setup.py) script
* Python3 and pip packages - `pandas`, & ` tabulate`
```shell
python3 -m pip install pandas tabulate
```
## Scripts
usage:
**Usage:**
```
* **run_rocDecodeSamples.py**
```shell
usage: run_rocDecodeSamples.py [--rocDecode_directory ROCDECODE_DIRECTORY]
[--gpu_device_id GPU_DEVICE_ID]
[--files_directory FILES_DIRECTORY]
@@ -33,7 +46,9 @@ optional arguments:
The number of threads is only for the videoDecodePerf sample (sample_mode = 1) - optional (default:4)
```
```
* **run_rocDecode_Conformance.py**
```shell
usage: run_rocDecode_Conformance.py [--rocDecode_directory ROCDECODE_DIRECTORY]
[--gpu_device_id GPU_DEVICE_ID]
[--files_directory FILES_DIRECTORY]
@@ -1,33 +1,32 @@
# Video Decode Sample
This sample illustrates the FFMPEG demuxer to get the individual frames which are then decoded on AMD hardware using rocDecode library.
# Video decode sample
The video decode sample illustrates decoding a single packetized video stream using FFMPEG demuxer, video parser, and rocDecoder to get the individual decoded frames in YUV format. This sample cab ne configured with a device ID and optionally able to dump the output to a file. This sample uses the high level RocVideoDecoder class which connects both the video parser and Rocdecoder. This process repeats in a loop until all frames have been decoded.
## 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
* Install [rocDecode](../../README.md#build-and-install-instructions)
* [FFMPEG](https://ffmpeg.org/about.html)
* On `Ubuntu`
```shell
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev
```
sudo apt install ffmpeg
```
* On `RHEL`/`SLES` - install ffmpeg development packages manually or use [rocDecode-setup.py](../../rocDecode-setup.py) script
## Build
```
mkdir build
cd build
```shell
mkdir video_decode_sample && cd video_decode_sample
cmake ../
make -j
```
# Run
```
## Run
```shell
./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,35 +1,34 @@
# Video Decode Sample
This sample illustrates the FFMPEG demuxer to get the individual frames which are then decoded on AMD hardware using rocDecode library.
# Video decode fork sample
This sample uses fork() to create multiple processes to decode the same input video parallely.
The video decode fork sample creates multiple processes which demux and decode the same video in parallel. The demuxer uses FFMPEG to get the individual frames which are then sent to the decoder APIs. The sample uses shared memory to keep count of the number of frames decoded in the different processes. Each child process needs to exit successfully for the sample to complete successfully.
This sample shows scaling in performance for `N` VCN engines as per GPU architecture.
## 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
* Install [rocDecode](../../README.md#build-and-install-instructions)
* [FFMPEG](https://ffmpeg.org/about.html)
* On `Ubuntu`
```shell
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev
```
sudo apt install ffmpeg
```
* On `RHEL`/`SLES` - install ffmpeg development packages manually or use [rocDecode-setup.py](../../rocDecode-setup.py) script
## Build
```
mkdir build
cd build
```shell
mkdir video_decode_fork_sample && cd video_decode_fork_sample
cmake ../
make -j
```
# Run
```
## Run
```shell
./videodecodefork -i <input video file [required]>
-f <Number of forks ( >= 1) [optional; default:4]>
-d <Device ID (>= 0) [optional - default:0]>
@@ -1,38 +1,39 @@
# Video Decode Sample
This sample illustrates a way to pass the data chunk-by-chunk sequentially to the FFMPEG demuxer which are then decoded on AMD hardware using rocDecode library.
# Video decode memory sample
The video decode memory sample illustrates a way to pass the data chunk-by-chunk sequentially to the FFMPEG demuxer which are then decoded on AMD hardware using rocDecode library.
The sample provides a user class `FileStreamProvider` derived from the existing `VideoDemuxer::StreamProvider` to read a video file and fill the buffer owned by the demuxer. It then takes frames from this buffer for further parsing and decoding.
## 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
* Install [rocDecode](../../README.md#build-and-install-instructions)
* [FFMPEG](https://ffmpeg.org/about.html)
* On `Ubuntu`
```shell
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev
```
sudo apt install ffmpeg
```
* On `RHEL`/`SLES` - install ffmpeg development packages manually or use [rocDecode-setup.py](../../rocDecode-setup.py) script
## Build
```
mkdir build
cd build
```shell
mkdir video_decode_mem_sample && cd video_decode_mem_sample
cmake ../
make -j
```
# Run
```
./videodecodemem -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]>
-z <force_zero_latency - Decoded frames will be flushed out for display immediately [optional]>
-sei <extract SEI messages [optional]>
-crop <crop rectangle for output (not used when using interopped decoded frame) [optional - default: 0,0,0,0]>
-m <output_surface_memory_type - decoded surface memory [optional - default: 0][0 : OUT_SURFACE_MEM_DEV_INTERNAL/ 1 : OUT_SURFACE_MEM_DEV_COPIED/ 2 : OUT_SURFACE_MEM_HOST_COPIED]>
## Run
```shell
./videodecodemem -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]>
-z <force_zero_latency - Decoded frames will be flushed out for display immediately [optional]>
-sei <extract SEI messages [optional]>
-crop <crop rectangle for output (not used when using interopped decoded frame) [optional - default: 0,0,0,0]>
-m <output_surface_memory_type - decoded surface memory [optional - default: 0][0 : OUT_SURFACE_MEM_DEV_INTERNAL/ 1 : OUT_SURFACE_MEM_DEV_COPIED/ 2 : OUT_SURFACE_MEM_HOST_COPIED]>
```
@@ -1,38 +1,41 @@
# Video Decode Multi Files Sample
This sample illustrates the FFMPEG demuxer to get the individual frames which are then decoded on AMD hardware using rocDecode library.
# Video decode multi files sample
This sample takes multiple files as a list and decodes each of them one after the other.
The video decode multiple files sample illustrates the use of providing a list of files as input to showcase the reconfigure option in rocDecode library. The input video files have to be of the same codec type to use the reconfigure option but can have different resolution or resize parameters.
The reconfigure option can be disabled by the user if needed. The input file is parsed line by line and data is stored in a queue. The individual video files are demuxed and decoded one after the other in a loop. Outpuot for each individual input file can also be stored if needed.
## 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
* Install [rocDecode](../../README.md#build-and-install-instructions)
* [FFMPEG](https://ffmpeg.org/about.html)
* On `Ubuntu`
```shell
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev
```
sudo apt install ffmpeg
```
* On `RHEL`/`SLES` - install ffmpeg development packages manually or use [rocDecode-setup.py](../../rocDecode-setup.py) script
## Build
```
mkdir build
cd build
```shell
mkdir video_decode_multi_files_sample && cd video_decode_multi_files_sample
cmake ../
make -j
```
# Run
* Example input file list - example.txt
## Run
```shell
./videodecodemultifiles -i <input file list[required - example.txt]>
-d <GPU device ID - 0:device 0 / 1:device 1/ ... [optional - default:0]>
-use_reconfigure <flag (bool - 0/1) [optional - default: 1] set 0 to disable reconfigure api for decoding multiple files. Only resolution changes between files are supported when reconfigure is enabled. The codec, bit_depth, and the chroma_format must be the same between files>
```
### Note: Example input file list - example.txt
```shell
infile input1.[mp4/mov...] [required]
outfile output1.yuv [optional]
z 0 [optional]
@@ -43,11 +46,4 @@ infile input2.[mp4/mov...] [optional]
outfile output2.yuv [optional]
...
...
```
```
./videodecodemultifiles -i <input file list[required - example.txt]>
-d <GPU device ID - 0:device 0 / 1:device 1/ ... [optional - default:0]>
-use_reconfigure <flag (bool - 0/1) [optional - default: 1] set 0 to disable reconfigure api for decoding multiple files. Only resolution changes between files are supported when reconfigure is enabled.
The codec, bit_depth, and the chroma_format must be the same between files.>
```
```
@@ -1,35 +1,34 @@
# Video Decode Sample
# Video decode performance sample
This sample illustrates the FFMPEG demuxer to get the individual frames which are then decoded on AMD hardware using rocDecode library.
This sample uses multiple threads to decode the same input video parallely.
## 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
* Install [rocDecode](../../README.md#build-and-install-instructions)
* [FFMPEG](https://ffmpeg.org/about.html)
* On `Ubuntu`
```shell
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev
```
sudo apt install ffmpeg
```
* On `RHEL`/`SLES` - install ffmpeg development packages manually or use [rocDecode-setup.py](../../rocDecode-setup.py) script
## Build
```
mkdir build
cd build
```shell
mkdir video_decode_perf_sample && cd video_decode_perf_sample
cmake ../
make -j
```
# Run
```
## Run
```shell
./videodecodeperf -i <input video file [required]>
-t <number of threads [optional - default:4]>
-d <Device ID (>= 0) [optional - default:0]>
@@ -1,11 +1,36 @@
# Video Decode Sample
This sample illustrates the FFMPEG demuxer to get the individual frames which are then decoded using rocDecode API and optionally color-converted using custom HIP kernels on AMD hardware. This sample converts decoded YUV output to one of the RGB or BGR formats(24bit, 32bit, 464bit)
# Video decode RGB sample
## Build and run the sample:
```
mkdir build
cd build
cmake ..
This sample illustrates the FFMPEG demuxer to get the individual frames which are then decoded using rocDecode API and optionally color-converted using custom HIP kernels on AMD hardware. This sample converts decoded YUV output to one of the RGB or BGR formats(24bit, 32bit, 464bit) in a separate thread allowing to run both VCN hardware and compute engine in parallel.
This sample uses HIP kernels to showcase the color conversion. Whenever a frame is ready after decoding, the `ColorSpaceConversionThread` is notified and can be used for post-processing.
## Prerequisites:
* Install [rocDecode](../../README.md#build-and-install-instructions)
* [FFMPEG](https://ffmpeg.org/about.html)
* On `Ubuntu`
```shell
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev
```
* On `RHEL`/`SLES` - install ffmpeg development packages manually or use [rocDecode-setup.py](../../rocDecode-setup.py) script
## Build
```shell
mkdir video_decode_rgb_sample && cd video_decode_rgb_sample
cmake ../
make -j
./videodecodergb -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> -of <optional: output format bgr, bgra, bgr48, bgr64 etc>
```
## Run
```shell
./videodecodergb -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>
-of <optional: output format bgr, bgra, bgr48, bgr64 etc>
```