diff options
author | John Stebbins <[email protected]> | 2016-09-22 11:57:56 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2017-02-21 13:54:40 -0700 |
commit | 25bf29176bcedbd33238e0e16f1a271650f4809a (patch) | |
tree | 0e36fd652b0db3cab5faa69298e12b0bf36641ba | |
parent | e1ced8ee0d1052941d88c54b55f664fc481f94ea (diff) |
vfr: add cfr frame drop debugging logs
These logs can be enabled by uncommenting HB_DEBUG_CFR_DROPS at the top
of the file.
If you have any sources that use progressive frame upsampling that you
would like to test with this new frame drop algo, enable these debug
logs to get full details of what frames are dropped and passed.
They show which frames are dropped and the metrics that the decision to
drop is based on. They also show which frames are passed and the
cadence of passed vs. dropped frames.
-rw-r--r-- | libhb/vfr.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libhb/vfr.c b/libhb/vfr.c index 41be58f5e..81ab4183e 100644 --- a/libhb/vfr.c +++ b/libhb/vfr.c @@ -9,6 +9,7 @@ #include "hb.h" +//#define HB_DEBUG_CFR_DROPS 1 #define MAX_FRAME_ANALYSIS_DEPTH 10 struct hb_filter_private_s @@ -37,6 +38,9 @@ struct hb_filter_private_s double * frame_metric; unsigned gamma_lut[256]; +#if defined(HB_DEBUG_CFR_DROPS) + int64_t sequence; +#endif }; static int hb_vfr_init( hb_filter_object_t * filter, @@ -188,6 +192,9 @@ static hb_buffer_t * adjust_frame_rate( hb_filter_private_t * pv, pv->out_last_stop = in->s.start; } +#if defined(HB_DEBUG_CFR_DROPS) + in->s.pcr = pv->sequence++; +#endif hb_list_add(pv->frame_rate_list, in); count = hb_list_count(pv->frame_rate_list); if (count < 2) @@ -234,6 +241,24 @@ static hb_buffer_t * adjust_frame_rate( hb_filter_private_t * pv, drop_frame = find_drop_frame(pv->frame_metric, count); out = hb_list_item(pv->frame_rate_list, drop_frame); + +#if defined(HB_DEBUG_CFR_DROPS) + hb_log("CFR Drop: %ld metric %d", out->s.pcr, (int)pv->frame_metric[drop_frame]); + int jj; + for (jj = 0; jj < count; jj++) + { + if (jj == drop_frame) + { + fprintf(stderr, "(%4d) ", (int)pv->frame_metric[jj]); + } + else + { + fprintf(stderr, "%6d ", (int)pv->frame_metric[jj]); + } + } + fprintf(stderr, "\n"); +#endif + hb_list_rem(pv->frame_rate_list, out); hb_buffer_close(&out); delete_metric(pv->frame_metric, drop_frame, count); @@ -242,6 +267,13 @@ static hb_buffer_t * adjust_frame_rate( hb_filter_private_t * pv, } out = hb_list_item(pv->frame_rate_list, 0); + +#if defined(HB_DEBUG_CFR_DROPS) + static int64_t lastpass = 0; + hb_log("CFR Pass: %ld ~ %ld metric %d", out->s.pcr, out->s.pcr - lastpass, (int)pv->frame_metric[0]); + lastpass = out->s.pcr; +#endif + hb_list_rem(pv->frame_rate_list, out); hb_buffer_list_append(&list, out); delete_metric(pv->frame_metric, 0, count); |