[FFmpeg-devel] [Patch] beautified + accelerated vf_fillborders – Please review

Lou Logan lou at lrcd.com
Tue Mar 12 00:29:27 EET 2019


On Mon, 11 Mar 2019 23:07:37 +0100
Ulf Zibis <Ulf.Zibis at CoSoCo.de> wrote:

> From 74dda304bf7a0a31873518187438815d08533934 Mon Sep 17 00:00:00 2001
> From: Ulf Zibis <Ulf.Zibis at CoSoCo.de>
> Date: 11.03.2019, 23:04:15
> 
> Beautified + accelerated

Commit message title prefix for filter patches are usually in the form
of:

avfilter/fillborders:
or
lavfi/fillborders: 

The commit message body ideally should have a concise but informative
summary that describes the patch.

See 'git log' for examples.

> diff --git a/libavfilter/vf_fillborders.c b/libavfilter/vf_fillborders.c
> index 1344587..a7a074b 100644
> --- a/libavfilter/vf_fillborders.c
> +++ b/libavfilter/vf_fillborders.c
> @@ -1,5 +1,7 @@
>  /*
>   * Copyright (c) 2017 Paul B Mahol
> + * 

Trailing whitespace. This should always be avoided.

> + * Contributors: Ulf Zibis

We don't add a "Contributors" line. The git log covers that.

[...]
>  static void fixed_borders16(FillBordersContext *s, AVFrame *frame)
>  {
> -    int p, y, x;
> +    for (int p = 0; p < s->nb_planes; p++) {
> +        uint16_t *data = (uint16_t *)frame->data[p];
> +        int lz = frame->linesize[p] / sizeof(uint16_t);
> +        int width = s->planewidth[p];
> +        int height = s->planeheight[p] * lz;
> +        int left = s->borders[p].left;
> +        int right = width - s->borders[p].right;
> +        int top = s->borders[p].top * lz;
> +        int bottom = height - s->borders[p].bottom * lz;
> +        int fill_sz = MAX(MAX(left, right), top!=0 || height-bottom!=0 ? width : 0);
> +        uint16_t *fill = malloc(fill_sz * sizeof(uint16_t));

Use av_malloc.


More information about the ffmpeg-devel mailing list