Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance iamf v1.0 decoder for future extension #113

Merged
merged 16 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SET(CMAKE_POSITION_INDEPENDENT_CODE ON)

option(BUILD_SHARED_LIBS "Build shared library" ON)

add_definitions(-DIAMF_RIMARY_PROFILE=001)
add_definitions(-DIAMF_PRIMARY_PROFILE=001)
add_definitions(-DIAMF_ADDITIONAL_PROFILE=001)

set(CODEC_LIB_DIR "${PROJECT_SOURCE_DIR}/dep_codecs/lib")
Expand All @@ -26,6 +26,13 @@ option(CODEC_CAP "Codec capability check" ON)
option(MULTICHANNEL_BINAURALIZER "Enable multichannel binaural rendering" OFF)
option(HOA_BINAURALIZER "Enable HOA binaural rendering" OFF)

if (CMAKE_BUILD_TYPE)
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
if ("${BUILD_TYPE}" STREQUAL "debug")
add_definitions(-DIA_DBG)
message(STATUS "Debug mode.")
endif()
endif()

if(MULTICHANNEL_BINAURALIZER)
message(STATUS "Enable multichannel binaural rendering")
Expand Down
2 changes: 1 addition & 1 deletion code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ To produce binaural output, please download the following file and place it in y
12 : Sound system mono (0+1+0)
b : Binaural.
-p [dB] : Peak threshold in dB.
-l [LKFS] : Normalization loudness in LKFS.
-l [LKFS] : Normalization loudness(<0) in LKFS.
-d [bit] : Bit depth of WAVE output.
-mp [id] : Set mix presentation id.
-m : Generate a metadata file with the suffix .met.
Expand Down
39 changes: 12 additions & 27 deletions code/dep_external/include/bear/iamf_bear_api.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
/*
BSD 3-Clause Clear License The Clear BSD License

Copyright (c) 2023, Alliance for Open Media.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
* Copyright (c) 2024, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 3-Clause Clear License
* and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear
* License was not distributed with this source code in the LICENSE file, you
* can obtain it at www.aomedia.org/license/software-license/bsd-3-c-c. If the
* Alliance for Open Media Patent License 1.0 was not distributed with this
* source code in the PATENTS file, you can obtain it at
* www.aomedia.org/license/patent.
*/

/**
* @file iamf_bear_api.h
Expand Down Expand Up @@ -54,7 +39,7 @@ extern "C" {
#endif

EXPORT_API void* CreateBearAPI(char* tf_data_path);
EXPORT_API void DestoryBearAPI(void* pv_thiz);
EXPORT_API void DestroyBearAPI(void* pv_thiz);
EXPORT_API int ConfigureBearDirectSpeakerChannel(void* pv_thiz, int layout,
size_t nsample_per_frame,
int sample_rate);
Expand All @@ -64,7 +49,7 @@ EXPORT_API int SetBearDirectSpeakerChannel(void* pv_thiz, int source_id,
// EXPORT_API void SetBearObjectChannel(...);
// EXPORT_API int ConfigureBearHOAChannel(...);
// EXPORT_API void SetBearHOAChannel(...);
EXPORT_API void DestoryBearChannel(void* pv_thiz, int source_id);
EXPORT_API void DestroyBearChannel(void* pv_thiz, int source_id);
EXPORT_API int GetBearRenderedAudio(void* pv_thiz, int source_id, float** out);

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion code/dep_external/include/resonance/iamf_resonance_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ EXPORT_API void* CreateResonanceAudioApi2(size_t num_channels,
// // class construction.
// static const SourceId kInvalidSourceId = -1;

EXPORT_API void DestoryResonanceAudioApi2(void* pv_thiz);
EXPORT_API void DestroyResonanceAudioApi2(void* pv_thiz);

// Renders and outputs an interleaved output buffer in float format.
//
Expand Down
Binary file modified code/dep_external/lib/binaural/libiamf2bear.so
Binary file not shown.
Binary file modified code/dep_external/lib/binaural/libiamf2resonance.so
Binary file not shown.
61 changes: 23 additions & 38 deletions code/dep_external/src/binaural/iamf2bear/iamf2bear.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
/*
BSD 3-Clause Clear License The Clear BSD License

Copyright (c) 2023, Alliance for Open Media.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
* Copyright (c) 2024, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 3-Clause Clear License
* and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear
* License was not distributed with this source code in the LICENSE file, you
* can obtain it at www.aomedia.org/license/software-license/bsd-3-c-c. If the
* Alliance for Open Media Patent License 1.0 was not distributed with this
* source code in the PATENTS file, you can obtain it at
* www.aomedia.org/license/patent.
*/

