From 99162f8d46db7ec02facae035c4ff573d2d8d612 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 26 Jan 2013 20:49:16 +0100 Subject: [PATCH 1/3] vf_yadif: silence a warning. clang says: libavfilter/vf_yadif.c:192:28: warning: incompatible pointer types assigning to 'void (*)(uint8_t *, uint8_t *, uint8_t *, uint8_t *, int, int, int, int, int)' from 'void (uint16_t *, uint16_t *, uint16_t *, uint16_t *, int, int, int, int, int)' --- libavfilter/vf_yadif.c | 16 ++++++++++++---- libavfilter/x86/vf_yadif_init.c | 12 ++++++------ libavfilter/yadif.h | 4 ++-- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index db9c71c973..ae49013a70 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -81,10 +81,14 @@ next2++; \ } -static void filter_line_c(uint8_t *dst, - uint8_t *prev, uint8_t *cur, uint8_t *next, +static void filter_line_c(void *dst1, + void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int parity, int mode) { + uint8_t *dst = dst1; + uint8_t *prev = prev1; + uint8_t *cur = cur1; + uint8_t *next = next1; int x; uint8_t *prev2 = parity ? prev : cur ; uint8_t *next2 = parity ? cur : next; @@ -92,11 +96,15 @@ static void filter_line_c(uint8_t *dst, FILTER } -static void filter_line_c_16bit(uint16_t *dst, - uint16_t *prev, uint16_t *cur, uint16_t *next, +static void filter_line_c_16bit(void *dst1, + void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int parity, int mode) { + uint16_t *dst = dst1; + uint16_t *prev = prev1; + uint16_t *cur = cur1; + uint16_t *next = next1; int x; uint16_t *prev2 = parity ? prev : cur ; uint16_t *next2 = parity ? cur : next; diff --git a/libavfilter/x86/vf_yadif_init.c b/libavfilter/x86/vf_yadif_init.c index 0cee8e56b4..2ffeca0f76 100644 --- a/libavfilter/x86/vf_yadif_init.c +++ b/libavfilter/x86/vf_yadif_init.c @@ -27,14 +27,14 @@ #include "libavcodec/x86/dsputil_mmx.h" #include "libavfilter/yadif.h" -void ff_yadif_filter_line_mmxext(uint8_t *dst, uint8_t *prev, uint8_t *cur, - uint8_t *next, int w, int prefs, +void ff_yadif_filter_line_mmxext(void *dst, void *prev, void *cur, + void *next, int w, int prefs, int mrefs, int parity, int mode); -void ff_yadif_filter_line_sse2(uint8_t *dst, uint8_t *prev, uint8_t *cur, - uint8_t *next, int w, int prefs, +void ff_yadif_filter_line_sse2(void *dst, void *prev, void *cur, + void *next, int w, int prefs, int mrefs, int parity, int mode); -void ff_yadif_filter_line_ssse3(uint8_t *dst, uint8_t *prev, uint8_t *cur, - uint8_t *next, int w, int prefs, +void ff_yadif_filter_line_ssse3(void *dst, void *prev, void *cur, + void *next, int w, int prefs, int mrefs, int parity, int mode); av_cold void ff_yadif_init_x86(YADIFContext *yadif) diff --git a/libavfilter/yadif.h b/libavfilter/yadif.h index 06b39c69de..e6f713b26c 100644 --- a/libavfilter/yadif.h +++ b/libavfilter/yadif.h @@ -50,8 +50,8 @@ typedef struct YADIFContext { AVFilterBufferRef *next; AVFilterBufferRef *prev; AVFilterBufferRef *out; - void (*filter_line)(uint8_t *dst, - uint8_t *prev, uint8_t *cur, uint8_t *next, + void (*filter_line)(void *dst, + void *prev, void *cur, void *next, int w, int prefs, int mrefs, int parity, int mode); const AVPixFmtDescriptor *csp; From 6ed9fc44badb256bdf235e700702bee46a9f6527 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 26 Jan 2013 21:10:54 +0100 Subject: [PATCH 2/3] svq1: replace struct svq1_frame_size with an array. It is used as an array in svq1enc, so this is more correct. --- libavcodec/svq1.c | 2 +- libavcodec/svq1.h | 7 +------ libavcodec/svq1dec.c | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/libavcodec/svq1.c b/libavcodec/svq1.c index e20fa43344..545df80974 100644 --- a/libavcodec/svq1.c +++ b/libavcodec/svq1.c @@ -37,7 +37,7 @@ #include "svq1_vlc.h" /* standard video sizes */ -const struct svq1_frame_size ff_svq1_frame_size_table[7] = { +const uint16_t ff_svq1_frame_size_table[7][2] = { { 160, 120 }, { 128, 96 }, { 176, 144 }, { 352, 288 }, { 704, 576 }, { 240, 180 }, { 320, 240 } }; diff --git a/libavcodec/svq1.h b/libavcodec/svq1.h index b2055faa38..70b5c37be2 100644 --- a/libavcodec/svq1.h +++ b/libavcodec/svq1.h @@ -42,11 +42,6 @@ #define SVQ1_BLOCK_INTER_4V 2 #define SVQ1_BLOCK_INTRA 3 -struct svq1_frame_size { - uint16_t width; - uint16_t height; -}; - uint16_t ff_svq1_packet_checksum(const uint8_t *data, const int length, int value); @@ -59,6 +54,6 @@ extern const uint8_t ff_svq1_inter_multistage_vlc[6][8][2]; extern const uint16_t ff_svq1_intra_mean_vlc[256][2]; extern const uint16_t ff_svq1_inter_mean_vlc[512][2]; -extern const struct svq1_frame_size ff_svq1_frame_size_table[7]; +extern const uint16_t ff_svq1_frame_size_table[7][2]; #endif /* AVCODEC_SVQ1_H */ diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c index 515604222b..dc041dd0d7 100644 --- a/libavcodec/svq1dec.c +++ b/libavcodec/svq1dec.c @@ -579,8 +579,8 @@ static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame) return AVERROR_INVALIDDATA; } else { /* get width, height from table */ - s->width = ff_svq1_frame_size_table[frame_size_code].width; - s->height = ff_svq1_frame_size_table[frame_size_code].height; + s->width = ff_svq1_frame_size_table[frame_size_code][0]; + s->height = ff_svq1_frame_size_table[frame_size_code][1]; } } From 238614de679a71970c20d7c3fee08a322967ec40 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 26 Jan 2013 22:02:19 +0100 Subject: [PATCH 3/3] cdgraphics: do not rely on get_buffer() initializing the frame. Setting it to zero (instead of 128, as the default get_buffer() does) also produces more correctly-looking output. --- cmdutils.c | 2 +- libavcodec/cdgraphics.c | 2 ++ tests/ref/fate/cdgraphics | 32 ++++++++++++++++---------------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index dc7e7b2e65..9aec9ae5ae 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1566,7 +1566,7 @@ static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbu /* XXX this shouldn't be needed, but some tests break without this line * those decoders are buggy and need to be fixed. * the following tests fail: - * cdgraphics, ansi, aasc, fraps-v1, qtrle-1bit + * ansi, aasc, fraps-v1, qtrle-1bit */ memset(buf->base[0], 128, ret); diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index e4ed83b9d4..9f402cae21 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -287,6 +287,8 @@ static int cdg_decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } + if (!avctx->frame_number) + memset(cc->frame.data[0], 0, cc->frame.linesize[0] * avctx->height); command = bytestream_get_byte(&buf); inst = bytestream_get_byte(&buf); diff --git a/tests/ref/fate/cdgraphics b/tests/ref/fate/cdgraphics index 78a8f28880..dccb2b5c36 100644 --- a/tests/ref/fate/cdgraphics +++ b/tests/ref/fate/cdgraphics @@ -1,20 +1,20 @@ #tb 0: 1/300 -0, 0, 0, 1, 194400, 0xd919c635 -0, 1, 1, 1, 194400, 0xd919c635 -0, 2, 2, 1, 194400, 0x516a1007 -0, 3, 3, 1, 194400, 0x516a1007 -0, 4, 4, 1, 194400, 0x516a1007 -0, 5, 5, 1, 194400, 0x516a1007 -0, 6, 6, 1, 194400, 0x516a1007 -0, 7, 7, 1, 194400, 0x516a1007 -0, 8, 8, 1, 194400, 0x516a1007 -0, 9, 9, 1, 194400, 0x516a1007 -0, 10, 10, 1, 194400, 0x516a1007 -0, 11, 11, 1, 194400, 0x516a1007 -0, 12, 12, 1, 194400, 0x516a1007 -0, 13, 13, 1, 194400, 0x516a1007 -0, 14, 14, 1, 194400, 0x516a1007 -0, 15, 15, 1, 194400, 0x516a1007 +0, 0, 0, 1, 194400, 0x46ad80da +0, 1, 1, 1, 194400, 0x46ad80da +0, 2, 2, 1, 194400, 0x9392c3b9 +0, 3, 3, 1, 194400, 0x9392c3b9 +0, 4, 4, 1, 194400, 0x9392c3b9 +0, 5, 5, 1, 194400, 0x9392c3b9 +0, 6, 6, 1, 194400, 0x9392c3b9 +0, 7, 7, 1, 194400, 0x9392c3b9 +0, 8, 8, 1, 194400, 0x9392c3b9 +0, 9, 9, 1, 194400, 0x9392c3b9 +0, 10, 10, 1, 194400, 0x9392c3b9 +0, 11, 11, 1, 194400, 0x9392c3b9 +0, 12, 12, 1, 194400, 0x9392c3b9 +0, 13, 13, 1, 194400, 0x9392c3b9 +0, 14, 14, 1, 194400, 0x9392c3b9 +0, 15, 15, 1, 194400, 0x9392c3b9 0, 16, 16, 1, 194400, 0x46ad80da 0, 17, 17, 1, 194400, 0x46ad80da 0, 18, 18, 1, 194400, 0x46ad80da