From 35d5cb1ab4dab657ef31b845893cf98d885c8add Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 1 Jun 2011 12:40:01 -0400 Subject: ac3enc: extract all exponents for the frame at once --- libavcodec/ac3enc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index dbe7784eae..53f6251a5e 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -900,15 +900,11 @@ static av_cold void exponent_init(AC3EncodeContext *s) */ static void extract_exponents(AC3EncodeContext *s) { - int blk, ch; + int ch = !s->cpl_on; + int chan_size = AC3_MAX_COEFS * AC3_MAX_BLOCKS * (s->channels - ch + 1); + AC3Block *block = &s->blocks[0]; - for (ch = !s->cpl_on; ch <= s->channels; ch++) { - for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { - AC3Block *block = &s->blocks[blk]; - s->ac3dsp.extract_exponents(block->exp[ch], block->fixed_coef[ch], - AC3_MAX_COEFS); - } - } + s->ac3dsp.extract_exponents(block->exp[ch], block->fixed_coef[ch], chan_size); } -- cgit v1.2.3 From dcb73592f4f938eb2fd121f434236d5065ff26b6 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Sun, 5 Jun 2011 10:31:24 +0200 Subject: configure: Document --enable-vaapi VAAPI is disabled by default so it should have a --enable-vaapi option documented, not a --disable-vaapi. Signed-off-by: Mans Rullgard --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 805e4ba50a..fe5b700db5 100755 --- a/configure +++ b/configure @@ -106,7 +106,7 @@ Configuration options: --disable-lpc disable LPC code --disable-mdct disable MDCT code --disable-rdft disable RDFT code - --disable-vaapi disable VAAPI code + --enable-vaapi enable VAAPI code --disable-vdpau disable VDPAU code --disable-dxva2 disable DXVA2 code --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary) -- cgit v1.2.3 From 5a4a71257c0d0b1f4a5b4f0ebd4d96515feea23a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 4 Jun 2011 18:48:46 +0100 Subject: Fix build of eval-test program eval.c has moved to libavutil, move the TESTPROGS entry too. Signed-off-by: Mans Rullgard --- libavcodec/Makefile | 2 +- libavutil/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 77f285eda0..ce96950301 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -662,7 +662,7 @@ SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h EXAMPLES = api -TESTPROGS = cabac dct eval fft fft-fixed h264 iirfilter rangecoder snow +TESTPROGS = cabac dct fft fft-fixed h264 iirfilter rangecoder snow TESTPROGS-$(HAVE_MMX) += motion TESTOBJS = dctref.o diff --git a/libavutil/Makefile b/libavutil/Makefile index 1386ebb190..01231bd52d 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -75,7 +75,7 @@ OBJS-$(ARCH_ARM) += arm/cpu.o OBJS-$(ARCH_PPC) += ppc/cpu.o OBJS-$(ARCH_X86) += x86/cpu.o -TESTPROGS = adler32 aes base64 cpu crc des lls md5 pca sha tree +TESTPROGS = adler32 aes base64 cpu crc des eval lls md5 pca sha tree TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo DIRS = arm bfin sh4 x86 -- cgit v1.2.3 From a43458d7eb32c2cc560c58c78949f152a8e95e3d Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 9 May 2011 22:11:57 +0200 Subject: tiff: fix linesize for mono-white/black formats. Fix decoding of file Test_1bpp.tif Signed-off-by: Anton Khirnov --- libavcodec/tiff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index bea353275f..eaaeb84425 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -105,7 +105,7 @@ static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src, static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uint8_t *src, int size, int lines){ int c, line, pixels, code; const uint8_t *ssrc = src; - int width = s->width * s->bpp >> 3; + int width = ((s->width * s->bpp) + 7) >> 3; #if CONFIG_ZLIB uint8_t *zbuf; unsigned long outlen; -- cgit v1.2.3 From 1863a3c7aa897b2077e408ab0bdc57cb3a13d5f3 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 9 May 2011 21:26:39 +0200 Subject: tiff: print log in case of unknown / unsupported tag. Helps debugging. Signed-off-by: Anton Khirnov --- libavcodec/tiff.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index eaaeb84425..08cd3b0a6f 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -478,6 +478,8 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t * if(s->compr == TIFF_G4) s->fax_opts = value; break; + default: + av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n", tag, tag); } return 0; } -- cgit v1.2.3 From 92b4abc2ad88ac7e89a60480094b8398fe1b8dbf Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 5 Jun 2011 01:06:13 +0100 Subject: tableprint: Restore mistakenly deleted common.h #include for FF_ARRAY_ELEMS. This fixes the build with hardcoded tables enabled. Signed-off-by: Mans Rullgard --- libavcodec/tableprint.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/tableprint.h b/libavcodec/tableprint.h index de355fc0aa..ddf2635da0 100644 --- a/libavcodec/tableprint.h +++ b/libavcodec/tableprint.h @@ -26,6 +26,8 @@ #include #include +#include "libavutil/common.h" + #define WRITE_1D_FUNC_ARGV(type, linebrk, fmtstr, ...)\ void write_##type##_array(const type *data, int len)\ {\ -- cgit v1.2.3 From b39b06233dfd69b941a32f29171dfb63abb23c06 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 5 Jun 2011 13:17:26 +0200 Subject: AVOptions: add av_opt_free convenience function. --- doc/APIchanges | 3 +++ libavutil/avutil.h | 2 +- libavutil/opt.c | 8 ++++++++ libavutil/opt.h | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index a55b15284b..77eb6d2d27 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2011-04-18 API changes, most recent first: +2011-06-xx - xxxxxxx - lavu 51.3.0 - opt.h + Add av_opt_free convenience function. + 2011-05-28 - 0420bd7 - lavu 51.2.0 - pixdesc.h Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor. diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 8b8ca40c94..5085a6dd0b 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -40,7 +40,7 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 51 -#define LIBAVUTIL_VERSION_MINOR 2 +#define LIBAVUTIL_VERSION_MINOR 3 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/libavutil/opt.c b/libavutil/opt.c index 4e25918ed1..172fcec456 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -520,6 +520,14 @@ int av_set_options_string(void *ctx, const char *opts, return count; } +void av_opt_free(void *obj) +{ + const AVOption *o = NULL; + while ((o = av_next_option(obj, o))) + if (o->type == FF_OPT_TYPE_STRING || o->type == FF_OPT_TYPE_BINARY) + av_freep((uint8_t *)obj + o->offset); +} + #ifdef TEST #undef printf diff --git a/libavutil/opt.h b/libavutil/opt.h index 6668139fec..8c3b6c1c36 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -176,4 +176,9 @@ void av_opt_set_defaults2(void *s, int mask, int flags); int av_set_options_string(void *ctx, const char *opts, const char *key_val_sep, const char *pairs_sep); +/** + * Free all string and binary options in obj. + */ +void av_opt_free(void *obj); + #endif /* AVUTIL_OPT_H */ -- cgit v1.2.3 From 367732832faaf1bac4ece37cf7fef8c911e16312 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 5 Jun 2011 13:18:17 +0200 Subject: lavf,lavc: free avoptions in a generic way. It's simpler and less error-prone. Fixes some memleaks along the way. --- libavcodec/utils.c | 3 +++ libavdevice/bktr.c | 2 -- libavdevice/fbdev.c | 1 - libavdevice/libdc1394.c | 3 --- libavdevice/v4l2.c | 4 ---- libavdevice/vfwcap.c | 3 --- libavdevice/x11grab.c | 2 -- libavformat/rawdec.c | 4 ---- libavformat/tty.c | 1 - libavformat/utils.c | 7 ++++++- 10 files changed, 9 insertions(+), 21 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 65792a6f5a..2b417defbf 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -783,6 +783,9 @@ av_cold int avcodec_close(AVCodecContext *avctx) avctx->codec->close(avctx); avcodec_default_free_buffers(avctx); avctx->coded_frame = NULL; + if (avctx->codec->priv_class) + av_opt_free(avctx->priv_data); + av_opt_free(avctx); av_freep(&avctx->priv_data); if(avctx->codec && avctx->codec->encode) av_freep(&avctx->extradata); diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c index 6e19a61103..4d3933f4e9 100644 --- a/libavdevice/bktr.c +++ b/libavdevice/bktr.c @@ -320,8 +320,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) last_frame_time = 0; out: - av_freep(&s->video_size); - av_freep(&s->framerate); return ret; } diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c index 7e9ffe5c77..afd6b94ed0 100644 --- a/libavdevice/fbdev.c +++ b/libavdevice/fbdev.c @@ -103,7 +103,6 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx, int ret, flags = O_RDONLY; ret = av_parse_video_rate(&fbdev->fps, fbdev->framerate); - av_freep(&fbdev->framerate); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Couldn't parse framerate.\n"); return ret; diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index b17d0fb441..622579bc92 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -195,9 +195,6 @@ static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap, *select_fps = fps; *select_fmt = fmt; out: - av_freep(&dc1394->video_size); - av_freep(&dc1394->pixel_format); - av_freep(&dc1394->framerate); return ret; } diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 98ff82ec0d..839d290b63 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -684,10 +684,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8; out: - av_freep(&s->video_size); - av_freep(&s->pixel_format); - av_freep(&s->standard); - av_freep(&s->framerate); return res; } diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index 5dd873bdcb..95dd4c34b8 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -234,9 +234,6 @@ static int vfw_read_close(AVFormatContext *s) pktl = next; } - av_freep(&ctx->video_size); - av_freep(&ctx->framerate); - return 0; } diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c index b1ca6e699a..c6dc673520 100644 --- a/libavdevice/x11grab.c +++ b/libavdevice/x11grab.c @@ -258,8 +258,6 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) st->codec->bit_rate = x11grab->frame_size * 1/av_q2d(x11grab->time_base) * 8; out: - av_freep(&x11grab->video_size); - av_freep(&x11grab->framerate); return ret; } diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index a92200d844..cc05c353e9 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -102,9 +102,6 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->height = height; st->codec->pix_fmt = pix_fmt; fail: - av_freep(&s1->video_size); - av_freep(&s1->pixel_format); - av_freep(&s1->framerate); return ret; } default: @@ -182,7 +179,6 @@ int ff_raw_video_read_header(AVFormatContext *s, av_set_pts_info(st, 64, 1, 1200000); fail: - av_freep(&s1->framerate); return ret; } diff --git a/libavformat/tty.c b/libavformat/tty.c index 9dada16b8a..970274eb54 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -121,7 +121,6 @@ static int read_header(AVFormatContext *avctx, } fail: - av_freep(&s->video_size); return ret; } diff --git a/libavformat/utils.c b/libavformat/utils.c index 1050959dcb..bdc20f6d9b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2549,6 +2549,10 @@ void avformat_free_context(AVFormatContext *s) int i; AVStream *st; + av_opt_free(s); + if (s->iformat && s->iformat->priv_class) + av_opt_free(s->priv_data); + for(i=0;inb_streams;i++) { /* free all data in a stream component */ st = s->streams[i]; @@ -2578,7 +2582,6 @@ void avformat_free_context(AVFormatContext *s) } av_freep(&s->chapters); av_metadata_free(&s->metadata); - av_freep(&s->key); av_freep(&s->streams); av_free(s); } @@ -3094,6 +3097,8 @@ fail: av_freep(&s->streams[i]->priv_data); av_freep(&s->streams[i]->index_entries); } + if (s->iformat && s->iformat->priv_class) + av_opt_free(s->priv_data); av_freep(&s->priv_data); return ret; } -- cgit v1.2.3 From 29b3de127f332ef7dff863544730f0b4b0741a11 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 5 Jun 2011 02:00:21 +0200 Subject: Skip generated table headers during 'make checkheaders'. --- libavcodec/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ce96950301..6088d21307 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -651,8 +651,9 @@ OBJS-$(!CONFIG_SMALL) += inverse.o -include $(SUBDIR)$(ARCH)/Makefile -SKIPHEADERS += %_tablegen.h aac_tablegen_decl.h \ - fft-internal.h $(ARCH)/vp56_arith.h +SKIPHEADERS += %_tablegen.h %_tables.h \ + aac_tablegen_decl.h fft-internal.h \ + $(ARCH)/vp56_arith.h SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h SKIPHEADERS-$(CONFIG_LIBDIRAC) += libdirac.h SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h -- cgit v1.2.3 From f25a2ece76756214da7dcde4a52a0534d9503319 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 5 Jun 2011 00:59:52 +0200 Subject: Drop explicit filenames from @file Doxygen tags. The filename is unnecessary and brittle across file renames. --- libavcodec/lagarith.c | 2 +- libavcodec/lagarithrac.c | 2 +- libavcodec/lagarithrac.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 53f274da94..3d53536d13 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -20,7 +20,7 @@ */ /** - * @file libavcodec/lagarith.c + * @file * Lagarith lossless decoder * @author Nathan Caldwell */ diff --git a/libavcodec/lagarithrac.c b/libavcodec/lagarithrac.c index f1ffbf0a9b..ab7a60011d 100644 --- a/libavcodec/lagarithrac.c +++ b/libavcodec/lagarithrac.c @@ -21,7 +21,7 @@ */ /** - * @file libavcodec/lagarithrac.c + * @file * Lagarith range decoder * @author Nathan Caldwell * @author David Conrad diff --git a/libavcodec/lagarithrac.h b/libavcodec/lagarithrac.h index 7d0d05c6ac..6a8fa95a8e 100644 --- a/libavcodec/lagarithrac.h +++ b/libavcodec/lagarithrac.h @@ -21,7 +21,7 @@ */ /** - * @file libavcodec/lagarithrac.h + * @file * Lagarith range decoder * @author Nathan Caldwell * @author David Conrad -- cgit v1.2.3 From fb8648ad4b94abd119ae75b174f578aaacbbfd55 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 5 Jun 2011 01:54:45 +0200 Subject: Remove unnecessary LIBAVFORMAT_BUILD #ifdef. --- libavutil/internal.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavutil/internal.h b/libavutil/internal.h index 51e449d3fe..ee11a0a9d2 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -141,7 +141,6 @@ #define strncpy strncpy_is_forbidden_due_to_security_issues_use_av_strlcpy #undef exit #define exit exit_is_forbidden -#ifndef LIBAVFORMAT_BUILD #undef printf #define printf please_use_av_log_instead_of_printf #undef fprintf @@ -150,7 +149,6 @@ #define puts please_use_av_log_instead_of_puts #undef perror #define perror please_use_av_log_instead_of_perror -#endif #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ {\ -- cgit v1.2.3 From ef5d7e18f4be8f36afc1034369849bff980ad9b1 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 5 Jun 2011 01:59:14 +0200 Subject: Skip tableprint.h during 'make checkheaders'. It is only used on the host and may not compile on the target. --- libavcodec/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 6088d21307..b772bf185e 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -651,8 +651,11 @@ OBJS-$(!CONFIG_SMALL) += inverse.o -include $(SUBDIR)$(ARCH)/Makefile -SKIPHEADERS += %_tablegen.h %_tables.h \ - aac_tablegen_decl.h fft-internal.h \ +SKIPHEADERS += %_tablegen.h \ + %_tables.h \ + aac_tablegen_decl.h \ + fft-internal.h \ + tableprint.h \ $(ARCH)/vp56_arith.h SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h SKIPHEADERS-$(CONFIG_LIBDIRAC) += libdirac.h -- cgit v1.2.3 From 2c6fb9f03204d25bee68f1175233c1fff8e77e65 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 5 Jun 2011 14:20:56 -0500 Subject: v4l2: do not force NTSC as standard Setting a standard is meaningful only for analog capture devices. --- libavdevice/v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 839d290b63..2553bca48a 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -730,7 +730,7 @@ static int v4l2_read_close(AVFormatContext *s1) #define OFFSET(x) offsetof(struct video_data, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "standard", "", offsetof(struct video_data, standard), FF_OPT_TYPE_STRING, {.str = "NTSC" }, 0, 0, AV_OPT_FLAG_DECODING_PARAM }, + { "standard", "", offsetof(struct video_data, standard), FF_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_DECODING_PARAM }, { "channel", "", offsetof(struct video_data, channel), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, -- cgit v1.2.3 From a8d44f9dd5e2b0e65976c586a6185882d673317b Mon Sep 17 00:00:00 2001 From: Daniel Kang Date: Sun, 5 Jun 2011 19:20:05 -0400 Subject: Add x86 assembly for some 10-bit H.264 intra predict functions. Parts are inspired from the 8-bit H.264 predict code in Libav. Other parts ported from x264 with relicensing permission from author. Signed-off-by: Diego Biurrun --- libavcodec/x86/Makefile | 3 +- libavcodec/x86/h264_intrapred_10bit.asm | 337 ++++++++++++++++++++++++++++++++ libavcodec/x86/h264_intrapred_init.c | 61 +++++- 3 files changed, 396 insertions(+), 5 deletions(-) create mode 100644 libavcodec/x86/h264_intrapred_10bit.asm diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index 38b736e5e7..1c451c8352 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -16,7 +16,8 @@ YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \ x86/h264_idct_10bit.o \ x86/h264_weight.o \ -YASM-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred.o +YASM-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred.o \ + x86/h264_intrapred_10bit.o MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_yasm.o diff --git a/libavcodec/x86/h264_intrapred_10bit.asm b/libavcodec/x86/h264_intrapred_10bit.asm new file mode 100644 index 0000000000..5cb593ac38 --- /dev/null +++ b/libavcodec/x86/h264_intrapred_10bit.asm @@ -0,0 +1,337 @@ +;***************************************************************************** +;* MMX/SSE2/AVX-optimized 10-bit H.264 intra prediction code +;***************************************************************************** +;* Copyright (C) 2005-2011 x264 project +;* +;* Authors: Daniel Kang +;* +;* This file is part of Libav. +;* +;* Libav is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* Libav 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 +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with Libav; if not, write to the Free Software +;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "x86inc.asm" +%include "x86util.asm" + +SECTION_RODATA + +SECTION .text + +cextern pw_4 +cextern pw_1 + +%macro PRED4x4_LOWPASS 4 + paddw %2, %3 + psrlw %2, 1 + pavgw %1, %4, %2 +%endmacro + +;----------------------------------------------------------------------------- +; void pred4x4_down_right(pixel *src, const pixel *topright, int stride) +;----------------------------------------------------------------------------- +%macro PRED4x4_DR 1 +cglobal pred4x4_down_right_10_%1, 3,3 + sub r0, r2 + lea r1, [r0+r2*2] + movhps m1, [r1-8] + movhps m2, [r0+r2*1-8] + movhps m4, [r0-8] + punpckhwd m2, m4 + movq m3, [r0] + punpckhdq m1, m2 + PALIGNR m3, m1, 10, m1 + mova m1, m3 + movhps m4, [r1+r2*1-8] + PALIGNR m3, m4, 14, m4 + mova m2, m3 + movhps m4, [r1+r2*2-8] + PALIGNR m3, m4, 14, m4 + PRED4x4_LOWPASS m0, m3, m1, m2 + movq [r1+r2*2], m0 + psrldq m0, 2 + movq [r1+r2*1], m0 + psrldq m0, 2 + movq [r0+r2*2], m0 + psrldq m0, 2 + movq [r0+r2*1], m0 + RET +%endmacro + +INIT_XMM +%define PALIGNR PALIGNR_MMX +PRED4x4_DR sse2 +%define PALIGNR PALIGNR_SSSE3 +PRED4x4_DR ssse3 +%ifdef HAVE_AVX +INIT_AVX +PRED4x4_DR avx +%endif + +;----------------------------------------------------------------------------- +; void pred4x4_vertical_right(pixel *src, const pixel *topright, int stride) +;----------------------------------------------------------------------------- +%macro PRED4x4_VR 1 +cglobal pred4x4_vertical_right_10_%1, 3,3,6 + sub r0, r2 + lea r1, [r0+r2*2] + movq m5, [r0] ; ........t3t2t1t0 + movhps m1, [r0-8] + PALIGNR m0, m5, m1, 14, m1 ; ......t3t2t1t0lt + pavgw m5, m0 + movhps m1, [r0+r2*1-8] + PALIGNR m0, m1, 14, m1 ; ....t3t2t1t0ltl0 + mova m1, m0 + movhps m2, [r0+r2*2-8] + PALIGNR m0, m2, 14, m2 ; ..t3t2t1t0ltl0l1 + mova m2, m0 + movhps m3, [r1+r2*1-8] + PALIGNR m0, m3, 14, m3 ; t3t2t1t0ltl0l1l2 + PRED4x4_LOWPASS m3, m1, m0, m2 + pslldq m1, m3, 12 + psrldq m3, 4 + movq [r0+r2*1], m5 + movq [r0+r2*2], m3 + PALIGNR m5, m1, 14, m2 + pslldq m1, 2 + movq [r1+r2*1], m5 + PALIGNR m3, m1, 14, m1 + movq [r1+r2*2], m3 + RET +%endmacro + +INIT_XMM +%define PALIGNR PALIGNR_MMX +PRED4x4_VR sse2 +%define PALIGNR PALIGNR_SSSE3 +PRED4x4_VR ssse3 +%ifdef HAVE_AVX +INIT_AVX +PRED4x4_VR avx +%endif + +;----------------------------------------------------------------------------- +; void pred4x4_horizontal_down(pixel *src, const pixel *topright, int stride) +;----------------------------------------------------------------------------- +%macro PRED4x4_HD 1 +cglobal pred4x4_horizontal_down_10_%1, 3,3 + sub r0, r2 + lea r1, [r0+r2*2] + movq m0, [r0-8] ; lt .. + movhps m0, [r0] + pslldq m0, 2 ; t2 t1 t0 lt .. .. .. .. + movq m1, [r1+r2*2-8] ; l3 + movq m3, [r1+r2*1-8] + punpcklwd m1, m3 ; l2 l3 + movq m2, [r0+r2*2-8] ; l1 + movq m3, [r0+r2*1-8] + punpcklwd m2, m3 ; l0 l1 + punpckhdq m1, m2 ; l0 l1 l2 l3 + punpckhqdq m1, m0 ; t2 t1 t0 lt l0 l1 l2 l3 + psrldq m0, m1, 4 ; .. .. t2 t1 t0 lt l0 l1 + psrldq m2, m1, 2 ; .. t2 t1 t0 lt l0 l1 l2 + pavgw m5, m1, m2 + PRED4x4_LOWPASS m3, m1, m0, m2 + punpcklwd m5, m3 + psrldq m3, 8 + PALIGNR m3, m5, 12, m4 + movq [r1+r2*2], m5 + movhps [r0+r2*2], m5 + psrldq m5, 4 + movq [r1+r2*1], m5 + movq [r0+r2*1], m3 + RET +%endmacro + +INIT_XMM +%define PALIGNR PALIGNR_MMX +PRED4x4_HD sse2 +%define PALIGNR PALIGNR_SSSE3 +PRED4x4_HD ssse3 +%ifdef HAVE_AVX +INIT_AVX +PRED4x4_HD avx +%endif + +;----------------------------------------------------------------------------- +; void pred4x4_dc(pixel *src, const pixel *topright, int stride) +;----------------------------------------------------------------------------- +%macro HADDD 2 ; sum junk +%if mmsize == 16 + movhlps %2, %1 + paddd %1, %2 + pshuflw %2, %1, 0xE + paddd %1, %2 +%else + pshufw %2, %1, 0xE + paddd %1, %2 +%endif +%endmacro + +%macro HADDW 2 + pmaddwd %1, [pw_1] + HADDD %1, %2 +%endmacro + +INIT_MMX +cglobal pred4x4_dc_10_mmxext, 3,3 + sub r0, r2 + lea r1, [r0+r2*2] + movq m2, [r0+r2*1-8] + paddw m2, [r0+r2*2-8] + paddw m2, [r1+r2*1-8] + paddw m2, [r1+r2*2-8] + psrlq m2, 48 + movq m0, [r0] + HADDW m0, m1 + paddw m0, [pw_4] + paddw m0, m2 + psrlw m0, 3 + SPLATW m0, m0, 0 + movq [r0+r2*1], m0 + movq [r0+r2*2], m0 + movq [r1+r2*1], m0 + movq [r1+r2*2], m0 + RET + +;----------------------------------------------------------------------------- +; void pred4x4_down_left(pixel *src, const pixel *topright, int stride) +;----------------------------------------------------------------------------- +;TODO: more AVX here +%macro PRED4x4_DL 1 +cglobal pred4x4_down_left_10_%1, 3,3 + sub r0, r2 + movq m1, [r0] + movhps m1, [r1] + pslldq m5, m1, 2 + pxor m2, m5, m1 + psrldq m2, 2 + pxor m3, m1, m2 + PRED4x4_LOWPASS m0, m5, m3, m1 + lea r1, [r0+r2*2] + movhps [r1+r2*2], m0 + psrldq m0, 2 + movq [r0+r2*1], m0 + psrldq m0, 2 + movq [r0+r2*2], m0 + psrldq m0, 2 + movq [r1+r2*1], m0 + RET +%endmacro + +INIT_XMM +PRED4x4_DL sse2 +%ifdef HAVE_AVX +INIT_AVX +PRED4x4_DL avx +%endif + +;----------------------------------------------------------------------------- +; void pred4x4_vertical_left(pixel *src, const pixel *topright, int stride) +;----------------------------------------------------------------------------- +%macro PRED4x4_VL 1 +cglobal pred4x4_vertical_left_10_%1, 3,3 + sub r0, r2 + movu m1, [r0] + movhps m1, [r1] + psrldq m3, m1, 2 + psrldq m2, m1, 4 + pavgw m4, m3, m1 + PRED4x4_LOWPASS m0, m1, m2, m3 + lea r1, [r0+r2*2] + movq [r0+r2*1], m4 + movq [r0+r2*2], m0 + psrldq m4, 2 + psrldq m0, 2 + movq [r1+r2*1], m4 + movq [r1+r2*2], m0 + RET +%endmacro + +INIT_XMM +PRED4x4_VL sse2 +%ifdef HAVE_AVX +INIT_AVX +PRED4x4_VL avx +%endif + +;----------------------------------------------------------------------------- +; void pred4x4_horizontal_up(pixel *src, const pixel *topright, int stride) +;----------------------------------------------------------------------------- +INIT_MMX +cglobal pred4x4_horizontal_up_10_mmxext, 3,3 + sub r0, r2 + lea r1, [r0+r2*2] + movq m0, [r0+r2*1-8] + punpckhwd m0, [r0+r2*2-8] + movq m1, [r1+r2*1-8] + punpckhwd m1, [r1+r2*2-8] + punpckhdq m0, m1 + pshufw m1, m1, 0xFF + movq [r1+r2*2], m1 + movd [r1+r2*1+4], m1 + pshufw m2, m0, 11111001b + movq m1, m2 + pavgw m2, m0 + + pshufw m5, m0, 11111110b + PRED4x4_LOWPASS m3, m0, m5, m1 + movq m6, m2 + punpcklwd m6, m3 + movq [r0+r2*1], m6 + psrlq m2, 16 + psrlq m3, 16 + punpcklwd m2, m3 + movq [r0+r2*2], m2 + psrlq m2, 32 + movd [r1+r2*1], m2 + RET + + + +;----------------------------------------------------------------------------- +; void pred8x8_vertical(pixel *src, int stride) +;----------------------------------------------------------------------------- +INIT_XMM +cglobal pred8x8_vertical_10_sse2, 2,2 + sub r0, r1 + mova m0, [r0] +%rep 3 + mova [r0+r1*1], m0 + mova [r0+r1*2], m0 + lea r0, [r0+r1*2] +%endrep + mova [r0+r1*1], m0 + mova [r0+r1*2], m0 + RET + +;----------------------------------------------------------------------------- +; void pred8x8_horizontal(pixel *src, int stride) +;----------------------------------------------------------------------------- +INIT_XMM +cglobal pred8x8_horizontal_10_sse2, 2,3 + mov r2, 4 +.loop: + movq m0, [r0+r1*0-8] + movq m1, [r0+r1*1-8] + pshuflw m0, m0, 0xff + pshuflw m1, m1, 0xff + punpcklqdq m0, m0 + punpcklqdq m1, m1 + mova [r0+r1*0], m0 + mova [r0+r1*1], m1 + lea r0, [r0+r1*2] + dec r2 + jg .loop + REP_RET diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c index bd57030660..da5553571a 100644 --- a/libavcodec/x86/h264_intrapred_init.c +++ b/libavcodec/x86/h264_intrapred_init.c @@ -21,6 +21,31 @@ #include "libavutil/cpu.h" #include "libavcodec/h264pred.h" +#define PRED4x4(TYPE, DEPTH, OPT) \ +void ff_pred4x4_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, const uint8_t *topright, int stride); + +PRED4x4(dc, 10, mmxext) +PRED4x4(down_left, 10, sse2) +PRED4x4(down_left, 10, avx) +PRED4x4(down_right, 10, sse2) +PRED4x4(down_right, 10, ssse3) +PRED4x4(down_right, 10, avx) +PRED4x4(vertical_left, 10, sse2) +PRED4x4(vertical_left, 10, avx) +PRED4x4(vertical_right, 10, sse2) +PRED4x4(vertical_right, 10, ssse3) +PRED4x4(vertical_right, 10, avx) +PRED4x4(horizontal_up, 10, mmxext) +PRED4x4(horizontal_down, 10, sse2) +PRED4x4(horizontal_down, 10, ssse3) +PRED4x4(horizontal_down, 10, avx) + +#define PRED8x8(TYPE, DEPTH, OPT) \ +void ff_pred8x8_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int stride); + +PRED8x8(vertical, 10, sse2) +PRED8x8(horizontal, 10, sse2) + void ff_pred16x16_vertical_mmx (uint8_t *src, int stride); void ff_pred16x16_vertical_sse (uint8_t *src, int stride); void ff_pred16x16_horizontal_mmx (uint8_t *src, int stride); @@ -98,11 +123,8 @@ void ff_pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int s void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth) { int mm_flags = av_get_cpu_flags(); - const int high_depth = bit_depth > 8; - - if (high_depth) - return; + if (bit_depth == 8) { #if HAVE_YASM if (mm_flags & AV_CPU_FLAG_MMX) { h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_mmx; @@ -226,4 +248,35 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth } } #endif + } else if (bit_depth == 10) { +#if HAVE_YASM + if (mm_flags & AV_CPU_FLAG_MMX2) { + h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext; + h->pred4x4[HOR_UP_PRED ] = ff_pred4x4_horizontal_up_10_mmxext; + } + if (mm_flags & AV_CPU_FLAG_SSE2) { + h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2; + h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_sse2; + h->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_sse2; + h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_sse2; + h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_sse2; + + h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vertical_10_sse2; + h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_10_sse2; + } + if (mm_flags & AV_CPU_FLAG_SSSE3) { + h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3; + h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_ssse3; + h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_ssse3; + } +#if HAVE_AVX + if (mm_flags&AV_CPU_FLAG_AVX) { + h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_avx; + h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_avx; + h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_avx; + h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_avx; + } +#endif /* HAVE_AVX */ +#endif /* HAVE_YASM */ + } } -- cgit v1.2.3 From eb7505e4295dca9c3ab8c01e055a458e07857ef0 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sat, 4 Jun 2011 18:45:28 +0200 Subject: Remove some unused scripts from tools/. --- tools/build_avopt | 9 --------- tools/clean-diff | 11 ----------- tools/jauche_sortierer.sh | 21 --------------------- tools/unwrap-diff | 2 -- 4 files changed, 43 deletions(-) delete mode 100755 tools/build_avopt delete mode 100755 tools/clean-diff delete mode 100755 tools/jauche_sortierer.sh delete mode 100755 tools/unwrap-diff diff --git a/tools/build_avopt b/tools/build_avopt deleted file mode 100755 index fcf165765c..0000000000 --- a/tools/build_avopt +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -sed 's/unsigned//g' |\ - sed 's/enum//g' |\ - egrep '^ *(int|float|double|AVRational|char *\*) *[a-zA-Z_0-9]* *;' |\ - sed 's/^ *\([^ ]*\)[ *]*\([^;]*\);.*$/{"\2", NULL, OFFSET(\2), FF_OPT_TYPE_\U\1, DEFAULT, \1_MIN, \1_MAX},/' |\ - sed 's/AVRATIONAL_M/INT_M/g'|\ - sed 's/TYPE_AVRATIONAL/TYPE_RATIONAL/g'|\ - sed 's/FLOAT_M/FLT_M/g'|\ - sed 's/FF_OPT_TYPE_CHAR/FF_OPT_TYPE_STRING/g' diff --git a/tools/clean-diff b/tools/clean-diff deleted file mode 100755 index 4600702b10..0000000000 --- a/tools/clean-diff +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -sed '/^+[^+]/!s/ /TaBBaT/g' |\ - expand -t $(seq -s , 9 8 200) |\ - sed 's/TaBBaT/ /g' |\ - sed '/^+[^+]/s/ * $//' |\ - tr -d '\015' |\ - tr '\n' '°' |\ - sed 's/\(@@[^@]*@@°[^@]*\)/\n\1/g' |\ - egrep -v '@@[^@]*@@°(( [^°]*°)|([+-][[:space:]]*°)|(-[[:space:]]*([^°]*)°\+[[:space:]]*\5°))*$' |\ - tr -d '\n' |\ - tr '°' '\n' diff --git a/tools/jauche_sortierer.sh b/tools/jauche_sortierer.sh deleted file mode 100755 index 1f84f1a2a9..0000000000 --- a/tools/jauche_sortierer.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -#GPL -#TODO -#add pixelformat/sampleformat into the path of the codecs - -FFP=../ffprobe -TMP=$(mktemp) || exit 1 -TARGET=$1 -shift - -for v do - BASE=$(basename $v) - echo $v | egrep -i '(public|private)' >/dev/null && echo Warning $v may be private - $FFP $v 2> $TMP - FORM=$((grep 'Input #0, ' -m1 $TMP || echo 'Input #0, unknown') | sed 's/Input #0, \([a-zA-Z0-9_]*\).*/\1/' ) - mkdir -p $TARGET/container/$FORM - ln -s $v $TARGET/container/$FORM/$BASE - eval $(grep 'Stream #0\.[^:]*: [a-zA-Z0-9][^:]*: [a-zA-Z0-9]' $TMP | sed 's#[^:]*: \([a-zA-Z0-9]*\)[^:]*: \([a-zA-Z0-9]*\).*#mkdir -p '$TARGET'/\1/\2 ; ln -s '$v' '$TARGET'/\1/\2/'$BASE' ; #') -done - -rm $TMP diff --git a/tools/unwrap-diff b/tools/unwrap-diff deleted file mode 100755 index ccea99b7b4..0000000000 --- a/tools/unwrap-diff +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -tr '\n' '\001' | sed 's/\x01\x01/\x01 \x01/g' | sed 's/\x01\([^-+ @]\)/ \1/g' | tr '\001' '\n' -- cgit v1.2.3