Skip to content
Snippets Groups Projects
Commit 4219be8a authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fix python tests

parent f0e6048e
No related branches found
No related tags found
1 merge request!311Resolves #296 removal of NvPipe
Pipeline #27147 passed
This commit is part of merge request !311. Comments created here will be created in the context of that merge request.
......@@ -14,8 +14,8 @@ from enum import IntEnum
################################################################################
# components/codecs/include/ftl/codecs/packet.hpp
Packet = namedtuple("Packet", ["codec", "definition", "block_total",
"block_number", "flags", "data"])
Packet = namedtuple("Packet", ["codec", "definition", "frame_count",
"bitrate", "flags", "data"])
StreamPacket = namedtuple("StreamPacket", ["timestamp", "frameset_id",
"frame_number", "channel"])
......@@ -33,7 +33,10 @@ class codec_t(IntEnum):
PNG = 1
H264 = 2
HEVC = 3
WAV = 4
H264_LOSSLESS = 4
HEVC_LOSSLESS = 5
WAV = 32
OPUS = 33
JSON = 100
CALIBRATION = 101
POSE = 102
......@@ -127,10 +130,10 @@ class FTLDecoder:
################################################################################
def split_images(packet, im):
if packet.block_total == 1:
if packet.frame_count == 1:
return im
n = packet.block_total
n = packet.frame_count
height, width = definition_t[packet.definition]
cols = im.shape[1] // width
......@@ -145,7 +148,7 @@ def split_images(packet, im):
return imgs
def decode_codec_opencv(packet):
if packet.block_total != 1 or packet.block_number != 0:
if packet.frame_count != 1:
warn("Unsupported block format (todo)") # is this relevant?
im = _int_to_float(cv.imdecode(np.frombuffer(packet.data, dtype=np.uint8),
......@@ -154,7 +157,7 @@ def decode_codec_opencv(packet):
return split_images(packet, im)
def decode_codec_opencv_float(packet):
if packet.block_total != 1 or packet.block_number != 0:
if packet.frame_count != 1:
warn("Unsupported block format (todo)") # is this relevant?
im = cv.imdecode(np.frombuffer(packet.data, dtype=np.uint8),
......
......@@ -151,9 +151,9 @@ class FTLStreamWriter:
elif data.dtype in [np.int8, np.uint8]:
if nchans == 3:
ftl_dtype = _imageformat_t.RGB
ftl_dtype = _imageformat_t.BGR
elif nchans == 4:
ftl_dtype = _imageformat_t.RGBA
ftl_dtype = _imageformat_t.BGRA
else:
raise ValueError("Unsupported number of channels: %i" % nchans)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment