From 6d5600e8556a632ca62a2807d994c40251db3bdd Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 1 Oct 2012 04:18:02 +0200 Subject: [PATCH 1/7] avutil: add yuva422p and yuva444p formats --- libavcodec/utils.c | 2 ++ libavutil/pixdesc.c | 26 ++++++++++++++++++++++++++ libavutil/pixfmt.h | 2 ++ libswscale/utils.c | 2 ++ tests/ref/lavfi/pixdesc | 2 ++ tests/ref/lavfi/pixfmts_copy | 2 ++ tests/ref/lavfi/pixfmts_null | 2 ++ tests/ref/lavfi/pixfmts_scale | 2 ++ tests/ref/lavfi/pixfmts_vflip | 2 ++ 9 files changed, 42 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 90afdd3031..4a3ac72b6c 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -180,6 +180,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, case AV_PIX_FMT_YUVJ440P: case AV_PIX_FMT_YUVJ444P: case AV_PIX_FMT_YUVA420P: + case AV_PIX_FMT_YUVA422P: + case AV_PIX_FMT_YUVA444P: case AV_PIX_FMT_YUV420P9LE: case AV_PIX_FMT_YUV420P9BE: case AV_PIX_FMT_YUV420P10LE: diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 3a1f9fe957..b8cfabd6ef 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -531,6 +531,32 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { { 3, 0, 1, 0, 7 }, /* A */ }, .flags = PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA422P] = { + .name = "yuva422p", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 0, 1, 0, 7 }, /* Y */ + { 1, 0, 1, 0, 7 }, /* U */ + { 2, 0, 1, 0, 7 }, /* V */ + { 3, 0, 1, 0, 7 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA444P] = { + .name = "yuva444p", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 0, 1, 0, 7 }, /* Y */ + { 1, 0, 1, 0, 7 }, /* U */ + { 2, 0, 1, 0, 7 }, /* V */ + { 3, 0, 1, 0, 7 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, }, [AV_PIX_FMT_VDPAU_H264] = { .name = "vdpau_h264", diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index fbc2845a15..b11a0340db 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -158,6 +158,8 @@ enum AVPixelFormat { AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions #if FF_API_PIX_FMT diff --git a/libswscale/utils.c b/libswscale/utils.c index 440cce7a09..4001606a1b 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -108,6 +108,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_YUV440P] = { 1, 1 }, [AV_PIX_FMT_YUVJ440P] = { 1, 1 }, [AV_PIX_FMT_YUVA420P] = { 1, 1 }, + [AV_PIX_FMT_YUVA422P] = { 1, 1 }, + [AV_PIX_FMT_YUVA444P] = { 1, 1 }, [AV_PIX_FMT_RGB48BE] = { 1, 1 }, [AV_PIX_FMT_RGB48LE] = { 1, 1 }, [AV_PIX_FMT_RGB565BE] = { 1, 1 }, diff --git a/tests/ref/lavfi/pixdesc b/tests/ref/lavfi/pixdesc index 5dfa270021..dc1b8572dc 100644 --- a/tests/ref/lavfi/pixdesc +++ b/tests/ref/lavfi/pixdesc @@ -57,6 +57,8 @@ yuv444p16le 20f86bc2f68d2b3f1f2b48b97b2189f4 yuv444p9be 6ab31f4c12b533ce318ecdff83cdd054 yuv444p9le f0606604a5c08becab6ba500124c4b7c yuva420p a29884f3f3dfe1e00b961bc17bef3d47 +yuva422p 92b6815f465297284cdb843711682cee +yuva444p c523716e4900cfe515eaab1d7124fdd9 yuvj420p 32eec78ba51857b16ce9b813a49b7189 yuvj422p 0dfa0ed434f73be51428758c69e082cb yuvj440p 657501a28004e27a592757a7509f5189 diff --git a/tests/ref/lavfi/pixfmts_copy b/tests/ref/lavfi/pixfmts_copy index 5dfa270021..dc1b8572dc 100644 --- a/tests/ref/lavfi/pixfmts_copy +++ b/tests/ref/lavfi/pixfmts_copy @@ -57,6 +57,8 @@ yuv444p16le 20f86bc2f68d2b3f1f2b48b97b2189f4 yuv444p9be 6ab31f4c12b533ce318ecdff83cdd054 yuv444p9le f0606604a5c08becab6ba500124c4b7c yuva420p a29884f3f3dfe1e00b961bc17bef3d47 +yuva422p 92b6815f465297284cdb843711682cee +yuva444p c523716e4900cfe515eaab1d7124fdd9 yuvj420p 32eec78ba51857b16ce9b813a49b7189 yuvj422p 0dfa0ed434f73be51428758c69e082cb yuvj440p 657501a28004e27a592757a7509f5189 diff --git a/tests/ref/lavfi/pixfmts_null b/tests/ref/lavfi/pixfmts_null index 5dfa270021..dc1b8572dc 100644 --- a/tests/ref/lavfi/pixfmts_null +++ b/tests/ref/lavfi/pixfmts_null @@ -57,6 +57,8 @@ yuv444p16le 20f86bc2f68d2b3f1f2b48b97b2189f4 yuv444p9be 6ab31f4c12b533ce318ecdff83cdd054 yuv444p9le f0606604a5c08becab6ba500124c4b7c yuva420p a29884f3f3dfe1e00b961bc17bef3d47 +yuva422p 92b6815f465297284cdb843711682cee +yuva444p c523716e4900cfe515eaab1d7124fdd9 yuvj420p 32eec78ba51857b16ce9b813a49b7189 yuvj422p 0dfa0ed434f73be51428758c69e082cb yuvj440p 657501a28004e27a592757a7509f5189 diff --git a/tests/ref/lavfi/pixfmts_scale b/tests/ref/lavfi/pixfmts_scale index 4a5bf676d9..acd40e3451 100644 --- a/tests/ref/lavfi/pixfmts_scale +++ b/tests/ref/lavfi/pixfmts_scale @@ -57,6 +57,8 @@ yuv444p16le a0c5d3c7bf3f181db503cf8e450d1335 yuv444p9be 9ac2643ce7f7e5c4e17c8c9fd8494d4a yuv444p9le 896a1cc9cccca1ba410dd53942d33cc4 yuva420p 8673a9131fb47de69788863f93a50eb7 +yuva422p 3c76ebeca0a7d3aa5f8e31ef80a86ffe +yuva444p 3268c6abe5e3cdbd16552a1eddced816 yuvj420p 30427bd6caf5bda93a173dbebe759e09 yuvj422p fc8288f64fd149573f73cf8da05d8e6d yuvj440p 508ac7a9ddeb6d1794a1100ba7a1664c diff --git a/tests/ref/lavfi/pixfmts_vflip b/tests/ref/lavfi/pixfmts_vflip index f21927bdad..a4dffb9c22 100644 --- a/tests/ref/lavfi/pixfmts_vflip +++ b/tests/ref/lavfi/pixfmts_vflip @@ -57,6 +57,8 @@ yuv444p16le 8e83323cf102d6c823a03ae8a7b7e033 yuv444p9be 6ac92b7dc9ab2fc59bee99204886899a yuv444p9le 85aef13a654953d3455d89770b0d74bd yuva420p c705d1cf061d8c6580ac690b55f92276 +yuva422p 6aed0ea657ed51cc047a4fbdd981aec8 +yuva444p da5d64f2b2bd2013c186456f595fad65 yuvj420p 41fd02b204da0ab62452cd14b595e2e4 yuvj422p 7f6ca9bc1812cde02036d7d29a7cce43 yuvj440p 25711c3c0fd15ec19c59a10784fcfb96 From 0bf511d579c7b21f1244eec688abf571ca1235bd Mon Sep 17 00:00:00 2001 From: Sami Pietila Date: Fri, 12 Oct 2012 07:12:49 -0700 Subject: [PATCH 2/7] vp8: reset loopfilter delta values at keyframes. Signed-off-by: Ronald S. Bultje --- libavcodec/vp8.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index e365877bed..2766c9e37c 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -353,6 +353,7 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) memcpy(s->prob->pred8x8c , vp8_pred8x8c_prob_inter , sizeof(s->prob->pred8x8c)); memcpy(s->prob->mvc , vp8_mv_default_prob , sizeof(s->prob->mvc)); memset(&s->segmentation, 0, sizeof(s->segmentation)); + memset(&s->lf_delta, 0, sizeof(s->lf_delta)); } ff_vp56_init_range_decoder(c, buf, header_size); From eae35eadc0ae943598ed3f971245fe39a1cd213b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 11 Oct 2012 23:57:08 +0200 Subject: [PATCH 3/7] rtspdec: Fix use of uninitialized byte MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ffurl_read_complete can return 0 as well as negative error codes. Signed-off-by: Martin Storsjö --- libavformat/rtspdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 7476c45ba8..d46f1a4872 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -76,8 +76,8 @@ static inline int read_line(AVFormatContext *s, char *rbuf, const int rbufsize, do { ret = ffurl_read_complete(rt->rtsp_hd, rbuf + idx, 1); - if (ret < 0) - return ret; + if (ret <= 0) + return ret ? ret : AVERROR_EOF; if (rbuf[idx] == '\r') { /* Ignore */ } else if (rbuf[idx] == '\n') { From 2f1b2ff934e672c7ad5d8f1efe887350edc4daec Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 12 Oct 2012 02:06:51 +0200 Subject: [PATCH 4/7] rtmpproto: Fix an out of array write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/rtmpproto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index a5bc246e31..3ab2e57e62 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -1371,9 +1371,9 @@ static int rtmp_server_handshake(URLContext *s, RTMPContext *rt) /* By now same epoch will be sent */ hs_my_epoch = hs_epoch; /* Generate random */ - for (randomidx = 0; randomidx < (RTMP_HANDSHAKE_PACKET_SIZE); + for (randomidx = 8; randomidx < (RTMP_HANDSHAKE_PACKET_SIZE); randomidx += 4) - AV_WB32(hs_s1 + 8 + randomidx, av_get_random_seed()); + AV_WB32(hs_s1 + randomidx, av_get_random_seed()); ret = rtmp_send_hs_packet(rt, hs_my_epoch, 0, hs_s1, RTMP_HANDSHAKE_PACKET_SIZE); From c80b59f679a0ac861bc30f6b5469032884e42ab6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 12 Oct 2012 02:26:50 +0200 Subject: [PATCH 5/7] tscc2: Fix an out of array access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/tscc2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c index 1b2a3a4990..36287137ad 100644 --- a/libavcodec/tscc2.c +++ b/libavcodec/tscc2.c @@ -173,7 +173,7 @@ static int tscc2_decode_mb(TSCC2Context *c, int *q, int vlc_set, if (ac == 0x1000) ac = get_bits(gb, 12); bpos += ac & 0xF; - if (bpos >= 64) + if (bpos >= 16) return AVERROR_INVALIDDATA; val = sign_extend(ac >> 4, 8); c->block[tscc2_zigzag[bpos++]] = val; From 5a2cb78219168af7a0f446cd97dbac2d3c1868e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 12 Oct 2012 11:10:09 +0300 Subject: [PATCH 6/7] rtspdec: Set the default port for listen mode, if none is specified MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/rtspdec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index d46f1a4872..7e7fb2dcfd 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -621,6 +621,10 @@ static int rtsp_listen(AVFormatContext *s) /* ff_url_join. No authorization by now (NULL) */ ff_url_join(rt->control_uri, sizeof(rt->control_uri), "rtsp", NULL, host, port, "%s", path); + + if (port < 0) + port = RTSP_DEFAULT_PORT; + /* Create TCP connection */ ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, "?listen&listen_timeout=%d", rt->initial_timeout * 1000); From f6c38c5f4ed6683a6a61db2ed418a68bbe5f5507 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 29 Aug 2012 19:37:14 +0200 Subject: [PATCH 7/7] avfilter: call x86 init functions under if (ARCH_X86), not if (HAVE_MMX) --- libavfilter/vf_gradfun.c | 2 +- libavfilter/vf_yadif.c | 2 +- libavfilter/x86/Makefile | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c index 7fbcf1a578..2ee8b5d60d 100644 --- a/libavfilter/vf_gradfun.c +++ b/libavfilter/vf_gradfun.c @@ -135,7 +135,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args) gf->blur_line = ff_gradfun_blur_line_c; gf->filter_line = ff_gradfun_filter_line_c; - if (HAVE_MMX) + if (ARCH_X86) ff_gradfun_init_x86(gf); av_log(ctx, AV_LOG_VERBOSE, "threshold:%.2f radius:%d\n", thresh, gf->radius); diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 947aaac49a..1c605d942d 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -400,7 +400,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args) yadif->filter_line = filter_line_c; - if (HAVE_MMX) + if (ARCH_X86) ff_yadif_init_x86(yadif); av_log(ctx, AV_LOG_VERBOSE, "mode:%d parity:%d auto_enable:%d\n", diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile index 46fc84f3ec..4289f924da 100644 --- a/libavfilter/x86/Makefile +++ b/libavfilter/x86/Makefile @@ -1,3 +1,4 @@ -MMX-OBJS-$(CONFIG_YADIF_FILTER) += x86/yadif.o -MMX-OBJS-$(CONFIG_GRADFUN_FILTER) += x86/gradfun.o +OBJS-$(CONFIG_GRADFUN_FILTER) += x86/gradfun.o +OBJS-$(CONFIG_YADIF_FILTER) += x86/yadif.o + YASM-OBJS-$(CONFIG_HQDN3D_FILTER) += x86/hqdn3d.o