/**
* @file bear.cpp
Expand Down Expand Up @@ -102,7 +87,7 @@ static int getmodulepath(char *path, int buffsize)
int count = 0, i = 0;
#if defined(_WIN32)
count = GetModuleFileName(NULL, path, buffsize);
#elifdef __APPLE__
#elif defined(__APPLE__)
uint32_t size = MAX_PATH;
_NSGetExecutablePath(path, &size);
count = size;
Expand Down Expand Up @@ -169,7 +154,7 @@ extern "C" EXPORT_API void *CreateBearAPI(char *tf_data_path)
}
}

extern "C" EXPORT_API void DestoryBearAPI(void *pv_thiz)
extern "C" EXPORT_API void DestroyBearAPI(void *pv_thiz)
{
int i;
BearAPIImplement *thiz = (BearAPIImplement *)pv_thiz;
Expand Down Expand Up @@ -231,17 +216,17 @@ extern "C" EXPORT_API int ConfigureBearDirectSpeakerChannel(void *pv_thiz,
std::make_pair(-180.0, 180.0),
std::make_pair(-90.0, 90.0),
true},
Channel{"M+110",
PolarPosition{110.0, 0.0},
PolarPosition{110.0, 0.0},
std::make_pair(100.0, 120.0),
std::make_pair(0.0, 15.0),
Channel{"U+030",
PolarPosition{30.0, 30.0},
PolarPosition{30.0, 30.0},
std::make_pair(30.0, 45.0),
std::make_pair(30.0, 55.0),
false},
Channel{"M-110",
PolarPosition{-110.0, 0.0},
PolarPosition{-110.0, 0.0},
std::make_pair(-120.0, -100.0),
std::make_pair(0.0, 15.0),
Channel{"U-030",
PolarPosition{-30.0, 30.0},
PolarPosition{-30.0, 30.0},
std::make_pair(-45.0, -30.0),
std::make_pair(30.0, 55.0),
false},
}};

Expand Down Expand Up @@ -389,7 +374,7 @@ extern "C" EXPORT_API int SetBearDirectSpeakerChannel(void *pv_thiz, int source_
return (-1);
}

extern "C" EXPORT_API void DestoryBearChannel(void *pv_thiz, int source_id)
extern "C" EXPORT_API void DestroyBearChannel(void *pv_thiz, int source_id)
{
BearAPIImplement *thiz = (BearAPIImplement *)pv_thiz;

Expand Down
39 changes: 12 additions & 27 deletions code/dep_external/src/binaural/iamf2bear/iamf_bear_api.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
/*
BSD 3-Clause Clear License The Clear BSD License

Copyright (c) 2023, Alliance for Open Media.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
* Copyright (c) 2024, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 3-Clause Clear License
* and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear
* License was not distributed with this source code in the LICENSE file, you
* can obtain it at www.aomedia.org/license/software-license/bsd-3-c-c. If the
* Alliance for Open Media Patent License 1.0 was not distributed with this
* source code in the PATENTS file, you can obtain it at
* www.aomedia.org/license/patent.
*/

/**
* @file iamf_bear_api.h
Expand Down Expand Up @@ -54,7 +39,7 @@ extern "C" {
#endif

EXPORT_API void* CreateBearAPI(char* tf_data_path);
EXPORT_API void DestoryBearAPI(void* pv_thiz);
EXPORT_API void DestroyBearAPI(void* pv_thiz);
EXPORT_API int ConfigureBearDirectSpeakerChannel(void* pv_thiz, int layout,
size_t nsample_per_frame,
int sample_rate);
Expand All @@ -64,7 +49,7 @@ EXPORT_API int SetBearDirectSpeakerChannel(void* pv_thiz, int source_id,
// EXPORT_API void SetBearObjectChannel(...);
// EXPORT_API int ConfigureBearHOAChannel(...);
// EXPORT_API void SetBearHOAChannel(...);
EXPORT_API void DestoryBearChannel(void* pv_thiz, int source_id);
EXPORT_API void DestroyBearChannel(void* pv_thiz, int source_id);
EXPORT_API int GetBearRenderedAudio(void* pv_thiz, int source_id, float** out);

#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace vraudio {
// class construction.
//static const SourceId ` = -1;

extern "C" EXPORT_API void DestoryResonanceAudioApi2(void* pv_thiz)
extern "C" EXPORT_API void DestroyResonanceAudioApi2(void* pv_thiz)
{
ResonanceAudioApi* thiz = (ResonanceAudioApi*)pv_thiz;
delete thiz;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ EXPORT_API void* CreateResonanceAudioApi2(size_t num_channels,
// // class construction.
// static const SourceId kInvalidSourceId = -1;

EXPORT_API void DestoryResonanceAudioApi2(void* pv_thiz);
EXPORT_API void DestroyResonanceAudioApi2(void* pv_thiz);

// Renders and outputs an interleaved output buffer in float format.
//
Expand Down
3 changes: 2 additions & 1 deletion code/include/IAMF_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ char *IAMF_decoder_get_codec_capability();
* adjusted to the setting target.
* @param [in] handle : iamf decoder handle.
* @param [in] loundness : target normalization loudness in LKFS.
* 0 dose not do normalization,
* others(<0) target value of normalization.
* @return @ref IAErrCode.
*/
int IAMF_decoder_set_normalization_loudness(IAMF_DecoderHandle handle,
Expand Down Expand Up @@ -225,7 +227,6 @@ typedef struct IAMF_extradata {

/**
* @brief Set the start timestamp and time base to decoder.
* max frame size could be gotten.
* @param [in] handle : iamf decoder handle.
* @param [in] pts : the start timestamp.
* @param [in] time_base : the time base used for pts.
Expand Down
1 change: 0 additions & 1 deletion code/include/IAMF_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,4 @@ typedef enum {
IA_CHANNEL_LAYOUT_BINAURAL, // binaural
IA_CHANNEL_LAYOUT_COUNT
} IAChannelLayoutType;

#endif /* IAMF_DEFINES_H */
2 changes: 2 additions & 0 deletions code/include/vlogging_tool_sr.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
**/

#include <stdarg.h>
#include <stdint.h>

#ifndef _VLOGGING_TOOL_SR_H_
#define _VLOGGING_TOOL_SR_H_
Expand All @@ -34,6 +35,7 @@ int vlog_print(LOG_TYPE type, uint64_t key, const char* format, ...);
int vlog_obu(uint32_t obu_type, void* obu,
uint64_t num_samples_to_trim_at_start,
uint64_t num_samples_to_trim_at_end);
int vlog_decop(char* decop_text);
int vlog_file_close();
int is_vlog_file_open();

Expand Down
Loading