Loading experiments/selection_isar/README.md +34 −2 Original line number Diff line number Diff line <!--- (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository. All Rights Reserved. This software is protected by copyright law and by international treaties. The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository retain full ownership rights in their respective contributions in the software. This notice grants no license of any kind, including but not limited to patent license, nor is any license granted by implication, estoppel or otherwise. Contributors are required to enter into the IVAS codec Public Collaboration agreement before making contributions. This software is provided "AS IS", without any express or implied warranties. The software is in the development stage. It is intended exclusively for experts who have experience with such software and solely for the purpose of inspection. All implied warranties of non-infringement, merchantability and fitness for a particular purpose are hereby disclaimed and excluded. Any dispute, controversy or claim arising under or in relation to providing this software shall be submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and the United Nations Convention on Contracts on the International Sales of Goods. --> # IVAS ISAR Selection Experiments This directory contains input and configuration files for the ISAR selection tests based on S4-240396. Loading @@ -7,7 +39,7 @@ All tests use the BS.1534 (MUSHRA) test methodology. ## Experiments | Experiment | Input format | |:----------:|:------------:| | :--------: | :----------: | | BS1534-1a | HOA3 | | BS1534-2a | MASA | | BS1534-3a | 7_1_4 | Loading ivas_processing_scripts/audiotools/quaternions.py 0 → 100755 +143 −0 Original line number Diff line number Diff line #!/usr/bin/env python3 # # (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository. All Rights Reserved. # # This software is protected by copyright law and by international treaties. # The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository retain full ownership rights in their respective contributions in # the software. This notice grants no license of any kind, including but not limited to patent # license, nor is any license granted by implication, estoppel or otherwise. # # Contributors are required to enter into the IVAS codec Public Collaboration agreement before making # contributions. # # This software is provided "AS IS", without any express or implied warranties. The software is in the # development stage. It is intended exclusively for experts who have experience with such software and # solely for the purpose of inspection. All implied warranties of non-infringement, merchantability # and fitness for a particular purpose are hereby disclaimed and excluded. # # Any dispute, controversy or claim arising under or in relation to providing this software shall be # submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in # accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and # the United Nations Convention on Contracts on the International Sales of Goods. # import numpy as np """ Based on Jia, Y. B. (2008). Quaternions and rotations. Com S, 477(577), 15. """ ################################### # Operations on only one quaternion ################################### def is_unitquat(q): # the norm must be 1 for a unit quaternion if q_norm2(q) == 1: return True else: return False def q_conj(q): # quaternion conjugate p = q.copy() p[1:] = -p[1:] return p def q_norm2(q): # quaternion norm return np.sqrt(np.sum(q**2)) def q_inv(q): # quaternion inverse return q_conj(q) / q_norm2(q) def q_exp(q, e): # quaternion exponentiation p = np.zeros_like(q) eps = np.zeros_like(q) eps[0] = 0 eps[1:] = q[1:] norm_e = np.sqrt(q_norm2((e))) if norm_e == 0: # real quaternion, reaise the real part p[0] = q[0] ** e p[1:] = 0 else: # go to the polar form norm = np.sqrt(q_norm2(q)) phi = np.arccos(q[0] / norm) eps = eps * (1 / norm_e) p[0] = norm * np.cos(e * phi) p[1] = norm * eps[1] * np.sin(e * phi) p[2] = norm * eps[2] * np.sin(e * phi) p[3] = norm * eps[3] * np.sin(e * phi) return p def q_log(q): # quaternion logarithm if not is_unitquat(q): raise ValueError("Input must be a unit quaternion!") p = np.zeros_like(q) vec = q[1:] vec_norm = np.sqrt(np.sum(vec**2)) vec /= vec_norm vec *= np.arccos(q[0]) p[1:] = vec return p ############################### # Operations on two quaternions ############################### def q_add(p, q): # quaternion addition return np.add(p, q) def q_sub(p, q): # quaternion subtraction return np.sub(p, q) def q_mul(p, q): # quaternion multiplication pq = np.zeros_like(q) pq[0] = p[0] * q[0] - p[1] * q[1] - p[2] * q[2] - p[3] * q[3] pq[1] = p[0] * q[1] + p[1] * q[0] + p[2] * q[3] - p[3] * q[2] pq[2] = p[0] * q[2] + p[1] * q[3] + p[2] * q[0] - p[3] * q[1] pq[3] = p[0] * q[3] - p[1] * q[2] + p[2] * q[1] + p[3] * q[0] return pq def q_div(p, q): # quaternion division return q_mul(p, q_inv(q)) ivas_processing_scripts/trajectories/README.md 0 → 100644 +62 −0 Original line number Diff line number Diff line <!--- (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository. All Rights Reserved. This software is protected by copyright law and by international treaties. The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository retain full ownership rights in their respective contributions in the software. This notice grants no license of any kind, including but not limited to patent license, nor is any license granted by implication, estoppel or otherwise. Contributors are required to enter into the IVAS codec Public Collaboration agreement before making contributions. This software is provided "AS IS", without any express or implied warranties. The software is in the development stage. It is intended exclusively for experts who have experience with such software and solely for the purpose of inspection. All implied warranties of non-infringement, merchantability and fitness for a particular purpose are hereby disclaimed and excluded. Any dispute, controversy or claim arising under or in relation to providing this software shall be submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and the United Nations Convention on Contracts on the International Sales of Goods. --> # Trajectory file processing module This module can be executed using `python -m ivas_processing_scripts.trajectories`. IVAS head tracking trajectory files can be manipulated using this helper script. See the usage help below for details. ```text usage: Process IVAS .csv head tracking trajectories in either Euler (YPR) or Quaternion format. Order of supported operations: zero => offset => invert => delay Head tracking data is equivalent to scene rotation data (NOT listener orientation, use --invert if needed) [-h] [-i] [-d DELAY] [-o OFFSET OFFSET OFFSET] [-zy] [-zp] [-zr] [-of {q,e}] in_trj out_trj positional arguments: in_trj Input Trajectory out_trj Output Trajectory options: -h, --help show this help message and exit -i, --invert Flag to invert trajectory, default = False -d DELAY, --delay DELAY Delay trajectory by this amount in milliseconds -o OFFSET OFFSET OFFSET, --offset OFFSET OFFSET OFFSET Offset trajectory by this rotation [yaw, pitch, roll] -zy, --zero_yaw Zero yaw axis -zp, --zero_pitch Zero pitch axis -zr, --zero_roll Zero roll axis -of {q,e}, --output_format {q,e} Output format: 'e' for Euler (YPR) and 'q' for Quaternions, default = q ``` ivas_processing_scripts/trajectories/__init__.py 0 → 100755 +124 −0 Original line number Diff line number Diff line #!/usr/bin/env python3 # # (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository. All Rights Reserved. # # This software is protected by copyright law and by international treaties. # The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository retain full ownership rights in their respective contributions in # the software. This notice grants no license of any kind, including but not limited to patent # license, nor is any license granted by implication, estoppel or otherwise. # # Contributors are required to enter into the IVAS codec Public Collaboration agreement before making # contributions. # # This software is provided "AS IS", without any express or implied warranties. The software is in the # development stage. It is intended exclusively for experts who have experience with such software and # solely for the purpose of inspection. All implied warranties of non-infringement, merchantability # and fitness for a particular purpose are hereby disclaimed and excluded. # # Any dispute, controversy or claim arising under or in relation to providing this software shall be # submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in # accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and # the United Nations Convention on Contracts on the International Sales of Goods. # import argparse from functools import partial import numpy as np from ivas_processing_scripts.audiotools.quaternions import q_inv, q_mul from ivas_processing_scripts.audiotools.rotation import Euler2Quat, Quat2Euler from ivas_processing_scripts.audiotools.utils import read_trajectory, write_trajectory def get_args(): parser = argparse.ArgumentParser( """Process IVAS .csv head tracking trajectories in either Euler (YPR) or Quaternion format. Order of supported operations: zero => offset => invert => delay Head tracking data is equivalent to scene rotation data (NOT listener orientation, use --invert if needed) """ ) parser.add_argument("in_trj", help="Input Trajectory") parser.add_argument("out_trj", help="Output Trajectory") parser.add_argument( "-i", "--invert", action="store_true", default=False, help="Flag to invert trajectory, default = %(default)s", ) parser.add_argument( "-d", "--delay", default=None, help="Delay trajectory by this amount in milliseconds", type=int, ) parser.add_argument( "-o", "--offset", help="Offset trajectory by this rotation [yaw, pitch, roll]", nargs=3, type=int, ) for a, ax in zip("ypr", ["yaw", "pitch", "roll"]): parser.add_argument( f"-z{a}", f"--zero_{ax}", action="store_true", default=[], help=f"Zero {ax} axis", ) parser.add_argument( "-of", "--output_format", choices=["q", "e"], default="q", help="Output format: 'e' for Euler (YPR) and 'q' for Quaternions, default = %(default)s", type=str, ) return parser.parse_args() def main(): args = get_args() trj = read_trajectory(args.in_trj) if args.zero_yaw or args.zero_pitch or args.zero_roll: trj_euler = Quat2Euler(trj) if args.zero_yaw: trj_euler[:, 0] = 0 if args.zero_pitch: trj_euler[:, 1] = 0 if args.zero_roll: trj_euler[:, 2] = 0 trj = Euler2Quat(trj_euler) if args.offset: args.offset = np.array(args.offset) args.offset = Euler2Quat(args.offset) # left multiply by offset to chain the rotations trj = np.apply_along_axis(partial(q_mul, args.offset), 1, trj) if args.invert: trj = np.apply_along_axis(q_inv, 1, trj) if args.delay: pad = np.array([[1, 0, 0, 0]]) trj = np.vstack([np.repeat(pad, int(args.delay / 5), axis=0), trj]) write_trajectory(trj, args.out_trj, quat=(args.output_format == "q")) ivas_processing_scripts/trajectories/__main__.py 0 → 100755 +36 −0 Original line number Diff line number Diff line #!/usr/bin/env python3 # # (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository. All Rights Reserved. # # This software is protected by copyright law and by international treaties. # The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository retain full ownership rights in their respective contributions in # the software. This notice grants no license of any kind, including but not limited to patent # license, nor is any license granted by implication, estoppel or otherwise. # # Contributors are required to enter into the IVAS codec Public Collaboration agreement before making # contributions. # # This software is provided "AS IS", without any express or implied warranties. The software is in the # development stage. It is intended exclusively for experts who have experience with such software and # solely for the purpose of inspection. All implied warranties of non-infringement, merchantability # and fitness for a particular purpose are hereby disclaimed and excluded. # # Any dispute, controversy or claim arising under or in relation to providing this software shall be # submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in # accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and # the United Nations Convention on Contracts on the International Sales of Goods. # from ivas_processing_scripts.trajectories import main if __name__ == "__main__": main() Loading
experiments/selection_isar/README.md +34 −2 Original line number Diff line number Diff line <!--- (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository. All Rights Reserved. This software is protected by copyright law and by international treaties. The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository retain full ownership rights in their respective contributions in the software. This notice grants no license of any kind, including but not limited to patent license, nor is any license granted by implication, estoppel or otherwise. Contributors are required to enter into the IVAS codec Public Collaboration agreement before making contributions. This software is provided "AS IS", without any express or implied warranties. The software is in the development stage. It is intended exclusively for experts who have experience with such software and solely for the purpose of inspection. All implied warranties of non-infringement, merchantability and fitness for a particular purpose are hereby disclaimed and excluded. Any dispute, controversy or claim arising under or in relation to providing this software shall be submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and the United Nations Convention on Contracts on the International Sales of Goods. --> # IVAS ISAR Selection Experiments This directory contains input and configuration files for the ISAR selection tests based on S4-240396. Loading @@ -7,7 +39,7 @@ All tests use the BS.1534 (MUSHRA) test methodology. ## Experiments | Experiment | Input format | |:----------:|:------------:| | :--------: | :----------: | | BS1534-1a | HOA3 | | BS1534-2a | MASA | | BS1534-3a | 7_1_4 | Loading
ivas_processing_scripts/audiotools/quaternions.py 0 → 100755 +143 −0 Original line number Diff line number Diff line #!/usr/bin/env python3 # # (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository. All Rights Reserved. # # This software is protected by copyright law and by international treaties. # The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository retain full ownership rights in their respective contributions in # the software. This notice grants no license of any kind, including but not limited to patent # license, nor is any license granted by implication, estoppel or otherwise. # # Contributors are required to enter into the IVAS codec Public Collaboration agreement before making # contributions. # # This software is provided "AS IS", without any express or implied warranties. The software is in the # development stage. It is intended exclusively for experts who have experience with such software and # solely for the purpose of inspection. All implied warranties of non-infringement, merchantability # and fitness for a particular purpose are hereby disclaimed and excluded. # # Any dispute, controversy or claim arising under or in relation to providing this software shall be # submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in # accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and # the United Nations Convention on Contracts on the International Sales of Goods. # import numpy as np """ Based on Jia, Y. B. (2008). Quaternions and rotations. Com S, 477(577), 15. """ ################################### # Operations on only one quaternion ################################### def is_unitquat(q): # the norm must be 1 for a unit quaternion if q_norm2(q) == 1: return True else: return False def q_conj(q): # quaternion conjugate p = q.copy() p[1:] = -p[1:] return p def q_norm2(q): # quaternion norm return np.sqrt(np.sum(q**2)) def q_inv(q): # quaternion inverse return q_conj(q) / q_norm2(q) def q_exp(q, e): # quaternion exponentiation p = np.zeros_like(q) eps = np.zeros_like(q) eps[0] = 0 eps[1:] = q[1:] norm_e = np.sqrt(q_norm2((e))) if norm_e == 0: # real quaternion, reaise the real part p[0] = q[0] ** e p[1:] = 0 else: # go to the polar form norm = np.sqrt(q_norm2(q)) phi = np.arccos(q[0] / norm) eps = eps * (1 / norm_e) p[0] = norm * np.cos(e * phi) p[1] = norm * eps[1] * np.sin(e * phi) p[2] = norm * eps[2] * np.sin(e * phi) p[3] = norm * eps[3] * np.sin(e * phi) return p def q_log(q): # quaternion logarithm if not is_unitquat(q): raise ValueError("Input must be a unit quaternion!") p = np.zeros_like(q) vec = q[1:] vec_norm = np.sqrt(np.sum(vec**2)) vec /= vec_norm vec *= np.arccos(q[0]) p[1:] = vec return p ############################### # Operations on two quaternions ############################### def q_add(p, q): # quaternion addition return np.add(p, q) def q_sub(p, q): # quaternion subtraction return np.sub(p, q) def q_mul(p, q): # quaternion multiplication pq = np.zeros_like(q) pq[0] = p[0] * q[0] - p[1] * q[1] - p[2] * q[2] - p[3] * q[3] pq[1] = p[0] * q[1] + p[1] * q[0] + p[2] * q[3] - p[3] * q[2] pq[2] = p[0] * q[2] + p[1] * q[3] + p[2] * q[0] - p[3] * q[1] pq[3] = p[0] * q[3] - p[1] * q[2] + p[2] * q[1] + p[3] * q[0] return pq def q_div(p, q): # quaternion division return q_mul(p, q_inv(q))
ivas_processing_scripts/trajectories/README.md 0 → 100644 +62 −0 Original line number Diff line number Diff line <!--- (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository. All Rights Reserved. This software is protected by copyright law and by international treaties. The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository retain full ownership rights in their respective contributions in the software. This notice grants no license of any kind, including but not limited to patent license, nor is any license granted by implication, estoppel or otherwise. Contributors are required to enter into the IVAS codec Public Collaboration agreement before making contributions. This software is provided "AS IS", without any express or implied warranties. The software is in the development stage. It is intended exclusively for experts who have experience with such software and solely for the purpose of inspection. All implied warranties of non-infringement, merchantability and fitness for a particular purpose are hereby disclaimed and excluded. Any dispute, controversy or claim arising under or in relation to providing this software shall be submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and the United Nations Convention on Contracts on the International Sales of Goods. --> # Trajectory file processing module This module can be executed using `python -m ivas_processing_scripts.trajectories`. IVAS head tracking trajectory files can be manipulated using this helper script. See the usage help below for details. ```text usage: Process IVAS .csv head tracking trajectories in either Euler (YPR) or Quaternion format. Order of supported operations: zero => offset => invert => delay Head tracking data is equivalent to scene rotation data (NOT listener orientation, use --invert if needed) [-h] [-i] [-d DELAY] [-o OFFSET OFFSET OFFSET] [-zy] [-zp] [-zr] [-of {q,e}] in_trj out_trj positional arguments: in_trj Input Trajectory out_trj Output Trajectory options: -h, --help show this help message and exit -i, --invert Flag to invert trajectory, default = False -d DELAY, --delay DELAY Delay trajectory by this amount in milliseconds -o OFFSET OFFSET OFFSET, --offset OFFSET OFFSET OFFSET Offset trajectory by this rotation [yaw, pitch, roll] -zy, --zero_yaw Zero yaw axis -zp, --zero_pitch Zero pitch axis -zr, --zero_roll Zero roll axis -of {q,e}, --output_format {q,e} Output format: 'e' for Euler (YPR) and 'q' for Quaternions, default = q ```
ivas_processing_scripts/trajectories/__init__.py 0 → 100755 +124 −0 Original line number Diff line number Diff line #!/usr/bin/env python3 # # (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository. All Rights Reserved. # # This software is protected by copyright law and by international treaties. # The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository retain full ownership rights in their respective contributions in # the software. This notice grants no license of any kind, including but not limited to patent # license, nor is any license granted by implication, estoppel or otherwise. # # Contributors are required to enter into the IVAS codec Public Collaboration agreement before making # contributions. # # This software is provided "AS IS", without any express or implied warranties. The software is in the # development stage. It is intended exclusively for experts who have experience with such software and # solely for the purpose of inspection. All implied warranties of non-infringement, merchantability # and fitness for a particular purpose are hereby disclaimed and excluded. # # Any dispute, controversy or claim arising under or in relation to providing this software shall be # submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in # accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and # the United Nations Convention on Contracts on the International Sales of Goods. # import argparse from functools import partial import numpy as np from ivas_processing_scripts.audiotools.quaternions import q_inv, q_mul from ivas_processing_scripts.audiotools.rotation import Euler2Quat, Quat2Euler from ivas_processing_scripts.audiotools.utils import read_trajectory, write_trajectory def get_args(): parser = argparse.ArgumentParser( """Process IVAS .csv head tracking trajectories in either Euler (YPR) or Quaternion format. Order of supported operations: zero => offset => invert => delay Head tracking data is equivalent to scene rotation data (NOT listener orientation, use --invert if needed) """ ) parser.add_argument("in_trj", help="Input Trajectory") parser.add_argument("out_trj", help="Output Trajectory") parser.add_argument( "-i", "--invert", action="store_true", default=False, help="Flag to invert trajectory, default = %(default)s", ) parser.add_argument( "-d", "--delay", default=None, help="Delay trajectory by this amount in milliseconds", type=int, ) parser.add_argument( "-o", "--offset", help="Offset trajectory by this rotation [yaw, pitch, roll]", nargs=3, type=int, ) for a, ax in zip("ypr", ["yaw", "pitch", "roll"]): parser.add_argument( f"-z{a}", f"--zero_{ax}", action="store_true", default=[], help=f"Zero {ax} axis", ) parser.add_argument( "-of", "--output_format", choices=["q", "e"], default="q", help="Output format: 'e' for Euler (YPR) and 'q' for Quaternions, default = %(default)s", type=str, ) return parser.parse_args() def main(): args = get_args() trj = read_trajectory(args.in_trj) if args.zero_yaw or args.zero_pitch or args.zero_roll: trj_euler = Quat2Euler(trj) if args.zero_yaw: trj_euler[:, 0] = 0 if args.zero_pitch: trj_euler[:, 1] = 0 if args.zero_roll: trj_euler[:, 2] = 0 trj = Euler2Quat(trj_euler) if args.offset: args.offset = np.array(args.offset) args.offset = Euler2Quat(args.offset) # left multiply by offset to chain the rotations trj = np.apply_along_axis(partial(q_mul, args.offset), 1, trj) if args.invert: trj = np.apply_along_axis(q_inv, 1, trj) if args.delay: pad = np.array([[1, 0, 0, 0]]) trj = np.vstack([np.repeat(pad, int(args.delay / 5), axis=0), trj]) write_trajectory(trj, args.out_trj, quat=(args.output_format == "q"))
ivas_processing_scripts/trajectories/__main__.py 0 → 100755 +36 −0 Original line number Diff line number Diff line #!/usr/bin/env python3 # # (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository. All Rights Reserved. # # This software is protected by copyright law and by international treaties. # The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, # Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., # Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, # Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other # contributors to this repository retain full ownership rights in their respective contributions in # the software. This notice grants no license of any kind, including but not limited to patent # license, nor is any license granted by implication, estoppel or otherwise. # # Contributors are required to enter into the IVAS codec Public Collaboration agreement before making # contributions. # # This software is provided "AS IS", without any express or implied warranties. The software is in the # development stage. It is intended exclusively for experts who have experience with such software and # solely for the purpose of inspection. All implied warranties of non-infringement, merchantability # and fitness for a particular purpose are hereby disclaimed and excluded. # # Any dispute, controversy or claim arising under or in relation to providing this software shall be # submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in # accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and # the United Nations Convention on Contracts on the International Sales of Goods. # from ivas_processing_scripts.trajectories import main if __name__ == "__main__": main()