From 24d3796d218ed160fce767b1489115cb7e514867 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 8 Aug 2012 15:41:36 +0200 Subject: [PATCH 1/6] build: add HOSTOBJS to SUBDIR_VARS list Even though HOSTOBJS are not referenced directly in subdirectory Makefile snippets right now, robustness requires resetting the variable contents. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7d4ca8f56c..d2aed23cd4 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,7 @@ SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \ ARMV5TE-OBJS ARMV6-OBJS ARMVFP-OBJS NEON-OBJS \ MMI-OBJS ALTIVEC-OBJS VIS-OBJS \ MMX-OBJS YASM-OBJS \ - OBJS TESTOBJS + OBJS HOSTOBJS TESTOBJS define RESET $(1) := From 36a8c43073114cffc6ea147178f227a95e40a59f Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 9 Aug 2012 03:03:26 +0200 Subject: [PATCH 2/6] doxygen: qdm2: Drop documentation for non-existing function parameters --- libavcodec/qdm2.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 945999e126..4d3b3915fb 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -1086,7 +1086,6 @@ static void process_subpacket_9 (QDM2Context *q, QDM2SubPNode *node) * * @param q context * @param node pointer to node with packet - * @param length packet length in bits */ static void process_subpacket_10 (QDM2Context *q, QDM2SubPNode *node) { @@ -1135,7 +1134,6 @@ static void process_subpacket_11 (QDM2Context *q, QDM2SubPNode *node) * * @param q context * @param node pointer to node with packet - * @param length packet length in bits */ static void process_subpacket_12 (QDM2Context *q, QDM2SubPNode *node) { From f9150c8ac040262c5b8bf01ab5449011a5984ef5 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Wed, 8 Aug 2012 23:03:44 +0000 Subject: [PATCH 3/6] lagarith: frame multithreading About 2x speedup going from 1 to 2 threads. 1.7s to 0.85s on foreman CIF. Signed-off-by: Janne Grunau --- libavcodec/lagarith.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 665bd963b9..e365610410 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -30,6 +30,7 @@ #include "mathops.h" #include "dsputil.h" #include "lagarithrac.h" +#include "thread.h" enum LagarithFrameType { FRAME_RAW = 1, /**< uncompressed */ @@ -506,7 +507,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *picture = data; if (p->data[0]) - avctx->release_buffer(avctx, p); + ff_thread_release_buffer(avctx, p); p->reference = 0; p->key_frame = 1; @@ -520,7 +521,7 @@ static int lag_decode_frame(AVCodecContext *avctx, case FRAME_SOLID_RGBA: avctx->pix_fmt = PIX_FMT_RGB32; - if (avctx->get_buffer(avctx, p) < 0) { + if (ff_thread_get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } @@ -542,7 +543,7 @@ static int lag_decode_frame(AVCodecContext *avctx, if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24) avctx->pix_fmt = PIX_FMT_RGB24; - if (avctx->get_buffer(avctx, p) < 0) { + if (ff_thread_get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } @@ -602,7 +603,7 @@ static int lag_decode_frame(AVCodecContext *avctx, case FRAME_ARITH_YUY2: avctx->pix_fmt = PIX_FMT_YUV422P; - if (avctx->get_buffer(avctx, p) < 0) { + if (ff_thread_get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } @@ -628,7 +629,7 @@ static int lag_decode_frame(AVCodecContext *avctx, case FRAME_ARITH_YV12: avctx->pix_fmt = PIX_FMT_YUV420P; - if (avctx->get_buffer(avctx, p) < 0) { + if (ff_thread_get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } @@ -678,7 +679,7 @@ static av_cold int lag_decode_end(AVCodecContext *avctx) LagarithContext *l = avctx->priv_data; if (l->picture.data[0]) - avctx->release_buffer(avctx, &l->picture); + ff_thread_release_buffer(avctx, &l->picture); av_freep(&l->rgb_planes); return 0; @@ -692,6 +693,6 @@ AVCodec ff_lagarith_decoder = { .init = lag_decode_init, .close = lag_decode_end, .decode = lag_decode_frame, - .capabilities = CODEC_CAP_DR1, + .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS, .long_name = NULL_IF_CONFIG_SMALL("Lagarith lossless"), }; From 74f82f92a4683a431db84b0a4d4197f705ec54ad Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 31 Jul 2012 14:53:57 +0100 Subject: [PATCH 4/6] motion_est: remove useless no_motion_search() function At both places this function is called, mb_[xy] == s->mb_[xy] making the call together with following code equivalent to simply assigning zeros. Signed-off-by: Mans Rullgard --- libavcodec/motion_est.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 0afb697eb9..155786e11b 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -374,13 +374,6 @@ int ff_init_me(MpegEncContext *s){ return 0; } -static inline void no_motion_search(MpegEncContext * s, - int *mx_ptr, int *my_ptr) -{ - *mx_ptr = 16 * s->mb_x; - *my_ptr = 16 * s->mb_y; -} - #define Z_THRESHOLD 256 #define CHECK_SAD_HALF_MV(suffix, x, y) \ @@ -1040,9 +1033,8 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, switch(s->me_method) { case ME_ZERO: default: - no_motion_search(s, &mx, &my); - mx-= mb_x*16; - my-= mb_y*16; + mx = 0; + my = 0; dmin = 0; break; case ME_X1: @@ -1283,10 +1275,9 @@ static int ff_estimate_motion_b(MpegEncContext * s, switch(s->me_method) { case ME_ZERO: default: - no_motion_search(s, &mx, &my); + mx = 0; + my = 0; dmin = 0; - mx-= mb_x*16; - my-= mb_y*16; break; case ME_X1: case ME_EPZS: From 5bf7bc625ba75a44d9034d123d687375783d31e6 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 31 Jul 2012 14:56:28 +0100 Subject: [PATCH 5/6] motion_est: remove unused macros Signed-off-by: Mans Rullgard --- libavcodec/motion_est.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 155786e11b..ee4abea61b 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -39,8 +39,6 @@ #undef NDEBUG #include -#define SQ(a) ((a)*(a)) - #define P_LEFT P[1] #define P_TOP P[2] #define P_TOPRIGHT P[3] @@ -374,8 +372,6 @@ int ff_init_me(MpegEncContext *s){ return 0; } -#define Z_THRESHOLD 256 - #define CHECK_SAD_HALF_MV(suffix, x, y) \ {\ d= s->dsp.pix_abs[size][(x?1:0)+(y?2:0)](NULL, pix, ptr+((x)>>1), stride, h);\ From 0db9eba48c8a27bc2373d02edda3340ef6f0e5fc Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 31 Jul 2012 14:58:09 +0100 Subject: [PATCH 6/6] motion_est: drop inline from sad_hpel_motion_search() This function is only ever called through a function pointer, so marking it inline makes no sense. Signed-off-by: Mans Rullgard --- libavcodec/motion_est.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index ee4abea61b..4cf8a68df7 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -45,7 +45,7 @@ #define P_MEDIAN P[4] #define P_MV1 P[9] -static inline int sad_hpel_motion_search(MpegEncContext * s, +static int sad_hpel_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int src_index, int ref_index, int size, int h); @@ -379,7 +379,7 @@ int ff_init_me(MpegEncContext *s){ COPY3_IF_LT(dminh, d, dx, x, dy, y)\ } -static inline int sad_hpel_motion_search(MpegEncContext * s, +static int sad_hpel_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int src_index, int ref_index, int size, int h)