Re: [FFmpeg-devel] dash: add descriptor which is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.

2019-07-19 Thread Moritz Barsnick
On Fri, Jul 19, 2019 at 11:08:00 +0800, leozhang wrote:
> change history:
> 1. Use normal descriptor string instead of base64 encoded
> 2. Add example to muxers.texi
> 3. Change descriptor char * and allocate it dynamically
>
> Please review, thanks

Please take care, the above text has become part of the commit message
but shouldn't be, so it shouldn't be pushed that way either.

You need to add remarks to your emails below the '---' line:
>
> Signed-off-by: leozhang 
> ---

Right here.

>  doc/muxers.texi   |  4 
>  libavformat/dashenc.c | 27 +++
>  2 files changed, 27 insertions(+), 4 deletions(-)

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

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

Re: [FFmpeg-devel] [PATCH 4/4] avcodec/mediacodec_wrapper: remove unused local variables in ff_AMediaCodec_getCodecNameByType()

2019-07-19 Thread Matthieu Bouron
On Sun, Jul 14, 2019 at 08:17:03PM +0200, Matthieu Bouron wrote:
> On Thu, Jul 04, 2019 at 03:43:48PM +0200, Matthieu Bouron wrote:
> > ---
> >  libavcodec/mediacodec_wrapper.c | 10 --
> >  1 file changed, 10 deletions(-)
> > 
> > diff --git a/libavcodec/mediacodec_wrapper.c 
> > b/libavcodec/mediacodec_wrapper.c
> > index 70e1e7cae1..5213cf640a 100644
> > --- a/libavcodec/mediacodec_wrapper.c
> > +++ b/libavcodec/mediacodec_wrapper.c
> > @@ -392,8 +392,6 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
> > *mime, int profile, int e
> >  struct JNIAMediaCodecListFields jfields = { 0 };
> >  struct JNIAMediaFormatFields mediaformat_jfields = { 0 };
> >  
> > -jobject format = NULL;
> > -jobject codec = NULL;
> >  jobject codec_name = NULL;
> >  
> >  jobject info = NULL;
> > @@ -571,14 +569,6 @@ done_with_info:
> >  }
> >  
> >  done:
> > -if (format) {
> > -(*env)->DeleteLocalRef(env, format);
> > -}
> > -
> > -if (codec) {
> > -(*env)->DeleteLocalRef(env, codec);
> > -}
> > -
> >  if (codec_name) {
> >  (*env)->DeleteLocalRef(env, codec_name);
> >  }
> > -- 
> > 2.22.0
> > 
> 
> Ping for the patch set.

If there is no objection, I will push the patchset in a few days.

> 
> -- 
> Matthieu B.

-- 
Matthieu B.
___
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] fftools/ffprobe: process show_frame/show_packets last

2019-07-19 Thread Nicolas George
Aman Gupta (12019-07-18):
> From: Aman Gupta 
> 
> When using `ffprobe -show_format -show_streams -show_packets`,
> it makes more sense to omit static data about the file format
> and streams before the long list of packets instead of at the
> end.
> 
> Signed-off-by: Aman Gupta 
> ---
>  fftools/ffprobe.c | 38 --
>  1 file changed, 20 insertions(+), 18 deletions(-)

Been there, tried that: it will miss all streams that appear late, like
subtitles in MPEG-PS.

It needs to be an option.

Regards,

-- 
  Nicolas George


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] fftools/ffprobe: process show_frame/show_packets last

2019-07-19 Thread Paul B Mahol
On 7/19/19, Aman Gupta  wrote:
> From: Aman Gupta 
>
> When using `ffprobe -show_format -show_streams -show_packets`,
> it makes more sense to omit static data about the file format
> and streams before the long list of packets instead of at the
> end.
>
> Signed-off-by: Aman Gupta 
> ---
>  fftools/ffprobe.c | 38 --
>  1 file changed, 20 insertions(+), 18 deletions(-)
>

Sure this does not need FATE update?


> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 5aaddb0308..c9c10b143d 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -3003,6 +3003,26 @@ static int probe_file(WriterContext *wctx, const char
> *filename)
>  ifile.fmt_ctx->streams[i]->discard = AVDISCARD_ALL;
>  }
>
> +if (do_show_format) {
> +ret = show_format(wctx, &ifile);
> +CHECK_END;
> +}
> +
> +if (do_show_streams) {
> +ret = show_streams(wctx, &ifile);
> +CHECK_END;
> +}
> +
> +if (do_show_programs) {
> +ret = show_programs(wctx, &ifile);
> +CHECK_END;
> +}
> +
> +if (do_show_chapters) {
> +ret = show_chapters(wctx, &ifile);
> +CHECK_END;
> +}
> +
>  if (do_read_frames || do_read_packets) {
>  if (do_show_frames && do_show_packets &&
>  wctx->writer->flags &
> WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER)
> @@ -3019,24 +3039,6 @@ static int probe_file(WriterContext *wctx, const char
> *filename)
>  CHECK_END;
>  }
>
> -if (do_show_programs) {
> -ret = show_programs(wctx, &ifile);
> -CHECK_END;
> -}
> -
> -if (do_show_streams) {
> -ret = show_streams(wctx, &ifile);
> -CHECK_END;
> -}
> -if (do_show_chapters) {
> -ret = show_chapters(wctx, &ifile);
> -CHECK_END;
> -}
> -if (do_show_format) {
> -ret = show_format(wctx, &ifile);
> -CHECK_END;
> -}
> -
>  end:
>  if (ifile.fmt_ctx)
>  close_input_file(&ifile);
> --
> 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 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] Setup for extracting quantization parameters from encoded streams

2019-07-19 Thread Nicolas George
Juan De León (12019-07-17):
> +FILE *stats_file;

I do not judge whether this filter would be useful and should be
included, but if so, then I would appreciate that the output be done
using AVIO, so that it can go to any supported protocol.

Regards,

-- 
  Nicolas George


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] avutil/mips: refactor msa load and store macros.

2019-07-19 Thread Michael Niedermayer
On Wed, Jul 17, 2019 at 05:35:00PM +0800, Shiyou Yin wrote:
> Replace STnxm_UB and LDnxm_SH with new macros ST_{H/W/D}{1/2/4/8}.
> The old macros are difficult to use because they don't follow the same 
> parameter passing rules.
> Changing details as following:
> 1. remove LD4x4_SH.
> 2. replace ST2x4_UB with ST_H4.
> 3. replace ST4x2_UB with ST_W2.
> 4. replace ST4x4_UB with ST_W4.
> 5. replace ST4x8_UB with ST_W8.
> 6. replace ST6x4_UB with ST_W2 and ST_H2.
> 7. replace ST8x1_UB with ST_D1.
> 8. replace ST8x2_UB with ST_D2.
> 9. replace ST8x4_UB with ST_D4.
> 10. replace ST8x8_UB with ST_D8.
> 11. replace ST12x4_UB with ST_D4 and ST_W4.
> 
> Examples of new macro: ST_H4(in, idx0, idx1, idx2, idx3, pdst, stride)
> ST_H4 store four half-word elements in vector 'in' to pdst with stride.
> About the macro name:
> 1) 'ST' means store operation.
> 2) 'H/W/D' means type of vector element is 'half-word/word/double-word'.
> 3) Number '1/2/4/8' means how many elements will be stored.
> About the macro parameter:
> 1) 'in0, in1...' 128-bits vector.
> 2) 'idx0, idx1...' elements index.
> 3) 'pdst' destination pointer to store to
> 4) 'stride' stride of each store operation.

will apply

thanks

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

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



signature.asc
Description: 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] avformat/mpegenc - reject unsupported audio streams

2019-07-19 Thread Gyan



On 17-07-2019 02:23 PM, Carl Eugen Hoyos wrote:




Am 08.07.2019 um 14:05 schrieb Gyan :




On 25-04-2019 01:48 PM, Gyan wrote:



On 25-04-2019 01:23 PM, Ali KIZIL wrote:

There are also Dolby Codecs (ac3 & eac3). Will it also throw error for
these codecs ?

AC3   is  supported before and after this patch.
EAC3 is unsupported before and after this patch.

But it's sent to the same decoder, so support could be added. I'll check.

Attached patch allows muxing EAC3 in MPEG-PS.  Stock ffmpeg can demux and 
decode such streams fine.

Which descriptor is used for eac3?
Please do not commit just because decoding works with FFmpeg, at least try to 
find some specification.


The PS muxer appears to use System A and this is what the ATSC A/52 
(2012) standard says,


"For System A, this section extends the use ofthe AC-3 Registration 
Descriptor defined in Section A3 in combination with the E-AC-3 
stream_type value defined below."


and

"E-AC-3 bit streams shall be identified with a stream_typevalue of 0x87 
when transmitted as PES streams conforming to ATSC-published standards."


Note that the stream_type value of AC-3 is 0x81 yet our id sequence 
starts from 0x80.  This patch uses the same descriptor series as AC-3, 
however if I switch to 0x87, only one such stream may be muxed as 0x88 
was assigned (by you) to DTS. Also, our demuxer sets the codec_id to DTS 
for 0x88 to 0x8f.


Both stock ffmpeg and VlC 4.0 nightly play files using the current 
patch. Mediainfo also identifies the codec correctly.


Comments?

Gyan
___
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 6/6] avcodec/flicvideo: More strictly check chunk size for FLI_COPY

2019-07-19 Thread Michael Niedermayer
On Sat, Jun 22, 2019 at 01:29:36AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (40sec -> 13sec)
> Fixes: 
> 15417/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5679812615602176
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/flicvideo.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

[...]
-- 
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 4/4] avcodec/h264_cavlc: Fix integer overflows with motion vector residual addition

2019-07-19 Thread Michael Niedermayer
On Thu, Jun 27, 2019 at 02:35:33AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 14 + 2147483647 cannot be represented in type 
> 'int'
> Fixes: 
> 14794/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5677380695228416
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/h264_cavlc.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)

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

[FFmpeg-devel] [PATCH v2 1/3] lavf/f_select: support scenecut with more pixel formats

2019-07-19 Thread lance . lmwang
From: Limin Wang 

This patch haven't make other pixel format usable yet to make sure the test
result is same with rgb32 format.

Signed-off-by: Limin Wang 
---
 libavfilter/f_select.c | 34 ++
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 1132375758..eed8df34cb 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -28,6 +28,8 @@
 #include "libavutil/fifo.h"
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/pixdesc.h"
 #include "avfilter.h"
 #include "audio.h"
 #include "formats.h"
@@ -144,6 +146,10 @@ typedef struct SelectContext {
 char *expr_str;
 AVExpr *expr;
 double var_values[VAR_VARS_NB];
+int bitdepth;
+int nb_planes;
+ptrdiff_t width[4];
+ptrdiff_t height[4];
 int do_scene_detect;///< 1 if the expression requires scene 
detection variables, 0 otherwise
 ff_scene_sad_fn sad;///< Sum of the absolute difference 
function (scene detect only)
 double prev_mafd;   ///< previous MAFD 
  (scene detect only)
@@ -202,6 +208,17 @@ static av_cold int init(AVFilterContext *ctx)
 static int config_input(AVFilterLink *inlink)
 {
 SelectContext *select = inlink->dst->priv;
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+
+select->bitdepth = desc->comp[0].depth;
+select->nb_planes = av_pix_fmt_count_planes(inlink->format);
+for (int plane = 0; plane < select->nb_planes; plane++) {
+ptrdiff_t line_size = av_image_get_linesize(inlink->format, inlink->w, 
plane);
+int vsub = desc->log2_chroma_h;
+
+select->width[plane] = line_size >> (select->bitdepth > 8);
+select->height[plane] = plane == 1 || plane == 2 ?  
AV_CEIL_RSHIFT(inlink->h, vsub) : inlink->h;
+}
 
 select->var_values[VAR_N]  = 0.0;
 select->var_values[VAR_SELECTED_N] = 0.0;
@@ -242,7 +259,7 @@ static int config_input(AVFilterLink *inlink)
 inlink->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;
 
 if (CONFIG_SELECT_FILTER && select->do_scene_detect) {
-select->sad = ff_scene_sad_get_fn(8);
+select->sad = ff_scene_sad_get_fn(select->bitdepth == 8 ? 8 : 16);
 if (!select->sad)
 return AVERROR(EINVAL);
 }
@@ -258,12 +275,21 @@ static double get_scene_score(AVFilterContext *ctx, 
AVFrame *frame)
 if (prev_picref &&
 frame->height == prev_picref->height &&
 frame->width  == prev_picref->width) {
-uint64_t sad;
+uint64_t sad = 0;
 double mafd, diff;
+int count = 0;
+
+for (int plane = 0; plane < select->nb_planes; plane++) {
+uint64_t plane_sad;
+select->sad(prev_picref->data[plane], prev_picref->linesize[plane],
+frame->data[plane], frame->linesize[plane],
+select->width[plane], select->height[plane], &plane_sad);
+sad += plane_sad;
+count += select->width[plane] * select->height[plane];
+}
 
-select->sad(prev_picref->data[0], prev_picref->linesize[0], 
frame->data[0], frame->linesize[0], frame->width * 3, frame->height, &sad);
 emms_c();
-mafd = (double)sad / (frame->width * 3 * frame->height);
+mafd = (double)sad / count;
 diff = fabs(mafd - select->prev_mafd);
 ret  = av_clipf(FFMIN(mafd, diff) / 100., 0, 1);
 select->prev_mafd = mafd;
-- 
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 v2 2/3] fate: change the scenecut fate threshold for one more scenecut scenes

2019-07-19 Thread lance . lmwang
From: Limin Wang 

why change .4 to .25, it's for:
one scenecut(pkt_pts=20040) isn't detected by 0.4 threshold

why not change to 0.25 instead of .3:
it'll cause this scenecut(pkt_pts=20040) failed to detect after applied the next
patch which enable yuvj420

for fate testing, it's better to catch all scenecut scenes.

Signed-off-by: Limin Wang 
---
 tests/fate/filter-video.mak| 2 +-
 tests/ref/fate/filter-metadata-scenedetect | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 1042e96e54..60c6be143b 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -734,7 +734,7 @@ SCENEDETECT_DEPS = FFPROBE LAVFI_INDEV MOVIE_FILTER 
SELECT_FILTER SCALE_FILTER \
AVCODEC AVDEVICE MOV_DEMUXER SVQ3_DECODER ZLIB
 FATE_METADATA_FILTER-$(call ALLYES, $(SCENEDETECT_DEPS)) += 
fate-filter-metadata-scenedetect
 fate-filter-metadata-scenedetect: SRC = 
$(TARGET_SAMPLES)/svq3/Vertical400kbit.sorenson3.mov
-fate-filter-metadata-scenedetect: CMD = run $(FILTER_METADATA_COMMAND) 
"sws_flags=+accurate_rnd+bitexact;movie='$(SRC)',select=gt(scene\,.4)"
+fate-filter-metadata-scenedetect: CMD = run $(FILTER_METADATA_COMMAND) 
"sws_flags=+accurate_rnd+bitexact;movie='$(SRC)',select=gt(scene\,.25)"
 
 CROPDETECT_DEPS = FFPROBE LAVFI_INDEV MOVIE_FILTER CROPDETECT_FILTER 
SCALE_FILTER \
   AVCODEC AVDEVICE MOV_DEMUXER H264_DECODER
diff --git a/tests/ref/fate/filter-metadata-scenedetect 
b/tests/ref/fate/filter-metadata-scenedetect
index d04054a951..67c23b3c32 100644
--- a/tests/ref/fate/filter-metadata-scenedetect
+++ b/tests/ref/fate/filter-metadata-scenedetect
@@ -7,4 +7,5 @@ pkt_pts=9760|tag:lavfi.scene_score=1.00
 pkt_pts=14080|tag:lavfi.scene_score=0.838916
 pkt_pts=15700|tag:lavfi.scene_score=1.00
 pkt_pts=18500|tag:lavfi.scene_score=0.474948
+pkt_pts=20040|tag:lavfi.scene_score=0.379700
 pkt_pts=21760|tag:lavfi.scene_score=1.00
-- 
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 3/4] avcodec/dxv: Check op_offset in both directions

2019-07-19 Thread Michael Niedermayer
On Thu, Jun 27, 2019 at 09:32:44AM +0200, Paul B Mahol wrote:
> On 6/27/19, Michael Niedermayer  wrote:
> > Fixes: signed integer overflow: 61 + 2147483647 cannot be represented in
> > type 'int'
> > Fixes:
> > 15311/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5742552826773504
> >
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/dxv.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
> > index 5fd1844094..3506775560 100644
> > --- a/libavcodec/dxv.c
> > +++ b/libavcodec/dxv.c
> > @@ -745,7 +745,7 @@ static int dxv_decompress_cocg(DXVContext *ctx,
> > GetByteContext *gb,
> >  int skip0, skip1, oi0 = 0, oi1 = 0;
> >  int ret, state0 = 0, state1 = 0;
> >
> > -if (op_offset < 12)
> > +if (op_offset < 12 || op_offset - 12 > bytestream2_get_bytes_left(gb))
> >  return AVERROR_INVALIDDATA;
> >
> >  dst = tex_data;
> > --
> > 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".
> 
> Make sure this does not break any files.

Do you have any specific files i should test ?

I of course cannot test every file on earth ...

Thanks

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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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 3/3] lavf/f_select: make the more pixel format usable to avoid autoscale to rgb

2019-07-19 Thread lance . lmwang
From: Limin Wang 

Below is the tested results for the new added pixel format without autoscale to 
rgb24:
1. AV_PIX_FMT_YUVJ420P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
-f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,select=gt(scene\,.25)"

master:
pkt_pts=1620|tag:lavfi.scene_score=1.00
pkt_pts=4140|tag:lavfi.scene_score=0.875036
pkt_pts=5800|tag:lavfi.scene_score=1.00
pkt_pts=6720|tag:lavfi.scene_score=0.461625
pkt_pts=8160|tag:lavfi.scene_score=1.00
pkt_pts=9760|tag:lavfi.scene_score=1.00
pkt_pts=14080|tag:lavfi.scene_score=0.838916
pkt_pts=15700|tag:lavfi.scene_score=1.00
pkt_pts=18500|tag:lavfi.scene_score=0.474948
pkt_pts=20040|tag:lavfi.scene_score=0.379700
pkt_pts=21760|tag:lavfi.scene_score=1.00
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f  
0.71s user 0.01s system 99% cpu 0.721 total

patch applied:
pkt_pts=1620|tag:lavfi.scene_score=1.00
pkt_pts=4140|tag:lavfi.scene_score=0.668643
pkt_pts=5800|tag:lavfi.scene_score=0.996721
pkt_pts=6720|tag:lavfi.scene_score=0.357390
pkt_pts=8160|tag:lavfi.scene_score=0.886268
pkt_pts=9760|tag:lavfi.scene_score=0.926219
pkt_pts=14080|tag:lavfi.scene_score=0.650033
pkt_pts=15700|tag:lavfi.scene_score=1.00
pkt_pts=18500|tag:lavfi.scene_score=0.316402
pkt_pts=20040|tag:lavfi.scene_score=0.269509
pkt_pts=21760|tag:lavfi.scene_score=1.00
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f  
0.19s user 0.01s system 81% cpu 0.240 total

2. AV_PIX_FMT_YUV420P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
-f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_1080-sdr.mkv,select=gt(scene\,.2)"
master:
pkt_pts=3587|tag:lavfi.scene_score=0.462364
pkt_pts=4838|tag:lavfi.scene_score=0.419519
pkt_pts=6548|tag:lavfi.scene_score=0.397027
pkt_pts=9968|tag:lavfi.scene_score=0.419245
pkt_pts=12471|tag:lavfi.scene_score=0.413084
pkt_pts=16225|tag:lavfi.scene_score=0.506370
pkt_pts=19645|tag:lavfi.scene_score=0.507538
pkt_pts=22314|tag:lavfi.scene_score=0.504319
pkt_pts=24817|tag:lavfi.scene_score=0.417544
pkt_pts=25651|tag:lavfi.scene_score=0.413916
pkt_pts=26652|tag:lavfi.scene_score=0.487707
18.58s user 0.07s system 99% cpu 18.663 total

patch applied:
pkt_pts=3587|tag:lavfi.scene_score=0.272173
pkt_pts=4838|tag:lavfi.scene_score=0.247841
pkt_pts=6548|tag:lavfi.scene_score=0.233134
pkt_pts=9968|tag:lavfi.scene_score=0.247253
pkt_pts=12471|tag:lavfi.scene_score=0.244129
pkt_pts=16225|tag:lavfi.scene_score=0.302531
pkt_pts=19645|tag:lavfi.scene_score=0.303560
pkt_pts=22314|tag:lavfi.scene_score=0.301861
pkt_pts=24817|tag:lavfi.scene_score=0.249331
pkt_pts=25651|tag:lavfi.scene_score=0.247096
pkt_pts=26652|tag:lavfi.scene_score=0.287728
10.90s user 0.06s system 99% cpu 10.967 total

3. AV_PIX_FMT_YUV422P

time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
-f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_1080-sdr.mkv,format=yuv422p,select=gt(scene\,.2)"
master:

patched applied:
pkt_pts=3587|tag:lavfi.scene_score=0.224017
pkt_pts=4838|tag:lavfi.scene_score=0.204225
pkt_pts=9968|tag:lavfi.scene_score=0.204636
pkt_pts=12471|tag:lavfi.scene_score=0.202772
pkt_pts=16225|tag:lavfi.scene_score=0.248765
pkt_pts=19645|tag:lavfi.scene_score=0.250144
pkt_pts=22314|tag:lavfi.scene_score=0.248802
pkt_pts=24817|tag:lavfi.scene_score=0.208362
pkt_pts=25651|tag:lavfi.scene_score=0.205777
pkt_pts=26652|tag:lavfi.scene_score=0.230742

4.  AV_PIX_FMT_YUV420P10LE
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
-f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_4k.mkv,select=gt(scene\,.2)"

master:
pkt_pts=3587|tag:lavfi.scene_score=0.269890
pkt_pts=4838|tag:lavfi.scene_score=0.248957
pkt_pts=6548|tag:lavfi.scene_score=0.234619
pkt_pts=9969|tag:lavfi.scene_score=0.224912
pkt_pts=12471|tag:lavfi.scene_score=0.225158
pkt_pts=16225|tag:lavfi.scene_score=0.289809
pkt_pts=19645|tag:lavfi.scene_score=0.285013
pkt_pts=22314|tag:lavfi.scene_score=0.280295
pkt_pts=24817|tag:lavfi.scene_score=0.206486
pkt_pts=25651|tag:lavfi.scene_score=0.208556
pkt_pts=26652|tag:lavfi.scene_score=0.249577
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f  
76.03s user 0.22s system 99% cpu 1:16.27 total

patch applied
pkt_pts=3587|tag:lavfi.scene_score=0.630004
pkt_pts=4838|tag:lavfi.scene_score=0.580807
pkt_pts=6548|tag:lavfi.scene_score=0.548095
pkt_pts=9969|tag:lavfi.scene_score=0.529728
pkt_pts=12471|tag:lavfi.scene_score=0.529921
pkt_pts=16225|tag:lavfi.scene_score=0.680033
pkt_pts=19645|tag:lavfi.scene_score=0.670753
pkt_pts=22314|tag:lavfi.scene_score=0.660605
pkt_pts=24817|tag:lavfi.scene_score=0.490141
pkt_pts=25651|tag:lavfi.scene_score=0.494594
pkt_pts=26652|tag:lavfi.scene_score=0.584942
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts

[FFmpeg-devel] [PATCH 1/3] tools/aviocat: add verbose mode.

2019-07-19 Thread Nicolas George
For now: print the input size as detected by AVSEEK_SIZE.

Signed-off-by: Nicolas George 
---
 tools/aviocat.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/aviocat.c b/tools/aviocat.c
index 2aa08b92ed..7dca4f52b5 100644
--- a/tools/aviocat.c
+++ b/tools/aviocat.c
@@ -26,14 +26,14 @@
 
 static int usage(const char *argv0, int ret)
 {
-fprintf(stderr, "%s [-b bytespersec] [-d duration] [-oi ] [-oo 
] input_url output_url\n", argv0);
+fprintf(stderr, "%s [-b bytespersec] [-d duration] [-oi ] [-oo 
] [-v] input_url output_url\n", argv0);
 fprintf(stderr, ": AVOptions expressed as key=value, 
:-separated\n");
 return ret;
 }
 
 int main(int argc, char **argv)
 {
-int bps = 0, duration = 0, ret, i;
+int bps = 0, duration = 0, verbose = 0, ret, i;
 const char *input_url = NULL, *output_url = NULL;
 int64_t stream_pos = 0;
 int64_t start_time;
@@ -65,6 +65,8 @@ int main(int argc, char **argv)
 return usage(argv[0], 1);
 }
 i++;
+} else if (!strcmp(argv[i], "-v")) {
+verbose = 1;
 } else if (!input_url) {
 input_url = argv[i];
 } else if (!output_url) {
@@ -82,6 +84,15 @@ int main(int argc, char **argv)
 fprintf(stderr, "Unable to open %s: %s\n", input_url, errbuf);
 return 1;
 }
+if (verbose) {
+int64_t size = avio_seek(input, 0, AVSEEK_SIZE);
+if (size >= 0) {
+fprintf(stderr, "aviocat: input size: %"PRId64"\n", size);
+} else {
+fprintf(stderr, "aviocat: input size: unknown\n");
+}
+}
+exit(0);
 if (duration && !bps) {
 int64_t size = avio_size(input);
 if (size < 0) {
-- 
2.20.1

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

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

[FFmpeg-devel] [PATCH 3/3] lavf/concat: implement FFSEEK_SIZE.

2019-07-19 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavformat/concat.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/concat.c b/libavformat/concat.c
index 19c83c309a..ea3bc1dfde 100644
--- a/libavformat/concat.c
+++ b/libavformat/concat.c
@@ -38,6 +38,7 @@ struct concat_data {
 struct concat_nodes *nodes;///< list of nodes to concat
 size_t   length;   ///< number of cat'ed nodes
 size_t   current;  ///< index of currently read node
+uint64_t total_size;
 };
 
 static av_cold int concat_close(URLContext *h)
@@ -59,7 +60,7 @@ static av_cold int concat_open(URLContext *h, const char 
*uri, int flags)
 {
 char *node_uri = NULL;
 int err = 0;
-int64_t size;
+int64_t size, total_size = 0;
 size_t len, i;
 URLContext *uc;
 struct concat_data  *data = h->priv_data;
@@ -112,6 +113,7 @@ static av_cold int concat_open(URLContext *h, const char 
*uri, int flags)
 /* assembling */
 nodes[i].uc   = uc;
 nodes[i].size = size;
+total_size += size;
 }
 av_free(node_uri);
 data->length = i;
@@ -123,6 +125,7 @@ static av_cold int concat_open(URLContext *h, const char 
*uri, int flags)
 err = AVERROR(ENOMEM);
 } else
 data->nodes = nodes;
+data->total_size = total_size;
 return err;
 }
 
@@ -158,6 +161,8 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int 
whence)
 struct concat_nodes *nodes = data->nodes;
 size_t i;
 
+if ((whence & AVSEEK_SIZE))
+return data->total_size;
 switch (whence) {
 case SEEK_END:
 for (i = data->length - 1; i && pos < -nodes[i].size; i--)
-- 
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 2/3] lavf/aviobuf: make AVSEEK_SIZE usable from outside.

2019-07-19 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavformat/aviobuf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 6a5cd97b0a..750326f62d 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -255,6 +255,9 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int 
whence)
 if(!s)
 return AVERROR(EINVAL);
 
+if ((whence & AVSEEK_SIZE))
+return s->seek ? s->seek(s->opaque, offset, AVSEEK_SIZE) : 
AVERROR(ENOSYS);
+
 buffer_size = s->buf_end - s->buffer;
 // pos is the absolute position that the beginning of s->buffer 
corresponds to in the file
 pos = s->pos - (s->write_flag ? 0 : buffer_size);
-- 
2.20.1

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

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

Re: [FFmpeg-devel] [PATCH] libavformat/subfile: Fix SEEK_CUR and SEEK_END seeking

2019-07-19 Thread Nicolas George
Andreas Rheinhardt (12019-07-15):
> Up until now, when performing a SEEK_END seek, the subfile protocol
> ignored the desired position (relative to EOF) and used the current
> absolute offset in the input file instead.
> 
> And when performing a SEEK_CUR seek, the current position has been
> ignored.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> Sorry for the noise of another email, but I just found out that SEEK_CUR
> is buggy as well. This probably hasn't been detected earlier because
> avio_seek translates SEEK_CUR to SEEK_SET internally.

I think this patch is necessary, and I intend to apply it.

But in the meantime, can you test if this patch:

https://ffmpeg.org/pipermail/ffmpeg-devel/2019-July/246765.html

does resolve the problem with concat: that made you look into it?

Regards,

-- 
  Nicolas George


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: Add-multithreading-for-swscale-filter

2019-07-19 Thread Pawlowski, Slawomir


Best regards,
Sławomir Pawłowski



Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


0001-Add-multithreading-for-swscale-filter.patch
Description: 0001-Add-multithreading-for-swscale-filter.patch
___
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] tools/aviocat: add verbose mode.

2019-07-19 Thread Andreas Rheinhardt
Nicolas George:
> For now: print the input size as detected by AVSEEK_SIZE.
> 
> Signed-off-by: Nicolas George 
> ---
>  tools/aviocat.c | 15 +--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/aviocat.c b/tools/aviocat.c
> index 2aa08b92ed..7dca4f52b5 100644
> --- a/tools/aviocat.c
> +++ b/tools/aviocat.c
> @@ -26,14 +26,14 @@
>  
>  static int usage(const char *argv0, int ret)
>  {
> -fprintf(stderr, "%s [-b bytespersec] [-d duration] [-oi ] [-oo 
> ] input_url output_url\n", argv0);
> +fprintf(stderr, "%s [-b bytespersec] [-d duration] [-oi ] [-oo 
> ] [-v] input_url output_url\n", argv0);
>  fprintf(stderr, ": AVOptions expressed as key=value, 
> :-separated\n");
>  return ret;
>  }
>  
>  int main(int argc, char **argv)
>  {
> -int bps = 0, duration = 0, ret, i;
> +int bps = 0, duration = 0, verbose = 0, ret, i;
>  const char *input_url = NULL, *output_url = NULL;
>  int64_t stream_pos = 0;
>  int64_t start_time;
> @@ -65,6 +65,8 @@ int main(int argc, char **argv)
>  return usage(argv[0], 1);
>  }
>  i++;
> +} else if (!strcmp(argv[i], "-v")) {
> +verbose = 1;
>  } else if (!input_url) {
>  input_url = argv[i];
>  } else if (!output_url) {
> @@ -82,6 +84,15 @@ int main(int argc, char **argv)
>  fprintf(stderr, "Unable to open %s: %s\n", input_url, errbuf);
>  return 1;
>  }
> +if (verbose) {
> +int64_t size = avio_seek(input, 0, AVSEEK_SIZE);
This is only allowed after AVSEEK_SIZE is allowed to be usable from
outside, i.e. your first two patches should be swapped.
> +if (size >= 0) {
> +fprintf(stderr, "aviocat: input size: %"PRId64"\n", size);
> +} else {
> +fprintf(stderr, "aviocat: input size: unknown\n");
> +}
> +}
> +exit(0);

Leftover from your testing?

>  if (duration && !bps) {
>  int64_t size = avio_size(input);
>  if (size < 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] patch2 Add-multithreading-for-swscale-filter.patch

2019-07-19 Thread Pawlowski, Slawomir
From 3ce39207e95eb4697abb0fbaccd37cc451559e49 Mon Sep 17 00:00:00 2001
From: Slawomir Pawlowski 
Date: Fri, 19 Jul 2019 13:16:16 +0200
Subject: [PATCH] Add multithreading for swscale filter.

Use with option "-filter_scale_threads "
Split slice in scaler in to parts.

Signed-off-by: Slawomir Pawlowski 
Signed-off-by: Tomasz Szumski 
---
 fftools/ffmpeg.h  |   1 +
 fftools/ffmpeg_filter.c   |   3 +
 fftools/ffmpeg_opt.c  |   7 +
 libavfilter/avfilter.h|  18 ++
 libavfilter/avfiltergraph.c   |   4 +
 libavfilter/vf_scale.c|   4 +
 libswscale/options.c  |   3 +
 libswscale/slice.c|  32 +++-
 libswscale/swscale.c  | 414 +-
 libswscale/swscale_internal.h |  46 +
 libswscale/utils.c| 152 +++-
 11 files changed, 547 insertions(+), 137 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index eb1eaf6..ea1cef5 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -609,6 +609,7 @@ extern char *videotoolbox_pixfmt;
 
 extern int filter_nbthreads;
 extern int filter_complex_nbthreads;
+extern int filter_scale_nbthreads;
 extern int vstats_version;
 
 extern const AVIOInterruptCB int_cb;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 6518d50..793d3e9 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1011,6 +1011,9 @@ int configure_filtergraph(FilterGraph *fg)
 AVDictionaryEntry *e = NULL;
 
 fg->graph->nb_threads = filter_nbthreads;
+#if HAVE_THREADS
+fg->graph->sws_nbthreads = filter_scale_nbthreads;
+#endif
 
 args[0] = 0;
 while ((e = av_dict_get(ost->sws_dict, "", e,
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index d4851a2..37791ff 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -109,6 +109,9 @@ int frame_bits_per_raw_sample = 0;
 float max_error_rate  = 2.0/3;
 int filter_nbthreads = 0;
 int filter_complex_nbthreads = 0;
+#if HAVE_THREADS
+int filter_scale_nbthreads  = 0;
+#endif
 int vstats_version = 2;
 
 
@@ -3497,6 +3500,10 @@ const OptionDef options[] = {
 { "disposition",OPT_STRING | HAS_ARG | OPT_SPEC |
 OPT_OUTPUT,  { .off = 
OFFSET(disposition) },
 "disposition", "" },
+#if HAVE_THREADS
+{ "filter_scale_threads",  HAS_ARG | OPT_INT,  { 
&filter_scale_nbthreads },
+"number of threads for scale filter" },
+#endif
 { "thread_queue_size", HAS_ARG | OPT_INT | OPT_OFFSET | OPT_EXPERT | 
OPT_INPUT,
  { .off = 
OFFSET(thread_queue_size) },
 "set the maximum number of queued packets from the demuxer" },
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 9d70e71..a2835d7 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -422,6 +422,16 @@ struct AVFilterContext {
  * configured.
  */
 int extra_hw_frames;
+
+
+#if HAVE_THREADS
+/**
+ * Number of threads to processing scale
+ */
+int sws_slice_nbthreads;
+
+#endif
+
 };
 
 /**
@@ -907,6 +917,14 @@ typedef struct AVFilterGraph {
 int sink_links_count;
 
 unsigned disable_auto_convert;
+
+#if HAVE_THREADS
+/**
+ * Number of threads to processing scale
+ */
+int sws_nbthreads;
+#endif
+
 } AVFilterGraph;
 
 /**
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index a149f8f..cbd6ad1 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -257,6 +257,10 @@ static int graph_config_links(AVFilterGraph *graph, 
AVClass *log_ctx)
 for (i = 0; i < graph->nb_filters; i++) {
 filt = graph->filters[i];
 
+#if HAVE_THREADS
+filt->sws_slice_nbthreads = graph->sws_nbthreads;
+#endif
+
 if (!filt->nb_outputs) {
 if ((ret = avfilter_config_links(filt)))
 return ret;
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index f741419..5098aee 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -299,6 +299,10 @@ static int config_props(AVFilterLink *outlink)
 av_opt_set_int(*s, "sws_flags", scale->flags, 0);
 av_opt_set_int(*s, "param0", scale->param[0], 0);
 av_opt_set_int(*s, "param1", scale->param[1], 0);
+#if HAVE_THREADS
+av_opt_set_int(*s, "sw_nbthreads", ctx->sws_slice_nbthreads, 0);
+#endif
+
 if (scale->in_range != AVCOL_RANGE_UNSPECIFIED)
 av_opt_set_int(*s, "src_range",
scale->in_range == AVCOL_RANGE_JPEG, 0);
diff --git a/libswscale/options.c b/libswscale/options.c
index 7eb2752..942c12d 100644
--- a/libswscale/options.c
+++ b/libswscale/options.c
@@ -80,6 +80,9 @@ static const AVOption swscale_options[] = {
 { "none","ignore alpha",  0, 
AV_OPT_TYPE_CONST,  { .i64  = SWS

Re: [FFmpeg-devel] Patch: Add-multithreading-for-swscale-filter

2019-07-19 Thread Nicolas George
Pawlowski, Slawomir (12019-07-19):
> From 3ce39207e95eb4697abb0fbaccd37cc451559e49 Mon Sep 17 00:00:00 2001
> From: Slawomir Pawlowski 
> Date: Fri, 19 Jul 2019 13:16:16 +0200
> Subject: [PATCH] Add multithreading for swscale filter.
> 
> Use with option "-filter_scale_threads "
> Split slice in scaler in to parts.
> 
> Signed-off-by: Slawomir Pawlowski 
> Signed-off-by: Tomasz Szumski 

Thanks for the patch. Just a quick review for the most visible issues.

> ---
>  fftools/ffmpeg.h  |   1 +
>  fftools/ffmpeg_filter.c   |   3 +
>  fftools/ffmpeg_opt.c  |   7 +
>  libavfilter/avfilter.h|  18 ++
>  libavfilter/avfiltergraph.c   |   4 +
>  libavfilter/vf_scale.c|   4 +
>  libswscale/options.c  |   3 +
>  libswscale/slice.c|  32 +++-
>  libswscale/swscale.c  | 414 
> +-
>  libswscale/swscale_internal.h |  46 +
>  libswscale/utils.c| 152 +++-
>  11 files changed, 547 insertions(+), 137 deletions(-)

This patch probably needs to be split: swscale, lavfi infrastructure,
scale filter, command-line tool.

> 
> diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
> index eb1eaf6..ea1cef5 100644
> --- a/fftools/ffmpeg.h
> +++ b/fftools/ffmpeg.h
> @@ -609,6 +609,7 @@ extern char *videotoolbox_pixfmt;
>  
>  extern int filter_nbthreads;
>  extern int filter_complex_nbthreads;
> +extern int filter_scale_nbthreads;
>  extern int vstats_version;
>  
>  extern const AVIOInterruptCB int_cb;
> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> index 6518d50..793d3e9 100644
> --- a/fftools/ffmpeg_filter.c
> +++ b/fftools/ffmpeg_filter.c
> @@ -1011,6 +1011,9 @@ int configure_filtergraph(FilterGraph *fg)
>  AVDictionaryEntry *e = NULL;
>  
>  fg->graph->nb_threads = filter_nbthreads;

> +#if HAVE_THREADS
> +fg->graph->sws_nbthreads = filter_scale_nbthreads;
> +#endif

Here and elsewhere: there is no need for HAVE_THREADS to just define a
field and set it. Do not litter the code with unnecessary conditional
compilation.

>  
>  args[0] = 0;
>  while ((e = av_dict_get(ost->sws_dict, "", e,
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index d4851a2..37791ff 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -109,6 +109,9 @@ int frame_bits_per_raw_sample = 0;
>  float max_error_rate  = 2.0/3;
>  int filter_nbthreads = 0;
>  int filter_complex_nbthreads = 0;
> +#if HAVE_THREADS
> +int filter_scale_nbthreads  = 0;
> +#endif
>  int vstats_version = 2;
>  
>  
> @@ -3497,6 +3500,10 @@ const OptionDef options[] = {
>  { "disposition",OPT_STRING | HAS_ARG | OPT_SPEC |
>  OPT_OUTPUT,  { .off 
> = OFFSET(disposition) },
>  "disposition", "" },
> +#if HAVE_THREADS
> +{ "filter_scale_threads",  HAS_ARG | OPT_INT,  { 
> &filter_scale_nbthreads },
> +"number of threads for scale filter" },
> +#endif
>  { "thread_queue_size", HAS_ARG | OPT_INT | OPT_OFFSET | OPT_EXPERT | 
> OPT_INPUT,
>   { .off 
> = OFFSET(thread_queue_size) },
>  "set the maximum number of queued packets from the demuxer" },
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index 9d70e71..a2835d7 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -422,6 +422,16 @@ struct AVFilterContext {
>   * configured.
>   */
>  int extra_hw_frames;
> +
> +
> +#if HAVE_THREADS

> +/**
> + * Number of threads to processing scale
> + */
> +int sws_slice_nbthreads;

Adding a field to AVFilterContext that is relevant only for vf_scale is
not acceptable. Use the option system.

> +
> +#endif
> +
>  };
>  
>  /**
> @@ -907,6 +917,14 @@ typedef struct AVFilterGraph {
>  int sink_links_count;
>  
>  unsigned disable_auto_convert;
> +
> +#if HAVE_THREADS
> +/**
> + * Number of threads to processing scale
> + */
> +int sws_nbthreads;
> +#endif
> +
>  } AVFilterGraph;
>  
>  /**
> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
> index a149f8f..cbd6ad1 100644
> --- a/libavfilter/avfiltergraph.c
> +++ b/libavfilter/avfiltergraph.c
> @@ -257,6 +257,10 @@ static int graph_config_links(AVFilterGraph *graph, 
> AVClass *log_ctx)
>  for (i = 0; i < graph->nb_filters; i++) {
>  filt = graph->filters[i];
>  
> +#if HAVE_THREADS
> +filt->sws_slice_nbthreads = graph->sws_nbthreads;
> +#endif
> +
>  if (!filt->nb_outputs) {
>  if ((ret = avfilter_config_links(filt)))
>  return ret;
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index f741419..5098aee 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -299,6 +299,10 @@ static int config_props(AVFilterLink *outlink)
>  av_opt_set_int(*s, 

Re: [FFmpeg-devel] patch2 Add-multithreading-for-swscale-filter.patch

2019-07-19 Thread Nicolas George
Pawlowski, Slawomir (12019-07-19):
> From 3ce39207e95eb4697abb0fbaccd37cc451559e49 Mon Sep 17 00:00:00 2001
> From: Slawomir Pawlowski 
> Date: Fri, 19 Jul 2019 13:16:16 +0200
> Subject: [PATCH] Add multithreading for swscale filter.
> 
> Use with option "-filter_scale_threads "
> Split slice in scaler in to parts.
> 
> Signed-off-by: Slawomir Pawlowski 
> Signed-off-by: Tomasz Szumski 
> ---
>  fftools/ffmpeg.h  |   1 +
>  fftools/ffmpeg_filter.c   |   3 +
>  fftools/ffmpeg_opt.c  |   7 +
>  libavfilter/avfilter.h|  18 ++
>  libavfilter/avfiltergraph.c   |   4 +
>  libavfilter/vf_scale.c|   4 +
>  libswscale/options.c  |   3 +
>  libswscale/slice.c|  32 +++-
>  libswscale/swscale.c  | 414 
> +-
>  libswscale/swscale_internal.h |  46 +
>  libswscale/utils.c| 152 +++-
>  11 files changed, 547 insertions(+), 137 deletions(-)

See this review:

https://ffmpeg.org/pipermail/ffmpeg-devel/2019-July/246770.html

When sending a second version of a patch, it is nice to tell what
changed.

Regards,

-- 
  Nicolas George


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/3] tools/aviocat: add verbose mode.

2019-07-19 Thread Nicolas George
Andreas Rheinhardt (12019-07-19):
> This is only allowed after AVSEEK_SIZE is allowed to be usable from
> outside, i.e. your first two patches should be swapped.

It will only print "unknown". And with dynamic linking plus the fact
that it was a public API, it is good to know what happens when
AVSEEK_SIZE is used before the first patch.

> > +exit(0);
> Leftover from your testing?

Thank you for catching it. Locally fixed.

Regards,

-- 
  Nicolas George


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/3] avcodec/ffwavesynth: Check sample rate before use

2019-07-19 Thread Nicolas George
Michael Niedermayer (12019-07-15):
> Fixes: division by zero
> Fixes: 
> 15725/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5641231956180992
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/ffwavesynth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

All three patches look good to me. Thanks for fixing it.

Regards,

-- 
  Nicolas George


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 v2] Add 2 timestamp print formats

2019-07-19 Thread Ulf Zibis

Am 03.07.19 um 10:52 schrieb Michael Niedermayer:
>
>> I too thought on that, but the existing functions too rely on
>> float/double. Should I anyway provide a solution with integer arithmetic?
> its indepedant of your patch but i think all these should use integers
> unless its too messy

Now seeing the code of the select filter I'm wondering that there too
generally float values are used even when dealing with typically integer
values e.g. frame no.

-Ulf


___
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: Add-multithreading-for-swscale-filter

2019-07-19 Thread Paul B Mahol
On 7/19/19, Nicolas George  wrote:
> Pawlowski, Slawomir (12019-07-19):
>> From 3ce39207e95eb4697abb0fbaccd37cc451559e49 Mon Sep 17 00:00:00 2001
>> From: Slawomir Pawlowski 
>> Date: Fri, 19 Jul 2019 13:16:16 +0200
>> Subject: [PATCH] Add multithreading for swscale filter.
>>
>> Use with option "-filter_scale_threads "
>> Split slice in scaler in to parts.
>>
>> Signed-off-by: Slawomir Pawlowski 
>> Signed-off-by: Tomasz Szumski 
>
> Thanks for the patch. Just a quick review for the most visible issues.
>
>> ---
>>  fftools/ffmpeg.h  |   1 +
>>  fftools/ffmpeg_filter.c   |   3 +
>>  fftools/ffmpeg_opt.c  |   7 +
>>  libavfilter/avfilter.h|  18 ++
>>  libavfilter/avfiltergraph.c   |   4 +
>>  libavfilter/vf_scale.c|   4 +
>>  libswscale/options.c  |   3 +
>>  libswscale/slice.c|  32 +++-
>>  libswscale/swscale.c  | 414
>> +-
>>  libswscale/swscale_internal.h |  46 +
>>  libswscale/utils.c| 152 +++-
>>  11 files changed, 547 insertions(+), 137 deletions(-)
>
> This patch probably needs to be split: swscale, lavfi infrastructure,
> scale filter, command-line tool.
>
>>
>> diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
>> index eb1eaf6..ea1cef5 100644
>> --- a/fftools/ffmpeg.h
>> +++ b/fftools/ffmpeg.h
>> @@ -609,6 +609,7 @@ extern char *videotoolbox_pixfmt;
>>
>>  extern int filter_nbthreads;
>>  extern int filter_complex_nbthreads;
>> +extern int filter_scale_nbthreads;
>>  extern int vstats_version;
>>
>>  extern const AVIOInterruptCB int_cb;
>> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
>> index 6518d50..793d3e9 100644
>> --- a/fftools/ffmpeg_filter.c
>> +++ b/fftools/ffmpeg_filter.c
>> @@ -1011,6 +1011,9 @@ int configure_filtergraph(FilterGraph *fg)
>>  AVDictionaryEntry *e = NULL;
>>
>>  fg->graph->nb_threads = filter_nbthreads;
>
>> +#if HAVE_THREADS
>> +fg->graph->sws_nbthreads = filter_scale_nbthreads;
>> +#endif
>
> Here and elsewhere: there is no need for HAVE_THREADS to just define a
> field and set it. Do not litter the code with unnecessary conditional
> compilation.
>
>>
>>  args[0] = 0;
>>  while ((e = av_dict_get(ost->sws_dict, "", e,
>> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
>> index d4851a2..37791ff 100644
>> --- a/fftools/ffmpeg_opt.c
>> +++ b/fftools/ffmpeg_opt.c
>> @@ -109,6 +109,9 @@ int frame_bits_per_raw_sample = 0;
>>  float max_error_rate  = 2.0/3;
>>  int filter_nbthreads = 0;
>>  int filter_complex_nbthreads = 0;
>> +#if HAVE_THREADS
>> +int filter_scale_nbthreads  = 0;
>> +#endif
>>  int vstats_version = 2;
>>
>>
>> @@ -3497,6 +3500,10 @@ const OptionDef options[] = {
>>  { "disposition",OPT_STRING | HAS_ARG | OPT_SPEC |
>>  OPT_OUTPUT,  {
>> .off = OFFSET(disposition) },
>>  "disposition", "" },
>> +#if HAVE_THREADS
>> +{ "filter_scale_threads",  HAS_ARG | OPT_INT,
>>  { &filter_scale_nbthreads },
>> +"number of threads for scale filter" },
>> +#endif
>>  { "thread_queue_size", HAS_ARG | OPT_INT | OPT_OFFSET | OPT_EXPERT |
>> OPT_INPUT,
>>   {
>> .off = OFFSET(thread_queue_size) },
>>  "set the maximum number of queued packets from the demuxer" },
>> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
>> index 9d70e71..a2835d7 100644
>> --- a/libavfilter/avfilter.h
>> +++ b/libavfilter/avfilter.h
>> @@ -422,6 +422,16 @@ struct AVFilterContext {
>>   * configured.
>>   */
>>  int extra_hw_frames;
>> +
>> +
>> +#if HAVE_THREADS
>
>> +/**
>> + * Number of threads to processing scale
>> + */
>> +int sws_slice_nbthreads;
>
> Adding a field to AVFilterContext that is relevant only for vf_scale is
> not acceptable. Use the option system.

Also there is already option to override number of threads per filter.

>
>> +
>> +#endif
>> +
>>  };
>>
>>  /**
>> @@ -907,6 +917,14 @@ typedef struct AVFilterGraph {
>>  int sink_links_count;
>>
>>  unsigned disable_auto_convert;
>> +
>> +#if HAVE_THREADS
>> +/**
>> + * Number of threads to processing scale
>> + */
>> +int sws_nbthreads;
>> +#endif
>> +
>>  } AVFilterGraph;
>>
>>  /**
>> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
>> index a149f8f..cbd6ad1 100644
>> --- a/libavfilter/avfiltergraph.c
>> +++ b/libavfilter/avfiltergraph.c
>> @@ -257,6 +257,10 @@ static int graph_config_links(AVFilterGraph *graph,
>> AVClass *log_ctx)
>>  for (i = 0; i < graph->nb_filters; i++) {
>>  filt = graph->filters[i];
>>
>> +#if HAVE_THREADS
>> +filt->sws_slice_nbthreads = graph->sws_nbthreads;
>> +#endif
>> +
>>  if (!filt->nb_outputs) {
>>  if ((ret = avfilter_config_links(filt)))
>>  return ret;
>> diff --git a/libavfilter/vf_scale.c b/libav

Re: [FFmpeg-devel] [PATCH 3/4] avcodec/dxv: Check op_offset in both directions

2019-07-19 Thread Paul B Mahol
On 7/19/19, Michael Niedermayer  wrote:
> On Thu, Jun 27, 2019 at 09:32:44AM +0200, Paul B Mahol wrote:
>> On 6/27/19, Michael Niedermayer  wrote:
>> > Fixes: signed integer overflow: 61 + 2147483647 cannot be represented
>> > in
>> > type 'int'
>> > Fixes:
>> > 15311/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5742552826773504
>> >
>> > Found-by: continuous fuzzing process
>> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> > Signed-off-by: Michael Niedermayer 
>> > ---
>> >  libavcodec/dxv.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
>> > index 5fd1844094..3506775560 100644
>> > --- a/libavcodec/dxv.c
>> > +++ b/libavcodec/dxv.c
>> > @@ -745,7 +745,7 @@ static int dxv_decompress_cocg(DXVContext *ctx,
>> > GetByteContext *gb,
>> >  int skip0, skip1, oi0 = 0, oi1 = 0;
>> >  int ret, state0 = 0, state1 = 0;
>> >
>> > -if (op_offset < 12)
>> > +if (op_offset < 12 || op_offset - 12 >
>> > bytestream2_get_bytes_left(gb))
>> >  return AVERROR_INVALIDDATA;
>> >
>> >  dst = tex_data;
>> > --
>> > 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".
>>
>> Make sure this does not break any files.
>
> Do you have any specific files i should test ?
>
> I of course cannot test every file on earth ...

I'm on vacation, so when I get back I will give you some files.

>
> Thanks
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If you fake or manipulate statistics in a paper in physics you will never
> get a job again.
> If you fake or manipulate statistics in a paper in medicin you will get
> a job for life at the pharma industry.
>
___
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] patch2 Add-multithreading-for-swscale-filter.patch

2019-07-19 Thread Paul B Mahol
On 7/19/19, Nicolas George  wrote:
> Pawlowski, Slawomir (12019-07-19):
>> From 3ce39207e95eb4697abb0fbaccd37cc451559e49 Mon Sep 17 00:00:00 2001
>> From: Slawomir Pawlowski 
>> Date: Fri, 19 Jul 2019 13:16:16 +0200
>> Subject: [PATCH] Add multithreading for swscale filter.
>>
>> Use with option "-filter_scale_threads "
>> Split slice in scaler in to parts.
>>
>> Signed-off-by: Slawomir Pawlowski 
>> Signed-off-by: Tomasz Szumski 
>> ---
>>  fftools/ffmpeg.h  |   1 +
>>  fftools/ffmpeg_filter.c   |   3 +
>>  fftools/ffmpeg_opt.c  |   7 +
>>  libavfilter/avfilter.h|  18 ++
>>  libavfilter/avfiltergraph.c   |   4 +
>>  libavfilter/vf_scale.c|   4 +
>>  libswscale/options.c  |   3 +
>>  libswscale/slice.c|  32 +++-
>>  libswscale/swscale.c  | 414
>> +-
>>  libswscale/swscale_internal.h |  46 +
>>  libswscale/utils.c| 152 +++-
>>  11 files changed, 547 insertions(+), 137 deletions(-)
>
> See this review:
>
> https://ffmpeg.org/pipermail/ffmpeg-devel/2019-July/246770.html
>
> When sending a second version of a patch, it is nice to tell what
> changed.

Also patch should make use of ff_filter_get_nb_threads(ctx).
___
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 6/6] avcodec/flicvideo: More strictly check chunk size for FLI_COPY

2019-07-19 Thread Paul B Mahol
On 7/19/19, Michael Niedermayer  wrote:
> On Sat, Jun 22, 2019 at 01:29:36AM +0200, Michael Niedermayer wrote:
>> Fixes: Timeout (40sec -> 13sec)
>> Fixes:
>> 15417/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5679812615602176
>>
>> Found-by: continuous fuzzing process
>> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> Signed-off-by: Michael Niedermayer 
>> ---
>>  libavcodec/flicvideo.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> will apply
>

Why? This actually is breaking old code.
Can you please stop committing such kind of patches?
___
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] patch2 Add-multithreading-for-swscale-filter.patch

2019-07-19 Thread Carl Eugen Hoyos
Am Fr., 19. Juli 2019 um 14:37 Uhr schrieb Pawlowski, Slawomir
:

> -res = alloc_slice(&c->slice[0], c->srcFormat, c->srcH, c->chrSrcH, 
> c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
> -if (res < 0) goto cleanup;
> +if(!c->parent) {
> +res = alloc_slice(&c->slice[0], c->srcFormat, c->srcH, c->chrSrcH, 
> c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
> +if (res < 0) goto cleanup;
> +}
> +else {

Since you have to send a new patch anyway:
Please fix your editor, so the ugly new line is not added.

> Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
> moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
> wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
> jakiekolwiek
> przegladanie lub rozpowszechnianie jest zabronione.
> This e-mail and any attachments may contain confidential material

You have sent this message to a publicly logged mailing list, it does not
contain confidential material, please remove this footer.

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/mxfenc: fix index byte count in partition header

2019-07-19 Thread Tomas Härdin
tor 2019-07-18 klockan 11:39 -0700 skrev Baptiste Coudurier:
> ---
>  libavformat/mxfenc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> index b677f6af8e..2e54320cf0 100644
> --- a/libavformat/mxfenc.c
> +++ b/libavformat/mxfenc.c
> @@ -1944,8 +1944,7 @@ static int mxf_write_partition(AVFormatContext
> *s, int bodysid,
>  index_byte_count = 80;
>  
>  if (index_byte_count) {
> -// add encoded ber length
> -index_byte_count += 16 + klv_ber_length(index_byte_count);
> +index_byte_count += 16 + 4; // add encoded ber4 length
>  index_byte_count += klv_fill_size(index_byte_count);
>  }
>  

Is there a reason why we don't pick a single BER length coding for the
entire muxer?

/Tomas

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

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

Re: [FFmpeg-devel] [PATCH 1/3] avformat/utils: Check rfps_duration_sum for overflow

2019-07-19 Thread Michael Niedermayer
On Fri, Jul 05, 2019 at 01:28:33AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 9151595917793558550 + 297519050751678697 
> cannot be represented in type 'long'
> Fixes: 
> 15496/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5722866475073536
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/utils.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

will apply

[...]
-- 
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/5] avcodec/flashsv: add FF_CODEC_CAP_INIT_CLEANUP to flashsv1

2019-07-19 Thread Michael Niedermayer
On Sun, Jul 07, 2019 at 03:18:12PM +0200, Michael Niedermayer wrote:
> Fixes: memleaks on error paths during init
> Fixes: 
> 15533/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLASHSV_fuzzer-5647977168764928
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/flashsv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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

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

Re: [FFmpeg-devel] [PATCH 4/5] avcodec/flashsv: add FF_CODEC_CAP_INIT_CLEANUP to flashsv2

2019-07-19 Thread Michael Niedermayer
On Sun, Jul 07, 2019 at 03:18:13PM +0200, Michael Niedermayer wrote:
> Fixes: memleaks on error paths during init
> Fixes: 
> 15548/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLASHSV2_fuzzer-6324019382452224
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/flashsv.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".

[FFmpeg-devel] [PATCH, v2 1/2] fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale

2019-07-19 Thread Linjie Fu
Currently, ffmpeg inserts scale filter by default in the filter graph
to force the whole decoded stream to scale into the same size with the
first frame. It's not quite make sense in resolution changing cases if
user wants the rawvideo without any scale.

Using autoscale/noautoscale to indicate whether auto inserting the scale
filter in the filter graph:
-noautoscale or -autoscale 0:
disable the default auto scale filter inserting.

Signed-off-by: U. Artie Eoff 
Signed-off-by: Linjie Fu 
---
 fftools/ffmpeg.c| 1 +
 fftools/ffmpeg.h| 4 
 fftools/ffmpeg_filter.c | 2 +-
 fftools/ffmpeg_opt.c| 8 
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 01f04103cf..5d52430b1e 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2133,6 +2133,7 @@ static int ifilter_send_frame(InputFilter *ifilter, 
AVFrame *frame)
 
 /* determine if the parameters for this input changed */
 need_reinit = ifilter->format != frame->format;
+fg->autoscale = ifilter->ist->autoscale;
 
 switch (ifilter->ist->st->codecpar->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7b6f802082..1602406581 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -133,6 +133,8 @@ typedef struct OptionsContext {
 intnb_hwaccel_output_formats;
 SpecifierOpt *autorotate;
 intnb_autorotate;
+SpecifierOpt *autoscale;
+intnb_autoscale;
 
 /* output options */
 StreamMap *stream_maps;
@@ -285,6 +287,7 @@ typedef struct FilterGraph {
 
 AVFilterGraph *graph;
 int reconfiguration;
+int autoscale;
 
 InputFilter   **inputs;
 int  nb_inputs;
@@ -335,6 +338,7 @@ typedef struct InputStream {
 int guess_layout_max;
 
 int autorotate;
+int autoscale;
 
 int fix_sub_duration;
 struct { /* previous decoded subtitle and related variables */
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 72838de1e2..2a2eb080eb 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -469,7 +469,7 @@ static int configure_output_video_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 if (ret < 0)
 return ret;
 
-if (ofilter->width || ofilter->height) {
+if ((ofilter->width || ofilter->height) && fg->autoscale) {
 char args[255];
 AVFilterContext *filter;
 AVDictionaryEntry *e = NULL;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f5ca18aa64..41cb676dad 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -742,7 +742,9 @@ static void add_input_streams(OptionsContext *o, 
AVFormatContext *ic)
 MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
 
 ist->autorotate = 1;
+ist->autoscale  = 1;
 MATCH_PER_STREAM_OPT(autorotate, i, ist->autorotate, ic, st);
+MATCH_PER_STREAM_OPT(autoscale, i, ist->autoscale, ic, st);
 
 MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
 if (codec_tag) {
@@ -3640,6 +3642,12 @@ const OptionDef options[] = {
 { "autorotate",   HAS_ARG | OPT_BOOL | OPT_SPEC |
   OPT_EXPERT | OPT_INPUT,  
  { .off = OFFSET(autorotate) },
 "automatically insert correct rotate filters" },
+{ "autoscale",HAS_ARG | OPT_BOOL | OPT_SPEC |
+  OPT_EXPERT | OPT_INPUT,  
  { .off = OFFSET(autoscale) },
+"automatically insert a scale filter at the end of the filter graph if 
a resolution"
+"change is detected. This ensures all frames are the same resolution 
as the first frame"
+"when they leave the filter chain (this option is enabled by default)."
+"If disabled, some encoders/muxers may not support this mode."},
 
 /* audio options */
 { "aframes",OPT_AUDIO | HAS_ARG  | OPT_PERFILE | OPT_OUTPUT,   
{ .func_arg = opt_audio_frames },
-- 
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, v3 2/2] doc/ffmpeg.texi: update docs for autoscale/autorotate

2019-07-19 Thread Linjie Fu
Add docs for autoscale.

Update information for autorotate according to ffplay.

Signed-off-by: U. Artie Eoff 
Signed-off-by: Linjie Fu 
---
 doc/ffmpeg.texi | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index cd35eb49c8..99121b6981 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -734,10 +734,6 @@ ffmpeg -dump_attachment:t "" -i INPUT
 Technical note -- attachments are implemented as codec extradata, so this
 option can actually be used to extract extradata from any stream, not just
 attachments.
-
-@item -noautorotate
-Disable automatically rotating video based on file metadata.
-
 @end table
 
 @section Video Options
@@ -819,6 +815,19 @@ Create the filtergraph specified by @var{filtergraph} and 
use it to
 filter the stream.
 
 This is an alias for @code{-filter:v}, see the @ref{filter_option,,-filter 
option}.
+
+@item -autorotate
+Automatically rotate the video according to file metadata. Enabled by
+default, use @option{-noautorotate} to disable it.
+
+@item -autoscale
+Automatically scale the video according to the resolution of first frame.
+Enabled by default, use @option{-noautoscale} to disable it. When autoscale is
+disabled, all output frames might not be in the same resolution and may require
+some additional explicit processing according to your final rendering/output
+destination. Disabling autoscale may not work in all situations. Therefore, it
+is not recommended to disable it unless you really know what you are doing.
+Disable autoscale at your own risk.
 @end table
 
 @section Advanced Video options
-- 
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 3/3] lavf/concat: implement FFSEEK_SIZE.

2019-07-19 Thread Andreas Rheinhardt
The commit title is wrong: It's AVSEEK_SIZE.

Nicolas George:
> Signed-off-by: Nicolas George 
> ---
>  libavformat/concat.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/concat.c b/libavformat/concat.c
> index 19c83c309a..ea3bc1dfde 100644
> --- a/libavformat/concat.c
> +++ b/libavformat/concat.c
> @@ -38,6 +38,7 @@ struct concat_data {
>  struct concat_nodes *nodes;///< list of nodes to concat
>  size_t   length;   ///< number of cat'ed nodes
>  size_t   current;  ///< index of currently read node
> +uint64_t total_size;
>  };
>  
>  static av_cold int concat_close(URLContext *h)
> @@ -59,7 +60,7 @@ static av_cold int concat_open(URLContext *h, const char 
> *uri, int flags)
>  {
>  char *node_uri = NULL;
>  int err = 0;
> -int64_t size;
> +int64_t size, total_size = 0;
>  size_t len, i;
>  URLContext *uc;
>  struct concat_data  *data = h->priv_data;
> @@ -112,6 +113,7 @@ static av_cold int concat_open(URLContext *h, const char 
> *uri, int flags)
>  /* assembling */
>  nodes[i].uc   = uc;
>  nodes[i].size = size;
> +total_size += size;
There is a potential for overflow here which is undefined behaviour as
total_size is signed. Simply making it unsigned (like you store it)
will solve the undefined behaviour here, but if a wraparound happened,
then seeking may return a nonsense value (not only when using
AVSEEK_SIZE, but certainly when using AVSEEK_SIZE) and may not work at
all. I see two solutions for this:
a) Erroring out when the total size doesn't fit into a int64_t.
b) Disallow seeking if the total size doesn't fit into a int64_t (in
this case, one might even allow input files that don't report a usable
size).
I don't know if a) would break any use cases (maybe some (buggy)
protocol reports INT64_MAX if the size is unknown?).
>  }
>  av_free(node_uri);
>  data->length = i;
> @@ -123,6 +125,7 @@ static av_cold int concat_open(URLContext *h, const char 
> *uri, int flags)
>  err = AVERROR(ENOMEM);
>  } else
>  data->nodes = nodes;
> +data->total_size = total_size;
>  return err;
>  }
>  
> @@ -158,6 +161,8 @@ static int64_t concat_seek(URLContext *h, int64_t pos, 
> int whence)
>  struct concat_nodes *nodes = data->nodes;
>  size_t i;
>  
> +if ((whence & AVSEEK_SIZE))
Unnecessary parentheses.
> +return data->total_size;
>  switch (whence) {
>  case SEEK_END:
>  for (i = data->length - 1; i && pos < -nodes[i].size; i--)
> 

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

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

Re: [FFmpeg-devel] [PATCH] libavformat/subfile: Fix SEEK_CUR and SEEK_END seeking

2019-07-19 Thread Andreas Rheinhardt
Nicolas George:
> Andreas Rheinhardt (12019-07-15):
>> Up until now, when performing a SEEK_END seek, the subfile protocol
>> ignored the desired position (relative to EOF) and used the current
>> absolute offset in the input file instead.
>>
>> And when performing a SEEK_CUR seek, the current position has been
>> ignored.
>>
>> Signed-off-by: Andreas Rheinhardt 
>> ---
>> Sorry for the noise of another email, but I just found out that SEEK_CUR
>> is buggy as well. This probably hasn't been detected earlier because
>> avio_seek translates SEEK_CUR to SEEK_SET internally.
> 
> I think this patch is necessary, and I intend to apply it.
> 
> But in the meantime, can you test if this patch:
> 
> https://ffmpeg.org/pipermail/ffmpeg-devel/2019-July/246765.html
> 
> does resolve the problem with concat: that made you look into it?
> 
> Regards,
> 
It does solve the seeking problem with concat and subfile, just as
fixing subfile alone does; also, applying both commits works fine, too.

- 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] lavc/phtread_frame: update hwaccel_priv_data in time for multithread

2019-07-19 Thread Fu, Linjie
> -Original Message-
> From: Fu, Linjie
> Sent: Friday, July 19, 2019 05:35
> To: ffmpeg-devel@ffmpeg.org
> Cc: Fu, Linjie 
> Subject: [PATCH] lavc/phtread_frame: update hwaccel_priv_data in time for
> multithread
> 
> When resolution/format changes, hwaccel_uninit/hwaccel_init will
> be called to destroy and re-create the hwaccel_priv_data. When output
> frame number meets the constraints for vframes, the hwaccel_priv_data
> modified in decoding thread won't be update to user-thread due to the
> delay mechanism. It will lead to:
> 1. memory leak in child-thread.
> 2. double free in user-thread while calling avcodec_close().
> 
> Can be reproduced with a resolution change case, and use -vframes
> to terminate the decode during dynamic resolution changing:
> 
> ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -v verbose
> -i ./reinit-large_420_8-to-small_420_8.h264 -pix_fmt nv12 -f rawvideo
> -vsync passthrough -vframes 45 -y out.yuv
> 
> The root cause is the conflict between delay mechanism and -vframes.
> FFmpeg won't output a frame if it's still receiving the initial packets,
> so there is async between decode process and output. hwaccel_priv_data
> in user thread won't be updated until the resolution changing
> frame is output.
> 
> As user context should reflect the state of the last frame that
> was output to the user, hwaccel_priv_data should be updated
> separately from decoding thread in time.
> 
> Signed-off-by: Linjie Fu 
> ---
>  libavcodec/pthread_frame.c | 11 +--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
> index 36ac0ac..cf7a575 100644
> --- a/libavcodec/pthread_frame.c
> +++ b/libavcodec/pthread_frame.c
> @@ -282,7 +282,6 @@ static int
> update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
>  dst->sample_rate= src->sample_rate;
>  dst->sample_fmt = src->sample_fmt;
>  dst->channel_layout = src->channel_layout;
> -dst->internal->hwaccel_priv_data = src->internal->hwaccel_priv_data;
> 
>  if (!!dst->hw_frames_ctx != !!src->hw_frames_ctx ||
>  (dst->hw_frames_ctx && dst->hw_frames_ctx->data != src-
> >hw_frames_ctx->data)) {
> @@ -410,6 +409,7 @@ static int submit_packet(PerThreadContext *p,
> AVCodecContext *user_avctx,
>  pthread_mutex_unlock(&prev_thread->progress_mutex);
>  }
> 
> +p->avctx->internal->hwaccel_priv_data = prev_thread->avctx-
> >internal->hwaccel_priv_data;
>  err = update_context_from_thread(p->avctx, prev_thread->avctx, 0);
>  if (err) {
>  pthread_mutex_unlock(&p->mutex);
> @@ -476,7 +476,7 @@ int ff_thread_decode_frame(AVCodecContext
> *avctx,
>  FrameThreadContext *fctx = avctx->internal->thread_ctx;
>  int finished = fctx->next_finished;
>  PerThreadContext *p;
> -int err;
> +int err, cur_decoding;
> 
>  /* release the async lock, permitting blocked hwaccel threads to
>   * go forward while we are in this function */
> @@ -544,6 +544,13 @@ int ff_thread_decode_frame(AVCodecContext
> *avctx,
> 
>  if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0;
> 
> +/* update hwaccel_priv_data from decoding thread */
> +cur_decoding = fctx->next_decoding - 1;
> +if (cur_decoding < 0) cur_decoding += avctx->thread_count;
> +
> +p = &fctx->threads[cur_decoding];
> +avctx->internal->hwaccel_priv_data = p->avctx->internal-
> >hwaccel_priv_data;
> +
>  fctx->next_finished = finished;
> 
>  /* return the size of the consumed packet if no error occurred */
> --
> 2.7.4


Since previous concerns in https://patchwork.ffmpeg.org/patch/13723/
could be  addressed in this version, ping for comments.

- 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, v3 2/2] doc/ffmpeg.texi: update docs for autoscale/autorotate

2019-07-19 Thread Nicolas George
Linjie Fu (12019-07-20):
> Add docs for autoscale.

In the same patch. Why would you want to separate?

Regards,

-- 
  Nicolas George


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] lavf/concat: implement FFSEEK_SIZE.

2019-07-19 Thread Nicolas George
Andreas Rheinhardt (12019-07-19):
> The commit title is wrong: It's AVSEEK_SIZE.

Locally fixed, thanks.

Regards,

-- 
  Nicolas George


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 v1] filter select - avoid 2 times rounding

2019-07-19 Thread Ulf Zibis
Hi,

I have seen, that filter select sometimes doesn't catch a frame
determined by t as cause of floating point rounding. I could experience
less problems after removing 2 times rounding in filter select. I'm
aware that there still is a chance to miss a catch, but I believe it
should be much more rare.

The patch works fine e.g. with:
$ ./ffmpeg in.mp4 -vf
select='eq(t\,10.16)+eq(t\,10.2)+eq(t\,10.24)+eq(t\,10.28)+eq(t\,10.32)+eq(t\,10.36)+eq(t\,10.4)+eq(t\,10.44)+eq(t\,17.52)+eq(t\,47.96)+eq(t\,49.08)+eq(t\,49.2)+eq(t\,55.72)+eq(t\,83.0)'
-vsync vfr out_%02d.png

Without the patch the frame for eq(t\,10.2) was missing.

-Ulf

>From f14142a22d340cba48b3e2352a33026590dec3a5 Mon Sep 17 00:00:00 2001
From: Ulf Zibis 
Date: 19.07.2019, 18:27:51

avfilter/select: avoid twice rounding

diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 1132375..39cc004 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -297,6 +297,7 @@
 
 #define D2TS(d)  (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
+#define TS2DT(ts, tb) (TS2D((ts) * (tb).num / (double)(tb).den))
 
 static void select_frame(AVFilterContext *ctx, AVFrame *frame)
 {
@@ -307,11 +308,11 @@
 if (isnan(select->var_values[VAR_START_PTS]))
 select->var_values[VAR_START_PTS] = TS2D(frame->pts);
 if (isnan(select->var_values[VAR_START_T]))
-select->var_values[VAR_START_T] = TS2D(frame->pts) * av_q2d(inlink->time_base);
+select->var_values[VAR_START_T] = TS2DT(frame->pts, inlink->time_base);
 
 select->var_values[VAR_N  ] = inlink->frame_count_out;
 select->var_values[VAR_PTS] = TS2D(frame->pts);
-select->var_values[VAR_T  ] = TS2D(frame->pts) * av_q2d(inlink->time_base);
+select->var_values[VAR_T  ] = TS2DT(frame->pts, inlink->time_base);
 select->var_values[VAR_POS] = frame->pkt_pos == -1 ? NAN : frame->pkt_pos;
 select->var_values[VAR_KEY] = frame->key_frame;
 select->var_values[VAR_CONCATDEC_SELECT] = get_concatdec_select(frame, av_rescale_q(frame->pts, inlink->time_base, AV_TIME_BASE_Q));
___
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] filter select - avoid 2 times rounding

2019-07-19 Thread Nicolas George
Ulf Zibis (12019-07-19):
> >From f14142a22d340cba48b3e2352a33026590dec3a5 Mon Sep 17 00:00:00 2001
> From: Ulf Zibis 
> Date: 19.07.2019, 18:27:51
> 

> avfilter/select: avoid twice rounding

Maybe I a missing something, I see no change in rounding in this code. I
suspect your diagnosis is wrong.

> 
> diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
> index 1132375..39cc004 100644
> --- a/libavfilter/f_select.c
> +++ b/libavfilter/f_select.c
> @@ -297,6 +297,7 @@
>  
>  #define D2TS(d)  (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
>  #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))

> +#define TS2DT(ts, tb) (TS2D((ts) * (tb).num / (double)(tb).den))

You are multiplying two possibly large integers: it can overflow. I am
not sure if it is really a concern, but it must not be done blindly.

>  
>  static void select_frame(AVFilterContext *ctx, AVFrame *frame)
>  {
> @@ -307,11 +308,11 @@
>  if (isnan(select->var_values[VAR_START_PTS]))
>  select->var_values[VAR_START_PTS] = TS2D(frame->pts);
>  if (isnan(select->var_values[VAR_START_T]))
> -select->var_values[VAR_START_T] = TS2D(frame->pts) * 
> av_q2d(inlink->time_base);
> +select->var_values[VAR_START_T] = TS2DT(frame->pts, 
> inlink->time_base);
>  
>  select->var_values[VAR_N  ] = inlink->frame_count_out;
>  select->var_values[VAR_PTS] = TS2D(frame->pts);
> -select->var_values[VAR_T  ] = TS2D(frame->pts) * 
> av_q2d(inlink->time_base);
> +select->var_values[VAR_T  ] = TS2DT(frame->pts, inlink->time_base);
>  select->var_values[VAR_POS] = frame->pkt_pos == -1 ? NAN : 
> frame->pkt_pos;
>  select->var_values[VAR_KEY] = frame->key_frame;
>  select->var_values[VAR_CONCATDEC_SELECT] = get_concatdec_select(frame, 
> av_rescale_q(frame->pts, inlink->time_base, AV_TIME_BASE_Q));


Regards,

-- 
  Nicolas George


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] avformat/mxfenc: fix index byte count in partition header

2019-07-19 Thread Baptiste Coudurier
Hi Tomas

> On Jul 19, 2019, at 8:48 AM, Tomas Härdin  wrote:
> 
> tor 2019-07-18 klockan 11:39 -0700 skrev Baptiste Coudurier:
>> ---
>> libavformat/mxfenc.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>> 
>> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
>> index b677f6af8e..2e54320cf0 100644
>> --- a/libavformat/mxfenc.c
>> +++ b/libavformat/mxfenc.c
>> @@ -1944,8 +1944,7 @@ static int mxf_write_partition(AVFormatContext
>> *s, int bodysid,
>> index_byte_count = 80;
>> 
>> if (index_byte_count) {
>> -// add encoded ber length
>> -index_byte_count += 16 + klv_ber_length(index_byte_count);
>> +index_byte_count += 16 + 4; // add encoded ber4 length
>> index_byte_count += klv_fill_size(index_byte_count);
>> }
>> 
> 
> Is there a reason why we don't pick a single BER length coding for the
> entire muxer?

BER It saves space, BER4 is only used when required. No strong opinion,
I think it’s unrelated to this fix though.

— 
Baptiste

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

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

Re: [FFmpeg-devel] [PATCH, v3 2/2] doc/ffmpeg.texi: update docs for autoscale/autorotate

2019-07-19 Thread Fu, Linjie
> -Original Message-
> From: Nicolas George [mailto:geo...@nsup.org]
> Sent: Saturday, July 20, 2019 00:37
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Fu, Linjie ; Eoff, Ullysses A
> 
> Subject: Re: [FFmpeg-devel] [PATCH, v3 2/2] doc/ffmpeg.texi: update docs
> for autoscale/autorotate
> 
> Linjie Fu (12019-07-20):
> > Add docs for autoscale.
> 
> In the same patch. Why would you want to separate?

Simply thought doc should be update separately.
Will follow.
___
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] filter select - avoid 2 times rounding

2019-07-19 Thread Ulf Zibis

Am 19.07.19 um 18:57 schrieb Nicolas George:
>
>> avfilter/select: avoid twice rounding
> Maybe I a missing something, I see no change in rounding in this code.
So please give an alternative theory than a rounding issue, why I
actually experience a different result.

>  I suspect your diagnosis is wrong

In the current code there is a 1st rounding with "(double)(time_base.nom
/ time_base.den)" and then a 2nd with multipliying this value with
"frame->pts". In my code there is only 1 rounding after division of
(int64_t)(frame->pts * time_base.nom) with "(double)time_base.den".

Additionally I think, the video must have millions of hours to trap into
integer overflow with int64_t.

-Ulf


___
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] filter select - avoid 2 times rounding

2019-07-19 Thread Nicolas George
Ulf Zibis (12019-07-19):
> So please give an alternative theory than a rounding issue, why I
> actually experience a different result.

Code with doubles is very fragile, changing anything in the structure of
your formula will give slightly different results. You were just lucky
that this change made your use case work.

> In the current code there is a 1st rounding with "(double)(time_base.nom
> / time_base.den)" and then a 2nd with multipliying this value with
> "frame->pts". In my code there is only 1 rounding after division of
> (int64_t)(frame->pts * time_base.nom) with "(double)time_base.den".

There is no rounding, all is done in double.

Regards,

-- 
  Nicolas George


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, v3] fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale

2019-07-19 Thread Linjie Fu
Currently, ffmpeg inserts scale filter by default in the filter graph
to force the whole decoded stream to scale into the same size with the
first frame. It's not quite make sense in resolution changing cases if
user wants the rawvideo without any scale.

Using autoscale/noautoscale to indicate whether auto inserting the scale
filter in the filter graph:
-noautoscale or -autoscale 0:
disable the default auto scale filter inserting.

Update docs.

Signed-off-by: U. Artie Eoff 
Signed-off-by: Linjie Fu 
---
 doc/ffmpeg.texi | 17 +
 fftools/ffmpeg.c|  1 +
 fftools/ffmpeg.h|  4 
 fftools/ffmpeg_filter.c |  2 +-
 fftools/ffmpeg_opt.c|  8 
 5 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index cd35eb49c8..99121b6981 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -734,10 +734,6 @@ ffmpeg -dump_attachment:t "" -i INPUT
 Technical note -- attachments are implemented as codec extradata, so this
 option can actually be used to extract extradata from any stream, not just
 attachments.
-
-@item -noautorotate
-Disable automatically rotating video based on file metadata.
-
 @end table
 
 @section Video Options
@@ -819,6 +815,19 @@ Create the filtergraph specified by @var{filtergraph} and 
use it to
 filter the stream.
 
 This is an alias for @code{-filter:v}, see the @ref{filter_option,,-filter 
option}.
+
+@item -autorotate
+Automatically rotate the video according to file metadata. Enabled by
+default, use @option{-noautorotate} to disable it.
+
+@item -autoscale
+Automatically scale the video according to the resolution of first frame.
+Enabled by default, use @option{-noautoscale} to disable it. When autoscale is
+disabled, all output frames might not be in the same resolution and may require
+some additional explicit processing according to your final rendering/output
+destination. Disabling autoscale may not work in all situations. Therefore, it
+is not recommended to disable it unless you really know what you are doing.
+Disable autoscale at your own risk.
 @end table
 
 @section Advanced Video options
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 01f04103cf..5d52430b1e 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2133,6 +2133,7 @@ static int ifilter_send_frame(InputFilter *ifilter, 
AVFrame *frame)
 
 /* determine if the parameters for this input changed */
 need_reinit = ifilter->format != frame->format;
+fg->autoscale = ifilter->ist->autoscale;
 
 switch (ifilter->ist->st->codecpar->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7b6f802082..1602406581 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -133,6 +133,8 @@ typedef struct OptionsContext {
 intnb_hwaccel_output_formats;
 SpecifierOpt *autorotate;
 intnb_autorotate;
+SpecifierOpt *autoscale;
+intnb_autoscale;
 
 /* output options */
 StreamMap *stream_maps;
@@ -285,6 +287,7 @@ typedef struct FilterGraph {
 
 AVFilterGraph *graph;
 int reconfiguration;
+int autoscale;
 
 InputFilter   **inputs;
 int  nb_inputs;
@@ -335,6 +338,7 @@ typedef struct InputStream {
 int guess_layout_max;
 
 int autorotate;
+int autoscale;
 
 int fix_sub_duration;
 struct { /* previous decoded subtitle and related variables */
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 72838de1e2..2a2eb080eb 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -469,7 +469,7 @@ static int configure_output_video_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 if (ret < 0)
 return ret;
 
-if (ofilter->width || ofilter->height) {
+if ((ofilter->width || ofilter->height) && fg->autoscale) {
 char args[255];
 AVFilterContext *filter;
 AVDictionaryEntry *e = NULL;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f5ca18aa64..41cb676dad 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -742,7 +742,9 @@ static void add_input_streams(OptionsContext *o, 
AVFormatContext *ic)
 MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
 
 ist->autorotate = 1;
+ist->autoscale  = 1;
 MATCH_PER_STREAM_OPT(autorotate, i, ist->autorotate, ic, st);
+MATCH_PER_STREAM_OPT(autoscale, i, ist->autoscale, ic, st);
 
 MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
 if (codec_tag) {
@@ -3640,6 +3642,12 @@ const OptionDef options[] = {
 { "autorotate",   HAS_ARG | OPT_BOOL | OPT_SPEC |
   OPT_EXPERT | OPT_INPUT,  
  { .off = OFFSET(autorotate) },
 "automatically insert correct rotate filters" },
+{ "autoscale",HAS_ARG | OPT_BOOL | OPT_SPEC |
+  OPT_EXPERT | OPT_INPUT,  
  { .off = OFFSET(autoscale) 

Re: [FFmpeg-devel] [PATCH v1] filter select - avoid 2 times rounding

2019-07-19 Thread Ulf Zibis

Am 19.07.19 um 19:23 schrieb Nicolas George:
> Ulf Zibis (12019-07-19):
>> So please give an alternative theory than a rounding issue, why I
>> actually experience a different result.
> Code with doubles is very fragile, changing anything in the structure of
> your formula will give slightly different results. You were just lucky
> that this change made your use case work.

May be, but I believe single rounding over twice rounding is less fragile.

If I see right, the expression evaluation in libavutil/eval.c only
rounds once, so the chance of equal results against one rounding in
filter select should be higher.

>> In the current code there is a 1st rounding with "(double)(time_base.nom
>> / time_base.den)" and then a 2nd with multipliying this value with
>> "frame->pts". In my code there is only 1 rounding after division of
>> (int64_t)(frame->pts * time_base.nom) with "(double)time_base.den".
> There is no rounding, all is done in double.
Try this:
    printf("single rounding: %.40f\n", 130560LL * 1 / (double)12800);
    printf("twice rounding:  %.40f\n", 130560LL * (double)(1 /
(double)12800));
Result:
single rounding: 10.1992894572642398998141288757
twice rounding:  10.2010658141036401502788066864
The 1st result is closer to 10.2 as the 2nd.



___
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] filter select - avoid 2 times rounding

2019-07-19 Thread Nicolas George
Ulf Zibis (12019-07-19):
> May be, but I believe single rounding over twice rounding is less fragile.

Yes. And two plastic bags will slow your fall more than one when you
jump from a plane.

> Try this:
>     printf("single rounding: %.40f\n", 130560LL * 1 / (double)12800);
>     printf("twice rounding:  %.40f\n", 130560LL * (double)(1 /
> (double)12800));
> Result:
> single rounding: 10.1992894572642398998141288757
> twice rounding:  10.2010658141036401502788066864
> The 1st result is closer to 10.2 as the 2nd.

By a completely negligible difference. And that is assuming it would
hold for other values of 10.2, which I am not convinced.

You are wasting your time and making the code less readable for no
actual benefit.

Regards,

-- 
  Nicolas George


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] patch2 Add-multithreading-for-swscale-filter.patch

2019-07-19 Thread Michael Niedermayer
On Fri, Jul 19, 2019 at 12:36:48PM +, Pawlowski, Slawomir wrote:
> From 3ce39207e95eb4697abb0fbaccd37cc451559e49 Mon Sep 17 00:00:00 2001
> From: Slawomir Pawlowski 
> Date: Fri, 19 Jul 2019 13:16:16 +0200
> Subject: [PATCH] Add multithreading for swscale filter.
> 
> Use with option "-filter_scale_threads "
> Split slice in scaler in to parts.
> 
> Signed-off-by: Slawomir Pawlowski 
> Signed-off-by: Tomasz Szumski 
> ---
>  fftools/ffmpeg.h  |   1 +
>  fftools/ffmpeg_filter.c   |   3 +
>  fftools/ffmpeg_opt.c  |   7 +
>  libavfilter/avfilter.h|  18 ++
>  libavfilter/avfiltergraph.c   |   4 +
>  libavfilter/vf_scale.c|   4 +
>  libswscale/options.c  |   3 +
>  libswscale/slice.c|  32 +++-
>  libswscale/swscale.c  | 414 
> +-
>  libswscale/swscale_internal.h |  46 +
>  libswscale/utils.c| 152 +++-
>  11 files changed, 547 insertions(+), 137 deletions(-)

didnt really review the code yet but it fails to build on mingw64

CC  libswscale/alphablend.o
In file included from src/libswscale/alphablend.c:21:0:
src/libswscale/swscale_internal.h:665:5: error: unknown type name ‘pthread_t’
 pthread_t f_thread;
 ^
src/libswscale/swscale_internal.h:666:5: error: unknown type name 
‘pthread_cond_t’
 pthread_cond_t process_cond;
 ^
src/libswscale/swscale_internal.h:667:5: error: unknown type name 
‘pthread_cond_t’
 pthread_cond_t finish_cond;
 ^
src/libswscale/swscale_internal.h:668:5: error: unknown type name 
‘pthread_mutex_t’
 pthread_mutex_t process_mutex;
 ^
src/libswscale/swscale_internal.h:669:5: error: unknown type name 
‘pthread_mutex_t’
 pthread_mutex_t finish_mutex;
 ^
make: *** [libswscale/alphablend.o] Error 1
You have new mail in /var/mail/michael


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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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] lavf/aviobuf: make AVSEEK_SIZE usable from outside.

2019-07-19 Thread Michael Niedermayer
On Fri, Jul 19, 2019 at 02:23:53PM +0200, Nicolas George wrote:
> Signed-off-by: Nicolas George 
> ---
>  libavformat/aviobuf.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 6a5cd97b0a..750326f62d 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -255,6 +255,9 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int 
> whence)
>  if(!s)
>  return AVERROR(EINVAL);
>  
> +if ((whence & AVSEEK_SIZE))

redundant ()

> +return s->seek ? s->seek(s->opaque, offset, AVSEEK_SIZE) : 
> AVERROR(ENOSYS);
> +

seems like a good idea

Thanks

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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


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

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

Re: [FFmpeg-devel] [PATCH v2 3/3] lavf/f_select: make the more pixel format usable to avoid autoscale to rgb

2019-07-19 Thread Marton Balint



On Fri, 19 Jul 2019, lance.lmw...@gmail.com wrote:


From: Limin Wang 

Below is the tested results for the new added pixel format without autoscale to 
rgb24:
1. AV_PIX_FMT_YUVJ420P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
-f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,select=gt(scene\,.25)"

master:
pkt_pts=1620|tag:lavfi.scene_score=1.00
pkt_pts=4140|tag:lavfi.scene_score=0.875036
pkt_pts=5800|tag:lavfi.scene_score=1.00
pkt_pts=6720|tag:lavfi.scene_score=0.461625
pkt_pts=8160|tag:lavfi.scene_score=1.00
pkt_pts=9760|tag:lavfi.scene_score=1.00
pkt_pts=14080|tag:lavfi.scene_score=0.838916
pkt_pts=15700|tag:lavfi.scene_score=1.00
pkt_pts=18500|tag:lavfi.scene_score=0.474948
pkt_pts=20040|tag:lavfi.scene_score=0.379700
pkt_pts=21760|tag:lavfi.scene_score=1.00
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f  
0.71s user 0.01s system 99% cpu 0.721 total

patch applied:
pkt_pts=1620|tag:lavfi.scene_score=1.00
pkt_pts=4140|tag:lavfi.scene_score=0.668643
pkt_pts=5800|tag:lavfi.scene_score=0.996721
pkt_pts=6720|tag:lavfi.scene_score=0.357390
pkt_pts=8160|tag:lavfi.scene_score=0.886268
pkt_pts=9760|tag:lavfi.scene_score=0.926219
pkt_pts=14080|tag:lavfi.scene_score=0.650033
pkt_pts=15700|tag:lavfi.scene_score=1.00
pkt_pts=18500|tag:lavfi.scene_score=0.316402
pkt_pts=20040|tag:lavfi.scene_score=0.269509
pkt_pts=21760|tag:lavfi.scene_score=1.00
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f  
0.19s user 0.01s system 81% cpu 0.240 total

2. AV_PIX_FMT_YUV420P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
-f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_1080-sdr.mkv,select=gt(scene\,.2)"
master:
pkt_pts=3587|tag:lavfi.scene_score=0.462364
pkt_pts=4838|tag:lavfi.scene_score=0.419519
pkt_pts=6548|tag:lavfi.scene_score=0.397027
pkt_pts=9968|tag:lavfi.scene_score=0.419245
pkt_pts=12471|tag:lavfi.scene_score=0.413084
pkt_pts=16225|tag:lavfi.scene_score=0.506370
pkt_pts=19645|tag:lavfi.scene_score=0.507538
pkt_pts=22314|tag:lavfi.scene_score=0.504319
pkt_pts=24817|tag:lavfi.scene_score=0.417544
pkt_pts=25651|tag:lavfi.scene_score=0.413916
pkt_pts=26652|tag:lavfi.scene_score=0.487707
18.58s user 0.07s system 99% cpu 18.663 total

patch applied:
pkt_pts=3587|tag:lavfi.scene_score=0.272173
pkt_pts=4838|tag:lavfi.scene_score=0.247841
pkt_pts=6548|tag:lavfi.scene_score=0.233134
pkt_pts=9968|tag:lavfi.scene_score=0.247253
pkt_pts=12471|tag:lavfi.scene_score=0.244129
pkt_pts=16225|tag:lavfi.scene_score=0.302531
pkt_pts=19645|tag:lavfi.scene_score=0.303560
pkt_pts=22314|tag:lavfi.scene_score=0.301861
pkt_pts=24817|tag:lavfi.scene_score=0.249331
pkt_pts=25651|tag:lavfi.scene_score=0.247096
pkt_pts=26652|tag:lavfi.scene_score=0.287728
10.90s user 0.06s system 99% cpu 10.967 total

3. AV_PIX_FMT_YUV422P

time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
-f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_1080-sdr.mkv,format=yuv422p,select=gt(scene\,.2)"
master:

patched applied:
pkt_pts=3587|tag:lavfi.scene_score=0.224017
pkt_pts=4838|tag:lavfi.scene_score=0.204225
pkt_pts=9968|tag:lavfi.scene_score=0.204636
pkt_pts=12471|tag:lavfi.scene_score=0.202772
pkt_pts=16225|tag:lavfi.scene_score=0.248765
pkt_pts=19645|tag:lavfi.scene_score=0.250144
pkt_pts=22314|tag:lavfi.scene_score=0.248802
pkt_pts=24817|tag:lavfi.scene_score=0.208362
pkt_pts=25651|tag:lavfi.scene_score=0.205777
pkt_pts=26652|tag:lavfi.scene_score=0.230742

4.  AV_PIX_FMT_YUV420P10LE
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
-f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_4k.mkv,select=gt(scene\,.2)"

master:
pkt_pts=3587|tag:lavfi.scene_score=0.269890
pkt_pts=4838|tag:lavfi.scene_score=0.248957
pkt_pts=6548|tag:lavfi.scene_score=0.234619
pkt_pts=9969|tag:lavfi.scene_score=0.224912
pkt_pts=12471|tag:lavfi.scene_score=0.225158
pkt_pts=16225|tag:lavfi.scene_score=0.289809
pkt_pts=19645|tag:lavfi.scene_score=0.285013
pkt_pts=22314|tag:lavfi.scene_score=0.280295
pkt_pts=24817|tag:lavfi.scene_score=0.206486
pkt_pts=25651|tag:lavfi.scene_score=0.208556
pkt_pts=26652|tag:lavfi.scene_score=0.249577
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f  
76.03s user 0.22s system 99% cpu 1:16.27 total

patch applied
pkt_pts=3587|tag:lavfi.scene_score=0.630004
pkt_pts=4838|tag:lavfi.scene_score=0.580807
pkt_pts=6548|tag:lavfi.scene_score=0.548095
pkt_pts=9969|tag:lavfi.scene_score=0.529728
pkt_pts=12471|tag:lavfi.scene_score=0.529921
pkt_pts=16225|tag:lavfi.scene_score=0.680033
pkt_pts=19645|tag:lavfi.scene_score=0.670753
pkt_pts=22314|tag:lavfi.scene_score=0.660605
pkt_pts=24817|tag:lavfi.scene_score=0.490141
pkt_pts=25651|tag:lavfi.scene_score=0.494594
pkt_pts=26652|tag:lavfi.scene_score=0.5849

Re: [FFmpeg-devel] [PATCH v2 1/3] lavf/f_select: support scenecut with more pixel formats

2019-07-19 Thread Marton Balint



On Fri, 19 Jul 2019, lance.lmw...@gmail.com wrote:


From: Limin Wang 

This patch haven't make other pixel format usable yet to make sure the test
result is same with rgb32 format.

Signed-off-by: Limin Wang 
---
libavfilter/f_select.c | 34 ++
1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 1132375758..eed8df34cb 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -28,6 +28,8 @@
#include "libavutil/fifo.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "audio.h"
#include "formats.h"
@@ -144,6 +146,10 @@ typedef struct SelectContext {
char *expr_str;
AVExpr *expr;
double var_values[VAR_VARS_NB];
+int bitdepth;
+int nb_planes;
+ptrdiff_t width[4];
+ptrdiff_t height[4];
int do_scene_detect;///< 1 if the expression requires scene 
detection variables, 0 otherwise
ff_scene_sad_fn sad;///< Sum of the absolute difference 
function (scene detect only)
double prev_mafd;   ///< previous MAFD  
 (scene detect only)
@@ -202,6 +208,17 @@ static av_cold int init(AVFilterContext *ctx)
static int config_input(AVFilterLink *inlink)
{
SelectContext *select = inlink->dst->priv;
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+
+select->bitdepth = desc->comp[0].depth;
+select->nb_planes = av_pix_fmt_count_planes(inlink->format);
+for (int plane = 0; plane < select->nb_planes; plane++) {
+ptrdiff_t line_size = av_image_get_linesize(inlink->format, inlink->w, 
plane);
+int vsub = desc->log2_chroma_h;
+
+select->width[plane] = line_size >> (select->bitdepth > 8);
+select->height[plane] = plane == 1 || plane == 2 ?  
AV_CEIL_RSHIFT(inlink->h, vsub) : inlink->h;
+}

select->var_values[VAR_N]  = 0.0;
select->var_values[VAR_SELECTED_N] = 0.0;
@@ -242,7 +259,7 @@ static int config_input(AVFilterLink *inlink)
inlink->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;

if (CONFIG_SELECT_FILTER && select->do_scene_detect) {
-select->sad = ff_scene_sad_get_fn(8);
+select->sad = ff_scene_sad_get_fn(select->bitdepth == 8 ? 8 : 16);
if (!select->sad)
return AVERROR(EINVAL);
}
@@ -258,12 +275,21 @@ static double get_scene_score(AVFilterContext *ctx, 
AVFrame *frame)
if (prev_picref &&
frame->height == prev_picref->height &&
frame->width  == prev_picref->width) {
-uint64_t sad;
+uint64_t sad = 0;
double mafd, diff;
+int count = 0;
+
+for (int plane = 0; plane < select->nb_planes; plane++) {
+uint64_t plane_sad;
+select->sad(prev_picref->data[plane], prev_picref->linesize[plane],
+frame->data[plane], frame->linesize[plane],
+select->width[plane], select->height[plane], &plane_sad);
+sad += plane_sad;
+count += select->width[plane] * select->height[plane];
+}

-select->sad(prev_picref->data[0], prev_picref->linesize[0], frame->data[0], 
frame->linesize[0], frame->width * 3, frame->height, &sad);
emms_c();
-mafd = (double)sad / (frame->width * 3 * frame->height);
+mafd = (double)sad / count;


Still missing normalization to [0..255] here for >8 bitdepth.

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

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

Re: [FFmpeg-devel] [PATCH] tools/target_dem_fuzzer: ignore avformat_find_stream_info() failure

2019-07-19 Thread Michael Niedermayer
On Thu, Jun 13, 2019 at 01:09:34PM +0200, Michael Niedermayer wrote:
> Such a failure should not be fatal and its worth testing this path too
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dem_fuzzer.c | 2 --
>  1 file changed, 2 deletions(-)

will apply

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

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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

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

Re: [FFmpeg-devel] [PATCH 2/4] avcodec/agm: Fix overflow of signed shift

2019-07-19 Thread Michael Niedermayer
On Mon, Jul 01, 2019 at 12:16:49AM +0200, Michael Niedermayer wrote:
> Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
> Fixes: 
> 15328/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5637545171353600
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/agm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

What does censorship reveal? It reveals fear. -- Julian Assange


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 6/6] avcodec/flicvideo: More strictly check chunk size for FLI_COPY

2019-07-19 Thread Michael Niedermayer
On Fri, Jul 19, 2019 at 03:54:19PM +0200, Paul B Mahol wrote:
> On 7/19/19, Michael Niedermayer  wrote:
> > On Sat, Jun 22, 2019 at 01:29:36AM +0200, Michael Niedermayer wrote:
> >> Fixes: Timeout (40sec -> 13sec)
> >> Fixes:
> >> 15417/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5679812615602176
> >>
> >> Found-by: continuous fuzzing process
> >> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >> Signed-off-by: Michael Niedermayer 
> >> ---
> >>  libavcodec/flicvideo.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > will apply
> >
> 
> Why? This actually is breaking old code.
> Can you please stop committing such kind of patches?

This patch was on the mailing list since a month, why do you point
out a problem with it only once i say that i intend to apply it ?

either way, ill of course not apply it now that you point to a
problem. But please provide a testcase that this patch breaks

Thanks


[...]
-- 
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] Setup for extracting quantization parameters from encoded streams

2019-07-19 Thread Moritz Barsnick
On Fri, Jul 19, 2019 at 10:00:52 +0200, Nicolas George wrote:
> I do not judge whether this filter would be useful and should be
> included, but if so, then I would appreciate that the output be done
> using AVIO, so that it can go to any supported protocol.

The metadata filter has a nice example of how to use avio, incl.
mapping to stdout:

https://github.com/FFmpeg/FFmpeg/blob/f102a4efcef33014d414f9bf4492a04feab20c82/libavfilter/f_metadata.c#L250

I suppose this can been used as a reference.

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

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

Re: [FFmpeg-devel] [PATCH 3/4] avcodec/dxv: Check op_offset in both directions

2019-07-19 Thread Michael Niedermayer
On Fri, Jul 19, 2019 at 03:36:43PM +0200, Paul B Mahol wrote:
> On 7/19/19, Michael Niedermayer  wrote:
> > On Thu, Jun 27, 2019 at 09:32:44AM +0200, Paul B Mahol wrote:
> >> On 6/27/19, Michael Niedermayer  wrote:
> >> > Fixes: signed integer overflow: 61 + 2147483647 cannot be represented
> >> > in
> >> > type 'int'
> >> > Fixes:
> >> > 15311/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5742552826773504
> >> >
> >> > Found-by: continuous fuzzing process
> >> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >> > Signed-off-by: Michael Niedermayer 
> >> > ---
> >> >  libavcodec/dxv.c | 2 +-
> >> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >> >
> >> > diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
> >> > index 5fd1844094..3506775560 100644
> >> > --- a/libavcodec/dxv.c
> >> > +++ b/libavcodec/dxv.c
> >> > @@ -745,7 +745,7 @@ static int dxv_decompress_cocg(DXVContext *ctx,
> >> > GetByteContext *gb,
> >> >  int skip0, skip1, oi0 = 0, oi1 = 0;
> >> >  int ret, state0 = 0, state1 = 0;
> >> >
> >> > -if (op_offset < 12)
> >> > +if (op_offset < 12 || op_offset - 12 >
> >> > bytestream2_get_bytes_left(gb))
> >> >  return AVERROR_INVALIDDATA;
> >> >
> >> >  dst = tex_data;
> >> > --
> >> > 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".
> >>
> >> Make sure this does not break any files.
> >
> > Do you have any specific files i should test ?
> >
> > I of course cannot test every file on earth ...
> 
> I'm on vacation, so when I get back I will give you some files.

ok, ill wait, no hurry, enjoy your vacation!

Thanks!

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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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 v1] filter select - avoid 2 times rounding

2019-07-19 Thread Ulf Zibis

Am 19.07.19 um 20:01 schrieb Nicolas George:
> Ulf Zibis (12019-07-19):
>> May be, but I believe single rounding over twice rounding is less fragile.
> Yes. And two plastic bags will slow your fall more than one when you
> jump from a plane.
>
>> Try this:
>>     printf("single rounding: %.40f\n", 130560LL * 1 / (double)12800);
>>     printf("twice rounding:  %.40f\n", 130560LL * (double)(1 /
>> (double)12800));
>> Result:
>> single rounding: 10.1992894572642398998141288757
>> twice rounding:  10.2010658141036401502788066864
>> The 1st result is closer to 10.2 as the 2nd.
> By a completely negligible difference. 
The wing beat of a butterfly can trigger a hurricane.
> And that is assuming it would hold for other values of 10.2, which I am not 
> convinced.
Then try this:
#define TIME_BASE 12800 // typical time base for 25 fps video
    int false_single = 0, false_twice = 0;
    for (int t = 0; t < 100 * 100; t += 4) {
    char expr_str[16], end, *end_p = &end;
    sprintf(expr_str, "%6g", t/(float)100); // simulate string from
command line
    double expr_parsed = strtod(expr_str, &end_p); //    ... to parse
    int64_t pts = t * TIME_BASE / 100;
    double t_single = pts * 1 / (double)TIME_BASE;
    double t_twice = pts * (double)(1 / (double)TIME_BASE);
    int r_single = expr_parsed == t_single;
    int r_twice = expr_parsed == t_twice;
/*
    printf("time:%6s, pts:%8ld, parsed:%22.18f, t_single:%22.18f=%s,
t_twice:%22.18f=%s\n",
    expr_str, pts, expr_parsed, t_single, r_single ? "true "
: "false", t_twice, r_twice ? "true " : "false");
*/
    false_single += !r_single;
    false_twice += !r_twice;
    }

    printf("single rounding fails: %d, twice rounding fails: %d, in %d
frames\n", false_single, false_twice, 100 * 100 / 4);

Result:
single rounding fails: 0, twice rounding fails: 327, in 2500 frames

> You are wasting your time and making the code less readable for no
> actual benefit.

Finding out, why the select filter doesn't work as I expected, wasted
enough time, so some time more doesn't matter ;-)

-Ulf

___
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] filter select - avoid 2 times rounding

2019-07-19 Thread Hendrik Leppkes
On Fri, Jul 19, 2019 at 7:44 PM Ulf Zibis  wrote:
>
>
> Am 19.07.19 um 19:23 schrieb Nicolas George:
> > Ulf Zibis (12019-07-19):
> >> So please give an alternative theory than a rounding issue, why I
> >> actually experience a different result.
> > Code with doubles is very fragile, changing anything in the structure of
> > your formula will give slightly different results. You were just lucky
> > that this change made your use case work.
>
> May be, but I believe single rounding over twice rounding is less fragile.
>
> If I see right, the expression evaluation in libavutil/eval.c only
> rounds once, so the chance of equal results against one rounding in
> filter select should be higher.
>
> >> In the current code there is a 1st rounding with "(double)(time_base.nom
> >> / time_base.den)" and then a 2nd with multipliying this value with
> >> "frame->pts". In my code there is only 1 rounding after division of
> >> (int64_t)(frame->pts * time_base.nom) with "(double)time_base.den".
> > There is no rounding, all is done in double.
> Try this:
> printf("single rounding: %.40f\n", 130560LL * 1 / (double)12800);
> printf("twice rounding:  %.40f\n", 130560LL * (double)(1 /
> (double)12800));
> Result:
> single rounding: 10.1992894572642398998141288757
> twice rounding:  10.2010658141036401502788066864


This has absolutely nothing to do with "rounding", since there is no
rounding being performed, but all to do with that floating point
arithmetic is just always inaccurate.
What this comes down to is this:

a) 130560 / 12800
b) 130560 * (1 / 12800)

There is no rounding there, since everything is kept in full double
precision. But anyone working with doubles should know that they are
inherently inaccurate.
Instead of re-ordering the floating point math to somehow give you a
slightly more favorable result, maybe there should be actual rounding
to something reasonable when its evaluating the conditions, so that
such inaccuracies just don't matter in the first place?

- Hendrik
___
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/6] avcodec/ffwavesynth: use uint32_t to compute difference, it is enough

2019-07-19 Thread Nicolas George
Michael Niedermayer (12019-07-08):
> On Sat, Jun 22, 2019 at 01:29:33AM +0200, Michael Niedermayer wrote:
> > Fixes: signed integer overflow: 6494225984479297536 - -6043795377581187040 
> > cannot be represented in type 'long'
> > Fixes: 
> > 15285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5632780307791872
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/ffwavesynth.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> will apply

Sorry, I thought I missed the spot and you already applied it.

This patch could be merged with this one:

avcodec/ffwavesynth: More correct cast in wavesynth_seek()

but it is not very important.

As for:

avcodec/ffwavesynth: Fix backward lcg_seek()
avcodec/ffwavesynth: Simplify lcg_seek(), avoid negative case

If you checked they generate the same sequence, then ok and thanks. If
not, then I can do the testing tomorrow.

Regards,

-- 
  Nicolas George


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] lavf/aviobuf: make AVSEEK_SIZE usable from outside.

2019-07-19 Thread Nicolas George
Michael Niedermayer (12019-07-19):
> > +if ((whence & AVSEEK_SIZE))
> redundant ()

I use it as a marker that it is not a mistake for &&. IIRC, gcc (with
some options) warns about "if (a & b)" but accepts "if ((a & b))", and
that is the preferred way. We already have a few instances in the code
base, not all of them mine.

Regards,

-- 
  Nicolas George


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] lavf/aviobuf: make AVSEEK_SIZE usable from outside.

2019-07-19 Thread Hendrik Leppkes
On Fri, Jul 19, 2019 at 11:49 PM Nicolas George  wrote:
>
> Michael Niedermayer (12019-07-19):
> > > +if ((whence & AVSEEK_SIZE))
> > redundant ()
>
> I use it as a marker that it is not a mistake for &&. IIRC, gcc (with
> some options) warns about "if (a & b)" but accepts "if ((a & b))", and
> that is the preferred way. We already have a few instances in the code
> base, not all of them mine.
>

That seems like a particularly dumb compiler "feature". Checking
bitmasks for a set bit seems like a rather standard if condition.

- Hendril
___
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] filter select - avoid 2 times rounding

2019-07-19 Thread Ulf Zibis

Am 19.07.19 um 22:46 schrieb Hendrik Leppkes:
> This has absolutely nothing to do with "rounding", since there is no
> rounding being performed, but all to do with that floating point
> arithmetic is just always inaccurate.

Floating point representation and arithmetic *is* "aproximating
(=rounding) a real (and here a rational, wich is a subset of real)
value", see 1st paragraph here:
https://en.wikipedia.org/wiki/Floating-point_arithmetic


> What this comes down to is this:
>
> a) 130560 / 12800
> b) 130560 * (1 / 12800)
>
> There is no rounding there, since everything is kept in full double
> precision. But anyone working with doubles should know that they are
> inherently inaccurate.
> Instead of re-ordering the floating point math to somehow give you a
> slightly more favorable result, maybe there should be actual rounding
> to something reasonable when its evaluating the conditions, so that
> such inaccuracies just don't matter in the first place?
$1 The captain is always right.

$2 If the captain fails, see $1.

0 against 327 fails in 2500 frames is a "slightly more favorable
result". See my last post from 22:23 CEST.

-Ulf

___
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] lavf/aviobuf: make AVSEEK_SIZE usable from outside.

2019-07-19 Thread Nicolas George
Hendrik Leppkes (12019-07-20):
> That seems like a particularly dumb compiler "feature". Checking
> bitmasks for a set bit seems like a rather standard if condition.

Maybe, to each their own, but it saved me a few times, so personally I
like it, especially since the double-parentheses is an
obvious and unobtrusive way of silencing it.

(Personally I would prefer explicitly "!= 0", but that is not FFmpeg's
coding style.)

Regards,

-- 
  Nicolas George


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 v2 1/3] lavf/f_select: support scenecut with more pixel formats

2019-07-19 Thread Limin Wang
On Fri, Jul 19, 2019 at 09:26:06PM +0200, Marton Balint wrote:
> 
> 
> On Fri, 19 Jul 2019, lance.lmw...@gmail.com wrote:
> 
> >From: Limin Wang 
> >
> >This patch haven't make other pixel format usable yet to make sure the test
> >result is same with rgb32 format.
> >
> >Signed-off-by: Limin Wang 
> >---
> >libavfilter/f_select.c | 34 ++
> >1 file changed, 30 insertions(+), 4 deletions(-)
> >
> >diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
> >index 1132375758..eed8df34cb 100644
> >--- a/libavfilter/f_select.c
> >+++ b/libavfilter/f_select.c
> >@@ -28,6 +28,8 @@
> >#include "libavutil/fifo.h"
> >#include "libavutil/internal.h"
> >#include "libavutil/opt.h"
> >+#include "libavutil/imgutils.h"
> >+#include "libavutil/pixdesc.h"
> >#include "avfilter.h"
> >#include "audio.h"
> >#include "formats.h"
> >@@ -144,6 +146,10 @@ typedef struct SelectContext {
> >char *expr_str;
> >AVExpr *expr;
> >double var_values[VAR_VARS_NB];
> >+int bitdepth;
> >+int nb_planes;
> >+ptrdiff_t width[4];
> >+ptrdiff_t height[4];
> >int do_scene_detect;///< 1 if the expression requires scene 
> > detection variables, 0 otherwise
> >ff_scene_sad_fn sad;///< Sum of the absolute difference 
> > function (scene detect only)
> >double prev_mafd;   ///< previous MAFD   
> > (scene detect only)
> >@@ -202,6 +208,17 @@ static av_cold int init(AVFilterContext *ctx)
> >static int config_input(AVFilterLink *inlink)
> >{
> >SelectContext *select = inlink->dst->priv;
> >+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
> >+
> >+select->bitdepth = desc->comp[0].depth;
> >+select->nb_planes = av_pix_fmt_count_planes(inlink->format);
> >+for (int plane = 0; plane < select->nb_planes; plane++) {
> >+ptrdiff_t line_size = av_image_get_linesize(inlink->format, 
> >inlink->w, plane);
> >+int vsub = desc->log2_chroma_h;
> >+
> >+select->width[plane] = line_size >> (select->bitdepth > 8);
> >+select->height[plane] = plane == 1 || plane == 2 ?  
> >AV_CEIL_RSHIFT(inlink->h, vsub) : inlink->h;
> >+}
> >
> >select->var_values[VAR_N]  = 0.0;
> >select->var_values[VAR_SELECTED_N] = 0.0;
> >@@ -242,7 +259,7 @@ static int config_input(AVFilterLink *inlink)
> >inlink->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;
> >
> >if (CONFIG_SELECT_FILTER && select->do_scene_detect) {
> >-select->sad = ff_scene_sad_get_fn(8);
> >+select->sad = ff_scene_sad_get_fn(select->bitdepth == 8 ? 8 : 16);
> >if (!select->sad)
> >return AVERROR(EINVAL);
> >}
> >@@ -258,12 +275,21 @@ static double get_scene_score(AVFilterContext *ctx, 
> >AVFrame *frame)
> >if (prev_picref &&
> >frame->height == prev_picref->height &&
> >frame->width  == prev_picref->width) {
> >-uint64_t sad;
> >+uint64_t sad = 0;
> >double mafd, diff;
> >+int count = 0;
> >+
> >+for (int plane = 0; plane < select->nb_planes; plane++) {
> >+uint64_t plane_sad;
> >+select->sad(prev_picref->data[plane], 
> >prev_picref->linesize[plane],
> >+frame->data[plane], frame->linesize[plane],
> >+select->width[plane], select->height[plane], 
> >&plane_sad);
> >+sad += plane_sad;
> >+count += select->width[plane] * select->height[plane];
> >+}
> >
> >-select->sad(prev_picref->data[0], prev_picref->linesize[0], 
> >frame->data[0], frame->linesize[0], frame->width * 3, frame->height, &sad);
> >emms_c();
> >-mafd = (double)sad / (frame->width * 3 * frame->height);
> >+mafd = (double)sad / count;
> 
> Still missing normalization to [0..255] here for >8 bitdepth.
By the testing, Passengers_Breakfast_4K.mkv is 10bits sample, it can't detect 
the scenecut if using 1< 8. 



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

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

Re: [FFmpeg-devel] [PATCH v1] filter select - avoid 2 times rounding

2019-07-19 Thread Hendrik Leppkes
On Sat, Jul 20, 2019 at 12:06 AM Ulf Zibis  wrote:
>
>
> Am 19.07.19 um 22:46 schrieb Hendrik Leppkes:
> > This has absolutely nothing to do with "rounding", since there is no
> > rounding being performed, but all to do with that floating point
> > arithmetic is just always inaccurate.
>
> Floating point representation and arithmetic *is* "aproximating
> (=rounding) a real (and here a rational, wich is a subset of real)
> value", see 1st paragraph here:
> https://en.wikipedia.org/wiki/Floating-point_arithmetic
>
>
> > What this comes down to is this:
> >
> > a) 130560 / 12800
> > b) 130560 * (1 / 12800)
> >
> > There is no rounding there, since everything is kept in full double
> > precision. But anyone working with doubles should know that they are
> > inherently inaccurate.
> > Instead of re-ordering the floating point math to somehow give you a
> > slightly more favorable result, maybe there should be actual rounding
> > to something reasonable when its evaluating the conditions, so that
> > such inaccuracies just don't matter in the first place?
> $1 The captain is always right.
>
> $2 If the captain fails, see $1.
>
> 0 against 327 fails in 2500 frames is a "slightly more favorable
> result". See my last post from 22:23 CEST.
>

The entire point is that your change is not a fix, its a bandaid at best.

The behavior will still depend on many outside factors, like the
platform, if SSE or x87 FP math is being used, if fast or precise FP
mode is used by the compiler, and who knows what - because you are
expecting an equals comparison on a floating point value stemming from
a division to be true, which will just fail sometimes if one doesn't
round intentionally to get rid of the inaccuracy introduced by the
calculation itself.

- Hendrik
___
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] filter select - avoid 2 times rounding

2019-07-19 Thread Ulf Zibis

Am 20.07.19 um 00:06 schrieb Ulf Zibis:
> Am 19.07.19 um 22:46 schrieb Hendrik Leppkes:
>> This has absolutely nothing to do with "rounding", since there is no
>> rounding being performed, but all to do with that floating point
>> arithmetic is just always inaccurate.
> Floating point representation and arithmetic *is* "aproximating
> (=rounding) a real (and here a rational, wich is a subset of real)
> value", see 1st paragraph here:
> https://en.wikipedia.org/wiki/Floating-point_arithmetic

And if your concern is about the term "rounding" take "approximation"
for all places I've used "rounding", English is not my home language.

-Ulf

___
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] lavf/f_select: make the more pixel format usable to avoid autoscale to rgb

2019-07-19 Thread Limin Wang
On Fri, Jul 19, 2019 at 09:23:24PM +0200, Marton Balint wrote:
> 
> 
> On Fri, 19 Jul 2019, lance.lmw...@gmail.com wrote:
> 
> >From: Limin Wang 
> >
> >Below is the tested results for the new added pixel format without autoscale 
> >to rgb24:
> >1. AV_PIX_FMT_YUVJ420P
> >time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags 
> >-bitexact -f lavfi \
> >"sws_flags=+accurate_rnd+bitexact;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,select=gt(scene\,.25)"
> >
> >master:
> >pkt_pts=1620|tag:lavfi.scene_score=1.00
> >pkt_pts=4140|tag:lavfi.scene_score=0.875036
> >pkt_pts=5800|tag:lavfi.scene_score=1.00
> >pkt_pts=6720|tag:lavfi.scene_score=0.461625
> >pkt_pts=8160|tag:lavfi.scene_score=1.00
> >pkt_pts=9760|tag:lavfi.scene_score=1.00
> >pkt_pts=14080|tag:lavfi.scene_score=0.838916
> >pkt_pts=15700|tag:lavfi.scene_score=1.00
> >pkt_pts=18500|tag:lavfi.scene_score=0.474948
> >pkt_pts=20040|tag:lavfi.scene_score=0.379700
> >pkt_pts=21760|tag:lavfi.scene_score=1.00
> >./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
> >-f  0.71s user 0.01s system 99% cpu 0.721 total
> >
> >patch applied:
> >pkt_pts=1620|tag:lavfi.scene_score=1.00
> >pkt_pts=4140|tag:lavfi.scene_score=0.668643
> >pkt_pts=5800|tag:lavfi.scene_score=0.996721
> >pkt_pts=6720|tag:lavfi.scene_score=0.357390
> >pkt_pts=8160|tag:lavfi.scene_score=0.886268
> >pkt_pts=9760|tag:lavfi.scene_score=0.926219
> >pkt_pts=14080|tag:lavfi.scene_score=0.650033
> >pkt_pts=15700|tag:lavfi.scene_score=1.00
> >pkt_pts=18500|tag:lavfi.scene_score=0.316402
> >pkt_pts=20040|tag:lavfi.scene_score=0.269509
> >pkt_pts=21760|tag:lavfi.scene_score=1.00
> >./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
> >-f  0.19s user 0.01s system 81% cpu 0.240 total
> >
> >2. AV_PIX_FMT_YUV420P
> >time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags 
> >-bitexact -f lavfi \
> >"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_1080-sdr.mkv,select=gt(scene\,.2)"
> >master:
> >pkt_pts=3587|tag:lavfi.scene_score=0.462364
> >pkt_pts=4838|tag:lavfi.scene_score=0.419519
> >pkt_pts=6548|tag:lavfi.scene_score=0.397027
> >pkt_pts=9968|tag:lavfi.scene_score=0.419245
> >pkt_pts=12471|tag:lavfi.scene_score=0.413084
> >pkt_pts=16225|tag:lavfi.scene_score=0.506370
> >pkt_pts=19645|tag:lavfi.scene_score=0.507538
> >pkt_pts=22314|tag:lavfi.scene_score=0.504319
> >pkt_pts=24817|tag:lavfi.scene_score=0.417544
> >pkt_pts=25651|tag:lavfi.scene_score=0.413916
> >pkt_pts=26652|tag:lavfi.scene_score=0.487707
> >18.58s user 0.07s system 99% cpu 18.663 total
> >
> >patch applied:
> >pkt_pts=3587|tag:lavfi.scene_score=0.272173
> >pkt_pts=4838|tag:lavfi.scene_score=0.247841
> >pkt_pts=6548|tag:lavfi.scene_score=0.233134
> >pkt_pts=9968|tag:lavfi.scene_score=0.247253
> >pkt_pts=12471|tag:lavfi.scene_score=0.244129
> >pkt_pts=16225|tag:lavfi.scene_score=0.302531
> >pkt_pts=19645|tag:lavfi.scene_score=0.303560
> >pkt_pts=22314|tag:lavfi.scene_score=0.301861
> >pkt_pts=24817|tag:lavfi.scene_score=0.249331
> >pkt_pts=25651|tag:lavfi.scene_score=0.247096
> >pkt_pts=26652|tag:lavfi.scene_score=0.287728
> >10.90s user 0.06s system 99% cpu 10.967 total
> >
> >3. AV_PIX_FMT_YUV422P
> >
> >time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags 
> >-bitexact -f lavfi \
> >"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_1080-sdr.mkv,format=yuv422p,select=gt(scene\,.2)"
> >master:
> >
> >patched applied:
> >pkt_pts=3587|tag:lavfi.scene_score=0.224017
> >pkt_pts=4838|tag:lavfi.scene_score=0.204225
> >pkt_pts=9968|tag:lavfi.scene_score=0.204636
> >pkt_pts=12471|tag:lavfi.scene_score=0.202772
> >pkt_pts=16225|tag:lavfi.scene_score=0.248765
> >pkt_pts=19645|tag:lavfi.scene_score=0.250144
> >pkt_pts=22314|tag:lavfi.scene_score=0.248802
> >pkt_pts=24817|tag:lavfi.scene_score=0.208362
> >pkt_pts=25651|tag:lavfi.scene_score=0.205777
> >pkt_pts=26652|tag:lavfi.scene_score=0.230742
> >
> >4.  AV_PIX_FMT_YUV420P10LE
> >time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags 
> >-bitexact -f lavfi \
> >"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_4k.mkv,select=gt(scene\,.2)"
> >
> >master:
> >pkt_pts=3587|tag:lavfi.scene_score=0.269890
> >pkt_pts=4838|tag:lavfi.scene_score=0.248957
> >pkt_pts=6548|tag:lavfi.scene_score=0.234619
> >pkt_pts=9969|tag:lavfi.scene_score=0.224912
> >pkt_pts=12471|tag:lavfi.scene_score=0.225158
> >pkt_pts=16225|tag:lavfi.scene_score=0.289809
> >pkt_pts=19645|tag:lavfi.scene_score=0.285013
> >pkt_pts=22314|tag:lavfi.scene_score=0.280295
> >pkt_pts=24817|tag:lavfi.scene_score=0.206486
> >pkt_pts=25651|tag:lavfi.scene_score=0.208556
> >pkt_pts=26652|tag:lavfi.scene_score=0.249577
> >./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact 
> >-f  76.03s user 0.22s system 99% cpu 1:16.27 total
> >
> >patch applied
> >pkt_pts=3587|tag:lavfi.scene_score=0.630004
> >pkt_pts=4838|tag:lavfi.scene_score=0

Re: [FFmpeg-devel] [PATCH 2/3] lavf/aviobuf: make AVSEEK_SIZE usable from outside.

2019-07-19 Thread Michael Niedermayer
On Fri, Jul 19, 2019 at 11:49:04PM +0200, Nicolas George wrote:
> Michael Niedermayer (12019-07-19):
> > > +if ((whence & AVSEEK_SIZE))
> > redundant ()
> 
> I use it as a marker that it is not a mistake for &&. IIRC, gcc (with
> some options) warns about "if (a & b)" but accepts "if ((a & b))", and
> that is the preferred way. We already have a few instances in the code
> base, not all of them mine.

ok, just mentioned it as i thought it was unintended.
If the () is intended, ignore my comment

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


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] avcodec/dvbsubdec: Use ff_set_dimensions()

2019-07-19 Thread Michael Niedermayer
Fixes: signed integer overflow: 65313 * 65313 cannot be represented in type 
'int'
Fixes: 
15740/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-5641749164195840

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

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index bc4a17bde0..6e7e13b6eb 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1578,8 +1578,9 @@ static int 
dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
 display_def->width   = bytestream_get_be16(&buf) + 1;
 display_def->height  = bytestream_get_be16(&buf) + 1;
 if (!avctx->width || !avctx->height) {
-avctx->width  = display_def->width;
-avctx->height = display_def->height;
+int ret = ff_set_dimensions(avctx, display_def->width, 
display_def->height);
+if (ret < 0)
+return ret;
 }
 
 if (info_byte & 1<<3) { // display_window_flag
-- 
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 2/3] lavfi: modify avfilter_get_matrix to support separate scale factors

2019-07-19 Thread Jarek Samic
---
 libavfilter/transform.c  | 13 ++---
 libavfilter/transform.h  | 30 +++---
 libavfilter/vf_deshake.c |  7 +--
 3 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/libavfilter/transform.c b/libavfilter/transform.c
index f92fc4d42f..f65de965cd 100644
--- a/libavfilter/transform.c
+++ b/libavfilter/transform.c
@@ -103,12 +103,19 @@ INTERPOLATE_METHOD(interpolate_biquadratic)
 }
 }
 
-void avfilter_get_matrix(float x_shift, float y_shift, float angle, float 
zoom, float *matrix) {
-matrix[0] = zoom * cos(angle);
+void avfilter_get_matrix(
+float x_shift,
+float y_shift,
+float angle,
+float scale_x,
+float scale_y,
+float *matrix
+) {
+matrix[0] = scale_x * cos(angle);
 matrix[1] = -sin(angle);
 matrix[2] = x_shift;
 matrix[3] = -matrix[1];
-matrix[4] = matrix[0];
+matrix[4] = scale_y * cos(angle);
 matrix[5] = y_shift;
 matrix[6] = 0;
 matrix[7] = 0;
diff --git a/libavfilter/transform.h b/libavfilter/transform.h
index 07436bfccb..0bdc9be123 100644
--- a/libavfilter/transform.h
+++ b/libavfilter/transform.h
@@ -60,20 +60,28 @@ enum FillMethod {
 #define FILL_DEFAULT FILL_ORIGINAL
 
 /**
- * Get an affine transformation matrix from a given translation, rotation, and
- * zoom factor. The matrix will look like:
+ * Get an affine transformation matrix from given translation, rotation, and
+ * zoom factors. The matrix will look like:
  *
- * [ zoom * cos(angle),   -sin(angle), x_shift,
- *  sin(angle), zoom * cos(angle), y_shift,
- *   0, 0,   1 ]
+ * [ scale_x * cos(angle),   -sin(angle), x_shift,
+ * sin(angle),  scale_y * cos(angle), y_shift,
+ *  0, 0,   1 ]
  *
- * @param x_shift horizontal translation
- * @param y_shift vertical translation
- * @param angle   rotation in radians
- * @param zoomscale percent (1.0 = 100%)
- * @param matrix  9-item affine transformation matrix
+ * @param x_shift   horizontal translation
+ * @param y_shift   vertical translation
+ * @param angle rotation in radians
+ * @param scale_x   x scale percent (1.0 = 100%)
+ * @param scale_y   y scale percent (1.0 = 100%)
+ * @param matrix9-item affine transformation matrix
  */
-void avfilter_get_matrix(float x_shift, float y_shift, float angle, float 
zoom, float *matrix);
+void avfilter_get_matrix(
+float x_shift,
+float y_shift,
+float angle,
+float scale_x,
+float scale_y,
+float *matrix
+);
 
 /**
  * Add two matrices together. result = m1 + m2.
diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index c8480e74dd..9c89390e36 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -421,6 +421,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 const int chroma_width  = AV_CEIL_RSHIFT(link->w, desc->log2_chroma_w);
 const int chroma_height = AV_CEIL_RSHIFT(link->h, desc->log2_chroma_h);
 int aligned;
+float transform_zoom;
 
 out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
 if (!out) {
@@ -505,10 +506,12 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 deshake->last.angle = t.angle;
 deshake->last.zoom = t.zoom;
 
+transform_zoom = 1.0 + t.zoom / 100.0;
+
 // Generate a luma transformation matrix
-avfilter_get_matrix(t.vec.x, t.vec.y, t.angle, 1.0 + t.zoom / 100.0, 
matrix_y);
+avfilter_get_matrix(t.vec.x, t.vec.y, t.angle, transform_zoom, 
transform_zoom, matrix_y);
 // Generate a chroma transformation matrix
-avfilter_get_matrix(t.vec.x / (link->w / chroma_width), t.vec.y / (link->h 
/ chroma_height), t.angle, 1.0 + t.zoom / 100.0, matrix_uv);
+avfilter_get_matrix(t.vec.x / (link->w / chroma_width), t.vec.y / (link->h 
/ chroma_height), t.angle, transform_zoom, transform_zoom, matrix_uv);
 // Transform the luma and chroma planes
 ret = deshake->transform(link->dst, link->w, link->h, chroma_width, 
chroma_height,
  matrix_y, matrix_uv, INTERPOLATE_BILINEAR, 
deshake->edge, in, out);
-- 
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 3/3] lavfi: add deshake_opencl filter

2019-07-19 Thread Jarek Samic
This filter is the subject of my GSoC project.

This is a video stabilization / deshake filter (name undetermined, feel free to 
discuss) that uses feature
point matching and RANSAC to determine a camera path, smooths the camera path 
with a gaussian filter, and
then applies the new path to the video.

There are a number of debug features that can be turned on (viewing point 
matches, viewing transform
details, viewing average kernel execution times). See the bottom of the file.

The filter is finished feature-wise and therefore ready for some review. There 
are a few things left for
me to do before this can be merged, though:

* Improve performance of the OpenCL kernels (in particular: harris_response and 
match_descriptors)
* See what I can do to improve the RANSAC model generation to reduce the amount 
of jitter in the result
* Clean up the few remaining TODOs

Just keep that in mind.

---
 libavfilter/Makefile|2 +
 libavfilter/allfilters.c|1 +
 libavfilter/opencl/deshake.cl   |  621 ++
 libavfilter/opencl_source.h |1 +
 libavfilter/vf_deshake_opencl.c | 1992 +++
 5 files changed, 2617 insertions(+)
 create mode 100644 libavfilter/opencl/deshake.cl
 create mode 100644 libavfilter/vf_deshake_opencl.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 455c809b15..d167841f44 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -211,6 +211,8 @@ OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER)  += 
vf_deinterlace_vaapi.o vaapi_vpp
 OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
 OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
 OBJS-$(CONFIG_DENOISE_VAAPI_FILTER)  += vf_misc_vaapi.o vaapi_vpp.o
+OBJS-$(CONFIG_DESHAKE_OPENCL_FILTER)+= vf_deshake_opencl.o opencl.o \
+opencl/deshake.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
 OBJS-$(CONFIG_DESPILL_FILTER)+= vf_despill.o
 OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 04a3df7d56..07f27fccdc 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -199,6 +199,7 @@ extern AVFilter ff_vf_delogo;
 extern AVFilter ff_vf_denoise_vaapi;
 extern AVFilter ff_vf_derain;
 extern AVFilter ff_vf_deshake;
+extern AVFilter ff_vf_deshake_opencl;
 extern AVFilter ff_vf_despill;
 extern AVFilter ff_vf_detelecine;
 extern AVFilter ff_vf_dilation;
diff --git a/libavfilter/opencl/deshake.cl b/libavfilter/opencl/deshake.cl
new file mode 100644
index 00..737239f634
--- /dev/null
+++ b/libavfilter/opencl/deshake.cl
@@ -0,0 +1,621 @@
+/*
+ * Copyright (C) 2000, Intel Corporation, all rights reserved.
+ * Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+ * Third party copyrights are property of their respective owners.
+ *
+ * Redistribution and use in source and binary forms, with or without 
modification,
+ * are permitted provided that the following conditions are met:
+ *
+ *   * Redistribution's of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ *   * Redistribution's in binary form must reproduce the above copyright 
notice,
+ * this list of conditions and the following disclaimer in the 
documentation
+ * and/or other materials provided with the distribution.
+ *
+ *   * The name of the copyright holders may not be used to endorse or promote 
products
+ * derived from this software without specific prior written permission.
+ *
+ * This software is provided by the copyright holders and contributors "as is" 
and
+ * any express or implied warranties, including, but not limited to, the 
implied
+ * warranties of merchantability and fitness for a particular purpose are 
disclaimed.
+ * In no event shall the Intel Corporation or contributors be liable for any 
direct,
+ * indirect, incidental, special, exemplary, or consequential damages
+ * (including, but not limited to, procurement of substitute goods or services;
+ * loss of use, data, or profits; or business interruption) however caused
+ * and on any theory of liability, whether in contract, strict liability,
+ * or tort (including negligence or otherwise) arising in any way out of
+ * the use of this software, even if advised of the possibility of such damage.
+ *
+ * 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.
+ *
+ 

[FFmpeg-devel] [PATCH 1/3] lavfi: add utilities to reduce OpenCL boilerplate code

2019-07-19 Thread Jarek Samic
---
 libavfilter/opencl.c |  10 +++
 libavfilter/opencl.h | 142 +--
 2 files changed, 146 insertions(+), 6 deletions(-)

diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c
index 95f0bfc604..8e96543467 100644
--- a/libavfilter/opencl.c
+++ b/libavfilter/opencl.c
@@ -350,3 +350,13 @@ void ff_opencl_print_const_matrix_3x3(AVBPrint *buf, const 
char *name_str,
 }
 av_bprintf(buf, "};\n");
 }
+
+cl_ulong ff_opencl_get_event_time(cl_event event) {
+cl_ulong time_start;
+cl_ulong time_end;
+
+clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_START, 
sizeof(time_start), &time_start, NULL);
+clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_END, sizeof(time_end), 
&time_end, NULL);
+
+return time_end - time_start;
+}
diff --git a/libavfilter/opencl.h b/libavfilter/opencl.h
index 973b6d82dd..7487e60241 100644
--- a/libavfilter/opencl.h
+++ b/libavfilter/opencl.h
@@ -47,6 +47,11 @@ typedef struct OpenCLFilterContext {
 intoutput_height;
 } OpenCLFilterContext;
 
+// Groups together information about a kernel argument
+typedef struct OpenCLKernelArg {
+size_t arg_size;
+const void *arg_val;
+} OpenCLKernelArg;
 
 /**
  * set argument to specific Kernel.
@@ -73,9 +78,26 @@ typedef struct OpenCLFilterContext {
 goto fail; \
 }  \
 } while(0)
+
+/**
+ * Create a kernel with the given name.
+ *
+ * The kernel variable in the context structure must have a name of the form
+ * kernel_.
+ *
+ * The OpenCLFilterContext variable in the context structure must be named ocf.
+ *
+ * Requires the presence of a local cl_int variable named cle and a fail label 
for error
+ * handling.
+ */
+#define CL_CREATE_KERNEL(ctx, kernel_name) do {
 \
+ctx->kernel_ ## kernel_name = clCreateKernel(ctx->ocf.program, 
#kernel_name, &cle); \
+CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create %s kernel: %d.\n", 
#kernel_name, cle); \
+} while(0)
+
 /**
-  * release an OpenCL Kernel
-  */
+ * release an OpenCL Kernel
+ */
 #define CL_RELEASE_KERNEL(k)  \
 do {  \
 if (k) {  \
@@ -87,8 +109,8 @@ do { 
 \
 } while(0)
 
 /**
-  * release an OpenCL Memory Object
-  */
+ * release an OpenCL Memory Object
+ */
 #define CL_RELEASE_MEMORY(m)  \
 do {  \
 if (m) {  \
@@ -100,8 +122,8 @@ do {
  \
 } while(0)
 
 /**
-  * release an OpenCL Command Queue
-  */
+ * release an OpenCL Command Queue
+ */
 #define CL_RELEASE_QUEUE(q)   \
 do {  \
 if (q) {  \
@@ -112,6 +134,108 @@ do {  
\
 } \
 } while(0)
 
+/**
+ * Enqueue a kernel with the given information.
+ *
+ * Kernel arguments are provided as KernelArg structures and are set in the 
order
+ * that they are passed.
+ *
+ * Requires the presence of a local cl_int variable named cle and a fail label 
for error
+ * handling.
+ */
+#define CL_ENQUEUE_KERNEL_WITH_ARGS(queue, kernel, global_work_size, 
local_work_size, event, ...)   \
+do {   
 \
+OpenCLKernelArg args[] = {__VA_ARGS__};
 \
+for (int i = 0; i < FF_ARRAY_ELEMS(args); i++) {   
 \
+cle = clSetKernelArg(kernel, i, args[i].arg_size, args[i].arg_val);
 \
+if (cle != CL_SUCCESS) {   
 \
+av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
 \
+"argument %d: error %d.\n", i, cle);   
 \
+err = AVERROR(EIO);
 \
+goto fail; 
 \
+}  
 \
+}  
 \
+   
 \
+cle = clEnqueueNDRangeKernel(

Re: [FFmpeg-devel] [PATCH v1] filter select - avoid 2 times rounding

2019-07-19 Thread Ulf Zibis

Am 20.07.19 um 00:37 schrieb Hendrik Leppkes:
>> $1 The captain is always right.
>>
>> $2 If the captain fails, see $1.
>>
>> 0 against 327 fails in 2500 frames is a "slightly more favorable
>> result". See my last post from 22:23 CEST.
>>
> The entire point is that your change is not a fix, its a bandaid at best.
I never have talked about a fix. What is the drawback of implementing
such a bandaid?

> The behavior will still depend on many outside factors, like the
> platform, if SSE or x87 FP math is being used, if fast or precise FP
> mode is used by the compiler, and who knows what - because you are
> expecting an equals comparison on a floating point value stemming from
> a division to be true, which will just fail sometimes if one doesn't
> round intentionally to get rid of the inaccuracy introduced by the
> calculation itself.
This is all correct. (the part about intentional rounding I don't
understand, may please give an example)

But keep in mind, that both calculations, the parsing from a string to a
double floating point and the transform oft an integer pts to a double
floating point value happen on the same machine with the same SSE and
x87 FP math and binaries from the same build with the same compiler
mode, so equality of both results is very very likely when doing only
exactly 1 approximation step on both sides.

The point is, that with e.g "10.2" the user is seeing a fixed point
value (= 10,200 ms) which is equivalent to an exact rational value, and
moreover FFmpeg claims to calculate with exact rationals where even
possible. So how should a user come to the idea, that "10.2" becomes
internally corrupted by "stupid" floating point
representation/conversion, and additionally in light of an exact time
base rational representation as e.g. 1/12800 s.
From my point of view it was a half-baked or "lousy" idea to internally
base all values of the select filter on a common double float array
instead on a multityped struct, so honouring that, my patch is indeed a
bandaid, but IMHO really helpful.

If FFmpeg engineers still want to persevere on the "just always
inaccurate" FP representation, why don't they provide a convenient
like(x, y) expression besides eq(x, y)?

-Ulf


___
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] fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale

2019-07-19 Thread Gyan



On 19-07-2019 11:04 PM, Linjie Fu wrote:

Currently, ffmpeg inserts scale filter by default in the filter graph
to force the whole decoded stream to scale into the same size with the
first frame. It's not quite make sense in resolution changing cases if
user wants the rawvideo without any scale.

Using autoscale/noautoscale to indicate whether auto inserting the scale
filter in the filter graph:
 -noautoscale or -autoscale 0:
 disable the default auto scale filter inserting.

Update docs.

Signed-off-by: U. Artie Eoff 
Signed-off-by: Linjie Fu 
---
  doc/ffmpeg.texi | 17 +
  fftools/ffmpeg.c|  1 +
  fftools/ffmpeg.h|  4 
  fftools/ffmpeg_filter.c |  2 +-
  fftools/ffmpeg_opt.c|  8 
  5 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index cd35eb49c8..99121b6981 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -734,10 +734,6 @@ ffmpeg -dump_attachment:t "" -i INPUT
  Technical note -- attachments are implemented as codec extradata, so this
  option can actually be used to extract extradata from any stream, not just
  attachments.
-
-@item -noautorotate
-Disable automatically rotating video based on file metadata.
-
  @end table
  
  @section Video Options

@@ -819,6 +815,19 @@ Create the filtergraph specified by @var{filtergraph} and 
use it to
  filter the stream.
  
  This is an alias for @code{-filter:v}, see the @ref{filter_option,,-filter option}.

+
+@item -autorotate
+Automatically rotate the video according to file metadata. Enabled by
+default, use @option{-noautorotate} to disable it.
+
+@item -autoscale
+Automatically scale the video according to the resolution of first frame.
+Enabled by default, use @option{-noautoscale} to disable it. When autoscale is
+disabled, all output frames might not be in the same resolution and may require
+some additional explicit processing according to your final rendering/output
+destination. Disabling autoscale may not work in all situations. Therefore, it
+is not recommended to disable it unless you really know what you are doing.
+Disable autoscale at your own risk.


Since the auto scaling happens at the end of the graph, what may the 
"additional explicit processing" be?



  @end table
  
  @section Advanced Video options

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 01f04103cf..5d52430b1e 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2133,6 +2133,7 @@ static int ifilter_send_frame(InputFilter *ifilter, 
AVFrame *frame)
  
  /* determine if the parameters for this input changed */

  need_reinit = ifilter->format != frame->format;
+fg->autoscale = ifilter->ist->autoscale;
  
  switch (ifilter->ist->st->codecpar->codec_type) {

  case AVMEDIA_TYPE_AUDIO:
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7b6f802082..1602406581 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -133,6 +133,8 @@ typedef struct OptionsContext {
  intnb_hwaccel_output_formats;
  SpecifierOpt *autorotate;
  intnb_autorotate;
+SpecifierOpt *autoscale;
+intnb_autoscale;
  
  /* output options */

  StreamMap *stream_maps;
@@ -285,6 +287,7 @@ typedef struct FilterGraph {
  
  AVFilterGraph *graph;

  int reconfiguration;
+int autoscale;
  
  InputFilter   **inputs;

  int  nb_inputs;
@@ -335,6 +338,7 @@ typedef struct InputStream {
  int guess_layout_max;
  
  int autorotate;

+int autoscale;
  
  int fix_sub_duration;

  struct { /* previous decoded subtitle and related variables */
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 72838de1e2..2a2eb080eb 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -469,7 +469,7 @@ static int configure_output_video_filter(FilterGraph *fg, 
OutputFilter *ofilter,
  if (ret < 0)
  return ret;
  
-if (ofilter->width || ofilter->height) {

+if ((ofilter->width || ofilter->height) && fg->autoscale) {
  char args[255];
  AVFilterContext *filter;
  AVDictionaryEntry *e = NULL;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f5ca18aa64..41cb676dad 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -742,7 +742,9 @@ static void add_input_streams(OptionsContext *o, 
AVFormatContext *ic)
  MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
  
  ist->autorotate = 1;

+ist->autoscale  = 1;
  MATCH_PER_STREAM_OPT(autorotate, i, ist->autorotate, ic, st);
+MATCH_PER_STREAM_OPT(autoscale, i, ist->autoscale, ic, st);
  
  MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);

  if (codec_tag) {
@@ -3640,6 +3642,12 @@ const OptionDef options[] = {
  { "autorotate",   HAS_ARG | OPT_BOOL | OPT_SPEC |
OPT_EXPERT | OPT_INPUT, 
   { .off = OFFSET(autorotate) },