Add 'projects/rocdecode/' from commit 'b0bab079403eda171f9056409fa96b0908f61073'
git-subtree-dir: projects/rocdecode git-subtree-mainline:5d609c1e57git-subtree-split:b0bab07940
这个提交包含在:
文件差异内容过多而无法显示
加载差异
@@ -0,0 +1,238 @@
|
||||
<doxygenlayout version="1.0">
|
||||
<!-- Generated by doxygen 1.9.7 -->
|
||||
<!-- Navigation index tabs for HTML output -->
|
||||
<navindex>
|
||||
<tab type="mainpage" visible="yes" title="Introduction"/>
|
||||
<tab type="pages" visible="yes" title="" intro=""/>
|
||||
<tab type="topics" visible="yes" title="rocDecode APIs" intro=""/>
|
||||
<tab type="namespaces" visible="yes" title="">
|
||||
<tab type="namespacelist" visible="yes" title="" intro=""/>
|
||||
<tab type="namespacemembers" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="concepts" visible="yes" title="">
|
||||
</tab>
|
||||
<tab type="interfaces" visible="yes" title="">
|
||||
<tab type="interfacelist" visible="yes" title="" intro=""/>
|
||||
<tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||
<tab type="interfacehierarchy" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="classes" visible="no" title="">
|
||||
<tab type="classlist" visible="no" title="" intro=""/>
|
||||
<tab type="hierarchy" visible="no" title="" intro=""/>
|
||||
<tab type="classmembers" visible="no" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="structs" visible="no" title="">
|
||||
<tab type="structlist" visible="no" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="exceptions" visible="yes" title="">
|
||||
<tab type="exceptionlist" visible="yes" title="" intro=""/>
|
||||
<tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||
<tab type="exceptionhierarchy" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="files" visible="yes" title="rocDecode Header Files">
|
||||
<tab type="filelist" visible="no" title="" intro=""/>
|
||||
<tab type="globals" visible="no" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="examples" visible="yes" title="" intro=""/>
|
||||
</navindex>
|
||||
|
||||
<!-- Layout definition for a class page -->
|
||||
<class>
|
||||
<briefdescription visible="yes"/>
|
||||
<includes visible="$SHOW_HEADERFILE"/>
|
||||
<inheritancegraph visible="$CLASS_GRAPH"/>
|
||||
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
|
||||
<memberdecl>
|
||||
<nestedclasses visible="yes" title=""/>
|
||||
<publictypes title=""/>
|
||||
<services title=""/>
|
||||
<interfaces title=""/>
|
||||
<publicslots title=""/>
|
||||
<signals title=""/>
|
||||
<publicmethods title=""/>
|
||||
<publicstaticmethods title=""/>
|
||||
<publicattributes title=""/>
|
||||
<publicstaticattributes title=""/>
|
||||
<protectedtypes title=""/>
|
||||
<protectedslots title=""/>
|
||||
<protectedmethods title=""/>
|
||||
<protectedstaticmethods title=""/>
|
||||
<protectedattributes title=""/>
|
||||
<protectedstaticattributes title=""/>
|
||||
<packagetypes title=""/>
|
||||
<packagemethods title=""/>
|
||||
<packagestaticmethods title=""/>
|
||||
<packageattributes title=""/>
|
||||
<packagestaticattributes title=""/>
|
||||
<properties title=""/>
|
||||
<events title=""/>
|
||||
<privatetypes title=""/>
|
||||
<privateslots title=""/>
|
||||
<privatemethods title=""/>
|
||||
<privatestaticmethods title=""/>
|
||||
<privateattributes title=""/>
|
||||
<privatestaticattributes title=""/>
|
||||
<friends title=""/>
|
||||
<related title="" subtitle=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<services title=""/>
|
||||
<interfaces title=""/>
|
||||
<constructors title=""/>
|
||||
<functions title=""/>
|
||||
<related title=""/>
|
||||
<variables title=""/>
|
||||
<properties title=""/>
|
||||
<events title=""/>
|
||||
</memberdef>
|
||||
<allmemberslink visible="yes"/>
|
||||
<usedfiles visible="$SHOW_USED_FILES"/>
|
||||
<authorsection visible="yes"/>
|
||||
</class>
|
||||
|
||||
<!-- Layout definition for a namespace page -->
|
||||
<namespace>
|
||||
<briefdescription visible="yes"/>
|
||||
<memberdecl>
|
||||
<nestednamespaces visible="yes" title=""/>
|
||||
<constantgroups visible="yes" title=""/>
|
||||
<interfaces visible="yes" title=""/>
|
||||
<classes visible="yes" title=""/>
|
||||
<concepts visible="yes" title=""/>
|
||||
<structs visible="yes" title=""/>
|
||||
<exceptions visible="yes" title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
</memberdef>
|
||||
<authorsection visible="yes"/>
|
||||
</namespace>
|
||||
|
||||
<!-- Layout definition for a concept page -->
|
||||
<concept>
|
||||
<briefdescription visible="yes"/>
|
||||
<includes visible="$SHOW_HEADERFILE"/>
|
||||
<definition visible="yes" title=""/>
|
||||
<detaileddescription title=""/>
|
||||
<authorsection visible="yes"/>
|
||||
</concept>
|
||||
|
||||
<!-- Layout definition for a file page -->
|
||||
<file>
|
||||
<briefdescription visible="yes"/>
|
||||
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||
<includegraph visible="$INCLUDE_GRAPH"/>
|
||||
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
|
||||
<sourcelink visible="yes"/>
|
||||
<memberdecl>
|
||||
<interfaces visible="yes" title=""/>
|
||||
<classes visible="yes" title=""/>
|
||||
<structs visible="yes" title=""/>
|
||||
<exceptions visible="yes" title=""/>
|
||||
<namespaces visible="yes" title=""/>
|
||||
<concepts visible="yes" title=""/>
|
||||
<constantgroups visible="yes" title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
</memberdef>
|
||||
<authorsection/>
|
||||
</file>
|
||||
|
||||
<!-- Layout definition for a group page -->
|
||||
<group>
|
||||
<briefdescription visible="yes"/>
|
||||
<groupgraph visible="$GROUP_GRAPHS"/>
|
||||
<memberdecl>
|
||||
<nestedgroups visible="yes" title=""/>
|
||||
<dirs visible="yes" title=""/>
|
||||
<files visible="yes" title=""/>
|
||||
<namespaces visible="yes" title=""/>
|
||||
<concepts visible="yes" title=""/>
|
||||
<classes visible="yes" title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<enumvalues title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<signals title=""/>
|
||||
<publicslots title=""/>
|
||||
<protectedslots title=""/>
|
||||
<privateslots title=""/>
|
||||
<events title=""/>
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<pagedocs/>
|
||||
<inlineclasses title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<enumvalues title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<signals title=""/>
|
||||
<publicslots title=""/>
|
||||
<protectedslots title=""/>
|
||||
<privateslots title=""/>
|
||||
<events title=""/>
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
</memberdef>
|
||||
<authorsection visible="yes"/>
|
||||
</group>
|
||||
|
||||
<!-- Layout definition for a directory page -->
|
||||
<directory>
|
||||
<briefdescription visible="yes"/>
|
||||
<directorygraph visible="yes"/>
|
||||
<memberdecl>
|
||||
<dirs visible="yes"/>
|
||||
<files visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
</directory>
|
||||
</doxygenlayout>
|
||||
@@ -0,0 +1,67 @@
|
||||
variables:
|
||||
- group: common
|
||||
- template: /.azuredevops/variables-global.yml@pipelines_repo
|
||||
|
||||
parameters:
|
||||
- name: pipelinesRepoRef
|
||||
type: string
|
||||
default: refs/heads/develop
|
||||
- name: rocPyDecodeRepoRef
|
||||
type: string
|
||||
default: refs/heads/develop
|
||||
- name: triggerDownstreamJobs
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
resources:
|
||||
repositories:
|
||||
- repository: pipelines_repo
|
||||
type: github
|
||||
endpoint: ROCm
|
||||
name: ROCm/ROCm
|
||||
ref: ${{ parameters.pipelinesRepoRef }}
|
||||
- repository: rocpydecode_repo
|
||||
type: github
|
||||
endpoint: ROCm
|
||||
name: ROCm/rocPyDecode
|
||||
ref: ${{ parameters.rocPyDecodeRepoRef }}
|
||||
|
||||
trigger:
|
||||
batch: true
|
||||
branches:
|
||||
include:
|
||||
- develop
|
||||
- mainline
|
||||
paths:
|
||||
exclude:
|
||||
- .github
|
||||
- .jenkins
|
||||
- docs
|
||||
- '.*.y*ml'
|
||||
- '*.md'
|
||||
- LICENSE
|
||||
|
||||
pr:
|
||||
autoCancel: true
|
||||
branches:
|
||||
include:
|
||||
- develop
|
||||
- mainline
|
||||
paths:
|
||||
exclude:
|
||||
- .github
|
||||
- .jenkins
|
||||
- docs
|
||||
- '.*.y*ml'
|
||||
- '*.md'
|
||||
- LICENSE
|
||||
drafts: false
|
||||
|
||||
stages:
|
||||
- stage: rocDecode
|
||||
jobs:
|
||||
- template: ${{ variables.CI_COMPONENT_PATH }}/rocDecode.yml@pipelines_repo
|
||||
parameters:
|
||||
sparseCheckoutDir: ''
|
||||
rocPyDecodeRepo: rocpydecode_repo
|
||||
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
|
||||
@@ -0,0 +1,22 @@
|
||||
# Configuration details
|
||||
# https://docs.codecov.io/docs/codecov-yaml
|
||||
|
||||
# Validate YAML
|
||||
# curl --data-binary @.codecov.yaml https://codecov.io/validate
|
||||
|
||||
# Coverage configuration
|
||||
coverage:
|
||||
status:
|
||||
patch: true
|
||||
|
||||
range: 60..80 # First number represents red, and second represents green
|
||||
round: nearest # up, down, or nearest
|
||||
precision: 2 # Number of decimal places, between 0 and 5
|
||||
|
||||
comment: # this is a top-level key
|
||||
layout: "diff, files"
|
||||
behavior: default
|
||||
require_changes: true # learn more in the Requiring Changes section below
|
||||
require_base: true # [true :: must have a base report to post]
|
||||
require_head: true # [true :: must have a head report to post]
|
||||
hide_project_coverage: true # [true :: only show coverage on the git diff]
|
||||
@@ -0,0 +1,6 @@
|
||||
* @rrawther @AryanSalmanpour
|
||||
# Documentation files
|
||||
docs/ @ROCm/rocm-documentation
|
||||
*.md @ROCm/rocm-documentation
|
||||
*.rst @ROCm/rocm-documentation
|
||||
.readthedocs.yaml @ROCm/rocm-documentation
|
||||
@@ -0,0 +1,19 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "pip" # See documentation for possible values
|
||||
directory: "/docs/sphinx" # Location of package manifests
|
||||
open-pull-requests-limit: 10
|
||||
schedule:
|
||||
interval: "daily"
|
||||
target-branch: "develop"
|
||||
labels:
|
||||
- "documentation"
|
||||
- "dependencies"
|
||||
- "ci:docs-only"
|
||||
reviewers:
|
||||
- "samjwu"
|
||||
@@ -0,0 +1,6 @@
|
||||
build/
|
||||
samples/*/build
|
||||
.vscode/
|
||||
doxygen_output*
|
||||
samples/videoDecodeMultiFiles/example.txt
|
||||
api/rocdecode_version.h
|
||||
@@ -0,0 +1,18 @@
|
||||
# Read the Docs configuration file
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
version: 2
|
||||
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
|
||||
formats: [htmlzip, pdf, epub]
|
||||
|
||||
python:
|
||||
install:
|
||||
- requirements: docs/sphinx/requirements.txt
|
||||
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.10"
|
||||
@@ -0,0 +1,228 @@
|
||||
# Changelog for rocDecode
|
||||
|
||||
Full documentation for rocDecode is available at [https://rocm.docs.amd.com/projects/rocDecode/en/latest/](https://rocm.docs.amd.com/projects/rocDecode/en/latest/)
|
||||
|
||||
## rocDecode 1.6.0 for ROCm 7.2.0
|
||||
|
||||
### Changed
|
||||
* Updated libdrm path configuration and libva version requirements for ROCm and TheRock platforms
|
||||
|
||||
### 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.
|
||||
* rocdecode-host package - rocdecode-host library and samples
|
||||
|
||||
### 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
|
||||
* AV1 12-bit decode support on VA-API version 1.23.0 and later.
|
||||
* rocdecode-host V1.0.0 library for software decode
|
||||
* FFmpeg version support for 5.1 and 6.1
|
||||
* Find package - rocdecode-host
|
||||
|
||||
### Resolved issues
|
||||
* rocdecode-host - failure to build debuginfo packages without FFmpeg resolved.
|
||||
* Fix a memory leak for rocDecodeNegativeTests
|
||||
|
||||
### Changed
|
||||
* HIP meta package changed - Use hip-dev/devel to bring required hip dev deps
|
||||
* rocdecode host - linking updates to rocdecode-host library
|
||||
|
||||
## rocdecode 1.0.0 for ROCm 7.0.0
|
||||
|
||||
### Added
|
||||
|
||||
* VP9 IVF container file parsing support in bitstream reader.
|
||||
* CTest for VP9 decode on bitstream reader.
|
||||
* HEVC/AVC/AV1/VP9 stream syntax error handling.
|
||||
* HEVC stream bit depth change handling and DPB buffer size change handling through decoder reconfiguration.
|
||||
* AVC stream DPB buffer size change handling through decoder reconfiguration.
|
||||
* rocdecode now uses the Cmake CMAKE_PREFIX_PATH directive.
|
||||
* rocdecode - A new avcodec-based decoder built as a separate "rocdecode-host" library
|
||||
* The host backend in the `videoDeode` sample now uses the rocdecode-host library
|
||||
* The host backend using rocdecode-host library is added in `videoDecodePerf` sample
|
||||
|
||||
### Optimized
|
||||
|
||||
* Decode session start latency reduction.
|
||||
* Bitstream type detection optimization in bitstream reader.
|
||||
|
||||
### Resolved issues
|
||||
|
||||
* Fixed a bug in picture files sample "videoDecodePicFiles" that can results in incorrect output frame count.
|
||||
* Fixed a decoded frame output issue in video size change cases.
|
||||
* Removed incorrect asserts of bitdepth_minus_8 in GetBitDepth() and num_chroma_planes in GetNumChromaPlanes() API calls in RocVideoDecoder utility class.
|
||||
|
||||
### Removed
|
||||
|
||||
* GetStream() interface call from RocVideoDecoder utility class
|
||||
|
||||
### Changed
|
||||
|
||||
* Changed asserts in query API calls in RocVideoDecoder utility class to error reports, to avoid hard stop during query in case error occurs and to let the caller decide actions.
|
||||
* `libdrm_amdgpu` is now explicitly linked with rocdecode.
|
||||
|
||||
## rocDecode 0.10.0 for ROCm 6.4
|
||||
|
||||
### Added
|
||||
|
||||
* The new bitstream reader feature. The bitstream reader contains built-in stream file parsers, including an elementary stream file parser and an IVF container file parser. It can parse AVC/HEVC/AV1 elementary stream files and AV1 IVF container files. Additional format support can be added in the future.
|
||||
* VP9 decode support.
|
||||
* More CTests: VP9 test and tests on video decode raw sample.
|
||||
* Two new samples, videodecoderaw and videodecodepicfiles, have been added. videodecoderaw uses the bitstream reader instead of the FFMPEG demuxer to get picture data, and videodecodepicfiles shows how to decode an elementary video stream stored in multiple files with each file containing bitstream data of a coded picutre
|
||||
|
||||
### Changed
|
||||
|
||||
* AMD Clang++ is now the default CXX compiler.
|
||||
* Moved MD5 code out of roc video decode utility.
|
||||
|
||||
### Removed
|
||||
|
||||
* FFMPEG executable requirement for the package
|
||||
|
||||
## rocDecode 0.8.0 for ROCm 6.3
|
||||
|
||||
### Added
|
||||
|
||||
* AV1 decode support
|
||||
|
||||
### Changed
|
||||
|
||||
* Clang is now the default CXX compiler.
|
||||
* The new minimum supported version of va-api is 1.16.
|
||||
* New build and runtime options have been added to the `rocDecode-setup.py` setup script.
|
||||
* Added FFMpeg based software decoding into utils.
|
||||
* Modified videodecode sample to allow FFMpeg based decoding
|
||||
|
||||
### Removed
|
||||
|
||||
* Make tests have been removed. CTEST is now used for both Make tests and package tests.
|
||||
* `mesa-amdgpu-dri-drivers` has been removed as a dependency on RHEL and SLES.
|
||||
|
||||
### Resolved issues
|
||||
|
||||
* Fixed a bug in the size of output streams in the `videoDecodeBatch` sample.
|
||||
|
||||
## rocDecode 0.7.0
|
||||
|
||||
### Added
|
||||
|
||||
* Clang - Default CXX compiler
|
||||
* Parser - Add new API rocDecParserMarkFrameForReuse()
|
||||
|
||||
### Optimized
|
||||
|
||||
* Setup Script - Build and runtime install options
|
||||
|
||||
### Changed
|
||||
|
||||
* CTest - Core tests for make test and package test
|
||||
|
||||
### Resolved issues
|
||||
|
||||
* Sample - Bugfix for videoDecodeBatch
|
||||
|
||||
### Tested configurations
|
||||
|
||||
* Linux
|
||||
* Ubuntu - `20.04` / `22.04`
|
||||
* RHEL - `8` / `9`
|
||||
* SLES - `15 SP5`
|
||||
* ROCm:
|
||||
* rocm-core - `6.2.0.60200-66`
|
||||
* amdgpu-core - `1:6.2.60200-2009582`
|
||||
* libva-dev - `2.7.0-2` / `2.14.0-1`
|
||||
* mesa-amdgpu-va-drivers - `1:24.2.0.60200-2009582`
|
||||
* FFmpeg - `4.2.7` / `4.4.2-0`
|
||||
* rocDecode Setup Script - `V2.2.0`
|
||||
|
||||
|
||||
## rocDecode 0.6.0
|
||||
|
||||
### Additions
|
||||
|
||||
* AVC decode support
|
||||
* FFMPEG V5.X Support
|
||||
* Mariner - Build Support
|
||||
|
||||
### Optimizations
|
||||
|
||||
* Setup Script - Error Check install
|
||||
|
||||
### Changes
|
||||
|
||||
* Dependencies - Updates to core dependencies
|
||||
* LibVA Headers - Use public headers
|
||||
* mesa-amdgpu-va-drivers - RPM Package available on RPM from ROCm 6.2
|
||||
|
||||
### Fixes
|
||||
|
||||
* Package deps
|
||||
* RHEL/SLES - Additional required packages `mesa-amdgpu-dri-drivers libdrm-amdgpu`
|
||||
|
||||
### Tested configurations
|
||||
|
||||
* Linux
|
||||
* Ubuntu - `20.04` / `22.04`
|
||||
* RHEL - `8` / `9`
|
||||
* ROCm:
|
||||
* rocm-core - `6.1.0.60100-64`
|
||||
* amdgpu-core - `1:6.1.60100-1741643`
|
||||
* libva-dev - `2.7.0-2` / `2.14.0-1`
|
||||
* mesa-amdgpu-va-drivers - `1:24.1.0`
|
||||
* mesa-amdgpu-dri-drivers - `24.1.0.60200`
|
||||
* FFmpeg - `4.2.7` / `4.4.2-0`
|
||||
* rocDecode Setup Script - `V2.1.0`
|
||||
|
||||
## rocDecode 0.5.0
|
||||
|
||||
### Changes
|
||||
|
||||
* Added HEVC decode support
|
||||
* Changed setup updates
|
||||
* Added AMDGPU package support
|
||||
* Optimized package dependencies
|
||||
* Updated README
|
||||
|
||||
### Fixes
|
||||
|
||||
* Minor bug fix and updates
|
||||
|
||||
### Tested configurations
|
||||
|
||||
* Linux distribution
|
||||
* Ubuntu - `20.04` / `22.04`
|
||||
* ROCm:
|
||||
* rocm-core - `6.1.0.60100-28`
|
||||
* amdgpu-core - `1:6.1.60100-1731559`
|
||||
* FFMPEG - `4.2.7` / `4.4.2-0`
|
||||
* rocDecode Setup Script - `V1.4`
|
||||
|
||||
## rocDecode 0.4.0
|
||||
|
||||
### Changes
|
||||
|
||||
* Added CTest - Tests for install verification
|
||||
* Added Doxygen - Support for API documentation
|
||||
* Changed setup updates
|
||||
* Optimized CMakeList Cleanup
|
||||
* Added README
|
||||
|
||||
### Fixes
|
||||
|
||||
* Minor bug fix and updates
|
||||
|
||||
### Tested configurations
|
||||
|
||||
* Linux distribution
|
||||
* Ubuntu - `20.04` / `22.04`
|
||||
* ROCm:
|
||||
* rocm-core - `5.6.1.50601-93`
|
||||
* amdgpu-core - `1:5.6.50601-1649308`
|
||||
* FFMPEG - `4.2.7` / `4.4.2-0`
|
||||
* libva-dev - `2.7.0-2` / `2.14.0-1`
|
||||
* rocDecode Setup Script - `V1.1`
|
||||
@@ -0,0 +1,491 @@
|
||||
# ##############################################################################
|
||||
# Copyright (c) 2023 - 2026 Advanced Micro Devices, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# ##############################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
# 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()
|
||||
|
||||
# Check if lib/rocm_sysdeps/lib exists in the ROCm path which indicates ROCm installation via TheRock
|
||||
set(USING_THE_ROCK OFF)
|
||||
if(EXISTS "${ROCM_PATH}/lib/rocm_sysdeps/lib")
|
||||
set(USING_THE_ROCK ON)
|
||||
endif()
|
||||
|
||||
# Set AMD Clang as default compiler
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED On)
|
||||
set(CMAKE_CXX_EXTENSIONS ON)
|
||||
if (NOT DEFINED CMAKE_CXX_COMPILER)
|
||||
set(CMAKE_C_COMPILER ${ROCM_PATH}/lib/llvm/bin/amdclang)
|
||||
set(CMAKE_CXX_COMPILER ${ROCM_PATH}/lib/llvm/bin/amdclang++)
|
||||
endif()
|
||||
|
||||
# rocdecode Version
|
||||
set(VERSION "1.7.0")
|
||||
|
||||
# Set Project Version and Language
|
||||
project(rocdecode VERSION ${VERSION} LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Library install directory")
|
||||
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE STRING "Include install directory")
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
find_program(MAKE_NSIS_EXE makensis)
|
||||
find_program(RPMBUILD_EXE rpmbuild)
|
||||
find_program(DPKG_EXE dpkg)
|
||||
|
||||
# avoid setting the default installation path to /usr/local
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX ${ROCM_PATH} CACHE PATH "${PROJECT_NAME} default installation path" FORCE)
|
||||
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
|
||||
set(DEFAULT_BUILD_TYPE "Release")
|
||||
set(ENHANCED_MESSAGE ON)
|
||||
|
||||
if(ENHANCED_MESSAGE)
|
||||
string(ASCII 27 Esc)
|
||||
set(ColourReset "${Esc}[m")
|
||||
set(Red "${Esc}[31m")
|
||||
set(Green "${Esc}[32m")
|
||||
set(Yellow "${Esc}[33m")
|
||||
set(Blue "${Esc}[34m")
|
||||
set(BoldBlue "${Esc}[1;34m")
|
||||
set(Magenta "${Esc}[35m")
|
||||
set(Cyan "${Esc}[36m")
|
||||
set(White "${Esc}[37m")
|
||||
endif()
|
||||
message("-- ${BoldBlue}${PROJECT_NAME} Version -- ${VERSION}${ColourReset}")
|
||||
message("-- ${BoldBlue}${PROJECT_NAME} Install Path -- ${CMAKE_INSTALL_PREFIX}${ColourReset}")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake)
|
||||
|
||||
# rocdecode Build Type
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "rocdecode Default Build Type" FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
# -O0 -- Don't Optimize output file
|
||||
# -g -- generate debugging information, generate debugging information, dwarf-4 for making valgrind work
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -gdwarf-4")
|
||||
else()
|
||||
# -O3 -- Optimize output file
|
||||
# -DNDEBUG -- turn off asserts
|
||||
# -fPIC -- Generate position-independent code if possible
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG -fPIC")
|
||||
endif()
|
||||
message("-- ${BoldBlue}${PROJECT_NAME} Build Type -- ${CMAKE_BUILD_TYPE}${ColourReset}")
|
||||
|
||||
# Developer options
|
||||
# Add an option for enabling the rocprofiler-register
|
||||
option(ROCDECODE_ENABLE_ROCPROFILER_REGISTER "Enable rocprofiler-register support" ON)
|
||||
# Add an option for enabling FFMPEG avcodec host-based decoder
|
||||
option(ROCDECODE_ENABLE_HOST_DECODER "Enable rocdecode-host-based decoder support" ON)
|
||||
|
||||
set (HIP_PLATFORM amd CACHE STRING "HIP platform")
|
||||
find_package(HIP QUIET)
|
||||
find_package(Libva QUIET)
|
||||
find_package(Libdrm_amdgpu QUIET)
|
||||
|
||||
# Find Ubuntu 22.04
|
||||
file(READ "/etc/os-release" OS_RELEASE)
|
||||
string(REGEX MATCH "22.04" UBUNTU_22_FOUND ${OS_RELEASE})
|
||||
|
||||
# Check Libva version compatibility based on installation method and OS:
|
||||
# - Ubuntu 22.04 with standard ROCm installation: requires libva >= 1.16
|
||||
# - TheRock installation (any OS): libva >= 1.8 is sufficient
|
||||
# - Other OS versions with standard ROCm: libva >= 1.8 is sufficient
|
||||
if(Libva_FOUND)
|
||||
if(UBUNTU_22_FOUND AND NOT USING_THE_ROCK)
|
||||
if((${Libva_VERSION_MAJOR} GREATER_EQUAL 1) AND (${Libva_VERSION_MINOR} GREATER_EQUAL 16))
|
||||
message("-- ${White}\tLibva Version Supported${ColourReset}")
|
||||
else()
|
||||
set(Libva_FOUND FALSE)
|
||||
message("-- ${Yellow}\tLibva Version Not Supported${ColourReset}")
|
||||
endif()
|
||||
else()
|
||||
if((${Libva_VERSION_MAJOR} GREATER_EQUAL 1) AND (${Libva_VERSION_MINOR} GREATER_EQUAL 8))
|
||||
message("-- ${White}\tLibva Version Supported${ColourReset}")
|
||||
else()
|
||||
set(Libva_FOUND FALSE)
|
||||
message("-- ${Yellow}\tLibva Version Not Supported${ColourReset}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ROCDECODE_ENABLE_ROCPROFILER_REGISTER)
|
||||
find_package(rocprofiler-register QUIET
|
||||
HINTS $ENV{rocprofiler_register_ROOT} $ENV{ROCPROFILER_REGISTER_ROOT} ${CMAKE_INSTALL_PREFIX}
|
||||
PATHS ${ROCM_PATH})
|
||||
endif()
|
||||
if(ROCDECODE_ENABLE_HOST_DECODER)
|
||||
find_package(FFmpeg QUIET)
|
||||
endif()
|
||||
|
||||
if(HIP_FOUND AND Libva_FOUND AND Libdrm_amdgpu_FOUND)
|
||||
|
||||
# HIP
|
||||
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} hip::host)
|
||||
# LibVA
|
||||
include_directories(${LIBVA_INCLUDE_DIR})
|
||||
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${LIBVA_LIBRARY})
|
||||
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${LIBVA_DRM_LIBRARY})
|
||||
|
||||
# DRM_AMDGPU
|
||||
include_directories(${LIBDRM_AMDGPU_INCLUDE_DIR})
|
||||
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${LIBDRM_AMDGPU_LIBRARY})
|
||||
|
||||
# rocprofiler
|
||||
if (rocprofiler-register_FOUND)
|
||||
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} rocprofiler-register::rocprofiler-register)
|
||||
endif()
|
||||
|
||||
# local include files
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/api ${CMAKE_CURRENT_SOURCE_DIR}/src/rocdecode ${CMAKE_CURRENT_SOURCE_DIR}/src/parser ${CMAKE_CURRENT_SOURCE_DIR}/src/rocdecode/vaapi)
|
||||
# source files
|
||||
file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
||||
list(FILTER SOURCES EXCLUDE REGEX "${CMAKE_CURRENT_SOURCE_DIR}/src/rocdecode-host/*.*")
|
||||
# rocdecode.so
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCES})
|
||||
|
||||
# --all-warnings/-Wall -- Enable most warning messages
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARY_LIST})
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
|
||||
if(USING_THE_ROCK)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN;$ORIGIN/rocm_sysdeps/lib" BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
endif()
|
||||
|
||||
# rocprofiler
|
||||
if (rocprofiler-register_FOUND)
|
||||
string(REPLACE "." ";" VERSION_LIST ${VERSION})
|
||||
list(GET VERSION_LIST 0 VERSION_MAJOR)
|
||||
list(GET VERSION_LIST 1 VERSION_MINOR)
|
||||
list(GET VERSION_LIST 2 VERSION_PATCH)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE ROCDECODE_ROCPROFILER_REGISTER=1
|
||||
ROCDECODE_ROCP_REG_VERSION_MAJOR=${VERSION_MAJOR}
|
||||
ROCDECODE_ROCP_REG_VERSION_MINOR=${VERSION_MINOR}
|
||||
ROCDECODE_ROCP_REG_VERSION_PATCH=${VERSION_PATCH})
|
||||
endif()
|
||||
|
||||
# make rocdecode-host for decoding on HOST only if FFMPEG is available
|
||||
if(ROCDECODE_ENABLE_HOST_DECODER AND FFMPEG_FOUND)
|
||||
add_subdirectory(src/rocdecode-host)
|
||||
else()
|
||||
if(NOT FFMPEG_FOUND)
|
||||
message("-- ${Yellow}${PROJECT_NAME} -- FFMPEG NOT Found; rocdecode-host exculded${ColourReset}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Generate BUILD_INFO
|
||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/api/rocdecode_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/rocdecode_version.h @ONLY )
|
||||
|
||||
# install rocdecode libs -- {ROCM_PATH}/lib
|
||||
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_SKIP)
|
||||
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev NAMELINK_ONLY)
|
||||
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT asan)
|
||||
# install rocdecode include files -- {ROCM_PATH}/include/rocdecode
|
||||
install(FILES api/rocdecode/rocdecode.h api/rocdecode/rocparser.h api/rocdecode/roc_bitstream_reader.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} COMPONENT dev)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rocdecode_version.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} COMPONENT dev)
|
||||
# install rocdecode api trace include file -- {ROCM_PATH}/include/rocdecode/amd_detail
|
||||
install(FILES api/amd_detail/rocdecode_api_trace.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/amd_detail COMPONENT dev)
|
||||
|
||||
# install rocdecode samples -- {ROCM_PATH}/share/rocdecode
|
||||
install(DIRECTORY cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME} COMPONENT dev)
|
||||
install(DIRECTORY utils/rocvideodecode DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
|
||||
install(FILES samples/videoDecode/CMakeLists.txt samples/videoDecode/README.md samples/videoDecode/videodecode.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecode COMPONENT dev)
|
||||
install(FILES samples/videoDecodeRaw/CMakeLists.txt samples/videoDecodeRaw/README.md samples/videoDecodeRaw/videodecoderaw.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecodeRaw COMPONENT dev)
|
||||
install(FILES samples/videoDecodeMem/CMakeLists.txt samples/videoDecodeMem/README.md samples/videoDecodeMem/videodecodemem.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecodeMem COMPONENT dev)
|
||||
install(FILES samples/videoDecodePerf/CMakeLists.txt samples/videoDecodePerf/README.md samples/videoDecodePerf/videodecodeperf.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecodePerf COMPONENT dev)
|
||||
install(FILES samples/videoDecodeRGB/CMakeLists.txt samples/videoDecodeRGB/README.md samples/videoDecodeRGB/videodecrgb.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecodeRGB COMPONENT dev)
|
||||
install(FILES samples/videoDecodeBatch/CMakeLists.txt samples/videoDecodeBatch/README.md samples/videoDecodeBatch/videodecodebatch.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecodeBatch COMPONENT dev)
|
||||
install(FILES samples/rocdecDecode/CMakeLists.txt samples/rocdecDecode/README.md samples/rocdecDecode/rocdecdecode.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/rocdecDecode COMPONENT dev)
|
||||
install(FILES samples/common.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples COMPONENT dev)
|
||||
install(FILES utils/md5.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
|
||||
install(FILES utils/video_demuxer.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
|
||||
install(FILES utils/colorspace_kernels.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
|
||||
install(FILES utils/colorspace_kernels.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
|
||||
install(FILES utils/resize_kernels.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
|
||||
install(FILES utils/resize_kernels.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
|
||||
install(FILES utils/video_post_process.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
|
||||
install(FILES data/videos/AMD_driving_virtual_20-H265.mp4 data/videos/AMD_driving_virtual_20-H265.265 data/videos/AMD_driving_virtual_20-H264.mp4 data/videos/AMD_driving_virtual_20-H264.264 data/videos/AMD_driving_virtual_20-AV1.mp4 data/videos/AMD_driving_virtual_20-AV1.ivf data/videos/AMD_driving_virtual_20-VP9.ivf DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/video COMPONENT dev)
|
||||
install(DIRECTORY data/frames/ DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/frames COMPONENT dev)
|
||||
# install license information - {ROCM_PATH}/share/doc/rocdecode
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
install(FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT runtime)
|
||||
install(FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION ${CMAKE_INSTALL_DOCDIR}-asan COMPONENT asan)
|
||||
# install test cmake
|
||||
install(FILES test/CMakeLists.txt DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/test COMPONENT test)
|
||||
install(DIRECTORY test/testScripts DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/test COMPONENT test)
|
||||
install(FILES test/rocDecodeNegativeApiTests/CMakeLists.txt test/rocDecodeNegativeApiTests/README.md test/rocDecodeNegativeApiTests/rocdecode_api_negative_tests.cpp test/rocDecodeNegativeApiTests/rocdecode_api_negative_tests.h test/rocDecodeNegativeApiTests/rocdecodenegativetest.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/test/rocDecodeNegativeApiTests COMPONENT dev)
|
||||
|
||||
message("-- ${White}AMD ROCm ${PROJECT_NAME} -- CMAKE_CXX_FLAGS:${CMAKE_CXX_FLAGS}${ColourReset}")
|
||||
message("-- ${White}AMD ROCm ${PROJECT_NAME} -- Link Libraries: ${LINK_LIBRARY_LIST}${ColourReset}")
|
||||
|
||||
# Cmake module config file configurations
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/" CACHE INTERNAL "Default module path.")
|
||||
|
||||
# Export the package for use from the build-tree
|
||||
## (this registers the build-tree with a global CMake-registry)
|
||||
export(PACKAGE ${PROJECT_NAME})
|
||||
set(CONF_LIB_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
# Create the rocdecode-config.cmake and rocdecode-config-version files
|
||||
include(CMakePackageConfigHelpers)
|
||||
set(CONFIG_PACKAGE_INSTALL_DIR ${CONF_LIB_DIR}/cmake/${PROJECT_NAME})
|
||||
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
|
||||
|
||||
# Generate config Version File for rocdecode
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
|
||||
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
# Generate Config File for rocdecode
|
||||
configure_package_config_file(
|
||||
${CMAKE_MODULE_PATH}/${PROJECT_NAME}-config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
|
||||
INSTALL_DESTINATION ${CONFIG_PACKAGE_INSTALL_DIR}
|
||||
PATH_VARS LIB_INSTALL_DIR INCLUDE_INSTALL_DIR BIN_INSTALL_DIR
|
||||
)
|
||||
|
||||
# Install the rocdecode-config.cmake and rocdecode-config-version.cmake
|
||||
install(FILES
|
||||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
|
||||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
COMPONENT dev
|
||||
)
|
||||
|
||||
# Install the export set for use with the install-tree
|
||||
install(EXPORT ${PROJECT_NAME}-targets
|
||||
FILE ${PROJECT_NAME}-targets.cmake
|
||||
NAMESPACE ${PROJECT_NAME}::
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
COMPONENT dev
|
||||
)
|
||||
|
||||
# make test with CTest
|
||||
set(BUILD_FROM_SOURCE ON)
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
add_subdirectory(test)
|
||||
|
||||
# set package information
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
||||
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_LICENSE "MIT")
|
||||
# TBD: Change to generic support email
|
||||
set(CPACK_PACKAGE_CONTACT "rocdecode Support <mivisionx.support@amd.com>")
|
||||
set(CPACK_PACKAGE_VENDOR "AMD ROCm")
|
||||
set(CPACK_PACKAGE_GROUP "Development/Tools")
|
||||
set(CPACK_PACKAGE_HOMEPAGE "https://github.com/ROCm/rocDecode")
|
||||
|
||||
if(ENABLE_ASAN_PACKAGING)
|
||||
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "AMD rocdecode address sanitizer libraries")
|
||||
set(CPACK_RPM_PACKAGE_SUMMARY "AMD rocdecode address sanitizer libraries")
|
||||
else()
|
||||
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "AMD rocdecode is a high performance video decode SDK for AMD GPUs")
|
||||
set(CPACK_RPM_PACKAGE_SUMMARY "AMD rocdecode is a high performance video decode SDK for AMD GPUs")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{ROCM_LIBPATCH_VERSION})
|
||||
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.$ENV{ROCM_LIBPATCH_VERSION}")
|
||||
endif()
|
||||
|
||||
# Set the dependent packages
|
||||
# libva 2.16 (API 1.16) is needed to use mesa-amdgpu-va-drivers, libva-amdgpu
|
||||
# (AMD build of libva 2.16) should be used if distro's libva is too old
|
||||
set(ROCDECODE_DEBIAN_RUNTIME_PACKAGE_LIST "hip-runtime-amd, libva-drm2 (>= 2.16.0) | libva-amdgpu-drm2, mesa-amdgpu-va-drivers")
|
||||
# Unfortunately RPM has a mix of naming schemes; RHEL has "libva", SLE has "libva2-drm2"
|
||||
set(ROCDECODE_RPM_RUNTIME_PACKAGE_LIST "hip-runtime-amd, (libva or libva-drm2), mesa-amdgpu-va-drivers")
|
||||
# Add rocprofiler-register dependencies
|
||||
if(ROCDECODE_ENABLE_ROCPROFILER_REGISTER)
|
||||
set(ROCDECODE_DEBIAN_RUNTIME_PACKAGE_LIST "${ROCDECODE_DEBIAN_RUNTIME_PACKAGE_LIST}, rocprofiler-register")
|
||||
set(ROCDECODE_RPM_RUNTIME_PACKAGE_LIST "${ROCDECODE_RPM_RUNTIME_PACKAGE_LIST}, rocprofiler-register")
|
||||
endif()
|
||||
|
||||
# Set the dev dependent packages
|
||||
set(ROCDECODE_DEBIAN_DEV_PACKAGE_LIST "hip-dev, libva-dev (>= 2.16.0) | libva-amdgpu-dev, pkg-config, libavcodec-dev, libavformat-dev, libavutil-dev")
|
||||
if(UBUNTU_22_FOUND)
|
||||
set(ROCDECODE_DEBIAN_DEV_PACKAGE_LIST "${ROCDECODE_DEBIAN_DEV_PACKAGE_LIST}, libstdc++-12-dev")
|
||||
endif()
|
||||
# TBD - RPM packages need Fusion Packages - "libavcodec-devel, libavformat-devel, libavutil-devel"
|
||||
set(ROCDECODE_RPM_DEV_PACKAGE_LIST "hip-devel, libva-devel, pkg-config")
|
||||
|
||||
# '%{?dist}' breaks manual builds on debian systems due to empty Provides
|
||||
execute_process(
|
||||
COMMAND rpm --eval %{?dist}
|
||||
RESULT_VARIABLE PROC_RESULT
|
||||
OUTPUT_VARIABLE EVAL_RESULT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(PROC_RESULT EQUAL "0" AND NOT EVAL_RESULT STREQUAL "")
|
||||
string(APPEND CPACK_RPM_PACKAGE_RELEASE "%{?dist}")
|
||||
endif()
|
||||
|
||||
# set package
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_HOMEPAGE})
|
||||
set(CPACK_RPM_PACKAGE_URL ${CPACK_PACKAGE_HOMEPAGE})
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQPROV "no")
|
||||
# Debian package
|
||||
set(CPACK_DEB_COMPONENT_INSTALL ON)
|
||||
set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME "${PROJECT_NAME}")
|
||||
set(CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS "rocm-core, ${ROCDECODE_DEBIAN_RUNTIME_PACKAGE_LIST}")
|
||||
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "${PROJECT_NAME}-dev")
|
||||
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS
|
||||
"rocm-core, ${PROJECT_NAME}, ${ROCDECODE_DEBIAN_DEV_PACKAGE_LIST}")
|
||||
# Debian package - specific variable for ASAN
|
||||
set(CPACK_DEBIAN_ASAN_PACKAGE_NAME "${PROJECT_NAME}-asan" )
|
||||
set(CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS "rocm-core-asan, ${ROCDECODE_DEBIAN_RUNTIME_PACKAGE_LIST}" )
|
||||
# Debian package - Test
|
||||
set(CPACK_DEBIAN_TEST_PACKAGE_NAME "${PROJECT_NAME}-test" )
|
||||
set(CPACK_DEBIAN_TEST_PACKAGE_DEPENDS "rocm-core, ${CPACK_DEBIAN_DEV_PACKAGE_NAME}" )
|
||||
# Debian package - Host
|
||||
set(CPACK_DEBIAN_HOST_PACKAGE_NAME "${PROJECT_NAME}-host" )
|
||||
set(CPACK_DEBIAN_HOST_PACKAGE_DEPENDS "rocm-core, ${CPACK_DEBIAN_DEV_PACKAGE_NAME}" )
|
||||
# RPM package
|
||||
set(CPACK_RPM_COMPONENT_INSTALL ON)
|
||||
set(CPACK_RPM_RUNTIME_PACKAGE_NAME "${PROJECT_NAME}")
|
||||
set(CPACK_RPM_RUNTIME_PACKAGE_REQUIRES "rocm-core, ${ROCDECODE_RPM_RUNTIME_PACKAGE_LIST}")
|
||||
set(CPACK_RPM_DEV_PACKAGE_NAME "${PROJECT_NAME}-devel")
|
||||
set(CPACK_RPM_DEV_PACKAGE_REQUIRES "rocm-core, ${PROJECT_NAME}, ${ROCDECODE_RPM_DEV_PACKAGE_LIST}")
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "MIT" )
|
||||
# RPM package specific variable for ASAN
|
||||
set(CPACK_RPM_ASAN_PACKAGE_NAME "${PROJECT_NAME}-asan" )
|
||||
set(CPACK_RPM_ASAN_PACKAGE_REQUIRES "rocm-core-asan, ${ROCDECODE_RPM_RUNTIME_PACKAGE_LIST}" )
|
||||
# RPM package specific variable for Test
|
||||
set(CPACK_RPM_TEST_PACKAGE_NAME "${PROJECT_NAME}-test" )
|
||||
set(CPACK_RPM_TEST_PACKAGE_REQUIRES "rocm-core, ${CPACK_RPM_DEV_PACKAGE_NAME}" )
|
||||
# RPM package specific variable for Host
|
||||
set(CPACK_RPM_HOST_PACKAGE_NAME "${PROJECT_NAME}-host" )
|
||||
set(CPACK_RPM_HOST_PACKAGE_REQUIRES "rocm-core, ${CPACK_RPM_DEV_PACKAGE_NAME}" )
|
||||
|
||||
if(NOT ROCM_DEP_ROCMCORE)
|
||||
string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_RUNTIME_PACKAGE_REQUIRES ${CPACK_RPM_RUNTIME_PACKAGE_REQUIRES})
|
||||
string(REGEX REPLACE ",? ?rocm-core-asan," "" CPACK_RPM_ASAN_PACKAGE_REQUIRES ${CPACK_RPM_ASAN_PACKAGE_REQUIRES})
|
||||
string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_DEV_PACKAGE_REQUIRES ${CPACK_RPM_DEV_PACKAGE_REQUIRES})
|
||||
string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_TEST_PACKAGE_REQUIRES ${CPACK_RPM_TEST_PACKAGE_REQUIRES})
|
||||
string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_HOST_PACKAGE_REQUIRES ${CPACK_RPM_TEST_PACKAGE_REQUIRES})
|
||||
string(REGEX REPLACE ",? ?rocm-core," "" CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS ${CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS})
|
||||
string(REGEX REPLACE ",? ?rocm-core-asan," "" CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS})
|
||||
string(REGEX REPLACE ",? ?rocm-core," "" CPACK_DEBIAN_DEV_PACKAGE_DEPENDS ${CPACK_DEBIAN_DEV_PACKAGE_DEPENDS})
|
||||
string(REGEX REPLACE ",? ?rocm-core," "" CPACK_DEBIAN_TEST_PACKAGE_DEPENDS ${CPACK_DEBIAN_TEST_PACKAGE_DEPENDS})
|
||||
string(REGEX REPLACE ",? ?rocm-core," "" CPACK_DEBIAN_HOST_PACKAGE_DEPENDS ${CPACK_DEBIAN_TEST_PACKAGE_DEPENDS})
|
||||
endif()
|
||||
|
||||
if(ENABLE_ASAN_PACKAGING)
|
||||
# ASAN Package requires asan component with only libraries and license file
|
||||
set(CPACK_COMPONENTS_ALL asan)
|
||||
else()
|
||||
set(CPACK_COMPONENTS_ALL runtime dev test host)
|
||||
endif()
|
||||
|
||||
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
|
||||
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
|
||||
set(CPACK_DEBIAN_PACKAGE_RELEASE "local")
|
||||
set(CPACK_RPM_PACKAGE_RELEASE "local")
|
||||
|
||||
if(DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE})
|
||||
set(CPACK_DEBIAN_PACKAGE_RELEASE $ENV{CPACK_DEBIAN_PACKAGE_RELEASE})
|
||||
endif()
|
||||
if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE})
|
||||
set(CPACK_RPM_PACKAGE_RELEASE $ENV{CPACK_RPM_PACKAGE_RELEASE})
|
||||
endif()
|
||||
|
||||
set(CPACK_GENERATOR "TGZ;ZIP")
|
||||
if(EXISTS ${MAKE_NSIS_EXE})
|
||||
list(APPEND CPACK_GENERATOR "NSIS")
|
||||
endif()
|
||||
if(EXISTS ${RPMBUILD_EXE})
|
||||
list(APPEND CPACK_GENERATOR "RPM")
|
||||
message("-- ${White}${PROJECT_NAME}: .rpm RunTime Package Requirements -- ${CPACK_RPM_RUNTIME_PACKAGE_REQUIRES}${ColourReset}")
|
||||
message("-- ${White}${PROJECT_NAME}: .rpm Devel Package Requirements -- ${CPACK_RPM_DEV_PACKAGE_REQUIRES}${ColourReset}")
|
||||
endif()
|
||||
if(EXISTS ${DPKG_EXE})
|
||||
list(APPEND CPACK_GENERATOR "DEB")
|
||||
message("-- ${White}${PROJECT_NAME}: .deb RunTime Package Requirements -- ${CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS}${ColourReset}")
|
||||
message("-- ${White}${PROJECT_NAME}: .deb Dev Package Requirements -- ${CPACK_DEBIAN_DEV_PACKAGE_DEPENDS}${ColourReset}")
|
||||
endif()
|
||||
|
||||
include(CPack)
|
||||
|
||||
cpack_add_component(runtime
|
||||
DISPLAY_NAME "rocdecode Runtime Package"
|
||||
DESCRIPTION "High perf video decode SDK for AMD GPUs. Rocdecode library and license.txt")
|
||||
|
||||
cpack_add_component(dev
|
||||
DISPLAY_NAME "rocdecode Develop Package"
|
||||
DESCRIPTION "High perf video decode SDK for AMD GPUs. Rocdecode header files, and samples")
|
||||
|
||||
cpack_add_component(asan
|
||||
DISPLAY_NAME "rocdecode ASAN Package"
|
||||
DESCRIPTION "High perf video decode SDK for AMD GPUs. rocdecode ASAN libraries")
|
||||
|
||||
cpack_add_component(test
|
||||
DISPLAY_NAME "rocdecode Test Package"
|
||||
DESCRIPTION "High perf video decode SDK for AMD GPUs. rocdecode test")
|
||||
|
||||
# make rocdecode-host for decoding on HOST only if FFMPEG is available
|
||||
if(ROCDECODE_ENABLE_HOST_DECODER AND FFMPEG_FOUND)
|
||||
cpack_add_component(host
|
||||
DISPLAY_NAME "rocdecode host package"
|
||||
DESCRIPTION "High perf video decode host SDK for AMD GPUs")
|
||||
endif()
|
||||
|
||||
else()
|
||||
message("-- ${Red}AMD ROCm ${PROJECT_NAME} -- unmet dependencies${ColourReset}")
|
||||
if(NOT HIP_FOUND)
|
||||
message(FATAL_ERROR "-- ERROR!: HIP Not Found! - please install rocm-hip-runtime-dev!")
|
||||
endif()
|
||||
if(NOT Libva_FOUND)
|
||||
message(FATAL_ERROR "-- ERROR!: libva Not Found - please install libva-dev/libva-devel!")
|
||||
endif()
|
||||
if(NOT Libdrm_amdgpu_FOUND)
|
||||
message(FATAL_ERROR "-- ERROR!: libdrm_amdgpu Not Found - please install libdrm-dev(DEBIAN)/libdrm-devel(RPM) package!")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,31 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 - 2026 Advanced Micro Devices, Inc. All rights reserved
|
||||
|
||||
NOTICE REGARDING STANDARDS
|
||||
|
||||
AMD does not provide a license or sublicense to any Intellectual Property Rights
|
||||
relating to any standards, including but not limited to any audio and/or video
|
||||
codec technologies such as MPEG-2, MPEG-4; AVC/H.264; HEVC/H.265; AAC decode/FFMPEG;
|
||||
AAC encode/FFMPEG; VC-1; and MP3 (collectively, the “Media Technologies”).
|
||||
For clarity, you will pay any royalties due for such third party technologies,
|
||||
which may include the Media Technologies that are owed as a result of
|
||||
AMD providing the Software to you.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,248 @@
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
|
||||
<p align="center"><img width="70%" src="docs/data/AMD_rocDecode_Logo.png" /></p>
|
||||
|
||||
rocDecode is a high-performance video decode SDK for AMD GPUs. Using the rocDecode API, you can
|
||||
access the video decoding features available on your GPU.
|
||||
|
||||
> [!NOTE]
|
||||
> The published documentation is available at [rocDecode](https://rocm.docs.amd.com/projects/rocDecode/en/latest/index.html) in an organized, easy-to-read format, with search and a table of contents. The documentation source files reside in the `rocDecode/docs` folder of this repository. As with all ROCm projects, the documentation is open source. For more information on contributing to the documentation, see [Contribute to ROCm documentation](https://rocm.docs.amd.com/en/latest/contribute/contributing.html).
|
||||
|
||||
## Supported codecs
|
||||
* H.265 (HEVC) - 8 bit, and 10 bit
|
||||
* H.264 (AVC) - 8 bit
|
||||
* AV1 - 8 bit, and 10 bit
|
||||
* VP9 - 8 bit, and 10 bit
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### Operating Systems
|
||||
* Linux
|
||||
* Ubuntu - `22.04` / `24.04`
|
||||
* RedHat - `8` / `9`
|
||||
* SLES - `15-SP5`
|
||||
|
||||
### Hardware
|
||||
* **GPU**: [AMD Radeon™ Graphics](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html) / [AMD Instinct™ Accelerators](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> * `gfx908` or higher GPU required
|
||||
|
||||
* Install ROCm `6.3.0` or later with `amdgpu-install` and usecase:`rocm`
|
||||
> [!IMPORTANT]
|
||||
> `sudo amdgpu-install --usecase=rocm`
|
||||
|
||||
### Compiler
|
||||
* AMD Clang++ Version 18.0.0 or later - installed with ROCm
|
||||
|
||||
### Libraries
|
||||
* CMake Version `3.10` or later
|
||||
```shell
|
||||
sudo apt install cmake
|
||||
```
|
||||
|
||||
* [Video Acceleration API](https://en.wikipedia.org/wiki/Video_Acceleration_API) - `libva-amdgpu-dev` is an AMD implementation for VA-API
|
||||
```shell
|
||||
sudo apt install libva-amdgpu-dev
|
||||
```
|
||||
> [!NOTE]
|
||||
> * RPM Packages for `RHEL`/`SLES` - `libva-amdgpu-devel`
|
||||
> * `libva-amdgpu` is strongly recommended over system `libva` as it is used for building mesa-amdgpu-va-driver
|
||||
|
||||
* AMD VA Drivers
|
||||
```shell
|
||||
sudo apt install libva2-amdgpu libva-amdgpu-drm2 libva-amdgpu-wayland2 libva-amdgpu-x11-2 mesa-amdgpu-va-drivers
|
||||
```
|
||||
> [!NOTE]
|
||||
> RPM Packages for `RHEL`/`SLES` - `libva-amdgpu mesa-amdgpu-va-drivers`
|
||||
|
||||
* HIP
|
||||
```shell
|
||||
sudo apt install hip-dev
|
||||
```
|
||||
|
||||
* [pkg-config](https://en.wikipedia.org/wiki/Pkg-config)
|
||||
```shell
|
||||
sudo apt install pkg-config
|
||||
```
|
||||
|
||||
* [FFmpeg](https://github.com/FFmpeg/FFmpeg) libraries and headers:
|
||||
* `libavcodec` - provides implementation of a wider range of codecs.
|
||||
* `libavformat` - implements streaming protocols, container formats and basic I/O access.
|
||||
* `libavutil` - includes hashers, decompressors and miscellaneous utility functions.
|
||||
|
||||
> [!NOTE]
|
||||
> FFmpeg libraries are used in samples and tests
|
||||
|
||||
```shell
|
||||
sudo apt install libavcodec-dev libavformat-dev libavutil-dev
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> * Required compiler support
|
||||
> * C++17
|
||||
> * Threads
|
||||
> * On Ubuntu 22.04 - Additional package required: libstdc++-12-dev
|
||||
> ```shell
|
||||
> sudo apt install libstdc++-12-dev
|
||||
> ```
|
||||
|
||||
>[!NOTE]
|
||||
> * All package installs are shown with the `apt` package manager. Use the appropriate package manager for your operating system.
|
||||
|
||||
### Prerequisites setup script
|
||||
|
||||
For your convenience, we provide the setup script, [rocDecode-setup.py](https://github.com/ROCm/rocDecode/blob/develop/rocDecode-setup.py), which installs all required dependencies. Run this script only once.
|
||||
|
||||
```shell
|
||||
python3 rocDecode-setup.py --rocm_path [ ROCm Installation Path - optional (default:/opt/rocm)]
|
||||
--runtime [ Setup runtime requirements - optional (default:ON) [options:ON/OFF]]
|
||||
--developer [ Setup Developer Options - optional (default:OFF) [options:ON/OFF]]
|
||||
```
|
||||
|
||||
## Installation instructions
|
||||
|
||||
The installation process uses the following steps:
|
||||
|
||||
* [ROCm-supported hardware](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html) install verification
|
||||
|
||||
* Install ROCm `6.3.0` or later with `amdgpu-install` and `--usecase=rocm`:
|
||||
|
||||
```
|
||||
sudo amdgpu-install --usecase=rocm
|
||||
```
|
||||
|
||||
>[!IMPORTANT]
|
||||
> Use **either** [package install](#package-install) **or** [source install](#source-install) as described below.
|
||||
|
||||
### Package install
|
||||
|
||||
To install rocDecode runtime, development, and test packages, run the line of code for your operating
|
||||
system.
|
||||
|
||||
* Runtime package - `rocdecode` only provides the rocdecode library `librocdecode.so`
|
||||
* Development package - `rocdecode-dev`/`rocdecode-devel` provides the library, header files, and samples
|
||||
* Host package - `rocdecode-host` provides rocdecode host decode
|
||||
* Test package - `rocdecode-test` provides CTest to verify installation
|
||||
|
||||
#### Ubuntu
|
||||
|
||||
```shell
|
||||
sudo apt install rocdecode rocdecode-dev rocdecode-test rocdecode-host
|
||||
```
|
||||
|
||||
#### RHEL
|
||||
|
||||
```shell
|
||||
sudo yum install rocdecode rocdecode-devel rocdecode-test rocdecode-host
|
||||
```
|
||||
|
||||
#### SLES
|
||||
|
||||
```shell
|
||||
sudo zypper install rocdecode rocdecode-devel rocdecode-test rocdecode-host
|
||||
```
|
||||
|
||||
>[!NOTE]
|
||||
> * Package install auto installs all dependencies.
|
||||
> * `rocdecode-host` package is optional package use in host video decode
|
||||
|
||||
> [!IMPORTANT]
|
||||
> `RHEL`/`SLES` package install requires manual `FFMPEG` dev install
|
||||
|
||||
### Source install
|
||||
|
||||
To build rocDecode from source and install, run:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/ROCm/rocDecode.git
|
||||
cd rocDecode
|
||||
python3 rocDecode-setup.py
|
||||
mkdir build && cd build
|
||||
cmake ../
|
||||
make -j8
|
||||
sudo make install
|
||||
```
|
||||
|
||||
#### Run tests
|
||||
|
||||
```shell
|
||||
make test
|
||||
```
|
||||
> [!IMPORTANT]
|
||||
> make test requires `FFMPEG` dev install
|
||||
|
||||
>[!NOTE]
|
||||
> To run tests with verbose option, use `make test ARGS="-VV"`.
|
||||
|
||||
#### Make package
|
||||
|
||||
```shell
|
||||
sudo make package
|
||||
```
|
||||
|
||||
## Verify installation
|
||||
|
||||
The installer copies:
|
||||
|
||||
* 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`
|
||||
|
||||
### Using sample application
|
||||
|
||||
To verify your installation using a sample application, run:
|
||||
|
||||
```shell
|
||||
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
|
||||
```
|
||||
|
||||
### Using test package
|
||||
|
||||
To verify your installation using the `rocdecode-test` package, run:
|
||||
|
||||
```shell
|
||||
mkdir rocdecode-test && cd rocdecode-test
|
||||
cmake /opt/rocm/share/rocdecode/test/
|
||||
ctest -VV
|
||||
```
|
||||
|
||||
## Samples
|
||||
|
||||
You can access samples to decode your videos in our
|
||||
[GitHub repository](https://github.com/ROCm/rocDecode/tree/develop/samples). Refer to the
|
||||
individual folders to build and run the samples.
|
||||
|
||||
[FFmpeg](https://ffmpeg.org/about.html) is required for sample applications and `make test`. To install
|
||||
FFmpeg, refer to the instructions listed for your operating system:
|
||||
|
||||
* Ubuntu:
|
||||
|
||||
```shell
|
||||
sudo apt install libavcodec-dev libavformat-dev libavutil-dev
|
||||
```
|
||||
|
||||
* RHEL/SLES:
|
||||
|
||||
Install ffmpeg development packages manually or use `rocDecode-setup.py` script
|
||||
|
||||
## Docker
|
||||
|
||||
You can find rocDecode Docker containers in our
|
||||
[GitHub repository](https://github.com/ROCm/rocDecode/tree/develop/docker).
|
||||
|
||||
## Tested configurations
|
||||
|
||||
* Linux
|
||||
* Ubuntu - `22.04` / `24.04`
|
||||
* RHEL - `8` / `9`
|
||||
* SLES - `15 SP7`
|
||||
* ROCm: `7.0.0`
|
||||
* libva-amdgpu-dev - `2.16.0`
|
||||
* mesa-amdgpu-va-drivers - `1:24.3.0`
|
||||
* FFmpeg - `4.4.2` / `6.1.1`
|
||||
* rocDecode Setup Script - `V2.5.0`
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
Copyright (c) 2023 - 2026 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "rocdecode/rocdecode.h"
|
||||
#include "rocdecode/rocparser.h"
|
||||
#include "rocdecode/roc_bitstream_reader.h"
|
||||
|
||||
// Define version macros for the rocDecode API dispatch table, specifying the MAJOR and STEP versions.
|
||||
//
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
//
|
||||
// 1. When adding new functions to the rocDecode API dispatch table, always append the new function pointer
|
||||
// to the end of the table and increment the dispatch table's version number. Never rearrange the order of
|
||||
// the member variables in the dispatch table, as doing so will break the Application Binary Interface (ABI).
|
||||
// 2. In critical situations where the type of an existing member variable in a dispatch table has been changed
|
||||
// or removed due to a data type modification, it is important to increment the major version number of the
|
||||
// rocDecode API dispatch table. If the function pointer type can no longer be declared, do not remove it.
|
||||
// Instead, change the function pointer type to `void*` and ensure it is always initialized to `nullptr`.
|
||||
//
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
//
|
||||
|
||||
// The major version number should ideally remain unchanged. Increment the ROCDECODE_RUNTIME_API_TABLE_MAJOR_VERSION only
|
||||
// for fundamental changes to the rocDecodeDispatchTable struct, such as altering the type or name of an existing member variable.
|
||||
// Please DO NOT REMOVE it.
|
||||
#define ROCDECODE_RUNTIME_API_TABLE_MAJOR_VERSION 0
|
||||
|
||||
// Increment the ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION when new runtime API functions are added.
|
||||
// If the corresponding ROCDECODE_RUNTIME_API_TABLE_MAJOR_VERSION increases reset the ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION to zero.
|
||||
#define ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION 1
|
||||
|
||||
// rocDecode API interface
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecCreateVideoParser)(RocdecVideoParser *parser_handle, RocdecParserParams *params);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecParseVideoData)(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecDestroyVideoParser)(RocdecVideoParser parser_handle);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecCreateDecoder)(rocDecDecoderHandle *decoder_handle, RocDecoderCreateInfo *decoder_create_info);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecDestroyDecoder)(rocDecDecoderHandle decoder_handle);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecGetDecoderCaps)(RocdecDecodeCaps *decode_caps);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecDecodeFrame)(rocDecDecoderHandle decoder_handle, RocdecPicParams *pic_params);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecGetDecodeStatus)(rocDecDecoderHandle decoder_handle, int pic_idx, RocdecDecodeStatus *decode_status);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecReconfigureDecoder)(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecGetVideoFrame)(rocDecDecoderHandle decoder_handle, int pic_idx, void *dev_mem_ptr[3], uint32_t *horizontal_pitch, RocdecProcParams *vid_postproc_params);
|
||||
typedef const char* (ROCDECAPI *PfnRocDecGetErrorName)(rocDecStatus rocdec_status);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecCreateBitstreamReader)(RocdecBitstreamReader *bs_reader_handle, const char *input_file_path);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecGetBitstreamCodecType)(RocdecBitstreamReader bs_reader_handle, rocDecVideoCodec *codec_type);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecGetBitstreamBitDepth)(RocdecBitstreamReader bs_reader_handle, int *bit_depth);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecGetBitstreamPicData)(RocdecBitstreamReader bs_reader_handle, uint8_t **pic_data, int *pic_size, int64_t *pts);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecDestroyBitstreamReader)(RocdecBitstreamReader bs_reader_handle);
|
||||
|
||||
// rocDecode API dispatch table
|
||||
struct RocDecodeDispatchTable {
|
||||
// ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION == 0
|
||||
size_t size;
|
||||
PfnRocDecCreateVideoParser pfn_rocdec_create_video_parser;
|
||||
PfnRocDecParseVideoData pfn_rocdec_parse_video_data;
|
||||
PfnRocDecDestroyVideoParser pfn_rocdec_destroy_video_parser;
|
||||
PfnRocDecCreateDecoder pfn_rocdec_create_decoder;
|
||||
PfnRocDecDestroyDecoder pfn_rocdec_destroy_decoder;
|
||||
PfnRocDecGetDecoderCaps pfn_rocdec_get_gecoder_caps;
|
||||
PfnRocDecDecodeFrame pfn_rocdec_decode_frame;
|
||||
PfnRocDecGetDecodeStatus pfn_rocdec_get_decode_status;
|
||||
PfnRocDecReconfigureDecoder pfn_rocdec_reconfigure_decoder;
|
||||
PfnRocDecGetVideoFrame pfn_rocdec_get_video_frame;
|
||||
PfnRocDecGetErrorName pfn_rocdec_get_error_name;
|
||||
// PLEASE DO NOT EDIT ABOVE!
|
||||
// ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION == 1
|
||||
PfnRocDecCreateBitstreamReader pfn_rocdec_create_bitstream_reader;
|
||||
PfnRocDecGetBitstreamCodecType pfn_rocdec_get_bitstream_codec_type;
|
||||
PfnRocDecGetBitstreamBitDepth pfn_rocdec_get_bitstream_bit_depth;
|
||||
PfnRocDecGetBitstreamPicData pfn_rocdec_get_bitstream_pic_data;
|
||||
PfnRocDecDestroyBitstreamReader pfn_rocdec_destroy_bitstream_reader;
|
||||
// PLEASE DO NOT EDIT ABOVE!
|
||||
// ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION == 2
|
||||
|
||||
// ******************************************************************************************* //
|
||||
// READ BELOW
|
||||
// ******************************************************************************************* //
|
||||
// Please keep this text at the end of the structure:
|
||||
|
||||
// 1. Do not reorder any existing members.
|
||||
// 2. Increase the step version definition before adding new members.
|
||||
// 3. Insert new members under the appropriate step version comment.
|
||||
// 4. Generate a comment for the next step version.
|
||||
// 5. Add a "PLEASE DO NOT EDIT ABOVE!" comment.
|
||||
// ******************************************************************************************* //
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright (c) 2024 - 2026 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _ROCDECODE_HOST_VERSION_H_
|
||||
#define _ROCDECODE_HOST_VERSION_H_
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief rocDecode host version
|
||||
* \defgroup group_rocdecode_host_version rocdecode-host Version
|
||||
* \brief rocdecode-host version
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define ROCDECODE_HOST_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define ROCDECODE_HOST_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define ROCDECODE_HOST_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||
|
||||
/**
|
||||
* ROCDECODE_HOST_CHECK_VERSION:
|
||||
* @major: major version, like 1 in 1.2.3
|
||||
* @minor: minor version, like 2 in 1.2.3
|
||||
* @patch: patch version, like 3 in 1.2.3
|
||||
*
|
||||
* Evaluates to %TRUE if the version of ROCDECODE HOST is greater than
|
||||
* @major, @minor and @patch
|
||||
*/
|
||||
#define ROCDECODE_HOST_CHECK_VERSION(major, minor, patch) \
|
||||
(ROCDECODE_HOST_VERSION_MAJOR > (major) || \
|
||||
(ROCDECODE_HOST_VERSION_MAJOR == (major) && ROCDECODE_HOST_VERSION_MINOR > (minor)) || \
|
||||
(ROCDECODE_HOST_VERSION_MAJOR == (major) && ROCDECODE_HOST_VERSION_MINOR == (minor) && ROCDECODE_HOST_VERSION_PATCH >= (patch)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // end extern "C" block
|
||||
#endif
|
||||
|
||||
#endif //_ROCDECODE_HOST_VERSION_H_ header guard
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
Copyright (c) 2023 - 2026 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rocdecode/rocdecode.h"
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief The AMD rocBitstreamReader Library.
|
||||
*
|
||||
* \defgroup group_roc_bitstream_reader rocDecode Parser: AMD ROCm Video Bitstream Reader API
|
||||
* \brief AMD The rocBitstreamReader is a toolkit to read picture data from bitstream files for decoding on AMD’s GPUs.
|
||||
*/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*********************************************************************************/
|
||||
//! HANDLE of rocBitstreamReader
|
||||
//! Used in subsequent API calls after rocDecCreateBitstreamReader
|
||||
/*********************************************************************************/
|
||||
typedef void *RocdecBitstreamReader;
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup group_roc_bitstream_reader
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecCreateBitstreamReader(RocdecBitstreamReader *bs_reader_handle, const char *input_file_path)
|
||||
//! Create video bitstream reader object and initialize
|
||||
/************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecCreateBitstreamReader(RocdecBitstreamReader *bs_reader_handle, const char *input_file_path);
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup group_roc_bitstream_reader
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecGetBitstreamCodecType(RocdecBitstreamReader bs_reader_handle, rocDecVideoCodec *codec_type)
|
||||
//! Get the codec type of the bitstream
|
||||
/************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecGetBitstreamCodecType(RocdecBitstreamReader bs_reader_handle, rocDecVideoCodec *codec_type);
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup group_roc_bitstream_reader
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecGetBitstreamBitDepth(RocdecBitstreamReader bs_reader_handle, int *bit_depth)
|
||||
//! Get the bit depth of the bitstream
|
||||
/************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecGetBitstreamBitDepth(RocdecBitstreamReader bs_reader_handle, int *bit_depth);
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup group_roc_bitstream_reader
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecGetBitstreamPicData(RocdecBitstreamReader bs_reader_handle, uint8_t **pic_data, int *pic_size, int64_t *pts)
|
||||
//! Read one unit of picture data from the bitstream. The unit can be a frame or field for AVC/HEVC,
|
||||
//! a temporal unit for AV1, or a frame (including superframe) for VP9. The picture data unit is pointed
|
||||
//! by pic_data. The size of the unit is specified by pic_size. The presentation time stamp, if available,
|
||||
//! is given by pts.
|
||||
/************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecGetBitstreamPicData(RocdecBitstreamReader bs_reader_handle, uint8_t **pic_data, int *pic_size, int64_t *pts);
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup group_roc_bitstream_reader
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecDestroyBitstreamReader(RocdecBitstreamReader bs_reader_handle)
|
||||
//! Destroy the video parser object
|
||||
/************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecDestroyBitstreamReader(RocdecBitstreamReader bs_reader_handle);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
文件差异内容过多而无法显示
加载差异
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
Copyright (c) 2023 - 2026 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ROCDECAPI
|
||||
#if defined(_WIN32)
|
||||
#define ROCDECAPI __stdcall // for future: only linux is supported in this version
|
||||
#else
|
||||
#define ROCDECAPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#pragma once
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "rocdecode.h"
|
||||
#include "rocparser.h"
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief The AMD rocDecode Library.
|
||||
*
|
||||
* \defgroup group_amd_rocdecode rocDecode: AMD ROCm Software Decode API
|
||||
* \brief The rocDecodeHost is a part of rocDecode toolkit to decode videos and images using a avcodec based video decoder on ROCm.
|
||||
*/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/****************************************************************/
|
||||
//! \ingroup group_rocdec_struct
|
||||
//! \struct RocdecVideoFormatHost
|
||||
//! Video format including raw sequence header information
|
||||
//! Used in rocDecCreateVideoParser API
|
||||
/****************************************************************/
|
||||
typedef struct {
|
||||
RocdecVideoFormat video_format; /**< OUT: RocdecVideoFormat structure */
|
||||
rocDecVideoSurfaceFormat video_surface_format; /**< OUT: output surface format */
|
||||
uint32_t reserved[16]; // reserved for future
|
||||
} RocdecVideoFormatHost;
|
||||
|
||||
typedef int(ROCDECAPI *PFNVIDSEQUENCECHOSTALLBACK)(void *, RocdecVideoFormatHost *);
|
||||
typedef int(ROCDECAPI *PFNVIDDISPLAYHOSTCALLBACK)(void *, void *);
|
||||
|
||||
/******************************************************************************************/
|
||||
//! \struct _RocdecPicParamsHost
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Picture parameters for decoding
|
||||
//! This structure is used in rocDecDecodePictureHost API
|
||||
//! IN for rocDecDecodePictureHost
|
||||
/******************************************************************************************/
|
||||
typedef struct _RocdecPicParamsHost {
|
||||
// Bitstream data
|
||||
uint32_t bitstream_data_len; /**< IN: Number of bytes in bitstream data buffer */
|
||||
const uint8_t *bitstream_data; /**< IN: Ptr to bitstream data for this picture (slice-layer) */
|
||||
uint32_t flags; /**< IN: Combination of ROCDEC_PKT_XXX flags */
|
||||
RocdecTimeStamp pts; /**< IN: Presentation time stamp (10MHz clock), only valid if ROCDEC_PKT_TIMESTAMP flag is set */
|
||||
} RocdecPicParamsHost;
|
||||
|
||||
|
||||
/**************************************************************************************************************/
|
||||
//! \struct RocDecoderHostCreateInfo
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! This structure is used in rocDecCreateDecoderHost API
|
||||
/**************************************************************************************************************/
|
||||
typedef struct _RocDecoderHostCreateInfo {
|
||||
uint32_t width; /**< IN: Coded sequence width in pixels */
|
||||
uint32_t height; /**< IN: Coded sequence height in pixels */
|
||||
uint32_t num_decode_threads; /**< IN: Maximum number of internal decode threads for multi-threading <default value 0: threading will be chosen as appropriate to get the max performace> */
|
||||
rocDecVideoCodec codec_type; /**< IN: rocDecVideoCodec_XXX */
|
||||
rocDecVideoChromaFormat chroma_format; /**< IN: rocDecVideoChromaFormat_XXX */
|
||||
uint32_t bit_depth_minus_8; /**< IN: The value "BitDepth minus 8" */
|
||||
uint32_t intra_decode_only; /**< IN: not used for avcodec based decoding (default value is 0). */
|
||||
uint32_t max_width; /**< IN: Coded sequence max width in pixels used with reconfigure Decoder */
|
||||
uint32_t max_height; /**< IN: Coded sequence max height in pixels used with reconfigure Decoder */
|
||||
struct {
|
||||
int16_t left;
|
||||
int16_t top;
|
||||
int16_t right;
|
||||
int16_t bottom;
|
||||
} display_rect; /**< IN: area of the frame that should be displayed */
|
||||
rocDecVideoSurfaceFormat output_format; /**< IN: rocDecVideoSurfaceFormat_XXX */
|
||||
uint32_t target_width; /**< IN: Post-processed output width (Should be aligned to 2) */
|
||||
uint32_t target_height; /**< IN: Post-processed output height (Should be aligned to 2) */
|
||||
uint32_t num_output_surfaces; /**< IN: Maximum number of output surfaces simultaneously mapped */
|
||||
struct {
|
||||
int16_t left;
|
||||
int16_t top;
|
||||
int16_t right;
|
||||
int16_t bottom;
|
||||
} target_rect; /**< IN: (for future use) target rectangle in the output frame (for aspect ratio conversion)
|
||||
if a null rectangle is specified, {0,0,target_width,target_height} will be used*/
|
||||
void *user_data; /**< IN: User data for callbacks */
|
||||
// callback functions to enable users to consume decoded data
|
||||
PFNVIDSEQUENCECHOSTALLBACK pfn_sequence_callback; /**< IN: Called before decoding frames and/or whenever there is a fmt change */
|
||||
PFNVIDDISPLAYCALLBACK pfn_display_picture; /**< IN: Called whenever a picture is ready to be displayed (display order) */
|
||||
PFNVIDSEIMSGCALLBACK pfn_get_sei_msg; /**< IN: Called when all SEI messages are parsed for particular frame */
|
||||
uint32_t reserved[4]; /**< Reserved for future use - set to zero */
|
||||
} RocDecoderHostCreateInfo;
|
||||
|
||||
|
||||
/*****************************************************************************************************/
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecCreateDecoderHost(rocDecDecoderHandle *decoder_handle, RocDecoderHostCreateInfo *decoder_create_info)
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Create the decoder object based on decoder_create_info. A handle to the created decoder is returned
|
||||
/*****************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecCreateDecoderHost(rocDecDecoderHandle *decoder_handle, RocDecoderHostCreateInfo *decoder_create_info);
|
||||
|
||||
/*****************************************************************************************************/
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecDestroyDecoderHost(rocDecDecoderHandle decoder_handle)
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Destroy the decoder object
|
||||
/*****************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecDestroyDecoderHost(rocDecDecoderHandle decoder_handle);
|
||||
|
||||
/**********************************************************************************************************************/
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecGetDecoderCapsHost(RocdecDecodeCaps *decode_caps)
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Queries decode capabilities of host based decoder based on codec type, chroma_format and BitDepthMinus8 parameters.
|
||||
//! 1. Application fills IN parameters codec_type, chroma_format and BitDepthMinus8 of RocdecDecodeCaps structure
|
||||
//! 2. For FFMpeg avcodec based decoder, this call returns success
|
||||
/**********************************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecGetDecoderCapsHost(RocdecDecodeCaps *decode_caps);
|
||||
|
||||
/*****************************************************************************************************/
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecDecodeFrameHost(rocDecDecoderHandle decoder_handle, RocdecPicParamsHost *pic_params)
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Decodes a single picture
|
||||
//! Submits the frame for host based decoding
|
||||
/*****************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecDecodeFrameHost(rocDecDecoderHandle decoder_handle, RocdecPicParamsHost *pic_params);
|
||||
|
||||
/************************************************************************************************************/
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecGetDecodeStatusHost(rocDecDecoderHandle decoder_handle, int pic_idx, RocdecDecodeStatus* decode_status);
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Get the decode status for frame corresponding to nPicIdx
|
||||
//! API is currently supported for HEVC, AVC/H264 and JPEG codecs.
|
||||
//! API returns ROCDEC_NOT_SUPPORTED error code for unsupported codec.
|
||||
/************************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecGetDecodeStatusHost(rocDecDecoderHandle decoder_handle, int pic_idx, RocdecDecodeStatus *decode_status);
|
||||
|
||||
/*********************************************************************************************************/
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecReconfigureDecoderHost(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params)
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Used to reuse single decoder for multiple clips. Currently supports resolution change, resize params
|
||||
//! params, target area params change for same codec. Must be called during RocdecParserParams::pfn_sequence_callback
|
||||
/*********************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecReconfigureDecoderHost(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params);
|
||||
|
||||
/************************************************************************************************************************/
|
||||
//! \fn extern rocDecStatus ROCDECAPI rocDecGetVideoFrameHost(rocDecDecoderHandle decoder_handle, int pic_idx,
|
||||
//! uint32_t *frame_data, uint32_t *line_size,
|
||||
//! RocdecProcParams *vid_postproc_params);
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Post-process and map video frame corresponding to pic_idx for use in HIP. Returns HIP device pointer and associated
|
||||
//! line_size of the video frame. Returns host memory pointers and pitch for each plane (Y, U and V) seperately
|
||||
//! line_size is a pointer to an unsigned 32-bit integer array of size 3.
|
||||
/************************************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecGetVideoFrameHost(rocDecDecoderHandle decoder_handle, int pic_idx,
|
||||
void **frame_data, uint32_t *line_size,
|
||||
RocdecProcParams *vid_postproc_params);
|
||||
|
||||
/*****************************************************************************************************/
|
||||
//! \fn const char* ROCDECAPI rocDecGetErrorNameHost(rocDecStatus rocdec_status)
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Return name of the specified error code in text form.
|
||||
/*****************************************************************************************************/
|
||||
extern const char *ROCDECAPI rocDecGetErrorNameHost(rocDecStatus rocdec_status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,297 @@
|
||||
/*
|
||||
Copyright (c) 2023 - 2026 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rocdecode/rocdecode.h"
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief The AMD rocParser Library.
|
||||
*
|
||||
* \defgroup group_rocparser rocDecode Parser: AMD ROCm Video Parser API
|
||||
* \brief AMD The rocDecode video parser for AMD’s GPUs.
|
||||
* \defgroup group_rocdec_struct rocDecode Parser Structs: AMD ROCm Video Parser Structs
|
||||
* \brief AMD The rocDecode video parser struct
|
||||
*/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*********************************************************************************/
|
||||
//! HANDLE pf rocDecDecoder
|
||||
//! Used in subsequent API calls after rocDecCreateDecoder
|
||||
/*********************************************************************************/
|
||||
|
||||
typedef void *RocdecVideoParser;
|
||||
typedef uint64_t RocdecTimeStamp;
|
||||
|
||||
/***************************************************************/
|
||||
//! \enum RocdecReconfigOptions
|
||||
//! Decoder reconfigure options for VP9 decode
|
||||
//! Used in RocdecVideoFormat structure
|
||||
/***************************************************************/
|
||||
typedef enum {
|
||||
ROCDEC_RECONFIG_NEW_SURFACES = 0, /**< Allocate new surfaces during decoder reconfig */
|
||||
ROCDEC_RECONFIG_KEEP_SURFACES = 1, /**< Keep existing surfaces during decoder reconfig */
|
||||
} RocdecReconfigOptions;
|
||||
|
||||
/**
|
||||
* @brief ROCDEC_VIDEO_FORMAT struct
|
||||
* @ingroup group_rocdec_struct
|
||||
* Used in Parser callback API
|
||||
*/
|
||||
typedef struct {
|
||||
rocDecVideoCodec codec; /**< OUT: Compression format */
|
||||
/**
|
||||
* OUT: frame rate = numerator / denominator (for example: 30000/1001)
|
||||
*/
|
||||
struct {
|
||||
/**< OUT: frame rate numerator (0 = unspecified or variable frame rate) */
|
||||
uint32_t numerator;
|
||||
/**< OUT: frame rate denominator (0 = unspecified or variable frame rate) */
|
||||
uint32_t denominator;
|
||||
} frame_rate;
|
||||
uint8_t progressive_sequence; /**< OUT: 0=interlaced, 1=progressive */
|
||||
uint8_t bit_depth_luma_minus8; /**< OUT: high bit depth luma. E.g, 2 for 10-bitdepth, 4 for 12-bitdepth */
|
||||
uint8_t bit_depth_chroma_minus8; /**< OUT: high bit depth chroma. E.g, 2 for 10-bitdepth, 4 for 12-bitdepth */
|
||||
uint8_t min_num_decode_surfaces; /**< OUT: Minimum number of decode surfaces to be allocated for correct
|
||||
decoding. The client can send this value in num_decode_surfaces.
|
||||
This guarantees correct functionality and optimal video memory
|
||||
usage but not necessarily the best performance, which depends on
|
||||
the design of the overall application. The optimal number of
|
||||
decode surfaces (in terms of performance and memory utilization)
|
||||
should be decided by experimentation for each application, but it
|
||||
cannot go below min_num_decode_surfaces.
|
||||
If this value is used for num_decode_surfaces then it must be
|
||||
returned to parser during sequence callback. */
|
||||
uint32_t coded_width; /**< OUT: coded frame width in pixels */
|
||||
uint32_t coded_height; /**< OUT: coded frame height in pixels */
|
||||
/**
|
||||
* area of the frame that should be displayed
|
||||
* typical example:
|
||||
* coded_width = 1920, coded_height = 1088
|
||||
* display_area = { 0,0,1920,1080 }
|
||||
*/
|
||||
struct {
|
||||
int left; /**< OUT: left position of display rect */
|
||||
int top; /**< OUT: top position of display rect */
|
||||
int right; /**< OUT: right position of display rect */
|
||||
int bottom; /**< OUT: bottom position of display rect */
|
||||
} display_area;
|
||||
rocDecVideoChromaFormat chroma_format; /**< OUT: Chroma format */
|
||||
uint32_t bitrate; /**< OUT: video bitrate (bps, 0=unknown) */
|
||||
/**
|
||||
* OUT: Display Aspect Ratio = x:y (4:3, 16:9, etc)
|
||||
*/
|
||||
struct {
|
||||
int x;
|
||||
int y;
|
||||
} display_aspect_ratio;
|
||||
/**
|
||||
* Video Signal Description
|
||||
* Refer section E.2.1 (VUI parameters semantics) of H264 spec file
|
||||
*/
|
||||
struct {
|
||||
uint8_t video_format : 3; /**< OUT: 0-Component, 1-PAL, 2-NTSC, 3-SECAM, 4-MAC, 5-Unspecified */
|
||||
uint8_t video_full_range_flag : 1; /**< OUT: indicates the black level and luma and chroma range */
|
||||
uint8_t reserved_zero_bits : 4; /**< Reserved bits */
|
||||
uint8_t color_primaries; /**< OUT: chromaticity coordinates of source primaries */
|
||||
uint8_t transfer_characteristics; /**< OUT: opto-electronic transfer characteristic of the source picture */
|
||||
uint8_t matrix_coefficients; /**< OUT: used in deriving luma and chroma signals from RGB primaries */
|
||||
} video_signal_description;
|
||||
uint32_t seqhdr_data_length; /**< OUT: Additional bytes following (RocdecVideoFormatEx) */
|
||||
uint32_t reconfig_options; /**< OUT: Refer to RocdecReconfigOptions */
|
||||
} RocdecVideoFormat;
|
||||
|
||||
/****************************************************************/
|
||||
//! \ingroup group_rocdec_struct
|
||||
//! \struct RocdecVideoFormat
|
||||
//! Video format including raw sequence header information
|
||||
//! Used in rocDecCreateVideoParser API
|
||||
/****************************************************************/
|
||||
typedef struct {
|
||||
RocdecVideoFormat format; /**< OUT: RocdecVideoFormat structure */
|
||||
uint32_t max_width;
|
||||
uint32_t max_height;
|
||||
uint8_t raw_seqhdr_data[1024]; /**< OUT: Sequence header data */
|
||||
} RocdecVideoFormatEx;
|
||||
|
||||
/***************************************************************/
|
||||
//! \enum RocdecVideoPacketFlags
|
||||
//! Data packet flags
|
||||
//! Used in RocdecSourceDataPacket structure
|
||||
/***************************************************************/
|
||||
typedef enum {
|
||||
ROCDEC_PKT_ENDOFSTREAM = 0x01, /**< Set when this is the last packet for this stream */
|
||||
ROCDEC_PKT_TIMESTAMP = 0x02, /**< Timestamp is valid */
|
||||
ROCDEC_PKT_DISCONTINUITY = 0x04, /**< Set when a discontinuity has to be signalled */
|
||||
ROCDEC_PKT_ENDOFPICTURE = 0x08, /**< Set when the packet contains exactly one frame or one field */
|
||||
ROCDEC_PKT_NOTIFY_EOS = 0x10, /**< If this flag is set along with ROCDEC_PKT_ENDOFSTREAM, an additional (dummy)
|
||||
display callback will be invoked with null value of ROCDECPARSERDISPINFO which
|
||||
should be interpreted as end of the stream. */
|
||||
} RocdecVideoPacketFlags;
|
||||
|
||||
/*****************************************************************************/
|
||||
//! \ingroup group_rocdec_struct
|
||||
//! \struct RocdecSourceDataPacket
|
||||
//! Data Packet
|
||||
//! Used in rocDecParseVideoData API
|
||||
//! IN for rocDecParseVideoData
|
||||
/*****************************************************************************/
|
||||
typedef struct _RocdecSourceDataPacket {
|
||||
uint32_t flags; /**< IN: Combination of ROCDEC_PKT_XXX flags */
|
||||
uint32_t payload_size; /**< IN: number of bytes in the payload (may be zero if EOS flag is set) */
|
||||
const uint8_t *payload; /**< IN: Pointer to packet payload data (may be NULL if EOS flag is set) */
|
||||
RocdecTimeStamp pts; /**< IN: Presentation time stamp (10MHz clock), only valid if ROCDEC_PKT_TIMESTAMP flag is set */
|
||||
} RocdecSourceDataPacket;
|
||||
|
||||
/**********************************************************************************/
|
||||
/*! \brief Timing Info struct
|
||||
* \ingroup group_rocdec_struct
|
||||
* \struct RocdecParserDispInfo
|
||||
* \Used in rocdecParseVideoData API with PFNVIDDISPLAYCALLBACK pfn_display_picture
|
||||
*/
|
||||
/**********************************************************************************/
|
||||
typedef struct _RocdecParserDispInfo {
|
||||
int picture_index; /**< OUT: Index of the current picture */
|
||||
int progressive_frame; /**< OUT: 1 if progressive frame; 0 otherwise */
|
||||
int top_field_first; /**< OUT: 1 if top field is displayed first; 0 otherwise */
|
||||
int repeat_first_field; /**< OUT: Number of additional fields (1=ivtc, 2=frame doubling, 4=frame tripling, -1=unpaired field) */
|
||||
RocdecTimeStamp pts; /**< OUT: Presentation time stamp */
|
||||
} RocdecParserDispInfo;
|
||||
|
||||
/**
|
||||
* @brief RocdecOperatingPointInfo struct
|
||||
* @ingroup group_rocdec_struct
|
||||
* Operating point information of scalable bitstream
|
||||
*/
|
||||
typedef struct _RocdecOperatingPointInfo {
|
||||
rocDecVideoCodec codec;
|
||||
union {
|
||||
struct
|
||||
{
|
||||
uint8_t operating_points_cnt;
|
||||
uint8_t reserved24_bits[3];
|
||||
uint16_t operating_points_idc[32];
|
||||
} av1;
|
||||
uint8_t codec_reserved[1024];
|
||||
};
|
||||
} RocdecOperatingPointInfo;
|
||||
|
||||
/**********************************************************************************/
|
||||
//! \ingroup group_rocdec_struct
|
||||
//! \struct RocdecSeiMessage;
|
||||
//! Used in RocdecSeiMessageInfo structure
|
||||
/**********************************************************************************/
|
||||
typedef struct _RocdecSeiMessage {
|
||||
uint8_t sei_message_type; /**< OUT: SEI Message Type */
|
||||
uint8_t reserved[3];
|
||||
uint32_t sei_message_size; /**< OUT: SEI Message Size */
|
||||
} RocdecSeiMessage;
|
||||
|
||||
/**********************************************************************************/
|
||||
//! \ingroup group_rocdec_struct
|
||||
//! \struct RocdecSeiMessageInfo
|
||||
//! Used in rocDecParseVideoData API with PFNVIDSEIMSGCALLBACK pfn_get_sei_msg
|
||||
/**********************************************************************************/
|
||||
typedef struct _RocdecSeiMessageInfo {
|
||||
void *sei_data; /**< OUT: SEI Message Data */
|
||||
RocdecSeiMessage *sei_message; /**< OUT: SEI Message Info */
|
||||
uint32_t sei_message_count; /**< OUT: SEI Message Count */
|
||||
uint32_t picIdx; /**< OUT: SEI Message Pic Index */
|
||||
} RocdecSeiMessageInfo;
|
||||
|
||||
/**
|
||||
* @brief Parser callbacks
|
||||
* \ The parser will call these synchronously from within rocDecParseVideoData(), whenever there is sequence change or a picture
|
||||
* \ is ready to be decoded and/or displayed.
|
||||
* \ Return values from these callbacks are interpreted as below. If the callbacks return failure, it will be propagated by
|
||||
* \ rocDecParseVideoData() to the application.
|
||||
* \ Parser picks default operating point as 0 and outputAllLayers flag as 0 if PFNVIDOPPOINTCALLBACK is not set or return value is
|
||||
* \ -1 or invalid operating point.
|
||||
* \ PFNVIDSEQUENCECALLBACK : 0: fail, 1: succeeded, > 1: override dpb size of parser (set by RocdecParserParams::max_num_decode_surfaces
|
||||
* \ while creating parser)
|
||||
* \ PFNVIDDECODECALLBACK : 0: fail, >=1: succeeded
|
||||
* \ PFNVIDDISPLAYCALLBACK : 0: fail, >=1: succeeded
|
||||
* \ PFNVIDOPPOINTCALLBACK : <0: fail, >=0: succeeded (bit 0-9: OperatingPoint, bit 10-10: outputAllLayers, bit 11-30: reserved)
|
||||
* \ PFNVIDSEIMSGCALLBACK : 0: fail, >=1: succeeded
|
||||
*/
|
||||
typedef int(ROCDECAPI *PFNVIDSEQUENCECALLBACK)(void *, RocdecVideoFormat *);
|
||||
typedef int(ROCDECAPI *PFNVIDDECODECALLBACK)(void *, RocdecPicParams *);
|
||||
typedef int(ROCDECAPI *PFNVIDDISPLAYCALLBACK)(void *, RocdecParserDispInfo *);
|
||||
// typedef int (ROCDECAPI *PFNVIDOPPOINTCALLBACK)(void *, RocdecOperatingPointInfo*); // reserved for future (AV1 specific)
|
||||
typedef int(ROCDECAPI *PFNVIDSEIMSGCALLBACK)(void *, RocdecSeiMessageInfo *);
|
||||
|
||||
/**
|
||||
* \brief The AMD rocDecode library.
|
||||
* \ingroup group_rocdec_struct
|
||||
* \Used in rocDecCreateVideoParser API
|
||||
*/
|
||||
typedef struct _RocdecParserParams {
|
||||
rocDecVideoCodec codec_type; /**< IN: rocDecVideoCodec_XXX */
|
||||
uint32_t max_num_decode_surfaces; /**< IN: Max # of decode surfaces (parser will cycle through these) */
|
||||
uint32_t clock_rate; /**< IN: Timestamp units in Hz (0=default=10000000Hz) */
|
||||
uint32_t error_threshold; /**< IN: % Error threshold (0-100) for calling pfn_decode_picture (100=always IN: call pfn_decode_picture even if picture bitstream is fully corrupted) */
|
||||
uint32_t max_display_delay; /**< IN: Max display queue delay (improves pipelining of decode with display) 0 = no delay (recommended values: 2..4) */
|
||||
uint32_t annex_b : 1; /**< IN: AV1 annexB stream */
|
||||
uint32_t reserved : 31; /**< Reserved for future use - set to zero */
|
||||
uint32_t reserved_1[4]; /**< IN: Reserved for future use - set to 0 */
|
||||
void *user_data; /**< IN: User data for callbacks */
|
||||
PFNVIDSEQUENCECALLBACK pfn_sequence_callback; /**< IN: Called before decoding frames and/or whenever there is a fmt change */
|
||||
PFNVIDDECODECALLBACK pfn_decode_picture; /**< IN: Called when a picture is ready to be decoded (decode order) */
|
||||
PFNVIDDISPLAYCALLBACK pfn_display_picture; /**< IN: Called whenever a picture is ready to be displayed (display order) */
|
||||
PFNVIDSEIMSGCALLBACK pfn_get_sei_msg; /**< IN: Called when all SEI messages are parsed for particular frame */
|
||||
void *reserved_2[5]; /**< Reserved for future use - set to NULL */
|
||||
RocdecVideoFormatEx *ext_video_info; /**< IN: [Optional] sequence header data from system layer */
|
||||
} RocdecParserParams;
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup group_rocparser
|
||||
//! \fn rocDecodeStatus ROCDECAPI rocDecCreateVideoParser(RocdecVideoParser *parser_handle, RocdecParserParams *params)
|
||||
//! Create video parser object and initialize
|
||||
/************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecCreateVideoParser(RocdecVideoParser *parser_handle, RocdecParserParams *params);
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup group_rocparser
|
||||
//! \fn rocDecodeStatus ROCDECAPI rocDecParseVideoData(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet)
|
||||
//! Parse the video data from source data packet in pPacket
|
||||
//! Extracts parameter sets like SPS, PPS, bitstream etc. from pPacket and
|
||||
//! calls back pfn_decode_picture with RocdecPicParams data for kicking of HW decoding
|
||||
//! calls back pfn_sequence_callback with RocdecVideoFormat data for initial sequence header or when
|
||||
//! the decoder encounters a video format change
|
||||
//! calls back pfn_display_picture with RocdecParserDispInfo data to display a video frame
|
||||
/************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecParseVideoData(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet);
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup group_rocparser
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecDestroyVideoParser(RocdecVideoParser parser_handle)
|
||||
//! Destroy the video parser object
|
||||
/************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecDestroyVideoParser(RocdecVideoParser parser_handle);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright (c) 2024 - 2026 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _ROCDECODE_VERSION_H_
|
||||
#define _ROCDECODE_VERSION_H_
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief rocDecode version
|
||||
* \defgroup group_rocdecode_version rocDecode Version
|
||||
* \brief rocDecode version
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define ROCDECODE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define ROCDECODE_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define ROCDECODE_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||
|
||||
/**
|
||||
* ROCDECODE_CHECK_VERSION:
|
||||
* @major: major version, like 1 in 1.2.3
|
||||
* @minor: minor version, like 2 in 1.2.3
|
||||
* @patch: patch version, like 3 in 1.2.3
|
||||
*
|
||||
* Evaluates to %TRUE if the version of ROCDECODE is greater than
|
||||
* @major, @minor and @patch
|
||||
*/
|
||||
#define ROCDECODE_CHECK_VERSION(major, minor, patch) \
|
||||
(ROCDECODE_VERSION_MAJOR > (major) || \
|
||||
(ROCDECODE_VERSION_MAJOR == (major) && ROCDECODE_VERSION_MINOR > (minor)) || \
|
||||
(ROCDECODE_VERSION_MAJOR == (major) && ROCDECODE_VERSION_MINOR == (minor) && ROCDECODE_VERSION_PATCH >= (patch)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // end extern "C" block
|
||||
#endif
|
||||
|
||||
#endif //_ROCDECODE_VERSION_H_ header guard
|
||||
@@ -0,0 +1,158 @@
|
||||
################################################################################
|
||||
# Copyright (c) 2023 - 2026 Advanced Micro Devices, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
################################################################################
|
||||
################################################################################
|
||||
# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil)
|
||||
# Once done this will define
|
||||
#
|
||||
# FFMPEG_FOUND - system has ffmpeg or libav
|
||||
# FFMPEG_INCLUDE_DIR - the ffmpeg include directory
|
||||
# FFMPEG_LIBRARIES - Link these to use ffmpeg
|
||||
################################################################################
|
||||
|
||||
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig")
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(
|
||||
FFmpeg
|
||||
FOUND_VAR FFMPEG_FOUND
|
||||
REQUIRED_VARS
|
||||
FFMPEG_LIBRARIES
|
||||
FFMPEG_INCLUDE_DIR
|
||||
AVCODEC_INCLUDE_DIR
|
||||
AVCODEC_LIBRARY
|
||||
AVFORMAT_INCLUDE_DIR
|
||||
AVFORMAT_LIBRARY
|
||||
AVUTIL_INCLUDE_DIR
|
||||
AVUTIL_LIBRARY
|
||||
VERSION_VAR FFMPEG_VERSION
|
||||
)
|
||||
|
||||
if(FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
|
||||
set(FFMPEG_FOUND TRUE)
|
||||
else()
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
|
||||
pkg_check_modules(_FFMPEG_AVFORMAT libavformat)
|
||||
pkg_check_modules(_FFMPEG_AVUTIL libavutil)
|
||||
endif()
|
||||
|
||||
# AVCODEC
|
||||
find_path(AVCODEC_INCLUDE_DIR
|
||||
NAMES libavcodec/avcodec.h
|
||||
PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
PATH_SUFFIXES ffmpeg libav
|
||||
)
|
||||
mark_as_advanced(AVCODEC_INCLUDE_DIR)
|
||||
find_library(AVCODEC_LIBRARY
|
||||
NAMES avcodec
|
||||
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS}
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
mark_as_advanced(AVCODEC_LIBRARY)
|
||||
|
||||
# AVFORMAT
|
||||
find_path(AVFORMAT_INCLUDE_DIR
|
||||
NAMES libavformat/avformat.h
|
||||
PATHS ${_FFMPEG_AVFORMAT_INCLUDE_DIRS}
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
PATH_SUFFIXES ffmpeg libav
|
||||
)
|
||||
mark_as_advanced(AVFORMAT_INCLUDE_DIR)
|
||||
find_library(AVFORMAT_LIBRARY
|
||||
NAMES avformat
|
||||
PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS}
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
mark_as_advanced(AVFORMAT_LIBRARY)
|
||||
|
||||
# AVUTIL
|
||||
find_path(AVUTIL_INCLUDE_DIR
|
||||
NAMES libavutil/avutil.h
|
||||
PATHS ${_FFMPEG_AVUTIL_INCLUDE_DIRS}
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
PATH_SUFFIXES ffmpeg libav
|
||||
)
|
||||
mark_as_advanced(AVUTIL_INCLUDE_DIR)
|
||||
find_library(AVUTIL_LIBRARY
|
||||
NAMES avutil
|
||||
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS}
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
mark_as_advanced(AVUTIL_LIBRARY)
|
||||
|
||||
if(AVCODEC_LIBRARY AND AVFORMAT_LIBRARY)
|
||||
set(FFMPEG_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if(_FFMPEG_AVCODEC_VERSION VERSION_LESS 58.18.100 OR _FFMPEG_AVFORMAT_VERSION VERSION_LESS 58.12.100 OR _FFMPEG_AVUTIL_VERSION VERSION_LESS 56.14.100)
|
||||
if(FFMPEG_FOUND)
|
||||
message("-- ${White}FFMPEG required min version - 4.0.4 Found:${FFMPEG_VERSION}")
|
||||
message("-- ${White}AVCODEC required min version - 58.18.100 Found:${_FFMPEG_AVCODEC_VERSION}${ColourReset}")
|
||||
message("-- ${White}AVFORMAT required min version - 58.12.100 Found:${_FFMPEG_AVFORMAT_VERSION}${ColourReset}")
|
||||
message("-- ${White}AVUTIL required min version - 56.14.100 Found:${_FFMPEG_AVUTIL_VERSION}${ColourReset}")
|
||||
endif()
|
||||
set(FFMPEG_FOUND FALSE)
|
||||
message( "-- ${Yellow}NOTE: FindFFmpeg failed to find -- FFMPEG${ColourReset}" )
|
||||
endif()
|
||||
|
||||
if(FFMPEG_FOUND)
|
||||
set(FFMPEG_INCLUDE_DIR ${AVFORMAT_INCLUDE_DIR} CACHE INTERNAL "")
|
||||
set(FFMPEG_LIBRARIES
|
||||
${AVCODEC_LIBRARY}
|
||||
${AVFORMAT_LIBRARY}
|
||||
${AVUTIL_LIBRARY}
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
endif()
|
||||
|
||||
if(FFMPEG_FOUND)
|
||||
message("-- ${White}Using FFMPEG -- \n\tLibraries:${FFMPEG_LIBRARIES} \n\tIncludes:${FFMPEG_INCLUDE_DIR}${ColourReset}")
|
||||
else()
|
||||
if(FFmpeg_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "{Red}FindFFmpeg -- libavcodec or libavformat or libavutil NOT FOUND${ColourReset}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
################################################################################
|
||||
# Copyright (c) 2024 - 2026 Advanced Micro Devices, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
find_library(LIBDRM_AMDGPU_LIBRARY NAMES drm_amdgpu HINTS ${ROCM_PATH}/lib/rocm_sysdeps/lib /opt/amdgpu/lib/x86_64-linux-gnu /opt/amdgpu/lib64 /usr/lib/x86_64-linux-gnu /usr/lib64)
|
||||
find_path(LIBDRM_AMDGPU_INCLUDE_DIR NAMES libdrm/amdgpu.h libdrm/amdgpu_drm.h PATHS ${ROCM_PATH}/lib/rocm_sysdeps/include /opt/amdgpu/include /usr/include /usr/ /usr/local/include NO_DEFAULT_PATH)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libdrm_amdgpu DEFAULT_MSG LIBDRM_AMDGPU_INCLUDE_DIR LIBDRM_AMDGPU_LIBRARY)
|
||||
mark_as_advanced(LIBDRM_AMDGPU_INCLUDE_DIR LIBDRM_AMDGPU_LIBRARY)
|
||||
|
||||
if(Libdrm_amdgpu_FOUND)
|
||||
if(NOT TARGET Libdrm_amdgpu::drm_amdgpu)
|
||||
add_library(Libdrm_amdgpu::drm_amdgpu UNKNOWN IMPORTED)
|
||||
set_target_properties(Libdrm_amdgpu::drm_amdgpu PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBDRM_AMDGPU_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${LIBDRM_AMDGPU_LIBRARY}")
|
||||
endif()
|
||||
message("-- ${White}Using Libdrm_amdgpu -- \n\tLibraries:${LIBDRM_AMDGPU_LIBRARY} \n\tIncludes:${LIBDRM_AMDGPU_INCLUDE_DIR} ${ColourReset}")
|
||||
else()
|
||||
if(Libdrm_amdgpu_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "{Red}FindLibdrm_amdgpu -- Libdrm_admgpu NOT FOUND${ColourReset}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,63 @@
|
||||
################################################################################
|
||||
# Copyright (c) 2023 - 2026 Advanced Micro Devices, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
find_library(LIBVA_LIBRARY NAMES va HINTS ${ROCM_PATH}/lib/rocm_sysdeps/lib /opt/amdgpu/lib/x86_64-linux-gnu /opt/amdgpu/lib64 /usr/lib/x86_64-linux-gnu /usr/lib64)
|
||||
find_library(LIBVA_DRM_LIBRARY NAMES va-drm HINTS ${ROCM_PATH}/lib/rocm_sysdeps/lib /opt/amdgpu/lib/x86_64-linux-gnu /opt/amdgpu/lib64 /usr/lib/x86_64-linux-gnu /usr/lib64)
|
||||
find_path(LIBVA_INCLUDE_DIR NAMES va/va.h PATHS ${ROCM_PATH}/lib/rocm_sysdeps/include /opt/amdgpu/include /usr/include NO_DEFAULT_PATH)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libva DEFAULT_MSG LIBVA_INCLUDE_DIR LIBVA_LIBRARY)
|
||||
mark_as_advanced(LIBVA_INCLUDE_DIR LIBVA_LIBRARY LIBVA_DRM_LIBRARY)
|
||||
|
||||
if(Libva_FOUND)
|
||||
# Find VA Version
|
||||
file(READ "${LIBVA_INCLUDE_DIR}/va/va_version.h" VA_VERSION_FILE)
|
||||
string(REGEX MATCH "VA_MAJOR_VERSION ([0-9]*)" _ ${VA_VERSION_FILE})
|
||||
set(Libva_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "VA_MINOR_VERSION ([0-9]*)" _ ${VA_VERSION_FILE})
|
||||
set(Libva_VERSION_MINOR ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "VA_MICRO_VERSION ([0-9]*)" _ ${VA_VERSION_FILE})
|
||||
set(Libva_VERSION_MICRO ${CMAKE_MATCH_1})
|
||||
set(Libva_VERSION "${Libva_VERSION_MAJOR}.${Libva_VERSION_MINOR}.${Libva_VERSION_MICRO}")
|
||||
message("-- ${White}Found Libva Version: ${Libva_VERSION}${ColourReset}")
|
||||
|
||||
endif()
|
||||
|
||||
if(Libva_FOUND)
|
||||
if(NOT TARGET Libva::va)
|
||||
add_library(Libva::va UNKNOWN IMPORTED)
|
||||
set_target_properties(Libva::va PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBVA_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${LIBVA_LIBRARY}")
|
||||
endif()
|
||||
if(NOT TARGET Libva::va_drm)
|
||||
add_library(Libva::va_drm UNKNOWN IMPORTED)
|
||||
set_target_properties(Libva::va_drm PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBVA_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${LIBVA_DRM_LIBRARY}")
|
||||
endif()
|
||||
message("-- ${White}Using Libva -- \n\tLibraries:${LIBVA_LIBRARY} \n\tIncludes:${LIBVA_INCLUDE_DIR}${ColourReset}")
|
||||
message("-- ${White}Using Libva-drm -- \n\tLibraries:${LIBVA_DRM_LIBRARY}${ColourReset}")
|
||||
else()
|
||||
if(Libva_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "{Red}FindLibva -- Libva NOT FOUND${ColourReset}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,36 @@
|
||||
# - Config file for the rocdecode package
|
||||
# It defines the following variables
|
||||
# use rocdecode_INCLUDE_DIR or ROCDECODE_INCLUDE_DIR - include directory for rocdecode
|
||||
# use rocdecode_LIB_DIR or ROCDECODE_LIB_DIR - library directory for rocdecode
|
||||
# use rocdecode_LIBRARY or ROCDECODE_LIBRARY - library to link against
|
||||
# use rocdecode_LIBRARIES or ROCDECODE_LIBRARIES - library to link against
|
||||
|
||||
# compute paths
|
||||
get_filename_component(@PROJECT_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
# version
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-config-version.cmake)
|
||||
set(@PROJECT_NAME@_VERSION ${PACKAGE_VERSION})
|
||||
|
||||
# targets
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(@PROJECT_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
set_and_check(@PROJECT_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@")
|
||||
set_and_check(@PROJECT_NAME@_LIBRARY "@PACKAGE_LIB_INSTALL_DIR@/lib@PROJECT_NAME@.so")
|
||||
set_and_check(@PROJECT_NAME@_LIBRARIES "@PACKAGE_LIB_INSTALL_DIR@/lib@PROJECT_NAME@.so")
|
||||
|
||||
if(NOT TARGET @PROJECT_NAME@::@PROJECT_NAME@)
|
||||
add_library(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE IMPORTED)
|
||||
set_target_properties(@PROJECT_NAME@::@PROJECT_NAME@ PROPERTIES INTERFACE_LINK_LIBRARIES ${@PROJECT_NAME@_LIBRARY})
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
@PROJECT_NAME@
|
||||
FOUND_VAR @PROJECT_NAME@_FOUND
|
||||
REQUIRED_VARS @PROJECT_NAME@_INCLUDE_DIR @PROJECT_NAME@_LIB_DIR @PROJECT_NAME@_LIBRARY @PROJECT_NAME@_LIBRARIES
|
||||
VERSION_VAR @PROJECT_NAME@_VERSION
|
||||
HANDLE_COMPONENTS)
|
||||
@@ -0,0 +1,36 @@
|
||||
# - Config file for the rocdecode-host package
|
||||
# It defines the following variables
|
||||
# use rocdecode-host_INCLUDE_DIR - include directory for rocdecode-host
|
||||
# use rocdecode-host_LIB_DIR - library directory for rocdecode-host
|
||||
# use rocdecode-host_LIBRARY - library to link against
|
||||
# use rocdecode-host_LIBRARIES - library to link against
|
||||
|
||||
# compute paths
|
||||
get_filename_component(@PROJECT_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
# version
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-config-version.cmake)
|
||||
set(@PROJECT_NAME@_VERSION ${PACKAGE_VERSION})
|
||||
|
||||
# targets
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(@PROJECT_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
set_and_check(@PROJECT_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@")
|
||||
set_and_check(@PROJECT_NAME@_LIBRARY "@PACKAGE_LIB_INSTALL_DIR@/lib@PROJECT_NAME@.so")
|
||||
set_and_check(@PROJECT_NAME@_LIBRARIES "@PACKAGE_LIB_INSTALL_DIR@/lib@PROJECT_NAME@.so")
|
||||
|
||||
if(NOT TARGET rocdecode::@PROJECT_NAME@)
|
||||
add_library(rocdecode::@PROJECT_NAME@ INTERFACE IMPORTED)
|
||||
set_target_properties(rocdecode::@PROJECT_NAME@ PROPERTIES INTERFACE_LINK_LIBRARIES ${@PROJECT_NAME@_LIBRARY})
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
@PROJECT_NAME@
|
||||
FOUND_VAR @PROJECT_NAME@_FOUND
|
||||
REQUIRED_VARS @PROJECT_NAME@_INCLUDE_DIR @PROJECT_NAME@_LIB_DIR @PROJECT_NAME@_LIBRARY @PROJECT_NAME@_LIBRARIES
|
||||
VERSION_VAR @PROJECT_NAME@_VERSION
|
||||
HANDLE_COMPONENTS)
|
||||
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
@@ -0,0 +1,13 @@
|
||||
# rocDecode Docker
|
||||
|
||||
## Build - dockerfiles
|
||||
|
||||
```
|
||||
sudo docker build -f {DOCKER_FILE_NAME}.dockerfile -t {DOCKER_IMAGE_NAME} .
|
||||
```
|
||||
|
||||
## Run - docker
|
||||
|
||||
```
|
||||
sudo docker run -it --device=/dev/kfd --device=/dev/dri --cap-add=SYS_RAWIO --device=/dev/mem --group-add video --network host --privileged {DOCKER_IMAGE_NAME}
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
# install base dependencies
|
||||
RUN apt-get update -y
|
||||
#RUN apt-get dist-upgrade -y
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install gcc g++ cmake pkg-config git apt-utils sudo vainfo dialog
|
||||
|
||||
# install ROCm
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install initramfs-tools libnuma-dev wget keyboard-configuration && \
|
||||
wget https://repo.radeon.com/amdgpu-install/6.1/ubuntu/focal/amdgpu-install_6.1.60100-1_all.deb && \
|
||||
sudo apt-get install -y ./amdgpu-install_6.1.60100-1_all.deb && \
|
||||
sudo amdgpu-install -y --usecase=rocm
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
# install rocDecode package
|
||||
RUN DEBIAN_FRONTEND=noninteractive sudo apt install -y rocdecode rocdecode-dev rocdecode-test rocdecode-host
|
||||
@@ -0,0 +1,17 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
# install base dependencies
|
||||
RUN apt-get update -y
|
||||
#RUN apt-get dist-upgrade -y
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install gcc g++ cmake pkg-config git apt-utils sudo vainfo dialog libstdc++-12-dev
|
||||
|
||||
# install ROCm
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install initramfs-tools libnuma-dev wget keyboard-configuration && \
|
||||
wget https://repo.radeon.com/amdgpu-install/6.1/ubuntu/jammy/amdgpu-install_6.1.60100-1_all.deb && \
|
||||
sudo apt-get install -y ./amdgpu-install_6.1.60100-1_all.deb && \
|
||||
sudo amdgpu-install -y --usecase=rocm
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
# install rocDecode package
|
||||
RUN DEBIAN_FRONTEND=noninteractive sudo apt install -y rocdecode rocdecode-dev rocdecode-test rocdecode-host
|
||||
@@ -0,0 +1,2 @@
|
||||
_build/
|
||||
_doxygen/
|
||||
@@ -0,0 +1,24 @@
|
||||
.. meta::
|
||||
:description: rocDecode memory types
|
||||
:keywords: parse video, parse, decode, video decoder, video decoding, rocDecode, AMD, ROCm, memory types
|
||||
|
||||
********************************************************************
|
||||
rocDecode surface data memory locations
|
||||
********************************************************************
|
||||
|
||||
Surface data memory refers to the memory used by rocDecode for decoded frames and processing results. There are three locations where surface data memory can be stored: device memory, host memory, and internal memory.
|
||||
|
||||
Device memory refers to GPU memory. It's optimized for operations performed by the GPU, avoiding unnecessary memory transfers between the device and the host. It's used for standalone GPU processing and high-performance computing tasks where multiple operations are performed on the same data.
|
||||
|
||||
|
||||
Host memory refers to CPU memory. It's suitable for when the memory needs to be accessed or manipulated by CPU-side applications or when data needs to be transferred between systems.
|
||||
|
||||
Internal memory refers to intermediate GPU memory that is shared between operators. It's optimized for operator chaining within GPU workflows. It keeps data localized on the GPU so it can be accessed by subsequent operations, reducing latency and improving throughput. For example, in image processing pipelines, the results of a resizing operator can directly feed into a filtering operator without needing to copy data to the host between each step. This optimization is especially useful for large datasets and real-time applications.
|
||||
|
||||
|
||||
The ``OutputSurfaceMemoryType_enum`` enum type defines ``OUT_SURFACE_MEM_DEV_COPIED``, ``OUT_SURFACE_MEM_HOST_COPIED``, and ``OUT_SURFACE_MEM_DEV_INTERNAL``, for the three different types of memory locations. ``OUT_SURFACE_MEM_DEV_COPIED`` indicates device, or GPU, memory. ``OUT_SURFACE_MEM_HOST_COPIED`` indicates host, or CPU, memory. And ``OUT_SURFACE_MEM_DEV_INTERNAL`` indicates intermediate GPU memory.
|
||||
|
||||
``OUT_SURFACE_MEM_DEV_COPIED`` is not supported when the FFmpeg decoder is used.
|
||||
|
||||
A fourth enum, ``OUT_SURFACE_MEM_NOT_MAPPED``, is used only for performance purposes. The decoded frames are not available when this memory type is used.
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
.. meta::
|
||||
:description: Video decoding pipeline
|
||||
:keywords: video decoder, video decoding, rocDecode, AMD, ROCm
|
||||
|
||||
********************************************************************
|
||||
Video decoding pipeline
|
||||
********************************************************************
|
||||
|
||||
.. image:: ../data/VideoDecoderPipelinetest.png
|
||||
:alt: Video decoder pipeline test
|
||||
|
||||
There are three main components in rocDecode:
|
||||
|
||||
* Demuxer: Our demuxer is based on FFmpeg, a leading multimedia framework. For more information,
|
||||
refer to the `FFmpeg website <https://ffmpeg.org/about.html>`_.
|
||||
* Video parser APIs
|
||||
* Video decoder APIs
|
||||
|
||||
rocDecode follows this workflow:
|
||||
|
||||
1. The demuxer extracts a segment of video data and sends it to the video parser.
|
||||
2. The video parser extracts crucial information, such as picture and slice parameters, and sends it to
|
||||
the decoder APIs.
|
||||
3. The hardware receives the picture and slice parameters, then decodes a frame using Video
|
||||
Acceleration API (VA-API).
|
||||
4. This process repeats in a loop until all frames have been decoded.
|
||||
|
||||
Steps in decoding video content for applications (available in the rocDecode Toolkit):
|
||||
|
||||
1. Demultiplex the content into elementary stream packets (FFmpeg)
|
||||
2. Parse the demultiplexed packets into video frames for the decoder provided by rocDecode API.
|
||||
3. Decode compressed video frames into YUV frames using rocDecode API.
|
||||
4. Wait for the decoding to finish.
|
||||
5. Get the decoded YUV frame from amd-gpu context to HIP (using VAAPI-HIP interoperability under
|
||||
ROCm).
|
||||
6. Run HIP kernels in the mapped YUV frame. For example, format conversion, scaling, object detection,
|
||||
classification, and others.
|
||||
7. Release the decoded frame.
|
||||
|
||||
.. note::
|
||||
YUV is a color space that represents images using luminance (Y) for brightness and two chrominance
|
||||
components (U and V) for color information.
|
||||
|
||||
The preceding steps are demonstrated in the sample applications located in our
|
||||
`GitHub repository <https://github.com/ROCm/rocDecode/tree/develop/samples>`_ directory.
|
||||
@@ -0,0 +1,57 @@
|
||||
# MIT License
|
||||
|
||||
# Copyright (c) 2023 - 2026 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# Configuration file for the Sphinx documentation builder.
|
||||
#
|
||||
# This file only contains a selection of the most common options. For a full
|
||||
# list see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
|
||||
import re
|
||||
|
||||
from rocm_docs import ROCmDocs
|
||||
|
||||
with open('../CMakeLists.txt', encoding='utf-8') as f:
|
||||
match = re.search(r'.*\bset\(VERSION\s+\"?([0-9.]+)[^0-9.]+', f.read())
|
||||
if not match:
|
||||
raise ValueError("VERSION not found!")
|
||||
version_number = match[1]
|
||||
left_nav_title = f"rocDecode {version_number} documentation"
|
||||
|
||||
# for PDF output on Read the Docs
|
||||
project = "rocDecode documentation"
|
||||
author = "Advanced Micro Devices, Inc."
|
||||
copyright = "Copyright (c) 2024 - 2026 Advanced Micro Devices, Inc. All rights reserved."
|
||||
version = version_number
|
||||
release = version_number
|
||||
|
||||
external_toc_path = "./sphinx/_toc.yml"
|
||||
|
||||
docs_core = ROCmDocs(left_nav_title)
|
||||
docs_core.run_doxygen(doxygen_root="doxygen", doxygen_path="doxygen/xml")
|
||||
docs_core.enable_api_reference()
|
||||
docs_core.setup()
|
||||
|
||||
external_projects_current_project = "rocdecode"
|
||||
|
||||
for sphinx_var in ROCmDocs.SPHINX_VARS:
|
||||
globals()[sphinx_var] = getattr(docs_core, sphinx_var)
|
||||
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 5.8 KiB |
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 49 KiB |
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 60 KiB |
@@ -0,0 +1,3 @@
|
||||
html/
|
||||
latex/
|
||||
xml/
|
||||
文件差异内容过多而无法显示
加载差异
@@ -0,0 +1,238 @@
|
||||
<doxygenlayout version="1.0">
|
||||
<!-- Generated by doxygen 1.9.7 -->
|
||||
<!-- Navigation index tabs for HTML output -->
|
||||
<navindex>
|
||||
<tab type="mainpage" visible="yes" title="Introduction"/>
|
||||
<tab type="pages" visible="yes" title="" intro=""/>
|
||||
<tab type="topics" visible="yes" title="rocDecode APIs" intro=""/>
|
||||
<tab type="namespaces" visible="yes" title="">
|
||||
<tab type="namespacelist" visible="yes" title="" intro=""/>
|
||||
<tab type="namespacemembers" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="concepts" visible="yes" title="">
|
||||
</tab>
|
||||
<tab type="interfaces" visible="yes" title="">
|
||||
<tab type="interfacelist" visible="yes" title="" intro=""/>
|
||||
<tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||
<tab type="interfacehierarchy" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="classes" visible="no" title="">
|
||||
<tab type="classlist" visible="no" title="" intro=""/>
|
||||
<tab type="hierarchy" visible="no" title="" intro=""/>
|
||||
<tab type="classmembers" visible="no" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="structs" visible="no" title="">
|
||||
<tab type="structlist" visible="no" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="exceptions" visible="yes" title="">
|
||||
<tab type="exceptionlist" visible="yes" title="" intro=""/>
|
||||
<tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||
<tab type="exceptionhierarchy" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="files" visible="yes" title="rocDecode Header Files">
|
||||
<tab type="filelist" visible="no" title="" intro=""/>
|
||||
<tab type="globals" visible="no" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="examples" visible="yes" title="" intro=""/>
|
||||
</navindex>
|
||||
|
||||
<!-- Layout definition for a class page -->
|
||||
<class>
|
||||
<briefdescription visible="yes"/>
|
||||
<includes visible="$SHOW_HEADERFILE"/>
|
||||
<inheritancegraph visible="$CLASS_GRAPH"/>
|
||||
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
|
||||
<memberdecl>
|
||||
<nestedclasses visible="yes" title=""/>
|
||||
<publictypes title=""/>
|
||||
<services title=""/>
|
||||
<interfaces title=""/>
|
||||
<publicslots title=""/>
|
||||
<signals title=""/>
|
||||
<publicmethods title=""/>
|
||||
<publicstaticmethods title=""/>
|
||||
<publicattributes title=""/>
|
||||
<publicstaticattributes title=""/>
|
||||
<protectedtypes title=""/>
|
||||
<protectedslots title=""/>
|
||||
<protectedmethods title=""/>
|
||||
<protectedstaticmethods title=""/>
|
||||
<protectedattributes title=""/>
|
||||
<protectedstaticattributes title=""/>
|
||||
<packagetypes title=""/>
|
||||
<packagemethods title=""/>
|
||||
<packagestaticmethods title=""/>
|
||||
<packageattributes title=""/>
|
||||
<packagestaticattributes title=""/>
|
||||
<properties title=""/>
|
||||
<events title=""/>
|
||||
<privatetypes title=""/>
|
||||
<privateslots title=""/>
|
||||
<privatemethods title=""/>
|
||||
<privatestaticmethods title=""/>
|
||||
<privateattributes title=""/>
|
||||
<privatestaticattributes title=""/>
|
||||
<friends title=""/>
|
||||
<related title="" subtitle=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<services title=""/>
|
||||
<interfaces title=""/>
|
||||
<constructors title=""/>
|
||||
<functions title=""/>
|
||||
<related title=""/>
|
||||
<variables title=""/>
|
||||
<properties title=""/>
|
||||
<events title=""/>
|
||||
</memberdef>
|
||||
<allmemberslink visible="yes"/>
|
||||
<usedfiles visible="$SHOW_USED_FILES"/>
|
||||
<authorsection visible="yes"/>
|
||||
</class>
|
||||
|
||||
<!-- Layout definition for a namespace page -->
|
||||
<namespace>
|
||||
<briefdescription visible="yes"/>
|
||||
<memberdecl>
|
||||
<nestednamespaces visible="yes" title=""/>
|
||||
<constantgroups visible="yes" title=""/>
|
||||
<interfaces visible="yes" title=""/>
|
||||
<classes visible="yes" title=""/>
|
||||
<concepts visible="yes" title=""/>
|
||||
<structs visible="yes" title=""/>
|
||||
<exceptions visible="yes" title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
</memberdef>
|
||||
<authorsection visible="yes"/>
|
||||
</namespace>
|
||||
|
||||
<!-- Layout definition for a concept page -->
|
||||
<concept>
|
||||
<briefdescription visible="yes"/>
|
||||
<includes visible="$SHOW_HEADERFILE"/>
|
||||
<definition visible="yes" title=""/>
|
||||
<detaileddescription title=""/>
|
||||
<authorsection visible="yes"/>
|
||||
</concept>
|
||||
|
||||
<!-- Layout definition for a file page -->
|
||||
<file>
|
||||
<briefdescription visible="yes"/>
|
||||
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||
<includegraph visible="$INCLUDE_GRAPH"/>
|
||||
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
|
||||
<sourcelink visible="yes"/>
|
||||
<memberdecl>
|
||||
<interfaces visible="yes" title=""/>
|
||||
<classes visible="yes" title=""/>
|
||||
<structs visible="yes" title=""/>
|
||||
<exceptions visible="yes" title=""/>
|
||||
<namespaces visible="yes" title=""/>
|
||||
<concepts visible="yes" title=""/>
|
||||
<constantgroups visible="yes" title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
</memberdef>
|
||||
<authorsection/>
|
||||
</file>
|
||||
|
||||
<!-- Layout definition for a group page -->
|
||||
<group>
|
||||
<briefdescription visible="yes"/>
|
||||
<groupgraph visible="$GROUP_GRAPHS"/>
|
||||
<memberdecl>
|
||||
<nestedgroups visible="yes" title=""/>
|
||||
<dirs visible="yes" title=""/>
|
||||
<files visible="yes" title=""/>
|
||||
<namespaces visible="yes" title=""/>
|
||||
<concepts visible="yes" title=""/>
|
||||
<classes visible="yes" title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<enumvalues title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<signals title=""/>
|
||||
<publicslots title=""/>
|
||||
<protectedslots title=""/>
|
||||
<privateslots title=""/>
|
||||
<events title=""/>
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<pagedocs/>
|
||||
<inlineclasses title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<sequences title=""/>
|
||||
<dictionaries title=""/>
|
||||
<enums title=""/>
|
||||
<enumvalues title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<signals title=""/>
|
||||
<publicslots title=""/>
|
||||
<protectedslots title=""/>
|
||||
<privateslots title=""/>
|
||||
<events title=""/>
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
</memberdef>
|
||||
<authorsection visible="yes"/>
|
||||
</group>
|
||||
|
||||
<!-- Layout definition for a directory page -->
|
||||
<directory>
|
||||
<briefdescription visible="yes"/>
|
||||
<directorygraph visible="yes"/>
|
||||
<memberdecl>
|
||||
<dirs visible="yes"/>
|
||||
<files visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
</directory>
|
||||
</doxygenlayout>
|
||||
@@ -0,0 +1,76 @@
|
||||
.. meta::
|
||||
:description: Using the rocDecode bitstream reader API
|
||||
:keywords: rocDecode, AMD, ROCm, bitstream decoder
|
||||
|
||||
********************************************************************
|
||||
Using the rocDecode bitstream reader APIs
|
||||
********************************************************************
|
||||
|
||||
The rocDecode bitstream reader APIs are a simplified set of APIs that provide a way to use and test the decoder without relying on FFMpeg. The bitstream reader APIs can be used to extract and parse coded picture data from an elementary video stream for the decoder to consume.
|
||||
|
||||
.. note::
|
||||
|
||||
The bitstream reader APIs can only be used with elementary video streams and IVF container files.
|
||||
|
||||
|
||||
The |videodecoderaw|_ sample demonstrates how to use the bitstream reader APIs, including how to create a bitstream reader and use it to extract picture data and pass it to the decoder:
|
||||
|
||||
.. code:: C++
|
||||
|
||||
RocdecBitstreamReader bs_reader = nullptr;
|
||||
rocDecVideoCodec rocdec_codec_id;
|
||||
int bit_depth;
|
||||
if (rocDecCreateBitstreamReader(&bs_reader, input_file_path.c_str()) != ROCDEC_SUCCESS) {
|
||||
std::cerr << "Failed to create the bitstream reader." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
[...]
|
||||
# Decode loop:
|
||||
do {
|
||||
if (rocDecGetBitstreamPicData(bs_reader, &pvideo, &n_video_bytes, &pts) != ROCDEC_SUCCESS) {
|
||||
std::cerr << "Failed to get picture data." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
[...]
|
||||
n_frame_returned = viddec.DecodeFrame(pvideo, n_video_bytes, pkg_flags, pts, &decoded_pics);
|
||||
}
|
||||
|
||||
|
||||
The ``videodecoderaw.cpp`` example also demonstrates how to use the bitstream reader APIs to obtain the bit depth and codec of a stream:
|
||||
|
||||
.. code:: C++
|
||||
|
||||
if (rocDecGetBitstreamCodecType(bs_reader, &rocdec_codec_id) != ROCDEC_SUCCESS) {
|
||||
std::cerr << "Failed to get stream codec type." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
[...]
|
||||
if (rocDecGetBitstreamBitDepth(bs_reader, &bit_depth) != ROCDEC_SUCCESS) {
|
||||
std::cerr << "Failed to get stream bit depth." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
``rocDecDestroyBitstreamReader`` must always be called to destroy the bitstream reader once processing is complete.
|
||||
|
||||
|
||||
.. |videodecode| replace:: ``videodecode.cpp``
|
||||
.. _videodecode: https://github.com/ROCm/rocDecode/tree/develop/samples/videoDecode/videodecode.cpp
|
||||
|
||||
.. |videodecoderaw| replace:: ``videodecoderaw.cpp``
|
||||
.. _videodecoderaw: https://github.com/ROCm/rocDecode/tree/develop/samples/videoDecodeRaw
|
||||
|
||||
.. |common| replace:: ``common.h``
|
||||
.. _common: https://github.com/ROCm/rocDecode/blob/develop/samples/common.h
|
||||
|
||||
.. |apifolder| replace:: ``api`` folder
|
||||
.. _apifolder: https://github.com/ROCm/rocDecode/tree/develop/api
|
||||
|
||||
.. |utilsfolder| replace:: ``utils`` folder
|
||||
.. _utilsfolder: https://github.com/ROCm/rocDecode/tree/develop/utils
|
||||
|
||||
|
||||
.. |reconfig_struct| replace:: ``ReconfigParams_t``
|
||||
.. _reconfig_struct: https://rocm.docs.amd.com/projects/rocDecode/en/latest/doxygen/html/structReconfigParams__t.html
|
||||
@@ -0,0 +1,96 @@
|
||||
.. meta::
|
||||
:description: Using rocDecode with the FFMpeg demultiplexer
|
||||
:keywords: parse video, parse, rocDecode, AMD, ROCm, FFmpeg demuxer
|
||||
|
||||
********************************************************************
|
||||
Using the rocDecode FFmpeg demultiplexer
|
||||
********************************************************************
|
||||
|
||||
The rocDecode FFmpeg demultiplexer (demuxer) extracts coded picture data from digital media files.
|
||||
|
||||
To use the rocDecode FFmpeg demuxer , import the ``video_demuxer.h`` header file.
|
||||
|
||||
.. code:: C++
|
||||
|
||||
#include "video_demuxer.h"
|
||||
|
||||
Instantiate a ``VideoDemuxer`` with the path to the video file. The ``GetCodecId`` and ``GetBitDepth`` functions can be used to obtain the video stream's codec ID and bit depth. The ``AVCodec2RocDecVideoCodec`` utility function converts the codec ID returned from the demuxer to its corresponding ``rocDecVideoCodec_enum`` value.
|
||||
|
||||
.. code:: C++
|
||||
|
||||
VideoDemuxer *demuxer;
|
||||
demuxer = new VideoDemuxer(input_file_path.c_str());
|
||||
rocdec_codec_id = AVCodec2RocDecVideoCodec(demuxer->GetCodecID());
|
||||
bit_depth = demuxer->GetBitDepth();
|
||||
|
||||
Call ``Demux`` to extract frame data from the stream:
|
||||
|
||||
.. code:: C++
|
||||
|
||||
demuxer->Demux(&pvideo, &n_video_bytes, &pts);
|
||||
|
||||
The demuxer will demultiplex frames sequentially starting at the beginning of the stream. To start the demultiplexing and decoding process from a different frame, create a seek context that specifies a seek criteria and a seek mode.
|
||||
|
||||
The seek criteria describes whether the demuxer needs to seek to a specific frame or seek to a specific timestamp. The seek mode indicates whether the demuxer should seek to the exact frame or to the previous keyframe.
|
||||
|
||||
The seek criteria is defined by the ``SeekCriteriaEnum`` enum and the seek mode is defined by the ``SeekModeEnum`` enum. Both the ``SeekCriteriaEnum`` and the ``SeekModeEnum`` are defined in ``video_demuxer.h``.
|
||||
|
||||
Set the seek criteria to ``SEEK_CRITERIA_FRAME_NUM`` to seek to a frame or to ``SEEK_CRITERIA_TIME_STAMP`` to seek to a timestamp. Set the seek mode to ``SEEK_MODE_EXACT_FRAME`` to seek to the exact frame or to ``SEEK_MODE_PREV_KEY_FRAME`` to seek to the previous keyframe.
|
||||
|
||||
From |videodecode|_:
|
||||
|
||||
.. code:: C++
|
||||
|
||||
VideoSeekContext video_seek_ctx;
|
||||
[...]
|
||||
do {
|
||||
[...]
|
||||
if (seek_criteria == 1 && first_frame) {
|
||||
// use VideoSeekContext class to seek to given frame number
|
||||
video_seek_ctx.seek_frame_ = seek_to_frame;
|
||||
video_seek_ctx.seek_crit_ = SEEK_CRITERIA_FRAME_NUM;
|
||||
video_seek_ctx.seek_mode_ = (seek_mode ? SEEK_MODE_EXACT_FRAME : SEEK_MODE_PREV_KEY_FRAME);
|
||||
demuxer->Seek(video_seek_ctx, &pvideo, &n_video_bytes);
|
||||
pts = video_seek_ctx.out_frame_pts_;
|
||||
std::cout << "info: Number of frames that were decoded during seek - " << video_seek_ctx.num_frames_decoded_ << std::endl;
|
||||
first_frame = false;
|
||||
} else if (seek_criteria == 2 && first_frame) {
|
||||
// use VideoSeekContext class to seek to given timestamp
|
||||
video_seek_ctx.seek_frame_ = seek_to_frame;
|
||||
video_seek_ctx.seek_crit_ = SEEK_CRITERIA_TIME_STAMP;
|
||||
video_seek_ctx.seek_mode_ = (seek_mode ? SEEK_MODE_EXACT_FRAME : SEEK_MODE_PREV_KEY_FRAME);
|
||||
demuxer->Seek(video_seek_ctx, &pvideo, &n_video_bytes);
|
||||
pts = video_seek_ctx.out_frame_pts_;
|
||||
std::cout << "info: Duration of frame found after seek - " << video_seek_ctx.out_frame_duration_ << " ms" << std::endl;
|
||||
first_frame = false;
|
||||
} else {
|
||||
demuxer->Demux(&pvideo, &n_video_bytes, &pts);
|
||||
}
|
||||
[...]
|
||||
} while (n_video_bytes);
|
||||
|
||||
Delete the demuxer once demultiplexing is complete.
|
||||
|
||||
.. code:: C++
|
||||
|
||||
delete demuxer;
|
||||
|
||||
.. |videodecode| replace:: ``videodecode.cpp``
|
||||
.. _videodecode: https://github.com/ROCm/rocDecode/tree/develop/samples/videoDecode/videodecode.cpp
|
||||
|
||||
.. |videodecoderaw| replace:: ``videodecoderaw.cpp``
|
||||
.. _videodecoderaw: https://github.com/ROCm/rocDecode/tree/develop/samples/videoDecodeRaw
|
||||
|
||||
.. |common| replace:: ``common.h``
|
||||
.. _common: https://github.com/ROCm/rocDecode/blob/develop/samples/common.h
|
||||
|
||||
.. |apifolder| replace:: ``api`` folder
|
||||
.. _apifolder: https://github.com/ROCm/rocDecode/tree/develop/api
|
||||
|
||||
.. |utilsfolder| replace:: ``utils`` folder
|
||||
.. _utilsfolder: https://github.com/ROCm/rocDecode/tree/develop/utils
|
||||
|
||||
|
||||
.. |reconfig_struct| replace:: ``ReconfigParams_t``
|
||||
.. _reconfig_struct: https://rocm.docs.amd.com/projects/rocDecode/en/latest/doxygen/html/structReconfigParams__t.html
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
.. meta::
|
||||
:description: Using the rocDecode core API
|
||||
:keywords: rocDecode, AMD, ROCm, core API
|
||||
|
||||
********************************************************************
|
||||
Using the rocdecdecode example
|
||||
********************************************************************
|
||||
|
||||
rocDecode provides four core APIs exposed in the header files in the |apifolder|_ directory:
|
||||
|
||||
| The rocDecode parser API, exposed in ``rocparser.h``.
|
||||
| The hardware decoder API, exposed in ``rocdecode.h``.
|
||||
| The software decoder API, exposed in ``rocdecode_host.h``.
|
||||
| The bitstream reader API, exposed in ``roc_bitstream_reader.h``.
|
||||
|
||||
The |rocdecdecode|_ sample demonstrates how to use the rocDecode core APIs in an application. It shows how to use the parser and both the hardware and software decoders. For information on how to use the bitstream reader API, see :doc:`Using the rocDecode bitstream reader API <./using-rocDecode-bitstream>`.
|
||||
|
||||
The sample decodes raw elementary video frame files as input and produces individually decoded frames in YUV format as output. The input can be one individual frame file or multiple frames from one or more video files. The individual frame files must be numbered in ascending order of frames.
|
||||
|
||||
``rocdecdecode.cpp`` takes the following arguments:
|
||||
|
||||
.. list-table::
|
||||
:widths: 10 60 30
|
||||
:header-rows: 1
|
||||
|
||||
* - Argument
|
||||
- Description
|
||||
- Note
|
||||
|
||||
* - ``-i``
|
||||
- Path to the input video frame file or to frame folder.
|
||||
- Required.
|
||||
|
||||
* - ``-o``
|
||||
- Output path. Saves the decoded YUV frames to this folder.
|
||||
- Optional. Decoded frames aren't saved by default.
|
||||
|
||||
* - ``-d``
|
||||
- GPU device ID. Set it to 0 for the first device, 1 for the second device, 2 for the third device, and so on for each subsequent device.
|
||||
- Optional. Set to 0 by default.
|
||||
|
||||
* - ``-b``
|
||||
- Backend. Set it to 0 to use the hardware decoder on the GPU or to 1 to use the software decoder on the CPU.
|
||||
- Optional. Set to 0 by default.
|
||||
|
||||
|
||||
* - ``-c``
|
||||
- Codec. Set to 0 for HEVC, 1 for H264, 2 for AV1, 4 for VP9, 5 for VP8, or 6 for MJPEG.
|
||||
- Optional. Set to 0 by default.
|
||||
|
||||
* - ``-n``
|
||||
- Number of iterations for performance evaluation.
|
||||
- Optional. Set to 1 by default.
|
||||
|
||||
* - ``-m``
|
||||
- The output surface memory type. The memory type where the surface data, such as the decoded frames, resides. Set this to 0 for intermediate GPU memory, to 1 for GPU memory, and to 2 for CPU memory. See :doc:`Surface data memory locations <../conceptual/rocDecode-memory-types>` for more information.
|
||||
- Optional. Set to 0 by default.
|
||||
|
||||
The ``DecoderInfo`` struct defined in the sample is used to store user-supplied parameters as well as the decoder and parser handles.
|
||||
|
||||
The memory type and the type of decoder is set by the specified backend. If the GPU (device) backend is selected, both a parser and a hardware decoder are created. If the CPU (host) backend is selected, only a software decoder is created:
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
DecoderInfo dec_info;
|
||||
[...]
|
||||
int main(int argc, char** argv) {
|
||||
[...]
|
||||
dec_info.rocdec_codec_id = CodecTypeToRocDecVideoCodec(codec_type);
|
||||
dec_info.dec_device_id = device_id;
|
||||
dec_info.mem_type = (!backend) ? OUT_SURFACE_MEM_DEV_INTERNAL : OUT_SURFACE_MEM_HOST;
|
||||
init();
|
||||
if (backend == DECODER_BACKEND_DEVICE) {
|
||||
create_parser(dec_info);
|
||||
create_decoder(dec_info);
|
||||
} else {
|
||||
create_decoder_host(dec_info);
|
||||
}
|
||||
[...]
|
||||
}
|
||||
|
||||
All applications need to register the ``pfn_sequence_callback`` and ``pfn_display_picture`` callbacks. Applications that use the parser must also register the ``pfn_decode_picture`` callback.
|
||||
|
||||
When the GPU backend is selected, these callbacks are registered in the ``create_parser()`` function. ``create_parser`` also creates the parser using ``rocDecCreateVideoParser()``:
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
void create_parser(DecoderInfo& dec_info) {
|
||||
RocdecParserParams params = {};
|
||||
params.codec_type = dec_info.rocdec_codec_id;
|
||||
params.max_num_decode_surfaces = 6;
|
||||
params.max_display_delay = 1;
|
||||
params.user_data = &dec_info;
|
||||
params.pfn_sequence_callback = handle_video_sequence;
|
||||
params.pfn_decode_picture = handle_picture_decode;
|
||||
params.pfn_display_picture = handle_picture_display;
|
||||
CHECK(rocDecCreateVideoParser(&dec_info.parser, ¶ms));
|
||||
}
|
||||
|
||||
The ``create_decoder()`` function sets the decoder parameters and passes them to ``rocDecCreateDecoder()`` to create the hardware decoder:
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
void create_decoder(DecoderInfo& dec_info) {
|
||||
RocDecoderCreateInfo create_info = {};
|
||||
create_info.codec_type = dec_info.rocdec_codec_id; // user specified codec_type for raw files
|
||||
[...]
|
||||
CHECK(rocDecCreateDecoder(&dec_info.decoder, &create_info));
|
||||
}
|
||||
|
||||
The ``create_decoder_host()`` function performs the same actions as ``create_decoder()``, but uses ``rocDecCreateDecoderHost()`` to create a software decoder. Because the parser isn't used with the software decoder, and because the software decoder uses different function calls, the callbacks for the software decoder are registered in ``create_decoder_host()``:
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
void create_decoder_host(DecoderInfo& dec_info) {
|
||||
RocDecoderHostCreateInfo create_info = {};
|
||||
create_info.codec_type = dec_info.rocdec_codec_id;
|
||||
[...]
|
||||
create_info.pfn_sequence_callback = handle_video_sequence_host;
|
||||
create_info.pfn_display_picture = handle_picture_display_host;
|
||||
CHECK(rocDecCreateDecoderHost(&dec_info.decoder, &create_info));
|
||||
dec_info.backend = DECODER_BACKEND_HOST;
|
||||
}
|
||||
|
||||
After the decoder and parser have been created, ``decode_frames`` is called.
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
[...]
|
||||
dec_info.dump_decoded_frames = dump_output_frames;
|
||||
auto input_frames = read_frames(input_file_names);
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
for (int i = 0; i < num_iterations; i++) {
|
||||
decode_frames(dec_info, input_frames);
|
||||
}
|
||||
[...]
|
||||
}
|
||||
|
||||
``decode_frames`` calls ``rocDecParseVideoData()`` or ``rocDecDecodeFrameHost()``, depending on the backend, to parse and decode the frames:
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
void decode_frames(DecoderInfo& dec_info, const std::vector<std::vector<uint8_t>>& frames) {
|
||||
// gpu backend using VCN
|
||||
if (dec_info.backend == DECODER_BACKEND_DEVICE) {
|
||||
for (int i=0; i < static_cast<int>(frames.size()); ++i) {
|
||||
RocdecSourceDataPacket packet = {};
|
||||
packet.payload_size = frames[i].size();
|
||||
packet.payload = frames[i].data();
|
||||
if (i == static_cast<int>(frames.size() - 1)) {
|
||||
packet.flags = ROCDEC_PKT_ENDOFPICTURE; // mark end_of_picture flag for last frame
|
||||
}
|
||||
CHECK(rocDecParseVideoData(dec_info.parser, &packet));
|
||||
}
|
||||
} else if (dec_info.backend == DECODER_BACKEND_HOST) {
|
||||
for (int i=0; i < static_cast<int>(frames.size()); ++i) {
|
||||
RocdecPicParamsHost pic_params = {};
|
||||
pic_params.bitstream_data_len = frames[i].size();
|
||||
pic_params.bitstream_data = frames[i].data();
|
||||
if (i == static_cast<int>(frames.size() - 1)) {
|
||||
pic_params.flags = ROCDEC_PKT_ENDOFPICTURE; // mark end_of_picture flag for last frame
|
||||
}
|
||||
CHECK(rocDecDecodeFrameHost(dec_info.decoder, &pic_params));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
The registered callbacks are triggered during the calls to ``rocDecParseVideoData()`` and ``rocDecDecodeFrameHost()``.
|
||||
|
||||
``pfn_decode_picture`` is triggered when a new frame is ready to be decoded, ``pfn_sequence_callback`` is triggered when a new sequence header is encountered, and ``pfn_display_picture`` is triggered when a frame has finished being decoded.
|
||||
|
||||
``pfn_decode_picture`` needs to call ``rocDecDecodeFrame()`` or ``rocDecodeFrameHost()``, depending on the specified backend, to decode a frame.
|
||||
|
||||
In ``rocdecdecode.cpp``, ``pfn_decode_picture`` calls ``handle_picture_decode()`` or ``handle_picture_decode_host()``, depending on the specified backend:
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
int ROCDECAPI handle_picture_decode(void* user_data, RocdecPicParams* params) {
|
||||
DecoderInfo *p_dec_info = static_cast<DecoderInfo *>(user_data);
|
||||
CHECK(rocDecDecodeFrame(p_dec_info->decoder, params));
|
||||
return 1;
|
||||
}
|
||||
|
||||
``pfn_sequence_callback`` is triggered when a format change occurs or when a new sequence header is encountered. When this happens, the decoder is reconfigured to handle the new sequence or format.
|
||||
|
||||
``pfn_sequence_callback`` needs to call ``rocDecReconfigureDecoder()`` or ``rocDecReconfigureDecoderHost()`` depending on the backend, to reconfigure the decoder.
|
||||
|
||||
In the ``rocdecdecode.cpp`` sample, ``pfn_sequence_callback`` calls ``handle_video_sequence()`` or ``handle_video_sequence_host()``, depending on the specified backend:
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
int ROCDECAPI handle_video_sequence(void* user_data, RocdecVideoFormat* format) {
|
||||
DecoderInfo *p_dec_info = static_cast<DecoderInfo *>(user_data);
|
||||
[...]
|
||||
RocdecReconfigureDecoderInfo reconfig_params = {};
|
||||
reconfig_params.width = format->coded_width;
|
||||
reconfig_params.height = format->coded_height;
|
||||
reconfig_params.bit_depth_minus_8 = bitdepth_minus_8;
|
||||
reconfig_params.num_decode_surfaces = format->min_num_decode_surfaces;
|
||||
reconfig_params.target_width = target_width;
|
||||
reconfig_params.target_height = target_height;
|
||||
reconfig_params.display_rect.left = format->display_area.left;
|
||||
reconfig_params.display_rect.right = format->display_area.right;
|
||||
reconfig_params.display_rect.top = format->display_area.top;
|
||||
reconfig_params.display_rect.bottom = format->display_area.bottom;
|
||||
CHECK(rocDecReconfigureDecoder(p_dec_info->decoder, &reconfig_params));
|
||||
[...]
|
||||
return 1;
|
||||
}
|
||||
|
||||
``pfn_display_picture`` is triggered when a frame has been decoded. It needs to call ``rocDecGetVideoFrame()`` or ``rocDecGetVideoFrameHost()``, depending on the specified backend.
|
||||
|
||||
``rocDecGetVideoFrame()`` and ``rocDecGetVideoFrameHost()`` map the video ID of the decoded frame to HIP. Calls to both these functions block until the frame is decoded and the memory mapping is complete. They return the HIP device pointer or the host memory pointer, depending on the backend specified, as well as information about the :doc:`output surface <../conceptual/rocDecode-memory-types>`.
|
||||
|
||||
``pfn_display_picture`` calls ``handle_picture_display()`` or ``handle_handle_picture_display_host()``, depending on the specified backend, and saves the frames to file if the ``rocdecdecode`` was run with the ``-o`` option:
|
||||
|
||||
From the ``rocdecdecode.cpp`` sample:
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
int ROCDECAPI handle_picture_display(void* user_data, RocdecParserDispInfo* disp_info) {
|
||||
DecoderInfo *p_dec_info = static_cast<DecoderInfo *>(user_data);
|
||||
RocdecProcParams params = {};
|
||||
params.progressive_frame = disp_info->progressive_frame;
|
||||
params.top_field_first = disp_info->top_field_first;
|
||||
void* dev_mem_ptr[3] = { 0 };
|
||||
uint32_t pitch[3] = { 0 };
|
||||
CHECK(rocDecGetVideoFrame(p_dec_info->decoder, disp_info->picture_index, dev_mem_ptr, pitch, ¶ms));
|
||||
if (p_dec_info->dump_decoded_frames) {
|
||||
save_frame_to_file(p_dec_info, dev_mem_ptr, pitch);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
Once decoding is complete, ``rocDecDestroyVideoParser()`` needs to be called to destroy the parser, and either ``rocDecDestroyDecoderHost()`` or ``rocDecDestroyDecoder()`` needs to be called to destroy the decoder.
|
||||
|
||||
.. |rocdecdecode| replace:: ``rocdecdecode``
|
||||
.. _rocdecdecode: https://github.com/ROCm/rocDecode/tree/develop/samples/rocdecDecode/README.md
|
||||
|
||||
.. |apifolder| replace:: ``api/rocdecode/``
|
||||
.. _apifolder: https://github.com/ROCm/rocDecode/tree/develop/api/rocdecode
|
||||
|
||||
.. |utilsfolder| replace:: ``utils`` folder
|
||||
.. _utilsfolder: https://github.com/ROCm/rocDecode/tree/develop/utils
|
||||
某些文件未显示,因为此 diff 中更改的文件太多 显示更多
在新工单中引用
屏蔽一个用户