[FFmpeg-cvslog] avfilter/vf_thumbnail: optimize planar processing path

2022-12-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Dec  5 15:35:05 
2022 +0100| [46642ceeafeee5b8cbc82ff32ce3dcd7c73af159] | committer: Paul B Mahol

avfilter/vf_thumbnail: optimize planar processing path

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

 libavfilter/vf_thumbnail.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_thumbnail.c b/libavfilter/vf_thumbnail.c
index 0622e3706e..f66af760a3 100644
--- a/libavfilter/vf_thumbnail.c
+++ b/libavfilter/vf_thumbnail.c
@@ -191,11 +191,14 @@ static int do_slice(AVFilterContext *ctx, void *arg, int 
jobnr, int nb_jobs)
 const int slice_start = (s->planeheight[plane] * jobnr) / nb_jobs;
 const int slice_end = (s->planeheight[plane] * (jobnr+1)) / 
nb_jobs;
 const uint8_t *p = frame->data[plane] + slice_start * 
frame->linesize[plane];
+const ptrdiff_t linesize = frame->linesize[plane];
+const int planewidth = s->planewidth[plane];
+int *hhist = hist + 256 * plane;
 
 for (int j = slice_start; j < slice_end; j++) {
-for (int i = 0; i < s->planewidth[plane]; i++)
-hist[256*plane + p[i]]++;
-p += frame->linesize[plane];
+for (int i = 0; i < planewidth; i++)
+hhist[p[i]]++;
+p += linesize;
 }
 }
 break;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avfilter/vf_thumbnail: allow to change stats log level

2022-12-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Dec  5 15:46:29 
2022 +0100| [520111c610545f49eea526db3ae706e3dcd52e2b] | committer: Paul B Mahol

avfilter/vf_thumbnail: allow to change stats log level

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

 doc/filters.texi   |  4 
 libavfilter/vf_thumbnail.c | 12 +---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 4ed6d50750..4b74bce34f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -22193,6 +22193,10 @@ The filter accepts the following options:
 Set the frames batch size to analyze; in a set of @var{n} frames, the filter
 will pick one of them, and then handle the next batch of @var{n} frames until
 the end. Default is @code{100}.
+
+@item log
+Set the log level to display picked frame stats.
+Default is @code{info}.
 @end table
 
 Since the filter keeps track of the whole frames sequence, a bigger @var{n}
diff --git a/libavfilter/vf_thumbnail.c b/libavfilter/vf_thumbnail.c
index f66af760a3..4d6b0aef04 100644
--- a/libavfilter/vf_thumbnail.c
+++ b/libavfilter/vf_thumbnail.c
@@ -42,6 +42,7 @@ struct thumb_frame {
 typedef struct ThumbContext {
 const AVClass *class;
 int n;  ///< current frame
+int loglevel;
 int n_frames;   ///< number of frames for analysis
 struct thumb_frame *frames; ///< the n_frames frames
 AVRational tb;  ///< copy of the input timebase to ease access
@@ -58,6 +59,10 @@ typedef struct ThumbContext {
 
 static const AVOption thumbnail_options[] = {
 { "n", "set the frames batch size", OFFSET(n_frames), AV_OPT_TYPE_INT, 
{.i64=100}, 2, INT_MAX, FLAGS },
+{ "log", "force stats logging level", OFFSET(loglevel), AV_OPT_TYPE_INT, 
{.i64 = AV_LOG_INFO}, INT_MIN, INT_MAX, FLAGS, "level" },
+{ "quiet",   "logging disabled",  0, AV_OPT_TYPE_CONST, {.i64 
= AV_LOG_QUIET},   0, 0, FLAGS, "level" },
+{ "info","information logging level", 0, AV_OPT_TYPE_CONST, {.i64 
= AV_LOG_INFO},0, 0, FLAGS, "level" },
+{ "verbose", "verbose logging level", 0, AV_OPT_TYPE_CONST, {.i64 
= AV_LOG_VERBOSE}, 0, 0, FLAGS, "level" },
 { NULL }
 };
 
@@ -127,9 +132,10 @@ static AVFrame *get_best_frame(AVFilterContext *ctx)
 
 // raise the chosen one
 picref = s->frames[best_frame_idx].buf;
-av_log(ctx, AV_LOG_INFO, "frame id #%d (pts_time=%f) selected "
-   "from a set of %d images\n", best_frame_idx,
-   picref->pts * av_q2d(s->tb), nb_frames);
+if (s->loglevel != AV_LOG_QUIET)
+av_log(ctx, s->loglevel, "frame id #%d (pts_time=%f) selected "
+   "from a set of %d images\n", best_frame_idx,
+   picref->pts * av_q2d(s->tb), nb_frames);
 s->frames[best_frame_idx].buf = NULL;
 
 return picref;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/nvenc: explicitly disable lookahead if lacking sufficient surfaces

2022-12-05 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Mon Dec  
5 21:10:36 2022 +0100| [ac0f42d8939351747fcb6938d4bdebc970b8ee0e] | committer: 
Timo Rothenpieler

avcodec/nvenc: explicitly disable lookahead if lacking sufficient surfaces

It could already be enabled by the preset, so it needs explicitly
disabled in this case.

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

 libavcodec/nvenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 9726c565d3..30c10f394a 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1076,6 +1076,7 @@ static av_cold void 
nvenc_setup_rate_control(AVCodecContext *avctx)
 ctx->encode_config.frameIntervalP - 4;
 
 if (lkd_bound < 0) {
+ctx->encode_config.rcParams.enableLookahead = 0;
 av_log(avctx, AV_LOG_WARNING,
"Lookahead not enabled. Increase buffer delay (-delay).\n");
 } else {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/nvenc: notify users about rc_lookahead clipping

2022-12-05 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Mon Dec  
5 21:18:42 2022 +0100| [45216e33e295f27b52bb0e829284f682ba48b7c8] | committer: 
Timo Rothenpieler

avcodec/nvenc: notify users about rc_lookahead clipping

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

 libavcodec/nvenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 30c10f394a..8a776e5737 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1089,6 +1089,9 @@ static av_cold void 
nvenc_setup_rate_control(AVCodecContext *avctx)
ctx->encode_config.rcParams.lookaheadDepth,
ctx->encode_config.rcParams.disableIadapt ? "disabled" : 
"enabled",
ctx->encode_config.rcParams.disableBadapt ? "disabled" : 
"enabled");
+if (ctx->encode_config.rcParams.lookaheadDepth < ctx->rc_lookahead)
+av_log(avctx, AV_LOG_WARNING, "Clipping lookahead depth to %d 
(from %d) due to lack of surfaces/delay",
+ctx->encode_config.rcParams.lookaheadDepth, 
ctx->rc_lookahead);
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".