#include "libavutil/cpu.h"
#include "libavutil/common.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "yadif.h"
void (*filter_line)(uint8_t *dst,
uint8_t *prev, uint8_t *cur, uint8_t *next,
int w, int prefs, int mrefs, int parity, int mode);
+
+ const AVPixFmtDescriptor *csp;
} YADIFContext;
static void filter_line_c(uint8_t *dst,
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];
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) {
{
static const enum PixelFormat pix_fmts[] = {
PIX_FMT_YUV420P,
+ PIX_FMT_YUV422P,
+ PIX_FMT_YUV444P,
+ PIX_FMT_YUV410P,
+ PIX_FMT_YUV411P,
PIX_FMT_GRAY8,
+ PIX_FMT_YUVJ420P,
+ PIX_FMT_YUVJ422P,
+ PIX_FMT_YUVJ444P,
+ PIX_FMT_YUV440P,
+ PIX_FMT_YUVJ440P,
PIX_FMT_NONE
};
yadif->mode = 0;
yadif->parity = -1;
+ yadif->csp = NULL;
if (args) sscanf(args, "%d:%d", &yadif->mode, &yadif->parity);