Re: [FFmpeg-devel] [PATCH v2] libavformat/rtsp: return error if rtsp_hd_out is null instead of crash

2019-09-17 Thread Ross Nicholson
Updated patch to add return after variable definitions.

On Wed, 18 Sep 2019 at 07:54, phunkyfish  wrote:

> ---
>  libavformat/rtsp.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index c153cac88b..3e8606dade 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -1318,6 +1318,9 @@ static int
> rtsp_send_cmd_with_content_async(AVFormatContext *s,
>  char buf[4096], *out_buf;
>  char base64buf[AV_BASE64_SIZE(sizeof(buf))];
>
> +if (rt->rtsp_hd_out == NULL)
> +return ENOTCONN;
> +
>  /* Add in RTSP headers */
>  out_buf = buf;
>  rt->seq++;
> --
> 2.20.1 (Apple Git-117)
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2] libavformat/rtsp: return error if rtsp_hd_out is null instead of crash

2019-09-17 Thread phunkyfish
---
 libavformat/rtsp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c153cac88b..3e8606dade 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1318,6 +1318,9 @@ static int 
rtsp_send_cmd_with_content_async(AVFormatContext *s,
 char buf[4096], *out_buf;
 char base64buf[AV_BASE64_SIZE(sizeof(buf))];
 
+if (rt->rtsp_hd_out == NULL)
+return ENOTCONN;
+
 /* Add in RTSP headers */
 out_buf = buf;
 rt->seq++;
-- 
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] Is it ok to add G.722.1 decoder as external lib?

2019-09-17 Thread Hyun Yoo
According to wiki, g.722.1 is not variants of G.722 and
they use different patented compression technologies.

There is a reference code in ITU-T
https://www.itu.int/rec/T-REC-G.722.1-200505-I/en
and the freeswitch version is a wrapper with cleaner api.
(I recently contacted the freeswitch guy and got permission)
so I think the source code is ok to use.

The codec itself is licensed by Polycom so I agreed it should be notified
to user.
How can I mark the new external codec as “nonfree” in configure?
Any document about that?

I also found old thread about "Differences between Cook and G.722.1"
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2007-May/034060.html
I can find CODEC_ID_COOK but not G722_1 so maybe they turned out to be
different.

2019년 9월 17일 (화) 오후 5:27, Moritz Barsnick 님이 작성:

> On Tue, Sep 17, 2019 at 09:52:48 +0200, Carl Eugen Hoyos wrote:
> > > But that said: ffmpeg already has a native G.722 encoder (and decoder),
> >
> > See: https://en.wikipedia.org/wiki/G.722.1
> > The numbering...
>
> Yes, my next paragraph referred to that. But I just figured out that
> G.722 was apparently differently licensed, and therefore it was
> probably quite straightforward to port libg722 to ffmpeg, unlike this
> G.722.1 code or codec.
>
> > (The library is non-free and we cannot change that.)
>
> Indeed.
>
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] doc: various spelling, grammar and formatting fixes

2019-09-17 Thread Gyan



On 17-09-2019 01:51 PM, Moritz Barsnick wrote:

Signed-off-by: Moritz Barsnick 
---
  doc/filters.texi | 69 
  doc/muxers.texi  |  4 +--
  2 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index bbfdad4d4d..6ed0e79f16 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -756,7 +756,7 @@ aecho=0.8:0.88:60:0.4
  @end example

  @item
-If delay is very short, then it sound like a (metallic) robot playing music:
+If delay is very short, then it sounds like a (metallic) robot playing music:
  @example
  aecho=0.8:0.88:6:0.4
  @end example
@@ -1157,11 +1157,11 @@ It can be used as component for digital crossover 
filters,
  room equalization, cross talk cancellation, wavefield synthesis,
  auralization, ambiophonics, ambisonics and spatialization.

-This filter uses second stream as FIR coefficients.
-If second stream holds single channel, it will be used
-for all input channels in first stream, otherwise
-number of channels in second stream must be same as
-number of channels in first stream.
+This filter uses the second stream as FIR coefficients.
+If the second stream holds a single channel, it will be used
+for all input channels in the first stream, otherwise
+the number of channels in the second stream must be same as
+the number of channels in the first stream.

  It accepts the following parameters:

@@ -1766,7 +1766,7 @@ Each sample is adjusted by looking for other samples with 
similar contexts. This
  context similarity is defined by comparing their surrounding patches of size
  @option{p}. Patches are searched in an area of @option{r} around the sample.

-The filter accepts the following options.
+The filter accepts the following options:

  @table @option
  @item s
@@ -2965,12 +2965,12 @@ Compensation Delay Line is a metric based delay to 
compensate differing
  positions of microphones or speakers.

  For example, you have recorded guitar with two microphones placed in
-different location. Because the front of sound wave has fixed speed in
+different locations. Because the front of sound wave has fixed speed in
  normal conditions, the phasing of microphones can vary and depends on
  their location and interposition. The best sound mix can be achieved when
-these microphones are in phase (synchronized). Note that distance of
-~30 cm between microphones makes one microphone to capture signal in
-antiphase to another microphone. That makes the final mix sounding moody.
+these microphones are in phase (synchronized). Note that a distance of
+~30 cm between microphones makes one microphone capture the signal in
+antiphase to the other microphone. That makes the final mix sound moody.
  This filter helps to solve phasing problems by adding different delays
  to each microphone track and make them synchronized.

@@ -2979,7 +2979,7 @@ synchronize other tracks one by one with it.
  Remember that synchronization/delay tolerance depends on sample rate, too.
  Higher sample rates will give more tolerance.

-It accepts the following parameters:
+The filter accepts the following parameters:

  @table @option
  @item mm
@@ -3003,7 +3003,7 @@ Set wet amount. Amount of processed (wet) signal.
  Default is 1.

  @item temp
-Set temperature degree in Celsius. This is the temperature of the environment.
+Set temperature in degrees Celsius. This is the temperature of the environment.
  Default is 20.
  @end table

@@ -6638,7 +6638,7 @@ If the interlacing is unknown or the decoder does not 
export this information,
  top field first will be assumed.

  @item deint
-Specify which frames to deinterlace. Accept one of the following
+Specify which frames to deinterlace. Accepts one of the following
  values:

  @table @option
@@ -11423,7 +11423,7 @@ All streams must be of same pixel format and of same 
height.
  Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  to create same output.

-The filter accept the following option:
+The filter accepts the following option:

  @table @option
  @item inputs
@@ -13262,7 +13262,7 @@ the following values: "blur", "blur_no_scale", "median", 
"gaussian",
  or "bilateral". The default value is "gaussian".

  The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
-depend on the smooth type. @var{param1} and
+depends on the smooth type. @var{param1} and
  @var{param2} accept integer positive values or 0. @var{param3} and
  @var{param4} accept floating point values.

@@ -14443,7 +14443,7 @@ __kernel void blend_images(__write_only image2d_t dst,

  Alter frame colors in video with pseudocolors.

-This filter accept the following options:
+This filter accepts the following options:

  @table @option
  @item c0
@@ -14768,7 +14768,7 @@ Enable checking the parity bit. In the event of a 
parity error, the filter will
  @code{0x00} for that character. Default is false.

  @item lp
-Lowpass lines prior further proccessing. Default is disabled.
+Lo

[FFmpeg-devel] [PATCH 07/10] avformat/asfdec_o: Remove code duplication

2019-09-17 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavformat/asfdec_o.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index e90820373e..40641b8022 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -1549,14 +1549,7 @@ static void reset_packet_state(AVFormatContext *s)
 asf->sub_dts   = 0;
 for (i = 0; i < asf->nb_streams; i++) {
 ASFPacket *pkt = &asf->asf_st[i]->pkt;
-pkt->size_left = 0;
-pkt->data_size = 0;
-pkt->duration  = 0;
-pkt->flags = 0;
-pkt->dts   = 0;
-pkt->duration  = 0;
-av_packet_unref(&pkt->avpkt);
-av_init_packet(&pkt->avpkt);
+reset_packet(pkt);
 }
 }
 
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 10/10] avutil/common: Fix undefined shift

2019-09-17 Thread Andreas Rheinhardt
av_mod_uintp2_c uses a bitwise AND with (1 << p) - 1 to clear the high
bits of an unsigned int. But this is undefined if p == 31, because 1 is
an int and 2^31 is not representable in an int. So make 1 unsigned.

Signed-off-by: Andreas Rheinhardt 
---
 libavutil/common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/common.h b/libavutil/common.h
index 8db0291170..af35397eb9 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -240,7 +240,7 @@ static av_always_inline av_const unsigned 
av_clip_uintp2_c(int a, int p)
  */
 static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned 
p)
 {
-return a & ((1 << p) - 1);
+return a & ((1U << p) - 1);
 }
 
 /**
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 09/10] avcodec/opus_rc: Fix currently empty checks

2019-09-17 Thread Andreas Rheinhardt
FFMAX(a, 0) is always a if a is an unsigned type. In case of opus_rc, a
is the difference of a signed and an unsigned type and the conversion to
unsigned was surely unintended.

Found via PVS-Studio (see issue #8156).

Signed-off-by: Andreas Rheinhardt 
---
Casting is the easy solution to this problem; one could of course use
another type, but then one would need to check whether this would not
lead to undefined or undesired behaviour elsewhere.
Given that a segfault would be the likely result of a wraparound in any
of these subtractions, I'm wondering whether the FFMAX is necessary at
all.
PVS-Studio found more bugs of this kind. Search for "will work as" on
this website: https://trac.ffmpeg.org/attachment/ticket/8156/project2019.tasks 

 libavcodec/opus_rc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/opus_rc.c b/libavcodec/opus_rc.c
index c432eb90c9..1c5bcefabd 100644
--- a/libavcodec/opus_rc.c
+++ b/libavcodec/opus_rc.c
@@ -391,11 +391,11 @@ void ff_opus_rc_enc_end(OpusRangeCoder *rc, uint8_t *dst, 
int size)
 uint8_t *rb_src, *rb_dst;
 ff_opus_rc_put_raw(rc, 0, 32 - rc->rb.cachelen);
 rb_src = rc->buf + OPUS_MAX_PACKET_SIZE + 12 - rc->rb.bytes;
-rb_dst = dst + FFMAX(size - rc->rb.bytes, 0);
+rb_dst = dst + FFMAX(size - (int)rc->rb.bytes, 0);
 lap = &dst[rng_bytes] - rb_dst;
 for (i = 0; i < lap; i++)
 rb_dst[i] |= rb_src[i];
-memcpy(&rb_dst[lap], &rb_src[lap], FFMAX(rc->rb.bytes - lap, 0));
+memcpy(&rb_dst[lap], &rb_src[lap], FFMAX((int)rc->rb.bytes - lap, 0));
 }
 }
 
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 03/10] avcodec/cbs_av1: Fix potential undefined shift

2019-09-17 Thread Andreas Rheinhardt
1 << w is undefined as soon as w is >= 31, as 1 has type int. In the
case of cbs_av1_read_ns, w could potentially even be 32, so one has to
use a 64bit type.

(None of the current callers ever use arguments that are so large that
the above scenario can happen, but this might change in the future.)

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs_av1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 98cd37ef74..0ff6d60ae2 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -220,7 +220,7 @@ static int cbs_av1_read_ns(CodedBitstreamContext *ctx, 
GetBitContext *gbc,
 position = get_bits_count(gbc);
 
 w = av_log2(n) + 1;
-m = (1 << w) - n;
+m = (1LL << w) - n;
 
 if (get_bits_left(gbc) < w) {
 av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid non-symmetric value at "
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 06/10] avformat/asfdec_o: Don't reset twice

2019-09-17 Thread Andreas Rheinhardt
A variable has been assigned a value twice consecutively; essentially
the same happens when one performs av_init_packet on an AVPacket after
a call to av_packet_unref.

Found via PVS-Studio (see ticket #8156).

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/asfdec_o.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index 26f9609f27..e90820373e 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -1142,9 +1142,7 @@ static void reset_packet(ASFPacket *asf_pkt)
 asf_pkt->duration  = 0;
 asf_pkt->flags = 0;
 asf_pkt->dts   = 0;
-asf_pkt->duration  = 0;
 av_packet_unref(&asf_pkt->avpkt);
-av_init_packet(&asf_pkt->avpkt);
 }
 
 static int asf_read_replicated_data(AVFormatContext *s, ASFPacket *asf_pkt)
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 08/10] avcodec/avpacket: Improve allocating packets

2019-09-17 Thread Andreas Rheinhardt
av_mallocz + av_init_packet leads to the same result as av_mallocz +
av_packet_unref, but faster.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/avpacket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 2b20067211..858f827a0a 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -54,7 +54,7 @@ AVPacket *av_packet_alloc(void)
 if (!pkt)
 return pkt;
 
-av_packet_unref(pkt);
+av_init_packet(pkt);
 
 return pkt;
 }
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 02/10] avcodec/mjpegdec: Unify switch statements

2019-09-17 Thread Andreas Rheinhardt
This has been forgotten in d5a3a20d.

Found via PVS-Studio (see ticket #8156).

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mjpegdec.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index f095afaed8..8b053613fc 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -555,11 +555,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 case 0x22122100:
 case 0x21211100:
 case 0x22211200:
-if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;
-else
-goto unk_pixfmt;
-s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
-break;
 case 0x1100:
 case 0x22112200:
 case 0x1100:
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 04/10] avcodec/cbs_av1: Make overread check more robust

2019-09-17 Thread Andreas Rheinhardt
When performing a comparison of a signed int and an unsigned int, the
signed int is first converted to an unsigned int, so that negative
values are being treated as big, positive values. This can become a
problem in an overread check, namely when an overread already happened.
So change the type of the variable containing the amount of bits that
need to be left to signed.

Signed-off-by: Andreas Rheinhardt 
---
I am not aware of any situation where cbs overreads, but robustness is
nevertheless valueable.

 libavcodec/cbs_av1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 0ff6d60ae2..84998e1e8c 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -211,8 +211,8 @@ static int cbs_av1_read_ns(CodedBitstreamContext *ctx, 
GetBitContext *gbc,
uint32_t n, const char *name,
const int *subscripts, uint32_t *write_to)
 {
-uint32_t w, m, v, extra_bit, value;
-int position;
+uint32_t m, v, extra_bit, value;
+int position, w;
 
 av_assert0(n > 0);
 
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 05/10] avformat/asfdec_o: Unify switch cases

2019-09-17 Thread Andreas Rheinhardt
Found via PVS-Studio (see ticket #8156).

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/asfdec_o.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index 8e7f044ce9..26f9609f27 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -316,6 +316,7 @@ static int asf_read_generic_value(AVIOContext *pb, int 
type, uint64_t *value)
 
 switch (type) {
 case ASF_BOOL:
+case ASF_WORD:
 *value = avio_rl16(pb);
 break;
 case ASF_DWORD:
@@ -324,9 +325,6 @@ static int asf_read_generic_value(AVIOContext *pb, int 
type, uint64_t *value)
 case ASF_QWORD:
 *value = avio_rl64(pb);
 break;
-case ASF_WORD:
-*value = avio_rl16(pb);
-break;
 default:
 return AVERROR_INVALIDDATA;
 }
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 01/10] avcodec/cbs_h2645: Fix potential out-of-bounds array access

2019-09-17 Thread Andreas Rheinhardt
The maximum allowed index for an array access is FF_ARRAY_ELEMS - 1; yet
the current code allowed FF_ARRAY_ELEMS. This wasn't dangerous in practice,
as parameter sets with invalid ids were already filtered out during
reading.

Found via PVS-Studio (see ticket #8156).

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs_h2645.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 8da8421e47..69e71a7526 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -748,7 +748,7 @@ static int cbs_h26 ## h26n ## _replace_ ## 
ps_var(CodedBitstreamContext *ctx, \
 CodedBitstreamH26 ## h26n ## Context *priv = ctx->priv_data; \
 H26 ## h26n ## Raw ## ps_name *ps_var = unit->content; \
 unsigned int id = ps_var->id_element; \
-if (id > FF_ARRAY_ELEMS(priv->ps_var)) { \
+if (id >= FF_ARRAY_ELEMS(priv->ps_var)) { \
 av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid " #ps_name \
" id : %d.\n", id); \
 return AVERROR_INVALIDDATA; \
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] Add option to log timing

2019-09-17 Thread Soft Works
> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Moritz Barsnick
> Sent: Tuesday, September 17, 2019 11:07 PM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH v2] Add option to log timing
> 
> On Tue, Sep 17, 2019 at 00:07:37 +, Soft Works wrote:
> > This commit adds two logging flags: 'timing' and 'datetiming'.
> 
> I like the whole idea. I haven't tested yet, but I will in a moment.
> 
> > Usage:
> > ffmpeg -loglevel +timing
> > or
> > ffmpeg -loglevel +datetiming
> 
> Have you considered what happens if you do $ ffmpeg -loglevel
> +timing+datetiming ?

It will print date + time.

> (It just seems a bit weird having one flag being a superset of another.
> I don't mind otherwise.)

You're correct, It's a superset. I found it more convenient to do it like this 
because:
- It would make little sense printing only the date for each line
- I wanted to avoid requiring a user to specify two separate flags to get both 
date and time

But I wouldn't mind changing this to independent flags

> You also need to add documentation for these options to doc/fftools-
> common-opts.texi (section "@item -loglevel").

Damn, this is going to get more work than expected ;-)

> libavutil/log.h is part of the API, IIUC. So you should bump libavutil's micro
> version, and even add an entry into doc/APIchanges.

OK.

> > +&& ((flags & AV_LOG_PRINT_TIME) || (flags &
> AV_LOG_PRINT_DATETIME)))
> > +format_date_now(&part[4], flags & AV_LOG_PRINT_DATETIME);
> 
> According to the style of the other calls, you could express "&part[4]"
> as "part+4".

I won't argue - conformity wins of course.


Thanks for looking into this, I'll wait for other comments before updating the 
patch.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavf/mpegts: add support for AVS2

2019-09-17 Thread Carl Eugen Hoyos
Am Sa., 26. Mai 2018 um 08:50 Uhr schrieb hwren :
>
> Signed-off-by: hwren 
> ---
>  libavformat/mpegts.c | 1 +
>  libavformat/mpegts.h | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index 5f53f77..6674cd0 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -735,6 +735,7 @@ static const StreamType ISO_types[] = {
>  { 0x21, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_JPEG2000   },
>  { 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC   },
>  { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS   },
> +{ 0xd2, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS2   },
>  { 0xd1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC  },
>  { 0xea, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1},
>  { 0 },

Pushed this hunk.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avutil/encryption_info: Don't pass NULL to memcpy

2019-09-17 Thread Andreas Rheinhardt
The pointer arguments to memcpy (and several other functions of the
C standard library) are not allowed to be NULL, not even when the number
of bytes to copy is zero. An AVEncryptionInitInfo's data pointer is
explicitly allowed to be NULL and yet av_encryption_init_info_add_side_data
unconditionally used it as a source pointer to copy from. This commit changes
this so that copying is only done if the number of bytes to copy is > 0.

Fixes ticket #8141 as well as a part of ticket #8150.

Signed-off-by: Andreas Rheinhardt 
---
This is a slightly improved version (see the code). Furthermore, a typo
in the commit message has been fixed.

 libavutil/encryption_info.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavutil/encryption_info.c b/libavutil/encryption_info.c
index 812c704776..dd3fa71a44 100644
--- a/libavutil/encryption_info.c
+++ b/libavutil/encryption_info.c
@@ -331,8 +331,10 @@ uint8_t *av_encryption_init_info_add_side_data(const 
AVEncryptionInitInfo *info,
 memcpy(cur_buffer, cur_info->key_ids[i], cur_info->key_id_size);
 cur_buffer += cur_info->key_id_size;
 }
-memcpy(cur_buffer, cur_info->data, cur_info->data_size);
-cur_buffer += cur_info->data_size;
+if (cur_info->data_size > 0) {
+memcpy(cur_buffer, cur_info->data, cur_info->data_size);
+cur_buffer += cur_info->data_size;
+}
 }
 
 return buffer;
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] avcodec/4xm: Check index in decode_i_block() also in the path where its not used.

2019-09-17 Thread Michael Niedermayer
Fixes: Infinite loop
Fixes: signed integer overflow: 2147483644 + 16 cannot be represented in type 
'int'
Fixes: 
16169/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5662570416963584
Fixes: 
16782/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5743163859271680

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

diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 1f4e2aee24..336c651d31 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -525,6 +525,10 @@ static int decode_i_block(FourXContext *f, int16_t *block)
 break;
 if (code == 0xf0) {
 i += 16;
+if (i >= 64) {
+av_log(f->avctx, AV_LOG_ERROR, "run %d overflow\n", i);
+return 0;
+}
 } else {
 if (code & 0xf) {
 level = get_xbits(&f->gb, code & 0xf);
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] avcodec/motionpixels: Mark 2 functions as always_inline

2019-09-17 Thread Michael Niedermayer
Fixes: Timeout (30sec -> 25sec)
Fixes: 
17050/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOTIONPIXELS_fuzzer-5719149803732992

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

diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index be45586e3d..6cb444a703 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -171,7 +171,7 @@ static int mp_read_codes_table(MotionPixelsContext *mp, 
GetBitContext *gb)
return 0;
 }
 
-static int mp_gradient(MotionPixelsContext *mp, int component, int v)
+static av_always_inline int mp_gradient(MotionPixelsContext *mp, int 
component, int v)
 {
 int delta;
 
@@ -196,7 +196,7 @@ static void mp_set_rgb_from_yuv(MotionPixelsContext *mp, 
int x, int y, const Yuv
 *(uint16_t *)&mp->frame->data[0][y * mp->frame->linesize[0] + x * 2] = 
color;
 }
 
-static int mp_get_vlc(MotionPixelsContext *mp, GetBitContext *gb)
+static av_always_inline int mp_get_vlc(MotionPixelsContext *mp, GetBitContext 
*gb)
 {
 int i;
 
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 1/4] avutil/avstring: support input path is a null pointer or empty string

2019-09-17 Thread Limin Wang
On Tue, Sep 17, 2019 at 06:22:39PM +0200, Marton Balint wrote:
> 
> 
> On Mon, 16 Sep 2019, Tomas Härdin wrote:
> 
> >mån 2019-09-16 klockan 09:03 +0800 skrev lance.lmw...@gmail.com:
> >>From: Limin Wang 
> >>
> >>Signed-off-by: Limin Wang 
> >>---
> >> libavutil/avstring.c | 12 
> >> libavutil/avstring.h | 13 +
> >> 2 files changed, 17 insertions(+), 8 deletions(-)
> >>
> >>diff --git a/libavutil/avstring.c b/libavutil/avstring.c
> >>index 4c068f5bc5..9fddd0c77b 100644
> >>--- a/libavutil/avstring.c
> >>+++ b/libavutil/avstring.c
> >>@@ -257,8 +257,12 @@ char *av_strireplace(const char *str, const char
> >>*from, const char *to)
> >>
> >> const char *av_basename(const char *path)
> >> {
> >>-char *p = strrchr(path, '/');
> >>+char *p = NULL;
> >>+
> >>+if (!path || *path == '\0')
> >>+return ".";
> >
> >I will note here that this kind of thing would go great with a contract
> >on the function prototype, so that callers could formally verify that
> >they can indeed remove the NULL checks, and that the result of
> >av_basename() is always a valid string..
> 
> This is basename, not dirname. We should not return an arbitrary
> (valid) value for invalid inputs.

basename and dirname is supported by Linux and OSX system by ,
I consider to make the interface is consistent with the standard api first,
then it's time to change to invoke the system api if it's support. I
have read the implementaion in linux, it's more robust and tested. for
example, the current code haven't process multiple `/' characters.

You can get more descrioption about the system api by below command:
man 3 basename 

> 
> >The patch itself is probably fine
> 
> I disagree here.
> 
> Regards,
> Marton
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] Add option to log timing

2019-09-17 Thread Moritz Barsnick
On Tue, Sep 17, 2019 at 00:07:37 +, Soft Works wrote:
> This commit adds two logging flags: 'timing' and 'datetiming'.

I like the whole idea. I haven't tested yet, but I will in a moment.

> Usage:
> ffmpeg -loglevel +timing
> or
> ffmpeg -loglevel +datetiming

Have you considered what happens if you do
$ ffmpeg -loglevel +timing+datetiming
?

(It just seems a bit weird having one flag being a superset of another.
I don't mind otherwise.)

>  fftools/cmdutils.c | 14 ++
>  libavutil/log.c| 37 -
>  libavutil/log.h| 10 ++

You also need to add documentation for these options to
doc/fftools-common-opts.texi (section "@item -loglevel").

libavutil/log.h is part of the API, IIUC. So you should bump
libavutil's micro version, and even add an entry into doc/APIchanges.

> +&& ((flags & AV_LOG_PRINT_TIME) || (flags & AV_LOG_PRINT_DATETIME)))
> +format_date_now(&part[4], flags & AV_LOG_PRINT_DATETIME);

According to the style of the other calls, you could express "&part[4]"
as "part+4".

>  if (*print_prefix && (level > AV_LOG_QUIET) && (flags & 
> AV_LOG_PRINT_LEVEL))
>  av_bprintf(part+2, "[%s] ", get_level_str(level));

(As done here.)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] libavformat/rtspdec: Don't send teardown if rtsp_hd_out is null

2019-09-17 Thread Ross Nicholson
This can be closed. New patch created which returns an error instead to
prevent crash.

On Thu, 12 Sep 2019 at 08:21, Ross Nicholson  wrote:

> Ping, any update?
>
> On Thu, 5 Sep 2019 at 06:33, Ross Nicholson  wrote:
>
>> Hey All,
>>
>> Anything needed from me to progress this?
>>
>> Thanks in advance,
>>
>> Ross
>>
>> On 29 Aug 2019, at 17:04, Ross Nicholson  wrote:
>>
>> Hey Jun,
>>
>> So I got kodi running with FFmpeg n4.2 and the issue persists. Here's the
>> debugger output after trying to play the test link you provided.
>>
>> With the patch this does not occur so their must be some way to call
>> function with rt->rtsp_hd_out as NULL;
>>
>> Thanks,
>>
>> Ross
>>
>> Process 92017 stopped
>>
>> * thread #28, name = 'VideoPlayer', stop reason = EXC_BAD_ACCESS (code=1,
>> address=0x20)
>>
>> frame #0: 0x0001037af09e
>> kodi.bin`ffurl_write(h=0x, buf="TEARDOWN  RTSP/1.0\r\nCSeq:
>> 1\r\nUser-Agent: Lavf58.29.100\r\n\r\n", size=58) at avio.c:423:20 [opt]
>>
>>420
>>
>>421 int ffurl_write(URLContext *h, const unsigned char *buf, int size)
>>
>>422 {
>>
>> -> 423 if (!(h->flags & AVIO_FLAG_WRITE))
>>
>>424 return AVERROR(EIO);
>>
>>425 /* avoid sending too big packets */
>>
>>426 if (h->max_packet_size && size > h->max_packet_size)
>>
>> Target 0: (kodi.bin) stopped.
>>
>>
>> And the backtrace:
>>
>>
>> * thread #28, name = 'VideoPlayer', stop reason = EXC_BAD_ACCESS (code=1,
>> address=0x20)
>>
>>   * frame #0: 0x0001037af09e
>> kodi.bin`ffurl_write(h=0x, buf="TEARDOWN  RTSP/1.0\r\nCSeq:
>> 1\r\nUser-Agent: Lavf58.29.100\r\n\r\n", size=58) at avio.c:423:20 [opt]
>>
>> frame #1: 0x0001038c3be9
>> kodi.bin`rtsp_send_cmd_with_content_async(s=0x00011989c000,
>> method=, url=, headers=,
>> send_content=0x, send_content_length=0) at rtsp.c:1352:5
>> [opt]
>>
>> frame #2: 0x0001038c928c
>> kodi.bin`rtsp_read_close(s=0x00011989c000) at rtspdec.c:61:9 [opt]
>>
>> frame #3: 0x0001038f9994
>> kodi.bin`avformat_close_input(ps=0x00014dbb8000) at utils.c:4450:13
>> [opt]
>>
>> frame #4: 0x0001004c7841
>> kodi.bin`CDVDDemuxFFmpeg::Open(this=0x00014dbb7ff0,
>> pInput=std::__1::shared_ptr::element_type @
>> 0x00014dbb7d10 strong=4 weak=1, streaminfo=true, fileinfo=false) at
>> DVDDemuxFFmpeg.cpp:278:7
>>
>> frame #5: 0x0001004eb802
>> kodi.bin`CDVDFactoryDemuxer::CreateDemuxer(pInputStream=std::__1::shared_ptr::element_type
>> @ 0x00014dbb7d10 strong=4 weak=1, fileinfo=false) at
>> DVDFactoryDemuxer.cpp:88:15
>>
>> frame #6: 0x000100575ff3
>> kodi.bin`CVideoPlayer::OpenDemuxStream(this=0x00011d90d800) at
>> VideoPlayer.cpp:822:18
>>
>> frame #7: 0x000100579642
>> kodi.bin`CVideoPlayer::Prepare(this=0x00011d90d800) at
>> VideoPlayer.cpp:1224:8
>>
>> frame #8: 0x00010057b70f
>> kodi.bin`CVideoPlayer::Process(this=0x00011d90d800) at
>> VideoPlayer.cpp:1310:3
>>
>> frame #9: 0x000100aa7a04
>> kodi.bin`CThread::Action(this=0x00011d90d800) at Thread.cpp:282:5
>>
>> frame #10: 0x000100aadc90
>> kodi.bin`CThread::Create(this=0x00014d19f670,
>> pThread=0x00011d90d800, promise=promise @
>> 0x7b522e70)::$_0::operator()(CThread*, std::__1::promise)
>> const at Thread.cpp:140:18
>>
>> frame #11: 0x000100aad9eb
>> kodi.bin`decltype(__f=0x00014d19f670, __args=0x00014d19f678,
>> __args=0x00014d19f680)::$_0>(fp)(std::__1::forward(fp0),
>> std::__1::forward >(fp0)))
>> std::__1::__invoke> std::__1::promise >(CThread::Create(bool)::$_0&&, CThread*&&,
>> std::__1::promise&&) at type_traits:4339:1
>>
>> frame #12: 0x000100aad917 kodi.bin`void
>> std::__1::__thread_execute> std::__1::default_delete >,
>> CThread::Create(bool)::$_0, CThread*, std::__1::promise, 2ul,
>> 3ul>(__t=size=4, (null)=__tuple_indices<2, 3> @ 0x7b522eb8)::$_0,
>> CThread*, std::__1::promise >&, std::__1::__tuple_indices<2ul, 3ul>)
>> at thread:342:5
>>
>> frame #13: 0x000100aad026 kodi.bin`void*
>> std::__1::__thread_proxy> std::__1::default_delete >,
>> CThread::Create(bool)::$_0, CThread*, std::__1::promise >
>> >(__vp=0x00014d19f670) at thread:352:5
>>
>> frame #14: 0x7fff68c1c2eb libsystem_pthread.dylib`_pthread_body
>> + 126
>>
>> frame #15: 0x7fff68c1f249 libsystem_pthread.dylib`_pthread_start
>> + 66
>>
>> frame #16: 0x7fff68c1b40d libsystem_pthread.dylib`thread_start +
>> 13
>>
>>
>>
>> On Thu, 29 Aug 2019 at 00:20, Jun Li  wrote:
>>
>>> On Wed, Aug 28, 2019 at 3:09 PM Carl Eugen Hoyos 
>>> wrote:
>>>
>>> > Am Mo., 5. Aug. 2019 um 09:19 Uhr schrieb Ross Nicholson <
>>> > phunkyf...@gmail.com>:
>>> > >
>>> > > Example stream that does not work: rtsp://
>>> > > 184.72.239.149/vod/mp4:BigBuckBunny_115k.mov
>>> >
>>> > Is this still valid?
>>> >
>>> >
>>> Carl, you can try this one for validation: rtsp://
>>> wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115

[FFmpeg-devel] [PATCH 1/1] libavformat/rtsp: return error if rtsp_hd_out is null instead of crash

2019-09-17 Thread phunkyfish
---
 libavformat/rtsp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c153cac88b..6de090b7ce 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1315,6 +1315,8 @@ static int 
rtsp_send_cmd_with_content_async(AVFormatContext *s,
 int send_content_length)
 {
 RTSPState *rt = s->priv_data;
+if (rt->rtsp_hd_out == NULL)
+return ENOTCONN;
 char buf[4096], *out_buf;
 char base64buf[AV_BASE64_SIZE(sizeof(buf))];
 
-- 
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 0/1] libavformat/rtsp: return error if rtsp_hd_out is null instead of crash

2019-09-17 Thread phunkyfish
There is an issue in kodi where this value can be null, a previous patch 
attempted to fix this in rtspdec but the more correct solution is to return an 
error in that case

phunkyfish (1):
  libavformat/rtsp: return error if rtsp_hd_out is null instead of crash

 libavformat/rtsp.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 1/4] avutil/avstring: support input path is a null pointer or empty string

2019-09-17 Thread Marton Balint



On Mon, 16 Sep 2019, Tomas Härdin wrote:


mån 2019-09-16 klockan 09:03 +0800 skrev lance.lmw...@gmail.com:

From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavutil/avstring.c | 12 
 libavutil/avstring.h | 13 +
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 4c068f5bc5..9fddd0c77b 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -257,8 +257,12 @@ char *av_strireplace(const char *str, const char
*from, const char *to)

 const char *av_basename(const char *path)
 {
-char *p = strrchr(path, '/');
+char *p = NULL;
+
+if (!path || *path == '\0')
+return ".";


I will note here that this kind of thing would go great with a contract
on the function prototype, so that callers could formally verify that
they can indeed remove the NULL checks, and that the result of
av_basename() is always a valid string..


This is basename, not dirname. We should not return an 
arbitrary (valid) value for invalid inputs.



The patch itself is probably fine


I disagree here.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/3] avfilter/x86/vf_eq: add SSE2 version

2019-09-17 Thread James Almer
On 9/17/2019 10:39 AM, Ting Fu wrote:
> Signed-off-by: Ting Fu 
> ---
>  libavfilter/x86/vf_eq.asm| 19 +--
>  libavfilter/x86/vf_eq_init.c | 20 
>  2 files changed, 37 insertions(+), 2 deletions(-)
> 
> diff --git a/libavfilter/x86/vf_eq.asm b/libavfilter/x86/vf_eq.asm
> index bf28691297..d6b51cf6df 100644
> --- a/libavfilter/x86/vf_eq.asm
> +++ b/libavfilter/x86/vf_eq.asm
> @@ -24,14 +24,21 @@
>  
>  SECTION .text
>  
> -INIT_MMX mmx
> +%macro PROCESS_ONE_LINE 1
>  cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w
>  movd m3, contrastd
>  movd m4, brightnessd
>  movsx r5d, contrastw
>  movsx r6d, brightnessw
> +%if mmsize == 8
>  pshufw m3, m3, 0
>  pshufw m4, m4, 0

pshufw isn't mmx, but mmxext (AKA, integer SSE). Hardly a problem since
i don't think anyone using a Pentium 2 will use this filter, but still
it's technically wrong.

The function should be changed into mmxext to reflect the above.

> +%elif mmsize == 16
> +pshuflw m3, m3, 0
> +movlhps m3, m3
> +pshuflw m4, m4, 0
> +movlhps m4, m4
> +%endif

You can use the SPLATW macro instead. It will expand to the correct
instructions based on what set is enabled.

>  
>  DEFINE_ARGS src, dst, tmp, scalar, w
>  xor tmpd, tmpd
> @@ -39,7 +46,7 @@ cglobal process_one_line, 5, 7, 5, src, dst, contrast, 
> brightness, w
>  pxor m1, m1
>  mov scalard, wd
>  and scalard, mmsize-1
> -sar wd, 3
> +sar wd, %1
>  cmp wd, 1
>  jl .loop1
>  
> @@ -80,3 +87,11 @@ cglobal process_one_line, 5, 7, 5, src, dst, contrast, 
> brightness, w
>  
>  .end:
>  RET
> +
> +%endmacro
> +
> +INIT_MMX mmx
> +PROCESS_ONE_LINE 3
> +
> +INIT_XMM sse2
> +PROCESS_ONE_LINE 4
> diff --git a/libavfilter/x86/vf_eq_init.c b/libavfilter/x86/vf_eq_init.c
> index 63c69078fb..cdd5272220 100644
> --- a/libavfilter/x86/vf_eq_init.c
> +++ b/libavfilter/x86/vf_eq_init.c
> @@ -28,6 +28,8 @@
>  
>  extern void ff_process_one_line_mmx(const uint8_t *src, uint8_t *dst, int 
> contvec,
>  int brvec, int w);
> +extern void ff_process_one_line_sse2(const uint8_t *src, uint8_t *dst, int 
> contvec,
> +int brvec, int w);
>  
>  static void process_mmx(EQParameters *param, uint8_t *dst, int dst_stride,
>  const uint8_t *src, int src_stride, int w, int h)
> @@ -44,6 +46,21 @@ static void process_mmx(EQParameters *param, uint8_t *dst, 
> int dst_stride,
>  emms_c();
>  }
>  
> +static void process_sse2(EQParameters *param, uint8_t *dst, int dst_stride,
> +const uint8_t *src, int src_stride, int w, int h)
> +{
> +short contrast = (short) (param->contrast * 256 * 16);
> +short brightness = ((short) (100.0 * param->brightness + 100.0) * 511)
> +   / 200 - 128 - contrast / 32;
> +
> +while (h--) {
> +ff_process_one_line_sse2(src, dst, contrast, brightness, w);
> +src += src_stride;
> +dst += dst_stride;
> +}
> +emms_c();

No need for this since the SSE2 version uses xmm regs.

> +}
> +
>  av_cold void ff_eq_init_x86(EQContext *eq)
>  {
>  int cpu_flags = av_get_cpu_flags();
> @@ -51,5 +68,8 @@ av_cold void ff_eq_init_x86(EQContext *eq)
>  if (cpu_flags & AV_CPU_FLAG_MMX) {
>  eq->process = process_mmx;
>  }
> +if (cpu_flags & AV_CPU_FLAG_SSE2) {
> +eq->process = process_sse2;
> +}
>  }
>  
> 

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/3] avfilter/x86/vf_eq: Change inline assembly into nasm code

2019-09-17 Thread Ting Fu
Signed-off-by: Ting Fu 
---
 libavfilter/x86/Makefile |  3 +-
 libavfilter/x86/vf_eq.asm| 82 ++
 libavfilter/x86/vf_eq.c  | 96 
 libavfilter/x86/vf_eq_init.c | 55 +
 4 files changed, 139 insertions(+), 97 deletions(-)
 create mode 100644 libavfilter/x86/vf_eq.asm
 delete mode 100644 libavfilter/x86/vf_eq.c
 create mode 100644 libavfilter/x86/vf_eq_init.c

diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile
index f12993e606..f2922c4597 100644
--- a/libavfilter/x86/Makefile
+++ b/libavfilter/x86/Makefile
@@ -6,7 +6,7 @@ OBJS-$(CONFIG_BLEND_FILTER)  += 
x86/vf_blend_init.o
 OBJS-$(CONFIG_BWDIF_FILTER)  += x86/vf_bwdif_init.o
 OBJS-$(CONFIG_COLORSPACE_FILTER) += x86/colorspacedsp_init.o
 OBJS-$(CONFIG_CONVOLUTION_FILTER)+= x86/vf_convolution_init.o
-OBJS-$(CONFIG_EQ_FILTER) += x86/vf_eq.o
+OBJS-$(CONFIG_EQ_FILTER) += x86/vf_eq_init.o
 OBJS-$(CONFIG_FSPP_FILTER)   += x86/vf_fspp_init.o
 OBJS-$(CONFIG_GBLUR_FILTER)  += x86/vf_gblur_init.o
 OBJS-$(CONFIG_GRADFUN_FILTER)+= x86/vf_gradfun_init.o
@@ -43,6 +43,7 @@ X86ASM-OBJS-$(CONFIG_BLEND_FILTER)   += x86/vf_blend.o
 X86ASM-OBJS-$(CONFIG_BWDIF_FILTER)   += x86/vf_bwdif.o
 X86ASM-OBJS-$(CONFIG_COLORSPACE_FILTER)  += x86/colorspacedsp.o
 X86ASM-OBJS-$(CONFIG_CONVOLUTION_FILTER) += x86/vf_convolution.o
+X86ASM-OBJS-$(CONFIG_CONVOLUTION_FILTER) += x86/vf_eq.o
 X86ASM-OBJS-$(CONFIG_FRAMERATE_FILTER)   += x86/vf_framerate.o
 X86ASM-OBJS-$(CONFIG_FSPP_FILTER)+= x86/vf_fspp.o
 X86ASM-OBJS-$(CONFIG_GBLUR_FILTER)   += x86/vf_gblur.o
diff --git a/libavfilter/x86/vf_eq.asm b/libavfilter/x86/vf_eq.asm
new file mode 100644
index 00..bf28691297
--- /dev/null
+++ b/libavfilter/x86/vf_eq.asm
@@ -0,0 +1,82 @@
+;*
+;* x86-optimized functions for eq filter
+;*
+;* Original MPlayer filters by Richard Felker.
+;*
+;* This file is part of FFmpeg.
+;*
+;* FFmpeg is free software; you can redistribute it and/or modify
+;* it under the terms of the GNU General Public License as published by
+;* the Free Software Foundation; either version 2 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 General Public License for more details.
+;*
+;* You should have received a copy of the GNU General Public License along
+;* with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+;* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+;*
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION .text
+
+INIT_MMX mmx
+cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w
+movd m3, contrastd
+movd m4, brightnessd
+movsx r5d, contrastw
+movsx r6d, brightnessw
+pshufw m3, m3, 0
+pshufw m4, m4, 0
+
+DEFINE_ARGS src, dst, tmp, scalar, w
+xor tmpd, tmpd
+pxor m0, m0
+pxor m1, m1
+mov scalard, wd
+and scalard, mmsize-1
+sar wd, 3
+cmp wd, 1
+jl .loop1
+
+.loop0:
+movu m1, [srcq]
+mova m2, m1
+punpcklbw m1, m0
+punpckhbw m2, m0
+psllw m1, 4
+psllw m2, 4
+pmulhw m1, m3
+pmulhw m2, m3
+paddw m1, m4
+paddw m2, m4
+packuswb m1, m2
+movu [dstq], m1
+add srcq, mmsize
+add dstq, mmsize
+sub wd, 1
+cmp wd, 0
+jne .loop0
+
+.loop1:
+cmp scalard, 0
+je .end
+movzx tmpd, byte [srcq]
+imul tmpd, r5d
+sar tmpd, 12
+add tmpd, r6d
+movd m1, tmpd
+packuswb m1, m0
+movd tmpd, m1
+mov [dstq], tmpb
+inc srcq
+inc dstq
+dec scalard
+jmp .loop1
+
+.end:
+RET
diff --git a/libavfilter/x86/vf_eq.c b/libavfilter/x86/vf_eq.c
deleted file mode 100644
index 16f399505f..00
--- a/libavfilter/x86/vf_eq.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *
- * Original MPlayer filters by Richard Felker.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.

[FFmpeg-devel] [PATCH 3/3] avfilter/x86/vf_eq: add SSE2 version

2019-09-17 Thread Ting Fu
Signed-off-by: Ting Fu 
---
 libavfilter/x86/vf_eq.asm| 19 +--
 libavfilter/x86/vf_eq_init.c | 20 
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/libavfilter/x86/vf_eq.asm b/libavfilter/x86/vf_eq.asm
index bf28691297..d6b51cf6df 100644
--- a/libavfilter/x86/vf_eq.asm
+++ b/libavfilter/x86/vf_eq.asm
@@ -24,14 +24,21 @@
 
 SECTION .text
 
-INIT_MMX mmx
+%macro PROCESS_ONE_LINE 1
 cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w
 movd m3, contrastd
 movd m4, brightnessd
 movsx r5d, contrastw
 movsx r6d, brightnessw
+%if mmsize == 8
 pshufw m3, m3, 0
 pshufw m4, m4, 0
+%elif mmsize == 16
+pshuflw m3, m3, 0
+movlhps m3, m3
+pshuflw m4, m4, 0
+movlhps m4, m4
+%endif
 
 DEFINE_ARGS src, dst, tmp, scalar, w
 xor tmpd, tmpd
@@ -39,7 +46,7 @@ cglobal process_one_line, 5, 7, 5, src, dst, contrast, 
brightness, w
 pxor m1, m1
 mov scalard, wd
 and scalard, mmsize-1
-sar wd, 3
+sar wd, %1
 cmp wd, 1
 jl .loop1
 
@@ -80,3 +87,11 @@ cglobal process_one_line, 5, 7, 5, src, dst, contrast, 
brightness, w
 
 .end:
 RET
+
+%endmacro
+
+INIT_MMX mmx
+PROCESS_ONE_LINE 3
+
+INIT_XMM sse2
+PROCESS_ONE_LINE 4
diff --git a/libavfilter/x86/vf_eq_init.c b/libavfilter/x86/vf_eq_init.c
index 63c69078fb..cdd5272220 100644
--- a/libavfilter/x86/vf_eq_init.c
+++ b/libavfilter/x86/vf_eq_init.c
@@ -28,6 +28,8 @@
 
 extern void ff_process_one_line_mmx(const uint8_t *src, uint8_t *dst, int 
contvec,
 int brvec, int w);
+extern void ff_process_one_line_sse2(const uint8_t *src, uint8_t *dst, int 
contvec,
+int brvec, int w);
 
 static void process_mmx(EQParameters *param, uint8_t *dst, int dst_stride,
 const uint8_t *src, int src_stride, int w, int h)
@@ -44,6 +46,21 @@ static void process_mmx(EQParameters *param, uint8_t *dst, 
int dst_stride,
 emms_c();
 }
 
+static void process_sse2(EQParameters *param, uint8_t *dst, int dst_stride,
+const uint8_t *src, int src_stride, int w, int h)
+{
+short contrast = (short) (param->contrast * 256 * 16);
+short brightness = ((short) (100.0 * param->brightness + 100.0) * 511)
+   / 200 - 128 - contrast / 32;
+
+while (h--) {
+ff_process_one_line_sse2(src, dst, contrast, brightness, w);
+src += src_stride;
+dst += dst_stride;
+}
+emms_c();
+}
+
 av_cold void ff_eq_init_x86(EQContext *eq)
 {
 int cpu_flags = av_get_cpu_flags();
@@ -51,5 +68,8 @@ av_cold void ff_eq_init_x86(EQContext *eq)
 if (cpu_flags & AV_CPU_FLAG_MMX) {
 eq->process = process_mmx;
 }
+if (cpu_flags & AV_CPU_FLAG_SSE2) {
+eq->process = process_sse2;
+}
 }
 
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/3] checkasm/vf_eq: add test for vf_eq

2019-09-17 Thread Ting Fu
Signed-off-by: Ting Fu 
---
 libavfilter/vf_eq.c   | 13 ---
 libavfilter/vf_eq.h   |  1 +
 tests/checkasm/Makefile   |  1 +
 tests/checkasm/checkasm.c |  3 ++
 tests/checkasm/checkasm.h |  1 +
 tests/checkasm/vf_eq.c| 79 +++
 tests/fate/checkasm.mak   |  1 +
 7 files changed, 94 insertions(+), 5 deletions(-)
 create mode 100644 tests/checkasm/vf_eq.c

diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
index 2c4c7e4d54..0f9d129255 100644
--- a/libavfilter/vf_eq.c
+++ b/libavfilter/vf_eq.c
@@ -174,12 +174,18 @@ static int set_expr(AVExpr **pexpr, const char *expr, 
const char *option, void *
 return 0;
 }
 
+void ff_eq_init(EQContext *eq)
+{
+eq->process = process_c;
+if (ARCH_X86)
+ff_eq_init_x86(eq);
+}
+
 static int initialize(AVFilterContext *ctx)
 {
 EQContext *eq = ctx->priv;
 int ret;
-
-eq->process = process_c;
+ff_eq_init(eq);
 
 if ((ret = set_expr(&eq->contrast_pexpr, eq->contrast_expr, 
"contrast", ctx)) < 0 ||
 (ret = set_expr(&eq->brightness_pexpr,   eq->brightness_expr,   
"brightness",   ctx)) < 0 ||
@@ -191,9 +197,6 @@ static int initialize(AVFilterContext *ctx)
 (ret = set_expr(&eq->gamma_weight_pexpr, eq->gamma_weight_expr, 
"gamma_weight", ctx)) < 0 )
 return ret;
 
-if (ARCH_X86)
-ff_eq_init_x86(eq);
-
 if (eq->eval_mode == EVAL_MODE_INIT) {
 set_gamma(eq);
 set_contrast(eq);
diff --git a/libavfilter/vf_eq.h b/libavfilter/vf_eq.h
index fa49d46e5c..cd0cd75f08 100644
--- a/libavfilter/vf_eq.h
+++ b/libavfilter/vf_eq.h
@@ -100,6 +100,7 @@ typedef struct EQContext {
 enum EvalMode { EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB } eval_mode;
 } EQContext;
 
+void ff_eq_init(EQContext *eq);
 void ff_eq_init_x86(EQContext *eq);
 
 #endif /* AVFILTER_EQ_H */
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 0112ff603e..de850c016e 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -36,6 +36,7 @@ CHECKASMOBJS-$(CONFIG_AVCODEC)  += $(AVCODECOBJS-yes)
 AVFILTEROBJS-$(CONFIG_AFIR_FILTER) += af_afir.o
 AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o
 AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o
+AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o
 AVFILTEROBJS-$(CONFIG_GBLUR_FILTER)  += vf_gblur.o
 AVFILTEROBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
 AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER)  += vf_threshold.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index d9a5c7f401..bcbe775510 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -165,6 +165,9 @@ static const struct {
 #if CONFIG_COLORSPACE_FILTER
 { "vf_colorspace", checkasm_check_colorspace },
 #endif
+#if CONFIG_EQ_FILTER
+{ "vf_eq", checkasm_check_vf_eq },
+#endif
 #if CONFIG_GBLUR_FILTER
 { "vf_gblur", checkasm_check_vf_gblur },
 #endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index fdf9eeb75d..0a7f9f25c4 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -72,6 +72,7 @@ void checkasm_check_sw_rgb(void);
 void checkasm_check_utvideodsp(void);
 void checkasm_check_v210dec(void);
 void checkasm_check_v210enc(void);
+void checkasm_check_vf_eq(void);
 void checkasm_check_vf_gblur(void);
 void checkasm_check_vf_hflip(void);
 void checkasm_check_vf_threshold(void);
diff --git a/tests/checkasm/vf_eq.c b/tests/checkasm/vf_eq.c
new file mode 100644
index 00..b1a6a61e05
--- /dev/null
+++ b/tests/checkasm/vf_eq.c
@@ -0,0 +1,79 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 "checkasm.h"
+#include "libavfilter/avfilter.h"
+#include "libavfilter/vf_eq.h"
+#include "libavutil/intreadwrite.h"
+
+#define WIDTH 256
+#define HEIGHT 256
+#define SRC_STRIDE 256
+#define PIXELS (WIDTH * HEIGHT)
+#define RANDOM_RANGE 8
+#define SCALE 1
+
+#define randomize_buffers(buf, size)  \
+do {  \
+int j;\
+uint8_t *tmp_buf = (uint8_t *)buf;\
+for (j = 0; j< size ; j++)\
+tmp_buf[j] = rnd() & 0xFF;\
+} while (0)
+
+static void check_eq(void){
+   

[FFmpeg-devel] [PATCH] libavformat/hls.c: fix hls_read_seek return error when seek to first_timestamp

2019-09-17 Thread 1433100204
From: leizhai 

---
 libavformat/hls.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 0611ddc6bb..4525862ee8 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2237,7 +2237,12 @@ static int hls_read_seek(AVFormatContext *s, int 
stream_index,
 }
 /* check if the timestamp is valid for the playlist with the
  * specified stream index */
-if (!seek_pls || !find_timestamp_in_playlist(c, seek_pls, seek_timestamp, 
&seq_no))
+
+/*fix seek to first_timestamp return error bug*/
+int find_ts_ret = find_timestamp_in_playlist(c, seek_pls, seek_timestamp, 
&seq_no);
+if (find_ts_ret == 0 && seq_no == seek_pls->start_seq_no)
+find_ts_ret = 1;
+if (!seek_pls || !find_ts_ret)
 return AVERROR(EIO);
 
 /* set segment now so we do not need to search again below */
-- 
2.14.3 (Apple Git-98)



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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/5] avformat/mov: Fix memleak

2019-09-17 Thread Michael Niedermayer
On Mon, Sep 16, 2019 at 05:54:59PM +0200, Andreas Rheinhardt wrote:
> When the mov/mp4 demuxer encounters an error during decrypting a packet,
> it returns the error, yet doesn't free the packet, so that the packet
> leaks. This has been fixed in this commit.
> 
> Fixes the memleaks from ticket #8150.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> This only fixes the memleaks from #8150. I can't reproduce the
> uninitialized reads, so I can't do anything about them. Can someone else
> reproduce them?
> 
>  libavformat/mov.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

will apply

thx

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

No great genius has ever existed without some touch of madness. -- Aristotle


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg_opt: Fix signed integer overflow

2019-09-17 Thread Michael Niedermayer
On Mon, Sep 16, 2019 at 05:55:01PM +0200, Andreas Rheinhardt wrote:
> Fixes ticket #8154.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  fftools/ffmpeg_opt.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

will apply

thx

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/3] avformat/mov: Check for EOF in mov_read_meta()

2019-09-17 Thread Michael Niedermayer
On Sun, Sep 15, 2019 at 04:35:30PM -0300, James Almer wrote:
> On 9/15/2019 4:34 PM, Michael Niedermayer wrote:
> > On Sat, Aug 31, 2019 at 10:36:32AM -0300, James Almer wrote:
> >> On 8/31/2019 5:47 AM, Michael Niedermayer wrote:
> >>> On Fri, Aug 30, 2019 at 08:57:29PM -0300, James Almer wrote:
>  On 8/30/2019 8:25 PM, Michael Niedermayer wrote:
> > Fixes: Timeout (195sec -> 2ms)
> > Fixes: 
> > 16735/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5090676403863552
> >
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavformat/mov.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index 675b915906..46c544b61f 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -4419,7 +4419,10 @@ static int mov_read_custom(MOVContext *c, 
> > AVIOContext *pb, MOVAtom atom)
> >  static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> >  {
> >  while (atom.size > 8) {
> > -uint32_t tag = avio_rl32(pb);
> > +uint32_t tag;
> > +if (avio_feof(pb))
> > +return AVERROR_EOF;
> > +tag = avio_rl32(pb);
> >  atom.size -= 4;
> >  if (tag == MKTAG('h','d','l','r')) {
> >  avio_seek(pb, -8, SEEK_CUR);
> 
>  Maybe do something like "while (atom.size > 8 && !avio_feof(pb))"
>  instead, which is similar to the loop in mov_read_default.
> >>>
> >>> Can do but why ?
> >>> the code in the patch returns an error if the atom is truncated
> >>> the change suggested does not return an error if the atom is truncated
> >>> on its own this doesnt sound better
> >>>
> >>> Thanks
> >>
> >> There's Marton's "avformat/utils: return pending IO error on EOF in
> >> av_read_frame()" patch to check in generic code if avio_feof() != 0 is
> >> an actual EOF or an IO error, so if you make this code here simply break
> >> the loop, same as it's done in mov_read_default(), then said generic
> >> code would be triggered and return the proper error code once the
> >> current packet is done processing.
> > 
> > are you against the original patch in this thread ?
> > from reading this its not clear to me if you dislike the original
> > patch or not ?
> > 
> > thanks
> 
> No, I'm not.

ok, will apply

thx

[...]
-- 
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: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for binkvideo

2019-09-17 Thread Michael Niedermayer
On Mon, Sep 16, 2019 at 09:51:15PM +1000, Peter Ross wrote:
> On Sat, Sep 14, 2019 at 11:39:49PM +0200, Michael Niedermayer wrote:
> > Fixes: Timeout (89sec -> 7sec)
> > Fixes: 
> > 17035/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-5737222422134784
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  tools/target_dec_fuzzer.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
> > index 6fb53d5ab2..945f7a497c 100644
> > --- a/tools/target_dec_fuzzer.c
> > +++ b/tools/target_dec_fuzzer.c
> > @@ -128,6 +128,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
> > size) {
> >  maxpixels = maxpixels_per_frame * maxiteration;
> >  switch (c->id) {
> >  // Allows a small input to generate gigantic output
> > +case AV_CODEC_ID_BINKVIDEO: maxpixels /= 32; break;
> >  case AV_CODEC_ID_DIRAC: maxpixels /= 8192; break;
> >  case AV_CODEC_ID_MSRLE: maxpixels /= 16;  break;
> >  case AV_CODEC_ID_QTRLE: maxpixels /= 16;  break;
> > -- 
> > 2.23.0
> 
> approve

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 5/5] avformat/utils: Fix always true check

2019-09-17 Thread Michael Niedermayer
On Mon, Sep 16, 2019 at 05:55:02PM +0200, Andreas Rheinhardt wrote:
> Found via PVS-Studio (ticket #8156).
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index b83a740500..1cd7aa211c 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -4837,7 +4837,7 @@ int ff_mkdir_p(const char *path)
>  }
>  }
>  
> -if ((*(pos - 1) != '/') || (*(pos - 1) != '\\')) {
> +if ((*(pos - 1) != '/') && (*(pos - 1) != '\\')) {
>  ret = mkdir(temp, 0755);
>  }

This should probably check for HAVE_DOS_PATH

thx

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3 2/5] avcodec/v210enc: make 8bit and 10bit function consistent

2019-09-17 Thread Limin Wang
On Mon, Sep 16, 2019 at 09:06:06PM +0200, Michael Niedermayer wrote:
> On Sun, Sep 01, 2019 at 09:20:20PM +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > I have benchmarked the performance with c code and haven't see any
> > performance impact.
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavcodec/v210enc.c | 7 +--
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> > 
> > diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
> > index 1b840b2..69a2efe 100644
> > --- a/libavcodec/v210enc.c
> > +++ b/libavcodec/v210enc.c
> > @@ -43,12 +43,7 @@ static void v210_planar_pack_8_c(const uint8_t *y, const 
> > uint8_t *u,
> >  uint32_t val;
> >  int i;
> >  
> > -/* unroll this to match the assembly */
> > -for (i = 0; i < width - 11; i += 12) {
> > -WRITE_PIXELS(u, y, v, 8);
> > -WRITE_PIXELS(y, u, y, 8);
> > -WRITE_PIXELS(v, y, u, 8);
> > -WRITE_PIXELS(y, v, y, 8);
> > +for (i = 0; i < width - 5; i += 6) {
> >  WRITE_PIXELS(u, y, v, 8);
> >  WRITE_PIXELS(y, u, y, 8);
> >  WRITE_PIXELS(v, y, u, 8);
> 
> I have retested this with START/STOP_TIMER
> and the more unrolled loop is consistently faster
> 
> ./ffmpeg -cpuflags 0 -v 99 -i matrixbench_mpeg2.mpg -vcodec v210 -an test.avi
> 
>  31620 decicycles in TEST, 2096691 runs,461 skips  0  0  0  0  0  0  0  0 
>  0  0  0 21 13  9  8  7  8  7  0  0  0  0  0  0  0  0  0  0  0  0  0  0
>  31509 decicycles in TEST, 2096892 runs,260 skips  0  0  0  0  0  0  0  0 
>  0  0  0 21 10  9  8  6  7  3  2  0  0  0  0  0  0  0  0  0  0  0  0  0
>  32069 decicycles in TEST, 2096965 runs,187 skips  0  0  0  0  0  0  0  0 
>  0  0  0 21 16 10  8  6  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
>  31522 decicycles in TEST, 2096962 runs,190 skips  0  0  0  0  0  0  0  0 
>  0  0  0 21 10  9  8  6  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
>  31537 decicycles in TEST, 2096784 runs,368 skips  0  0  0  0  0  0  0  0 
>  0  0  0 21 12  8  9  7  7  7  0  0  0  0  0  0  0  0  0  0  0  0  0  0
> 
> prev:
>  30705 decicycles in TEST, 2096875 runs,277 skips  0  0  0  0  0  0  0  0 
>  0  0  0 21 15  9  9  7  5  3  1  0  0  0  0  0  0  0  0  0  0  0  0  0
>  30771 decicycles in TEST, 2096907 runs,245 skips  0  0  0  0  0  0  0  0 
>  0  0  0 21 15  9  8  6  7  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
>  30560 decicycles in TEST, 2096904 runs,248 skips  0  0  0  0  0  0  0  0 
>  0  0  0 21 10  9  9  6  2  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
>  31020 decicycles in TEST, 2096974 runs,178 skips  0  0  0  0  0  0  0  0 
>  0  0  0 21 16  9  8  6  2  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
>  31018 decicycles in TEST, 2096980 runs,172 skips  0  0  0  0  0  0  0  0 
>  0  0  0 21 16  9  8  6  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
> 

Michael, I have updated the patch V4 for review, old patch#2,3 are discard for 
the performance different. 

> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> I have often repented speaking, but never of holding my tongue.
> -- Xenocrates



> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] Is it ok to add G.722.1 decoder as external lib?

2019-09-17 Thread Moritz Barsnick
On Tue, Sep 17, 2019 at 09:52:48 +0200, Carl Eugen Hoyos wrote:
> > But that said: ffmpeg already has a native G.722 encoder (and decoder),
>
> See: https://en.wikipedia.org/wiki/G.722.1
> The numbering...

Yes, my next paragraph referred to that. But I just figured out that
G.722 was apparently differently licensed, and therefore it was
probably quite straightforward to port libg722 to ffmpeg, unlike this
G.722.1 code or codec.

> (The library is non-free and we cannot change that.)

Indeed.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2] doc: various spelling, grammar and formatting fixes

2019-09-17 Thread Moritz Barsnick
Signed-off-by: Moritz Barsnick 
---
 doc/filters.texi | 69 
 doc/muxers.texi  |  4 +--
 2 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index bbfdad4d4d..6ed0e79f16 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -756,7 +756,7 @@ aecho=0.8:0.88:60:0.4
 @end example

 @item
-If delay is very short, then it sound like a (metallic) robot playing music:
+If delay is very short, then it sounds like a (metallic) robot playing music:
 @example
 aecho=0.8:0.88:6:0.4
 @end example
@@ -1157,11 +1157,11 @@ It can be used as component for digital crossover 
filters,
 room equalization, cross talk cancellation, wavefield synthesis,
 auralization, ambiophonics, ambisonics and spatialization.

-This filter uses second stream as FIR coefficients.
-If second stream holds single channel, it will be used
-for all input channels in first stream, otherwise
-number of channels in second stream must be same as
-number of channels in first stream.
+This filter uses the second stream as FIR coefficients.
+If the second stream holds a single channel, it will be used
+for all input channels in the first stream, otherwise
+the number of channels in the second stream must be same as
+the number of channels in the first stream.

 It accepts the following parameters:

@@ -1766,7 +1766,7 @@ Each sample is adjusted by looking for other samples with 
similar contexts. This
 context similarity is defined by comparing their surrounding patches of size
 @option{p}. Patches are searched in an area of @option{r} around the sample.

-The filter accepts the following options.
+The filter accepts the following options:

 @table @option
 @item s
@@ -2965,12 +2965,12 @@ Compensation Delay Line is a metric based delay to 
compensate differing
 positions of microphones or speakers.

 For example, you have recorded guitar with two microphones placed in
-different location. Because the front of sound wave has fixed speed in
+different locations. Because the front of sound wave has fixed speed in
 normal conditions, the phasing of microphones can vary and depends on
 their location and interposition. The best sound mix can be achieved when
-these microphones are in phase (synchronized). Note that distance of
-~30 cm between microphones makes one microphone to capture signal in
-antiphase to another microphone. That makes the final mix sounding moody.
+these microphones are in phase (synchronized). Note that a distance of
+~30 cm between microphones makes one microphone capture the signal in
+antiphase to the other microphone. That makes the final mix sound moody.
 This filter helps to solve phasing problems by adding different delays
 to each microphone track and make them synchronized.

@@ -2979,7 +2979,7 @@ synchronize other tracks one by one with it.
 Remember that synchronization/delay tolerance depends on sample rate, too.
 Higher sample rates will give more tolerance.

-It accepts the following parameters:
+The filter accepts the following parameters:

 @table @option
 @item mm
@@ -3003,7 +3003,7 @@ Set wet amount. Amount of processed (wet) signal.
 Default is 1.

 @item temp
-Set temperature degree in Celsius. This is the temperature of the environment.
+Set temperature in degrees Celsius. This is the temperature of the environment.
 Default is 20.
 @end table

@@ -6638,7 +6638,7 @@ If the interlacing is unknown or the decoder does not 
export this information,
 top field first will be assumed.

 @item deint
-Specify which frames to deinterlace. Accept one of the following
+Specify which frames to deinterlace. Accepts one of the following
 values:

 @table @option
@@ -11423,7 +11423,7 @@ All streams must be of same pixel format and of same 
height.
 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
 to create same output.

-The filter accept the following option:
+The filter accepts the following option:

 @table @option
 @item inputs
@@ -13262,7 +13262,7 @@ the following values: "blur", "blur_no_scale", 
"median", "gaussian",
 or "bilateral". The default value is "gaussian".

 The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
-depend on the smooth type. @var{param1} and
+depends on the smooth type. @var{param1} and
 @var{param2} accept integer positive values or 0. @var{param3} and
 @var{param4} accept floating point values.

@@ -14443,7 +14443,7 @@ __kernel void blend_images(__write_only image2d_t dst,

 Alter frame colors in video with pseudocolors.

-This filter accept the following options:
+This filter accepts the following options:

 @table @option
 @item c0
@@ -14768,7 +14768,7 @@ Enable checking the parity bit. In the event of a 
parity error, the filter will
 @code{0x00} for that character. Default is false.

 @item lp
-Lowpass lines prior further proccessing. Default is disabled.
+Lowpass lines prior to further processing. Default is disabled.
 @end table

 @subsection Examples

Re: [FFmpeg-devel] Is it ok to add G.722.1 decoder as external lib?

2019-09-17 Thread Andrey Semashev

On 2019-09-17 03:29, Hyun Yoo wrote:

I implemented a g.722.1 decoder by linking FreeSwitch's libg722_1
as external lib like libilbc, libspeex(ex. configure --enable-libg722_1)
(https://github.com/traviscross/freeswitch/tree/master/libs/libg722_1)


I believe, the correct upstream link is

https://freeswitch.org/stash/projects/SD/repos/libg7221/browse

The GitHub project is a mirror.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] Is it ok to add G.722.1 decoder as external lib?

2019-09-17 Thread Carl Eugen Hoyos


> Am 17.09.2019 um 09:43 schrieb Moritz Barsnick :

> But that said: ffmpeg already has a native G.722 encoder (and decoder),

See: https://en.wikipedia.org/wiki/G.722.1
The numbering...

Carl Eugen

(The library is non-free and we cannot change that.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] Is it ok to add G.722.1 decoder as external lib?

2019-09-17 Thread Moritz Barsnick
On Tue, Sep 17, 2019 at 09:29:54 +0900, Hyun Yoo wrote:
> I implemented a g.722.1 decoder by linking FreeSwitch's libg722_1
> as external lib like libilbc, libspeex(ex. configure --enable-libg722_1)
> (https://github.com/traviscross/freeswitch/tree/master/libs/libg722_1)
>
> But I'm not sure about the license issue
> because g.722.1 is licensed by Polycom(royalty-free)
>
> Getting permission is my(commiter) job? or user(who link and compile)'s job?

I believe (but IANAL) all that licence file
(https://github.com/traviscross/freeswitch/blob/1220bbcff2fe733f40c9eae0f26a91062f419fee/libs/libg722_1/COPYING)
says is that the G.722.1 *codec* is to be licensed, and the code
implementation is "free to use". Is this the actual reference
implementation quoted in that file? Really bad wording, if you ask me.

But that said: ffmpeg already has a native G.722 encoder (and decoder),
and even the same author (Steve Underwood) is credited in it. Perhaps
it was even derived from the same sources as the libg722_1 sources.

Why would you need this external implementation? Because it provides
G.722.1 versus just G.722? Could that functionality not easily be
ported/merged to ffmpeg, assuming the same licensing conditions as
assumed for the G.722 implementation?

Cheers,
Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] Is it ok to add G.722.1 decoder as external lib?

2019-09-17 Thread Carl Eugen Hoyos


> Am 17.09.2019 um 02:29 schrieb Hyun Yoo :
> 
> I implemented a g.722.1 decoder by linking FreeSwitch's libg722_1
> as external lib like libilbc, libspeex(ex. configure --enable-libg722_1)
> (https://github.com/traviscross/freeswitch/tree/master/libs/libg722_1)
> 
> But I'm not sure about the license issue
> because g.722.1 is licensed by Polycom(royalty-free)

Mark the new external codec as “nonfree” in FFmpeg’s configure file.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] Is it ok to add G.722.1 decoder as external lib?

2019-09-17 Thread Tomas Härdin
tis 2019-09-17 klockan 09:29 +0900 skrev Hyun Yoo:
> I implemented a g.722.1 decoder by linking FreeSwitch's libg722_1
> as external lib like libilbc, libspeex(ex. configure --enable-
> libg722_1)
> (https://github.com/traviscross/freeswitch/tree/master/libs/libg722_1
> )
> 
> But I'm not sure about the license issue
> because g.722.1 is licensed by Polycom(royalty-free)

The software license sounds like it's non-free

> Getting permission is my(commiter) job? or user(who link and
> compile)'s job?

If FFmpeg could get the appropriate paperwork to relicense it under say
LGPL that would be great. Else it would be up to the user

We've had some discussions before about non-free codec wrappers in the
codebase, and most developers are not very fond of them. Perhaps an
effort to implement our own encoder would be worthwhile? The patents
are a non-issue for European users

/Tomas

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".