[FFmpeg-devel] [PATCH] lavfi/il: simplify/generalize linesize computation
Stefano Sabatini
stefasab at gmail.com
Sun Feb 10 14:03:32 CET 2013
On date Sunday 2013-02-10 01:19:44 +0100, Stefano Sabatini encoded:
> Rely on generic utilities for computing each plane linesize.
>
> In particular, add support to NV12/21 formats and avoid use of
> PIX_FMT_PLANAR pixdesc flag, whose semantics is questionable.
> ---
> libavfilter/vf_il.c | 42 ++++++++++++++++++------------------------
> 1 file changed, 18 insertions(+), 24 deletions(-)
>
> diff --git a/libavfilter/vf_il.c b/libavfilter/vf_il.c
> index 8343307..0be45ed 100644
> --- a/libavfilter/vf_il.c
> +++ b/libavfilter/vf_il.c
> @@ -25,6 +25,7 @@
> */
>
> #include "libavutil/opt.h"
> +#include "libavutil/imgutils.h"
> #include "libavutil/pixdesc.h"
> #include "avfilter.h"
> #include "internal.h"
> @@ -40,8 +41,8 @@ typedef struct {
> enum FilterMode luma_mode, chroma_mode, alpha_mode;
> int luma_swap, chroma_swap, alpha_swap;
> int nb_planes;
> - int chroma_width, chroma_height;
> - int width;
> + int linesize[4], chroma_height;
> + int has_alpha;
> } IlContext;
>
> #define OFFSET(x) offsetof(IlContext, x)
> @@ -98,19 +99,17 @@ static int config_input(AVFilterLink *inlink)
> {
> IlContext *il = inlink->dst->priv;
> const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
> - int bpp = av_get_padded_bits_per_pixel(desc) >> 3;
> - int bytes = FFALIGN(desc->comp[0].depth_minus1 + 1, 8) / 8;
> - int i;
> + int i, ret;
>
> for (i = 0; i < desc->nb_components; i++)
> il->nb_planes = FFMAX(il->nb_planes, desc->comp[i].plane);
> il->nb_planes++;
>
> + il->has_alpha = desc->flags & PIX_FMT_ALPHA;
Fixed this one, and applied after more testing.
--
FFmpeg = Fanciful and Fast Martial Peaceful Efficient Generator
More information about the ffmpeg-devel
mailing list