diff mbox series

[FFmpeg-devel,13/17] avfilter/internal: Mark ff_filter_get_nb_threads() as av_pure

Message ID HE1PR0301MB21546703969128DF59805A428F319@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit b76f9bcfd0796afb3d23a4c833508a34dd516a78
Headers show
Series [FFmpeg-devel,01/17] avcodec/avcodec: Stop including bsf.h in avcodec.h
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt June 14, 2021, 10:41 p.m. UTC
It does not modify anything; it only returns a value, so it fulfills
the requirements for av_pure.
The deeper rationale behind this change is that this function is called
quite often inside arguments to FFMIN which may lead to two calls to it;
declaring this function as av_pure allows the compiler to optimize the
second call away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index f3b434dbe9..1bcfb830a1 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -363,7 +363,7 @@  static inline int ff_norm_qscale(int qscale, int type)
  * Get number of threads for current filter instance.
  * This number is always same or less than graph->nb_threads.
  */
-int ff_filter_get_nb_threads(AVFilterContext *ctx);
+int ff_filter_get_nb_threads(AVFilterContext *ctx) av_pure;
 
 /**
  * Generic processing of user supplied commands that are set