[FFmpeg-devel] [PATCH v3 5/5] lavf/internal.h: Add declaration for ff_get_raw_palette()

2016-02-29 Thread Mats Peterson


--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From a8a3cef658f4d9c3e4f9a5f9839cfc8761379d83 Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Tue, 1 Mar 2016 08:08:19 +0100
Subject: [PATCH v3 5/5] lavf/internal.h: Add declaration for ff_get_raw_palette()

---
 libavformat/internal.h |   12 
 1 file changed, 12 insertions(+)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index bc6a6c2..9a22bb4 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -573,4 +573,16 @@ int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int
  */
 int ff_reshuffle_raw_rgb(AVFormatContext *s, AVPacket **ppkt, AVCodecContext *enc, int expected_stride);
 
+/**
+ * Retrieves the palette from a packet, either from a side data packet
+ * or appended to the video data in the packet itself.
+ *
+ * Despite its name, this function is also used with non-raw codecs that
+ * use a palette.
+ *
+ * @param pkt pointer to the packet before calling ff_reshuffle_raw_rgb()
+ * @param ret the return value from ff_reshuffle_raw_rgb()
+ */
+int ff_get_raw_palette(AVFormatContext *s, AVPacket *pkt, int ret, const uint8_t **palette);
+
 #endif /* AVFORMAT_INTERNAL_H */
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v3 4/5] lavf/rawutils: New function ff_get_raw_palette()

2016-02-29 Thread Mats Peterson


--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 9a816b6d3d592684e08eac3120aaf94146b179ce Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Tue, 1 Mar 2016 08:07:56 +0100
Subject: [PATCH v3 4/5] lavf/rawutils: New function ff_get_raw_palette()

---
 libavformat/rawutils.c |   16 
 1 file changed, 16 insertions(+)

diff --git a/libavformat/rawutils.c b/libavformat/rawutils.c
index 26ebbb5..7b84984 100644
--- a/libavformat/rawutils.c
+++ b/libavformat/rawutils.c
@@ -65,3 +65,19 @@ fail:
 
 return ret;
 }
+
+int ff_get_raw_palette(AVFormatContext *s, AVPacket *pkt, int ret, const uint8_t **palette)
+{
+int size;
+
+*palette = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, );
+if (*palette && size != AVPALETTE_SIZE) {
+av_log(s, AV_LOG_ERROR, "Invalid palette side data\n");
+return AVERROR_INVALIDDATA;
+}
+
+if (!*palette && ret == CONTAINS_PAL)
+*palette = pkt->data + pkt->size - AVPALETTE_SIZE;
+
+return 0;
+}
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v3 3/5] lavf/riffenc: Handle non-raw codecs with a palette

2016-02-29 Thread Mats Peterson


--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 701ba074d4d5c0d0fe0b1b814db41df940a2c7d7 Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Tue, 1 Mar 2016 08:07:29 +0100
Subject: [PATCH v3 3/5] lavf/riffenc: Handle non-raw codecs with a palette

---
 libavformat/riffenc.c |   20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 1dd7971..195a58e 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -209,12 +209,17 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
 int keep_height = enc->extradata_size >= 9 &&
   !memcmp(enc->extradata + enc->extradata_size - 9, "BottomUp", 9);
 int extradata_size = enc->extradata_size - 9*keep_height;
-int raw_pal_avi;
+enum AVPixelFormat pix_fmt = enc->pix_fmt;
+int pal_avi;
 
-raw_pal_avi = !for_asf && enc->codec_id == AV_CODEC_ID_RAWVIDEO &&
-  !enc->codec_tag &&
-enc->bits_per_coded_sample >= 1 && enc->bits_per_coded_sample <= 8;
-if (!enc->extradata_size && raw_pal_avi)
+if (pix_fmt == AV_PIX_FMT_NONE && enc->bits_per_coded_sample == 1)
+pix_fmt = AV_PIX_FMT_MONOWHITE;
+pal_avi = !for_asf &&
+  (pix_fmt == AV_PIX_FMT_PAL8 ||
+   pix_fmt == AV_PIX_FMT_MONOWHITE ||
+   pix_fmt == AV_PIX_FMT_MONOBLACK);
+
+if (!enc->extradata_size && pal_avi)
 extradata_size = 4 * (1 << enc->bits_per_coded_sample);
 
 /* size */
@@ -239,11 +244,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
 avio_write(pb, enc->extradata, extradata_size);
 if (!for_asf && extradata_size & 1)
 avio_w8(pb, 0);
-} else if (raw_pal_avi) {
+} else if (pal_avi) {
 int i;
-enum AVPixelFormat pix_fmt = enc->pix_fmt;
-if (pix_fmt == AV_PIX_FMT_NONE && enc->bits_per_coded_sample == 1)
-pix_fmt = AV_PIX_FMT_MONOWHITE;
 for (i = 0; i < 1 << enc->bits_per_coded_sample; i++) {
 /* Initialize 1 bpp palette to black & white */
 if (i == 0 && pix_fmt == AV_PIX_FMT_MONOWHITE)
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v3 2/5] lavf/movenc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson


--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 74f44252ec10720b6d7813f7fe0bc166c871ecbd Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Tue, 1 Mar 2016 08:06:38 +0100
Subject: [PATCH v3 2/5] lavf/movenc: Add support for palette side data packets

---
 libavformat/movenc.c |   45 +++--
 1 file changed, 27 insertions(+), 18 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 3295266..6c8dfbb 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1716,13 +1716,14 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
 else
 avio_wb16(pb, 0x18); /* Reserved */
 
-if (track->is_unaligned_qt_rgb && track->enc->pix_fmt == AV_PIX_FMT_PAL8) {
+if (track->mode == MODE_MOV && track->enc->pix_fmt == AV_PIX_FMT_PAL8) {
+int pal_size = 1 << track->enc->bits_per_coded_sample;
 int i;
 avio_wb16(pb, 0); /* Color table ID */
 avio_wb32(pb, 0); /* Color table seed */
 avio_wb16(pb, 0x8000);/* Color table flags */
-avio_wb16(pb, 255);   /* Color table size (zero-relative) */
-for (i = 0; i < 256; i++) {
+avio_wb16(pb, pal_size - 1);  /* Color table size (zero-relative) */
+for (i = 0; i < pal_size; i++) {
 uint32_t rgb = AV_RL32(>palette[i]);
 uint16_t r = (rgb >> 16) & 0xff;
 uint16_t g = (rgb >> 8)  & 0xff;
@@ -4763,21 +4764,29 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
 }
 }
 
-if (trk->is_unaligned_qt_rgb) {
-const uint8_t *data = pkt->data;
-int size = pkt->size;
-int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16;
-int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2;
-int ret = ff_reshuffle_raw_rgb(s, , trk->enc, expected_stride);
-if (ret < 0)
-return ret;
-if (ret == CONTAINS_PAL && !trk->pal_done) {
-int pal_size = 1 << trk->enc->bits_per_coded_sample;
-memset(trk->palette, 0, AVPALETTE_SIZE);
-memcpy(trk->palette, data + size - 4*pal_size, 4*pal_size);
-trk->pal_done++;
-} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 ||
-   trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) {
+if (trk->mode == MODE_MOV) {
+AVPacket *opkt = pkt;
+int ret;
+if (trk->is_unaligned_qt_rgb) {
+int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16;
+int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2;
+ret = ff_reshuffle_raw_rgb(s, , trk->enc, expected_stride);
+if (ret < 0)
+return ret;
+} else
+ret = 0;
+if (trk->enc->pix_fmt == AV_PIX_FMT_PAL8 && !trk->pal_done) {
+const uint8_t *pal;
+int ret2 = ff_get_raw_palette(s, opkt, ret, );
+if (ret2 < 0)
+return ret2;
+if (pal) {
+memcpy(trk->palette, pal, AVPALETTE_SIZE);
+trk->pal_done++;
+}
+} else if (trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO &&
+   (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 ||
+   trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK)) {
 for (i = 0; i < pkt->size; i++)
 pkt->data[i] = ~pkt->data[i];
 }
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v3 1/5] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson

This patch set adds support for non-raw codecs that use a palette.

Try to do stream copy to and from avi with the files below:

QuickTime Animation (RLE):
https://drive.google.com/open?id=0B3_pEBoLs0faREo1SlRydmV1LU0

QuickTime Graphics (SMC):
https://drive.google.com/open?id=0B3_pEBoLs0faODd5RVBldkdvVGc

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From dd44c73c49cac3e2158f90d13bd6b30b55b3266a Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Tue, 1 Mar 2016 08:06:25 +0100
Subject: [PATCH v3 1/5] lavf/avienc: Add support for palette side data packets

---
 libavformat/avienc.c |   74 ++
 1 file changed, 44 insertions(+), 30 deletions(-)

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index ca505f4..fd03ba7 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -362,7 +362,8 @@ static int avi_write_header(AVFormatContext *s)
 && enc->pix_fmt == AV_PIX_FMT_RGB555LE
 && enc->bits_per_coded_sample == 15)
 enc->bits_per_coded_sample = 16;
-avist->pal_offset = avio_tell(pb) + 40;
+if (pb->seekable)
+avist->pal_offset = avio_tell(pb) + 40;
 ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 0, 0);
 pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
   enc->bits_per_coded_sample);
@@ -652,11 +653,11 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
 unsigned char tag[5];
 const int stream_index = pkt->stream_index;
-const uint8_t *data= pkt->data;
-int size   = pkt->size;
 AVIOContext *pb = s->pb;
 AVCodecContext *enc = s->streams[stream_index]->codec;
 AVIStream *avist= s->streams[stream_index]->priv_data;
+AVPacket *opkt = pkt;
+enum AVPixelFormat pix_fmt = enc->pix_fmt;
 int ret;
 
 if (enc->codec_id == AV_CODEC_ID_H264 && enc->codec_tag == MKTAG('H','2','6','4') && pkt->size) {
@@ -668,44 +669,57 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
 if ((ret = write_skip_frames(s, stream_index, pkt->dts)) < 0)
 return ret;
 
+if (!pkt->size)
+return avi_write_packet_internal(s, pkt); /* Passthrough */
+
 if (enc->codec_id == AV_CODEC_ID_RAWVIDEO && enc->codec_tag == 0) {
 int64_t bpc = enc->bits_per_coded_sample != 15 ? enc->bits_per_coded_sample : 16;
 int expected_stride = ((enc->width * bpc + 31) >> 5)*4;
-
 ret = ff_reshuffle_raw_rgb(s, , enc, expected_stride);
 if (ret < 0)
 return ret;
-if (ret) {
-if (ret == CONTAINS_PAL) {
-int pc_tag, i;
-int pal_size = 1 << enc->bits_per_coded_sample;
-if (!avist->hdr_pal_done) {
-int64_t cur_offset = avio_tell(pb);
-avio_seek(pb, avist->pal_offset, SEEK_SET);
-for (i = 0; i < pal_size; i++) {
-uint32_t v = AV_RL32(data + size - 4*pal_size + 4*i);
-avio_wl32(pb, v & 0xff);
-}
-avio_seek(pb, cur_offset, SEEK_SET);
-avist->hdr_pal_done++;
-}
-avi_stream2fourcc(tag, stream_index, enc->codec_type);
-tag[2] = 'p'; tag[3] = 'c';
-pc_tag = ff_start_tag(pb, tag);
-avio_w8(pb, 0);
-avio_w8(pb, pal_size & 0xFF);
-avio_wl16(pb, 0); // reserved
+} else
+ret = 0;
+if (pix_fmt == AV_PIX_FMT_NONE && enc->bits_per_coded_sample == 1)
+pix_fmt = AV_PIX_FMT_MONOWHITE;
+if (pix_fmt == AV_PIX_FMT_PAL8 ||
+pix_fmt == AV_PIX_FMT_MONOWHITE ||
+pix_fmt == AV_PIX_FMT_MONOBLACK) {
+const uint8_t *pal;
+int ret2 = ff_get_raw_palette(s, opkt, ret, );
+if (ret2 < 0)
+return ret2;
+if (pal) {
+int pal_size = 1 << enc->bits_per_coded_sample;
+int pc_tag, i;
+if (pb->seekable && !avist->hdr_pal_done) {
+int64_t cur_offset = avio_tell(pb);
+avio_seek(pb, avist->pal_offset, SEEK_SET);
 for (i = 0; i < pal_size; i++) {
-uint32_t v = AV_RL32(data + size - 4*pal_size + 4*i);
-avio_wb32(pb, v<<8);
+uint32_t v = AV_RL32(pal + 4*i);
+avio_wl32(pb, v & 0xff);
 }
-ff_end_tag(pb, pc_tag);
+avio_seek(pb, cur_offset, SEEK_SET);
+avist->hdr_pal_done++;
 }
-ret = avi_write_packet_internal(s, pkt);
-av_packet_free();
-return ret;
+avi_stream2fourcc(tag, stream_index, enc->codec_type);
+tag[2] = 'p'; tag[3] = 'c';
+

Re: [FFmpeg-devel] [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson

On 02/29/2016 02:27 PM, Mats Peterson wrote:

New patch set.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel




Sorry, Michael, but this won't be the last version. There are other 
codecs than rawvideo that use a palette, so I'm working on a new version.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v9] VideoToolbox H.264 Encoder

2016-02-29 Thread Rick Kern
Autodetected by default. Encode using -codec:v vtenc.

Signed-off-by: Rick Kern 
---
 MAINTAINERS|1 +
 configure  |   19 +
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |1 +
 libavcodec/vtenc.c | 1339 
 5 files changed, 1361 insertions(+)
 create mode 100644 libavcodec/vtenc.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 155642b..650da3c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -289,6 +289,7 @@ Codecs:
   vp8   David Conrad, Jason Garrett-Glaser, 
Ronald Bultje
   vp9   Ronald Bultje, Clément Bœsch
   vqavideo.cMike Melanson
+  vtenc.c   Rick Kern
   wavpack.c Kostya Shishkov
   wmaprodec.c   Sascha Sommer
   wmavoice.cRonald S. Bultje
diff --git a/configure b/configure
index 8491fa1..c7af891 100755
--- a/configure
+++ b/configure
@@ -289,6 +289,7 @@ External library support:
   --disable-sdldisable sdl [autodetect]
   --disable-securetransport disable Secure Transport, needed for TLS support
on OSX if openssl and gnutls are not used 
[autodetect]
+  --disable-vtenc  disable VideoToolbox H.264 encoder [autodetect]
   --enable-x11grab enable X11 grabbing (legacy) [no]
   --disable-xlib   disable xlib [autodetect]
   --disable-zlib   disable zlib [autodetect]
@@ -1509,6 +1510,7 @@ EXTERNAL_LIBRARY_LIST="
 schannel
 sdl
 securetransport
+vtenc
 x11grab
 xlib
 zlib
@@ -2672,6 +2674,9 @@ libzvbi_teletext_decoder_deps="libzvbi"
 nvenc_encoder_deps="nvenc"
 nvenc_h264_encoder_deps="nvenc"
 nvenc_hevc_encoder_deps="nvenc"
+vtenc_encoder_deps="vtenc VideoToolbox_VideoToolbox_h pthreads"
+vtenc_encoder_select="bzlib zlib iconv"
+vtenc_encoder_extralibs="-framework CoreFoundation -framework VideoToolbox 
-framework CoreMedia"
 
 # demuxers / muxers
 ac3_demuxer_select="ac3_parser"
@@ -5695,6 +5700,20 @@ enabled openssl   && { use_pkg_config openssl 
openssl/ssl.h SSL_library_
check_lib openssl/ssl.h SSL_library_init -lssl 
-lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
 enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
qtkit_indev; }
+{ disabled vtenc_encoder && disable vtenc; } || 
+{ disabled vtenc && 
+  disable vtenc_encoder; } ||
+{ enabled vtenc &&
+  require VideoToolbox 
VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames 
-framework VideoToolbox &&
+  enable vtenc_encoder; } ||
+{ enabled vtenc_encoder &&
+  check_lib VideoToolbox/VTCompressionSession.h 
VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox &&
+  enable vtenc; } ||
+{ disable vtenc && 
+  disable vtenc_encoder; }
+enabled vtenc_encoder&& check_header "TargetConditionals.h" &&
+{ check_cpp_condition "TargetConditionals.h" 
"TARGET_OS_MAC && !TARGET_OS_IPHONE" &&
+  vtenc_encoder_extralibs+=" -framework 
VideoDecodeAcceleration"; }
 
 # libdc1394 check
 if enabled libdc1394; then
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 667e257..8249def 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -120,6 +120,7 @@ OBJS-$(CONFIG_TEXTUREDSPENC)   += texturedspenc.o
 OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
 OBJS-$(CONFIG_VC1DSP)  += vc1dsp.o
 OBJS-$(CONFIG_VIDEODSP)+= videodsp.o
+OBJS-$(CONFIG_VTENC)   += vtenc.o
 OBJS-$(CONFIG_VP3DSP)  += vp3dsp.o
 OBJS-$(CONFIG_VP56DSP) += vp56dsp.o
 OBJS-$(CONFIG_VP8DSP)  += vp8dsp.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2097db0..29724bb 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -610,6 +610,7 @@ void avcodec_register_all(void)
 REGISTER_ENCODER(HEVC_QSV,  hevc_qsv);
 REGISTER_ENCODER(LIBKVAZAAR,libkvazaar);
 REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
+REGISTER_ENCODER(VTENC, vtenc);
 
 /* parsers */
 REGISTER_PARSER(AAC,aac);
diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c
new file mode 100644
index 000..f653d8d
--- /dev/null
+++ b/libavcodec/vtenc.c
@@ -0,0 +1,1339 @@
+/*
+ * copyright (c) 2015 Rick Kern 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the 

[FFmpeg-devel] [PATCH v9] VideoToolbox H.264 Encoder

2016-02-29 Thread Rick Kern
Replaced color_range with av_frame_get_color_range().

Rick Kern (1):
  VideoToolbox H.264 Encoder

 MAINTAINERS|1 +
 configure  |   19 +
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |1 +
 libavcodec/vtenc.c | 1339 
 5 files changed, 1361 insertions(+)
 create mode 100644 libavcodec/vtenc.c

-- 
2.5.4 (Apple Git-61)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] sdp: fix opus sprop-stereo fmtp syntax

2016-02-29 Thread Mark Harris
---
 libavformat/sdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 2ab37a8..368402b 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -706,7 +706,7 @@ static char *sdp_write_media_attributes(char *buff, int 
size, AVCodecContext *c,
 av_strlcatf(buff, size, "a=rtpmap:%d opus/48000/2\r\n",
  payload_type);
 if (c->channels == 2) {
-av_strlcatf(buff, size, "a=fmtp:%d sprop-stereo:1\r\n",
+av_strlcatf(buff, size, "a=fmtp:%d sprop-stereo=1\r\n",
  payload_type);
 }
 break;
-- 
2.7.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Fw: [Outreachy Announce] Outreachy: help spread the word and Twitter chats

2016-02-29 Thread Michael Niedermayer
Hi mentors

Forwarding as it says "please forward this e-mail to any mentors from your org 
new to Outreachy this round and encourage them to participate."


- Forwarded message from Marina Zhurakhinskaya  -

Date: Mon, 29 Feb 2016 22:47:14 -0500 (EST)
From: Marina Zhurakhinskaya 
To: outreachy-interns-december-2015 
, outreachy-alums 
, outreachy-announce-list 
, outreachy-list 
Subject: Re: [Outreachy Announce] Outreachy: help spread the word and Twitter 
chats

Dear Outreachy community,

The #OutreachyChat times are upon us! Chats will take place tomorrow (March 1) 
at 4pm UTC / 11am EST and at 2am UTC (March 2) / 9pm EST (March 1). I'll be 
tweeting from @outreachy account and will pose the questions below with an 
interval of 5-10 minutes between questions. As you can see, they are prefaced 
with Q1, Q2, and so on, and correspondingly, you will need to reply with A1, 
A2, and so on in your answers. You will also need to use the hashtag 
#OutreachyChat in all your tweets related to the chat. Prospective applicants 
will be encouraged to ask follow-up questions, so you might find yourself in 
further discussions with them. The following questions are planned for the chat:

Q1: Please introduce yourself. Are you a mentor? Alum? Applicant? What project 
are you working on or looking into? #OutreachyChat
Q2: For mentors, tell us about your org's work, its structure, size? What is it 
like to participate in your community? #OutreachyChat
Q3: For alums, what did you gain as the result of Outreachy internship? 
#OutreachyChat
Q4: For mentors, what is the project you are mentoring? What skills does one 
need to have for it? What will they learn? #OutreachyChat
Q5: For alums, what is your advice for prospective applicants? #OutreachyChat
Q6: For mentors, what does an applicant need to do to make the first 
contribution to your project? #OutreachyChat

Please feel free to make suggestions for further improving these questions or 
adding new ones.

Because the goal of having two chats is to have them at two different times so 
that more people can participate, the same questions will used in both chats 
and if you are able to participate in both chats, you should provide 
(approximately) the same answers. 

Coordinators, please respond to questions addressed to mentors in the chat - 
after all, you are mentors too :). Also, please forward this e-mail to any 
mentors from your org new to Outreachy this round and encourage them to 
participate.

Looking forward to the chats tomorrow!

Marina

- Original Message -
From: "Marina Zhurakhinskaya" 
To: "outreachy-interns-december-2015" 
, "outreachy-alums" 
, "outreachy-announce-list" 
, "outreachy-list" 
Sent: Tuesday, February 23, 2016 4:52:57 PM
Subject: Outreachy: help spread the word and Twitter chats

Dear Outreachy community,

We have opened applications for the new round of the program and would love 
your help spreading the word. Please send the information to your university 
department or community group, share it on social networks, or encourage 
someone you know to apply. We have a sample e-mail and sample social network 
updates you can use available at 
https://wiki.gnome.org/Outreachy/2016/MayAugust/SpreadTheWord

Please join us for Twitter chats with #OutreachyChat hashtag at 4pm UTC on 
March 1 (11am EST) or at 2am UTC on March 2 (9pm EST on March 1). The goal of 
the chats is to increase the visibility of this opportunity and individual 
project ideas, and to encourage more people to apply. We will ask mentors to 
introduce their organizations and project ideas and past interns to share their 
advice and experience. Closer to the chat date, I will share with you the 
questions we'll have.

Thanks!
Marina
___
Outreachy-announce-list mailing list
outreachy-announce-l...@gnome.org
https://mail.gnome.org/mailman/listinfo/outreachy-announce-list


- End forwarded message -

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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: add filter-hls

2016-02-29 Thread Michael Niedermayer
On Tue, Mar 01, 2016 at 12:32:27AM -0300, James Almer wrote:
> On 3/1/2016 12:24 AM, Michael Niedermayer wrote:
> > On Tue, Mar 01, 2016 at 12:17:33AM -0300, James Almer wrote:
> >> On 2/29/2016 11:47 PM, Michael Niedermayer wrote:
> >>> +fate-filter-hls2: tests/data/hls-list.m3u8
> >>
> >> Why not just add fate-filter-hls1 as dep here, and get rid of the m3u8 
> >> target above?
> > 
> > i think that isnt correct
> > consider that the m3u8 has been build previously and the user runs
> > make fate-filter-hls2
> > the hls1 test should not run in that case, its not needed
> 
> Doesn't seem to be the case, though. At least not on msys2/mingw64:

ok, simpliied as you suggested then ...



[...]
-- 
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


Re: [FFmpeg-devel] [PATCH] fate: add filter-hls

2016-02-29 Thread James Almer
On 3/1/2016 12:24 AM, Michael Niedermayer wrote:
> On Tue, Mar 01, 2016 at 12:17:33AM -0300, James Almer wrote:
>> On 2/29/2016 11:47 PM, Michael Niedermayer wrote:
>>> +fate-filter-hls2: tests/data/hls-list.m3u8
>>
>> Why not just add fate-filter-hls1 as dep here, and get rid of the m3u8 
>> target above?
> 
> i think that isnt correct
> consider that the m3u8 has been build previously and the user runs
> make fate-filter-hls2
> the hls1 test should not run in that case, its not needed

Doesn't seem to be the case, though. At least not on msys2/mingw64:

$ make testclean

$ make fate-filter-hls2
HOSTCC  tests/base64.o
HOSTLD  tests/base64.exe
HOSTCC  tests/tiny_psnr.o
HOSTLD  tests/tiny_psnr.exe
HOSTCC  tests/tiny_ssim.o
HOSTLD  tests/tiny_ssim.exe
TESTfilter-hls1
TESTfilter-hls2

$ make fate-filter-hls2
TESTfilter-hls1
TESTfilter-hls2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] AAC encoder 3x performance drop in 3.0 since Oct 2014

2016-02-29 Thread Ganesh Ajjanagadde
On Mon, Feb 29, 2016 at 10:07 PM, Michael Niedermayer
 wrote:
> On Mon, Feb 29, 2016 at 10:02:46PM -0500, Ronald S. Bultje wrote:
>> Hi,
>>
>> On Mon, Feb 29, 2016 at 9:30 PM, Ganesh Ajjanagadde 
>> wrote:
>>
>> > Ideally, FATE should have some basic plotting/performance
>> > infrastructure, e.g a client can submit perf figures so that evolution
>> > over time can be viewed. No idea why this can't be done.
>>
>>
>> It can - it just hasn't been done yet :)
>>
>> Patches welcome, and I personally think this would be very useful and quite
>> cool.
>
> i too think this would be cool, it will be somewhat noisy though for
> some clients (like mine, which run in 8 VMs on the same host)
> depending on how many of them run and how many are idle there will
> be fluctuations

I assume that we are not operating under an "adversarial situation",
i.e that is mitigated via current FATE mechanics. Then, we can limit
the concerns to issues like the one you desribed.

For this, as an extra goal, one could envision computing some sort of
variance/confidence intervals after sufficiently many runs. This could
also go into the report, so that one could e.g go to FATE and sort by
confidence level in addition to the other fields.

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Those who are too smart to engage in politics are punished by being
> governed by those who are dumber. -- Plato
>
> ___
> 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] fate: add filter-hls

2016-02-29 Thread Michael Niedermayer
On Tue, Mar 01, 2016 at 12:17:33AM -0300, James Almer wrote:
> On 2/29/2016 11:47 PM, Michael Niedermayer wrote:
> > ---
> >  tests/fate/filter-audio.mak |7 +
> >  tests/ref/fate/filter-hls2  |  768 
> > +++
> >  2 files changed, 775 insertions(+)
> >  create mode 100644 tests/ref/fate/filter-hls1
> >  create mode 100644 tests/ref/fate/filter-hls2
> > 
> > diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
> > index 85a36d2..a330a93 100644
> > --- a/tests/fate/filter-audio.mak
> > +++ b/tests/fate/filter-audio.mak
> > @@ -3,6 +3,13 @@ fate-filter-adelay: tests/data/asynth-44100-2.wav
> >  fate-filter-adelay: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
> >  fate-filter-adelay: CMD = framecrc -i $(SRC) -af adelay=42
> >  
> > +FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MOV_MUXER MOV_DEMUXER 
> > AEVALSRC_FILTER LAVFI_INDEV MP2FIXED_ENCODER) += fate-filter-hls1 
> > fate-filter-hls2
> 
> Shouldn't it be MPEGTS instead of MOV?

fixed


> 
> > +tests/data/hls-list.m3u8: fate-filter-hls1
> > +fate-filter-hls1: CMD = run ffmpeg -f lavfi -i 
> > "aevalsrc=cos(2*PI*t)*sin(2*PI*(440+4*t)*t)::d=20" -f segment -segment_time 
> > 10 -map 0 -flags +bitexact -codec:a mp2fixed \
> > +   -segment_list 
> > $(TARGET_PATH)/tests/data/hls-list.m3u8 
> > $(TARGET_PATH)/tests/data/hls-out-%03d.ts
> 
> Add a "fate-filter-hls1: REF = /dev/null" line here to avoid the empty ref 
> file.

fixed


> 
> > +fate-filter-hls2: tests/data/hls-list.m3u8
> 
> Why not just add fate-filter-hls1 as dep here, and get rid of the m3u8 target 
> above?

i think that isnt correct
consider that the m3u8 has been build previously and the user runs
make fate-filter-hls2
the hls1 test should not run in that case, its not needed

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc/aacenc_utils: replace sqrtf(Q*sqrtf(Q)) by precomputed value

2016-02-29 Thread Ganesh Ajjanagadde
It makes no sense whatsoever to do this at each function call; we
already have a table for this.

Yields a 2x improvement in find_min_book (x86-64, Haswell+GCC):
ffmpeg -i sin.flac -acodec aac -y sin.aac
find_min_book
old
605 decicycles in find_min_book, 8388453 runs,155 skips.9x
606 decicycles in find_min_book,16776912 runs,304 skips.9x
607 decicycles in find_min_book,33553819 runs,613 skips.2x
607 decicycles in find_min_book,67107668 runs,   1196 skips.3x
607 decicycles in find_min_book,134215360 runs,   2368 skips3x

new
359 decicycles in find_min_book, 8388552 runs, 56 skips.3x
360 decicycles in find_min_book,16777112 runs,104 skips.1x
361 decicycles in find_min_book,33554218 runs,214 skips.4x
361 decicycles in find_min_book,67108381 runs,483 skips.5x
361 decicycles in find_min_book,134216725 runs,   1003 skips5x

and more importantly a non-negligible speedup (~ 8%) to overall AAC encoding:
old:
ffmpeg -i sin.flac -acodec aac -strict -2 -y sin_new.aac  6.82s user 0.03s 
system 104% cpu 6.565 total
new:
ffmpeg -i sin.flac -acodec aac -strict -2 -y sin_old.aac  6.24s user 0.03s 
system 104% cpu 5.993 total

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/aacenc_utils.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h
index cb5bc8d..c2a2c2e 100644
--- a/libavcodec/aacenc_utils.h
+++ b/libavcodec/aacenc_utils.h
@@ -90,8 +90,7 @@ static inline float find_max_val(int group_len, int swb_size, 
const float *scale
 
 static inline int find_min_book(float maxval, int sf)
 {
-float Q = ff_aac_pow2sf_tab[POW_SF2_ZERO - sf + SCALE_ONE_POS - 
SCALE_DIV_512];
-float Q34 = sqrtf(Q * sqrtf(Q));
+float Q34 = ff_aac_pow34sf_tab[POW_SF2_ZERO - sf + SCALE_ONE_POS - 
SCALE_DIV_512];
 int qmaxval, cb;
 qmaxval = maxval * Q34 + C_QUANT;
 if (qmaxval >= (FF_ARRAY_ELEMS(aac_maxval_cb)))
-- 
2.7.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] fate: add filter-hls

2016-02-29 Thread James Almer
On 2/29/2016 11:47 PM, Michael Niedermayer wrote:
> ---
>  tests/fate/filter-audio.mak |7 +
>  tests/ref/fate/filter-hls2  |  768 
> +++
>  2 files changed, 775 insertions(+)
>  create mode 100644 tests/ref/fate/filter-hls1
>  create mode 100644 tests/ref/fate/filter-hls2
> 
> diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
> index 85a36d2..a330a93 100644
> --- a/tests/fate/filter-audio.mak
> +++ b/tests/fate/filter-audio.mak
> @@ -3,6 +3,13 @@ fate-filter-adelay: tests/data/asynth-44100-2.wav
>  fate-filter-adelay: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
>  fate-filter-adelay: CMD = framecrc -i $(SRC) -af adelay=42
>  
> +FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MOV_MUXER MOV_DEMUXER 
> AEVALSRC_FILTER LAVFI_INDEV MP2FIXED_ENCODER) += fate-filter-hls1 
> fate-filter-hls2

Shouldn't it be MPEGTS instead of MOV?

> +tests/data/hls-list.m3u8: fate-filter-hls1
> +fate-filter-hls1: CMD = run ffmpeg -f lavfi -i 
> "aevalsrc=cos(2*PI*t)*sin(2*PI*(440+4*t)*t)::d=20" -f segment -segment_time 
> 10 -map 0 -flags +bitexact -codec:a mp2fixed \
> +   -segment_list 
> $(TARGET_PATH)/tests/data/hls-list.m3u8 
> $(TARGET_PATH)/tests/data/hls-out-%03d.ts

Add a "fate-filter-hls1: REF = /dev/null" line here to avoid the empty ref file.

> +fate-filter-hls2: tests/data/hls-list.m3u8

Why not just add fate-filter-hls1 as dep here, and get rid of the m3u8 target 
above?

> +fate-filter-hls2: CMD = framecrc -flags +bitexact -i 
> $(TARGET_PATH)/tests/data/hls-list.m3u8
> +
>  FATE_AMIX += fate-filter-amix-simple
>  fate-filter-amix-simple: CMD = ffmpeg -filter_complex amix -i $(SRC) -ss 3 
> -i $(SRC1) -f f32le -
>  fate-filter-amix-simple: REF = $(SAMPLES)/filter/amix_simple.pcm
> diff --git a/tests/ref/fate/filter-hls1 b/tests/ref/fate/filter-hls1
> new file mode 100644
> index 000..e69de29

No comments about the actual test, but it trust you it's ok.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] AAC encoder 3x performance drop in 3.0 since Oct 2014

2016-02-29 Thread Michael Niedermayer
On Mon, Feb 29, 2016 at 10:02:46PM -0500, Ronald S. Bultje wrote:
> Hi,
> 
> On Mon, Feb 29, 2016 at 9:30 PM, Ganesh Ajjanagadde 
> wrote:
> 
> > Ideally, FATE should have some basic plotting/performance
> > infrastructure, e.g a client can submit perf figures so that evolution
> > over time can be viewed. No idea why this can't be done.
> 
> 
> It can - it just hasn't been done yet :)
> 
> Patches welcome, and I personally think this would be very useful and quite
> cool.

i too think this would be cool, it will be somewhat noisy though for
some clients (like mine, which run in 8 VMs on the same host)
depending on how many of them run and how many are idle there will
be fluctuations

[...]
-- 
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] Add the relaxed and acquire/releae flavors of avpriv_atomic_int_get and avpriv_atomic_int_set.

2016-02-29 Thread Ronald S. Bultje
Hi,

On Mon, Feb 29, 2016 at 9:35 PM, Wan-Teh Chang  wrote:

> Correct the order of the load/store operation and the memory barrier in
> avpriv_atomic_int_get and avpriv_atomic_int_set.
>

This sounds useful. Is there some documentation on which one should be used
under what conditions? I.e. when do I need full, release or acquire?

Use the atomic get and set functions in ff_thread_report_progress and
> ff_thread_await_progress.


I'd personally split this off into its own patch, but not a big deal
obviously.

Thanks,
Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] AAC encoder 3x performance drop in 3.0 since Oct 2014

2016-02-29 Thread Ronald S. Bultje
Hi,

On Mon, Feb 29, 2016 at 9:30 PM, Ganesh Ajjanagadde 
wrote:

> Ideally, FATE should have some basic plotting/performance
> infrastructure, e.g a client can submit perf figures so that evolution
> over time can be viewed. No idea why this can't be done.


It can - it just hasn't been done yet :)

Patches welcome, and I personally think this would be very useful and quite
cool.

Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Fix a bug in ff_thread_report_progress in updating progress[field].

2016-02-29 Thread Ronald S. Bultje
Hi,

On Mon, Feb 29, 2016 at 5:41 PM, Wan-Teh Chang  wrote:

> This bug was found by Dmitry Vyukov. If two threads may call
> ff_thread_report_progress at the same time, progress[field] may
> decrease. For example, suppose progress[field] is 10 and two threads
> call ff_thread_report_progress to update progress[field] to 11 and
> 12, respectively. If the second thread acquires progress_mutex first
> and updates progress[field] to 12, then the first thread will update
> progress[field] to 11, causing progress[field] to decrease.
> ---
>  libavcodec/pthread_frame.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
> index b77dd1e..a43e8fe 100644
> --- a/libavcodec/pthread_frame.c
> +++ b/libavcodec/pthread_frame.c
> @@ -482,8 +482,10 @@ void ff_thread_report_progress(ThreadFrame *f, int n,
> int field)
>  av_log(f->owner, AV_LOG_DEBUG, "%p finished %d field %d\n",
> progress, n, field);
>
>  pthread_mutex_lock(>progress_mutex);
> -progress[field] = n;
> -pthread_cond_broadcast(>progress_cond);
> +if (progress[field] < n) {
> +progress[field] = n;
> +pthread_cond_broadcast(>progress_cond);
> +}
>  pthread_mutex_unlock(>progress_mutex);
>  }


Do you have a sample+commandline to reproduce? The thing is, in all cases
where we use this, only one thread writes to a specific progress[n]. Two
threads may write to progress[], one per field, but one will write to
progress[0] and the other to progress[1]. If this happens, I don't mind the
patch, but I'd like to know how exactly this happens (also for posterity
documentation purposes).

Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] fate: add filter-hls

2016-02-29 Thread Michael Niedermayer
---
 tests/fate/filter-audio.mak |7 +
 tests/ref/fate/filter-hls2  |  768 +++
 2 files changed, 775 insertions(+)
 create mode 100644 tests/ref/fate/filter-hls1
 create mode 100644 tests/ref/fate/filter-hls2

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 85a36d2..a330a93 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -3,6 +3,13 @@ fate-filter-adelay: tests/data/asynth-44100-2.wav
 fate-filter-adelay: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-adelay: CMD = framecrc -i $(SRC) -af adelay=42
 
+FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MOV_MUXER MOV_DEMUXER AEVALSRC_FILTER 
LAVFI_INDEV MP2FIXED_ENCODER) += fate-filter-hls1 fate-filter-hls2
+tests/data/hls-list.m3u8: fate-filter-hls1
+fate-filter-hls1: CMD = run ffmpeg -f lavfi -i 
"aevalsrc=cos(2*PI*t)*sin(2*PI*(440+4*t)*t)::d=20" -f segment -segment_time 10 
-map 0 -flags +bitexact -codec:a mp2fixed \
+   -segment_list 
$(TARGET_PATH)/tests/data/hls-list.m3u8 
$(TARGET_PATH)/tests/data/hls-out-%03d.ts
+fate-filter-hls2: tests/data/hls-list.m3u8
+fate-filter-hls2: CMD = framecrc -flags +bitexact -i 
$(TARGET_PATH)/tests/data/hls-list.m3u8
+
 FATE_AMIX += fate-filter-amix-simple
 fate-filter-amix-simple: CMD = ffmpeg -filter_complex amix -i $(SRC) -ss 3 -i 
$(SRC1) -f f32le -
 fate-filter-amix-simple: REF = $(SAMPLES)/filter/amix_simple.pcm
diff --git a/tests/ref/fate/filter-hls1 b/tests/ref/fate/filter-hls1
new file mode 100644
index 000..e69de29
diff --git a/tests/ref/fate/filter-hls2 b/tests/ref/fate/filter-hls2
new file mode 100644
index 000..30bd96fb
--- /dev/null
+++ b/tests/ref/fate/filter-hls2
@@ -0,0 +1,768 @@
+#tb 0: 1/44100
+0,  0,  0, 1152, 2304, 0x907cb7fa
+0,   1152,   1152, 1152, 2304, 0xb8dc7525
+0,   2304,   2304, 1152, 2304, 0x3e7d6905
+0,   3456,   3456, 1152, 2304, 0xef47877b
+0,   4608,   4608, 1152, 2304, 0xfe916b7e
+0,   5760,   5760, 1152, 2304, 0xe3d08cde
+0,   6912,   6912, 1152, 2304, 0xff7f86cf
+0,   8064,   8064, 1152, 2304, 0x843e6f95
+0,   9216,   9216, 1152, 2304, 0x81577c26
+0,  10368,  10368, 1152, 2304, 0x04a085d5
+0,  11520,  11520, 1152, 2304, 0x1c5a76f5
+0,  12672,  12672, 1152, 2304, 0x4ee78623
+0,  13824,  13824, 1152, 2304, 0x8ec861dc
+0,  14976,  14976, 1152, 2304, 0x0ca179d8
+0,  16128,  16128, 1152, 2304, 0xc6da750f
+0,  17280,  17280, 1152, 2304, 0xf6bf79b5
+0,  18432,  18432, 1152, 2304, 0x97b88a43
+0,  19584,  19584, 1152, 2304, 0xf13c7b9c
+0,  20736,  20736, 1152, 2304, 0xdfba83af
+0,  21888,  21888, 1152, 2304, 0xc9467d4b
+0,  23040,  23040, 1152, 2304, 0xbbb58e2b
+0,  24192,  24192, 1152, 2304, 0x3a1078ea
+0,  25344,  25344, 1152, 2304, 0xe9587a5c
+0,  26496,  26496, 1152, 2304, 0xef5a8039
+0,  27648,  27648, 1152, 2304, 0x9d5f782f
+0,  28800,  28800, 1152, 2304, 0x1a548291
+0,  29952,  29952, 1152, 2304, 0x07517701
+0,  31104,  31104, 1152, 2304, 0x78127d6e
+0,  32256,  32256, 1152, 2304, 0x62e2788a
+0,  33408,  33408, 1152, 2304, 0x29397ad9
+0,  34560,  34560, 1152, 2304, 0x45da82d6
+0,  35712,  35712, 1152, 2304, 0x8ed66e51
+0,  36864,  36864, 1152, 2304, 0x660775cd
+0,  38016,  38016, 1152, 2304, 0x802c767a
+0,  39168,  39168, 1152, 2304, 0xcc055840
+0,  40320,  40320, 1152, 2304, 0x701b7eaf
+0,  41472,  41472, 1152, 2304, 0x8290749f
+0,  42624,  42624, 1152, 2304, 0x2c7b7d30
+0,  43776,  43776, 1152, 2304, 0xe4f17743
+0,  44928,  44928, 1152, 2304, 0x0e747d6e
+0,  46080,  46080, 1152, 2304, 0xbe7775a0
+0,  47232,  47232, 1152, 2304, 0xcf797673
+0,  48384,  48384, 1152, 2304, 0x29cb7800
+0,  49536,  49536, 1152, 2304, 0xfc947890
+0,  50688,  50688, 1152, 2304, 0x62757fc6
+0,  51840,  51840, 1152, 2304, 0x098876d0
+0,  52992,  52992, 1152, 2304, 0xa9567ee2
+0,  54144,  54144, 1152, 2304, 0xe3bb9173
+0,  55296,  55296, 1152, 2304, 0xcc2d6dee
+0,  56448,  56448, 1152, 2304, 0xe94591ab
+0,  57600,  57600, 1152, 2304, 0x5c7588de
+0,  58752,  58752, 1152, 2304, 0xfd83643c
+0,  59904,  59904, 1152, 2304, 0x528177f1
+0,  61056,  61056, 1152, 2304, 0x65d08474
+0,  62208,  62208, 1152,   

[FFmpeg-devel] [PATCH] Add the relaxed and acquire/releae flavors of avpriv_atomic_int_get and avpriv_atomic_int_set.

2016-02-29 Thread Wan-Teh Chang
Correct the order of the load/store operation and the memory barrier in
avpriv_atomic_int_get and avpriv_atomic_int_set.

Use the atomic get and set functions in ff_thread_report_progress and
ff_thread_await_progress.
---
 libavcodec/pthread_frame.c | 11 +++
 libavutil/atomic.c | 48 ++
 libavutil/atomic.h | 33 +++
 libavutil/atomic_gcc.h | 44 ++
 libavutil/atomic_suncc.h   | 30 -
 libavutil/atomic_win32.h   | 28 +++
 6 files changed, 189 insertions(+), 5 deletions(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index b77dd1e..34f9207 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -32,6 +32,7 @@
 #include "thread.h"
 #include "version.h"
 
+#include "libavutil/atomic.h"
 #include "libavutil/avassert.h"
 #include "libavutil/buffer.h"
 #include "libavutil/common.h"
@@ -474,7 +475,7 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int 
field)
 PerThreadContext *p;
 volatile int *progress = f->progress ? (int*)f->progress->data : NULL;
 
-if (!progress || progress[field] >= n) return;
+if (!progress || avpriv_atomic_int_get_relaxed([field]) >= n) 
return;
 
 p = f->owner->internal->thread_ctx;
 
@@ -482,8 +483,10 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int 
field)
 av_log(f->owner, AV_LOG_DEBUG, "%p finished %d field %d\n", progress, 
n, field);
 
 pthread_mutex_lock(>progress_mutex);
-progress[field] = n;
-pthread_cond_broadcast(>progress_cond);
+if (progress[field] < n) {
+avpriv_atomic_int_set_release([field], n);
+pthread_cond_broadcast(>progress_cond);
+}
 pthread_mutex_unlock(>progress_mutex);
 }
 
@@ -492,7 +495,7 @@ void ff_thread_await_progress(ThreadFrame *f, int n, int 
field)
 PerThreadContext *p;
 volatile int *progress = f->progress ? (int*)f->progress->data : NULL;
 
-if (!progress || progress[field] >= n) return;
+if (!progress || avpriv_atomic_int_get_acquire([field]) >= n) 
return;
 
 p = f->owner->internal->thread_ctx;
 
diff --git a/libavutil/atomic.c b/libavutil/atomic.c
index b13725d..3dc9062 100644
--- a/libavutil/atomic.c
+++ b/libavutil/atomic.c
@@ -40,6 +40,16 @@ int avpriv_atomic_int_get(volatile int *ptr)
 return res;
 }
 
+int avpriv_atomic_int_get_relaxed(volatile int *ptr)
+{
+return avpriv_atomic_int_get(ptr);
+}
+
+int avpriv_atomic_int_get_acquire(volatile int *ptr)
+{
+return avpriv_atomic_int_get(ptr);
+}
+
 void avpriv_atomic_int_set(volatile int *ptr, int val)
 {
 pthread_mutex_lock(_lock);
@@ -47,6 +57,16 @@ void avpriv_atomic_int_set(volatile int *ptr, int val)
 pthread_mutex_unlock(_lock);
 }
 
+void avpriv_atomic_int_set_relaxed(volatile int *ptr, int val)
+{
+avpriv_atomic_int_set(ptr, val);
+}
+
+void avpriv_atomic_int_set_release(volatile int *ptr, int val)
+{
+avpriv_atomic_int_set(ptr, val);
+}
+
 int avpriv_atomic_int_add_and_fetch(volatile int *ptr, int inc)
 {
 int res;
@@ -77,11 +97,31 @@ int avpriv_atomic_int_get(volatile int *ptr)
 return *ptr;
 }
 
+int avpriv_atomic_int_get_relaxed(volatile int *ptr)
+{
+return avpriv_atomic_int_get(ptr);
+}
+
+int avpriv_atomic_int_get_acquire(volatile int *ptr)
+{
+return avpriv_atomic_int_get(ptr);
+}
+
 void avpriv_atomic_int_set(volatile int *ptr, int val)
 {
 *ptr = val;
 }
 
+void avpriv_atomic_int_set_relaxed(volatile int *ptr, int val)
+{
+avpriv_atomic_int_set(ptr, val);
+}
+
+void avpriv_atomic_int_set_release(volatile int *ptr, int val)
+{
+avpriv_atomic_int_set(ptr, val);
+}
+
 int avpriv_atomic_int_add_and_fetch(volatile int *ptr, int inc)
 {
 *ptr += inc;
@@ -121,6 +161,14 @@ int main(void)
 avpriv_atomic_int_set(, 3);
 res = avpriv_atomic_int_get();
 av_assert0(res == 3);
+avpriv_atomic_int_set_relaxed(, 5);
+res = avpriv_atomic_int_get_relaxed();
+av_assert0(res == 5);
+res = avpriv_atomic_int_add_and_fetch(, -1);
+av_assert0(res == 4);
+avpriv_atomic_int_set_release(, 3);
+res = avpriv_atomic_int_get_acquire();
+av_assert0(res == 3);
 
 return 0;
 }
diff --git a/libavutil/atomic.h b/libavutil/atomic.h
index 15906d2..1921095 100644
--- a/libavutil/atomic.h
+++ b/libavutil/atomic.h
@@ -45,6 +45,23 @@
 int avpriv_atomic_int_get(volatile int *ptr);
 
 /**
+ * Load the current value stored in an atomic integer, with no memory barrier.
+ *
+ * @param ptr atomic integer
+ * @return the current value of the atomic integer
+ */
+int avpriv_atomic_int_get_relaxed(volatile int *ptr);
+
+/**
+ * Load the current value stored in an atomic integer, with an acquire memory
+ * barrier.
+ *
+ * @param ptr atomic integer
+ * @return the current value of the atomic integer
+ */
+int avpriv_atomic_int_get_acquire(volatile int *ptr);
+
+/**
  * Store a new value in an 

Re: [FFmpeg-devel] AAC encoder 3x performance drop in 3.0 since Oct 2014

2016-02-29 Thread Ganesh Ajjanagadde
On Mon, Feb 22, 2016 at 11:34 PM, Andrey Utkin
 wrote:
> Hi!
> I am aware of news that AAC encoder got stable status recently.
>
> But you could find this interesting. We've got an ffmpeg build from
> October 2014, and it performs three times faster on AAC encoding than
> recent 3.0 release. There is no complaints about audio quality on old
> version, and I can honestly say the audio quality is really
> satisfiable on old version. The performance is paramount in our
> particular usecase, so it is silly to deploy a new version which
> performs so noticeably worse. Still deploying new release is needed due
> to other particular bugfixes.
>
> Obvious things like lowering bitrace, setting "-aac_coder fast" don't
> help.
>
> You can check this yourself with this script (it is also inlined below):
> https://gist.github.com/andrey-utkin/c60cd4070eb962d58075
>
> On my workstation, the old version finishes the transcoding in 2.5s,
> the new one in 6.6s.
>
> Is there any workaround? Or is the old times speed is buried by
> correctness and stability?

No idea about this. However, here is some info.
The regression in speed dates to: 01ecb7172b684f1c4b3e748f95c5a9a494ca36ec.
At this commit, there was a bad speed regression (11.475 s, vs 2.525 s
before vs 6.565 s current).
As can be judged from this, since the main commit bringing in the
revamped encoder, there have been efforts that have shaved off some
time, some that increase it slightly, etc.
However, the chief one that brought it down from 11.x to 6.y was
b629c67ddfceb7026e407685f04d1bb09cb08d31. Since then, performance has
been generally stable at ~ 6.5 s +/- 10%.

Generally speaking though, it is indeed true that speed is still
somewhat lacking:
https://ffmpeg.org/pipermail/ffmpeg-devel/2015-December/184631.html.

Ideally, FATE should have some basic plotting/performance
infrastructure, e.g a client can submit perf figures so that evolution
over time can be viewed. No idea why this can't be done.
[...]
> ___
> 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


[FFmpeg-devel] [PATCH] lavf/dump.c: Print mastering display metadata

2016-02-29 Thread Neil Birkbeck
Signed-off-by: Neil Birkbeck 
---
 libavformat/dump.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 56c285d..9e7c12b 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -26,6 +26,7 @@
 #include "libavutil/display.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/log.h"
+#include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
 #include "libavutil/avstring.h"
@@ -352,6 +353,23 @@ static void dump_cpb(void *ctx, AVPacketSideData *sd)
cpb->vbv_delay);
 }
 
+static void dump_mastering_display_metadata(void *ctx, AVPacketSideData* sd) {
+AVMasteringDisplayMetadata* metadata = 
(AVMasteringDisplayMetadata*)sd->data;
+av_log(ctx, AV_LOG_INFO, "Mastering Display Metadata, "
+   "has_primaries:%d has_luminance:%d "
+   "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
+   "min_luminance=%f, max_luminance=%f\n",
+   metadata->has_primaries, metadata->has_luminance,
+   av_q2d(metadata->display_primaries[0][0]),
+   av_q2d(metadata->display_primaries[0][1]),
+   av_q2d(metadata->display_primaries[1][0]),
+   av_q2d(metadata->display_primaries[1][1]),
+   av_q2d(metadata->display_primaries[2][0]),
+   av_q2d(metadata->display_primaries[2][1]),
+   av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1]),
+   av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
+}
+
 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
 {
 int i;
@@ -400,6 +418,9 @@ static void dump_sidedata(void *ctx, AVStream *st, const 
char *indent)
 av_log(ctx, AV_LOG_INFO, "cpb: ");
 dump_cpb(ctx, );
 break;
+case AV_PKT_DATA_MASTERING_DISPLAY_METADATA:
+dump_mastering_display_metadata(ctx, );
+break;
 default:
 av_log(ctx, AV_LOG_WARNING,
"unknown side data type %d (%d bytes)", sd.type, sd.size);
-- 
2.7.0.rc3.207.g0ac5344

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavf/matroskadec: Add early support for colour elements

2016-02-29 Thread Neil Birkbeck
Adding early support for a subset of the proposed colour elements
according to the latest version of spec:
https://mailarchive.ietf.org/arch/search/?email_list=cellar=1=hIKLhMdgTMTEwUTeA4ct38h0tmE

I've left out elements for pix_fmt related things as there still
seems to be some discussion around these, and the max_cll/max_fall
are currently not propagated as there is not yet side data for them.

The new elements are exposed under strict experimental mode.

Signed-off-by: Neil Birkbeck 
---
 libavformat/matroska.h|  28 ++
 libavformat/matroskadec.c | 136 ++
 2 files changed, 164 insertions(+)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index a654e0c..e97fe6b 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -123,6 +123,34 @@
 #define MATROSKA_ID_VIDEOALPHAMODE 0x53C0
 #define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
 #define MATROSKA_ID_VIDEOCOLORSPACE 0x2EB524
+#define MATROSKA_ID_VIDEOCOLOR 0x55B0
+
+#define MATROSKA_ID_VIDEOCOLORMATRIXCOEFF 0x55B1
+#define MATROSKA_ID_VIDEOCOLORBITSPERCHANNEL 0x55B2
+#define MATROSKA_ID_VIDEOCOLORCHROMASUBHORZ 0x55B3
+#define MATROSKA_ID_VIDEOCOLORCHROMASUBVERT 0x55B4
+#define MATROSKA_ID_VIDEOCOLORCBSUBHORZ 0x55B5
+#define MATROSKA_ID_VIDEOCOLORCBSUBVERT 0x55B6
+#define MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ 0x55B7
+#define MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT 0x55B8
+#define MATROSKA_ID_VIDEOCOLORRANGE 0x55B9
+#define MATROSKA_ID_VIDEOCOLORTRANSFERCHARACTERISTICS 0x55BA
+
+#define MATROSKA_ID_VIDEOCOLORPRIMARIES 0x55BB
+#define MATROSKA_ID_VIDEOCOLORMAXCLL 0x55BC
+#define MATROSKA_ID_VIDEOCOLORMAXFALL 0x55BD
+
+#define MATROSKA_ID_VIDEOCOLORMASTERINGMETA 0x55D0
+#define MATROSKA_ID_VIDEOCOLOR_RX 0x55D1
+#define MATROSKA_ID_VIDEOCOLOR_RY 0x55D2
+#define MATROSKA_ID_VIDEOCOLOR_GX 0x55D3
+#define MATROSKA_ID_VIDEOCOLOR_GY 0x55D4
+#define MATROSKA_ID_VIDEOCOLOR_BX 0x55D5
+#define MATROSKA_ID_VIDEOCOLOR_BY 0x55D6
+#define MATROSKA_ID_VIDEOCOLOR_WHITEX 0x55D7
+#define MATROSKA_ID_VIDEOCOLOR_WHITEY 0x55D8
+#define MATROSKA_ID_VIDEOCOLOR_LUMINANCEMAX 0x55D9
+#define MATROSKA_ID_VIDEOCOLOR_LUMINANCEMIN 0x55DA
 
 /* IDs in the trackaudio master */
 #define MATROSKA_ID_AUDIOSAMPLINGFREQ 0xB5
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index d20568c..4510e8e 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -39,6 +39,7 @@
 #include "libavutil/intfloat.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/lzo.h"
+#include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
 #include "libavutil/time_internal.h"
@@ -130,6 +131,36 @@ typedef struct MatroskaTrackEncoding {
 MatroskaTrackEncryption encryption;
 } MatroskaTrackEncoding;
 
+typedef struct MatroskaMasteringMeta {
+double r_x;
+double r_y;
+double g_x;
+double g_y;
+double b_x;
+double b_y;
+double white_x;
+double white_y;
+double max_luminance;
+double min_luminance;
+} MatroskaMasteringMeta;
+
+typedef struct MatroskaTrackVideoColor {
+uint64_t matrix_coefficients;
+uint64_t bits_per_channel;
+uint64_t chroma_sub_horz;
+uint64_t chroma_sub_vert;
+uint64_t cb_sub_horz;
+uint64_t cb_sub_vert;
+uint64_t chroma_siting_horz;
+uint64_t chroma_siting_vert;
+uint64_t range;
+uint64_t transfer_characteristics;
+uint64_t primaries;
+uint64_t max_cll;
+uint64_t max_fall;
+MatroskaMasteringMeta mastering_meta;
+} MatroskaTrackVideoColor;
+
 typedef struct MatroskaTrackVideo {
 double   frame_rate;
 uint64_t display_width;
@@ -139,6 +170,7 @@ typedef struct MatroskaTrackVideo {
 EbmlBin color_space;
 uint64_t stereo_mode;
 uint64_t alpha_mode;
+MatroskaTrackVideoColor color;
 } MatroskaTrackVideo;
 
 typedef struct MatroskaTrackAudio {
@@ -356,6 +388,36 @@ static const EbmlSyntax matroska_info[] = {
 { 0 }
 };
 
+static const EbmlSyntax matroska_mastering_meta[] = {
+{ MATROSKA_ID_VIDEOCOLOR_RX, EBML_FLOAT, 0, 
offsetof(MatroskaMasteringMeta, r_x), { .f=-1 } },
+{ MATROSKA_ID_VIDEOCOLOR_RY, EBML_FLOAT, 0, 
offsetof(MatroskaMasteringMeta, r_y), { .f=-1 } },
+{ MATROSKA_ID_VIDEOCOLOR_GX, EBML_FLOAT, 0, 
offsetof(MatroskaMasteringMeta, g_x), { .f=-1 } },
+{ MATROSKA_ID_VIDEOCOLOR_GY, EBML_FLOAT, 0, 
offsetof(MatroskaMasteringMeta, g_y), { .f=-1 } },
+{ MATROSKA_ID_VIDEOCOLOR_BX, EBML_FLOAT, 0, 
offsetof(MatroskaMasteringMeta, b_x), { .f=-1 } },
+{ MATROSKA_ID_VIDEOCOLOR_BY, EBML_FLOAT, 0, 
offsetof(MatroskaMasteringMeta, b_y), { .f=-1 } },
+{ MATROSKA_ID_VIDEOCOLOR_WHITEX, EBML_FLOAT, 0, 
offsetof(MatroskaMasteringMeta, white_x), { .f=-1 } },
+{ MATROSKA_ID_VIDEOCOLOR_WHITEY, EBML_FLOAT, 0, 
offsetof(MatroskaMasteringMeta, white_y), { .f=-1 } },
+{ MATROSKA_ID_VIDEOCOLOR_LUMINANCEMIN, EBML_FLOAT, 0, 
offsetof(MatroskaMasteringMeta, min_luminance), { .f=-1 } 

Re: [FFmpeg-devel] [PATCH] Ignore invalid sprop-parameter-sets missing PPS

2016-02-29 Thread Andrew Shulgin
Thanks :)

On Tue, Mar 1, 2016 at 2:43 AM, Michael Niedermayer 
wrote:

> On Tue, Mar 01, 2016 at 02:11:28AM +0200, Andrew Shulgin wrote:
> > Yep, you're right.
>
> ok, applied
>
> thanks
>
>
> >
> > On Tue, Mar 1, 2016 at 2:09 AM, Michael Niedermayer
> 
> > wrote:
> >
> > > On Mon, Feb 29, 2016 at 03:10:41PM +0200, Andrew Shulgin wrote:
> > > > Extracting SPS without the missig PPS results in unplayable FLV.
> > > >
> > > > ffmpeg -thread_queue_size 512 -rtsp_transport tcp -i rtsp://
> > > > admin:12345@192.88.99.1/h264/ch1/main/av_stream -ar 44100 -ac 2
> -acodec
> > > > pcm_s16le -f s16le -ac 2 -i /dev/zero -c:v copy -acodec aac -strict
> > > > experimental -ab 128k -f flv wrong.flv
> > > >
> > > > Uploaded to upload.ffmpeg.org with filename
> > > > rtsp-invalid-sprop-parameter-sets.flv
> > > >
> > > > Also you may download the sample from here:
> > > > http://home.rmrf.co/storage/rtsp-invalid-sprop-parameter-sets.flv
> > >
> > > that doesnt play, do i guess correctly that this testcase works
> > > and results in a playable file with the original patch ?
> > >
> > > [...]
> > > --
> > > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> > >
> > > During times of universal deceit, telling the truth becomes a
> > > revolutionary act. -- George Orwell
> > >
> > > ___
> > > 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
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Democracy is the form of government in which you can choose your dictator
>
> ___
> 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] Ignore invalid sprop-parameter-sets missing PPS

2016-02-29 Thread Michael Niedermayer
On Tue, Mar 01, 2016 at 02:11:28AM +0200, Andrew Shulgin wrote:
> Yep, you're right.

ok, applied

thanks


> 
> On Tue, Mar 1, 2016 at 2:09 AM, Michael Niedermayer 
> wrote:
> 
> > On Mon, Feb 29, 2016 at 03:10:41PM +0200, Andrew Shulgin wrote:
> > > Extracting SPS without the missig PPS results in unplayable FLV.
> > >
> > > ffmpeg -thread_queue_size 512 -rtsp_transport tcp -i rtsp://
> > > admin:12345@192.88.99.1/h264/ch1/main/av_stream -ar 44100 -ac 2 -acodec
> > > pcm_s16le -f s16le -ac 2 -i /dev/zero -c:v copy -acodec aac -strict
> > > experimental -ab 128k -f flv wrong.flv
> > >
> > > Uploaded to upload.ffmpeg.org with filename
> > > rtsp-invalid-sprop-parameter-sets.flv
> > >
> > > Also you may download the sample from here:
> > > http://home.rmrf.co/storage/rtsp-invalid-sprop-parameter-sets.flv
> >
> > that doesnt play, do i guess correctly that this testcase works
> > and results in a playable file with the original patch ?
> >
> > [...]
> > --
> > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > During times of universal deceit, telling the truth becomes a
> > revolutionary act. -- George Orwell
> >
> > ___
> > 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

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec: Remove libvo-aacenc support.

2016-02-29 Thread Roger Pack
On 1/25/16, Hendrik Leppkes  wrote:
> On Mon, Jan 25, 2016 at 1:13 PM, Michael Niedermayer
>  wrote:
>> On Mon, Jan 25, 2016 at 10:24:36AM +, Carl Eugen Hoyos wrote:
>>> Kieran Kunhya  kunhya.com> writes:
>>>
>>> > The internal encoder is superior to libvo-aacenc.
>>>
>>> I thought this was the case for several years?
>>>
>>> Needs a Changelog entry and a news entry together with
>>> libaacplus.
>>
>> how does the speed of all the aac encoders compare ?
>> we should keep the fastest and the one havng best quality per bit
>> (assuming thats a single one and not multiple due to different behavior
>> at different bitrates)
>>
>> also it may make sense to keep activly developed encoders so users and
>> develoeprs can continue to test/compare and use them in case they
>> improve
>>
>
>
> libvo-aacenc is a dump from an earlier Android build. Android has
> since switched to fdk-aac and libvo-aacenc is just dead.
> So from that perspective, there is definitely nothing lost.
>
> Can't judge the speed, but libvo-aacenc has the worst quality of all
> aac lc encoders we had, so I doubt anyone is going to miss it.

For some reason this person:
https://ffmpeg.zeranoe.com/forum/viewtopic.php?f=5=1457
Missed it ("it's 4x slower!")...
FWIW.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] lavu/rational: add more info regarding floor(x+0.5) usage

2016-02-29 Thread Ganesh Ajjanagadde
On Thu, Feb 25, 2016 at 1:11 PM, Michael Niedermayer
 wrote:
> On Wed, Feb 24, 2016 at 09:20:11PM -0500, Ganesh Ajjanagadde wrote:
>> Add some more verbose info regarding why the imprecise and slow floor(x+0.5) 
>> hack
>> is used; helpful for future maintenance.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  libavutil/rational.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> LGTM
>
> thanks

pushed, thanks

>
> [...]
> --
> 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.
>
> ___
> 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] Ignore invalid sprop-parameter-sets missing PPS

2016-02-29 Thread Andrew Shulgin
Yep, you're right.

On Tue, Mar 1, 2016 at 2:09 AM, Michael Niedermayer 
wrote:

> On Mon, Feb 29, 2016 at 03:10:41PM +0200, Andrew Shulgin wrote:
> > Extracting SPS without the missig PPS results in unplayable FLV.
> >
> > ffmpeg -thread_queue_size 512 -rtsp_transport tcp -i rtsp://
> > admin:12345@192.88.99.1/h264/ch1/main/av_stream -ar 44100 -ac 2 -acodec
> > pcm_s16le -f s16le -ac 2 -i /dev/zero -c:v copy -acodec aac -strict
> > experimental -ab 128k -f flv wrong.flv
> >
> > Uploaded to upload.ffmpeg.org with filename
> > rtsp-invalid-sprop-parameter-sets.flv
> >
> > Also you may download the sample from here:
> > http://home.rmrf.co/storage/rtsp-invalid-sprop-parameter-sets.flv
>
> that doesnt play, do i guess correctly that this testcase works
> and results in a playable file with the original patch ?
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> During times of universal deceit, telling the truth becomes a
> revolutionary act. -- George Orwell
>
> ___
> 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] Ignore invalid sprop-parameter-sets missing PPS

2016-02-29 Thread Michael Niedermayer
On Mon, Feb 29, 2016 at 03:10:41PM +0200, Andrew Shulgin wrote:
> Extracting SPS without the missig PPS results in unplayable FLV.
> 
> ffmpeg -thread_queue_size 512 -rtsp_transport tcp -i rtsp://
> admin:12345@192.88.99.1/h264/ch1/main/av_stream -ar 44100 -ac 2 -acodec
> pcm_s16le -f s16le -ac 2 -i /dev/zero -c:v copy -acodec aac -strict
> experimental -ab 128k -f flv wrong.flv
> 
> Uploaded to upload.ffmpeg.org with filename
> rtsp-invalid-sprop-parameter-sets.flv
> 
> Also you may download the sample from here:
> http://home.rmrf.co/storage/rtsp-invalid-sprop-parameter-sets.flv

that doesnt play, do i guess correctly that this testcase works
and results in a playable file with the original patch ?

[...]
-- 
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


[FFmpeg-devel] [PATCH] avformat/udp: Add a delay between packets for streaming to clients with short buffer

2016-02-29 Thread Pavel Nikiforov
Hello !

This patch enables background sending of UDP packets with specified delay.
When sending packets without a delay some devices with small RX buffer
( MAG200 STB, for example) will drop tail packets in burst causing
decoding errors.

It needs to specify "fifo_size" with "packet_gap" .

The output url will looks like udp://xxx:yyy?fifo_size=_gap=

Patch attached.


udp.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Fix a bug in ff_thread_report_progress in updating progress[field].

2016-02-29 Thread Wan-Teh Chang
This bug was found by Dmitry Vyukov. If two threads may call
ff_thread_report_progress at the same time, progress[field] may
decrease. For example, suppose progress[field] is 10 and two threads
call ff_thread_report_progress to update progress[field] to 11 and
12, respectively. If the second thread acquires progress_mutex first
and updates progress[field] to 12, then the first thread will update
progress[field] to 11, causing progress[field] to decrease.
---
 libavcodec/pthread_frame.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index b77dd1e..a43e8fe 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -482,8 +482,10 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int 
field)
 av_log(f->owner, AV_LOG_DEBUG, "%p finished %d field %d\n", progress, 
n, field);
 
 pthread_mutex_lock(>progress_mutex);
-progress[field] = n;
-pthread_cond_broadcast(>progress_cond);
+if (progress[field] < n) {
+progress[field] = n;
+pthread_cond_broadcast(>progress_cond);
+}
 pthread_mutex_unlock(>progress_mutex);
 }
 
-- 
2.7.0.rc3.207.g0ac5344

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson

On 02/29/2016 09:42 PM, Michael Niedermayer wrote:

On Mon, Feb 29, 2016 at 04:12:56PM +0100, Mats Peterson wrote:

Mats Peterson  skrev: (29 februari 2016 
14:27:13 CET)

New patch set.


It seems that you, Michael, don't care much about adding support for palette 
side data packets, while Reimar advocates for it. Is the situation correctly 
understood?


no, iam waiting for the patch series to stabilize, you post a
new one every few hours
when that slows down then ill look (when ive time)



Hehe... OK. Sorry. Well, it's pretty much settled by now. Please go 
ahead and have a look at it.


Mats

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] fate: add libavcodec utils test

2016-02-29 Thread Michael Niedermayer
On Sun, Feb 28, 2016 at 12:50:24PM +0100, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  tests/fate/libavcodec.mak |5 +
>  1 file changed, 5 insertions(+)

patchset applied

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] reordered_opaque

2016-02-29 Thread Ratin
Is it possible for AVCodecContext 's  reordered_opaque to be exactly the
same for 3 or 4 consecutive frames when packet's pts is fed in it ? Is it
because of B frames? I am seeing this, in this case how does one re-orders
the pics to render?


Ratin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Michael Niedermayer
On Mon, Feb 29, 2016 at 04:12:56PM +0100, Mats Peterson wrote:
> Mats Peterson  skrev: (29 februari 2016 
> 14:27:13 CET)
> >New patch set.
> 
> It seems that you, Michael, don't care much about adding support for palette 
> side data packets, while Reimar advocates for it. Is the situation correctly 
> understood?

no, iam waiting for the patch series to stabilize, you post a
new one every few hours
when that slows down then ill look (when ive time)

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/seek-test: Support passing options to demuxers and protocols

2016-02-29 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavformat/seek-test.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c
index bfd06db..904b435 100644
--- a/libavformat/seek-test.c
+++ b/libavformat/seek-test.c
@@ -80,6 +80,8 @@ int main(int argc, char **argv)
 if (atoi(argv[i+1])) {
 ic->flags |= AVFMT_FLAG_FAST_SEEK;
 }
+} else if(argv[i][0] == '-' && argv[i+1]) {
+av_dict_set(_opts, argv[i] + 1, argv[i+1], 0);
 } else {
 argc = 1;
 }
-- 
1.7.9.5

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] fate: add pipe and cache test

2016-02-29 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 tests/fate/seek.mak   |2 ++
 tests/ref/seek/cache-pipe |   49 +
 2 files changed, 51 insertions(+)
 create mode 100644 tests/ref/seek/cache-pipe

diff --git a/tests/fate/seek.mak b/tests/fate/seek.mak
index a229e72..4722cd4 100644
--- a/tests/fate/seek.mak
+++ b/tests/fate/seek.mak
@@ -244,7 +244,9 @@ FATE_SEEK += $(FATE_SEEK_LAVF-yes:%=fate-seek-lavf-%)
 # extra files
 
 FATE_SEEK_EXTRA-$(CONFIG_MP3_DEMUXER)   += fate-seek-extra-mp3
+FATE_SEEK_EXTRA-$(call ALLYES, CACHE_PROTOCOL PIPE_PROTOCOL MP3_DEMUXER) += 
fate-seek-cache-pipe
 fate-seek-extra-mp3:  CMD = run libavformat/seek-test$(EXESUF) 
$(TARGET_SAMPLES)/gapless/gapless.mp3 -fastseek 1
+fate-seek-cache-pipe: CMD = cat $(TARGET_SAMPLES)/gapless/gapless.mp3 | run 
libavformat/seek-test$(EXESUF) cache:pipe:0 -read_ahead_limit -1
 FATE_SEEK_EXTRA += $(FATE_SEEK_EXTRA-yes)
 
 
diff --git a/tests/ref/seek/cache-pipe b/tests/ref/seek/cache-pipe
new file mode 100644
index 000..b6a42e8
--- /dev/null
+++ b/tests/ref/seek/cache-pipe
@@ -0,0 +1,49 @@
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st:-1 flags:0  ts:-1.00
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st:-1 flags:1  ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos:  31544 size:   
418
+ret: 0 st: 0 flags:0  ts: 0.788334
+ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos:  14407 size:   
418
+ret:-1 st: 0 flags:1  ts:-0.317499
+ret: 0 st:-1 flags:0  ts: 2.576668
+ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos:  42828 size:   
418
+ret: 0 st:-1 flags:1  ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos:  24856 size:   
418
+ret: 0 st: 0 flags:0  ts: 0.365002
+ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos:   7302 size:   
418
+ret:-1 st: 0 flags:1  ts:-0.740831
+ret: 0 st:-1 flags:0  ts: 2.153336
+ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos:  36141 size:   
418
+ret: 0 st:-1 flags:1  ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos:  18169 size:   
418
+ret: 0 st: 0 flags:0  ts:-0.058330
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st: 0 flags:1  ts: 2.835837
+ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos:  46590 size:   
418
+ret: 0 st:-1 flags:0  ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos:  29454 size:   
418
+ret: 0 st:-1 flags:1  ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos:  11064 size:   
418
+ret: 0 st: 0 flags:0  ts:-0.481662
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st: 0 flags:1  ts: 2.412505
+ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos:  39903 size:   
418
+ret: 0 st:-1 flags:0  ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos:  22766 size:   
418
+ret: 0 st:-1 flags:1  ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos:   4376 size:   
418
+ret: 0 st: 0 flags:0  ts:-0.904994
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st: 0 flags:1  ts: 1.989173
+ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos:  33215 size:   
418
+ret: 0 st:-1 flags:0  ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos:  15661 size:   
418
+ret:-1 st:-1 flags:1  ts:-0.222493
+ret: 0 st: 0 flags:0  ts: 2.671674
+ret: 0 st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos:  44500 size:   
418
+ret: 0 st: 0 flags:1  ts: 1.565841
+ret: 0 st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos:  26110 size:   
418
+ret: 0 st:-1 flags:0  ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos:   8974 size:   
418
+ret:-1 st:-1 flags:1  ts:-0.645825
-- 
1.7.9.5

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] submit_thread should also lock the mutex that guards the source avctx (prev_thread->avctx) when calling update_context_from_thread.

