Loading scripts/split_rendering/isar_bstool.py +28 −2 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ import math import sys from collections.abc import Callable from pathlib import Path from typing import Protocol, cast, final from typing import Protocol, cast, final, override class IsarBstoolError(Exception): Loading Loading @@ -183,7 +183,11 @@ class IsarBitstream: return self def is_same_as(self, other: IsarBitstream) -> bool: @override def __eq__(self, other: object) -> bool: if not isinstance(other, IsarBitstream): return NotImplemented return self.header == other.header and self.frames == other.frames Loading @@ -206,6 +210,21 @@ class IsarFileHeader: self.sample_rate = _int_from_bytes(reader.read(4)) self.lc3plus_hires = bool(_int_from_bytes(reader.read(2))) @override def __eq__(self, other: object) -> bool: if not isinstance(other, IsarFileHeader): return NotImplemented return ( self.delay_ns == other.delay_ns and self.codec == other.codec and self.pose_correction == other.pose_correction and self.codec_frame_size_ms == other.codec_frame_size_ms and self.isar_frame_size_ms == other.isar_frame_size_ms and self.sample_rate == other.sample_rate and self.lc3plus_hires == other.lc3plus_hires ) def write(self, writer: io.BufferedWriter) -> None: _write_exact(writer, self.FILE_HEADER) _write_exact(writer, _int_to_bytes(self.delay_ns, 4)) Loading Loading @@ -240,6 +259,13 @@ class IsarFileFrame: payload_size = math.ceil(self.num_bits / 8) self.payload = reader.read(payload_size) @override def __eq__(self, other: object) -> bool: if not isinstance(other, IsarFileFrame): return NotImplemented return self.num_bits == other.num_bits and self.payload == other.payload def write(self, writer: io.BufferedWriter) -> None: _write_exact(writer, self.FRAME_HEADER) _write_exact(writer, _int_to_bytes(self.VERSION, 1)) Loading tests/test_be_for_jbm_neutral_dly_profile.py +1 −1 Original line number Diff line number Diff line Loading @@ -228,7 +228,7 @@ def compare_audio(non_voip_output, voip_output, sampling_rate_khz): def compare_isar_files(non_voip_isar, voip_isar): isar_bs = IsarBitstream(non_voip_isar) isar_bs_voip = IsarBitstream(voip_isar).trim(JBM_NEUTRAL_DELAY_MS / 1000) if not isar_bs_voip.is_same_as(isar_bs): if isar_bs_voip != isar_bs: pytest.fail( "Difference between no jbm and zero-delay jbm decoding found! ISAR files differ" ) Loading Loading
scripts/split_rendering/isar_bstool.py +28 −2 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ import math import sys from collections.abc import Callable from pathlib import Path from typing import Protocol, cast, final from typing import Protocol, cast, final, override class IsarBstoolError(Exception): Loading Loading @@ -183,7 +183,11 @@ class IsarBitstream: return self def is_same_as(self, other: IsarBitstream) -> bool: @override def __eq__(self, other: object) -> bool: if not isinstance(other, IsarBitstream): return NotImplemented return self.header == other.header and self.frames == other.frames Loading @@ -206,6 +210,21 @@ class IsarFileHeader: self.sample_rate = _int_from_bytes(reader.read(4)) self.lc3plus_hires = bool(_int_from_bytes(reader.read(2))) @override def __eq__(self, other: object) -> bool: if not isinstance(other, IsarFileHeader): return NotImplemented return ( self.delay_ns == other.delay_ns and self.codec == other.codec and self.pose_correction == other.pose_correction and self.codec_frame_size_ms == other.codec_frame_size_ms and self.isar_frame_size_ms == other.isar_frame_size_ms and self.sample_rate == other.sample_rate and self.lc3plus_hires == other.lc3plus_hires ) def write(self, writer: io.BufferedWriter) -> None: _write_exact(writer, self.FILE_HEADER) _write_exact(writer, _int_to_bytes(self.delay_ns, 4)) Loading Loading @@ -240,6 +259,13 @@ class IsarFileFrame: payload_size = math.ceil(self.num_bits / 8) self.payload = reader.read(payload_size) @override def __eq__(self, other: object) -> bool: if not isinstance(other, IsarFileFrame): return NotImplemented return self.num_bits == other.num_bits and self.payload == other.payload def write(self, writer: io.BufferedWriter) -> None: _write_exact(writer, self.FRAME_HEADER) _write_exact(writer, _int_to_bytes(self.VERSION, 1)) Loading
tests/test_be_for_jbm_neutral_dly_profile.py +1 −1 Original line number Diff line number Diff line Loading @@ -228,7 +228,7 @@ def compare_audio(non_voip_output, voip_output, sampling_rate_khz): def compare_isar_files(non_voip_isar, voip_isar): isar_bs = IsarBitstream(non_voip_isar) isar_bs_voip = IsarBitstream(voip_isar).trim(JBM_NEUTRAL_DELAY_MS / 1000) if not isar_bs_voip.is_same_as(isar_bs): if isar_bs_voip != isar_bs: pytest.fail( "Difference between no jbm and zero-delay jbm decoding found! ISAR files differ" ) Loading