Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Anton Khirnov authored on 2012/11/29 05:47:39... | ... |
@@ -214,36 +214,34 @@ static av_cold void uninit(AVFilterContext *ctx) |
214 | 214 |
free_filter_param(&unsharp->chroma); |
215 | 215 |
} |
216 | 216 |
|
217 |
-static int end_frame(AVFilterLink *link) |
|
217 |
+static int filter_frame(AVFilterLink *link, AVFilterBufferRef *in) |
|
218 | 218 |
{ |
219 | 219 |
UnsharpContext *unsharp = link->dst->priv; |
220 |
- AVFilterBufferRef *in = link->cur_buf; |
|
221 |
- AVFilterBufferRef *out = link->dst->outputs[0]->out_buf; |
|
220 |
+ AVFilterLink *outlink = link->dst->outputs[0]; |
|
221 |
+ AVFilterBufferRef *out; |
|
222 | 222 |
int cw = SHIFTUP(link->w, unsharp->hsub); |
223 | 223 |
int ch = SHIFTUP(link->h, unsharp->vsub); |
224 |
- int ret; |
|
224 |
+ |
|
225 |
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); |
|
226 |
+ if (!out) { |
|
227 |
+ avfilter_unref_bufferp(&in); |
|
228 |
+ return AVERROR(ENOMEM); |
|
229 |
+ } |
|
230 |
+ avfilter_copy_buffer_ref_props(out, in); |
|
225 | 231 |
|
226 | 232 |
apply_unsharp(out->data[0], out->linesize[0], in->data[0], in->linesize[0], link->w, link->h, &unsharp->luma); |
227 | 233 |
apply_unsharp(out->data[1], out->linesize[1], in->data[1], in->linesize[1], cw, ch, &unsharp->chroma); |
228 | 234 |
apply_unsharp(out->data[2], out->linesize[2], in->data[2], in->linesize[2], cw, ch, &unsharp->chroma); |
229 | 235 |
|
230 |
- if ((ret = ff_draw_slice(link->dst->outputs[0], 0, link->h, 1)) < 0 || |
|
231 |
- (ret = ff_end_frame(link->dst->outputs[0])) < 0) |
|
232 |
- return ret; |
|
233 |
- return 0; |
|
234 |
-} |
|
235 |
- |
|
236 |
-static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir) |
|
237 |
-{ |
|
238 |
- return 0; |
|
236 |
+ avfilter_unref_bufferp(&in); |
|
237 |
+ return ff_filter_frame(outlink, out); |
|
239 | 238 |
} |
240 | 239 |
|
241 | 240 |
static const AVFilterPad avfilter_vf_unsharp_inputs[] = { |
242 | 241 |
{ |
243 | 242 |
.name = "default", |
244 | 243 |
.type = AVMEDIA_TYPE_VIDEO, |
245 |
- .draw_slice = draw_slice, |
|
246 |
- .end_frame = end_frame, |
|
244 |
+ .filter_frame = filter_frame, |
|
247 | 245 |
.config_props = config_props, |
248 | 246 |
.min_perms = AV_PERM_READ, |
249 | 247 |
}, |