2016-02-29 Thread Ronald S. Bultje
Hi,

On Mon, Feb 29, 2016 at 2:47 PM, Wan-Teh Chang  wrote:

> On Fri, Feb 26, 2016 at 5:04 PM, Ronald S. Bultje 
> wrote:
> >
> > To be a little bit more explicit, it should be relatively easy to
> > accomplish this by changing the position of qscale in the relevant
> struct,
> > and only copy that half of the struct (where entries are obviously
> grouped)
> > where we actually care about the copied value.
> >
> > See e.g. the copy_fields macro [1] on how we do partial-struct copies.
> >
> > Ronald
> >
> > [1]
> >
> http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/h264_slice.c;h=9a5bc3f63fb5c6aae3747a03657b8dc821c7d750;hb=HEAD#l427
>
> Hi Ronald,
>
> Thanks a lot for the hints. As soon as I had access to a computer last
> Saturday, I implemented your suggestion. Although the data race on
> |qscale| is gone, ThreadSantizer warned about the next data race of
> this kind. I fixed that using the same approach, and then
> ThreadSantizer warned about the next data race of this kind.
>
> That made me realize the fix for this class of data race is going to
> big, and I should do this work in the ffmpeg HEAD rather than the old
> version I'm using. I followed the instructions James Almer gave
> earlier in this email thread:
>
> ./configure --samples=fate-suite/ --toolchain=clang-tsan
> --disable-stripping
> make fate-h264 THREADS=4
>
> (Note: James suggested --toolchain=gcc-tsan. That didn't work for me
> for some reason. I tried --toolchain=clang-tsan instead and it
> worked.)
>
> ThreadSanitizer reported the same class of data races in the h264
> decoder with multiple threads. To understand the code and propose a
> proper fix, I am afraid that I will need to live and breathe this code
> for several days because the structs involved (H264Context,
> H264SliceContext, etc.) have a lot of members.
>
> So, I am wondering if you could run fate-h264 under tsan and take a
> look at the data races in the h264 decoding code. I think you will be
> able to fix the data races much faster than I can. If you don't have a
> lot of time, I'll be happy to implement a solution if you can outline
> it after your investigation. Thanks.


I don't think I care enough about tsan, I'd prefer a tool like Microsoft
Chess that replays concurrency paths. Sorry :(

Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] submit_thread should also lock the mutex that guards the source avctx (prev_thread->avctx) when calling update_context_from_thread.

2016-02-29 Thread Clément Bœsch
On Mon, Feb 29, 2016 at 11:47:14AM -0800, Wan-Teh Chang wrote:
> On Fri, Feb 26, 2016 at 5:04 PM, Ronald S. Bultje  wrote:
> >
> > To be a little bit more explicit, it should be relatively easy to
> > accomplish this by changing the position of qscale in the relevant struct,
> > and only copy that half of the struct (where entries are obviously grouped)
> > where we actually care about the copied value.
> >
> > See e.g. the copy_fields macro [1] on how we do partial-struct copies.
> >
> > Ronald
> >
> > [1]
> > http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/h264_slice.c;h=9a5bc3f63fb5c6aae3747a03657b8dc821c7d750;hb=HEAD#l427
> 
> Hi Ronald,
> 
> Thanks a lot for the hints. As soon as I had access to a computer last
> Saturday, I implemented your suggestion. Although the data race on
> |qscale| is gone, ThreadSantizer warned about the next data race of
> this kind. I fixed that using the same approach, and then
> ThreadSantizer warned about the next data race of this kind.
> 
> That made me realize the fix for this class of data race is going to
> big, and I should do this work in the ffmpeg HEAD rather than the old
> version I'm using. I followed the instructions James Almer gave
> earlier in this email thread:
> 
> ./configure --samples=fate-suite/ --toolchain=clang-tsan --disable-stripping
> make fate-h264 THREADS=4
> 
> (Note: James suggested --toolchain=gcc-tsan. That didn't work for me
> for some reason. I tried --toolchain=clang-tsan instead and it
> worked.)
> 
> ThreadSanitizer reported the same class of data races in the h264
> decoder with multiple threads. To understand the code and propose a
> proper fix, I am afraid that I will need to live and breathe this code
> for several days because the structs involved (H264Context,
> H264SliceContext, etc.) have a lot of members.
> 
> So, I am wondering if you could run fate-h264 under tsan and take a
> look at the data races in the h264 decoding code. I think you will be
> able to fix the data races much faster than I can. If you don't have a
> lot of time, I'll be happy to implement a solution if you can outline
> it after your investigation. Thanks.
> 

BTW, thanks a lot for working on this. You can also play with valgrind
(tool helgrind or drd) if it's supported on your system. You won't need a
special build to use it (although for fate, you'll need something like
--target-exec="valgrind --tool=helgrind" or get the command with make
fate-foobar V=1 and prepend valgrind).

Note: according to Ronald it's actually very close to TSAN.

-- 
Clément B.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] submit_thread should also lock the mutex that guards the source avctx (prev_thread->avctx) when calling update_context_from_thread.

2016-02-29 Thread Wan-Teh Chang
On Fri, Feb 26, 2016 at 5:04 PM, Ronald S. Bultje  wrote:
>
> To be a little bit more explicit, it should be relatively easy to
> accomplish this by changing the position of qscale in the relevant struct,
> and only copy that half of the struct (where entries are obviously grouped)
> where we actually care about the copied value.
>
> See e.g. the copy_fields macro [1] on how we do partial-struct copies.
>
> Ronald
>
> [1]
> http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/h264_slice.c;h=9a5bc3f63fb5c6aae3747a03657b8dc821c7d750;hb=HEAD#l427

Hi Ronald,

Thanks a lot for the hints. As soon as I had access to a computer last
Saturday, I implemented your suggestion. Although the data race on
|qscale| is gone, ThreadSantizer warned about the next data race of
this kind. I fixed that using the same approach, and then
ThreadSantizer warned about the next data race of this kind.

That made me realize the fix for this class of data race is going to
big, and I should do this work in the ffmpeg HEAD rather than the old
version I'm using. I followed the instructions James Almer gave
earlier in this email thread:

./configure --samples=fate-suite/ --toolchain=clang-tsan --disable-stripping
make fate-h264 THREADS=4

(Note: James suggested --toolchain=gcc-tsan. That didn't work for me
for some reason. I tried --toolchain=clang-tsan instead and it
worked.)

ThreadSanitizer reported the same class of data races in the h264
decoder with multiple threads. To understand the code and propose a
proper fix, I am afraid that I will need to live and breathe this code
for several days because the structs involved (H264Context,
H264SliceContext, etc.) have a lot of members.

So, I am wondering if you could run fate-h264 under tsan and take a
look at the data races in the h264 decoding code. I think you will be
able to fix the data races much faster than I can. If you don't have a
lot of time, I'll be happy to implement a solution if you can outline
it after your investigation. Thanks.

Wan-Teh Chang
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread wm4
On Mon, 29 Feb 2016 20:07:15 +0100
Clément Bœsch  wrote:

> On Mon, Feb 29, 2016 at 06:57:15PM +0100, wm4 wrote:
> [...]
> > > +static bool get_vt_profile_level(AVCodecContext *avctx,
> > > + CFStringRef*profile_level_val)
> > > +{
> > > +VTEncContext *vtctx = avctx->priv_data;
> > > +int64_t profile = vtctx->profile;
> > > +
> > > +if (profile == H264_PROF_AUTO && vtctx->level) {
> > > +//Need to pick a profile if level is not auto-selected.
> > > +profile = vtctx->has_b_frames ? H264_PROF_MAIN : 
> > > H264_PROF_BASELINE;
> > > +}
> > > +
> > > +*profile_level_val = NULL;
> > > +
> > > +switch (profile) {  
> 
> > > +case H264_PROF_AUTO:
> > > +return true;
> > > +  
> 
> We don't use bool in FFmpeg
> 
> > > +case H264_PROF_BASELINE:
> > > +switch (vtctx->level) {
> > > +case  0: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_AutoLevel; break;
> > > +case 13: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_1_3;   break;
> > > +case 30: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_3_0;   break;
> > > +case 31: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_3_1;   break;
> > > +case 32: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_3_2;   break;
> > > +case 40: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_4_0;   break;
> > > +case 41: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_4_1;   break;
> > > +case 42: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_4_2;   break;
> > > +case 50: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_5_0;   break;
> > > +case 51: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_5_1;   break;
> > > +case 52: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_5_2;   break;
> > > +}
> > > +break;
> > > +
> > > +case H264_PROF_MAIN:
> > > +switch (vtctx->level) {
> > > +case  0: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_AutoLevel; break;
> > > +case 30: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_3_0;   break;
> > > +case 31: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_3_1;   break;
> > > +case 32: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_3_2;   break;
> > > +case 40: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_4_0;   break;
> > > +case 41: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_4_1;   break;
> > > +case 42: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_4_2;   break;
> > > +case 50: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_5_0;   break;
> > > +case 51: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_5_1;   break;
> > > +case 52: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_5_2;   break;
> > > +}
> > > +break;
> > > +
> > > +case H264_PROF_HIGH:
> > > +switch (vtctx->level) {
> > > +case  0: *profile_level_val = 
> > > kVTProfileLevel_H264_High_AutoLevel; break;
> > > +case 30: *profile_level_val = 
> > > kVTProfileLevel_H264_High_3_0;   break;
> > > +case 31: *profile_level_val = 
> > > kVTProfileLevel_H264_High_3_1;   break;
> > > +case 32: *profile_level_val = 
> > > kVTProfileLevel_H264_High_3_2;   break;
> > > +case 40: *profile_level_val = 
> > > kVTProfileLevel_H264_High_4_0;   break;
> > > +case 41: *profile_level_val = 
> > > kVTProfileLevel_H264_High_4_1;   break;
> > > +case 42: *profile_level_val = 
> > > kVTProfileLevel_H264_High_4_2;   break;
> > > +case 50: *profile_level_val = 
> > > kVTProfileLevel_H264_High_5_0;   break;
> > > +case 51: *profile_level_val = 
> > > kVTProfileLevel_H264_High_5_1;   break;
> > > +case 52: *profile_level_val = 
> > > kVTProfileLevel_H264_High_5_2;   break;
> > > +}
> > > +break;  
> 
> I don't understand: why don't you put the kVTProfileLevel_H264_* as const
> values? You won't have to do this mapping anymore.
> 
> [...]
> 

The level constants depend on the profile. Blame Apple.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] submit_thread should also lock the mutex that guards the source avctx (prev_thread->avctx) when calling update_context_from_thread.

2016-02-29 Thread Wan-Teh Chang
Hi James,

On Thu, Feb 25, 2016 at 6:50 PM, James Almer  wrote:
>
> Did you try running the FATE suite using threadsanitizer, or just decoded 
> random
> videos? I remember like half the tests were failing because of data races and
> most of them pointed to code changed by your patches. It would be interesting 
> to
> see how they are affected.

When I submitted my patch for review, I only decoded random videos
(with an old version of ffmpeg). Later in this email thread, Ronald
showed my patch removed all concurrency, so I'll need to go back to
the drawing board.

> configure has the --toolchain=gcc-tsan option for this. Make sure to also add
> --disable-stripping, then run "make fate THREADS=4 SAMPLES=/path/to/samples" 
> or
> similar. You may instead want to run a small set at a time instead of the 
> whole
> suite since it's big and threadsanitizer slow. Try for example fate-h264 in 
> that
> case.

Thank you very much for the command line. I did this last Saturday on
the ffmpeg HEAD. Although the h264 decoding code has changed
significantly between the old version I'm using and the ffmpeg HEAD, I
am certain these are the same class of data race.

Wan-Teh Chang
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread Clément Bœsch
On Mon, Feb 29, 2016 at 08:14:10PM +0100, Nicolas George wrote:
> Le primidi 11 ventôse, an CCXXIV, Clement Boesch a écrit :
> > > > +case H264_PROF_BASELINE:
> > > > +switch (vtctx->level) {
> > > > +case  0: *profile_level_val = 
> > > > kVTProfileLevel_H264_Baseline_AutoLevel; break;
>   
> 
> 
> > > > +case H264_PROF_MAIN:
> > > > +switch (vtctx->level) {
> > > > +case  0: *profile_level_val = 
> > > > kVTProfileLevel_H264_Main_AutoLevel; break;
>   
> 
> > I don't understand: why don't you put the kVTProfileLevel_H264_* as const
> > values? You won't have to do this mapping anymore.
> 
> I wondered too, but I found an explanation. Apparently, the wrapped API
> combines the profile and level setting into a single constant. We could
> replicate that in FFmpeg, but the other codecs use separate profile and
> level options.
> 
> It could probably be done with an array instead of a switch; I do not know
> what results in the most compact code.
> 

Ah, my bad. OK

-- 
Clément B.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread Nicolas George
Le primidi 11 ventôse, an CCXXIV, Clement Boesch a écrit :
> > > +case H264_PROF_BASELINE:
> > > +switch (vtctx->level) {
> > > +case  0: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_AutoLevel; break;
  


> > > +case H264_PROF_MAIN:
> > > +switch (vtctx->level) {
> > > +case  0: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_AutoLevel; break;
  

> I don't understand: why don't you put the kVTProfileLevel_H264_* as const
> values? You won't have to do this mapping anymore.

I wondered too, but I found an explanation. Apparently, the wrapped API
combines the profile and level setting into a single constant. We could
replicate that in FFmpeg, but the other codecs use separate profile and
level options.

It could probably be done with an array instead of a switch; I do not know
what results in the most compact code.

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 v8] VideoToolbox H.264 Encoder

2016-02-29 Thread Clément Bœsch
On Mon, Feb 29, 2016 at 06:57:15PM +0100, wm4 wrote:
[...]
> > +static bool get_vt_profile_level(AVCodecContext *avctx,
> > + CFStringRef*profile_level_val)
> > +{
> > +VTEncContext *vtctx = avctx->priv_data;
> > +int64_t profile = vtctx->profile;
> > +
> > +if (profile == H264_PROF_AUTO && vtctx->level) {
> > +//Need to pick a profile if level is not auto-selected.
> > +profile = vtctx->has_b_frames ? H264_PROF_MAIN : 
> > H264_PROF_BASELINE;
> > +}
> > +
> > +*profile_level_val = NULL;
> > +
> > +switch (profile) {

> > +case H264_PROF_AUTO:
> > +return true;
> > +

We don't use bool in FFmpeg

> > +case H264_PROF_BASELINE:
> > +switch (vtctx->level) {
> > +case  0: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_AutoLevel; break;
> > +case 13: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_1_3;   break;
> > +case 30: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_3_0;   break;
> > +case 31: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_3_1;   break;
> > +case 32: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_3_2;   break;
> > +case 40: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_4_0;   break;
> > +case 41: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_4_1;   break;
> > +case 42: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_4_2;   break;
> > +case 50: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_5_0;   break;
> > +case 51: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_5_1;   break;
> > +case 52: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_5_2;   break;
> > +}
> > +break;
> > +
> > +case H264_PROF_MAIN:
> > +switch (vtctx->level) {
> > +case  0: *profile_level_val = 
> > kVTProfileLevel_H264_Main_AutoLevel; break;
> > +case 30: *profile_level_val = 
> > kVTProfileLevel_H264_Main_3_0;   break;
> > +case 31: *profile_level_val = 
> > kVTProfileLevel_H264_Main_3_1;   break;
> > +case 32: *profile_level_val = 
> > kVTProfileLevel_H264_Main_3_2;   break;
> > +case 40: *profile_level_val = 
> > kVTProfileLevel_H264_Main_4_0;   break;
> > +case 41: *profile_level_val = 
> > kVTProfileLevel_H264_Main_4_1;   break;
> > +case 42: *profile_level_val = 
> > kVTProfileLevel_H264_Main_4_2;   break;
> > +case 50: *profile_level_val = 
> > kVTProfileLevel_H264_Main_5_0;   break;
> > +case 51: *profile_level_val = 
> > kVTProfileLevel_H264_Main_5_1;   break;
> > +case 52: *profile_level_val = 
> > kVTProfileLevel_H264_Main_5_2;   break;
> > +}
> > +break;
> > +
> > +case H264_PROF_HIGH:
> > +switch (vtctx->level) {
> > +case  0: *profile_level_val = 
> > kVTProfileLevel_H264_High_AutoLevel; break;
> > +case 30: *profile_level_val = 
> > kVTProfileLevel_H264_High_3_0;   break;
> > +case 31: *profile_level_val = 
> > kVTProfileLevel_H264_High_3_1;   break;
> > +case 32: *profile_level_val = 
> > kVTProfileLevel_H264_High_3_2;   break;
> > +case 40: *profile_level_val = 
> > kVTProfileLevel_H264_High_4_0;   break;
> > +case 41: *profile_level_val = 
> > kVTProfileLevel_H264_High_4_1;   break;
> > +case 42: *profile_level_val = 
> > kVTProfileLevel_H264_High_4_2;   break;
> > +case 50: *profile_level_val = 
> > kVTProfileLevel_H264_High_5_0;   break;
> > +case 51: *profile_level_val = 
> > kVTProfileLevel_H264_High_5_1;   break;
> > +case 52: *profile_level_val = 
> > kVTProfileLevel_H264_High_5_2;   break;
> > +}
> > +break;

I don't understand: why don't you put the kVTProfileLevel_H264_* as const
values? You won't have to do this mapping anymore.

[...]

-- 
Clément B.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread Michael Niedermayer
On Tue, Mar 01, 2016 at 01:30:58AM +0800, Rick Kern wrote:
> Autodetected by default. Encode using -codec:v vtenc.
> 
> Signed-off-by: Rick Kern 
[...]

> +/*
> + * contiguous_buf_size is 0 if not contiguous, and the size of the buffer
> + * containing all planes if so.
> + */
> +static int get_cv_pixel_info(
> +AVCodecContext *avctx,
> +const AVFrame  *frame,
> +int*color,
> +int*plane_count,
> +size_t *widths,
> +size_t *heights,
> +size_t *strides,
> +size_t *contiguous_buf_size)
> +{
> +VTEncContext *vtctx = avctx->priv_data;
> +int av_format   = frame->format;

> +int av_color_range  = frame->color_range;

needs av_frame_get_color_range() OR update to the API as documented
in libavutil/frame.h

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi: add bench and abench filters

2016-02-29 Thread Paul B Mahol
On 2/29/16, Clement Boesch  wrote:
> From: Clement Boesch 
>
> ---
> TODO: doc, bump, Changelog
>
> example: -vf bench=start,gradfun,format=rgba,hqx,bench=stop

Nice, LGTM with documentation changes.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread wm4
On Tue,  1 Mar 2016 01:30:58 +0800
Rick Kern  wrote:

> Autodetected by default. Encode using -codec:v vtenc.
> 
> Signed-off-by: Rick Kern 
> ---
>  MAINTAINERS|1 +
>  configure  |   19 +
>  libavcodec/Makefile|1 +
>  libavcodec/allcodecs.c |1 +
>  libavcodec/vtenc.c | 1339 
> 
>  5 files changed, 1361 insertions(+)
>  create mode 100644 libavcodec/vtenc.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 155642b..650da3c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -289,6 +289,7 @@ Codecs:
>vp8   David Conrad, Jason Garrett-Glaser, 
> Ronald Bultje
>vp9   Ronald Bultje, Clément Bœsch
>vqavideo.cMike Melanson
> +  vtenc.c   Rick Kern
>wavpack.c Kostya Shishkov
>wmaprodec.c   Sascha Sommer
>wmavoice.cRonald S. Bultje
> diff --git a/configure b/configure
> index 8491fa1..c7af891 100755
> --- a/configure
> +++ b/configure
> @@ -289,6 +289,7 @@ External library support:
>--disable-sdldisable sdl [autodetect]
>--disable-securetransport disable Secure Transport, needed for TLS support
> on OSX if openssl and gnutls are not used 
> [autodetect]
> +  --disable-vtenc  disable VideoToolbox H.264 encoder [autodetect]
>--enable-x11grab enable X11 grabbing (legacy) [no]
>--disable-xlib   disable xlib [autodetect]
>--disable-zlib   disable zlib [autodetect]
> @@ -1509,6 +1510,7 @@ EXTERNAL_LIBRARY_LIST="
>  schannel
>  sdl
>  securetransport
> +vtenc
>  x11grab
>  xlib
>  zlib
> @@ -2672,6 +2674,9 @@ libzvbi_teletext_decoder_deps="libzvbi"
>  nvenc_encoder_deps="nvenc"
>  nvenc_h264_encoder_deps="nvenc"
>  nvenc_hevc_encoder_deps="nvenc"
> +vtenc_encoder_deps="vtenc VideoToolbox_VideoToolbox_h pthreads"
> +vtenc_encoder_select="bzlib zlib iconv"
> +vtenc_encoder_extralibs="-framework CoreFoundation -framework VideoToolbox 
> -framework CoreMedia"
>  
>  # demuxers / muxers
>  ac3_demuxer_select="ac3_parser"
> @@ -5695,6 +5700,20 @@ enabled openssl   && { use_pkg_config openssl 
> openssl/ssl.h SSL_library_
> check_lib openssl/ssl.h SSL_library_init 
> -lssl -lcrypto -lws2_32 -lgdi32 ||
> die "ERROR: openssl not found"; }
>  enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
> qtkit_indev; }
> +{ disabled vtenc_encoder && disable vtenc; } || 
> +{ disabled vtenc && 
> +  disable vtenc_encoder; } ||
> +{ enabled vtenc &&
> +  require VideoToolbox 
> VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames 
> -framework VideoToolbox &&
> +  enable vtenc_encoder; } ||
> +{ enabled vtenc_encoder &&
> +  check_lib VideoToolbox/VTCompressionSession.h 
> VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox &&
> +  enable vtenc; } ||
> +{ disable vtenc && 
> +  disable vtenc_encoder; }
> +enabled vtenc_encoder&& check_header "TargetConditionals.h" &&
> +{ check_cpp_condition "TargetConditionals.h" 
> "TARGET_OS_MAC && !TARGET_OS_IPHONE" &&
> +  vtenc_encoder_extralibs+=" -framework 
> VideoDecodeAcceleration"; }
>  
>  # libdc1394 check
>  if enabled libdc1394; then
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 5389725..63fbb80 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -120,6 +120,7 @@ OBJS-$(CONFIG_TEXTUREDSPENC)   += texturedspenc.o
>  OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
>  OBJS-$(CONFIG_VC1DSP)  += vc1dsp.o
>  OBJS-$(CONFIG_VIDEODSP)+= videodsp.o
> +OBJS-$(CONFIG_VTENC)   += vtenc.o
>  OBJS-$(CONFIG_VP3DSP)  += vp3dsp.o
>  OBJS-$(CONFIG_VP56DSP) += vp56dsp.o
>  OBJS-$(CONFIG_VP8DSP)  += vp8dsp.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 2097db0..29724bb 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -610,6 +610,7 @@ void avcodec_register_all(void)
>  REGISTER_ENCODER(HEVC_QSV,  hevc_qsv);
>  REGISTER_ENCODER(LIBKVAZAAR,libkvazaar);
>  REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
> +REGISTER_ENCODER(VTENC, vtenc);
>  
>  /* parsers */
>  REGISTER_PARSER(AAC,aac);
> diff --git a/libavcodec/vtenc.c 

[FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread Rick Kern
Autodetected by default. Encode using -codec:v vtenc.

Signed-off-by: Rick Kern 
---
 MAINTAINERS|1 +
 configure  |   19 +
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |1 +
 libavcodec/vtenc.c | 1339 
 5 files changed, 1361 insertions(+)
 create mode 100644 libavcodec/vtenc.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 155642b..650da3c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -289,6 +289,7 @@ Codecs:
   vp8   David Conrad, Jason Garrett-Glaser, 
Ronald Bultje
   vp9   Ronald Bultje, Clément Bœsch
   vqavideo.cMike Melanson
+  vtenc.c   Rick Kern
   wavpack.c Kostya Shishkov
   wmaprodec.c   Sascha Sommer
   wmavoice.cRonald S. Bultje
diff --git a/configure b/configure
index 8491fa1..c7af891 100755
--- a/configure
+++ b/configure
@@ -289,6 +289,7 @@ External library support:
   --disable-sdldisable sdl [autodetect]
   --disable-securetransport disable Secure Transport, needed for TLS support
on OSX if openssl and gnutls are not used 
[autodetect]
+  --disable-vtenc  disable VideoToolbox H.264 encoder [autodetect]
   --enable-x11grab enable X11 grabbing (legacy) [no]
   --disable-xlib   disable xlib [autodetect]
   --disable-zlib   disable zlib [autodetect]
@@ -1509,6 +1510,7 @@ EXTERNAL_LIBRARY_LIST="
 schannel
 sdl
 securetransport
+vtenc
 x11grab
 xlib
 zlib
@@ -2672,6 +2674,9 @@ libzvbi_teletext_decoder_deps="libzvbi"
 nvenc_encoder_deps="nvenc"
 nvenc_h264_encoder_deps="nvenc"
 nvenc_hevc_encoder_deps="nvenc"
+vtenc_encoder_deps="vtenc VideoToolbox_VideoToolbox_h pthreads"
+vtenc_encoder_select="bzlib zlib iconv"
+vtenc_encoder_extralibs="-framework CoreFoundation -framework VideoToolbox 
-framework CoreMedia"
 
 # demuxers / muxers
 ac3_demuxer_select="ac3_parser"
@@ -5695,6 +5700,20 @@ enabled openssl   && { use_pkg_config openssl 
openssl/ssl.h SSL_library_
check_lib openssl/ssl.h SSL_library_init -lssl 
-lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
 enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
qtkit_indev; }
+{ disabled vtenc_encoder && disable vtenc; } || 
+{ disabled vtenc && 
+  disable vtenc_encoder; } ||
+{ enabled vtenc &&
+  require VideoToolbox 
VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames 
-framework VideoToolbox &&
+  enable vtenc_encoder; } ||
+{ enabled vtenc_encoder &&
+  check_lib VideoToolbox/VTCompressionSession.h 
VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox &&
+  enable vtenc; } ||
+{ disable vtenc && 
+  disable vtenc_encoder; }
+enabled vtenc_encoder&& check_header "TargetConditionals.h" &&
+{ check_cpp_condition "TargetConditionals.h" 
"TARGET_OS_MAC && !TARGET_OS_IPHONE" &&
+  vtenc_encoder_extralibs+=" -framework 
VideoDecodeAcceleration"; }
 
 # libdc1394 check
 if enabled libdc1394; then
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 5389725..63fbb80 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -120,6 +120,7 @@ OBJS-$(CONFIG_TEXTUREDSPENC)   += texturedspenc.o
 OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
 OBJS-$(CONFIG_VC1DSP)  += vc1dsp.o
 OBJS-$(CONFIG_VIDEODSP)+= videodsp.o
+OBJS-$(CONFIG_VTENC)   += vtenc.o
 OBJS-$(CONFIG_VP3DSP)  += vp3dsp.o
 OBJS-$(CONFIG_VP56DSP) += vp56dsp.o
 OBJS-$(CONFIG_VP8DSP)  += vp8dsp.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2097db0..29724bb 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -610,6 +610,7 @@ void avcodec_register_all(void)
 REGISTER_ENCODER(HEVC_QSV,  hevc_qsv);
 REGISTER_ENCODER(LIBKVAZAAR,libkvazaar);
 REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
+REGISTER_ENCODER(VTENC, vtenc);
 
 /* parsers */
 REGISTER_PARSER(AAC,aac);
diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c
new file mode 100644
index 000..62770cf
--- /dev/null
+++ b/libavcodec/vtenc.c
@@ -0,0 +1,1339 @@
+/*
+ * copyright (c) 2015 Rick Kern 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the 

Re: [FFmpeg-devel] [PATCH] x86/vc1dsp: Split the file into MC and loopfilter

2016-02-29 Thread Timothy Gu
On Mon, Feb 29, 2016 at 4:57 AM Ronald S. Bultje  wrote:

> This is kind of hard to review, but I'm going to assume that there's no
> actual code changes, in which case this LGTM.
>

No there isn't. Applied, thanks.

Timothy

>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avformat/mov: merge mov_read_custom functions

2016-02-29 Thread Michael Niedermayer
On Sun, Feb 28, 2016 at 11:08:59PM +0100, Marton Balint wrote:
> 
> On Sun, 28 Feb 2016, Michael Niedermayer wrote:
> 
> >On Sat, Feb 20, 2016 at 02:11:49AM +0100, Marton Balint wrote:
> >>This also fixes reading gapless metadata when the entries do not start with 
> >>the
> >>mean atom. Such samples can be found here:
> >>https://hydrogenaud.io/index.php/topic,93310.0.html
> >>
> >>Signed-off-by: Marton Balint 
> >>---
> >> libavformat/mov.c | 50 --
> >> 1 file changed, 12 insertions(+), 38 deletions(-)
> >
> >probably ok
> >
> 
> Thanks, I have applied the series.
> 
> >also a fate test for this might make sense ... tell me if i should
> >upload something to fatesamples for that ...
> 
> If you download the .rar file from the URL above, and put
> 102400samples_qt-lc-aac.m4a into the gapless folder, I can add it to
> the gapless test using the fixed aac decoder.

uploaded

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v7] VideoToolbox H.264 Encoder

2016-02-29 Thread Nicolas George
Le primidi 11 ventôse, an CCXXIV, Richard Kern a écrit :
> No, doesn’t look like it. The VideoToolbox constants aren’t 1-to-1 with the 
> command line options.

They do not need to be, you can use intermediate integer constants just as
well as you currently use string constants, with the extra benefit that the
code is more compact, more efficient, and that the available values are
printed by the automated help system.

Please people, stop using strings all over the place.

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 v7] VideoToolbox H.264 Encoder

2016-02-29 Thread Richard Kern
Please ignore this patch - the options code need to be updated.

> On Feb 29, 2016, at 11:58 PM, wm4  wrote:
> 
> On Mon, 29 Feb 2016 23:14:17 +0800
> Rick Kern  wrote:
> 
>> Autodetected by default. Encode using -codec:v vtenc.
>> 
>> Signed-off-by: Rick Kern 
>> ---
> 
> OK, autodetection seems to work properly on non-OSX too. I'll apply in
> 18 hours or so.
> ___
> 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 v7] VideoToolbox H.264 Encoder

2016-02-29 Thread Richard Kern

> On Feb 29, 2016, at 11:19 PM, Clément Bœsch  wrote:
> 
> On Mon, Feb 29, 2016 at 11:14:17PM +0800, Rick Kern wrote:
> [...]
>> +if (!profile) {
>> +//VideoToolbox auto-selects profile and level.
>> +return true;
>> +} else if (!av_strcasecmp("baseline", profile)) {
>> +if  (!strcmp("auto", level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_AutoLevel;
>> +else if (!strcmp("1.3",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_1_3;
>> +else if (!strcmp("3.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_3_0;
>> +else if (!strcmp("3.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_3_1;
>> +else if (!strcmp("3.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_3_2;
>> +else if (!strcmp("4.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_4_0;
>> +else if (!strcmp("4.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_4_1;
>> +else if (!strcmp("4.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_4_2;
>> +else if (!strcmp("5.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_5_0;
>> +else if (!strcmp("5.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_5_1;
>> +else if (!strcmp("5.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_5_2;
>> +else {
>> +av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", 
>> vtctx->level);
>> +return false;
>> +}
>> +} else if (!av_strcasecmp("main", profile)) {
>> +if  (!strcmp("auto", level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_AutoLevel;
>> +else if (!strcmp("3.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_3_0;
>> +else if (!strcmp("3.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_3_1;
>> +else if (!strcmp("3.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_3_2;
>> +else if (!strcmp("4.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_4_0;
>> +else if (!strcmp("4.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_4_1;
>> +else if (!strcmp("4.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_4_2;
>> +else if (!strcmp("5.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_5_0;
>> +else if (!strcmp("5.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_5_1;
>> +else if (!strcmp("5.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_5_2;
>> +else {
>> +av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", 
>> vtctx->level);
>> +return false;
>> +}
>> +} else if (!av_strcasecmp("high", profile)) {
>> +if  (!strcmp("auto", level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_AutoLevel;
>> +else if (!strcmp("3.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_3_0;
>> +else if (!strcmp("3.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_3_1;
>> +else if (!strcmp("3.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_3_2;
>> +else if (!strcmp("4.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_4_0;
>> +else if (!strcmp("4.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_4_1;
>> +else if (!strcmp("4.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_4_2;
>> +else if (!strcmp("5.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_5_0;
>> +else if (!strcmp("5.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_5_1;
>> +else if (!strcmp("5.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_5_2;
>> +else {
>> +av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", 
>> vtctx->level);
>> +return false;
>> +}
>> +} else {
>> +av_log(avctx, AV_LOG_ERROR, "Unrecognized profile %s\n", 
>> vtctx->profile);
>> +return false;
>> +}
> 
> Can't you use AV_OPT_TYPE_CONST for those?
No, doesn’t look like it. The VideoToolbox constants aren’t 1-to-1 with the 
command line options.

> 
> [...]
> 
> -- 
> Clément B.
> ___
> 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 v7] VideoToolbox H.264 Encoder

2016-02-29 Thread wm4
On Mon, 29 Feb 2016 23:14:17 +0800
Rick Kern  wrote:

> Autodetected by default. Encode using -codec:v vtenc.
> 
> Signed-off-by: Rick Kern 
> ---

OK, autodetection seems to work properly on non-OSX too. I'll apply in
18 hours or so.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] vp9: add superframe merging bitstream filter.

2016-02-29 Thread Ronald S. Bultje
Fixes ticket 4313.
---
 ffmpeg.c|   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/vp9_superframe_bsf.c | 189 
 libavformat/ivfenc.c|  13 +++
 libavformat/matroskaenc.c   |   5 +-
 6 files changed, 209 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/vp9_superframe_bsf.c

diff --git a/ffmpeg.c b/ffmpeg.c
index 8fec1e7..37cd29c 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -712,6 +712,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, 
OutputStream *ost)
  if(
 (avctx->codec_type == AVMEDIA_TYPE_AUDIO || avctx->codec_type == 
AVMEDIA_TYPE_VIDEO) &&
 pkt->dts != AV_NOPTS_VALUE &&
+!(avctx->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) &&
 ost->last_mux_dts != AV_NOPTS_VALUE) {
   int64_t max = ost->last_mux_dts + !(s->oformat->flags & 
AVFMT_TS_NONSTRICT);
   if (pkt->dts < max) {
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f6a4fbb..041684d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -916,6 +916,7 @@ OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF)  += 
mp3_header_decompress_bsf.o \
 OBJS-$(CONFIG_NOISE_BSF)  += noise_bsf.o
 OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF)   += remove_extradata_bsf.o
 OBJS-$(CONFIG_TEXT2MOVSUB_BSF)+= movsub_bsf.o
+OBJS-$(CONFIG_VP9_SUPERFRAME_BSF) += vp9_superframe_bsf.o
 
 # thread libraries
 OBJS-$(HAVE_LIBC_MSVCRT)   += file_open.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2097db0..96f5c5c 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -666,4 +666,5 @@ void avcodec_register_all(void)
 REGISTER_BSF(NOISE, noise);
 REGISTER_BSF(REMOVE_EXTRADATA,  remove_extradata);
 REGISTER_BSF(TEXT2MOVSUB,   text2movsub);
+REGISTER_BSF(VP9_SUPERFRAME,vp9_superframe);
 }
diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/vp9_superframe_bsf.c
new file mode 100644
index 000..f991a80
--- /dev/null
+++ b/libavcodec/vp9_superframe_bsf.c
@@ -0,0 +1,189 @@
+/*
+ * Vp9 invisible (alt-ref) frame to superframe merge bitstream filter
+ * Copyright (c) 2016 Ronald S. Bultje 
+ *
+ * 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
+ */
+
+#include "libavutil/avassert.h"
+#include "avcodec.h"
+#include "get_bits.h"
+
+#define MAX_CACHE 8
+typedef struct VP9BSFContext {
+int n_cache;
+struct CachedBuf {
+uint8_t *data;
+int size;
+} cache[MAX_CACHE];
+} VP9BSFContext;
+
+static void stats(const struct CachedBuf *in, int n_in,
+  unsigned *_max, unsigned *_sum)
+{
+int n;
+unsigned max = 0, sum = 0;
+
+for (n = 0; n < n_in; n++) {
+unsigned sz = in[n].size;
+
+if (sz > max)
+max = sz;
+sum += sz;
+}
+
+*_max = max;
+*_sum = sum;
+}
+
+static int merge_superframe(const struct CachedBuf *in, int n_in,
+uint8_t **poutbuf, int *poutbuf_size)
+{
+unsigned max, sum, mag, marker, n, sz;
+uint8_t *ptr;
+
+stats(in, n_in, , );
+mag = av_log2(max) >> 3;
+marker = 0xC0 + (mag << 3) + (n_in - 1);
+sz = *poutbuf_size = sum + 2 + (mag + 1) * n_in;
+ptr = *poutbuf = av_malloc(sz);
+if (!ptr)
+return AVERROR(ENOMEM);
+
+for (n = 0; n < n_in; n++) {
+memcpy(ptr, in[n].data, in[n].size);
+ptr += in[n].size;
+}
+
+#define wloop(mag, wr) \
+for (n = 0; n < n_in; n++) { \
+wr; \
+ptr += mag + 1; \
+}
+
+// write superframe with marker 110[mag:2][nframes:3]
+*ptr++ = marker;
+switch (mag) {
+case 0:
+wloop(mag, *ptr = in[n].size);
+break;
+case 1:
+wloop(mag, AV_WB16(ptr, in[n].size));
+break;
+case 2:
+wloop(mag, AV_WB24(ptr, in[n].size));
+break;
+case 3:
+wloop(mag, AV_WB32(ptr, in[n].size));
+break;
+}
+*ptr++ = marker;
+av_assert0(ptr == &(*poutbuf)[*poutbuf_size]);
+
+return 0;
+}
+
+static int vp9_superframe_filter(AVBitStreamFilterContext *bsfc,
+ AVCodecContext *avctx, const 

[FFmpeg-devel] [PATCH 1/2] lavf: allow BSFs to drop packets.

2016-02-29 Thread Ronald S. Bultje
If pkt->size == 0 && pkt->side_data_elems == 0 after bsf->filter()
returns, the packet is considered dropped.
---
 ffmpeg.c   |  2 ++
 libavcodec/avcodec.h   |  3 ++-
 libavformat/avformat.h |  4 +++-
 libavformat/mux.c  | 24 +---
 libavformat/utils.c|  5 +
 5 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index a5ec3c3..8fec1e7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -694,6 +694,8 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, 
OutputStream *ost)
 if (exit_on_error)
 exit_program(1);
 }
+if (pkt->size == 0 && pkt->side_data_elems == 0)
+return;
 
 if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
 if (pkt->dts != AV_NOPTS_VALUE &&
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index d849765..516d236 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -5208,7 +5208,8 @@ AVBitStreamFilterContext *av_bitstream_filter_init(const 
char *name);
  * If the return value is 0, the output buffer is not allocated and
  * should be considered identical to the input buffer, or in case
  * *poutbuf was set it points to the input buffer (not necessarily to
- * its starting address).
+ * its starting address). A special case is if *poutbuf was set to NULL and
+ * *poutbuf_size was set to 0, which indicates the packet should be dropped.
  */
 int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
AVCodecContext *avctx, const char *args,
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 34bad43..a929d96 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2844,7 +2844,9 @@ int avformat_queue_attached_pictures(AVFormatContext *s);
  * Apply a list of bitstream filters to a packet.
  *
  * @param codec AVCodecContext, usually from an AVStream
- * @param pkt the packet to apply filters to
+ * @param pkt the packet to apply filters to. If, on success, the returned
+ *packet has size == 0 and side_data_elems == 0, it indicates that
+ *the packet should be dropped
  * @param bsfc a NULL-terminated list of filters to apply
  * @return  >=0 on success;
  *  AVERROR code on failure
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 789c811..5100aa3 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1024,6 +1024,19 @@ int av_interleaved_write_frame(AVFormatContext *s, 
AVPacket *pkt)
 if (pkt) {
 AVStream *st = s->streams[pkt->stream_index];
 
+if (s->oformat->check_bitstream) {
+if (!st->internal->bitstream_checked) {
+if ((ret = s->oformat->check_bitstream(s, pkt)) < 0)
+goto fail;
+else if (ret == 1)
+st->internal->bitstream_checked = 1;
+}
+}
+
+av_apply_bitstream_filters(st->codec, pkt, st->internal->bsfc);
+if (pkt->size == 0 && pkt->side_data_elems == 0)
+return 0;
+
 if (s->debug & FF_FDEBUG_TS)
 av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame size:%d dts:%s 
pts:%s\n",
 pkt->size, av_ts2str(pkt->dts), av_ts2str(pkt->pts));
@@ -1037,17 +1050,6 @@ int av_interleaved_write_frame(AVFormatContext *s, 
AVPacket *pkt)
 ret = AVERROR(EINVAL);
 goto fail;
 }
-
-if (s->oformat->check_bitstream) {
-if (!st->internal->bitstream_checked) {
-if ((ret = s->oformat->check_bitstream(s, pkt)) < 0)
-goto fail;
-else if (ret == 1)
-st->internal->bitstream_checked = 1;
-}
-}
-
-av_apply_bitstream_filters(st->codec, pkt, st->internal->bsfc);
 } else {
 av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame FLUSH\n");
 flush = 1;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 129a49d..af4695e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4694,6 +4694,11 @@ int av_apply_bitstream_filters(AVCodecContext *codec, 
AVPacket *pkt,
_pkt.data, _pkt.size,
pkt->data, pkt->size,
pkt->flags & AV_PKT_FLAG_KEY);
+if (a == 0 && new_pkt.size == 0 && new_pkt.side_data_elems == 0) {
+av_packet_unref(pkt);
+memset(pkt, 0, sizeof(*pkt));
+return 0;
+}
 if(a == 0 && new_pkt.data != pkt->data) {
 uint8_t *t = av_malloc(new_pkt.size + 
AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so 
cannot overflow
 if (t) {
-- 
2.1.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v7] VideoToolbox H.264 Encoder

2016-02-29 Thread Clément Bœsch
On Mon, Feb 29, 2016 at 11:14:17PM +0800, Rick Kern wrote:
[...]
> +if (!profile) {
> +//VideoToolbox auto-selects profile and level.
> +return true;
> +} else if (!av_strcasecmp("baseline", profile)) {
> +if  (!strcmp("auto", level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_AutoLevel;
> +else if (!strcmp("1.3",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_1_3;
> +else if (!strcmp("3.0",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_3_0;
> +else if (!strcmp("3.1",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_3_1;
> +else if (!strcmp("3.2",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_3_2;
> +else if (!strcmp("4.0",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_4_0;
> +else if (!strcmp("4.1",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_4_1;
> +else if (!strcmp("4.2",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_4_2;
> +else if (!strcmp("5.0",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_5_0;
> +else if (!strcmp("5.1",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_5_1;
> +else if (!strcmp("5.2",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Baseline_5_2;
> +else {
> +av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", 
> vtctx->level);
> +return false;
> +}
> +} else if (!av_strcasecmp("main", profile)) {
> +if  (!strcmp("auto", level)) *profile_level_val = 
> kVTProfileLevel_H264_Main_AutoLevel;
> +else if (!strcmp("3.0",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Main_3_0;
> +else if (!strcmp("3.1",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Main_3_1;
> +else if (!strcmp("3.2",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Main_3_2;
> +else if (!strcmp("4.0",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Main_4_0;
> +else if (!strcmp("4.1",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Main_4_1;
> +else if (!strcmp("4.2",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Main_4_2;
> +else if (!strcmp("5.0",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Main_5_0;
> +else if (!strcmp("5.1",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Main_5_1;
> +else if (!strcmp("5.2",  level)) *profile_level_val = 
> kVTProfileLevel_H264_Main_5_2;
> +else {
> +av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", 
> vtctx->level);
> +return false;
> +}
> +} else if (!av_strcasecmp("high", profile)) {
> +if  (!strcmp("auto", level)) *profile_level_val = 
> kVTProfileLevel_H264_High_AutoLevel;
> +else if (!strcmp("3.0",  level)) *profile_level_val = 
> kVTProfileLevel_H264_High_3_0;
> +else if (!strcmp("3.1",  level)) *profile_level_val = 
> kVTProfileLevel_H264_High_3_1;
> +else if (!strcmp("3.2",  level)) *profile_level_val = 
> kVTProfileLevel_H264_High_3_2;
> +else if (!strcmp("4.0",  level)) *profile_level_val = 
> kVTProfileLevel_H264_High_4_0;
> +else if (!strcmp("4.1",  level)) *profile_level_val = 
> kVTProfileLevel_H264_High_4_1;
> +else if (!strcmp("4.2",  level)) *profile_level_val = 
> kVTProfileLevel_H264_High_4_2;
> +else if (!strcmp("5.0",  level)) *profile_level_val = 
> kVTProfileLevel_H264_High_5_0;
> +else if (!strcmp("5.1",  level)) *profile_level_val = 
> kVTProfileLevel_H264_High_5_1;
> +else if (!strcmp("5.2",  level)) *profile_level_val = 
> kVTProfileLevel_H264_High_5_2;
> +else {
> +av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", 
> vtctx->level);
> +return false;
> +}
> +} else {
> +av_log(avctx, AV_LOG_ERROR, "Unrecognized profile %s\n", 
> vtctx->profile);
> +return false;
> +}

Can't you use AV_OPT_TYPE_CONST for those?

[...]

-- 
Clément B.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson
Mats Peterson  skrev: (29 februari 2016 
14:27:13 CET)
>New patch set.

It seems that you, Michael, don't care much about adding support for palette 
side data packets, while Reimar advocates for it. Is the situation correctly 
understood?
-- 
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v7] VideoToolbox H.264 Encoder

2016-02-29 Thread Rick Kern
Autodetected by default. Encode using -codec:v vtenc.

Signed-off-by: Rick Kern 
---
 MAINTAINERS|1 +
 configure  |   19 +
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |1 +
 libavcodec/vtenc.c | 1320 
 5 files changed, 1342 insertions(+)
 create mode 100644 libavcodec/vtenc.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 155642b..650da3c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -289,6 +289,7 @@ Codecs:
   vp8   David Conrad, Jason Garrett-Glaser, 
Ronald Bultje
   vp9   Ronald Bultje, Clément Bœsch
   vqavideo.cMike Melanson
+  vtenc.c   Rick Kern
   wavpack.c Kostya Shishkov
   wmaprodec.c   Sascha Sommer
   wmavoice.cRonald S. Bultje
diff --git a/configure b/configure
index 8b7c423..97bb40f 100755
--- a/configure
+++ b/configure
@@ -289,6 +289,7 @@ External library support:
   --disable-sdldisable sdl [autodetect]
   --disable-securetransport disable Secure Transport, needed for TLS support
on OSX if openssl and gnutls are not used 
[autodetect]
+  --disable-vtenc  disable VideoToolbox H.264 encoder [autodetect]
   --enable-x11grab enable X11 grabbing (legacy) [no]
   --disable-xlib   disable xlib [autodetect]
   --disable-zlib   disable zlib [autodetect]
@@ -1509,6 +1510,7 @@ EXTERNAL_LIBRARY_LIST="
 schannel
 sdl
 securetransport
+vtenc
 x11grab
 xlib
 zlib
@@ -2672,6 +2674,9 @@ libzvbi_teletext_decoder_deps="libzvbi"
 nvenc_encoder_deps="nvenc"
 nvenc_h264_encoder_deps="nvenc"
 nvenc_hevc_encoder_deps="nvenc"
+vtenc_encoder_deps="vtenc VideoToolbox_VideoToolbox_h pthreads"
+vtenc_encoder_select="bzlib zlib iconv"
+vtenc_encoder_extralibs="-framework CoreFoundation -framework VideoToolbox 
-framework CoreMedia"
 
 # demuxers / muxers
 ac3_demuxer_select="ac3_parser"
@@ -5687,6 +5692,20 @@ enabled openssl   && { use_pkg_config openssl 
openssl/ssl.h SSL_library_
check_lib openssl/ssl.h SSL_library_init -lssl 
-lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
 enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
qtkit_indev; }
+{ disabled vtenc_encoder && disable vtenc; } || 
+{ disabled vtenc && 
+  disable vtenc_encoder; } ||
+{ enabled vtenc &&
+  require VideoToolbox 
VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames 
-framework VideoToolbox &&
+  enable vtenc_encoder; } ||
+{ enabled vtenc_encoder &&
+  check_lib VideoToolbox/VTCompressionSession.h 
VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox &&
+  enable vtenc; } ||
+{ disable vtenc && 
+  disable vtenc_encoder; }
+enabled vtenc_encoder&& check_header "TargetConditionals.h" &&
+{ check_cpp_condition "TargetConditionals.h" 
"TARGET_OS_MAC && !TARGET_OS_IPHONE" &&
+  vtenc_encoder_extralibs+=" -framework 
VideoDecodeAcceleration"; }
 
 # libdc1394 check
 if enabled libdc1394; then
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 5389725..63fbb80 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -120,6 +120,7 @@ OBJS-$(CONFIG_TEXTUREDSPENC)   += texturedspenc.o
 OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
 OBJS-$(CONFIG_VC1DSP)  += vc1dsp.o
 OBJS-$(CONFIG_VIDEODSP)+= videodsp.o
+OBJS-$(CONFIG_VTENC)   += vtenc.o
 OBJS-$(CONFIG_VP3DSP)  += vp3dsp.o
 OBJS-$(CONFIG_VP56DSP) += vp56dsp.o
 OBJS-$(CONFIG_VP8DSP)  += vp8dsp.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2097db0..29724bb 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -610,6 +610,7 @@ void avcodec_register_all(void)
 REGISTER_ENCODER(HEVC_QSV,  hevc_qsv);
 REGISTER_ENCODER(LIBKVAZAAR,libkvazaar);
 REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
+REGISTER_ENCODER(VTENC, vtenc);
 
 /* parsers */
 REGISTER_PARSER(AAC,aac);
diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c
new file mode 100644
index 000..7c6ebfb
--- /dev/null
+++ b/libavcodec/vtenc.c
@@ -0,0 +1,1320 @@
+/*
+ * copyright (c) 2015 Rick Kern 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the 

Re: [FFmpeg-devel] [PATCH 1/2] lavf: allow BSFs to drop packets.

2016-02-29 Thread Nicolas George
Le primidi 11 ventôse, an CCXXIV, Ronald S. Bultje a écrit :
> If pkt->size == 0 && pkt->side_data_elems == 0 after bsf->filter()
> returns, the packet is considered dropped.

I think the doxy for av_apply_bitstream_filters() needs to be updated
accordingly.

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]lavf: Add pcx auto-detection

2016-02-29 Thread Carl Eugen Hoyos
Michael Niedermayer  niedermayer.cc> writes:

> On Mon, Feb 29, 2016 at 12:01:35PM +, Carl Eugen Hoyos wrote:
> > Carl Eugen Hoyos  ag.or.at> writes:
> > 
> > > +|| b[1] > 6
> > 
> > Locally fixed to "> 5"
> 
> patch probably ok

Pushed.

Thank you, Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] vp9: add superframe merging bitstream filter.

2016-02-29 Thread Ronald S. Bultje
Fixes ticket 4313.
---
 ffmpeg.c|   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/vp9_superframe_bsf.c | 189 
 libavformat/ivfenc.c|  13 +++
 libavformat/matroskaenc.c   |   5 +-
 6 files changed, 209 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/vp9_superframe_bsf.c

diff --git a/ffmpeg.c b/ffmpeg.c
index 8fec1e7..37cd29c 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -712,6 +712,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, 
OutputStream *ost)
  if(
 (avctx->codec_type == AVMEDIA_TYPE_AUDIO || avctx->codec_type == 
AVMEDIA_TYPE_VIDEO) &&
 pkt->dts != AV_NOPTS_VALUE &&
+!(avctx->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) &&
 ost->last_mux_dts != AV_NOPTS_VALUE) {
   int64_t max = ost->last_mux_dts + !(s->oformat->flags & 
AVFMT_TS_NONSTRICT);
   if (pkt->dts < max) {
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f6a4fbb..041684d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -916,6 +916,7 @@ OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF)  += 
mp3_header_decompress_bsf.o \
 OBJS-$(CONFIG_NOISE_BSF)  += noise_bsf.o
 OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF)   += remove_extradata_bsf.o
 OBJS-$(CONFIG_TEXT2MOVSUB_BSF)+= movsub_bsf.o
+OBJS-$(CONFIG_VP9_SUPERFRAME_BSF) += vp9_superframe_bsf.o
 
 # thread libraries
 OBJS-$(HAVE_LIBC_MSVCRT)   += file_open.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2097db0..96f5c5c 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -666,4 +666,5 @@ void avcodec_register_all(void)
 REGISTER_BSF(NOISE, noise);
 REGISTER_BSF(REMOVE_EXTRADATA,  remove_extradata);
 REGISTER_BSF(TEXT2MOVSUB,   text2movsub);
+REGISTER_BSF(VP9_SUPERFRAME,vp9_superframe);
 }
diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/vp9_superframe_bsf.c
new file mode 100644
index 000..f991a80
--- /dev/null
+++ b/libavcodec/vp9_superframe_bsf.c
@@ -0,0 +1,189 @@
+/*
+ * Vp9 invisible (alt-ref) frame to superframe merge bitstream filter
+ * Copyright (c) 2016 Ronald S. Bultje 
+ *
+ * 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
+ */
+
+#include "libavutil/avassert.h"
+#include "avcodec.h"
+#include "get_bits.h"
+
+#define MAX_CACHE 8
+typedef struct VP9BSFContext {
+int n_cache;
+struct CachedBuf {
+uint8_t *data;
+int size;
+} cache[MAX_CACHE];
+} VP9BSFContext;
+
+static void stats(const struct CachedBuf *in, int n_in,
+  unsigned *_max, unsigned *_sum)
+{
+int n;
+unsigned max = 0, sum = 0;
+
+for (n = 0; n < n_in; n++) {
+unsigned sz = in[n].size;
+
+if (sz > max)
+max = sz;
+sum += sz;
+}
+
+*_max = max;
+*_sum = sum;
+}
+
+static int merge_superframe(const struct CachedBuf *in, int n_in,
+uint8_t **poutbuf, int *poutbuf_size)
+{
+unsigned max, sum, mag, marker, n, sz;
+uint8_t *ptr;
+
+stats(in, n_in, , );
+mag = av_log2(max) >> 3;
+marker = 0xC0 + (mag << 3) + (n_in - 1);
+sz = *poutbuf_size = sum + 2 + (mag + 1) * n_in;
+ptr = *poutbuf = av_malloc(sz);
+if (!ptr)
+return AVERROR(ENOMEM);
+
+for (n = 0; n < n_in; n++) {
+memcpy(ptr, in[n].data, in[n].size);
+ptr += in[n].size;
+}
+
+#define wloop(mag, wr) \
+for (n = 0; n < n_in; n++) { \
+wr; \
+ptr += mag + 1; \
+}
+
+// write superframe with marker 110[mag:2][nframes:3]
+*ptr++ = marker;
+switch (mag) {
+case 0:
+wloop(mag, *ptr = in[n].size);
+break;
+case 1:
+wloop(mag, AV_WB16(ptr, in[n].size));
+break;
+case 2:
+wloop(mag, AV_WB24(ptr, in[n].size));
+break;
+case 3:
+wloop(mag, AV_WB32(ptr, in[n].size));
+break;
+}
+*ptr++ = marker;
+av_assert0(ptr == &(*poutbuf)[*poutbuf_size]);
+
+return 0;
+}
+
+static int vp9_superframe_filter(AVBitStreamFilterContext *bsfc,
+ AVCodecContext *avctx, const 

[FFmpeg-devel] [PATCH 1/2] lavf: allow BSFs to drop packets.

2016-02-29 Thread Ronald S. Bultje
If pkt->size == 0 && pkt->side_data_elems == 0 after bsf->filter()
returns, the packet is considered dropped.
---
 ffmpeg.c|  2 ++
 libavformat/mux.c   | 24 +---
 libavformat/utils.c |  5 +
 3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index a5ec3c3..8fec1e7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -694,6 +694,8 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, 
OutputStream *ost)
 if (exit_on_error)
 exit_program(1);
 }
+if (pkt->size == 0 && pkt->side_data_elems == 0)
+return;
 
 if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
 if (pkt->dts != AV_NOPTS_VALUE &&
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 789c811..5100aa3 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1024,6 +1024,19 @@ int av_interleaved_write_frame(AVFormatContext *s, 
AVPacket *pkt)
 if (pkt) {
 AVStream *st = s->streams[pkt->stream_index];
 
+if (s->oformat->check_bitstream) {
+if (!st->internal->bitstream_checked) {
+if ((ret = s->oformat->check_bitstream(s, pkt)) < 0)
+goto fail;
+else if (ret == 1)
+st->internal->bitstream_checked = 1;
+}
+}
+
+av_apply_bitstream_filters(st->codec, pkt, st->internal->bsfc);
+if (pkt->size == 0 && pkt->side_data_elems == 0)
+return 0;
+
 if (s->debug & FF_FDEBUG_TS)
 av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame size:%d dts:%s 
pts:%s\n",
 pkt->size, av_ts2str(pkt->dts), av_ts2str(pkt->pts));
@@ -1037,17 +1050,6 @@ int av_interleaved_write_frame(AVFormatContext *s, 
AVPacket *pkt)
 ret = AVERROR(EINVAL);
 goto fail;
 }
-
-if (s->oformat->check_bitstream) {
-if (!st->internal->bitstream_checked) {
-if ((ret = s->oformat->check_bitstream(s, pkt)) < 0)
-goto fail;
-else if (ret == 1)
-st->internal->bitstream_checked = 1;
-}
-}
-
-av_apply_bitstream_filters(st->codec, pkt, st->internal->bsfc);
 } else {
 av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame FLUSH\n");
 flush = 1;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 129a49d..af4695e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4694,6 +4694,11 @@ int av_apply_bitstream_filters(AVCodecContext *codec, 
AVPacket *pkt,
_pkt.data, _pkt.size,
pkt->data, pkt->size,
pkt->flags & AV_PKT_FLAG_KEY);
+if (a == 0 && new_pkt.size == 0 && new_pkt.side_data_elems == 0) {
+av_packet_unref(pkt);
+memset(pkt, 0, sizeof(*pkt));
+return 0;
+}
 if(a == 0 && new_pkt.data != pkt->data) {
 uint8_t *t = av_malloc(new_pkt.size + 
AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so 
cannot overflow
 if (t) {
-- 
2.1.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/md5enc: New streammd5 muxer

2016-02-29 Thread Hendrik Leppkes
On Mon, Feb 29, 2016 at 2:41 PM, Nicolas George  wrote:
>
>> I don't quite understand: Is there something that needs to be fixed in
>> the existing md5enc code?
>
> Apparently not, which means I am misremembering something.
>

You just can't reuse the classes for mutliple components, options are fine.

- Hendrik
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/md5enc: New streammd5 muxer

2016-02-29 Thread Nicolas George
Le primidi 11 ventôse, an CCXXIV, Moritz Barsnick a écrit :
> I would like to propose a (quite trivial) patch renaming first the
> sources, then the muxers, and of course aliasing the existing muxer
> names.

No objection from me. If you manage to make it so that the default is MD5
when the name is md5 and something else (preferably the strongest we
currently have, SHA-512) otherwise, that would be awesome.

> I don't quite understand: Is there something that needs to be fixed in
> the existing md5enc code?

Apparently not, which means I am misremembering something.

> And are there some written guideline on these sorts of things, or is it
> "obvious" or just "from experience"?

From experience: at some point, something did hang, maybe "-h full", when
two codecs / muxers / demuxers shared the same... apparently not AVOption
array, maybe AVClass. I do not remember the specifics.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 4/4] lavf/internal.h: Add declaration for ff_get_raw_palette()

2016-02-29 Thread Mats Peterson


--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 56ed6a5c0ac819e0cbb941034868490271f61801 Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Mon, 29 Feb 2016 14:24:53 +0100
Subject: [PATCH v2 4/4] lavf/internal.h: Add declaration for ff_get_raw_palette()

---
 libavformat/internal.h |9 +
 1 file changed, 9 insertions(+)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index bc6a6c2..1117635 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -573,4 +573,13 @@ int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int
  */
 int ff_reshuffle_raw_rgb(AVFormatContext *s, AVPacket **ppkt, AVCodecContext *enc, int expected_stride);
 
+/**
+ * Retrieves the palette from a packet, either from a side data packet
+ * or appended to the video data in the packet itself.
+ *
+ * @param pkt pointer to the packet before calling ff_reshuffle_raw_rgb()
+ * @param ret the return value from ff_reshuffle_raw_rgb()
+ */
+int ff_get_raw_palette(AVFormatContext *s, AVPacket *pkt, int ret, const uint8_t **palette);
+
 #endif /* AVFORMAT_INTERNAL_H */
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 3/4] lavf/rawutils: New function ff_get_raw_palette()

2016-02-29 Thread Mats Peterson


--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 750d1d19dbb234c5d2d07dd8235afa48d3f1ba1f Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Mon, 29 Feb 2016 14:24:31 +0100
Subject: [PATCH v2 3/4] lavf/rawutils: New function ff_get_raw_palette()

---
 libavformat/rawutils.c |   16 
 1 file changed, 16 insertions(+)

diff --git a/libavformat/rawutils.c b/libavformat/rawutils.c
index 26ebbb5..7b84984 100644
--- a/libavformat/rawutils.c
+++ b/libavformat/rawutils.c
@@ -65,3 +65,19 @@ fail:
 
 return ret;
 }
+
+int ff_get_raw_palette(AVFormatContext *s, AVPacket *pkt, int ret, const uint8_t **palette)
+{
+int size;
+
+*palette = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, );
+if (*palette && size != AVPALETTE_SIZE) {
+av_log(s, AV_LOG_ERROR, "Invalid palette side data\n");
+return AVERROR_INVALIDDATA;
+}
+
+if (!*palette && ret == CONTAINS_PAL)
+*palette = pkt->data + pkt->size - AVPALETTE_SIZE;
+
+return 0;
+}
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 2/4] lavf/movenc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson


--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From f659982a4799aa3bdde3b3498fd04ba236174b7d Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Mon, 29 Feb 2016 14:24:03 +0100
Subject: [PATCH v2 2/4] lavf/movenc: Add support for palette side data packets

---
 libavformat/movenc.c |   22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 3295266..52ae110 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1717,12 +1717,13 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
 avio_wb16(pb, 0x18); /* Reserved */
 
 if (track->is_unaligned_qt_rgb && track->enc->pix_fmt == AV_PIX_FMT_PAL8) {
+int pal_size = 1 << track->enc->bits_per_coded_sample;
 int i;
 avio_wb16(pb, 0); /* Color table ID */
 avio_wb32(pb, 0); /* Color table seed */
 avio_wb16(pb, 0x8000);/* Color table flags */
-avio_wb16(pb, 255);   /* Color table size (zero-relative) */
-for (i = 0; i < 256; i++) {
+avio_wb16(pb, pal_size - 1);  /* Color table size (zero-relative) */
+for (i = 0; i < pal_size; i++) {
 uint32_t rgb = AV_RL32(>palette[i]);
 uint16_t r = (rgb >> 16) & 0xff;
 uint16_t g = (rgb >> 8)  & 0xff;
@@ -4764,18 +4765,21 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
 }
 
 if (trk->is_unaligned_qt_rgb) {
-const uint8_t *data = pkt->data;
-int size = pkt->size;
 int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16;
 int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2;
+AVPacket *opkt = pkt;
 int ret = ff_reshuffle_raw_rgb(s, , trk->enc, expected_stride);
 if (ret < 0)
 return ret;
-if (ret == CONTAINS_PAL && !trk->pal_done) {
-int pal_size = 1 << trk->enc->bits_per_coded_sample;
-memset(trk->palette, 0, AVPALETTE_SIZE);
-memcpy(trk->palette, data + size - 4*pal_size, 4*pal_size);
-trk->pal_done++;
+if (trk->enc->pix_fmt == AV_PIX_FMT_PAL8 && !trk->pal_done) {
+const uint8_t *pal;
+int ret2 = ff_get_raw_palette(s, opkt, ret, );
+if (ret2 < 0)
+return ret2;
+if (pal) {
+memcpy(trk->palette, pal, AVPALETTE_SIZE);
+trk->pal_done++;
+}
 } else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 ||
trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) {
 for (i = 0; i < pkt->size; i++)
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson

New patch set.

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 46b854f4b872d67b3aed118c929250f983dbab7b Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Mon, 29 Feb 2016 14:23:50 +0100
Subject: [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

---
 libavformat/avienc.c |   61 --
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index ca505f4..2d22940 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -362,7 +362,8 @@ static int avi_write_header(AVFormatContext *s)
 && enc->pix_fmt == AV_PIX_FMT_RGB555LE
 && enc->bits_per_coded_sample == 15)
 enc->bits_per_coded_sample = 16;
-avist->pal_offset = avio_tell(pb) + 40;
+if (pb->seekable)
+avist->pal_offset = avio_tell(pb) + 40;
 ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 0, 0);
 pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
   enc->bits_per_coded_sample);
@@ -652,8 +653,6 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
 unsigned char tag[5];
 const int stream_index = pkt->stream_index;
-const uint8_t *data= pkt->data;
-int size   = pkt->size;
 AVIOContext *pb = s->pb;
 AVCodecContext *enc = s->streams[stream_index]->codec;
 AVIStream *avist= s->streams[stream_index]->priv_data;
@@ -668,39 +667,47 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
 if ((ret = write_skip_frames(s, stream_index, pkt->dts)) < 0)
 return ret;
 
+if (!pkt->size)
+return avi_write_packet_internal(s, pkt); /* Passthrough */
+
 if (enc->codec_id == AV_CODEC_ID_RAWVIDEO && enc->codec_tag == 0) {
 int64_t bpc = enc->bits_per_coded_sample != 15 ? enc->bits_per_coded_sample : 16;
 int expected_stride = ((enc->width * bpc + 31) >> 5)*4;
-
+AVPacket *opkt = pkt;
+const uint8_t *pal;
+int ret2;
 ret = ff_reshuffle_raw_rgb(s, , enc, expected_stride);
 if (ret < 0)
 return ret;
-if (ret) {
-if (ret == CONTAINS_PAL) {
-int pc_tag, i;
-int pal_size = 1 << enc->bits_per_coded_sample;
-if (!avist->hdr_pal_done) {
-int64_t cur_offset = avio_tell(pb);
-avio_seek(pb, avist->pal_offset, SEEK_SET);
-for (i = 0; i < pal_size; i++) {
-uint32_t v = AV_RL32(data + size - 4*pal_size + 4*i);
-avio_wl32(pb, v & 0xff);
-}
-avio_seek(pb, cur_offset, SEEK_SET);
-avist->hdr_pal_done++;
-}
-avi_stream2fourcc(tag, stream_index, enc->codec_type);
-tag[2] = 'p'; tag[3] = 'c';
-pc_tag = ff_start_tag(pb, tag);
-avio_w8(pb, 0);
-avio_w8(pb, pal_size & 0xFF);
-avio_wl16(pb, 0); // reserved
+ret2 = ff_get_raw_palette(s, opkt, ret, );
+if (ret2 < 0)
+return ret2;
+if (pal) {
+int pal_size = 1 << enc->bits_per_coded_sample;
+int pc_tag, i;
+if (pb->seekable && !avist->hdr_pal_done) {
+int64_t cur_offset = avio_tell(pb);
+avio_seek(pb, avist->pal_offset, SEEK_SET);
 for (i = 0; i < pal_size; i++) {
-uint32_t v = AV_RL32(data + size - 4*pal_size + 4*i);
-avio_wb32(pb, v<<8);
+uint32_t v = AV_RL32(pal + 4*i);
+avio_wl32(pb, v & 0xff);
 }
-ff_end_tag(pb, pc_tag);
+avio_seek(pb, cur_offset, SEEK_SET);
+avist->hdr_pal_done++;
+}
+avi_stream2fourcc(tag, stream_index, enc->codec_type);
+tag[2] = 'p'; tag[3] = 'c';
+pc_tag = ff_start_tag(pb, tag);
+avio_w8(pb, 0);
+avio_w8(pb, pal_size & 0xFF);
+avio_wl16(pb, 0); // reserved
+for (i = 0; i < pal_size; i++) {
+uint32_t v = AV_RL32(pal + 4*i);
+avio_wb32(pb, v<<8);
 }
+ff_end_tag(pb, pc_tag);
+}
+if (ret) {
 ret = avi_write_packet_internal(s, pkt);
 av_packet_free();
 return ret;
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/4 v2] lavf/movenc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson

Small fix.

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From ca4010bd52169e4a10513981fc876334eb2b4e5e Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Mon, 29 Feb 2016 14:10:54 +0100
Subject: [PATCH 2/4 v2] lavf/movenc: Add support for palette side data packets

---
 libavformat/movenc.c |   24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 3295266..5c5bca1 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1717,12 +1717,13 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
 avio_wb16(pb, 0x18); /* Reserved */
 
 if (track->is_unaligned_qt_rgb && track->enc->pix_fmt == AV_PIX_FMT_PAL8) {
+int pal_size = 1 << track->enc->bits_per_coded_sample;
 int i;
 avio_wb16(pb, 0); /* Color table ID */
 avio_wb32(pb, 0); /* Color table seed */
 avio_wb16(pb, 0x8000);/* Color table flags */
-avio_wb16(pb, 255);   /* Color table size (zero-relative) */
-for (i = 0; i < 256; i++) {
+avio_wb16(pb, pal_size - 1);  /* Color table size (zero-relative) */
+for (i = 0; i < pal_size; i++) {
 uint32_t rgb = AV_RL32(>palette[i]);
 uint16_t r = (rgb >> 16) & 0xff;
 uint16_t g = (rgb >> 8)  & 0xff;
@@ -4763,19 +4764,22 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
 }
 }
 
-if (trk->is_unaligned_qt_rgb) {
-const uint8_t *data = pkt->data;
-int size = pkt->size;
+if (trk->is_unaligned_qt_rgb && pkt->size) {
 int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16;
 int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2;
+AVPacket *opkt = pkt;
 int ret = ff_reshuffle_raw_rgb(s, , trk->enc, expected_stride);
 if (ret < 0)
 return ret;
-if (ret == CONTAINS_PAL && !trk->pal_done) {
-int pal_size = 1 << trk->enc->bits_per_coded_sample;
-memset(trk->palette, 0, AVPALETTE_SIZE);
-memcpy(trk->palette, data + size - 4*pal_size, 4*pal_size);
-trk->pal_done++;
+if (trk->enc->pix_fmt == AV_PIX_FMT_PAL8 && !trk->pal_done) {
+const uint8_t *pal;
+int ret2 = ff_get_raw_palette(s, opkt, ret, );
+if (ret2 < 0)
+return ret2;
+if (pal) {
+memcpy(trk->palette, pal, AVPALETTE_SIZE);
+trk->pal_done++;
+}
 } else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 ||
trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) {
 for (i = 0; i < pkt->size; i++)
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Ignore invalid sprop-parameter-sets missing PPS

2016-02-29 Thread Andrew Shulgin
Also i can send you an email with public RTSP URL privately if you ask.

On Mon, Feb 29, 2016 at 3:10 PM, Andrew Shulgin 
wrote:

> Extracting SPS without the missig PPS results in unplayable FLV.
>
> ffmpeg -thread_queue_size 512 -rtsp_transport tcp -i rtsp://
> admin:12345@192.88.99.1/h264/ch1/main/av_stream -ar 44100 -ac 2 -acodec
> pcm_s16le -f s16le -ac 2 -i /dev/zero -c:v copy -acodec aac -strict
> experimental -ab 128k -f flv wrong.flv
>
> Uploaded to upload.ffmpeg.org with filename
> rtsp-invalid-sprop-parameter-sets.flv
>
> Also you may download the sample from here:
> http://home.rmrf.co/storage/rtsp-invalid-sprop-parameter-sets.flv
>
> On Mon, Feb 29, 2016 at 2:47 PM, Michael Niedermayer <
> mich...@niedermayer.cc> wrote:
>
>> On Mon, Feb 29, 2016 at 01:59:22PM +0200, Andrew Shulgin wrote:
>> > Corrected the patch a bit, now setting extradata_size to 0
>> >
>> > On Mon, Feb 29, 2016 at 1:13 PM, Andrew Shulgin <
>> andrewshulgi...@gmail.com>
>> > wrote:
>> >
>> > > Correct SPS and PPS are in the stream.
>> > > Maybe it's reasonale to use existing SPS. But i'm not sure how to
>> > > implement that.
>> > > Yeah really, setting extradata_size to 0 should not be skipped.
>> > >
>> > > On Mon, Feb 29, 2016 at 1:01 PM, Michael Niedermayer <
>> > > mich...@niedermayer.cc> wrote:
>> > >
>> > >> On Sat, Feb 27, 2016 at 09:56:01PM +0200, Andrew Shulgin wrote:
>> > >> > Some Hikvison RTSP cameras send wrong sprop-parameter-sets in SDP
>> - it's
>> > >> > missing PPS.
>> > >> >
>> > >> > Example of correct sprop-parameter-sets:
>> > >> > sprop-parameter-sets=Z0IAH5W4PASaEAAAcIAAFfkAQA==,aM48gA==
>> > >> > Example of wrong sprop-parameter-sets:
>> > >> > sprop-parameter-sets=Z0IAH5WoPASaEAAAcIAAFfkIQA==,
>> > >> >
>> > >> > My patch adds a workaround that ignores invalid
>> sprop-parameter-sets.
>> > >>
>> > >> from where does it get the correct parameter set ?
>> > >> is it in the stream ? or repeated sprop-parameter-sets ?
>> > >>
>> > >> also shuldnt the sps be used instead of skipped?
>> > >> or the skip code be made conditional on codec->extradata_size > 0 ?
>> > >>
>> > >> [...]
>> > >> --
>> > >> Michael GnuPG fingerprint:
>> 9FF2128B147EF6730BADF133611EC787040B0FAB
>> > >>
>> > >> Complexity theory is the science of finding the exact solution to an
>> > >> approximation. Benchmarking OTOH is finding an approximation of the
>> exact
>> > >>
>> > >> ___
>> > >> ffmpeg-devel mailing list
>> > >> ffmpeg-devel@ffmpeg.org
>> > >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> > >>
>> > >>
>> > >
>>
>> >  rtpdec_h264.c |4 
>> >  1 file changed, 4 insertions(+)
>> > 04777111f044772997bed9c6ac4367b4a4c83952
>> 0001-Ignore-invalid-sprop-parameter-sets-missing-PPS.patch
>> > From 5ba47e182a47753ed47344b25fd6ba9d15698fd1 Mon Sep 17 00:00:00 2001
>> > From: Andrew Shulgin 
>> > Date: Mon, 29 Feb 2016 13:57:42 +0200
>> > Subject: [PATCH] Ignore invalid sprop-parameter-sets missing PPS
>> >
>> > ---
>> >  libavformat/rtpdec_h264.c | 4 
>> >  1 file changed, 4 insertions(+)
>> >
>> > diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
>> > index b399be4..4c0003e 100644
>> > --- a/libavformat/rtpdec_h264.c
>> > +++ b/libavformat/rtpdec_h264.c
>> > @@ -168,6 +168,10 @@ static int
>> sdp_parse_fmtp_config_h264(AVFormatContext *s,
>> >  int ret;
>> >  codec->extradata_size = 0;
>> >  av_freep(>extradata);
>> > +if (value[strlen(value) - 1] == ',') {
>> > +av_log(s, AV_LOG_WARNING, "Missing PPS in
>> sprop-parameter-sets, ignoring\n");
>> > +return 0;
>> > +}
>>
>> what i meant was that if there is no extradata set then extracting
>> the SPS without the missig PPS into it would make sense
>> while if extradata was already set then a SPS only sprop would be
>> better skiped as it would remove a already extradted  PPS
>>
>> [...]
>> --
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> If you drop bombs on a foreign country and kill hundred thousands of
>> innocent people, expect your government to call the consequence
>> "unprovoked inhuman terrorist attacks" and use it to justify dropping
>> more bombs and killing more people. The technology changed, the idea is
>> old.
>>
>> ___
>> 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] lavf/md5enc: New streammd5 muxer

2016-02-29 Thread Moritz Barsnick
On Fri, Feb 19, 2016 at 17:51:00 +0100, Nicolas George wrote:
> Changing the name of existing muxers is annoying, but for new features I
> would like much better if we did not wave around the name of a hash function
> that has known vulnerabilities since 20 years: "streamhash" would be an
> obvious choice.

I would like to propose a (quite trivial) patch renaming first the
sources, then the muxers, and of course aliasing the existing muxer
names.

But before that:

> > +static const AVClass streammd5enc_class = {
> > +.class_name = "stream hash encoder class",
> > +.item_name  = av_default_item_name,
> 
> > +.option = hash_options,
> 
> I am rather surprised to see that the existing code uses the same options
> array for both md5 and framemd5, I thought it was not allowed.
> 
> But anyways, md5 and framemd5 both use the same MD5Context. Using the same
> options array with a different context structure is a big no.

I don't quite understand: Is there something that needs to be fixed in
the existing md5enc code?

And are there some written guideline on these sorts of things, or is it
"obvious" or just "from experience"?

Thanks!
Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Ignore invalid sprop-parameter-sets missing PPS

2016-02-29 Thread Andrew Shulgin
Extracting SPS without the missig PPS results in unplayable FLV.

ffmpeg -thread_queue_size 512 -rtsp_transport tcp -i rtsp://
admin:12345@192.88.99.1/h264/ch1/main/av_stream -ar 44100 -ac 2 -acodec
pcm_s16le -f s16le -ac 2 -i /dev/zero -c:v copy -acodec aac -strict
experimental -ab 128k -f flv wrong.flv

Uploaded to upload.ffmpeg.org with filename
rtsp-invalid-sprop-parameter-sets.flv

Also you may download the sample from here:
http://home.rmrf.co/storage/rtsp-invalid-sprop-parameter-sets.flv

On Mon, Feb 29, 2016 at 2:47 PM, Michael Niedermayer  wrote:

> On Mon, Feb 29, 2016 at 01:59:22PM +0200, Andrew Shulgin wrote:
> > Corrected the patch a bit, now setting extradata_size to 0
> >
> > On Mon, Feb 29, 2016 at 1:13 PM, Andrew Shulgin <
> andrewshulgi...@gmail.com>
> > wrote:
> >
> > > Correct SPS and PPS are in the stream.
> > > Maybe it's reasonale to use existing SPS. But i'm not sure how to
> > > implement that.
> > > Yeah really, setting extradata_size to 0 should not be skipped.
> > >
> > > On Mon, Feb 29, 2016 at 1:01 PM, Michael Niedermayer <
> > > mich...@niedermayer.cc> wrote:
> > >
> > >> On Sat, Feb 27, 2016 at 09:56:01PM +0200, Andrew Shulgin wrote:
> > >> > Some Hikvison RTSP cameras send wrong sprop-parameter-sets in SDP -
> it's
> > >> > missing PPS.
> > >> >
> > >> > Example of correct sprop-parameter-sets:
> > >> > sprop-parameter-sets=Z0IAH5W4PASaEAAAcIAAFfkAQA==,aM48gA==
> > >> > Example of wrong sprop-parameter-sets:
> > >> > sprop-parameter-sets=Z0IAH5WoPASaEAAAcIAAFfkIQA==,
> > >> >
> > >> > My patch adds a workaround that ignores invalid
> sprop-parameter-sets.
> > >>
> > >> from where does it get the correct parameter set ?
> > >> is it in the stream ? or repeated sprop-parameter-sets ?
> > >>
> > >> also shuldnt the sps be used instead of skipped?
> > >> or the skip code be made conditional on codec->extradata_size > 0 ?
> > >>
> > >> [...]
> > >> --
> > >> Michael GnuPG fingerprint:
> 9FF2128B147EF6730BADF133611EC787040B0FAB
> > >>
> > >> Complexity theory is the science of finding the exact solution to an
> > >> approximation. Benchmarking OTOH is finding an approximation of the
> exact
> > >>
> > >> ___
> > >> ffmpeg-devel mailing list
> > >> ffmpeg-devel@ffmpeg.org
> > >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >>
> > >>
> > >
>
> >  rtpdec_h264.c |4 
> >  1 file changed, 4 insertions(+)
> > 04777111f044772997bed9c6ac4367b4a4c83952
> 0001-Ignore-invalid-sprop-parameter-sets-missing-PPS.patch
> > From 5ba47e182a47753ed47344b25fd6ba9d15698fd1 Mon Sep 17 00:00:00 2001
> > From: Andrew Shulgin 
> > Date: Mon, 29 Feb 2016 13:57:42 +0200
> > Subject: [PATCH] Ignore invalid sprop-parameter-sets missing PPS
> >
> > ---
> >  libavformat/rtpdec_h264.c | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
> > index b399be4..4c0003e 100644
> > --- a/libavformat/rtpdec_h264.c
> > +++ b/libavformat/rtpdec_h264.c
> > @@ -168,6 +168,10 @@ static int
> sdp_parse_fmtp_config_h264(AVFormatContext *s,
> >  int ret;
> >  codec->extradata_size = 0;
> >  av_freep(>extradata);
> > +if (value[strlen(value) - 1] == ',') {
> > +av_log(s, AV_LOG_WARNING, "Missing PPS in
> sprop-parameter-sets, ignoring\n");
> > +return 0;
> > +}
>
> what i meant was that if there is no extradata set then extracting
> the SPS without the missig PPS into it would make sense
> while if extradata was already set then a SPS only sprop would be
> better skiped as it would remove a already extradted  PPS
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If you drop bombs on a foreign country and kill hundred thousands of
> innocent people, expect your government to call the consequence
> "unprovoked inhuman terrorist attacks" and use it to justify dropping
> more bombs and killing more people. The technology changed, the idea is
> old.
>
> ___
> 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] x86/vc1dsp: Split the file into MC and loopfilter

2016-02-29 Thread Ronald S. Bultje
Hi,

On Sun, Feb 28, 2016 at 8:26 PM, Timothy Gu  wrote:

> ---
>  libavcodec/x86/Makefile  |   3 +-
>  libavcodec/x86/vc1dsp.asm| 585
> ---
>  libavcodec/x86/vc1dsp_loopfilter.asm | 317 +++
>  libavcodec/x86/vc1dsp_mc.asm | 292 +
>  4 files changed, 611 insertions(+), 586 deletions(-)
>  delete mode 100644 libavcodec/x86/vc1dsp.asm
>  create mode 100644 libavcodec/x86/vc1dsp_loopfilter.asm
>  create mode 100644 libavcodec/x86/vc1dsp_mc.asm


This is kind of hard to review, but I'm going to assume that there's no
actual code changes, in which case this LGTM.

Thanks,
Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Ignore invalid sprop-parameter-sets missing PPS

2016-02-29 Thread Michael Niedermayer
On Mon, Feb 29, 2016 at 01:59:22PM +0200, Andrew Shulgin wrote:
> Corrected the patch a bit, now setting extradata_size to 0
> 
> On Mon, Feb 29, 2016 at 1:13 PM, Andrew Shulgin 
> wrote:
> 
> > Correct SPS and PPS are in the stream.
> > Maybe it's reasonale to use existing SPS. But i'm not sure how to
> > implement that.
> > Yeah really, setting extradata_size to 0 should not be skipped.
> >
> > On Mon, Feb 29, 2016 at 1:01 PM, Michael Niedermayer <
> > mich...@niedermayer.cc> wrote:
> >
> >> On Sat, Feb 27, 2016 at 09:56:01PM +0200, Andrew Shulgin wrote:
> >> > Some Hikvison RTSP cameras send wrong sprop-parameter-sets in SDP - it's
> >> > missing PPS.
> >> >
> >> > Example of correct sprop-parameter-sets:
> >> > sprop-parameter-sets=Z0IAH5W4PASaEAAAcIAAFfkAQA==,aM48gA==
> >> > Example of wrong sprop-parameter-sets:
> >> > sprop-parameter-sets=Z0IAH5WoPASaEAAAcIAAFfkIQA==,
> >> >
> >> > My patch adds a workaround that ignores invalid sprop-parameter-sets.
> >>
> >> from where does it get the correct parameter set ?
> >> is it in the stream ? or repeated sprop-parameter-sets ?
> >>
> >> also shuldnt the sps be used instead of skipped?
> >> or the skip code be made conditional on codec->extradata_size > 0 ?
> >>
> >> [...]
> >> --
> >> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >>
> >> Complexity theory is the science of finding the exact solution to an
> >> approximation. Benchmarking OTOH is finding an approximation of the exact
> >>
> >> ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>
> >>
> >

>  rtpdec_h264.c |4 
>  1 file changed, 4 insertions(+)
> 04777111f044772997bed9c6ac4367b4a4c83952  
> 0001-Ignore-invalid-sprop-parameter-sets-missing-PPS.patch
> From 5ba47e182a47753ed47344b25fd6ba9d15698fd1 Mon Sep 17 00:00:00 2001
> From: Andrew Shulgin 
> Date: Mon, 29 Feb 2016 13:57:42 +0200
> Subject: [PATCH] Ignore invalid sprop-parameter-sets missing PPS
> 
> ---
>  libavformat/rtpdec_h264.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
> index b399be4..4c0003e 100644
> --- a/libavformat/rtpdec_h264.c
> +++ b/libavformat/rtpdec_h264.c
> @@ -168,6 +168,10 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
>  int ret;
>  codec->extradata_size = 0;
>  av_freep(>extradata);
> +if (value[strlen(value) - 1] == ',') {
> +av_log(s, AV_LOG_WARNING, "Missing PPS in sprop-parameter-sets, 
> ignoring\n");
> +return 0;
> +}

what i meant was that if there is no extradata set then extracting
the SPS without the missig PPS into it would make sense
while if extradata was already set then a SPS only sprop would be
better skiped as it would remove a already extradted  PPS

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you drop bombs on a foreign country and kill hundred thousands of
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mov: Set display aspect ratio for avid dv

2016-02-29 Thread Michael Niedermayer
On Mon, Feb 29, 2016 at 11:52:24AM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #5271 for me.
> 
> Please comment, Carl Eugen

>  mov.c |5 +
>  1 file changed, 5 insertions(+)
> ef08b944e3cb77bd7311187ecbfbdae719147d92  patchaviddv.diff
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 043f4a9..888b2ad 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -1461,6 +1461,11 @@ static int mov_read_ares(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  if (avio_rb16(pb) == 0xd4d)
>  codec->width = 1440;
>  return 0;
> +} else if (codec->codec_tag == MKTAG('A', 'V', 'd', '1') &&
> +   atom.size >= 24) {
> +avio_skip(pb, 12);
> +c->fc->streams[c->fc->nb_streams-1]->display_aspect_ratio.num = 
> avio_rb32(pb);

> +c->fc->streams[c->fc->nb_streams-1]->display_aspect_ratio.den = 
> avio_rb32(pb) * avio_rb32(pb);

probably not wrong but i would use a temporary variable here
one also could check for integer overflow then

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf: Add pcx auto-detection

2016-02-29 Thread Michael Niedermayer
On Mon, Feb 29, 2016 at 12:01:35PM +, Carl Eugen Hoyos wrote:
> Carl Eugen Hoyos  ag.or.at> writes:
> 
> > +|| b[1] > 6
> 
> Locally fixed to "> 5"

patch probably ok

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf: Add pcx auto-detection

2016-02-29 Thread Carl Eugen Hoyos
Carl Eugen Hoyos  ag.or.at> writes:

> +|| b[1] > 6

Locally fixed to "> 5"

Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Ignore invalid sprop-parameter-sets missing PPS

2016-02-29 Thread Andrew Shulgin
Corrected the patch a bit, now setting extradata_size to 0

On Mon, Feb 29, 2016 at 1:13 PM, Andrew Shulgin 
wrote:

> Correct SPS and PPS are in the stream.
> Maybe it's reasonale to use existing SPS. But i'm not sure how to
> implement that.
> Yeah really, setting extradata_size to 0 should not be skipped.
>
> On Mon, Feb 29, 2016 at 1:01 PM, Michael Niedermayer <
> mich...@niedermayer.cc> wrote:
>
>> On Sat, Feb 27, 2016 at 09:56:01PM +0200, Andrew Shulgin wrote:
>> > Some Hikvison RTSP cameras send wrong sprop-parameter-sets in SDP - it's
>> > missing PPS.
>> >
>> > Example of correct sprop-parameter-sets:
>> > sprop-parameter-sets=Z0IAH5W4PASaEAAAcIAAFfkAQA==,aM48gA==
>> > Example of wrong sprop-parameter-sets:
>> > sprop-parameter-sets=Z0IAH5WoPASaEAAAcIAAFfkIQA==,
>> >
>> > My patch adds a workaround that ignores invalid sprop-parameter-sets.
>>
>> from where does it get the correct parameter set ?
>> is it in the stream ? or repeated sprop-parameter-sets ?
>>
>> also shuldnt the sps be used instead of skipped?
>> or the skip code be made conditional on codec->extradata_size > 0 ?
>>
>> [...]
>> --
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> Complexity theory is the science of finding the exact solution to an
>> approximation. Benchmarking OTOH is finding an approximation of the exact
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>>
>
From 5ba47e182a47753ed47344b25fd6ba9d15698fd1 Mon Sep 17 00:00:00 2001
From: Andrew Shulgin 
Date: Mon, 29 Feb 2016 13:57:42 +0200
Subject: [PATCH] Ignore invalid sprop-parameter-sets missing PPS

---
 libavformat/rtpdec_h264.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index b399be4..4c0003e 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -168,6 +168,10 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
 int ret;
 codec->extradata_size = 0;
 av_freep(>extradata);
+if (value[strlen(value) - 1] == ',') {
+av_log(s, AV_LOG_WARNING, "Missing PPS in sprop-parameter-sets, ignoring\n");
+return 0;
+}
 ret = ff_h264_parse_sprop_parameter_sets(s, >extradata,
  >extradata_size, value);
 av_log(s, AV_LOG_DEBUG, "Extradata set to %p (size: %d)\n",
-- 
2.4.10

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]lavf: Add pcx auto-detection

2016-02-29 Thread Carl Eugen Hoyos
Hi!

Attached patch adds auto-detection for pcx images.

Please comment, Carl Eugen
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 782908e..edfa695 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -218,6 +218,7 @@ OBJS-$(CONFIG_IMAGE_EXR_PIPE_DEMUXER) += img2dec.o 
img2.o
 OBJS-$(CONFIG_IMAGE_J2K_PIPE_DEMUXER) += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_JPEG_PIPE_DEMUXER)+= img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER)  += img2dec.o img2.o
+OBJS-$(CONFIG_IMAGE_PCX_PIPE_DEMUXER) += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_PICTOR_PIPE_DEMUXER)  += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_PNG_PIPE_DEMUXER) += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_QDRAW_PIPE_DEMUXER)   += img2dec.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 9662941..fc87900 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -358,6 +358,7 @@ void av_register_all(void)
 REGISTER_DEMUXER (IMAGE_J2K_PIPE,image_j2k_pipe);
 REGISTER_DEMUXER (IMAGE_JPEG_PIPE,   image_jpeg_pipe);
 REGISTER_DEMUXER (IMAGE_JPEGLS_PIPE, image_jpegls_pipe);
+REGISTER_DEMUXER (IMAGE_PCX_PIPE,image_pcx_pipe);
 REGISTER_DEMUXER (IMAGE_PICTOR_PIPE, image_pictor_pipe);
 REGISTER_DEMUXER (IMAGE_PNG_PIPE,image_png_pipe);
 REGISTER_DEMUXER (IMAGE_QDRAW_PIPE,  image_qdraw_pipe);
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 94cce93..b2a0ee5 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -764,6 +764,27 @@ static int jpegls_probe(AVProbeData *p)
 return 0;
 }
 
+static int pcx_probe(AVProbeData *p)
+{
+const uint8_t *b = p->buf;
+
+if (   p->buf_size < 128
+|| b[0] != 10
+|| b[1] > 6
+|| b[2] != 1
+|| av_popcount(b[3]) != 1 || b[3] > 8
+|| AV_RL16([4]) > AV_RL16([8])
+|| AV_RL16([6]) > AV_RL16([10])
+|| b[64])
+return 0;
+b += 73;
+while (++b < p->buf + 128)
+if (*b)
+return AVPROBE_SCORE_EXTENSION / 4;
+
+return AVPROBE_SCORE_EXTENSION + 1;
+}
+
 static int qdraw_probe(AVProbeData *p)
 {
 const uint8_t *b = p->buf;
@@ -865,6 +886,7 @@ IMAGEAUTO_DEMUXER(exr, AV_CODEC_ID_EXR)
 IMAGEAUTO_DEMUXER(j2k, AV_CODEC_ID_JPEG2000)
 IMAGEAUTO_DEMUXER(jpeg,AV_CODEC_ID_MJPEG)
 IMAGEAUTO_DEMUXER(jpegls,  AV_CODEC_ID_JPEGLS)
+IMAGEAUTO_DEMUXER(pcx, AV_CODEC_ID_PCX)
 IMAGEAUTO_DEMUXER(pictor,  AV_CODEC_ID_PICTOR)
 IMAGEAUTO_DEMUXER(png, AV_CODEC_ID_PNG)
 IMAGEAUTO_DEMUXER(qdraw,   AV_CODEC_ID_QDRAW)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavfi: add bench and abench filters

2016-02-29 Thread Clément Bœsch
From: Clément Bœsch 

---
TODO: doc, bump, Changelog

example: -vf bench=start,gradfun,format=rgba,hqx,bench=stop
---
 libavfilter/Makefile |   2 +
 libavfilter/allfilters.c |   2 +
 libavfilter/f_bench.c| 132 +++
 3 files changed, 136 insertions(+)
 create mode 100644 libavfilter/f_bench.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 605ca29..be4b3c1 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -24,6 +24,7 @@ OBJS = allfilters.o   
  \
transform.o  \
video.o  \
 
+OBJS-$(CONFIG_ABENCH_FILTER) += f_bench.o
 OBJS-$(CONFIG_ACOMPRESSOR_FILTER)+= af_sidechaincompress.o
 OBJS-$(CONFIG_ACROSSFADE_FILTER) += af_afade.o
 OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
@@ -116,6 +117,7 @@ OBJS-$(CONFIG_ALPHAEXTRACT_FILTER)   += 
vf_extractplanes.o
 OBJS-$(CONFIG_ALPHAMERGE_FILTER) += vf_alphamerge.o
 OBJS-$(CONFIG_ATADENOISE_FILTER) += vf_atadenoise.o
 OBJS-$(CONFIG_BBOX_FILTER)   += bbox.o vf_bbox.o
+OBJS-$(CONFIG_BENCH_FILTER)  += f_bench.o
 OBJS-$(CONFIG_BLACKDETECT_FILTER)+= vf_blackdetect.o
 OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o
 OBJS-$(CONFIG_BLEND_FILTER)  += vf_blend.o dualinput.o 
framesync.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index e44a9d5..d6145d6 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -45,6 +45,7 @@ void avfilter_register_all(void)
 return;
 initialized = 1;
 
+REGISTER_FILTER(ABENCH, abench, af);
 REGISTER_FILTER(ACOMPRESSOR,acompressor,af);
 REGISTER_FILTER(ACROSSFADE, acrossfade, af);
 REGISTER_FILTER(ADELAY, adelay, af);
@@ -136,6 +137,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(ALPHAMERGE, alphamerge, vf);
 REGISTER_FILTER(ATADENOISE, atadenoise, vf);
 REGISTER_FILTER(ASS,ass,vf);
+REGISTER_FILTER(BENCH,  bench,  vf);
 REGISTER_FILTER(BBOX,   bbox,   vf);
 REGISTER_FILTER(BLACKDETECT,blackdetect,vf);
 REGISTER_FILTER(BLACKFRAME, blackframe, vf);
diff --git a/libavfilter/f_bench.c b/libavfilter/f_bench.c
new file mode 100644
index 000..9a3faa0
--- /dev/null
+++ b/libavfilter/f_bench.c
@@ -0,0 +1,132 @@
+/*
+ * 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
+ */
+
+#include "libavutil/opt.h"
+#include "libavutil/time.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+enum BenchAction {
+ACTION_START,
+ACTION_STOP,
+NB_ACTION
+};
+
+typedef struct {
+const AVClass *class;
+int action;
+} BenchContext;
+
+#define OFFSET(x) offsetof(BenchContext, x)
+#define DEFINE_OPTIONS(filt_name, FLAGS)   
 \
+static const AVOption filt_name##_options[] = {
 \
+{ "action", "set action", OFFSET(action), AV_OPT_TYPE_INT, 
{.i64=ACTION_START}, 0, NB_ACTION-1, FLAGS, "action" },  \
+{ "start", "start timer",  0, AV_OPT_TYPE_CONST, {.i64=ACTION_START}, 
INT_MIN, INT_MAX, FLAGS, "action" },  \
+{ "stop",  "stop timer",   0, AV_OPT_TYPE_CONST, {.i64=ACTION_STOP},  
INT_MIN, INT_MAX, FLAGS, "action" },  \
+{ NULL }   
 \
+}
+
+#define START_TIME_KEY "lavfi.bench.start_time"
+
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+AVFilterContext *ctx = inlink->dst;
+BenchContext *bench = ctx->priv;
+AVFilterLink *outlink = ctx->outputs[0];
+const int64_t t = av_gettime();
+
+if (t < 0)
+return ff_filter_frame(outlink, in);
+
+if (bench->action == ACTION_START) {
+av_dict_set_int(>metadata, START_TIME_KEY, t, 0);
+

Re: [FFmpeg-devel] [PATCH] Ignore invalid sprop-parameter-sets missing PPS

2016-02-29 Thread Andrew Shulgin
Correct SPS and PPS are in the stream.
Maybe it's reasonale to use existing SPS. But i'm not sure how to implement
that.
Yeah really, setting extradata_size to 0 should not be skipped.

On Mon, Feb 29, 2016 at 1:01 PM, Michael Niedermayer  wrote:

> On Sat, Feb 27, 2016 at 09:56:01PM +0200, Andrew Shulgin wrote:
> > Some Hikvison RTSP cameras send wrong sprop-parameter-sets in SDP - it's
> > missing PPS.
> >
> > Example of correct sprop-parameter-sets:
> > sprop-parameter-sets=Z0IAH5W4PASaEAAAcIAAFfkAQA==,aM48gA==
> > Example of wrong sprop-parameter-sets:
> > sprop-parameter-sets=Z0IAH5WoPASaEAAAcIAAFfkIQA==,
> >
> > My patch adds a workaround that ignores invalid sprop-parameter-sets.
>
> from where does it get the correct parameter set ?
> is it in the stream ? or repeated sprop-parameter-sets ?
>
> also shuldnt the sps be used instead of skipped?
> or the skip code be made conditional on codec->extradata_size > 0 ?
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Complexity theory is the science of finding the exact solution to an
> approximation. Benchmarking OTOH is finding an approximation of the exact
>
> ___
> 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 2/2] img2dec: Add mime_type to image formats

2016-02-29 Thread Carl Eugen Hoyos
Derek Buitenhuis  gmail.com> writes:

> On 2/26/2016 3:05 PM, Carl Eugen Hoyos wrote:
> > Or in other words: Except for jpeg, there is no 
> > probe function that returns 0 although the decoder 
> > can decode the image.
> 
> I'll take your word for it on this part.

Please don't: Instead double-check on what I had 
written in my previous mail.

> > So please provide your failing jpeg cases to 
> > improve the probing.
> > I will probably look myself into the issue but I 
> > prefer to have samples to test.

I fixed the remaining issue I saw, I'd be happy to fix 
more remaining test cases.

> Is it perhaps preferable to share a JPEG parser?

Sorry, I don't understand this.

> I think these sorts of failures will continue to pop
> up as long as the JPEG probing is an ad-hoc parser.

I believe that auto-detection works fine now for 
images that comply with the spec but see above.

Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Ignore invalid sprop-parameter-sets missing PPS

2016-02-29 Thread Michael Niedermayer
On Sat, Feb 27, 2016 at 09:56:01PM +0200, Andrew Shulgin wrote:
> Some Hikvison RTSP cameras send wrong sprop-parameter-sets in SDP - it's
> missing PPS.
> 
> Example of correct sprop-parameter-sets:
> sprop-parameter-sets=Z0IAH5W4PASaEAAAcIAAFfkAQA==,aM48gA==
> Example of wrong sprop-parameter-sets:
> sprop-parameter-sets=Z0IAH5WoPASaEAAAcIAAFfkIQA==,
> 
> My patch adds a workaround that ignores invalid sprop-parameter-sets.

from where does it get the correct parameter set ?
is it in the stream ? or repeated sprop-parameter-sets ?

also shuldnt the sps be used instead of skipped?
or the skip code be made conditional on codec->extradata_size > 0 ?

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/img2dec: Skip SOS when auto-detecting jpeg

2016-02-29 Thread Carl Eugen Hoyos
Michael Niedermayer  niedermayer.cc> writes:

> >  img2dec.c |1 +
> >  1 file changed, 1 insertion(+)
> > db2e658f6b6761e038746e51569a9faf5516e0ff  patchsoslength.diff
> > diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> 
> LGTM

Patch applied.

Thank you, Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]lavf/mov: Set display aspect ratio for avid dv

2016-02-29 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes ticket #5271 for me.

Please comment, Carl Eugen
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 043f4a9..888b2ad 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1461,6 +1461,11 @@ static int mov_read_ares(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 if (avio_rb16(pb) == 0xd4d)
 codec->width = 1440;
 return 0;
+} else if (codec->codec_tag == MKTAG('A', 'V', 'd', '1') &&
+   atom.size >= 24) {
+avio_skip(pb, 12);
+c->fc->streams[c->fc->nb_streams-1]->display_aspect_ratio.num = 
avio_rb32(pb);
+c->fc->streams[c->fc->nb_streams-1]->display_aspect_ratio.den = 
avio_rb32(pb) * avio_rb32(pb);
 }
 }
 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/img2dec: Skip SOS when auto-detecting jpeg

2016-02-29 Thread Michael Niedermayer
On Mon, Feb 29, 2016 at 01:45:28AM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> I believe attached patch fixes a possible issue when auto-detecting jpeg.
> 
> Please review, Carl Eugen

>  img2dec.c |1 +
>  1 file changed, 1 insertion(+)
> db2e658f6b6761e038746e51569a9faf5516e0ff  patchsoslength.diff
> diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c

LGTM

thx

[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] build: add install_name_dir option

2016-02-29 Thread Clément Bœsch
On Thu, Feb 25, 2016 at 02:56:52PM +0100, Clément Bœsch wrote:
> On Thu, Feb 25, 2016 at 02:47:45PM +0100, Hendrik Leppkes wrote:
> > On Thu, Feb 25, 2016 at 2:35 PM, Clément Bœsch  wrote:
> > > From: Clément Bœsch 
> > >
> > > This option is typically useful when cross-compiling dynamic libraries
> > > for iOS, with something such as --install_name_dir=@rpath
> > 
> > I don't know about any other things and their options for iOS
> > building, but that option name in configure looks rather out of place.
> > Can't we at least name it somewhat more fitting, maybe with dashes
> > instead of underscores?
> > 
> 
> Sure, --install-name-dir is better. I didn't find really more appropriate
> section in the helper, but feel free to suggest any other position.
> 

Applied as "--install-name-dir"

-- 
Clément B.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2] sws/aarch64: add {nv12, nv21, yuv420p, yuv422p}_to_{argb, rgba, abgr, rgba}_neon

2016-02-29 Thread Clément Bœsch
From: Clément Bœsch 

---
Changes since latest version:
- remove unused 32-bit path
- make 16-bit path more accurate by mirroring the MMX code (still not bitexact)
- the code as originally trying to process 2 lines at a time to save chroma pre
  mult computations and avoid re-reading the whole line; for some reason, this
  actually made the code around twice slower, for twice the complexity.
  dropping that complexity was a win-win.
---
 libswscale/aarch64/Makefile   |   3 +
 libswscale/aarch64/swscale_unscaled.c | 132 ++
 libswscale/aarch64/yuv2rgb_neon.S | 207 ++
 libswscale/swscale_internal.h |   1 +
 libswscale/swscale_unscaled.c |   2 +
 5 files changed, 345 insertions(+)
 create mode 100644 libswscale/aarch64/Makefile
 create mode 100644 libswscale/aarch64/swscale_unscaled.c
 create mode 100644 libswscale/aarch64/yuv2rgb_neon.S

diff --git a/libswscale/aarch64/Makefile b/libswscale/aarch64/Makefile
new file mode 100644
index 000..823806e
--- /dev/null
+++ b/libswscale/aarch64/Makefile
@@ -0,0 +1,3 @@
+OBJS+= aarch64/swscale_unscaled.o
+
+NEON-OBJS   += aarch64/yuv2rgb_neon.o
diff --git a/libswscale/aarch64/swscale_unscaled.c 
b/libswscale/aarch64/swscale_unscaled.c
new file mode 100644
index 000..551daad
--- /dev/null
+++ b/libswscale/aarch64/swscale_unscaled.c
@@ -0,0 +1,132 @@
+/*
+ * 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
+ */
+
+#include "config.h"
+#include "libswscale/swscale.h"
+#include "libswscale/swscale_internal.h"
+#include "libavutil/aarch64/cpu.h"
+
+#define YUV_TO_RGB_TABLE   
 \
+c->yuv2rgb_v2r_coeff,  
 \
+c->yuv2rgb_u2g_coeff,  
 \
+c->yuv2rgb_v2g_coeff,  
 \
+c->yuv2rgb_u2b_coeff,  
 \
+
+#define DECLARE_FF_YUVX_TO_RGBX_FUNCS(ifmt, ofmt)  
 \
+int ff_##ifmt##_to_##ofmt##_neon(int w, int h, 
 \
+ uint8_t *dst, int linesize,   
 \
+ const uint8_t *srcY, int linesizeY,   
 \
+ const uint8_t *srcU, int linesizeU,   
 \
+ const uint8_t *srcV, int linesizeV,   
 \
+ const int16_t *table, 
 \
+ int y_offset, 
 \
+ int y_coeff); 
 \
+   
 \
+static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t 
*src[], \
+   int srcStride[], int srcSliceY, int 
srcSliceH,   \
+   uint8_t *dst[], int dstStride[]) {  
 \
+const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE };  
 \
+   
 \
+ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH,   
 \
+ dst[0] + srcSliceY * dstStride[0], 
dstStride[0],   \
+ src[0], srcStride[0], 
 \
+ src[1], srcStride[1], 
 \
+ src[2], srcStride[2], 
 \
+ yuv2rgb_table,
 \
+ c->yuv2rgb_y_offset >> 6, 
 \
+ c->yuv2rgb_y_coeff);  

Re: [FFmpeg-devel] [PATCH 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson

On 02/29/2016 07:39 AM, Mats Peterson wrote:




___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



Once again, this patch set is needed for stream copy of raw palettized 
data, since the packets will have the palette in side data packets, and 
not appended to the video data in the packets themselves.


As long as the extra size due to the stride of the original packet is 
not mistaken for a palette (that will only happen when the extra size is 
exactly 1024 bytes), ff_reshuffle_raw_rgb() will align the stride 
properly even on stream copy. Thus, the video data won't be a perfectly 
"identical" copy, but that would be rather useless anyway due to the 
different stride alignment requirements of AVI and QuickTime.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/avf_showcqt: optimize draw routines

2016-02-29 Thread Muhammad Faiz
On Sun, Feb 28, 2016 at 4:52 PM, Muhammad Faiz  wrote:
> optimize draw_bar_yuv (slightly faster)
> optimize draw_axis (about 2x faster)
>
> Signed-off-by: Muhammad Faiz 
> ---
>  libavfilter/avf_showcqt.c | 212 
> +-
>  1 file changed, 115 insertions(+), 97 deletions(-)
>

Applied

Thanks
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel