Commit 65b85279 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'f7bf72a4'

* commit 'f7bf72a4':
  idcinvideo: correctly set AVFrame defaults
  yadif: Port inline assembly to yasm
  au: remove unnecessary casts
  au: return AVERROR codes instead of -1

Conflicts:
	libavcodec/idcinvideo.c
	libavfilter/x86/yadif_template.c
	libavformat/au.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 8c7de73e f7bf72a4
......@@ -169,7 +169,6 @@ static av_cold int idcin_decode_init(AVCodecContext *avctx)
}
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL;
return 0;
}
......
OBJS-$(CONFIG_GRADFUN_FILTER) += x86/gradfun.o
OBJS-$(CONFIG_VOLUME_FILTER) += x86/af_volume_init.o
OBJS-$(CONFIG_YADIF_FILTER) += x86/yadif.o
OBJS-$(CONFIG_YADIF_FILTER) += x86/yadif_init.o
YASM-OBJS-$(CONFIG_HQDN3D_FILTER) += x86/hqdn3d.o
YASM-OBJS-$(CONFIG_VOLUME_FILTER) += x86/af_volume.o
YASM-OBJS-$(CONFIG_YADIF_FILTER) += x86/yadif.o
;*****************************************************************************
;* x86-optimized functions for yadif filter
;*
;* Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at>
;* Copyright (c) 2013 Daniel Kang <daniel.d.kang@gmail.com>
;*
;* This file is part of FFmpeg.
;*
;* FFmpeg is free software; you can redistribute it and/or modify
;* it under the terms of the GNU General Public License as published by
;* the Free Software Foundation; either version 2 of the License, or
;* (at your option) any later version.
;*
;* FFmpeg is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;* GNU General Public License for more details.
;*
;* You should have received a copy of the GNU General Public License along
;* with FFmpeg; if not, write to the Free Software Foundation, Inc.,
;* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;******************************************************************************
%include "libavutil/x86/x86util.asm"
SECTION_RODATA
pb_1: times 16 db 1
pw_1: times 8 dw 1
SECTION .text
%macro CHECK 2
movu m2, [curq+mrefsq+%1]
movu m3, [curq+prefsq+%2]
mova m4, m2
mova m5, m2
pxor m4, m3
pavgb m5, m3
pand m4, [pb_1]
psubusb m5, m4
%if mmsize == 16
psrldq m5, 1
%else
psrlq m5, 8
%endif
punpcklbw m5, m7
mova m4, m2
psubusb m2, m3
psubusb m3, m4
pmaxub m2, m3
mova m3, m2
mova m4, m2
%if mmsize == 16
psrldq m3, 1
psrldq m4, 2
%else
psrlq m3, 8
psrlq m4, 16
%endif
punpcklbw m2, m7
punpcklbw m3, m7
punpcklbw m4, m7
paddw m2, m3
paddw m2, m4
%endmacro
%macro CHECK1 0
mova m3, m0
pcmpgtw m3, m2
pminsw m0, m2
mova m6, m3
pand m5, m3
pandn m3, m1
por m3, m5
mova m1, m3
%endmacro
%macro CHECK2 0
paddw m6, [pw_1]
psllw m6, 14
paddsw m2, m6
mova m3, m0
pcmpgtw m3, m2
pminsw m0, m2
pand m5, m3
pandn m3, m1
por m3, m5
mova m1, m3
%endmacro
%macro LOAD 2
movh m%1, %2
punpcklbw m%1, m7
%endmacro
%macro FILTER 3
.loop%1:
pxor m7, m7
LOAD 0, [curq+mrefsq]
LOAD 1, [curq+prefsq]
LOAD 2, [%2]
LOAD 3, [%3]
mova m4, m3
paddw m3, m2
psraw m3, 1
mova [rsp+ 0], m0
mova [rsp+16], m3
mova [rsp+32], m1
psubw m2, m4
ABS1 m2, m4
LOAD 3, [prevq+mrefsq]
LOAD 4, [prevq+prefsq]
psubw m3, m0
psubw m4, m1
ABS1 m3, m5
ABS1 m4, m5
paddw m3, m4
psrlw m2, 1
psrlw m3, 1
pmaxsw m2, m3
LOAD 3, [nextq+mrefsq]
LOAD 4, [nextq+prefsq]
psubw m3, m0
psubw m4, m1
ABS1 m3, m5
ABS1 m4, m5
paddw m3, m4
psrlw m3, 1
pmaxsw m2, m3
mova [rsp+48], m2
paddw m1, m0
paddw m0, m0
psubw m0, m1
psrlw m1, 1
ABS1 m0, m2
movu m2, [curq+mrefsq-1]
movu m3, [curq+prefsq-1]
mova m4, m2
psubusb m2, m3
psubusb m3, m4
pmaxub m2, m3
%if mmsize == 16
mova m3, m2
psrldq m3, 2
%else
pshufw m3, m2, q0021
%endif
punpcklbw m2, m7
punpcklbw m3, m7
paddw m0, m2
paddw m0, m3
psubw m0, [pw_1]
CHECK -2, 0
CHECK1
CHECK -3, 1
CHECK2
CHECK 0, -2
CHECK1
CHECK 1, -3
CHECK2
mova m6, [rsp+48]
cmp DWORD modem, 2
jge .end%1
LOAD 2, [%2+mrefsq*2]
LOAD 4, [%3+mrefsq*2]
LOAD 3, [%2+prefsq*2]
LOAD 5, [%3+prefsq*2]
paddw m2, m4
paddw m3, m5
psrlw m2, 1
psrlw m3, 1
mova m4, [rsp+ 0]
mova m5, [rsp+16]
mova m7, [rsp+32]
psubw m2, m4
psubw m3, m7
mova m0, m5
psubw m5, m4
psubw m0, m7
mova m4, m2
pminsw m2, m3
pmaxsw m3, m4
pmaxsw m2, m5
pminsw m3, m5
pmaxsw m2, m0
pminsw m3, m0
pxor m4, m4
pmaxsw m6, m3
psubw m4, m2
pmaxsw m6, m4
.end%1:
mova m2, [rsp+16]
mova m3, m2
psubw m2, m6
paddw m3, m6
pmaxsw m1, m2
pminsw m1, m3
packuswb m1, m1
movh [dstq], m1
add dstq, mmsize/2
add prevq, mmsize/2
add curq, mmsize/2
add nextq, mmsize/2
sub wd, mmsize/2
jg .loop%1
%endmacro
%macro YADIF 0
cglobal yadif_filter_line, 7, 7, 8, 16*5, dst, prev, cur, next, w, prefs, \
mrefs, parity, mode
test wq, wq
jle .ret
movsxdifnidn prefsq, prefsd
movsxdifnidn mrefsq, mrefsd
cmp DWORD paritym, 0
je .parity0
FILTER 1, prevq, curq
jmp .ret
.parity0:
FILTER 0, curq, nextq
.ret:
RET
%endmacro
INIT_XMM ssse3
YADIF
INIT_XMM sse2
YADIF
%if ARCH_X86_32
INIT_MMX mmxext
YADIF
%endif
......@@ -22,52 +22,32 @@
#include "libavutil/cpu.h"
#include "libavutil/mem.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/x86/dsputil_mmx.h"
#include "libavfilter/yadif.h"
#if HAVE_INLINE_ASM
DECLARE_ASM_CONST(16, const xmm_reg, pb_1) = {0x0101010101010101ULL, 0x0101010101010101ULL};
DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x0001000100010001ULL};
#if HAVE_SSSE3_INLINE
#define COMPILE_TEMPLATE_SSE2 1
#define COMPILE_TEMPLATE_SSSE3 1
#undef RENAME
#define RENAME(a) a ## _ssse3
#include "yadif_template.c"
#undef COMPILE_TEMPLATE_SSSE3
#endif
#if HAVE_SSE2_INLINE
#undef RENAME
#define RENAME(a) a ## _sse2
#include "yadif_template.c"
#undef COMPILE_TEMPLATE_SSE2
#endif
#if HAVE_MMXEXT_INLINE
#undef RENAME
#define RENAME(a) a ## _mmxext
#include "yadif_template.c"
#endif
#endif /* HAVE_INLINE_ASM */
void ff_yadif_filter_line_mmxext(uint8_t *dst, uint8_t *prev, uint8_t *cur,
uint8_t *next, int w, int prefs,
int mrefs, int parity, int mode);
void ff_yadif_filter_line_sse2(uint8_t *dst, uint8_t *prev, uint8_t *cur,
uint8_t *next, int w, int prefs,
int mrefs, int parity, int mode);
void ff_yadif_filter_line_ssse3(uint8_t *dst, uint8_t *prev, uint8_t *cur,
uint8_t *next, int w, int prefs,
int mrefs, int parity, int mode);
av_cold void ff_yadif_init_x86(YADIFContext *yadif)
{
int cpu_flags = av_get_cpu_flags();
#if HAVE_MMXEXT_INLINE
if (cpu_flags & AV_CPU_FLAG_MMXEXT)
yadif->filter_line = yadif_filter_line_mmxext;
#endif
#if HAVE_SSE2_INLINE
if (cpu_flags & AV_CPU_FLAG_SSE2)
yadif->filter_line = yadif_filter_line_sse2;
#endif
#if HAVE_SSSE3_INLINE
if (cpu_flags & AV_CPU_FLAG_SSSE3)
yadif->filter_line = yadif_filter_line_ssse3;
#endif
#if HAVE_YASM
#if ARCH_X86_32
if (EXTERNAL_MMXEXT(cpu_flags))
yadif->filter_line = ff_yadif_filter_line_mmxext;
#endif /* ARCH_X86_32 */
if (EXTERNAL_SSE2(cpu_flags))
yadif->filter_line = ff_yadif_filter_line_sse2;
if (EXTERNAL_SSSE3(cpu_flags))
yadif->filter_line = ff_yadif_filter_line_ssse3;
#endif /* HAVE_YASM */
}
This diff is collapsed.
......@@ -170,14 +170,14 @@ AVInputFormat ff_au_demuxer = {
static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
{
if (!enc->codec_tag)
return -1;
return AVERROR(EINVAL);
ffio_wfourcc(pb, ".snd"); /* magic number */
avio_wb32(pb, AU_HEADER_SIZE); /* header size */
avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */
avio_wb32(pb, (uint32_t)enc->codec_tag); /* codec ID */
avio_wb32(pb, enc->codec_tag); /* codec ID */
avio_wb32(pb, enc->sample_rate);
avio_wb32(pb, (uint32_t)enc->channels);
avio_wb32(pb, enc->channels);
avio_wb64(pb, 0); /* annotation field */
return 0;
......@@ -186,9 +186,10 @@ static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
static int au_write_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
int ret;
if (put_au_header(pb, s->streams[0]->codec) < 0)
return AVERROR(EINVAL);
if ((ret = put_au_header(pb, s->streams[0]->codec)) < 0)
return ret;
avio_flush(pb);
......
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