diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-02 21:19:41 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-02 21:19:41 +0200 |
commit | b286383bd2b13fdf59aecdb23d8514323460483b (patch) | |
tree | 4f8ee9745d719e2918843d0d8ebcf053ac220ef4 /libavfilter | |
parent | 7c84e7d33762a4bccc0002476a3b20e0b8f26fcc (diff) | |
parent | 5e745cefc0f89cf698c4cf0104182472fe0f603e (diff) | |
download | ffmpeg-streaming-b286383bd2b13fdf59aecdb23d8514323460483b.zip ffmpeg-streaming-b286383bd2b13fdf59aecdb23d8514323460483b.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
asfdec: read attached pictures.
apetag: reindent
apetag: export attached covers as video streams.
apetag: fix the amount of data read from binary tags.
apetag: make sure avio_get_str() doesn't read more than it should.
mov: read itunes cover art.
snow: remove VLA in mc_block()
intfloat: Don't use designated initializers in the public headers
snow: remove a VLA.
doc: Remind devs to check return values, especially for malloc() et al
MS ATC Screen (aka MSS3) decoder
vf_yadif: move x86 init code to x86/yadif.c
vf_gradfun: move x86 init code to x86/gradfun.c
roqvideo: Remove a totally unused dspcontext
smacker: remove some unused code
dsicin: remove dead assignment
aacdec: remove dead assignment
rl2: remove dead assignment
proresenc: make a variable local to the loop where it is used
alsdec: remove dead assignments
Conflicts:
Changelog
doc/developer.texi
libavcodec/allcodecs.c
libavcodec/avcodec.h
libavcodec/version.h
libavfilter/gradfun.h
libavfilter/x86/gradfun.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/gradfun.h | 7 | ||||
-rw-r--r-- | libavfilter/vf_gradfun.c | 9 | ||||
-rw-r--r-- | libavfilter/vf_yadif.c | 46 | ||||
-rw-r--r-- | libavfilter/x86/gradfun.c | 29 | ||||
-rw-r--r-- | libavfilter/x86/yadif.c | 13 | ||||
-rw-r--r-- | libavfilter/x86/yadif_template.c | 6 | ||||
-rw-r--r-- | libavfilter/yadif.h | 45 |
7 files changed, 80 insertions, 75 deletions
diff --git a/libavfilter/gradfun.h b/libavfilter/gradfun.h index 3c01085..3ceb133 100644 --- a/libavfilter/gradfun.h +++ b/libavfilter/gradfun.h @@ -37,12 +37,9 @@ typedef struct { void (*blur_line) (uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width); } GradFunContext; +void ff_gradfun_init_x86(GradFunContext *gf); + void ff_gradfun_filter_line_c(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers); void ff_gradfun_blur_line_c(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width); -void ff_gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers); -void ff_gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers); - -void ff_gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width); - #endif /* AVFILTER_GRADFUN_H */ diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c index 2ce9c6a..4b3a59f 100644 --- a/libavfilter/vf_gradfun.c +++ b/libavfilter/vf_gradfun.c @@ -123,7 +123,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args) GradFunContext *gf = ctx->priv; float thresh = 1.2; int radius = 16; - int cpu_flags = av_get_cpu_flags(); if (args) sscanf(args, "%f:%d", &thresh, &radius); @@ -135,12 +134,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) gf->blur_line = ff_gradfun_blur_line_c; gf->filter_line = ff_gradfun_filter_line_c; - if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX2) - gf->filter_line = ff_gradfun_filter_line_mmx2; - if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) - gf->filter_line = ff_gradfun_filter_line_ssse3; - if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) - gf->blur_line = ff_gradfun_blur_line_sse2; + if (HAVE_MMX) + ff_gradfun_init_x86(gf); av_log(ctx, AV_LOG_VERBOSE, "threshold:%.2f radius:%d\n", thresh, gf->radius); diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 41bf153..46ae1dd 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -30,42 +30,6 @@ #undef NDEBUG #include <assert.h> -typedef struct { - /** - * 0: send 1 frame for each frame - * 1: send 1 frame for each field - * 2: like 0 but skips spatial interlacing check - * 3: like 1 but skips spatial interlacing check - */ - int mode; - - /** - * 0: top field first - * 1: bottom field first - * -1: auto-detection - */ - int parity; - - int frame_pending; - - /** - * 0: deinterlace all frames - * 1: only deinterlace frames marked as interlaced - */ - int auto_enable; - - AVFilterBufferRef *cur; - AVFilterBufferRef *next; - AVFilterBufferRef *prev; - AVFilterBufferRef *out; - void (*filter_line)(uint8_t *dst, - uint8_t *prev, uint8_t *cur, uint8_t *next, - int w, int prefs, int mrefs, int parity, int mode); - - const AVPixFmtDescriptor *csp; - int eof; -} YADIFContext; - #define CHECK(j)\ { int score = FFABS(cur[mrefs-1+(j)] - cur[prefs-1-(j)])\ + FFABS(cur[mrefs +(j)] - cur[prefs -(j)])\ @@ -400,7 +364,6 @@ static int query_formats(AVFilterContext *ctx) static av_cold int init(AVFilterContext *ctx, const char *args) { YADIFContext *yadif = ctx->priv; - int cpu_flags = av_get_cpu_flags(); yadif->mode = 0; yadif->parity = -1; @@ -410,12 +373,9 @@ static av_cold int init(AVFilterContext *ctx, const char *args) if (args) sscanf(args, "%d:%d:%d", &yadif->mode, &yadif->parity, &yadif->auto_enable); yadif->filter_line = filter_line_c; - if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) - yadif->filter_line = ff_yadif_filter_line_ssse3; - else if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) - yadif->filter_line = ff_yadif_filter_line_sse2; - else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) - yadif->filter_line = ff_yadif_filter_line_mmx; + + if (HAVE_MMX) + ff_yadif_init_x86(yadif); av_log(ctx, AV_LOG_VERBOSE, "mode:%d parity:%d auto_enable:%d\n", yadif->mode, yadif->parity, yadif->auto_enable); diff --git a/libavfilter/x86/gradfun.c b/libavfilter/x86/gradfun.c index e892117..4a0c012 100644 --- a/libavfilter/x86/gradfun.c +++ b/libavfilter/x86/gradfun.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavfilter/gradfun.h" @@ -25,9 +26,9 @@ DECLARE_ALIGNED(16, static const uint16_t, pw_7f)[8] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F}; DECLARE_ALIGNED(16, static const uint16_t, pw_ff)[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; -void ff_gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers) +#if HAVE_MMX2 +static void gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers) { -#if HAVE_MMX intptr_t x; if (width & 3) { x = width & ~3; @@ -70,12 +71,12 @@ void ff_gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uint16_ "rm"(thresh), "m"(*dithers), "m"(*pw_7f) :"memory" ); -#endif } +#endif -void ff_gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers) -{ #if HAVE_SSSE3 +static void gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers) +{ intptr_t x; if (width & 7) { // could be 10% faster if I somehow eliminated this @@ -117,12 +118,12 @@ void ff_gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const uint16 "rm"(thresh), "m"(*dithers), "m"(*pw_7f) :"memory" ); -#endif // HAVE_SSSE3 } +#endif // HAVE_SSSE3 -void ff_gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width) -{ #if HAVE_SSE +static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width) +{ #define BLURV(load)\ intptr_t x = -2*width;\ __asm__ volatile(\ @@ -160,5 +161,17 @@ void ff_gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *buf1 } else { BLURV("movdqa"); } +} #endif // HAVE_SSE + +av_cold void ff_gradfun_init_x86(GradFunContext *gf) +{ + int cpu_flags = av_get_cpu_flags(); + + if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) + gf->filter_line = gradfun_filter_line_mmx2; + if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) + gf->filter_line = gradfun_filter_line_ssse3; + if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) + gf->blur_line = gradfun_blur_line_sse2; } diff --git a/libavfilter/x86/yadif.c b/libavfilter/x86/yadif.c index 2b55c00..d982388 100644 --- a/libavfilter/x86/yadif.c +++ b/libavfilter/x86/yadif.c @@ -18,6 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/x86/dsputil_mmx.h" @@ -47,3 +48,15 @@ DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x000100010 #define RENAME(a) a ## _mmx #include "yadif_template.c" #endif + +av_cold void ff_yadif_init_x86(YADIFContext *yadif) +{ + int cpu_flags = av_get_cpu_flags(); + + if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) + yadif->filter_line = yadif_filter_line_mmx; + if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) + yadif->filter_line = yadif_filter_line_sse2; + if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) + yadif->filter_line = yadif_filter_line_ssse3; +} diff --git a/libavfilter/x86/yadif_template.c b/libavfilter/x86/yadif_template.c index 71cf9d1..06c8797 100644 --- a/libavfilter/x86/yadif_template.c +++ b/libavfilter/x86/yadif_template.c @@ -103,9 +103,9 @@ "por "MM"5, "MM"3 \n\t"\ MOVQ" "MM"3, "MM"1 \n\t" -void RENAME(ff_yadif_filter_line)(uint8_t *dst, - uint8_t *prev, uint8_t *cur, uint8_t *next, - int w, int prefs, int mrefs, int parity, int mode) +static void RENAME(yadif_filter_line)(uint8_t *dst, uint8_t *prev, uint8_t *cur, + uint8_t *next, int w, int prefs, + int mrefs, int parity, int mode) { uint8_t tmp[5*16]; uint8_t *tmpA= (uint8_t*)(((uint64_t)(tmp+15)) & ~15); diff --git a/libavfilter/yadif.h b/libavfilter/yadif.h index ff574da..4d3d818 100644 --- a/libavfilter/yadif.h +++ b/libavfilter/yadif.h @@ -19,18 +19,45 @@ #ifndef AVFILTER_YADIF_H #define AVFILTER_YADIF_H +#include "libavutil/pixdesc.h" #include "avfilter.h" -void ff_yadif_filter_line_mmx(uint8_t *dst, - uint8_t *prev, uint8_t *cur, uint8_t *next, - int w, int prefs, int mrefs, int parity, int mode); +typedef struct { + /** + * 0: send 1 frame for each frame + * 1: send 1 frame for each field + * 2: like 0 but skips spatial interlacing check + * 3: like 1 but skips spatial interlacing check + */ + 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); + /** + * 0: top field first + * 1: bottom field first + * -1: auto-detection + */ + int parity; -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); + int frame_pending; + + /** + * 0: deinterlace all frames + * 1: only deinterlace frames marked as interlaced + */ + int auto_enable; + + AVFilterBufferRef *cur; + AVFilterBufferRef *next; + AVFilterBufferRef *prev; + AVFilterBufferRef *out; + void (*filter_line)(uint8_t *dst, + uint8_t *prev, uint8_t *cur, uint8_t *next, + int w, int prefs, int mrefs, int parity, int mode); + + const AVPixFmtDescriptor *csp; + int eof; +} YADIFContext; + +void ff_yadif_init_x86(YADIFContext *yadif); #endif /* AVFILTER_YADIF_H */ |