Add IDR info in timings csv
This commit is contained in:
committed by
Guillaume Meunier
parent
df786362e7
commit
7e22b3fa92
@@ -92,7 +92,9 @@ void VideoEncoder::Encode(wivrn_session & cnx,
|
|||||||
{
|
{
|
||||||
this->cnx = &cnx;
|
this->cnx = &cnx;
|
||||||
auto target_timestamp = std::chrono::steady_clock::time_point(std::chrono::nanoseconds(view_info.display_time));
|
auto target_timestamp = std::chrono::steady_clock::time_point(std::chrono::nanoseconds(view_info.display_time));
|
||||||
cnx.dump_time("encode_begin", frame_index, os_monotonic_get_ns(), stream_idx);
|
bool idr = sync_needed.exchange(false);
|
||||||
|
const char* extra = idr ? ",idr" : ",p";
|
||||||
|
cnx.dump_time("encode_begin", frame_index, os_monotonic_get_ns(), stream_idx, extra);
|
||||||
|
|
||||||
// Prepare the video shard template
|
// Prepare the video shard template
|
||||||
shard.stream_item_idx = stream_idx;
|
shard.stream_item_idx = stream_idx;
|
||||||
@@ -100,8 +102,8 @@ void VideoEncoder::Encode(wivrn_session & cnx,
|
|||||||
shard.shard_idx = 0;
|
shard.shard_idx = 0;
|
||||||
shard.view_info = view_info;
|
shard.view_info = view_info;
|
||||||
|
|
||||||
Encode(index, sync_needed.exchange(false), target_timestamp);
|
Encode(index, idr, target_timestamp);
|
||||||
cnx.dump_time("encode_end", frame_index, os_monotonic_get_ns(), stream_idx);
|
cnx.dump_time("encode_end", frame_index, os_monotonic_get_ns(), stream_idx, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoEncoder::SendData(std::span<uint8_t> data, bool end_of_frame)
|
void VideoEncoder::SendData(std::span<uint8_t> data, bool end_of_frame)
|
||||||
|
|||||||
@@ -277,11 +277,11 @@ std::array<to_headset::video_stream_description::foveation_parameter, 2> wivrn_s
|
|||||||
return hmd->get_foveation_parameters();
|
return hmd->get_foveation_parameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wivrn_session::dump_time(const std::string & event, uint64_t frame, uint64_t time, uint8_t stream)
|
void wivrn_session::dump_time(const std::string & event, uint64_t frame, uint64_t time, uint8_t stream, const char* extra)
|
||||||
{
|
{
|
||||||
if (feedback_csv)
|
if (feedback_csv)
|
||||||
{
|
{
|
||||||
std::lock_guard lock(csv_mutex);
|
std::lock_guard lock(csv_mutex);
|
||||||
feedback_csv << std::quoted(event) << "," << frame << "," << time << "," << (int)stream << std::endl;
|
feedback_csv << std::quoted(event) << "," << frame << "," << time << "," << (int)stream << extra << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public:
|
|||||||
|
|
||||||
std::array<to_headset::video_stream_description::foveation_parameter, 2> get_foveation_parameters();
|
std::array<to_headset::video_stream_description::foveation_parameter, 2> get_foveation_parameters();
|
||||||
|
|
||||||
void dump_time(const std::string & event, uint64_t frame, uint64_t time, uint8_t stream = -1);
|
void dump_time(const std::string & event, uint64_t frame, uint64_t time, uint8_t stream = -1, const char* extra = "");
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void run(std::weak_ptr<wivrn_session>);
|
static void run(std::weak_ptr<wivrn_session>);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class Frame:
|
|||||||
self.num = num
|
self.num = num
|
||||||
self.events = dict()
|
self.events = dict()
|
||||||
self.streams = dict()
|
self.streams = dict()
|
||||||
|
self.flags = dict()
|
||||||
|
|
||||||
def set(self, event, timestamp, stream):
|
def set(self, event, timestamp, stream):
|
||||||
if stream == 255:
|
if stream == 255:
|
||||||
@@ -22,7 +23,10 @@ class Frame:
|
|||||||
self.streams[stream] = dict()
|
self.streams[stream] = dict()
|
||||||
self.streams[stream][event] = timestamp
|
self.streams[stream][event] = timestamp
|
||||||
|
|
||||||
def duration(self, begin="wake_up", end="display", stream=None):
|
def flag(self, stream, flag):
|
||||||
|
self.flags[stream if stream != 255 else None] = flag
|
||||||
|
|
||||||
|
def duration(self, begin="wake_up", end="display", stream=None, begin_selector=min, end_selector=max):
|
||||||
try:
|
try:
|
||||||
if stream is None:
|
if stream is None:
|
||||||
streams = list(self.streams.values())
|
streams = list(self.streams.values())
|
||||||
@@ -31,13 +35,13 @@ class Frame:
|
|||||||
if begin in self.events:
|
if begin in self.events:
|
||||||
t0 = self.events[begin]
|
t0 = self.events[begin]
|
||||||
else:
|
else:
|
||||||
t0 = min([s[begin] for s in streams])
|
t0 = begin_selector([s[begin] for s in streams])
|
||||||
if end in self.events:
|
if end in self.events:
|
||||||
t1 = self.events[end]
|
t1 = self.events[end]
|
||||||
else:
|
else:
|
||||||
t1 = max([s[end] for s in streams])
|
t1 = end_selector([s[end] for s in streams])
|
||||||
return (t1 - t0)/1_000_000
|
return (t1 - t0)/1_000_000
|
||||||
except KeyError:
|
except (KeyError, ValueError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@@ -138,7 +142,7 @@ def read(file, skip=0, duration_ms=-1):
|
|||||||
|
|
||||||
origin = None
|
origin = None
|
||||||
frames = []
|
frames = []
|
||||||
for event, frame, timestamp, stream in timings:
|
for event, frame, timestamp, stream, *extra in timings:
|
||||||
frame = int(frame) - skip
|
frame = int(frame) - skip
|
||||||
|
|
||||||
if frame < 0:
|
if frame < 0:
|
||||||
@@ -161,10 +165,16 @@ def read(file, skip=0, duration_ms=-1):
|
|||||||
frames.append(Frame(len(frames)))
|
frames.append(Frame(len(frames)))
|
||||||
|
|
||||||
frames[frame].set(event, timestamp, stream)
|
frames[frame].set(event, timestamp, stream)
|
||||||
|
for x in extra:
|
||||||
|
frames[frame].flag(stream, x)
|
||||||
return frames
|
return frames
|
||||||
|
|
||||||
def durations(frames, begin="wake_up", end="display", stream=None):
|
def durations(frames, stream=None, flag=None, *args, **kwargs):
|
||||||
res = [frame.duration(begin, end, stream) for frame in frames]
|
def filter(frame):
|
||||||
|
if flag is None:
|
||||||
|
return True
|
||||||
|
return flag in frame.flags.get(stream, ())
|
||||||
|
res = [frame.duration(*args, **kwargs) for frame in frames if filter(frame)]
|
||||||
return [d for d in res if d is not None]
|
return [d for d in res if d is not None]
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user