[Libav-user] yadif deinterlace how?

Robert Nagy ronag89 at gmail.com
Sat Jun 18 12:12:32 CEST 2011


I have some questions in the code below. Also is there any way to
multithread a filter?

struct deinterlacer::implementation
std::shared_ptr<AVFilterGraph> graph_;

        // Do I need to free the filter context somehow?
AVFilterContext* video_in_filter_;
AVFilterContext* video_out_filter_;

implementation(size_t width, size_t height, PixelFormat pix_fmt)
: graph_(avfilter_graph_alloc(), avfilter_graph_free)
     // What is this "buffer" filter and why do I need to configure it with
    snprintf(args, sizeof(args), "%d:%d:%d:%d:%d", width, height, pix_fmt,
video_dec->time_base.num, video_dec->time_base.den);
avfilter_get_by_name("buffer"), "src", args, NULL, filter_graph);

    // Can yadif be at the end of the filter or do I need to add some form
of "sink"?
            // Where will the check that the yadif filter supports the
pix_fmt provided to "buffer" or not?
avfilter_get_by_name("yadif"), "out", NULL, NULL, filter_graph);
     // I hope this is correct?
         avfilter_graph_add_filter(filter_graph_, video_in_filter_);
avfilter_graph_add_filter(filter_graph_, video_out_filter_);
 // Is this required?
    avfilter_graph_config(filter_graph, NULL);

std::shared_ptr<AVFrame> execute(const std::shared_ptr<AVFrame>& frame)
// Not sure why this is the "out" link?
AVFilterLink* out = video_out_filter->inputs[0];

// Will this make a copy of the frame? Or do I need to store it in  a buffer
in order to guarantee it is not freed while the filter is working on it?
av_vsrc_buffer_add_frame(video_in_filter, frame, 0);

// Do I need to get all the frames poll_frame says exists, or can I just
take one?
if(avfilter_poll_frame(out) > 0)

// Where is my resulting frame?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20110618/9639ec93/attachment.html>

More information about the Libav-user mailing list