[FFmpeg-devel] [patch] yadif code dump
Michael Niedermayer
michaelni
Wed Dec 1 04:25:02 CET 2010
On Sat, Nov 27, 2010 at 09:58:06PM +0100, James Darnley wrote:
> Since I can't duplicate code any more, I put my additions into lavfi, enjoy.
> vf_yadif.c | 29 +++++++++++++++++++++++++----
> 1 file changed, 25 insertions(+), 4 deletions(-)
> 2307b6cbc1168768988398ef2c5bea08516f19e4 0001-Support-more-than-yuv420p-in-yadif.patch
> From 22cd772d7faa05907361d142579aa65b062f7ee3 Mon Sep 17 00:00:00 2001
> From: James Darnley <james.darnley at gmail.com>
> Date: Wed, 24 Nov 2010 21:13:52 +0100
> Subject: [PATCH 1/6] Support more than yuv420p in yadif
>
> (and correctly support grey8)
> ---
> libavfilter/vf_yadif.c | 29 +++++++++++++++++++++++++----
> 1 files changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
> index 5c4a245..a3f5800 100644
> --- a/libavfilter/vf_yadif.c
> +++ b/libavfilter/vf_yadif.c
> @@ -20,6 +20,7 @@
>
> #include "libavutil/cpu.h"
> #include "libavutil/common.h"
> +#include "libavutil/pixdesc.h"
> #include "avfilter.h"
> #include "yadif.h"
>
> @@ -51,6 +52,8 @@ typedef struct {
> void (*filter_line)(uint8_t *dst,
> uint8_t *prev, uint8_t *cur, uint8_t *next,
> int w, int refs, int parity, int mode);
> +
> + const AVPixFmtDescriptor *csp;
> } YADIFContext;
>
> static void filter_line_c(uint8_t *dst,
> @@ -121,12 +124,17 @@ static void filter(AVFilterContext *ctx, AVFilterBufferRef *dstpic,
> YADIFContext *yadif = ctx->priv;
> int y, i;
>
> - for (i = 0; i < 3; i++) {
> - int is_chroma = !!i;
> - int w = dstpic->video->w >> is_chroma;
> - int h = dstpic->video->h >> is_chroma;
> + for (i = 0; i < yadif->csp->nb_components; i++) {
> + int w = dstpic->video->w;
> + int h = dstpic->video->h;
> int refs = yadif->cur->linesize[i];
>
> + if (i) {
> + /* Why is this not part of the per-plane description thing? */
> + w >>= yadif->csp->log2_chroma_w;
> + h >>= yadif->csp->log2_chroma_h;
> + }
> +
> for (y = 0; y < h; y++) {
> if ((y ^ parity) & 1) {
> uint8_t *prev = &yadif->prev->data[i][y*refs];
> @@ -173,6 +181,9 @@ static void return_frame(AVFilterContext *ctx, int is_second)
> yadif->out = avfilter_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE |
> AV_PERM_REUSE, link->w, link->h);
>
> + if (!yadif->csp)
> + yadif->csp = &av_pix_fmt_descriptors[link->format];
> +
> filter(ctx, yadif->out, tff ^ !is_second, tff);
>
> if (is_second) {
the if() is not worth it, same for =NULL
[...]
> vf_yadif.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
> 2caabfd2b8d88e3dafb0c69d1d9c1d248b0d129e 0004-Remove-unnecessary-shadowed-variable-in-yadif.patch
> From a51b8f9397c8dd3fdaa3f85449afa87bb3ef0ff8 Mon Sep 17 00:00:00 2001
> From: James Darnley <james.darnley at gmail.com>
> Date: Thu, 25 Nov 2010 21:43:39 +0100
> Subject: [PATCH 4/6] Remove unnecessary shadowed variable in yadif
This could have performance effects and should be benchmarked
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101201/2a117a14/attachment.pgp>
More information about the ffmpeg-devel
mailing list