Commit fc5299ff authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

add per-item trajectory and render config search

parent c6b18040
Loading
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -435,6 +435,13 @@ conditions_to_generate:
      # fs: 48000
      ### Additional commandline options; default = null
      # opts: ["-q", "-no_delay_cmp"]
      ### Per-item renderer configuration. Set to true to search for a file with suffix .cfg; default = false
      # render_config: true
      ### Head-tracking trajectory file for binaural output OR 'true' which will search for a file with the suffix .ht.csv next to the input; default = null
      ###   NOTE: this automatically configures the '-T' argument to the decoder, so may conflict if also specified in `opts`
      # trajectory: "path/to/file"
      ### Limit the trajectory to 3DoF via truncation; default = false
      # only_3dof: false

  ### IVAS condition ###############################
  c07:
@@ -520,8 +527,10 @@ postprocessing:
  # bin_lfe_gain: 1
  ### Flag whether output should be limited to avoid clipping (can alter target loudness); default = true
  # limit: false
  ### Head-tracking trajectory file for binaural output; default = null
  ### Head-tracking trajectory file for binaural output OR 'true' which will search for a file with the suffix .ht.csv in the input dir; default = null
  # trajectory: "path/to/file"
  ### Limit the trajectory to 3DoF via truncation; default = false
  # only_3dof: false
```

</details>
+24 −15
Original line number Diff line number Diff line
@@ -290,6 +290,13 @@ conditions_to_generate:
          # fs: 48000
          ### Additional commandline options; default = null
          # opts: ["-q", "-no_delay_cmp"]
          ### Per-item renderer configuration. Set to true to search for a file with suffix .cfg in the input dir; default = false
          # render_config: true
          ### Head-tracking trajectory file for binaural output OR 'true' which will search for a file with the suffix .ht.csv in the input dir; default = null
          ###   NOTE: this automatically configures the '-T' argument to the decoder, so may conflict if also specified in `opts`
          # trajectory: "path/to/file"
          ### Limit the trajectory to 3DoF via truncation; default = false
          # only_3dof: false
      ### Bitstream options
      # tx:
          ### For possible arguments see overall bitstream modification
@@ -352,5 +359,7 @@ postprocessing:
# bin_lfe_gain: 1
### Flag whether output should be limited to avoid clipping (can alter target loudness); default = false
# limit: true
    ### Head-tracking trajectory file for binaural output; default = null
### Head-tracking trajectory file for binaural output OR 'true' which will search for a file with the suffix .ht.csv in the input dir; default = null
# trajectory: "path/to/file"
### Limit the trajectory to 3DoF via truncation; default = false
# only_3dof: false
+0 −1
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ class Audio(ABC):
        self.audio = None
        self.fs = None
        self.num_channels = None
        # self.logger = None # TODO needed?

    def __repr__(self):
        return f"{self.__class__} : {self.__dict__}"
+1 −1
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@ def process_audio(
    if loudness is not None:
        if logger:
            logger.debug(
                f"Applying loudness adjustment to {loudness} LKFS for format {loudness_fmt} using ITU STL bs1770demo"
                f"Applying loudness adjustment to {loudness} LKFS for format {x.name} (measured using {loudness_fmt}) using ITU STL bs1770demo"
            )
        x.audio, _ = loudness_norm(x, loudness, loudness_fmt, logger=logger)

+29 −0
Original line number Diff line number Diff line
@@ -31,10 +31,12 @@
#

from pathlib import Path
from typing import Union

import numpy as np

from ivas_processing_scripts.audiotools.rotation import Euler2Quat, Quat2Euler
from ivas_processing_scripts.utils import get_abs_path


def read_trajectory(trj_file: Path, return_quat=True):
@@ -69,3 +71,30 @@ def write_trajectory(trj, out_file, write_quat=True):
        for pos in trj:
            f.write(", ".join([f"{q:.6f}" for q in pos]))
            f.write("\n")


def get_trajectory_or_dir(
    trj: Union[str, Path, bool], input_path: Path
) -> tuple[Path, Path]:
    trajectory = None
    trajectory_dir = None
    if isinstance(trj, bool):
        trajectory_dir = input_path
    else:
        trajectory = get_abs_path(trj)

    return trajectory, trajectory_dir


def truncate_trajectory_3dof(
    in_file: Path,
    out_file: Path,
) -> None:

    data = np.genfromtxt(in_file, delimiter=",")
    data = data[:, :4]

    with open(out_file, "w") as f:
        for pos in data:
            f.write(", ".join([f"{q:.6f}" for q in pos]))
            f.write("\n")
Loading