Commit 25ca8aef authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '4a606c83'

* commit '4a606c83':
  av_memcpy_backptr: optimise some special cases
  mpegvideo: simplify dxy calculation in hpel_motion()
  build: add rules to generate preprocessed source files

Conflicts:
	Makefile
	libavutil/mem.c
	library.mak
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents e9c37236 4a606c83
...@@ -17,6 +17,7 @@ PROGS-$(CONFIG_FFSERVER) += ffserver ...@@ -17,6 +17,7 @@ PROGS-$(CONFIG_FFSERVER) += ffserver
PROGS := $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF)) PROGS := $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF)) INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
OBJS = cmdutils.o $(EXEOBJS) OBJS = cmdutils.o $(EXEOBJS)
OBJS-ffmpeg = ffmpeg_opt.o ffmpeg_filter.o OBJS-ffmpeg = ffmpeg_opt.o ffmpeg_filter.o
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
......
...@@ -56,6 +56,9 @@ COMPILE_S = $(call COMPILE,AS) ...@@ -56,6 +56,9 @@ COMPILE_S = $(call COMPILE,AS)
%.o: %.S %.o: %.S
$(COMPILE_S) $(COMPILE_S)
%.i: %.c
$(CC) $(CCFLAGS) $(CC_E) $<
%.h.c: %.h.c:
$(Q)echo '#include "$*.h"' >$@ $(Q)echo '#include "$*.h"' >$@
......
...@@ -4243,6 +4243,7 @@ ASFLAGS=$ASFLAGS ...@@ -4243,6 +4243,7 @@ ASFLAGS=$ASFLAGS
AS_C=$AS_C AS_C=$AS_C
AS_O=$AS_O AS_O=$AS_O
CC_C=$CC_C CC_C=$CC_C
CC_E=$CC_E
CC_O=$CC_O CC_O=$CC_O
CXX_C=$CXX_C CXX_C=$CXX_C
CXX_O=$CXX_O CXX_O=$CXX_O
......
...@@ -178,20 +178,19 @@ static inline int hpel_motion(MpegEncContext *s, ...@@ -178,20 +178,19 @@ static inline int hpel_motion(MpegEncContext *s,
op_pixels_func *pix_op, op_pixels_func *pix_op,
int motion_x, int motion_y) int motion_x, int motion_y)
{ {
int dxy; int dxy = 0;
int emu=0; int emu=0;
dxy = ((motion_y & 1) << 1) | (motion_x & 1);
src_x += motion_x >> 1; src_x += motion_x >> 1;
src_y += motion_y >> 1; src_y += motion_y >> 1;
/* WARNING: do no forget half pels */ /* WARNING: do no forget half pels */
src_x = av_clip(src_x, -16, s->width); //FIXME unneeded for emu? src_x = av_clip(src_x, -16, s->width); //FIXME unneeded for emu?
if (src_x == s->width) if (src_x != s->width)
dxy &= ~1; dxy |= motion_x & 1;
src_y = av_clip(src_y, -16, s->height); src_y = av_clip(src_y, -16, s->height);
if (src_y == s->height) if (src_y != s->height)
dxy &= ~2; dxy |= (motion_y & 1) << 1;
src += src_y * s->linesize + src_x; src += src_y * s->linesize + src_x;
if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){ if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
......
...@@ -246,29 +246,93 @@ void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem) ...@@ -246,29 +246,93 @@ void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem)
*nb_ptr = nb; *nb_ptr = nb;
} }
static void fill16(uint8_t *dst, int len)
{
uint32_t v = AV_RN16(dst - 2);
v |= v << 16;
while (len >= 4) {
AV_WN32(dst, v);
dst += 4;
len -= 4;
}
while (len--) {
*dst = dst[-2];
dst++;
}
}
static void fill24(uint8_t *dst, int len)
{
#if HAVE_BIGENDIAN
uint32_t v = AV_RB24(dst - 3);
uint32_t a = v << 8 | v >> 16;
uint32_t b = v << 16 | v >> 8;
uint32_t c = v << 24 | v;
#else
uint32_t v = AV_RL24(dst - 3);
uint32_t a = v | v << 24;
uint32_t b = v >> 8 | v << 16;
uint32_t c = v >> 16 | v << 8;
#endif
while (len >= 12) {
AV_WN32(dst, a);
AV_WN32(dst + 4, b);
AV_WN32(dst + 8, c);
dst += 12;
len -= 12;
}
if (len >= 4) {
AV_WN32(dst, a);
dst += 4;
len -= 4;
}
if (len >= 4) {
AV_WN32(dst, b);
dst += 4;
len -= 4;
}
while (len--) {
*dst = dst[-3];
dst++;
}
}
static void fill32(uint8_t *dst, int len)
{
uint32_t v = AV_RN32(dst - 4);
while (len >= 4) {
AV_WN32(dst, v);
dst += 4;
len -= 4;
}
while (len--) {
*dst = dst[-4];
dst++;
}
}
void av_memcpy_backptr(uint8_t *dst, int back, int cnt) void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
{ {
const uint8_t *src = &dst[-back]; const uint8_t *src = &dst[-back];
if (back <= 1) { if (back <= 1) {
memset(dst, *src, cnt); memset(dst, *src, cnt);
} else if (back == 2) {
fill16(dst, cnt);
} else if (back == 3) {
fill24(dst, cnt);
} else if (back == 4) {
fill32(dst, cnt);
} else { } else {
if (cnt >= 4) { if (cnt >= 16) {
AV_COPY16U(dst, src);
AV_COPY16U(dst + 2, src + 2);
src += 4;
dst += 4;
cnt -= 4;
}
if (cnt >= 8) {
AV_COPY16U(dst, src);
AV_COPY16U(dst + 2, src + 2);
AV_COPY16U(dst + 4, src + 4);
AV_COPY16U(dst + 6, src + 6);
src += 8;
dst += 8;
cnt -= 8;
}
if (cnt > 0) {
int blocklen = back; int blocklen = back;
while (cnt > blocklen) { while (cnt > blocklen) {
memcpy(dst, src, blocklen); memcpy(dst, src, blocklen);
...@@ -277,7 +341,29 @@ void av_memcpy_backptr(uint8_t *dst, int back, int cnt) ...@@ -277,7 +341,29 @@ void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
blocklen <<= 1; blocklen <<= 1;
} }
memcpy(dst, src, cnt); memcpy(dst, src, cnt);
return;
}
if (cnt >= 8) {
AV_COPY32U(dst, src);
AV_COPY32U(dst + 4, src + 4);
src += 8;
dst += 8;
cnt -= 8;
}
if (cnt >= 4) {
AV_COPY32U(dst, src);
src += 4;
dst += 4;
cnt -= 4;
}
if (cnt >= 2) {
AV_COPY16U(dst, src);
src += 2;
dst += 2;
cnt -= 2;
} }
if (cnt)
*dst = *src;
} }
} }
...@@ -17,12 +17,19 @@ $(SUBDIR)%-test.o: $(SUBDIR)%-test.c ...@@ -17,12 +17,19 @@ $(SUBDIR)%-test.o: $(SUBDIR)%-test.c
$(SUBDIR)%-test.o: $(SUBDIR)%.c $(SUBDIR)%-test.o: $(SUBDIR)%.c
$(COMPILE_C) $(COMPILE_C)
$(SUBDIR)%-test.i: $(SUBDIR)%-test.c
$(CC) $(CCFLAGS) $(CC_E) $<
$(SUBDIR)%-test.i: $(SUBDIR)%.c
$(CC) $(CCFLAGS) $(CC_E) $<
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm $(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
$(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d) $(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
$(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $< $(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
$(OBJS) $(OBJS:.o=.s) $(SUBDIR)%.h.o $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
$(TESTOBJS): CPPFLAGS += -DTEST $(LIBOBJS) $(LIBOBJS:.o=.s) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
$(TESTOBJS) $(TESTOBJS:.o=.i): CPPFLAGS += -DTEST
$(SUBDIR)$(LIBNAME): $(OBJS) $(SUBDIR)$(LIBNAME): $(OBJS)
$(RM) $@ $(RM) $@
......
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