mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-05 23:00:02 +00:00
avfilter/tinterlace: use drawutils for pad mode
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Thomas Mundt <tmundt75@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
01911b9b3c
commit
58ca446672
@ -28,6 +28,7 @@
|
|||||||
#define AVFILTER_TINTERLACE_H
|
#define AVFILTER_TINTERLACE_H
|
||||||
|
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
|
#include "drawutils.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
|
|
||||||
#define TINTERLACE_FLAG_VLPF 01
|
#define TINTERLACE_FLAG_VLPF 01
|
||||||
@ -57,6 +58,8 @@ typedef struct TInterlaceContext {
|
|||||||
AVFrame *next;
|
AVFrame *next;
|
||||||
uint8_t *black_data[4]; ///< buffer used to fill padded lines
|
uint8_t *black_data[4]; ///< buffer used to fill padded lines
|
||||||
int black_linesize[4];
|
int black_linesize[4];
|
||||||
|
FFDrawContext draw;
|
||||||
|
FFDrawColor color;
|
||||||
void (*lowpass_line)(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp,
|
void (*lowpass_line)(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp,
|
||||||
ptrdiff_t mref, ptrdiff_t pref);
|
ptrdiff_t mref, ptrdiff_t pref);
|
||||||
} TInterlaceContext;
|
} TInterlaceContext;
|
||||||
|
@ -156,21 +156,19 @@ static int config_out_props(AVFilterLink *outlink)
|
|||||||
av_make_q(2, 1));
|
av_make_q(2, 1));
|
||||||
|
|
||||||
if (tinterlace->mode == MODE_PAD) {
|
if (tinterlace->mode == MODE_PAD) {
|
||||||
uint8_t black[4] = { 16, 128, 128, 16 };
|
uint8_t black[4] = { 0, 0, 0, 16 };
|
||||||
int i, ret;
|
int ret;
|
||||||
|
ff_draw_init(&tinterlace->draw, outlink->format, 0);
|
||||||
|
ff_draw_color(&tinterlace->draw, &tinterlace->color, black);
|
||||||
if (ff_fmt_is_in(outlink->format, full_scale_yuvj_pix_fmts))
|
if (ff_fmt_is_in(outlink->format, full_scale_yuvj_pix_fmts))
|
||||||
black[0] = black[3] = 0;
|
tinterlace->color.comp[0].u8[0] = 0;
|
||||||
ret = av_image_alloc(tinterlace->black_data, tinterlace->black_linesize,
|
ret = av_image_alloc(tinterlace->black_data, tinterlace->black_linesize,
|
||||||
outlink->w, outlink->h, outlink->format, 16);
|
outlink->w, outlink->h, outlink->format, 16);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* fill black picture with black */
|
ff_fill_rectangle(&tinterlace->draw, &tinterlace->color, tinterlace->black_data,
|
||||||
for (i = 0; i < 4 && tinterlace->black_data[i]; i++) {
|
tinterlace->black_linesize, 0, 0, outlink->w, outlink->h);
|
||||||
int h = i == 1 || i == 2 ? AV_CEIL_RSHIFT(outlink->h, desc->log2_chroma_h) : outlink->h;
|
|
||||||
memset(tinterlace->black_data[i], black[i],
|
|
||||||
tinterlace->black_linesize[i] * h);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (tinterlace->flags & (TINTERLACE_FLAG_VLPF | TINTERLACE_FLAG_CVLPF)
|
if (tinterlace->flags & (TINTERLACE_FLAG_VLPF | TINTERLACE_FLAG_CVLPF)
|
||||||
&& !(tinterlace->mode == MODE_INTERLEAVE_TOP
|
&& !(tinterlace->mode == MODE_INTERLEAVE_TOP
|
||||||
|
Loading…
Reference in New Issue
Block a user