diff mbox

[FFmpeg-devel,V1,1/2] lavfi/lensfun: Use ff_filter_get_nb_threads() get number of threads

Message ID 1558490138-15867-1-git-send-email-mypopydev@gmail.com
State Accepted
Commit 98663a0bb8cb8dc0fbc7c8964ebfab9efc5c046d
Headers show

Commit Message

Jun Zhao May 22, 2019, 1:55 a.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

ff_filter_get_nb_threads() respect AVFilterContext.nb_threads and
graph->nb_threads both, in most case, we perfer this API than using
ctx->graph->nb_threads directly.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavfilter/vf_lensfun.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Paul B Mahol May 22, 2019, 8:13 a.m. UTC | #1
On 5/22/19, Jun Zhao <mypopydev@gmail.com> wrote:
> From: Jun Zhao <barryjzhao@tencent.com>
>
> ff_filter_get_nb_threads() respect AVFilterContext.nb_threads and
> graph->nb_threads both, in most case, we perfer this API than using
> ctx->graph->nb_threads directly.
>
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>  libavfilter/vf_lensfun.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c
> index 3b723dd..089121e 100644
> --- a/libavfilter/vf_lensfun.c
> +++ b/libavfilter/vf_lensfun.c
> @@ -465,7 +465,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *in)
>                                 vignetting_filter_slice,
>                                 &vignetting_thread_data,
>                                 NULL,
> -                               FFMIN(outlink->h, ctx->graph->nb_threads));
> +                               FFMIN(outlink->h,
> ff_filter_get_nb_threads(ctx)));
>      }
>
>      if (lensfun->mode & (GEOMETRY_DISTORTION | SUBPIXEL_DISTORTION)) {
> @@ -493,7 +493,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *in)
>                                 distortion_correction_filter_slice,
>                                 &distortion_correction_thread_data,
>                                 NULL,
> -                               FFMIN(outlink->h, ctx->graph->nb_threads));
> +                               FFMIN(outlink->h,
> ff_filter_get_nb_threads(ctx)));
>
>          av_frame_free(&in);
>          return ff_filter_frame(outlink, out);
> --
> 1.7.1
>

lgtm

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
mypopy@gmail.com May 22, 2019, 10:07 a.m. UTC | #2
On Wed, May 22, 2019 at 4:20 PM Paul B Mahol <onemda@gmail.com> wrote:
>
> On 5/22/19, Jun Zhao <mypopydev@gmail.com> wrote:
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > ff_filter_get_nb_threads() respect AVFilterContext.nb_threads and
> > graph->nb_threads both, in most case, we perfer this API than using
> > ctx->graph->nb_threads directly.
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> >  libavfilter/vf_lensfun.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c
> > index 3b723dd..089121e 100644
> > --- a/libavfilter/vf_lensfun.c
> > +++ b/libavfilter/vf_lensfun.c
> > @@ -465,7 +465,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> > *in)
> >                                 vignetting_filter_slice,
> >                                 &vignetting_thread_data,
> >                                 NULL,
> > -                               FFMIN(outlink->h, ctx->graph->nb_threads));
> > +                               FFMIN(outlink->h,
> > ff_filter_get_nb_threads(ctx)));
> >      }
> >
> >      if (lensfun->mode & (GEOMETRY_DISTORTION | SUBPIXEL_DISTORTION)) {
> > @@ -493,7 +493,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> > *in)
> >                                 distortion_correction_filter_slice,
> >                                 &distortion_correction_thread_data,
> >                                 NULL,
> > -                               FFMIN(outlink->h, ctx->graph->nb_threads));
> > +                               FFMIN(outlink->h,
> > ff_filter_get_nb_threads(ctx)));
> >
> >          av_frame_free(&in);
> >          return ff_filter_frame(outlink, out);
> > --
> > 1.7.1
> >
>
> lgtm
>
Pushed, Thanks.
diff mbox

Patch

diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c
index 3b723dd..089121e 100644
--- a/libavfilter/vf_lensfun.c
+++ b/libavfilter/vf_lensfun.c
@@ -465,7 +465,7 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *in)
                                vignetting_filter_slice,
                                &vignetting_thread_data,
                                NULL,
-                               FFMIN(outlink->h, ctx->graph->nb_threads));
+                               FFMIN(outlink->h, ff_filter_get_nb_threads(ctx)));
     }
 
     if (lensfun->mode & (GEOMETRY_DISTORTION | SUBPIXEL_DISTORTION)) {
@@ -493,7 +493,7 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *in)
                                distortion_correction_filter_slice,
                                &distortion_correction_thread_data,
                                NULL,
-                               FFMIN(outlink->h, ctx->graph->nb_threads));
+                               FFMIN(outlink->h, ff_filter_get_nb_threads(ctx)));
 
         av_frame_free(&in);
         return ff_filter_frame(outlink, out);