From 42761122779dea2629cfc54a8bbe5d327e729c6e Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 28 May 2011 17:20:49 +0100 Subject: [PATCH 1/7] vp8: use av_clip_uintp2() where possible Signed-off-by: Mans Rullgard --- libavcodec/vp8.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 38f38b7cb3..5500706494 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -166,12 +166,12 @@ static void get_quants(VP8Context *s) } else base_qi = yac_qi; - s->qmat[i].luma_qmul[0] = vp8_dc_qlookup[av_clip(base_qi + ydc_delta , 0, 127)]; - s->qmat[i].luma_qmul[1] = vp8_ac_qlookup[av_clip(base_qi , 0, 127)]; - s->qmat[i].luma_dc_qmul[0] = 2 * vp8_dc_qlookup[av_clip(base_qi + y2dc_delta, 0, 127)]; - s->qmat[i].luma_dc_qmul[1] = 155 * vp8_ac_qlookup[av_clip(base_qi + y2ac_delta, 0, 127)] / 100; - s->qmat[i].chroma_qmul[0] = vp8_dc_qlookup[av_clip(base_qi + uvdc_delta, 0, 127)]; - s->qmat[i].chroma_qmul[1] = vp8_ac_qlookup[av_clip(base_qi + uvac_delta, 0, 127)]; + s->qmat[i].luma_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + ydc_delta , 7)]; + s->qmat[i].luma_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi , 7)]; + s->qmat[i].luma_dc_qmul[0] = 2 * vp8_dc_qlookup[av_clip_uintp2(base_qi + y2dc_delta, 7)]; + s->qmat[i].luma_dc_qmul[1] = 155 * vp8_ac_qlookup[av_clip_uintp2(base_qi + y2ac_delta, 7)] / 100; + s->qmat[i].chroma_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + uvdc_delta, 7)]; + s->qmat[i].chroma_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi + uvac_delta, 7)]; s->qmat[i].luma_dc_qmul[1] = FFMAX(s->qmat[i].luma_dc_qmul[1], 8); s->qmat[i].chroma_qmul[0] = FFMIN(s->qmat[i].chroma_qmul[0], 132); From 798b26467877007418d21722d59c769d17ed7233 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 28 May 2011 13:10:01 +0100 Subject: [PATCH 2/7] build: remove BUILD_ROOT variable This variable is unnecessary as absolute paths are not required. Signed-off-by: Mans Rullgard --- Makefile | 6 +++--- common.mak | 12 +++--------- configure | 3 +-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 73ada9a59d..d18a2f97cf 100644 --- a/Makefile +++ b/Makefile @@ -202,15 +202,15 @@ ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF) @mkdir -p tests/vsynth1 - $(M)$(BUILD_ROOT)/$< 'tests/vsynth1/' + $(M)./$< 'tests/vsynth1/' tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF) @mkdir -p tests/vsynth2 - $(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm + $(M)./$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF) @mkdir -p tests/data - $(M)$(BUILD_ROOT)/$< $@ + $(M)./$< $@ tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN diff --git a/common.mak b/common.mak index 03fae6f805..20876c0951 100644 --- a/common.mak +++ b/common.mak @@ -12,12 +12,6 @@ vpath %.S $(SRC_DIR) vpath %.asm $(SRC_DIR) vpath %.v $(SRC_DIR) -ifeq ($(SRC_DIR),$(SRC_PATH_BARE)) -BUILD_ROOT_REL = . -else -BUILD_ROOT_REL = .. -endif - ifndef V Q = @ ECHO = printf "$(1)\t%s\n" $(2) @@ -33,7 +27,7 @@ endif ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale -IFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) +IFLAGS := -I. -I$(SRC_PATH) CPPFLAGS := $(IFLAGS) $(CPPFLAGS) CFLAGS += $(ECFLAGS) YASMFLAGS += $(IFLAGS) -Pconfig.asm @@ -85,7 +79,7 @@ FFLIBS := $(FFLIBS-yes) $(FFLIBS) TESTPROGS += $(TESTPROGS-yes) FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS) -FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS) +FFLDFLAGS := $(addprefix -Llib,$(ALLFFLIBS)) $(LDFLAGS) EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES))) OBJS := $(addprefix $(SUBDIR),$(sort $(OBJS))) @@ -94,7 +88,7 @@ TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS))) HOSTOBJS := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS))) HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS))) -DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME)) +DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME)) ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h)) SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS)) diff --git a/configure b/configure index b535920cb2..805e4ba50a 100755 --- a/configure +++ b/configure @@ -2989,7 +2989,7 @@ enabled extra_warnings && check_cflags -Winline # add some linker flags check_ldflags -Wl,--warn-common -check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil' +check_ldflags -Wl,-rpath-link,libpostproc -Wl,-rpath-link,libswscale -Wl,-rpath-link,libavfilter -Wl,-rpath-link,libavdevice -Wl,-rpath-link,libavformat -Wl,-rpath-link,libavcodec -Wl,-rpath-link,libavutil test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic echo "X{};" > $TMPV @@ -3253,7 +3253,6 @@ DATADIR=\$(DESTDIR)$datadir MANDIR=\$(DESTDIR)$mandir SRC_PATH="$source_path" SRC_PATH_BARE=$source_path -BUILD_ROOT="$PWD" CC_IDENT=$cc_ident ARCH=$arch CC=$cc From 2146f4928a45b37eba781a74aa8cc9ae50e89d52 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 27 May 2011 20:22:55 +0200 Subject: [PATCH 3/7] vf_crop: Replace #ifdef DEBUG + av_log() by av_dlog(). --- libavfilter/vf_crop.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c index 9f71b9e7dc..69e5a520c8 100644 --- a/libavfilter/vf_crop.c +++ b/libavfilter/vf_crop.c @@ -264,11 +264,9 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) crop->x &= ~((1 << crop->hsub) - 1); crop->y &= ~((1 << crop->vsub) - 1); -#ifdef DEBUG - av_log(ctx, AV_LOG_DEBUG, - "n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n", - (int)crop->var_values[VAR_N], crop->var_values[VAR_T], crop->x, crop->y, crop->x+crop->w, crop->y+crop->h); -#endif + av_dlog(ctx, "n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n", + (int)crop->var_values[VAR_N], crop->var_values[VAR_T], crop->x, + crop->y, crop->x+crop->w, crop->y+crop->h); ref2->data[0] += crop->y * ref2->linesize[0]; ref2->data[0] += crop->x * crop->max_step[0]; From d6e0729b24de566a80554abbdf0aca1ed24de14b Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 27 May 2011 20:24:44 +0200 Subject: [PATCH 4/7] avfilter: Surround function only used in debug mode by appropriate #ifdef. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the warning: libavfilter/avfilter.c:219: warning: ‘ff_get_ref_perms_string’ defined but not used --- libavfilter/avfilter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 02915036ab..abeae14f79 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -215,6 +215,7 @@ int avfilter_config_links(AVFilterContext *filter) return 0; } +#ifdef DEBUG static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) { snprintf(buf, buf_size, "%s%s%s%s%s%s", @@ -226,6 +227,7 @@ static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) perms & AV_PERM_NEG_LINESIZES ? "n" : ""); return buf; } +#endif static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) { From 06b5facd4b8cb19da352cec71b2edf2f0343ee35 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 29 Apr 2011 19:35:08 +0200 Subject: [PATCH 5/7] swscale: Remove disabled code. --- libswscale/ppc/yuv2rgb_altivec.c | 152 ------------------------------- libswscale/rgb2rgb_template.c | 7 -- libswscale/yuv2rgb.c | 74 --------------- 3 files changed, 233 deletions(-) diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c index 0cc0d3084d..54ebee1edf 100644 --- a/libswscale/ppc/yuv2rgb_altivec.c +++ b/libswscale/ppc/yuv2rgb_altivec.c @@ -447,159 +447,7 @@ static int altivec_##name (SwsContext *c, \ #define out_bgr24(a,b,c,ptr) vec_mstbgr24(a,b,c,ptr) DEFCSP420_CVT (yuv2_abgr, out_abgr) -#if 1 DEFCSP420_CVT (yuv2_bgra, out_bgra) -#else -static int altivec_yuv2_bgra32 (SwsContext *c, - unsigned char **in, int *instrides, - int srcSliceY, int srcSliceH, - unsigned char **oplanes, int *outstrides) -{ - int w = c->srcW; - int h = srcSliceH; - int i,j; - int instrides_scl[3]; - vector unsigned char y0,y1; - - vector signed char u,v; - - vector signed short Y0,Y1,Y2,Y3; - vector signed short U,V; - vector signed short vx,ux,uvx; - vector signed short vx0,ux0,uvx0; - vector signed short vx1,ux1,uvx1; - vector signed short R0,G0,B0; - vector signed short R1,G1,B1; - vector unsigned char R,G,B; - - vector unsigned char *uivP, *vivP; - vector unsigned char align_perm; - - vector signed short - lCY = c->CY, - lOY = c->OY, - lCRV = c->CRV, - lCBU = c->CBU, - lCGU = c->CGU, - lCGV = c->CGV; - - vector unsigned short lCSHIFT = c->CSHIFT; - - ubyte *y1i = in[0]; - ubyte *y2i = in[0]+w; - ubyte *ui = in[1]; - ubyte *vi = in[2]; - - vector unsigned char *oute - = (vector unsigned char *) - (oplanes[0]+srcSliceY*outstrides[0]); - vector unsigned char *outo - = (vector unsigned char *) - (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]); - - - instrides_scl[0] = instrides[0]; - instrides_scl[1] = instrides[1]-w/2; /* the loop moves ui by w/2 */ - instrides_scl[2] = instrides[2]-w/2; /* the loop moves vi by w/2 */ - - - for (i=0;i>15 */ - ux = vec_sl (U, lCSHIFT); - ux = vec_mradds (ux, lCBU, (vector signed short){0}); - ux0 = vec_mergeh (ux,ux); - ux1 = vec_mergel (ux,ux); - - /* vx = (CRV*(v<>15; */ - vx = vec_sl (V, lCSHIFT); - vx = vec_mradds (vx, lCRV, (vector signed short){0}); - vx0 = vec_mergeh (vx,vx); - vx1 = vec_mergel (vx,vx); - /* uvx = ((CGU*u) + (CGV*v))>>15 */ - uvx = vec_mradds (U, lCGU, (vector signed short){0}); - uvx = vec_mradds (V, lCGV, uvx); - uvx0 = vec_mergeh (uvx,uvx); - uvx1 = vec_mergel (uvx,uvx); - R0 = vec_add (Y0,vx0); - G0 = vec_add (Y0,uvx0); - B0 = vec_add (Y0,ux0); - R1 = vec_add (Y1,vx1); - G1 = vec_add (Y1,uvx1); - B1 = vec_add (Y1,ux1); - R = vec_packclp (R0,R1); - G = vec_packclp (G0,G1); - B = vec_packclp (B0,B1); - - out_argb(R,G,B,oute); - R0 = vec_add (Y2,vx0); - G0 = vec_add (Y2,uvx0); - B0 = vec_add (Y2,ux0); - R1 = vec_add (Y3,vx1); - G1 = vec_add (Y3,uvx1); - B1 = vec_add (Y3,ux1); - R = vec_packclp (R0,R1); - G = vec_packclp (G0,G1); - B = vec_packclp (B0,B1); - - out_argb(R,G,B,outo); - y1i += 16; - y2i += 16; - ui += 8; - vi += 8; - - } - - outo += (outstrides[0])>>4; - oute += (outstrides[0])>>4; - - ui += instrides_scl[1]; - vi += instrides_scl[2]; - y1i += instrides_scl[0]; - y2i += instrides_scl[0]; - } - return srcSliceH; -} - -#endif - - DEFCSP420_CVT (yuv2_rgba, out_rgba) DEFCSP420_CVT (yuv2_argb, out_argb) DEFCSP420_CVT (yuv2_rgb24, out_rgb24) diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index 0a226a2960..c02015e5b3 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -574,7 +574,6 @@ static inline void planar2x_c(const uint8_t *src, uint8_t *dst, int srcWidth, } // last line -#if 1 dst[0]= src[0]; for (x=0; x>2; } dst[2*srcWidth-1]= src[srcWidth-1]; -#else - for (x=0; x Date: Fri, 27 May 2011 09:32:17 +0200 Subject: [PATCH 6/7] v4l2: don't leak video standard string on error. --- libavdevice/v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index e0186f8031..80b640078d 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -511,7 +511,6 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap) return AVERROR(EIO); } } - av_freep(&s->standard); if (ap->time_base.num && ap->time_base.den) { av_log(s1, AV_LOG_DEBUG, "Setting time per frame to %d/%d\n", @@ -681,6 +680,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) out: av_freep(&s->video_size); av_freep(&s->pixel_format); + av_freep(&s->standard); return res; } From 371266daa3df35c424203fff0ce2e6de0e33a29d Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 29 May 2011 14:22:52 +0100 Subject: [PATCH 7/7] ARM: enable UAL syntax in asm.S This enables UAL syntax for all asm files instead of only those which happen to be incompatible with the old, deprecated syntax. Signed-off-by: Mans Rullgard --- libavcodec/arm/asm.S | 2 ++ libavcodec/arm/dsputil_vfp.S | 1 - libavcodec/arm/fmtconvert_vfp.S | 2 -- libavcodec/arm/mpegvideo_armv5te_s.S | 2 +- libavcodec/arm/vp8_armv6.S | 2 -- 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/arm/asm.S b/libavcodec/arm/asm.S index 6e3d7881dd..8d7fe98614 100644 --- a/libavcodec/arm/asm.S +++ b/libavcodec/arm/asm.S @@ -26,6 +26,8 @@ # define ELF @ #endif + .syntax unified + .macro require8 val=1 ELF .eabi_attribute 24, \val .endm diff --git a/libavcodec/arm/dsputil_vfp.S b/libavcodec/arm/dsputil_vfp.S index b41db03b63..16ea25afe6 100644 --- a/libavcodec/arm/dsputil_vfp.S +++ b/libavcodec/arm/dsputil_vfp.S @@ -21,7 +21,6 @@ #include "config.h" #include "asm.S" - .syntax unified /* * VFP is a floating point coprocessor used in some ARM cores. VFP11 has 1 cycle * throughput for almost all the instructions (except for double precision diff --git a/libavcodec/arm/fmtconvert_vfp.S b/libavcodec/arm/fmtconvert_vfp.S index e01627b669..1bb7f49801 100644 --- a/libavcodec/arm/fmtconvert_vfp.S +++ b/libavcodec/arm/fmtconvert_vfp.S @@ -21,8 +21,6 @@ #include "config.h" #include "asm.S" - .syntax unified - /** * ARM VFP optimized float to int16 conversion. * Assume that len is a positive number and is multiple of 8, destination diff --git a/libavcodec/arm/mpegvideo_armv5te_s.S b/libavcodec/arm/mpegvideo_armv5te_s.S index 6473926c0e..e83fe991e6 100644 --- a/libavcodec/arm/mpegvideo_armv5te_s.S +++ b/libavcodec/arm/mpegvideo_armv5te_s.S @@ -95,7 +95,7 @@ function ff_dct_unquantize_h263_armv5te, export=1 strh lr, [r0], #2 subs r3, r3, #8 - ldrgtd r4, [r0, #0] /* load data early to avoid load/use pipeline stall */ + ldrdgt r4, [r0, #0] /* load data early to avoid load/use pipeline stall */ bgt 1b adds r3, r3, #2 diff --git a/libavcodec/arm/vp8_armv6.S b/libavcodec/arm/vp8_armv6.S index 11d3521f8d..602c8a58be 100644 --- a/libavcodec/arm/vp8_armv6.S +++ b/libavcodec/arm/vp8_armv6.S @@ -20,8 +20,6 @@ #include "asm.S" - .syntax unified - .macro rac_get_prob h, bs, buf, cw, pr, t0, t1 adds \bs, \bs, \t0 lsl \cw, \cw, \t0