Re: [FFmpeg-devel] [PATCH 1/2] avformat/mov: zero initialize codec_name in mov_parse_stsd_video()

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 11:15:50PM -0300, James Almer wrote:
> On 10/17/2016 9:57 PM, Michael Niedermayer wrote:
> > On Sun, Oct 16, 2016 at 09:34:50PM -0300, James Almer wrote:
> >> Fixes valgrind warning about "Conditional jump or move depends on 
> >> uninitialised value(s)"
> >>
> >> Signed-off-by: James Almer 
> >> ---
> >>  libavformat/mov.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > This should be suppressable by adding it to
> > tests/fate-valgrind.supp
> 
> I'll leave that to someone else. No idea how to add stuff to that file.

IIRC, valgrind can print the proper formatted supperssion, so
should only require copy and paste from that


> 
> Should i drop this patch? Zero initializing a buffer in stack wouldn't
> hurt IMO.

iam not objecting to the zero init

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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


Re: [FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 11:26:24PM +0200, Andreas Cadhalpun wrote:
> On 18.10.2016 22:56, Michael Niedermayer wrote:
> > On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote:
> >> Nothing guarantees to set request_probe to -1, so this assert can be
> >> triggered, e.g. if st->probe_packets is 0.
> > 
> > probe_codec() called with NULL should cause
> > st->probe_packets = 0
> > st->request_probe = -1;
> 
> Yes, but request_probe can be change to a different value later on,
> e.g. in ff_parse_mpeg2_descriptor:
> 
> int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
> {
> [...]
> if (s->internal->raw_packet_buffer_remaining_size <= 0)
> if ((err = probe_codec(s, st, NULL)) < 0) // probe_packets = 
> 0, request_probe = -1
> return err;
> [...]
> ret = s->iformat->read_packet(s, pkt);
> ~~~
> ff_parse_mpeg2_descriptor([...])
> {
> [...]
> switch (desc_tag) {
> [...]
> case 0x05: /* registration descriptor */
> [...]
> st->request_probe = 50;
> [...]
> }
> ~~~
> [...]
> if (st->probe_packets) // still 0
> if ((err = probe_codec(s, st, NULL)) < 0)
> return err;
> av_assert0(st->request_probe <= 0); // now 50
> SIGABRT

hmm, i guess the patch is then ok
alternatively you could use i think:
@@ -803,7 +803,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
 return ret;
 for (i = 0; i < s->nb_streams; i++) {
 st = s->streams[i];
-if (st->probe_packets)
+if (st->probe_packets || st->request_probe > 0)
 if ((err = probe_codec(s, st, NULL)) < 0)
 return err;
 av_assert0(st->request_probe <= 0);


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn


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


Re: [FFmpeg-devel] [PATCH] libavcodec/tests: Added test for libavcodec/avpacket.c

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 01:38:27PM -0700, Thomas Turner wrote:
> Improved code coverage for libavcodec
> Function(s) Tested: av_packet_clone()
> 
> Signed-off-by: Thomas Turner 
> ---
>  libavcodec/Makefile |   3 +-
>  libavcodec/tests/avpacket.c | 254 
> 
>  tests/fate/libavcodec.mak   |   5 +
>  3 files changed, 261 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/tests/avpacket.c
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index a1560ba..d64b8df 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -1016,7 +1016,8 @@ SKIPHEADERS-$(CONFIG_VDA)  += vda.h 
> vda_vt_internal.h
>  SKIPHEADERS-$(CONFIG_VDPAU)+= vdpau.h vdpau_internal.h
>  SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vda_vt_internal.h
>  
> -TESTPROGS = imgconvert  \
> +TESTPROGS = avpacket\
> +imgconvert  \
>  jpeg2000dwt \
>  mathops\
>  options \
> diff --git a/libavcodec/tests/avpacket.c b/libavcodec/tests/avpacket.c
> new file mode 100644
> index 000..67ec71b
> --- /dev/null
> +++ b/libavcodec/tests/avpacket.c
> @@ -0,0 +1,254 @@
> +/*
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include "libavcodec/avcodec.h"
> +#include "libavutil/error.h"
> +
> +
> +
> +
> +
> +static char* getbuffer(AVPacket avpkt, int index)
> +{
> +uint8_t *buffer;
> +int val, buffer_size = 256;
> +
> +/* Allocate 256 bytes */
> +if((buffer = malloc(buffer_size)) == NULL){
> +perror("malloc");
> +goto EXIT;
> +}
> +
> +if(index == 0){
> +val = snprintf(buffer, buffer_size,
> +"{buffer: %p,  data: %p, size: %d}",
> +avpkt.buf->buffer, avpkt.buf->data, avpkt.buf->size);

> +}
> +else if(index == 1){

nitpick, the formating for this in ffmpeg is
} else if (index == 1) {



> +val = snprintf(buffer, buffer_size, "\"%s\"", avpkt.data);
> +}
> +else if(index == 2){
> +val = snprintf(buffer, buffer_size,
> +"{data: %p \"%s\", size: %d, type: %d}",
> +avpkt.side_data, avpkt.side_data->data, avpkt.side_data->size,
> +avpkt.side_data->type);
> +}
> +
> +/* snprintf fail check */
> +if(!(val > -1 && val < buffer_size)){
> +perror("snprintf");
> +free(buffer);
> +goto EXIT;
> +}
> +
> +return buffer;
> +
> +EXIT:

> +exit(-1);

exit always uses positive numbers in ffmpeg


> +}
> +
> +static void log_avpacket(AVPacket avpkt, const char* message)
> +{
> +uint8_t *buf_info = 0, *data_info = 0, *side_info = 0;
> +
> +/* get buf information */
> +if(avpkt.buf){
> +buf_info = getbuffer(avpkt, 0);
> +}
> +
> +/* get data information */
> +if(avpkt.data){
> +data_info = getbuffer(avpkt, 1);
> +}
> +
> +/* get side data information */
> +if(avpkt.side_data){
> +side_info = getbuffer(avpkt, 2);
> +}
> +
> +/* log standard packet information */
> +av_log(NULL, AV_LOG_INFO,
> +   "\n%s:\n\n"
> +   "buf\t\t: %p "
> +   "%s\n"
> +   "pts\t\t: %" PRId64 "\n"
> +   "dts\t\t: %" PRId64 "\n"
> +   "data\t\t: %p "
> +   "%s\n"
> +   "size\t\t: %d\n"
> +   "stream_index\t: %d\n"
> +   "flags\t\t: %d\n"
> +   "side_data\t: %p "
> +   "%s\n"
> +   "side_data_elems\t: %d\n"
> +   "duration\t: %" PRId64 "\n"
> +   "pos\t\t: %" PRId64 "\n\n",
> +   message,
> +   avpkt.buf,
> +   buf_info ? (char*)buf_info : "",
> +   avpkt.pts,
> +   avpkt.dts,
> +   avpkt.data,
> +   data_info,
> +   avpkt.size,
> +   avpkt.stream_index,
> +   

[FFmpeg-devel] [PATCH] avformat/matroskaenc: write DisplayWidth and DisplayHeight elements only if they differ from PixelWidth and PixelHeight

2016-10-18 Thread James Almer
Signed-off-by: James Almer 
---
 libavformat/matroskaenc.c | 6 --
 tests/fate/matroska.mak   | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 6f2957c..03d5326 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1192,8 +1192,10 @@ static int mkv_write_track(AVFormatContext *s, 
MatroskaMuxContext *mkv,
 av_log(s, AV_LOG_ERROR, "Overflow in display width\n");
 return AVERROR(EINVAL);
 }
-put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , d_width / 
display_width_div);
-put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, par->height / 
display_height_div);
+if (d_width != par->width || display_width_div != 1 || 
display_height_div != 1) {
+put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , d_width / 
display_width_div);
+put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, par->height 
/ display_height_div);
+}
 } else if (display_width_div != 1 || display_height_div != 1) {
 put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , par->width / 
display_width_div);
 put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, par->height / 
display_height_div);
diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 63a4252..35ed41f 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -4,6 +4,6 @@
 FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
 fate-matroska-remux: CMD = md5 -i 
$(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v 
copy -fflags +bitexact -strict -2 -f matroska
 fate-matroska-remux: CMP = oneline
-fate-matroska-remux: REF = 84e950f59677e306f944fca484888c5d
+fate-matroska-remux: REF = 9b8398b42804ba12c39d2f47299a0996
 
 FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes)
-- 
2.9.1

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/mov: zero initialize codec_name in mov_parse_stsd_video()

2016-10-18 Thread James Almer
On 10/17/2016 9:57 PM, Michael Niedermayer wrote:
> On Sun, Oct 16, 2016 at 09:34:50PM -0300, James Almer wrote:
>> Fixes valgrind warning about "Conditional jump or move depends on 
>> uninitialised value(s)"
>>
>> Signed-off-by: James Almer 
>> ---
>>  libavformat/mov.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> This should be suppressable by adding it to
> tests/fate-valgrind.supp

I'll leave that to someone else. No idea how to add stuff to that file.

Should i drop this patch? Zero initializing a buffer in stack wouldn't
hurt IMO.

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


Re: [FFmpeg-devel] [PATCH 2/2] avformat/mov: pass the demuxer's AVFormatContext to avpriv_request_sample()

2016-10-18 Thread James Almer
On 10/17/2016 6:42 PM, Michael Niedermayer wrote:
> On Sun, Oct 16, 2016 at 09:34:51PM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  libavformat/mov.c | 7 ---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> LGTM
> 
> thx

Pushed, thanks.

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


[FFmpeg-devel] [PATCH 3/4] V14 - SCTE-35 support in hlsenc

2016-10-18 Thread Carlos Fernandez Sanz
From: Carlos Fernandez 

Signed-off-by: Carlos Fernandez 
---
 libavformat/Makefile  |   2 +-
 libavformat/hlsenc.c  | 104 --
 libavformat/scte_35.c | 527 ++
 libavformat/scte_35.h |  86 
 4 files changed, 697 insertions(+), 22 deletions(-)
 create mode 100644 libavformat/scte_35.c
 create mode 100644 libavformat/scte_35.h

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 5d827d31..9218606 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -205,7 +205,7 @@ OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o
 OBJS-$(CONFIG_HEVC_DEMUXER)  += hevcdec.o rawdec.o
 OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o
 OBJS-$(CONFIG_HLS_DEMUXER)   += hls.o
-OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o
+OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o scte_35.o
 OBJS-$(CONFIG_HNM_DEMUXER)   += hnm.o
 OBJS-$(CONFIG_ICO_DEMUXER)   += icodec.o
 OBJS-$(CONFIG_ICO_MUXER) += icoenc.o
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 9ca2df7..01e3237 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -38,6 +38,7 @@
 #include "avio_internal.h"
 #include "internal.h"
 #include "os_support.h"
+#include "scte_35.h"
 
 #define KEYSIZE 16
 #define LINE_BUFFER_SIZE 1024
@@ -48,6 +49,10 @@ typedef struct HLSSegment {
 double duration; /* in seconds */
 int64_t pos;
 int64_t size;
+struct scte35_event *event;
+enum scte35_event_state event_state;
+int adv_count;
+int64_t start_pts;
 
 char key_uri[LINE_BUFFER_SIZE + 1];
 char iv_string[KEYSIZE*2 + 1];
@@ -108,6 +113,8 @@ typedef struct HLSContext {
 int nb_entries;
 int discontinuity_set;
 
+int adv_count;
+struct scte35_interface *scte_iface;
 HLSSegment *segments;
 HLSSegment *last_segment;
 HLSSegment *old_segments;
@@ -241,6 +248,8 @@ static int hls_delete_old_segments(HLSContext *hls) {
 av_freep();
 previous_segment = segment;
 segment = previous_segment->next;
+if (hls->scte_iface)
+hls->scte_iface->unref_scte35_event(_segment->event);
 av_free(previous_segment);
 }
 
@@ -360,8 +369,8 @@ static int hls_mux_init(AVFormatContext *s)
 }
 
 /* Create a new segment and append it to the segment list */
-static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, 
double duration,
-  int64_t pos, int64_t size)
+static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, 
double duration, int64_t pos,
+  int64_t start_pts, struct scte35_event *event, 
int64_t size)
 {
 HLSSegment *en = av_malloc(sizeof(*en));
 const char  *filename;
@@ -384,9 +393,20 @@ static int hls_append_segment(struct AVFormatContext *s, 
HLSContext *hls, double
 
 en->duration = duration;
 en->pos  = pos;
+en->event= event;
 en->size = size;
+en->start_pts  = start_pts;
 en->next = NULL;
 
+if (hls->scte_iface) {
+if (hls->scte_iface->event_state == EVENT_OUT_CONT)
+hls->adv_count++;
+else
+hls->adv_count = 0;
+en->event_state = hls->scte_iface->event_state;
+}
+
+
 if (hls->key_info_file) {
 av_strlcpy(en->key_uri, hls->key_uri, sizeof(en->key_uri));
 av_strlcpy(en->iv_string, hls->iv_string, sizeof(en->iv_string));
@@ -460,7 +480,7 @@ static int parse_playlist(AVFormatContext *s, const char 
*url)
 new_start_pos = avio_tell(hls->avf->pb);
 hls->size = new_start_pos - hls->start_pos;
 av_strlcpy(hls->avf->filename, line, sizeof(line));
-ret = hls_append_segment(s, hls, hls->duration, 
hls->start_pos, hls->size);
+ret = hls_append_segment(s, hls, hls->duration, 
hls->start_pos, 0, NULL, hls->size);
 if (ret < 0)
 goto fail;
 hls->start_pos = new_start_pos;
@@ -590,9 +610,19 @@ static int hls_window(AVFormatContext *s, int last)
 avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, 
milli, buf1);
 prog_date_time += en->duration;
 }
-if (hls->baseurl)
-avio_printf(out, "%s", hls->baseurl);
-avio_printf(out, "%s\n", en->filename);
+if (hls->scte_iface && en->event) {
+char *str;
+char fname[1024] = "";
+if (hls->baseurl)
+strncat(fname, hls->baseurl, sizeof(fname)-1);
+strncat(fname, en->filename, sizeof(fname)-strlen(fname)-1);
+str = hls->scte_iface->get_hls_string(hls->scte_iface, en->event, 
fname, en->event_state, -1, en->start_pts);
+avio_printf(out, "%s", str);
+} else {
+if (hls->baseurl)
+avio_printf(out, "%s", 

[FFmpeg-devel] [PATCH 0/4] V14 - SCTE-35 support

2016-10-18 Thread Carlos Fernandez Sanz
- Addresses all things mentioned by Anssi Hannula about HLS

Carlos Fernandez (4):
  Adding SCTE-35 CUI codec
  SCTE-35 extraction from mpegts
  SCTE-35 support in hlsenc
  Correct Indentation

 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   6 +
 libavformat/Makefile|   2 +-
 libavformat/hlsenc.c| 112 +++---
 libavformat/mpegts.c|  47 -
 libavformat/scte_35.c   | 527 
 libavformat/scte_35.h   |  86 
 7 files changed, 753 insertions(+), 28 deletions(-)
 create mode 100644 libavformat/scte_35.c
 create mode 100644 libavformat/scte_35.h

-- 
2.7.4

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


[FFmpeg-devel] [PATCH 2/4] V14 - SCTE-35 extraction from mpegts

2016-10-18 Thread Carlos Fernandez Sanz
From: Carlos Fernandez 

Signed-off-by: Carlos Fernandez 
---
 libavformat/mpegts.c | 47 +--
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index b31d233..932ffc1 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -725,6 +725,12 @@ static const StreamType HDMV_types[] = {
 { 0 },
 };
 
+/* SCTE types */
+static const StreamType SCTE_types[] = {
+{ 0x86, AVMEDIA_TYPE_DATA,  AV_CODEC_ID_SCTE_35},
+{ 0 },
+};
+
 /* ATSC ? */
 static const StreamType MISC_types[] = {
 { 0x81, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 },
@@ -872,6 +878,13 @@ static void reset_pes_packet_state(PESContext *pes)
 av_buffer_unref(>buffer);
 }
 
+static void new_data_packet(const uint8_t *buffer, int len, AVPacket *pkt)
+{
+av_init_packet(pkt);
+pkt->data = buffer;
+pkt->size = len;
+}
+
 static int new_pes_packet(PESContext *pes, AVPacket *pkt)
 {
 char *sd;
@@ -1590,6 +1603,27 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t 
*section,
 av_free(mp4_descr[i].dec_config_descr);
 }
 
+static void scte_data_cb(MpegTSFilter *filter, const uint8_t *section,
+int section_len)
+{
+AVProgram *prg = NULL;
+MpegTSContext *ts = filter->u.section_filter.opaque;
+
+int idx = ff_find_stream_index(ts->stream, filter->pid);
+new_data_packet(section, section_len, ts->pkt);
+if (idx >= 0) {
+ts->pkt->stream_index = idx;
+}
+prg = av_find_program_from_stream(ts->stream, NULL, idx);
+if (prg && prg->pcr_pid != -1 && prg->discard != AVDISCARD_ALL) {
+MpegTSFilter *f = ts->pids[prg->pcr_pid];
+if (f)
+ts->pkt->pts = ts->pkt->dts = f->last_pcr/300;
+}
+ts->stop_parse = 1;
+
+}
+
 static const uint8_t opus_coupled_stream_cnt[9] = {
 1, 0, 1, 1, 2, 2, 2, 3, 3
 };
@@ -1868,6 +1902,12 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
AVStream *st, int stream_type
 return 0;
 }
 
+static int is_pes_stream(int stream_type, uint32_t prog_reg_desc)
+{
+return !(stream_type == 0x13 ||
+ (stream_type == 0x86 && prog_reg_desc == AV_RL32("CUEI")) );
+}
+
 static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int 
section_len)
 {
 MpegTSContext *ts = filter->u.section_filter.opaque;
@@ -1975,7 +2015,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t 
*section, int section_len
 pes->st->id = pes->pid;
 }
 st = pes->st;
-} else if (stream_type != 0x13) {
+} else if (is_pes_stream(stream_type, prog_reg_desc)) {
 if (ts->pids[pid])
 mpegts_close_filter(ts, ts->pids[pid]); // wrongly added sdt 
filter probably
 pes = add_pes_stream(ts, pid, pcr_pid);
@@ -1995,6 +2035,10 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t 
*section, int section_len
 goto out;
 st->id = pid;
 st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
+if (stream_type == 0x86 && prog_reg_desc == AV_RL32("CUEI")) {
+mpegts_find_stream_type(st, stream_type, SCTE_types);
+mpegts_open_section_filter(ts, pid, scte_data_cb, ts, 1);
+}
 }
 }
 
@@ -2317,7 +2361,6 @@ static int handle_packet(MpegTSContext *ts, const uint8_t 
*packet)
 }
 }
 }
-
 } else {
 int ret;
 // Note: The position here points actually behind the current packet.
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet

2016-10-18 Thread Andreas Cadhalpun
On 18.10.2016 23:46, Hendrik Leppkes wrote:
> On Tue, Oct 18, 2016 at 11:26 PM, Andreas Cadhalpun
>  wrote:
>> On 18.10.2016 22:56, Michael Niedermayer wrote:
>>> On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote:
 Nothing guarantees to set request_probe to -1, so this assert can be
 triggered, e.g. if st->probe_packets is 0.
>>>
>>> probe_codec() called with NULL should cause
>>> st->probe_packets = 0
>>> st->request_probe = -1;
>>
>> Yes, but request_probe can be change to a different value later on,
>> e.g. in ff_parse_mpeg2_descriptor:
>>
>> int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>> {
>> [...]
>> if (s->internal->raw_packet_buffer_remaining_size <= 0)
>> if ((err = probe_codec(s, st, NULL)) < 0) // probe_packets = 
>> 0, request_probe = -1
>> return err;
>> [...]
>> ret = s->iformat->read_packet(s, pkt);
>> ~~~
>> ff_parse_mpeg2_descriptor([...])
>> {
>> [...]
>> switch (desc_tag) {
>> [...]
>> case 0x05: /* registration descriptor */
>> [...]
>> st->request_probe = 50;
>> [...]
>> }
>> ~~~
>> [...]
>> if (st->probe_packets) // still 0
>> if ((err = probe_codec(s, st, NULL)) < 0)
>> return err;
>> av_assert0(st->request_probe <= 0); // now 50
>> SIGABRT
>>
> 
> Can you actually make that happen, or is that just speculation?

Yes, at least in ffmpeg 3.1.4 and master with commit 04fa20d reverted.
(I do fuzz-testing, not speculating.)

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet

2016-10-18 Thread Hendrik Leppkes
On Tue, Oct 18, 2016 at 11:26 PM, Andreas Cadhalpun
 wrote:
> On 18.10.2016 22:56, Michael Niedermayer wrote:
>> On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote:
>>> Nothing guarantees to set request_probe to -1, so this assert can be
>>> triggered, e.g. if st->probe_packets is 0.
>>
>> probe_codec() called with NULL should cause
>> st->probe_packets = 0
>> st->request_probe = -1;
>
> Yes, but request_probe can be change to a different value later on,
> e.g. in ff_parse_mpeg2_descriptor:
>
> int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
> {
> [...]
> if (s->internal->raw_packet_buffer_remaining_size <= 0)
> if ((err = probe_codec(s, st, NULL)) < 0) // probe_packets = 
> 0, request_probe = -1
> return err;
> [...]
> ret = s->iformat->read_packet(s, pkt);
> ~~~
> ff_parse_mpeg2_descriptor([...])
> {
> [...]
> switch (desc_tag) {
> [...]
> case 0x05: /* registration descriptor */
> [...]
> st->request_probe = 50;
> [...]
> }
> ~~~
> [...]
> if (st->probe_packets) // still 0
> if ((err = probe_codec(s, st, NULL)) < 0)
> return err;
> av_assert0(st->request_probe <= 0); // now 50
> SIGABRT
>

Can you actually make that happen, or is that just speculation?

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


Re: [FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet

2016-10-18 Thread Andreas Cadhalpun
On 18.10.2016 22:56, Michael Niedermayer wrote:
> On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote:
>> Nothing guarantees to set request_probe to -1, so this assert can be
>> triggered, e.g. if st->probe_packets is 0.
> 
> probe_codec() called with NULL should cause
> st->probe_packets = 0
> st->request_probe = -1;

Yes, but request_probe can be change to a different value later on,
e.g. in ff_parse_mpeg2_descriptor:

int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
{
[...]
if (s->internal->raw_packet_buffer_remaining_size <= 0)
if ((err = probe_codec(s, st, NULL)) < 0) // probe_packets = 0, 
request_probe = -1
return err;
[...]
ret = s->iformat->read_packet(s, pkt);
~~~
ff_parse_mpeg2_descriptor([...])
{
[...]
switch (desc_tag) {
[...]
case 0x05: /* registration descriptor */
[...]
st->request_probe = 50;
[...]
}
~~~
[...]
if (st->probe_packets) // still 0
if ((err = probe_codec(s, st, NULL)) < 0)
return err;
av_assert0(st->request_probe <= 0); // now 50
SIGABRT

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote:
> Nothing guarantees to set request_probe to -1, so this assert can be
> triggered, e.g. if st->probe_packets is 0.

probe_codec() called with NULL should cause
st->probe_packets = 0
st->request_probe = -1;

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

Never trust a computer, one day, it may think you are the virus. -- Compn


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


[FFmpeg-devel] [PATCH] libavcodec/tests: Added test for libavcodec/avpacket.c

2016-10-18 Thread Thomas Turner
Improved code coverage for libavcodec
Function(s) Tested: av_packet_clone()

Signed-off-by: Thomas Turner 
---
 libavcodec/Makefile |   3 +-
 libavcodec/tests/avpacket.c | 254 
 tests/fate/libavcodec.mak   |   5 +
 3 files changed, 261 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/tests/avpacket.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index a1560ba..d64b8df 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1016,7 +1016,8 @@ SKIPHEADERS-$(CONFIG_VDA)  += vda.h 
vda_vt_internal.h
 SKIPHEADERS-$(CONFIG_VDPAU)+= vdpau.h vdpau_internal.h
 SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vda_vt_internal.h
 
-TESTPROGS = imgconvert  \
+TESTPROGS = avpacket\
+imgconvert  \
 jpeg2000dwt \
 mathops\
 options \
diff --git a/libavcodec/tests/avpacket.c b/libavcodec/tests/avpacket.c
new file mode 100644
index 000..67ec71b
--- /dev/null
+++ b/libavcodec/tests/avpacket.c
@@ -0,0 +1,254 @@
+/*
+ * 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 
+#include 
+#include 
+#include 
+#include "libavcodec/avcodec.h"
+#include "libavutil/error.h"
+
+
+
+
+
+static char* getbuffer(AVPacket avpkt, int index)
+{
+uint8_t *buffer;
+int val, buffer_size = 256;
+
+/* Allocate 256 bytes */
+if((buffer = malloc(buffer_size)) == NULL){
+perror("malloc");
+goto EXIT;
+}
+
+if(index == 0){
+val = snprintf(buffer, buffer_size,
+"{buffer: %p,  data: %p, size: %d}",
+avpkt.buf->buffer, avpkt.buf->data, avpkt.buf->size);
+}
+else if(index == 1){
+val = snprintf(buffer, buffer_size, "\"%s\"", avpkt.data);
+}
+else if(index == 2){
+val = snprintf(buffer, buffer_size,
+"{data: %p \"%s\", size: %d, type: %d}",
+avpkt.side_data, avpkt.side_data->data, avpkt.side_data->size,
+avpkt.side_data->type);
+}
+
+/* snprintf fail check */
+if(!(val > -1 && val < buffer_size)){
+perror("snprintf");
+free(buffer);
+goto EXIT;
+}
+
+return buffer;
+
+EXIT:
+exit(-1);
+}
+
+static void log_avpacket(AVPacket avpkt, const char* message)
+{
+uint8_t *buf_info = 0, *data_info = 0, *side_info = 0;
+
+/* get buf information */
+if(avpkt.buf){
+buf_info = getbuffer(avpkt, 0);
+}
+
+/* get data information */
+if(avpkt.data){
+data_info = getbuffer(avpkt, 1);
+}
+
+/* get side data information */
+if(avpkt.side_data){
+side_info = getbuffer(avpkt, 2);
+}
+
+/* log standard packet information */
+av_log(NULL, AV_LOG_INFO,
+   "\n%s:\n\n"
+   "buf\t\t: %p "
+   "%s\n"
+   "pts\t\t: %" PRId64 "\n"
+   "dts\t\t: %" PRId64 "\n"
+   "data\t\t: %p "
+   "%s\n"
+   "size\t\t: %d\n"
+   "stream_index\t: %d\n"
+   "flags\t\t: %d\n"
+   "side_data\t: %p "
+   "%s\n"
+   "side_data_elems\t: %d\n"
+   "duration\t: %" PRId64 "\n"
+   "pos\t\t: %" PRId64 "\n\n",
+   message,
+   avpkt.buf,
+   buf_info ? (char*)buf_info : "",
+   avpkt.pts,
+   avpkt.dts,
+   avpkt.data,
+   data_info,
+   avpkt.size,
+   avpkt.stream_index,
+   avpkt.flags,
+   avpkt.side_data,
+   side_info,
+   avpkt.side_data_elems,
+   avpkt.duration,
+   avpkt.pos
+);
+
+}
+
+static int compare_av_packet(AVPacket* p1, AVPacket* p2)
+{
+/* compare data */
+
+if(p1->size != p2->size){
+fprintf(stderr, "size\n");
+goto fail;
+}
+if(strncmp(p1->data, p2->data, p1->size) != 0){
+fprintf(stderr, "data\n");
+goto fail;
+}
+if(p1->pts != p2->pts){
+   

Re: [FFmpeg-devel] [PATCH v3] aacenc: add SIMD optimizations for abs_pow34 and quantization

2016-10-18 Thread Rostislav Pehlivanov
On 18 October 2016 at 21:04, Michael Niedermayer 
wrote:

> On Tue, Oct 18, 2016 at 05:33:13PM +0100, Rostislav Pehlivanov wrote:
> > On 18 October 2016 at 16:32, James Almer  wrote:
> >
> > > On 10/18/2016 12:07 PM, Rostislav Pehlivanov wrote:
> > > > diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
> > > > index ee3cbf8..622f0ba 100644
> > > > --- a/libavcodec/aacenc.c
> > > > +++ b/libavcodec/aacenc.c
> > > > @@ -1033,6 +1033,12 @@ static av_cold int
> aac_encode_init(AVCodecContext
> > > *avctx)
> > > >  ff_lpc_init(>lpc, 2*avctx->frame_size, TNS_MAX_ORDER,
> > > FF_LPC_TYPE_LEVINSON);
> > > >  s->random_state = 0x1f2e3d4c;
> > > >
> > > > +s->abs_pow34   = _pow34_v;
> > > > +s->quant_bands = _bands;
> > >
> > > No need for & in these.
> > >
> > > > +
> > > > +if (ARCH_X86)
> > > > +ff_aac_dsp_init_x86(s);
> > > > +
> > > >  if (HAVE_MIPSDSP)
> > > >  ff_aac_coder_init_mips(s);
> > >
> > > [...]
> > >
> > > > diff --git a/libavcodec/x86/aacencdsp.asm
> b/libavcodec/x86/aacencdsp.asm
> > > > new file mode 100644
> > > > index 000..dd7b022
> > > > --- /dev/null
> > > > +++ b/libavcodec/x86/aacencdsp.asm
> > > > @@ -0,0 +1,88 @@
> > > > +;**
> > > 
> > > > +;* SIMD optimized AAC encoder DSP functions
> > > > +;*
> > > > +;* Copyright (C) 2016 Rostislav Pehlivanov 
> > > > +;*
> > > > +;* 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/x86/x86util.asm"
> > > > +
> > > > +SECTION_RODATA
> > > > +
> > > > +float_abs_mask: times 4 dd 0x7fff
> > > > +
> > > > +SECTION .text
> > > > +
> > > > +;**
> *
> > > > +;void ff_abs_pow34(float *out, const float *in, const int size);
> > > > +;**
> *
> > > > +INIT_XMM sse
> > > > +cglobal abs_pow34, 3, 3, 3, out, in, size
> > > > +mova   m2, [float_abs_mask]
> > > > +shlsizeq, 2
> > > > +addinq, sizeq
> > > > +addoutq, sizeq
> > > > +negsizeq
> > > > +.loop:
> > > > +movaps m0, [inq+sizeq]
> > > > +andps  m0, m2
> > >
> > > Remove the movaps and do
> > >
> > > andps  m0, m2, [inq+sizeq]
> > >
> > > Instead. Sorry i didn't notice this last time.
> > >
> > > > +sqrtps m1, m0
> > > > +mulps  m0, m1
> > > > +sqrtps m0, m0
> > > > +mova   [outq+sizeq], m0
> > > > +addsizeq, mmsize
> > > > +jl.loop
> > > > +RET
> > > > +
> > > > +;**
> *
> > > > +;void ff_aac_quantize_bands(int *out, const float *in, const float
> > > *scaled,
> > > > +;   int size, int is_signed, int maxval,
> const
> > > float Q34,
> > > > +;   const float rounding)
> > > > +;**
> *
> > > > +INIT_XMM sse2
> > > > +cglobal aac_quantize_bands, 5, 5, 6, out, in, scaled, size,
> is_signed,
> > > maxval, Q34, rounding
> > > > +%if UNIX64 == 0
> > > > +movss m0, Q34m
> > > > +movss m1, roundingm
> > > > +cvtsi2ss  m3, maxvald
> > > > +%else
> > > > +cvtsi2ss  m3, dword maxvalm
> > > > +%endif
> > >
> > > The other way around. Unix64 is the one that has maxval on a reg
> regardless
> > > of how you init the function, whereas win64 and any x86_32 target have
> it
> > > on stack.
> > >
> > > > +shufpsm0, m0, 0
> > > > +shufpsm1, m1, 0
> > > > +shufpsm3, m3, 0
> > > > +shl   is_signedd, 31
> > > > +movd  m4, is_signedd
> > > > +shufpsm4, m4, 0
> > > > +shl   sized,   2
> > > > +add   inq, sizeq
> > > > +add   outq, sizeq
> > > > +add   scaledq, sizeq
> > > > +neg   sizeq
> > > > +.loop:
> > > > +mulps m2, m0, [scaledq+sizeq]
> > > > +addps m2, m1
> > > > +minps 

[FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet

2016-10-18 Thread Andreas Cadhalpun
Nothing guarantees to set request_probe to -1, so this assert can be
triggered, e.g. if st->probe_packets is 0.

Signed-off-by: Andreas Cadhalpun 
---

I think the reason why this assert isn't triggered way more often is
that the probing code usually works quite well.

---
 libavformat/utils.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8a51aea..a62a073 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -806,7 +806,6 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
 if (st->probe_packets)
 if ((err = probe_codec(s, st, NULL)) < 0)
 return err;
-av_assert0(st->request_probe <= 0);
 }
 continue;
 }
-- 
2.9.3
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Memcpy Operation Duration

2016-10-18 Thread Ali KIZIL
On Oct 18, 2016 11:08 PM, "Ronald S. Bultje"  wrote:
>
> Hi Ali,
>
> On Tue, Oct 18, 2016 at 3:57 PM, Ali KIZIL  wrote:
>
> > 2016-10-18 22:44 GMT+03:00 Sven C. Dack :
> >
> > > On 18/10/16 20:26, Ali KIZIL wrote:
> > >
> > >> Hi Everyone,
> > >>
> > >> Today, I was analyzing memcpy duration in FFmpeg. I noticed that it
is
> > >> taking longer time compared to an optimized SSE, SSE2, MMX, MMX2,
AVX or
> > >> AVX2 based memcpy operation.
> > >>
> > >> I tried march=corei7-avx2 compiled FFmpeg version, it does not change
> > the
> > >> duration of memcpy operation.
> > >> I also folowed https://trac.ffmpeg.org/wiki/C
> > >> ompilationGuide#PerformanceTips
> > >> .Same result. In addition, I tried gcc 6.2 if gcc if gcc is not
> > selecting
> > >> the correct flag. Same result again.
> > >>
> > >> This memcpy operations effect the fps decoding (and probably
encoding)
> > >> rates.
> > >>
> > >> In a case that uyvy422 to p010 3840x2160 unscaled convertion in
> > rawvideo,
> > >> fps rate increased from 44 fps to 52 fps on a Xeon E5 2630 v4.
> > >>
> > >> Do I miss anything when compiling FFmpeg for AVX2 or other flag
> > optimised,
> > >> or there need a fix in FFmpeg to direct some (or all)  memcpy
operations
> > >> to
> > >> a inherited memcpy operation which can decide flag for optimisation ?
> > >> Or there is no such need and I am on a wrong path ?
> > >>
> > >> (As a side note, FFmpeg works performance on i7 Extreme cores
compared
> > to
> > >> Xeon v4 processors.)
> > >
> > > Could be it's gcc's built-in version. It's been said that libc is
> > > occasionally better at it than gcc's built-in version.
> > >
> > > Use -fno-builtin-memcpy and see what difference it makes.
> >
>
> >
> I see, tomorrow morning I will give it a try.
> > Thank you for the good idea. If it increase performance, maybe it will
be a
> > good idea to make a configure option.
>
>
> configure has --extra-cflags=.. and --extra-ldflags=.. options to add
> custom CC CLI arguments.
>
> Ronald
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Hi Ronald,

Yes, I used extra flags to give march=native or march=corei7-avx2.
Tomorrow, I will try -fno-builtin-memcpy option with extra-cflag. I will
update the topic.

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


Re: [FFmpeg-devel] [PATCH] lavf/mov: Add support for edit list parsing.

2016-10-18 Thread Sasi Inguva
I am also happy to fix any breaking files, if they don't fall under the
above category.

On Tue, Oct 18, 2016 at 1:08 PM, Sasi Inguva  wrote:

> With the current state of code, we will only encounterdemuxer
> outputting non-monotonic DTS  when there are multiple edit lists . Avoiding
> non-monotonic DTS for mulitple edit lists will not be possible with how the
> edit list support is currently implemented. That would only be possible if
> the edit list support is implemented after the decode is done.
>
> The only situation I see where things will break is if a file containing
> multiple edit lists is remuxed to another container , and we are not
> rewriting timestamps but passing through. In that case the av_write_frame
> will fail with non-monotonic DTS  provided.
>
> However consider the alternative. We have demuxer giving monotonic DTS
> which does not at all correspond to the timeline that edit lists intend. We
> remux successfully, but we have generated a file with AVSync problems, and
> which plays wrong.
>
> On Tue, Oct 18, 2016 at 7:31 AM, wm4  wrote:
>
>> On Fri,  5 Aug 2016 17:18:39 -0700
>> Sasi Inguva  wrote:
>>
>> > In YouTube we have long been receiving MOV files from users, which have
>> non-trivial edit lists (Those edit lists which are not just used to offset
>> video start from audio start) and multiple edit lists. Recently the uploads
>> of such files has increased with the introduction of apps that allow video
>> editing and upload like Vine etc. mov.c in ffmpeg does not have edit list
>> parsing support i.e. the support for deciding what video/audio packets
>> should be output with what timestamps, based on edit lists. For this
>> reason, we had built a basic support for edit list parsing in our version
>> of ffmpeg, which fixes the AVIndexEntries built by mov_build_index by
>> looking at edit lists, and introduces new DISCARD flags in AVPacket and
>> AVFrame to signal to the decoder to discard certain packets.
>> >
>> > For a while our edit list support was broken, as in it didn't properly
>> work for multiple edit lists and it had problems with edit-lists ending on
>> B-frames. But we've fixed most of these issues in recent times, and we
>> think that now it is in a good enough condition so that it can be submitted
>> to HEAD. This will not only help the vast userbase of ffmepg, but will also
>> help us with staying up-to-date with ffmpeg and also by adding the power of
>> ffmpeg developer community to our MOV support. So here's a go at it.
>> > What is supported:
>> >  - multiple edit lists
>> >  - edit lists ending on B-frames
>> >  - zero segment duration edit lists
>> >
>> > What is not supported:
>> >  - Changing the rate of playing with edit lists. We basically ignore
>> MediaRate field of edit.
>> >
>> > I have added fate tests too. Here is a no-sign-in required link to the
>> test files https://drive.google.com/folderview?id=0Bz6XfEJZ-9N3R3o3QXNH
>> UGRqbms=sharing.
>>
>> This still makes demuxers output packets with _not_ strictly
>> monotonically increasing DTS timestamps. Please fix this - a demuxer
>> isn't supposed to do this, and it's completely broken.
>> ___
>> 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] Memcpy Operation Duration

2016-10-18 Thread Ronald S. Bultje
Hi Ali,

On Tue, Oct 18, 2016 at 3:57 PM, Ali KIZIL  wrote:

> 2016-10-18 22:44 GMT+03:00 Sven C. Dack :
>
> > On 18/10/16 20:26, Ali KIZIL wrote:
> >
> >> Hi Everyone,
> >>
> >> Today, I was analyzing memcpy duration in FFmpeg. I noticed that it is
> >> taking longer time compared to an optimized SSE, SSE2, MMX, MMX2, AVX or
> >> AVX2 based memcpy operation.
> >>
> >> I tried march=corei7-avx2 compiled FFmpeg version, it does not change
> the
> >> duration of memcpy operation.
> >> I also folowed https://trac.ffmpeg.org/wiki/C
> >> ompilationGuide#PerformanceTips
> >> .Same result. In addition, I tried gcc 6.2 if gcc if gcc is not
> selecting
> >> the correct flag. Same result again.
> >>
> >> This memcpy operations effect the fps decoding (and probably encoding)
> >> rates.
> >>
> >> In a case that uyvy422 to p010 3840x2160 unscaled convertion in
> rawvideo,
> >> fps rate increased from 44 fps to 52 fps on a Xeon E5 2630 v4.
> >>
> >> Do I miss anything when compiling FFmpeg for AVX2 or other flag
> optimised,
> >> or there need a fix in FFmpeg to direct some (or all)  memcpy operations
> >> to
> >> a inherited memcpy operation which can decide flag for optimisation ?
> >> Or there is no such need and I am on a wrong path ?
> >>
> >> (As a side note, FFmpeg works performance on i7 Extreme cores compared
> to
> >> Xeon v4 processors.)
> >
> > Could be it's gcc's built-in version. It's been said that libc is
> > occasionally better at it than gcc's built-in version.
> >
> > Use -fno-builtin-memcpy and see what difference it makes.
>

>
I see, tomorrow morning I will give it a try.
> Thank you for the good idea. If it increase performance, maybe it will be a
> good idea to make a configure option.


configure has --extra-cflags=.. and --extra-ldflags=.. options to add
custom CC CLI arguments.

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


Re: [FFmpeg-devel] [PATCH] lavf/mov: Add support for edit list parsing.

2016-10-18 Thread Sasi Inguva
With the current state of code, we will only encounterdemuxer
outputting non-monotonic DTS  when there are multiple edit lists . Avoiding
non-monotonic DTS for mulitple edit lists will not be possible with how the
edit list support is currently implemented. That would only be possible if
the edit list support is implemented after the decode is done.

The only situation I see where things will break is if a file containing
multiple edit lists is remuxed to another container , and we are not
rewriting timestamps but passing through. In that case the av_write_frame
will fail with non-monotonic DTS  provided.

However consider the alternative. We have demuxer giving monotonic DTS
which does not at all correspond to the timeline that edit lists intend. We
remux successfully, but we have generated a file with AVSync problems, and
which plays wrong.

On Tue, Oct 18, 2016 at 7:31 AM, wm4  wrote:

> On Fri,  5 Aug 2016 17:18:39 -0700
> Sasi Inguva  wrote:
>
> > In YouTube we have long been receiving MOV files from users, which have
> non-trivial edit lists (Those edit lists which are not just used to offset
> video start from audio start) and multiple edit lists. Recently the uploads
> of such files has increased with the introduction of apps that allow video
> editing and upload like Vine etc. mov.c in ffmpeg does not have edit list
> parsing support i.e. the support for deciding what video/audio packets
> should be output with what timestamps, based on edit lists. For this
> reason, we had built a basic support for edit list parsing in our version
> of ffmpeg, which fixes the AVIndexEntries built by mov_build_index by
> looking at edit lists, and introduces new DISCARD flags in AVPacket and
> AVFrame to signal to the decoder to discard certain packets.
> >
> > For a while our edit list support was broken, as in it didn't properly
> work for multiple edit lists and it had problems with edit-lists ending on
> B-frames. But we've fixed most of these issues in recent times, and we
> think that now it is in a good enough condition so that it can be submitted
> to HEAD. This will not only help the vast userbase of ffmepg, but will also
> help us with staying up-to-date with ffmpeg and also by adding the power of
> ffmpeg developer community to our MOV support. So here's a go at it.
> > What is supported:
> >  - multiple edit lists
> >  - edit lists ending on B-frames
> >  - zero segment duration edit lists
> >
> > What is not supported:
> >  - Changing the rate of playing with edit lists. We basically ignore
> MediaRate field of edit.
> >
> > I have added fate tests too. Here is a no-sign-in required link to the
> test files https://drive.google.com/folderview?id=0Bz6XfEJZ-
> 9N3R3o3QXNHUGRqbms=sharing.
>
> This still makes demuxers output packets with _not_ strictly
> monotonically increasing DTS timestamps. Please fix this - a demuxer
> isn't supposed to do this, and it's completely broken.
> ___
> 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 v3] aacenc: add SIMD optimizations for abs_pow34 and quantization

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 05:33:13PM +0100, Rostislav Pehlivanov wrote:
> On 18 October 2016 at 16:32, James Almer  wrote:
> 
> > On 10/18/2016 12:07 PM, Rostislav Pehlivanov wrote:
> > > diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
> > > index ee3cbf8..622f0ba 100644
> > > --- a/libavcodec/aacenc.c
> > > +++ b/libavcodec/aacenc.c
> > > @@ -1033,6 +1033,12 @@ static av_cold int aac_encode_init(AVCodecContext
> > *avctx)
> > >  ff_lpc_init(>lpc, 2*avctx->frame_size, TNS_MAX_ORDER,
> > FF_LPC_TYPE_LEVINSON);
> > >  s->random_state = 0x1f2e3d4c;
> > >
> > > +s->abs_pow34   = _pow34_v;
> > > +s->quant_bands = _bands;
> >
> > No need for & in these.
> >
> > > +
> > > +if (ARCH_X86)
> > > +ff_aac_dsp_init_x86(s);
> > > +
> > >  if (HAVE_MIPSDSP)
> > >  ff_aac_coder_init_mips(s);
> >
> > [...]
> >
> > > diff --git a/libavcodec/x86/aacencdsp.asm b/libavcodec/x86/aacencdsp.asm
> > > new file mode 100644
> > > index 000..dd7b022
> > > --- /dev/null
> > > +++ b/libavcodec/x86/aacencdsp.asm
> > > @@ -0,0 +1,88 @@
> > > +;**
> > 
> > > +;* SIMD optimized AAC encoder DSP functions
> > > +;*
> > > +;* Copyright (C) 2016 Rostislav Pehlivanov 
> > > +;*
> > > +;* 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/x86/x86util.asm"
> > > +
> > > +SECTION_RODATA
> > > +
> > > +float_abs_mask: times 4 dd 0x7fff
> > > +
> > > +SECTION .text
> > > +
> > > +;***
> > > +;void ff_abs_pow34(float *out, const float *in, const int size);
> > > +;***
> > > +INIT_XMM sse
> > > +cglobal abs_pow34, 3, 3, 3, out, in, size
> > > +mova   m2, [float_abs_mask]
> > > +shlsizeq, 2
> > > +addinq, sizeq
> > > +addoutq, sizeq
> > > +negsizeq
> > > +.loop:
> > > +movaps m0, [inq+sizeq]
> > > +andps  m0, m2
> >
> > Remove the movaps and do
> >
> > andps  m0, m2, [inq+sizeq]
> >
> > Instead. Sorry i didn't notice this last time.
> >
> > > +sqrtps m1, m0
> > > +mulps  m0, m1
> > > +sqrtps m0, m0
> > > +mova   [outq+sizeq], m0
> > > +addsizeq, mmsize
> > > +jl.loop
> > > +RET
> > > +
> > > +;***
> > > +;void ff_aac_quantize_bands(int *out, const float *in, const float
> > *scaled,
> > > +;   int size, int is_signed, int maxval, const
> > float Q34,
> > > +;   const float rounding)
> > > +;***
> > > +INIT_XMM sse2
> > > +cglobal aac_quantize_bands, 5, 5, 6, out, in, scaled, size, is_signed,
> > maxval, Q34, rounding
> > > +%if UNIX64 == 0
> > > +movss m0, Q34m
> > > +movss m1, roundingm
> > > +cvtsi2ss  m3, maxvald
> > > +%else
> > > +cvtsi2ss  m3, dword maxvalm
> > > +%endif
> >
> > The other way around. Unix64 is the one that has maxval on a reg regardless
> > of how you init the function, whereas win64 and any x86_32 target have it
> > on stack.
> >
> > > +shufpsm0, m0, 0
> > > +shufpsm1, m1, 0
> > > +shufpsm3, m3, 0
> > > +shl   is_signedd, 31
> > > +movd  m4, is_signedd
> > > +shufpsm4, m4, 0
> > > +shl   sized,   2
> > > +add   inq, sizeq
> > > +add   outq, sizeq
> > > +add   scaledq, sizeq
> > > +neg   sizeq
> > > +.loop:
> > > +mulps m2, m0, [scaledq+sizeq]
> > > +addps m2, m1
> > > +minps m2, m3
> >
> > > +movapsm5, [inq+sizeq]
> > > +andps m5, m4
> >
> > Same as in abs_pow34, remove movaps and do
> >
> > andps m5, m4, [inq+sizeq]
> >
> > > +orps  m2, m5
> > > +cvttps2dq m2, m2
> > > +mova  [outq+sizeq], m2
> > > +add   sizeq, mmsize
> > > +jl   .loop
> > > +RET
> > > diff --git 

Re: [FFmpeg-devel] Memcpy Operation Duration

2016-10-18 Thread Ali KIZIL
2016-10-18 22:44 GMT+03:00 Sven C. Dack :

> On 18/10/16 20:26, Ali KIZIL wrote:
>
>> Hi Everyone,
>>
>> Today, I was analyzing memcpy duration in FFmpeg. I noticed that it is
>> taking longer time compared to an optimized SSE, SSE2, MMX, MMX2, AVX or
>> AVX2 based memcpy operation.
>>
>> I tried march=corei7-avx2 compiled FFmpeg version, it does not change the
>> duration of memcpy operation.
>> I also folowed https://trac.ffmpeg.org/wiki/C
>> ompilationGuide#PerformanceTips
>> .Same result. In addition, I tried gcc 6.2 if gcc if gcc is not selecting
>> the correct flag. Same result again.
>>
>> This memcpy operations effect the fps decoding (and probably encoding)
>> rates.
>>
>> In a case that uyvy422 to p010 3840x2160 unscaled convertion in rawvideo,
>> fps rate increased from 44 fps to 52 fps on a Xeon E5 2630 v4.
>>
>> Do I miss anything when compiling FFmpeg for AVX2 or other flag optimised,
>> or there need a fix in FFmpeg to direct some (or all)  memcpy operations
>> to
>> a inherited memcpy operation which can decide flag for optimisation ?
>> Or there is no such need and I am on a wrong path ?
>>
>> (As a side note, FFmpeg works performance on i7 Extreme cores compared to
>> Xeon v4 processors.)
>>
>> Kind Regards,
>> Ali KIZIL
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
> Could be it's gcc's built-in version. It's been said that libc is
> occasionally better at it than gcc's built-in version.
>
> Use -fno-builtin-memcpy and see what difference it makes.
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


I see, tomorrow morning I will give it a try.
Thank you for the good idea. If it increase performance, maybe it will be a
good idea to make a configure option.

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


Re: [FFmpeg-devel] Memcpy Operation Duration

2016-10-18 Thread Sven C. Dack

On 18/10/16 20:26, Ali KIZIL wrote:

Hi Everyone,

Today, I was analyzing memcpy duration in FFmpeg. I noticed that it is
taking longer time compared to an optimized SSE, SSE2, MMX, MMX2, AVX or
AVX2 based memcpy operation.

I tried march=corei7-avx2 compiled FFmpeg version, it does not change the
duration of memcpy operation.
I also folowed https://trac.ffmpeg.org/wiki/CompilationGuide#PerformanceTips
.Same result. In addition, I tried gcc 6.2 if gcc if gcc is not selecting
the correct flag. Same result again.

This memcpy operations effect the fps decoding (and probably encoding)
rates.

In a case that uyvy422 to p010 3840x2160 unscaled convertion in rawvideo,
fps rate increased from 44 fps to 52 fps on a Xeon E5 2630 v4.

Do I miss anything when compiling FFmpeg for AVX2 or other flag optimised,
or there need a fix in FFmpeg to direct some (or all)  memcpy operations to
a inherited memcpy operation which can decide flag for optimisation ?
Or there is no such need and I am on a wrong path ?

(As a side note, FFmpeg works performance on i7 Extreme cores compared to
Xeon v4 processors.)

Kind Regards,
Ali KIZIL
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Could be it's gcc's built-in version. It's been said that libc is occasionally 
better at it than gcc's built-in version.


Use -fno-builtin-memcpy and see what difference it makes.


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


[FFmpeg-devel] Memcpy Operation Duration

2016-10-18 Thread Ali KIZIL
Hi Everyone,

Today, I was analyzing memcpy duration in FFmpeg. I noticed that it is
taking longer time compared to an optimized SSE, SSE2, MMX, MMX2, AVX or
AVX2 based memcpy operation.

I tried march=corei7-avx2 compiled FFmpeg version, it does not change the
duration of memcpy operation.
I also folowed https://trac.ffmpeg.org/wiki/CompilationGuide#PerformanceTips
.Same result. In addition, I tried gcc 6.2 if gcc if gcc is not selecting
the correct flag. Same result again.

This memcpy operations effect the fps decoding (and probably encoding)
rates.

In a case that uyvy422 to p010 3840x2160 unscaled convertion in rawvideo,
fps rate increased from 44 fps to 52 fps on a Xeon E5 2630 v4.

Do I miss anything when compiling FFmpeg for AVX2 or other flag optimised,
or there need a fix in FFmpeg to direct some (or all)  memcpy operations to
a inherited memcpy operation which can decide flag for optimisation ?
Or there is no such need and I am on a wrong path ?

(As a side note, FFmpeg works performance on i7 Extreme cores compared to
Xeon v4 processors.)

Kind Regards,
Ali KIZIL
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] vf_colorspace: Add support for iec61966-2.1 (sRGB) transfer

2016-10-18 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara 
---
Special thanks to Andrew Roland for helping me figure out these numbers.
Please keep me in CC.
Vittorio

 libavfilter/vf_colorspace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 5b060f9..16ad760 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -229,6 +229,7 @@ static const struct TransferCharacteristics 
transfer_characteristics[AVCOL_TRC_N
 [AVCOL_TRC_GAMMA28]   = { 1.0,0.0,1.0 / 2.8, 0.0 },
 [AVCOL_TRC_SMPTE170M] = { 1.099,  0.018,  0.45, 4.5 },
 [AVCOL_TRC_SMPTE240M] = { 1.1115, 0.0228, 0.45, 4.0 },
+[AVCOL_TRC_IEC61966_2_1] = { 1.055, 0.0031308, 1.0 / 2.4, 12.92 },
 [AVCOL_TRC_BT2020_10] = { 1.099,  0.018,  0.45, 4.5 },
 [AVCOL_TRC_BT2020_12] = { 1.0993, 0.0181, 0.45, 4.5 },
 };
@@ -1067,6 +1068,8 @@ static const AVOption colorspace_options[] = {
 ENUM("gamma28",  AVCOL_TRC_GAMMA28,  "trc"),
 ENUM("smpte170m",AVCOL_TRC_SMPTE170M,"trc"),
 ENUM("smpte240m",AVCOL_TRC_SMPTE240M,"trc"),
+ENUM("srgb", AVCOL_TRC_IEC61966_2_1, "trc"),
+ENUM("iec61966-2-1", AVCOL_TRC_IEC61966_2_1, "trc"),
 ENUM("bt2020-10",AVCOL_TRC_BT2020_10,"trc"),
 ENUM("bt2020-12",AVCOL_TRC_BT2020_12,"trc"),
 
-- 
2.10.0

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


Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: implement a53cc

2016-10-18 Thread Richard Kern

> On Oct 18, 2016, at 2:30 PM, Aman Gupta  wrote:
> 
> 
> 
> On Mon, Oct 17, 2016 at 6:03 PM, Aman Gupta  > wrote:
> 
> 
> On Mon, Oct 17, 2016 at 5:51 PM, Richard Kern  > wrote:
> 
>> On Oct 17, 2016, at 8:47 PM, Aman Gupta > > wrote:
>> 
>> 
>> 
>> On Mon, Oct 17, 2016 at 6:35 AM, Richard Kern > > wrote:
>> 
>>> On Sep 19, 2016, at 10:30 AM, Aman Gupta >> > wrote:
>>> 
>>> 
>>> 
>>> On Monday, September 19, 2016, Richard Kern >> > wrote:
>>> 
 On Sep 10, 2016, at 10:33 PM, Aman Gupta > wrote:
 
 
 
 On Sunday, September 11, 2016, Richard Kern > wrote:
 
 > On Sep 8, 2016, at 4:19 AM, Aman Gupta > wrote:
 >
 > From: Aman Gupta >
 >
 > ---
 > libavcodec/videotoolboxenc.c | 76 
 > ++--
 > 1 file changed, 67 insertions(+), 9 deletions(-)
 >
 > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
 > index 4345ca3..859dde9 100644
 > --- a/libavcodec/videotoolboxenc.c
 > +++ b/libavcodec/videotoolboxenc.c
 > @@ -32,6 +32,7 @@
 > #include "libavutil/pixdesc.h"
 > #include "internal.h"
 > #include 
 > +#include "h264.h"
 >
 > #if !CONFIG_VT_BT2020
 > # define kCVImageBufferColorPrimaries_ITU_R_2020   CFSTR("ITU_R_2020")
 > @@ -55,8 +56,14 @@ typedef enum VTH264Entropy{
 >
 > static const uint8_t start_code[] = { 0, 0, 0, 1 };
 >
 > +typedef struct ExtraSEI {
 > +  void *data;
 > +  size_t size;
 > +} ExtraSEI;
 > +
 > typedef struct BufNode {
 > CMSampleBufferRef cm_buffer;
 > +ExtraSEI *sei;
 > struct BufNode* next;
 > int error;
 > } BufNode;
 > @@ -94,6 +101,7 @@ typedef struct VTEncContext {
 > bool flushing;
 > bool has_b_frames;
 > bool warned_color_range;
 > +bool a53_cc;
 > } VTEncContext;
 >
 > static int vtenc_populate_extradata(AVCodecContext   *avctx,
 > @@ -136,7 +144,7 @@ static void set_async_error(VTEncContext *vtctx, int 
 > err)
 > pthread_mutex_unlock(>lock);
 > }
 >
 > -static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
 > CMSampleBufferRef *buf)
 > +static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
 > CMSampleBufferRef *buf, ExtraSEI **sei)
 > {
 > BufNode *info;
 >
 > @@ -173,6 +181,12 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool 
 > wait, CMSampleBufferRef *buf)
 > pthread_mutex_unlock(>lock);
 >
 > *buf = info->cm_buffer;
 > +if (sei && *buf) {
 > +*sei = info->sei;
 > +} else if (info->sei) {
 > +if (info->sei->data) av_free(info->sei->data);
 > +av_free(info->sei);
 > +}
 > av_free(info);
 >
 > vtctx->frame_ct_out++;
 > @@ -180,7 +194,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool 
 > wait, CMSampleBufferRef *buf)
 > return 0;
 > }
 >
 > -static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer)
 > +static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer, 
 > ExtraSEI *sei)
 > {
 > BufNode *info = av_malloc(sizeof(BufNode));
 > if (!info) {
 > @@ -190,6 +204,7 @@ static void vtenc_q_push(VTEncContext *vtctx, 
 > CMSampleBufferRef buffer)
 >
 > CFRetain(buffer);
 > info->cm_buffer = buffer;
 > +info->sei = sei;
 > info->next = NULL;
 >
 > pthread_mutex_lock(>lock);
 > @@ -420,6 +435,7 @@ static void vtenc_output_callback(
 > {
 > AVCodecContext *avctx = ctx;
 > VTEncContext   *vtctx = avctx->priv_data;
 > +ExtraSEI *sei = sourceFrameCtx;
 >
 > if (vtctx->async_error) {
 > if(sample_buffer) CFRelease(sample_buffer);
 > @@ -440,7 +456,7 @@ static void vtenc_output_callback(
 > }
 > }
 >
 > -vtenc_q_push(vtctx, sample_buffer);
 > +vtenc_q_push(vtctx, sample_buffer, sei);
 > }
 >
 > static int get_length_code_size(
 > @@ -1258,7 +1274,8 @@ static int copy_replace_length_codes(
 > static int vtenc_cm_to_avpacket(
 > AVCodecContext*avctx,
 > CMSampleBufferRef sample_buffer,
 > -AVPacket  *pkt)
 > +AVPacket  *pkt,
 > +ExtraSEI  *sei)
 > {
 > VTEncContext *vtctx = avctx->priv_data;
 >
 > @@ -1269,6 +1286,7 @@ static int vtenc_cm_to_avpacket(
 > size_t  header_size = 0;
 > size_t  in_buf_size;
 > size_t  

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: implement a53cc

2016-10-18 Thread Aman Gupta
On Mon, Oct 17, 2016 at 6:03 PM, Aman Gupta  wrote:

>
>
> On Mon, Oct 17, 2016 at 5:51 PM, Richard Kern  wrote:
>
>>
>> On Oct 17, 2016, at 8:47 PM, Aman Gupta  wrote:
>>
>>
>>
>> On Mon, Oct 17, 2016 at 6:35 AM, Richard Kern  wrote:
>>
>>>
>>> On Sep 19, 2016, at 10:30 AM, Aman Gupta  wrote:
>>>
>>>
>>>
>>> On Monday, September 19, 2016, Richard Kern  wrote:
>>>

 On Sep 10, 2016, at 10:33 PM, Aman Gupta  wrote:



 On Sunday, September 11, 2016, Richard Kern  wrote:

>
> > On Sep 8, 2016, at 4:19 AM, Aman Gupta  wrote:
> >
> > From: Aman Gupta 
> >
> > ---
> > libavcodec/videotoolboxenc.c | 76 ++
> --
> > 1 file changed, 67 insertions(+), 9 deletions(-)
> >
> > diff --git a/libavcodec/videotoolboxenc.c
> b/libavcodec/videotoolboxenc.c
> > index 4345ca3..859dde9 100644
> > --- a/libavcodec/videotoolboxenc.c
> > +++ b/libavcodec/videotoolboxenc.c
> > @@ -32,6 +32,7 @@
> > #include "libavutil/pixdesc.h"
> > #include "internal.h"
> > #include 
> > +#include "h264.h"
> >
> > #if !CONFIG_VT_BT2020
> > # define kCVImageBufferColorPrimaries_ITU_R_2020
>  CFSTR("ITU_R_2020")
> > @@ -55,8 +56,14 @@ typedef enum VTH264Entropy{
> >
> > static const uint8_t start_code[] = { 0, 0, 0, 1 };
> >
> > +typedef struct ExtraSEI {
> > +  void *data;
> > +  size_t size;
> > +} ExtraSEI;
> > +
> > typedef struct BufNode {
> > CMSampleBufferRef cm_buffer;
> > +ExtraSEI *sei;
> > struct BufNode* next;
> > int error;
> > } BufNode;
> > @@ -94,6 +101,7 @@ typedef struct VTEncContext {
> > bool flushing;
> > bool has_b_frames;
> > bool warned_color_range;
> > +bool a53_cc;
> > } VTEncContext;
> >
> > static int vtenc_populate_extradata(AVCodecContext   *avctx,
> > @@ -136,7 +144,7 @@ static void set_async_error(VTEncContext *vtctx,
> int err)
> > pthread_mutex_unlock(>lock);
> > }
> >
> > -static int vtenc_q_pop(VTEncContext *vtctx, bool wait,
> CMSampleBufferRef *buf)
> > +static int vtenc_q_pop(VTEncContext *vtctx, bool wait,
> CMSampleBufferRef *buf, ExtraSEI **sei)
> > {
> > BufNode *info;
> >
> > @@ -173,6 +181,12 @@ static int vtenc_q_pop(VTEncContext *vtctx,
> bool wait, CMSampleBufferRef *buf)
> > pthread_mutex_unlock(>lock);
> >
> > *buf = info->cm_buffer;
> > +if (sei && *buf) {
> > +*sei = info->sei;
> > +} else if (info->sei) {
> > +if (info->sei->data) av_free(info->sei->data);
> > +av_free(info->sei);
> > +}
> > av_free(info);
> >
> > vtctx->frame_ct_out++;
> > @@ -180,7 +194,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool
> wait, CMSampleBufferRef *buf)
> > return 0;
> > }
> >
> > -static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef
> buffer)
> > +static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef
> buffer, ExtraSEI *sei)
> > {
> > BufNode *info = av_malloc(sizeof(BufNode));
> > if (!info) {
> > @@ -190,6 +204,7 @@ static void vtenc_q_push(VTEncContext *vtctx,
> CMSampleBufferRef buffer)
> >
> > CFRetain(buffer);
> > info->cm_buffer = buffer;
> > +info->sei = sei;
> > info->next = NULL;
> >
> > pthread_mutex_lock(>lock);
> > @@ -420,6 +435,7 @@ static void vtenc_output_callback(
> > {
> > AVCodecContext *avctx = ctx;
> > VTEncContext   *vtctx = avctx->priv_data;
> > +ExtraSEI *sei = sourceFrameCtx;
> >
> > if (vtctx->async_error) {
> > if(sample_buffer) CFRelease(sample_buffer);
> > @@ -440,7 +456,7 @@ static void vtenc_output_callback(
> > }
> > }
> >
> > -vtenc_q_push(vtctx, sample_buffer);
> > +vtenc_q_push(vtctx, sample_buffer, sei);
> > }
> >
> > static int get_length_code_size(
> > @@ -1258,7 +1274,8 @@ static int copy_replace_length_codes(
> > static int vtenc_cm_to_avpacket(
> > AVCodecContext*avctx,
> > CMSampleBufferRef sample_buffer,
> > -AVPacket  *pkt)
> > +AVPacket  *pkt,
> > +ExtraSEI  *sei)
> > {
> > VTEncContext *vtctx = avctx->priv_data;
> >
> > @@ -1269,6 +1286,7 @@ static int vtenc_cm_to_avpacket(
> > size_t  header_size = 0;
> > size_t  in_buf_size;
> > size_t  out_buf_size;
> > +size_t  sei_nalu_size = 0;
> > int64_t dts_delta;
> > int64_t time_base_num;
> > int nalu_count;
> 

Re: [FFmpeg-devel] [PATCH 0/2] Fix gapless encoding/remuxing for MP3

2016-10-18 Thread Andreas Cadhalpun
On 17.10.2016 23:55, Jon Toohill wrote:
> Round trip wav->mp3->wav now preserves the correct number of samples.
> Remuxing mp3->mp3 with -c:a copy also preserves any existing gapless
> metadata in the Info tag.
> 
> The code in libmp3lame.c to set AV_PKT_DATA_SKIP_SAMPLES was mostly
> copied from libopusenc.c.
> 
> Jon Toohill (2):
>   lavc/libmp3lame: send encoder delay/padding in packet side data
>   lavf/mp3enc: write encoder delay/padding upon closing
> 
>  libavcodec/libmp3lame.c | 27 ++-
>  libavformat/mp3enc.c| 34 --
>  2 files changed, 54 insertions(+), 7 deletions(-)
> 

I've applied both patches. Thanks for fixing this!

Best regards,
Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/af_silenceremove: add optional tone when silence is removed

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 12:46:56PM -0400, Greg Rowe wrote:
> >see
> >libavfilter/asrc_sine.c
> >this code should probably be reused / factored
> >(note, any code moving/factoring of existing code should be in a
> > seperate patch)
> 
> Since silenceremove works only on AV_SAMPLE_FMT_DBL is it OK to use
> floating point for the generated tone or is it recommended to create
> the tone and then convert it to double samples or some other
> approach?

can you write a fate test for the filter which is portable accross
platforms ?

every filter should ideally have a fate test.
If you can write a working an portable fate test with float sine
then i have no objections to it

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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/rtp_g726: Map mime type G726 to the g726le decoder

2016-10-18 Thread Carl Eugen Hoyos
2016-10-14 15:12 GMT+02:00 Carl Eugen Hoyos :
> Hi!
>
> Attached patch fixes ticket #5890, completely untested.

I will apply this if there are no objections.

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


Re: [FFmpeg-devel] [PATCH] avfilter/af_silenceremove: add optional tone when silence is removed

2016-10-18 Thread Greg Rowe

see
libavfilter/asrc_sine.c
this code should probably be reused / factored
(note, any code moving/factoring of existing code should be in a
 seperate patch)


Since silenceremove works only on AV_SAMPLE_FMT_DBL is it OK to use 
floating point for the generated tone or is it recommended to create the 
tone and then convert it to double samples or some other approach?



Thanks,
Greg

--
Greg Rowe
www.shoretel.com
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/movenc: Skip duration check for discontinuous fragments

2016-10-18 Thread Michael Niedermayer
Found-by: Daemon404
Signed-off-by: Michael Niedermayer 
---
 libavformat/movenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index d7c7158..50be8ff 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4697,7 +4697,8 @@ static int check_pkt(AVFormatContext *s, AVPacket *pkt)
 
 if (trk->entry) {
 ref = trk->cluster[trk->entry - 1].dts;
-} else if (trk->start_dts != AV_NOPTS_VALUE) {
+} else if (   trk->start_dts != AV_NOPTS_VALUE
+   && !trk->frag_discont) {
 ref = trk->start_dts + trk->track_duration;
 } else
 ref = pkt->dts; // Skip tests for the first packet
-- 
2.10.1

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


Re: [FFmpeg-devel] [PATCH v3] aacenc: add SIMD optimizations for abs_pow34 and quantization

2016-10-18 Thread Rostislav Pehlivanov
On 18 October 2016 at 16:32, James Almer  wrote:

> On 10/18/2016 12:07 PM, Rostislav Pehlivanov wrote:
> > diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
> > index ee3cbf8..622f0ba 100644
> > --- a/libavcodec/aacenc.c
> > +++ b/libavcodec/aacenc.c
> > @@ -1033,6 +1033,12 @@ static av_cold int aac_encode_init(AVCodecContext
> *avctx)
> >  ff_lpc_init(>lpc, 2*avctx->frame_size, TNS_MAX_ORDER,
> FF_LPC_TYPE_LEVINSON);
> >  s->random_state = 0x1f2e3d4c;
> >
> > +s->abs_pow34   = _pow34_v;
> > +s->quant_bands = _bands;
>
> No need for & in these.
>
> > +
> > +if (ARCH_X86)
> > +ff_aac_dsp_init_x86(s);
> > +
> >  if (HAVE_MIPSDSP)
> >  ff_aac_coder_init_mips(s);
>
> [...]
>
> > diff --git a/libavcodec/x86/aacencdsp.asm b/libavcodec/x86/aacencdsp.asm
> > new file mode 100644
> > index 000..dd7b022
> > --- /dev/null
> > +++ b/libavcodec/x86/aacencdsp.asm
> > @@ -0,0 +1,88 @@
> > +;**
> 
> > +;* SIMD optimized AAC encoder DSP functions
> > +;*
> > +;* Copyright (C) 2016 Rostislav Pehlivanov 
> > +;*
> > +;* 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/x86/x86util.asm"
> > +
> > +SECTION_RODATA
> > +
> > +float_abs_mask: times 4 dd 0x7fff
> > +
> > +SECTION .text
> > +
> > +;***
> > +;void ff_abs_pow34(float *out, const float *in, const int size);
> > +;***
> > +INIT_XMM sse
> > +cglobal abs_pow34, 3, 3, 3, out, in, size
> > +mova   m2, [float_abs_mask]
> > +shlsizeq, 2
> > +addinq, sizeq
> > +addoutq, sizeq
> > +negsizeq
> > +.loop:
> > +movaps m0, [inq+sizeq]
> > +andps  m0, m2
>
> Remove the movaps and do
>
> andps  m0, m2, [inq+sizeq]
>
> Instead. Sorry i didn't notice this last time.
>
> > +sqrtps m1, m0
> > +mulps  m0, m1
> > +sqrtps m0, m0
> > +mova   [outq+sizeq], m0
> > +addsizeq, mmsize
> > +jl.loop
> > +RET
> > +
> > +;***
> > +;void ff_aac_quantize_bands(int *out, const float *in, const float
> *scaled,
> > +;   int size, int is_signed, int maxval, const
> float Q34,
> > +;   const float rounding)
> > +;***
> > +INIT_XMM sse2
> > +cglobal aac_quantize_bands, 5, 5, 6, out, in, scaled, size, is_signed,
> maxval, Q34, rounding
> > +%if UNIX64 == 0
> > +movss m0, Q34m
> > +movss m1, roundingm
> > +cvtsi2ss  m3, maxvald
> > +%else
> > +cvtsi2ss  m3, dword maxvalm
> > +%endif
>
> The other way around. Unix64 is the one that has maxval on a reg regardless
> of how you init the function, whereas win64 and any x86_32 target have it
> on stack.
>
> > +shufpsm0, m0, 0
> > +shufpsm1, m1, 0
> > +shufpsm3, m3, 0
> > +shl   is_signedd, 31
> > +movd  m4, is_signedd
> > +shufpsm4, m4, 0
> > +shl   sized,   2
> > +add   inq, sizeq
> > +add   outq, sizeq
> > +add   scaledq, sizeq
> > +neg   sizeq
> > +.loop:
> > +mulps m2, m0, [scaledq+sizeq]
> > +addps m2, m1
> > +minps m2, m3
>
> > +movapsm5, [inq+sizeq]
> > +andps m5, m4
>
> Same as in abs_pow34, remove movaps and do
>
> andps m5, m4, [inq+sizeq]
>
> > +orps  m2, m5
> > +cvttps2dq m2, m2
> > +mova  [outq+sizeq], m2
> > +add   sizeq, mmsize
> > +jl   .loop
> > +RET
> > diff --git a/libavcodec/x86/aacencdsp_init.c b/libavcodec/x86/aacencdsp_
> init.c
> > new file mode 100644
> > index 000..aefaa15
> > --- /dev/null
> > +++ b/libavcodec/x86/aacencdsp_init.c
> > @@ -0,0 +1,43 @@
> > +/*
> > + * AAC encoder assembly optimizations
> > + * Copyright (C) 2016 Rostislav Pehlivanov 
> > + *
> > + * This file is part of FFmpeg.
> > + *

[FFmpeg-devel] [PATCH] avfilter/firequalizer: add cubic_interpolate function on gain

2016-10-18 Thread Muhammad Faiz
smoother version of gain_interpolate

Signed-off-by: Muhammad Faiz 
---
 doc/filters.texi  |  2 ++
 libavfilter/af_firequalizer.c | 49 +--
 2 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 9fc8c4f..14c9b07 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2508,6 +2508,8 @@ and functions:
 @table @option
 @item gain_interpolate(f)
 interpolate gain on frequency f based on gain_entry
+@item cubic_interpolate(f)
+same as gain_interpolate, but smoother
 @end table
 This option is also available as command. Default is 
@code{gain_interpolate(f)}.
 
diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c
index 6868066..e799e34 100644
--- a/libavfilter/af_firequalizer.c
+++ b/libavfilter/af_firequalizer.c
@@ -354,6 +354,51 @@ static double gain_interpolate_func(void *p, double freq)
 return res[0].gain;
 }
 
+static double cubic_interpolate_func(void *p, double freq)
+{
+AVFilterContext *ctx = p;
+FIREqualizerContext *s = ctx->priv;
+GainEntry *res;
+double x, x2, x3;
+double a, b, c, d;
+double m0, m1, m2, msum, unit;
+
+if (!s->nb_gain_entry)
+return 0;
+
+if (freq <= s->gain_entry_tbl[0].freq)
+return s->gain_entry_tbl[0].gain;
+
+if (freq >= s->gain_entry_tbl[s->nb_gain_entry-1].freq)
+return s->gain_entry_tbl[s->nb_gain_entry-1].gain;
+
+res = bsearch(, >gain_entry_tbl, s->nb_gain_entry - 1, 
sizeof(*res), gain_entry_compare);
+av_assert0(res);
+
+unit = res[1].freq - res[0].freq;
+m0 = res != s->gain_entry_tbl ?
+ unit * (res[0].gain - res[-1].gain) / (res[0].freq - res[-1].freq) : 
0;
+m1 = res[1].gain - res[0].gain;
+m2 = res != s->gain_entry_tbl + s->nb_gain_entry - 2 ?
+ unit * (res[2].gain - res[1].gain) / (res[2].freq - res[1].freq) : 0;
+
+msum = fabs(m0) + fabs(m1);
+m0 = msum > 0 ? (fabs(m0) * m1 + fabs(m1) * m0) / msum : 0;
+msum = fabs(m1) + fabs(m2);
+m1 = msum > 0 ? (fabs(m1) * m2 + fabs(m2) * m1) / msum : 0;
+
+d = res[0].gain;
+c = m0;
+b = 3 * res[1].gain - m1 - 2 * c - 3 * d;
+a = res[1].gain - b - c - d;
+
+x = (freq - res[0].freq) / unit;
+x2 = x * x;
+x3 = x2 * x;
+
+return a * x3 + b * x2 + c * x + d;
+}
+
 static const char *const var_names[] = {
 "f",
 "sr",
@@ -379,9 +424,9 @@ static int generate_kernel(AVFilterContext *ctx, const char 
*gain, const char *g
 FIREqualizerContext *s = ctx->priv;
 AVFilterLink *inlink = ctx->inputs[0];
 const char *gain_entry_func_names[] = { "entry", NULL };
-const char *gain_func_names[] = { "gain_interpolate", NULL };
+const char *gain_func_names[] = { "gain_interpolate", "cubic_interpolate", 
NULL };
 double (*gain_entry_funcs[])(void *, double, double) = { entry_func, NULL 
};
-double (*gain_funcs[])(void *, double) = { gain_interpolate_func, NULL };
+double (*gain_funcs[])(void *, double) = { gain_interpolate_func, 
cubic_interpolate_func, NULL };
 double vars[VAR_NB];
 AVExpr *gain_expr;
 int ret, k, center, ch;
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH] avfilter/firequalizer: add dumpfile and dumpscale option

2016-10-18 Thread Muhammad Faiz
On 10/18/16, Muhammad Faiz  wrote:
> Signed-off-by: Muhammad Faiz 
> ---
>  doc/filters.texi  |  7 
>  libavfilter/af_firequalizer.c | 97
> ---
>  2 files changed, 90 insertions(+), 14 deletions(-)
>

applied

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


Re: [FFmpeg-devel] [PATCH] swresample/resample: fix return value of build_filter

2016-10-18 Thread Muhammad Faiz
On 10/18/16, Michael Niedermayer  wrote:
> On Tue, Oct 18, 2016 at 02:17:49PM +0700, Muhammad Faiz wrote:
>> return AVERROR code on error
>>
>> Signed-off-by: Muhammad Faiz 
>> ---
>>  libswresample/resample.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> LGTM
>
> thx
>

applied

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


Re: [FFmpeg-devel] [PATCH] libavcodec/tests: Added selftest for libavcodec/avpacket.c

2016-10-18 Thread Michael Niedermayer
On Mon, Oct 17, 2016 at 11:22:21PM -0700, tdtur...@ucdavis.edu wrote:
> From: Thomas Turner 
> 
> Improved code coverage for libavcodec.
> Function(s) Tested: av_packet_clone()
> 
> Signed-off-by: Thomas Turner 
> ---
>  libavcodec/Makefile |   3 +-
>  libavcodec/tests/avpacket.c | 207 
> 
>  tests/fate/libavcodec.mak   |   5 ++
>  3 files changed, 214 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/tests/avpacket.c
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index a1560ba..d64b8df 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -1016,7 +1016,8 @@ SKIPHEADERS-$(CONFIG_VDA)  += vda.h 
> vda_vt_internal.h
>  SKIPHEADERS-$(CONFIG_VDPAU)+= vdpau.h vdpau_internal.h
>  SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vda_vt_internal.h
>  
> -TESTPROGS = imgconvert  \
> +TESTPROGS = avpacket\
> +imgconvert  \
>  jpeg2000dwt \
>  mathops\
>  options \
> diff --git a/libavcodec/tests/avpacket.c b/libavcodec/tests/avpacket.c
> new file mode 100644
> index 000..5b884d7
> --- /dev/null
> +++ b/libavcodec/tests/avpacket.c
> @@ -0,0 +1,207 @@
> +/*
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include "libavcodec/avcodec.h"
> +#include "libavutil/error.h"
> +
> +
> +
> +
> +static char* getbuffer(AVPacket avpkt, int index)
> +{
> +uint8_t *buffer;
> +int val, tot_elem, buffer_size = 256;
> +
> +/* Allocate 256 bytes */
> +if((buffer = malloc(buffer_size)) == NULL){
> +perror("malloc");
> +goto EXIT;
> +}
> +

> +if(index == 0){
> +val = snprintf(buffer, buffer_size,
> +"{buffer: %p,  data: %p, size: %d}",
> +avpkt.buf->buffer, avpkt.buf->data, avpkt.buf->size);
> +
> +tot_elem = strlen(buffer);
> +}
> +else if(index == 1){
> +val = snprintf(buffer, buffer_size, "\"%s\"", avpkt.data);
> +tot_elem = strlen(buffer);
> +}
> +else if(index == 2){
> +val = snprintf(buffer, buffer_size,
> +"{data: %p \"%s\", size: %d, type: %d}",
> +avpkt.side_data, avpkt.side_data->data, avpkt.side_data->size,
> +avpkt.side_data->type);
> +
> +tot_elem = strlen(buffer);
> +}

" tot_elem = strlen(buffer);" can be factored out


> +
> +/* snprintf fail check */
> +if(!(val > -1 && val < buffer_size)){
> +perror("snprintf");
> +free(buffer);
> +goto EXIT;
> +}
> +
> +return buffer;
> +
> +EXIT:
> +exit(-1);
> +}
> +

> +static void LOG_AVPACKET(AVPacket avpkt, const char* message)

function names in ffmpeg are lower case


> +{
> +uint8_t *buf_info = 0, *data_info = 0, *side_info = 0;
> +
> +/* get buf information */
> +if(avpkt.buf){
> +buf_info = getbuffer(avpkt, 0);
> +}
> +
> +/* get data information */
> +if(avpkt.data){
> +data_info = getbuffer(avpkt, 1);
> +}
> +
> +/* get side data information */
> +if(avpkt.side_data){
> +side_info = getbuffer(avpkt, 2);
> +}




> +
> +/* log standard packet information */
> +av_log(NULL, AV_LOG_INFO,
> +   "\n%s:\n\n"
> +   "buf\t\t: %p "
> +   "%s\n"
> +   "pts\t\t: %" PRId64 "\n"
> +   "dts\t\t: %" PRId64 "\n"
> +   "data\t\t: %p "
> +   "%s\n"
> +   "size\t\t: %d\n"
> +   "stream_index\t: %d\n"
> +   "flags\t\t: %d\n"
> +   "side_data\t: %p "
> +   "%s\n"
> +   "side_data_elems\t: %d\n"
> +   "duration\t: %" PRId64 "\n"
> +   "pos\t\t: %" PRId64 "\n\n",
> +   message,
> +   avpkt.buf,
> +   buf_info,
> +   avpkt.pts,
> +   avpkt.dts,

Re: [FFmpeg-devel] [PATCH v3] aacenc: add SIMD optimizations for abs_pow34 and quantization

2016-10-18 Thread Rostislav Pehlivanov
On 18 October 2016 at 14:51, Michael Niedermayer 
wrote:

> On Tue, Oct 18, 2016 at 09:02:19AM +0100, Rostislav Pehlivanov wrote:
> > On 17 October 2016 at 23:43, Michael Niedermayer  >
> > wrote:
> >
> > > On Mon, Oct 17, 2016 at 10:24:48PM +0100, Rostislav Pehlivanov wrote:
> > > > Should fix segfaults on x86-32
> > > >
> > > > Performance improvements:
> > > >
> > > > quant_bands:
> > > > with: 681 decicycles in quant_bands, 8388453 runs,155 skips
> > > > without: 1190 decicycles in quant_bands, 8388386 runs,222 skips
> > > > Around 42% for the function
> > > >
> > > > Twoloop coder:
> > > >
> > > > abs_pow34:
> > > > with/without: 7.82s/8.17s
> > > > Around 4% for the entire encoder
> > > >
> > > > Both:
> > > > with/without: 7.15s/8.17s
> > > > Around 12% for the entire encoder
> > > >
> > > > Fast coder:
> > > >
> > > > abs_pow34:
> > > > with/without: 3.40s/3.77s
> > > > Around 10% for the entire encoder
> > > >
> > > > Both:
> > > > with/without: 3.02s/3.77s
> > > > Around 20% faster for the entire encoder
> > > >
> > > > Signed-off-by: Rostislav Pehlivanov 
> > > > ---
> > > >  libavcodec/aaccoder.c| 27 +++--
> > > >  libavcodec/aaccoder_trellis.h|  2 +-
> > > >  libavcodec/aaccoder_twoloop.h|  2 +-
> > > >  libavcodec/aacenc.c  |  4 ++
> > > >  libavcodec/aacenc.h  |  6 +++
> > > >  libavcodec/aacenc_is.c   |  6 +--
> > > >  libavcodec/aacenc_ltp.c  |  4 +-
> > > >  libavcodec/aacenc_pred.c |  6 +--
> > > >  libavcodec/aacenc_quantization.h |  4 +-
> > > >  libavcodec/aacenc_utils.h|  4 +-
> > > >  libavcodec/x86/Makefile  |  2 +
> > > >  libavcodec/x86/aacencdsp.asm | 87 ++
> > > ++
> > > >  libavcodec/x86/aacencdsp_init.c  | 43 
> > > >  13 files changed, 170 insertions(+), 27 deletions(-)
> > > >  create mode 100644 libavcodec/x86/aacencdsp.asm
> > > >  create mode 100644 libavcodec/x86/aacencdsp_init.c
> > >
> > > fate passes on linux32/64 x86, mingw32/64 x86
> > >
> > > build fails on arm:
> > >
> > > libavcodec/libavcodec.a(aacenc.o): In function `aac_encode_init':
> > > ffmpeg/arm/src/libavcodec/aacenc.c:1038: undefined reference to
> > > `ff_aac_dsp_init_x86'
> > > collect2: ld returned 1 exit status
> > > make: *** [ffserver_g] Error 1
> > > make: *** Waiting for unfinished jobs
> > > libavcodec/libavcodec.a(aacenc.o): In function `aac_encode_init':
> > > ffmpeg/arm/src/libavcodec/aacenc.c:1038: undefined reference to
> > > `ff_aac_dsp_init_x86'
> > > collect2: ld returned 1 exit status
> > > make: *** [ffprobe_g] Error 1
> > > libavcodec/libavcodec.a(aacenc.o): In function `aac_encode_init':
> > > ffmpeg/arm/src/libavcodec/aacenc.c:1038: undefined reference to
> > > `ff_aac_dsp_init_x86'
> > > collect2: ld returned 1 exit status
> > > make: *** [ffmpeg_g] Error 1
> > >
> > > [...]
> > > --
> > > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC7
> 87040B0FAB
> > >
> > > While the State exists there can be no freedom; when there is freedom
> there
> > > will be no State. -- Vladimir Lenin
> > >
> > > ___
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
> > >
> > Attaching a new version with the fixes from James Almer which should also
> > fix non-x86 compilation
>
> >  aaccoder.c|   27 +++
> >  aaccoder_trellis.h|2 -
> >  aaccoder_twoloop.h|2 -
> >  aacenc.c  |4 ++
> >  aacenc.h  |6 +++
> >  aacenc_is.c   |6 +--
> >  aacenc_ltp.c  |4 +-
> >  aacenc_pred.c |6 +--
> >  aacenc_quantization.h |4 +-
> >  aacenc_utils.h|2 -
> >  x86/Makefile  |2 +
> >  x86/aacencdsp.asm |   88 ++
> 
> >  x86/aacencdsp_init.c  |   43 
> >  13 files changed, 170 insertions(+), 26 deletions(-)
> > 84d67e14dbd62ef958a52a4027a8dff22f7480b6  0001-aacenc-add-SIMD-
> optimizations-for-abs_pow34-and-quan.patch
> > From d92003e23d82bc40fd85712538983209a7704248 Mon Sep 17 00:00:00 2001
> > From: Rostislav Pehlivanov 
> > Date: Sat, 8 Oct 2016 15:59:14 +0100
> > Subject: [PATCH] aacenc: add SIMD optimizations for abs_pow34 and
> quantization
> >
> > Performance improvements:
> >
> > quant_bands:
> > with: 681 decicycles in quant_bands, 8388453 runs,155 skips
> > without: 1190 decicycles in quant_bands, 8388386 runs,222 skips
> > Around 42% for the function
> >
> > Twoloop coder:
> >
> > abs_pow34:
> > with/without: 7.82s/8.17s
> > Around 4% for the entire encoder
> >
> > Both:
> > with/without: 7.15s/8.17s
> > Around 12% for the entire encoder
> >
> > Fast coder:
> >
> > abs_pow34:
> > with/without: 3.40s/3.77s
> > Around 

Re: [FFmpeg-devel] [PATCH] lavf/aviobuf: add ff_get_line2() variant

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 01:32:12PM +0200, Stefano Sabatini wrote:
> On date Thursday 2016-10-13 21:59:19 +0200, Michael Niedermayer encoded:
> > On Thu, Oct 13, 2016 at 07:40:59PM +0200, Stefano Sabatini wrote:
> > > This allows to probe if the read line was partially discarded.
> > > ---
> > >  libavformat/aviobuf.c  | 10 +-
> > >  libavformat/internal.h | 14 ++
> > >  2 files changed, 23 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> > > index 134d627..28183b4 100644
> > > --- a/libavformat/aviobuf.c
> > > +++ b/libavformat/aviobuf.c
> > > @@ -764,18 +764,26 @@ unsigned int avio_rb32(AVIOContext *s)
> > >  
> > >  int ff_get_line(AVIOContext *s, char *buf, int maxlen)
> > >  {
> > > -int i = 0;
> > > +return ff_get_line2(s, buf, maxlen, NULL);
> > > +}
> > > +
> > > +int ff_get_line2(AVIOContext *s, char *buf, int maxlen, int *readlen)
> > > +{
> > > +int i = 0, j = 0;
> > >  char c;
> > >  
> > >  do {
> > >  c = avio_r8(s);
> > >  if (c && i < maxlen-1)
> > >  buf[i++] = c;
> > > +j++;
> > >  } while (c != '\n' && c != '\r' && c);
> > 
> 
> > "\n" and "\0" would i belive both have a j=1 but they would have
> > differig i
> > is that intended ? (seems to me that this would make truncation
> > detection more annoying)
> > or am i missing something that avoids this difference?
> 
> Improved version in attachment.
> -- 
> FFmpeg = Fascinating Foolish Mystic Puritan Egregious Gymnast

>  aviobuf.c  |   18 +++---
>  internal.h |   14 ++
>  2 files changed, 29 insertions(+), 3 deletions(-)
> 19b979c45f087997ac69fba2caf5504c933acfc8  
> 0001-lavf-aviobuf-add-ff_get_line2-variant.patch
> From 58c1cad434447d48246e153e3a1a391d72d23c7b Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini 
> Date: Thu, 13 Oct 2016 16:36:30 +0200
> Subject: [PATCH] lavf/aviobuf: add ff_get_line2() variant
> 
> This allows to probe if the read line was partially discarded.
> ---
>  libavformat/aviobuf.c  | 18 +++---
>  libavformat/internal.h | 14 ++
>  2 files changed, 29 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 134d627..29bcf1e 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -764,18 +764,30 @@ unsigned int avio_rb32(AVIOContext *s)
>  
>  int ff_get_line(AVIOContext *s, char *buf, int maxlen)
>  {
> -int i = 0;
> +return ff_get_line2(s, buf, maxlen, NULL);
> +}
> +
> +int ff_get_line2(AVIOContext *s, char *buf, int maxlen, int *readlen)
> +{
> +int i = 0, j = 0;
>  char c;
>  
> +while (1) {
>  c = avio_r8(s);
>  if (c && i < maxlen-1)
>  buf[i++] = c;
> +if (c != '\n' && c != '\r' && c) {
> +j++;
> +} else {
> +break;
> +}
> +}

a string like "\n"
would have a strlen of 1
but readlen of 0
while a string like "X" would have a strlen and readlen of 1

is this difference intended ?
or maybe i misread the code

[...]

-- 
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] lavf/mov: Add support for edit list parsing.

2016-10-18 Thread wm4
On Fri,  5 Aug 2016 17:18:39 -0700
Sasi Inguva  wrote:

> In YouTube we have long been receiving MOV files from users, which have 
> non-trivial edit lists (Those edit lists which are not just used to offset 
> video start from audio start) and multiple edit lists. Recently the uploads 
> of such files has increased with the introduction of apps that allow video 
> editing and upload like Vine etc. mov.c in ffmpeg does not have edit list 
> parsing support i.e. the support for deciding what video/audio packets should 
> be output with what timestamps, based on edit lists. For this reason, we had 
> built a basic support for edit list parsing in our version of ffmpeg, which 
> fixes the AVIndexEntries built by mov_build_index by looking at edit lists, 
> and introduces new DISCARD flags in AVPacket and AVFrame to signal to the 
> decoder to discard certain packets.
> 
> For a while our edit list support was broken, as in it didn't properly work 
> for multiple edit lists and it had problems with edit-lists ending on 
> B-frames. But we've fixed most of these issues in recent times, and we think 
> that now it is in a good enough condition so that it can be submitted to 
> HEAD. This will not only help the vast userbase of ffmepg, but will also help 
> us with staying up-to-date with ffmpeg and also by adding the power of ffmpeg 
> developer community to our MOV support. So here's a go at it.
> What is supported:
>  - multiple edit lists
>  - edit lists ending on B-frames
>  - zero segment duration edit lists
> 
> What is not supported:
>  - Changing the rate of playing with edit lists. We basically ignore 
> MediaRate field of edit.
> 
> I have added fate tests too. Here is a no-sign-in required link to the test 
> files 
> https://drive.google.com/folderview?id=0Bz6XfEJZ-9N3R3o3QXNHUGRqbms=sharing.

This still makes demuxers output packets with _not_ strictly
monotonically increasing DTS timestamps. Please fix this - a demuxer
isn't supposed to do this, and it's completely broken.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/4] lavc/mediacodec: use more meaningful filenames

2016-10-18 Thread Matthieu Bouron
On Wed, Oct 12, 2016 at 03:22:42PM +0200, Matthieu Bouron wrote:
> From: Matthieu Bouron 
> 
> Adds the following changes:
>   * mediacodecdec.{c,h} -> mediacodecdec_common.{c,h}
>   * mediacodecdec_h2645.c -> mediacodecdec.c
> ---
>  libavcodec/Makefile|   12 +-
>  libavcodec/mediacodec.c|3 +-
>  libavcodec/mediacodec_sw_buffer.c  |2 +-
>  libavcodec/mediacodec_sw_buffer.h  |2 +-
>  libavcodec/mediacodecdec.c | 1064 
> +---
>  libavcodec/mediacodecdec_common.c  |  789 +++
>  .../{mediacodecdec.h => mediacodecdec_common.h}|6 +-
>  libavcodec/mediacodecdec_h2645.c   |  623 
>  8 files changed, 1251 insertions(+), 1250 deletions(-)
>  create mode 100644 libavcodec/mediacodecdec_common.c
>  rename libavcodec/{mediacodecdec.h => mediacodecdec_common.h} (95%)
>  delete mode 100644 libavcodec/mediacodecdec_h2645.c
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index e8b1b00..7b85378 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -94,7 +94,7 @@ OBJS-$(CONFIG_LSP) += lsp.o
>  OBJS-$(CONFIG_LZF) += lzf.o
>  OBJS-$(CONFIG_MDCT)+= mdct_fixed.o mdct_float.o 
> mdct_fixed_32.o
>  OBJS-$(CONFIG_ME_CMP)  += me_cmp.o
> -OBJS-$(CONFIG_MEDIACODEC)  += mediacodecdec.o 
> mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
> +OBJS-$(CONFIG_MEDIACODEC)  += mediacodecdec_common.o 
> mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
>  OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
>  OBJS-$(CONFIG_MPEGAUDIO)   += mpegaudio.o mpegaudiodata.o   \
>mpegaudiodecheader.o
> @@ -316,7 +316,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264dec.o 
> h264_cabac.o h264_cavlc.o \
>h264_slice.o h264data.o 
> h264_parse.o \
>h2645_parse.o
>  OBJS-$(CONFIG_H264_CUVID_DECODER)  += cuvid.o
> -OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec_h2645.o
> +OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
>  OBJS-$(CONFIG_H264_MMAL_DECODER)   += mmaldec.o
>  OBJS-$(CONFIG_H264_NVENC_ENCODER)  += nvenc_h264.o
>  OBJS-$(CONFIG_NVENC_ENCODER)   += nvenc_h264.o
> @@ -333,7 +333,7 @@ OBJS-$(CONFIG_HEVC_DECODER)+= hevc.o 
> hevc_mvs.o hevc_ps.o hevc_sei.o
>hevc_cabac.o hevc_refs.o 
> hevcpred.o\
>hevcdsp.o hevc_filter.o 
> h2645_parse.o hevc_data.o
>  OBJS-$(CONFIG_HEVC_CUVID_DECODER)  += cuvid.o
> -OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec_h2645.o hevc_parse.o
> +OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o hevc_parse.o
>  OBJS-$(CONFIG_HEVC_NVENC_ENCODER)  += nvenc_hevc.o
>  OBJS-$(CONFIG_NVENC_HEVC_ENCODER)  += nvenc_hevc.o
>  OBJS-$(CONFIG_HEVC_QSV_DECODER)+= qsvdec_h2645.o
> @@ -413,7 +413,7 @@ OBJS-$(CONFIG_MPEG2_QSV_ENCODER)   += qsvenc_mpeg2.o
>  OBJS-$(CONFIG_MPEG2VIDEO_DECODER)  += mpeg12dec.o mpeg12.o mpeg12data.o
>  OBJS-$(CONFIG_MPEG2VIDEO_ENCODER)  += mpeg12enc.o mpeg12.o
>  OBJS-$(CONFIG_MPEG4_DECODER)   += xvididct.o
> -OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_h2645.o
> +OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
>  OBJS-$(CONFIG_MPEG4_OMX_ENCODER)   += omx.o
>  OBJS-$(CONFIG_MPL2_DECODER)+= mpl2dec.o ass.o
>  OBJS-$(CONFIG_MSA1_DECODER)+= mss3.o
> @@ -596,11 +596,11 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o 
> vp56data.o \
>  OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o
>  OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o
>  OBJS-$(CONFIG_VP8_CUVID_DECODER)   += cuvid.o
> -OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
> +OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec.o
>  OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9dsp.o vp56rac.o 
> vp9dsp_8bpp.o \
>vp9dsp_10bpp.o vp9dsp_12bpp.o
>  OBJS-$(CONFIG_VP9_CUVID_DECODER)   += cuvid.o
> -OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
> +OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec.o
>  OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o
>  OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
>  OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
> diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c
> index a658f0e..3521c8a 100644
> --- a/libavcodec/mediacodec.c
> +++ b/libavcodec/mediacodec.c
> @@ -34,7 +34,8 @@
>  
>  #include "ffjni.h"
>  #include "mediacodec.h"
> -#include "mediacodecdec.h"
> +#include 

Re: [FFmpeg-devel] [PATCH 2/3 v2] avformat/matroskadec: support parsing Chroma Location elements

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 12:18:01AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavformat/matroska.h| 14 ++
>  libavformat/matroskadec.c |  7 +++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/libavformat/matroska.h b/libavformat/matroska.h
> index 8ad89da..13155e5 100644
> --- a/libavformat/matroska.h
> +++ b/libavformat/matroska.h
> @@ -317,6 +317,20 @@ typedef enum {
>MATROSKA_VIDEO_DISPLAYUNIT_UNKNOWN = 4,
>  } MatroskaVideoDisplayUnit;
>  
> +typedef enum {
> +  MATROSKA_COLOUR_CHROMASITINGHORZ_UNDETERMINED = 0,
> +  MATROSKA_COLOUR_CHROMASITINGHORZ_LEFT = 1,
> +  MATROSKA_COLOUR_CHROMASITINGHORZ_HALF = 2,
> +  MATROSKA_COLOUR_CHROMASITINGHORZ_NB
> +} MatroskaColourChromaSitingHorz;
> +
> +typedef enum {
> +  MATROSKA_COLOUR_CHROMASITINGVERT_UNDETERMINED = 0,
> +  MATROSKA_COLOUR_CHROMASITINGVERT_TOP  = 1,
> +  MATROSKA_COLOUR_CHROMASITINGVERT_HALF = 2,
> +  MATROSKA_COLOUR_CHROMASITINGVERT_NB
> +} MatroskaColourChromaSitingVert;
> +
>  /*
>   * Matroska Codec IDs, strings
>   */
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index a5d3c0e..722d0b0 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -1827,6 +1827,13 @@ static int mkv_parse_video_color(AVStream *st, const 
> MatroskaTrack *track) {
>  if (track->video.color.range != AVCOL_RANGE_UNSPECIFIED &&
>  track->video.color.range <= AVCOL_RANGE_JPEG)
>  st->codecpar->color_range = track->video.color.range;
> +if (track->video.color.chroma_siting_horz && 
> track->video.color.chroma_siting_vert &&
> +track->video.color.chroma_siting_horz < 
> MATROSKA_COLOUR_CHROMASITINGHORZ_NB &&
> +track->video.color.chroma_siting_vert < 
> MATROSKA_COLOUR_CHROMASITINGVERT_NB) {
> +st->codecpar->chroma_location =
> +
> avcodec_chroma_pos_to_enum((track->video.color.chroma_siting_horz - 1) << 7,
> +   
> (track->video.color.chroma_siting_vert - 1) << 7);
> +}

on the assumtation that the cases match up correctly, (I did not
cross-check the spec), LGTM

thx

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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/mediacodec: Factor duplicate include

2016-10-18 Thread Matthieu Bouron
On Mon, Oct 17, 2016 at 07:43:37AM +0200, Matthieu Bouron wrote:
> On Sun, Oct 16, 2016 at 04:52:10PM +0200, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/mediacodec.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c
> > index a658f0e..37008e0 100644
> > --- a/libavcodec/mediacodec.c
> > +++ b/libavcodec/mediacodec.c
> > @@ -24,6 +24,8 @@
> >  
> >  #include "libavutil/error.h"
> >  
> > +#include "mediacodec.h"
> > +
> >  #if CONFIG_H264_MEDIACODEC_HWACCEL
> >  
> >  #include 
> > @@ -33,7 +35,6 @@
> >  #include "libavutil/mem.h"
> >  
> >  #include "ffjni.h"
> > -#include "mediacodec.h"
> >  #include "mediacodecdec.h"
> >  
> >  AVMediaCodecContext *av_mediacodec_alloc_context(void)
> > @@ -101,8 +102,6 @@ int av_mediacodec_release_buffer(AVMediaCodecBuffer 
> > *buffer, int render)
> >  
> >  #include 
> >  
> > -#include "mediacodec.h"
> > -
> >  AVMediaCodecContext *av_mediacodec_alloc_context(void)
> >  {
> >  return NULL;
> > -- 
> > 2.10.1
> 
> LGTM.

Applied.

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


Re: [FFmpeg-devel] [PATCH] swresample/resample: fix return value of build_filter

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 02:17:49PM +0700, Muhammad Faiz wrote:
> return AVERROR code on error
> 
> Signed-off-by: Muhammad Faiz 
> ---
>  libswresample/resample.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

LGTM

thx

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

Never trust a computer, one day, it may think you are the virus. -- Compn


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 ffprobe demuxer

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 01:33:27PM +0200, Stefano Sabatini wrote:
> On date Thursday 2016-10-13 19:46:41 +0200, Stefano Sabatini encoded:
> > On date Thursday 2016-09-29 21:55:11 +0200, wm4 encoded:
> [...]
> > > This seems like a rather special use case. Why does it have a demuxer,
> > > and can't be in your own C code using libavcodec/libavformat?
> > > 
> > 
> > > In addition, I think using the ffprobe "format" is an overcomplication,
> > > and will justify adding even more stuff to the demuxer, until it's a
> > > similarily complex mess like the ffm demuxer/muxer.
> > 
> > I'm aware of the issue. OTOH I think the feature per-se is useful, at
> > least for the two mentioned use cases (debugging - especially if
> > coupled with a corresponding muxer), and data streams (generated by
> > script) injection, since it relies on a textual format easily
> > scriptable and editable by hand.
> > 
> > I thus leave the choice to the community. I guess this will require a
> > vote if we cannot find an agreement.
> > 
> > Latest patch in attachment with ffprobe demuxer disabled by default,
> > and extended documentation. (I'm also attaching the ff_get_line2 patch
> > which is used by this new patch).
> 
> Updated, depends on the ff_get_line2() patch.
> -- 
> FFmpeg = Fanciful and Fundamentalist Magnificient Ponderous Elastic Game

>  configure|3 
>  doc/demuxers.texi|   18 ++
>  doc/ffprobe-format.texi  |  121 ++
>  doc/formats.texi |1 
>  libavformat/Makefile |1 
>  libavformat/allformats.c |1 
>  libavformat/ffprobedec.c |  405 
> +++
>  7 files changed, 550 insertions(+)
> 1d8a987564e907802dfd84722e3f5aafa69919ee  0002-lavf-add-ffprobe-demuxer.patch
> From bef4930a2bf280425b5952de0e2281f03897ff7c Mon Sep 17 00:00:00 2001
> From: Nicolas George 
> Date: Sat, 11 Jan 2014 19:42:41 +0100
> Subject: [PATCH] lavf: add ffprobe demuxer
> 
> With several modifications and documentation by Stefano Sabatini
> .
> 
> Signed-off-by: Nicolas George 
> ---
[...]
> +static int read_section_packet(AVFormatContext *avf, AVPacket *pkt)
> +{
> +FFprobeContext *ffp = avf->priv_data;
> +uint8_t buf[4096];
> +int ret;
> +AVPacket p;
> +char flags;
> +
> +av_init_packet();
> +p.pos = avio_tell(avf->pb);
> +p.stream_index = -1;
> +p.size = -1;
> +av_bprint_clear(>data);
> +while ((ret = read_section_line(avf, buf, sizeof(buf {
> +int has_time = 0;
> +int64_t pts, dts, duration;
> +char timebuf[1024];
> +
> +if (ret < 0)
> +return ret;
> +if (sscanf(buf, "stream_index=%d", _index)) {
> +if ((unsigned)p.stream_index >= avf->nb_streams) {
> +av_log(avf, AV_LOG_ERROR, "Invalid stream number %d 
> specified in packet number %d\n",
> +   p.stream_index, ffp->packet_nb);
> +return AVERROR_INVALIDDATA;
> +}
> +}
> +
> +#define PARSE_TIME(name_, is_duration)  \
> +sscanf(buf, #name_ "=%"SCNi64, _);   \

> +has_time = sscanf(buf, #name_ "_time=%s", timebuf); \

%s may be unsafe, not sure if theres a check elsewhere that prevents
writing over the outut buffer

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

Observe your enemies, for they first find out your faults. -- Antisthenes


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


Re: [FFmpeg-devel] [PATCH v3] aacenc: add SIMD optimizations for abs_pow34 and quantization

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 09:02:19AM +0100, Rostislav Pehlivanov wrote:
> On 17 October 2016 at 23:43, Michael Niedermayer 
> wrote:
> 
> > On Mon, Oct 17, 2016 at 10:24:48PM +0100, Rostislav Pehlivanov wrote:
> > > Should fix segfaults on x86-32
> > >
> > > Performance improvements:
> > >
> > > quant_bands:
> > > with: 681 decicycles in quant_bands, 8388453 runs,155 skips
> > > without: 1190 decicycles in quant_bands, 8388386 runs,222 skips
> > > Around 42% for the function
> > >
> > > Twoloop coder:
> > >
> > > abs_pow34:
> > > with/without: 7.82s/8.17s
> > > Around 4% for the entire encoder
> > >
> > > Both:
> > > with/without: 7.15s/8.17s
> > > Around 12% for the entire encoder
> > >
> > > Fast coder:
> > >
> > > abs_pow34:
> > > with/without: 3.40s/3.77s
> > > Around 10% for the entire encoder
> > >
> > > Both:
> > > with/without: 3.02s/3.77s
> > > Around 20% faster for the entire encoder
> > >
> > > Signed-off-by: Rostislav Pehlivanov 
> > > ---
> > >  libavcodec/aaccoder.c| 27 +++--
> > >  libavcodec/aaccoder_trellis.h|  2 +-
> > >  libavcodec/aaccoder_twoloop.h|  2 +-
> > >  libavcodec/aacenc.c  |  4 ++
> > >  libavcodec/aacenc.h  |  6 +++
> > >  libavcodec/aacenc_is.c   |  6 +--
> > >  libavcodec/aacenc_ltp.c  |  4 +-
> > >  libavcodec/aacenc_pred.c |  6 +--
> > >  libavcodec/aacenc_quantization.h |  4 +-
> > >  libavcodec/aacenc_utils.h|  4 +-
> > >  libavcodec/x86/Makefile  |  2 +
> > >  libavcodec/x86/aacencdsp.asm | 87 ++
> > ++
> > >  libavcodec/x86/aacencdsp_init.c  | 43 
> > >  13 files changed, 170 insertions(+), 27 deletions(-)
> > >  create mode 100644 libavcodec/x86/aacencdsp.asm
> > >  create mode 100644 libavcodec/x86/aacencdsp_init.c
> >
> > fate passes on linux32/64 x86, mingw32/64 x86
> >
> > build fails on arm:
> >
> > libavcodec/libavcodec.a(aacenc.o): In function `aac_encode_init':
> > ffmpeg/arm/src/libavcodec/aacenc.c:1038: undefined reference to
> > `ff_aac_dsp_init_x86'
> > collect2: ld returned 1 exit status
> > make: *** [ffserver_g] Error 1
> > make: *** Waiting for unfinished jobs
> > libavcodec/libavcodec.a(aacenc.o): In function `aac_encode_init':
> > ffmpeg/arm/src/libavcodec/aacenc.c:1038: undefined reference to
> > `ff_aac_dsp_init_x86'
> > collect2: ld returned 1 exit status
> > make: *** [ffprobe_g] Error 1
> > libavcodec/libavcodec.a(aacenc.o): In function `aac_encode_init':
> > ffmpeg/arm/src/libavcodec/aacenc.c:1038: undefined reference to
> > `ff_aac_dsp_init_x86'
> > collect2: ld returned 1 exit status
> > make: *** [ffmpeg_g] Error 1
> >
> > [...]
> > --
> > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > While the State exists there can be no freedom; when there is freedom there
> > will be no State. -- Vladimir Lenin
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >
> Attaching a new version with the fixes from James Almer which should also
> fix non-x86 compilation

>  aaccoder.c|   27 +++
>  aaccoder_trellis.h|2 -
>  aaccoder_twoloop.h|2 -
>  aacenc.c  |4 ++
>  aacenc.h  |6 +++
>  aacenc_is.c   |6 +--
>  aacenc_ltp.c  |4 +-
>  aacenc_pred.c |6 +--
>  aacenc_quantization.h |4 +-
>  aacenc_utils.h|2 -
>  x86/Makefile  |2 +
>  x86/aacencdsp.asm |   88 
> ++
>  x86/aacencdsp_init.c  |   43 
>  13 files changed, 170 insertions(+), 26 deletions(-)
> 84d67e14dbd62ef958a52a4027a8dff22f7480b6  
> 0001-aacenc-add-SIMD-optimizations-for-abs_pow34-and-quan.patch
> From d92003e23d82bc40fd85712538983209a7704248 Mon Sep 17 00:00:00 2001
> From: Rostislav Pehlivanov 
> Date: Sat, 8 Oct 2016 15:59:14 +0100
> Subject: [PATCH] aacenc: add SIMD optimizations for abs_pow34 and quantization
> 
> Performance improvements:
> 
> quant_bands:
> with: 681 decicycles in quant_bands, 8388453 runs,155 skips
> without: 1190 decicycles in quant_bands, 8388386 runs,222 skips
> Around 42% for the function
> 
> Twoloop coder:
> 
> abs_pow34:
> with/without: 7.82s/8.17s
> Around 4% for the entire encoder
> 
> Both:
> with/without: 7.15s/8.17s
> Around 12% for the entire encoder
> 
> Fast coder:
> 
> abs_pow34:
> with/without: 3.40s/3.77s
> Around 10% for the entire encoder
> 
> Both:
> with/without: 3.02s/3.77s
> Around 20% faster for the entire encoder
> 
> Signed-off-by: Rostislav Pehlivanov 
> ---
>  libavcodec/aaccoder.c| 27 ++--
>  libavcodec/aaccoder_trellis.h|  2 +-
>  libavcodec/aaccoder_twoloop.h|  2 +-
>  libavcodec/aacenc.c   

[FFmpeg-devel] [PATCH] lavf/mov: support gopro hero moments udta tag

2016-10-18 Thread Jean Caillé
From: Jean Caillé 

---
 libavformat/mov.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index cd3e46a..011eb77 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -268,6 +268,23 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext 
*pb, unsigned len)
 return av_dict_set(>fc->metadata, key, buf, 0);
 }
 
+static int mov_metadata_hmmt(MOVContext *c, AVIOContext *pb, unsigned len)
+{
+int i, n_hmmt;
+
+if (len < 2)
+return 0;
+if (c->ignore_chapters)
+return 0;
+
+n_hmmt = avio_rb32(pb);
+for (i = 0; i < n_hmmt && !pb->eof_reached; i++) {
+int moment_time = avio_rb32(pb);
+avpriv_new_chapter(c->fc, i, av_make_q(1, 1000), moment_time, 
AV_NOPTS_VALUE, NULL);
+}
+return 0;
+}
+
 static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 char tmp_key[5];
@@ -303,6 +320,8 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 parse = mov_metadata_gnre; break;
 case MKTAG( 'h','d','v','d'): key = "hd_video";
 parse = mov_metadata_int8_no_padding; break;
+case MKTAG( 'H','M','M','T'):
+return mov_metadata_hmmt(c, pb, atom.size);
 case MKTAG( 'k','e','y','w'): key = "keywords";  break;
 case MKTAG( 'l','d','e','s'): key = "synopsis";  break;
 case MKTAG( 'l','o','c','i'):
-- 
2.7.4 (Apple Git-66)

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


Re: [FFmpeg-devel] [PATCH 4/4] lavc/mediacodec: use more meaningful filenames

2016-10-18 Thread Matthieu Bouron
On Wed, Oct 12, 2016 at 03:22:42PM +0200, Matthieu Bouron wrote:
> From: Matthieu Bouron 
> 
> Adds the following changes:
>   * mediacodecdec.{c,h} -> mediacodecdec_common.{c,h}
>   * mediacodecdec_h2645.c -> mediacodecdec.c
> ---
>  libavcodec/Makefile|   12 +-
>  libavcodec/mediacodec.c|3 +-
>  libavcodec/mediacodec_sw_buffer.c  |2 +-
>  libavcodec/mediacodec_sw_buffer.h  |2 +-
>  libavcodec/mediacodecdec.c | 1064 
> +---
>  libavcodec/mediacodecdec_common.c  |  789 +++
>  .../{mediacodecdec.h => mediacodecdec_common.h}|6 +-
>  libavcodec/mediacodecdec_h2645.c   |  623 
>  8 files changed, 1251 insertions(+), 1250 deletions(-)
>  create mode 100644 libavcodec/mediacodecdec_common.c
>  rename libavcodec/{mediacodecdec.h => mediacodecdec_common.h} (95%)
>  delete mode 100644 libavcodec/mediacodecdec_h2645.c
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index e8b1b00..7b85378 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -94,7 +94,7 @@ OBJS-$(CONFIG_LSP) += lsp.o
>  OBJS-$(CONFIG_LZF) += lzf.o
>  OBJS-$(CONFIG_MDCT)+= mdct_fixed.o mdct_float.o 
> mdct_fixed_32.o
>  OBJS-$(CONFIG_ME_CMP)  += me_cmp.o
> -OBJS-$(CONFIG_MEDIACODEC)  += mediacodecdec.o 
> mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
> +OBJS-$(CONFIG_MEDIACODEC)  += mediacodecdec_common.o 
> mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
>  OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
>  OBJS-$(CONFIG_MPEGAUDIO)   += mpegaudio.o mpegaudiodata.o   \
>mpegaudiodecheader.o
> @@ -316,7 +316,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264dec.o 
> h264_cabac.o h264_cavlc.o \
>h264_slice.o h264data.o 
> h264_parse.o \
>h2645_parse.o
>  OBJS-$(CONFIG_H264_CUVID_DECODER)  += cuvid.o
> -OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec_h2645.o
> +OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
>  OBJS-$(CONFIG_H264_MMAL_DECODER)   += mmaldec.o
>  OBJS-$(CONFIG_H264_NVENC_ENCODER)  += nvenc_h264.o
>  OBJS-$(CONFIG_NVENC_ENCODER)   += nvenc_h264.o
> @@ -333,7 +333,7 @@ OBJS-$(CONFIG_HEVC_DECODER)+= hevc.o 
> hevc_mvs.o hevc_ps.o hevc_sei.o
>hevc_cabac.o hevc_refs.o 
> hevcpred.o\
>hevcdsp.o hevc_filter.o 
> h2645_parse.o hevc_data.o
>  OBJS-$(CONFIG_HEVC_CUVID_DECODER)  += cuvid.o
> -OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec_h2645.o hevc_parse.o
> +OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o hevc_parse.o
>  OBJS-$(CONFIG_HEVC_NVENC_ENCODER)  += nvenc_hevc.o
>  OBJS-$(CONFIG_NVENC_HEVC_ENCODER)  += nvenc_hevc.o
>  OBJS-$(CONFIG_HEVC_QSV_DECODER)+= qsvdec_h2645.o
> @@ -413,7 +413,7 @@ OBJS-$(CONFIG_MPEG2_QSV_ENCODER)   += qsvenc_mpeg2.o
>  OBJS-$(CONFIG_MPEG2VIDEO_DECODER)  += mpeg12dec.o mpeg12.o mpeg12data.o
>  OBJS-$(CONFIG_MPEG2VIDEO_ENCODER)  += mpeg12enc.o mpeg12.o
>  OBJS-$(CONFIG_MPEG4_DECODER)   += xvididct.o
> -OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_h2645.o
> +OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
>  OBJS-$(CONFIG_MPEG4_OMX_ENCODER)   += omx.o
>  OBJS-$(CONFIG_MPL2_DECODER)+= mpl2dec.o ass.o
>  OBJS-$(CONFIG_MSA1_DECODER)+= mss3.o
> @@ -596,11 +596,11 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o 
> vp56data.o \
>  OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o
>  OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o
>  OBJS-$(CONFIG_VP8_CUVID_DECODER)   += cuvid.o
> -OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
> +OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec.o
>  OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9dsp.o vp56rac.o 
> vp9dsp_8bpp.o \
>vp9dsp_10bpp.o vp9dsp_12bpp.o
>  OBJS-$(CONFIG_VP9_CUVID_DECODER)   += cuvid.o
> -OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
> +OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec.o
>  OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o
>  OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
>  OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
> diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c
> index a658f0e..3521c8a 100644
> --- a/libavcodec/mediacodec.c
> +++ b/libavcodec/mediacodec.c
> @@ -34,7 +34,8 @@
>  
>  #include "ffjni.h"
>  #include "mediacodec.h"
> -#include "mediacodecdec.h"
> +#include 

Re: [FFmpeg-devel] [PATCH 2/3] lavfi/loudnorm: add an internal libebur128 library

2016-10-18 Thread Martin Vignali
Hello,

Maybe you can also update the doc

removing this line :
To enable compilation of this filter you need to configure FFmpeg with
--enable-libebur128

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


Re: [FFmpeg-devel] [PATCH] doc/examples/demuxing_decoding: Drop AVFrame->pts use

2016-10-18 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 01:53:58PM +0200, Stefano Sabatini wrote:
> On date Tuesday 2016-10-18 04:58:52 +0200, Michael Niedermayer encoded:
> > This code is not correct for git master
> > 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  doc/examples/demuxing_decoding.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/doc/examples/demuxing_decoding.c 
> > b/doc/examples/demuxing_decoding.c
> > index 49fb6af..b1a216a 100644
> > --- a/doc/examples/demuxing_decoding.c
> > +++ b/doc/examples/demuxing_decoding.c
> > @@ -93,10 +93,9 @@ static int decode_packet(int *got_frame, int cached)
> >  return -1;
> >  }
> >  
> > -printf("video_frame%s n:%d coded_n:%d pts:%s\n",
> > +printf("video_frame%s n:%d coded_n:%d\n",
> > cached ? "(cached)" : "",
> > -   video_frame_count++, frame->coded_picture_number,
> > -   av_ts2timestr(frame->pts, _dec_ctx->time_base));
> > +   video_frame_count++, frame->coded_picture_number);
> >  
> >  /* copy decoded frame to destination buffer:
> >   * this is required since rawvideo expects non aligned data */
> 
> Considering it was never so useful (it was mostly set to NOPTS), LGTM.

applied

thx

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


[FFmpeg-devel] [PATCH]lavc/sheervideo: Increase av_get_codec_tag_string() input buffer size.

2016-10-18 Thread Carl Eugen Hoyos
Hi!

Attached patch increases the size of the input buffer for 
av_get_codec_tag_string() to 32, typically used in FFmpeg.

Carl Eugen
From 79eff70eb71106b8b2330f5d1d119d40775f1f77 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Tue, 18 Oct 2016 14:53:30 +0200
Subject: [PATCH] lavc/sheervideo: Increase av_get_codec_tag_string() input
 buffer size.

A size of 32 is typically used.
---
 libavcodec/sheervideo.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c
index f8490c9..e8f008b 100644
--- a/libavcodec/sheervideo.c
+++ b/libavcodec/sheervideo.c
@@ -2879,7 +2879,7 @@ static int decode_frame(AVCodecContext *avctx,
 AVFrame *p = data;
 GetBitContext gb;
 unsigned format;
-char format_str[16];
+char format_str[32];
 int ret;
 
 if (avpkt->size <= 20)
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH]lavf/avidec: Be more verbose when ignoring very large tag size

2016-10-18 Thread Carl Eugen Hoyos
2016-10-18 8:11 GMT+02:00 Clément Bœsch :
> On Tue, Oct 18, 2016 at 12:42:18AM +0200, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Attached patch prints the tag and the tag size when ignoring the size.
>>
>> Please comment, Carl Eugen
>
>> From e99dc274b7b4b4b5ef502ddb0a8245c1f47c2ece Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos 
>> Date: Tue, 18 Oct 2016 00:37:06 +0200
>> Subject: [PATCH] lavf/avidec: Be more verbose when ignoring very large tag
>>  size.
>>
>> ---
>>  libavformat/avidec.c |5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
>> index b291625..2fcb0ee 100644
>> --- a/libavformat/avidec.c
>> +++ b/libavformat/avidec.c
>> @@ -986,7 +986,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>  if (size > 100) {
>>  av_log(s, AV_LOG_ERROR,
>> "Something went wrong during header parsing, "
>> -   "I will ignore it and try to continue anyway.\n");
>> +   "tag %c%c%c%c has size %u, "
>> +   "I will ignore it and try to continue anyway.\n",
>> +   tag & 0xff, tag >> 8 & 0xff, tag >> 16 & 0xff, tag 
>> >> 24 & 0xff,
>> +   size);
>
> please use av_get_codec_tag_string() if the tag can be anything, it will
> prevent printing special characters.

Applied using av_get_codec_tag().

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] comma at the end of enumerator lists

2016-10-18 Thread Carl Eugen Hoyos
2016-10-18 13:11 GMT+02:00 Moritz Barsnick :
> On Tue, Oct 18, 2016 at 00:21:42 +0200, Carl Eugen Hoyos wrote:
>> In any case, your second patch is acceptable, should not have
>> any adversary effects and we have significantly worse cosmetic
>> patches in our tree, so it is ok imo.
>
> I only see one patch - did I miss one? - , and if that's the one you're

I meant this one on the mailing list contrary to the first - inacceptable
- one on github, sorry.

> referring to, it should at least be created with git format-patch (and
> thus include a proper commit message).

Of course.

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


Re: [FFmpeg-devel] [PATCH] doc/examples/demuxing_decoding: Drop AVFrame->pts use

2016-10-18 Thread Stefano Sabatini
On date Tuesday 2016-10-18 04:58:52 +0200, Michael Niedermayer encoded:
> This code is not correct for git master
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  doc/examples/demuxing_decoding.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/doc/examples/demuxing_decoding.c 
> b/doc/examples/demuxing_decoding.c
> index 49fb6af..b1a216a 100644
> --- a/doc/examples/demuxing_decoding.c
> +++ b/doc/examples/demuxing_decoding.c
> @@ -93,10 +93,9 @@ static int decode_packet(int *got_frame, int cached)
>  return -1;
>  }
>  
> -printf("video_frame%s n:%d coded_n:%d pts:%s\n",
> +printf("video_frame%s n:%d coded_n:%d\n",
> cached ? "(cached)" : "",
> -   video_frame_count++, frame->coded_picture_number,
> -   av_ts2timestr(frame->pts, _dec_ctx->time_base));
> +   video_frame_count++, frame->coded_picture_number);
>  
>  /* copy decoded frame to destination buffer:
>   * this is required since rawvideo expects non aligned data */

Considering it was never so useful (it was mostly set to NOPTS), LGTM.
-- 
FFmpeg = Free and Frightening Magical Prodigious Exxagerate Guide
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/aviobuf: add ff_get_line2() variant

2016-10-18 Thread Stefano Sabatini
On date Thursday 2016-10-13 21:59:19 +0200, Michael Niedermayer encoded:
> On Thu, Oct 13, 2016 at 07:40:59PM +0200, Stefano Sabatini wrote:
> > This allows to probe if the read line was partially discarded.
> > ---
> >  libavformat/aviobuf.c  | 10 +-
> >  libavformat/internal.h | 14 ++
> >  2 files changed, 23 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> > index 134d627..28183b4 100644
> > --- a/libavformat/aviobuf.c
> > +++ b/libavformat/aviobuf.c
> > @@ -764,18 +764,26 @@ unsigned int avio_rb32(AVIOContext *s)
> >  
> >  int ff_get_line(AVIOContext *s, char *buf, int maxlen)
> >  {
> > -int i = 0;
> > +return ff_get_line2(s, buf, maxlen, NULL);
> > +}
> > +
> > +int ff_get_line2(AVIOContext *s, char *buf, int maxlen, int *readlen)
> > +{
> > +int i = 0, j = 0;
> >  char c;
> >  
> >  do {
> >  c = avio_r8(s);
> >  if (c && i < maxlen-1)
> >  buf[i++] = c;
> > +j++;
> >  } while (c != '\n' && c != '\r' && c);
> 

> "\n" and "\0" would i belive both have a j=1 but they would have
> differig i
> is that intended ? (seems to me that this would make truncation
> detection more annoying)
> or am i missing something that avoids this difference?

Improved version in attachment.
-- 
FFmpeg = Fascinating Foolish Mystic Puritan Egregious Gymnast
>From 58c1cad434447d48246e153e3a1a391d72d23c7b Mon Sep 17 00:00:00 2001
From: Stefano Sabatini 
Date: Thu, 13 Oct 2016 16:36:30 +0200
Subject: [PATCH] lavf/aviobuf: add ff_get_line2() variant

This allows to probe if the read line was partially discarded.
---
 libavformat/aviobuf.c  | 18 +++---
 libavformat/internal.h | 14 ++
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 134d627..29bcf1e 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -764,18 +764,30 @@ unsigned int avio_rb32(AVIOContext *s)
 
 int ff_get_line(AVIOContext *s, char *buf, int maxlen)
 {
-int i = 0;
+return ff_get_line2(s, buf, maxlen, NULL);
+}
+
+int ff_get_line2(AVIOContext *s, char *buf, int maxlen, int *readlen)
+{
+int i = 0, j = 0;
 char c;
 
-do {
+while (1) {
 c = avio_r8(s);
 if (c && i < maxlen-1)
 buf[i++] = c;
-} while (c != '\n' && c != '\r' && c);
+if (c != '\n' && c != '\r' && c) {
+j++;
+} else {
+break;
+}
+}
 if (c == '\r' && avio_r8(s) != '\n' && !avio_feof(s))
 avio_skip(s, -1);
 
 buf[i] = 0;
+if (readlen)
+*readlen = j;
 return i;
 }
 
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 49244fa..fc49571 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -274,6 +274,20 @@ void ff_put_v(AVIOContext *bc, uint64_t val);
  */
 int ff_get_line(AVIOContext *s, char *buf, int maxlen);
 
+/**
+ * Read a whole line of text from AVIOContext. Stop reading after reaching
+ * either a \\n, a \\0 or EOF. The returned string is always \\0-terminated,
+ * and may be truncated if the buffer is too small.
+ *
+ * @param s the read-only AVIOContext
+ * @param buf buffer to store the read line
+ * @param maxlen size of the buffer
+ * @param readlen length of the read line, not including the final \\0
+ * @return the length of the string written in the buffer, not including the
+ * final \\0
+ */
+int ff_get_line2(AVIOContext *s, char *buf, int maxlen, int *readlen);
+
 #define SPACE_CHARS " \t\r\n"
 
 /**
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-10-18 Thread Stefano Sabatini
On date Thursday 2016-10-13 19:46:41 +0200, Stefano Sabatini encoded:
> On date Thursday 2016-09-29 21:55:11 +0200, wm4 encoded:
[...]
> > This seems like a rather special use case. Why does it have a demuxer,
> > and can't be in your own C code using libavcodec/libavformat?
> > 
> 
> > In addition, I think using the ffprobe "format" is an overcomplication,
> > and will justify adding even more stuff to the demuxer, until it's a
> > similarily complex mess like the ffm demuxer/muxer.
> 
> I'm aware of the issue. OTOH I think the feature per-se is useful, at
> least for the two mentioned use cases (debugging - especially if
> coupled with a corresponding muxer), and data streams (generated by
> script) injection, since it relies on a textual format easily
> scriptable and editable by hand.
> 
> I thus leave the choice to the community. I guess this will require a
> vote if we cannot find an agreement.
> 
> Latest patch in attachment with ffprobe demuxer disabled by default,
> and extended documentation. (I'm also attaching the ff_get_line2 patch
> which is used by this new patch).

Updated, depends on the ff_get_line2() patch.
-- 
FFmpeg = Fanciful and Fundamentalist Magnificient Ponderous Elastic Game
>From bef4930a2bf280425b5952de0e2281f03897ff7c Mon Sep 17 00:00:00 2001
From: Nicolas George 
Date: Sat, 11 Jan 2014 19:42:41 +0100
Subject: [PATCH] lavf: add ffprobe demuxer

With several modifications and documentation by Stefano Sabatini
.

Signed-off-by: Nicolas George 
---
 configure|   3 +
 doc/demuxers.texi|  18 +++
 doc/ffprobe-format.texi  | 121 ++
 doc/formats.texi |   1 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/ffprobedec.c | 405 +++
 7 files changed, 550 insertions(+)
 create mode 100644 doc/ffprobe-format.texi
 create mode 100644 libavformat/ffprobedec.c

diff --git a/configure b/configure
index 96f575f..65995e7 100755
--- a/configure
+++ b/configure
@@ -3340,6 +3340,9 @@ for n in $COMPONENT_LIST; do
 eval ${n}_if_any="\$$v"
 done
 
+# Disable ffprobe demuxer for security concerns
+disable ffprobe_demuxer
+
 enable $ARCH_EXT_LIST
 
 die_unknown(){
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 2934a1c..0e6dfbd 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -243,6 +243,24 @@ file subdir/file-2.wav
 @end example
 @end itemize
 
+@section ffprobe
+
+ffprobe internal demuxer. It is able to demux files in the format
+specified in the @ref{FFprobe demuxer format} chapter.
+
+For security reasons this demuxer is disabled by default, should be
+enabled though the @code{--enable-demuxer=ffprobe} configure option.
+
+This format is useful to generate streams in a textual format, easily
+generated with scripting or by hand (by editing the output of
+@command{ffprobe}).
+
+In particular, it can be also used to inject data stream generated by
+scripts in the @command{ffmpeg} output, for example with the command:
+@example
+ffmpeg -i INPUT -i data.ffprobe -map 0:0 -map 0:1 -map 1:0 -codec:d copy OUTPUT
+@end example
+
 @section flv
 
 Adobe Flash Video Format demuxer.
diff --git a/doc/ffprobe-format.texi b/doc/ffprobe-format.texi
new file mode 100644
index 000..fa34f5e
--- /dev/null
+++ b/doc/ffprobe-format.texi
@@ -0,0 +1,121 @@
+@anchor{FFprobe demuxer format}
+@chapter FFprobe demuxer format
+@c man begin FFPROBE DEMUXER FORMAT
+
+The ffprobe demuxer format is inspired by the output generated by the
+ffprobe default format.
+
+It consists of several sections (@samp{FORMAT}, @samp{STREAM},
+@samp{PACKET}). Each section starts with a single line in the format
+@samp{[SECTION]} and ends with the corresponding line
+@samp{[/SECTION]}, where @samp{SECTION} is the name of the section.
+
+A well-formed file consists of an initial @samp{FORMAT} section,
+followed by several @samp{STREAM} sections (one per stream), and
+several @samp{PACKET} sections.
+
+Each section contains a sequence of lines in the form
+@samp{key=value}. In the case of data the key and the value must
+stay on different lines.
+
+Unrecognized values are discarded.
+
+This format can be read by the @code{ffprobe} demuxer. It is an
+internal format and thus should not be used for archiving purposes.
+
+The following sections document the fields accepted by each section.
+
+@section FORMAT
+
+@table @samp
+@item nb_streams
+the number of supported streams
+@end table
+
+@section STREAM
+@table @samp
+@item index
+the index number
+@item codec_name
+the codec name (the name must be an accepted FFmpeg codec name
+@item time_base
+Specify the time_base as @samp{NUM/DEN}, this is the time base used to
+specify the timestamps in the corresponding packets
+@end table
+
+@section PACKET
+
+@table @samp
+@item stream_index
+the stream index of the stream (must have been specified in a stream
+section). If not specified the first stream is assumed.

Re: [FFmpeg-devel] comma at the end of enumerator lists

2016-10-18 Thread Moritz Barsnick
On Mon, Oct 17, 2016 at 23:23:31 +0200, Michael Behrisch wrote:
> My main reason is that we are compiling with different compilers for
> different platforms

If you're trying to keep ffmpeg more portable, you could at least try
the real-life thing and actually attempt to build with Sun Studio or
newer ICC or whatever you have in mind, and report back what actual
problems they pose. That said, have you seen the amount of
platforms+compilers already covered in fate alone?

> I cannot think of any but to be honest I cannot even tell exactly which
> warnings are enabled by which of the -Wall, -Wextra and -Wpedantic flags
> and it is surprisingly hard to find out.

I agree. I also agree warnings should be eliminated, but some are just
useless or wrong or whatever, so often nothing to worry about if you
explicitly switched them on.

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


Re: [FFmpeg-devel] comma at the end of enumerator lists

2016-10-18 Thread Moritz Barsnick
On Tue, Oct 18, 2016 at 00:21:42 +0200, Carl Eugen Hoyos wrote:
> In any case, your second patch is acceptable, should not have
> any adversary effects and we have significantly worse cosmetic
> patches in our tree, so it is ok imo.

I only see one patch - did I miss one? - , and if that's the one you're
referring to, it should at least be created with git format-patch (and
thus include a proper commit message).

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


Re: [FFmpeg-devel] [PATCHv3] mov: Evaluate the movie display matrix

2016-10-18 Thread Benoit Fouet
Hi,

On 14/10/2016 00:50, Vittorio Giovara wrote:
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index a15c8d1..e8da77f 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c

[...]

> @@ -3798,16 +3804,33 @@ static int mov_read_meta(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  return 0;
>  }
>  
> +// return 0 when matrix is identity, 1 otherwise
> +#define IS_MATRIX_FULL(matrix)   \
> +(matrix[0][0] != (1 << 16) ||\
> + matrix[1][1] != (1 << 16) ||\
> + matrix[2][2] != (1 << 30) ||\
> + matrix[0][1] || matrix[0][2] || \
> + matrix[1][0] || matrix[1][2] || \
> + matrix[2][0] || matrix[2][1])
> +

should be "(matrix)" everywhere
Also, reversing the logic would allow preventing the evaluation of all
conditions when the matrix is not identity (i.e. making it
IS_MATRIX_IDENTITY)

> +// fixed point to double
> +#define CONV_FP(x, sh) ((double) (x)) / (1 << (sh))
> +

((double) (x) / (1 << (sh)))

> +// double to fixed point
> +#define CONV_DB(x, sh) ((int32_t) ((x) * (1 << (sh
> +

Cheers,
-- 
Ben


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


Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-10-18 Thread Stefano Sabatini
On date Thursday 2016-09-29 21:02:14 +0100, Josh de Kock encoded:
[...]
> Are you sure this cannot be done from outside of libav*? It really
> seems like something which wouldn't actually be very useful for
> anyone else.

It can be done outside of libav* (reading from a custom format, and
then converting to one of the supported output formats), but this
would imply another processing step.

> It's also just another hack in for a non-standardised,
> exclusive format. Lavf is really not a good fit for this and it
> should be done outside of libav*.

See my previous replies. I think there are both advantages and
disadvantages for integrating this format, and it should be probably
disabled by default for security concerns.
-- 
FFmpeg = Fierce & Foolish Murdering Probing Enhancing Goblin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: Detect field_order based on video_line_map

2016-10-18 Thread Tobias Rapp

On 11.10.2016 10:40, Tobias Rapp wrote:

Read video_line_map from MXF generic picture essence descriptor and use
it to derive the coded field order. Use field_dominance to derive the
display field order from coded field order. If field_dominance is not
available the default value "1" is used as defined in SMPTE S377-1.

Fixes field_order detection for a bunch of DV/DVCPRO files. The heuristic
for deriving coded field order from video_line_map is inspired by
MediaInfo.

Signed-off-by: Tobias Rapp 
---
 libavformat/mxfdec.c | 75 +---
 1 file changed, 60 insertions(+), 15 deletions(-)



Ping. Example files can be found at [1]. To debug the detected field 
order I used ffprobe plus the patch in [2]:


./ffprobe -show_streams -select_streams v -i $INPUT_FILE 2>/dev/null | 
grep field_order


For file "Avid-5.mxf" [3] the result is:
field_order=tt (without patch)
field_order=bb (with patch)

For file "OpenCube-3.mxf" [4] the result is:
field_order=unknown (without patch)
field_order=bb (with patch)

Regards,
Tobias

Links:
[1] http://mxf.irt.de/files/filter.php?action=query=manufacturers
[2] https://ffmpeg.org/pipermail/ffmpeg-devel/2016-October/200607.html
[3] 
http://mxf.irt.de/files/download.php?action=getFile=manufacturers=85
[4] 
http://mxf.irt.de/files/download.php?action=getFile=manufacturers=114


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


Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-10-18 Thread Stefano Sabatini
On date Friday 2016-10-14 00:11:49 +0200, Moritz Barsnick encoded:
> On Thu, Oct 13, 2016 at 19:46:41 +0200, Stefano Sabatini wrote:
> > +In particular, can be also used to inject data stream generated by
>   ^ it can
> 
> > +Unrecognized values are discarded (this allows the demuxer to accept
> > +the output generated by @command{ffprobe} without further
> > +modifications.
> ^) (missing closing bracket)
> 
> > +the codec name (the name must be an accepted FFmpeg codec name
>  ^) (missing 
> closing bracket)
> 
> > +@item duration_tim
>  ^duration_time
>  

> > +av_log(avf, AV_LOG_ERROR, "Invalid " #name_ " time 
> > specification '%s' for data packet\n", \
> ^ Is 
> there a space too much here ("duration_ time")?

No, this is correct as is (it renders to "duration time", the "_" is
part of the variable name).

Will send an update soon, thanks.
-- 
FFmpeg = Formidable and Foolish Magnificient Power Explosive Geisha
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] fate: add swr-convertaudio test

2016-10-18 Thread Muhammad Faiz
On Tue, Oct 18, 2016 at 6:20 AM, Michael Niedermayer
 wrote:
> On Mon, Oct 17, 2016 at 05:37:41AM +0700, Muhammad Faiz wrote:
>> test for flt to s16
>> should pass on correct rounding to nearest
>>
>> Signed-off-by: Muhammad Faiz 
>> ---
>>  tests/fate/libswresample.mak | 8 
>>  1 file changed, 8 insertions(+)
>
> tested on linux32/64, arm and mips qemu
>
> LGTM
>
> thx

pushed

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


Re: [FFmpeg-devel] [PATCH v3] aacenc: add SIMD optimizations for abs_pow34 and quantization

2016-10-18 Thread Rostislav Pehlivanov
On 17 October 2016 at 23:43, Michael Niedermayer 
wrote:

> On Mon, Oct 17, 2016 at 10:24:48PM +0100, Rostislav Pehlivanov wrote:
> > Should fix segfaults on x86-32
> >
> > Performance improvements:
> >
> > quant_bands:
> > with: 681 decicycles in quant_bands, 8388453 runs,155 skips
> > without: 1190 decicycles in quant_bands, 8388386 runs,222 skips
> > Around 42% for the function
> >
> > Twoloop coder:
> >
> > abs_pow34:
> > with/without: 7.82s/8.17s
> > Around 4% for the entire encoder
> >
> > Both:
> > with/without: 7.15s/8.17s
> > Around 12% for the entire encoder
> >
> > Fast coder:
> >
> > abs_pow34:
> > with/without: 3.40s/3.77s
> > Around 10% for the entire encoder
> >
> > Both:
> > with/without: 3.02s/3.77s
> > Around 20% faster for the entire encoder
> >
> > Signed-off-by: Rostislav Pehlivanov 
> > ---
> >  libavcodec/aaccoder.c| 27 +++--
> >  libavcodec/aaccoder_trellis.h|  2 +-
> >  libavcodec/aaccoder_twoloop.h|  2 +-
> >  libavcodec/aacenc.c  |  4 ++
> >  libavcodec/aacenc.h  |  6 +++
> >  libavcodec/aacenc_is.c   |  6 +--
> >  libavcodec/aacenc_ltp.c  |  4 +-
> >  libavcodec/aacenc_pred.c |  6 +--
> >  libavcodec/aacenc_quantization.h |  4 +-
> >  libavcodec/aacenc_utils.h|  4 +-
> >  libavcodec/x86/Makefile  |  2 +
> >  libavcodec/x86/aacencdsp.asm | 87 ++
> ++
> >  libavcodec/x86/aacencdsp_init.c  | 43 
> >  13 files changed, 170 insertions(+), 27 deletions(-)
> >  create mode 100644 libavcodec/x86/aacencdsp.asm
> >  create mode 100644 libavcodec/x86/aacencdsp_init.c
>
> fate passes on linux32/64 x86, mingw32/64 x86
>
> build fails on arm:
>
> libavcodec/libavcodec.a(aacenc.o): In function `aac_encode_init':
> ffmpeg/arm/src/libavcodec/aacenc.c:1038: undefined reference to
> `ff_aac_dsp_init_x86'
> collect2: ld returned 1 exit status
> make: *** [ffserver_g] Error 1
> make: *** Waiting for unfinished jobs
> libavcodec/libavcodec.a(aacenc.o): In function `aac_encode_init':
> ffmpeg/arm/src/libavcodec/aacenc.c:1038: undefined reference to
> `ff_aac_dsp_init_x86'
> collect2: ld returned 1 exit status
> make: *** [ffprobe_g] Error 1
> libavcodec/libavcodec.a(aacenc.o): In function `aac_encode_init':
> ffmpeg/arm/src/libavcodec/aacenc.c:1038: undefined reference to
> `ff_aac_dsp_init_x86'
> collect2: ld returned 1 exit status
> make: *** [ffmpeg_g] Error 1
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> While the State exists there can be no freedom; when there is freedom there
> will be no State. -- Vladimir Lenin
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
Attaching a new version with the fixes from James Almer which should also
fix non-x86 compilation
From d92003e23d82bc40fd85712538983209a7704248 Mon Sep 17 00:00:00 2001
From: Rostislav Pehlivanov 
Date: Sat, 8 Oct 2016 15:59:14 +0100
Subject: [PATCH] aacenc: add SIMD optimizations for abs_pow34 and quantization

Performance improvements:

quant_bands:
with: 681 decicycles in quant_bands, 8388453 runs,155 skips
without: 1190 decicycles in quant_bands, 8388386 runs,222 skips
Around 42% for the function

Twoloop coder:

abs_pow34:
with/without: 7.82s/8.17s
Around 4% for the entire encoder

Both:
with/without: 7.15s/8.17s
Around 12% for the entire encoder

Fast coder:

abs_pow34:
with/without: 3.40s/3.77s
Around 10% for the entire encoder

Both:
with/without: 3.02s/3.77s
Around 20% faster for the entire encoder

Signed-off-by: Rostislav Pehlivanov 
---
 libavcodec/aaccoder.c| 27 ++--
 libavcodec/aaccoder_trellis.h|  2 +-
 libavcodec/aaccoder_twoloop.h|  2 +-
 libavcodec/aacenc.c  |  4 ++
 libavcodec/aacenc.h  |  6 +++
 libavcodec/aacenc_is.c   |  6 +--
 libavcodec/aacenc_ltp.c  |  4 +-
 libavcodec/aacenc_pred.c |  6 +--
 libavcodec/aacenc_quantization.h |  4 +-
 libavcodec/aacenc_utils.h|  2 +-
 libavcodec/x86/Makefile  |  2 +
 libavcodec/x86/aacencdsp.asm | 88 
 libavcodec/x86/aacencdsp_init.c  | 43 
 13 files changed, 170 insertions(+), 26 deletions(-)
 create mode 100644 libavcodec/x86/aacencdsp.asm
 create mode 100644 libavcodec/x86/aacencdsp_init.c

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 35787e8..9f3b4ed 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -88,7 +88,7 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce
 float next_minrd = INFINITY;
 int next_mincb = 0;
 
-abs_pow34_v(s->scoefs, sce->coeffs, 1024);
+s->abs_pow34(s->scoefs, sce->coeffs, 1024);
 start = win*128;
 

[FFmpeg-devel] [PATCH] swresample/resample: fix return value of build_filter

2016-10-18 Thread Muhammad Faiz
return AVERROR code on error

Signed-off-by: Muhammad Faiz 
---
 libswresample/resample.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libswresample/resample.c b/libswresample/resample.c
index b834248..8635bf1 100644
--- a/libswresample/resample.c
+++ b/libswresample/resample.c
@@ -149,6 +149,7 @@ static int build_filter(ResampleContext *c, void *filter, 
double factor, int tap
 double *tab = av_malloc_array(tap_count+1,  sizeof(*tab));
 double *sin_lut = av_malloc_array(ph_nb, sizeof(*sin_lut));
 const int center= (tap_count-1)/2;
+int ret = AVERROR(ENOMEM);
 
 if (!tab || !sin_lut)
 goto fail;
@@ -292,10 +293,11 @@ static int build_filter(ResampleContext *c, void *filter, 
double factor, int tap
 }
 #endif
 
+ret = 0;
 fail:
 av_free(tab);
 av_free(sin_lut);
-return 0;
+return ret;
 }
 
 static ResampleContext *resample_init(ResampleContext *c, int out_rate, int 
in_rate, int filter_size, int phase_shift, int linear,
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH]lavf/avidec: Be more verbose when ignoring very large tag size

2016-10-18 Thread Clément Bœsch
On Tue, Oct 18, 2016 at 12:42:18AM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch prints the tag and the tag size when ignoring the size.
> 
> Please comment, Carl Eugen

> From e99dc274b7b4b4b5ef502ddb0a8245c1f47c2ece Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Tue, 18 Oct 2016 00:37:06 +0200
> Subject: [PATCH] lavf/avidec: Be more verbose when ignoring very large tag
>  size.
> 
> ---
>  libavformat/avidec.c |5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index b291625..2fcb0ee 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -986,7 +986,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  if (size > 100) {
>  av_log(s, AV_LOG_ERROR,
> "Something went wrong during header parsing, "
> -   "I will ignore it and try to continue anyway.\n");
> +   "tag %c%c%c%c has size %u, "
> +   "I will ignore it and try to continue anyway.\n",
> +   tag & 0xff, tag >> 8 & 0xff, tag >> 16 & 0xff, tag >> 
> 24 & 0xff,
> +   size);

please use av_get_codec_tag_string() if the tag can be anything, it will
prevent printing special characters.

-- 
Clément B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel