Re: [FFmpeg-devel] [PATCH v2 4/8] aacenc: reset marked IS and M/S bands upon frame encoding
On Fri, Jul 03, 2015 at 12:02:18AM -0300, Claudio Freire wrote: On Thu, Jul 2, 2015 at 3:13 PM, Rostislav Pehlivanov atomnu...@gmail.com wrote: This commit resets any bands marked as M/S or IS upon encoding a frame. This is needed because the arrays may contain some residual information upon allocation on startup and because there isn't any mechanism to reset the arrays once the frame has been encoded. --- libavcodec/aacenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 3a512ff..05a8162 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -617,6 +617,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, tag = s-chan_map[i+1]; chans= tag == TYPE_CPE ? 2 : 1; cpe = s-cpe[i]; +memset(cpe-is_mask, 0, sizeof(cpe-is_mask)); +memset(cpe-ms_mask, 0, sizeof(cpe-ms_mask)); put_bits(s-pb, 3, tag); put_bits(s-pb, 4, chan_el_counter[tag]++); for (ch = 0; ch chans; ch++) Looks good and necessary applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Allow native jpeg 2000 encoding yuv42x and yuv41x
On 7/3/15, Carl Eugen Hoyos ceho...@ag.or.at wrote: Paul B Mahol onemda at gmail.com writes: Attached patch allows lossless encoding of lena.pnm in yuv420p, yuv422p, yuv410p and yuv411p with the native jpeg 2000 encoder, fixes tickets #535 and #4524. Isn't lossy one broken with those pixel formats? It works fine here, how can I reproduce the brokenness? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ffmpeg -f lavfi -i testsrc -strict -2 -pix_fmt yuv420p /tmp/o.j2k ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Allow native jpeg 2000 encoding yuv42x and yuv41x
Paul B Mahol onemda at gmail.com writes: ffmpeg -f lavfi -i testsrc -strict -2 -pix_fmt yuv420p /tmp/o.j2k Thank you! Chroma-subsampling currently only works for 256x256 Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 6/9] lavf/http: add http_accept
Le quintidi 15 messidor, an CCXXIII, Stephan Holljes a écrit : Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/http.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/libavformat/http.c b/libavformat/http.c index 676bfd5..d9c3624 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -25,6 +25,7 @@ #include zlib.h #endif /* CONFIG_ZLIB */ +#include libavutil/avassert.h #include libavutil/avstring.h #include libavutil/opt.h @@ -382,6 +383,24 @@ static int http_open(URLContext *h, const char *uri, int flags, return ret; } +static int http_accept(URLContext *s, URLContext **c) +{ +int ret; +HTTPContext *sc = s-priv_data; +HTTPContext *cc; +URLContext *sl = sc-hd; +URLContext *cl; +av_assert0(sc-listen); +if ((ret = ffurl_alloc(c, s-filename, AVIO_FLAG_WRITE, sl-interrupt_callback)) 0) Here too, I suspect c-flags should be used (possibly with some filtering) instead of hardcoding the flags. +goto fail; +cc = (*c)-priv_data; +if ((ret = ffurl_accept(sl, cl)) 0) +goto fail; +cc-hd = cl; +fail: +return ret; +} + static int http_getc(HTTPContext *s) { int len; Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/9] lavf/tcp: add tcp_accept
Le quintidi 15 messidor, an CCXXIII, Stephan Holljes a écrit : Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/tcp.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/libavformat/tcp.c b/libavformat/tcp.c index f24cad2..875da50 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include avformat.h +#include libavutil/avassert.h #include libavutil/parseutils.h #include libavutil/opt.h #include libavutil/time.h @@ -163,6 +164,23 @@ static int tcp_open(URLContext *h, const char *uri, int flags) return ret; } +static int tcp_accept(URLContext *s, URLContext **c) +{ +TCPContext *sc = s-priv_data; +TCPContext *cc; +int ret; +av_assert0(sc-listen); +if ((ret = ffurl_alloc(c, s-filename, AVIO_FLAG_READ_WRITE, s-interrupt_callback)) 0) Maybe c-flags instead of hardcoding AVIO_FLAG_READ_WRITE? +return ret; +cc = (*c)-priv_data; +ret = accept(sc-fd, NULL, NULL); I suspect you should ne using ff_accept() here, not accept() directly. +if (ret 0) { +return ff_neterrno(); +} Nit: the braces are not needed. +cc-fd = ret; +return 0; +} + static int tcp_read(URLContext *h, uint8_t *buf, int size) { TCPContext *s = h-priv_data; @@ -223,6 +241,7 @@ static int tcp_get_file_handle(URLContext *h) URLProtocol ff_tcp_protocol = { .name= tcp, .url_open= tcp_open, +.url_accept = tcp_accept, .url_read= tcp_read, .url_write = tcp_write, .url_close = tcp_close, (Patches 1-3 look good to me for now.) Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 7/9] lavf/http: increase range for listen, handle connection closing accordingly, add http_handshake and move handshake logic there
Le quintidi 15 messidor, an CCXXIII, Stephan Holljes a écrit : Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/http.c | 45 - 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index d9c3624..95065f5 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -129,7 +129,7 @@ static const AVOption options[] = { { end_offset, try to limit the request to bytes preceding this offset, OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D }, { method, Override the HTTP method or set the expected HTTP method from a client, OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E }, { reconnect, auto reconnect after disconnect before EOF, OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D }, -{ listen, listen on HTTP, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D | E }, +{ listen, listen on HTTP, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, D | E }, { NULL } }; @@ -307,6 +307,8 @@ static void handle_http_errors(URLContext *h, int error) HTTPContext *s = h-priv_data; if (h-is_connected) { switch(error) { +case 0: +break; case AVERROR_HTTP_BAD_REQUEST: ffurl_write(s-hd, bad_request, strlen(bad_request)); break; @@ -317,15 +319,32 @@ static void handle_http_errors(URLContext *h, int error) } } +static int http_handshake(URLContext *c) { +int ret, err = 0, new_location; +HTTPContext *ch = c-priv_data; +URLContext *cl = ch-hd; +static const char header[] = HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n; +if ((ret = ffurl_handshake(cl)) 0) +return ret; +if ((err = http_read_header(c, new_location)) 0) +goto fail; +if ((ret = ffurl_write(cl, header, strlen(header))) 0) +goto fail; +// Avoid returning a positive value from ffurl_write() +ret = ret 0 ? 0 : ret; +fail: +handle_http_errors(c, err); +return ret; This is a matter of taste, but I find it more readable if it avoids going over the fail label: +if ((ret = ffurl_write(cl, header, strlen(header))) 0) +goto fail; +return 0; +fail: +handle_http_errors(c, err); +return ret; That way, you also do not need to change handle_http_errors() for error=0. (Although av_assert0(error 0) would do no harm there.) +} + static int http_listen(URLContext *h, const char *uri, int flags, AVDictionary **options) { HTTPContext *s = h-priv_data; int ret; -static const char header[] = HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n; char hostname[1024], proto[10]; char lower_url[100]; const char *lower_proto = tcp; -int port, new_location; +int port; s-chunked_post = 1; av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), port, NULL, 0, uri); @@ -333,18 +352,16 @@ static int http_listen(URLContext *h, const char *uri, int flags, lower_proto = tls; ff_url_join(lower_url, sizeof(lower_url), lower_proto, NULL, hostname, port, NULL); -av_dict_set(options, listen, 1, 0); +if ((ret = av_dict_set_int(options, listen, s-listen, 0)) 0) +goto fail; if ((ret = ffurl_open(s-hd, lower_url, AVIO_FLAG_READ_WRITE, h-interrupt_callback, options)) 0) goto fail; -if ((ret = http_read_header(h, new_location)) 0) - goto fail; -if ((ret = ffurl_write(s-hd, header, strlen(header))) 0) - goto fail; -return 0; - +if (s-listen == 1) { +// single client +ret = http_handshake(h); +} fail: -handle_http_errors(h, ret); av_dict_free(s-chained_options); return ret; } @@ -1263,7 +1280,7 @@ static int http_shutdown(URLContext *h, int flags) /* signal end of chunked encoding if used */ if (((flags AVIO_FLAG_WRITE) s-chunked_post) || -((flags AVIO_FLAG_READ) s-chunked_post s-listen)) { +((flags AVIO_FLAG_READ) s-chunked_post s-listen == 1)) { ret = ffurl_write(s-hd, footer, sizeof(footer) - 1); ret = ret 0 ? 0 : ret; s-end_chunked_post = 1; @@ -1282,7 +1299,7 @@ static int http_close(URLContext *h) av_freep(s-inflate_buffer); #endif /* CONFIG_ZLIB */ -if (!s-end_chunked_post) +if ((s-listen != 2 !s-end_chunked_post)) The two tests on s-listen seem redundant. Maybe it would be better to take the time of renaming a few fields in the structure to make the underlying logic simpler. Also, the parentheses in that last line are strange. /* Close the write
[FFmpeg-devel] FFmpeg/MPlayer/rtmpdump possibly searching for a new server and hosting
Hi all It is POSSIBLE that we need to move to different servers/hosting. We have been informed that the free hosting and servers we use currently may become unavailable in the future. Thus if someone can provide the FFmpeg/MPlayer/rtmpdump projects with a free server and hosting, knows of some company who might provide us with that or wants to sponsor a server hosting please reply ASAP Thank you! PS: please use reply to all so the thread does not get fragmented between mailing lists -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Allow native jpeg 2000 encoding yuv42x and yuv41x
On Fri, Jul 03, 2015 at 01:15:56PM +, Carl Eugen Hoyos wrote: Paul B Mahol onemda at gmail.com writes: ffmpeg -f lavfi -i testsrc -strict -2 -pix_fmt yuv420p /tmp/o.j2k Thank you! Chroma-subsampling currently only works for 256x256 fixed, this was a decoder bug though [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] swscale: ayuv16 input support
Signed-off-by: Paul B Mahol one...@gmail.com --- libswscale/input.c| 36 libswscale/swscale_internal.h | 2 ++ libswscale/swscale_unscaled.c | 1 + libswscale/utils.c| 2 +- 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/libswscale/input.c b/libswscale/input.c index 1f04fc2..d7d4bc5 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -607,6 +607,33 @@ static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2)); } +static void read_ayuv16le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, + uint32_t *unused2) +{ +int i; +for (i = 0; i width; i++) +AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2)); +} + + +static void read_ayuv16le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, + const uint8_t *unused1, int width, uint32_t *unused2) +{ +int i; +for (i = 0; i width; i++) { +AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 4)); +AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6)); +} +} + +static void read_ayuv16le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, +uint32_t *unused2) +{ +int i; +for (i = 0; i width; i++) +AV_WN16(dst + i * 2, AV_RL16(src + i * 8)); +} + /* This is almost identical to the previous, end exists only because * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */ static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, @@ -987,6 +1014,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) c-chrToYV12 = bswap16UV_c; break; #endif +case AV_PIX_FMT_AYUV16LE: +c-chrToYV12 = read_ayuv16le_UV_c; +break; } if (c-chrSrcHSubSample) { switch (srcFormat) { @@ -1271,6 +1301,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YA16BE: c-lumToYV12 = read_ya16be_gray_c; break; +case AV_PIX_FMT_AYUV16LE: +c-lumToYV12 = read_ayuv16le_Y_c; +break; case AV_PIX_FMT_YUYV422: case AV_PIX_FMT_YVYU422: case AV_PIX_FMT_YA8: @@ -1397,6 +1430,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YA16BE: c-alpToYV12 = read_ya16be_alpha_c; break; +case AV_PIX_FMT_AYUV16LE: +c-alpToYV12 = read_ayuv16le_A_c; +break; case AV_PIX_FMT_PAL8 : c-alpToYV12 = palToA_c; break; diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 2299aa5..9045336 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -790,6 +790,8 @@ static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt) || (x)==AV_PIX_FMT_YA8 \ || (x)==AV_PIX_FMT_YA16LE \ || (x)==AV_PIX_FMT_YA16BE \ +|| (x)==AV_PIX_FMT_AYUV16LE\ +|| (x)==AV_PIX_FMT_AYUV16BE\ || isRGBinInt(x) \ || isBGRinInt(x) \ ) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 1dc42c8..0e1e26e 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1676,6 +1676,7 @@ void ff_get_unscaled_swscale(SwsContext *c) IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16) || +IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_AYUV16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP9) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP10) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12) || diff --git a/libswscale/utils.c b/libswscale/utils.c index c384aa5..3561f7b 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -224,7 +224,7 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_BAYER_GRBG16LE] = { 1, 0 }, [AV_PIX_FMT_BAYER_GRBG16BE] = { 1, 0 }, [AV_PIX_FMT_XYZ12BE] = { 1, 1, 1 }, -[AV_PIX_FMT_XYZ12LE] = { 1, 1, 1 }, +[AV_PIX_FMT_AYUV16LE]= { 1, 0}, }; int sws_isSupportedInput(enum AVPixelFormat pix_fmt) -- 1.7.11.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] avutil: add AYVU16LE and AYVU16BE packed pixel format
Signed-off-by: Paul B Mahol one...@gmail.com --- libavutil/pixdesc.c | 26 ++ libavutil/pixfmt.h | 2 ++ libavutil/version.h | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 32dc4b8..3e23af3 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1965,6 +1965,32 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .name = mmal, .flags = AV_PIX_FMT_FLAG_HWACCEL, }, +[AV_PIX_FMT_AYUV16LE] = { +.name = ayuv16le, +.nb_components = 4, +.log2_chroma_w = 0, +.log2_chroma_h = 0, +.comp = { +{ 0, 7, 5, 0, 15 },/* Y */ +{ 0, 7, 7, 0, 15 },/* U */ +{ 0, 7, 3, 0, 15 },/* V */ +{ 0, 7, 1, 0, 15 },/* A */ +}, +.flags = AV_PIX_FMT_FLAG_ALPHA, +}, +[AV_PIX_FMT_AYUV16BE] = { +.name = ayuv16be, +.nb_components = 4, +.log2_chroma_w = 0, +.log2_chroma_h = 0, +.comp = { +{ 0, 7, 5, 0, 15 },/* Y */ +{ 0, 7, 7, 0, 15 },/* U */ +{ 0, 7, 3, 0, 15 },/* V */ +{ 0, 7, 1, 0, 15 },/* A */ +}, +.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA, +}, }; static const char *color_range_names[AVCOL_RANGE_NB] = { diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index eef6444..90493c8 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -308,6 +308,8 @@ enum AVPixelFormat { AV_PIX_FMT_YUV440P10BE, /// planar YUV 4:4:0,20bpp, (1 Cr Cb sample per 1x2 Y samples), big-endian AV_PIX_FMT_YUV440P12LE, /// planar YUV 4:4:0,24bpp, (1 Cr Cb sample per 1x2 Y samples), little-endian AV_PIX_FMT_YUV440P12BE, /// planar YUV 4:4:0,24bpp, (1 Cr Cb sample per 1x2 Y samples), big-endian +AV_PIX_FMT_AYUV16LE,/// packed AYUV 4:4:4,64bpp (1 Cr Cb sample per 1x1 Y A samples), little-endian +AV_PIX_FMT_AYUV16BE,/// packed AYUV 4:4:4,64bpp (1 Cr Cb sample per 1x1 Y A samples), big-endian 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 diff --git a/libavutil/version.h b/libavutil/version.h index 215729e..e7155c2 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -56,7 +56,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 54 -#define LIBAVUTIL_VERSION_MINOR 27 +#define LIBAVUTIL_VERSION_MINOR 28 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 1.7.11.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] swscale: ayuv16le output support
Signed-off-by: Paul B Mahol one...@gmail.com --- libswscale/output.c | 48 libswscale/utils.c | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/libswscale/output.c b/libswscale/output.c index 09e3369..042b36f 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -2008,6 +2008,51 @@ yuv2ya8_X_c(SwsContext *c, const int16_t *lumFilter, } } +static void +yuv2ayuv16le_X_c(SwsContext *c, const int16_t *lumFilter, + const int32_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int32_t **chrUSrc, + const int32_t **chrVSrc, int chrFilterSize, + const int32_t **alpSrc, uint8_t *dest, int dstW, int y) +{ +int hasAlpha = !!alpSrc; +int i; + +for (i = 0; i dstW; i++) { +int Y = 1 14, U = 1 14; +int V = 1 14, A = 1 14; +int j; + +Y -= 0x4000; +U -= 0x4000; +V -= 0x4000; +A -= 0x4000; + +for (j = 0; j lumFilterSize; j++) +Y += lumSrc[j][i] * (unsigned)lumFilter[j]; + +for (j = 0; j chrFilterSize; j++) +U += chrUSrc[j][i] * (unsigned)chrFilter[j]; + +for (j = 0; j chrFilterSize; j++) +V += chrVSrc[j][i] * (unsigned)chrFilter[j]; + +if (hasAlpha) +for (j = 0; j lumFilterSize; j++) +A += alpSrc[j][i] * (unsigned)lumFilter[j]; + +Y = 0x8000 + av_clip_int16(Y 15); +U = 0x8000 + av_clip_int16(U 15); +V = 0x8000 + av_clip_int16(V 15); +A = 0x8000 + av_clip_int16(A 15); + +AV_WL16(dest + 8 * i, hasAlpha ? A : 65535); +AV_WL16(dest + 8 * i + 2, Y); +AV_WL16(dest + 8 * i + 4, U); +AV_WL16(dest + 8 * i + 6, V); +} +} + av_cold void ff_sws_init_output_funcs(SwsContext *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, @@ -2457,5 +2502,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, *yuv2packed2 = yuv2ya8_2_c; *yuv2packedX = yuv2ya8_X_c; break; +case AV_PIX_FMT_AYUV16LE: +*yuv2packedX = yuv2ayuv16le_X_c; +break; } } diff --git a/libswscale/utils.c b/libswscale/utils.c index 3561f7b..e4e9197 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -224,7 +224,7 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_BAYER_GRBG16LE] = { 1, 0 }, [AV_PIX_FMT_BAYER_GRBG16BE] = { 1, 0 }, [AV_PIX_FMT_XYZ12BE] = { 1, 1, 1 }, -[AV_PIX_FMT_AYUV16LE]= { 1, 0}, +[AV_PIX_FMT_AYUV16LE]= { 1, 1}, }; int sws_isSupportedInput(enum AVPixelFormat pix_fmt) -- 1.7.11.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg/MPlayer/rtmpdump possibly searching for a new server and hosting
On Fri, 3 Jul 2015 19:53:43 +0200 Michael Niedermayer michae...@gmx.at wrote: Hi all It is POSSIBLE that we need to move to different servers/hosting. We have been informed that the free hosting and servers we use currently may become unavailable in the future. Thus if someone can provide the FFmpeg/MPlayer/rtmpdump projects with a free server and hosting, knows of some company who might provide us with that or wants to sponsor a server hosting please reply ASAP Thank you! PS: please use reply to all so the thread does not get fragmented between mailing lists do you have any kind of stats on what we need michael? rackspace? vhost? bandwidth? storage? i think under 3 tb space, some bandwidth for http and mailing lists and samples repo. dual/quad cpu for trac. might be nice to get working svnweb back for mplayer/gitweb for rtmpdump too. also looking for people to help with rtmpdump project. auto builds? website design? docs? reviewing patches? etc... -compn ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg/MPlayer/rtmpdump possibly searching for a new server and hosting
On Fri, Jul 03, 2015 at 07:53:43PM +0200, Michael Niedermayer wrote: Hi all It is POSSIBLE that we need to move to different servers/hosting. We have been informed that the free hosting and servers we use currently may become unavailable in the future. Thus if someone can provide the FFmpeg/MPlayer/rtmpdump projects with a free server and hosting, knows of some company who might provide us with that or wants to sponsor a server hosting please reply ASAP Thank you! PS: please use reply to all so the thread does not get fragmented between mailing lists I forgot some things :( i should have subscribed to rtmpdump list first so replyng with fullquote and to avoid a repetition of any project takeovers its needed that someone providing us with a server agrees that the projects hosted on it belong to the domain owners of the specific project or whoever is delgated by the domain owner. And the hoster/server provider would not mess with anything on the box excpt as agreed by the admis or needed for whatever legal/saftey reaosons. Also a guranteed minimum 3 month period to move elsewhere if in the future the free service becomes unavailable would be nice if we can get that about specs: we have 3 servers one has 2x1tb disks, one is virtual and has 500gb disk, the 3rd we are trying to phase out and move things to the other about net bandwidth i do not know exactly, ifconfig and uptime say RX bytes:29816783928 (29.8 GB) TX bytes:941213238690 (941.2 GB) 20:30:47 up 8 days, 4:56, 2 users, load average: 0.12, 0.07, 0.09 but we had no release in that period and where not on slashdot so this is possibly a more or less signifciant underestimation [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I know you won't believe me, but the highest form of Human Excellence is to question oneself and others. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Allow native jpeg 2000 encoding yuv42x and yuv41x
On Fri, Jul 03, 2015 at 12:34:21PM +0200, Carl Eugen Hoyos wrote: Hi! Attached patch allows lossless encoding of lena.pnm in yuv420p, yuv422p, yuv410p and yuv411p with the native jpeg 2000 encoder, fixes tickets #535 and #4524. Tested only with FFmpeg, all other decoders also fail for file3.jp2, the relevant sample from the reference file suite. Please comment, Carl Eugen if it works now after the decder fix the this should be ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [GSoC 2015] Segmentation fault with av_malloc()
Hello everyone, I am working with movtextdec.c to implement support for various Text Modifier Boxes. I am getting a segmentation fault with m-style_temp = av_malloc() and I cannot figure out why. I tried to play around with several things to find out the reason, but in vain. Must be something pretty straightforward that I am overlooking here. Diff appended below. Thanks, Niklesh -- diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c index a3afd91..bf9fa71 100644 --- a/libavcodec/movtextdec.c +++ b/libavcodec/movtextdec.c @@ -26,6 +26,7 @@ #include libavutil/bprint.h #include libavutil/intreadwrite.h #include libavutil/mem.h + #include stdio.h #define STYLE_FLAG_BOLD (10) #define STYLE_FLAG_ITALIC (11) @@ -37,31 +38,150 @@ typedef struct { uint8_t style_flag; } StyleBox; +typedef struct { +uint16_t hlit_start; +uint16_t hlit_end; +} HighlightBox; + +typedef struct { + uint8_t hlit_color[4]; +} HilightcolorBox; + +typedef struct { +int styl; +int hlit; +int hclr; +} Box_flags; + +typedef struct { +StyleBox **s; +StyleBox *style_temp; +HighlightBox h; +HilightcolorBox c; +Box_flags f; +uint16_t style_entries; +uint64_t tracksize; +int size_var; +} MovTextContext; + +struct Box +{ +uint32_t type; +size_t base_size; +int (*decode)(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt); +}; + +static int decode_hlit(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt) +{ +m-f.hlit = 1; +m-h.hlit_start = AV_RB16(tsmb); +tsmb += 2; +m-h.hlit_end = AV_RB16(tsmb); +tsmb += 2; +return 0; +} + +static int decode_hclr(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt) +{ +m-f.hclr = 1; +m-c.hlit_color[0] = *tsmb++; +m-c.hlit_color[1] = *tsmb++; +m-c.hlit_color[2] = *tsmb++; +m-c.hlit_color[3] = *tsmb++; +return 0; +} + +static int decode_styl(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt) +{ +int count_s, i; +m-style_entries = AV_RB16(tsmb); +tsmb += 2; +// A single style record is of length 12 bytes. +if (m-tracksize + m-size_var + 2 + m-style_entries * 12 avpkt-size) +return -1; +m-f.styl = 1; +for(i = 0; i m-style_entries; i++) { +m-style_temp = av_malloc(sizeof(StyleBox)); +if (!m-style_temp) +goto error; +m-style_temp-style_start = AV_RB16(tsmb); +tsmb += 2; +m-style_temp-style_end = AV_RB16(tsmb); +tsmb += 2; +// fontID = AV_RB16(tsmb); +tsmb += 2; +m-style_temp-style_flag = AV_RB8(tsmb); +av_dynarray_add(m-s, count_s, m-style_temp); +if(!m-s) +goto error; +// fontsize = AV_RB8(tsmb); +tsmb += 2; +// text-color-rgba +tsmb += 4; +} +return 0; + +error: +for(i = 0; i count_s; i++) { +av_freep(m-s[i]); +} +av_freep(m-s); +if (m-style_temp) +av_freep(m-style_temp); +//av_bprint_finalize(buf, NULL); +return AVERROR(ENOMEM); +} + +struct Box box_types[] = { +{ MKBETAG('s','t','y','l'), 2, decode_styl }, +{ MKBETAG('h','l','i','t'), 4, decode_hlit }, +{ MKBETAG('h','c','l','r'), 4, decode_hclr } +}; + +const static size_t box_count = sizeof(box_types) / sizeof(struct Box); + static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end, -StyleBox **s, int style_entries) +MovTextContext *m) { int i = 0; int text_pos = 0; while (text text_end) { -for (i = 0; i style_entries; i++) { -if (s[i]-style_flag text_pos == s[i]-style_end) { -if (s[i]-style_flag STYLE_FLAG_BOLD) -av_bprintf(buf, {\\b0}); -if (s[i]-style_flag STYLE_FLAG_ITALIC) -av_bprintf(buf, {\\i0}); -if (s[i]-style_flag STYLE_FLAG_UNDERLINE) -av_bprintf(buf, {\\u0}); +if (m-f.styl) { +for (i = 0; i m-style_entries; i++) { +if (m-s[i]-style_flag text_pos == m-s[i]-style_end) { +if (m-s[i]-style_flag STYLE_FLAG_BOLD) +av_bprintf(buf, {\\b0}); +if (m-s[i]-style_flag STYLE_FLAG_ITALIC) +av_bprintf(buf, {\\i0}); +if (m-s[i]-style_flag STYLE_FLAG_UNDERLINE) +av_bprintf(buf, {\\u0}); +} +} +for (i = 0; i m-style_entries; i++) { +if (m-s[i]-style_flag text_pos == m-s[i]-style_start) { +if (m-s[i]-style_flag STYLE_FLAG_BOLD) +av_bprintf(buf, {\\b1}); +if (m-s[i]-style_flag STYLE_FLAG_ITALIC) +av_bprintf(buf, {\\i1}); +if (m-s[i]-style_flag STYLE_FLAG_UNDERLINE) +
Re: [FFmpeg-devel] Patch for x86 YUV-BGR32 using MMX
Attached is the updated patch to fix alpha. On Thu, Jul 2, 2015 at 11:02 AM, Kevin Coyle kco...@netflix.com wrote: Hi all, Attached is a patch to convert YUV-BGR32 using MMX. Thanks. From 6eb02502ab8d16d6f9253d91b8b8cdbbc11f1a93 Mon Sep 17 00:00:00 2001 From: Kevin Coyle kco...@netflix.com Date: Fri, 3 Jul 2015 11:16:42 -0700 Subject: [PATCH] YUV-BGR32 MMX support --- libswscale/x86/swscale_template.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c index 36a606c..bbda6d0 100644 --- a/libswscale/x86/swscale_template.c +++ b/libswscale/x86/swscale_template.c @@ -399,6 +399,35 @@ static void RENAME(yuv2rgb32_X)(SwsContext *c, const int16_t *lumFilter, } } +static void RENAME(yuv2bgr32_X)(SwsContext *c, const int16_t *lumFilter, +const int16_t **lumSrc, int lumFilterSize, +const int16_t *chrFilter, const int16_t **chrUSrc, +const int16_t **chrVSrc, +int chrFilterSize, const int16_t **alpSrc, +uint8_t *dest, int dstW, int dstY) +{ +x86_reg dummy=0; +x86_reg dstW_reg = dstW; +x86_reg uv_off = c-uv_offx2; + +if (CONFIG_SWSCALE_ALPHA c-alpPixBuf) { +YSCALEYUV2PACKEDX +YSCALEYUV2RGBX +YSCALEYUV2PACKEDX_YA(ALP_MMX_FILTER_OFFSET, %%mm0, %%mm3, %%mm6, %%mm1, %%mm7) +psraw$3, %%mm1 \n\t +psraw$3, %%mm7 \n\t +packuswb %%mm7, %%mm1 \n\t +WRITEBGR32(%4, %5, %%REGa, %%mm5, %%mm4, %%mm2, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) +YSCALEYUV2PACKEDX_END +} else { +YSCALEYUV2PACKEDX +YSCALEYUV2RGBX +pcmpeqd %%mm7, %%mm7 \n\t +WRITEBGR32(%4, %5, %%REGa, %%mm5, %%mm4, %%mm2, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) +YSCALEYUV2PACKEDX_END +} +} + #define REAL_WRITERGB16(dst, dstw, index) \ pand MANGLE(bF8), %%mm2 \n\t /* B */\ pand MANGLE(bFC), %%mm4 \n\t /* G */\ @@ -1491,6 +1520,7 @@ static av_cold void RENAME(sws_init_swscale)(SwsContext *c) if (!(c-flags SWS_FULL_CHR_H_INT)) { switch (c-dstFormat) { case AV_PIX_FMT_RGB32: c-yuv2packedX = RENAME(yuv2rgb32_X); break; +case AV_PIX_FMT_BGR32: c-yuv2packedX = RENAME(yuv2bgr32_X); break; #if HAVE_6REGS case AV_PIX_FMT_BGR24: c-yuv2packedX = RENAME(yuv2bgr24_X); break; #endif -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSoC 2015] Segmentation fault with av_malloc()
Hi Niklesh, On Fri, Jul 3, 2015 at 1:47 PM, Niklesh Lalwani lalwani1...@gmail.com wrote: Hello everyone, I am working with movtextdec.c to implement support for various Text Modifier Boxes. I am getting a segmentation fault with m-style_temp = av_malloc() and I cannot figure out why. Allocation segmentation faults are almost universally caused by memory corruption earlier on in your program, try using address sanitizer or valgrind. Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] fate/api: simplify
Signed-off-by: James Almer jamr...@gmail.com --- tests/fate/api.mak | 19 +-- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/tests/fate/api.mak b/tests/fate/api.mak index 4a1ee81..34c7f45 100644 --- a/tests/fate/api.mak +++ b/tests/fate/api.mak @@ -1,23 +1,14 @@ -FATE_API_LIBAVCODEC-$(call ENCDEC, FLAC, FLAC) += fate-api-flac +FATE_API-$(call ENCDEC, FLAC, FLAC) += fate-api-flac fate-api-flac: $(APITESTSDIR)/api-flac-test$(EXESUF) fate-api-flac: CMD = run $(APITESTSDIR)/api-flac-test fate-api-flac: CMP = null fate-api-flac: REF = /dev/null -FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, H264, H264) += fate-api-h264 +FATE_API_SAMPLES-$(call DEMDEC, H264, H264) += fate-api-h264 fate-api-h264: $(APITESTSDIR)/api-h264-test$(EXESUF) fate-api-h264: CMD = run $(APITESTSDIR)/api-h264-test $(TARGET_SAMPLES)/h264-conformance/SVA_NL2_E.264 -FATE_API_SAMPLES-$(CONFIG_AVFORMAT) += $(FATE_API_SAMPLES_LIBAVFORMAT-yes) +FATE_FFMPEG += $(FATE_API-yes) +FATE_SAMPLES_FFMPEG += $(FATE_API_SAMPLES-yes) -ifdef SAMPLES -FATE_API_SAMPLES += $(FATE_API_SAMPLES-yes) -endif - -FATE_API-$(CONFIG_AVCODEC) += $(FATE_API_LIBAVCODEC-yes) -FATE_API-$(CONFIG_AVFORMAT) += $(FATE_API_LIBAVFORMAT-yes) -FATE_API = $(FATE_API-yes) - -FATE-yes += $(FATE_API) $(FATE_API_SAMPLES) - -fate-api: $(FATE_API) $(FATE_API_SAMPLES) +fate-api: $(FATE_API-yes) $(FATE_API_SAMPLES-yes) -- 2.4.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 7/9] lavf/http: increase range for listen, handle connection closing accordingly, add http_handshake and move handshake logic there
On Fri, Jul 3, 2015 at 4:18 PM, Nicolas George geo...@nsup.org wrote: Le quintidi 15 messidor, an CCXXIII, Stephan Holljes a écrit : Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/http.c | 45 - 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index d9c3624..95065f5 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -129,7 +129,7 @@ static const AVOption options[] = { { end_offset, try to limit the request to bytes preceding this offset, OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D }, { method, Override the HTTP method or set the expected HTTP method from a client, OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E }, { reconnect, auto reconnect after disconnect before EOF, OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D }, -{ listen, listen on HTTP, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D | E }, +{ listen, listen on HTTP, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, D | E }, { NULL } }; @@ -307,6 +307,8 @@ static void handle_http_errors(URLContext *h, int error) HTTPContext *s = h-priv_data; if (h-is_connected) { switch(error) { +case 0: +break; case AVERROR_HTTP_BAD_REQUEST: ffurl_write(s-hd, bad_request, strlen(bad_request)); break; @@ -317,15 +319,32 @@ static void handle_http_errors(URLContext *h, int error) } } +static int http_handshake(URLContext *c) { +int ret, err = 0, new_location; +HTTPContext *ch = c-priv_data; +URLContext *cl = ch-hd; +static const char header[] = HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n; +if ((ret = ffurl_handshake(cl)) 0) +return ret; +if ((err = http_read_header(c, new_location)) 0) +goto fail; +if ((ret = ffurl_write(cl, header, strlen(header))) 0) +goto fail; +// Avoid returning a positive value from ffurl_write() +ret = ret 0 ? 0 : ret; +fail: +handle_http_errors(c, err); +return ret; This is a matter of taste, but I find it more readable if it avoids going over the fail label: +if ((ret = ffurl_write(cl, header, strlen(header))) 0) +goto fail; +return 0; +fail: +handle_http_errors(c, err); +return ret; That way, you also do not need to change handle_http_errors() for error=0. (Although av_assert0(error 0) would do no harm there.) +} + static int http_listen(URLContext *h, const char *uri, int flags, AVDictionary **options) { HTTPContext *s = h-priv_data; int ret; -static const char header[] = HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n; char hostname[1024], proto[10]; char lower_url[100]; const char *lower_proto = tcp; -int port, new_location; +int port; s-chunked_post = 1; av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), port, NULL, 0, uri); @@ -333,18 +352,16 @@ static int http_listen(URLContext *h, const char *uri, int flags, lower_proto = tls; ff_url_join(lower_url, sizeof(lower_url), lower_proto, NULL, hostname, port, NULL); -av_dict_set(options, listen, 1, 0); +if ((ret = av_dict_set_int(options, listen, s-listen, 0)) 0) +goto fail; if ((ret = ffurl_open(s-hd, lower_url, AVIO_FLAG_READ_WRITE, h-interrupt_callback, options)) 0) goto fail; -if ((ret = http_read_header(h, new_location)) 0) - goto fail; -if ((ret = ffurl_write(s-hd, header, strlen(header))) 0) - goto fail; -return 0; - +if (s-listen == 1) { +// single client +ret = http_handshake(h); +} fail: -handle_http_errors(h, ret); av_dict_free(s-chained_options); return ret; } @@ -1263,7 +1280,7 @@ static int http_shutdown(URLContext *h, int flags) /* signal end of chunked encoding if used */ if (((flags AVIO_FLAG_WRITE) s-chunked_post) || -((flags AVIO_FLAG_READ) s-chunked_post s-listen)) { +((flags AVIO_FLAG_READ) s-chunked_post s-listen == 1)) { ret = ffurl_write(s-hd, footer, sizeof(footer) - 1); ret = ret 0 ? 0 : ret; s-end_chunked_post = 1; @@ -1282,7 +1299,7 @@ static int http_close(URLContext *h) av_freep(s-inflate_buffer); #endif /* CONFIG_ZLIB */ -if (!s-end_chunked_post) +if ((s-listen != 2 !s-end_chunked_post)) The two tests on s-listen seem redundant. Maybe it would be better to take the time of renaming a few fields in the structure to make the underlying logic simpler. Those tests
[FFmpeg-devel] [PATCH 1/9] lavf/network: split ff_listen_bind into ff_listen and ff_accept
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/network.c | 27 +-- libavformat/network.h | 20 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/libavformat/network.c b/libavformat/network.c index 47ade8c..7a326d2 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -187,12 +187,11 @@ int ff_socket(int af, int type, int proto) return fd; } -int ff_listen_bind(int fd, const struct sockaddr *addr, - socklen_t addrlen, int timeout, URLContext *h) +int ff_listen(int fd, const struct sockaddr *addr, + socklen_t addrlen) { int ret; int reuse = 1; -struct pollfd lp = { fd, POLLIN, 0 }; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reuse, sizeof(reuse))) { av_log(NULL, AV_LOG_WARNING, setsockopt(SO_REUSEADDR) failed\n); } @@ -203,6 +202,13 @@ int ff_listen_bind(int fd, const struct sockaddr *addr, ret = listen(fd, 1); if (ret) return ff_neterrno(); +return ret; +} + +int ff_accept(int fd, int timeout, URLContext *h) +{ +int ret; +struct pollfd lp = { fd, POLLIN, 0 }; ret = ff_poll_interrupt(lp, 1, timeout, h-interrupt_callback); if (ret 0) @@ -211,15 +217,24 @@ int ff_listen_bind(int fd, const struct sockaddr *addr, ret = accept(fd, NULL, NULL); if (ret 0) return ff_neterrno(); - -closesocket(fd); - if (ff_socket_nonblock(ret, 1) 0) av_log(NULL, AV_LOG_DEBUG, ff_socket_nonblock failed\n); return ret; } +int ff_listen_bind(int fd, const struct sockaddr *addr, + socklen_t addrlen, int timeout, URLContext *h) +{ +int ret; +if ((ret = ff_listen(fd, addr, addrlen)) 0) +return ret; +if ((ret = ff_accept(fd, timeout, h)) 0) +return ret; +closesocket(fd); +return ret; +} + int ff_listen_connect(int fd, const struct sockaddr *addr, socklen_t addrlen, int timeout, URLContext *h, int will_try_next) diff --git a/libavformat/network.h b/libavformat/network.h index 86fb656..f83c796 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -255,6 +255,26 @@ int ff_listen_bind(int fd, const struct sockaddr *addr, URLContext *h); /** + * Bind to a file descriptor to an address without accepting connections. + * @param fd First argument of bind(). + * @param addrSecond argument of bind(). + * @param addrlen Third argument of bind(). + * @return0 on success or an AVERROR on failure. + */ +int ff_listen(int fd, const struct sockaddr *addr, socklen_t addrlen); + +/** + * Poll for a single connection on the passed file descriptor. + * @param fd The listening socket file descriptor. + * @param timeout Polling timeout in milliseconds. + * @param h URLContext providing interrupt check + *callback and logging context. + * @returnA non-blocking file descriptor on success + *or an AVERROR on failure. + */ +int ff_accept(int fd, int timeout, URLContext *h); + +/** * Connect to a file descriptor and poll for result. * * @param fd First argument of connect(), -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/9] lavf/tcp: increase range for listen and call the underlying socket operations accordingly
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/tcp.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 71dff7a..9a8e46e 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -45,7 +45,7 @@ typedef struct TCPContext { #define D AV_OPT_FLAG_DECODING_PARAM #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { -{ listen, Listen for incoming connections, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E }, +{ listen, Listen for incoming connections, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, .flags = D|E }, { timeout, set timeout (in microseconds) of socket I/O operations, OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, { listen_timeout, Connection awaiting timeout (in milliseconds), OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, { NULL } @@ -126,12 +126,18 @@ static int tcp_open(URLContext *h, const char *uri, int flags) goto fail; } -if (s-listen) { -if ((ret = ff_listen_bind(fd, cur_ai-ai_addr, cur_ai-ai_addrlen, - s-listen_timeout, h)) 0) { +if (s-listen == 2) { +// multi-client +if ((ret = ff_listen(fd, cur_ai-ai_addr, cur_ai-ai_addrlen)) 0) { +goto fail1; +} +} else if (s-listen == 1) { +// single client +if ((fd = ff_listen_bind(fd, cur_ai-ai_addr, cur_ai-ai_addrlen, + s-listen_timeout, h)) 0) { +ret = fd; goto fail1; } -fd = ret; } else { if ((ret = ff_listen_connect(fd, cur_ai-ai_addr, cur_ai-ai_addrlen, s-open_timeout / 1000, h, !!cur_ai-ai_next)) 0) { -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/9] lavf/avio: add ffurl_accept and ffurl_handshake
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/avio.c | 19 +++ libavformat/url.h | 18 ++ 2 files changed, 37 insertions(+) diff --git a/libavformat/avio.c b/libavformat/avio.c index c188adc..1182336 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -211,6 +211,25 @@ int ffurl_connect(URLContext *uc, AVDictionary **options) return 0; } +int ffurl_accept(URLContext *s, URLContext **c) +{ +if (s-prot-url_accept) +return s-prot-url_accept(s, c); +return 0; +} + +int ffurl_handshake(URLContext *c) +{ +int ret; +if (c-prot-url_handshake) { +ret = c-prot-url_handshake(c); +if (ret) +return ret; +} +c-is_connected = 1; +return 0; +} + #define URL_SCHEME_CHARS\ abcdefghijklmnopqrstuvwxyz\ ABCDEFGHIJKLMNOPQRSTUVWXYZ\ diff --git a/libavformat/url.h b/libavformat/url.h index 99a3201..d010a77 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -58,6 +58,8 @@ typedef struct URLProtocol { * for those nested protocols. */ int (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options); +int (*url_accept)(URLContext *s, URLContext **c); +int (*url_handshake)(URLContext *c); /** * Read data from the protocol. @@ -140,6 +142,22 @@ int ffurl_open(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options); /** + * Accept an URLContext c on an URLContext s + * @param s server context + * @param c client context + * @return = 0 on success, ff_neterrno() on failure. + */ +int ffurl_accept(URLContext *s, URLContext **c); + +/** + * Perform a protocol handshake on the passed client context. + * @param c the client context + * @return = 0 on success or a negative value corresponding + * to an AVERROR code on failure + */ +int ffurl_handshake(URLContext *c); + +/** * Read up to size bytes from the resource accessed by h, and store * the read bytes in buf. * -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/9] lavf/avio: add avio_accept and avio_handshake
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/avio.h| 16 libavformat/aviobuf.c | 17 + 2 files changed, 33 insertions(+) diff --git a/libavformat/avio.h b/libavformat/avio.h index d3d9bbd..b7a4fa8 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -648,4 +648,20 @@ struct AVBPrint; */ int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size); +/** + * Accept and allocate a client context on a server context. + * @param s the server context + * @param c the client context + * @return = 0 on success or a negative value corresponding + * to an AVERROR on failure + */ +int avio_accept(AVIOContext *s, AVIOContext **c); + +/** + * Perform a protocol dependent handshake + * @param c the client context to perform the handshake on + * @return = 0 on success or a negative value corresponding + * to an AVERROR on failure + */ +int avio_handshake(AVIOContext *c); #endif /* AVFORMAT_AVIO_H */ diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index ff85081..ce05c5d 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1021,6 +1021,23 @@ int avio_read_to_bprint(AVIOContext *h, AVBPrint *pb, size_t max_size) return 0; } +int avio_accept(AVIOContext *s, AVIOContext **c) +{ +int ret; +URLContext *sc = s-opaque; +URLContext *cc; +ret = ffurl_accept(sc, cc); +if (ret 0) +return ret; +return ffio_fdopen(c, cc); +} + +int avio_handshake(AVIOContext *c) +{ +URLContext *cc = c-opaque; +return ffurl_handshake(cc); +} + /* output in a dynamic buffer */ typedef struct DynBuffer { -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/9] lavf/tcp: add tcp_accept
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/tcp.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/libavformat/tcp.c b/libavformat/tcp.c index f24cad2..71dff7a 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include avformat.h +#include libavutil/avassert.h #include libavutil/parseutils.h #include libavutil/opt.h #include libavutil/time.h @@ -163,6 +164,22 @@ static int tcp_open(URLContext *h, const char *uri, int flags) return ret; } +static int tcp_accept(URLContext *s, URLContext **c) +{ +TCPContext *sc = s-priv_data; +TCPContext *cc; +int ret; +av_assert0(sc-listen); +if ((ret = ffurl_alloc(c, s-filename, AVIO_FLAG_READ_WRITE, s-interrupt_callback)) 0) +return ret; +cc = (*c)-priv_data; +ret = ff_accept(sc-fd, sc-listen_timeout, s); +if (ret 0) +return ff_neterrno(); +cc-fd = ret; +return 0; +} + static int tcp_read(URLContext *h, uint8_t *buf, int size) { TCPContext *s = h-priv_data; @@ -223,6 +240,7 @@ static int tcp_get_file_handle(URLContext *h) URLProtocol ff_tcp_protocol = { .name= tcp, .url_open= tcp_open, +.url_accept = tcp_accept, .url_read= tcp_read, .url_write = tcp_write, .url_close = tcp_close, -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 8/9] doc/protocols: document experimental mutli-client api
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- doc/protocols.texi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/protocols.texi b/doc/protocols.texi index 453dbcf..39a132a 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -292,6 +292,8 @@ autodetection in the future. If set to 1 enables experimental HTTP server. This can be used to send data when used as an output option, or read data from a client with HTTP POST when used as an input option. +If set to 2 enables experimental mutli-client HTTP server. This is not yet implemented +in ffmpeg.c or ffserver.c and thus must not be used as a command line option. @example # Server side (sending): ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://@var{server}:@var{port} -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 9/9] Add http multi-client example code
On Fri, Jul 3, 2015 at 12:32 PM, Nicolas George geo...@nsup.org wrote: Le quintidi 15 messidor, an CCXXIII, Stephan Holljes a écrit : Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- doc/examples/Makefile | 1 + doc/examples/http_multiclient.c | 101 2 files changed, 102 insertions(+) create mode 100644 doc/examples/http_multiclient.c diff --git a/doc/examples/Makefile b/doc/examples/Makefile index 9699f11..8c9501b 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -18,6 +18,7 @@ EXAMPLES= avio_list_dir \ extract_mvs\ filtering_video\ filtering_audio\ +http_multiclient \ metadata \ muxing \ remuxing \ diff --git a/doc/examples/http_multiclient.c b/doc/examples/http_multiclient.c new file mode 100644 index 000..fdecab4 --- /dev/null +++ b/doc/examples/http_multiclient.c @@ -0,0 +1,101 @@ +/* + * copyright (c) 2015 Stephan Holljes + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * libavformat multi-client network API usage example. + * + * @example http_multiclient.c + * This example will serve a file without decoding or demuxing it over http. + * Multiple clients can connect and will receive the same file. Did you test several simultaneous clients? It should work, because fork() is a strong isolation, so it if works for one it works for many, but testing is always better. Yes, I tested it with multiple simultaneous wget instances and with siege (a benchmark tool for webservers). + */ + +#include libavformat/avformat.h +#include unistd.h + +int main(int argc, char **argv) +{ +AVDictionary *options = NULL; +AVIOContext *input = NULL, *client = NULL, *server = NULL; +const char *in_uri, *out_uri; +int ret, pid, n; +uint8_t buf[1024]; + +if (argc 3) { +printf(usage: %s input http://hostname[:port]\n; + API example program to serve http to multiple clients.\n + The output format is guessed according to the input file extension.\n I suspect this sentence is outdated. + \n, argv[0]); +return 1; +} + +in_uri = argv[1]; +out_uri = argv[2]; + +av_register_all(); +avformat_network_init(); + +if ((ret = av_dict_set(options, listen, 2, 0)) 0) +goto end; +if ((ret = avio_open2(server, out_uri, AVIO_FLAG_READ_WRITE, NULL, options)) 0) +goto end; +fprintf(stderr, Entering main loop.\n); +for(;;) { +if ((ret = avio_accept(server, client)) 0) +goto end; +fprintf(stderr, Accepted client, forking process.\n); +pid = fork(); Zombie apocalypse ahead! Well, setting SIGCHLD to SIG_IGN is hardly portable, double-fork is ugly and proper waiting is painful, so I guess we can leave the zombies for now in a simple testing program, but a comment stating it would be useful. +if (pid == 0) { Maybe also: if (pid 0) { perror(Fork failed); err = AVERROR(errno); goto end; } +fprintf(stderr, Opening input file.\n); +if ((ret = avio_open2(input, in_uri, AVIO_FLAG_READ, NULL, NULL)) 0) +goto end; +fprintf(stderr, In child.\n); +avio_handshake(client); +fprintf(stderr, Handshake performed.\n); It would feel more natural to perform the handshake before opening the input file. Note that since this is your code, you are free to reject this kind of stylistic remark. In this particular case, it will be necessary when extending the code, because avio_handshake() will be responsible for getting the request file name from the client. Also: since this is fork()ing instead of pthread_create()ing, you probably should close the server context in the client process. And you definitely must close the client
[FFmpeg-devel] [PATCH 7/9] lavf/http: increase range for listen, handle connection closing accordingly, add http_handshake and move handshake logic there
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/http.c | 44 +++- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index 3c1ec35..6338d80 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -129,7 +129,7 @@ static const AVOption options[] = { { end_offset, try to limit the request to bytes preceding this offset, OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D }, { method, Override the HTTP method or set the expected HTTP method from a client, OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E }, { reconnect, auto reconnect after disconnect before EOF, OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D }, -{ listen, listen on HTTP, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D | E }, +{ listen, listen on HTTP, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, D | E }, { NULL } }; @@ -305,8 +305,11 @@ static void handle_http_errors(URLContext *h, int error) static const char bad_request[] = HTTP/1.1 400 Bad Request\r\nContent-Type: text/plain\r\n\r\n400 Bad Request\r\n; static const char internal_server_error[] = HTTP/1.1 500 Internal server error\r\nContent-Type: text/plain\r\n\r\n500 Internal server error\r\n; HTTPContext *s = h-priv_data; +av_assert0(error 0); if (h-is_connected) { switch(error) { +case 0: +break; case AVERROR_HTTP_BAD_REQUEST: ffurl_write(s-hd, bad_request, strlen(bad_request)); break; @@ -317,15 +320,33 @@ static void handle_http_errors(URLContext *h, int error) } } +static int http_handshake(URLContext *c) { +int ret, err, new_location; +HTTPContext *ch = c-priv_data; +URLContext *cl = ch-hd; +static const char header[] = HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n; +if ((ret = ffurl_handshake(cl)) 0) +return ret; +if ((err = http_read_header(c, new_location)) 0) +goto fail; +if ((ret = ffurl_write(cl, header, strlen(header))) 0) +return ret; +// Avoid returning a positive value from ffurl_write() +ret = ret 0 ? 0 : ret; +return ret; +fail: +handle_http_errors(c, err); +return ret; +} + static int http_listen(URLContext *h, const char *uri, int flags, AVDictionary **options) { HTTPContext *s = h-priv_data; int ret; -static const char header[] = HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n; char hostname[1024], proto[10]; char lower_url[100]; const char *lower_proto = tcp; -int port, new_location; +int port; s-chunked_post = 1; av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), port, NULL, 0, uri); @@ -333,18 +354,14 @@ static int http_listen(URLContext *h, const char *uri, int flags, lower_proto = tls; ff_url_join(lower_url, sizeof(lower_url), lower_proto, NULL, hostname, port, NULL); -av_dict_set(options, listen, 1, 0); +if ((ret = av_dict_set_int(options, listen, s-listen, 0)) 0) +goto fail; if ((ret = ffurl_open(s-hd, lower_url, AVIO_FLAG_READ_WRITE, h-interrupt_callback, options)) 0) goto fail; -if ((ret = http_read_header(h, new_location)) 0) - goto fail; -if ((ret = ffurl_write(s-hd, header, strlen(header))) 0) - goto fail; -return 0; - +if (s-listen == 1) /* single client */ +ret = http_handshake(h); fail: -handle_http_errors(h, ret); av_dict_free(s-chained_options); return ret; } @@ -1262,8 +1279,7 @@ static int http_shutdown(URLContext *h, int flags) HTTPContext *s = h-priv_data; /* signal end of chunked encoding if used */ -if (((flags AVIO_FLAG_WRITE) s-chunked_post) || -((flags AVIO_FLAG_READ) s-chunked_post s-listen)) { +if (((flags AVIO_FLAG_WRITE) s-chunked_post)) { ret = ffurl_write(s-hd, footer, sizeof(footer) - 1); ret = ret 0 ? 0 : ret; s-end_chunked_post = 1; @@ -1365,6 +1381,8 @@ HTTP_CLASS(http); URLProtocol ff_http_protocol = { .name= http, .url_open2 = http_open, +.url_accept = http_accept, +.url_handshake = http_handshake, .url_read= http_read, .url_write = http_write, .url_seek= http_seek, -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 6/9] lavf/http: add http_accept
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/http.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/libavformat/http.c b/libavformat/http.c index 676bfd5..3c1ec35 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -25,6 +25,7 @@ #include zlib.h #endif /* CONFIG_ZLIB */ +#include libavutil/avassert.h #include libavutil/avstring.h #include libavutil/opt.h @@ -382,6 +383,24 @@ static int http_open(URLContext *h, const char *uri, int flags, return ret; } +static int http_accept(URLContext *s, URLContext **c) +{ +int ret; +HTTPContext *sc = s-priv_data; +HTTPContext *cc; +URLContext *sl = sc-hd; +URLContext *cl; +av_assert0(sc-listen); +if ((ret = ffurl_alloc(c, s-filename, s-flags AVIO_FLAG_READ_WRITE, sl-interrupt_callback)) 0) +goto fail; +cc = (*c)-priv_data; +if ((ret = ffurl_accept(sl, cl)) 0) +goto fail; +cc-hd = cl; +fail: +return ret; +} + static int http_getc(HTTPContext *s) { int len; -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 9/9] doc/example: Add http multi-client example code
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- doc/examples/Makefile | 1 + doc/examples/http_multiclient.c | 111 2 files changed, 112 insertions(+) create mode 100644 doc/examples/http_multiclient.c diff --git a/doc/examples/Makefile b/doc/examples/Makefile index 9699f11..8c9501b 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -18,6 +18,7 @@ EXAMPLES= avio_list_dir \ extract_mvs\ filtering_video\ filtering_audio\ +http_multiclient \ metadata \ muxing \ remuxing \ diff --git a/doc/examples/http_multiclient.c b/doc/examples/http_multiclient.c new file mode 100644 index 000..093b064 --- /dev/null +++ b/doc/examples/http_multiclient.c @@ -0,0 +1,111 @@ +/* + * copyright (c) 2015 Stephan Holljes + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * libavformat multi-client network API usage example. + * + * @example http_multiclient.c + * This example will serve a file without decoding or demuxing it over http. + * Multiple clients can connect and will receive the same file. + */ + +#include libavformat/avformat.h +#include unistd.h + +int main(int argc, char **argv) +{ +AVDictionary *options = NULL; +AVIOContext *input = NULL, *client = NULL, *server = NULL; +const char *in_uri, *out_uri; +int ret, pid, n; +uint8_t buf[1024]; + +if (argc 3) { +printf(usage: %s input http://hostname[:port]\n; + API example program to serve http to multiple clients.\n + \n, argv[0]); +return 1; +} + +in_uri = argv[1]; +out_uri = argv[2]; + +av_register_all(); +avformat_network_init(); + +if ((ret = av_dict_set(options, listen, 2, 0)) 0) +goto end; +if ((ret = avio_open2(server, out_uri, AVIO_FLAG_READ_WRITE, NULL, options)) 0) +goto end; +fprintf(stderr, Entering main loop.\n); +for(;;) { +if ((ret = avio_accept(server, client)) 0) +goto end; +fprintf(stderr, Accepted client, forking process.\n); +// XXX: Since we don't reap our children and don't ignore signals +// this produces zombie processes. +pid = fork(); +if (pid 0) { +fprintf(stderr, Fork failed.\n); +ret = AVERROR(errno); +goto end; +} +if (pid == 0) { +fprintf(stderr, In child.\n); +avio_handshake(client); +fprintf(stderr, Handshake performed.\n); +fprintf(stderr, Opening input file.\n); +if ((ret = avio_open2(input, in_uri, AVIO_FLAG_READ, NULL, NULL)) 0) +goto end; +for(;;) { +n = avio_read(input, buf, sizeof(buf)); +if (n 0) { +if (n == AVERROR_EOF) +break; +av_log(input, AV_LOG_ERROR, Error reading from input: %s.\n, + av_err2str(n)); +ret = n; +break; +} +avio_write(client, buf, n); +avio_flush(client); +} +fprintf(stderr, Flushing client\n); +avio_flush(client); +fprintf(stderr, Closing client\n); +avio_close(client); +break; +} +if (pid 0) +avio_close(client); +} + +end: +if (ret) { +fprintf(stderr, Some errors occured: ); +fprintf(stderr, %s\n, av_err2str(ret)); +} +avio_close(server); +avio_close(input); +if (ret 0 ret != AVERROR_EOF) +return 1; +return 0; +} -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Allow native jpeg 2000 encoding yuv42x and yuv41x
On 7/3/15, Michael Niedermayer michae...@gmx.at wrote: On Fri, Jul 03, 2015 at 12:34:21PM +0200, Carl Eugen Hoyos wrote: Hi! Attached patch allows lossless encoding of lena.pnm in yuv420p, yuv422p, yuv410p and yuv411p with the native jpeg 2000 encoder, fixes tickets #535 and #4524. Tested only with FFmpeg, all other decoders also fail for file3.jp2, the relevant sample from the reference file suite. Please comment, Carl Eugen if it works now after the decder fix the this should be ok It kinda works, decoder dumps bunch of yellow warnings but final output looks ok. Encoder on other hand for yuv420p use bunch of memory ~330MB. ImageMagick does not like ffmpeg output. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg/MPlayer/rtmpdump possibly searching for a new server and hosting
How much equipment or server resources do you need. I should be able to host this. Kieran On 3 July 2015 at 18:53, Michael Niedermayer michae...@gmx.at wrote: Hi all It is POSSIBLE that we need to move to different servers/hosting. We have been informed that the free hosting and servers we use currently may become unavailable in the future. Thus if someone can provide the FFmpeg/MPlayer/rtmpdump projects with a free server and hosting, knows of some company who might provide us with that or wants to sponsor a server hosting please reply ASAP Thank you! PS: please use reply to all so the thread does not get fragmented between mailing lists -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] avcodec: loongson optimized h264pred with mmi
i will offer a download source of Fedora21 OS next Monday. i will run yum-builddep ffmpeg-xxx.src.rpm for preparing devel environment. what else do you need to install, because it maybe slow for downloading other packages abroad. the new FC21 build with mips64el N64 API and mips64r2(-march=loongson3a) isa, and enabled ARCH_MIPS64 after ffmpeg configure. the FC19-O32 was slow, so aborted. here i contrast the performance between libav and ffmpeg i run test on my x86_64 notebook(Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz): ffmpeg version 2.5.7-0ubuntu0.15.04.1 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13) avconv version 11.2-6:11.2-1, Copyright (c) 2000-2014 the Libav developers built on Jan 18 2015 05:12:33 with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu2) 1 single thread --- time ffmpeg -threads 1 -i 1920x1080.mp4 -cpuflags 0 -f rawvideo -an -vframes 4096 -y /dev/null frame= 1253 fps= 38 q=0.0 Lsize= 3805988kB time=00:00:52.20 bitrate=597196.8kbits/s video:3805988kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.00% real0m33.163s user0m33.092s sys 0m0.056s --- time avconv -threads 1 -i 1920x1080.mp4 -cpuflags 0 -f rawvideo -an -vframes 4096 -y /dev/null frame= 1253 fps= 40 q=0.0 Lsize= 3805988kB time=52.17 bitrate=597673.8kbits/s video:3805988kB audio:0kB other streams:0kB global headers:0kB muxing overhead: 0.00% real0m31.154s user0m31.036s sys 0m0.108s 2 multi-threads --- time ffmpeg -threads 1 -i 1920x1080.mp4 -cpuflags 0 -f rawvideo -an -vframes 4096 -y /dev/null frame= 1253 fps= 78 q=0.0 Lsize= 3805988kB time=00:00:52.20 bitrate=597196.8kbits/s video:3805988kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.00% real0m16.157s user0m59.600s sys 0m0.328s --- time avconv -threads 1 -i 1920x1080.mp4 -cpuflags 0 -f rawvideo -an -vframes 4096 -y /dev/null frame= 1253 fps= 84 q=0.0 Lsize= 3805988kB time=52.17 bitrate=597673.8kbits/s video:3805988kB audio:0kB other streams:0kB global headers:0kB muxing overhead: 0.00% real0m15.005s user0m55.296s sys 0m0.240s libav is faster than ffmpeg? the test of other video has same conclusion. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Patch for x86 YUV-BGR32 using MMX
On Fri, Jul 03, 2015 at 11:18:16AM -0700, Kevin Coyle wrote: Attached is the updated patch to fix alpha. On Thu, Jul 2, 2015 at 11:02 AM, Kevin Coyle kco...@netflix.com wrote: Hi all, Attached is a patch to convert YUV-BGR32 using MMX. Thanks. swscale_template.c | 30 ++ 1 file changed, 30 insertions(+) 879fd87075497b7b8b57024356e8c1a2fea25b84 0001-YUV-BGR32-MMX-support.patch From 6eb02502ab8d16d6f9253d91b8b8cdbbc11f1a93 Mon Sep 17 00:00:00 2001 From: Kevin Coyle kco...@netflix.com Date: Fri, 3 Jul 2015 11:16:42 -0700 Subject: [PATCH] YUV-BGR32 MMX support applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSoC 2015] Segmentation fault with av_malloc()
Thanks guys, I'll try it out. -Niklesh ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] swscale: ayuv16 input support
On Fri, Jul 03, 2015 at 04:16:32PM +, Paul B Mahol wrote: Signed-off-by: Paul B Mahol one...@gmail.com --- libswscale/input.c| 36 libswscale/swscale_internal.h | 2 ++ libswscale/swscale_unscaled.c | 1 + libswscale/utils.c| 2 +- 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/libswscale/input.c b/libswscale/input.c index 1f04fc2..d7d4bc5 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -607,6 +607,33 @@ static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2)); } +static void read_ayuv16le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, + uint32_t *unused2) +{ +int i; +for (i = 0; i width; i++) +AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2)); +} + + +static void read_ayuv16le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, + const uint8_t *unused1, int width, uint32_t *unused2) +{ +int i; +for (i = 0; i width; i++) { +AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 4)); +AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6)); +} +} + +static void read_ayuv16le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, +uint32_t *unused2) +{ +int i; +for (i = 0; i width; i++) +AV_WN16(dst + i * 2, AV_RL16(src + i * 8)); +} + /* This is almost identical to the previous, end exists only because * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */ static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, @@ -987,6 +1014,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) c-chrToYV12 = bswap16UV_c; break; #endif +case AV_PIX_FMT_AYUV16LE: +c-chrToYV12 = read_ayuv16le_UV_c; +break; } if (c-chrSrcHSubSample) { switch (srcFormat) { @@ -1271,6 +1301,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YA16BE: c-lumToYV12 = read_ya16be_gray_c; break; +case AV_PIX_FMT_AYUV16LE: +c-lumToYV12 = read_ayuv16le_Y_c; +break; case AV_PIX_FMT_YUYV422: case AV_PIX_FMT_YVYU422: case AV_PIX_FMT_YA8: @@ -1397,6 +1430,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YA16BE: c-alpToYV12 = read_ya16be_alpha_c; break; +case AV_PIX_FMT_AYUV16LE: +c-alpToYV12 = read_ayuv16le_A_c; +break; case AV_PIX_FMT_PAL8 : c-alpToYV12 = palToA_c; break; diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 2299aa5..9045336 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -790,6 +790,8 @@ static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt) || (x)==AV_PIX_FMT_YA8 \ || (x)==AV_PIX_FMT_YA16LE \ || (x)==AV_PIX_FMT_YA16BE \ +|| (x)==AV_PIX_FMT_AYUV16LE\ +|| (x)==AV_PIX_FMT_AYUV16BE\ || isRGBinInt(x) \ || isBGRinInt(x) \ ) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 1dc42c8..0e1e26e 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1676,6 +1676,7 @@ void ff_get_unscaled_swscale(SwsContext *c) IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16) || +IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_AYUV16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP9) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP10) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12) || diff --git a/libswscale/utils.c b/libswscale/utils.c index c384aa5..3561f7b 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -224,7 +224,7 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_BAYER_GRBG16LE] = { 1, 0 }, [AV_PIX_FMT_BAYER_GRBG16BE] = { 1, 0 }, [AV_PIX_FMT_XYZ12BE] = { 1, 1, 1 }, -[AV_PIX_FMT_XYZ12LE] = { 1, 1, 1 }, +[AV_PIX_FMT_AYUV16LE]= { 1, 0}, this looks like a typo you remove AV_PIX_FMT_XYZ12LE [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire signature.asc Description: Digital
Re: [FFmpeg-devel] [PATCH 2/2] wmalosslessdec: reset frame-nb_samples on packet loss
On Fri, Jul 03, 2015 at 12:07:10AM +0200, Andreas Cadhalpun wrote: Otherwise a frame with non-zero nb_samples but without any data can be returned. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com --- libavcodec/wmalosslessdec.c | 1 + 1 file changed, 1 insertion(+) i think this is ok, it fits with how the code seems to work [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] fate/api-tests: Tests that need samples should only run if SAMPLES is set
On Fri, Jul 03, 2015 at 12:38:26AM +0100, George Boyle wrote: This change fixes a bug where a test that required a sample was being included in the suite when SAMPLES was not set. It also improves the consistency of variable names relating to the API tests. --- tests/fate/api.mak | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are too smart to engage in politics are punished by being governed by those who are dumber. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] texi2pod: fix an unescaped left brace
On 01/07/15 6:32 PM, James Almer wrote: This silences some deprecation warnings Signed-off-by: James Almer jamr...@gmail.com --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index e1ff6b4..9a9b34f 100644 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -384,7 +384,7 @@ sub postprocess # @* is also impossible in .pod; we discard it and any newline that # follows it. Similarly, our macro @gol must be discarded. -s/\@anchor{(?:[^\}]*)\}//g; +s/\@anchor\{(?:[^\}]*)\}//g; s/\(?\@xref\{(?:[^\}]*)\}(?:[^.]|(?:[^]*))*\.\)?//g; s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; s/;\s+\@pxref\{(?:[^\}]*)\}//g; Ping. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] swscale: ayuv16le output support
On Fri, Jul 03, 2015 at 04:16:33PM +, Paul B Mahol wrote: Signed-off-by: Paul B Mahol one...@gmail.com --- libswscale/output.c | 48 libswscale/utils.c | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) this is missing upddates to fate [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] swscale: ayuv16 input support
On Fri, Jul 03, 2015 at 09:59:58PM +0200, Michael Niedermayer wrote: On Fri, Jul 03, 2015 at 04:16:32PM +, Paul B Mahol wrote: Signed-off-by: Paul B Mahol one...@gmail.com --- libswscale/input.c| 36 libswscale/swscale_internal.h | 2 ++ libswscale/swscale_unscaled.c | 1 + libswscale/utils.c| 2 +- 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/libswscale/input.c b/libswscale/input.c index 1f04fc2..d7d4bc5 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -607,6 +607,33 @@ static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2)); } +static void read_ayuv16le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, + uint32_t *unused2) +{ +int i; +for (i = 0; i width; i++) +AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2)); +} + + +static void read_ayuv16le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, + const uint8_t *unused1, int width, uint32_t *unused2) +{ +int i; +for (i = 0; i width; i++) { +AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 4)); +AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6)); +} +} + +static void read_ayuv16le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, +uint32_t *unused2) +{ +int i; +for (i = 0; i width; i++) +AV_WN16(dst + i * 2, AV_RL16(src + i * 8)); +} + /* This is almost identical to the previous, end exists only because * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */ static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, @@ -987,6 +1014,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) c-chrToYV12 = bswap16UV_c; break; #endif +case AV_PIX_FMT_AYUV16LE: +c-chrToYV12 = read_ayuv16le_UV_c; +break; } if (c-chrSrcHSubSample) { switch (srcFormat) { @@ -1271,6 +1301,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YA16BE: c-lumToYV12 = read_ya16be_gray_c; break; +case AV_PIX_FMT_AYUV16LE: +c-lumToYV12 = read_ayuv16le_Y_c; +break; case AV_PIX_FMT_YUYV422: case AV_PIX_FMT_YVYU422: case AV_PIX_FMT_YA8: @@ -1397,6 +1430,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YA16BE: c-alpToYV12 = read_ya16be_alpha_c; break; +case AV_PIX_FMT_AYUV16LE: +c-alpToYV12 = read_ayuv16le_A_c; +break; case AV_PIX_FMT_PAL8 : c-alpToYV12 = palToA_c; break; diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 2299aa5..9045336 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -790,6 +790,8 @@ static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt) || (x)==AV_PIX_FMT_YA8 \ || (x)==AV_PIX_FMT_YA16LE \ || (x)==AV_PIX_FMT_YA16BE \ +|| (x)==AV_PIX_FMT_AYUV16LE\ +|| (x)==AV_PIX_FMT_AYUV16BE\ || isRGBinInt(x) \ || isBGRinInt(x) \ ) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 1dc42c8..0e1e26e 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1676,6 +1676,7 @@ void ff_get_unscaled_swscale(SwsContext *c) IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16) || +IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_AYUV16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP9) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP10) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12) || diff --git a/libswscale/utils.c b/libswscale/utils.c index c384aa5..3561f7b 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -224,7 +224,7 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_BAYER_GRBG16LE] = { 1, 0 }, [AV_PIX_FMT_BAYER_GRBG16BE] = { 1, 0 }, [AV_PIX_FMT_XYZ12BE] = { 1, 1, 1 }, -[AV_PIX_FMT_XYZ12LE] = { 1, 1, 1 }, +[AV_PIX_FMT_AYUV16LE]= { 1, 0}, this looks like a typo you remove AV_PIX_FMT_XYZ12LE should be ok without
Re: [FFmpeg-devel] [PATCH 1/3] avutil: add AYVU16LE and AYVU16BE packed pixel format
On Fri, Jul 03, 2015 at 04:16:31PM +, Paul B Mahol wrote: Signed-off-by: Paul B Mahol one...@gmail.com --- libavutil/pixdesc.c | 26 ++ libavutil/pixfmt.h | 2 ++ libavutil/version.h | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_lut: 10bit planar yuv support
On 7/1/15, Paul B Mahol one...@gmail.com wrote: Signed-off-by: Paul B Mahol one...@gmail.com --- The fate test should be redone. --- libavfilter/vf_lut.c | 57 --- tests/ref/fate/filter-pixfmts-lut | 4 +++ 2 files changed, 51 insertions(+), 10 deletions(-) Fixed crash, added more pixel formats and pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] use mmi instead of loongson3 as simd-optimization flag
From 0b953ff84cce87c2b988852aa59c899e2fa23309 Mon Sep 17 00:00:00 2001 From: ZhouXiaoyong zhouxiaoy...@loongson.cn Date: Fri, 3 Jul 2015 16:27:48 +0800 Subject: [PATCH 2/4] use mmi instead of loongson3 as simd-optimization flag Signed-off-by: ZhouXiaoyong zhouxiaoy...@loongson.cn --- Makefile | 2 +- arch.mak | 2 +- configure | 10 ++ libavcodec/mips/Makefile | 4 ++-- libavcodec/mips/h264chroma_init_mips.c | 8 libavcodec/mips/h264dsp_init_mips.c| 8 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index fd59628..a6f7fad 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,7 @@ SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \ ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \ ALTIVEC-OBJS MMX-OBJS YASM-OBJS \ MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MSA-OBJS \ - LOONGSON3-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS + MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS define RESET $(1) := diff --git a/arch.mak b/arch.mak index 4508c2a..80f4ba2 100644 --- a/arch.mak +++ b/arch.mak @@ -8,7 +8,7 @@ OBJS-$(HAVE_MIPSFPU) += $(MIPSFPU-OBJS)$(MIPSFPU-OBJS-yes) OBJS-$(HAVE_MIPSDSPR1) += $(MIPSDSPR1-OBJS) $(MIPSDSPR1-OBJS-yes) OBJS-$(HAVE_MIPSDSPR2) += $(MIPSDSPR2-OBJS) $(MIPSDSPR2-OBJS-yes) OBJS-$(HAVE_MSA) += $(MSA-OBJS)$(MSA-OBJS-yes) -OBJS-$(HAVE_LOONGSON3) += $(LOONGSON3-OBJS) $(LOONGSON3-OBJS-yes) +OBJS-$(HAVE_MMI) += $(MMI-OBJS) $(MMI-OBJS-yes) OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes) OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes) diff --git a/configure b/configure index cc23991..a292102 100755 --- a/configure +++ b/configure @@ -374,7 +374,7 @@ Optimization options (experts only): --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations --disable-msadisable MSA optimizations --disable-mipsfpudisable floating point MIPS optimizations - --disable-loongson3 disable Loongson-3 SIMD optimizations + --disable-mmidisable Loongson SIMD optimizations --disable-fast-unaligned consider unaligned accesses slow Developer options (useful when working on FFmpeg itself): @@ -1591,7 +1591,7 @@ ARCH_EXT_LIST_MIPS= ARCH_EXT_LIST_LOONGSON= -loongson3 +mmi ARCH_EXT_LIST_X86_SIMD= @@ -2046,7 +2046,7 @@ mips32r2_deps=mips mips32r5_deps=mips mips64r6_deps=mips msa_deps=mips -loongson3_deps=mips +mmi_deps=mips altivec_deps=ppc dcbzl_deps=ppc @@ -4737,6 +4737,8 @@ EOF elif enabled mips; then +enabled mmi check_inline_asm mmi 'punpcklhw $f0, $f0, $f0' + # Enable minimum ISA based on selected options if enabled mips64 (enabled mipsdspr1 || enabled mipsdspr2); then add_cflags -mips64r2 @@ -5779,7 +5781,7 @@ if enabled mips; then echo MIPS DSP R1 enabled ${mipsdspr1-no} echo MIPS DSP R2 enabled ${mipsdspr2-no} echo MIPS MSA enabled ${msa-no} -echo LOONGSON3 enabled ${loongson3-no} +echo LOONGSON MMI enabled ${mmi-no} fi if enabled ppc; then echo AltiVec enabled ${altivec-no} diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index 277ac2a..49c7556 100644 --- a/libavcodec/mips/Makefile +++ b/libavcodec/mips/Makefile @@ -49,5 +49,5 @@ MSA-OBJS-$(CONFIG_HPELDSP)+= mips/hpeldsp_msa.o MSA-OBJS-$(CONFIG_BLOCKDSP) += mips/blockdsp_msa.o MSA-OBJS-$(CONFIG_PIXBLOCKDSP)+= mips/pixblockdsp_msa.o MSA-OBJS-$(CONFIG_MPEGVIDEO) += mips/mpegvideo_msa.o -LOONGSON3-OBJS-$(CONFIG_H264DSP) += mips/h264dsp_mmi.o -LOONGSON3-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o +MMI-OBJS-$(CONFIG_H264DSP)+= mips/h264dsp_mmi.o +MMI-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o diff --git a/libavcodec/mips/h264chroma_init_mips.c b/libavcodec/mips/h264chroma_init_mips.c index 1cc5767..122148d 100644 --- a/libavcodec/mips/h264chroma_init_mips.c +++ b/libavcodec/mips/h264chroma_init_mips.c @@ -38,7 +38,7 @@ static av_cold void h264chroma_init_msa(H264ChromaContext *c, int bit_depth) } #endif // #if HAVE_MSA -#if HAVE_LOONGSON3 +#if HAVE_MMI static av_cold void h264chroma_init_mmi(H264ChromaContext *c, int bit_depth) { int high_bit_depth = bit_depth 8; @@ -50,14 +50,14 @@ static av_cold void h264chroma_init_mmi(H264ChromaContext *c, int bit_depth) c-avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_mmi; } } -#endif /* HAVE_LOONGSON3 */ +#endif /* HAVE_MMI */ av_cold void ff_h264chroma_init_mips(H264ChromaContext *c, int bit_depth) { #if HAVE_MSA h264chroma_init_msa(c, bit_depth); #endif // #if HAVE_MSA -#if HAVE_LOONGSON3 +#if HAVE_MMI
[FFmpeg-devel] [PATCH 3/4] configure: add loongson2 cpu support
From c6c4faaab7c598ce0fb6f7a4afab825f7a86 Mon Sep 17 00:00:00 2001 From: ZhouXiaoyong zhouxiaoy...@loongson.cn Date: Fri, 3 Jul 2015 16:44:12 +0800 Subject: [PATCH 3/4] configure: add loongson2 cpu support Signed-off-by: ZhouXiaoyong zhouxiaoy...@loongson.cn --- configure | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/configure b/configure index a292102..bb3041b 100755 --- a/configure +++ b/configure @@ -1591,6 +1591,8 @@ ARCH_EXT_LIST_MIPS= ARCH_EXT_LIST_LOONGSON= +loongson2 +loongson3 mmi @@ -3964,7 +3966,7 @@ elif enabled mips; then check_cflags -mtune=i6400 -mabi=64 check_ldflags -mabi=64 ;; -loongson3*) +loongson*) disable mipsfpu disable mips32r2 disable mips32r5 @@ -3979,7 +3981,17 @@ elif enabled mips; then enable fast_cmov enable fast_unaligned disable aligned_stack -cpuflags=-march=loongson3a -mhard-float +case $cpu in +loongson3*) +cpuflags=-march=loongson3a -mhard-float +;; +loongson2e) +cpuflags=-march=loongson2e -mhard-float +;; +loongson2f) +cpuflags=-march=loongson2f -mhard-float +;; +esac ;; generic) disable mips32r5 @@ -4737,13 +4749,15 @@ EOF elif enabled mips; then +enabled loongson2 check_inline_asm loongson2 'dmult.g $8, $9, $10' +enabled loongson3 check_inline_asm loongson3 'gsldxc1 $f0, 0($2, $3)' enabled mmi check_inline_asm mmi 'punpcklhw $f0, $f0, $f0' # Enable minimum ISA based on selected options if enabled mips64 (enabled mipsdspr1 || enabled mipsdspr2); then add_cflags -mips64r2 add_asflags -mips64r2 -elif enabled mips64 enabled mipsfpu disabled loongson3; then +elif enabled mips64 enabled mipsfpu disabled loongson2 disabled loongson3; then add_cflags -mips64 add_asflags -mips64 elif enabled mipsdspr1 || enabled mipsdspr2; then @@ -4768,7 +4782,6 @@ elif enabled mips; then check_inline_asm mipsfpu 'madd.d $f0, $f2, $f4, $f6' enabled msacheck_cflags -mmsa check_ldflags -mmsa check_inline_asm msa 'addvi.b $w0, $w1, 1' -enabled loongson3 check_inline_asm loongson3 'gsldxc1 $f0, 0($2, $3)' enabled mips32r5 add_asflags -mips32r5 -mfp64 enabled mips64r6 add_asflags -mips64r6 -mfp64 -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] avcodec: loongson optimized h264pred with mmi
From dc50d05ba8a4d40e17f15a52237f33cff0205fea Mon Sep 17 00:00:00 2001 From: ZhouXiaoyong zhouxiaoy...@loongson.cn Date: Fri, 3 Jul 2015 16:56:01 +0800 Subject: [PATCH 4/4] avcodec: loongson optimized h264pred with mmi Signed-off-by: ZhouXiaoyong zhouxiaoy...@loongson.cn --- libavcodec/mips/Makefile | 1 + libavcodec/mips/h264pred_init_mips.c | 53 +++ libavcodec/mips/h264pred_mips.h | 53 +++ libavcodec/mips/h264pred_mmi.c | 799 +++ 4 files changed, 906 insertions(+) diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index 49c7556..894ca28 100644 --- a/libavcodec/mips/Makefile +++ b/libavcodec/mips/Makefile @@ -51,3 +51,4 @@ MSA-OBJS-$(CONFIG_PIXBLOCKDSP)+= mips/pixblockdsp_msa.o MSA-OBJS-$(CONFIG_MPEGVIDEO) += mips/mpegvideo_msa.o MMI-OBJS-$(CONFIG_H264DSP)+= mips/h264dsp_mmi.o MMI-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o +MMI-OBJS-$(CONFIG_H264PRED) += mips/h264pred_mmi.o diff --git a/libavcodec/mips/h264pred_init_mips.c b/libavcodec/mips/h264pred_init_mips.c index 27ff10f..dc9c95a 100644 --- a/libavcodec/mips/h264pred_init_mips.c +++ b/libavcodec/mips/h264pred_init_mips.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015 Shivraj Patil (shivraj.pa...@imgtec.com) + * Copyright (c) 2015 Zhou Xiaoyong zhouxiaoy...@loongson.cn * * This file is part of FFmpeg. * @@ -20,6 +21,7 @@ #include config.h #include h264dsp_mips.h +#include h264pred_mips.h #if HAVE_MSA static av_cold void h264_pred_init_msa(H264PredContext *h, int codec_id, @@ -94,6 +96,54 @@ static av_cold void h264_pred_init_msa(H264PredContext *h, int codec_id, } #endif // #if HAVE_MSA +#if HAVE_MMI +static av_cold void h264_pred_init_mmi(H264PredContext *h, int codec_id, +const int bit_depth, const int chroma_format_idc) +{ +if (bit_depth == 8) { +if (chroma_format_idc == 1) { +h-pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_8_mmi; +h-pred8x8 [HOR_PRED8x8] = ff_pred8x8_horizontal_8_mmi; +} else { +h-pred8x8 [VERT_PRED8x8 ] = ff_pred8x16_vertical_8_mmi; +h-pred8x8 [HOR_PRED8x8] = ff_pred8x16_horizontal_8_mmi; +} + +h-pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_8_mmi; +h-pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_8_mmi; +h-pred16x16[HOR_PRED8x8] = ff_pred16x16_horizontal_8_mmi; +h-pred8x8l [TOP_DC_PRED] = ff_pred8x8l_top_dc_8_mmi; +h-pred8x8l [DC_PRED] = ff_pred8x8l_dc_8_mmi; +h-pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_8_mmi; + +switch (codec_id) { +case AV_CODEC_ID_SVQ3: +h-pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_8_mmi; +; +break; +case AV_CODEC_ID_RV40: +h-pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_8_mmi; +; +break; +case AV_CODEC_ID_VP7: +case AV_CODEC_ID_VP8: +; +break; +default: +h-pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_8_mmi; +break; +} + +if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) { +if (chroma_format_idc == 1) { +h-pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_8_mmi; +h-pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_8_mmi; +} +} +} +} +#endif /* HAVE_MMI */ + av_cold void ff_h264_pred_init_mips(H264PredContext *h, int codec_id, int bit_depth, const int chroma_format_idc) @@ -101,4 +151,7 @@ av_cold void ff_h264_pred_init_mips(H264PredContext *h, int codec_id, #if HAVE_MSA h264_pred_init_msa(h, codec_id, bit_depth, chroma_format_idc); #endif // #if HAVE_MSA +#if HAVE_MMI +h264_pred_init_mmi(h, codec_id, bit_depth, chroma_format_idc); +#endif /* HAVE_MMI */ } diff --git a/libavcodec/mips/h264pred_mips.h b/libavcodec/mips/h264pred_mips.h new file mode 100644 index 000..16bf6fc --- /dev/null +++ b/libavcodec/mips/h264pred_mips.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2015 Zhou Xiaoyong zhouxiaoy...@loongson.cn + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General
[FFmpeg-devel] [PATCH 1/4] avcodec: loongson remove useless macros in mipsfpu optimization
From be9c7fd9b3ddcba9c122c933717f54437d2e1c8a Mon Sep 17 00:00:00 2001 From: ZhouXiaoyong zhouxiaoy...@loongson.cn Date: Fri, 3 Jul 2015 15:59:00 +0800 Subject: [PATCH 1/4] avcodec: loongson remove useless macros in mipsfpu optimization Loongson has disabled all mipsfpu optimization as fate-test faild. Signed-off-by: ZhouXiaoyong zhouxiaoy...@loongson.cn --- libavcodec/mips/aacsbr_mips.h | 4 ++-- libavcodec/mips/iirfilter_mips.c | 4 libavcodec/mips/mpegaudiodsp_mips_float.c | 6 -- libavcodec/mips/sbrdsp_mips.c | 4 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/libavcodec/mips/aacsbr_mips.h b/libavcodec/mips/aacsbr_mips.h index e525197..da8389f 100644 --- a/libavcodec/mips/aacsbr_mips.h +++ b/libavcodec/mips/aacsbr_mips.h @@ -149,7 +149,7 @@ static void sbr_qmf_analysis_mips(AVFloatDSPContext *fdsp, FFTContext *mdct, } } -#if (HAVE_MIPSFPU !HAVE_LOONGSON3) +#if HAVE_MIPSFPU static void sbr_qmf_synthesis_mips(FFTContext *mdct, SBRDSPContext *sbrdsp, AVFloatDSPContext *fdsp, float *out, float X[2][38][64], @@ -488,7 +488,7 @@ static void sbr_qmf_synthesis_mips(FFTContext *mdct, #define sbr_qmf_analysis sbr_qmf_analysis_mips #define sbr_qmf_synthesis sbr_qmf_synthesis_mips -#endif /* (HAVE_MIPSFPU !HAVE_LOONGSON3) */ +#endif /* HAVE_MIPSFPU */ #endif /* HAVE_INLINE_ASM */ #endif /* AVCODEC_MIPS_AACSBR_FLOAT_H */ diff --git a/libavcodec/mips/iirfilter_mips.c b/libavcodec/mips/iirfilter_mips.c index 5a145cf..a5646cd 100644 --- a/libavcodec/mips/iirfilter_mips.c +++ b/libavcodec/mips/iirfilter_mips.c @@ -55,7 +55,6 @@ #include libavcodec/iirfilter.h #if HAVE_INLINE_ASM -#if !HAVE_LOONGSON3 typedef struct FFIIRFilterCoeffs { int order; float gain; @@ -196,13 +195,10 @@ static void ff_iir_filter_flt_mips(const struct FFIIRFilterCoeffs *c, } } } -#endif /* !HAVE_LOONGSON3 */ #endif /* HAVE_INLINE_ASM */ void ff_iir_filter_init_mips(FFIIRFilterContext *f) { #if HAVE_INLINE_ASM -#if !HAVE_LOONGSON3 f-filter_flt = ff_iir_filter_flt_mips; -#endif /* !HAVE_LOONGSON3 */ #endif /* HAVE_INLINE_ASM */ } diff --git a/libavcodec/mips/mpegaudiodsp_mips_float.c b/libavcodec/mips/mpegaudiodsp_mips_float.c index beebace..bd36894 100644 --- a/libavcodec/mips/mpegaudiodsp_mips_float.c +++ b/libavcodec/mips/mpegaudiodsp_mips_float.c @@ -278,7 +278,6 @@ static void ff_mpadsp_apply_window_mips_float(float *synth_buf, float *window, ); } -#if !HAVE_LOONGSON3 static void ff_dct32_mips_float(float *out, const float *tab) { float val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7, @@ -787,7 +786,6 @@ static void ff_dct32_mips_float(float *out, const float *tab) out[15] = val30 + val17; out[31] = val31; } -#endif /* !HAVE_LOONGSON3 */ static void imdct36_mips_float(float *out, float *buf, float *in, float *win) { @@ -1226,7 +1224,6 @@ static void imdct36_mips_float(float *out, float *buf, float *in, float *win) ); } -#if !HAVE_LOONGSON3 static void ff_imdct36_blocks_mips_float(float *out, float *buf, float *in, int count, int switch_point, int block_type) { @@ -1245,13 +1242,10 @@ static void ff_imdct36_blocks_mips_float(float *out, float *buf, float *in, out++; } } -#endif /* !HAVE_LOONGSON3 */ void ff_mpadsp_init_mipsfpu(MPADSPContext *s) { s-apply_window_float = ff_mpadsp_apply_window_mips_float; -#if !HAVE_LOONGSON3 s-imdct36_blocks_float = ff_imdct36_blocks_mips_float; s-dct32_float = ff_dct32_mips_float; -#endif /* !HAVE_LOONGSON3 */ } diff --git a/libavcodec/mips/sbrdsp_mips.c b/libavcodec/mips/sbrdsp_mips.c index 63361e4..c203095 100644 --- a/libavcodec/mips/sbrdsp_mips.c +++ b/libavcodec/mips/sbrdsp_mips.c @@ -438,7 +438,6 @@ static void sbr_qmf_deint_bfly_mips(float *v, const float *src0, const float *sr } } -#if !HAVE_LOONGSON3 static void sbr_autocorrelate_mips(const float x[40][2], float phi[3][2][2]) { int i; @@ -607,7 +606,6 @@ static void sbr_autocorrelate_mips(const float x[40][2], float phi[3][2][2]) : memory ); } -#endif /* !HAVE_LOONGSON3 */ static void sbr_hf_gen_mips(float (*X_high)[2], const float (*X_low)[2], const float alpha0[2], const float alpha1[2], @@ -896,9 +894,7 @@ void ff_sbrdsp_init_mips(SBRDSPContext *s) s-sum64x5 = sbr_sum64x5_mips; s-sum_square = sbr_sum_square_mips; s-qmf_deint_bfly = sbr_qmf_deint_bfly_mips; -#if !HAVE_LOONGSON3 s-autocorrelate = sbr_autocorrelate_mips; -#endif /* !HAVE_LOONGSON3 */ s-hf_gen = sbr_hf_gen_mips; s-hf_g_filt = sbr_hf_g_filt_mips; -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] GSoC update
Le quintidi 15 messidor, an CCXXIII, Stephan Holljes a écrit : +if ((ret = ffurl_alloc(c, s-filename, AVIO_FLAG_READ_WRITE, sl-interrupt_callback)) 0) AVIO_FLAG_READ_WRITE seems wrong. Changed to AVIO_FLAG_WRITE, but don't we read the request data from the client? Why does it work as intended with AVIO_FLAG_WRITE? You are mixing the modes for the HTTP context and for the TCP context. For the TCP context, it must be READ_WRITE, of course, in order to read the request and send the reply. But for the HTTP context, it only determines what methods are automatically accepted by the logic you wrote a bit earlier: GET to write to clients, POST to read from clients. Since I was told on IRC that sending git send-email patches is preferred over attached patch-files, I will send the patches in a series of follow-up emails. I will look at them presently. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 9/9] Add http multi-client example code
Le quintidi 15 messidor, an CCXXIII, Stephan Holljes a écrit : Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- doc/examples/Makefile | 1 + doc/examples/http_multiclient.c | 101 2 files changed, 102 insertions(+) create mode 100644 doc/examples/http_multiclient.c diff --git a/doc/examples/Makefile b/doc/examples/Makefile index 9699f11..8c9501b 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -18,6 +18,7 @@ EXAMPLES= avio_list_dir \ extract_mvs\ filtering_video\ filtering_audio\ +http_multiclient \ metadata \ muxing \ remuxing \ diff --git a/doc/examples/http_multiclient.c b/doc/examples/http_multiclient.c new file mode 100644 index 000..fdecab4 --- /dev/null +++ b/doc/examples/http_multiclient.c @@ -0,0 +1,101 @@ +/* + * copyright (c) 2015 Stephan Holljes + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * libavformat multi-client network API usage example. + * + * @example http_multiclient.c + * This example will serve a file without decoding or demuxing it over http. + * Multiple clients can connect and will receive the same file. Did you test several simultaneous clients? It should work, because fork() is a strong isolation, so it if works for one it works for many, but testing is always better. + */ + +#include libavformat/avformat.h +#include unistd.h + +int main(int argc, char **argv) +{ +AVDictionary *options = NULL; +AVIOContext *input = NULL, *client = NULL, *server = NULL; +const char *in_uri, *out_uri; +int ret, pid, n; +uint8_t buf[1024]; + +if (argc 3) { +printf(usage: %s input http://hostname[:port]\n; + API example program to serve http to multiple clients.\n + The output format is guessed according to the input file extension.\n I suspect this sentence is outdated. + \n, argv[0]); +return 1; +} + +in_uri = argv[1]; +out_uri = argv[2]; + +av_register_all(); +avformat_network_init(); + +if ((ret = av_dict_set(options, listen, 2, 0)) 0) +goto end; +if ((ret = avio_open2(server, out_uri, AVIO_FLAG_READ_WRITE, NULL, options)) 0) +goto end; +fprintf(stderr, Entering main loop.\n); +for(;;) { +if ((ret = avio_accept(server, client)) 0) +goto end; +fprintf(stderr, Accepted client, forking process.\n); +pid = fork(); Zombie apocalypse ahead! Well, setting SIGCHLD to SIG_IGN is hardly portable, double-fork is ugly and proper waiting is painful, so I guess we can leave the zombies for now in a simple testing program, but a comment stating it would be useful. +if (pid == 0) { Maybe also: if (pid 0) { perror(Fork failed); err = AVERROR(errno); goto end; } +fprintf(stderr, Opening input file.\n); +if ((ret = avio_open2(input, in_uri, AVIO_FLAG_READ, NULL, NULL)) 0) +goto end; +fprintf(stderr, In child.\n); +avio_handshake(client); +fprintf(stderr, Handshake performed.\n); It would feel more natural to perform the handshake before opening the input file. Note that since this is your code, you are free to reject this kind of stylistic remark. In this particular case, it will be necessary when extending the code, because avio_handshake() will be responsible for getting the request file name from the client. Also: since this is fork()ing instead of pthread_create()ing, you probably should close the server context in the client process. And you definitely must close the client context in the server process. +for(;;) { +n = avio_read(input, buf, sizeof(buf)); +fprintf(stderr, Read %d bytes from input.\n, n); +if (n
[FFmpeg-devel] [PATCH]Allow native jpeg 2000 encoding yuv42x and yuv41x
Hi! Attached patch allows lossless encoding of lena.pnm in yuv420p, yuv422p, yuv410p and yuv411p with the native jpeg 2000 encoder, fixes tickets #535 and #4524. Tested only with FFmpeg, all other decoders also fail for file3.jp2, the relevant sample from the reference file suite. Please comment, Carl Eugen diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c index 6d7b3f7..42489d8 100644 --- a/libavcodec/j2kenc.c +++ b/libavcodec/j2kenc.c @@ -1158,9 +1158,8 @@ AVCodec ff_jpeg2000_encoder = { .capabilities = CODEC_CAP_EXPERIMENTAL, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB24, AV_PIX_FMT_YUV444P, AV_PIX_FMT_GRAY8, -/* AV_PIX_FMT_YUV420P, -AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, -AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,*/ +AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, +AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_NONE }, .priv_class = j2k_class, ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/8] aacpsy: use a different metric for the spread of a band
On Thu, Jul 02, 2015 at 11:56:15PM -0300, Claudio Freire wrote: On Thu, Jul 2, 2015 at 3:13 PM, Rostislav Pehlivanov atomnu...@gmail.com wrote: This commit modifies 02dbed6 to use band-active_lines to better gauge how much information is contained within a single band and thus allow the perceptual noise subsitution to more accurately determine which bands to code as noise. The spread[w+g] used before this patch behaved more like a low-pass filter for PNS band_types, which could mistakingly mark some low frequency bands as noise. Reviewed-by: Claudio Freire klaussfre...@gmail.com --- libavcodec/aacpsy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c index 78232d4..b16f6b9 100644 --- a/libavcodec/aacpsy.c +++ b/libavcodec/aacpsy.c @@ -787,7 +787,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel, psy_band-threshold = band-thr; psy_band-energy= band-energy; -psy_band-spread= spread_en[w+g]; +psy_band-spread= band-active_lines * 2.0f / band_sizes[g]; } } Can't say much since I proposed it myself, so... LGTM ;-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Allow native jpeg 2000 encoding yuv42x and yuv41x
On 7/3/15, Carl Eugen Hoyos ceho...@ag.or.at wrote: Hi! Attached patch allows lossless encoding of lena.pnm in yuv420p, yuv422p, yuv410p and yuv411p with the native jpeg 2000 encoder, fixes tickets #535 and #4524. Tested only with FFmpeg, all other decoders also fail for file3.jp2, the relevant sample from the reference file suite. Please comment, Carl Eugen Isn't lossy one broken with those pixel formats? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 3/8] aaccoder: fix M/S coding
On Fri, Jul 03, 2015 at 12:01:44AM -0300, Claudio Freire wrote: On Thu, Jul 2, 2015 at 3:13 PM, Rostislav Pehlivanov atomnu...@gmail.com wrote: There were some mistakes in the code for M/S stereo, this commit fixes them. The start variable was not being reset for every window and every access to the coefficients was incorrect as well. This fixes that by properly addressing the coefficients using both windows and setting the start on every window to zero. --- libavcodec/aaccoder.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 3fcc8b4..33cbe7b 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -1143,6 +1143,7 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe, if (!cpe-common_window) return; for (w = 0; w sce0-ics.num_windows; w += sce0-ics.group_len[w]) { +start = 0; for (g = 0; g sce0-ics.num_swb; g++) { if (!cpe-ch[0].zeroes[w*16+g] !cpe-ch[1].zeroes[w*16+g]) { float dist1 = 0.0f, dist2 = 0.0f; @@ -1152,22 +1153,22 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe, float minthr = FFMIN(band0-threshold, band1-threshold); float maxthr = FFMAX(band0-threshold, band1-threshold); for (i = 0; i sce0-ics.swb_sizes[g]; i++) { -M[i] = (sce0-pcoeffs[start+w2*128+i] - + sce1-pcoeffs[start+w2*128+i]) * 0.5; +M[i] = (sce0-pcoeffs[start+(w+w2)*128+i] + + sce1-pcoeffs[start+(w+w2)*128+i]) * 0.5; S[i] = M[i] - - sce1-pcoeffs[start+w2*128+i]; + - sce1-pcoeffs[start+(w+w2)*128+i]; } -abs_pow34_v(L34, sce0-coeffs+start+w2*128, sce0-ics.swb_sizes[g]); -abs_pow34_v(R34, sce1-coeffs+start+w2*128, sce0-ics.swb_sizes[g]); +abs_pow34_v(L34, sce0-coeffs+start+(w+w2)*128, sce0-ics.swb_sizes[g]); +abs_pow34_v(R34, sce1-coeffs+start+(w+w2)*128, sce0-ics.swb_sizes[g]); abs_pow34_v(M34, M, sce0-ics.swb_sizes[g]); abs_pow34_v(S34, S, sce0-ics.swb_sizes[g]); -dist1 += quantize_band_cost(s, sce0-coeffs + start + w2*128, +dist1 += quantize_band_cost(s, sce0-coeffs + start + (w+w2)*128, L34, sce0-ics.swb_sizes[g], sce0-sf_idx[(w+w2)*16+g], sce0-band_type[(w+w2)*16+g], lambda / band0-threshold, INFINITY, NULL); -dist1 += quantize_band_cost(s, sce1-coeffs + start + w2*128, +dist1 += quantize_band_cost(s, sce1-coeffs + start + (w+w2)*128, R34, sce1-ics.swb_sizes[g], sce1-sf_idx[(w+w2)*16+g], LGTM. applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB You can kill me, but you cannot change the truth. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Allow native jpeg 2000 encoding yuv42x and yuv41x
Paul B Mahol onemda at gmail.com writes: Attached patch allows lossless encoding of lena.pnm in yuv420p, yuv422p, yuv410p and yuv411p with the native jpeg 2000 encoder, fixes tickets #535 and #4524. Isn't lossy one broken with those pixel formats? It works fine here, how can I reproduce the brokenness? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 2/8] aaccoder: remove previous PNS implementation from twoloop
On Thu, Jul 2, 2015 at 3:13 PM, Rostislav Pehlivanov atomnu...@gmail.com wrote: This commit undoes commit c5d4f87e8427c0952278ec247fa8ab1e6e52 and removes PNS band marking from the twoloop coder, which has been reimplemented in a better way in this series of patches. LGTM as long as the rest of the patch set is committed as well ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 5/8] aacenc: use the new function for setting special band scalefactor indices
On Thu, Jul 2, 2015 at 3:13 PM, Rostislav Pehlivanov atomnu...@gmail.com wrote: This commit enables the function added with commit 7c10b87 and uses that new function for setting any special scalefactor indices. This commit does not change the behaviour of the encoder since no bands are being marked as either NOISE_BT(due to the previous PNS implementation removed in the previous commit) or INTENSITY_BT2/INTENSITY_BT. LGTM in conjunction with other patches in the set ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv3] avcodec: Add support for Closed Caption export in h264
On Thu, Jul 02, 2015 at 08:18:13PM +0100, Kieran Kunhya wrote: --- libavcodec/h264.c | 11 +++ libavcodec/h264.h | 2 ++ libavcodec/h264_sei.c | 35 ++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 1cbd4cb..1569ec8 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -609,6 +609,8 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h) h-prev_frame_num= -1; h-sei_fpa.frame_packing_arrangement_cancel_flag = -1; h-has_afd = 0; +h-a53_caption_size = 0; +h-a53_caption = NULL; h-next_outputed_poc = INT_MIN; for (i = 0; i MAX_DELAYED_PIC_COUNT; i++) @@ -879,6 +881,15 @@ static void decode_postinit(H264Context *h, int setup_finished) } } +if (h-a53_caption) { +AVFrameSideData *sd = +av_frame_new_side_data(cur-f, AV_FRAME_DATA_A53_CC, h-a53_caption_size); +if (sd) +memcpy(sd-data, h-a53_caption, h-a53_caption_size); +av_freep(h-a53_caption); +h-a53_caption_size = 0; +} + cur-mmco_reset = h-mmco_reset; h-mmco_reset = 0; i think this could in case of seeking return old a53_captions the stuff should be reset/freed in some place thats called from avcodec_flush()-flush_dpb() maybe ff_h264_reset_sei() [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel