Re: [FFmpeg-devel] [PATCH] avformat/wtvdec: Fix reading OLE dates on BE

2021-02-27 Thread Peter Ross
On Sun, Feb 28, 2021 at 04:01:21AM +0100, Andreas Rheinhardt wrote:
> The WTV demuxer's oledata_to_iso8601 reads a value via avio_rl64
> and reinterprets it as a double via av_int2double. This does not
> work on big endian systems. So swap it to native endianness before
> av_int2double.
> 
> law-and-order-partial.wtv from the FATE-suite exhibited the problem.
> 
> Thanks-to: Andriy Gelman 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/wtvdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
> index 7def9d2348..bb84e5dc9f 100644
> --- a/libavformat/wtvdec.c
> +++ b/libavformat/wtvdec.c
> @@ -418,7 +418,7 @@ static int crazytime_to_iso8601(char *buf, int buf_size, 
> int64_t value)
>   */
>  static int oledate_to_iso8601(char *buf, int buf_size, int64_t value)
>  {
> -time_t t = (av_int2double(value) - 25569.0) * 86400;
> +time_t t = (av_int2double(av_le2ne64(value)) - 25569.0) * 86400;
>  struct tm tmbuf;
>  struct tm *tm= gmtime_r(, );
>  if (!tm)
> -- 
> 2.27.0

ok, please apply.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


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] avformat/wtvdec: Fix reading OLE dates on BE

2021-02-27 Thread Andreas Rheinhardt
The WTV demuxer's oledata_to_iso8601 reads a value via avio_rl64
and reinterprets it as a double via av_int2double. This does not
work on big endian systems. So swap it to native endianness before
av_int2double.

law-and-order-partial.wtv from the FATE-suite exhibited the problem.

Thanks-to: Andriy Gelman 
Signed-off-by: Andreas Rheinhardt 
---
 libavformat/wtvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 7def9d2348..bb84e5dc9f 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -418,7 +418,7 @@ static int crazytime_to_iso8601(char *buf, int buf_size, 
int64_t value)
  */
 static int oledate_to_iso8601(char *buf, int buf_size, int64_t value)
 {
-time_t t = (av_int2double(value) - 25569.0) * 86400;
+time_t t = (av_int2double(av_le2ne64(value)) - 25569.0) * 86400;
 struct tm tmbuf;
 struct tm *tm= gmtime_r(, );
 if (!tm)
-- 
2.27.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] x11grab: capture a window instead of the whole screen

2021-02-27 Thread Andriy Gelman
On Mon, 22. Feb 17:53, sgerwk-at-aol@ffmpeg.org wrote:
> Hi,
> 
> On Sun, 21 Feb 2021, Andriy Gelman wrote:
> > Hi,
> > 
> > Thanks for updating the patch. Sorry for the delay in getting you some 
> > feedback..
> > 
> > When I tested with -show_mouse 1 -show_region 1 -window_id xx, the mouse and
> > border get drawn in the wrong place. There is around (0.6cm error). Can you
> > reproduce?
> > 
> 
> I didn't notice the problem because the wm I use places the top-level
> windows in a window of the same size - at position 0,0. Still, I could
> reproduce it by capturing a subwindow.
> 
> The problem was indeed what you suspected: geo->x,geo->y is the position
> inside the parent, but translate includes it already as it is the position
> within the root window.
> 
> > > From e13c1be7abd6989b3ad80fd8086fe6a0819fd810 Mon Sep 17 00:00:00 2001
> > > From: sgerwk 
> > > Date: Wed, 10 Feb 2021 17:36:00 +0100
> > > Subject: [PATCH] libavdevice/xcbgrab: option for grabbing a window 
> > > instead of
> > >  desktop
> > > 
> > > ---
> > >  doc/indevs.texi   | 14 +++-
> > >  libavdevice/xcbgrab.c | 79 ---
> > >  2 files changed, 72 insertions(+), 21 deletions(-)
> > > 
> > > diff --git a/doc/indevs.texi b/doc/indevs.texi
> > > index 3924d03..48fd2b1 100644
> > > --- a/doc/indevs.texi
> > > +++ b/doc/indevs.texi
> > > @@ -1564,8 +1564,20 @@ With @var{follow_mouse}:
> > >  ffmpeg -f x11grab -follow_mouse centered -show_region 1 -framerate 25 
> > > -video_size cif -i :0.0 out.mpg
> > >  @end example
> > > 
> > > +@item window_id
> > > +Grab this window, instead of the whole screen.
> > > +
> > > +The id of a window can be found by xwininfo(1), possibly with options 
> > > -tree and
> > > +-root.
> > > +
> > > +If the window is later enlarged, the new area is not recorded. Video 
> > > ends when
> > > +the window is closed, unmapped (i.e., iconified) or shrunk beyond the 
> > > video
> > > +size (which defaults to the initial window size).
> > > +
> > > +This option disables options @option{follow_mouse} and 
> > > @option{select_region}.
> > > +
> > >  @item video_size
> > > -Set the video frame size. Default is the full desktop.
> > > +Set the video frame size. Default is the full desktop or window.
> > > 
> > >  @item grab_x
> > >  @item grab_y
> > > diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
> > > index be5d5ea..7697090 100644
> > > --- a/libavdevice/xcbgrab.c
> > > +++ b/libavdevice/xcbgrab.c
> > > @@ -60,6 +60,8 @@ typedef struct XCBGrabContext {
> > >  AVRational time_base;
> > >  int64_t frame_duration;
> > > 
> > > +xcb_window_t window_id;
> > 
> > > +int win_x, win_y;
> > 
> > The position of the window is always recalculated so I don't think win_x and
> > win_y should be part of the of XCBGrabContext.
> > 
> 
> Done. Some functions now require win_x and win_y because they no longer
> find them in XCBGrabContext.
> 
> > >  int x, y;
> > >  int width, height;
> > >  int frame_size;
> > > @@ -82,6 +84,7 @@ typedef struct XCBGrabContext {
> > >  #define OFFSET(x) offsetof(XCBGrabContext, x)
> > >  #define D AV_OPT_FLAG_DECODING_PARAM
> > >  static const AVOption options[] = {
> > > +{ "window_id", "Window to capture", OFFSET(window_id), 
> > > AV_OPT_TYPE_INT, { .i64 = XCB_NONE }, 0, UINT32_MAX, D },
> > >  { "x", "Initial x coordinate.", OFFSET(x), AV_OPT_TYPE_INT, { .i64 = 
> > > 0 }, 0, INT_MAX, D },
> > >  { "y", "Initial y coordinate.", OFFSET(y), AV_OPT_TYPE_INT, { .i64 = 
> > > 0 }, 0, INT_MAX, D },
> > >  { "grab_x", "Initial x coordinate.", OFFSET(x), AV_OPT_TYPE_INT, { 
> > > .i64 = 0 }, 0, INT_MAX, D },
> > > @@ -157,7 +160,7 @@ static int xcbgrab_frame(AVFormatContext *s, AVPacket 
> > > *pkt)
> > >  XCBGrabContext *c = s->priv_data;
> > >  xcb_get_image_cookie_t iq;
> > >  xcb_get_image_reply_t *img;
> > > -xcb_drawable_t drawable = c->screen->root;
> > > +xcb_drawable_t drawable = c->window_id;
> > >  xcb_generic_error_t *e = NULL;
> > >  uint8_t *data;
> > >  int length;
> > > @@ -267,7 +270,7 @@ static int xcbgrab_frame_shm(AVFormatContext *s, 
> > > AVPacket *pkt)
> > >  XCBGrabContext *c = s->priv_data;
> > >  xcb_shm_get_image_cookie_t iq;
> > >  xcb_shm_get_image_reply_t *img;
> > > -xcb_drawable_t drawable = c->screen->root;
> > > +xcb_drawable_t drawable = c->window_id;
> > >  xcb_generic_error_t *e = NULL;
> > >  AVBufferRef *buf;
> > >  xcb_shm_seg_t segment;
> > > @@ -355,17 +358,17 @@ static void xcbgrab_draw_mouse(AVFormatContext *s, 
> > > AVPacket *pkt,
> > >  cx = ci->x - ci->xhot;
> > >  cy = ci->y - ci->yhot;
> > > 
> > > -x = FFMAX(cx, gr->x);
> > > -y = FFMAX(cy, gr->y);
> > > +x = FFMAX(cx, gr->win_x + gr->x);
> > > +y = FFMAX(cy, gr->win_y + gr->y);
> > > 
> > > -w = FFMIN(cx + ci->width,  gr->x + gr->width)  - x;
> > > -h = FFMIN(cy + ci->height, gr->y + gr->height) - y;
> > 

Re: [FFmpeg-devel] [PATCH] Handle AVID MJPEG streams directly in the MJPEG decoder.

2021-02-27 Thread James Almer

On 2/27/2021 1:37 PM, James Almer wrote:

On 2/27/2021 1:33 PM, Michael Niedermayer wrote:

On Wed, Feb 24, 2021 at 11:25:42AM +0100, Anton Khirnov wrote:

AVID streams - currently handled by the AVRN decoder - can be (depending
on extradata contents) either MJPEG or raw video. To decode the MJPEG
variant, the AVRN decoder currently instantiates a MJPEG decoder
internally and forwards decoded frames to the caller (possibly after
cropping them).

This is suboptimal, because the AVRN decoder does not forward all the
features of the internal MJPEG decoder, such as direct rendering.
Handling such forwarding in a full and generic manner would be quite
hard, so it is simpler to just handle those streams in the MJPEG decoder
directly.

The AVRN decoder, which now handles only the raw streams, can now be
marked as supporting direct rendering.

This also removes the last remaining internal use of the obsolete
decoding API.
---
And now without the missing isom tag change. Thanks to Andreas for 
noticing.

---
  configure   |  1 -
  libavcodec/avrndec.c    | 71 +
  libavcodec/mjpegdec.c   | 11 +++
  libavcodec/version.h    |  2 +-
  libavformat/avidec.c    |  6 
  libavformat/isom_tags.c |  4 +--
  tests/fate/video.mak    |  2 +-
  7 files changed, 22 insertions(+), 75 deletions(-)


breaks:
./ffmpeg -vlowres 2 -i ~/tickets/162/avid.avi  -vframes 3 avrn.avi

The outputed image is several times bigger and looks as if it encodes 
random bits od memory


Can you try again with git head? I removed the max_lowres value since 
the avrn raw decoder doesn't support it, since it was pulled from the 
mjpeg version.


Ok, the above was unrelated since this sample is mjpeg, now raw.
The following however fixes it for me:


diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 79c7d6e6cf..8eed8eefe6 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2863,8 +2863,8 @@ the_end:
 if ((avctx->codec_tag == MKTAG('A', 'V', 'R', 'n') ||
  avctx->codec_tag == MKTAG('A', 'V', 'D', 'J')) &&
 avctx->coded_height > s->orig_height) {
-frame->height   = avctx->coded_height;
-frame->crop_top = frame->height - s->orig_height;
+frame->height   = AV_CEIL_RSHIFT(avctx->coded_height, avctx->lowres);
+frame->crop_top = frame->height - AV_CEIL_RSHIFT(s->orig_height, 
avctx->lowres);


But it may be an incomplete solution, since there's another similar 
check/assignment in ff_mjpeg_decode_sof() also added by 9e4225cf7f.

___
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] avformat/mvi: Check audio size for more overflows

2021-02-27 Thread Michael Niedermayer
Fixes: left shift of negative value -352256000
Fixes: 
30837/clusterfuzz-testcase-minimized-ffmpeg_dem_MVI_fuzzer-5755626262888448

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

diff --git a/libavformat/mvi.c b/libavformat/mvi.c
index 2d4b11aa32..cfdbe5d273 100644
--- a/libavformat/mvi.c
+++ b/libavformat/mvi.c
@@ -120,6 +120,10 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
 mvi->video_frame_size = (mvi->get_int)(pb);
 if (mvi->audio_size_left == 0)
 return AVERROR(EIO);
+if (mvi->audio_size_counter + 512 > UINT64_MAX - mvi->audio_frame_size 
||
+mvi->audio_size_counter + 512 + mvi->audio_frame_size >= 
((uint64_t)INT32_MAX) << MVI_FRAC_BITS)
+return AVERROR_INVALIDDATA;
+
 count = (mvi->audio_size_counter + mvi->audio_frame_size + 512) >> 
MVI_FRAC_BITS;
 if (count > mvi->audio_size_left)
 count = mvi->audio_size_left;
-- 
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 2/2] avformat/samidec: Deallocate hdr_buf

2021-02-27 Thread Michael Niedermayer
Fixes: memleak
Fixes: 
30841/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-4521799196999680

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

diff --git a/libavformat/samidec.c b/libavformat/samidec.c
index cf5076c7b8..d84f56ce6f 100644
--- a/libavformat/samidec.c
+++ b/libavformat/samidec.c
@@ -89,6 +89,7 @@ static int sami_read_header(AVFormatContext *s)
 sub = ff_subtitles_queue_insert(>q, buf.str, buf.len, 
!is_sync);
 if (!sub) {
 res = AVERROR(ENOMEM);
+av_bprint_finalize(_buf, NULL);
 goto end;
 }
 if (is_sync) {
@@ -97,6 +98,7 @@ static int sami_read_header(AVFormatContext *s)
 sub->pts  = p ? strtol(p, NULL, 10) : 0;
 if (sub->pts <= INT64_MIN/2 || sub->pts >= INT64_MAX/2) {
 res = AVERROR_PATCHWELCOME;
+av_bprint_finalize(_buf, NULL);
 goto end;
 }
 
-- 
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] avformat/movenccenc: Fix memory leak for muxing CENC-encrypted files

2021-02-27 Thread Marton Balint



On Sat, 27 Feb 2021, Вадим Бездушный wrote:


Ping.

This patch is very trivial and solves memory leak which makes CENC
encryption quite hard to use on high load services.


Thanks, applied.

Regards,
Marton



вс, 31 янв. 2021 г. в 16:52, Vadym Bezdushnyi :


Signed-off-by: Vadym Bezdushnyi 
---
Memory for auxillary_info was not freed after usage.

Leak can be reproduced with following commands:

Optionally, generate input video:
ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 input.mp4

Run ffmpeg with valgrind:
valgrind --leak-check=full --show-leak-kinds=all \
ffmpeg -y -i input.mp4 -vcodec copy -acodec copy \
-encryption_scheme cenc-aes-ctr \
-encryption_key  \
-encryption_kid  \
ffmpeg_encrypted.mp4

For test video which has duration of 10 sec, leak is 4 Kb.
For 100 sec video, leak will be 33 Kb. Most likely,
leaked memory will grow linearly to the number of input frames.

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

diff --git a/libavformat/movenccenc.c b/libavformat/movenccenc.c
index b91294f706..74f3c4ccfb 100644
--- a/libavformat/movenccenc.c
+++ b/libavformat/movenccenc.c
@@ -412,4 +412,6 @@ int ff_mov_cenc_init(MOVMuxCencContext* ctx, uint8_t*
encryption_key,
 void ff_mov_cenc_free(MOVMuxCencContext* ctx)
 {
 av_aes_ctr_free(ctx->aes_ctr);
+av_freep(>auxiliary_info);
+av_freep(>auxiliary_info_sizes);
 }
--
2.30.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 1/5] avdevice/alsa_dec: do not set codecpar frame_size

2021-02-27 Thread Marton Balint



On Sun, 21 Feb 2021, Marton Balint wrote:


Constant frame size is not guaranteed if the read call interrupted by a signal,
or if non-blocking mode is used.


Ping for the series.

Thanks,
Marton



Signed-off-by: Marton Balint 
---
libavdevice/alsa_dec.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/libavdevice/alsa_dec.c b/libavdevice/alsa_dec.c
index 36494e921c..6d568737b3 100644
--- a/libavdevice/alsa_dec.c
+++ b/libavdevice/alsa_dec.c
@@ -83,7 +83,6 @@ static av_cold int audio_read_header(AVFormatContext *s1)
st->codecpar->codec_id= codec_id;
st->codecpar->sample_rate = s->sample_rate;
st->codecpar->channels= s->channels;
-st->codecpar->frame_size = s->frame_size;
avpriv_set_pts_info(st, 64, 1, 100);  /* 64 bits pts in us */
/* microseconds instead of seconds, MHz instead of Hz */
s->timefilter = ff_timefilter_new(100.0 / s->sample_rate,
--
2.26.2

___
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 2/2] avformat/mxfdec: add support for getting product version number metadata

2021-02-27 Thread Marton Balint



On Sat, 20 Feb 2021, Marton Balint wrote:


Signed-off-by: Marton Balint 
---
libavformat/mxfdec.c | 3 +++
tests/ref/fate/mxf-d10-user-comments | 1 +
tests/ref/fate/mxf-probe-dnxhd   | 1 +
3 files changed, 5 insertions(+)


Ping, will apply soon.

Thanks,
Marton



diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 3ce83dde54..bb00838a3f 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2788,6 +2788,9 @@ static int mxf_read_identification_metadata(void *arg, 
AVIOContext *pb, int tag,
case 0x3C02:
SET_STR_METADATA(pb, "product_name", str);
break;
+case 0x3C03:
+SET_VERSION_METADATA(pb, "product_version_num", major, minor, 
tertiary, patch, release, str);
+break;
case 0x3C04:
SET_STR_METADATA(pb, "product_version", str);
break;
diff --git a/tests/ref/fate/mxf-d10-user-comments 
b/tests/ref/fate/mxf-d10-user-comments
index 69605d1906..13761fb0ce 100644
--- a/tests/ref/fate/mxf-d10-user-comments
+++ b/tests/ref/fate/mxf-d10-user-comments
@@ -17,6 +17,7 @@ TAG:uid=adab4424-2f25-4dc7-92ff-29bd000c
TAG:generation_uid=adab4424-2f25-4dc7-92ff-29bd000c0001
TAG:company_name=FATE-company
TAG:product_name=FATE-test
+TAG:product_version_num=0.0.0.0.0
TAG:product_version=3.14159
TAG:application_platform=Lavf
TAG:product_uid=adab4424-2f25-4dc7-92ff-29bd000c0002
diff --git a/tests/ref/fate/mxf-probe-dnxhd b/tests/ref/fate/mxf-probe-dnxhd
index 8b1add0374..274dcc47d9 100644
--- a/tests/ref/fate/mxf-probe-dnxhd
+++ b/tests/ref/fate/mxf-probe-dnxhd
@@ -177,6 +177,7 @@ TAG:toolkit_version_num=1.1.0.0.0
TAG:modification_date=2016-09-18T19:25:25.00Z
TAG:product_uid=acfbf03a-4f42-a231-d0b7-c06ecd3d4ad7
TAG:product_version=Unknown version
+TAG:product_version_num=8.6.0.0.1
TAG:product_name=Avid Media Composer 8.6.3.43955
TAG:company_name=Avid Technology, Inc.
TAG:material_package_umid=0x060A2B340101010101010F00130057DEEA1570665313060E2B347F7F2A80
--
2.26.2

___
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 1/3] avfilter/avf_showcqt: use av_gettime_relative() instead of av_gettime()

2021-02-27 Thread Marton Balint


On Sun, 7 Feb 2021, Marton Balint wrote:


av_gettime_relative() is using the monotonic clock therefore more suitable for
relative time calculations.


Applied.

Regards,
Marton



Signed-off-by: Marton Balint 
---
libavfilter/avf_showcqt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index 115174a9b4..dba1f089ee 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -1133,11 +1133,11 @@ static int plot_cqt(AVFilterContext *ctx, AVFrame 
**frameout)
int64_t last_time, cur_time;

#define UPDATE_TIME(t) \
-cur_time = av_gettime(); \
+cur_time = av_gettime_relative(); \
t += cur_time - last_time; \
last_time = cur_time

-last_time = av_gettime();
+last_time = av_gettime_relative();

memcpy(s->fft_result, s->fft_data, s->fft_len * sizeof(*s->fft_data));
if (s->attack_data) {
--
2.26.2

___
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 2/3] avdevice/timefilter: remove obsolete comments from the docs

2021-02-27 Thread Marton Balint



On Sun, 7 Feb 2021, Nicolas George wrote:


Marton Balint (12021-02-07):

Also rename the parameters of the function to match with the implementation.

Signed-off-by: Marton Balint 
---
 libavdevice/timefilter.h | 15 +--
 1 file changed, 1 insertion(+), 14 deletions(-)


Probably ok, I do not remember correcly enough.


Thanks, applied.

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] [FFmpeg-cvslog] avcodec/avrndec: remove max_lowres value

2021-02-27 Thread James Almer

On 2/27/2021 3:11 PM, Carl Eugen Hoyos wrote:

Am Sa., 27. Feb. 2021 um 15:25 Uhr schrieb James Almer :


ffmpeg | branch: master | James Almer  | Sat Feb 27 00:12:18 
2021 -0300| [0c902a61471a2f45e1c7159bd77146d2b499abb3] | committer: James Almer

avcodec/avrndec: remove max_lowres value

The decoder does not support lowres since 9e4225cf7f.


Wouldn't the correct resolution have been to revert 9e4225cf7f
or do I misunderstand the process?


If you mean the regression Michael noticed, I pushed this before his 
email. I thought it might have perhaps fixed the regression, but after 
looking at it i realized i was wrong since the sample that broke is a 
mjpeg one and not a raw one, so this decoder isn't used for it.

___
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] [FFmpeg-cvslog] avcodec/avrndec: remove max_lowres value

2021-02-27 Thread Carl Eugen Hoyos
Am Sa., 27. Feb. 2021 um 15:25 Uhr schrieb James Almer :
>
> ffmpeg | branch: master | James Almer  | Sat Feb 27 
> 00:12:18 2021 -0300| [0c902a61471a2f45e1c7159bd77146d2b499abb3] | committer: 
> James Almer
>
> avcodec/avrndec: remove max_lowres value
>
> The decoder does not support lowres since 9e4225cf7f.

Wouldn't the correct resolution have been to revert 9e4225cf7f
or do I misunderstand the process?

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] [PATCH] avformat/movenccenc: Fix memory leak for muxing CENC-encrypted files

2021-02-27 Thread Вадим Бездушный
Ping.

This patch is very trivial and solves memory leak which makes CENC
encryption quite hard to use on high load services.

вс, 31 янв. 2021 г. в 16:52, Vadym Bezdushnyi :

> Signed-off-by: Vadym Bezdushnyi 
> ---
> Memory for auxillary_info was not freed after usage.
>
> Leak can be reproduced with following commands:
>
> Optionally, generate input video:
> ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 input.mp4
>
> Run ffmpeg with valgrind:
> valgrind --leak-check=full --show-leak-kinds=all \
> ffmpeg -y -i input.mp4 -vcodec copy -acodec copy \
> -encryption_scheme cenc-aes-ctr \
> -encryption_key  \
> -encryption_kid  \
> ffmpeg_encrypted.mp4
>
> For test video which has duration of 10 sec, leak is 4 Kb.
> For 100 sec video, leak will be 33 Kb. Most likely,
> leaked memory will grow linearly to the number of input frames.
>
>  libavformat/movenccenc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavformat/movenccenc.c b/libavformat/movenccenc.c
> index b91294f706..74f3c4ccfb 100644
> --- a/libavformat/movenccenc.c
> +++ b/libavformat/movenccenc.c
> @@ -412,4 +412,6 @@ int ff_mov_cenc_init(MOVMuxCencContext* ctx, uint8_t*
> encryption_key,
>  void ff_mov_cenc_free(MOVMuxCencContext* ctx)
>  {
>  av_aes_ctr_free(ctx->aes_ctr);
> +av_freep(>auxiliary_info);
> +av_freep(>auxiliary_info_sizes);
>  }
> --
> 2.30.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] Handle AVID MJPEG streams directly in the MJPEG decoder.

