Re: [FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: Refactor an inconsistent variable name

2017-11-22 Thread 刘歧

> 在 2017年11月22日,16:08,Karthick J  写道:
> 
> ---
> libavformat/hlsenc.c | 18 +-
> 1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 525605b..611cc99 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1074,7 +1074,7 @@ static int create_master_playlist(AVFormatContext *s,
> AVDictionary *options = NULL;
> unsigned int i, j;
> int m3u8_name_size, ret, bandwidth;
> -char *m3U8_rel_name;
> +char *m3u8_rel_name;
> 
> input_vs->m3u8_created = 1;
> if (!hls->master_m3u8_created) {
> @@ -1108,14 +1108,14 @@ static int create_master_playlist(AVFormatContext *s,
> vs = &(hls->var_streams[i]);
> 
> m3u8_name_size = strlen(vs->m3u8_name) + 1;
> -m3U8_rel_name = av_malloc(m3u8_name_size);
> -if (!m3U8_rel_name) {
> +m3u8_rel_name = av_malloc(m3u8_name_size);
> +if (!m3u8_rel_name) {
> ret = AVERROR(ENOMEM);
> goto fail;
> }
> -av_strlcpy(m3U8_rel_name, vs->m3u8_name, m3u8_name_size);
> +av_strlcpy(m3u8_rel_name, vs->m3u8_name, m3u8_name_size);
> ret = get_relative_url(hls->master_m3u8_url, vs->m3u8_name,
> -   m3U8_rel_name, m3u8_name_size);
> +   m3u8_rel_name, m3u8_name_size);
> if (ret < 0) {
> av_log(NULL, AV_LOG_ERROR, "Unable to find relative URL\n");
> goto fail;
> @@ -1145,7 +1145,7 @@ static int create_master_playlist(AVFormatContext *s,
> if (!bandwidth) {
> av_log(NULL, AV_LOG_WARNING,
> "Bandwidth info not available, set audio and video 
> bitrates\n");
> -av_freep(_rel_name);
> +av_freep(_rel_name);
> continue;
> }
> 
> @@ -1153,14 +1153,14 @@ static int create_master_playlist(AVFormatContext *s,
> if (vid_st && vid_st->codecpar->width > 0 && vid_st->codecpar->height 
> > 0)
> avio_printf(master_pb, ",RESOLUTION=%dx%d", 
> vid_st->codecpar->width,
> vid_st->codecpar->height);
> -avio_printf(master_pb, "\n%s\n\n", m3U8_rel_name);
> +avio_printf(master_pb, "\n%s\n\n", m3u8_rel_name);
> 
> -av_freep(_rel_name);
> +av_freep(_rel_name);
> }
> fail:
> if(ret >=0)
> hls->master_m3u8_created = 1;
> -av_freep(_rel_name);
> +av_freep(_rel_name);
> ff_format_io_close(s, _pb);
> return ret;
> }
> -- 
> 1.9.1
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

patchset LGTM



Thanks



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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/hlsenc: Modularized playlist creation to allow reuse

2017-11-22 Thread Jeyapal, Karthick
>On 11/22/17, 2:18 PM, "Hendrik Leppkes"  wrote:

>>On Wed, Nov 22, 2017 at 9:35 AM, Jeyapal, Karthick  
>>wrote:
>>>On 11/22/17, 1:47 PM, "刘歧"  wrote:
[…]
>>> move the APIs to an C source file, and use ff_ prefix, refer to: 
>>> https://ffmpeg.org/developer.html#toc-Naming-conventions
>> Thanks for the reply.
>> I am not adding it to the API or a global function.
>> Those are just ‘static’ utility functions, to allow code reuse.
>> The scope will be limited only to those files including hlsenc.h.
>> Developer guide states “For file-scope variables and functions declared as 
>> static, no prefix is required”.
>> For example, oggdec.h has two static functions without ff_ prefix.
>>
>
>Regardless, having a bunch of complex functions in a header is not the
>preferred way (because their code gets duplicated), its usually
>reserved for extremely simple functions or special cases. Instead, put
>them into a .c file and give them the ff_ prefix, like most common
>shared code we use.
Thanks for the clarification. 
I have uploaded newer patch set v2 with those functions in .c file 
>
>- Hendrik

regards,
Karthick

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


[FFmpeg-devel] [PATCH 1/1] avformat/dashenc: Associate mpd extension with dash muxer

2017-11-22 Thread Karthick J
---
 libavformat/dashenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 201668a..0fee3cd 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1219,6 +1219,7 @@ static const AVClass dash_class = {
 AVOutputFormat ff_dash_muxer = {
 .name   = "dash",
 .long_name  = NULL_IF_CONFIG_SMALL("DASH Muxer"),
+.extensions = "mpd",
 .priv_data_size = sizeof(DASHContext),
 .audio_codec= AV_CODEC_ID_AAC,
 .video_codec= AV_CODEC_ID_H264,
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/hlsenc: Modularized playlist creation to allow reuse

2017-11-22 Thread Hendrik Leppkes
On Wed, Nov 22, 2017 at 9:35 AM, Jeyapal, Karthick  wrote:
>>On 11/22/17, 1:47 PM, "刘歧"  wrote:
>>
>>> 在 2017年11月22日,14:53,Karthick J  写道:
>>>
>>> ---
>>> libavformat/hlsenc.c | 130 +++---
>>> libavformat/hlsenc.h | 158 
>>> +++
>>> 2 files changed, 177 insertions(+), 111 deletions(-)
>>> create mode 100644 libavformat/hlsenc.h
>>>
> […]
>> move the APIs to an C source file, and use ff_ prefix, refer to: 
>> https://ffmpeg.org/developer.html#toc-Naming-conventions
> Thanks for the reply.
> I am not adding it to the API or a global function.
> Those are just ‘static’ utility functions, to allow code reuse.
> The scope will be limited only to those files including hlsenc.h.
> Developer guide states “For file-scope variables and functions declared as 
> static, no prefix is required”.
> For example, oggdec.h has two static functions without ff_ prefix.
>

Regardless, having a bunch of complex functions in a header is not the
preferred way (because their code gets duplicated), its usually
reserved for extremely simple functions or special cases. Instead, put
them into a .c file and give them the ff_ prefix, like most common
shared code we use.

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


Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-22 Thread Marc-Antoine ARNAUD
New patch version which fixe the last remark.


Le ven. 10 nov. 2017 à 00:47, Michael Niedermayer 
a écrit :

> On Thu, Nov 09, 2017 at 10:22:23AM +, Marc-Antoine ARNAUD wrote:
> > Please find the merged patch in attachement.
> >
> > Thanks
> >
> > Le mer. 8 nov. 2017 à 17:12, Paul B Mahol  a écrit :
> >
> > > On 11/8/17, Marc-Antoine ARNAUD  wrote:
> > > > This patch will fix the stride issue.
> > > > Is it valid for you ?
> > > >
> > > > Does it required to merge these 2 patches ? (and remove base64
> encoding
> > > on
> > > > the first one)
> > >
> > > Please merge those two patches, base64 encoding should not be needed
> > > (it helps to faster review patches if they are not encoded).
> > > ___
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
>
> >  vf_geq.c |  124
> +--
> >  1 file changed, 90 insertions(+), 34 deletions(-)
> > b41a90fffb5ddef553661007a38659c602f7ce56
> 0001-avfilter-slice-processing-for-geq.patch
> > From ac2a6322fa96835e02a24c31f014fb360e26561f Mon Sep 17 00:00:00 2001
> > From: Marc-Antoine Arnaud 
> > Date: Thu, 9 Nov 2017 11:19:43 +0100
> > Subject: [PATCH] avfilter: slice processing for geq
> > Content-Type: text/x-patch; charset="utf-8"
>
> crashes:
> ./ffmpeg_g -f lavfi -i
> 'nullsrc=s=200x200,format=yuv444p16,geq=X*Y/10:sin(X/10)*255:cos(Y/10)*255'
> -vframes 5 -y blah.avi
>
> ==24616== Thread 7:
> ==24616== Invalid write of size 2
> ==24616==at 0x4F3AAF: slice_geq_filter (vf_geq.c:289)
> ==24616==by 0x48E4C9: worker_func (pthread.c:50)
> ==24616==by 0x11DB932: run_jobs (slicethread.c:61)
> ==24616==by 0x11DBA04: thread_worker (slicethread.c:85)
> ==24616==by 0xC45D183: start_thread (pthread_create.c:312)
> ==24616==by 0xC770FFC: clone (clone.S:111)
> ==24616==  Address 0x1177143e is 93,214 bytes inside a block of size
> 93,215 alloc'd
> ==24616==at 0x4C2A6C5: memalign (vg_replace_malloc.c:727)
> ==24616==by 0x4C2A760: posix_memalign (vg_replace_malloc.c:876)
> ==24616==by 0x11B0C43: av_malloc (mem.c:87)
> ==24616==by 0x11987CC: av_buffer_alloc (buffer.c:72)
> ==24616==by 0x1198831: av_buffer_allocz (buffer.c:85)
> ==24616==by 0x1198F29: pool_alloc_buffer (buffer.c:312)
> ==24616==by 0x1199057: av_buffer_pool_get (buffer.c:349)
> ==24616==by 0x489D6D: ff_frame_pool_get (framepool.c:222)
> ==24616==by 0x58F6EB: ff_default_get_video_buffer (video.c:89)
> ==24616==by 0x58F768: ff_get_video_buffer (video.c:102)
> ==24616==by 0x4F3BF3: geq_filter_frame (vf_geq.c:312)
> ==24616==by 0x472FD0: ff_filter_frame_framed (avfilter.c:1104)
> ==24616==by 0x473800: ff_filter_frame_to_filter (avfilter.c:1252)
> ==24616==by 0x4739F8: ff_filter_activate_default (avfilter.c:1301)
> ==24616==by 0x473C12: ff_filter_activate (avfilter.c:1462)
> ==24616==by 0x478A4F: ff_filter_graph_run_once (avfiltergraph.c:1456)
> ==24616==by 0x478C72: get_frame_internal (buffersink.c:110)
> ==24616==by 0x478CCF: av_buffersink_get_frame_flags (buffersink.c:121)
> ==24616==by 0x441808: lavfi_read_packet (lavfi.c:410)
> ==24616==by 0x7AC315: ff_read_packet (utils.c:822)
> ==24616==
> --24616-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV)
> - exiting
> --24616-- si_code=80;  Faulting address: 0x0;  sp: 0x40a075db0
>
> [...]
>
> --
> 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
>


0001-avfilter-slice-processing-for-geq.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Guess video codec delay based on PTS while parsing MOV header.

2017-11-22 Thread Sasi Inguva
I was just shooting for a heuristic which works for most of the cases.
Most GOP structures are like this in decoding order
PTS:  Pmin ,  Pmax , (Pmin + k) , (Pmin + k -1) ... (Pmin + 1)
,  (Pmin + 2k) , (Pmin + 2k -1) ... (Pmin + k + 1)  (Pmax + 1)
PICT_TYPE: I0 I1   Bk   Bk-1
B0  B2k B2k-1  Bk+1
   I2

The min. buffer size is actually the number of frames that came in between
Pmin and Pmin + 1 ,since the buffer should be able to hold all those frames
(and sort them) , before Pmin + 1 comes along and is output. So here, the
buffer size is "k".

The algo computes the number of decreasing steps from Pmax ->  (Pmin + 1)
=  k . Hence the algo works for this case.

However I realize now that my algo will break,
when Pmin and Pmax are not adjacent
Pmin , *(Pmin + k -1)* , Pmax , (Pmin + k) ,  ... (Pmin + 1) , ...   - The
buffer size is still k but the algo will compute as (k - 1) . e.g.  0, 2,
4, 1, 3

or the path from Pmax -> (Pmin + 1) not strictly decreasing .
Pmin ,  Pmax , (Pmin + k) , (Pmin + k -1), *(Pmin + k +1)*   ... (Pmin +
1)  - The buffer size is now (k + 1) but the algo will still compute as  k
e.g. 0, 4, 2, 3, 1

I can build a better heuristic by finding the  frame with next min. PTS
after Pmin and computing the distance between that frame and Pmin.  However
that will still fail for this example,
 0, 3, 5, 1, 4, 2 . The delay computed will be 2 (because 2 frames between
0 and 1 ) but we need a buffer size of 3 .

On Wed, Nov 22, 2017 at 8:29 AM, Michael Niedermayer  wrote:

> On Mon, Nov 20, 2017 at 08:27:05PM -0800, Sasi Inguva wrote:
> > Signed-off-by: Sasi Inguva 
> > ---
> >  libavformat/mov.c| 50 ++
> ++
> >  tests/fate/mov.mak   |  7 ++
> >  tests/ref/fate/mov-guess-delay-1 |  3 +++
> >  tests/ref/fate/mov-guess-delay-2 |  3 +++
> >  tests/ref/fate/mov-guess-delay-3 |  3 +++
> >  5 files changed, 66 insertions(+)
> >  create mode 100644 tests/ref/fate/mov-guess-delay-1
> >  create mode 100644 tests/ref/fate/mov-guess-delay-2
> >  create mode 100644 tests/ref/fate/mov-guess-delay-3
> >
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index fd170baa57..afb0d4ca5c 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -3213,6 +3213,54 @@ static int64_t add_ctts_entry(MOVStts**
> ctts_data, unsigned int* ctts_count, uns
> >  return *ctts_count;
> >  }
> >
> > +static void mov_guess_video_delay(MOVContext *c, AVStream* st) {
> > +MOVStreamContext *msc = st->priv_data;
> > +int ind;
> > +int ctts_ind = 0;
> > +int ctts_sample = 0;
> > +int64_t curr_pts = AV_NOPTS_VALUE;
> > +int64_t min_prev_pts = AV_NOPTS_VALUE;
> > +int64_t prev_max_pts = AV_NOPTS_VALUE;
> > +int num_steps = 0;
> > +
> > +if (st->codecpar->video_delay <= 0 && msc->ctts_data &&
> > +st->codecpar->codec_id == AV_CODEC_ID_H264) {
> > +st->codecpar->video_delay = 0;
> > +for(ind = 0; ind < st->nb_index_entries && ctts_ind <
> msc->ctts_count; ++ind) {
> > +curr_pts = st->index_entries[ind].timestamp +
> msc->ctts_data[ctts_ind].duration;
> > +
> > +// Everytime we encounter a new max_pts we reset num_steps
> and compute again.
> > +if (curr_pts > prev_max_pts) {
> > +st->codecpar->video_delay = 
> > FFMIN(FFMAX(st->codecpar->video_delay,
> num_steps), 16);
> > +num_steps = 0;
> > +prev_max_pts = curr_pts;
> > +min_prev_pts = curr_pts;
> > +} else {
> > +// Compute delay as the length of the path from max PTS
> to min PTS.
> > +// Frames: I0 I1 B0 B1 B2
> > +// PTS: 0  4  1  2  3 -> num_steps = delay = 1
> (4->1)
> > +//
> > +// Frames: I0 I1 B1 B0 B2
> > +// PTS: 0  4  2  1  3 -> num_steps = delay = 2
> (4->2, 2->1)
> > +if (min_prev_pts != AV_NOPTS_VALUE) {
> > +if (curr_pts < min_prev_pts) {
> > +++num_steps;
> > +min_prev_pts = curr_pts;
> > +}
> > +}
> > +}
>
> Can you explain why this algorithm is correct ?
> (iam asking as i suspect it is not correct, but i may be wrong)
>
> What this should do is find the minimum buffer size to sort the stream
> of frame timestamps.
>
>
> [...]
> --
> 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
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>

[FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: Refactor an inconsistent variable name

2017-11-22 Thread Karthick J
---
 libavformat/hlsenc.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 525605b..611cc99 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1074,7 +1074,7 @@ static int create_master_playlist(AVFormatContext *s,
 AVDictionary *options = NULL;
 unsigned int i, j;
 int m3u8_name_size, ret, bandwidth;
-char *m3U8_rel_name;
+char *m3u8_rel_name;
 
 input_vs->m3u8_created = 1;
 if (!hls->master_m3u8_created) {
@@ -1108,14 +1108,14 @@ static int create_master_playlist(AVFormatContext *s,
 vs = &(hls->var_streams[i]);
 
 m3u8_name_size = strlen(vs->m3u8_name) + 1;
-m3U8_rel_name = av_malloc(m3u8_name_size);
-if (!m3U8_rel_name) {
+m3u8_rel_name = av_malloc(m3u8_name_size);
+if (!m3u8_rel_name) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
-av_strlcpy(m3U8_rel_name, vs->m3u8_name, m3u8_name_size);
+av_strlcpy(m3u8_rel_name, vs->m3u8_name, m3u8_name_size);
 ret = get_relative_url(hls->master_m3u8_url, vs->m3u8_name,
-   m3U8_rel_name, m3u8_name_size);
+   m3u8_rel_name, m3u8_name_size);
 if (ret < 0) {
 av_log(NULL, AV_LOG_ERROR, "Unable to find relative URL\n");
 goto fail;
@@ -1145,7 +1145,7 @@ static int create_master_playlist(AVFormatContext *s,
 if (!bandwidth) {
 av_log(NULL, AV_LOG_WARNING,
 "Bandwidth info not available, set audio and video 
bitrates\n");
-av_freep(_rel_name);
+av_freep(_rel_name);
 continue;
 }
 
@@ -1153,14 +1153,14 @@ static int create_master_playlist(AVFormatContext *s,
 if (vid_st && vid_st->codecpar->width > 0 && vid_st->codecpar->height 
> 0)
 avio_printf(master_pb, ",RESOLUTION=%dx%d", 
vid_st->codecpar->width,
 vid_st->codecpar->height);
-avio_printf(master_pb, "\n%s\n\n", m3U8_rel_name);
+avio_printf(master_pb, "\n%s\n\n", m3u8_rel_name);
 
-av_freep(_rel_name);
+av_freep(_rel_name);
 }
 fail:
 if(ret >=0)
 hls->master_m3u8_created = 1;
-av_freep(_rel_name);
+av_freep(_rel_name);
 ff_format_io_close(s, _pb);
 return ret;
 }
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 1/2] avformat/hlsenc: Minor fix in setting http options for master playlist

2017-11-22 Thread Karthick J
---
 libavformat/hlsenc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 3c47ced..525605b 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1089,8 +1089,7 @@ static int create_master_playlist(AVFormatContext *s,
 return 0;
 }
 
-if (hls->user_agent)
-  av_dict_set(, "user-agent", hls->user_agent, 0);
+set_http_options(s, , hls);
 
 ret = s->io_open(s, _pb, hls->master_m3u8_url, AVIO_FLAG_WRITE,\
  );
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/hlsenc: Minor fix in setting http options for master playlist

2017-11-22 Thread 刘歧

> 在 2017年11月22日,16:08,Karthick J  写道:
> 
> ---
> libavformat/hlsenc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 3c47ced..525605b 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1089,8 +1089,7 @@ static int create_master_playlist(AVFormatContext *s,
> return 0;
> }
> 
> -if (hls->user_agent)
> -  av_dict_set(, "user-agent", hls->user_agent, 0);
> +set_http_options(s, , hls);
> 
> ret = s->io_open(s, _pb, hls->master_m3u8_url, AVIO_FLAG_WRITE,\
>  );
> -- 
> 1.9.1
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

LGTM

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/hlsenc: Modularized playlist creation to allow reuse

2017-11-22 Thread Jeyapal, Karthick
>On 11/22/17, 1:47 PM, "刘歧"  wrote:
>
>> 在 2017年11月22日,14:53,Karthick J  写道:
>> 
>> ---
>> libavformat/hlsenc.c | 130 +++---
>> libavformat/hlsenc.h | 158 
>> +++
>> 2 files changed, 177 insertions(+), 111 deletions(-)
>> create mode 100644 libavformat/hlsenc.h
>> 
[…]
> move the APIs to an C source file, and use ff_ prefix, refer to: 
> https://ffmpeg.org/developer.html#toc-Naming-conventions
Thanks for the reply.
I am not adding it to the API or a global function. 
Those are just ‘static’ utility functions, to allow code reuse. 
The scope will be limited only to those files including hlsenc.h. 
Developer guide states “For file-scope variables and functions declared as 
static, no prefix is required”.
For example, oggdec.h has two static functions without ff_ prefix.

Regards,
Karthick






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


Re: [FFmpeg-devel] [PATCH 1/1] avformat/dashenc: Associate mpd extension with dash muxer

2017-11-22 Thread 刘歧

> 在 2017年11月22日,16:20,Karthick J  写道:
> 
> ---
> libavformat/dashenc.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 201668a..0fee3cd 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -1219,6 +1219,7 @@ static const AVClass dash_class = {
> AVOutputFormat ff_dash_muxer = {
> .name   = "dash",
> .long_name  = NULL_IF_CONFIG_SMALL("DASH Muxer"),
> +.extensions = "mpd",
> .priv_data_size = sizeof(DASHContext),
> .audio_codec= AV_CODEC_ID_AAC,
> .video_codec= AV_CODEC_ID_H264,
> -- 
> 1.9.1
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

LGTM


Thanks

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


[FFmpeg-devel] [PATCH v2 1/2] avformat/hlsenc: Modularized playlist creation to allow reuse

2017-11-22 Thread Karthick J
---
 libavformat/hlsenc.c | 237 +++
 libavformat/hlsenc.h |  67 +++
 2 files changed, 193 insertions(+), 111 deletions(-)
 create mode 100644 libavformat/hlsenc.h

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 3c47ced..d5b1b98 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -45,6 +45,7 @@
 
 #include "avformat.h"
 #include "avio_internal.h"
+#include "hlsenc.h"
 #include "internal.h"
 #include "os_support.h"
 
@@ -73,35 +74,11 @@ typedef struct HLSSegment {
 struct HLSSegment *next;
 } HLSSegment;
 
-typedef enum HLSFlags {
-// Generate a single media file and use byte ranges in the playlist.
-HLS_SINGLE_FILE = (1 << 0),
-HLS_DELETE_SEGMENTS = (1 << 1),
-HLS_ROUND_DURATIONS = (1 << 2),
-HLS_DISCONT_START = (1 << 3),
-HLS_OMIT_ENDLIST = (1 << 4),
-HLS_SPLIT_BY_TIME = (1 << 5),
-HLS_APPEND_LIST = (1 << 6),
-HLS_PROGRAM_DATE_TIME = (1 << 7),
-HLS_SECOND_LEVEL_SEGMENT_INDEX = (1 << 8), // include segment index in 
segment filenames when use_localtime  e.g.: %%03d
-HLS_SECOND_LEVEL_SEGMENT_DURATION = (1 << 9), // include segment duration 
(microsec) in segment filenames when use_localtime  e.g.: %%09t
-HLS_SECOND_LEVEL_SEGMENT_SIZE = (1 << 10), // include segment size (bytes) 
in segment filenames when use_localtime  e.g.: %%014s
-HLS_TEMP_FILE = (1 << 11),
-HLS_PERIODIC_REKEY = (1 << 12),
-} HLSFlags;
-
 typedef enum {
 SEGMENT_TYPE_MPEGTS,
 SEGMENT_TYPE_FMP4,
 } SegmentType;
 
-typedef enum {
-PLAYLIST_TYPE_NONE,
-PLAYLIST_TYPE_EVENT,
-PLAYLIST_TYPE_VOD,
-PLAYLIST_TYPE_NB,
-} PlaylistType;
-
 typedef struct VariantStream {
 unsigned number;
 int64_t sequence;
@@ -206,6 +183,113 @@ typedef struct HLSContext {
 unsigned int master_publish_rate;
 } HLSContext;
 
+void ff_hls_write_playlist_version(AVIOContext *out, int version) {
+if (!out)
+return;
+avio_printf(out, "#EXTM3U\n");
+avio_printf(out, "#EXT-X-VERSION:%d\n", version);
+}
+
+void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
+  int bandwidth, char *filename) {
+if (!out || !filename)
+return;
+
+if (!bandwidth) {
+av_log(NULL, AV_LOG_WARNING,
+"Bandwidth info not available, set audio and video 
bitrates\n");
+return;
+}
+
+avio_printf(out, "#EXT-X-STREAM-INF:BANDWIDTH=%d", bandwidth);
+if (st && st->codecpar->width > 0 && st->codecpar->height > 0)
+avio_printf(out, ",RESOLUTION=%dx%d", st->codecpar->width,
+st->codecpar->height);
+avio_printf(out, "\n%s\n\n", filename);
+}
+
+void ff_hls_write_playlist_header(AVIOContext *out, int version, int 
allowcache,
+  int target_duration, int64_t sequence,
+  uint32_t playlist_type) {
+if (!out)
+return;
+ff_hls_write_playlist_version(out, version);
+if (allowcache == 0 || allowcache == 1) {
+avio_printf(out, "#EXT-X-ALLOW-CACHE:%s\n", allowcache == 0 ? "NO" : 
"YES");
+}
+avio_printf(out, "#EXT-X-TARGETDURATION:%d\n", target_duration);
+avio_printf(out, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence);
+av_log(NULL, AV_LOG_VERBOSE, "EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence);
+
+if (playlist_type == PLAYLIST_TYPE_EVENT) {
+avio_printf(out, "#EXT-X-PLAYLIST-TYPE:EVENT\n");
+} else if (playlist_type == PLAYLIST_TYPE_VOD) {
+avio_printf(out, "#EXT-X-PLAYLIST-TYPE:VOD\n");
+}
+}
+
+void ff_hls_write_init_file(AVIOContext *out, char *filename,
+int byterange_mode, int64_t size, int64_t pos) {
+avio_printf(out, "#EXT-X-MAP:URI=\"%s\"", filename);
+if (byterange_mode) {
+avio_printf(out, ",BYTERANGE=\"%"PRId64"@%"PRId64"\"", size, pos);
+}
+avio_printf(out, "\n");
+}
+
+void ff_hls_write_file_entry(AVIOContext *out, int insert_discont,
+int byterange_mode, uint32_t flags, double 
duration,
+int64_t size, int64_t pos, //Used only if 
HLS_SINGLE_FILE flag is set
+char *baseurl, //Ignored if NULL
+char *filename, double *prog_date_time) {
+if (!out || !filename)
+return;
+
+if (insert_discont) {
+avio_printf(out, "#EXT-X-DISCONTINUITY\n");
+}
+if (flags & HLS_ROUND_DURATIONS)
+avio_printf(out, "#EXTINF:%ld,\n",  lrint(duration));
+else
+avio_printf(out, "#EXTINF:%f,\n", duration);
+if (byterange_mode)
+avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", size, pos);
+
+if ((flags & HLS_PROGRAM_DATE_TIME) && prog_date_time) {
+time_t tt, wrongsecs;
+int milli;
+struct tm *tm, tmpbuf;
+char buf0[128], buf1[128];
+tt = (int64_t)prog_date_time;
+milli = 

[FFmpeg-devel] [PATCH v2 2/2] avformat/dashenc: Option to generate hls playlist as well

2017-11-22 Thread Karthick J
This is to take full advantage of Common Media Application Format.
Now server can generate one content and serve both HLS and DASH players.
---
 doc/muxers.texi   |   3 ++
 libavformat/dashenc.c | 102 --
 2 files changed, 101 insertions(+), 4 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 0bb8ad2..1cf2481 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -249,6 +249,9 @@ DASH-templated name to used for the media segments. Default 
is "chunk-stream$Rep
 URL of the page that will return the UTC timestamp in ISO format. Example: 
"https://time.akamai.com/?iso;
 @item -http_user_agent @var{user_agent}
 Override User-Agent field in HTTP header. Applicable only for HTTP output.
+@item -hls_playlist @var{hls_playlist}
+Generate HLS playlist files as well. The master playlist is generated with the 
filename master.m3u8.
+One media playlist file is generated for each stream with filenames 
media_0.m3u8, media_1.m3u8, etc.
 @item -adaptation_sets @var{adaptation_sets}
 Assign streams to AdaptationSets. Syntax is "id=x,streams=a,b,c 
id=y,streams=d,e" with x and y being the IDs
 of the adaptation sets and a,b,c,d and e are the indices of the mapped streams.
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 201668a..4c3962a 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -36,6 +36,7 @@
 #include "avc.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "hlsenc.h"
 #include "internal.h"
 #include "isom.h"
 #include "os_support.h"
@@ -101,6 +102,8 @@ typedef struct DASHContext {
 const char *media_seg_name;
 const char *utc_timing_url;
 const char *user_agent;
+int hls_playlist;
+int master_playlist_created;
 } DASHContext;
 
 static struct codec_string {
@@ -217,6 +220,13 @@ static void set_http_options(AVDictionary **options, 
DASHContext *c)
 av_dict_set(options, "user_agent", c->user_agent, 0);
 }
 
+static void get_hls_playlist_name(char *playlist_name, const char *base_url, 
int id) {
+if (base_url)
+sprintf(playlist_name, "%smedia_%d.m3u8", base_url, id);
+else
+sprintf(playlist_name, "media_%d.m3u8", id);
+}
+
 static int flush_init_segment(AVFormatContext *s, OutputStream *os)
 {
 DASHContext *c = s->priv_data;
@@ -262,7 +272,8 @@ static void dash_free(AVFormatContext *s)
 av_freep(>streams);
 }
 
-static void output_segment_list(OutputStream *os, AVIOContext *out, 
DASHContext *c)
+static void output_segment_list(OutputStream *os, AVIOContext *out, 
DASHContext *c,
+int representation_id, int final)
 {
 int i, start_index = 0, start_number = 1;
 if (c->window_size) {
@@ -322,6 +333,54 @@ static void output_segment_list(OutputStream *os, 
AVIOContext *out, DASHContext
 }
 avio_printf(out, "\t\t\t\t\n");
 }
+if (c->hls_playlist && start_index < os->nb_segments)
+{
+int timescale = os->ctx->streams[0]->time_base.den;
+char temp_filename_hls[1024];
+char filename_hls[1024];
+AVIOContext *out_hls = NULL;
+AVDictionary *http_opts = NULL;
+int target_duration = 0;
+const char *proto = avio_find_protocol_name(c->dirname);
+int use_rename = proto && !strcmp(proto, "file");
+
+get_hls_playlist_name(filename_hls, c->dirname, representation_id);
+
+snprintf(temp_filename_hls, sizeof(temp_filename_hls), use_rename ? 
"%s.tmp" : "%s", filename_hls);
+
+set_http_options(_opts, c);
+avio_open2(_hls, temp_filename_hls, AVIO_FLAG_WRITE, NULL, 
_opts);
+av_dict_free(_opts);
+for (i = start_index; i < os->nb_segments; i++) {
+Segment *seg = os->segments[i];
+if (target_duration < seg->duration)
+target_duration = seg->duration;
+}
+target_duration = lrint((double) target_duration / timescale);
+
+ff_hls_write_playlist_header(out_hls, 6, -1, target_duration,
+ start_number, PLAYLIST_TYPE_NONE);
+
+ff_hls_write_init_file(out_hls, os->initfile, c->single_file,
+   os->init_range_length, os->init_start_pos);
+
+for (i = start_index; i < os->nb_segments; i++) {
+Segment *seg = os->segments[i];
+ff_hls_write_file_entry(out_hls, 0, c->single_file, 0,
+(double) seg->duration / timescale,
+seg->range_length, seg->start_pos, NULL,
+c->single_file ? os->initfile : seg->file,
+NULL);
+}
+
+if (final)
+ff_hls_write_end_list(out_hls);
+
+avio_close(out_hls);
+if (use_rename)
+avpriv_io_move(temp_filename_hls, filename_hls);
+}
+
 }
 
 static char *xmlescape(const char *str) {
@@ -391,7 +450,8 @@ static void 

Re: [FFmpeg-devel] [PATCH 1/2] avformat/hlsenc: Modularized playlist creation to allow reuse

2017-11-22 Thread 刘歧

> 在 2017年11月22日,14:53,Karthick J  写道:
> 
> ---
> libavformat/hlsenc.c | 130 +++---
> libavformat/hlsenc.h | 158 +++
> 2 files changed, 177 insertions(+), 111 deletions(-)
> create mode 100644 libavformat/hlsenc.h
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 3c47ced..4e017eb 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -45,6 +45,7 @@
> 
> #include "avformat.h"
> #include "avio_internal.h"
> +#include "hlsenc.h"
> #include "internal.h"
> #include "os_support.h"
> 
> @@ -73,35 +74,11 @@ typedef struct HLSSegment {
> struct HLSSegment *next;
> } HLSSegment;
> 
> -typedef enum HLSFlags {
> -// Generate a single media file and use byte ranges in the playlist.
> -HLS_SINGLE_FILE = (1 << 0),
> -HLS_DELETE_SEGMENTS = (1 << 1),
> -HLS_ROUND_DURATIONS = (1 << 2),
> -HLS_DISCONT_START = (1 << 3),
> -HLS_OMIT_ENDLIST = (1 << 4),
> -HLS_SPLIT_BY_TIME = (1 << 5),
> -HLS_APPEND_LIST = (1 << 6),
> -HLS_PROGRAM_DATE_TIME = (1 << 7),
> -HLS_SECOND_LEVEL_SEGMENT_INDEX = (1 << 8), // include segment index in 
> segment filenames when use_localtime  e.g.: %%03d
> -HLS_SECOND_LEVEL_SEGMENT_DURATION = (1 << 9), // include segment 
> duration (microsec) in segment filenames when use_localtime  e.g.: %%09t
> -HLS_SECOND_LEVEL_SEGMENT_SIZE = (1 << 10), // include segment size 
> (bytes) in segment filenames when use_localtime  e.g.: %%014s
> -HLS_TEMP_FILE = (1 << 11),
> -HLS_PERIODIC_REKEY = (1 << 12),
> -} HLSFlags;
> -
> typedef enum {
> SEGMENT_TYPE_MPEGTS,
> SEGMENT_TYPE_FMP4,
> } SegmentType;
> 
> -typedef enum {
> -PLAYLIST_TYPE_NONE,
> -PLAYLIST_TYPE_EVENT,
> -PLAYLIST_TYPE_VOD,
> -PLAYLIST_TYPE_NB,
> -} PlaylistType;
> -
> typedef struct VariantStream {
> unsigned number;
> int64_t sequence;
> @@ -1022,19 +999,6 @@ static void hls_free_segments(HLSSegment *p)
> }
> }
> 
> -static void write_m3u8_head_block(HLSContext *hls, AVIOContext *out, int 
> version,
> -  int target_duration, int64_t sequence)
> -{
> -avio_printf(out, "#EXTM3U\n");
> -avio_printf(out, "#EXT-X-VERSION:%d\n", version);
> -if (hls->allowcache == 0 || hls->allowcache == 1) {
> -avio_printf(out, "#EXT-X-ALLOW-CACHE:%s\n", hls->allowcache == 0 ? 
> "NO" : "YES");
> -}
> -avio_printf(out, "#EXT-X-TARGETDURATION:%d\n", target_duration);
> -avio_printf(out, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence);
> -av_log(hls, AV_LOG_VERBOSE, "EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", 
> sequence);
> -}
> -
> static void hls_rename_temp_file(AVFormatContext *s, AVFormatContext *oc)
> {
> size_t len = strlen(oc->filename);
> @@ -1101,8 +1065,7 @@ static int create_master_playlist(AVFormatContext *s,
> goto fail;
> }
> 
> -avio_printf(master_pb, "#EXTM3U\n");
> -avio_printf(master_pb, "#EXT-X-VERSION:%d\n", hls->version);
> +hls_write_playlist_version(master_pb, hls->version);
> 
> /* For variant streams with video add #EXT-X-STREAM-INF tag with 
> attributes*/
> for (i = 0; i < hls->nb_varstreams; i++) {
> @@ -1143,18 +1106,7 @@ static int create_master_playlist(AVFormatContext *s,
> bandwidth += aud_st->codecpar->bit_rate;
> bandwidth += bandwidth / 10;
> 
> -if (!bandwidth) {
> -av_log(NULL, AV_LOG_WARNING,
> -"Bandwidth info not available, set audio and video 
> bitrates\n");
> -av_freep(_rel_name);
> -continue;
> -}
> -
> -avio_printf(master_pb, "#EXT-X-STREAM-INF:BANDWIDTH=%d", bandwidth);
> -if (vid_st && vid_st->codecpar->width > 0 && 
> vid_st->codecpar->height > 0)
> -avio_printf(master_pb, ",RESOLUTION=%dx%d", 
> vid_st->codecpar->width,
> -vid_st->codecpar->height);
> -avio_printf(master_pb, "\n%s\n\n", m3U8_rel_name);
> +hls_write_stream_info(vid_st, master_pb, bandwidth, m3U8_rel_name);
> 
> av_freep(_rel_name);
> }
> @@ -1209,12 +1161,8 @@ static int hls_window(AVFormatContext *s, int last, 
> VariantStream *vs)
> }
> 
> vs->discontinuity_set = 0;
> -write_m3u8_head_block(hls, out, hls->version, target_duration, sequence);
> -if (hls->pl_type == PLAYLIST_TYPE_EVENT) {
> -avio_printf(out, "#EXT-X-PLAYLIST-TYPE:EVENT\n");
> -} else if (hls->pl_type == PLAYLIST_TYPE_VOD) {
> -avio_printf(out, "#EXT-X-PLAYLIST-TYPE:VOD\n");
> -}
> +hls_write_playlist_header(out, hls->version, hls->allowcache,
> +  target_duration, sequence, hls->pl_type);
> 
> if((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && 
> vs->discontinuity_set==0 ){
> avio_printf(out, "#EXT-X-DISCONTINUITY\n");
> @@ -1231,74 +1179,34 @@ static int hls_window(AVFormatContext *s, int last, 
> 

Re: [FFmpeg-devel] [PATCH] Add FAQs about running in background (rev 2)

2017-11-22 Thread Jim DeLaHunt
Ping. This patch responds to review comments, and there have been no 
further comments for a week. Could someone commit it please?


Thanks,
  —Jim DeLaHunt


On 2017-11-15 00:43, Jim DeLaHunt wrote:

Add two FAQs about running FFmpeg in the background.
The first explains the use of the -nostdin option in
a straightforward way. Text revised based on review.

The second FAQ starts from a confusing error message,
and leads to the solution, use of the -nostdin option.
The purpose of the second FAQ is to attract web searches
from people having the problem, and offer them a solution.

Add an anchor to the Main Options section of the ffmpeg
documentation, so that the FAQs can link directly there.
---
  doc/faq.texi| 65 +
  doc/ffmpeg.texi |  1 +
  2 files changed, 66 insertions(+)

diff --git a/doc/faq.texi b/doc/faq.texi
index dcaf89c6d2..73624c647e 100644
--- a/doc/faq.texi
+++ b/doc/faq.texi
@@ -501,6 +501,71 @@ ffmpeg -i ega_screen.nut -vf setdar=4/3 
ega_screen_anamorphic.nut
  ffmpeg -i ega_screen.nut -aspect 4/3 -c copy ega_screen_overridden.nut
  @end example
  
+@anchor{background task}

+@section How do I run ffmpeg as a background task?
+
+ffmpeg normally checks the console input, for entries like "q" to stop
+and "?" to give help, while performing operations. ffmpeg does not have a way 
of
+detecting when it is running as a background task.
+When it checks the console input, that can cause the process running ffmpeg
+in the background to suspend.
+
+To prevent those input checks, allowing ffmpeg to run as a background task,
+use the @url{ffmpeg.html#stdin-option, @code{-nostdin} option}
+in the ffmpeg invocation. This is effective whether you run ffmpeg in a shell
+or invoke ffmpeg in its own process via an operating system API.
+
+As an alternative, when you are running ffmpeg in a shell, you can redirect
+standard input to @code{/dev/null} (on Linux and Mac OS)
+or @code{NUL} (on Windows). You can do this redirect either
+on the ffmpeg invocation, or from a shell script which calls ffmpeg.
+
+For example:
+
+@example
+ffmpeg -nostdin -i INPUT OUTPUT
+@end example
+
+or (on Linux, Mac OS, and other UNIX-like shells):
+
+@example
+ffmpeg -i INPUT OUTPUT  ~/tmp/log.txt &
+[1] 93352
+%
+[1]  + suspended (tty output)  ffmpeg -i INPUT OUTPUT &>
+@end example
+
+The message "tty output" notwithstanding, the problem here is that
+ffmpeg normally checks the console input when it runs. The operating system
+detects this, and suspends the process until you can bring it to the
+foreground and attend to it.
+
+The solution is to use the right techniques to tell ffmpeg not to consult
+console input. You can use the
+@url{ffmpeg.html#stdin-option, @code{-nostdin} option},
+or redirect standard input with @code{< /dev/null}.
+See FAQ
+@ref{background task, @emph{How do I run ffmpeg as a background task?}}
+for details.
+
  @chapter Development
  
  @section Are there examples illustrating how to use the FFmpeg libraries, particularly libavcodec and libavformat?

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 7db80ebf6a..2bcad75973 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -470,6 +470,7 @@ the encoding process. It is made of "@var{key}=@var{value}" 
lines. @var{key}
  consists of only alphanumeric characters. The last key of a sequence of
  progress information is always "progress".
  
+@anchor{stdin option}

  @item -stdin
  Enable interaction on standard input. On by default unless standard input is
  used as an input. To explicitly disable interaction you need to specify


--
--Jim DeLaHunt, j...@jdlh.com http://blog.jdlh.com/ (http://jdlh.com/)
  multilingual websites consultant

  355-1027 Davie St, Vancouver BC V6E 4L2, Canada
 Canada mobile +1-604-376-8953

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


Re: [FFmpeg-devel] [mov] Fix trampling of ctts during seeks when sidx support is enabled.

2017-11-22 Thread Carl Eugen Hoyos
2017-11-23 1:30 GMT+01:00 John Stebbins :
> On 11/22/2017 02:36 PM, Carl Eugen Hoyos wrote:
>> 2017-08-24 0:39 GMT+02:00 Dale Curtis :
>>
>>> -sc->ctts_data[ctts_count].count= count;
>>> -sc->ctts_data[ctts_count].duration = duration;
>>> -ctts_count++;
>>> +/* Expand entries such that we have a 1-1 mapping with samples. */
>>> +for (j = 0; j < count; j++)
>>> +add_ctts_entry(>ctts_data, _count, 
>>> >ctts_allocated_size, 1, duration);
>> count is a 32bit value read from the file, so this hunk makes
>> the demuxer allocate huge amount of memories for some
>> files.
>>
>> Is there an upper limit for count?
>
> In practice, if a valid mp4 blows up due to this ctts allocation,
> it's also going to blow up when AVIndexEntries is allocated
> for the samples.

> An invalid mp4 can do anything of course.

This is about invalid files allocating >1GB.

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


[FFmpeg-devel] [PATCH 1/3] avformat/hlsenc:addition of #EXT-X-MEDIA tag and AUDIO attribute

2017-11-22 Thread vdixit
From: Vishwanath Dixit 

Signed-off-by: Karthick J 
---
 doc/muxers.texi  | 12 ++
 libavformat/hlsenc.c | 63 ++--
 2 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 0bb8ad2..60b2eb4 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -827,6 +827,18 @@ be a video only stream with video bitrate 1000k, the 
second variant stream will
 be an audio only stream with bitrate 64k and the third variant stream will be a
 video only stream with bitrate 256k. Here, three media playlist with file names
 out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created.
+@example
+ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k  \
+  -map 0:a -map 0:a -map 0:v -map 0:v -f hls \
+  -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low 
v:1,agroup:aud_high" \
+  -master_pl_name master.m3u8 \
+  http://example.com/live/out.m3u8
+@end example
+This example creates two audio only and two video only variant streams. In
+addition to the #EXT-X-STREAM-INF tag for each variant stream in the master
+playlist, #EXT-X-MEDIA tag is also added for the two audio only variant streams
+and they are mapped to the two video only variant streams with audio group 
names
+'aud_low' and 'aud_high'.
 
 By default, a single hls variant containing all the encoded streams is created.
 
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 3c47ced..9fed6a3 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -146,6 +146,7 @@ typedef struct VariantStream {
 AVStream **streams;
 unsigned int nb_streams;
 int m3u8_created; /* status of media play-list creation */
+char *agroup; /* audio group name */
 char *baseurl;
 } VariantStream;
 
@@ -1068,7 +1069,7 @@ static int create_master_playlist(AVFormatContext *s,
   VariantStream * const input_vs)
 {
 HLSContext *hls = s->priv_data;
-VariantStream *vs;
+VariantStream *vs, *temp_vs;
 AVStream *vid_st, *aud_st;
 AVIOContext *master_pb = 0;
 AVDictionary *options = NULL;
@@ -1104,6 +1105,34 @@ static int create_master_playlist(AVFormatContext *s,
 avio_printf(master_pb, "#EXTM3U\n");
 avio_printf(master_pb, "#EXT-X-VERSION:%d\n", hls->version);
 
+/* For audio only variant streams add #EXT-X-MEDIA tag with attributes*/
+for (i = 0; i < hls->nb_varstreams; i++) {
+vs = &(hls->var_streams[i]);
+
+if (vs->has_video || vs->has_subtitle || !vs->agroup)
+continue;
+
+m3u8_name_size = strlen(vs->m3u8_name) + 1;
+m3U8_rel_name = av_malloc(m3u8_name_size);
+if (!m3U8_rel_name) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+av_strlcpy(m3U8_rel_name, vs->m3u8_name, m3u8_name_size);
+ret = get_relative_url(hls->master_m3u8_url, vs->m3u8_name,
+   m3U8_rel_name, m3u8_name_size);
+if (ret < 0) {
+av_log(NULL, AV_LOG_ERROR, "Unable to find relative URL\n");
+goto fail;
+}
+
+avio_printf(master_pb, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"",
+vs->agroup);
+avio_printf(master_pb, ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n",
+m3U8_rel_name);
+av_freep(_rel_name);
+}
+
 /* For variant streams with video add #EXT-X-STREAM-INF tag with 
attributes*/
 for (i = 0; i < hls->nb_varstreams; i++) {
 vs = &(hls->var_streams[i]);
@@ -1136,6 +1165,25 @@ static int create_master_playlist(AVFormatContext *s,
 continue;
 }
 
+/**
+ * Traverse through the list of audio only rendition streams and find
+ * the rendition which has highest bitrate in the same audio group
+ */
+if (vs->agroup) {
+for (j = 0; j < hls->nb_varstreams; j++) {
+temp_vs = &(hls->var_streams[j]);
+if (!temp_vs->has_video && !temp_vs->has_subtitle &&
+temp_vs->agroup &&
+!strcmp(temp_vs->agroup, vs->agroup)) {
+if (!aud_st)
+aud_st = temp_vs->streams[0];
+if (temp_vs->streams[0]->codecpar->bit_rate >
+aud_st->codecpar->bit_rate)
+aud_st = temp_vs->streams[0];
+}
+}
+}
+
 bandwidth = 0;
 if (vid_st)
 bandwidth += vid_st->codecpar->bit_rate;
@@ -1154,6 +1202,10 @@ static int create_master_playlist(AVFormatContext *s,
 if (vid_st && vid_st->codecpar->width > 0 && vid_st->codecpar->height 
> 0)
 avio_printf(master_pb, ",RESOLUTION=%dx%d", 
vid_st->codecpar->width,
 vid_st->codecpar->height);
+
+if (vs->agroup && aud_st)
+avio_printf(master_pb, 

Re: [FFmpeg-devel] [PATCH] Refactor Developer Docs, update dev list section

2017-11-22 Thread Carl Eugen Hoyos
2017-11-22 15:03 GMT+01:00 Derek Buitenhuis :
> On 11/21/2017 11:40 PM, Carl Eugen Hoyos wrote:
>> I am against removing this paragraph.
>
> He specifically asked if it was required of new developers to subscribe
> to this list, in a separate thread, earlier[1]. Paul explicitly said it
> was *not* required[2], Timo said no discussion happens on the list[3],
> and you gave a two word reply[4] that was completely devoid of actual
> information.
>
> You can see how this may have given Jim a different impression.
>
> Please, can we not be so abrasive and inconsistent with new contributers?
> It's shameful.

Lol, I completely agree.

Please understand I am against removing the paragraph from the
documentation because I believe it is a good idea if developers
are subscribed to -cvslog.

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


Re: [FFmpeg-devel] [PATCH 00/15] OpenCL infrastructure, filters

2017-11-22 Thread Mark Thompson
On 22/11/17 00:59, Carl Eugen Hoyos wrote:
> 2017-11-22 1:30 GMT+01:00 Mark Thompson :
>> On 14/11/17 19:47, Mark Thompson wrote:
>>> Changes since the last time this was posted:
>>> * Add unsharp filter (to replace existing unsharp).
>>> * Remove old experimental API.
>>> * Miscellaneous fixes.
>>>
>>> Now also tested with AMD OpenCL on Windows (DXVA2
>>> mapping works nicely, D3D11 does not because it wants
>>> the Intel extension for NV12 support).
>>
>> I have approval for this from James and Rostislav (via IRC).
> 
> I don't exactly why vhook was removed but I would prefer
> if this patch would be approved on the mailing list.

Set pushed, minus the program_opencl filter.  Can you further explain your 
concerns about it?

Thanks,

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


Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

2017-11-22 Thread Mark Thompson
On 22/11/17 22:53, Philip Langdale wrote:
> On Wed, 22 Nov 2017 23:36:23 +0100
> Timo Rothenpieler  wrote:
> 
 I'd like to look through it again and test a bit more (will try to
 do so tomorrow, certainly by the end of the week), but I think it
 should be ready to commit with the external header removed.  
>>>
>>> Are you planning to remove Nvidia headers as well?  
>>
>> No, I am very much against this.
>> And others have also voiced against that.
>>
>> Also, I don't see a problem with including this AMD header. It very
>> much increases the accessibility and maintainability(no need to watch
>> out for potential breaking upstream changes, however likely that
>> might be). Having those vendor-specific hwaccels enabled in otherwise
>> generic builds gives a lot of people easy access, or access at all.
>>
>> It also might make them potential usage candidates for browsers, no
>> idea how their weird lawyer-code-review system works though, and if
>> it has any impact to avoid external dependencies.
>>
> 
> I feel the same way; I'm fine with the header in-tree.

Well, why should this external header be in the ffmpeg tree?

In my opinion indiscriminately placing upstream headers in the tree is just not 
what we want to do:
* It increases the maintenance burden, because upstream changes need to be 
checked and then reflected locally.
* Breaking changes are completely fatal - we have to choose one side or the 
other of the change and abandon the other completely.
* It makes it harder for users to build against different versions which they 
may have (especially for users who may want to stick with older versions they 
have verified for their use-cases).
* It makes it harder to developers to modify code on either side of the API, 
because more places have to be updated.

And what is the benefit?  A minor convenience gain for users who can't be 
bothered to get the headers themselves in the same way that they do for every 
other external package they use.  I don't think that's worth it.

(For comparison, including the Nvidia headers allows the stuff there to be 
built at all in the face of a hostile upstream.  That's quite different to a 
minor convenience gain.)

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


[FFmpeg-devel] [PATCH v3 2/2] avformat/dashenc: Option to generate hls playlist as well

2017-11-22 Thread Karthick J
This is to take full advantage of Common Media Application Format.
Now server can generate one content and serve both HLS and DASH players.
---
 doc/muxers.texi   |   3 ++
 libavformat/dashenc.c | 103 --
 2 files changed, 102 insertions(+), 4 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 0bb8ad2..1cf2481 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -249,6 +249,9 @@ DASH-templated name to used for the media segments. Default 
is "chunk-stream$Rep
 URL of the page that will return the UTC timestamp in ISO format. Example: 
"https://time.akamai.com/?iso;
 @item -http_user_agent @var{user_agent}
 Override User-Agent field in HTTP header. Applicable only for HTTP output.
+@item -hls_playlist @var{hls_playlist}
+Generate HLS playlist files as well. The master playlist is generated with the 
filename master.m3u8.
+One media playlist file is generated for each stream with filenames 
media_0.m3u8, media_1.m3u8, etc.
 @item -adaptation_sets @var{adaptation_sets}
 Assign streams to AdaptationSets. Syntax is "id=x,streams=a,b,c 
id=y,streams=d,e" with x and y being the IDs
 of the adaptation sets and a,b,c,d and e are the indices of the mapped streams.
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 201668a..3fd1ef3 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -36,6 +36,7 @@
 #include "avc.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "hlsenc.h"
 #include "internal.h"
 #include "isom.h"
 #include "os_support.h"
@@ -101,6 +102,8 @@ typedef struct DASHContext {
 const char *media_seg_name;
 const char *utc_timing_url;
 const char *user_agent;
+int hls_playlist;
+int master_playlist_created;
 } DASHContext;
 
 static struct codec_string {
@@ -217,6 +220,14 @@ static void set_http_options(AVDictionary **options, 
DASHContext *c)
 av_dict_set(options, "user_agent", c->user_agent, 0);
 }
 
+static void get_hls_playlist_name(char *playlist_name, int string_size,
+  const char *base_url, int id) {
+if (base_url)
+snprintf(playlist_name, string_size, "%smedia_%d.m3u8", base_url, id);
+else
+snprintf(playlist_name, string_size, "media_%d.m3u8", id);
+}
+
 static int flush_init_segment(AVFormatContext *s, OutputStream *os)
 {
 DASHContext *c = s->priv_data;
@@ -262,7 +273,8 @@ static void dash_free(AVFormatContext *s)
 av_freep(>streams);
 }
 
-static void output_segment_list(OutputStream *os, AVIOContext *out, 
DASHContext *c)
+static void output_segment_list(OutputStream *os, AVIOContext *out, 
DASHContext *c,
+int representation_id, int final)
 {
 int i, start_index = 0, start_number = 1;
 if (c->window_size) {
@@ -322,6 +334,55 @@ static void output_segment_list(OutputStream *os, 
AVIOContext *out, DASHContext
 }
 avio_printf(out, "\t\t\t\t\n");
 }
+if (c->hls_playlist && start_index < os->nb_segments)
+{
+int timescale = os->ctx->streams[0]->time_base.den;
+char temp_filename_hls[1024];
+char filename_hls[1024];
+AVIOContext *out_hls = NULL;
+AVDictionary *http_opts = NULL;
+int target_duration = 0;
+const char *proto = avio_find_protocol_name(c->dirname);
+int use_rename = proto && !strcmp(proto, "file");
+
+get_hls_playlist_name(filename_hls, sizeof(filename_hls),
+  c->dirname, representation_id);
+
+snprintf(temp_filename_hls, sizeof(temp_filename_hls), use_rename ? 
"%s.tmp" : "%s", filename_hls);
+
+set_http_options(_opts, c);
+avio_open2(_hls, temp_filename_hls, AVIO_FLAG_WRITE, NULL, 
_opts);
+av_dict_free(_opts);
+for (i = start_index; i < os->nb_segments; i++) {
+Segment *seg = os->segments[i];
+if (target_duration < seg->duration)
+target_duration = seg->duration;
+}
+target_duration = lrint((double) target_duration / timescale);
+
+ff_hls_write_playlist_header(out_hls, 6, -1, target_duration,
+ start_number, PLAYLIST_TYPE_NONE);
+
+ff_hls_write_init_file(out_hls, os->initfile, c->single_file,
+   os->init_range_length, os->init_start_pos);
+
+for (i = start_index; i < os->nb_segments; i++) {
+Segment *seg = os->segments[i];
+ff_hls_write_file_entry(out_hls, 0, c->single_file, 0,
+(double) seg->duration / timescale,
+seg->range_length, seg->start_pos, NULL,
+c->single_file ? os->initfile : seg->file,
+NULL);
+}
+
+if (final)
+ff_hls_write_end_list(out_hls);
+
+avio_close(out_hls);
+if (use_rename)
+

[FFmpeg-devel] [PATCH] Download dash content with byte range info

2017-11-22 Thread Colin NG
---
 libavformat/dashdec.c | 38 --
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 0e3afd2..3798649 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -522,6 +522,24 @@ static enum AVMediaType get_content_type(xmlNodePtr node)
 return type;
 }
 
+static struct fragment * get_Fragment(char *range)
+{
+struct fragment * seg =  av_mallocz(sizeof(struct fragment));
+
+if (!seg)
+return NULL;
+
+seg->size = -1;
+if (range)  {
+char *str_end_offset;
+char *str_offset = av_strtok(range, "-", _end_offset);
+seg->url_offset = strtoll(str_offset, NULL, 10);
+seg->size = strtoll(str_end_offset, NULL, 10) -seg->url_offset;
+}
+
+return seg;
+}
+
 static int parse_manifest_segmenturlnode(AVFormatContext *s, struct 
representation *rep,
  xmlNodePtr fragmenturl_node,
  xmlNodePtr *baseurl_nodes,
@@ -530,33 +548,40 @@ static int parse_manifest_segmenturlnode(AVFormatContext 
*s, struct representati
 {
 char *initialization_val = NULL;
 char *media_val = NULL;
+char *range_val = NULL;
 
 if (!av_strcasecmp(fragmenturl_node->name, (const char 
*)"Initialization")) {
 initialization_val = xmlGetProp(fragmenturl_node, "sourceURL");
-if (initialization_val) {
-rep->init_section = av_mallocz(sizeof(struct fragment));
+range_val = xmlGetProp(fragmenturl_node, "range");
+if (initialization_val || range_val) {
+rep->init_section = get_Fragment(range_val);
 if (!rep->init_section) {
 xmlFree(initialization_val);
+xmlFree(range_val);
 return AVERROR(ENOMEM);
 }
 rep->init_section->url = get_content_url(baseurl_nodes, 4,
  rep_id_val,
  rep_bandwidth_val,
  initialization_val);
+
 if (!rep->init_section->url) {
 av_free(rep->init_section);
 xmlFree(initialization_val);
+xmlFree(range_val);
 return AVERROR(ENOMEM);
 }
-rep->init_section->size = -1;
 xmlFree(initialization_val);
+xmlFree(range_val);
 }
 } else if (!av_strcasecmp(fragmenturl_node->name, (const char 
*)"SegmentURL")) {
 media_val = xmlGetProp(fragmenturl_node, "media");
-if (media_val) {
-struct fragment *seg = av_mallocz(sizeof(struct fragment));
+range_val = xmlGetProp(fragmenturl_node, "mediaRange");
+if (media_val || range_val) {
+struct fragment *seg =  get_Fragment(range_val);
 if (!seg) {
 xmlFree(media_val);
+xmlFree(range_val);
 return AVERROR(ENOMEM);
 }
 seg->url = get_content_url(baseurl_nodes, 4,
@@ -566,11 +591,12 @@ static int parse_manifest_segmenturlnode(AVFormatContext 
*s, struct representati
 if (!seg->url) {
 av_free(seg);
 xmlFree(media_val);
+xmlFree(range_val);
 return AVERROR(ENOMEM);
 }
-seg->size = -1;
 dynarray_add(>fragments, >n_fragments, seg);
 xmlFree(media_val);
+xmlFree(range_val);
 }
 }
 
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/sbrdsp_fixed: Fix integer overflow

2017-11-22 Thread Hendrik Leppkes
On Wed, Nov 22, 2017 at 11:38 PM, Carl Eugen Hoyos  wrote:
> 2017-11-22 21:00 GMT+01:00 Michael Niedermayer :
>
>> diff --git a/libavcodec/sbrdsp_fixed.c b/libavcodec/sbrdsp_fixed.c
>> index a0ef6859f1..0db932a105 100644
>> --- a/libavcodec/sbrdsp_fixed.c
>> +++ b/libavcodec/sbrdsp_fixed.c
>> @@ -133,7 +133,7 @@ static av_always_inline SoftFloat autocorr_calc(int64_t 
>> accu)
>>
>>  round = 1U << (nz-1);
>>  mant = (int)((accu + round) >> nz);
>> -mant = (mant + 0x40)>>7;
>> +mant = (mant + 0x40ll)>>7;
>
> LL?
>

More correctly, shouldnt this use one of those fancy integer constant
macros, like INT64_C(0x40)? (I don't actually know if those are
supposed to work with hex constants, but the fact that they exist
seems to indicate that LL is not entirely portable)

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


Re: [FFmpeg-devel] [mov] Fix trampling of ctts during seeks when sidx support is enabled.

2017-11-22 Thread John Stebbins
On 11/22/2017 02:36 PM, Carl Eugen Hoyos wrote:
> 2017-08-24 0:39 GMT+02:00 Dale Curtis :
>
>> -sc->ctts_data[ctts_count].count= count;
>> -sc->ctts_data[ctts_count].duration = duration;
>> -ctts_count++;
>> +/* Expand entries such that we have a 1-1 mapping with samples. */
>> +for (j = 0; j < count; j++)
>> +add_ctts_entry(>ctts_data, _count, 
>> >ctts_allocated_size, 1, duration);
> count is a 32bit value read from the file, so this hunk makes
> the demuxer allocate huge amount of memories for some
> files.
>
> Is there an upper limit for count?
>
>

In practice, if a valid mp4 blows up due to this ctts allocation, it's also 
going to blow up when AVIndexEntries is
allocated for the samples.  An invalid mp4 can do anything of course.

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7




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


Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

2017-11-22 Thread Marton Balint



On Wed, 22 Nov 2017, Mark Thompson wrote:


On 22/11/17 22:53, Philip Langdale wrote:

On Wed, 22 Nov 2017 23:36:23 +0100
Timo Rothenpieler  wrote:


I'd like to look through it again and test a bit more (will try to
do so tomorrow, certainly by the end of the week), but I think it
should be ready to commit with the external header removed. 


Are you planning to remove Nvidia headers as well? 


No, I am very much against this.
And others have also voiced against that.

Also, I don't see a problem with including this AMD header. It very
much increases the accessibility and maintainability(no need to watch
out for potential breaking upstream changes, however likely that
might be). Having those vendor-specific hwaccels enabled in otherwise
generic builds gives a lot of people easy access, or access at all.

It also might make them potential usage candidates for browsers, no
idea how their weird lawyer-code-review system works though, and if
it has any impact to avoid external dependencies.



I feel the same way; I'm fine with the header in-tree.


Well, why should this external header be in the ffmpeg tree?

In my opinion indiscriminately placing upstream headers in the tree is just not 
what we want to do:
* It increases the maintenance burden, because upstream changes need to be 
checked and then reflected locally.
* Breaking changes are completely fatal - we have to choose one side or the 
other of the change and abandon the other completely.
* It makes it harder for users to build against different versions which they 
may have (especially for users who may want to stick with older versions they 
have verified for their use-cases).
* It makes it harder to developers to modify code on either side of the API, 
because more places have to be updated.

And what is the benefit?  A minor convenience gain for users who can't be 
bothered to get the headers themselves in the same way that they do for every 
other external package they use.  I don't think that's worth it.

(For comparison, including the Nvidia headers allows the stuff there to be 
built at all in the face of a hostile upstream.  That's quite different to a 
minor convenience gain.)


All your points apply to Nvidia external headers as well, and you can't 
set aside the fact that AMD and Nvidia deserve equal treatment. IMHO we 
either include the AMD headers, or we remove the Nvidia headers and make 
the configure error message point the user to an external github repo from 
where the Nvidia headers are downloadable.


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


Re: [FFmpeg-devel] [PATCH] Download dash content with byte range info

2017-11-22 Thread Steven Liu
2017-11-23 6:58 GMT+08:00 Colin NG :
> ---
>  libavformat/dashdec.c | 38 --
>  1 file changed, 32 insertions(+), 6 deletions(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 0e3afd2..3798649 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -522,6 +522,24 @@ static enum AVMediaType get_content_type(xmlNodePtr node)
>  return type;
>  }
>
> +static struct fragment * get_Fragment(char *range)
Wrong code style, refer to: https://ffmpeg.org/developer.html#Naming-conventions

> +{
> +struct fragment * seg =  av_mallocz(sizeof(struct fragment));
> +
> +if (!seg)
> +return NULL;
> +
> +seg->size = -1;
> +if (range)  {
> +char *str_end_offset;
> +char *str_offset = av_strtok(range, "-", _end_offset);
check str_offset NULL value, because the HTTP Server maybe not
standard, that cannot control by us.

> +seg->url_offset = strtoll(str_offset, NULL, 10);
> +seg->size = strtoll(str_end_offset, NULL, 10) -seg->url_offset;
> +}
> +
> +return seg;
> +}
> +
>  static int parse_manifest_segmenturlnode(AVFormatContext *s, struct 
> representation *rep,
>   xmlNodePtr fragmenturl_node,
>   xmlNodePtr *baseurl_nodes,
> @@ -530,33 +548,40 @@ static int 
> parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
>  {
>  char *initialization_val = NULL;
>  char *media_val = NULL;
> +char *range_val = NULL;
>
>  if (!av_strcasecmp(fragmenturl_node->name, (const char 
> *)"Initialization")) {
>  initialization_val = xmlGetProp(fragmenturl_node, "sourceURL");
> -if (initialization_val) {
> -rep->init_section = av_mallocz(sizeof(struct fragment));
> +range_val = xmlGetProp(fragmenturl_node, "range");
> +if (initialization_val || range_val) {
> +rep->init_section = get_Fragment(range_val);
>  if (!rep->init_section) {
>  xmlFree(initialization_val);
> +xmlFree(range_val);
>  return AVERROR(ENOMEM);
>  }
>  rep->init_section->url = get_content_url(baseurl_nodes, 4,
>   rep_id_val,
>   rep_bandwidth_val,
>   initialization_val);
> +
>  if (!rep->init_section->url) {
>  av_free(rep->init_section);
>  xmlFree(initialization_val);
> +xmlFree(range_val);
>  return AVERROR(ENOMEM);
>  }
> -rep->init_section->size = -1;
>  xmlFree(initialization_val);
> +xmlFree(range_val);
>  }
>  } else if (!av_strcasecmp(fragmenturl_node->name, (const char 
> *)"SegmentURL")) {
>  media_val = xmlGetProp(fragmenturl_node, "media");
> -if (media_val) {
> -struct fragment *seg = av_mallocz(sizeof(struct fragment));
> +range_val = xmlGetProp(fragmenturl_node, "mediaRange");
> +if (media_val || range_val) {
> +struct fragment *seg =  get_Fragment(range_val);
>  if (!seg) {
>  xmlFree(media_val);
> +xmlFree(range_val);
>  return AVERROR(ENOMEM);
>  }
>  seg->url = get_content_url(baseurl_nodes, 4,
> @@ -566,11 +591,12 @@ static int 
> parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
>  if (!seg->url) {
>  av_free(seg);
>  xmlFree(media_val);
> +xmlFree(range_val);
>  return AVERROR(ENOMEM);
>  }
> -seg->size = -1;
>  dynarray_add(>fragments, >n_fragments, seg);
>  xmlFree(media_val);
> +xmlFree(range_val);
>  }
>  }
>
> --
> 2.7.4
>
> ___
> 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 00/15] OpenCL infrastructure, filters

2017-11-22 Thread Carl Eugen Hoyos
2017-11-23 0:26 GMT+01:00 Mark Thompson :
> On 22/11/17 00:59, Carl Eugen Hoyos wrote:
>> 2017-11-22 1:30 GMT+01:00 Mark Thompson :
>>> On 14/11/17 19:47, Mark Thompson wrote:
 Changes since the last time this was posted:
 * Add unsharp filter (to replace existing unsharp).
 * Remove old experimental API.
 * Miscellaneous fixes.

 Now also tested with AMD OpenCL on Windows (DXVA2
 mapping works nicely, D3D11 does not because it wants
 the Intel extension for NV12 support).
>>>
>>> I have approval for this from James and Rostislav (via IRC).
>>
>> I don't exactly why vhook was removed but I would prefer

Missing "remember".

>> if this patch would be approved on the mailing list.
>
> Set pushed, minus the program_opencl filter.

> Can you further explain your concerns about it?

I have no concerns (or more exactly: no opinion), I just
wonder if the single reason vhook was removed wasn't
simply that we don't want to allow users to load random
binaries.

If nobody has any concerns then it is probably good to
push but in this (imo rare) case it would be great to
wait a little longer.

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


Re: [FFmpeg-devel] [PATCH] Refactor Developer Docs, update dev list section

2017-11-22 Thread Derek Buitenhuis
On 11/22/2017 11:34 PM, Carl Eugen Hoyos wrote:
> Please understand I am against removing the paragraph from the
> documentation because I believe it is a good idea if developers
> are subscribed to -cvslog.

Perhaps it can be reworded a bit to say it's encouraged for the
cited reasons, but not mandatory if you just want to send a patch
here and there?

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


Re: [FFmpeg-devel] [PATCH] ffmpeg: add return value check to suppress the build warning.

2017-11-22 Thread Carl Eugen Hoyos
2017-11-20 10:07 GMT+01:00 刘歧 :

> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index babd85f7bc..0c16e75ab0 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -220,13 +220,18 @@ static void sub2video_push_ref(InputStream *ist, 
> int64_t pts)
>  {
>  AVFrame *frame = ist->sub2video.frame;
>  int i;
> +int ret;
>
>  av_assert1(frame->data[0]);
>  ist->sub2video.last_pts = frame->pts = pts;
> -for (i = 0; i < ist->nb_filters; i++)
> -av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
> - AV_BUFFERSRC_FLAG_KEEP_REF |
> - AV_BUFFERSRC_FLAG_PUSH);
> +for (i = 0; i < ist->nb_filters; i++) {
> +ret = av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
> +   AV_BUFFERSRC_FLAG_KEEP_REF |
> +   AV_BUFFERSRC_FLAG_PUSH);
> +if (ret != AVERROR_EOF && ret < 0)
> +av_log(NULL, AV_LOG_WARNING, "Error while add the frame to 
> buffer source(%s).\n",

Nicolas had a comment about this change:
http://ffmpeg.org/pipermail/ffmpeg-devel/2017-February/207015.html

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


Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: fix last packet timestamps

2017-11-22 Thread Marton Balint



On Wed, 22 Nov 2017, Derek Buitenhuis wrote:


On 11/22/2017 1:10 AM, Marton Balint wrote:

Fixes the packet timestamps of the last packet, which was unset, or guessed by
compute_pkt_fields.

ffprobe -fflags nofillin -show_packets tests/data/lavf/lavf.mxf -select_streams 
v

Signed-off-by: Marton Balint 
---
 libavformat/mxfdec.c|  8 
 tests/ref/seek/lavf-mxf_d10 | 12 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)


Can you add what the fix actually was to the commit message?



Hmm, the patch seems to break timestamps for some files so I will work on 
a new one anyway.


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


Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

2017-11-22 Thread Timo Rothenpieler

Am 17.11.2017 um 06:07 schrieb mmironov:

 From 454aad17fea28e8e4c5abb904341181271971bfc Mon Sep 17 00:00:00 2001
From: mmironov 
Date: Tue, 14 Nov 2017 17:54:24 -0500
Subject: [PATCH] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF
  SDK

Signed-off-by: mmironov 
---
  Changelog|1 +
  compat/amd/amfsdkenc.h   | 1755 ++
  configure|   25 +
  libavcodec/Makefile  |4 +
  libavcodec/allcodecs.c   |2 +
  libavcodec/amfenc.c  |  596 
  libavcodec/amfenc.h  |  143 
  libavcodec/amfenc_h264.c |  397 +++
  libavcodec/amfenc_hevc.c |  327 +
  9 files changed, 3250 insertions(+)
  create mode 100644 compat/amd/amfsdkenc.h
  create mode 100644 libavcodec/amfenc.c
  create mode 100644 libavcodec/amfenc.h
  create mode 100644 libavcodec/amfenc_h264.c
  create mode 100644 libavcodec/amfenc_hevc.c


...

diff --git a/configure b/configure
index 3788f26..cbec01f 100755
--- a/configure
+++ b/configure
@@ -303,6 +303,7 @@ External library support:
--disable-zlib   disable zlib [autodetect]
  
The following libraries provide various hardware acceleration features:

+  --disable-amfdisable AMF video encoding code [autodetect]
--disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
--disable-cuda   disable dynamically linked Nvidia CUDA code 
[autodetect]
--enable-cuda-sdkenable CUDA features that require the CUDA SDK [no]
@@ -1639,6 +1640,7 @@ EXTERNAL_LIBRARY_LIST="
  "
  
  HWACCEL_AUTODETECT_LIBRARY_LIST="

+amf
  audiotoolbox
  crystalhd
  cuda
@@ -2781,12 +2783,15 @@ scale_npp_filter_deps="cuda libnpp"
  scale_cuda_filter_deps="cuda_sdk"
  thumbnail_cuda_filter_deps="cuda_sdk"
  
+amf_deps_any="dlopen LoadLibrary"

+
  nvenc_deps="cuda"
  nvenc_deps_any="libdl LoadLibrary"
  nvenc_encoder_deps="nvenc"
  
  h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"

  h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
+h264_amf_encoder_deps="amf"
  h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
  h264_cuvid_decoder_deps="cuvid"
  h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
@@ -2803,6 +2808,7 @@ h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
  h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
  h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
  h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
+hevc_amf_encoder_deps="amf"
  hevc_cuvid_decoder_deps="cuvid"
  hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
  hevc_mediacodec_decoder_deps="mediacodec"
@@ -6171,6 +6177,18 @@ else
  disable cuda cuvid nvdec nvenc
  fi
  
+if enabled x86; then

+case $target_os in
+mingw32*|mingw64*|win32|win64|cygwin*)
+;;
+*)
+disable amf
+;;
+esac
+else
+disable amf
+fi
+


Can't this be integrated into the nvenc case, that, except for also 
having linux, does pretty much the same?
Like, moving linux to its own case that only disables amf, and adding 
amf to the other two nvenc/cuvid/nvdec disable-lines.




smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

2017-11-22 Thread Philip Langdale
On Wed, 22 Nov 2017 23:36:23 +0100
Timo Rothenpieler  wrote:

> >> I'd like to look through it again and test a bit more (will try to
> >> do so tomorrow, certainly by the end of the week), but I think it
> >> should be ready to commit with the external header removed.  
> > 
> > Are you planning to remove Nvidia headers as well?  
> 
> No, I am very much against this.
> And others have also voiced against that.
> 
> Also, I don't see a problem with including this AMD header. It very
> much increases the accessibility and maintainability(no need to watch
> out for potential breaking upstream changes, however likely that
> might be). Having those vendor-specific hwaccels enabled in otherwise
> generic builds gives a lot of people easy access, or access at all.
> 
> It also might make them potential usage candidates for browsers, no
> idea how their weird lawyer-code-review system works though, and if
> it has any impact to avoid external dependencies.
> 

I feel the same way; I'm fine with the header in-tree.

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


[FFmpeg-devel] Fix for ticket #6764

2017-11-22 Thread Colin NG
Add NULL pointer check for incoming audio data.
diff --git a/libavcodec/opus_pvq.c b/libavcodec/opus_pvq.c
index f98b85d..f1dbc5d 100644
--- a/libavcodec/opus_pvq.c
+++ b/libavcodec/opus_pvq.c
@@ -504,6 +504,9 @@ static av_always_inline uint32_t 
quant_band_template(CeltPVQ *pvq, CeltFrame *f,
 int longblocks = (B0 == 1);
 uint32_t cm = 0;
 
+ if (!X)
+return cm;
+
 if (N == 1) {
 float *x = X;
 for (i = 0; i <= stereo; i++) {
@@ -795,7 +798,7 @@ static av_always_inline uint32_t 
quant_band_template(CeltPVQ *pvq, CeltFrame *f,
 f->remaining2 -= curr_bits;
 }
 
-if (q != 0) {
+if (X && q != 0) {
 /* Finally do the actual (de)quantization */
 if (quant) {
 cm = celt_alg_quant(rc, X, N, (q < 8) ? q : (8 + (q & 7)) << 
((q >> 3) - 1),
@@ -902,6 +905,9 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, 
OpusRangeCoder *rc, int b
 float *Y_orig = f->block[1].coeffs + (ff_celt_freq_bands[band] << f->size);
 OPUS_RC_CHECKPOINT_SPAWN(rc);
 
+if (!X && !Y)
+return 0.0f;
+
 memcpy(X, X_orig, band_size*sizeof(float));
 if (Y)
 memcpy(Y, Y_orig, band_size*sizeof(float));
@@ -911,7 +917,6 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, 
OpusRangeCoder *rc, int b
 int curr_balance = f->remaining / FFMIN(3, f->coded_bands - band);
 b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[band] + 
curr_balance), 14);
 }
-
 if (f->dual_stereo) {
 pvq->encode_band(pvq, f, rc, band, X, NULL, band_size, b / 2, 
f->blocks, NULL,
  f->size, norm1, 0, 1.0f, lowband_scratch, cm[0]);
@@ -925,7 +930,12 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, 
OpusRangeCoder *rc, int b
 
 for (i = 0; i < band_size; i++) {
 err_x += (X[i] - X_orig[i])*(X[i] - X_orig[i]);
-err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
+}
+
+   if (Y) {
+for (i = 0; i < band_size; i++) {
+err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
+}
 }
 
 dist = sqrtf(err_x) + sqrtf(err_y);
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Refactor Developer Docs, update dev list section

2017-11-22 Thread Carl Eugen Hoyos
2017-11-23 0:39 GMT+01:00 Derek Buitenhuis :
> On 11/22/2017 11:34 PM, Carl Eugen Hoyos wrote:
>> Please understand I am against removing the paragraph from the
>> documentation because I believe it is a good idea if developers
>> are subscribed to -cvslog.
>
> Perhaps it can be reworded a bit to say it's encouraged for the
> cited reasons, but not mandatory if you just want to send a patch
> here and there?

If that really helps anybody, please do so!

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/sbrdsp_fixed: Fix integer overflow

2017-11-22 Thread Carl Eugen Hoyos
2017-11-22 21:00 GMT+01:00 Michael Niedermayer :

> diff --git a/libavcodec/sbrdsp_fixed.c b/libavcodec/sbrdsp_fixed.c
> index a0ef6859f1..0db932a105 100644
> --- a/libavcodec/sbrdsp_fixed.c
> +++ b/libavcodec/sbrdsp_fixed.c
> @@ -133,7 +133,7 @@ static av_always_inline SoftFloat autocorr_calc(int64_t 
> accu)
>
>  round = 1U << (nz-1);
>  mant = (int)((accu + round) >> nz);
> -mant = (mant + 0x40)>>7;
> +mant = (mant + 0x40ll)>>7;

LL?

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


Re: [FFmpeg-devel] [PATCH] avformat/avienc: fix fields-per-frame value for interlaced video streams

2017-11-22 Thread Carl Eugen Hoyos
2017-11-22 16:41 GMT+01:00 Tobias Rapp :
> Writes one set of field framing information for progressive streams and
> two sets for interlaced streams. Fixes ticket #6383.
>
> Unfortunately the OpenDML v1.02 document is not very specific what value
> to use for start_line when frame data is not coming from a capturing
> device, so this is just using 0/1 depending on the field order as a
> best-effort guess.

I believe your approach is sane but the only available examples
may indicate that it should be set to something like height / 2 ;-(

> +int num, den, fields, i;
>  av_reduce(, , dar.num, dar.den, 0x);
> +if (par->field_order == AV_FIELD_TT || par->field_order == 
> AV_FIELD_BB ||
> +par->field_order == AV_FIELD_TB || par->field_order == 
> AV_FIELD_BT) {
> +fields = 2; // interlaced
> +} else {
> +fields = 1; // progressive

fields = 1 + field_order == TT || field_order == BB etc.;

> +for (i = 0; i < fields; i++) {
> +int start_line;
> +if (par->field_order == AV_FIELD_TT || par->field_order == 
> AV_FIELD_TB) {
> +start_line = (i == 0) ? 0 : 1;
> +} else if (par->field_order == AV_FIELD_BB || 
> par->field_order == AV_FIELD_BT) {
> +start_line = (i == 0) ? 1 : 0;

start_line = fields * (i ^ (par->field_order == AV_FIELD_BB ||
par->field_order == AV_FIELD_BT));

Which are imo less ugly.

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


Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

2017-11-22 Thread Mironov, Mikhail
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Timo Rothenpieler
> Sent: November 22, 2017 5:36 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD
> GPUs based on AMF SDK
> 
> Am 17.11.2017 um 06:07 schrieb mmironov:
> >  From 454aad17fea28e8e4c5abb904341181271971bfc Mon Sep 17 00:00:00
> > 2001
> > From: mmironov 
> > Date: Tue, 14 Nov 2017 17:54:24 -0500
> > Subject: [PATCH] Added HW H.264 and HEVC encoding for AMD GPUs
> based on AMF
> >   SDK
> >
> > Signed-off-by: mmironov 
> > ---
> >   Changelog|1 +
> >   compat/amd/amfsdkenc.h   | 1755
> ++
> >   configure|   25 +
> >   libavcodec/Makefile  |4 +
> >   libavcodec/allcodecs.c   |2 +
> >   libavcodec/amfenc.c  |  596 
> >   libavcodec/amfenc.h  |  143 
> >   libavcodec/amfenc_h264.c |  397 +++
> >   libavcodec/amfenc_hevc.c |  327 +
> >   9 files changed, 3250 insertions(+)
> >   create mode 100644 compat/amd/amfsdkenc.h
> >   create mode 100644 libavcodec/amfenc.c
> >   create mode 100644 libavcodec/amfenc.h
> >   create mode 100644 libavcodec/amfenc_h264.c
> >   create mode 100644 libavcodec/amfenc_hevc.c
> ...
> > diff --git a/configure b/configure
> > index 3788f26..cbec01f 100755
> > --- a/configure
> > +++ b/configure
> > @@ -303,6 +303,7 @@ External library support:
> > --disable-zlib   disable zlib [autodetect]
> >
> > The following libraries provide various hardware acceleration features:
> > +  --disable-amfdisable AMF video encoding code [autodetect]
> > --disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
> > --disable-cuda   disable dynamically linked Nvidia CUDA code
> [autodetect]
> > --enable-cuda-sdkenable CUDA features that require the CUDA SDK
> [no]
> > @@ -1639,6 +1640,7 @@ EXTERNAL_LIBRARY_LIST="
> >   "
> >
> >   HWACCEL_AUTODETECT_LIBRARY_LIST="
> > +amf
> >   audiotoolbox
> >   crystalhd
> >   cuda
> > @@ -2781,12 +2783,15 @@ scale_npp_filter_deps="cuda libnpp"
> >   scale_cuda_filter_deps="cuda_sdk"
> >   thumbnail_cuda_filter_deps="cuda_sdk"
> >
> > +amf_deps_any="dlopen LoadLibrary"
> 
> This should be libdl, and not dlopen.
> Or rather just LoadLibrary, since it's Windows only? No idea how exactly
> cygwin works there.
> 

The actual code calls dlopen() and it in turn calls LoadLibrary(). 
In the future Linux support will be added. So I feel to change this to libdl 
but keep.
From the prev post: I will combine amf and nvidia cases.

Thanks,
Mikhail

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


Re: [FFmpeg-devel] [PATCH v2 2/2] avformat/dashenc: Option to generate hls playlist as well

2017-11-22 Thread Jeyapal, Karthick


On 11/22/17, 9:06 PM, "Michael Niedermayer"  wrote:

>On Wed, Nov 22, 2017 at 02:50:12PM +0530, Karthick J wrote:
>>  
>> +static void get_hls_playlist_name(char *playlist_name, const char 
>> *base_url, int id) {
>> +if (base_url)
>> +sprintf(playlist_name, "%smedia_%d.m3u8", base_url, id);
>> +else
>> +sprintf(playlist_name, "media_%d.m3u8", id);
>> +}

>please always use snprint, not sprintf as it can overwrite the array
Thanks for the comments. I have uploaded a new patch(v3) with snprintf.

>[...]
>-- 
>Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
>Everything should be made as simple as possible, but not simpler.
>-- Albert Einstein

regards,
Karthick

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


Re: [FFmpeg-devel] [mov] Fix trampling of ctts during seeks when sidx support is enabled.

2017-11-22 Thread Carl Eugen Hoyos
2017-08-24 0:39 GMT+02:00 Dale Curtis :

> -sc->ctts_data[ctts_count].count= count;
> -sc->ctts_data[ctts_count].duration = duration;
> -ctts_count++;
> +/* Expand entries such that we have a 1-1 mapping with samples. */
> +for (j = 0; j < count; j++)
> +add_ctts_entry(>ctts_data, _count, 
> >ctts_allocated_size, 1, duration);

count is a 32bit value read from the file, so this hunk makes
the demuxer allocate huge amount of memories for some
files.

Is there an upper limit for count?

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


Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

2017-11-22 Thread Timo Rothenpieler

I'd like to look through it again and test a bit more (will try to do so
tomorrow, certainly by the end of the week), but I think it should be ready to
commit with the external header removed.


Are you planning to remove Nvidia headers as well?


No, I am very much against this.
And others have also voiced against that.

Also, I don't see a problem with including this AMD header. It very much 
increases the accessibility and maintainability(no need to watch out for 
potential breaking upstream changes, however likely that might be).
Having those vendor-specific hwaccels enabled in otherwise generic 
builds gives a lot of people easy access, or access at all.


It also might make them potential usage candidates for browsers, no idea 
how their weird lawyer-code-review system works though, and if it has 
any impact to avoid external dependencies.




smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavcodec/opus: Add NULL pointer check for incoming data; avoid segfault

2017-11-22 Thread Colin NG
---
Fix for ticket 7674

 libavcodec/opus_pvq.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/libavcodec/opus_pvq.c b/libavcodec/opus_pvq.c
index f98b85d..02ccd69 100644
--- a/libavcodec/opus_pvq.c
+++ b/libavcodec/opus_pvq.c
@@ -504,6 +504,9 @@ static av_always_inline uint32_t 
quant_band_template(CeltPVQ *pvq, CeltFrame *f,
 int longblocks = (B0 == 1);
 uint32_t cm = 0;
 
+ if (!X)
+return cm;
+
 if (N == 1) {
 float *x = X;
 for (i = 0; i <= stereo; i++) {
@@ -795,7 +798,7 @@ static av_always_inline uint32_t 
quant_band_template(CeltPVQ *pvq, CeltFrame *f,
 f->remaining2 -= curr_bits;
 }
 
-if (q != 0) {
+if (X && !q) {
 /* Finally do the actual (de)quantization */
 if (quant) {
 cm = celt_alg_quant(rc, X, N, (q < 8) ? q : (8 + (q & 7)) << 
((q >> 3) - 1),
@@ -902,6 +905,9 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, 
OpusRangeCoder *rc, int b
 float *Y_orig = f->block[1].coeffs + (ff_celt_freq_bands[band] << f->size);
 OPUS_RC_CHECKPOINT_SPAWN(rc);
 
+if (!X && !Y)
+return 0.0f;
+
 memcpy(X, X_orig, band_size*sizeof(float));
 if (Y)
 memcpy(Y, Y_orig, band_size*sizeof(float));
@@ -911,7 +917,6 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, 
OpusRangeCoder *rc, int b
 int curr_balance = f->remaining / FFMIN(3, f->coded_bands - band);
 b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[band] + 
curr_balance), 14);
 }
-
 if (f->dual_stereo) {
 pvq->encode_band(pvq, f, rc, band, X, NULL, band_size, b / 2, 
f->blocks, NULL,
  f->size, norm1, 0, 1.0f, lowband_scratch, cm[0]);
@@ -925,7 +930,12 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, 
OpusRangeCoder *rc, int b
 
 for (i = 0; i < band_size; i++) {
 err_x += (X[i] - X_orig[i])*(X[i] - X_orig[i]);
-err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
+}
+
+   if (Y) {
+for (i = 0; i < band_size; i++) {
+err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
+}
 }
 
 dist = sqrtf(err_x) + sqrtf(err_y);
-- 
2.7.4

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


[FFmpeg-devel] [Patch] Fix for ticket 6658 (Dash demuxer segfault)

2017-11-22 Thread Colin NG
Clean up coding style.
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 3798649..7e7ae52 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -148,6 +148,11 @@ static uint64_t get_current_time_in_sec(void)
 return  av_gettime() / 100;
 }
 
+static char *ishttp(char *url) {
+char *proto_name = avio_find_protocol_name(url);
+return av_strstart(proto_name, "http", NULL);
+}
+
 static uint64_t get_utc_date_time_insec(AVFormatContext *s, const char 
*datetime)
 {
 struct tm timeinfo;
@@ -392,7 +397,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, 
const char *url,
 else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
 return AVERROR_INVALIDDATA;
 
-ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
+av_freep(pb);
+ret = avio_open2(pb, url, AVIO_FLAG_READ, c->interrupt_callback, );
 if (ret >= 0) {
 // update cookies on http response with setcookies.
 char *new_cookies = NULL;
@@ -639,6 +645,78 @@ static int parse_manifest_segmenttimeline(AVFormatContext 
*s, struct representat
 return 0;
 }
 
+static int resolve_content_path(AVFormatContext *s, const char *url, 
xmlNodePtr *baseurl_nodes, int n_baseurl_nodes)
+ {
+int i;
+char *text;
+char tmp_str[MAX_URL_SIZE];
+char tmp_str_2[MAX_URL_SIZE];
+
+char *path = av_mallocz(MAX_URL_SIZE);
+int nameSize = 0;
+int updated = 0;
+
+av_strlcpy(tmp_str, url, strlen(url)+1);
+char *mpdName = strtok(tmp_str, "/");
+
+while ((mpdName = strtok(NULL, "/"))) {
+nameSize = strlen(mpdName);
+}
+
+av_strlcpy(path, url, strlen(url)-nameSize+1);
+
+int rootId = 0;
+xmlNodePtr  *node = NULL;
+for (rootId = n_baseurl_nodes-1; rootId > 0; rootId--) {
+if (!(node = baseurl_nodes[rootId])) {
+continue;
+}
+if (ishttp(xmlNodeGetContent(node))) {
+break;
+}
+}
+
+node = baseurl_nodes[rootId];
+char *baseurl = xmlNodeGetContent(node);
+char *root_url = (!av_strcasecmp(baseurl, ""))? path: baseurl;
+
+if (node) {
+xmlNodeSetContent(node, root_url);
+}
+
+int size = strlen(root_url);
+char *isRootHttp = ishttp(root_url);
+
+char token = '/';
+if (strncmp(_url[size-1], , 1) != 0) {
+av_strlcat(root_url, "/", size+2);
+size+=2;
+}
+
+for (i = 0; i < n_baseurl_nodes; i++) {
+if (i == rootId) {
+continue;
+}
+text = xmlNodeGetContent(baseurl_nodes[i]);
+if (text) {
+memset(tmp_str, 0, strlen(tmp_str));
+
+if (!ishttp(text) && isRootHttp) {
+av_strlcpy(tmp_str, root_url, size+1);
+}
+int start = (strncmp(text, , 1) == 0) ? 1: 0;
+memset(tmp_str_2, 0, strlen(tmp_str_2));
+av_strlcat(tmp_str, text+start, MAX_URL_SIZE);
+xmlFree(text);
+xmlNodeSetContent(baseurl_nodes[i], tmp_str);
+updated = 1;
+}
+}
+
+av_free(path);
+return updated;
+
+}
 static int parse_manifest_representation(AVFormatContext *s, const char *url,
  xmlNodePtr node,
  xmlNodePtr adaptionset_node,
@@ -698,6 +776,8 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 baseurl_nodes[2] = adaptionset_baseurl_node;
 baseurl_nodes[3] = representation_baseurl_node;
 
+resolve_content_path(s, url, baseurl_nodes, 4);
+
 if (representation_segmenttemplate_node || fragment_template_node) {
 fragment_timeline_node = NULL;
 fragment_templates_tab[0] = representation_segmenttemplate_node;
@@ -993,6 +1073,9 @@ static int parse_manifest(AVFormatContext *s, const char 
*url, AVIOContext *in)
 }
 
 mpd_baseurl_node = find_child_node_by_name(node, "BaseURL");
+if (!mpd_baseurl_node) {
+mpd_baseurl_node = xmlNewNode(node, "BaseURL");
+}
 
 // at now we can handle only one period, with the longest duration
 node = xmlFirstElementChild(node);
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avcodec/hapdec : use gray8 for HapAlphaOnly decoding instead of RGB0

2017-11-22 Thread Carl Eugen Hoyos
2017-11-16 23:41 GMT+01:00 Martin Vignali :
> Hello,
>
> Following previous discussion
> patch in attach change pix_fmt for hap alpha only decoding to use gray8
> instead of RGB0

Looks like what you suggested.

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


Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

2017-11-22 Thread Timo Rothenpieler

Am 17.11.2017 um 06:07 schrieb mmironov:

 From 454aad17fea28e8e4c5abb904341181271971bfc Mon Sep 17 00:00:00 2001
From: mmironov 
Date: Tue, 14 Nov 2017 17:54:24 -0500
Subject: [PATCH] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF
  SDK

Signed-off-by: mmironov 
---
  Changelog|1 +
  compat/amd/amfsdkenc.h   | 1755 ++
  configure|   25 +
  libavcodec/Makefile  |4 +
  libavcodec/allcodecs.c   |2 +
  libavcodec/amfenc.c  |  596 
  libavcodec/amfenc.h  |  143 
  libavcodec/amfenc_h264.c |  397 +++
  libavcodec/amfenc_hevc.c |  327 +
  9 files changed, 3250 insertions(+)
  create mode 100644 compat/amd/amfsdkenc.h
  create mode 100644 libavcodec/amfenc.c
  create mode 100644 libavcodec/amfenc.h
  create mode 100644 libavcodec/amfenc_h264.c
  create mode 100644 libavcodec/amfenc_hevc.c

...

diff --git a/configure b/configure
index 3788f26..cbec01f 100755
--- a/configure
+++ b/configure
@@ -303,6 +303,7 @@ External library support:
--disable-zlib   disable zlib [autodetect]
  
The following libraries provide various hardware acceleration features:

+  --disable-amfdisable AMF video encoding code [autodetect]
--disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
--disable-cuda   disable dynamically linked Nvidia CUDA code 
[autodetect]
--enable-cuda-sdkenable CUDA features that require the CUDA SDK [no]
@@ -1639,6 +1640,7 @@ EXTERNAL_LIBRARY_LIST="
  "
  
  HWACCEL_AUTODETECT_LIBRARY_LIST="

+amf
  audiotoolbox
  crystalhd
  cuda
@@ -2781,12 +2783,15 @@ scale_npp_filter_deps="cuda libnpp"
  scale_cuda_filter_deps="cuda_sdk"
  thumbnail_cuda_filter_deps="cuda_sdk"
  
+amf_deps_any="dlopen LoadLibrary"


This should be libdl, and not dlopen.
Or rather just LoadLibrary, since it's Windows only? No idea how exactly 
cygwin works there.


Sorry for the double-post, was a bit too quick with that first mail.



smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/avienc: fix fields-per-frame value for interlaced video streams

2017-11-22 Thread Derek Buitenhuis
On 11/22/2017 10:52 PM, Carl Eugen Hoyos wrote:
> start_line = fields * (i ^ (par->field_order == AV_FIELD_BB ||
> par->field_order == AV_FIELD_BT));
> 
> Which are imo less ugly.

Can't agree.

It's needlessly less readable bit fiddling.

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


Re: [FFmpeg-devel] [PATCH] libavcodec/opus: Add NULL pointer check for incoming data; avoid segfault

2017-11-22 Thread Carl Eugen Hoyos
2017-11-23 2:02 GMT+01:00 Rostislav Pehlivanov :
> On 23 November 2017 at 00:53, Colin NG  wrote:
>
>> ---
>> Fix for ticket 7674

6764

> I actually found out about this bug while working on it a few days ago but
> wanted to wait until I got the opus_rc and some opusenc_psy improvements
> fully done.

> Pushed my fix for mono.

Could you explain what you fixed?

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


Re: [FFmpeg-devel] [Patch] Fix for ticket 6658 (Dash demuxer segfault)

2017-11-22 Thread Steven Liu
2017-11-23 9:16 GMT+08:00 Colin NG :
> Clean up coding style.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 3798649..7e7ae52 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -148,6 +148,11 @@ static uint64_t get_current_time_in_sec(void)
 return  av_gettime() / 100;
 }

+static char *ishttp(char *url) {
+char *proto_name = avio_find_protocol_name(url);
+return av_strstart(proto_name, "http", NULL);
+}
+
 static uint64_t get_utc_date_time_insec(AVFormatContext *s, const
char *datetime)
 {
 struct tm timeinfo;
@@ -392,7 +397,8 @@ static int open_url(AVFormatContext *s,
AVIOContext **pb, const char *url,
 else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
 return AVERROR_INVALIDDATA;

-ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
+av_freep(pb);
+ret = avio_open2(pb, url, AVIO_FLAG_READ, c->interrupt_callback, );
 if (ret >= 0) {
 // update cookies on http response with setcookies.
 char *new_cookies = NULL;
@@ -639,6 +645,78 @@ static int
parse_manifest_segmenttimeline(AVFormatContext *s, struct representat
 return 0;
 }

+static int resolve_content_path(AVFormatContext *s, const char *url,
xmlNodePtr *baseurl_nodes, int n_baseurl_nodes)
+ {
+int i;
+char *text;
+char tmp_str[MAX_URL_SIZE];
+char tmp_str_2[MAX_URL_SIZE];
+
+char *path = av_mallocz(MAX_URL_SIZE);
+int nameSize = 0;
+int updated = 0;
+
+av_strlcpy(tmp_str, url, strlen(url)+1);
+char *mpdName = strtok(tmp_str, "/");
+
+while ((mpdName = strtok(NULL, "/"))) {
+nameSize = strlen(mpdName);
+}
+
+av_strlcpy(path, url, strlen(url)-nameSize+1);
+
+int rootId = 0;
+xmlNodePtr  *node = NULL;
+for (rootId = n_baseurl_nodes-1; rootId > 0; rootId--) {
+if (!(node = baseurl_nodes[rootId])) {
+continue;
+}
+if (ishttp(xmlNodeGetContent(node))) {
+break;
+}
+}
+
+node = baseurl_nodes[rootId];
+char *baseurl = xmlNodeGetContent(node);
+char *root_url = (!av_strcasecmp(baseurl, ""))? path: baseurl;
+
+if (node) {
+xmlNodeSetContent(node, root_url);
+}
+
+int size = strlen(root_url);
+char *isRootHttp = ishttp(root_url);
+
+char token = '/';
+if (strncmp(_url[size-1], , 1) != 0) {

why not av_strncasecmp?

+av_strlcat(root_url, "/", size+2);
+size+=2;
+}
+
+for (i = 0; i < n_baseurl_nodes; i++) {
+if (i == rootId) {
+continue;
+}
+text = xmlNodeGetContent(baseurl_nodes[i]);
+if (text) {
+memset(tmp_str, 0, strlen(tmp_str));
+
+if (!ishttp(text) && isRootHttp) {
+av_strlcpy(tmp_str, root_url, size+1);
+}
+int start = (strncmp(text, , 1) == 0) ? 1: 0;

why not av_strncasecmp?


+memset(tmp_str_2, 0, strlen(tmp_str_2));
+av_strlcat(tmp_str, text+start, MAX_URL_SIZE);
+xmlFree(text);
+xmlNodeSetContent(baseurl_nodes[i], tmp_str);
+updated = 1;
+}
+}
+
+av_free(path);
+return updated;
+
+}
 static int parse_manifest_representation(AVFormatContext *s, const char *url,
  xmlNodePtr node,
  xmlNodePtr adaptionset_node,
@@ -698,6 +776,8 @@ static int
parse_manifest_representation(AVFormatContext *s, const char *url,
 baseurl_nodes[2] = adaptionset_baseurl_node;
 baseurl_nodes[3] = representation_baseurl_node;

+resolve_content_path(s, url, baseurl_nodes, 4);



check this call return value. If there are no return value, make it void type.



+
 if (representation_segmenttemplate_node || fragment_template_node) {
 fragment_timeline_node = NULL;
 fragment_templates_tab[0] = representation_segmenttemplate_node;
@@ -993,6 +1073,9 @@ static int parse_manifest(AVFormatContext *s,
const char *url, AVIOContext *in)
 }

 mpd_baseurl_node = find_child_node_by_name(node, "BaseURL");
+if (!mpd_baseurl_node) {
+mpd_baseurl_node = xmlNewNode(node, "BaseURL");
+}

 // at now we can handle only one period, with the longest duration
 node = xmlFirstElementChild(node);



BTW: use command looks like this:
1. git commit -a
2. git format-patch -1 or git format-patch -s -2 to make patch.

refer to: https://ffmpeg.org/developer.html#Submitting-patches-1


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


[FFmpeg-devel] [PATCH 6/6] avcodec/hevcdsp: Add NEON optimization for idct16x16

2017-11-22 Thread Shengbin Meng
From: Meng Wang 

Signed-off-by: Meng Wang 
---
 libavcodec/arm/hevcdsp_idct_neon.S | 241 +
 libavcodec/arm/hevcdsp_init_neon.c |   2 +
 2 files changed, 243 insertions(+)

diff --git a/libavcodec/arm/hevcdsp_idct_neon.S 
b/libavcodec/arm/hevcdsp_idct_neon.S
index e39d00634b..272abf279c 100644
--- a/libavcodec/arm/hevcdsp_idct_neon.S
+++ b/libavcodec/arm/hevcdsp_idct_neon.S
@@ -451,6 +451,247 @@ function ff_hevc_transform_8x8_neon_8, export=1
 bx lr
 endfunc
 
+/* 16x16 even line combine, input: q3-q10  output: q8-q15 */
+.macro tr8_combine
+vsub.s32   q12, q3, q10  // e_8[3] - o_8[3], dst[4]
+vadd.s32   q11, q3, q10  // e_8[3] + o_8[3], dst[3]
+
+vsub.s32   q13, q6, q9   // e_8[2] - o_8[2], dst[5]
+vadd.s32   q10, q6, q9   // e_8[2] + o_8[2], dst[2]
+
+vsub.s32   q14, q5, q8   // e_8[1] - o_8[1], dst[6]
+vadd.s32   q9,  q5, q8   // e_8[1] + o_8[1], dst[1]
+
+vsub.s32   q15, q4, q7   // e_8[0] - o_8[0], dst[7]
+vadd.s32   q8,  q4, q7   // e_8[0] + o_8[0], dst[0]
+.endm
+
+.macro tr16_begin in0, in1, in2, in3, in4, in5, in6, in7
+vmull.s16  q2, \in0, d2[1]   // 90 * src1
+vmull.s16  q3, \in0, d2[0]   // 87 * src1
+vmull.s16  q4, \in0, d2[3]   // 80 * src1
+vmull.s16  q5, \in0, d2[2]   // 70 * src1
+vmull.s16  q6, \in0, d3[1]   // 57 * src1
+vmull.s16  q7, \in0, d3[0]   // 43 * src1
+vmull.s16  q8, \in0, d3[3]   // 25 * src1
+vmull.s16  q9, \in0, d3[2]   //  9 * src1
+
+vmlal.s16  q2, \in1, d2[0]   // 87 * src3
+vmlal.s16  q3, \in1, d3[1]   // 57 * src3
+vmlal.s16  q4, \in1, d3[2]   //  9 * src3
+vmlsl.s16  q5, \in1, d3[0]   //-43 * src3
+vmlsl.s16  q6, \in1, d2[3]   //-80 * src3
+vmlsl.s16  q7, \in1, d2[1]   //-90 * src3
+vmlsl.s16  q8, \in1, d2[2]   //-70 * src3
+vmlsl.s16  q9, \in1, d3[3]   //-25 * src3
+
+vmlal.s16  q2, \in2, d2[3]   // 80 * src5
+vmlal.s16  q3, \in2, d3[2]   //  9 * src5
+vmlsl.s16  q4, \in2, d2[2]   //-70 * src5
+vmlsl.s16  q5, \in2, d2[0]   //-87 * src5
+vmlsl.s16  q6, \in2, d3[3]   //-25 * src5
+vmlal.s16  q7, \in2, d3[1]   // 57 * src5
+vmlal.s16  q8, \in2, d2[1]   // 90 * src5
+vmlal.s16  q9, \in2, d3[0]   // 43 * src5
+
+vmlal.s16  q2, \in3, d2[2]   // 70 * src7
+vmlsl.s16  q3, \in3, d3[0]   //-43 * src7
+vmlsl.s16  q4, \in3, d2[0]   //-87 * src7
+vmlal.s16  q5, \in3, d3[2]   //  9 * src7
+vmlal.s16  q6, \in3, d2[1]   // 90 * src7
+vmlal.s16  q7, \in3, d3[3]   // 25 * src7
+vmlsl.s16  q8, \in3, d2[3]   //-80 * src7
+vmlsl.s16  q9, \in3, d3[1]   //-57 * src7
+
+vmlal.s16  q2, \in4, d3[1]   // 57 * src9
+vmlsl.s16  q3, \in4, d2[3]   //-80 * src9
+vmlsl.s16  q4, \in4, d3[3]   //-25 * src9
+vmlal.s16  q5, \in4, d2[1]   // 90 * src9
+vmlsl.s16  q6, \in4, d3[2]   // -9 * src9
+vmlsl.s16  q7, \in4, d2[0]   //-87 * src9
+vmlal.s16  q8, \in4, d3[0]   // 43 * src9
+vmlal.s16  q9, \in4, d2[2]   // 70 * src9
+
+vmlal.s16  q2, \in5, d3[0]   // 43 * src11
+vmlsl.s16  q3, \in5, d2[1]   //-90 * src11
+vmlal.s16  q4, \in5, d3[1]   // 57 * src11
+vmlal.s16  q5, \in5, d3[3]   // 25 * src11
+vmlsl.s16  q6, \in5, d2[0]   //-87 * src11
+vmlal.s16  q7, \in5, d2[2]   // 70 * src11
+vmlal.s16  q8, \in5, d3[2]   //  9 * src11
+vmlsl.s16  q9, \in5, d2[3]   //-80 * src11
+
+vmlal.s16  q2, \in6, d3[3]   // 25 * src13
+vmlsl.s16  q3, \in6, d2[2]   //-70 * src13
+vmlal.s16  q4, \in6, d2[1]   // 90 * src13
+vmlsl.s16  q5, \in6, d2[3]   //-80 * src13
+vmlal.s16  q6, \in6, d3[0]   // 43 * src13
+vmlal.s16  q7, \in6, d3[2]   //  9 * src13
+vmlsl.s16  q8, \in6, d3[1]   //-57 * src13
+vmlal.s16  q9, \in6, d2[0]   // 87 * src13
+
+
+vmlal.s16  q2, \in7, d3[2]   //  9 * src15
+vmlsl.s16  q3, \in7, d3[3]   //-25 * src15
+vmlal.s16  q4, \in7, d3[0]   // 43 * src15
+vmlsl.s16  q5, \in7, d3[1]   //-57 * src15
+vmlal.s16  q6, \in7, d2[2]   // 70 * src15
+vmlsl.s16  q7, \in7, d2[3]   //-80 * src15
+vmlal.s16  q8, \in7, d2[0]   // 87 * src15
+vmlsl.s16  q9, \in7, d2[1]   //-90 * src15
+.endm
+
+.macro tr16_end shift
+vpop   {q2-q3}
+vadd.s32   q4, q8,  q2
+vsub.s32   q5, q8,  q2
+vqrshrn.s32d12, q4, \shift
+vqrshrn.s32d15, q5, \shift
+
+vadd.s32   q4, q9,  q3
+vsub.s32   q5, q9,  q3
+vqrshrn.s32d13, q4, \shift
+vqrshrn.s32d14, q5, \shift
+
+vpop   {q2-q3}
+vadd.s32   q4, q10, q2
+vsub.s32   q5, q10, q2
+vqrshrn.s32d16, q4, \shift

[FFmpeg-devel] [DEVEL][PATCH 1/2] ffmpeg: parse duplicate option

2017-11-22 Thread pkv.stream

Le 19/11/2017 à 8:28 PM, Michael Niedermayer a écrit :

On Sun, Nov 19, 2017 at 11:01:37AM +0100, pkv.stream wrote:
[...]


@@ -3674,6 +3697,10 @@ const OptionDef options[] = {
  { "channel_layout", OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE |
  OPT_INPUT | OPT_OUTPUT,   
 { .func_arg = opt_channel_layout },
  "set channel layout", "layout" },
+{ "channel_layout_uint64", OPT_AUDIO | HAS_ARG | OPT_INT64 | OPT_SPEC |

i mean as "channel_layout"
does it work with both using the same name so the option is routed
to both the field and callback or am i missing something why this is
not intended?


Hi Michael,
I've modified previous patch per your remark, so that channel_layout 
option is now routed both as func_arg and OPT_SPEC with same option name.


patch 1/2:  parse duplicate option. Allows two entries carrying same 
name in OptionDef table, the main one (the first) calls a func_arg while 
the second writes an offset in a SpecifierOpt. The duplicate option can 
never be set directly and should be set when the main option is parsed 
(in func_arg).


patch 2/2: fix channel_layout bug (ticket 6706) by retrieving 
channel_layout from stream output options and passing to filters.


Hope it will be OK.
Thanks.

From 7b53b8a6487173c62fcab2761289340b35bd171a Mon Sep 17 00:00:00 2001
From: pkviet 
Date: Wed, 22 Nov 2017 13:44:37 +0100
Subject: [PATCH 1/2] ffmpeg: parse duplicate option

Allows parsing of a duplicate option in an OptionDef table, with same
name as main option.
This is useful for example for channel_layout which can be parsed with
func_arg (opt_channel_layout) and also stored as an offset in a
SpecifierOpt.

Signed-off-by: pkviet 
---
 fftools/cmdutils.c | 18 ++
 fftools/cmdutils.h | 13 +
 2 files changed, 31 insertions(+)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 6920ca0..00802cf 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -380,6 +380,24 @@ int parse_option(void *optctx, const char *opt, const char 
*arg,
 return !!(po->flags & HAS_ARG);
 }
 
+int parse_duplicate_option(void *optctx, const char *opt, const char *arg,
+const OptionDef *options)
+{
+const OptionDef *po;
+int ret;
+
+po = find_option(options, opt) + 1;
+if (po->name != (po - 1)->name) {
+av_log(NULL, AV_LOG_ERROR, "Option '%s' has no duplicate.\n", opt);
+return AVERROR(EINVAL);
+}
+ret = write_option(optctx, po, opt, arg);
+if (ret < 0)
+return ret;
+
+return !!(po->flags & HAS_ARG);
+}
+
 void parse_options(void *optctx, int argc, char **argv, const OptionDef 
*options,
void (*parse_arg_function)(void *, const char*))
 {
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index fa2b255..a2f74b5 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -301,6 +301,19 @@ int parse_option(void *optctx, const char *opt, const char 
*arg,
  const OptionDef *options);
 
 /**
+* Parse the duplicate of one given option (carrying same name). Some options 
may
+* need to be dealt with func_arg as well as OPT_SPEC.
+* Ex: channel_layout is parsed with func_arg (allowing strings as well as 
numerals
+* as arguments); but it can be needed also as an OPT_SPEC.
+* The duplicate option should be defined in an OptionDef table right after the 
main
+* option and carries the same name.
+*
+* @return on success 1 if arg was consumed, 0 otherwise; negative number on 
error
+*/
+int parse_duplicate_option(void *optctx, const char *opt, const char *arg,
+const OptionDef *options);
+
+/**
  * An option extracted from the commandline.
  * Cannot use AVDictionary because of options like -map which can be
  * used multiple times.
-- 
2.10.1.windows.1

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


[FFmpeg-devel] [PATCH 0/6] Optimize HEVC decoding on ARM (32bit) platform

2017-11-22 Thread Shengbin Meng
Our tests show that CPU clocks are reduced for each module:
~48% for qpel weight
~17% for epel
~71% for sao edge mode
~48% for sao band mode
~60% for idct of 16x16 block
And overall decoding speeds up by 20~30% (increase of FPS).

We also compared the decoding results to make sure they are the same
before and after the optimization.

These patches are based on the n3.4 release.

Meng Wang (5):
  avcodec/hevcdsp: Add NEON optimization for qpel weighted mode
  avcodec/hevcdsp: Add NEON optimization for epel
  avcodec/hevcdsp: Use pre-load (pld) to optimize data loading
  avcodec/hevcdsp: Add NEON optimization for sao
  avcodec/hevcdsp: Add NEON optimization for idct16x16

Shengbin Meng (1):
  avcodec/hevcdsp: Add NEON optimization for whole-pixel interpolation

 libavcodec/arm/Makefile|4 +-
 libavcodec/arm/hevcdsp_epel_neon.S | 2078 
 libavcodec/arm/hevcdsp_idct_neon.S |  241 +
 libavcodec/arm/hevcdsp_init_neon.c |  695 
 libavcodec/arm/hevcdsp_qpel_neon.S |  702 
 libavcodec/arm/hevcdsp_sao_neon.S  |  181 
 6 files changed, 3900 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S
 create mode 100644 libavcodec/arm/hevcdsp_sao_neon.S

-- 
2.13.6 (Apple Git-96)

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


[FFmpeg-devel] [PATCH 1/6] avcodec/hevcdsp: Add NEON optimization for qpel weighted mode

2017-11-22 Thread Shengbin Meng
From: Meng Wang 

Signed-off-by: Meng Wang 
---
 libavcodec/arm/hevcdsp_init_neon.c |  66 +
 libavcodec/arm/hevcdsp_qpel_neon.S | 509 +
 2 files changed, 575 insertions(+)

diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
b/libavcodec/arm/hevcdsp_init_neon.c
index 1a3912c609..2559c92095 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -63,6 +63,8 @@ static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, 
ptrdiff_t dststride, uint8
int height, int width);
 static void (*put_hevc_qpel_uw_neon[4][4])(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *_src, ptrdiff_t _srcstride,
int width, int height, int16_t* src2, 
ptrdiff_t src2stride);
+static void (*put_hevc_qpel_wt_neon[4][4])(uint8_t *_dst, ptrdiff_t 
_dststride, uint8_t *_src, ptrdiff_t _srcstride,
+   int width, int height, int denom, int wx1, 
int ox1, int wx0, int ox0, int16_t* src2, ptrdiff_t src2stride);
 void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t 
srcstride,
int height, intptr_t mx, intptr_t my, int 
width);
 void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *src, ptrdiff_t srcstride,
@@ -70,6 +72,15 @@ void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, 
ptrdiff_t dststride, uint8_
 void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *src, ptrdiff_t srcstride,
int16_t *src2,
int height, intptr_t mx, intptr_t my, 
int width);
+void ff_hevc_put_qpel_uni_w_neon_wrapper(uint8_t *dst,  ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int denom, int wx, int ox,
+ intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_qpel_bi_w_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *src, ptrdiff_t srcstride,
+int16_t *src2,
+int height, int denom, int wx0, int 
wx1,
+int ox0, int ox1, intptr_t mx, 
intptr_t my, int width);
+
 #define QPEL_FUNC(name) \
 void name(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t 
srcstride, \
int height, int width)
@@ -124,6 +135,26 @@ QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v2_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v3_neon_8);
 #undef QPEL_FUNC_UW
 
+#define QPEL_FUNC_WT(name) \
+void name(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t 
_srcstride, \
+int width, int height, int denom, int wx1, int ox1, int wx0, int ox0, 
int16_t* src2, ptrdiff_t src2stride);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_v1_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_v2_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_v3_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h1_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h2_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h1v1_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h1v2_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h1v3_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h2v1_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h2v2_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h2v3_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v1_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v2_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v3_neon_8);
+#undef QPEL_FUNC_WT
+
 void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t 
srcstride,
int height, intptr_t mx, intptr_t my, int 
width) {
 
@@ -142,6 +173,20 @@ void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, 
ptrdiff_t dststride, uint8_t
 put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, 
height, src2, MAX_PB_SIZE);
 }
 
+void ff_hevc_put_qpel_uni_w_neon_wrapper(uint8_t *dst,  ptrdiff_t dststride,
+  uint8_t *src, ptrdiff_t 
srcstride,
+  int height, int denom, int wx, 
int ox,
+  intptr_t mx, intptr_t my, int 
width) {
+put_hevc_qpel_wt_neon[my][mx](dst, dststride, src, srcstride, width, 
height, denom, wx, ox, 0, 0, NULL, 0);
+}
+
+void ff_hevc_put_qpel_bi_w_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *src, ptrdiff_t srcstride,
+ int16_t *src2,
+ int height, int denom, int wx0, 
int wx1,
+ int ox0, int ox1, intptr_t mx, 
intptr_t my, int width) {
+put_hevc_qpel_wt_neon[my][mx](dst, dststride, src, srcstride, width, 
height, denom, wx1, 

[FFmpeg-devel] [PATCH 5/6] avcodec/hevcdsp: Add NEON optimization for sao

2017-11-22 Thread Shengbin Meng
From: Meng Wang 

Signed-off-by: Meng Wang 
---
 libavcodec/arm/Makefile|   3 +-
 libavcodec/arm/hevcdsp_init_neon.c |  62 +
 libavcodec/arm/hevcdsp_sao_neon.S  | 181 +
 3 files changed, 245 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/arm/hevcdsp_sao_neon.S

diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index 1acda0b1f8..fc4c0147c5 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -137,7 +137,8 @@ NEON-OBJS-$(CONFIG_HEVC_DECODER)   += 
arm/hevcdsp_init_neon.o   \
   arm/hevcdsp_deblock_neon.o\
   arm/hevcdsp_idct_neon.o   \
   arm/hevcdsp_qpel_neon.o   \
-  arm/hevcdsp_epel_neon.o
+  arm/hevcdsp_epel_neon.o   \
+ arm/hevcdsp_sao_neon.o
 NEON-OBJS-$(CONFIG_RV30_DECODER)   += arm/rv34dsp_neon.o
 NEON-OBJS-$(CONFIG_RV40_DECODER)   += arm/rv34dsp_neon.o\
   arm/rv40dsp_neon.o
diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
b/libavcodec/arm/hevcdsp_init_neon.c
index 6171863113..33cc44ef40 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -23,6 +23,13 @@
 #include "libavcodec/hevcdsp.h"
 #include "hevcdsp_arm.h"
 
+void ff_hevc_sao_band_filter_neon_wrapper(uint8_t *_dst, uint8_t *_src,
+  ptrdiff_t stride_dst, ptrdiff_t stride_src,
+  int16_t *sao_offset_val, int sao_left_class,
+  int width, int height);
+void ff_hevc_sao_edge_filter_neon_wrapper(uint8_t *_dst, uint8_t *_src, 
ptrdiff_t stride_dst, int16_t *sao_offset_val,
+  int eo, int width, int height);
+
 void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int 
_beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
 void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int 
_beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
 void ff_hevc_v_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int 
*_tc, uint8_t *_no_p, uint8_t *_no_q);
@@ -396,6 +403,51 @@ EPEL_FUNC_WT(ff_hevc_put_epel_wt_h6v7_neon_8);
 EPEL_FUNC_WT(ff_hevc_put_epel_wt_h7v7_neon_8);
 #undef EPEL_FUNC_WT
 
+void ff_hevc_sao_band_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t 
stride_dst, ptrdiff_t stride_src, int width, int height, int16_t *offset_table);
+
+void ff_hevc_sao_band_filter_neon_wrapper(uint8_t *_dst, uint8_t *_src,
+  ptrdiff_t stride_dst, ptrdiff_t stride_src,
+  int16_t *sao_offset_val, int sao_left_class,
+  int width, int height) {
+uint8_t *dst = (uint8_t *)_dst;
+uint8_t *src = (uint8_t *)_src;
+int16_t offset_table[32] = {0};
+int k;
+
+stride_dst /= sizeof(uint8_t);
+stride_src /= sizeof(uint8_t);
+
+for (k = 0; k < 4; k++) {
+offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
+}
+
+ff_hevc_sao_band_filter_neon_8(dst, src, stride_dst, stride_src, width, 
height, offset_table);
+}
+
+void ff_hevc_sao_edge_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t 
stride_dst, ptrdiff_t stride_src, int width, int height,
+int a_stride, int b_stride, int16_t 
*sao_offset_val, uint8_t *edge_idx);
+
+void ff_hevc_sao_edge_filter_neon_wrapper(uint8_t *_dst, uint8_t *_src, 
ptrdiff_t stride_dst, int16_t *sao_offset_val,
+  int eo, int width, int height) {
+static uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
+static const int8_t pos[4][2][2] = {
+{ { -1,  0 }, {  1, 0 } }, // horizontal
+{ {  0, -1 }, {  0, 1 } }, // vertical
+{ { -1, -1 }, {  1, 1 } }, // 45 degree
+{ {  1, -1 }, { -1, 1 } }, // 135 degree
+};
+uint8_t *dst = (uint8_t *)_dst;
+uint8_t *src = (uint8_t *)_src;
+int a_stride, b_stride;
+ptrdiff_t stride_src = (2*64 + 32) / sizeof(uint8_t);
+stride_dst /= sizeof(uint8_t);
+
+a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src;
+b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src;
+
+ff_hevc_sao_edge_filter_neon_8(dst, src, stride_dst, stride_src, width, 
height, a_stride, b_stride, sao_offset_val, edge_idx);
+}
+
 void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t 
srcstride,
int height, intptr_t mx, intptr_t my, int 
width) {
 
@@ -486,6 +538,16 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const 
int bit_depth)
 c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_neon;
 

Re: [FFmpeg-devel] [PATCH 1/6] avcodec/hevcdsp: Add NEON optimization for qpel weighted mode

2017-11-22 Thread Michael Niedermayer
On Wed, Nov 22, 2017 at 07:12:01PM +0800, Shengbin Meng wrote:
> From: Meng Wang 
> 
> Signed-off-by: Meng Wang 
> ---
>  libavcodec/arm/hevcdsp_init_neon.c |  66 +
>  libavcodec/arm/hevcdsp_qpel_neon.S | 509 
> +
>  2 files changed, 575 insertions(+)
> 
> diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
> b/libavcodec/arm/hevcdsp_init_neon.c

This seems not to apply to git master


Applying: avcodec/hevcdsp: Add NEON optimization for qpel weighted mode
Using index info to reconstruct a base tree...
M   libavcodec/arm/hevcdsp_init_neon.c
Falling back to patching base and 3-way merge...
Auto-merging libavcodec/arm/hevcdsp_init_neon.c
CONFLICT (content): Merge conflict in libavcodec/arm/hevcdsp_init_neon.c
error: Failed to merge in the changes.
Patch failed at 0001 avcodec/hevcdsp: Add NEON optimization for qpel weighted 
mode
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Guess video codec delay based on PTS while parsing MOV header.

2017-11-22 Thread Michael Niedermayer
On Wed, Nov 22, 2017 at 01:21:45PM +0530, Sasi Inguva wrote:
> I was just shooting for a heuristic which works for most of the cases.

I do not think a heuristic is a good idea. Its not very hard to
compute this exactly. You just reorder using a 16 entry buffer and
keep track of what the largest size was that was actually needed.

Or a buffer that is increased in size whenever it would lead to
out of order output



[...]

> I can build a better heuristic by finding the  frame with next min. PTS
> after Pmin and computing the distance between that frame and Pmin.  However
> that will still fail for this example,
>  0, 3, 5, 1, 4, 2 . The delay computed will be 2 (because 2 frames between
> 0 and 1 ) but we need a buffer size of 3 .
> 
> On Wed, Nov 22, 2017 at 8:29 AM, Michael Niedermayer  > wrote:
> 
> > On Mon, Nov 20, 2017 at 08:27:05PM -0800, Sasi Inguva wrote:
> > > Signed-off-by: Sasi Inguva 
> > > ---
> > >  libavformat/mov.c| 50 ++
> > ++
> > >  tests/fate/mov.mak   |  7 ++
> > >  tests/ref/fate/mov-guess-delay-1 |  3 +++
> > >  tests/ref/fate/mov-guess-delay-2 |  3 +++
> > >  tests/ref/fate/mov-guess-delay-3 |  3 +++
> > >  5 files changed, 66 insertions(+)
> > >  create mode 100644 tests/ref/fate/mov-guess-delay-1
> > >  create mode 100644 tests/ref/fate/mov-guess-delay-2
> > >  create mode 100644 tests/ref/fate/mov-guess-delay-3
> > >
> > > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > > index fd170baa57..afb0d4ca5c 100644
> > > --- a/libavformat/mov.c
> > > +++ b/libavformat/mov.c
> > > @@ -3213,6 +3213,54 @@ static int64_t add_ctts_entry(MOVStts**
> > ctts_data, unsigned int* ctts_count, uns
> > >  return *ctts_count;
> > >  }
> > >
> > > +static void mov_guess_video_delay(MOVContext *c, AVStream* st) {
> > > +MOVStreamContext *msc = st->priv_data;
> > > +int ind;
> > > +int ctts_ind = 0;
> > > +int ctts_sample = 0;
> > > +int64_t curr_pts = AV_NOPTS_VALUE;
> > > +int64_t min_prev_pts = AV_NOPTS_VALUE;
> > > +int64_t prev_max_pts = AV_NOPTS_VALUE;
> > > +int num_steps = 0;
> > > +
> > > +if (st->codecpar->video_delay <= 0 && msc->ctts_data &&
> > > +st->codecpar->codec_id == AV_CODEC_ID_H264) {
> > > +st->codecpar->video_delay = 0;
> > > +for(ind = 0; ind < st->nb_index_entries && ctts_ind <
> > msc->ctts_count; ++ind) {
> > > +curr_pts = st->index_entries[ind].timestamp +
> > msc->ctts_data[ctts_ind].duration;
> > > +
> > > +// Everytime we encounter a new max_pts we reset num_steps
> > and compute again.
> > > +if (curr_pts > prev_max_pts) {
> > > +st->codecpar->video_delay = 
> > > FFMIN(FFMAX(st->codecpar->video_delay,
> > num_steps), 16);
> > > +num_steps = 0;
> > > +prev_max_pts = curr_pts;
> > > +min_prev_pts = curr_pts;
> > > +} else {
> > > +// Compute delay as the length of the path from max PTS
> > to min PTS.
> > > +// Frames: I0 I1 B0 B1 B2
> > > +// PTS: 0  4  1  2  3 -> num_steps = delay = 1
> > (4->1)
> > > +//
> > > +// Frames: I0 I1 B1 B0 B2
> > > +// PTS: 0  4  2  1  3 -> num_steps = delay = 2
> > (4->2, 2->1)
> > > +if (min_prev_pts != AV_NOPTS_VALUE) {
> > > +if (curr_pts < min_prev_pts) {
> > > +++num_steps;
> > > +min_prev_pts = curr_pts;
> > > +}
> > > +}
> > > +}
> >
> > Can you explain why this algorithm is correct ?
> > (iam asking as i suspect it is not correct, but i may be wrong)
> >
> > What this should do is find the minimum buffer size to sort the stream
> > of frame timestamps.
> >
> >
> > [...]
> > --
> > 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
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.


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


[FFmpeg-devel] [DEVEL][PATCH 2/2] ffmpeg: fix ticket 6706

2017-11-22 Thread pkv.stream


From 532b13fb2a174af0b91a0b08984cbdb8d5027392 Mon Sep 17 00:00:00 2001
From: pkviet 
Date: Sat, 18 Nov 2017 00:26:50 +0100
Subject: [PATCH 2/2] ffmpeg: fix ticket 6706

Fix regression with channel_layout option which is not passed
correctly from output streams to filters when the channel layout is not
a default one.

Signed-off-by: pkviet 
---
 fftools/ffmpeg.h |  3 +++
 fftools/ffmpeg_opt.c | 34 ++
 2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index e0977e1..5c45df4 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -121,6 +121,8 @@ typedef struct OptionsContext {
 intnb_frame_sizes;
 SpecifierOpt *frame_pix_fmts;
 intnb_frame_pix_fmts;
+SpecifierOpt *channel_layouts;
+intnb_channel_layouts;
 
 /* input options */
 int64_t input_ts_offset;
@@ -624,6 +626,7 @@ extern int vstats_version;
 extern const AVIOInterruptCB int_cb;
 
 extern const OptionDef options[];
+extern const OptionDef channel_layout_option[];
 extern const HWAccel hwaccels[];
 extern AVBufferRef *hw_device_ctx;
 #if CONFIG_QSV
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f66f672..6da53aa 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1818,6 +1818,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, 
AVFormatContext *oc, in
 char *sample_fmt = NULL;
 
 MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);
+MATCH_PER_STREAM_OPT(channel_layouts, ui64, audio_enc->channel_layout, 
oc, st);
 
 MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
 if (sample_fmt &&
@@ -2542,7 +2543,11 @@ loop_end:
(count + 1) * sizeof(*f->sample_rates));
 }
 if (ost->enc_ctx->channels) {
-f->channel_layout = 
av_get_default_channel_layout(ost->enc_ctx->channels);
+if (ost->enc_ctx->channel_layout) {
+f->channel_layout = ost->enc_ctx->channel_layout;
+} else {
+f->channel_layout = 
av_get_default_channel_layout(ost->enc_ctx->channels);
+}
 } else if (ost->enc->channel_layouts) {
 count = 0;
 while (ost->enc->channel_layouts[count])
@@ -3119,7 +3124,7 @@ static int opt_channel_layout(void *optctx, const char 
*opt, const char *arg)
 char layout_str[32];
 char *stream_str;
 char *ac_str;
-int ret, channels, ac_str_size;
+int ret, channels, ac_str_size, stream_str_size;
 uint64_t layout;
 
 layout = av_get_channel_layout(arg);
@@ -3131,12 +3136,30 @@ static int opt_channel_layout(void *optctx, const char 
*opt, const char *arg)
 ret = opt_default_new(o, opt, layout_str);
 if (ret < 0)
 return ret;
+stream_str = strchr(opt, ':');
+stream_str_size = (stream_str ? strlen(stream_str) : 0);
+/* set duplicate 'channel_layout' option in SpecifierOpt,
+ *  enabling access to channel layout through MATCH_PER_STREAM_OPT
+ */
+ac_str_size = 22 + stream_str_size;
+ac_str = av_mallocz(ac_str_size);
+if (!ac_str) {
+return AVERROR(ENOMEM);
+}
+av_strlcpy(ac_str, "channel_layout", 22);
+if (stream_str) {
+av_strlcat(ac_str, stream_str, ac_str_size);
+}
+ret = parse_duplicate_option(o, ac_str, layout_str, options);
+av_free(ac_str);
+if (ret < 0) {
+return ret;
+}
 
 /* set 'ac' option based on channel layout */
 channels = av_get_channel_layout_nb_channels(layout);
 snprintf(layout_str, sizeof(layout_str), "%d", channels);
-stream_str = strchr(opt, ':');
-ac_str_size = 3 + (stream_str ? strlen(stream_str) : 0);
+ac_str_size = 3 + stream_str_size;
 ac_str = av_mallocz(ac_str_size);
 if (!ac_str)
 return AVERROR(ENOMEM);
@@ -3689,6 +3712,9 @@ const OptionDef options[] = {
 { "channel_layout", OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE |
 OPT_INPUT | OPT_OUTPUT,
{ .func_arg = opt_channel_layout },
 "set channel layout", "layout" },
+{ "channel_layout", OPT_AUDIO | HAS_ARG | OPT_INT64 | OPT_SPEC |
+   OPT_INPUT | OPT_OUTPUT, 
{ .off = OFFSET(channel_layouts) },
+"set channel layout with uint64", "layout_uint64" }, // allows storage 
of option in SpecifierOpt
 { "af", OPT_AUDIO | HAS_ARG  | OPT_PERFILE | OPT_OUTPUT,   
{ .func_arg = opt_audio_filters },
 "set audio filters", "filter_graph" },
 { "guess_layout_max", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | 
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(guess_layout_max) },
-- 
2.10.1.windows.1

___
ffmpeg-devel 

Re: [FFmpeg-devel] [PATCH 3/4] avformat/movenc: force colr atom for uncompressed yuv in mov

2017-11-22 Thread Kevin Wheatley
The guess work comes from this list:

https://developer.apple.com/library/content/technotes/tn2162/_index.html#//apple_ref/doc/uid/DTS40013070-CH1-TNTAG10-SAMPLE__COLR__SETTINGS

and I agree is the source of a lot of chaos, but it is what several
tools have done in the absence of any specified values.

My usage of the feature is to write the atom when I need to by
explicitly enabling it on the command line and I also explicitly set
the metadata either from the input file, or by overriding on the
command line.

Kevin


On Mon, Nov 20, 2017 at 4:52 PM, Derek Buitenhuis
 wrote:
> On 11/20/2017 4:45 PM, Dave Rice wrote:
>> What do you propose as the default for guessed_hacky_crap? Also are there 
>> supporters for the need of a guessed_hacky_crap optio? Is there precedence 
>> in ffmpeg to enable/disable guesswork via a user option?
>
> I personally would never use the guesswork stuff, since I think it is a
> terrible idea, so can't really propose a default or support it.
>
> The guesswork stuff was added at the same time as colr support, by Michael,
> in 7b6f4191763a5ffde02fa198101aabc3ddb5bf61, so maybe he has some opinion.
>
> - Derek
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/6] avcodec/hevcdsp: Add NEON optimization for epel

2017-11-22 Thread Shengbin Meng
From: Meng Wang 

Signed-off-by: Meng Wang 
---
 libavcodec/arm/Makefile|3 +-
 libavcodec/arm/hevcdsp_epel_neon.S | 2068 
 libavcodec/arm/hevcdsp_init_neon.c |  459 
 3 files changed, 2529 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S

diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index 1eeac5449e..1acda0b1f8 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -136,7 +136,8 @@ NEON-OBJS-$(CONFIG_DCA_DECODER)+= 
arm/synth_filter_neon.o
 NEON-OBJS-$(CONFIG_HEVC_DECODER)   += arm/hevcdsp_init_neon.o   \
   arm/hevcdsp_deblock_neon.o\
   arm/hevcdsp_idct_neon.o   \
-  arm/hevcdsp_qpel_neon.o
+  arm/hevcdsp_qpel_neon.o   \
+  arm/hevcdsp_epel_neon.o
 NEON-OBJS-$(CONFIG_RV30_DECODER)   += arm/rv34dsp_neon.o
 NEON-OBJS-$(CONFIG_RV40_DECODER)   += arm/rv34dsp_neon.o\
   arm/rv40dsp_neon.o
diff --git a/libavcodec/arm/hevcdsp_epel_neon.S 
b/libavcodec/arm/hevcdsp_epel_neon.S
new file mode 100644
index 00..d0d93e8033
--- /dev/null
+++ b/libavcodec/arm/hevcdsp_epel_neon.S
@@ -0,0 +1,2068 @@
+/*
+ * Copyright (c) 2017 Meng Wang 
+ *
+ * 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/arm/asm.S"
+#include "neon.S"
+
+.macro regshuffle_d4
+vmov d16, d17
+vmov d17, d18
+vmov d18, d19
+.endm
+
+.macro regshuffle_q4
+vmov q0, q1
+vmov q1, q2
+vmov q2, q3
+.endm
+
+.macro vextin4
+pld   [r2]
+vld1.8{q11}, [r2], r3
+vext.8d16, d22, d23, #1
+vext.8d17, d22, d23, #2
+vext.8d18, d22, d23, #3
+vext.8d19, d22, d23, #4
+.endm
+
+.macro loadin4
+pld   [r2]
+vld1.8{d16}, [r2], r3
+pld   [r2]
+vld1.8{d17}, [r2], r3
+pld   [r2]
+vld1.8{d18}, [r2], r3
+pld   [r2]
+vld1.8{d19}, [r2], r3
+.endm
+
+.macro epel_filter_1_32b
+vmov.i16   d16, #58
+vmov.i16   d17, #10
+vmull.s16  q9,  d2,  d16   // 58*b0
+vmull.s16  q10, d3,  d16   // 58*b1
+vmull.s16  q11, d4,  d17   // 10*c0
+vmull.s16  q12, d5,  d17   // 10*c1
+vadd.s32   q11, q9
+vadd.s32   q12, q10
+vaddl.s16  q9,  d0,  d6
+vaddl.s16  q10, d1,  d7
+vshl.s32   q13, q9,  #1// 2*a + 2*d
+vshl.s32   q14, q10, #1
+vsub.s32   q11, q13// -2*a + 58*b + 10*c -2*d
+vsub.s32   q12, q14
+vqshrn.s32 d16, q11, #6
+vqshrn.s32 d17, q12, #6   // out=q8
+.endm
+
+.macro epel_filter_2_32b
+vmov.i16   d16, #54
+vmull.s16  q9,  d2, d16   // 54*b0
+vmull.s16  q10, d3, d16   // 54*b1
+vshll.s16  q11, d4, #4// 16*c0
+vshll.s16  q12, d5, #4// 16*c1
+vadd.s32   q9,  q11
+vadd.s32   q10, q12
+vshll.s16  q11, d0, #2// 4*a0
+vshll.s16  q12, d1, #2// 4*a1
+vshll.s16  q13, d6, #1// 2*d0
+vshll.s16  q14, d7, #1// 2*d0
+vadd.s32   q11, q13
+vadd.s32   q12, q14
+vsub.s32   q9,  q11   // -4*a + 54*b + 16*c - 2*d
+vsub.s32   q10, q12
+vqshrn.s32 d16, q9,  #6
+vqshrn.s32 d17, q10, #6   // out=q8
+.endm
+
+.macro epel_filter_3_32b
+vmov.i16   d16, #46
+vmull.s16  q9,  d2, d16   // 46*b0
+vmull.s16  q10, d3, d16   // 46*b1
+vshll.s16  q11, d4, #5
+vshll.s16  q12, d5, #5
+vshll.s16  q13, d4, #2
+vshll.s16  q14, d5, #2
+vsub.s32   q11, q13   // 28*c0
+vsub.s32   q12, q14   // 28*c1
+vadd.s32   q9,  q11   // 46*b0 + 28*c0
+vadd.s32   q10, q12   // 46*b1 + 28*c1
+vshll.s16  q11, d6, #2// 4*d0
+vshll.s16  q12, d7, #2// 4*d1
+vmov.i16   d16, #6
+vmull.s16  q13, d0, 

[FFmpeg-devel] [PATCH 4/6] avcodec/hevcdsp: Use pre-load (pld) to optimize data loading

2017-11-22 Thread Shengbin Meng
From: Meng Wang 

Signed-off-by: Meng Wang 
---
 libavcodec/arm/hevcdsp_epel_neon.S | 10 ++
 libavcodec/arm/hevcdsp_qpel_neon.S | 24 
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/libavcodec/arm/hevcdsp_epel_neon.S 
b/libavcodec/arm/hevcdsp_epel_neon.S
index d0d93e8033..03e6504481 100644
--- a/libavcodec/arm/hevcdsp_epel_neon.S
+++ b/libavcodec/arm/hevcdsp_epel_neon.S
@@ -306,6 +306,7 @@
 cmp   r5, #2
 beq   2f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vst1.16{q7}, [r0], r1
 regshuffle_d4
@@ -320,6 +321,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vst1.16d14, [r0], r1
 regshuffle_d4
@@ -357,6 +359,7 @@
 cmp   r5, #2
 beq   2f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vqrshrun.s16   d0, q7, #6
 vst1.8d0, [r0], r1
@@ -372,6 +375,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vqrshrun.s16   d0, q7, #6
 vst1.32d0[0], [r0], r1
@@ -396,6 +400,7 @@
 cmp   r5, #2
 beq   2f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vld1.16{q0}, [r8], r9
 vqadd.s16  q0, q7
@@ -415,6 +420,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vld1.16  d0, [r8], r9
 vqadd.s16d0, d14
@@ -465,6 +471,7 @@
 cmp   r5, #2
 beq   2f
 8:  subs  r4, #1
+pld   [r2]
 \filter
 vmovl.s16 q12, d14   // extending signed 4x16bit data to 4x32 
bit
 vmovl.s16 q13, d15
@@ -490,6 +497,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vmovl.s16 q12, d14  // extending signed 4x16bit data to 4x32 
bit
 vmul.s32  q14, q12, q6
@@ -535,6 +543,7 @@
 cmp   r5, #2
 beq   2f
 8:  subsr4,   #1
+pld [r2]
 \filter
 vmovl.s16 q12, d14  // extending signed 4x16bit data to 
4x32 bit
 vmovl.s16 q13, d15
@@ -569,6 +578,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vmovl.s16q12, d14
 vmul.s32 q14, q12, q6
diff --git a/libavcodec/arm/hevcdsp_qpel_neon.S 
b/libavcodec/arm/hevcdsp_qpel_neon.S
index 71ecc00b6e..b507fbc13b 100644
--- a/libavcodec/arm/hevcdsp_qpel_neon.S
+++ b/libavcodec/arm/hevcdsp_qpel_neon.S
@@ -231,6 +231,7 @@
 cmp   r5, #4
 beq   4f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vst1.16{q7}, [r0], r1
 regshuffle_d8
@@ -245,6 +246,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vst1.16d14, [r0], r1
 regshuffle_d8
@@ -273,6 +275,7 @@
 cmp   r5, #4
 beq   4f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vqrshrun.s16   d0, q7, #6
 vst1.8d0, [r0], r1
@@ -288,6 +291,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vqrshrun.s16   d0, q7, #6
 vst1.32d0[0], [r0], r1
@@ -301,6 +305,7 @@
 cmp   r5, #4
 beq   4f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vld1.16{q0}, [r8], r9
 vqadd.s16  q0, q7
@@ -320,6 +325,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vld1.16  d0, [r8], r9
 vqadd.s16d0, d14
@@ -358,6 +364,7 @@
 cmp   r5, #4
 beq   4f
 8:  subs  r4, #1
+pld   [r2]
 \filter
 vmovl.s16 q12, d14 // extending signed 4x16bit data to 4x32 bit
 vmovl.s16 q13, d15
@@ -383,6 +390,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vmovl.s16 q12, d14  // extending signed 4x16bit data to 4x32 
bit
 vmul.s32  q14, q12, q6
@@ -412,6 +420,7 @@
 cmp r5,   #4
 beq 4f
 8:  subsr4,   #1
+pld   [r2]
 \filter
 vmovl.s16 q12, d14  // extending signed 4x16bit data to 
4x32 bit
 vmovl.s16 q13, d15
@@ -446,6 +455,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vmovl.s16q12, d14
 vmul.s32 q14, q12, q6
@@ -1524,8 +1534,9 @@ function ff_hevc_put_qpel_bi_uw_pixels_neon_8, export=1
 cmp   r5, #4
 beq   4f
 8:  subs r4, #1
-vshll.u8  

[FFmpeg-devel] [PATCH 3/6] avcodec/hevcdsp: Add NEON optimization for whole-pixel interpolation

2017-11-22 Thread Shengbin Meng
New code is written for qpel; and then code for qpel is reused for epel,
because whole-pixel interpolation in qpel and epel are identical.

Signed-off-by: Shengbin Meng 
---
 libavcodec/arm/hevcdsp_init_neon.c | 106 ++
 libavcodec/arm/hevcdsp_qpel_neon.S | 177 +
 2 files changed, 283 insertions(+)

diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
b/libavcodec/arm/hevcdsp_init_neon.c
index 9d885a62a9..6171863113 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -71,6 +71,10 @@ static void (*put_hevc_epel_uw_neon[8][8])(uint8_t *dst, 
ptrdiff_t dststride, ui
int width, int height, int16_t* 
src2, ptrdiff_t src2stride);
 static void (*put_hevc_epel_wt_neon[8][8])(uint8_t *_dst, ptrdiff_t 
_dststride, uint8_t *_src, ptrdiff_t _srcstride,
int width, int height, int denom, 
int wx1, int ox1, int wx0, int ox0, int16_t* src2, ptrdiff_t src2stride);
+static void (*put_hevc_qpel_bi_uw_pixels_neon[1])(uint8_t *dst, ptrdiff_t 
dststride, uint8_t *_src, ptrdiff_t _srcstride,
+  int width, int height, int16_t* 
src2, ptrdiff_t src2stride);
+static void (*put_hevc_qpel_wt_pixels_neon[1])(uint8_t *_dst, ptrdiff_t 
_dststride, uint8_t *_src, ptrdiff_t _srcstride,
+  int width, int height, 
int denom, int wx1, int ox1, int wx0, int ox0, int16_t* src2, ptrdiff_t 
src2stride);
 void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t 
srcstride,
int height, intptr_t mx, intptr_t my, int 
width);
 void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *src, ptrdiff_t srcstride,
@@ -101,6 +105,17 @@ void ff_hevc_put_epel_bi_w_neon_wrapper(uint8_t *dst, 
ptrdiff_t dststride, uint8
  int16_t *src2,
  int height, int denom, int wx0, 
int wx1,
  int ox0, int ox1, intptr_t mx, 
intptr_t my, int width);
+void ff_hevc_put_qpel_bi_uw_pixels_neon_wrapper(uint8_t *dst, ptrdiff_t 
dststride, uint8_t *src, ptrdiff_t srcstride,
+   int16_t *src2,
+   int height, intptr_t mx, 
intptr_t my, int width);
+void ff_hevc_put_qpel_uni_wt_pixels_neon_wrapper(uint8_t *dst,  ptrdiff_t 
dststride,
+  uint8_t *src, ptrdiff_t 
srcstride,
+  int height, int denom, int wx, 
int ox,
+  intptr_t mx, intptr_t my, int 
width);
+void ff_hevc_put_qpel_bi_wt_pixels_neon_wrapper(uint8_t *dst, ptrdiff_t 
dststride, uint8_t *src, ptrdiff_t srcstride,
+int16_t *src2,
+int height, int denom, int 
wx0, int wx1,
+int ox0, int ox1, intptr_t mx, 
intptr_t my, int width);
 
 #define QPEL_FUNC(name) \
 void name(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t 
srcstride, \
@@ -154,6 +169,7 @@ QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h2v3_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v1_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v2_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v3_neon_8);
+QPEL_FUNC_UW(ff_hevc_put_qpel_bi_uw_pixels_neon_8);
 #undef QPEL_FUNC_UW
 
 #define QPEL_FUNC_WT(name) \
@@ -174,6 +190,7 @@ QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h2v3_neon_8);
 QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v1_neon_8);
 QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v2_neon_8);
 QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v3_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_pixels_neon_8);
 #undef QPEL_FUNC_WT
 
 
@@ -441,6 +458,26 @@ void ff_hevc_put_epel_bi_w_neon_wrapper(uint8_t *dst, 
ptrdiff_t dststride, uint8
 put_hevc_epel_wt_neon[my][mx](dst, dststride, src, srcstride, width, 
height, denom, wx1, ox1, wx0, ox0, src2, MAX_PB_SIZE);
 }
 
+void ff_hevc_put_qpel_bi_uw_pixels_neon_wrapper(uint8_t *dst, ptrdiff_t 
dststride, uint8_t *src, ptrdiff_t srcstride,
+   int16_t *src2,
+   int height, intptr_t mx, 
intptr_t my, int width) {
+put_hevc_qpel_bi_uw_pixels_neon[0](dst, dststride, src, srcstride, width, 
height, src2, MAX_PB_SIZE);
+}
+
+void ff_hevc_put_qpel_uni_wt_pixels_neon_wrapper(uint8_t *dst,  ptrdiff_t 
dststride,
+ uint8_t *src, ptrdiff_t 
srcstride,
+ int height, int denom, 
int wx, int ox,
+ intptr_t mx, intptr_t my, 
int width) {
+put_hevc_qpel_wt_pixels_neon[0](dst, 

Re: [FFmpeg-devel] [mov] Increment stsd_count while processing stsd data; avoids leaks.

2017-11-22 Thread Michael Niedermayer
On Tue, Nov 21, 2017 at 03:42:40PM -0800, Dale Curtis wrote:
> In the event of ff_mov_read_stsd_entries() failure, sc->stsd_count
> is not updated, even if the function allocates extradata memory.
> Instead update the sc->stsd_count as entries are parsed so that
> mov_read_close() can do the right thing.
> 
> Signed-off-by: Dale Curtis 

>  mov.c |7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 4e5dd3d8a96401f9e1e79008ed4655d8896dbd21  fix_stsd_leak_v1.patch
> From 3c69f724173582f48189a92c3116a6783e078961 Mon Sep 17 00:00:00 2001
> From: Dale Curtis 
> Date: Tue, 21 Nov 2017 15:40:22 -0800
> Subject: [PATCH] [mov] Increment stsd_count while processing stsd data; avoids
>  leaks.
> 
> In the event of ff_mov_read_stsd_entries() failure, sc->stsd_count
> is not updated, even if the function allocates extradata memory.
> Instead update the sc->stsd_count as entries are parsed so that
> mov_read_close() can do the right thing.
> 
> Signed-off-by: Dale Curtis 

applied

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


[FFmpeg-devel] [PATCH] libavformat/mov: Replace duplicate stream_nb check by assert

2017-11-22 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavformat/mov.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9e876efc8c..6940dfc7d5 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2437,8 +2437,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext 
*pb, int entries)
 MOVStreamContext *sc;
 int pseudo_stream_id;
 
-if (c->fc->nb_streams < 1)
-return 0;
+av_assert0 (c->fc->nb_streams >= 1);
 st = c->fc->streams[c->fc->nb_streams-1];
 sc = st->priv_data;
 
-- 
2.15.0

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


Re: [FFmpeg-devel] [PATCH] fix bug in af_pan channel coefficient parser

2017-11-22 Thread Tobias Rapp

On 21.11.2017 20:01, Michael Niedermayer wrote:

On Tue, Nov 21, 2017 at 02:24:23PM +0100, Tobias Rapp wrote:

On 20.11.2017 22:15, Michael Niedermayer wrote:

On Mon, Nov 20, 2017 at 05:14:15PM +0100, Nicolas George wrote:

Tobias Rapp (2017-11-20):

Would it be OK to backport the fix into release/3.4? I can do the
cherry-picking but am unsure about the policies and what other older
releases should possibly be adapted, too.


I do not know how backporting to releases work either, but I have of
course no objection in principle.


simple cherry pick with the hex hash in the commit message (-x)
test if it still all works and push


Backported the fix to release/3.4

Not sure what other releases are still maintained as the list within
the MAINTAINERS file looks outdated (2.5 to 2.8).


The ones we list on the download page should be updated if they are
affected


Which would currently mean release branches 3.4 to 2.8. From testing it 
seems that releases 3.2 and earlier do not support a pan filter string 
like "stereo|c0=c0-c2|c1=c1-c2", error message is 'Syntax error near 
"-c2"'. So backported the fix to release/3.3 additionally only.


Regards,
Tobias

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


Re: [FFmpeg-devel] Fix for ticket #6764

2017-11-22 Thread Carl Eugen Hoyos
2017-11-23 0:24 GMT+01:00 Colin NG :
> Add NULL pointer check for incoming audio data.

Please commit locally and attach the patch file
produced with git format-patch

Indentation looks wrong here, consider using
tools/patcheck (this may be my mistake tough).

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


Re: [FFmpeg-devel] [PATCH] libavcodec/opus: Add NULL pointer check for incoming data; avoid segfault

2017-11-22 Thread Rostislav Pehlivanov
On 23 November 2017 at 00:53, Colin NG  wrote:

> ---
> Fix for ticket 7674
>
>  libavcodec/opus_pvq.c | 16 +---
>  1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/opus_pvq.c b/libavcodec/opus_pvq.c
> index f98b85d..02ccd69 100644
> --- a/libavcodec/opus_pvq.c
> +++ b/libavcodec/opus_pvq.c
> @@ -504,6 +504,9 @@ static av_always_inline uint32_t
> quant_band_template(CeltPVQ *pvq, CeltFrame *f,
>  int longblocks = (B0 == 1);
>  uint32_t cm = 0;
>
> + if (!X)
> +return cm;
> +
>  if (N == 1) {
>  float *x = X;
>  for (i = 0; i <= stereo; i++) {
> @@ -795,7 +798,7 @@ static av_always_inline uint32_t
> quant_band_template(CeltPVQ *pvq, CeltFrame *f,
>  f->remaining2 -= curr_bits;
>  }
>
> -if (q != 0) {
> +if (X && !q) {
>  /* Finally do the actual (de)quantization */
>  if (quant) {
>  cm = celt_alg_quant(rc, X, N, (q < 8) ? q : (8 + (q & 7))
> << ((q >> 3) - 1),
> @@ -902,6 +905,9 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f,
> OpusRangeCoder *rc, int b
>  float *Y_orig = f->block[1].coeffs + (ff_celt_freq_bands[band] <<
> f->size);
>  OPUS_RC_CHECKPOINT_SPAWN(rc);
>
> +if (!X && !Y)
> +return 0.0f;
> +
>  memcpy(X, X_orig, band_size*sizeof(float));
>  if (Y)
>  memcpy(Y, Y_orig, band_size*sizeof(float));
> @@ -911,7 +917,6 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f,
> OpusRangeCoder *rc, int b
>  int curr_balance = f->remaining / FFMIN(3, f->coded_bands - band);
>  b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[band] +
> curr_balance), 14);
>  }
> -
>  if (f->dual_stereo) {
>  pvq->encode_band(pvq, f, rc, band, X, NULL, band_size, b / 2,
> f->blocks, NULL,
>   f->size, norm1, 0, 1.0f, lowband_scratch, cm[0]);
> @@ -925,7 +930,12 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame
> *f, OpusRangeCoder *rc, int b
>
>  for (i = 0; i < band_size; i++) {
>  err_x += (X[i] - X_orig[i])*(X[i] - X_orig[i]);
> -err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
> +}
> +
> +   if (Y) {
> +for (i = 0; i < band_size; i++) {
> +err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
> +}
>  }
>
>  dist = sqrtf(err_x) + sqrtf(err_y);
> --
> 2.7.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


I actually found out about this bug while working on it a few days ago but
wanted to wait until I got the opus_rc and some opusenc_psy improvements
fully done.
Pushed my fix for mono. I disagree with the rest. There should always be a
channel of audio (X) to analyze.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/3] avformat/hlsenc:addition of CODECS attribute in the master playlist

2017-11-22 Thread vdixit
From: Vishwanath Dixit 

Signed-off-by: Karthick J 
---
 libavformat/hlsenc.c | 67 +++-
 1 file changed, 66 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 9fed6a3..32246c4 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1065,6 +1065,52 @@ static int get_relative_url(const char *master_url, 
const char *media_url,
 return 0;
 }
 
+static void get_codec_str(AVStream *vid_st, AVStream *aud_st, char *vcodec,
+  char *acodec, int vcodec_len, int acodec_len) {
+if (vcodec_len > 0)
+vcodec[0] = '\0';
+else
+return;
+
+if (acodec_len > 0)
+acodec[0] = '\0';
+else
+return;
+
+if (!vid_st && !aud_st) {
+av_log(NULL, AV_LOG_WARNING, "Atleast one stream shoud be valid\n");
+return;
+}
+
+if (vid_st && vid_st->codecpar->profile != FF_PROFILE_UNKNOWN &&
+vid_st->codecpar->level != FF_LEVEL_UNKNOWN &&
+vid_st->codecpar->codec_id == AV_CODEC_ID_H264) {
+snprintf(vcodec, vcodec_len, "avc1.%02x00%02x",
+vid_st->codecpar->profile, vid_st->codecpar->level);
+}
+
+if (aud_st) {
+if (aud_st->codecpar->codec_id == AV_CODEC_ID_MP2) {
+snprintf(acodec, acodec_len, "mp4a.40.33");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_MP3) {
+snprintf(acodec, acodec_len, "mp4a.40.34");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_AAC) {
+/* TODO : For HE-AAC, HE-AACv2, the last digit needs to be set to 
5 and 29 respectively */
+snprintf(acodec, acodec_len, "mp4a.40.2");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_AC3) {
+snprintf(acodec, acodec_len, "mp4a.A5");
+} else if (aud_st->codecpar->codec_id == AV_CODEC_ID_EAC3) {
+snprintf(acodec, acodec_len, "mp4a.A6");
+}
+}
+
+// either provide codec string for both active streams or for none
+if (vid_st && aud_st && (!strlen(vcodec) || !strlen(acodec))) {
+acodec[0] = vcodec[0] = '\0';
+av_log(NULL, AV_LOG_INFO, "Codec string not available for audio or 
video stream\n");
+}
+}
+
 static int create_master_playlist(AVFormatContext *s,
   VariantStream * const input_vs)
 {
@@ -1075,7 +1121,7 @@ static int create_master_playlist(AVFormatContext *s,
 AVDictionary *options = NULL;
 unsigned int i, j;
 int m3u8_name_size, ret, bandwidth;
-char *m3U8_rel_name;
+char *m3U8_rel_name, vcodec[32], acodec[32];
 
 input_vs->m3u8_created = 1;
 if (!hls->master_m3u8_created) {
@@ -1203,6 +1249,25 @@ static int create_master_playlist(AVFormatContext *s,
 avio_printf(master_pb, ",RESOLUTION=%dx%d", 
vid_st->codecpar->width,
 vid_st->codecpar->height);
 
+get_codec_str(vid_st, aud_st, vcodec, acodec, sizeof(vcodec),
+  sizeof(acodec));
+
+if (strlen(vcodec) || strlen(acodec))
+avio_printf(master_pb, ",CODECS=\"");
+
+if (strlen(vcodec)) {
+avio_printf(master_pb, "%s", vcodec);
+
+if (strlen(acodec))
+avio_printf(master_pb, ",");
+}
+
+if (strlen(acodec))
+avio_printf(master_pb, "%s", acodec);
+
+if (strlen(vcodec) || strlen(acodec))
+avio_printf(master_pb, "\"");
+
 if (vs->agroup && aud_st)
 avio_printf(master_pb, ",AUDIO=\"group_%s\"", vs->agroup);
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 2/3] avcodec/libx264:setting profile and level in avcodec context

2017-11-22 Thread vdixit
From: Vishwanath Dixit 

Signed-off-by: Karthick J 
---
 libavcodec/libx264.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 9c67c91..eeafe31 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -454,6 +454,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
 X264Context *x4 = avctx->priv_data;
 AVCPBProperties *cpb_props;
 int sw,sh;
+x264_nal_t *nal;
+uint8_t *p;
+int nnal, s, i;
 
 if (avctx->global_quality > 0)
 av_log(avctx, AV_LOG_WARNING, "-qscale is ignored, -crf is 
recommended.\n");
@@ -799,12 +802,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (!x4->enc)
 return AVERROR_EXTERNAL;
 
-if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
-x264_nal_t *nal;
-uint8_t *p;
-int nnal, s, i;
+s = x264_encoder_headers(x4->enc, , );
+if (avctx->profile == FF_PROFILE_UNKNOWN)
+avctx->profile = nal->p_payload[5];
+if (avctx->level == FF_LEVEL_UNKNOWN)
+avctx->level = nal->p_payload[7];
 
-s = x264_encoder_headers(x4->enc, , );
+if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
 avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE);
 if (!p)
 return AVERROR(ENOMEM);
-- 
1.9.1

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


[FFmpeg-devel] [PATCH] avformat/hlsenc: Added option to add EXT-X-INDEPENDENT-SEGMENTS tag

2017-11-22 Thread Karthick J
---
 doc/muxers.texi  |  4 
 libavformat/hlsenc.c | 14 ++
 2 files changed, 18 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 0bb8ad2..9d9ca31 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -737,6 +737,10 @@ The file specified by @code{hls_key_info_file} will be 
checked periodically and
 detect updates to the encryption info. Be sure to replace this file atomically,
 including the file containing the AES encryption key.
 
+@item independent_segments
+Add the @code{#EXT-X-INDEPENDENT-SEGMENTS} to playlists that has video segments
+and when all the segments of that playlist are guaranteed to start with a Key 
frame.
+
 @item split_by_time
 Allow segments to start on frames other than keyframes. This improves
 behavior on some players when the time between keyframes is inconsistent,
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 3c47ced..5fc355a 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -88,6 +88,7 @@ typedef enum HLSFlags {
 HLS_SECOND_LEVEL_SEGMENT_SIZE = (1 << 10), // include segment size (bytes) 
in segment filenames when use_localtime  e.g.: %%014s
 HLS_TEMP_FILE = (1 << 11),
 HLS_PERIODIC_REKEY = (1 << 12),
+HLS_INDEPENDENT_SEGMENTS = (1 << 13),
 } HLSFlags;
 
 typedef enum {
@@ -1191,6 +1192,10 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 sequence = 0;
 }
 
+if (hls->flags & HLS_INDEPENDENT_SEGMENTS) {
+hls->version = 6;
+}
+
 if (hls->segment_type == SEGMENT_TYPE_FMP4) {
 hls->version = 7;
 }
@@ -1220,6 +1225,9 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 avio_printf(out, "#EXT-X-DISCONTINUITY\n");
 vs->discontinuity_set = 1;
 }
+if (vs->has_video && (hls->flags & HLS_INDEPENDENT_SEGMENTS)) {
+avio_printf(out, "#EXT-X-INDEPENDENT-SEGMENTS\n");
+}
 for (en = vs->segments; en; en = en->next) {
 if ((hls->encrypt || hls->key_info_file) && (!key_uri || 
strcmp(en->key_uri, key_uri) ||
 av_strcasecmp(en->iv_string, iv_string))) {
@@ -1732,6 +1740,11 @@ static int hls_write_header(AVFormatContext *s)
 vs->start_pts  = AV_NOPTS_VALUE;
 vs->current_segment_final_filename_fmt[0] = '\0';
 
+if (hls->flags & HLS_SPLIT_BY_TIME) {
+// Independent segments cannot be guaranteed when splitting by time
+hls->flags &= ~HLS_INDEPENDENT_SEGMENTS;
+}
+
 if (hls->flags & HLS_PROGRAM_DATE_TIME) {
 time_t now0;
 time();
@@ -2323,6 +2336,7 @@ static const AVOption options[] = {
 {"second_level_segment_duration", "include segment duration in segment 
filenames when use_localtime", 0, AV_OPT_TYPE_CONST, {.i64 = 
HLS_SECOND_LEVEL_SEGMENT_DURATION }, 0, UINT_MAX,   E, "flags"},
 {"second_level_segment_size", "include segment size in segment filenames 
when use_localtime", 0, AV_OPT_TYPE_CONST, {.i64 = 
HLS_SECOND_LEVEL_SEGMENT_SIZE }, 0, UINT_MAX,   E, "flags"},
 {"periodic_rekey", "reload keyinfo file periodically for re-keying", 0, 
AV_OPT_TYPE_CONST, {.i64 = HLS_PERIODIC_REKEY }, 0, UINT_MAX,   E, "flags"},
+{"independent_segments", "add EXT-X-INDEPENDENT-SEGMENTS, whenever 
applicable", 0, AV_OPT_TYPE_CONST, { .i64 = HLS_INDEPENDENT_SEGMENTS }, 0, 
UINT_MAX, E, "flags"},
 {"use_localtime", "set filename expansion with strftime at segment 
creation", OFFSET(use_localtime), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
 {"use_localtime_mkdir", "create last directory component in 
strftime-generated filename", OFFSET(use_localtime_mkdir), AV_OPT_TYPE_BOOL, 
{.i64 = 0 }, 0, 1, E },
 {"hls_playlist_type", "set the HLS playlist type", OFFSET(pl_type), 
AV_OPT_TYPE_INT, {.i64 = PLAYLIST_TYPE_NONE }, 0, PLAYLIST_TYPE_NB-1, E, 
"pl_type" },
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] ffmpeg: add return value check to suppress the build warning.

2017-11-22 Thread Jun Zhao


On 2017/11/23 11:00, Carl Eugen Hoyos wrote:
> 2017-11-20 10:07 GMT+01:00 刘歧 :
>
>> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
>> index babd85f7bc..0c16e75ab0 100644
>> --- a/fftools/ffmpeg.c
>> +++ b/fftools/ffmpeg.c
>> @@ -220,13 +220,18 @@ static void sub2video_push_ref(InputStream *ist, 
>> int64_t pts)
>>  {
>>  AVFrame *frame = ist->sub2video.frame;
>>  int i;
>> +int ret;
>>
>>  av_assert1(frame->data[0]);
>>  ist->sub2video.last_pts = frame->pts = pts;
>> -for (i = 0; i < ist->nb_filters; i++)
>> -av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
>> - AV_BUFFERSRC_FLAG_KEEP_REF |
>> - AV_BUFFERSRC_FLAG_PUSH);
>> +for (i = 0; i < ist->nb_filters; i++) {
>> +ret = av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
>> +   AV_BUFFERSRC_FLAG_KEEP_REF |
>> +   AV_BUFFERSRC_FLAG_PUSH);
>> +if (ret != AVERROR_EOF && ret < 0)
>> +av_log(NULL, AV_LOG_WARNING, "Error while add the frame to 
>> buffer source(%s).\n",
> Nicolas had a comment about this change:
> http://ffmpeg.org/pipermail/ffmpeg-devel/2017-February/207015.html
>
> Carl Eugen
I didn't know you have submitted a similar patch and Nicolas had some
comments about the change
before this mail, will update the warning/error message as the comments.
Tks.
> ___
> 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 1/2] avocdec/ttaenc: buffer packets directly

2017-11-22 Thread James Almer
On 11/20/2017 5:44 PM, James Almer wrote:
> This is a bit more robust in case of OOM.
> 
> Signed-off-by: James Almer 
> ---
>  libavformat/ttaenc.c | 42 +-
>  1 file changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c
> index fdce1e3dc1..b05705b6b6 100644
> --- a/libavformat/ttaenc.c
> +++ b/libavformat/ttaenc.c
> @@ -29,7 +29,7 @@
>  
>  typedef struct TTAMuxContext {
>  AVIOContext *seek_table;
> -AVIOContext *data;
> +AVPacketList *queue, *queue_end;
>  uint32_t nb_samples;
>  int frame_size;
>  int last_frame;
> @@ -56,10 +56,6 @@ static int tta_write_header(AVFormatContext *s)
>  
>  if ((ret = avio_open_dyn_buf(>seek_table)) < 0)
>  return ret;
> -if ((ret = avio_open_dyn_buf(>data)) < 0) {
> -ffio_free_dyn_buf(>seek_table);
> -return ret;
> -}
>  
>  /* Ignore most extradata information if present. It can be innacurate
> if for example remuxing from Matroska */
> @@ -84,8 +80,23 @@ static int tta_write_header(AVFormatContext *s)
>  static int tta_write_packet(AVFormatContext *s, AVPacket *pkt)
>  {
>  TTAMuxContext *tta = s->priv_data;
> +AVPacketList *pktl = av_mallocz(sizeof(*pktl));
> +int ret;
> +
> +if (!pktl)
> +return AVERROR(ENOMEM);
> +
> +ret = av_packet_ref(>pkt, pkt);
> +if (ret < 0) {
> +av_free(pktl);
> +return ret;
> +}
> +if (tta->queue_end)
> +tta->queue_end->next = pktl;
> +else
> +tta->queue = pktl;
> +tta->queue_end = pktl;
>  
> -avio_write(tta->data, pkt->data, pkt->size);
>  avio_wl32(tta->seek_table, pkt->size);
>  tta->nb_samples += pkt->duration;
>  
> @@ -106,6 +117,21 @@ static int tta_write_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  return 0;
>  }
>  
> +static void tta_queue_flush(AVFormatContext *s)
> +{
> +TTAMuxContext *tta = s->priv_data;
> +AVPacketList *pktl;
> +
> +while (pktl = tta->queue) {
> +AVPacket *pkt = >pkt;
> +avio_write(s->pb, pkt->data, pkt->size);
> +av_packet_unref(pkt);
> +tta->queue = pktl->next;
> +av_free(pktl);
> +}
> +tta->queue_end = NULL;
> +}
> +
>  static int tta_write_trailer(AVFormatContext *s)
>  {
>  TTAMuxContext *tta = s->priv_data;
> @@ -125,9 +151,7 @@ static int tta_write_trailer(AVFormatContext *s)
>  av_free(ptr);
>  
>  /* Write audio data */
> -size = avio_close_dyn_buf(tta->data, );
> -avio_write(s->pb, ptr, size);
> -av_free(ptr);
> +tta_queue_flush(s);
>  
>  ff_ape_write_tag(s);
>  avio_flush(s->pb);

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


Re: [FFmpeg-devel] [PATCH] ffmpeg: add return value check to suppress the build warning.

2017-11-22 Thread Bang He
is it necessary to check AVERROR_EOF?

On Thu, Nov 23, 2017 at 1:14 PM, Jun Zhao  wrote:

>
>
> On 2017/11/23 11:00, Carl Eugen Hoyos wrote:
> > 2017-11-20 10:07 GMT+01:00 刘歧 :
> >
> >> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> >> index babd85f7bc..0c16e75ab0 100644
> >> --- a/fftools/ffmpeg.c
> >> +++ b/fftools/ffmpeg.c
> >> @@ -220,13 +220,18 @@ static void sub2video_push_ref(InputStream *ist,
> int64_t pts)
> >>  {
> >>  AVFrame *frame = ist->sub2video.frame;
> >>  int i;
> >> +int ret;
> >>
> >>  av_assert1(frame->data[0]);
> >>  ist->sub2video.last_pts = frame->pts = pts;
> >> -for (i = 0; i < ist->nb_filters; i++)
> >> -av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
> >> - AV_BUFFERSRC_FLAG_KEEP_REF |
> >> - AV_BUFFERSRC_FLAG_PUSH);
> >> +for (i = 0; i < ist->nb_filters; i++) {
> >> +ret = av_buffersrc_add_frame_flags(ist->filters[i]->filter,
> frame,
> >> +   AV_BUFFERSRC_FLAG_KEEP_REF |
> >> +   AV_BUFFERSRC_FLAG_PUSH);
> >> +if (ret != AVERROR_EOF && ret < 0)
> >> +av_log(NULL, AV_LOG_WARNING, "Error while add the frame to
> buffer source(%s).\n",
> > Nicolas had a comment about this change:
> > http://ffmpeg.org/pipermail/ffmpeg-devel/2017-February/207015.html
> >
> > Carl Eugen
> I didn't know you have submitted a similar patch and Nicolas had some
> comments about the change
> before this mail, will update the warning/error message as the comments.
> Tks.
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/6] avcodec/hevcdsp: Add NEON optimization for qpel weighted mode

2017-11-22 Thread Shengbin Meng


> On 22 Nov 2017, at 20:26, Michael Niedermayer  wrote:
> 
> On Wed, Nov 22, 2017 at 07:12:01PM +0800, Shengbin Meng wrote:
>> From: Meng Wang 
>> 
>> Signed-off-by: Meng Wang 
>> ---
>> libavcodec/arm/hevcdsp_init_neon.c |  66 +
>> libavcodec/arm/hevcdsp_qpel_neon.S | 509 
>> +
>> 2 files changed, 575 insertions(+)
>> 
>> diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
>> b/libavcodec/arm/hevcdsp_init_neon.c
> 
> This seems not to apply to git master

I looked into that and it seems someone has added commits about hevc decoding 
in git master after n3.4.
My patches are based on n3.4 so some conflicts occur. And I checked the 
conflict is mainly due to the following change in master:

ff_hevcdsp_init_neon => ff_hevc_dsp_init_neon  (in 
libavcodec/arm/hevcdsp_init_neon.c, a common function name was changed).

It is a small conflict though and should be easily resolved. Anyway, I have 
updated those patches to v2 which are all based on master, for your 
convenience. They should merge all right.

And since master already contains optimization code for IDCT (even 32x32 
blocks, great plus!), our work about IDCT are removed from v2 patches.

Thank you.

Regards,
Shengbin

> Applying: avcodec/hevcdsp: Add NEON optimization for qpel weighted mode
> Using index info to reconstruct a base tree...
> M   libavcodec/arm/hevcdsp_init_neon.c
> Falling back to patching base and 3-way merge...
> Auto-merging libavcodec/arm/hevcdsp_init_neon.c
> CONFLICT (content): Merge conflict in libavcodec/arm/hevcdsp_init_neon.c
> error: Failed to merge in the changes.
> Patch failed at 0001 avcodec/hevcdsp: Add NEON optimization for qpel weighted 
> mode
> The copy of the patch that failed is found in: .git/rebase-apply/patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
> 
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> I am the wisest man alive, for I know one thing, and that is that I know
> nothing. -- Socrates
> ___
> 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 3/4] avformat/movenc: force colr atom for uncompressed yuv in mov

2017-11-22 Thread Derek Buitenhuis
On 11/22/2017 1:33 PM, Kevin Wheatley wrote:
> The guess work comes from this list:
> 
> https://developer.apple.com/library/content/technotes/tn2162/_index.html#//apple_ref/doc/uid/DTS40013070-CH1-TNTAG10-SAMPLE__COLR__SETTINGS

It's a mistake to conflate resolutions with the standards listed there. It does 
not
list any heuristics, just a set of standards and associated values. No info 
falls
under "Anything Else", IMO.

> and I agree is the source of a lot of chaos, but it is what several
> tools have done in the absence of any specified values.

"Other tools use heuristics too" is a bad rationale for creating such files by 
default.

> My usage of the feature is to write the atom when I need to by
> explicitly enabling it on the command line and I also explicitly set
> the metadata either from the input file, or by overriding on the
> command line.

This use-case is preserved if we leave the heuristics as an option, which I'm
totally OK with.

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


Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-22 Thread Derek Buitenhuis
On 11/22/2017 10:24 AM, Marc-Antoine ARNAUD wrote:
> New patch version which fixe the last remark.

[...]

> +char depth_string[8];
> +snprintf(depth_string, sizeof(depth_string), "%d", (1 1);
> +geq->expr_str[A] = av_strdup(depth_string);

Missing return value check for av_strdup.

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


Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

2017-11-22 Thread Mironov, Mikhail
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Mark Thompson
> Sent: November 21, 2017 7:40 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD
> GPUs based on AMF SDK
> 
> On 21/11/17 23:08, Timo Rothenpieler wrote:
> > Am 21.11.2017 um 16:32 schrieb Mironov, Mikhail:
> >>
> >> Are you all busy right now? Any hint on timing?
> >> Thanks,
> >> Mikhail
> >
> > I cannot test this patch due to lack of hardware, but by now the code has
> been polished for a while, and if no further comments/issues come up, I'd be
> all for finally merging this.
> 
> I'd like to look through it again and test a bit more (will try to do so
> tomorrow, certainly by the end of the week), but I think it should be ready to
> commit with the external header removed.

Are you planning to remove Nvidia headers as well?

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


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


Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-22 Thread Derek Buitenhuis
On 11/22/2017 2:38 PM, Marc-Antoine ARNAUD wrote:
> It made sense, but this commit don't touch this part of the code.
> It can made more sense to add an another path to "prevent bad memory
> allocation in geq filter". What do you think ?

Ah, you are correct. A 2nd patch would be nice, yes, but don't consider
it a blocker for your current patch.

Sorry 'bout that!

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


[FFmpeg-devel] [PATCH 0/3][RFC] Random UDP bits

2017-11-22 Thread Derek Buitenhuis
Bits that I saw when I was reviewing the OpenSRT code.

Derek Buitenhuis (3):
  Revert "udp: fix compilation when HAVE_PTHREAD_CANCEL isnt defined"
  udp: Check the port number provided by av_url_split as per docs
  udp: Actually fail when we're missing required options, like the
"warning" says.

 libavformat/udp.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

-- 
1.8.3.1

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


[FFmpeg-devel] [PATCH 1/3] Revert "udp: fix compilation when HAVE_PTHREAD_CANCEL isnt defined"

2017-11-22 Thread Derek Buitenhuis
This was an mplayer-specific hack.

This reverts commit a4f94f24b4f153c30bbcaa700bedfb2b3a581e5e.
---
Near as I can tell, this is a hack added to deal with the fact that the
terrible mplayer build system cannibalized FFmpeg's, and failed at it.

There's no reason this should be in FFmpeg, if that is the case
---
 libavformat/udp.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 3835f98..0dde035 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -64,10 +64,6 @@
 #include 
 #endif
 
-#ifndef HAVE_PTHREAD_CANCEL
-#define HAVE_PTHREAD_CANCEL 0
-#endif
-
 #ifndef IPV6_ADD_MEMBERSHIP
 #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
 #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
-- 
1.8.3.1

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


[FFmpeg-devel] [PATCH 3/3] udp: Actually fail when we're missing required options, like the "warning" says.

2017-11-22 Thread Derek Buitenhuis
Signed-off-by: Derek Buitenhuis 
---
There was no reasoning in the commit that added this, so maybe someone on
the list has some insights.
---
 libavformat/udp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 7bbd282..6319655 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -963,8 +963,8 @@ static int udp_open(URLContext *h, const char *uri, int 
flags)
 */
 
 if (is_output && s->bitrate && !s->circular_buffer_size) {
-/* Warn user in case of 'circular_buffer_size' is not set */
-av_log(h, AV_LOG_WARNING,"'bitrate' option was set but 
'circular_buffer_size' is not, but required\n");
+av_log(h, AV_LOG_ERROR,"'bitrate' option was set but 
'circular_buffer_size' is not, but required\n");
+goto fail;
 }
 
 if ((!is_output && s->circular_buffer_size) || (is_output && s->bitrate && 
s->circular_buffer_size)) {
-- 
1.8.3.1

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


[FFmpeg-devel] [PATCH v2 5/5] avcodec/hevcdsp: Add NEON optimization for sao

2017-11-22 Thread Shengbin Meng
From: Meng Wang 

Signed-off-by: Meng Wang 
---
 libavcodec/arm/Makefile|   3 +-
 libavcodec/arm/hevcdsp_init_neon.c |  62 +
 libavcodec/arm/hevcdsp_sao_neon.S  | 181 +
 3 files changed, 245 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/arm/hevcdsp_sao_neon.S

diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index 1acda0b1f8..fc4c0147c5 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -137,7 +137,8 @@ NEON-OBJS-$(CONFIG_HEVC_DECODER)   += 
arm/hevcdsp_init_neon.o   \
   arm/hevcdsp_deblock_neon.o\
   arm/hevcdsp_idct_neon.o   \
   arm/hevcdsp_qpel_neon.o   \
-  arm/hevcdsp_epel_neon.o
+  arm/hevcdsp_epel_neon.o   \
+ arm/hevcdsp_sao_neon.o
 NEON-OBJS-$(CONFIG_RV30_DECODER)   += arm/rv34dsp_neon.o
 NEON-OBJS-$(CONFIG_RV40_DECODER)   += arm/rv34dsp_neon.o\
   arm/rv40dsp_neon.o
diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
b/libavcodec/arm/hevcdsp_init_neon.c
index 4e57422ad4..f7efff28e1 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -23,6 +23,13 @@
 #include "libavcodec/hevcdsp.h"
 #include "hevcdsp_arm.h"
 
+void ff_hevc_sao_band_filter_neon_wrapper(uint8_t *_dst, uint8_t *_src,
+  ptrdiff_t stride_dst, ptrdiff_t stride_src,
+  int16_t *sao_offset_val, int sao_left_class,
+  int width, int height);
+void ff_hevc_sao_edge_filter_neon_wrapper(uint8_t *_dst, uint8_t *_src, 
ptrdiff_t stride_dst, int16_t *sao_offset_val,
+  int eo, int width, int height);
+
 void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int 
_beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
 void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int 
_beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
 void ff_hevc_v_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int 
*_tc, uint8_t *_no_p, uint8_t *_no_q);
@@ -414,6 +421,51 @@ EPEL_FUNC_WT(ff_hevc_put_epel_wt_h6v7_neon_8);
 EPEL_FUNC_WT(ff_hevc_put_epel_wt_h7v7_neon_8);
 #undef EPEL_FUNC_WT
 
+void ff_hevc_sao_band_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t 
stride_dst, ptrdiff_t stride_src, int width, int height, int16_t *offset_table);
+
+void ff_hevc_sao_band_filter_neon_wrapper(uint8_t *_dst, uint8_t *_src,
+  ptrdiff_t stride_dst, ptrdiff_t stride_src,
+  int16_t *sao_offset_val, int sao_left_class,
+  int width, int height) {
+uint8_t *dst = (uint8_t *)_dst;
+uint8_t *src = (uint8_t *)_src;
+int16_t offset_table[32] = {0};
+int k;
+
+stride_dst /= sizeof(uint8_t);
+stride_src /= sizeof(uint8_t);
+
+for (k = 0; k < 4; k++) {
+offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
+}
+
+ff_hevc_sao_band_filter_neon_8(dst, src, stride_dst, stride_src, width, 
height, offset_table);
+}
+
+void ff_hevc_sao_edge_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t 
stride_dst, ptrdiff_t stride_src, int width, int height,
+int a_stride, int b_stride, int16_t 
*sao_offset_val, uint8_t *edge_idx);
+
+void ff_hevc_sao_edge_filter_neon_wrapper(uint8_t *_dst, uint8_t *_src, 
ptrdiff_t stride_dst, int16_t *sao_offset_val,
+  int eo, int width, int height) {
+static uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
+static const int8_t pos[4][2][2] = {
+{ { -1,  0 }, {  1, 0 } }, // horizontal
+{ {  0, -1 }, {  0, 1 } }, // vertical
+{ { -1, -1 }, {  1, 1 } }, // 45 degree
+{ {  1, -1 }, { -1, 1 } }, // 135 degree
+};
+uint8_t *dst = (uint8_t *)_dst;
+uint8_t *src = (uint8_t *)_src;
+int a_stride, b_stride;
+ptrdiff_t stride_src = (2*64 + 32) / sizeof(uint8_t);
+stride_dst /= sizeof(uint8_t);
+
+a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src;
+b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src;
+
+ff_hevc_sao_edge_filter_neon_8(dst, src, stride_dst, stride_src, width, 
height, a_stride, b_stride, sao_offset_val, edge_idx);
+}
+
 void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t 
srcstride,
int height, intptr_t mx, intptr_t my, int 
width) {
 
@@ -505,6 +557,16 @@ av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, 
const int bit_depth)
 c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_neon;
 

[FFmpeg-devel] [PATCH v2 4/5] avcodec/hevcdsp: Use pre-load (pld) to optimize data loading

2017-11-22 Thread Shengbin Meng
From: Meng Wang 

Signed-off-by: Meng Wang 
---
 libavcodec/arm/hevcdsp_epel_neon.S | 10 ++
 libavcodec/arm/hevcdsp_qpel_neon.S | 24 
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/libavcodec/arm/hevcdsp_epel_neon.S 
b/libavcodec/arm/hevcdsp_epel_neon.S
index d0d93e8033..03e6504481 100644
--- a/libavcodec/arm/hevcdsp_epel_neon.S
+++ b/libavcodec/arm/hevcdsp_epel_neon.S
@@ -306,6 +306,7 @@
 cmp   r5, #2
 beq   2f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vst1.16{q7}, [r0], r1
 regshuffle_d4
@@ -320,6 +321,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vst1.16d14, [r0], r1
 regshuffle_d4
@@ -357,6 +359,7 @@
 cmp   r5, #2
 beq   2f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vqrshrun.s16   d0, q7, #6
 vst1.8d0, [r0], r1
@@ -372,6 +375,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vqrshrun.s16   d0, q7, #6
 vst1.32d0[0], [r0], r1
@@ -396,6 +400,7 @@
 cmp   r5, #2
 beq   2f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vld1.16{q0}, [r8], r9
 vqadd.s16  q0, q7
@@ -415,6 +420,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vld1.16  d0, [r8], r9
 vqadd.s16d0, d14
@@ -465,6 +471,7 @@
 cmp   r5, #2
 beq   2f
 8:  subs  r4, #1
+pld   [r2]
 \filter
 vmovl.s16 q12, d14   // extending signed 4x16bit data to 4x32 
bit
 vmovl.s16 q13, d15
@@ -490,6 +497,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vmovl.s16 q12, d14  // extending signed 4x16bit data to 4x32 
bit
 vmul.s32  q14, q12, q6
@@ -535,6 +543,7 @@
 cmp   r5, #2
 beq   2f
 8:  subsr4,   #1
+pld [r2]
 \filter
 vmovl.s16 q12, d14  // extending signed 4x16bit data to 
4x32 bit
 vmovl.s16 q13, d15
@@ -569,6 +578,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vmovl.s16q12, d14
 vmul.s32 q14, q12, q6
diff --git a/libavcodec/arm/hevcdsp_qpel_neon.S 
b/libavcodec/arm/hevcdsp_qpel_neon.S
index 71ecc00b6e..b507fbc13b 100644
--- a/libavcodec/arm/hevcdsp_qpel_neon.S
+++ b/libavcodec/arm/hevcdsp_qpel_neon.S
@@ -231,6 +231,7 @@
 cmp   r5, #4
 beq   4f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vst1.16{q7}, [r0], r1
 regshuffle_d8
@@ -245,6 +246,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vst1.16d14, [r0], r1
 regshuffle_d8
@@ -273,6 +275,7 @@
 cmp   r5, #4
 beq   4f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vqrshrun.s16   d0, q7, #6
 vst1.8d0, [r0], r1
@@ -288,6 +291,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vqrshrun.s16   d0, q7, #6
 vst1.32d0[0], [r0], r1
@@ -301,6 +305,7 @@
 cmp   r5, #4
 beq   4f
 8:  subs r4, #1
+pld   [r2]
 \filter
 vld1.16{q0}, [r8], r9
 vqadd.s16  q0, q7
@@ -320,6 +325,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vld1.16  d0, [r8], r9
 vqadd.s16d0, d14
@@ -358,6 +364,7 @@
 cmp   r5, #4
 beq   4f
 8:  subs  r4, #1
+pld   [r2]
 \filter
 vmovl.s16 q12, d14 // extending signed 4x16bit data to 4x32 bit
 vmovl.s16 q13, d15
@@ -383,6 +390,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vmovl.s16 q12, d14  // extending signed 4x16bit data to 4x32 
bit
 vmul.s32  q14, q12, q6
@@ -412,6 +420,7 @@
 cmp r5,   #4
 beq 4f
 8:  subsr4,   #1
+pld   [r2]
 \filter
 vmovl.s16 q12, d14  // extending signed 4x16bit data to 
4x32 bit
 vmovl.s16 q13, d15
@@ -446,6 +455,7 @@
 mov r2, r7
 b 0b
 4:  subs r4, #1
+pld   [r2]
 \filter
 vmovl.s16q12, d14
 vmul.s32 q14, q12, q6
@@ -1524,8 +1534,9 @@ function ff_hevc_put_qpel_bi_uw_pixels_neon_8, export=1
 cmp   r5, #4
 beq   4f
 8:  subs r4, #1
-vshll.u8  

Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: fix last packet timestamps

2017-11-22 Thread Derek Buitenhuis
On 11/22/2017 1:10 AM, Marton Balint wrote:
> Fixes the packet timestamps of the last packet, which was unset, or guessed by
> compute_pkt_fields.
> 
> ffprobe -fflags nofillin -show_packets tests/data/lavf/lavf.mxf 
> -select_streams v
> 
> Signed-off-by: Marton Balint 
> ---
>  libavformat/mxfdec.c|  8 
>  tests/ref/seek/lavf-mxf_d10 | 12 ++--
>  2 files changed, 10 insertions(+), 10 deletions(-)

Can you add what the fix actually was to the commit message?

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


Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-22 Thread Marc-Antoine ARNAUD
It made sense, but this commit don't touch this part of the code.
It can made more sense to add an another path to "prevent bad memory
allocation in geq filter". What do you think ?

Regards,

Le mer. 22 nov. 2017 à 15:19, Derek Buitenhuis 
a écrit :

> On 11/22/2017 10:24 AM, Marc-Antoine ARNAUD wrote:
> > New patch version which fixe the last remark.
>
> [...]
>
> > +char depth_string[8];
> > +snprintf(depth_string, sizeof(depth_string), "%d",
> (1 > +geq->expr_str[A] = av_strdup(depth_string);
>
> Missing return value check for av_strdup.
>
> - Derek
> ___
> 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 v2 2/2] avformat/dashenc: Option to generate hls playlist as well

2017-11-22 Thread Michael Niedermayer
On Wed, Nov 22, 2017 at 02:50:12PM +0530, Karthick J wrote:
> This is to take full advantage of Common Media Application Format.
> Now server can generate one content and serve both HLS and DASH players.
> ---
>  doc/muxers.texi   |   3 ++
>  libavformat/dashenc.c | 102 
> --
>  2 files changed, 101 insertions(+), 4 deletions(-)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 0bb8ad2..1cf2481 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -249,6 +249,9 @@ DASH-templated name to used for the media segments. 
> Default is "chunk-stream$Rep
>  URL of the page that will return the UTC timestamp in ISO format. Example: 
> "https://time.akamai.com/?iso;
>  @item -http_user_agent @var{user_agent}
>  Override User-Agent field in HTTP header. Applicable only for HTTP output.
> +@item -hls_playlist @var{hls_playlist}
> +Generate HLS playlist files as well. The master playlist is generated with 
> the filename master.m3u8.
> +One media playlist file is generated for each stream with filenames 
> media_0.m3u8, media_1.m3u8, etc.
>  @item -adaptation_sets @var{adaptation_sets}
>  Assign streams to AdaptationSets. Syntax is "id=x,streams=a,b,c 
> id=y,streams=d,e" with x and y being the IDs
>  of the adaptation sets and a,b,c,d and e are the indices of the mapped 
> streams.
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 201668a..4c3962a 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -36,6 +36,7 @@
>  #include "avc.h"
>  #include "avformat.h"
>  #include "avio_internal.h"
> +#include "hlsenc.h"
>  #include "internal.h"
>  #include "isom.h"
>  #include "os_support.h"
> @@ -101,6 +102,8 @@ typedef struct DASHContext {
>  const char *media_seg_name;
>  const char *utc_timing_url;
>  const char *user_agent;
> +int hls_playlist;
> +int master_playlist_created;
>  } DASHContext;
>  
>  static struct codec_string {
> @@ -217,6 +220,13 @@ static void set_http_options(AVDictionary **options, 
> DASHContext *c)
>  av_dict_set(options, "user_agent", c->user_agent, 0);
>  }
>  
> +static void get_hls_playlist_name(char *playlist_name, const char *base_url, 
> int id) {
> +if (base_url)
> +sprintf(playlist_name, "%smedia_%d.m3u8", base_url, id);
> +else
> +sprintf(playlist_name, "media_%d.m3u8", id);
> +}

please always use snprint, not sprintf as it can overwrite the array

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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


[FFmpeg-devel] [PATCH 2/3] udp: Check the port number provided by av_url_split as per docs

2017-11-22 Thread Derek Buitenhuis
Signed-off-by: Derek Buitenhuis 
---
 libavformat/udp.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 0dde035..7bbd282 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -443,6 +443,10 @@ int ff_udp_set_remote_url(URLContext *h, const char *uri)
 const char *p;
 
 av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), , NULL, 0, 
uri);
+if (port < 0) {
+av_log(s, AV_LOG_ERROR, "No valid port number found in URL.\n");
+return AVERROR(EINVAL);
+}
 
 /* set the destination address */
 s->dest_addr_len = udp_set_url(h, >dest_addr, hostname, port);
@@ -798,6 +802,10 @@ static int udp_open(URLContext *h, const char *uri, int 
flags)
 
 /* fill the dest addr */
 av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), , NULL, 0, 
uri);
+if (port < 0) {
+av_log(h, AV_LOG_ERROR, "Missing or invalid port provided in URL.\n");
+return AVERROR(EINVAL);
+}
 
 /* XXX: fix av_url_split */
 if (hostname[0] == '\0' || hostname[0] == '?') {
-- 
1.8.3.1

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


Re: [FFmpeg-devel] [PATCH] avformat/avienc: fix fields-per-frame value for interlaced video streams

2017-11-22 Thread Derek Buitenhuis
On 11/22/2017 3:41 PM, Tobias Rapp wrote:
> Writes one set of field framing information for progressive streams and
> two sets for interlaced streams. Fixes ticket #6383.
> 
> Unfortunately the OpenDML v1.02 document is not very specific what value
> to use for start_line when frame data is not coming from a capturing
> device, so this is just using 0/1 depending on the field order as a
> best-effort guess.

Looking at the OpenDML spec, I think this indeed is the best we can do without
deeper knowledge of where the source signal came from, or copying it from a
pre-existing file, within the existing avformat scaffolding.

Code itself seems OK.

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


[FFmpeg-devel] [PATCH v2 1/5] avcodec/hevcdsp: Add NEON optimization for qpel weighted mode

2017-11-22 Thread Shengbin Meng
From: Meng Wang 

Signed-off-by: Meng Wang 
---
 libavcodec/arm/hevcdsp_init_neon.c |  67 +
 libavcodec/arm/hevcdsp_qpel_neon.S | 509 +
 2 files changed, 576 insertions(+)

diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
b/libavcodec/arm/hevcdsp_init_neon.c
index a4628d2a93..183162803e 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -81,6 +81,8 @@ static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, 
ptrdiff_t dststride, uint8
int height, int width);
 static void (*put_hevc_qpel_uw_neon[4][4])(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *_src, ptrdiff_t _srcstride,
int width, int height, int16_t* src2, 
ptrdiff_t src2stride);
+static void (*put_hevc_qpel_wt_neon[4][4])(uint8_t *_dst, ptrdiff_t 
_dststride, uint8_t *_src, ptrdiff_t _srcstride,
+   int width, int height, int denom, int wx1, 
int ox1, int wx0, int ox0, int16_t* src2, ptrdiff_t src2stride);
 void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t 
srcstride,
int height, intptr_t mx, intptr_t my, int 
width);
 void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *src, ptrdiff_t srcstride,
@@ -88,6 +90,15 @@ void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, 
ptrdiff_t dststride, uint8_
 void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *src, ptrdiff_t srcstride,
int16_t *src2,
int height, intptr_t mx, intptr_t my, 
int width);
+void ff_hevc_put_qpel_uni_w_neon_wrapper(uint8_t *dst,  ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int denom, int wx, int ox,
+ intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_qpel_bi_w_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *src, ptrdiff_t srcstride,
+int16_t *src2,
+int height, int denom, int wx0, int 
wx1,
+int ox0, int ox1, intptr_t mx, 
intptr_t my, int width);
+
 #define QPEL_FUNC(name) \
 void name(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t 
srcstride, \
int height, int width)
@@ -142,6 +153,26 @@ QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v2_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v3_neon_8);
 #undef QPEL_FUNC_UW
 
+#define QPEL_FUNC_WT(name) \
+void name(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t 
_srcstride, \
+int width, int height, int denom, int wx1, int ox1, int wx0, int ox0, 
int16_t* src2, ptrdiff_t src2stride);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_v1_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_v2_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_v3_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h1_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h2_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h1v1_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h1v2_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h1v3_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h2v1_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h2v2_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h2v3_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v1_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v2_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v3_neon_8);
+#undef QPEL_FUNC_WT
+
 void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t 
srcstride,
int height, intptr_t mx, intptr_t my, int 
width) {
 
@@ -160,6 +191,21 @@ void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, 
ptrdiff_t dststride, uint8_t
 put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, 
height, src2, MAX_PB_SIZE);
 }
 
+void ff_hevc_put_qpel_uni_w_neon_wrapper(uint8_t *dst,  ptrdiff_t dststride,
+  uint8_t *src, ptrdiff_t 
srcstride,
+  int height, int denom, int wx, 
int ox,
+  intptr_t mx, intptr_t my, int 
width) {
+put_hevc_qpel_wt_neon[my][mx](dst, dststride, src, srcstride, width, 
height, denom, wx, ox, 0, 0, NULL, 0);
+}
+
+void ff_hevc_put_qpel_bi_w_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *src, ptrdiff_t srcstride,
+ int16_t *src2,
+ int height, int denom, int wx0, 
int wx1,
+ int ox0, int ox1, intptr_t mx, 
intptr_t my, int width) {
+put_hevc_qpel_wt_neon[my][mx](dst, dststride, src, srcstride, width, 
height, denom, wx1, 

[FFmpeg-devel] [PATCH v2 2/5] avcodec/hevcdsp: Add NEON optimization for epel

2017-11-22 Thread Shengbin Meng
From: Meng Wang 

Signed-off-by: Meng Wang 
---
 libavcodec/arm/Makefile|3 +-
 libavcodec/arm/hevcdsp_epel_neon.S | 2068 
 libavcodec/arm/hevcdsp_init_neon.c |  458 
 3 files changed, 2528 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S

diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index 1eeac5449e..1acda0b1f8 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -136,7 +136,8 @@ NEON-OBJS-$(CONFIG_DCA_DECODER)+= 
arm/synth_filter_neon.o
 NEON-OBJS-$(CONFIG_HEVC_DECODER)   += arm/hevcdsp_init_neon.o   \
   arm/hevcdsp_deblock_neon.o\
   arm/hevcdsp_idct_neon.o   \
-  arm/hevcdsp_qpel_neon.o
+  arm/hevcdsp_qpel_neon.o   \
+  arm/hevcdsp_epel_neon.o
 NEON-OBJS-$(CONFIG_RV30_DECODER)   += arm/rv34dsp_neon.o
 NEON-OBJS-$(CONFIG_RV40_DECODER)   += arm/rv34dsp_neon.o\
   arm/rv40dsp_neon.o
diff --git a/libavcodec/arm/hevcdsp_epel_neon.S 
b/libavcodec/arm/hevcdsp_epel_neon.S
new file mode 100644
index 00..d0d93e8033
--- /dev/null
+++ b/libavcodec/arm/hevcdsp_epel_neon.S
@@ -0,0 +1,2068 @@
+/*
+ * Copyright (c) 2017 Meng Wang 
+ *
+ * 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/arm/asm.S"
+#include "neon.S"
+
+.macro regshuffle_d4
+vmov d16, d17
+vmov d17, d18
+vmov d18, d19
+.endm
+
+.macro regshuffle_q4
+vmov q0, q1
+vmov q1, q2
+vmov q2, q3
+.endm
+
+.macro vextin4
+pld   [r2]
+vld1.8{q11}, [r2], r3
+vext.8d16, d22, d23, #1
+vext.8d17, d22, d23, #2
+vext.8d18, d22, d23, #3
+vext.8d19, d22, d23, #4
+.endm
+
+.macro loadin4
+pld   [r2]
+vld1.8{d16}, [r2], r3
+pld   [r2]
+vld1.8{d17}, [r2], r3
+pld   [r2]
+vld1.8{d18}, [r2], r3
+pld   [r2]
+vld1.8{d19}, [r2], r3
+.endm
+
+.macro epel_filter_1_32b
+vmov.i16   d16, #58
+vmov.i16   d17, #10
+vmull.s16  q9,  d2,  d16   // 58*b0
+vmull.s16  q10, d3,  d16   // 58*b1
+vmull.s16  q11, d4,  d17   // 10*c0
+vmull.s16  q12, d5,  d17   // 10*c1
+vadd.s32   q11, q9
+vadd.s32   q12, q10
+vaddl.s16  q9,  d0,  d6
+vaddl.s16  q10, d1,  d7
+vshl.s32   q13, q9,  #1// 2*a + 2*d
+vshl.s32   q14, q10, #1
+vsub.s32   q11, q13// -2*a + 58*b + 10*c -2*d
+vsub.s32   q12, q14
+vqshrn.s32 d16, q11, #6
+vqshrn.s32 d17, q12, #6   // out=q8
+.endm
+
+.macro epel_filter_2_32b
+vmov.i16   d16, #54
+vmull.s16  q9,  d2, d16   // 54*b0
+vmull.s16  q10, d3, d16   // 54*b1
+vshll.s16  q11, d4, #4// 16*c0
+vshll.s16  q12, d5, #4// 16*c1
+vadd.s32   q9,  q11
+vadd.s32   q10, q12
+vshll.s16  q11, d0, #2// 4*a0
+vshll.s16  q12, d1, #2// 4*a1
+vshll.s16  q13, d6, #1// 2*d0
+vshll.s16  q14, d7, #1// 2*d0
+vadd.s32   q11, q13
+vadd.s32   q12, q14
+vsub.s32   q9,  q11   // -4*a + 54*b + 16*c - 2*d
+vsub.s32   q10, q12
+vqshrn.s32 d16, q9,  #6
+vqshrn.s32 d17, q10, #6   // out=q8
+.endm
+
+.macro epel_filter_3_32b
+vmov.i16   d16, #46
+vmull.s16  q9,  d2, d16   // 46*b0
+vmull.s16  q10, d3, d16   // 46*b1
+vshll.s16  q11, d4, #5
+vshll.s16  q12, d5, #5
+vshll.s16  q13, d4, #2
+vshll.s16  q14, d5, #2
+vsub.s32   q11, q13   // 28*c0
+vsub.s32   q12, q14   // 28*c1
+vadd.s32   q9,  q11   // 46*b0 + 28*c0
+vadd.s32   q10, q12   // 46*b1 + 28*c1
+vshll.s16  q11, d6, #2// 4*d0
+vshll.s16  q12, d7, #2// 4*d1
+vmov.i16   d16, #6
+vmull.s16  q13, d0, 

[FFmpeg-devel] [PATCH v2 3/5] avcodec/hevcdsp: Add NEON optimization for whole-pixel interpolation

2017-11-22 Thread Shengbin Meng
New code is written for qpel; and then code for qpel is reused for epel,
because whole-pixel interpolation in qpel and epel are identical.

Signed-off-by: Shengbin Meng 
---
 libavcodec/arm/hevcdsp_init_neon.c | 107 ++
 libavcodec/arm/hevcdsp_qpel_neon.S | 177 +
 2 files changed, 284 insertions(+)

diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
b/libavcodec/arm/hevcdsp_init_neon.c
index 7d85c29d6a..4e57422ad4 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -89,6 +89,10 @@ static void (*put_hevc_epel_uw_neon[8][8])(uint8_t *dst, 
ptrdiff_t dststride, ui
int width, int height, int16_t* 
src2, ptrdiff_t src2stride);
 static void (*put_hevc_epel_wt_neon[8][8])(uint8_t *_dst, ptrdiff_t 
_dststride, uint8_t *_src, ptrdiff_t _srcstride,
int width, int height, int denom, 
int wx1, int ox1, int wx0, int ox0, int16_t* src2, ptrdiff_t src2stride);
+static void (*put_hevc_qpel_bi_uw_pixels_neon[1])(uint8_t *dst, ptrdiff_t 
dststride, uint8_t *_src, ptrdiff_t _srcstride,
+  int width, int height, int16_t* 
src2, ptrdiff_t src2stride);
+static void (*put_hevc_qpel_wt_pixels_neon[1])(uint8_t *_dst, ptrdiff_t 
_dststride, uint8_t *_src, ptrdiff_t _srcstride,
+  int width, int height, 
int denom, int wx1, int ox1, int wx0, int ox0, int16_t* src2, ptrdiff_t 
src2stride);
 void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t 
srcstride,
int height, intptr_t mx, intptr_t my, int 
width);
 void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, 
uint8_t *src, ptrdiff_t srcstride,
@@ -119,6 +123,17 @@ void ff_hevc_put_epel_bi_w_neon_wrapper(uint8_t *dst, 
ptrdiff_t dststride, uint8
  int16_t *src2,
  int height, int denom, int wx0, 
int wx1,
  int ox0, int ox1, intptr_t mx, 
intptr_t my, int width);
+void ff_hevc_put_qpel_bi_uw_pixels_neon_wrapper(uint8_t *dst, ptrdiff_t 
dststride, uint8_t *src, ptrdiff_t srcstride,
+   int16_t *src2,
+   int height, intptr_t mx, 
intptr_t my, int width);
+void ff_hevc_put_qpel_uni_wt_pixels_neon_wrapper(uint8_t *dst,  ptrdiff_t 
dststride,
+  uint8_t *src, ptrdiff_t 
srcstride,
+  int height, int denom, int wx, 
int ox,
+  intptr_t mx, intptr_t my, int 
width);
+void ff_hevc_put_qpel_bi_wt_pixels_neon_wrapper(uint8_t *dst, ptrdiff_t 
dststride, uint8_t *src, ptrdiff_t srcstride,
+int16_t *src2,
+int height, int denom, int 
wx0, int wx1,
+int ox0, int ox1, intptr_t mx, 
intptr_t my, int width);
 
 #define QPEL_FUNC(name) \
 void name(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t 
srcstride, \
@@ -172,6 +187,7 @@ QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h2v3_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v1_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v2_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v3_neon_8);
+QPEL_FUNC_UW(ff_hevc_put_qpel_bi_uw_pixels_neon_8);
 #undef QPEL_FUNC_UW
 
 #define QPEL_FUNC_WT(name) \
@@ -192,6 +208,7 @@ QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h2v3_neon_8);
 QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v1_neon_8);
 QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v2_neon_8);
 QPEL_FUNC_WT(ff_hevc_put_qpel_wt_h3v3_neon_8);
+QPEL_FUNC_WT(ff_hevc_put_qpel_wt_pixels_neon_8);
 #undef QPEL_FUNC_WT
 
 
@@ -459,6 +476,27 @@ void ff_hevc_put_epel_bi_w_neon_wrapper(uint8_t *dst, 
ptrdiff_t dststride, uint8
 put_hevc_epel_wt_neon[my][mx](dst, dststride, src, srcstride, width, 
height, denom, wx1, ox1, wx0, ox0, src2, MAX_PB_SIZE);
 }
 
+
+void ff_hevc_put_qpel_bi_uw_pixels_neon_wrapper(uint8_t *dst, ptrdiff_t 
dststride, uint8_t *src, ptrdiff_t srcstride,
+   int16_t *src2,
+   int height, intptr_t mx, 
intptr_t my, int width) {
+put_hevc_qpel_bi_uw_pixels_neon[0](dst, dststride, src, srcstride, width, 
height, src2, MAX_PB_SIZE);
+}
+
+void ff_hevc_put_qpel_uni_wt_pixels_neon_wrapper(uint8_t *dst,  ptrdiff_t 
dststride,
+ uint8_t *src, ptrdiff_t 
srcstride,
+ int height, int denom, 
int wx, int ox,
+ intptr_t mx, intptr_t my, 
int width) {
+put_hevc_qpel_wt_pixels_neon[0](dst, 

Re: [FFmpeg-devel] [PATCH] libavformat/mov: Replace duplicate stream_nb check by assert

2017-11-22 Thread Derek Buitenhuis
On 11/22/2017 12:04 PM, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/mov.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

If it's a duplicate check, is there even a gain from using an assert?

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


Re: [FFmpeg-devel] [PATCH] Refactor Developer Docs, update dev list section

2017-11-22 Thread Derek Buitenhuis
On 11/21/2017 11:40 PM, Carl Eugen Hoyos wrote:
> I am against removing this paragraph.

He specifically asked if it was required of new developers to subscribe
to this list, in a separate thread, earlier[1]. Paul explicitly said it
was *not* required[2], Timo said no discussion happens on the list[3],
and you gave a two word reply[4] that was completely devoid of actual
information.

You can see how this may have given Jim a different impression.

Please, can we not be so abrasive and inconsistent with new contributers?
It's shameful.

- Derek

[1] http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-November/220271.html 
[2] http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-November/220441.html
[3] http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-November/220272.html
[4] http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-November/220392.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/avienc: fix fields-per-frame value for interlaced video streams

2017-11-22 Thread Tobias Rapp
Writes one set of field framing information for progressive streams and
two sets for interlaced streams. Fixes ticket #6383.

Unfortunately the OpenDML v1.02 document is not very specific what value
to use for start_line when frame data is not coming from a capturing
device, so this is just using 0/1 depending on the field order as a
best-effort guess.

Signed-off-by: Tobias Rapp 
---
 libavformat/avienc.c | 38 +++---
 libavformat/version.h|  2 +-
 tests/ref/fate/copy-trac2211-avi |  4 ++--
 3 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 483f5b5..efe67ce 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -501,8 +501,14 @@ static int avi_write_header(AVFormatContext *s)
 AVRational dar = av_mul_q(st->sample_aspect_ratio,
   (AVRational) { par->width,
  par->height });
-int num, den;
+int num, den, fields, i;
 av_reduce(, , dar.num, dar.den, 0x);
+if (par->field_order == AV_FIELD_TT || par->field_order == 
AV_FIELD_BB ||
+par->field_order == AV_FIELD_TB || par->field_order == 
AV_FIELD_BT) {
+fields = 2; // interlaced
+} else {
+fields = 1; // progressive
+}
 
 avio_wl32(pb, 0); // video format   = unknown
 avio_wl32(pb, 0); // video standard = unknown
@@ -514,17 +520,27 @@ static int avi_write_header(AVFormatContext *s)
 avio_wl16(pb, num);
 avio_wl32(pb, par->width);
 avio_wl32(pb, par->height);
-avio_wl32(pb, 1); // progressive FIXME
-
-avio_wl32(pb, par->height);
-avio_wl32(pb, par->width);
-avio_wl32(pb, par->height);
-avio_wl32(pb, par->width);
-avio_wl32(pb, 0);
-avio_wl32(pb, 0);
+avio_wl32(pb, fields); // fields per frame
+
+for (i = 0; i < fields; i++) {
+int start_line;
+if (par->field_order == AV_FIELD_TT || par->field_order == 
AV_FIELD_TB) {
+start_line = (i == 0) ? 0 : 1;
+} else if (par->field_order == AV_FIELD_BB || par->field_order 
== AV_FIELD_BT) {
+start_line = (i == 0) ? 1 : 0;
+} else {
+start_line = 0;
+}
 
-avio_wl32(pb, 0);
-avio_wl32(pb, 0);
+avio_wl32(pb, par->height / fields); // compressed bitmap 
height
+avio_wl32(pb, par->width);   // compressed bitmap width
+avio_wl32(pb, par->height / fields); // valid bitmap height
+avio_wl32(pb, par->width);   // valid bitmap width
+avio_wl32(pb, 0);// valid bitmap X offset
+avio_wl32(pb, 0);// valid bitmap Y offset
+avio_wl32(pb, 0);// valid X offset in T
+avio_wl32(pb, start_line);   // valid Y start line
+}
 ff_end_tag(pb, vprp);
 }
 
diff --git a/libavformat/version.h b/libavformat/version.h
index feb1461..7fe3710 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
 #define LIBAVFORMAT_VERSION_MINOR   2
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MICRO 103
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
diff --git a/tests/ref/fate/copy-trac2211-avi b/tests/ref/fate/copy-trac2211-avi
index 007349e..06d81e5 100644
--- a/tests/ref/fate/copy-trac2211-avi
+++ b/tests/ref/fate/copy-trac2211-avi
@@ -1,5 +1,5 @@
-6f6b211cbc8de9871e8e09e64048e2f9 *tests/data/fate/copy-trac2211-avi.avi
-1777924 tests/data/fate/copy-trac2211-avi.avi
+0920978f3f8196413c43f0033b55a5b6 *tests/data/fate/copy-trac2211-avi.avi
+1777956 tests/data/fate/copy-trac2211-avi.avi
 #tb 0: 1/14
 #media_type 0: video
 #codec_id 0: rawvideo
-- 
2.7.4


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


Re: [FFmpeg-devel] [PATCH 1/3] Revert "udp: fix compilation when HAVE_PTHREAD_CANCEL isnt defined"

2017-11-22 Thread Paul B Mahol
On 11/22/17, Derek Buitenhuis  wrote:
> This was an mplayer-specific hack.
>
> This reverts commit a4f94f24b4f153c30bbcaa700bedfb2b3a581e5e.
> ---
> Near as I can tell, this is a hack added to deal with the fact that the
> terrible mplayer build system cannibalized FFmpeg's, and failed at it.
>
> There's no reason this should be in FFmpeg, if that is the case
> ---
>  libavformat/udp.c | 4 
>  1 file changed, 4 deletions(-)
>
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index 3835f98..0dde035 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -64,10 +64,6 @@
>  #include 
>  #endif
>
> -#ifndef HAVE_PTHREAD_CANCEL
> -#define HAVE_PTHREAD_CANCEL 0
> -#endif
> -
>  #ifndef IPV6_ADD_MEMBERSHIP
>  #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
>  #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
> --
> 1.8.3.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

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


Re: [FFmpeg-devel] [DEVEL][PATCH 2/2] ffmpeg: fix ticket 6706

2017-11-22 Thread pkv.stream

sorry wrong patch, discard previous for this one !


From 532b13fb2a174af0b91a0b08984cbdb8d5027392 Mon Sep 17 00:00:00 2001
From: pkviet 
Date: Sat, 18 Nov 2017 00:26:50 +0100
Subject: [PATCH 2/2] ffmpeg: fix ticket 6706

Fix regression with channel_layout option which is not passed
correctly from output streams to filters when the channel layout is not
a default one.

Signed-off-by: pkviet 
---
 fftools/ffmpeg.h |  3 +++
 fftools/ffmpeg_opt.c | 34 ++
 2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index e0977e1..5c45df4 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -121,6 +121,8 @@ typedef struct OptionsContext {
 intnb_frame_sizes;
 SpecifierOpt *frame_pix_fmts;
 intnb_frame_pix_fmts;
+SpecifierOpt *channel_layouts;
+intnb_channel_layouts;
 
 /* input options */
 int64_t input_ts_offset;

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f66f672..6da53aa 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1818,6 +1818,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, 
AVFormatContext *oc, in
 char *sample_fmt = NULL;
 
 MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);
+MATCH_PER_STREAM_OPT(channel_layouts, ui64, audio_enc->channel_layout, 
oc, st);
 
 MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
 if (sample_fmt &&
@@ -2542,7 +2543,11 @@ loop_end:
(count + 1) * sizeof(*f->sample_rates));
 }
 if (ost->enc_ctx->channels) {
-f->channel_layout = 
av_get_default_channel_layout(ost->enc_ctx->channels);
+if (ost->enc_ctx->channel_layout) {
+f->channel_layout = ost->enc_ctx->channel_layout;
+} else {
+f->channel_layout = 
av_get_default_channel_layout(ost->enc_ctx->channels);
+}
 } else if (ost->enc->channel_layouts) {
 count = 0;
 while (ost->enc->channel_layouts[count])
@@ -3119,7 +3124,7 @@ static int opt_channel_layout(void *optctx, const char 
*opt, const char *arg)
 char layout_str[32];
 char *stream_str;
 char *ac_str;
-int ret, channels, ac_str_size;
+int ret, channels, ac_str_size, stream_str_size;
 uint64_t layout;
 
 layout = av_get_channel_layout(arg);
@@ -3131,12 +3136,30 @@ static int opt_channel_layout(void *optctx, const char 
*opt, const char *arg)
 ret = opt_default_new(o, opt, layout_str);
 if (ret < 0)
 return ret;
+stream_str = strchr(opt, ':');
+stream_str_size = (stream_str ? strlen(stream_str) : 0);
+/* set duplicate 'channel_layout' option in SpecifierOpt,
+ *  enabling access to channel layout through MATCH_PER_STREAM_OPT
+ */
+ac_str_size = 22 + stream_str_size;
+ac_str = av_mallocz(ac_str_size);
+if (!ac_str) {
+return AVERROR(ENOMEM);
+}
+av_strlcpy(ac_str, "channel_layout", 22);
+if (stream_str) {
+av_strlcat(ac_str, stream_str, ac_str_size);
+}
+ret = parse_duplicate_option(o, ac_str, layout_str, options);
+av_free(ac_str);
+if (ret < 0) {
+return ret;
+}
 
 /* set 'ac' option based on channel layout */
 channels = av_get_channel_layout_nb_channels(layout);
 snprintf(layout_str, sizeof(layout_str), "%d", channels);
-stream_str = strchr(opt, ':');
-ac_str_size = 3 + (stream_str ? strlen(stream_str) : 0);
+ac_str_size = 3 + stream_str_size;
 ac_str = av_mallocz(ac_str_size);
 if (!ac_str)
 return AVERROR(ENOMEM);
@@ -3689,6 +3712,9 @@ const OptionDef options[] = {
 { "channel_layout", OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE |
 OPT_INPUT | OPT_OUTPUT,
{ .func_arg = opt_channel_layout },
 "set channel layout", "layout" },
+{ "channel_layout", OPT_AUDIO | HAS_ARG | OPT_INT64 | OPT_SPEC |
+   OPT_INPUT | OPT_OUTPUT, 
{ .off = OFFSET(channel_layouts) },
+"set channel layout with uint64", "layout_uint64" }, // allows storage 
of option in SpecifierOpt
 { "af", OPT_AUDIO | HAS_ARG  | OPT_PERFILE | OPT_OUTPUT,   
{ .func_arg = opt_audio_filters },
 "set audio filters", "filter_graph" },
 { "guess_layout_max", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | 
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(guess_layout_max) },
-- 
2.10.1.windows.1

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


Re: [FFmpeg-devel] [PATCH] Add FAQs about running in background (rev 2)

2017-11-22 Thread Michael Niedermayer
On Wed, Nov 15, 2017 at 12:43:30AM -0800, Jim DeLaHunt wrote:
> Add two FAQs about running FFmpeg in the background.
> The first explains the use of the -nostdin option in
> a straightforward way. Text revised based on review.
> 
> The second FAQ starts from a confusing error message,
> and leads to the solution, use of the -nostdin option.
> The purpose of the second FAQ is to attract web searches
> from people having the problem, and offer them a solution.
> 
> Add an anchor to the Main Options section of the ffmpeg
> documentation, so that the FAQs can link directly there.
> ---
>  doc/faq.texi| 65 
> +
>  doc/ffmpeg.texi |  1 +
>  2 files changed, 66 insertions(+)

will apply

thanks

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

You can kill me, but you cannot change the truth.


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


Re: [FFmpeg-devel] avcodec/x86/exrdsp : use ymm constant for pb_80 instead of vbroadcasti128

2017-11-22 Thread James Almer
On 11/21/2017 6:09 PM, Martin Vignali wrote:
> Hello,
> 
> After patch by James Almer
> (pb_80 now fit an ymm)
> 
> The two mode (SSE, AVX2) for constant loading can be remove
> 
> speed seems to be similar to me
> 
> Martin

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


Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-22 Thread Michael Niedermayer
On Wed, Nov 22, 2017 at 10:24:30AM +, Marc-Antoine ARNAUD wrote:
> New patch version which fixe the last remark.
> 
> 
> Le ven. 10 nov. 2017 à 00:47, Michael Niedermayer 
> a écrit :
> 
> > On Thu, Nov 09, 2017 at 10:22:23AM +, Marc-Antoine ARNAUD wrote:
> > > Please find the merged patch in attachement.
> > >
> > > Thanks
> > >
> > > Le mer. 8 nov. 2017 à 17:12, Paul B Mahol  a écrit :
> > >
> > > > On 11/8/17, Marc-Antoine ARNAUD  wrote:
> > > > > This patch will fix the stride issue.
> > > > > Is it valid for you ?
> > > > >
> > > > > Does it required to merge these 2 patches ? (and remove base64
> > encoding
> > > > on
> > > > > the first one)
> > > >
> > > > Please merge those two patches, base64 encoding should not be needed
> > > > (it helps to faster review patches if they are not encoded).
> > > > ___
> > > > ffmpeg-devel mailing list
> > > > ffmpeg-devel@ffmpeg.org
> > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > >
> >
> > >  vf_geq.c |  124
> > +--
> > >  1 file changed, 90 insertions(+), 34 deletions(-)
> > > b41a90fffb5ddef553661007a38659c602f7ce56
> > 0001-avfilter-slice-processing-for-geq.patch
> > > From ac2a6322fa96835e02a24c31f014fb360e26561f Mon Sep 17 00:00:00 2001
> > > From: Marc-Antoine Arnaud 
> > > Date: Thu, 9 Nov 2017 11:19:43 +0100
> > > Subject: [PATCH] avfilter: slice processing for geq
> > > Content-Type: text/x-patch; charset="utf-8"
> >
> > crashes:
> > ./ffmpeg_g -f lavfi -i
> > 'nullsrc=s=200x200,format=yuv444p16,geq=X*Y/10:sin(X/10)*255:cos(Y/10)*255'
> > -vframes 5 -y blah.avi
> >
> > ==24616== Thread 7:
> > ==24616== Invalid write of size 2
> > ==24616==at 0x4F3AAF: slice_geq_filter (vf_geq.c:289)
> > ==24616==by 0x48E4C9: worker_func (pthread.c:50)
> > ==24616==by 0x11DB932: run_jobs (slicethread.c:61)
> > ==24616==by 0x11DBA04: thread_worker (slicethread.c:85)
> > ==24616==by 0xC45D183: start_thread (pthread_create.c:312)
> > ==24616==by 0xC770FFC: clone (clone.S:111)
> > ==24616==  Address 0x1177143e is 93,214 bytes inside a block of size
> > 93,215 alloc'd
> > ==24616==at 0x4C2A6C5: memalign (vg_replace_malloc.c:727)
> > ==24616==by 0x4C2A760: posix_memalign (vg_replace_malloc.c:876)
> > ==24616==by 0x11B0C43: av_malloc (mem.c:87)
> > ==24616==by 0x11987CC: av_buffer_alloc (buffer.c:72)
> > ==24616==by 0x1198831: av_buffer_allocz (buffer.c:85)
> > ==24616==by 0x1198F29: pool_alloc_buffer (buffer.c:312)
> > ==24616==by 0x1199057: av_buffer_pool_get (buffer.c:349)
> > ==24616==by 0x489D6D: ff_frame_pool_get (framepool.c:222)
> > ==24616==by 0x58F6EB: ff_default_get_video_buffer (video.c:89)
> > ==24616==by 0x58F768: ff_get_video_buffer (video.c:102)
> > ==24616==by 0x4F3BF3: geq_filter_frame (vf_geq.c:312)
> > ==24616==by 0x472FD0: ff_filter_frame_framed (avfilter.c:1104)
> > ==24616==by 0x473800: ff_filter_frame_to_filter (avfilter.c:1252)
> > ==24616==by 0x4739F8: ff_filter_activate_default (avfilter.c:1301)
> > ==24616==by 0x473C12: ff_filter_activate (avfilter.c:1462)
> > ==24616==by 0x478A4F: ff_filter_graph_run_once (avfiltergraph.c:1456)
> > ==24616==by 0x478C72: get_frame_internal (buffersink.c:110)
> > ==24616==by 0x478CCF: av_buffersink_get_frame_flags (buffersink.c:121)
> > ==24616==by 0x441808: lavfi_read_packet (lavfi.c:410)
> > ==24616==by 0x7AC315: ff_read_packet (utils.c:822)
> > ==24616==
> > --24616-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV)
> > - exiting
> > --24616-- si_code=80;  Faulting address: 0x0;  sp: 0x40a075db0
> >
> > [...]
> >
> > --
> > 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
> >

>  vf_geq.c |  130 
> +++
>  1 file changed, 90 insertions(+), 40 deletions(-)
> abe75c0a0cf89605006905c0c58c0600d26fadb6  
> 0001-avfilter-slice-processing-for-geq.patch
> From 7ac2a8c41aaf69ec6cacf7460fa170fd4ca52d8f Mon Sep 17 00:00:00 2001
> From: Marc-Antoine Arnaud 
> Date: Wed, 22 Nov 2017 11:21:35 +0100
> Subject: [PATCH 1/1] avfilter: slice processing for geq
> Content-Type: text/x-patch; charset="utf-8"
> 
> ---
>  libavfilter/vf_geq.c | 130 
> +++
>  1 file changed, 90 insertions(+), 40 deletions(-)
> 
> diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c
> index 36dbd421ce..09bc3d546e 100644
> --- a/libavfilter/vf_geq.c
> +++ 

[FFmpeg-devel] [vorbis] 1 << 31 > int32_t::max(), so use 1u << 31 instead.

2017-11-22 Thread Dale Curtis



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


Re: [FFmpeg-devel] [avformat] Prevent undefined shift with wrap_bits > 63.

2017-11-22 Thread Dale Curtis
On Tue, Nov 21, 2017 at 7:05 PM, Michael Niedermayer  wrote:
>
> I dont think wrap_bits can/should be > 64 or do i miss something ?
>

Good point, this seems true with the current code.


>
> maybe a av_assert* for that would be better.
>

Done; used av_assert2().


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


Re: [FFmpeg-devel] [PATCH] libavformat/mov: Replace duplicate stream_nb check by assert

2017-11-22 Thread Derek Buitenhuis
On 11/22/2017 8:09 PM, Michael Niedermayer wrote:
> not much, no
> its a non static function tough
> i can remove the check completely if thats preferred ?

I guess leave it since it's non-static.

LGTM.

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


[FFmpeg-devel] [PATCH 1/2] avcodec/kgv1dec: Check that there is enough input for maximum RLE compression

2017-11-22 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 4271/clusterfuzz-testcase-4676667768307712

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/kgv1dec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index 5359411c76..a6bd9400ac 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -62,6 +62,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 h = (buf[1] + 1) * 8;
 buf += 2;
 
+if (avpkt->size < 2 + w*h / 513)
+return AVERROR_INVALIDDATA;
+
 if (w != avctx->width || h != avctx->height) {
 av_freep(>frame_buffer);
 av_freep(>last_frame_buffer);
-- 
2.15.0

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


  1   2   >