Commit 207e6deb authored by Thomas Mundt's avatar Thomas Mundt Committed by Michael Niedermayer

avfilter/interlace: change lowpass_line function prototype

Signed-off-by: 's avatarThomas Mundt <tmundt75@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 362f6c91
...@@ -50,7 +50,7 @@ typedef struct InterlaceContext { ...@@ -50,7 +50,7 @@ typedef struct InterlaceContext {
int lowpass; // enable or disable low pass filtering int lowpass; // enable or disable low pass filtering
AVFrame *cur, *next; // the two frames from which the new one is obtained 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, 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; } InterlaceContext;
void ff_interlace_init_x86(InterlaceContext *interlace); void ff_interlace_init_x86(InterlaceContext *interlace);
......
...@@ -54,7 +54,7 @@ typedef struct { ...@@ -54,7 +54,7 @@ typedef struct {
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];
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,
const uint8_t *srcp_above, const uint8_t *srcp_below); ptrdiff_t mref, ptrdiff_t pref);
} TInterlaceContext; } TInterlaceContext;
void ff_tinterlace_init_x86(TInterlaceContext *interlace); void ff_tinterlace_init_x86(TInterlaceContext *interlace);
......
...@@ -55,9 +55,10 @@ AVFILTER_DEFINE_CLASS(interlace); ...@@ -55,9 +55,10 @@ AVFILTER_DEFINE_CLASS(interlace);
static void lowpass_line_c(uint8_t *dstp, ptrdiff_t linesize, static void lowpass_line_c(uint8_t *dstp, ptrdiff_t linesize,
const uint8_t *srcp, const uint8_t *srcp,
const uint8_t *srcp_above, ptrdiff_t mref, ptrdiff_t pref)
const uint8_t *srcp_below)
{ {
const uint8_t *srcp_above = srcp + mref;
const uint8_t *srcp_below = srcp + pref;
int i; int i;
for (i = 0; i < linesize; i++) { for (i = 0; i < linesize; i++) {
// this calculation is an integer representation of // this calculation is an integer representation of
...@@ -154,13 +155,13 @@ static void copy_picture_field(InterlaceContext *s, ...@@ -154,13 +155,13 @@ static void copy_picture_field(InterlaceContext *s,
int srcp_linesize = src_frame->linesize[plane] * 2; int srcp_linesize = src_frame->linesize[plane] * 2;
int dstp_linesize = dst_frame->linesize[plane] * 2; int dstp_linesize = dst_frame->linesize[plane] * 2;
for (j = lines; j > 0; j--) { for (j = lines; j > 0; j--) {
const uint8_t *srcp_above = srcp - src_frame->linesize[plane]; ptrdiff_t pref = src_frame->linesize[plane];
const uint8_t *srcp_below = srcp + src_frame->linesize[plane]; ptrdiff_t mref = -pref;
if (j == lines) if (j == lines)
srcp_above = srcp; // there is no line above mref = 0; // there is no line above
if (j == 1) else if (j == 1)
srcp_below = srcp; // there is no line below pref = 0; // there is no line below
s->lowpass_line(dstp, cols, srcp, srcp_above, srcp_below); s->lowpass_line(dstp, cols, srcp, mref, pref);
dstp += dstp_linesize; dstp += dstp_linesize;
srcp += srcp_linesize; srcp += srcp_linesize;
} }
......
...@@ -89,8 +89,10 @@ static int query_formats(AVFilterContext *ctx) ...@@ -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, 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; int i;
for (i = 0; i < width; i++) { for (i = 0; i < width; i++) {
// this calculation is an integer representation of // this calculation is an integer representation of
...@@ -228,12 +230,12 @@ void copy_picture_field(TInterlaceContext *tinterlace, ...@@ -228,12 +230,12 @@ void copy_picture_field(TInterlaceContext *tinterlace,
int srcp_linesize = src_linesize[plane] * k; int srcp_linesize = src_linesize[plane] * k;
int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1); int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1);
for (h = lines; h > 0; h--) { for (h = lines; h > 0; h--) {
const uint8_t *srcp_above = srcp - src_linesize[plane]; ptrdiff_t pref = src_linesize[plane];
const uint8_t *srcp_below = srcp + src_linesize[plane]; ptrdiff_t mref = -pref;
if (h == lines) srcp_above = srcp; // there is no line above if (h == lines) mref = 0; // there is no line above
if (h == 1) srcp_below = srcp; // there is no line below 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; dstp += dstp_linesize;
srcp += srcp_linesize; srcp += srcp_linesize;
} }
......
...@@ -28,32 +28,32 @@ SECTION_RODATA ...@@ -28,32 +28,32 @@ SECTION_RODATA
SECTION .text SECTION .text
%macro LOWPASS_LINE 0 %macro LOWPASS_LINE 0
cglobal lowpass_line, 5, 5, 7 cglobal lowpass_line, 5, 5, 7, dst, h, src, mref, pref
add r0, r1 add dstq, hq
add r2, r1 add srcq, hq
add r3, r1 add mrefq, srcq
add r4, r1 add prefq, srcq
neg r1 neg hq
pcmpeqb m6, m6 pcmpeqb m6, m6
.loop: .loop:
mova m0, [r3+r1] mova m0, [mrefq+hq]
mova m1, [r3+r1+mmsize] mova m1, [mrefq+hq+mmsize]
pavgb m0, [r4+r1] pavgb m0, [prefq+hq]
pavgb m1, [r4+r1+mmsize] pavgb m1, [prefq+hq+mmsize]
pxor m0, m6 pxor m0, m6
pxor m1, m6 pxor m1, m6
pxor m2, m6, [r2+r1] pxor m2, m6, [srcq+hq]
pxor m3, m6, [r2+r1+mmsize] pxor m3, m6, [srcq+hq+mmsize]
pavgb m0, m2 pavgb m0, m2
pavgb m1, m3 pavgb m1, m3
pxor m0, m6 pxor m0, m6
pxor m1, m6 pxor m1, m6
mova [r0+r1], m0 mova [dstq+hq], m0
mova [r0+r1+mmsize], m1 mova [dstq+hq+mmsize], m1
add r1, 2*mmsize add hq, 2*mmsize
jl .loop jl .loop
REP_RET REP_RET
%endmacro %endmacro
......
...@@ -28,12 +28,10 @@ ...@@ -28,12 +28,10 @@
void ff_lowpass_line_sse2(uint8_t *dstp, ptrdiff_t linesize, void ff_lowpass_line_sse2(uint8_t *dstp, ptrdiff_t linesize,
const uint8_t *srcp, const uint8_t *srcp,
const uint8_t *srcp_above, ptrdiff_t mref, ptrdiff_t pref);
const uint8_t *srcp_below);
void ff_lowpass_line_avx (uint8_t *dstp, ptrdiff_t linesize, void ff_lowpass_line_avx (uint8_t *dstp, ptrdiff_t linesize,
const uint8_t *srcp, const uint8_t *srcp,
const uint8_t *srcp_above, ptrdiff_t mref, ptrdiff_t pref);
const uint8_t *srcp_below);
av_cold void ff_interlace_init_x86(InterlaceContext *s) av_cold void ff_interlace_init_x86(InterlaceContext *s)
{ {
......
...@@ -29,12 +29,10 @@ ...@@ -29,12 +29,10 @@
void ff_lowpass_line_sse2(uint8_t *dstp, ptrdiff_t linesize, void ff_lowpass_line_sse2(uint8_t *dstp, ptrdiff_t linesize,
const uint8_t *srcp, const uint8_t *srcp,
const uint8_t *srcp_above, ptrdiff_t mref, ptrdiff_t pref);
const uint8_t *srcp_below);
void ff_lowpass_line_avx (uint8_t *dstp, ptrdiff_t linesize, void ff_lowpass_line_avx (uint8_t *dstp, ptrdiff_t linesize,
const uint8_t *srcp, const uint8_t *srcp,
const uint8_t *srcp_above, ptrdiff_t mref, ptrdiff_t pref);
const uint8_t *srcp_below);
av_cold void ff_tinterlace_init_x86(TInterlaceContext *s) av_cold void ff_tinterlace_init_x86(TInterlaceContext *s)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment