[FFmpeg-cvslog] avfilter/avf_showcwt: do not return initial black frames with negative timestamps

Paul B Mahol git at videolan.org
Sat Nov 11 18:46:01 EET 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Nov 11 17:23:55 2023 +0100| [fa4c2884dd568d4fc0d657d3622437aebc3563b3] | committer: Paul B Mahol

avfilter/avf_showcwt: do not return initial black frames with negative timestamps

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa4c2884dd568d4fc0d657d3622437aebc3563b3
---

 libavfilter/avf_showcwt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avf_showcwt.c b/libavfilter/avf_showcwt.c
index e7164ebb25..e7ed5447ce 100644
--- a/libavfilter/avf_showcwt.c
+++ b/libavfilter/avf_showcwt.c
@@ -672,8 +672,9 @@ static int run_channel_cwt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
 
         memset(isrc, 0, sizeof(*isrc) * output_padding_size);
         if (offset == 0) {
+            const unsigned *kindex = index + kernel_start;
             for (int i = 0; i < kernel_range; i++) {
-                const unsigned n = index[i + kernel_start];
+                const unsigned n = kindex[i];
 
                 isrc[n].re += dstx[i].re;
                 isrc[n].im += dstx[i].im;
@@ -1247,8 +1248,11 @@ static int activate(AVFilterContext *ctx)
                 ff_filter_execute(ctx, run_channels_cwt_prepare, fin, NULL,
                                   FFMIN(s->nb_threads, s->nb_channels));
                 if (fin) {
-                    if (s->hop_index == 0)
+                    if (s->hop_index == 0) {
                         s->in_pts = fin->pts;
+                        if (s->old_pts == AV_NOPTS_VALUE)
+                            s->old_pts = av_rescale_q(s->in_pts, inlink->time_base, outlink->time_base) - 1;
+                    }
                     s->hop_index += fin->nb_samples;
                     av_frame_free(&fin);
                 } else {



More information about the ffmpeg-cvslog mailing list