[FFmpeg-devel] [PATCH] x86/vf_limiter: make limiter functions work on x86_32

2017-07-12 Thread James Almer
Signed-off-by: James Almer 
---
 libavfilter/x86/vf_limiter.asm| 28 
 libavfilter/x86/vf_limiter_init.c |  4 ++--
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/libavfilter/x86/vf_limiter.asm b/libavfilter/x86/vf_limiter.asm
index 9e7271be76..c5b9b0a64d 100644
--- a/libavfilter/x86/vf_limiter.asm
+++ b/libavfilter/x86/vf_limiter.asm
@@ -20,23 +20,21 @@
 
 %include "libavutil/x86/x86util.asm"
 
-%if ARCH_X86_64
-
-SECTION_RODATA
-
-pb_0: times 16 db 0
-
 SECTION .text
 
 INIT_XMM sse2
 
-cglobal limiter_8bit, 8, 9, 3, src, dst, slinesize, dlinesize, w, h, min, max, 
x
+cglobal limiter_8bit, 6, 7, 3, src, dst, slinesize, dlinesize, w, h, x
 movsxdifnidn wq, wd
 addsrcq, wq
 adddstq, wq
 neg  wq
-SPLATB_REG   m1, min, [pb_0]
-SPLATB_REG   m2, max, [pb_0]
+movd m1, r6m
+punpcklbwm1, m1
+SPLATW   m1, m1
+movd m2, r7m
+punpcklbwm2, m2
+SPLATW   m2, m2
 .nextrow:
 mov  xq, wq
 
@@ -51,18 +49,18 @@ cglobal limiter_8bit, 8, 9, 3, src, dst, slinesize, 
dlinesize, w, h, min, max, x
 adddstq, dlinesizeq
 subhd, 1
 jg .nextrow
-ret
+RET
 
 INIT_XMM sse4
 
-cglobal limiter_16bit, 8, 9, 3, src, dst, slinesize, dlinesize, w, h, min, 
max, x
+cglobal limiter_16bit, 6, 7, 3, src, dst, slinesize, dlinesize, w, h, x
 shl  wd, 1
 addsrcq, wq
 adddstq, wq
 neg  wq
-movd m1, mind
+movd m1, r6m
 SPLATW   m1, m1
-movd m2, maxd
+movd m2, r7m
 SPLATW   m2, m2
 .nextrow:
 mov  xq, wq
@@ -79,6 +77,4 @@ cglobal limiter_16bit, 8, 9, 3, src, dst, slinesize, 
dlinesize, w, h, min, max,
 adddstq, dlinesizeq
 subhd, 1
 jg .nextrow
-ret
-
-%endif
+RET
diff --git a/libavfilter/x86/vf_limiter_init.c 
b/libavfilter/x86/vf_limiter_init.c
index ef7d20a1a0..07c733dc21 100644
--- a/libavfilter/x86/vf_limiter_init.c
+++ b/libavfilter/x86/vf_limiter_init.c
@@ -31,12 +31,12 @@ void ff_limiter_init_x86(LimiterDSPContext *dsp, int bpp)
 {
 int cpu_flags = av_get_cpu_flags();
 
-if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags)) {
+if (EXTERNAL_SSE2(cpu_flags)) {
 if (bpp <= 8) {
 dsp->limiter = ff_limiter_8bit_sse2;
 }
 }
-if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags)) {
+if (EXTERNAL_SSE4(cpu_flags)) {
 if (bpp > 8) {
 dsp->limiter = ff_limiter_16bit_sse4;
 }
-- 
2.13.0

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


[FFmpeg-devel] [PATCH 1/2] avcodec/vorbisenc: Add pre-echo detection

2017-07-12 Thread Tyler Jones
The encoder will attempt to determine the existence of transient
signals by applying a 4th order highpass filter to remove dominant
low frequency waveforms. Frames are then split up into blocks
where the variance is calculated and compared with blocks from
the previous frame. A preecho is only likely to be noticeable when
relatively quiet audio is followed by a loud transient signal.

Signed-off-by: Tyler Jones 
---
 libavcodec/Makefile|   2 +-
 libavcodec/vorbisenc.c |  28 +++--
 libavcodec/vorbispsy.c | 153 +
 libavcodec/vorbispsy.h |  79 +
 4 files changed, 256 insertions(+), 6 deletions(-)
 create mode 100644 libavcodec/vorbispsy.c
 create mode 100644 libavcodec/vorbispsy.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index b440a00..2db6727 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -611,7 +611,7 @@ OBJS-$(CONFIG_VMNC_DECODER)+= vmnc.o
 OBJS-$(CONFIG_VORBIS_DECODER)  += vorbisdec.o vorbisdsp.o vorbis.o \
   vorbis_data.o
 OBJS-$(CONFIG_VORBIS_ENCODER)  += vorbisenc.o vorbis.o \
-  vorbis_data.o
+  vorbis_data.o vorbispsy.o
 OBJS-$(CONFIG_VP3_DECODER) += vp3.o
 OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vp56rac.o
 OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \
diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index bf21a3b..3482cf0 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -33,6 +33,7 @@
 #include "mathops.h"
 #include "vorbis.h"
 #include "vorbis_enc_data.h"
+#include "vorbispsy.h"
 
 #include "audio_frame_queue.h"
 #include "libavfilter/bufferqueue.h"
@@ -136,6 +137,7 @@ typedef struct vorbis_enc_context {
 int64_t next_pts;
 
 AVFloatDSPContext *fdsp;
+VorbisPsyContext *vpctx;
 } vorbis_enc_context;
 
 #define MAX_CHANNELS 2
@@ -272,11 +274,12 @@ static int create_vorbis_context(vorbis_enc_context *venc,
 vorbis_enc_floor   *fc;
 vorbis_enc_residue *rc;
 vorbis_enc_mapping *mc;
-int i, book, ret;
+int i, book, ret, blocks;
 
 venc->channels= avctx->channels;
 venc->sample_rate = avctx->sample_rate;
-venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11;
+venc->log2_blocksize[0] = 8;
+venc->log2_blocksize[1] = 11;
 
 venc->ncodebooks = FF_ARRAY_ELEMS(cvectors);
 venc->codebooks  = av_malloc(sizeof(vorbis_enc_codebook) * 
venc->ncodebooks);
@@ -464,6 +467,12 @@ static int create_vorbis_context(vorbis_enc_context *venc,
 if ((ret = dsp_init(avctx, venc)) < 0)
 return ret;
 
+blocks = 1 << (venc->log2_blocksize[1] - venc->log2_blocksize[0]);
+venc->vpctx = av_mallocz(sizeof(VorbisPsyContext));
+if (!venc->vpctx || (ret = psy_vorbis_init(venc->vpctx, venc->sample_rate,
+   venc->channels, blocks)) < 0)
+return AVERROR(ENOMEM);
+
 return 0;
 }
 
@@ -1071,22 +1080,23 @@ static void move_audio(vorbis_enc_context *venc, int 
sf_size)
 float *save = venc->saved + ch * frame_size;
 const float *input = (float *) cur->extended_data[ch];
 const size_t len  = cur->nb_samples * sizeof(float);
-
 memcpy(offset + sf*sf_size, input, len);
 memcpy(save + sf*sf_size, input, len);   // Move samples for next 
frame
 }
 av_frame_free();
 }
 venc->have_saved = 1;
-memcpy(venc->scratch, venc->samples, 2 * venc->channels * frame_size);
+memcpy(venc->scratch, venc->samples, sizeof(float) * venc->channels * 2 * 
frame_size);
 }
 
 static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr)
 {
 vorbis_enc_context *venc = avctx->priv_data;
-int i, ret, need_more;
+int i, ret, need_more, ch;
+int curr_win = 1;
 int frame_size = 1 << (venc->log2_blocksize[1] - 1);
+int block_size = 1 << (venc->log2_blocksize[0] - 1);
 vorbis_enc_mode *mode;
 vorbis_enc_mapping *mapping;
 PutBitContext pb;
@@ -1121,6 +1131,13 @@ static int vorbis_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 
 move_audio(venc, avctx->frame_size);
 
+for (ch = 0; ch < venc->channels; ch++) {
+float *scratch = venc->scratch + 2 * ch * frame_size + frame_size;
+
+if (!psy_vorbis_block_frame(venc->vpctx, scratch, ch, frame_size, 
block_size))
+curr_win = 0;
+}
+
 if (!apply_window_and_mdct(venc))
 return 0;
 
@@ -1252,6 +1269,7 @@ static av_cold int vorbis_encode_close(AVCodecContext 
*avctx)
 ff_mdct_end(>mdct[1]);
 ff_af_queue_close(>afq);
 ff_bufqueue_discard_all(>bufqueue);
+psy_vorbis_close(venc->vpctx);
 
 av_freep(>extradata);
 
diff --git 

Re: [FFmpeg-devel] [PATCH 1/1] This change adds an encoder for Camera metadata motion. This is a type of sensor data associated with video, such as GPS, acceleration, gyro, and camera orientation. It

2017-07-12 Thread Hendrik Leppkes
On Wed, Jul 12, 2017 at 8:31 PM, Louis O'Bryan
 wrote:
> On Wed, Jul 12, 2017 at 9:16 AM, Louis O'Bryan  wrote:
>
>> On Wed, Jul 12, 2017 at 12:50 AM, wm4  wrote:
>>
>>> On Tue, 11 Jul 2017 16:17:33 -0700
>>> "Louis O'Bryan"  wrote:
>>>
>>> > If I need to write a new atom under stsd for my stream in the mov muxer
>>> > 
>>> > (mov_write_stsd_tag),
>>> > is it appropriate to indicate that through the AVStream metadata rather
>>> > than the codec_tag?
>>>
>>> It seemed to have lots of unrelated changes, but maybe I'm missing
>>> something. If those codec tag refactors are needed, they should
>>> probably be split into a separate patch.
>>>
>>> But it looks like most of those changes were unintended (Moritz
>>> suspected that too). The tag addition itself is probably fine.
>>>
>>> Also, please don't top post on mailing lists.
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>
>> That file had unrelated changes that shouldn't have been there, please
>> ignore them.
>> Now that there is no codec associated with the stream, there shouldn't be
>> a codec tag at all, I would assume. (Another issue I need to deal with is
>> that the MOV muxer also doesn't support streams without a codec, but that
>> is separate.)
>>
>
> My goal is to modify the MOV/MP4 muxer so that I can mux the new stream
> with video and audio streams. Part of that is writing a new sample entry
> box under the stsd box.
> Since I no longer plan to use an encoder for the stream, I was wondering if
> the AVStream::metadata
> 
> would be an appropriate way to recognize that stream. Other cases in the
> mov_write_stsd_tag function use the codec tag.
> I have the following sample of that idea here, which allows me to use the
> new stream and write the sample entry box:
>

You can associate a codec to the stream, put the codec in the data
codec range. You just wouldn't have an encoder for it.
This should probably work without any special hacks, I would guess.

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


Re: [FFmpeg-devel] [PATCH] avutil/threadmessage: fix error return in case of av_fifo_alloc failure

2017-07-12 Thread Nicolas George
Le quartidi 24 messidor, an CCXXV, Александр Слободенюк a écrit :
> "ret" variable didn't change from 0.

> From c97362039a106f94dfae46dafc9d06204cdcd1cb Mon Sep 17 00:00:00 2001
> From: Aleksandr Slobodeniuk 
> Date: Wed, 12 Jul 2017 21:41:56 +0300
> Subject: [PATCH] avutil/threadmessage: fix error return in case of
>  av_fifo_alloc failure
> 
> ---
>  libavutil/threadmessage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM, thanks.

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH] avutil/threadmessage: fix error return in case of av_fifo_alloc failure

2017-07-12 Thread Александр Слободенюк
"ret" variable didn't change from 0.

0001-avutil-threadmessage-fix-error-return-in-case-of-av_.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/1] This change adds an encoder for Camera metadata motion. This is a type of sensor data associated with video, such as GPS, acceleration, gyro, and camera orientation. It

2017-07-12 Thread Louis O'Bryan
On Wed, Jul 12, 2017 at 9:16 AM, Louis O'Bryan  wrote:

> On Wed, Jul 12, 2017 at 12:50 AM, wm4  wrote:
>
>> On Tue, 11 Jul 2017 16:17:33 -0700
>> "Louis O'Bryan"  wrote:
>>
>> > If I need to write a new atom under stsd for my stream in the mov muxer
>> > 
>> > (mov_write_stsd_tag),
>> > is it appropriate to indicate that through the AVStream metadata rather
>> > than the codec_tag?
>>
>> It seemed to have lots of unrelated changes, but maybe I'm missing
>> something. If those codec tag refactors are needed, they should
>> probably be split into a separate patch.
>>
>> But it looks like most of those changes were unintended (Moritz
>> suspected that too). The tag addition itself is probably fine.
>>
>> Also, please don't top post on mailing lists.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
> That file had unrelated changes that shouldn't have been there, please
> ignore them.
> Now that there is no codec associated with the stream, there shouldn't be
> a codec tag at all, I would assume. (Another issue I need to deal with is
> that the MOV muxer also doesn't support streams without a codec, but that
> is separate.)
>

My goal is to modify the MOV/MP4 muxer so that I can mux the new stream
with video and audio streams. Part of that is writing a new sample entry
box under the stsd box.
Since I no longer plan to use an encoder for the stream, I was wondering if
the AVStream::metadata

would be an appropriate way to recognize that stream. Other cases in the
mov_write_stsd_tag function use the codec tag.
I have the following sample of that idea here, which allows me to use the
new stream and write the sample entry box:

---
 libavformat/movenc.c | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 88f2f2c819..8d57a18864 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -109,6 +109,13 @@ static const AVClass flavor ## _muxer_class = {\

 static int get_moov_size(AVFormatContext *s);

+static int stream_has_metadata(AVStream *st, const char *metadata_key) {
+if (!st->metadata) {
+return 0;
+}
+return av_dict_get(st->metadata, metadata_key, NULL, 0) != NULL;
+}
+
 static int utf8len(const uint8_t *b)
 {
 int len = 0;
@@ -2060,6 +2067,16 @@ static int mov_write_tmcd_tag(AVIOContext *pb,
MOVTrack *track)
 return update_size(pb, pos);
 }

+static int mov_write_camm_tag(AVIOContext *pb) {
+int64_t pos = avio_tell(pb);
+avio_wb32(pb, 0); /* size */
+ffio_wfourcc(pb, "camm");
+avio_wb32(pb, 0); /* Reserved */
+avio_wb16(pb, 0); /* Reserved */
+avio_wb16(pb, 1); /* Data-reference index */
+return update_size(pb, pos);
+}
+
 static int mov_write_stsd_tag(AVFormatContext *s, AVIOContext *pb,
MOVMuxContext *mov, MOVTrack *track)
 {
 int64_t pos = avio_tell(pb);
@@ -2077,6 +2094,8 @@ static int mov_write_stsd_tag(AVFormatContext *s,
AVIOContext *pb, MOVMuxContext
 mov_write_rtp_tag(pb, track);
 else if (track->par->codec_tag == MKTAG('t','m','c','d'))
 mov_write_tmcd_tag(pb, track);
+else if (stream_has_metadata(track->st, "camm"))
+mov_write_camm_tag(pb);
 return update_size(pb, pos);
 }

@@ -2443,6 +2462,9 @@ static int mov_write_hdlr_tag(AVFormatContext *s,
AVIOContext *pb, MOVTrack *tra
 } else if (track->par->codec_tag == MKTAG('t','m','c','d')) {
 hdlr_type = "tmcd";
 descr = "TimeCodeHandler";
+} else if (stream_has_metadata(track->st, "camm")) {
+hdlr_type = "camm";
+descr = "CameraMetadataMotionHandler";
 } else {
 av_log(s, AV_LOG_WARNING,
"Unknown hldr_type for %s, writing dummy values\n",
@@ -5875,7 +5897,7 @@ static int mov_init(AVFormatContext *s)
 track->language = 0;
 track->mode = mov->mode;
 track->tag  = mov_find_codec_tag(s, track);
-if (!track->tag) {
+if (!track->tag && !stream_has_metadata(st, "camm")) {
 av_log(s, AV_LOG_ERROR, "Could not find tag for codec %s in
stream #%d, "
"codec not currently supported in container\n",
avcodec_get_name(st->codecpar->codec_id), i);
-- 
2.13.2.932.g7449e964c-goog
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/1] This change adds an encoder for Camera metadata motion. This is a type of sensor data associated with video, such as GPS, acceleration, gyro, and camera orientation. It

2017-07-12 Thread Louis O'Bryan
On Wed, Jul 12, 2017 at 12:50 AM, wm4  wrote:

> On Tue, 11 Jul 2017 16:17:33 -0700
> "Louis O'Bryan"  wrote:
>
> > If I need to write a new atom under stsd for my stream in the mov muxer
> > 
> > (mov_write_stsd_tag),
> > is it appropriate to indicate that through the AVStream metadata rather
> > than the codec_tag?
>
> It seemed to have lots of unrelated changes, but maybe I'm missing
> something. If those codec tag refactors are needed, they should
> probably be split into a separate patch.
>
> But it looks like most of those changes were unintended (Moritz
> suspected that too). The tag addition itself is probably fine.
>
> Also, please don't top post on mailing lists.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

That file had unrelated changes that shouldn't have been there, please
ignore them.
Now that there is no codec associated with the stream, there shouldn't be a
codec tag at all, I would assume. (Another issue I need to deal with is
that the MOV muxer also doesn't support streams without a codec, but that
is separate.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] ffmpeg: add -(no)find_stream_info expert option

2017-07-12 Thread Clément Bœsch
On Wed, Jul 12, 2017 at 05:14:14PM +0200, Nicolas George wrote:
> Le quartidi 24 messidor, an CCXXV, Clement Boesch a écrit :
> > ---
> >  ffmpeg_opt.c | 22 +-
> >  1 file changed, 13 insertions(+), 9 deletions(-)
> > 
> > diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> > index 9b7e8c74b9..10ca260648 100644
> > --- a/ffmpeg_opt.c
> > +++ b/ffmpeg_opt.c
> > @@ -145,6 +145,7 @@ static int override_ffserver  = 0;
> >  static int input_stream_potentially_available = 0;
> >  static int ignore_unknown_streams = 0;
> >  static int copy_unknown_streams = 0;
> > +static int find_stream_info = 1;
> 
> > +{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { 
> > _stream_info },
> > +"read and decode the streams to fill missing information with 
> > heuristics" },
> >  
> >  /* video options */
> >  { "vframes",  OPT_VIDEO | HAS_ARG  | OPT_PERFILE | OPT_OUTPUT, 
> >   { .func_arg = opt_video_frames },
> 
> Should it not be implemented for OPT_PERFILE?
> 

Yeah, I guess so. Fixed locally. Also changed in ffplay and ffprobe, even
thought it doesn't make much sense "yet".

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 1/3] ffmpeg: add -(no)find_stream_info expert option

2017-07-12 Thread Nicolas George
Le quartidi 24 messidor, an CCXXV, Clement Boesch a écrit :
> ---
>  ffmpeg_opt.c | 22 +-
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index 9b7e8c74b9..10ca260648 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -145,6 +145,7 @@ static int override_ffserver  = 0;
>  static int input_stream_potentially_available = 0;
>  static int ignore_unknown_streams = 0;
>  static int copy_unknown_streams = 0;
> +static int find_stream_info = 1;

> +{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { 
> _stream_info },
> +"read and decode the streams to fill missing information with 
> heuristics" },
>  
>  /* video options */
>  { "vframes",  OPT_VIDEO | HAS_ARG  | OPT_PERFILE | OPT_OUTPUT,   
> { .func_arg = opt_video_frames },

Should it not be implemented for OPT_PERFILE?

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/aacdec_template: Fix undefined integer overflow in apply_tns()

2017-07-12 Thread Kieran Kunhya
>
> I actually would request a short note explaining the SUINTFLOAT type usage.
> Something like:
> +typedef unsignedSUINTFLOAT; // Equivalent to INTFLOAT,
> Used as temporal cast to avoid undefined sign overflow operations.
>
> Maybe add such note to all "signed value in unsigned type" typedefs.
>

Needs to be in main documentation because nobody is going to understand
this in 50 years time when mailing lists have bitrotted.

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


[FFmpeg-devel] [PATCH 1/3 v2] avutil: merge slice threading implementation from avcodec and avfilter

2017-07-12 Thread Muhammad Faiz
Rework it to improve performance. Now mutex is not shared by workers,
instead each worker has its own mutex and condition variable. This
reduces lock contention between workers. Also use atomic variable for
counter.

The interface also allows execute to run special function on main
thread, requested by Ronald.

Signed-off-by: Muhammad Faiz 
---
 libavutil/Makefile  |   1 +
 libavutil/slicethread.c | 259 
 libavutil/slicethread.h |  52 ++
 3 files changed, 312 insertions(+)
 create mode 100644 libavutil/slicethread.c
 create mode 100644 libavutil/slicethread.h

diff --git a/libavutil/Makefile b/libavutil/Makefile
index b4464b0..af9fba8 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -142,6 +142,7 @@ OBJS = adler32.o
\
samplefmt.o  \
sha.o\
sha512.o \
+   slicethread.o\
spherical.o  \
stereo3d.o   \
threadmessage.o  \
diff --git a/libavutil/slicethread.c b/libavutil/slicethread.c
new file mode 100644
index 000..c43f87a
--- /dev/null
+++ b/libavutil/slicethread.c
@@ -0,0 +1,259 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "slicethread.h"
+#include "mem.h"
+#include "thread.h"
+#include "avassert.h"
+
+#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS
+
+typedef struct WorkerContext {
+AVSliceThread   *ctx;
+pthread_mutex_t mutex;
+pthread_cond_t  cond;
+pthread_t   thread;
+int done;
+} WorkerContext;
+
+struct AVSliceThread {
+WorkerContext   *workers;
+int nb_threads;
+int nb_active_threads;
+int nb_jobs;
+
+atomic_uint first_job;
+atomic_uint current_job;
+pthread_mutex_t done_mutex;
+pthread_cond_t  done_cond;
+int done;
+int finished;
+
+void*priv;
+void(*worker_func)(void *priv, int jobnr, int threadnr, int 
nb_jobs, int nb_threads);
+void(*main_func)(void *priv);
+};
+
+static int run_jobs(AVSliceThread *ctx)
+{
+unsigned nb_jobs= ctx->nb_jobs;
+unsigned nb_active_threads = ctx->nb_active_threads;
+unsigned first_job= atomic_fetch_add_explicit(>first_job, 1, 
memory_order_acq_rel);
+unsigned current_job  = first_job;
+
+do {
+ctx->worker_func(ctx->priv, current_job, first_job, nb_jobs, 
nb_active_threads);
+} while ((current_job = atomic_fetch_add_explicit(>current_job, 1, 
memory_order_acq_rel)) < nb_jobs);
+
+return current_job == nb_jobs + nb_active_threads - 1;
+}
+
+static void *attribute_align_arg thread_worker(void *v)
+{
+WorkerContext *w = v;
+AVSliceThread *ctx = w->ctx;
+
+pthread_mutex_lock(>mutex);
+pthread_cond_signal(>cond);
+
+while (1) {
+w->done = 1;
+while (w->done)
+pthread_cond_wait(>cond, >mutex);
+
+if (ctx->finished) {
+pthread_mutex_unlock(>mutex);
+return NULL;
+}
+
+if (run_jobs(ctx)) {
+pthread_mutex_lock(>done_mutex);
+ctx->done = 1;
+pthread_cond_signal(>done_cond);
+pthread_mutex_unlock(>done_mutex);
+}
+}
+}
+
+int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,
+  void (*worker_func)(void *priv, int jobnr, int 
threadnr, int nb_jobs, int nb_threads),
+  void (*main_func)(void *priv),
+  int nb_threads)
+{
+AVSliceThread *ctx;
+int nb_workers, i;
+
+#if HAVE_W32THREADS
+w32thread_init();
+#endif
+
+av_assert0(nb_threads >= 0);
+if (!nb_threads) {
+int nb_cpus = av_cpu_count();
+if (nb_cpus > 1)
+nb_threads = nb_cpus + 1;
+

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/aacdec_template: Fix undefined integer overflow in apply_tns()

2017-07-12 Thread Ivan Kalvachev
On 7/11/17, Michael Niedermayer  wrote:
> On Sun, Jul 02, 2017 at 01:33:16PM +0200, Michael Niedermayer wrote:
>> On Sun, Jul 02, 2017 at 01:14:31PM +0200, wm4 wrote:
>> > On Sun,  2 Jul 2017 04:28:54 +0200
>> > Michael Niedermayer  wrote:
>> >
>> > > Fixes: runtime error: signed integer overflow: -2147483648 -
>> > > 1202286525 cannot be represented in type 'int'
>> > > Fixes: 2071/clusterfuzz-testcase-minimized-6036414271586304
>> > >
>> > > Found-by: continuous fuzzing process
>> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> > > Signed-off-by: Michael Niedermayer 
>> > > ---
>> > >  libavcodec/aac_defines.h | 2 ++
>> > >  libavcodec/aacdec_template.c | 5 +++--
>> > >  2 files changed, 5 insertions(+), 2 deletions(-)
>> > >
>> > > diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
>> > > index 3c79a8a4a1..ee4c73a87d 100644
>> > > --- a/libavcodec/aac_defines.h
>> > > +++ b/libavcodec/aac_defines.h
>> > > @@ -35,6 +35,7 @@
>> > >  #define AAC_RENAME(x)   x ## _fixed
>> > >  #define AAC_RENAME_32(x)x ## _fixed_32
>> > >  typedef int INTFLOAT;
>> > > +typedef unsignedSUINTFLOAT;
>> > >  typedef int64_t INT64FLOAT;
>> > >  typedef int16_t SHORTFLOAT;
>> > >  typedef SoftFloat   AAC_FLOAT;
>> > > @@ -83,6 +84,7 @@ typedef int AAC_SIGNE;
>> > >  #define AAC_RENAME(x)   x
>> > >  #define AAC_RENAME_32(x)x
>> > >  typedef float   INTFLOAT;
>> > > +typedef float   SUINTFLOAT;
>> >
>> > Not more of this damn shit.
>>
>> i dont think i understand your comment
>>
>> The code is templated and uses largely the INTFLOAT data type
>> which is either signed int or float depending on if the code is build
>> for the fixed point or floating point decoder
>>
>> to fix the undefined behavior in the fixed point decoder a type which
>> is unsigned int is the obvious choice.
>> Such type must be float in the floating point decoder.
>>
>> This patch adds such type.
>>
>> do you object to fixing the issue ?
>> do you want to suggest a different solution ?
>
> over a week passed, noone replied.
> Is everyone ok with patch 1/3 ?
> does someone object to it ?
> does anyone have a better solution ?
>
> If noone replies, i will apply this patch, i do not want to leave
> undefined behavior in the codebase.

I actually would request a short note explaining the SUINTFLOAT type usage.
Something like:
+typedef unsignedSUINTFLOAT; // Equivalent to INTFLOAT,
Used as temporal cast to avoid undefined sign overflow operations.

Maybe add such note to all "signed value in unsigned type" typedefs.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] win32_dlfcn: Support WinRT/UWP.

2017-07-12 Thread Matt Oliver
On 12 July 2017 at 20:31, wm4  wrote:

> On Sat, 1 Jul 2017 23:18:25 +1000
> Matt Oliver  wrote:
>
> > This only enables dlls that are packaged with the application to be
> > loaded. Due to the limitations of WinRT/UWP it is not allowed to load
> > external/system dlls so this cannot be used as a complete replacement
> > for normal win32 dll loading.
> > ---
> >  compat/w32dlfcn.h | 9 -
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h
> > index bc9bb8c9f5..eeabfe4ee0 100644
> > --- a/compat/w32dlfcn.h
> > +++ b/compat/w32dlfcn.h
> > @@ -21,7 +21,7 @@
> >
> >  #ifdef _WIN32
> >  #include 
> > -#if _WIN32_WINNT < 0x0602
> > +#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT
> >  #include "libavutil/wchar_filename.h"
> >  #endif
> >  /**
> > @@ -71,7 +71,14 @@ exit:
> >  #ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
> >  #   define LOAD_LIBRARY_SEARCH_SYSTEM320x0800
> >  #endif
> > +#if !HAVE_WINRT
>
> Why not remove the ! and swap the if/else?
>
> >  return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_
> APPLICATION_DIR
> > | LOAD_LIBRARY_SEARCH_SYSTEM32);
> > +#else
> > +wchar_t *name_w = NULL;
> > +if (utf8towchar(name, _w))
> > +return NULL;
> > +return LoadPackagedLibrary(name_w, 0);
>
> Leaks memory?


Your correct, thanks. New patch attached.


0001-win32_dlfcn-Support-WinRT-UWP.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/os_support: Use existing WinRT config value.

2017-07-12 Thread Matt Oliver
On 12 July 2017 at 20:27, wm4  wrote:

> On Wed, 12 Jul 2017 20:05:08 +1000
> Matt Oliver  wrote:
>
> > ---
> >  libavformat/os_support.h | 14 +-
> >  1 file changed, 1 insertion(+), 13 deletions(-)
> >
> > diff --git a/libavformat/os_support.h b/libavformat/os_support.h
> > index 6e245a88d8..91220e9716 100644
> > --- a/libavformat/os_support.h
> > +++ b/libavformat/os_support.h
> > @@ -146,18 +146,6 @@ int ff_poll(struct pollfd *fds, nfds_t numfds, int
> > timeout);
> >  #include 
> >  #include "libavutil/wchar_filename.h"
> >
> > -#ifdef WINAPI_FAMILY
> > -#include 
> > -// If a WINAPI_FAMILY is defined, check that the desktop API subset
> > -// is enabled
> > -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
> > -#define USE_MOVEFILEEXA
> > -#endif
> > -#else
> > -// If no WINAPI_FAMILY is defined, assume the full API subset
> > -#define USE_MOVEFILEEXA
> > -#endif
> > -
> >  #define DEF_FS_FUNCTION(name, wfunc, afunc)   \
> >  static inline int win32_##name(const char *filename_utf8) \
> >  { \
> > @@ -232,7 +220,7 @@ static inline int win32_rename(const char *src_utf8,
> > const char *dest_utf8)
> >
> >  fallback:
> >  /* filename may be be in CP_ACP */
> > -#ifdef USE_MOVEFILEEXA
> > +#if !HAVE_WINRT
> >  ret = MoveFileExA(src_utf8, dest_utf8, MOVEFILE_REPLACE_EXISTING);
> >  if (ret)
> >  errno = EPERM;
> > --
>
> I think this would conflict with a similar commit in Libav, but not
> sure.
>

I think ive seen the commit your referring to. However libav adds a
HAVE_UWP value however we already have the HAVE_WINRT value thats used in
existing code to do the same thing.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add prefetch for mips

2017-07-12 Thread Manojkumar Bhosale
LGTM

-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of 
kaustubh.ra...@imgtec.com
Sent: Wednesday, July 12, 2017 5:33 PM
To: ffmpeg-devel@ffmpeg.org
Cc: Kaustubh Raste
Subject: [FFmpeg-devel] [PATCH] Add prefetch for mips

From: Kaustubh Raste 

Signed-off-by: Kaustubh Raste 
---
 libavcodec/mips/Makefile|1 +
 libavcodec/mips/videodsp_init.c |   51 +++
 libavcodec/videodsp.c   |2 ++
 libavcodec/videodsp.h   |1 +
 4 files changed, 55 insertions(+)
 create mode 100644 libavcodec/mips/videodsp_init.c

diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index 
797df09..1f659a0 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -38,6 +38,7 @@ OBJS-$(CONFIG_ME_CMP) += 
mips/me_cmp_init_mips.o
 OBJS-$(CONFIG_MPEG4_DECODER)  += mips/xvididct_init_mips.o
 OBJS-$(CONFIG_VC1DSP) += mips/vc1dsp_init_mips.o
 OBJS-$(CONFIG_WMV2DSP)+= mips/wmv2dsp_init_mips.o
+OBJS-$(CONFIG_VIDEODSP)   += mips/videodsp_init.o
 MSA-OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_msa.o\
  mips/hevc_mc_uni_msa.o\
  mips/hevc_mc_uniw_msa.o   \
diff --git a/libavcodec/mips/videodsp_init.c b/libavcodec/mips/videodsp_init.c 
new file mode 100644 index 000..8170404
--- /dev/null
+++ b/libavcodec/mips/videodsp_init.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017 Kaustubh Raste (kaustubh.ra...@imgtec.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
+02110-1301 USA  */
+
+#include "config.h"
+#include "libavutil/attributes.h"
+#include "libavutil/mips/asmdefs.h"
+#include "libavcodec/videodsp.h"
+
+#if HAVE_MSA
+static void prefetch_mips(uint8_t *mem, ptrdiff_t stride, int h) {
+register const uint8_t *p = mem;
+
+__asm__ volatile (
+"1: \n\t"
+"pref  4,  0(%[p])  \n\t"
+"pref  4,  32(%[p]) \n\t"
+PTR_ADDIU"  %[h],  %[h], -1 \n\t"
+PTR_ADDU "  %[p],  %[p], %[stride]  \n\t"
+
+"bnez   %[h],  1b   \n\t"
+
+: [p] "+r" (p), [h] "+r" (h)
+: [stride] "r" (stride)
+);
+}
+#endif  // #if HAVE_MSA
+
+av_cold void ff_videodsp_init_mips(VideoDSPContext *ctx, int bpc) { #if 
+HAVE_MSA
+ctx->prefetch = prefetch_mips;
+#endif  // #if HAVE_MSA
+}
diff --git a/libavcodec/videodsp.c b/libavcodec/videodsp.c index 
ba618a7..ce9e9eb 100644
--- a/libavcodec/videodsp.c
+++ b/libavcodec/videodsp.c
@@ -52,4 +52,6 @@ av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
 ff_videodsp_init_ppc(ctx, bpc);
 if (ARCH_X86)
 ff_videodsp_init_x86(ctx, bpc);
+if (ARCH_MIPS)
+ff_videodsp_init_mips(ctx, bpc);
 }
diff --git a/libavcodec/videodsp.h b/libavcodec/videodsp.h index 
fc01a31..c0545f2 100644
--- a/libavcodec/videodsp.h
+++ b/libavcodec/videodsp.h
@@ -83,5 +83,6 @@ void ff_videodsp_init_aarch64(VideoDSPContext *ctx, int bpc); 
 void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc);  void 
ff_videodsp_init_ppc(VideoDSPContext *ctx, int bpc);  void 
ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc);
+void ff_videodsp_init_mips(VideoDSPContext *ctx, int bpc);
 
 #endif /* AVCODEC_VIDEODSP_H */
--
1.7.9.5

___
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] Add prefetch for mips

2017-07-12 Thread kaustubh.raste
From: Kaustubh Raste 

Signed-off-by: Kaustubh Raste 
---
 libavcodec/mips/Makefile|1 +
 libavcodec/mips/videodsp_init.c |   51 +++
 libavcodec/videodsp.c   |2 ++
 libavcodec/videodsp.h   |1 +
 4 files changed, 55 insertions(+)
 create mode 100644 libavcodec/mips/videodsp_init.c

diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 797df09..1f659a0 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -38,6 +38,7 @@ OBJS-$(CONFIG_ME_CMP) += 
mips/me_cmp_init_mips.o
 OBJS-$(CONFIG_MPEG4_DECODER)  += mips/xvididct_init_mips.o
 OBJS-$(CONFIG_VC1DSP) += mips/vc1dsp_init_mips.o
 OBJS-$(CONFIG_WMV2DSP)+= mips/wmv2dsp_init_mips.o
+OBJS-$(CONFIG_VIDEODSP)   += mips/videodsp_init.o
 MSA-OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_msa.o\
  mips/hevc_mc_uni_msa.o\
  mips/hevc_mc_uniw_msa.o   \
diff --git a/libavcodec/mips/videodsp_init.c b/libavcodec/mips/videodsp_init.c
new file mode 100644
index 000..8170404
--- /dev/null
+++ b/libavcodec/mips/videodsp_init.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017 Kaustubh Raste (kaustubh.ra...@imgtec.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "libavutil/attributes.h"
+#include "libavutil/mips/asmdefs.h"
+#include "libavcodec/videodsp.h"
+
+#if HAVE_MSA
+static void prefetch_mips(uint8_t *mem, ptrdiff_t stride, int h)
+{
+register const uint8_t *p = mem;
+
+__asm__ volatile (
+"1: \n\t"
+"pref  4,  0(%[p])  \n\t"
+"pref  4,  32(%[p]) \n\t"
+PTR_ADDIU"  %[h],  %[h], -1 \n\t"
+PTR_ADDU "  %[p],  %[p], %[stride]  \n\t"
+
+"bnez   %[h],  1b   \n\t"
+
+: [p] "+r" (p), [h] "+r" (h)
+: [stride] "r" (stride)
+);
+}
+#endif  // #if HAVE_MSA
+
+av_cold void ff_videodsp_init_mips(VideoDSPContext *ctx, int bpc)
+{
+#if HAVE_MSA
+ctx->prefetch = prefetch_mips;
+#endif  // #if HAVE_MSA
+}
diff --git a/libavcodec/videodsp.c b/libavcodec/videodsp.c
index ba618a7..ce9e9eb 100644
--- a/libavcodec/videodsp.c
+++ b/libavcodec/videodsp.c
@@ -52,4 +52,6 @@ av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
 ff_videodsp_init_ppc(ctx, bpc);
 if (ARCH_X86)
 ff_videodsp_init_x86(ctx, bpc);
+if (ARCH_MIPS)
+ff_videodsp_init_mips(ctx, bpc);
 }
diff --git a/libavcodec/videodsp.h b/libavcodec/videodsp.h
index fc01a31..c0545f2 100644
--- a/libavcodec/videodsp.h
+++ b/libavcodec/videodsp.h
@@ -83,5 +83,6 @@ void ff_videodsp_init_aarch64(VideoDSPContext *ctx, int bpc);
 void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc);
 void ff_videodsp_init_ppc(VideoDSPContext *ctx, int bpc);
 void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc);
+void ff_videodsp_init_mips(VideoDSPContext *ctx, int bpc);
 
 #endif /* AVCODEC_VIDEODSP_H */
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH 1/3] avutil: merge slice threading implementation from avcodec and avfilter

2017-07-12 Thread Michael Niedermayer
On Wed, Jul 12, 2017 at 07:44:10AM +0700, Muhammad Faiz wrote:
> Rework it to improve performance. Now mutex is not shared by workers,
> instead each worker has its own mutex and condition variable. This
> reduces lock contention between workers. Also use atomic variable for
> counter.
> 
> The interface also allows execute to run special function on main
> thread, requested by Ronald.
> 
> Signed-off-by: Muhammad Faiz 
> ---
>  libavutil/Makefile  |   1 +
>  libavutil/slicethread.c | 259 
> 
>  libavutil/slicethread.h |  52 ++
>  3 files changed, 312 insertions(+)
>  create mode 100644 libavutil/slicethread.c
>  create mode 100644 libavutil/slicethread.h

breaks build on mips (i guess as it was without threads)
src/libavutil/slicethread.c:249: error: conflicting types for 
‘avpriv_slicethread_execute’
src/libavutil/slicethread.h:44: note: previous declaration of 
‘avpriv_slicethread_execute’ was here
make: *** [libavutil/slicethread.o] Error 1
make: *** Waiting for unfinished jobs


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

It is what and why we do it that matters, not just one of them.


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


Re: [FFmpeg-devel] [PATCH] configure: use pkg-config for libgme, if available

2017-07-12 Thread Ricardo Constantino
On 12 July 2017 at 08:43, wm4  wrote:
> On Tue, 11 Jul 2017 21:56:21 +0100
> Ricardo Constantino  wrote:
>
>> On 6 July 2017 at 23:16, Ricardo Constantino  wrote:
>> > On 23 June 2017 at 17:08, wm4  wrote:
>> >> On Fri, 23 Jun 2017 01:53:37 +0100
>> >> Ricardo Constantino  wrote:
>> >>
>> >>> The pkg-config file is relatively new (2013), so some distros might
>> >>> not have it yet. And the -lstdc++ being required for the static lib
>> >>> is only present since the last release in December 2016.
>> >>> ---
>> >>>  configure | 3 ++-
>> >>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> >>>
>> >>> diff --git a/configure b/configure
>> >>> index dd9608540e..74f8ba4c57 100755
>> >>> --- a/configure
>> >>> +++ b/configure
>> >>> @@ -5826,7 +5826,8 @@ enabled fontconfig&& enable libfontconfig
>> >>>  enabled libfontconfig && require_pkg_config fontconfig 
>> >>> "fontconfig/fontconfig.h" FcInit
>> >>>  enabled libfreetype   && require_pkg_config freetype2 "ft2build.h 
>> >>> FT_FREETYPE_H" FT_Init_FreeType
>> >>>  enabled libfribidi&& require_pkg_config fribidi fribidi.h 
>> >>> fribidi_version_info
>> >>> -enabled libgme&& require  libgme gme/gme.h gme_new_emu 
>> >>> -lgme -lstdc++
>> >>> +enabled libgme&& { use_pkg_config libgme gme/gme.h 
>> >>> gme_new_emu ||
>> >>> +   require libgme gme/gme.h gme_new_emu 
>> >>> -lgme -lstdc++; }
>> >>>  enabled libgsm&& { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
>> >>> check_lib libgsm "${gsm_hdr}" 
>> >>> gsm_create -lgsm && break;
>> >>> done || die "ERROR: libgsm not found"; }
>> >>
>> >> The first patch without the fallback has my blessing.
>> >
>> > Pinging this one because some distros (Ubuntu at least) don't have 0.6.1 
>> > yet.
>>
>> Ping.
>
> I can push it if you want?

Sure, whichever patch you prefer.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/aacdec_template: Fix undefined integer overflow in apply_tns()

2017-07-12 Thread wm4
On Wed, 12 Jul 2017 12:16:15 +0200
Michael Niedermayer  wrote:

> On Wed, Jul 12, 2017 at 09:22:44AM +0200, wm4 wrote:
> > On Tue, 11 Jul 2017 22:34:24 +0200
> > Michael Niedermayer  wrote:
> >   
> > > On Sun, Jul 02, 2017 at 01:33:16PM +0200, Michael Niedermayer wrote:  
> > > > On Sun, Jul 02, 2017 at 01:14:31PM +0200, wm4 wrote:
> > > > > On Sun,  2 Jul 2017 04:28:54 +0200
> > > > > Michael Niedermayer  wrote:
> > > > > 
> > > > > > Fixes: runtime error: signed integer overflow: -2147483648 - 
> > > > > > 1202286525 cannot be represented in type 'int'
> > > > > > Fixes: 2071/clusterfuzz-testcase-minimized-6036414271586304
> > > > > > 
> > > > > > Found-by: continuous fuzzing process 
> > > > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > > > Signed-off-by: Michael Niedermayer 
> > > > > > ---
> > > > > >  libavcodec/aac_defines.h | 2 ++
> > > > > >  libavcodec/aacdec_template.c | 5 +++--
> > > > > >  2 files changed, 5 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
> > > > > > index 3c79a8a4a1..ee4c73a87d 100644
> > > > > > --- a/libavcodec/aac_defines.h
> > > > > > +++ b/libavcodec/aac_defines.h
> > > > > > @@ -35,6 +35,7 @@
> > > > > >  #define AAC_RENAME(x)   x ## _fixed
> > > > > >  #define AAC_RENAME_32(x)x ## _fixed_32
> > > > > >  typedef int INTFLOAT;
> > > > > > +typedef unsignedSUINTFLOAT;
> > > > > >  typedef int64_t INT64FLOAT;
> > > > > >  typedef int16_t SHORTFLOAT;
> > > > > >  typedef SoftFloat   AAC_FLOAT;
> > > > > > @@ -83,6 +84,7 @@ typedef int AAC_SIGNE;
> > > > > >  #define AAC_RENAME(x)   x
> > > > > >  #define AAC_RENAME_32(x)x
> > > > > >  typedef float   INTFLOAT;
> > > > > > +typedef float   SUINTFLOAT;
> > > > > 
> > > > > Not more of this damn shit.
> > > > 
> > > > i dont think i understand your comment
> > > > 
> > > > The code is templated and uses largely the INTFLOAT data type
> > > > which is either signed int or float depending on if the code is build
> > > > for the fixed point or floating point decoder
> > > > 
> > > > to fix the undefined behavior in the fixed point decoder a type which
> > > > is unsigned int is the obvious choice.
> > > > Such type must be float in the floating point decoder.
> > > > 
> > > > This patch adds such type.
> > > > 
> > > > do you object to fixing the issue ?
> > > > do you want to suggest a different solution ?
> > > 
> > > over a week passed, noone replied.
> > > Is everyone ok with patch 1/3 ?
> > > does someone object to it ?
> > > does anyone have a better solution ?
> > > 
> > > If noone replies, i will apply this patch, i do not want to leave
> > > undefined behavior in the codebase.  
> > 
> > Fix the type name?  
> 
> Iam happy to change the name, what name would you prefer ?

UINTFLOAT obviously.

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


Re: [FFmpeg-devel] [PATCH] win32_dlfcn: Support WinRT/UWP.

2017-07-12 Thread wm4
On Sat, 1 Jul 2017 23:18:25 +1000
Matt Oliver  wrote:

> This only enables dlls that are packaged with the application to be
> loaded. Due to the limitations of WinRT/UWP it is not allowed to load
> external/system dlls so this cannot be used as a complete replacement
> for normal win32 dll loading.
> ---
>  compat/w32dlfcn.h | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h
> index bc9bb8c9f5..eeabfe4ee0 100644
> --- a/compat/w32dlfcn.h
> +++ b/compat/w32dlfcn.h
> @@ -21,7 +21,7 @@
> 
>  #ifdef _WIN32
>  #include 
> -#if _WIN32_WINNT < 0x0602
> +#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT
>  #include "libavutil/wchar_filename.h"
>  #endif
>  /**
> @@ -71,7 +71,14 @@ exit:
>  #ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
>  #   define LOAD_LIBRARY_SEARCH_SYSTEM320x0800
>  #endif
> +#if !HAVE_WINRT

Why not remove the ! and swap the if/else?

>  return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR
> | LOAD_LIBRARY_SEARCH_SYSTEM32);
> +#else
> +wchar_t *name_w = NULL;
> +if (utf8towchar(name, _w))
> +return NULL;
> +return LoadPackagedLibrary(name_w, 0);

Leaks memory?

> +#endif
>  }
>  #define dlopen(name, flags) win32_dlopen(name)
>  #define dlclose FreeLibrary
> --

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


Re: [FFmpeg-devel] [PATCH] lavf/os_support: Use existing WinRT config value.

2017-07-12 Thread wm4
On Wed, 12 Jul 2017 20:05:08 +1000
Matt Oliver  wrote:

> ---
>  libavformat/os_support.h | 14 +-
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/libavformat/os_support.h b/libavformat/os_support.h
> index 6e245a88d8..91220e9716 100644
> --- a/libavformat/os_support.h
> +++ b/libavformat/os_support.h
> @@ -146,18 +146,6 @@ int ff_poll(struct pollfd *fds, nfds_t numfds, int
> timeout);
>  #include 
>  #include "libavutil/wchar_filename.h"
> 
> -#ifdef WINAPI_FAMILY
> -#include 
> -// If a WINAPI_FAMILY is defined, check that the desktop API subset
> -// is enabled
> -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
> -#define USE_MOVEFILEEXA
> -#endif
> -#else
> -// If no WINAPI_FAMILY is defined, assume the full API subset
> -#define USE_MOVEFILEEXA
> -#endif
> -
>  #define DEF_FS_FUNCTION(name, wfunc, afunc)   \
>  static inline int win32_##name(const char *filename_utf8) \
>  { \
> @@ -232,7 +220,7 @@ static inline int win32_rename(const char *src_utf8,
> const char *dest_utf8)
> 
>  fallback:
>  /* filename may be be in CP_ACP */
> -#ifdef USE_MOVEFILEEXA
> +#if !HAVE_WINRT
>  ret = MoveFileExA(src_utf8, dest_utf8, MOVEFILE_REPLACE_EXISTING);
>  if (ret)
>  errno = EPERM;
> --

I think this would conflict with a similar commit in Libav, but not
sure.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/aacdec_template: Fix undefined integer overflow in apply_tns()

2017-07-12 Thread Michael Niedermayer
On Wed, Jul 12, 2017 at 09:22:44AM +0200, wm4 wrote:
> On Tue, 11 Jul 2017 22:34:24 +0200
> Michael Niedermayer  wrote:
> 
> > On Sun, Jul 02, 2017 at 01:33:16PM +0200, Michael Niedermayer wrote:
> > > On Sun, Jul 02, 2017 at 01:14:31PM +0200, wm4 wrote:  
> > > > On Sun,  2 Jul 2017 04:28:54 +0200
> > > > Michael Niedermayer  wrote:
> > > >   
> > > > > Fixes: runtime error: signed integer overflow: -2147483648 - 
> > > > > 1202286525 cannot be represented in type 'int'
> > > > > Fixes: 2071/clusterfuzz-testcase-minimized-6036414271586304
> > > > > 
> > > > > Found-by: continuous fuzzing process 
> > > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > > Signed-off-by: Michael Niedermayer 
> > > > > ---
> > > > >  libavcodec/aac_defines.h | 2 ++
> > > > >  libavcodec/aacdec_template.c | 5 +++--
> > > > >  2 files changed, 5 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
> > > > > index 3c79a8a4a1..ee4c73a87d 100644
> > > > > --- a/libavcodec/aac_defines.h
> > > > > +++ b/libavcodec/aac_defines.h
> > > > > @@ -35,6 +35,7 @@
> > > > >  #define AAC_RENAME(x)   x ## _fixed
> > > > >  #define AAC_RENAME_32(x)x ## _fixed_32
> > > > >  typedef int INTFLOAT;
> > > > > +typedef unsignedSUINTFLOAT;
> > > > >  typedef int64_t INT64FLOAT;
> > > > >  typedef int16_t SHORTFLOAT;
> > > > >  typedef SoftFloat   AAC_FLOAT;
> > > > > @@ -83,6 +84,7 @@ typedef int AAC_SIGNE;
> > > > >  #define AAC_RENAME(x)   x
> > > > >  #define AAC_RENAME_32(x)x
> > > > >  typedef float   INTFLOAT;
> > > > > +typedef float   SUINTFLOAT;  
> > > > 
> > > > Not more of this damn shit.  
> > > 
> > > i dont think i understand your comment
> > > 
> > > The code is templated and uses largely the INTFLOAT data type
> > > which is either signed int or float depending on if the code is build
> > > for the fixed point or floating point decoder
> > > 
> > > to fix the undefined behavior in the fixed point decoder a type which
> > > is unsigned int is the obvious choice.
> > > Such type must be float in the floating point decoder.
> > > 
> > > This patch adds such type.
> > > 
> > > do you object to fixing the issue ?
> > > do you want to suggest a different solution ?  
> > 
> > over a week passed, noone replied.
> > Is everyone ok with patch 1/3 ?
> > does someone object to it ?
> > does anyone have a better solution ?
> > 
> > If noone replies, i will apply this patch, i do not want to leave
> > undefined behavior in the codebase.
> 
> Fix the type name?

Iam happy to change the name, what name would you prefer ?

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

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



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


[FFmpeg-devel] [PATCH] lavf/os_support: Use existing WinRT config value.

2017-07-12 Thread Matt Oliver
---
 libavformat/os_support.h | 14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/libavformat/os_support.h b/libavformat/os_support.h
index 6e245a88d8..91220e9716 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -146,18 +146,6 @@ int ff_poll(struct pollfd *fds, nfds_t numfds, int
timeout);
 #include 
 #include "libavutil/wchar_filename.h"

-#ifdef WINAPI_FAMILY
-#include 
-// If a WINAPI_FAMILY is defined, check that the desktop API subset
-// is enabled
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#define USE_MOVEFILEEXA
-#endif
-#else
-// If no WINAPI_FAMILY is defined, assume the full API subset
-#define USE_MOVEFILEEXA
-#endif
-
 #define DEF_FS_FUNCTION(name, wfunc, afunc)   \
 static inline int win32_##name(const char *filename_utf8) \
 { \
@@ -232,7 +220,7 @@ static inline int win32_rename(const char *src_utf8,
const char *dest_utf8)

 fallback:
 /* filename may be be in CP_ACP */
-#ifdef USE_MOVEFILEEXA
+#if !HAVE_WINRT
 ret = MoveFileExA(src_utf8, dest_utf8, MOVEFILE_REPLACE_EXISTING);
 if (ret)
 errno = EPERM;
--


0001-lavf-os_support-Use-existing-WinRT-config-value.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] win32_dlfcn: Support WinRT/UWP.

2017-07-12 Thread Matt Oliver
On 2 July 2017 at 00:29, Matt Oliver  wrote:

> On 2 July 2017 at 00:14, Hendrik Leppkes  wrote:
>
>> On Sat, Jul 1, 2017 at 3:18 PM, Matt Oliver  wrote:
>> > This only enables dlls that are packaged with the application to be
>> > loaded. Due to the limitations of WinRT/UWP it is not allowed to load
>> > external/system dlls so this cannot be used as a complete replacement
>> > for normal win32 dll loading.
>>
>> Most of the things we do load are system libraries, so does it really
>> make sense to pretend it works?
>>
>
> No, but this was in response to a previous patch posted to the mailing
> list that just set the return to null. Its mainly just to prevent build
> errors when including the header and I figured that at least a function
> that works would be better than just returning null as this may be of use
> in the future.
> Of course all code we have wont work and should be handled specifically
> (like the recent dx lib linking) but i figured this was better than nothing.
>

Does anyone have any issue with me applying this?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/3] ffmpeg: add -(no)find_stream_info expert option

2017-07-12 Thread Clément Bœsch
---
 ffmpeg_opt.c | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 9b7e8c74b9..10ca260648 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -145,6 +145,7 @@ static int override_ffserver  = 0;
 static int input_stream_potentially_available = 0;
 static int ignore_unknown_streams = 0;
 static int copy_unknown_streams = 0;
+static int find_stream_info = 1;
 
 static void uninit_options(OptionsContext *o)
 {
@@ -949,10 +950,8 @@ static int open_input_file(OptionsContext *o, const char 
*filename)
 AVInputFormat *file_iformat = NULL;
 int err, i, ret;
 int64_t timestamp;
-AVDictionary **opts;
 AVDictionary *unused_opts = NULL;
 AVDictionaryEntry *e = NULL;
-int orig_nb_streams; // number of streams before 
avformat_find_stream_info
 char *   video_codec_name = NULL;
 char *   audio_codec_name = NULL;
 char *subtitle_codec_name = NULL;
@@ -1055,13 +1054,19 @@ static int open_input_file(OptionsContext *o, const 
char *filename)
 for (i = 0; i < ic->nb_streams; i++)
 choose_decoder(o, ic, ic->streams[i]);
 
-/* Set AVCodecContext options for avformat_find_stream_info */
-opts = setup_find_stream_info_opts(ic, o->g->codec_opts);
-orig_nb_streams = ic->nb_streams;
+if (find_stream_info) {
+AVDictionary **opts = setup_find_stream_info_opts(ic, 
o->g->codec_opts);
+int orig_nb_streams = ic->nb_streams;
 
+// TODO: reindent
 /* If not enough info to get the stream parameters, we decode the
first frames to get it. (used in mpeg case for example) */
 ret = avformat_find_stream_info(ic, opts);
+
+for (i = 0; i < orig_nb_streams; i++)
+av_dict_free([i]);
+av_freep();
+
 if (ret < 0) {
 av_log(NULL, AV_LOG_FATAL, "%s: could not find codec parameters\n", 
filename);
 if (ic->nb_streams == 0) {
@@ -1069,6 +1074,7 @@ static int open_input_file(OptionsContext *o, const char 
*filename)
 exit_program(1);
 }
 }
+}
 
 if (o->start_time_eof != AV_NOPTS_VALUE) {
 if (ic->duration>0) {
@@ -1180,10 +1186,6 @@ static int open_input_file(OptionsContext *o, const char 
*filename)
 }
 }
 
-for (i = 0; i < orig_nb_streams; i++)
-av_dict_free([i]);
-av_freep();
-
 input_stream_potentially_available = 1;
 
 return 0;
@@ -3520,6 +3522,8 @@ const OptionDef options[] = {
 { "thread_queue_size", HAS_ARG | OPT_INT | OPT_OFFSET | OPT_EXPERT | 
OPT_INPUT,
  { .off = 
OFFSET(thread_queue_size) },
 "set the maximum number of queued packets from the demuxer" },
+{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { 
_stream_info },
+"read and decode the streams to fill missing information with 
heuristics" },
 
 /* video options */
 { "vframes",  OPT_VIDEO | HAS_ARG  | OPT_PERFILE | OPT_OUTPUT, 
  { .func_arg = opt_video_frames },
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 3/3] ffplay: add -(no)find_stream_info expert option

2017-07-12 Thread Clément Bœsch
---
 ffplay.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index c0b326c8cc..2eaeebc826 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -349,6 +349,7 @@ static int nb_vfilters = 0;
 static char *afilters = NULL;
 #endif
 static int autorotate = 1;
+static int find_stream_info = 1;
 
 /* current context */
 static int is_full_screen;
@@ -2695,8 +2696,6 @@ static int read_thread(void *arg)
 int64_t stream_start_time;
 int pkt_in_play_range = 0;
 AVDictionaryEntry *t;
-AVDictionary **opts;
-int orig_nb_streams;
 SDL_mutex *wait_mutex = SDL_CreateMutex();
 int scan_all_pmts_set = 0;
 int64_t pkt_ts;
@@ -2746,9 +2745,11 @@ static int read_thread(void *arg)
 
 av_format_inject_global_side_data(ic);
 
-opts = setup_find_stream_info_opts(ic, codec_opts);
-orig_nb_streams = ic->nb_streams;
+if (find_stream_info) {
+AVDictionary **opts = setup_find_stream_info_opts(ic, codec_opts);
+int orig_nb_streams = ic->nb_streams;
 
+// TODO: reindent
 err = avformat_find_stream_info(ic, opts);
 
 for (i = 0; i < orig_nb_streams; i++)
@@ -2761,6 +2762,7 @@ static int read_thread(void *arg)
 ret = -1;
 goto fail;
 }
+}
 
 if (ic->pb)
 ic->pb->eof_reached = 0; // FIXME hack, ffplay maybe should not use 
avio_feof() to test for the end
@@ -3557,6 +3559,8 @@ static const OptionDef options[] = {
 { "scodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { _codec_name }, 
"force subtitle decoder", "decoder_name" },
 { "vcodec", HAS_ARG | OPT_STRING | OPT_EXPERT, {_codec_name }, 
"force video decoder","decoder_name" },
 { "autorotate", OPT_BOOL, {  }, "automatically rotate video", 
"" },
+{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { 
_stream_info },
+"read and decode the streams to fill missing information with 
heuristics" },
 { NULL, },
 };
 
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 2/3] ffprobe: add -(no)find_stream_info expert option

2017-07-12 Thread Clément Bœsch
---
 ffprobe.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index e295c53def..72a06d983b 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -130,6 +130,8 @@ typedef struct ReadInterval {
 static ReadInterval *read_intervals;
 static int read_intervals_nb = 0;
 
+static int find_stream_info  = 1;
+
 /* section structure definition */
 
 #define SECTION_MAX_NB_CHILDREN 10
@@ -2771,10 +2773,9 @@ static void show_error(WriterContext *w, int err)
 
 static int open_input_file(InputFile *ifile, const char *filename)
 {
-int err, i, orig_nb_streams;
+int err, i;
 AVFormatContext *fmt_ctx = NULL;
 AVDictionaryEntry *t;
-AVDictionary **opts;
 int scan_all_pmts_set = 0;
 
 fmt_ctx = avformat_alloc_context();
@@ -2802,10 +2803,11 @@ static int open_input_file(InputFile *ifile, const char 
*filename)
 return AVERROR_OPTION_NOT_FOUND;
 }
 
-/* fill the streams in the format context */
-opts = setup_find_stream_info_opts(fmt_ctx, codec_opts);
-orig_nb_streams = fmt_ctx->nb_streams;
+if (find_stream_info) {
+AVDictionary **opts = setup_find_stream_info_opts(fmt_ctx, codec_opts);
+int orig_nb_streams = fmt_ctx->nb_streams;
 
+// TODO: reindent
 err = avformat_find_stream_info(fmt_ctx, opts);
 
 for (i = 0; i < orig_nb_streams; i++)
@@ -2816,6 +2818,7 @@ static int open_input_file(InputFile *ifile, const char 
*filename)
 print_error(filename, err);
 return err;
 }
+}
 
 av_dump_format(fmt_ctx, 0, filename, 0);
 
@@ -3472,6 +3475,8 @@ static const OptionDef real_options[] = {
 { "read_intervals", HAS_ARG, {.func_arg = opt_read_intervals}, "set read 
intervals", "read_intervals" },
 { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = 
opt_default}, "generic catch all option", "" },
 { "i", HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", 
"input_file"},
+{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { 
_stream_info },
+"read and decode the streams to fill missing information with 
heuristics" },
 { NULL, },
 };
 
-- 
2.13.2

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


Re: [FFmpeg-devel] [PATCH 1/1] This change adds an encoder for Camera metadata motion. This is a type of sensor data associated with video, such as GPS, acceleration, gyro, and camera orientation. It

2017-07-12 Thread wm4
On Tue, 11 Jul 2017 16:17:33 -0700
"Louis O'Bryan"  wrote:

> If I need to write a new atom under stsd for my stream in the mov muxer
> 
> (mov_write_stsd_tag),
> is it appropriate to indicate that through the AVStream metadata rather
> than the codec_tag?

It seemed to have lots of unrelated changes, but maybe I'm missing
something. If those codec tag refactors are needed, they should
probably be split into a separate patch.

But it looks like most of those changes were unintended (Moritz
suspected that too). The tag addition itself is probably fine.

Also, please don't top post on mailing lists.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: use pkg-config for libgme, if available

2017-07-12 Thread wm4
On Tue, 11 Jul 2017 21:56:21 +0100
Ricardo Constantino  wrote:

> On 6 July 2017 at 23:16, Ricardo Constantino  wrote:
> > On 23 June 2017 at 17:08, wm4  wrote:  
> >> On Fri, 23 Jun 2017 01:53:37 +0100
> >> Ricardo Constantino  wrote:
> >>  
> >>> The pkg-config file is relatively new (2013), so some distros might
> >>> not have it yet. And the -lstdc++ being required for the static lib
> >>> is only present since the last release in December 2016.
> >>> ---
> >>>  configure | 3 ++-
> >>>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/configure b/configure
> >>> index dd9608540e..74f8ba4c57 100755
> >>> --- a/configure
> >>> +++ b/configure
> >>> @@ -5826,7 +5826,8 @@ enabled fontconfig&& enable libfontconfig
> >>>  enabled libfontconfig && require_pkg_config fontconfig 
> >>> "fontconfig/fontconfig.h" FcInit
> >>>  enabled libfreetype   && require_pkg_config freetype2 "ft2build.h 
> >>> FT_FREETYPE_H" FT_Init_FreeType
> >>>  enabled libfribidi&& require_pkg_config fribidi fribidi.h 
> >>> fribidi_version_info
> >>> -enabled libgme&& require  libgme gme/gme.h gme_new_emu -lgme 
> >>> -lstdc++
> >>> +enabled libgme&& { use_pkg_config libgme gme/gme.h 
> >>> gme_new_emu ||
> >>> +   require libgme gme/gme.h gme_new_emu 
> >>> -lgme -lstdc++; }
> >>>  enabled libgsm&& { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
> >>> check_lib libgsm "${gsm_hdr}" 
> >>> gsm_create -lgsm && break;
> >>> done || die "ERROR: libgsm not found"; }  
> >>
> >> The first patch without the fallback has my blessing.  
> >
> > Pinging this one because some distros (Ubuntu at least) don't have 0.6.1 
> > yet.  
> 
> Ping.

I can push it if you want?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/aacdec_template: Fix undefined integer overflow in apply_tns()

2017-07-12 Thread wm4
On Tue, 11 Jul 2017 22:34:24 +0200
Michael Niedermayer  wrote:

> On Sun, Jul 02, 2017 at 01:33:16PM +0200, Michael Niedermayer wrote:
> > On Sun, Jul 02, 2017 at 01:14:31PM +0200, wm4 wrote:  
> > > On Sun,  2 Jul 2017 04:28:54 +0200
> > > Michael Niedermayer  wrote:
> > >   
> > > > Fixes: runtime error: signed integer overflow: -2147483648 - 1202286525 
> > > > cannot be represented in type 'int'
> > > > Fixes: 2071/clusterfuzz-testcase-minimized-6036414271586304
> > > > 
> > > > Found-by: continuous fuzzing process 
> > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > Signed-off-by: Michael Niedermayer 
> > > > ---
> > > >  libavcodec/aac_defines.h | 2 ++
> > > >  libavcodec/aacdec_template.c | 5 +++--
> > > >  2 files changed, 5 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
> > > > index 3c79a8a4a1..ee4c73a87d 100644
> > > > --- a/libavcodec/aac_defines.h
> > > > +++ b/libavcodec/aac_defines.h
> > > > @@ -35,6 +35,7 @@
> > > >  #define AAC_RENAME(x)   x ## _fixed
> > > >  #define AAC_RENAME_32(x)x ## _fixed_32
> > > >  typedef int INTFLOAT;
> > > > +typedef unsignedSUINTFLOAT;
> > > >  typedef int64_t INT64FLOAT;
> > > >  typedef int16_t SHORTFLOAT;
> > > >  typedef SoftFloat   AAC_FLOAT;
> > > > @@ -83,6 +84,7 @@ typedef int AAC_SIGNE;
> > > >  #define AAC_RENAME(x)   x
> > > >  #define AAC_RENAME_32(x)x
> > > >  typedef float   INTFLOAT;
> > > > +typedef float   SUINTFLOAT;  
> > > 
> > > Not more of this damn shit.  
> > 
> > i dont think i understand your comment
> > 
> > The code is templated and uses largely the INTFLOAT data type
> > which is either signed int or float depending on if the code is build
> > for the fixed point or floating point decoder
> > 
> > to fix the undefined behavior in the fixed point decoder a type which
> > is unsigned int is the obvious choice.
> > Such type must be float in the floating point decoder.
> > 
> > This patch adds such type.
> > 
> > do you object to fixing the issue ?
> > do you want to suggest a different solution ?  
> 
> over a week passed, noone replied.
> Is everyone ok with patch 1/3 ?
> does someone object to it ?
> does anyone have a better solution ?
> 
> If noone replies, i will apply this patch, i do not want to leave
> undefined behavior in the codebase.

Fix the type name?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel