static VideoFilter *NewIvtcFilter(VideoFrameType inpixfmt, VideoFrameType outpixfmt, int *width, int *height, char *options, int threads) { (void) threads; ThisFilter *filter; options = NULL; if (inpixfmt != FMT_YV12) return NULL; if (outpixfmt != FMT_YV12) return NULL; filter = malloc (sizeof (ThisFilter)); if (filter == NULL) { fprintf (stderr, "Ivtc: failed to allocate memory for filter\n"); return NULL; } memset(filter, 0, sizeof(ThisFilter)); filter->progressive_frame_seen = 0; filter->interlaced_frame_seen = 0; filter->apply_filter = 0; filter->context = pullup_alloc_context(); struct pullup_context *c = filter->context; c->metric_plane = 0; c->strict_breaks = 0; c->junk_left = c->junk_right = 1; c->junk_top = c->junk_bottom = 4; c->verbose = 0; c->format = PULLUP_FMT_Y; c->nplanes = 4; pullup_preinit_context(c); c->bpp[0] = c->bpp[1] = c->bpp[2] = 0; c->background[1] = c->background[2] = 128; int pitches[3] = { *width, *width >> 1, *width >> 1 }; SetupFilter(filter, *width, *height, pitches); #if HAVE_MMX c->cpu |= PULLUP_CPU_MMX; #endif pullup_init_context(c); filter->vf.filter = &IvtcFilter; filter->vf.cleanup = &IvtcFilterCleanup; return (VideoFilter *) filter; }
static int vf_open(vf_instance_t *vf, char *args) { struct vf_priv_s *p; struct pullup_context *c; vf->filter = filter; vf->config = config; vf->query_format = query_format; vf->uninit = uninit; vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); p->ctx = c = pullup_alloc_context(); p->fakecount = 1; c->verbose = verbose>0; c->junk_left = c->junk_right = 1; c->junk_top = c->junk_bottom = 4; c->strict_breaks = 0; c->metric_plane = 0; if (args) { sscanf(args, "%d:%d:%d:%d:%d:%d", &c->junk_left, &c->junk_right, &c->junk_top, &c->junk_bottom, &c->strict_breaks, &c->metric_plane); } return 1; }