2021-02-27 Thread James Almer

On 2/27/2021 1:33 PM, Michael Niedermayer wrote:

On Wed, Feb 24, 2021 at 11:25:42AM +0100, Anton Khirnov wrote:

AVID streams - currently handled by the AVRN decoder - can be (depending
on extradata contents) either MJPEG or raw video. To decode the MJPEG
variant, the AVRN decoder currently instantiates a MJPEG decoder
internally and forwards decoded frames to the caller (possibly after
cropping them).

This is suboptimal, because the AVRN decoder does not forward all the
features of the internal MJPEG decoder, such as direct rendering.
Handling such forwarding in a full and generic manner would be quite
hard, so it is simpler to just handle those streams in the MJPEG decoder
directly.

The AVRN decoder, which now handles only the raw streams, can now be
marked as supporting direct rendering.

This also removes the last remaining internal use of the obsolete
decoding API.
---
And now without the missing isom tag change. Thanks to Andreas for noticing.
---
  configure   |  1 -
  libavcodec/avrndec.c| 71 +
  libavcodec/mjpegdec.c   | 11 +++
  libavcodec/version.h|  2 +-
  libavformat/avidec.c|  6 
  libavformat/isom_tags.c |  4 +--
  tests/fate/video.mak|  2 +-
  7 files changed, 22 insertions(+), 75 deletions(-)


breaks:
./ffmpeg -vlowres 2 -i ~/tickets/162/avid.avi  -vframes 3 avrn.avi

The outputed image is several times bigger and looks as if it encodes random 
bits od memory


Can you try again with git head? I removed the max_lowres value since 
the avrn raw decoder doesn't support it, since it was pulled from the 
mjpeg version.




thx

[...]


___
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] Handle AVID MJPEG streams directly in the MJPEG decoder.

2021-02-27 Thread Michael Niedermayer
On Wed, Feb 24, 2021 at 11:25:42AM +0100, Anton Khirnov wrote:
> AVID streams - currently handled by the AVRN decoder - can be (depending
> on extradata contents) either MJPEG or raw video. To decode the MJPEG
> variant, the AVRN decoder currently instantiates a MJPEG decoder
> internally and forwards decoded frames to the caller (possibly after
> cropping them).
> 
> This is suboptimal, because the AVRN decoder does not forward all the
> features of the internal MJPEG decoder, such as direct rendering.
> Handling such forwarding in a full and generic manner would be quite
> hard, so it is simpler to just handle those streams in the MJPEG decoder
> directly.
> 
> The AVRN decoder, which now handles only the raw streams, can now be
> marked as supporting direct rendering.
> 
> This also removes the last remaining internal use of the obsolete
> decoding API.
> ---
> And now without the missing isom tag change. Thanks to Andreas for noticing.
> ---
>  configure   |  1 -
>  libavcodec/avrndec.c| 71 +
>  libavcodec/mjpegdec.c   | 11 +++
>  libavcodec/version.h|  2 +-
>  libavformat/avidec.c|  6 
>  libavformat/isom_tags.c |  4 +--
>  tests/fate/video.mak|  2 +-
>  7 files changed, 22 insertions(+), 75 deletions(-)

breaks:
./ffmpeg -vlowres 2 -i ~/tickets/162/avid.avi  -vframes 3 avrn.avi

The outputed image is several times bigger and looks as if it encodes random 
bits od memory

thx

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


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/x86: add cfhdenc SIMD

2021-02-27 Thread Paul B Mahol
On Sat, Feb 27, 2021 at 3:33 PM James Almer  wrote:

> On 2/27/2021 11:05 AM, Paul B Mahol wrote:
> > Signed-off-by: Paul B Mahol 
> > ---
> >   libavcodec/cfhdencdsp.c  |   3 +
> >   libavcodec/x86/Makefile  |   2 +
> >   libavcodec/x86/cfhdencdsp.asm| 435 +++
> >   libavcodec/x86/cfhdencdsp_init.c |  48 
> >   4 files changed, 488 insertions(+)
> >   create mode 100644 libavcodec/x86/cfhdencdsp.asm
> >   create mode 100644 libavcodec/x86/cfhdencdsp_init.c
> >
> > diff --git a/libavcodec/cfhdencdsp.c b/libavcodec/cfhdencdsp.c
> > index 0becb76d1d..b979e9e09a 100644
> > --- a/libavcodec/cfhdencdsp.c
> > +++ b/libavcodec/cfhdencdsp.c
> > @@ -73,4 +73,7 @@ av_cold void ff_cfhdencdsp_init(CFHDEncDSPContext *c)
> >   {
> >   c->horiz_filter = horiz_filter;
> >   c->vert_filter = vert_filter;
> > +
> > +if (ARCH_X86)
> > +ff_cfhdencdsp_init_x86(c);
> >   }
> > diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
> > index 884dc0c759..6361161180 100644
> > --- a/libavcodec/x86/Makefile
> > +++ b/libavcodec/x86/Makefile
> > @@ -51,6 +51,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+=
> x86/alacdsp_init.o
> >   OBJS-$(CONFIG_APNG_DECODER)+= x86/pngdsp_init.o
> >   OBJS-$(CONFIG_CAVS_DECODER)+= x86/cavsdsp.o
> >   OBJS-$(CONFIG_CFHD_DECODER)+= x86/cfhddsp_init.o
> > +OBJS-$(CONFIG_CFHD_ENCODER)+= x86/cfhdencdsp_init.o
> >   OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp_init.o
> x86/synth_filter_init.o
> >   OBJS-$(CONFIG_DNXHD_ENCODER)   += x86/dnxhdenc_init.o
> >   OBJS-$(CONFIG_EXR_DECODER) += x86/exrdsp_init.o
> > @@ -154,6 +155,7 @@ X86ASM-OBJS-$(CONFIG_ADPCM_G722_ENCODER) +=
> x86/g722dsp.o
> >   X86ASM-OBJS-$(CONFIG_ALAC_DECODER) += x86/alacdsp.o
> >   X86ASM-OBJS-$(CONFIG_APNG_DECODER) += x86/pngdsp.o
> >   X86ASM-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsidct.o
> > +X86ASM-OBJS-$(CONFIG_CFHD_ENCODER) += x86/cfhdencdsp.o
> >   X86ASM-OBJS-$(CONFIG_CFHD_DECODER) += x86/cfhddsp.o
> >   X86ASM-OBJS-$(CONFIG_DCA_DECODER)  += x86/dcadsp.o
> x86/synth_filter.o
> >   X86ASM-OBJS-$(CONFIG_DIRAC_DECODER)+= x86/diracdsp.o
>   \
> > diff --git a/libavcodec/x86/cfhdencdsp.asm
> b/libavcodec/x86/cfhdencdsp.asm
> > new file mode 100644
> > index 00..b0b094aa71
> > --- /dev/null
> > +++ b/libavcodec/x86/cfhdencdsp.asm
> > @@ -0,0 +1,435 @@
> >
> +;**
> > +;* x86-optimized functions for the CFHD encoder
> > +;* Copyright (c) 2021 Paul B Mahol
> > +;*
> > +;* This file is part of FFmpeg.
> > +;*
> > +;* FFmpeg is free software; you can redistribute it and/or
> > +;* modify it under the terms of the GNU Lesser General Public
> > +;* License as published by the Free Software Foundation; either
> > +;* version 2.1 of the License, or (at your option) any later version.
> > +;*
> > +;* FFmpeg is distributed in the hope that it will be useful,
> > +;* but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > +;* Lesser General Public License for more details.
> > +;*
> > +;* You should have received a copy of the GNU Lesser General Public
> > +;* License along with FFmpeg; if not, write to the Free Software
> > +;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> >
> +;**
> > +
> > +%include "libavutil/x86/x86util.asm"
> > +
> > +SECTION_RODATA
> > +
> > +pw_p1_n1:  dw  1, -1, 1, -1, 1, -1, 1, -1
> > +pw_n1_p1:  dw  -1, 1, -1, 1, -1, 1, -1, 1
> > +pw_p5_n11: dw  5, -11, 5, -11, 5, -11, 5, -11
> > +pw_n5_p11: dw -5, 11, -5, 11, -5, 11, -5, 11
> > +pw_p11_n5: dw 11, -5, 11, -5, 11, -5, 11, -5
> > +pw_n11_p5: dw -11, 5, -11, 5, -11, 5, -11, 5
> > +pd_4:  times 4 dd  4
> > +pw_n4: times 8 dw -4
> > +cextern pw_m1
> > +cextern pw_1
> > +cextern pw_4
> > +
> > +SECTION .text
>
> [...]
>
> > +
> > +%if ARCH_X86_64
> > +INIT_XMM sse2
> > +cglobal cfhdenc_vert_filter, 8, 11, 14, input, low, high, istride,
> lwidth, hwidth, width, height, x, y, pos
> > +movsxdifnidn  widthq, widthd
> > +movsxdifnidn heightq, heightd
>
> Why did you add this? The shl and sub below using a d suffix like in the
> previous version is enough to clear the upper bits.
>

ok


>
> > +
> > +shl  istrideq, 1
> > +
> > +shlwidthq, 1
> > +sub   heightq, 2
>
> Should be ok if tested and bitexact.
>

yes. it is bitexact.

___
> 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

Re: [FFmpeg-devel] [PATCH] avcodec/x86: add cfhdenc SIMD

2021-02-27 Thread James Almer

On 2/27/2021 11:05 AM, Paul B Mahol wrote:

Signed-off-by: Paul B Mahol 
---
  libavcodec/cfhdencdsp.c  |   3 +
  libavcodec/x86/Makefile  |   2 +
  libavcodec/x86/cfhdencdsp.asm| 435 +++
  libavcodec/x86/cfhdencdsp_init.c |  48 
  4 files changed, 488 insertions(+)
  create mode 100644 libavcodec/x86/cfhdencdsp.asm
  create mode 100644 libavcodec/x86/cfhdencdsp_init.c

diff --git a/libavcodec/cfhdencdsp.c b/libavcodec/cfhdencdsp.c
index 0becb76d1d..b979e9e09a 100644
--- a/libavcodec/cfhdencdsp.c
+++ b/libavcodec/cfhdencdsp.c
@@ -73,4 +73,7 @@ av_cold void ff_cfhdencdsp_init(CFHDEncDSPContext *c)
  {
  c->horiz_filter = horiz_filter;
  c->vert_filter = vert_filter;
+
+if (ARCH_X86)
+ff_cfhdencdsp_init_x86(c);
  }
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 884dc0c759..6361161180 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -51,6 +51,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= x86/alacdsp_init.o
  OBJS-$(CONFIG_APNG_DECODER)+= x86/pngdsp_init.o
  OBJS-$(CONFIG_CAVS_DECODER)+= x86/cavsdsp.o
  OBJS-$(CONFIG_CFHD_DECODER)+= x86/cfhddsp_init.o
+OBJS-$(CONFIG_CFHD_ENCODER)+= x86/cfhdencdsp_init.o
  OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp_init.o 
x86/synth_filter_init.o
  OBJS-$(CONFIG_DNXHD_ENCODER)   += x86/dnxhdenc_init.o
  OBJS-$(CONFIG_EXR_DECODER) += x86/exrdsp_init.o
@@ -154,6 +155,7 @@ X86ASM-OBJS-$(CONFIG_ADPCM_G722_ENCODER) += x86/g722dsp.o
  X86ASM-OBJS-$(CONFIG_ALAC_DECODER) += x86/alacdsp.o
  X86ASM-OBJS-$(CONFIG_APNG_DECODER) += x86/pngdsp.o
  X86ASM-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsidct.o
+X86ASM-OBJS-$(CONFIG_CFHD_ENCODER) += x86/cfhdencdsp.o
  X86ASM-OBJS-$(CONFIG_CFHD_DECODER) += x86/cfhddsp.o
  X86ASM-OBJS-$(CONFIG_DCA_DECODER)  += x86/dcadsp.o x86/synth_filter.o
  X86ASM-OBJS-$(CONFIG_DIRAC_DECODER)+= x86/diracdsp.o\
diff --git a/libavcodec/x86/cfhdencdsp.asm b/libavcodec/x86/cfhdencdsp.asm
new file mode 100644
index 00..b0b094aa71
--- /dev/null
+++ b/libavcodec/x86/cfhdencdsp.asm
@@ -0,0 +1,435 @@
+;**
+;* x86-optimized functions for the CFHD encoder
+;* Copyright (c) 2021 Paul B Mahol
+;*
+;* This file is part of FFmpeg.
+;*
+;* FFmpeg is free software; you can redistribute it and/or
+;* modify it under the terms of the GNU Lesser General Public
+;* License as published by the Free Software Foundation; either
+;* version 2.1 of the License, or (at your option) any later version.
+;*
+;* FFmpeg is distributed in the hope that it will be useful,
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of
+;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;* Lesser General Public License for more details.
+;*
+;* You should have received a copy of the GNU Lesser General Public
+;* License along with FFmpeg; if not, write to the Free Software
+;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;**
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+
+pw_p1_n1:  dw  1, -1, 1, -1, 1, -1, 1, -1
+pw_n1_p1:  dw  -1, 1, -1, 1, -1, 1, -1, 1
+pw_p5_n11: dw  5, -11, 5, -11, 5, -11, 5, -11
+pw_n5_p11: dw -5, 11, -5, 11, -5, 11, -5, 11
+pw_p11_n5: dw 11, -5, 11, -5, 11, -5, 11, -5
+pw_n11_p5: dw -11, 5, -11, 5, -11, 5, -11, 5
+pd_4:  times 4 dd  4
+pw_n4: times 8 dw -4
+cextern pw_m1
+cextern pw_1
+cextern pw_4
+
+SECTION .text


[...]


+
+%if ARCH_X86_64
+INIT_XMM sse2
+cglobal cfhdenc_vert_filter, 8, 11, 14, input, low, high, istride, lwidth, 
hwidth, width, height, x, y, pos
+movsxdifnidn  widthq, widthd
+movsxdifnidn heightq, heightd


Why did you add this? The shl and sub below using a d suffix like in the 
previous version is enough to clear the upper bits.



+
+shl  istrideq, 1
+
+shlwidthq, 1
+sub   heightq, 2


Should be ok if tested and bitexact.
___
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 3/5] libavformat/protocols.c: fix build warning for [-Wdiscarded-qualifiers]

2021-02-27 Thread Reimar Döffinger


> On 27 Feb 2021, at 09:14, Guo, Yejun  wrote:
> 
> 
> 
>> -Original Message-
>> From: ffmpeg-devel  On Behalf Of Paul B
>> Mahol
>> Sent: 2021年2月26日 19:37
>> To: FFmpeg development discussions and patches 
>> Cc: Guo, Yejun 
>> Subject: Re: [FFmpeg-devel] [PATCH V3 3/5] libavformat/protocols.c: fix build
>> warning for [-Wdiscarded-qualifiers]
>> 
>> look at same/similar patches like yours that have been already rejected.
> 
> thanks for the info.
> 
> My motivation to fix the build warnings is that: I have several patches caught
> by patchwork with build warnings that I missed. I'd like to avoid it. And the 
> best method,
> IMO, is to add '-Wall -Werror' for the build option.

I think that is a bad idea, compilers add new warnings all the time, many of 
them
unreliable or of questionable quality/usefulness.
What you end up with using -Werror is a project that constantly fails to build 
and gets
a reputation for low quality.
However there may well be specific, reliable warning types for which we
should add an error specifically, as we already do now for e.g.
-Werror=implicit-function-declaration
There might also be other options to improve things and ensure relevant
warnings are visible and addressed, but I’ve yet to
see a -Werror have convincing effects (for example one effect it usually
has is that people have to stick to “supported” compiler versions to avoid
constant issues with build failures, reducing testing and actually decreasing
code quality instead of increasing it).
Turning it around, using -Werror successfully would mean testing with all
compiler versions regularly including pre-release versions and ensuring
any issues are fixed immediately. Which I don’t think is an approach
that would work for FFmpeg.

> Such option can also help to find
> potential issues in the code. This is the reason that I plan to fix the build 
> warnings
> one by one together with community.

I believe many are likely to be fixable in a way that most developers
would be quite happy with, even consider it an improvement beyond
just the warning/bug fix.
It’ll just take a lot more effort to find those types of fixes.
After all if it was that simple there could just be an option for
the compiler to fix them itself, the reason there isn’t is because
it would likely end very badly.

Best regards,
Reimar
___
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/x86: add cfhdenc SIMD

2021-02-27 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/cfhdencdsp.c  |   3 +
 libavcodec/x86/Makefile  |   2 +
 libavcodec/x86/cfhdencdsp.asm| 435 +++
 libavcodec/x86/cfhdencdsp_init.c |  48 
 4 files changed, 488 insertions(+)
 create mode 100644 libavcodec/x86/cfhdencdsp.asm
 create mode 100644 libavcodec/x86/cfhdencdsp_init.c

diff --git a/libavcodec/cfhdencdsp.c b/libavcodec/cfhdencdsp.c
index 0becb76d1d..b979e9e09a 100644
--- a/libavcodec/cfhdencdsp.c
+++ b/libavcodec/cfhdencdsp.c
@@ -73,4 +73,7 @@ av_cold void ff_cfhdencdsp_init(CFHDEncDSPContext *c)
 {
 c->horiz_filter = horiz_filter;
 c->vert_filter = vert_filter;
+
+if (ARCH_X86)
+ff_cfhdencdsp_init_x86(c);
 }
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 884dc0c759..6361161180 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -51,6 +51,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= x86/alacdsp_init.o
 OBJS-$(CONFIG_APNG_DECODER)+= x86/pngdsp_init.o
 OBJS-$(CONFIG_CAVS_DECODER)+= x86/cavsdsp.o
 OBJS-$(CONFIG_CFHD_DECODER)+= x86/cfhddsp_init.o
+OBJS-$(CONFIG_CFHD_ENCODER)+= x86/cfhdencdsp_init.o
 OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp_init.o 
x86/synth_filter_init.o
 OBJS-$(CONFIG_DNXHD_ENCODER)   += x86/dnxhdenc_init.o
 OBJS-$(CONFIG_EXR_DECODER) += x86/exrdsp_init.o
@@ -154,6 +155,7 @@ X86ASM-OBJS-$(CONFIG_ADPCM_G722_ENCODER) += x86/g722dsp.o
 X86ASM-OBJS-$(CONFIG_ALAC_DECODER) += x86/alacdsp.o
 X86ASM-OBJS-$(CONFIG_APNG_DECODER) += x86/pngdsp.o
 X86ASM-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsidct.o
+X86ASM-OBJS-$(CONFIG_CFHD_ENCODER) += x86/cfhdencdsp.o
 X86ASM-OBJS-$(CONFIG_CFHD_DECODER) += x86/cfhddsp.o
 X86ASM-OBJS-$(CONFIG_DCA_DECODER)  += x86/dcadsp.o x86/synth_filter.o
 X86ASM-OBJS-$(CONFIG_DIRAC_DECODER)+= x86/diracdsp.o\
diff --git a/libavcodec/x86/cfhdencdsp.asm b/libavcodec/x86/cfhdencdsp.asm
new file mode 100644
index 00..b0b094aa71
--- /dev/null
+++ b/libavcodec/x86/cfhdencdsp.asm
@@ -0,0 +1,435 @@
+;**
+;* x86-optimized functions for the CFHD encoder
+;* Copyright (c) 2021 Paul B Mahol
+;*
+;* This file is part of FFmpeg.
+;*
+;* FFmpeg is free software; you can redistribute it and/or
+;* modify it under the terms of the GNU Lesser General Public
+;* License as published by the Free Software Foundation; either
+;* version 2.1 of the License, or (at your option) any later version.
+;*
+;* FFmpeg is distributed in the hope that it will be useful,
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of
+;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;* Lesser General Public License for more details.
+;*
+;* You should have received a copy of the GNU Lesser General Public
+;* License along with FFmpeg; if not, write to the Free Software
+;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;**
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+
+pw_p1_n1:  dw  1, -1, 1, -1, 1, -1, 1, -1
+pw_n1_p1:  dw  -1, 1, -1, 1, -1, 1, -1, 1
+pw_p5_n11: dw  5, -11, 5, -11, 5, -11, 5, -11
+pw_n5_p11: dw -5, 11, -5, 11, -5, 11, -5, 11
+pw_p11_n5: dw 11, -5, 11, -5, 11, -5, 11, -5
+pw_n11_p5: dw -11, 5, -11, 5, -11, 5, -11, 5
+pd_4:  times 4 dd  4
+pw_n4: times 8 dw -4
+cextern pw_m1
+cextern pw_1
+cextern pw_4
+
+SECTION .text
+
+%if ARCH_X86_64
+INIT_XMM sse2
+cglobal cfhdenc_horiz_filter, 8, 10, 11, input, low, high, istride, lwidth, 
hwidth, width, y, x, temp
+shl  istrideq, 1
+shl   lwidthq, 1
+shl   hwidthq, 1
+mova   m7, [pd_4]
+mova   m8, [pw_1]
+mova   m9, [pw_m1]
+mova   m10,[pw_p1_n1]
+movsxdifnidn yq, yd
+movsxdifnidn widthq, widthd
+negyq
+.looph:
+movsx  xq, word [inputq]
+
+movsx   tempq, word [inputq + 2]
+add tempq, xq
+
+movd  xm0, tempd
+packssdw   m0, m0
+movdtempd, m0
+mov   word [lowq], tempw
+
+movsx  xq, word [inputq]
+imul   xq, 5
+movsx   tempq, word [inputq + 2]
+imultempq, -11
+add tempq, xq
+
+movsx  xq, word [inputq + 4]
+imul   xq, 4
+add tempq, xq
+
+movsx  xq, word [inputq + 6]
+imul   xq, 4
+add tempq, xq
+
+movsx  xq, word [inputq + 8]
+imul   xq, -1
+add tempq, xq
+
+movsx  xq, word [inputq + 10]
+imul   xq, -1
+add tempq, xq
+
+add tempq, 4
+sar tempq, 3
+
+movd  xm0, tempd
+packssdw   m0, m0
+movdtempd, m0
+mov  word [highq], tempw
+
+movxq, 2
+
+.loopw:
+

Re: [FFmpeg-devel] [PATCH V2 1/7] libavdevice/v4l2.c: fix build warning for [-Wformat-truncation=]

2021-02-27 Thread Reimar Döffinger

> On 27 Feb 2021, at 06:37, Guo, Yejun  wrote:
> 
> 
>> -Original Message-
>> From: ffmpeg-devel  On Behalf Of Reimar
>> D?ffinger
>>> 
> 
> For the code in this function, max length of file name is fixed, see the code 
> below.
> Anyway, it still increases the on-stack variable size which might have 
> potential security
> issue.
> 
>snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
> 
> 'man readdir' shows:
>   struct dirent {
>   ino_t  d_ino;   /* Inode number */
>   off_t  d_off;   /* Not an offset; see below */
>   unsigned short d_reclen;/* Length of this record */
>   unsigned char  d_type;  /* Type of file; not supported
>  by all filesystem types */
>   char   d_name[256]; /* Null-terminated filename */
>   };

The size is not standardised.
E.g. the OSX manpage has:
 struct dirent { /* when _DARWIN_FEATURE_64_BIT_INODE is defined */
 ino_t  d_fileno; /* file number of entry */
 __uint64_t d_seekoff;/* seek offset (optional, used by servers)
 */
 __uint16_t d_reclen; /* length of this record */
 __uint16_t d_namlen; /* length of string in d_name */
 __uint8_t  d_type;   /* file type, see below */
 chard_name[1024];/* name must be no longer than this */
 };

___
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] avcodec: add SGA Video decoder

2021-02-27 Thread Paul B Mahol
On Sat, Feb 27, 2021 at 4:19 AM James Almer  wrote:

> On 2/26/2021 8:29 AM, Paul B Mahol wrote:
> > Signed-off-by: Paul B Mahol 
> > ---
> >   libavcodec/Makefile |   1 +
> >   libavcodec/allcodecs.c  |   1 +
> >   libavcodec/codec_desc.c |   7 +
> >   libavcodec/codec_id.h   |   1 +
> >   libavcodec/sga.c| 534 
> >   5 files changed, 544 insertions(+)
> >   create mode 100644 libavcodec/sga.c
> >
> > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > index fe7026c1db..850657ae3c 100644
> > --- a/libavcodec/Makefile
> > +++ b/libavcodec/Makefile
> > @@ -609,6 +609,7 @@ OBJS-$(CONFIG_SANM_DECODER)+= sanm.o
> >   OBJS-$(CONFIG_SCPR_DECODER)+= scpr.o
> >   OBJS-$(CONFIG_SCREENPRESSO_DECODER)+= screenpresso.o
> >   OBJS-$(CONFIG_SDX2_DPCM_DECODER)   += dpcm.o
> > +OBJS-$(CONFIG_SGA_DECODER) += sga.o
> >   OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
> >   OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
> >   OBJS-$(CONFIG_SGIRLE_DECODER)  += sgirledec.o
> > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> > index 990998b64b..a04faead16 100644
> > --- a/libavcodec/allcodecs.c
> > +++ b/libavcodec/allcodecs.c
> > @@ -289,6 +289,7 @@ extern AVCodec ff_s302m_decoder;
> >   extern AVCodec ff_sanm_decoder;
> >   extern AVCodec ff_scpr_decoder;
> >   extern AVCodec ff_screenpresso_decoder;
> > +extern AVCodec ff_sga_decoder;
> >   extern AVCodec ff_sgi_encoder;
> >   extern AVCodec ff_sgi_decoder;
> >   extern AVCodec ff_sgirle_decoder;
> > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> > index f64ba488f2..17f8a14044 100644
> > --- a/libavcodec/codec_desc.c
> > +++ b/libavcodec/codec_desc.c
> > @@ -1849,6 +1849,13 @@ static const AVCodecDescriptor
> codec_descriptors[] = {
> >   .long_name = NULL_IF_CONFIG_SMALL("Simbiosis Interactive IMX
> Video"),
> >   .props = AV_CODEC_PROP_LOSSY,
> >   },
> > +{
> > +.id= AV_CODEC_ID_SGA_VIDEO,
> > +.type  = AVMEDIA_TYPE_VIDEO,
> > +.name  = "sga",
> > +.long_name = NULL_IF_CONFIG_SMALL("Digital Pictures SGA Video"),
> > +.props = AV_CODEC_PROP_LOSSY,
> > +},
> >
> >   /* various PCM "codecs" */
> >   {
> > diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
> > index 7dd316afd2..ab7bc68ee2 100644
> > --- a/libavcodec/codec_id.h
> > +++ b/libavcodec/codec_id.h
> > @@ -306,6 +306,7 @@ enum AVCodecID {
> >   AV_CODEC_ID_ARGO,
> >   AV_CODEC_ID_CRI,
> >   AV_CODEC_ID_SIMBIOSIS_IMX,
> > +AV_CODEC_ID_SGA_VIDEO,
> >
> >   /* various PCM "codecs" */
> >   AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at
> the start of audio codecs
> > diff --git a/libavcodec/sga.c b/libavcodec/sga.c
> > new file mode 100644
> > index 00..00752a5843
> > --- /dev/null
> > +++ b/libavcodec/sga.c
>
> sgadec.c?
>

Nope.


>
> [...]
>
> > +memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
> > +frame->palette_has_changed = 1;
> > +frame->pict_type = AV_PICTURE_TYPE_I;
>
> Missing intra only in codec_desc.c, then?
>

Nope, codec have support for inter frames, just not implemented yet.

>
> > +frame->key_frame = 1;
>
> The demuxer does not seem to set every packet as key frame, only some.


That is for working seeking, if you have not noticed there are not pure
chunks but chunks muxed
in sectors of 2048 bytes.



>
> Which is it?
>
> > +
> > +*got_frame = 1;
> > +
> > +return avpkt->size;
> > +}
> > +
> > +static av_cold int sga_decode_end(AVCodecContext *avctx)
> > +{
> > +SGAVideoContext *s = avctx->priv_data;
> > +
> > +av_freep(>tileindex_data);
> > +s->tileindex_size = 0;
> > +
> > +av_freep(>palmapindex_data);
> > +s->palmapindex_size = 0;
> > +
> > +return 0;
> > +}
> > +
> > +AVCodec ff_sga_decoder = {
> > +.name   = "sga",
> > +.long_name  = NULL_IF_CONFIG_SMALL("Digital Pictures SGA
> Video"),
> > +.type   = AVMEDIA_TYPE_VIDEO,
> > +.id = AV_CODEC_ID_SGA_VIDEO,
> > +.priv_data_size = sizeof(SGAVideoContext),
> > +.init   = sga_decode_init,
> > +.decode = sga_decode_frame,
> > +.close  = sga_decode_end,
> > +.capabilities   = AV_CODEC_CAP_DR1,
> > +.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
> > +};
> >
>
> ___
> 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 2/3] avcodec: add SGA Video decoder

2021-02-27 Thread Carl Eugen Hoyos
Am Fr., 26. Feb. 2021 um 12:55 Uhr schrieb Paul B Mahol :

> +static int decode_palette(GetByteContext *gb, uint32_t *pal)
> +{
> +GetBitContext gbit;
> +
> +if (bytestream2_get_bytes_left(gb) < 18)
> +return AVERROR_INVALIDDATA;
> +
> +memset(pal, 0, 16 * sizeof(*pal));
> +init_get_bits8(, gb->buffer, 18);
> +
> +for (int RGBIndex = 0; RGBIndex < 3; RGBIndex++) {
> +for (int index = 0; index < 16; index++) {
> +unsigned color = get_bits1() << RGBIndex;
> +pal[15 - index] |= color << (5 + 16);
> +}
> +}
> +
> +for (int RGBIndex = 0; RGBIndex < 3; RGBIndex++) {
> +for (int index = 0; index < 16; index++) {
> +unsigned color = get_bits1() << RGBIndex;
> +pal[15 - index] |= color << (5 + 8);
> +}
> +}
> +
> +for (int RGBIndex = 0; RGBIndex < 3; RGBIndex++) {
> +for (int index = 0; index < 16; index++) {
> +unsigned color = get_bits1() << RGBIndex;
> +pal[15 - index] |= color << (5 + 0);
> +}
> +}
> +
> +for (int index = 0; index < 16; index++)
> +pal[index] = (0xFFU << 24) | pal[index] | (pal[index] >> 3);

Looks much better than what I suggested but please
also fill the last two bits of each component.

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] [PATCH V3 3/5] libavformat/protocols.c: fix build warning for [-Wdiscarded-qualifiers]

2021-02-27 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Paul B
> Mahol
> Sent: 2021年2月26日 19:37
> To: FFmpeg development discussions and patches 
> Cc: Guo, Yejun 
> Subject: Re: [FFmpeg-devel] [PATCH V3 3/5] libavformat/protocols.c: fix build
> warning for [-Wdiscarded-qualifiers]
> 
> look at same/similar patches like yours that have been already rejected.

thanks for the info.

My motivation to fix the build warnings is that: I have several patches caught
by patchwork with build warnings that I missed. I'd like to avoid it. And the 
best method,
IMO, is to add '-Wall -Werror' for the build option. Such option can also help 
to find
potential issues in the code. This is the reason that I plan to fix the build 
warnings
one by one together with community.

Looks that there are build warnings hard to have a nice fix, I'll reconsider my 
plan, thanks.

> 
> On Fri, Feb 26, 2021 at 9:48 AM Guo, Yejun  wrote:
> 
> > src/libavformat/protocols.c: In function ‘avio_enum_protocols’:
> > src/libavformat/protocols.c:116:7: warning: assignment discards ‘const’
> > qualifier from pointer target type [-Wdiscarded-qualifiers]
> >  p = p ? p + 1 : url_protocols;
> >^
> >
> > Signed-off-by: Guo, Yejun 
> > ---
> >  libavformat/protocols.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/protocols.c b/libavformat/protocols.c index
> > 7df18fbb3b..86cde84a31 100644
> > --- a/libavformat/protocols.c
> > +++ b/libavformat/protocols.c
> > @@ -113,7 +113,7 @@ const char *avio_enum_protocols(void **opaque,
> int
> > output)
> >  {
> >  const URLProtocol **p = *opaque;
> >
> > -p = p ? p + 1 : url_protocols;
> > +p = p ? p + 1 : (const URLProtocol **)url_protocols;
> >  *opaque = p;
> >  if (!*p) {
> >  *opaque = NULL;
> > --
> > 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 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".