diff options
author | Thomas Mundt <tmundt75@gmail.com> | 2017-04-20 23:26:59 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-04-22 20:12:15 +0200 |
commit | 207e6debf866ae4f8bdf864a5f389ef42660324d (patch) | |
tree | 87e4bb430785c39207f690ac9a1284e604f808d6 /libavfilter | |
parent | 362f6c91e466b2114d0827c6d58e26e121ed11e8 (diff) | |
download | ffmpeg-207e6debf866ae4f8bdf864a5f389ef42660324d.tar.gz |
avfilter/interlace: change lowpass_line function prototype
Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/interlace.h | 2 | ||||
-rw-r--r-- | libavfilter/tinterlace.h | 2 | ||||
-rw-r--r-- | libavfilter/vf_interlace.c | 17 | ||||
-rw-r--r-- | libavfilter/vf_tinterlace.c | 14 | ||||
-rw-r--r-- | libavfilter/x86/vf_interlace.asm | 30 | ||||
-rw-r--r-- | libavfilter/x86/vf_interlace_init.c | 6 | ||||
-rw-r--r-- | libavfilter/x86/vf_tinterlace_init.c | 6 |
7 files changed, 38 insertions, 39 deletions
diff --git a/libavfilter/interlace.h b/libavfilter/interlace.h index da073aeba3..107c94fdb1 100644 --- a/libavfilter/interlace.h +++ b/libavfilter/interlace.h @@ -50,7 +50,7 @@ typedef struct InterlaceContext { int lowpass; // enable or disable low pass filtering AVFrame *cur, *next; // the two frames from which the new one is obtained void (*lowpass_line)(uint8_t *dstp, ptrdiff_t linesize, const uint8_t *srcp, - const uint8_t *srcp_above, const uint8_t *srcp_below); + ptrdiff_t mref, ptrdiff_t pref); } InterlaceContext; void ff_interlace_init_x86(InterlaceContext *interlace); diff --git a/libavfilter/tinterlace.h b/libavfilter/tinterlace.h index 3b703e7b21..f52af13c9a 100644 --- a/libavfilter/tinterlace.h +++ b/libavfilter/tinterlace.h @@ -54,7 +54,7 @@ typedef struct { uint8_t *black_data[4]; ///< buffer used to fill padded lines int black_linesize[4]; void (*lowpass_line)(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, - const uint8_t *srcp_above, const uint8_t *srcp_below); + ptrdiff_t mref, ptrdiff_t pref); } TInterlaceContext; void ff_tinterlace_init_x86(TInterlaceContext *interlace); diff --git a/libavfilter/vf_interlace.c b/libavfilter/vf_interlace.c index efa3128727..8da8326709 100644 --- a/libavfilter/vf_interlace.c +++ b/libavfilter/vf_interlace.c @@ -55,9 +55,10 @@ AVFILTER_DEFINE_CLASS(interlace); static void lowpass_line_c(uint8_t *dstp, ptrdiff_t linesize, const uint8_t *srcp, - const uint8_t *srcp_above, - const uint8_t *srcp_below) + ptrdiff_t mref, ptrdiff_t pref) { + const uint8_t *srcp_above = srcp + mref; + const uint8_t *srcp_below = srcp + pref; int i; for (i = 0; i < linesize; i++) { // this calculation is an integer representation of @@ -154,13 +155,13 @@ static void copy_picture_field(InterlaceContext *s, int srcp_linesize = src_frame->linesize[plane] * 2; int dstp_linesize = dst_frame->linesize[plane] * 2; for (j = lines; j > 0; j--) { - const uint8_t *srcp_above = srcp - src_frame->linesize[plane]; - const uint8_t *srcp_below = srcp + src_frame->linesize[plane]; + ptrdiff_t pref = src_frame->linesize[plane]; + ptrdiff_t mref = -pref; if (j == lines) - srcp_above = srcp; // there is no line above - if (j == 1) - srcp_below = srcp; // there is no line below - s->lowpass_line(dstp, cols, srcp, srcp_above, srcp_below); + mref = 0; // there is no line above + else if (j == 1) + pref = 0; // there is no line below + s->lowpass_line(dstp, cols, srcp, mref, pref); dstp += dstp_linesize; srcp += srcp_linesize; } diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c index 80146a9480..09ca4d30ee 100644 --- a/libavfilter/vf_tinterlace.c +++ b/libavfilter/vf_tinterlace.c @@ -89,8 +89,10 @@ static int query_formats(AVFilterContext *ctx) } static void lowpass_line_c(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, - const uint8_t *srcp_above, const uint8_t *srcp_below) + ptrdiff_t mref, ptrdiff_t pref) { + const uint8_t *srcp_above = srcp + mref; + const uint8_t *srcp_below = srcp + pref; int i; for (i = 0; i < width; i++) { // this calculation is an integer representation of @@ -228,12 +230,12 @@ void copy_picture_field(TInterlaceContext *tinterlace, int srcp_linesize = src_linesize[plane] * k; int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1); for (h = lines; h > 0; h--) { - const uint8_t *srcp_above = srcp - src_linesize[plane]; - const uint8_t *srcp_below = srcp + src_linesize[plane]; - if (h == lines) srcp_above = srcp; // there is no line above - if (h == 1) srcp_below = srcp; // there is no line below + ptrdiff_t pref = src_linesize[plane]; + ptrdiff_t mref = -pref; + if (h == lines) mref = 0; // there is no line above + else if (h == 1) pref = 0; // there is no line below - tinterlace->lowpass_line(dstp, cols, srcp, srcp_above, srcp_below); + tinterlace->lowpass_line(dstp, cols, srcp, mref, pref); dstp += dstp_linesize; srcp += srcp_linesize; } diff --git a/libavfilter/x86/vf_interlace.asm b/libavfilter/x86/vf_interlace.asm index f70c700965..8a0dd3bdea 100644 --- a/libavfilter/x86/vf_interlace.asm +++ b/libavfilter/x86/vf_interlace.asm @@ -28,32 +28,32 @@ SECTION_RODATA SECTION .text %macro LOWPASS_LINE 0 -cglobal lowpass_line, 5, 5, 7 - add r0, r1 - add r2, r1 - add r3, r1 - add r4, r1 - neg r1 +cglobal lowpass_line, 5, 5, 7, dst, h, src, mref, pref + add dstq, hq + add srcq, hq + add mrefq, srcq + add prefq, srcq + neg hq pcmpeqb m6, m6 .loop: - mova m0, [r3+r1] - mova m1, [r3+r1+mmsize] - pavgb m0, [r4+r1] - pavgb m1, [r4+r1+mmsize] + mova m0, [mrefq+hq] + mova m1, [mrefq+hq+mmsize] + pavgb m0, [prefq+hq] + pavgb m1, [prefq+hq+mmsize] pxor m0, m6 pxor m1, m6 - pxor m2, m6, [r2+r1] - pxor m3, m6, [r2+r1+mmsize] + pxor m2, m6, [srcq+hq] + pxor m3, m6, [srcq+hq+mmsize] pavgb m0, m2 pavgb m1, m3 pxor m0, m6 pxor m1, m6 - mova [r0+r1], m0 - mova [r0+r1+mmsize], m1 + mova [dstq+hq], m0 + mova [dstq+hq+mmsize], m1 - add r1, 2*mmsize + add hq, 2*mmsize jl .loop REP_RET %endmacro diff --git a/libavfilter/x86/vf_interlace_init.c b/libavfilter/x86/vf_interlace_init.c index 52a22f80c7..7d8acd6143 100644 --- a/libavfilter/x86/vf_interlace_init.c +++ b/libavfilter/x86/vf_interlace_init.c @@ -28,12 +28,10 @@ void ff_lowpass_line_sse2(uint8_t *dstp, ptrdiff_t linesize, const uint8_t *srcp, - const uint8_t *srcp_above, - const uint8_t *srcp_below); + ptrdiff_t mref, ptrdiff_t pref); void ff_lowpass_line_avx (uint8_t *dstp, ptrdiff_t linesize, const uint8_t *srcp, - const uint8_t *srcp_above, - const uint8_t *srcp_below); + ptrdiff_t mref, ptrdiff_t pref); av_cold void ff_interlace_init_x86(InterlaceContext *s) { diff --git a/libavfilter/x86/vf_tinterlace_init.c b/libavfilter/x86/vf_tinterlace_init.c index ddb0cced36..175b5cff01 100644 --- a/libavfilter/x86/vf_tinterlace_init.c +++ b/libavfilter/x86/vf_tinterlace_init.c @@ -29,12 +29,10 @@ void ff_lowpass_line_sse2(uint8_t *dstp, ptrdiff_t linesize, const uint8_t *srcp, - const uint8_t *srcp_above, - const uint8_t *srcp_below); + ptrdiff_t mref, ptrdiff_t pref); void ff_lowpass_line_avx (uint8_t *dstp, ptrdiff_t linesize, const uint8_t *srcp, - const uint8_t *srcp_above, - const uint8_t *srcp_below); + ptrdiff_t mref, ptrdiff_t pref); av_cold void ff_tinterlace_init_x86(TInterlaceContext *s) { |