[FFmpeg-devel] [PATCH] Add GPU accelerated video crop filter
Timo Rothenpieler
timo at rothenpieler.org
Sat Mar 23 13:53:33 EET 2019
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4538 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190323/1504190e/attachment.bin>
More information about the ffmpeg-devel
mailing list