Skip to content

Commit

Permalink
Audio PR - Augmentation support [ Downmix and ToDecibels ] (#1320)
Browse files Browse the repository at this point in the history
* Bump rocm-docs-core[api_reference] from 0.34.0 to 0.34.2 in /docs/sphinx (#1286)

Bumps [rocm-docs-core[api_reference]](https://github.com/RadeonOpenCompute/rocm-docs-core) from 0.34.0 to 0.34.2.
- [Release notes](https://github.com/RadeonOpenCompute/rocm-docs-core/releases)
- [Changelog](https://github.com/ROCm/rocm-docs-core/blob/develop/CHANGELOG.md)
- [Commits](ROCm/rocm-docs-core@v0.34.0...v0.34.2)

---
updated-dependencies:
- dependency-name: rocm-docs-core[api_reference]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump cryptography from 42.0.0 to 42.0.2 in /docs/sphinx (#1289)

Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.0 to 42.0.2.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@42.0.0...42.0.2)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add PreEmphasis filter support

* Fix ROI - change from xy to width & height

* Adding openvx changes for downmix node

* Audio Augmentations 1 PR - NSR and Spectrogram

* Revert "Adding openvx changes for downmix node"

This reverts commit d53f81d.

* Merging swbs_m2/audio/pr5 into swbs_m3/audio/pr6

* Fixing build issues

* PR comments resolution in the PreEmphais Filter

* Minor Changes

* Change the borderType enum to int32 from uint32 dtype

* Fix validation of preemphasis

* Remove the memcopy of the src and dest rois as it can be handled in the rocAL - since the src and dst rois remain same

* Formatting change - minor

* Remove NSR

* Minor formatting changes

* Minor fix

* Minor update - remove the 2nd instance of preemphasis filter

* Add openvx extensions for to_decibels augmentations

* Enum dtype - change from uint to int

* Remove roi_tensor_ptr_dst as its unused after latest changes

* Remove the dst_roi arg from vxExtRppPreemphasisFilter call as its unused

* Add MFB to MIVisisonX

* Revert "Add MFB to MIVisisonX"

This reverts commit dc4200b.

* Fixing issues with src ROI

* Resolve the PR comments

* Resolving review comments

* Resolving review comments

* Change the dims[0] and dims[1] positioning for Spectrogram and AudioFillDescPointers

* Removing dstROI from to_decibels openvx augmentation

* Change function name to camelCase

* Resolving review comments

* Revert "Change the dims[0] and dims[1] positioning for Spectrogram and AudioFillDescPointers"

This reverts commit 886d6af.

* Fix Spectrogram

* Docs - update TOC for API Ref (#1327)

* Bump rocm-docs-core[api_reference] from 0.38.0 to 0.38.1 in /docs/sphinx (#1328)

Bumps [rocm-docs-core[api_reference]](https://github.com/RadeonOpenCompute/rocm-docs-core) from 0.38.0 to 0.38.1.
- [Release notes](https://github.com/RadeonOpenCompute/rocm-docs-core/releases)
- [Changelog](https://github.com/ROCm/rocm-docs-core/blob/develop/CHANGELOG.md)
- [Commits](ROCm/rocm-docs-core@v0.38.0...v0.38.1)

---
updated-dependencies:
- dependency-name: rocm-docs-core[api_reference]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update CHANGELOG.md

* Update CHANGELOG.md

* Documents - Bump idna from 3.4 to 3.7 in /docs/sphinx (#1330)

Bumps [idna](https://github.com/kjd/idna) from 3.4 to 3.7.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst)
- [Commits](kjd/idna@v3.4...v3.7)

---
updated-dependencies:
- dependency-name: idna
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update changelog

* Update changelog

* Resolve minor PR comments

* Remove comments

* Docs - Bump tqdm from 4.65.0 to 4.66.3 in /docs/sphinx (#1339)

Bumps [tqdm](https://github.com/tqdm/tqdm) from 4.65.0 to 4.66.3.
- [Release notes](https://github.com/tqdm/tqdm/releases)
- [Commits](tqdm/tqdm@v4.65.0...v4.66.3)

---
updated-dependencies:
- dependency-name: tqdm
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Docs - Bump jinja2 from 3.1.3 to 3.1.4 in /docs/sphinx (#1340)

Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.3...3.1.4)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Find Half - Fix (#1341)

* MIVisionX Setup - Updates (#1343)

* SWDEV-459739 - Remove the package obsolete setting (#1345)

The package was obsoleting itself and was causing upgrade issues.
Removed the same.

* Fix the layout issue with spec

* Add layouts for Audio in vxTensorLayout

Remove spectrogram layout param and pass layout in descriptor

* Check the validity of pointers

* Audio PR - Augmentation support [ Spectrogram ] (#1319)

* Bump rocm-docs-core[api_reference] from 0.34.0 to 0.34.2 in /docs/sphinx (#1286)

Bumps [rocm-docs-core[api_reference]](https://github.com/RadeonOpenCompute/rocm-docs-core) from 0.34.0 to 0.34.2.
- [Release notes](https://github.com/RadeonOpenCompute/rocm-docs-core/releases)
- [Changelog](https://github.com/ROCm/rocm-docs-core/blob/develop/CHANGELOG.md)
- [Commits](ROCm/rocm-docs-core@v0.34.0...v0.34.2)

---
updated-dependencies:
- dependency-name: rocm-docs-core[api_reference]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump cryptography from 42.0.0 to 42.0.2 in /docs/sphinx (#1289)

Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.0 to 42.0.2.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@42.0.0...42.0.2)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add PreEmphasis filter support

* Fix ROI - change from xy to width & height

* Adding openvx changes for downmix node

* Audio Augmentations 1 PR - NSR and Spectrogram

* Revert "Adding openvx changes for downmix node"

This reverts commit d53f81d.

* PR comments resolution in the PreEmphais Filter

* Minor Changes

* Change the borderType enum to int32 from uint32 dtype

* Fix validation of preemphasis

* Remove the memcopy of the src and dest rois as it can be handled in the rocAL - since the src and dst rois remain same

* Formatting change - minor

* Remove NSR

* Minor formatting changes

* Minor fix

* Minor update - remove the 2nd instance of preemphasis filter

* Enum dtype - change from uint to int

* Remove roi_tensor_ptr_dst as its unused after latest changes

* Remove the dst_roi arg from vxExtRppPreemphasisFilter call as its unused

* Add MFB to MIVisisonX

* Revert "Add MFB to MIVisisonX"

This reverts commit dc4200b.

* Resolve the PR comments

* Change the dims[0] and dims[1] positioning for Spectrogram and AudioFillDescPointers

* Change function name to camelCase

* Revert "Change the dims[0] and dims[1] positioning for Spectrogram and AudioFillDescPointers"

This reverts commit 886d6af.

* Fix Spectrogram

* Docs - update TOC for API Ref (#1327)

* Bump rocm-docs-core[api_reference] from 0.38.0 to 0.38.1 in /docs/sphinx (#1328)

Bumps [rocm-docs-core[api_reference]](https://github.com/RadeonOpenCompute/rocm-docs-core) from 0.38.0 to 0.38.1.
- [Release notes](https://github.com/RadeonOpenCompute/rocm-docs-core/releases)
- [Changelog](https://github.com/ROCm/rocm-docs-core/blob/develop/CHANGELOG.md)
- [Commits](ROCm/rocm-docs-core@v0.38.0...v0.38.1)

---
updated-dependencies:
- dependency-name: rocm-docs-core[api_reference]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update CHANGELOG.md

* Update CHANGELOG.md

* Documents - Bump idna from 3.4 to 3.7 in /docs/sphinx (#1330)

Bumps [idna](https://github.com/kjd/idna) from 3.4 to 3.7.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst)
- [Commits](kjd/idna@v3.4...v3.7)

---
updated-dependencies:
- dependency-name: idna
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update changelog

* Resolve minor PR comments

* Remove comments

* Fix the layout issue with spec

* Check the validity of pointers

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: root <[email protected]>
Co-authored-by: Swetha B S <[email protected]>
Co-authored-by: SundarRajan28 <[email protected]>
Co-authored-by: Swetha B S <[email protected]>
Co-authored-by: randyh62 <[email protected]>

* Introduce API to obtain RPP layout

* Add comments

* Resolving review comments

* Resolving review comments

* Minor changes

* Removing if blocks for CPU device checks

* Use RPP_AUDIO flag to disable RPP audio calls

* Add RPP_AUDIO flag for RPP audio API

* Add Audio flag for PreEmphasis filter

* Rename map variable

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: root <[email protected]>
Co-authored-by: Swetha B S <[email protected]>
Co-authored-by: Swetha B S <[email protected]>
Co-authored-by: SundarRajan28 <[email protected]>
Co-authored-by: Swetha B S <[email protected]>
Co-authored-by: randyh62 <[email protected]>
Co-authored-by: swetha097 <[email protected]>
Co-authored-by: Kiriti Gowda <[email protected]>
Co-authored-by: raramakr <[email protected]>
Co-authored-by: fiona-gladwin <[email protected]>
Co-authored-by: Sundar Rajan Vaithiyanathan <[email protected]>
Co-authored-by: Lakshmi Kumar <[email protected]>
  • Loading branch information
14 people authored May 30, 2024
1 parent 0df3adb commit f597337
Show file tree
Hide file tree
Showing 10 changed files with 543 additions and 31 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Documentation for MIVisionX is available at
* Support for advanced GPUs
* Support for PreEmphasis Filter augmentation in openVX extensions
* Support for Spectrogram augmentation in openVX extensions
* Support for Downmix and ToDecibels augmentations in openVX extensions

### Optimizations

Expand Down
2 changes: 2 additions & 0 deletions amd_openvx_extensions/amd_rpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ list(APPEND SOURCES
source/tensor/Copy.cpp
source/tensor/Crop.cpp
source/tensor/CropMirrorNormalize.cpp
source/tensor/Downmix.cpp
source/tensor/Exposure.cpp
source/tensor/FishEye.cpp
source/tensor/Flip.cpp
Expand All @@ -158,6 +159,7 @@ list(APPEND SOURCES
source/tensor/SequenceRearrange.cpp
source/tensor/Snow.cpp
source/tensor/Spectrogram.cpp
source/tensor/ToDecibels.cpp
source/tensor/Vignette.cpp
source/tensor/WarpAffine.cpp
source/tensor/SequenceRearrange.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ vx_status Vignette_Register(vx_context);
vx_status WarpAffine_Register(vx_context);
vx_status SequenceRearrange_Register(vx_context);
vx_status Spectrogram_Register(vx_context);
vx_status Downmix_Register(vx_context);
vx_status ToDecibels_Register(vx_context);

// kernel names
#define VX_KERNEL_RPP_NOPBATCHPD_NAME "org.rpp.NopbatchPD"
Expand Down Expand Up @@ -283,5 +285,7 @@ vx_status Spectrogram_Register(vx_context);
#define VX_KERNEL_RPP_SEQUENCEREARRANGE_NAME "org.rpp.SequenceRearrange"
#define VX_KERNEL_RPP_PREEMPHASISFILTER_NAME "org.rpp.PreemphasisFilter"
#define VX_KERNEL_RPP_SPECTROGRAM_NAME "org.rpp.Spectrogram"
#define VX_KERNEL_RPP_DOWNMIX_NAME "org.rpp.Downmix"
#define VX_KERNEL_RPP_TODECIBELS_NAME "org.rpp.ToDecibels"

#endif //_AMDVX_EXT__PUBLISH_KERNELS_H_
14 changes: 13 additions & 1 deletion amd_openvx_extensions/amd_rpp/include/internal_rpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ THE SOFTWARE.
#include<iostream>
#include<algorithm>
#include<functional>
#include<map>

using namespace std;

Expand Down Expand Up @@ -74,14 +75,25 @@ enum vxTensorLayout {
VX_NTF = 6 // Time major, Used for Spectrogram/MelFilterBank
};

const std::map<vxTensorLayout, RpptLayout> tensorLayoutMapping = {
{vxTensorLayout::VX_NHWC, RpptLayout::NHWC},
{vxTensorLayout::VX_NCHW, RpptLayout::NCHW},
{vxTensorLayout::VX_NFHWC, RpptLayout::NHWC},
{vxTensorLayout::VX_NFCHW, RpptLayout::NCHW},
#if RPP_AUDIO
{vxTensorLayout::VX_NHW, RpptLayout::NHW},
{vxTensorLayout::VX_NFT, RpptLayout::NFT},
{vxTensorLayout::VX_NTF, RpptLayout::NTF}
#endif
};

//! Brief The utility functions
vx_node createNode(vx_graph graph, vx_enum kernelEnum, vx_reference params[], vx_uint32 num);
vx_status createRPPHandle(vx_node node, vxRppHandle ** pHandle, Rpp32u batchSize, Rpp32u deviceType);
vx_status releaseRPPHandle(vx_node node, vxRppHandle * handle, Rpp32u deviceType);
void fillDescriptionPtrfromDims(RpptDescPtr &descPtr, vxTensorLayout layout, size_t *tensorDims);
void fillAudioDescriptionPtrFromDims(RpptDescPtr &descPtr, size_t *tensorDims, vxTensorLayout layout = vxTensorLayout::VX_NHW);
RpptDataType getRpptDataType(vx_enum dataType);
RpptLayout getRpptLayout(vxTensorLayout layout);

class Kernellist
{
Expand Down
4 changes: 3 additions & 1 deletion amd_openvx_extensions/amd_rpp/include/kernels_rpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ extern "C"
VX_KERNEL_RPP_VIGNETTE = VX_KERNEL_BASE(VX_ID_AMD, VX_LIBRARY_RPP) + 0x72,
VX_KERNEL_RPP_WARPAFFINE = VX_KERNEL_BASE(VX_ID_AMD, VX_LIBRARY_RPP) + 0x73,
VX_KERNEL_RPP_PREEMPHASISFILTER = VX_KERNEL_BASE(VX_ID_AMD, VX_LIBRARY_RPP) + 0x74,
VX_KERNEL_RPP_SPECTROGRAM = VX_KERNEL_BASE(VX_ID_AMD, VX_LIBRARY_RPP) + 0x75
VX_KERNEL_RPP_SPECTROGRAM = VX_KERNEL_BASE(VX_ID_AMD, VX_LIBRARY_RPP) + 0x75,
VX_KERNEL_RPP_DOWNMIX = VX_KERNEL_BASE(VX_ID_AMD, VX_LIBRARY_RPP) + 0x76,
VX_KERNEL_RPP_TODECIBELS = VX_KERNEL_BASE(VX_ID_AMD, VX_LIBRARY_RPP) + 0x77
};

#ifdef __cplusplus
Expand Down
25 changes: 25 additions & 0 deletions amd_openvx_extensions/amd_rpp/include/vx_ext_rpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,31 @@ extern "C"
*/
SHARED_PUBLIC vx_node VX_API_CALL vxExtRppSpectrogram(vx_graph graph, vx_tensor pSrc, vx_tensor pSrcRoi, vx_tensor pDst, vx_tensor pDstRoi, vx_array windowFunction, vx_scalar centerWindow, vx_scalar reflectPadding, vx_scalar spectrogramLayout, vx_scalar power, vx_scalar nfft, vx_scalar windowLength, vx_scalar windowStep);

/*! \brief [Graph] Applies downmixing to the input tensor.
* \ingroup group_amd_rpp
* \param [in] graph The handle to the graph.
* \param [in] pSrc The input tensor in <tt>\ref VX_TYPE_FLOAT32</tt> format data.
* \param [out] pDst The output tensor in <tt>\ref VX_TYPE_FLOAT32</tt> format data.
* \param [in] pSrcRoi The input tensor of batch size in <tt>unsigned int<tt> containing the roi values for the input.
* \return A node reference <tt>\ref vx_node</tt>. Any possible errors preventing a successful creation should be checked using <tt>\ref vxGetStatus</tt>.
*/
SHARED_PUBLIC vx_node VX_API_CALL vxExtRppDownmix(vx_graph graph, vx_tensor pSrc, vx_tensor pDst, vx_tensor srcRoi);

/*! \brief [Graph] Applies to_decibels augmentation to the input tensor.
* \ingroup group_amd_rpp
* \param [in] graph The handle to the graph.
* \param [in] pSrc The input tensor in <tt>\ref VX_TYPE_FLOAT32</tt> format data.
* \param[in] pSrcRoi The input tensor of batch size in <tt>unsigned int<tt> containing the roi values for the input.
* \param [out] pDst The output tensor in <tt>\ref VX_TYPE_FLOAT32</tt> format data.
* \param[in] cutOffDB The input scalar in <tt>\ref VX_TYPE_FLOAT32</tt> format containing minimum or cut-off ratio in dB
* \param[in] multiplier The input scalar in <tt>\ref VX_TYPE_FLOAT32</tt> format containing factor by which the logarithm is multiplied
* \param[in] referenceMagnitude The input scalar in <tt>\ref VX_TYPE_FLOAT32</tt> format containing Reference magnitude which if not provided uses maximum value of input as reference
* \param [in] inputLayout The input layout in <tt>\ref VX_TYPE_INT32</tt> denotes the layout of input tensor.
* \param [in] outputLayout The output layout in <tt>\ref VX_TYPE_INT32</tt> denotes the layout of output tensor.
* \return A node reference <tt>\ref vx_node</tt>. Any possible errors preventing a successful creation should be checked using <tt>\ref vxGetStatus</tt>.
*/
SHARED_PUBLIC vx_node VX_API_CALL vxExtRppToDecibels(vx_graph graph, vx_tensor pSrc, vx_tensor pSrcRoi, vx_tensor pDst, vx_scalar cutOffDB, vx_scalar multiplier, vx_scalar referenceMagnitude, vx_scalar inputLayout, vx_scalar outputLayout);

#ifdef __cplusplus
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ vx_status get_kernels_to_publish()
STATUS_ERROR_CHECK(ADD_KERNEL(Vignette_Register));
STATUS_ERROR_CHECK(ADD_KERNEL(WarpAffine_Register));
STATUS_ERROR_CHECK(ADD_KERNEL(Spectrogram_Register));
STATUS_ERROR_CHECK(ADD_KERNEL(Downmix_Register));
STATUS_ERROR_CHECK(ADD_KERNEL(ToDecibels_Register));

return status;
}
Expand Down
71 changes: 42 additions & 29 deletions amd_openvx_extensions/amd_rpp/source/kernel_rpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2584,6 +2584,43 @@ VX_API_ENTRY vx_node VX_API_CALL vxExtRppSpectrogram(vx_graph graph, vx_tensor p
return node;
}

VX_API_ENTRY vx_node VX_API_CALL vxExtRppDownmix(vx_graph graph, vx_tensor pSrc, vx_tensor pDst, vx_tensor pSrcRoi) {
vx_node node = NULL;
vx_context context = vxGetContext((vx_reference)graph);
if (vxGetStatus((vx_reference)context) == VX_SUCCESS) {
vx_uint32 devType = getGraphAffinity(graph);
vx_scalar deviceType = vxCreateScalar(vxGetContext((vx_reference)graph), VX_TYPE_UINT32, &devType);
vx_reference params[] = {
(vx_reference)pSrc,
(vx_reference)pDst,
(vx_reference)pSrcRoi,
(vx_reference)deviceType};
node = createNode(graph, VX_KERNEL_RPP_DOWNMIX, params, 4);
}
return node;
}

VX_API_ENTRY vx_node VX_API_CALL vxExtRppToDecibels(vx_graph graph, vx_tensor pSrc, vx_tensor pSrcRoi, vx_tensor pDst, vx_scalar cutOffDB, vx_scalar multiplier, vx_scalar referenceMagnitude, vx_scalar inputLayout, vx_scalar outputLayout) {
vx_node node = NULL;
vx_context context = vxGetContext((vx_reference)graph);
if (vxGetStatus((vx_reference)context) == VX_SUCCESS) {
vx_uint32 devType = getGraphAffinity(graph);
vx_scalar deviceType = vxCreateScalar(vxGetContext((vx_reference)graph), VX_TYPE_UINT32, &devType);
vx_reference params[] = {
(vx_reference)pSrc,
(vx_reference)pSrcRoi,
(vx_reference)pDst,
(vx_reference)cutOffDB,
(vx_reference)multiplier,
(vx_reference)referenceMagnitude,
(vx_reference)inputLayout,
(vx_reference)outputLayout,
(vx_reference)deviceType};
node = createNode(graph, VX_KERNEL_RPP_TODECIBELS, params, 9);
}
return node;
}

RpptDataType getRpptDataType(vx_enum vxDataType) {
switch(vxDataType) {
case vx_type_e::VX_TYPE_FLOAT32:
Expand All @@ -2597,34 +2634,6 @@ RpptDataType getRpptDataType(vx_enum vxDataType) {
}
}

RpptLayout getRpptLayout(vxTensorLayout layout) {
switch(layout) {
case vxTensorLayout::VX_NHWC:
return RpptLayout::NHWC;
case vxTensorLayout::VX_NCHW:
return RpptLayout::NCHW;
case vxTensorLayout::VX_NFHWC:
return RpptLayout::NHWC;
case vxTensorLayout::VX_NFCHW:
return RpptLayout::NCHW;
#if RPP_AUDIO
case vxTensorLayout::VX_NHW:
return RpptLayout::NHW;
case vxTensorLayout::VX_NFT:
return RpptLayout::NFT;
case vxTensorLayout::VX_NTF:
return RpptLayout::NTF;
#else
case vxTensorLayout::VX_NHW:
case vxTensorLayout::VX_NFT:
case vxTensorLayout::VX_NTF:
throw std::runtime_error("RPP_AUDIO flag disabled, Audio layouts are not supported");
#endif
default:
throw std::runtime_error("Invalid layout");
}
}

void fillDescriptionPtrfromDims(RpptDescPtr &descPtr, vxTensorLayout layout, size_t *tensorDims) {
switch(layout) {
case vxTensorLayout::VX_NHWC: {
Expand Down Expand Up @@ -2691,7 +2700,11 @@ void fillAudioDescriptionPtrFromDims(RpptDescPtr &descPtr, size_t *maxTensorDims
descPtr->strides.wStride = descPtr->c;
descPtr->strides.cStride = 1;
descPtr->numDims = 4;
descPtr->layout = getRpptLayout(layout);
if(tensorLayoutMapping.find(layout) != tensorLayoutMapping.end()) {
descPtr->layout = tensorLayoutMapping.at(layout);
} else {
throw std::runtime_error("Invalid layout");
}
}

// utility functions
Expand Down
Loading

0 comments on commit f597337

Please sign in to comment.