mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
avfilter/vf_bilateral: add direct aka writable frame support
This commit is contained in:
parent
cf0881bcfc
commit
444cf3fca8
@ -297,18 +297,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
AVFilterLink *outlink = ctx->outputs[0];
|
AVFilterLink *outlink = ctx->outputs[0];
|
||||||
AVFrame *out;
|
AVFrame *out;
|
||||||
|
|
||||||
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
|
if (av_frame_is_writable(in)) {
|
||||||
if (!out) {
|
out = in;
|
||||||
av_frame_free(&in);
|
} else {
|
||||||
return AVERROR(ENOMEM);
|
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
|
||||||
|
if (!out) {
|
||||||
|
av_frame_free(&in);
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
|
av_frame_copy_props(out, in);
|
||||||
}
|
}
|
||||||
av_frame_copy_props(out, in);
|
|
||||||
|
|
||||||
for (int plane = 0; plane < s->nb_planes; plane++) {
|
for (int plane = 0; plane < s->nb_planes; plane++) {
|
||||||
if (!(s->planes & (1 << plane))) {
|
if (!(s->planes & (1 << plane))) {
|
||||||
av_image_copy_plane(out->data[plane], out->linesize[plane],
|
if (out != in)
|
||||||
in->data[plane], in->linesize[plane],
|
av_image_copy_plane(out->data[plane], out->linesize[plane],
|
||||||
s->planewidth[plane] * ((s->depth + 7) / 8), s->planeheight[plane]);
|
in->data[plane], in->linesize[plane],
|
||||||
|
s->planewidth[plane] * ((s->depth + 7) / 8), s->planeheight[plane]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +327,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
in->linesize[plane] / 2, out->linesize[plane] / 2);
|
in->linesize[plane] / 2, out->linesize[plane] / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
av_frame_free(&in);
|
if (out != in)
|
||||||
|
av_frame_free(&in);
|
||||||
return ff_filter_frame(outlink, out);
|
return ff_filter_frame(outlink, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user