Files
SDR-Rover/tests/test_video004_keyframe.py

26 lines
1.1 KiB
Python

"""Усиление опорного кадра проверяется двумя потерями в одном блоке."""
from __future__ import annotations
import json
from tools.video004_transport import (
BASELINE_160, BASELINE_320, CODEC_RESULTS, _frames, simulate,
)
def test_double_keyframe_loss_needs_two_parity_symbols() -> None:
codec = json.loads(CODEC_RESULTS.read_text(encoding="utf-8"))
baseline = json.loads(BASELINE_320.read_text(encoding="utf-8"))
baseline_160 = json.loads(BASELINE_160.read_text(encoding="utf-8"))
combined, _ = _frames("NORMAL", 640, 360, 10, baseline["windows"][0],
codec, baseline_160)
frames = [frame for frame in combined if frame.stream_id == 0x56303334]
base = simulate(frames, 10, "2/3", 8, 1, ("keyframe_double", 2))
boosted = simulate(frames, 10, "2/3", 8, 1, ("keyframe_double", 2),
keyframe_boost=True)
assert base["displayed_frames"] == 55
assert base["unrecoverable_blocks"] == 1
assert boosted["displayed_frames"] == 60
assert boosted["parity_recoveries"] == 2