summaryrefslogtreecommitdiff
path: root/libavfilter/vf_tinterlace.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-03-10 01:30:30 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-10 01:40:35 +0100
commita05a44e205d6ae13d5eb1cd8d4ad2dba6ec940b3 (patch)
tree450d7173e72748db59d6cfb7107c688bc825fc9a /libavfilter/vf_tinterlace.c
parent586ae70ba78e023d16c0c812b05a26c7d423833b (diff)
parent7e350379f87e7f74420b4813170fe808e2313911 (diff)
Merge commit '7e350379f87e7f74420b4813170fe808e2313911'
* commit '7e350379f87e7f74420b4813170fe808e2313911': lavfi: switch to AVFrame. Conflicts: doc/filters.texi libavfilter/af_ashowinfo.c libavfilter/audio.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/buffersink.c libavfilter/buffersrc.c libavfilter/buffersrc.h libavfilter/f_select.c libavfilter/f_setpts.c libavfilter/fifo.c libavfilter/split.c libavfilter/src_movie.c libavfilter/version.h libavfilter/vf_aspect.c libavfilter/vf_bbox.c libavfilter/vf_blackframe.c libavfilter/vf_delogo.c libavfilter/vf_drawbox.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_fieldorder.c libavfilter/vf_fps.c libavfilter/vf_frei0r.c libavfilter/vf_gradfun.c libavfilter/vf_hqdn3d.c libavfilter/vf_lut.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/vf_showinfo.c libavfilter/vf_transpose.c libavfilter/vf_vflip.c libavfilter/vf_yadif.c libavfilter/video.c libavfilter/vsrc_testsrc.c libavfilter/yadif.h Following are notes about the merge authorship and various technical details. Michael Niedermayer: * Main merge operation, notably avfilter.c and video.c * Switch to AVFrame: - afade - anullsrc - apad - aresample - blackframe - deshake - idet - il - mandelbrot - mptestsrc - noise - setfield - smartblur - tinterlace * various merge changes and fixes in: - ashowinfo - blackdetect - field - fps - select - testsrc - yadif Nicolas George: * Switch to AVFrame: - make rawdec work with refcounted frames. Adapted from commit 759001c534287a96dc96d1e274665feb7059145d by Anton Khirnov. Also, fix the use of || instead of | in a flags check. - make buffer sink and src, audio and video work all together Clément Bœsch: * Switch to AVFrame: - aevalsrc - alphaextract - blend - cellauto - colormatrix - concat - earwax - ebur128 - edgedetect - geq - histeq - histogram - hue - kerndeint - life - movie - mp (with the help of Michael) - overlay - pad - pan - pp - pp - removelogo - sendcmd - showspectrum - showwaves - silencedetect - stereo3d - subtitles - super2xsai - swapuv - thumbnail - tile Hendrik Leppkes: * Switch to AVFrame: - aconvert - amerge - asetnsamples - atempo - biquads Matthieu Bouron: * Switch to AVFrame - alphamerge - decimate - volumedetect Stefano Sabatini: * Switch to AVFrame: - astreamsync - flite - framestep Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Nicolas George <nicolas.george@normalesup.org> Signed-off-by: Clément Bœsch <ubitux@gmail.com> Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Stefano Sabatini <stefasab@gmail.com> Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_tinterlace.c')
-rw-r--r--libavfilter/vf_tinterlace.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index 909784e5f7..bce63010b4 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -48,8 +48,8 @@ typedef struct {
int flags; ///< flags affecting interlacing algorithm
int frame; ///< number of the output frame
int vsub; ///< chroma vertical subsampling
- AVFilterBufferRef *cur;
- AVFilterBufferRef *next;
+ AVFrame *cur;
+ AVFrame *next;
uint8_t *black_data[4]; ///< buffer used to fill padded lines
int black_linesize[4];
} TInterlaceContext;
@@ -112,8 +112,8 @@ static av_cold void uninit(AVFilterContext *ctx)
{
TInterlaceContext *tinterlace = ctx->priv;
- avfilter_unref_bufferp(&tinterlace->cur );
- avfilter_unref_bufferp(&tinterlace->next);
+ av_frame_free(&tinterlace->cur );
+ av_frame_free(&tinterlace->next);
av_opt_free(tinterlace);
av_freep(&tinterlace->black_data[0]);
@@ -228,15 +228,15 @@ void copy_picture_field(uint8_t *dst[4], int dst_linesize[4],
}
}
-static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
+static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
TInterlaceContext *tinterlace = ctx->priv;
- AVFilterBufferRef *cur, *next, *out;
+ AVFrame *cur, *next, *out;
int field, tff, ret;
- avfilter_unref_buffer(tinterlace->cur);
+ av_frame_free(&tinterlace->cur);
tinterlace->cur = tinterlace->next;
tinterlace->next = picref;
@@ -249,13 +249,13 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
switch (tinterlace->mode) {
case MODE_MERGE: /* move the odd frame into the upper field of the new image, even into
* the lower field, generating a double-height video at half framerate */
- out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out)
return AVERROR(ENOMEM);
- avfilter_copy_buffer_ref_props(out, cur);
- out->video->h = outlink->h;
- out->video->interlaced = 1;
- out->video->top_field_first = 1;
+ av_frame_copy_props(out, cur);
+ out->height = outlink->h;
+ out->interlaced_frame = 1;
+ out->top_field_first = 1;
/* write odd frame lines into the upper field of the new frame */
copy_picture_field(out->data, out->linesize,
@@ -267,20 +267,20 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
(const uint8_t **)next->data, next->linesize,
inlink->format, inlink->w, inlink->h,
FIELD_UPPER_AND_LOWER, 1, FIELD_LOWER, tinterlace->flags);
- avfilter_unref_bufferp(&tinterlace->next);
+ av_frame_free(&tinterlace->next);
break;
case MODE_DROP_ODD: /* only output even frames, odd frames are dropped; height unchanged, half framerate */
case MODE_DROP_EVEN: /* only output odd frames, even frames are dropped; height unchanged, half framerate */
- out = avfilter_ref_buffer(tinterlace->mode == MODE_DROP_EVEN ? cur : next, AV_PERM_READ);
- avfilter_unref_bufferp(&tinterlace->next);
+ out = av_frame_clone(tinterlace->mode == MODE_DROP_EVEN ? cur : next);
+ av_frame_free(&tinterlace->next);
break;
case MODE_PAD: /* expand each frame to double height, but pad alternate
* lines with black; framerate unchanged */
- out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
- avfilter_copy_buffer_ref_props(out, cur);
- out->video->h = outlink->h;
+ out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
+ av_frame_copy_props(out, cur);
+ out->height = outlink->h;
field = (1 + tinterlace->frame) & 1 ? FIELD_UPPER : FIELD_LOWER;
/* copy upper and lower fields */
@@ -300,12 +300,12 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
case MODE_INTERLEAVE_TOP: /* top field first */
case MODE_INTERLEAVE_BOTTOM: /* bottom field first */
tff = tinterlace->mode == MODE_INTERLEAVE_TOP;
- out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out)
return AVERROR(ENOMEM);
- avfilter_copy_buffer_ref_props(out, cur);
- out->video->interlaced = 1;
- out->video->top_field_first = tff;
+ av_frame_copy_props(out, cur);
+ out->interlaced_frame = 1;
+ out->top_field_first = tff;
/* copy upper/lower field from cur */
copy_picture_field(out->data, out->linesize,
@@ -319,25 +319,25 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
inlink->format, inlink->w, inlink->h,
tff ? FIELD_LOWER : FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
tinterlace->flags);
- avfilter_unref_bufferp(&tinterlace->next);
+ av_frame_free(&tinterlace->next);
break;
case MODE_INTERLACEX2: /* re-interlace preserving image height, double frame rate */
/* output current frame first */
- out = avfilter_ref_buffer(cur, ~AV_PERM_WRITE);
+ out = av_frame_clone(cur);
if (!out)
return AVERROR(ENOMEM);
- out->video->interlaced = 1;
+ out->interlaced_frame = 1;
if ((ret = ff_filter_frame(outlink, out)) < 0)
return ret;
/* output mix of current and next frame */
- tff = next->video->top_field_first;
- out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ tff = next->top_field_first;
+ out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out)
return AVERROR(ENOMEM);
- avfilter_copy_buffer_ref_props(out, next);
- out->video->interlaced = 1;
+ av_frame_copy_props(out, next);
+ out->interlaced_frame = 1;
/* write current frame second field lines into the second field of the new frame */
copy_picture_field(out->data, out->linesize,