[FFmpeg-devel] [PATCH] Add GPU accelerated video crop filter

Tao Zhang nowerzt at gmail.com
Sat Mar 23 14:17:27 EET 2019


Got it and corrected. Thanks Timo

Timo Rothenpieler <timo at rothenpieler.org> 于2019年3月23日周六 下午7:53写道:

> On 23.03.2019 12:31, UsingtcNower wrote:
>  > diff --git a/configure b/configure
>  > index 331393f..88f1e91 100755
>  > --- a/configure
>  > +++ b/configure
>  > @@ -2978,6 +2978,7 @@ scale_npp_filter_deps="ffnvcodec libnpp"
>  >   scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
>  >   thumbnail_cuda_filter_deps="ffnvcodec cuda_nvcc"
>  >   transpose_npp_filter_deps="ffnvcodec libnpp"
>  > +crop_cuda_filter_deps="ffnvcodec cuda_nvcc"
>
> These are generally kept in alphabetical order.
>
> > +static av_cold int init_processing_chain(AVFilterContext *ctx, int
> in_width, int in_height,
> > +                                         int out_width, int out_height,
> > +                                         int left, int top)
> > +{
> > +    CUDACropContext *s = ctx->priv;
> > +
> > +    AVHWFramesContext *in_frames_ctx;
> > +
> > +    enum AVPixelFormat in_format;
> > +    enum AVPixelFormat out_format;
> > +    int ret;
> > +
> > +    /* check that we have a hw context */
> > +    if (!ctx->inputs[0]->hw_frames_ctx) {
> > +        av_log(ctx, AV_LOG_ERROR, "No hw context provided on input\n");
> > +        return AVERROR(EINVAL);
> > +    }
> > +    in_frames_ctx =
> (AVHWFramesContext*)ctx->inputs[0]->hw_frames_ctx->data;
> > +    in_format     = in_frames_ctx->sw_format;
> > +    out_format    = (s->format == AV_PIX_FMT_NONE) ? in_format :
> s->format;
> > +
> > +    if (!format_is_supported(in_format)) {
> > +        av_log(ctx, AV_LOG_ERROR, "Unsupported input format: %s\n",
> > +               av_get_pix_fmt_name(in_format));
> > +        return AVERROR(ENOSYS);
> > +    }
> > +    if (!format_is_supported(out_format)) {
> > +        av_log(ctx, AV_LOG_ERROR, "Unsupported output format: %s\n",
> > +               av_get_pix_fmt_name(out_format));
> > +        return AVERROR(ENOSYS);
> > +    }
> > +
> > +    if (in_width == out_width && in_height == out_height)
> > +        s->passthrough = 1;
> > +
> > +    s->in_fmt = in_format;
> > +    s->out_fmt = out_format;
> > +
> > +    s->planes_in[0].width   = in_width;
> > +    s->planes_in[0].height  = in_height;
> > +    s->planes_out[0].width  = out_width;
> > +    s->planes_out[0].height = out_height;
> > +    s->planes_in[0].left = left;
> > +    s->planes_in[0].top = top;
> > +    s->planes_out[0].left = 0;
> > +    s->planes_out[0].top = 0;
>
> This is a nit, but why not align all of them?
>
> Also missing a version bump. I'd say bumping lavf micro version is enough.
>
>
> Otherwise this looks good to me. Will give it a test later, and I don't
> really see any reason not to merge this.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list