Browse Source

avfilter/interlace: change lowpass_line function prototype

Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.4
Thomas Mundt Michael Niedermayer 8 years ago
parent
commit
207e6debf8
7 changed files with 38 additions and 39 deletions
  1. +1
    -1
      libavfilter/interlace.h
  2. +1
    -1
      libavfilter/tinterlace.h
  3. +9
    -8
      libavfilter/vf_interlace.c
  4. +8
    -6
      libavfilter/vf_tinterlace.c
  5. +15
    -15
      libavfilter/x86/vf_interlace.asm
  6. +2
    -4
      libavfilter/x86/vf_interlace_init.c
  7. +2
    -4
      libavfilter/x86/vf_tinterlace_init.c

+ 1
- 1
libavfilter/interlace.h View File

@@ -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);


+ 1
- 1
libavfilter/tinterlace.h View File

@@ -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);


+ 9
- 8
libavfilter/vf_interlace.c View File

@@ -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;
}


+ 8
- 6
libavfilter/vf_tinterlace.c View File

@@ -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;
}


+ 15
- 15
libavfilter/x86/vf_interlace.asm View File

@@ -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


+ 2
- 4
libavfilter/x86/vf_interlace_init.c View File

@@ -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)
{


+ 2
- 4
libavfilter/x86/vf_tinterlace_init.c View File

@@ -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)
{


Loading…
Cancel
Save