Re: [FFmpeg-devel] [PATCH] avformat/rmdec.c: fix left shift of negative value in rm_sync()

2019-09-15 Thread Michael Niedermayer
On Sun, Sep 15, 2019 at 12:22:39AM -0300, James Almer wrote:
> Fixes ticket 8143.
> 
> Signed-off-by: James Almer 
> ---
>  libavformat/rmdec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
> index c9abd38d33..ccdc38f98a 100644
> --- a/libavformat/rmdec.c
> +++ b/libavformat/rmdec.c
> @@ -724,8 +724,7 @@ static int rm_sync(AVFormatContext *s, int64_t 
> *timestamp, int *flags, int *stre
>  
>  num = avio_rb16(pb);
>  *timestamp = avio_rb32(pb);
> -mlti_id = (avio_r8(pb)>>1)-1<<16;
> -mlti_id = FFMAX(mlti_id, 0);
> +mlti_id = FFMAX((avio_r8(pb) >> 1) - 1, 0) << 16;

functions with sideeffects like moving some file pointer should
not be used in macros which may evaluate their arguments multiple
times

thx

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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] avcodec/v4l2_m2m_enc: check for V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME availability before using

2019-09-15 Thread Guo, Yejun


> -Original Message-
> From: Aman Gupta [mailto:a...@tmm1.net] On Behalf Of Aman Gupta
> Sent: Saturday, September 14, 2019 7:31 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Guo, Yejun ; Aman Gupta 
> Subject: [PATCH] avcodec/v4l2_m2m_enc: check for
> V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME availability before using
> 
> From: Aman Gupta 
> 
> Signed-off-by: Aman Gupta 
> ---
>  libavcodec/v4l2_m2m_enc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> index 4849bc26c5..474e6bef89 100644
> --- a/libavcodec/v4l2_m2m_enc.c
> +++ b/libavcodec/v4l2_m2m_enc.c
> @@ -245,8 +245,10 @@ static int v4l2_send_frame(AVCodecContext *avctx,
> const AVFrame *frame)
>  V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context;
>  V4L2Context *const output = &s->output;
> 
> +#ifdef V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME
>  if (frame && frame->pict_type == AV_PICTURE_TYPE_I)
>  v4l2_set_ext_ctrl(s, MPEG_CID(FORCE_KEY_FRAME), 0, "force key
> frame");
> +#endif

thanks, the specific build issue is fixed on my system, but I still met other 
v4l2 build issues on master with this patch.

src/libavcodec/v4l2_m2m_enc.c: In function 'v4l2_set_ext_ctrl':
src/libavcodec/v4l2_m2m_enc.c:51:12: warning: braces around scalar initializer
 struct v4l2_ext_controls ctrls = { { 0 } };
^
src/libavcodec/v4l2_m2m_enc.c:51:12: note: (near initialization for 
'ctrls.ctrl_class')
src/libavcodec/v4l2_m2m_enc.c: In function 'v4l2_get_ext_ctrl':
src/libavcodec/v4l2_m2m_enc.c:71:12: warning: braces around scalar initializer
 struct v4l2_ext_controls ctrls = { { 0 } };
^
src/libavcodec/v4l2_m2m_enc.c:71:12: note: (near initialization for 
'ctrls.ctrl_class')
src/libavcodec/v4l2_buffers.c: In function 'v4l2_buffer_swframe_to_buf':
src/libavcodec/v4l2_buffers.c:354:10: error: 'V4L2_PIX_FMT_YUV422M' undeclared 
(first use in this function)
 case V4L2_PIX_FMT_YUV422M:
  ^
src/libavcodec/v4l2_buffers.c:354:10: note: each undeclared identifier is 
reported only once for each function it appears in
src/libavcodec/v4l2_buffers.c:355:10: error: 'V4L2_PIX_FMT_YVU422M' undeclared 
(first use in this function)
 case V4L2_PIX_FMT_YVU422M:
  ^
src/libavcodec/v4l2_buffers.c:356:10: error: 'V4L2_PIX_FMT_YUV444M' undeclared 
(first use in this function)
 case V4L2_PIX_FMT_YUV444M:
  ^
src/libavcodec/v4l2_buffers.c:357:10: error: 'V4L2_PIX_FMT_YVU444M' undeclared 
(first use in this function)
 case V4L2_PIX_FMT_YVU444M:
  ^
src/ffbuild/common.mak:59: recipe for target 'libavcodec/v4l2_buffers.o' failed
make: *** [libavcodec/v4l2_buffers.o] Error 1
make: *** Waiting for unfinished jobs

> 
>  return ff_v4l2_context_enqueue_frame(output, frame);
>  }
> --
> 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] avcodec/mips: simplified code in vp3dsp_idct_msa.c.

2019-09-15 Thread gxw
Use the macros of ADD8 to replace continuous addition operations.
---
 libavcodec/mips/vp3dsp_idct_msa.c   | 80 -
 libavutil/mips/generic_macros_msa.h |  6 +++
 2 files changed, 22 insertions(+), 64 deletions(-)

diff --git a/libavcodec/mips/vp3dsp_idct_msa.c 
b/libavcodec/mips/vp3dsp_idct_msa.c
index 90c578f..e4cd377 100644
--- a/libavcodec/mips/vp3dsp_idct_msa.c
+++ b/libavcodec/mips/vp3dsp_idct_msa.c
@@ -178,14 +178,8 @@ static void idct_msa(uint8_t *dst, int stride, int16_t 
*input, int type)
c0, c1, c2, c3);
 ILVR_H4_SW(zero, f4, zero, f5, zero, f6, zero, f7,
c4, c5, c6, c7);
-A += c0;
-B += c7;
-C += c1;
-D += c2;
-E += c3;
-F += c4;
-G += c5;
-H += c6;
+ADD8(A, c0, B, c7, C, c1, D, c2, E, c3, F, c4, G, c5, H, c6,
+ A, B, C, D, E, F, G, H);
 }
 CLIP_SW8_0_255(A, B, C, D, E, F, G, H);
 sign_l = __msa_or_v((v16u8)r1_r, (v16u8)r2_r);
@@ -208,14 +202,8 @@ static void idct_msa(uint8_t *dst, int stride, int16_t 
*input, int type)
 Gd = Bdd;
 Hd = Bdd;
 } else {
-Ad = Add + c0;
-Bd = Add + c1;
-Cd = Add + c2;
-Dd = Add + c3;
-Ed = Add + c4;
-Fd = Add + c5;
-Gd = Add + c6;
-Hd = Add + c7;
+ADD8(Add, c0, Add, c1, Add, c2, Add, c3, Add, c4, Add, c5, Add, c6,
+ Add, c7, Ad, Bd, Cd, Dd, Ed, Fd, Gd, Hd);
 CLIP_SW8_0_255(Ad, Bd, Cd, Dd, Ed, Fd, Gd, Hd);
 }
 Ad = (v4i32)__msa_and_v((v16u8)Ad, (v16u8)sign_t);
@@ -235,14 +223,8 @@ static void idct_msa(uint8_t *dst, int stride, int16_t 
*input, int type)
 F = (v4i32)__msa_and_v((v16u8)F, (v16u8)sign_t);
 G = (v4i32)__msa_and_v((v16u8)G, (v16u8)sign_t);
 H = (v4i32)__msa_and_v((v16u8)H, (v16u8)sign_t);
-r0_r = Ad + A;
-r1_r = Bd + C;
-r2_r = Cd + D;
-r3_r = Dd + E;
-r0_l = Ed + F;
-r1_l = Fd + G;
-r2_l = Gd + H;
-r3_l = Hd + B;
+ADD8(Ad, A, Bd, C, Cd, D, Dd, E, Ed, F, Fd, G, Gd, H, Hd, B,
+ r0_r, r1_r, r2_r, r3_r, r0_l, r1_l, r2_l, r3_l);
 
 /* Row 4 to 7 */
 TRANSPOSE4x4_SW_SW(r4_r, r5_r, r6_r, r7_r,
@@ -286,14 +268,8 @@ static void idct_msa(uint8_t *dst, int stride, int16_t 
*input, int type)
c0, c1, c2, c3);
 ILVL_H4_SW(zero, f4, zero, f5, zero, f6, zero, f7,
c4, c5, c6, c7);
-A += c0;
-B += c7;
-C += c1;
-D += c2;
-E += c3;
-F += c4;
-G += c5;
-H += c6;
+ADD8(A, c0, B, c7, C, c1, D, c2, E, c3, F, c4, G, c5, H, c6,
+ A, B, C, D, E, F, G, H);
 }
 CLIP_SW8_0_255(A, B, C, D, E, F, G, H);
 sign_l = __msa_or_v((v16u8)r5_r, (v16u8)r6_r);
@@ -316,14 +292,8 @@ static void idct_msa(uint8_t *dst, int stride, int16_t 
*input, int type)
 Gd = Bdd;
 Hd = Bdd;
 } else {
-Ad = Add + c0;
-Bd = Add + c1;
-Cd = Add + c2;
-Dd = Add + c3;
-Ed = Add + c4;
-Fd = Add + c5;
-Gd = Add + c6;
-Hd = Add + c7;
+ADD8(Add, c0, Add, c1, Add, c2, Add, c3, Add, c4, Add, c5, Add, c6,
+ Add, c7, Ad, Bd, Cd, Dd, Ed, Fd, Gd, Hd);
 CLIP_SW8_0_255(Ad, Bd, Cd, Dd, Ed, Fd, Gd, Hd);
 }
 Ad = (v4i32)__msa_and_v((v16u8)Ad, (v16u8)sign_t);
@@ -343,14 +313,8 @@ static void idct_msa(uint8_t *dst, int stride, int16_t 
*input, int type)
 F = (v4i32)__msa_and_v((v16u8)F, (v16u8)sign_t);
 G = (v4i32)__msa_and_v((v16u8)G, (v16u8)sign_t);
 H = (v4i32)__msa_and_v((v16u8)H, (v16u8)sign_t);
-r4_r = Ad + A;
-r5_r = Bd + C;
-r6_r = Cd + D;
-r7_r = Dd + E;
-r4_l = Ed + F;
-r5_l = Fd + G;
-r6_l = Gd + H;
-r7_l = Hd + B;
+ADD8(Ad, A, Bd, C, Cd, D, Dd, E, Ed, F, Fd, G, Gd, H, Hd, B,
+ r4_r, r5_r, r6_r, r7_r, r4_l, r5_l, r6_l, r7_l);
 VSHF_B2_SB(r0_r, r4_r, r1_r, r5_r, mask, mask, d0, d1);
 VSHF_B2_SB(r2_r, r6_r, r3_r, r7_r, mask, mask, d2, d3);
 VSHF_B2_SB(r0_l, r4_l, r1_l, r5_l, mask, mask, d4, d5);
@@ -400,14 +364,8 @@ void ff_vp3_idct_dc_add_msa(uint8_t *dest, ptrdiff_t 
line_size, int16_t *block)
e0, e1, e2, e3);
 ILVR_H4_SW(zero, c4, zero, c5, zero, c6, zero, c7,
e4, e5, e6, e7);
-e0 += dc;
-e1 += dc;
-e2 += dc;
-e3 += dc;
-e4 += dc;
-e5 += dc;
-e6 += dc;
-e7 += dc;
+ADD8(e0, dc, e1, dc, e2, dc, e3, dc, e4, dc, e5, dc, e6, dc, e7, dc,
+ e0, e1, e2, e3, e4, e5, e6, e7);
 CLIP_SW8_0_255(e0, e1, e2, e3, e4, e5, e6, e7);
 
 /* Left part */
@@ -415,14 +373,8 @@ void ff_vp3_idct_dc_add_msa(uint8_t *dest, ptrdiff_t 
line_size, int16_t *block)
r0, r1, r2, r3);
 ILVL_H4_SW(zero, c4, zero, c5, zero, c6, zero, c7,
r4, r5, r6, r7);
-r0 += dc;
-r1 += dc;
-r2 += dc;
-r3 += dc;
-r4 += dc;
-r5 += dc;
-r6 +=

Re: [FFmpeg-devel] [PATCH 01/13] avformat/mux: Move packet references

2019-09-15 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> In the common case that the input packet was already refcounted,
> ff_interleave_add_packet would allocate a new AVPacketList, use
> av_packet_ref to create a new reference to the buffer for the
> AVPacketList's packet, interleave the packet and finally unreference
> the original input packet.
> This commit changes this: It uses av_packet_move_ref to transfer
> the packet to its destination. In case the input packet is refcounted,
> this saves an allocation and a free (of an AVBufferRef); if not, the
> packet is made refcounted before moving it. When the input packet has
> side data, one saves even more than one allocation+free.
> 
> Furthermore, when the packet is in reality an uncoded frame, a hacky
> ad-hoc variant of av_packet_move_ref has been employed. Not any more.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/mux.c | 11 ---
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 8ab5ea8c2b..ac370fb24d 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -930,17 +930,16 @@ int ff_interleave_add_packet(AVFormatContext *s, 
> AVPacket *pkt,
>  if ((pkt->flags & AV_PKT_FLAG_UNCODED_FRAME)) {
>  av_assert0(pkt->size == UNCODED_FRAME_PACKET_SIZE);
>  av_assert0(((AVFrame *)pkt->data)->buf);
> -this_pktl->pkt = *pkt;
> -pkt->buf = NULL;
> -pkt->side_data = NULL;
> -pkt->side_data_elems = 0;
>  } else {
> -if ((ret = av_packet_ref(&this_pktl->pkt, pkt)) < 0) {
> +if ((ret = av_packet_make_refcounted(pkt)) < 0) {
>  av_free(this_pktl);
>  return ret;
>  }
>  }
>  
> +av_packet_move_ref(&this_pktl->pkt, pkt);
> +pkt = &this_pktl->pkt;
> +
>  if (s->streams[pkt->stream_index]->last_in_packet_buffer) {
>  next_point = &(st->last_in_packet_buffer->next);
>  } else {
> @@ -989,8 +988,6 @@ next_non_null:
>  s->streams[pkt->stream_index]->last_in_packet_buffer =
>  *next_point  = this_pktl;
>  
> -av_packet_unref(pkt);
> -
>  return 0;
>  }
>  
> 
Ping for this patch and the remaining unmerged patches in this
patchset (patches 1, 2, 4, 5, 7-13).

- Andreas


___
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] avcodec/v4l2_m2m_enc: check for V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME availability before using

2019-09-15 Thread Michael Niedermayer
On Sun, Sep 15, 2019 at 08:43:32AM +, Guo, Yejun wrote:
> 
> 
> > -Original Message-
> > From: Aman Gupta [mailto:a...@tmm1.net] On Behalf Of Aman Gupta
> > Sent: Saturday, September 14, 2019 7:31 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Guo, Yejun ; Aman Gupta 
> > Subject: [PATCH] avcodec/v4l2_m2m_enc: check for
> > V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME availability before using
> > 
> > From: Aman Gupta 
> > 
> > Signed-off-by: Aman Gupta 
> > ---
> >  libavcodec/v4l2_m2m_enc.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> > index 4849bc26c5..474e6bef89 100644
> > --- a/libavcodec/v4l2_m2m_enc.c
> > +++ b/libavcodec/v4l2_m2m_enc.c
> > @@ -245,8 +245,10 @@ static int v4l2_send_frame(AVCodecContext *avctx,
> > const AVFrame *frame)
> >  V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context;
> >  V4L2Context *const output = &s->output;
> > 
> > +#ifdef V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME
> >  if (frame && frame->pict_type == AV_PICTURE_TYPE_I)
> >  v4l2_set_ext_ctrl(s, MPEG_CID(FORCE_KEY_FRAME), 0, "force key
> > frame");
> > +#endif
> 
> thanks, the specific build issue is fixed on my system, but I still met other 
> v4l2 build issues on master with this patch.
> 
> src/libavcodec/v4l2_m2m_enc.c: In function 'v4l2_set_ext_ctrl':
> src/libavcodec/v4l2_m2m_enc.c:51:12: warning: braces around scalar initializer
>  struct v4l2_ext_controls ctrls = { { 0 } };
> ^
> src/libavcodec/v4l2_m2m_enc.c:51:12: note: (near initialization for 
> 'ctrls.ctrl_class')
> src/libavcodec/v4l2_m2m_enc.c: In function 'v4l2_get_ext_ctrl':
> src/libavcodec/v4l2_m2m_enc.c:71:12: warning: braces around scalar initializer
>  struct v4l2_ext_controls ctrls = { { 0 } };
> ^
> src/libavcodec/v4l2_m2m_enc.c:71:12: note: (near initialization for 
> 'ctrls.ctrl_class')
> src/libavcodec/v4l2_buffers.c: In function 'v4l2_buffer_swframe_to_buf':
> src/libavcodec/v4l2_buffers.c:354:10: error: 'V4L2_PIX_FMT_YUV422M' 
> undeclared (first use in this function)
>  case V4L2_PIX_FMT_YUV422M:
>   ^
> src/libavcodec/v4l2_buffers.c:354:10: note: each undeclared identifier is 
> reported only once for each function it appears in
> src/libavcodec/v4l2_buffers.c:355:10: error: 'V4L2_PIX_FMT_YVU422M' 
> undeclared (first use in this function)
>  case V4L2_PIX_FMT_YVU422M:
>   ^
> src/libavcodec/v4l2_buffers.c:356:10: error: 'V4L2_PIX_FMT_YUV444M' 
> undeclared (first use in this function)
>  case V4L2_PIX_FMT_YUV444M:
>   ^
> src/libavcodec/v4l2_buffers.c:357:10: error: 'V4L2_PIX_FMT_YVU444M' 
> undeclared (first use in this function)
>  case V4L2_PIX_FMT_YVU444M:
>   ^
> src/ffbuild/common.mak:59: recipe for target 'libavcodec/v4l2_buffers.o' 
> failed
> make: *** [libavcodec/v4l2_buffers.o] Error 1
> make: *** Waiting for unfinished jobs

ossfuzz also hits these issues
https://oss-fuzz-build-logs.storage.googleapis.com/log-23c6325e-a029-4ee0-8752-b4f573601087.txt

thx

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

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


signature.asc
Description: 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".

[FFmpeg-devel] [PATCH v2] avformat/rmdec.c: fix left shift of negative value in rm_sync()

2019-09-15 Thread James Almer
Fixes ticket 8143.

Signed-off-by: James Almer 
---
 libavformat/rmdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index c9abd38d33..e95cc9f858 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -724,8 +724,8 @@ static int rm_sync(AVFormatContext *s, int64_t *timestamp, 
int *flags, int *stre
 
 num = avio_rb16(pb);
 *timestamp = avio_rb32(pb);
-mlti_id = (avio_r8(pb)>>1)-1<<16;
-mlti_id = FFMAX(mlti_id, 0);
+mlti_id = avio_r8((pb) >> 1) - 1;
+mlti_id = FFMAX(mlti_id, 0) << 16;
 *flags = avio_r8(pb); /* flags */
 }
 for(i=0;inb_streams;i++) {
-- 
2.22.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 v2] avformat/rmdec.c: fix left shift of negative value in rm_sync()

2019-09-15 Thread Andreas Rheinhardt
James Almer:
> Fixes ticket 8143.
> 
> Signed-off-by: James Almer 
> ---
>  libavformat/rmdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
> index c9abd38d33..e95cc9f858 100644
> --- a/libavformat/rmdec.c
> +++ b/libavformat/rmdec.c
> @@ -724,8 +724,8 @@ static int rm_sync(AVFormatContext *s, int64_t 
> *timestamp, int *flags, int *stre
>  
>  num = avio_rb16(pb);
>  *timestamp = avio_rb32(pb);
> -mlti_id = (avio_r8(pb)>>1)-1<<16;
> -mlti_id = FFMAX(mlti_id, 0);
> +mlti_id = avio_r8((pb) >> 1) - 1;
> +mlti_id = FFMAX(mlti_id, 0) << 16;
>  *flags = avio_r8(pb); /* flags */
>  }
>  for(i=0;inb_streams;i++) {
> 
LGTM.

- Andreas

___
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] avformat/rmdec.c: fix left shift of negative value in rm_sync()

2019-09-15 Thread James Almer
On 9/15/2019 10:19 AM, Andreas Rheinhardt wrote:
> James Almer:
>> Fixes ticket 8143.
>>
>> Signed-off-by: James Almer 
>> ---
>>  libavformat/rmdec.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
>> index c9abd38d33..e95cc9f858 100644
>> --- a/libavformat/rmdec.c
>> +++ b/libavformat/rmdec.c
>> @@ -724,8 +724,8 @@ static int rm_sync(AVFormatContext *s, int64_t 
>> *timestamp, int *flags, int *stre
>>  
>>  num = avio_rb16(pb);
>>  *timestamp = avio_rb32(pb);
>> -mlti_id = (avio_r8(pb)>>1)-1<<16;
>> -mlti_id = FFMAX(mlti_id, 0);
>> +mlti_id = avio_r8((pb) >> 1) - 1;
>> +mlti_id = FFMAX(mlti_id, 0) << 16;
>>  *flags = avio_r8(pb); /* flags */
>>  }
>>  for(i=0;inb_streams;i++) {
>>
> LGTM.
> 
> - Andreas

Applied, thanks.
___
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] avcodec/allcodecs: make libdav1d the preferred AV1 decoder

2019-09-15 Thread James Almer
It's considerably faster than libaom in most systems.

Signed-off-by: James Almer 
---
 libavcodec/allcodecs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 5130fca026..d5dfba1877 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -680,7 +680,6 @@ extern AVCodec ff_pcm_mulaw_at_encoder;
 extern AVCodec ff_pcm_mulaw_at_decoder;
 extern AVCodec ff_qdmc_at_decoder;
 extern AVCodec ff_qdm2_at_decoder;
-extern AVCodec ff_libaom_av1_decoder;
 extern AVCodec ff_libaom_av1_encoder;
 extern AVCodec ff_libaribb24_decoder;
 extern AVCodec ff_libcelt_decoder;
@@ -738,6 +737,7 @@ extern AVCodec ff_idf_decoder;
 /* external libraries, that shouldn't be used by default if one of the
  * above is available */
 extern AVCodec ff_h263_v4l2m2m_encoder;
+extern AVCodec ff_libaom_av1_decoder;
 extern AVCodec ff_libopenh264_encoder;
 extern AVCodec ff_libopenh264_decoder;
 extern AVCodec ff_h264_amf_encoder;
-- 
2.22.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] avfilter/x86/vf_360: add most of >8 depth asm

2019-09-15 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/x86/vf_v360.asm| 67 ++
 libavfilter/x86/vf_v360_init.c | 12 ++
 2 files changed, 79 insertions(+)

diff --git a/libavfilter/x86/vf_v360.asm b/libavfilter/x86/vf_v360.asm
index a0936eb6dc..5b241220d8 100644
--- a/libavfilter/x86/vf_v360.asm
+++ b/libavfilter/x86/vf_v360.asm
@@ -26,7 +26,9 @@
 SECTION_RODATA
 
 pb_mask: db 0,4,8,12,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
+pw_mask: db 0,1,4, 5, 8, 9,12,13,-1,-1,-1,-1,-1,-1,-1,-1
 pd_255: times 4 dd 255
+pd_65535: times 4 dd 65535
 
 SECTION .text
 
@@ -60,6 +62,34 @@ cglobal remap1_8bit_line, 6, 7, 6, dst, width, src, 
in_linesize, u, v, x
 jl .loop
 RET
 
+INIT_YMM avx2
+cglobal remap1_16bit_line, 6, 7, 6, dst, width, src, in_linesize, u, v, x
+movsxdifnidn widthq, widthd
+xor xq, xq
+movd   xm0, in_linesized
+pcmpeqw m4, m4
+VBROADCASTI128  m3, [pw_mask]
+vpbroadcastdm0, xm0
+
+.loop:
+pmovsxwd   m1, [vq + xq * 2]
+pmovsxwd   m2, [uq + xq * 2]
+
+pslldm2, 0x1
+pmulld   m1, m0
+padddm1, m2
+mova m2, m4
+vpgatherdd   m5, [srcq + m1], m2
+pshufb   m1, m5, m3
+vextracti128xm2, m1, 1
+movq[dstq+xq*2], xm1
+movq  [dstq+xq*2+8], xm2
+
+add   xq, mmsize / 4
+cmp   xq, widthq
+jl .loop
+RET
+
 INIT_YMM avx2
 cglobal remap2_8bit_line, 7, 8, 8, dst, width, src, in_linesize, u, v, ker, x
 movsxdifnidn widthq, widthd
@@ -96,6 +126,43 @@ DEFINE_ARGS dst, width, src, x, u, v, ker
 jl .loop
 RET
 
+INIT_YMM avx2
+cglobal remap2_16bit_line, 7, 8, 8, dst, width, src, in_linesize, u, v, ker, x
+movsxdifnidn widthq, widthd
+movd   xm0, in_linesized
+%if ARCH_X86_32
+DEFINE_ARGS dst, width, src, x, u, v, ker
+%endif
+xor xq, xq
+pcmpeqw m7, m7
+vpbroadcastdm0, xm0
+vpbroadcastdm6, [pd_65535]
+
+.loop:
+pmovsxwd   m1, [kerq + xq * 8]
+pmovsxwd   m2, [vq + xq * 8]
+pmovsxwd   m3, [uq + xq * 8]
+
+pslld   m3, 0x1
+pmulld  m4, m2, m0
+paddd   m4, m3
+movam3, m7
+vpgatherdd  m2, [srcq + m4], m3
+pandm2, m6
+pmulld  m2, m1
+phaddd  m2, m2
+phaddd  m1, m2, m2
+psrld   m1, m1, 0xe
+vextracti128   xm2, m1, 1
+
+pextrw   [dstq+xq*2], xm1, 0
+pextrw [dstq+xq*2+2], xm2, 0
+
+add   xq, mmsize / 16
+cmp   xq, widthq
+jl .loop
+RET
+
 %if ARCH_X86_64
 
 INIT_YMM avx2
diff --git a/libavfilter/x86/vf_v360_init.c b/libavfilter/x86/vf_v360_init.c
index 8c1a10c705..c7f4a3dd6d 100644
--- a/libavfilter/x86/vf_v360_init.c
+++ b/libavfilter/x86/vf_v360_init.c
@@ -32,6 +32,12 @@ void ff_remap2_8bit_line_avx2(uint8_t *dst, int width, const 
uint8_t *src, ptrdi
 void ff_remap4_8bit_line_avx2(uint8_t *dst, int width, const uint8_t *src, 
ptrdiff_t in_linesize,
   const uint16_t *u, const uint16_t *v, const 
int16_t *ker);
 
+void ff_remap1_16bit_line_avx2(uint8_t *dst, int width, const uint8_t *src, 
ptrdiff_t in_linesize,
+   const uint16_t *u, const uint16_t *v, const 
int16_t *ker);
+
+void ff_remap2_16bit_line_avx2(uint8_t *dst, int width, const uint8_t *src, 
ptrdiff_t in_linesize,
+  const uint16_t *u, const uint16_t *v, const 
int16_t *ker);
+
 av_cold void ff_v360_init_x86(V360Context *s, int depth)
 {
 int cpu_flags = av_get_cpu_flags();
@@ -42,6 +48,12 @@ av_cold void ff_v360_init_x86(V360Context *s, int depth)
 if (EXTERNAL_AVX2_FAST(cpu_flags) && s->interp == BILINEAR && depth <= 8)
 s->remap_line = ff_remap2_8bit_line_avx2;
 
+if (EXTERNAL_AVX2_FAST(cpu_flags) && s->interp == NEAREST && depth > 8)
+s->remap_line = ff_remap1_16bit_line_avx2;
+
+if (EXTERNAL_AVX2_FAST(cpu_flags) && s->interp == BILINEAR && depth > 8)
+s->remap_line = ff_remap2_16bit_line_avx2;
+
 #if ARCH_X86_64
 if (EXTERNAL_AVX2_FAST(cpu_flags) && (s->interp == BICUBIC ||
   s->interp == LANCZOS) && depth <= 8)
-- 
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".

Re: [FFmpeg-devel] [PATCH v2 3/3] FATE: add fate test for minterpolate filter

2019-09-15 Thread Michael Niedermayer
On Sat, Sep 14, 2019 at 11:37:31AM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  tests/fate/filter-video.mak |  4 
>  tests/ref/fate/filter-minterpolate-down |  6 ++
>  tests/ref/fate/filter-minterpolate-up   | 15 +++
>  3 files changed, 25 insertions(+)
>  create mode 100644 tests/ref/fate/filter-minterpolate-down
>  create mode 100644 tests/ref/fate/filter-minterpolate-up
> 
> diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
> index 0c6ee72..ab7b624 100644
> --- a/tests/fate/filter-video.mak
> +++ b/tests/fate/filter-video.mak
> @@ -122,6 +122,10 @@ FATE_FILTER-$(call ALLYES, FRAMERATE_FILTER 
> TESTSRC2_FILTER FORMAT_FILTER) += fa
>  fate-filter-framerate-12bit-up: CMD = framecrc -lavfi 
> testsrc2=r=50:d=1,format=pix_fmts=yuv422p12le,framerate=fps=60 -t 1 -pix_fmt 
> yuv422p12le
>  fate-filter-framerate-12bit-down: CMD = framecrc -lavfi 
> testsrc2=r=60:d=1,format=pix_fmts=yuv422p12le,framerate=fps=50 -t 1 -pix_fmt 
> yuv422p12le
>  
> +FATE_FILTER-$(call ALLYES, MINTERPOLATE_FILTER TESTSRC2_FILTER) += 
> fate-filter-minterpolate-up fate-filter-minterpolate-down

> +fate-filter-minterpolate-up: CMD = framecrc -lavfi 
> testsrc2=r=2:d=10,framerate=fps=10 -t 1
> +fate-filter-minterpolate-down: CMD = framecrc -lavfi 
> testsrc2=r=2:d=10,framerate=fps=1 -t 1

tested on linux x86_32/64, mingw32/64 arm & mips qemu

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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-15 Thread Michael Niedermayer
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

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

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


signature.asc
Description: 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-15 Thread James Almer
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.
___
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] avcodec/ttaenc: Fix undefined shift

2019-09-15 Thread Andreas Rheinhardt
ttaenc contained (1 << unary) - 1 as an argument for a function
expecting an unsigned int. unary can be as big as 31 in this case.
The type of the shift and the whole expression is int, because 1 fits
into an integer, so that the behaviour is undefined if unary == 31
as the result of the shift can't be represented in an int §. Subtraction
by 1 (which makes the result of the whole expression representable in
an int) doesn't change that this is undefined (it usually leads to
signed integer overflow which is undefined, too).

The solution is simple: Make 1 unsigned to change the type of the
whole expression to unsigned int (as the function expects anyway).

Fixes ticket #8153.

§: This of course presupposes the common int range of -2^31..2^31-1

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

diff --git a/libavcodec/ttaenc.c b/libavcodec/ttaenc.c
index 3cc54d78c5..08a0d0483a 100644
--- a/libavcodec/ttaenc.c
+++ b/libavcodec/ttaenc.c
@@ -164,7 +164,7 @@ pkt_alloc:
 put_bits(&pb, 31, 0x7FFF);
 unary -= 31;
 } else {
-put_bits(&pb, unary, (1 << unary) - 1);
+put_bits(&pb, unary, (1U << unary) - 1);
 unary = 0;
 }
 } while (unary);
-- 
2.21.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] Delete unused branch in libaomenc

2019-09-15 Thread Elliott Karpilovsky
---
 libavcodec/libaomenc.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 7f47707a09..0b369d50a7 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -572,15 +572,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
 enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
   AV_ROUND_NEAR_INF);
 } else if (enccfg.rc_end_usage != AOM_Q) {
-if (enccfg.rc_end_usage == AOM_CQ) {
-enccfg.rc_target_bitrate = 100;
-} else {
-enccfg.rc_end_usage = AOM_Q;
-ctx->crf = 32;
-av_log(avctx, AV_LOG_WARNING,
-   "Neither bitrate nor constrained quality specified, using 
default CRF of %d\n",
-   ctx->crf);
-}
+  enccfg.rc_end_usage = AOM_Q;
+  ctx->crf = 32;
+  av_log(avctx, AV_LOG_WARNING,
+ "Neither bitrate nor constrained quality specified, using default 
CRF of %d\n",
+ ctx->crf);
 }
 
 if (avctx->qmin >= 0)
-- 
2.23.0.237.gc6a4ce50a0-goog

___
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] avutil/mips: refactor msa SLDI_Bn_0 and SLDI_Bn macros.

2019-09-15 Thread Michael Niedermayer
On Wed, Aug 07, 2019 at 10:49:19AM +0800, Shiyou Yin wrote:
> LGTM.

will apply

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

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


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/6] tools/target_dec_fuzzer: Adjust motionpixels threshold

2019-09-15 Thread Michael Niedermayer
On Sun, Aug 25, 2019 at 08:41:54PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (151sec -> 173ms)
> Fixes: 
> 16053/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOTIONPIXELS_fuzzer-5647069169057792
> Fixes: 
> 16053/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOTIONPIXELS_fuzzer-5108957126852608
> 
> 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(+)

will apply

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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/2] libavcodec/utils: Free threads on init failure

2019-09-15 Thread Michael Niedermayer
On Tue, Aug 27, 2019 at 11:21:51PM +0200, Michael Niedermayer wrote:
> Fixes: Multiple memleaks
> Fixes: ffmpeg-memory-leak
> 
> Found-by: Francis Provencher 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/utils.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply


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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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 1/2] avcodec/gdv: Replace assert() checking bitstream by if()

2019-09-15 Thread Michael Niedermayer
On Wed, Aug 28, 2019 at 11:17:19PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/gdv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

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

"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott



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 1/2] tools/target_dec_fuzzer: increase snows threshold

2019-09-15 Thread Michael Niedermayer
On Thu, Aug 29, 2019 at 09:46:31PM +0200, Michael Niedermayer wrote:
> snow allows creating large output from tiny input, like other
> wavelet codecs
> 
> Fixes: Timeout (82sec -> 1.5sec)
> Fixes: 
> 9520/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-6286612576075776
> 
> 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(+)

will apply

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

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


signature.asc
Description: 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/5] avcodec/hevcdec: repeat character in skiped

2019-09-15 Thread Michael Niedermayer
On Wed, Aug 28, 2019 at 07:26:50PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hevcdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patchset

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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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 1/2] avcodec/cfhd: Check that cropped size is smaller than full

2019-09-15 Thread Michael Niedermayer
On Thu, Aug 29, 2019 at 09:04:58PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 57342 * 120830 cannot be represented in type 
> 'int'
> Fixes: 
> 16426/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5758744817827840
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> ---
>  libavcodec/cfhd.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

will apply

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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] avformat/cdxl: Fix integer overflow in intermediate

2019-09-15 Thread Michael Niedermayer
On Sat, Aug 31, 2019 at 01:25:02AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 65535 * 65312 cannot be represented in type 
> 'int'
> Fixes: 
> 16704/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6294115603447808
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/cdxl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

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

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


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] avformat/vividas: Remove align offset which is always masked off

2019-09-15 Thread Michael Niedermayer
On Sun, Sep 01, 2019 at 12:32:39AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/vividas.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
-- 
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 3/5] avformat/vividas: remove dead assignment

2019-09-15 Thread Michael Niedermayer
On Sun, Sep 01, 2019 at 12:32:38AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/vividas.c | 2 --
>  1 file changed, 2 deletions(-)

will apply

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

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


signature.asc
Description: 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".

[FFmpeg-devel] [PATCH] Change libvpx-vpx default to crf=32.

2019-09-15 Thread Elliott Karpilovsky
Current default is 200kbps, which produces inconsistent
results (too high for low-res, too low for hi-res). Use
CRF instead, which will adapt. Affects vp8/vp9. Also
have VP8 use a default bitrate of 256kbps.
---
 libavcodec/libvpxenc.c | 74 +++---
 1 file changed, 63 insertions(+), 11 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index feb52ea0dd..e7db55ac7d 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -510,6 +510,66 @@ static void set_color_range(AVCodecContext *avctx)
 #endif
 #endif
 
+/**
+ * Set the target bitrate to VPX library default. Also set CRF to 32 if needed.
+ */
+static void set_vp8_defaults(AVCodecContext *avctx,
+ struct vpx_codec_enc_cfg *enccfg)
+{
+VPxContext *ctx = avctx->priv_data;
+av_assert0(!avctx->bit_rate);
+avctx->bit_rate = enccfg->rc_target_bitrate * 1000;
+if (enccfg->rc_end_usage == VPX_CQ) {
+av_log(avctx, AV_LOG_WARNING,
+   "Bitrate not specified for constrained quality mode, using 
default of %dkbit/sec\n",
+   enccfg->rc_target_bitrate);
+} else {
+enccfg->rc_end_usage = VPX_CQ;
+ctx->crf = 32;
+av_log(avctx, AV_LOG_WARNING,
+   "Neither bitrate nor constrained quality specified, using 
default CRF of %d and bitrate of %dkbit/sec\n",
+   ctx->crf, enccfg->rc_target_bitrate);
+}
+}
+
+
+#if CONFIG_LIBVPX_VP9_ENCODER
+/**
+ * Keep the target bitrate at 0 to engage constant quality mode. If CRF is not
+ * set, use 32.
+ */
+static void set_vp9_defaults(AVCodecContext *avctx,
+ struct vpx_codec_enc_cfg *enccfg)
+{
+VPxContext *ctx = avctx->priv_data;
+av_assert0(!avctx->bit_rate);
+if (enccfg->rc_end_usage != VPX_Q && ctx->lossless < 0) {
+enccfg->rc_end_usage = VPX_Q;
+ctx->crf = 32;
+av_log(avctx, AV_LOG_WARNING,
+   "Neither bitrate nor constrained quality specified, using 
default CRF of %d\n",
+   ctx->crf);
+}
+}
+#endif
+
+/**
+ * Called when the bitrate is not set. It sets appropriate default values for
+ * bitrate and CRF.
+ */
+static void set_vpx_defaults(AVCodecContext *avctx,
+ struct vpx_codec_enc_cfg *enccfg)
+{
+av_assert0(!avctx->bit_rate);
+#if CONFIG_LIBVPX_VP9_ENCODER
+if (avctx->codec_id == AV_CODEC_ID_VP9) {
+set_vp9_defaults(avctx, enccfg);
+return;
+}
+#endif
+set_vp8_defaults(avctx, enccfg);
+}
+
 static av_cold int vpx_init(AVCodecContext *avctx,
 const struct vpx_codec_iface *iface)
 {
@@ -580,18 +640,9 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 if (avctx->bit_rate) {
 enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
   AV_ROUND_NEAR_INF);
-#if CONFIG_LIBVPX_VP9_ENCODER
-} else if (enccfg.rc_end_usage == VPX_Q) {
-#endif
 } else {
-if (enccfg.rc_end_usage == VPX_CQ) {
-enccfg.rc_target_bitrate = 100;
-} else {
-avctx->bit_rate = enccfg.rc_target_bitrate * 1000;
-av_log(avctx, AV_LOG_WARNING,
-   "Neither bitrate nor constrained quality specified, using 
default bitrate of %dkbit/sec\n",
-   enccfg.rc_target_bitrate);
-}
+// Set bit-rate to default value. Also sets CRF to default if needed.
+set_vpx_defaults(avctx, &enccfg);
 }
 
 if (avctx->codec_id == AV_CODEC_ID_VP9 && ctx->lossless == 1) {
@@ -1266,6 +1317,7 @@ static const AVOption vp9_options[] = {
 #undef LEGACY_OPTIONS
 
 static const AVCodecDefault defaults[] = {
+{ "b", "0" },
 { "qmin", "-1" },
 { "qmax", "-1" },
 { "g","-1" },
-- 
2.23.0.237.gc6a4ce50a0-goog

___
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] Change libvpx-vpx default to crf=32.

2019-09-15 Thread Elliott Karpilovsky
On Wed, Sep 4, 2019 at 9:53 AM James Zern
 wrote:
>
> Hi,
>
> On Wed, Aug 28, 2019 at 2:26 PM Elliott Karpilovsky
>  wrote:
> >
> > Current default is 200kbps, which produces inconsistent
> > results (too high for low-res, too low for hi-res). Use
> > CRF instead, which will adapt. Affects vp8/vp9. Also
> > have VP8 use a default bitrate of 256kbps.
> > ---
> >  libavcodec/libvpxenc.c | 71 +++---
> >  libavcodec/version.h   |  2 +-
> >  2 files changed, 61 insertions(+), 12 deletions(-)
> >
>
> Some cosmetics, seems to work as expected with tip of tree and v1.4.0.
>
> > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> > index feb52ea0dd..42504ab95e 100644
> > --- a/libavcodec/libvpxenc.c
> > +++ b/libavcodec/libvpxenc.c
> > @@ -510,6 +510,63 @@ static void set_color_range(AVCodecContext *avctx)
> >  #endif
> >  #endif
> >
> > +/**
> > + * Set the target bitrate to VPX library default. Also set CRF to 32 if 
> > needed.
> > + */
> > +static void set_vp8_defaults(AVCodecContext *avctx,
> > + struct vpx_codec_enc_cfg *enccfg) {
>
> Indent should be 4 and the brace for a function on a new line [1].
>

Will send a patch with this fixed.

> > [...]
> > +
> > +/**
> > + * Called when the bitrate is not set. It sets appropriate default values 
> > for
> > + * bit-rate and CRF.
>
> 'bitrate' is more common in this file.
>

Ditto.

> > [...]
> > diff --git a/libavcodec/version.h b/libavcodec/version.h
> > index e70ebc0c70..cda6dbae47 100644
> > --- a/libavcodec/version.h
> > +++ b/libavcodec/version.h
> > @@ -29,7 +29,7 @@
> >
> >  #define LIBAVCODEC_VERSION_MAJOR  58
> >  #define LIBAVCODEC_VERSION_MINOR  55
> > -#define LIBAVCODEC_VERSION_MICRO 101
> > +#define LIBAVCODEC_VERSION_MICRO 102
> >
>
> This no longer applies cleanly.
>

Ditto.

> [1] http://ffmpeg.org/developer.html#Code-formatting-conventions

Thank you for the link. I've updated my editor based on the
recommendations there.
___
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 v1 3/4] avformat/hlsenc: replace with av_dirname to get the directory

2019-09-15 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/hlsenc.c | 22 ++
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index b5681a85c7..21fb9d7a1d 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -486,7 +486,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 float playlist_duration = 0.0f;
 int ret = 0, path_size, sub_path_size;
 int segment_cnt = 0;
-char *dirname = NULL, *p, *sub_path;
+char *dirname = NULL, *sub_path;
 char *path = NULL;
 char *vtt_dirname = NULL;
 AVDictionary *options = NULL;
@@ -517,13 +517,8 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 }
 
 if (segment && !hls->use_localtime_mkdir) {
-dirname = hls->segment_filename ? av_strdup(hls->segment_filename): 
av_strdup(vs->avf->url);
-if (!dirname) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-p = (char *)av_basename(dirname);
-*p = '\0';
+char *dirname_r = hls->segment_filename ? 
av_strdup(hls->segment_filename): av_strdup(vs->avf->url);
+dirname = (char*)av_dirname(dirname_r);
 }
 
 /* if %v is present in the file's directory
@@ -542,7 +537,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 }
 }
 
-av_free(dirname);
+av_freep(&dirname);
 dirname = r_dirname;
 }
 
@@ -578,13 +573,8 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 }
 
 if ((segment->sub_filename[0] != '\0')) {
-vtt_dirname = av_strdup(vs->vtt_avf->url);
-if (!vtt_dirname) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-p = (char *)av_basename(vtt_dirname);
-*p = '\0';
+char *vtt_dirname_r = av_strdup(vs->vtt_avf->url);
+vtt_dirname = (char*)av_dirname(vtt_dirname_r);
 sub_path_size = strlen(segment->sub_filename) + 1 + 
strlen(vtt_dirname);
 sub_path = av_malloc(sub_path_size);
 if (!sub_path) {
-- 
2.21.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 v1 4/4] avformat/hlsenc: replace with av_freep for all av_free

2019-09-15 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/hlsenc.c | 64 ++--
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 21fb9d7a1d..6dc92b786e 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -590,7 +590,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 if ((ret = vs->vtt_avf->io_open(vs->vtt_avf, &out, sub_path, 
AVIO_FLAG_WRITE, &options)) < 0) {
 if (hls->ignore_io_errors)
 ret = 0;
-av_free(sub_path);
+av_freep(&sub_path);
 goto fail;
 }
 ff_format_io_close(vs->vtt_avf, &out);
@@ -598,18 +598,18 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: 
%s\n",
sub_path, strerror(errno));
 }
-av_free(sub_path);
+av_freep(&sub_path);
 }
 av_freep(&path);
 previous_segment = segment;
 segment = previous_segment->next;
-av_free(previous_segment);
+av_freep(&previous_segment);
 }
 
 fail:
-av_free(path);
-av_free(dirname);
-av_free(vtt_dirname);
+av_freep(&path);
+av_freep(&dirname);
+av_freep(&vtt_dirname);
 
 return ret;
 }
@@ -887,7 +887,7 @@ static int sls_flags_filename_process(struct 
AVFormatContext *s, HLSContext *hls
 strlen(vs->current_segment_final_filename_fmt)) {
 char * new_url = av_strdup(vs->current_segment_final_filename_fmt);
 if (!new_url) {
-av_free(en);
+av_freep(&en);
 return AVERROR(ENOMEM);
 }
 ff_format_set_url(vs->avf, new_url);
@@ -898,8 +898,8 @@ static int sls_flags_filename_process(struct 
AVFormatContext *s, HLSContext *hls
"Invalid second level segment filename template '%s', "
"you can try to remove second_level_segment_size 
flag\n",
vs->avf->url);
-av_free(filename);
-av_free(en);
+av_freep(&filename);
+av_freep(&en);
 return AVERROR(EINVAL);
 }
 ff_format_set_url(vs->avf, filename);
@@ -912,8 +912,8 @@ static int sls_flags_filename_process(struct 
AVFormatContext *s, HLSContext *hls
"Invalid second level segment filename template '%s', "
"you can try to remove second_level_segment_time 
flag\n",
vs->avf->url);
-av_free(filename);
-av_free(en);
+av_freep(&filename);
+av_freep(&en);
 return AVERROR(EINVAL);
 }
 ff_format_set_url(vs->avf, filename);
@@ -985,7 +985,7 @@ static int sls_flag_use_localtime_filename(AVFormatContext 
*oc, HLSContext *c, V
 av_log(c, AV_LOG_ERROR, "Invalid second level segment filename 
template '%s', "
 "you can try to remove second_level_segment_index flag\n",
oc->url);
-av_free(filename);
+av_freep(&filename);
 return AVERROR(EINVAL);
 }
 ff_format_set_url(oc, filename);
@@ -999,7 +999,7 @@ static int sls_flag_use_localtime_filename(AVFormatContext 
*oc, HLSContext *c, V
 av_log(c, AV_LOG_ERROR, "Invalid second level segment filename 
template '%s', "
 "you can try to remove second_level_segment_size 
flag\n",
oc->url);
-av_free(filename);
+av_freep(&filename);
 return AVERROR(EINVAL);
 }
 ff_format_set_url(oc, filename);
@@ -1010,7 +1010,7 @@ static int 
sls_flag_use_localtime_filename(AVFormatContext *oc, HLSContext *c, V
 av_log(c, AV_LOG_ERROR, "Invalid second level segment filename 
template '%s', "
 "you can try to remove second_level_segment_time 
flag\n",
oc->url);
-av_free(filename);
+av_freep(&filename);
 return AVERROR(EINVAL);
 }
 ff_format_set_url(oc, filename);
@@ -1098,7 +1098,7 @@ static int hls_append_segment(struct AVFormatContext *s, 
HLSContext *hls,
 if ((ret = hls_delete_old_segments(s, hls, vs)) < 0)
 return ret;
 } else
-av_free(en);
+av_freep(&en);
 } else
 vs->nb_entries++;
 
@@ -1207,7 +1207,7 @@ static void hls_free_segments(HLSSegment *p)
 while (p) {
 en = p;
 p = p->next;
-av_free(en);
+av_freep(&en);
 }
 }
 
@@ -1574,7 +1574,7 @@ static int hls_start(AVFormatContext *s, VariantS

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

2019-09-15 Thread lance . lmwang
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 ".";
 
+p = strrchr(path, '/');
 #if HAVE_DOS_PATHS
 char *q = strrchr(path, '\\');
 char *d = strchr(path, ':');
@@ -274,11 +278,11 @@ const char *av_basename(const char *path)
 
 const char *av_dirname(char *path)
 {
-char *p = strrchr(path, '/');
+char *p = path != NULL ? strrchr(path, '/') : NULL;
 
 #if HAVE_DOS_PATHS
-char *q = strrchr(path, '\\');
-char *d = strchr(path, ':');
+char *q = path != NULL ? strrchr(path, '\\') : NULL;
+char *d = path != NULL ? strchr(path, ':')  : NULL;;
 
 d = d ? d + 1 : d;
 
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index 37dd4e2da0..274335cfb9 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -274,16 +274,21 @@ char *av_strireplace(const char *str, const char *from, 
const char *to);
 
 /**
  * Thread safe basename.
- * @param path the path, on DOS both \ and / are considered separators.
+ * @param path the string to parse, on DOS both \ and / are considered 
separators.
  * @return pointer to the basename substring.
+ * If path does not contain a slash, the function returns a copy of path.
+ * If path is a NULL pointer or points to an empty string, a pointer
+ * to a string "." is returned.
  */
 const char *av_basename(const char *path);
 
 /**
  * Thread safe dirname.
- * @param path the path, on DOS both \ and / are considered separators.
- * @return the path with the separator replaced by the string terminator or 
".".
- * @note the function may change the input string.
+ * @param path the string to parse, on DOS both \ and / are considered 
separators.
+ * @return A pointer to a string that's the parent directory of path.
+ * If path is a NULL pointer or points to an empty string, a pointer
+ * to a string "." is returned.
+ * @note the function may modify the contents of the path, so copies should be 
passed.
  */
 const char *av_dirname(char *path);
 
-- 
2.21.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 6/6] Add myself as v210enc, v210dec maintainer

2019-09-15 Thread Limin Wang


Ping, please give comments, I have submit some patches for v210enc and
v210dec and nobody give feedback except Michael Niedermayer. I'm
request to be maintainer of them, 

Below is all of patches submited:
https://patchwork.ffmpeg.org/project/ffmpeg/list/?submitter=669&state=&q=&archive=&delegate=

Below is the accept patches:
[lmwang@vpn ffmpeg]$ git shortlog -ns |grep "Limin Wang"
38  Limin Wang

Also I hope to get push access to git repo so that I can summit some pending 
patches.


Thanks,
Limin


On Thu, Aug 29, 2019 at 09:27:12AM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7f60ef0021..4110d38354 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -243,6 +243,7 @@ Codecs:
>tta.c Alex Beregszaszi, Jaikrishnan Menon
>ttaenc.c  Paul B Mahol
>txd.c Ivo van Poorten
> +  v210enc.c, v210dec.c  Limin Wang
>v4l2_*Jorge Ramirez-Ortiz
>vc2*  Rostislav Pehlivanov
>vcr1.cMichael Niedermayer
> -- 
> 2.21.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 v4 1/2] libavuitl: add A2R10G10B10 & A2B10G10R10

2019-09-15 Thread Zhou, Zachary


> -Original Message-
> From: Fu, Linjie
> Sent: Wednesday, September 11, 2019 1:54 PM
> To: FFmpeg development discussions and patches 
> Cc: Zhou, Zachary 
> Subject: RE: [FFmpeg-devel] [PATCH v4 1/2] libavuitl: add A2R10G10B10 &
> A2B10G10R10
> 
> > -Original Message-
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> > Of Zachary Zhou
> > Sent: Wednesday, September 11, 2019 13:40
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Zhou, Zachary 
> > Subject: [FFmpeg-devel] [PATCH v4 1/2] libavuitl: add A2R10G10B10 &
> > A2B10G10R10
> >
> > ---
> >  libavutil/hwcontext_vaapi.c | 6 ++
> >  libavutil/pixfmt.h  | 3 +++
> >  2 files changed, 9 insertions(+)
> 
> Didn't see the difference compared with your V1 patch:
> https://patchwork.ffmpeg.org/patch/14998/
> 
> Is there something mixed up?

Thanks Linjie for the review, Yes, they are same.
only reason for the V1 here is I want to the V2 patch build get passed.

> 
> - linjie
___
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 v4 2/2] avfilter: Add tonemap vaapi filter

2019-09-15 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Moritz
> Barsnick
> Sent: Wednesday, September 11, 2019 3:56 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v4 2/2] avfilter: Add tonemap vaapi filter
> 
> On Wed, Sep 11, 2019 at 13:39:56 +0800, Zachary Zhou wrote:
> > +@section tonemap_vappi
> ^
> Typo - the filter has a different name.

Thank you for the review, will do the change.
- Zachary

> 
> 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".

[FFmpeg-devel] [PATCH v1 2/4] avformat/hlsenc: remove the unnecessary null pointer check

2019-09-15 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/hlsenc.c | 31 ++-
 1 file changed, 2 insertions(+), 29 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 1f2bdfbe4d..b5681a85c7 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1613,16 +1613,13 @@ static int hls_start(AVFormatContext *s, VariantStream 
*vs)
 if (c->use_localtime_mkdir) {
 const char *dir;
 char *fn_copy = av_strdup(oc->url);
-if (!fn_copy) {
-return AVERROR(ENOMEM);
-}
 dir = av_dirname(fn_copy);
 if (ff_mkdir_p(dir) == -1 && errno != EEXIST) {
 av_log(oc, AV_LOG_ERROR, "Could not create directory %s 
with use_localtime_mkdir\n", dir);
-av_free(fn_copy);
+av_freep(&fn_copy);
 return AVERROR(errno);
 }
-av_free(fn_copy);
+av_freep(&fn_copy);
 }
 } else {
 char *filename = NULL;
@@ -1784,11 +1781,6 @@ static int validate_name(int nb_vs, const char *fn)
 }
 
 fn_dup = av_strdup(fn);
-if (!fn_dup) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-
 filename = av_basename(fn);
 subdir_name = av_dirname(fn_dup);
 
@@ -1818,11 +1810,6 @@ static int format_name(const char *buf, char **s, int 
index, const char *varname
 int ret = 0;
 
 orig_buf_dup = av_strdup(buf);
-if (!orig_buf_dup) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-
 if (!av_stristr(buf, "%v")) {
 *s = orig_buf_dup;
 return ret;
@@ -1846,11 +1833,6 @@ static int format_name(const char *buf, char **s, int 
index, const char *varname
 /* if %v is present in the file's directory, create sub-directory */
 if (av_stristr(dir, "%v") && proto && !strcmp(proto, "file")) {
 mod_buf_dup = av_strdup(*s);
-if (!mod_buf_dup) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-
 dir = av_dirname(mod_buf_dup);
 if (ff_mkdir_p(dir) == -1 && errno != EEXIST) {
 ret = AVERROR(errno);
@@ -2151,11 +2133,6 @@ static int update_master_pl_info(AVFormatContext *s)
 int ret = 0;
 
 fn1 = av_strdup(s->url);
-if (!fn1) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-
 dir = av_dirname(fn1);
 
 /**
@@ -2164,10 +2141,6 @@ static int update_master_pl_info(AVFormatContext *s)
  */
 if (dir && av_stristr(av_basename(dir), "%v")) {
 fn2 = av_strdup(dir);
-if (!fn2) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
 dir = av_dirname(fn2);
 }
 
-- 
2.21.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-15 Thread Liu Steven


> 在 2019年9月16日,上午9:03,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 ".";
> 
> +p = strrchr(path, '/');
> #if HAVE_DOS_PATHS
> char *q = strrchr(path, '\\');
> char *d = strchr(path, ':');
> @@ -274,11 +278,11 @@ const char *av_basename(const char *path)
> 
> const char *av_dirname(char *path)
> {
> -char *p = strrchr(path, '/');
> +char *p = path != NULL ? strrchr(path, '/') : NULL;
> 
> #if HAVE_DOS_PATHS
> -char *q = strrchr(path, '\\');
> -char *d = strchr(path, ':');
> +char *q = path != NULL ? strrchr(path, '\\') : NULL;
> +char *d = path != NULL ? strchr(path, ':')  : NULL;;
remove one ‘;'
> 
> d = d ? d + 1 : d;
> 
> diff --git a/libavutil/avstring.h b/libavutil/avstring.h
> index 37dd4e2da0..274335cfb9 100644
> --- a/libavutil/avstring.h
> +++ b/libavutil/avstring.h
> @@ -274,16 +274,21 @@ char *av_strireplace(const char *str, const char *from, 
> const char *to);
> 
> /**
>  * Thread safe basename.
> - * @param path the path, on DOS both \ and / are considered separators.
> + * @param path the string to parse, on DOS both \ and / are considered 
> separators.
>  * @return pointer to the basename substring.
> + * If path does not contain a slash, the function returns a copy of path.
> + * If path is a NULL pointer or points to an empty string, a pointer
> + * to a string "." is returned.
>  */
> const char *av_basename(const char *path);
> 
> /**
>  * Thread safe dirname.
> - * @param path the path, on DOS both \ and / are considered separators.
> - * @return the path with the separator replaced by the string terminator or 
> ".".
> - * @note the function may change the input string.
> + * @param path the string to parse, on DOS both \ and / are considered 
> separators.
> + * @return A pointer to a string that's the parent directory of path.
> + * If path is a NULL pointer or points to an empty string, a pointer
> + * to a string "." is returned.
> + * @note the function may modify the contents of the path, so copies should 
> be passed.
>  */
> const char *av_dirname(char *path);
> 
> -- 
> 2.21.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 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 6/6] Add myself as v210enc, v210dec maintainer

2019-09-15 Thread Liu Steven


> 在 2019年8月29日,上午9:27,lance.lmw...@gmail.com 写道:
> 
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
> MAINTAINERS | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7f60ef0021..4110d38354 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -243,6 +243,7 @@ Codecs:
>   tta.c Alex Beregszaszi, Jaikrishnan Menon
>   ttaenc.c  Paul B Mahol
>   txd.c Ivo van Poorten
> +  v210enc.c, v210dec.c  Limin Wang
>   v4l2_*Jorge Ramirez-Ortiz
>   vc2*  Rostislav Pehlivanov
>   vcr1.cMichael Niedermayer
> -- 
> 2.21.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".



LGTM


Thanks
Steven

___
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 2/4] avformat/hlsenc: remove the unnecessary null pointer check

2019-09-15 Thread Liu Steven


> 在 2019年9月16日,上午9:03,lance.lmw...@gmail.com 写道:
> 
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
> libavformat/hlsenc.c | 31 ++-
> 1 file changed, 2 insertions(+), 29 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 1f2bdfbe4d..b5681a85c7 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1613,16 +1613,13 @@ static int hls_start(AVFormatContext *s, 
> VariantStream *vs)
> if (c->use_localtime_mkdir) {
> const char *dir;
> char *fn_copy = av_strdup(oc->url);
> -if (!fn_copy) {
> -return AVERROR(ENOMEM);
> -}
> dir = av_dirname(fn_copy);
> if (ff_mkdir_p(dir) == -1 && errno != EEXIST) {
> av_log(oc, AV_LOG_ERROR, "Could not create directory %s 
> with use_localtime_mkdir\n", dir);
> -av_free(fn_copy);
> +av_freep(&fn_copy);
> return AVERROR(errno);
> }
> -av_free(fn_copy);
> +av_freep(&fn_copy);
> }
> } else {
> char *filename = NULL;
> @@ -1784,11 +1781,6 @@ static int validate_name(int nb_vs, const char *fn)
> }
> 
> fn_dup = av_strdup(fn);
> -if (!fn_dup) {
> -ret = AVERROR(ENOMEM);
> -goto fail;
> -}
> -
> filename = av_basename(fn);
> subdir_name = av_dirname(fn_dup);
> 
> @@ -1818,11 +1810,6 @@ static int format_name(const char *buf, char **s, int 
> index, const char *varname
> int ret = 0;
> 
> orig_buf_dup = av_strdup(buf);
> -if (!orig_buf_dup) {
> -ret = AVERROR(ENOMEM);
> -goto fail;
> -}
> -

will segment fault when remove these five lines;
> if (!av_stristr(buf, "%v")) {
> *s = orig_buf_dup;
> return ret;
> @@ -1846,11 +1833,6 @@ static int format_name(const char *buf, char **s, int 
> index, const char *varname
> /* if %v is present in the file's directory, create sub-directory */
> if (av_stristr(dir, "%v") && proto && !strcmp(proto, "file")) {
> mod_buf_dup = av_strdup(*s);
> -if (!mod_buf_dup) {
> -ret = AVERROR(ENOMEM);
> -goto fail;
> -}
> -
> dir = av_dirname(mod_buf_dup);
> if (ff_mkdir_p(dir) == -1 && errno != EEXIST) {
> ret = AVERROR(errno);
> @@ -2151,11 +2133,6 @@ static int update_master_pl_info(AVFormatContext *s)
> int ret = 0;
> 
> fn1 = av_strdup(s->url);
> -if (!fn1) {
> -ret = AVERROR(ENOMEM);
> -goto fail;
> -}
> -
> dir = av_dirname(fn1);
> 
> /**
> @@ -2164,10 +2141,6 @@ static int update_master_pl_info(AVFormatContext *s)
>  */
> if (dir && av_stristr(av_basename(dir), "%v")) {
> fn2 = av_strdup(dir);
> -if (!fn2) {
> -ret = AVERROR(ENOMEM);
> -goto fail;
> -}
> dir = av_dirname(fn2);
> }
> 
> -- 
> 2.21.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”.

BTW,

command line:
./ffmpeg -re -f lavfi -i testsrc2 -g 25 -r:v 25 -f hls -hls_time 2  -strftime 1 
-strftime_mkdir 1 -hls_segment_filename "http://127.0.0.1/output_liuqi_%s.ts"; 
http://127.0.0.1/output_liuqi.m3u8
it incorrent result when strdup failed.

before patch it should get no memory error message.

after it will not get error message, but it create file at the root dir on 
server.

StevenLiu:dash StevenLiu$ sudo cat /usr/local/nginx/html/output_liuqi.m3u8 
;sudo ls /usr/local/nginx/html/output_liuqi*.ts
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:111
#EXTINF:2.00,
http://127.0.0.1/output_liuqi_1568603743.ts
#EXTINF:2.00,
http://127.0.0.1/output_liuqi_1568603745.ts
#EXTINF:1.64,
http://127.0.0.1/output_liuqi_1568603747.ts
#EXTINF:2.00,
http://127.0.0.1/output_liuqi_1568603748.ts
#EXTINF:2.00,
http://127.0.0.1/output_liuqi_1568603750.ts

/usr/local/nginx/html/output_liuqi_1568603519.ts
/usr/local/nginx/html/output_liuqi_1568603579.ts
/usr/local/nginx/html/output_liuqi_1568603636.ts
/usr/local/nginx/html/output_liuqi_1568603695.ts
/usr/local/nginx/html/output_liuqi_1568603522.ts
/usr/local/nginx/html/output_liuqi_1568603580.ts
/usr/local/nginx/html/output_liuqi_1568603639.ts
/usr/local/nginx/html/output_liuqi_1568603697.ts
/usr/local/nginx/html/output_liuqi_1568603524.ts
/usr/local/nginx/html/output_liuqi_1568603582.ts
/usr/local/nginx/html/output_liuqi_1568603641.ts
/usr/local/nginx/html/output_liuqi_1568603699.ts
/usr/local/nginx/html/output_liuqi_1568603526.ts
/usr/local/nginx/html/output_liuqi_1568603584.ts