From 2ddf7c88d162473e84417e94e1fb7e4375ecfdae Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 9 Dec 2012 10:24:16 +0100 Subject: [PATCH 1/2] ZeroCodec: Flip output The initial testing of the VFW binary codec was flawed, likely due to an AviSynth bug. Re-testing using VirtualDub and various professional editing applications has revealed it should have been flipped. Signed-off-by: Derek Buitenhuis --- libavcodec/version.h | 2 +- libavcodec/zerocodec.c | 9 +++-- tests/ref/fate/zerocodec | 76 ++++++++++++++++++++-------------------- 3 files changed, 45 insertions(+), 42 deletions(-) diff --git a/libavcodec/version.h b/libavcodec/version.h index d170f67ec5..d77c0787f8 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #define LIBAVCODEC_VERSION_MAJOR 54 #define LIBAVCODEC_VERSION_MINOR 34 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index f54abb1c1b..cba3198473 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -49,6 +49,9 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n"); return AVERROR_INVALIDDATA; } + + prev += (avctx->height - 1) * prev_pic->linesize[0]; + pic->key_frame = 0; pic->pict_type = AV_PICTURE_TYPE_P; } @@ -67,7 +70,7 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, zstream->next_in = avpkt->data; zstream->avail_in = avpkt->size; - dst = pic->data[0]; + dst = pic->data[0] + (avctx->height - 1) * pic->linesize[0]; /** * ZeroCodec has very simple interframe compression. If a value @@ -90,8 +93,8 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, for (j = 0; j < avctx->width << 1; j++) dst[j] += prev[j] & -!dst[j]; - prev += prev_pic->linesize[0]; - dst += pic->linesize[0]; + prev -= prev_pic->linesize[0]; + dst -= pic->linesize[0]; } /* Release the previous buffer if need be */ diff --git a/tests/ref/fate/zerocodec b/tests/ref/fate/zerocodec index 4d358ca8a8..2d368c3764 100644 --- a/tests/ref/fate/zerocodec +++ b/tests/ref/fate/zerocodec @@ -1,39 +1,39 @@ #tb 0: 417083/10000000 -0, 0, 0, 1, 1843200, 0x09f24bd5 -0, 1, 1, 1, 1843200, 0x8c932d04 -0, 2, 2, 1, 1843200, 0xe04904a0 -0, 3, 3, 1, 1843200, 0x1969f383 -0, 4, 4, 1, 1843200, 0x70781331 -0, 5, 5, 1, 1843200, 0xf494496b -0, 6, 6, 1, 1843200, 0xf6226da2 -0, 7, 7, 1, 1843200, 0x5d657925 -0, 8, 8, 1, 1843200, 0xde15820d -0, 9, 9, 1, 1843200, 0xb6768df1 -0, 10, 10, 1, 1843200, 0xc4318e08 -0, 11, 11, 1, 1843200, 0x8530a7d5 -0, 12, 12, 1, 1843200, 0x0ee29f10 -0, 13, 13, 1, 1843200, 0xcbb6b185 -0, 14, 14, 1, 1843200, 0x085aac47 -0, 15, 15, 1, 1843200, 0xb42e7b1b -0, 16, 16, 1, 1843200, 0xea3a2cd6 -0, 17, 17, 1, 1843200, 0x7600ee09 -0, 18, 18, 1, 1843200, 0xe39fc9d4 -0, 19, 19, 1, 1843200, 0xc122cd4c -0, 20, 20, 1, 1843200, 0x5fb4c1cb -0, 21, 21, 1, 1843200, 0x1552cb6c -0, 22, 22, 1, 1843200, 0x5b66ce2f -0, 23, 23, 1, 1843200, 0x70a8c318 -0, 24, 24, 1, 1843200, 0x8b86af2d -0, 25, 25, 1, 1843200, 0x94886a49 -0, 26, 26, 1, 1843200, 0xda05684f -0, 27, 27, 1, 1843200, 0xe57c8f33 -0, 28, 28, 1, 1843200, 0x39ef9c7e -0, 29, 29, 1, 1843200, 0xe7a0cab8 -0, 30, 30, 1, 1843200, 0x43f0d766 -0, 31, 31, 1, 1843200, 0x733d3c7b -0, 32, 32, 1, 1843200, 0x42713cea -0, 33, 33, 1, 1843200, 0xdd844e53 -0, 34, 34, 1, 1843200, 0xa0875ba8 -0, 35, 35, 1, 1843200, 0x318b6114 -0, 36, 36, 1, 1843200, 0xcc986275 -0, 37, 37, 1, 1843200, 0x14eb6704 +0, 0, 0, 1, 1843200, 0x04154bd5 +0, 1, 1, 1, 1843200, 0x3a872d04 +0, 2, 2, 1, 1843200, 0x3b1304a0 +0, 3, 3, 1, 1843200, 0x7474f383 +0, 4, 4, 1, 1843200, 0xce7d1331 +0, 5, 5, 1, 1843200, 0x3cdf496b +0, 6, 6, 1, 1843200, 0xe9096da2 +0, 7, 7, 1, 1843200, 0x30be7925 +0, 8, 8, 1, 1843200, 0x600b820d +0, 9, 9, 1, 1843200, 0xe7bb8df1 +0, 10, 10, 1, 1843200, 0x62848e08 +0, 11, 11, 1, 1843200, 0x9a71a7d5 +0, 12, 12, 1, 1843200, 0x743a9f10 +0, 13, 13, 1, 1843200, 0x62b0b185 +0, 14, 14, 1, 1843200, 0xd94eac47 +0, 15, 15, 1, 1843200, 0xa1007b1b +0, 16, 16, 1, 1843200, 0x11d72cd6 +0, 17, 17, 1, 1843200, 0x141aee09 +0, 18, 18, 1, 1843200, 0x9a90c9d4 +0, 19, 19, 1, 1843200, 0x6bd5cd4c +0, 20, 20, 1, 1843200, 0xdf2ec1cb +0, 21, 21, 1, 1843200, 0xeecbcb6c +0, 22, 22, 1, 1843200, 0x9ecace2f +0, 23, 23, 1, 1843200, 0x7b59c318 +0, 24, 24, 1, 1843200, 0x050baf2d +0, 25, 25, 1, 1843200, 0xada36a49 +0, 26, 26, 1, 1843200, 0x4f4d684f +0, 27, 27, 1, 1843200, 0x9ddc8f33 +0, 28, 28, 1, 1843200, 0x914d9c7e +0, 29, 29, 1, 1843200, 0x0dc3cab8 +0, 30, 30, 1, 1843200, 0x98f8d766 +0, 31, 31, 1, 1843200, 0x872e3c7b +0, 32, 32, 1, 1843200, 0xdf7b3cea +0, 33, 33, 1, 1843200, 0xf7864e53 +0, 34, 34, 1, 1843200, 0x13315ba8 +0, 35, 35, 1, 1843200, 0xc4586114 +0, 36, 36, 1, 1843200, 0x57a96275 +0, 37, 37, 1, 1843200, 0x6e756704 From 395c3feb3bb165af5760d287a9a64344b6269fe2 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 10 Dec 2012 14:55:28 +0000 Subject: [PATCH 2/2] build: fix 'clean' target This fixes removal of TOOLS as well as HOSTPROGS declared in the top-level Makefile. The clean target in common.mak needs to be eval'd since the variables used within are reset for each library. Signed-off-by: Mans Rullgard --- Makefile | 1 - common.mak | 6 ++++++ library.mak | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c4dc80c1f3..291197bc2a 100644 --- a/Makefile +++ b/Makefile @@ -187,7 +187,6 @@ uninstall-data: clean:: $(RM) $(ALLPROGS) $(RM) $(CLEANSUFFIXES) - $(RM) $(TOOLS) $(RM) $(CLEANSUFFIXES:%=tools/%) distclean:: diff --git a/common.mak b/common.mak index c4d299960e..5d80986aab 100644 --- a/common.mak +++ b/common.mak @@ -53,7 +53,13 @@ CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver DISTCLEANSUFFIXES = *.pc LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a +define RULES clean:: $(RM) $(OBJS) $(OBJS:.o=.d) + $(RM) $(HOSTPROGS) + $(RM) $(TOOLS) +endef + +$(eval $(RULES)) -include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d)) diff --git a/library.mak b/library.mak index 9309c42e5d..3b4bd2d161 100644 --- a/library.mak +++ b/library.mak @@ -58,7 +58,7 @@ $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver $(DEP_LIBS) clean:: $(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \ - $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) $(HOSTOBJS) $(HOSTPROGS) + $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) distclean:: clean $(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%)