Revision 88312a4d libavfilter/vf_yadif.c

View differences:

libavfilter/vf_yadif.c
20 20

  
21 21
#include "libavutil/cpu.h"
22 22
#include "libavutil/common.h"
23
#include "libavutil/pixdesc.h"
23 24
#include "avfilter.h"
24 25
#include "yadif.h"
25 26

  
......
51 52
    void (*filter_line)(uint8_t *dst,
52 53
                        uint8_t *prev, uint8_t *cur, uint8_t *next,
53 54
                        int w, int prefs, int mrefs, int parity, int mode);
55

  
56
    const AVPixFmtDescriptor *csp;
54 57
} YADIFContext;
55 58

  
56 59
static void filter_line_c(uint8_t *dst,
......
121 124
    YADIFContext *yadif = ctx->priv;
122 125
    int y, i;
123 126

  
124
    for (i = 0; i < 3; i++) {
125
        int is_chroma = !!i;
126
        int w = dstpic->video->w >> is_chroma;
127
        int h = dstpic->video->h >> is_chroma;
127
    for (i = 0; i < yadif->csp->nb_components; i++) {
128
        int w = dstpic->video->w;
129
        int h = dstpic->video->h;
128 130
        int refs = yadif->cur->linesize[i];
129 131

  
132
        if (i) {
133
        /* Why is this not part of the per-plane description thing? */
134
            w >>= yadif->csp->log2_chroma_w;
135
            h >>= yadif->csp->log2_chroma_h;
136
        }
137

  
130 138
        for (y = 0; y < h; y++) {
131 139
            if ((y ^ parity) & 1) {
132 140
                uint8_t *prev = &yadif->prev->data[i][y*refs];
......
181 189
        yadif->out = avfilter_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE |
182 190
                                               AV_PERM_REUSE, link->w, link->h);
183 191

  
192
    if (!yadif->csp)
193
        yadif->csp = &av_pix_fmt_descriptors[link->format];
194

  
184 195
    filter(ctx, yadif->out, tff ^ !is_second, tff);
185 196

  
186 197
    if (is_second) {
......
292 303
{
293 304
    static const enum PixelFormat pix_fmts[] = {
294 305
        PIX_FMT_YUV420P,
306
        PIX_FMT_YUV422P,
307
        PIX_FMT_YUV444P,
308
        PIX_FMT_YUV410P,
309
        PIX_FMT_YUV411P,
295 310
        PIX_FMT_GRAY8,
311
        PIX_FMT_YUVJ420P,
312
        PIX_FMT_YUVJ422P,
313
        PIX_FMT_YUVJ444P,
314
        PIX_FMT_YUV440P,
315
        PIX_FMT_YUVJ440P,
296 316
        PIX_FMT_NONE
297 317
    };
298 318

  
......
308 328

  
309 329
    yadif->mode = 0;
310 330
    yadif->parity = -1;
331
    yadif->csp = NULL;
311 332

  
312 333
    if (args) sscanf(args, "%d:%d", &yadif->mode, &yadif->parity);
313 334

  

Also available in: Unified diff