Skip to content

Commit 8b7db97

Browse files
committed
cmpto_j2k: print also cpu convs duration
in debug
1 parent faa6a7b commit 8b7db97

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/tv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ typedef long long time_ns_t;
9797
#define NS_IN_US_DBL ((double) NS_IN_US)
9898
#define US_TO_MS(val_us) ((val_us) / 1000)
9999
#define MS_TO_US(val_ms) ((val_ms) * 1000)
100+
#define NS_TO_MS(val_ns) ((val_ns) / 1000 / 1000)
100101

101102
static inline time_ns_t get_time_in_ns() {
102103
#ifdef HAVE_TIMESPEC_GET

src/video_compress/cmpto_j2k.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,14 @@ static void parallel_conv(video_frame *dst, video_frame *src){
161161
decoder_t decoder =
162162
get_decoder_from_to(src->color_spec, dst->color_spec);
163163
assert(decoder != nullptr);
164+
time_ns_t t0 = get_time_in_ns();
164165
parallel_pix_conv((int) src->tiles[0].height, dst->tiles[0].data,
165166
dst_pitch, src->tiles[0].data, src_pitch,
166167
decoder, 0);
168+
if (log_level >= LOG_LEVEL_DEBUG) {
169+
MSG(DEBUG, "pixfmt conversion duration: %f ms\n",
170+
NS_TO_MS((double) (get_time_in_ns() - t0)));
171+
}
167172
}
168173

169174
#ifdef HAVE_CUDA

src/video_decompress/cmpto_j2k.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,14 @@ static void rg48_to_r12l(unsigned char *dst_buffer,
140140
int dst_len = vc_get_linesize(width, R12L);
141141
decoder_t vc_copylineRG48toR12L = get_decoder_from_to(RG48, R12L);
142142

143+
time_ns_t t0 = get_time_in_ns();
143144
parallel_pix_conv((int) height, (char *) dst_buffer, dst_len,
144145
(const char *) src_buffer, src_pitch,
145146
vc_copylineRG48toR12L, 0);
147+
if (log_level >= LOG_LEVEL_DEBUG) {
148+
MSG(DEBUG, "pixfmt conversion duration: %f ms\n",
149+
NS_TO_MS((double) (get_time_in_ns() - t0)));
150+
}
146151
}
147152

148153
static void print_dropped(unsigned long long int dropped) {

0 commit comments

Comments
 (0)